diff --git a/__fixtures__/v-next/outputicjs/akash/client.ts b/__fixtures__/v-next/outputicjs/akash/client.ts deleted file mode 100644 index aa7b97c030..0000000000 --- a/__fixtures__/v-next/outputicjs/akash/client.ts +++ /dev/null @@ -1,51 +0,0 @@ -import { GeneratedType, Registry, OfflineSigner } from "@cosmjs/proto-signing"; -import { defaultRegistryTypes, AminoTypes, SigningStargateClient } from "@cosmjs/stargate"; -import { HttpEndpoint } from "@cosmjs/tendermint-rpc"; -import * as akashAuditV1beta1AuditRegistry from "./audit/v1beta1/audit.registry"; -import * as akashAuditV1beta2AuditRegistry from "./audit/v1beta2/audit.registry"; -import * as akashCertV1beta2CertRegistry from "./cert/v1beta2/cert.registry"; -import * as akashDeploymentV1beta1DeploymentRegistry from "./deployment/v1beta1/deployment.registry"; -import * as akashDeploymentV1beta2ServiceRegistry from "./deployment/v1beta2/service.registry"; -import * as akashMarketV1beta2ServiceRegistry from "./market/v1beta2/service.registry"; -import * as akashProviderV1beta1ProviderRegistry from "./provider/v1beta1/provider.registry"; -import * as akashProviderV1beta2ProviderRegistry from "./provider/v1beta2/provider.registry"; -export const akashAminoConverters = {}; -export const akashProtoRegistry: ReadonlyArray<[string, GeneratedType]> = [...akashAuditV1beta1AuditRegistry.registry, ...akashAuditV1beta2AuditRegistry.registry, ...akashCertV1beta2CertRegistry.registry, ...akashDeploymentV1beta1DeploymentRegistry.registry, ...akashDeploymentV1beta2ServiceRegistry.registry, ...akashMarketV1beta2ServiceRegistry.registry, ...akashProviderV1beta1ProviderRegistry.registry, ...akashProviderV1beta2ProviderRegistry.registry]; -export const getSigningAkashClientOptions = ({ - defaultTypes = defaultRegistryTypes -}: { - defaultTypes?: ReadonlyArray<[string, GeneratedType]>; -} = {}): { - registry: Registry; - aminoTypes: AminoTypes; -} => { - const registry = new Registry([...defaultTypes, ...akashProtoRegistry]); - const aminoTypes = new AminoTypes({ - ...akashAminoConverters - }); - return { - registry, - aminoTypes - }; -}; -export const getSigningAkashClient = async ({ - rpcEndpoint, - signer, - defaultTypes = defaultRegistryTypes -}: { - rpcEndpoint: string | HttpEndpoint; - signer: OfflineSigner; - defaultTypes?: ReadonlyArray<[string, GeneratedType]>; -}) => { - const { - registry, - aminoTypes - } = getSigningAkashClientOptions({ - 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__/v-next/outputicjs/cosmwasm/client.ts b/__fixtures__/v-next/outputicjs/cosmwasm/client.ts deleted file mode 100644 index b5c061a813..0000000000 --- a/__fixtures__/v-next/outputicjs/cosmwasm/client.ts +++ /dev/null @@ -1,44 +0,0 @@ -import { GeneratedType, Registry, OfflineSigner } from "@cosmjs/proto-signing"; -import { defaultRegistryTypes, AminoTypes, SigningStargateClient } from "@cosmjs/stargate"; -import { HttpEndpoint } from "@cosmjs/tendermint-rpc"; -import * as cosmwasmWasmV1TxRegistry from "./wasm/v1/tx.registry"; -export const cosmwasmAminoConverters = {}; -export const cosmwasmProtoRegistry: ReadonlyArray<[string, GeneratedType]> = [...cosmwasmWasmV1TxRegistry.registry]; -export const getSigningCosmwasmClientOptions = ({ - defaultTypes = defaultRegistryTypes -}: { - defaultTypes?: ReadonlyArray<[string, GeneratedType]>; -} = {}): { - registry: Registry; - aminoTypes: AminoTypes; -} => { - const registry = new Registry([...defaultTypes, ...cosmwasmProtoRegistry]); - const aminoTypes = new AminoTypes({ - ...cosmwasmAminoConverters - }); - return { - registry, - aminoTypes - }; -}; -export const getSigningCosmwasmClient = async ({ - rpcEndpoint, - signer, - defaultTypes = defaultRegistryTypes -}: { - rpcEndpoint: string | HttpEndpoint; - signer: OfflineSigner; - defaultTypes?: ReadonlyArray<[string, GeneratedType]>; -}) => { - const { - registry, - aminoTypes - } = getSigningCosmwasmClientOptions({ - 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__/v-next/outputicjs/evmos/client.ts b/__fixtures__/v-next/outputicjs/evmos/client.ts deleted file mode 100644 index 7ad652c77f..0000000000 --- a/__fixtures__/v-next/outputicjs/evmos/client.ts +++ /dev/null @@ -1,46 +0,0 @@ -import { GeneratedType, Registry, OfflineSigner } from "@cosmjs/proto-signing"; -import { defaultRegistryTypes, AminoTypes, SigningStargateClient } from "@cosmjs/stargate"; -import { HttpEndpoint } from "@cosmjs/tendermint-rpc"; -import * as evmosErc20V1TxRegistry from "./erc20/v1/tx.registry"; -import * as evmosFeesV1TxRegistry from "./fees/v1/tx.registry"; -import * as evmosVestingV1TxRegistry from "./vesting/v1/tx.registry"; -export const evmosAminoConverters = {}; -export const evmosProtoRegistry: ReadonlyArray<[string, GeneratedType]> = [...evmosErc20V1TxRegistry.registry, ...evmosFeesV1TxRegistry.registry, ...evmosVestingV1TxRegistry.registry]; -export const getSigningEvmosClientOptions = ({ - defaultTypes = defaultRegistryTypes -}: { - defaultTypes?: ReadonlyArray<[string, GeneratedType]>; -} = {}): { - registry: Registry; - aminoTypes: AminoTypes; -} => { - const registry = new Registry([...defaultTypes, ...evmosProtoRegistry]); - const aminoTypes = new AminoTypes({ - ...evmosAminoConverters - }); - return { - registry, - aminoTypes - }; -}; -export const getSigningEvmosClient = async ({ - rpcEndpoint, - signer, - defaultTypes = defaultRegistryTypes -}: { - rpcEndpoint: string | HttpEndpoint; - signer: OfflineSigner; - defaultTypes?: ReadonlyArray<[string, GeneratedType]>; -}) => { - const { - registry, - aminoTypes - } = getSigningEvmosClientOptions({ - 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__/v-next/outputicjs/ibc/client.ts b/__fixtures__/v-next/outputicjs/ibc/client.ts deleted file mode 100644 index fe59d969f4..0000000000 --- a/__fixtures__/v-next/outputicjs/ibc/client.ts +++ /dev/null @@ -1,47 +0,0 @@ -import { GeneratedType, Registry, OfflineSigner } from "@cosmjs/proto-signing"; -import { defaultRegistryTypes, AminoTypes, SigningStargateClient } from "@cosmjs/stargate"; -import { HttpEndpoint } from "@cosmjs/tendermint-rpc"; -import * as ibcApplicationsTransferV1TxRegistry from "./applications/transfer/v1/tx.registry"; -import * as ibcCoreChannelV1TxRegistry from "./core/channel/v1/tx.registry"; -import * as ibcCoreClientV1TxRegistry from "./core/client/v1/tx.registry"; -import * as ibcCoreConnectionV1TxRegistry from "./core/connection/v1/tx.registry"; -export const ibcAminoConverters = {}; -export const ibcProtoRegistry: ReadonlyArray<[string, GeneratedType]> = [...ibcApplicationsTransferV1TxRegistry.registry, ...ibcCoreChannelV1TxRegistry.registry, ...ibcCoreClientV1TxRegistry.registry, ...ibcCoreConnectionV1TxRegistry.registry]; -export const getSigningIbcClientOptions = ({ - defaultTypes = defaultRegistryTypes -}: { - defaultTypes?: ReadonlyArray<[string, GeneratedType]>; -} = {}): { - registry: Registry; - aminoTypes: AminoTypes; -} => { - const registry = new Registry([...defaultTypes, ...ibcProtoRegistry]); - const aminoTypes = new AminoTypes({ - ...ibcAminoConverters - }); - return { - registry, - aminoTypes - }; -}; -export const getSigningIbcClient = async ({ - rpcEndpoint, - signer, - defaultTypes = defaultRegistryTypes -}: { - rpcEndpoint: string | HttpEndpoint; - signer: OfflineSigner; - defaultTypes?: ReadonlyArray<[string, GeneratedType]>; -}) => { - const { - registry, - aminoTypes - } = getSigningIbcClientOptions({ - 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__/v-next/outputicjs/osmosis/client.ts b/__fixtures__/v-next/outputicjs/osmosis/client.ts deleted file mode 100644 index 87a5302af2..0000000000 --- a/__fixtures__/v-next/outputicjs/osmosis/client.ts +++ /dev/null @@ -1,50 +0,0 @@ -import { GeneratedType, Registry, OfflineSigner } from "@cosmjs/proto-signing"; -import { defaultRegistryTypes, AminoTypes, SigningStargateClient } from "@cosmjs/stargate"; -import { HttpEndpoint } from "@cosmjs/tendermint-rpc"; -import * as osmosisGammPoolmodelsBalancerTxTxRegistry from "./gamm/pool-models/balancer/tx/tx.registry"; -import * as osmosisGammPoolmodelsStableswapTxRegistry from "./gamm/pool-models/stableswap/tx.registry"; -import * as osmosisGammV1beta1TxRegistry from "./gamm/v1beta1/tx.registry"; -import * as osmosisIncentivesTxRegistry from "./incentives/tx.registry"; -import * as osmosisLockupTxRegistry from "./lockup/tx.registry"; -import * as osmosisSuperfluidTxRegistry from "./superfluid/tx.registry"; -import * as osmosisTokenfactoryV1beta1TxRegistry from "./tokenfactory/v1beta1/tx.registry"; -export const osmosisAminoConverters = {}; -export const osmosisProtoRegistry: ReadonlyArray<[string, GeneratedType]> = [...osmosisGammPoolmodelsBalancerTxTxRegistry.registry, ...osmosisGammPoolmodelsStableswapTxRegistry.registry, ...osmosisGammV1beta1TxRegistry.registry, ...osmosisIncentivesTxRegistry.registry, ...osmosisLockupTxRegistry.registry, ...osmosisSuperfluidTxRegistry.registry, ...osmosisTokenfactoryV1beta1TxRegistry.registry]; -export const getSigningOsmosisClientOptions = ({ - defaultTypes = defaultRegistryTypes -}: { - defaultTypes?: ReadonlyArray<[string, GeneratedType]>; -} = {}): { - registry: Registry; - aminoTypes: AminoTypes; -} => { - const registry = new Registry([...defaultTypes, ...osmosisProtoRegistry]); - const aminoTypes = new AminoTypes({ - ...osmosisAminoConverters - }); - return { - registry, - aminoTypes - }; -}; -export const getSigningOsmosisClient = async ({ - rpcEndpoint, - signer, - defaultTypes = defaultRegistryTypes -}: { - rpcEndpoint: string | HttpEndpoint; - signer: OfflineSigner; - defaultTypes?: ReadonlyArray<[string, GeneratedType]>; -}) => { - const { - registry, - aminoTypes - } = getSigningOsmosisClientOptions({ - 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__/v-next/outputv4/akash/bundle.ts b/__fixtures__/v-next/outputv4/akash/bundle.ts index 845b92822e..e5eece9d00 100644 --- a/__fixtures__/v-next/outputv4/akash/bundle.ts +++ b/__fixtures__/v-next/outputv4/akash/bundle.ts @@ -1,112 +1,113 @@ -import * as _0 from "./audit/v1beta1/audit"; -import * as _1 from "./audit/v1beta2/audit"; -import * as _2 from "./audit/v1beta2/genesis"; -import * as _3 from "./audit/v1beta2/query"; -import * as _4 from "./base/v1beta1/attribute"; -import * as _5 from "./base/v1beta1/endpoint"; -import * as _6 from "./base/v1beta1/resource"; -import * as _7 from "./base/v1beta1/resourcevalue"; -import * as _8 from "./base/v1beta2/attribute"; -import * as _9 from "./base/v1beta2/endpoint"; -import * as _10 from "./base/v1beta2/resource"; -import * as _11 from "./base/v1beta2/resourceunits"; -import * as _12 from "./base/v1beta2/resourcevalue"; -import * as _13 from "./cert/v1beta2/cert"; -import * as _14 from "./cert/v1beta2/genesis"; -import * as _15 from "./cert/v1beta2/query"; -import * as _16 from "./deployment/v1beta1/authz"; -import * as _17 from "./deployment/v1beta1/deployment"; -import * as _18 from "./deployment/v1beta1/genesis"; -import * as _19 from "./deployment/v1beta1/group"; -import * as _20 from "./deployment/v1beta1/params"; -import * as _21 from "./deployment/v1beta1/query"; -import * as _22 from "./deployment/v1beta2/authz"; -import * as _23 from "./deployment/v1beta2/deployment"; -import * as _24 from "./deployment/v1beta2/deploymentmsg"; -import * as _25 from "./deployment/v1beta2/genesis"; -import * as _26 from "./deployment/v1beta2/group"; -import * as _27 from "./deployment/v1beta2/groupid"; -import * as _28 from "./deployment/v1beta2/groupmsg"; -import * as _29 from "./deployment/v1beta2/groupspec"; -import * as _30 from "./deployment/v1beta2/params"; -import * as _31 from "./deployment/v1beta2/query"; -import * as _32 from "./deployment/v1beta2/resource"; -import * as _33 from "./deployment/v1beta2/service"; -import * as _34 from "./escrow/v1beta1/genesis"; -import * as _35 from "./escrow/v1beta1/query"; -import * as _36 from "./escrow/v1beta1/types"; -import * as _37 from "./escrow/v1beta2/genesis"; -import * as _38 from "./escrow/v1beta2/query"; -import * as _39 from "./escrow/v1beta2/types"; -import * as _40 from "./inflation/v1beta2/genesis"; -import * as _41 from "./inflation/v1beta2/params"; -import * as _42 from "./market/v1beta2/bid"; -import * as _43 from "./market/v1beta2/genesis"; -import * as _44 from "./market/v1beta2/lease"; -import * as _45 from "./market/v1beta2/order"; -import * as _46 from "./market/v1beta2/params"; -import * as _47 from "./market/v1beta2/query"; -import * as _48 from "./market/v1beta2/service"; -import * as _49 from "./provider/v1beta1/provider"; -import * as _50 from "./provider/v1beta2/genesis"; -import * as _51 from "./provider/v1beta2/provider"; -import * as _52 from "./provider/v1beta2/query"; -import * as _366 from "./audit/v1beta1/audit.amino"; -import * as _367 from "./audit/v1beta2/audit.amino"; -import * as _368 from "./cert/v1beta2/cert.amino"; -import * as _369 from "./deployment/v1beta2/service.amino"; -import * as _370 from "./market/v1beta2/service.amino"; -import * as _371 from "./provider/v1beta1/provider.amino"; -import * as _372 from "./provider/v1beta2/provider.amino"; -import * as _373 from "./audit/v1beta1/audit.registry"; -import * as _374 from "./audit/v1beta2/audit.registry"; -import * as _375 from "./cert/v1beta2/cert.registry"; -import * as _376 from "./deployment/v1beta2/service.registry"; -import * as _377 from "./market/v1beta2/service.registry"; -import * as _378 from "./provider/v1beta1/provider.registry"; -import * as _379 from "./provider/v1beta2/provider.registry"; -import * as _380 from "./audit/v1beta2/query.lcd"; -import * as _381 from "./cert/v1beta2/query.lcd"; -import * as _382 from "./deployment/v1beta1/query.lcd"; -import * as _383 from "./deployment/v1beta2/query.lcd"; -import * as _384 from "./escrow/v1beta1/query.lcd"; -import * as _385 from "./escrow/v1beta2/query.lcd"; -import * as _386 from "./market/v1beta2/query.lcd"; -import * as _387 from "./provider/v1beta2/query.lcd"; -import * as _388 from "./audit/v1beta2/query.rpc.Query"; -import * as _389 from "./cert/v1beta2/query.rpc.Query"; -import * as _390 from "./deployment/v1beta2/query.rpc.Query"; -import * as _391 from "./escrow/v1beta1/query.rpc.Query"; -import * as _392 from "./escrow/v1beta2/query.rpc.Query"; -import * as _393 from "./market/v1beta2/query.rpc.Query"; -import * as _394 from "./provider/v1beta2/query.rpc.Query"; -import * as _395 from "./audit/v1beta1/audit.rpc.msg"; -import * as _396 from "./audit/v1beta2/audit.rpc.msg"; -import * as _397 from "./cert/v1beta2/cert.rpc.msg"; -import * as _398 from "./deployment/v1beta2/service.rpc.msg"; -import * as _399 from "./market/v1beta2/service.rpc.msg"; -import * as _400 from "./provider/v1beta1/provider.rpc.msg"; -import * as _401 from "./provider/v1beta2/provider.rpc.msg"; -import * as _620 from "./lcd"; -import * as _621 from "./rpc.query"; -import * as _622 from "./rpc.tx"; +import * as _0 from "./audit/v1beta1/audit.js"; +import * as _1 from "./audit/v1beta2/audit.js"; +import * as _2 from "./audit/v1beta2/genesis.js"; +import * as _3 from "./audit/v1beta2/query.js"; +import * as _4 from "./base/v1beta1/attribute.js"; +import * as _5 from "./base/v1beta1/endpoint.js"; +import * as _6 from "./base/v1beta1/resource.js"; +import * as _7 from "./base/v1beta1/resourcevalue.js"; +import * as _8 from "./base/v1beta2/attribute.js"; +import * as _9 from "./base/v1beta2/endpoint.js"; +import * as _10 from "./base/v1beta2/resource.js"; +import * as _11 from "./base/v1beta2/resourceunits.js"; +import * as _12 from "./base/v1beta2/resourcevalue.js"; +import * as _13 from "./cert/v1beta2/cert.js"; +import * as _14 from "./cert/v1beta2/genesis.js"; +import * as _15 from "./cert/v1beta2/query.js"; +import * as _16 from "./deployment/v1beta1/authz.js"; +import * as _17 from "./deployment/v1beta1/deployment.js"; +import * as _18 from "./deployment/v1beta1/genesis.js"; +import * as _19 from "./deployment/v1beta1/group.js"; +import * as _20 from "./deployment/v1beta1/params.js"; +import * as _21 from "./deployment/v1beta1/query.js"; +import * as _22 from "./deployment/v1beta2/authz.js"; +import * as _23 from "./deployment/v1beta2/deployment.js"; +import * as _24 from "./deployment/v1beta2/deploymentmsg.js"; +import * as _25 from "./deployment/v1beta2/genesis.js"; +import * as _26 from "./deployment/v1beta2/group.js"; +import * as _27 from "./deployment/v1beta2/groupid.js"; +import * as _28 from "./deployment/v1beta2/groupmsg.js"; +import * as _29 from "./deployment/v1beta2/groupspec.js"; +import * as _30 from "./deployment/v1beta2/params.js"; +import * as _31 from "./deployment/v1beta2/query.js"; +import * as _32 from "./deployment/v1beta2/resource.js"; +import * as _33 from "./deployment/v1beta2/service.js"; +import * as _34 from "./escrow/v1beta1/genesis.js"; +import * as _35 from "./escrow/v1beta1/query.js"; +import * as _36 from "./escrow/v1beta1/types.js"; +import * as _37 from "./escrow/v1beta2/genesis.js"; +import * as _38 from "./escrow/v1beta2/query.js"; +import * as _39 from "./escrow/v1beta2/types.js"; +import * as _40 from "./inflation/v1beta2/genesis.js"; +import * as _41 from "./inflation/v1beta2/params.js"; +import * as _42 from "./market/v1beta2/bid.js"; +import * as _43 from "./market/v1beta2/genesis.js"; +import * as _44 from "./market/v1beta2/lease.js"; +import * as _45 from "./market/v1beta2/order.js"; +import * as _46 from "./market/v1beta2/params.js"; +import * as _47 from "./market/v1beta2/query.js"; +import * as _48 from "./market/v1beta2/service.js"; +import * as _49 from "./provider/v1beta1/provider.js"; +import * as _50 from "./provider/v1beta2/genesis.js"; +import * as _51 from "./provider/v1beta2/provider.js"; +import * as _52 from "./provider/v1beta2/query.js"; +import * as _316 from "./audit/v1beta1/audit.amino.js"; +import * as _317 from "./audit/v1beta2/audit.amino.js"; +import * as _318 from "./cert/v1beta2/cert.amino.js"; +import * as _319 from "./deployment/v1beta2/service.amino.js"; +import * as _320 from "./market/v1beta2/service.amino.js"; +import * as _321 from "./provider/v1beta1/provider.amino.js"; +import * as _322 from "./provider/v1beta2/provider.amino.js"; +import * as _323 from "./audit/v1beta1/audit.registry.js"; +import * as _324 from "./audit/v1beta2/audit.registry.js"; +import * as _325 from "./cert/v1beta2/cert.registry.js"; +import * as _326 from "./deployment/v1beta2/service.registry.js"; +import * as _327 from "./market/v1beta2/service.registry.js"; +import * as _328 from "./provider/v1beta1/provider.registry.js"; +import * as _329 from "./provider/v1beta2/provider.registry.js"; +import * as _330 from "./audit/v1beta2/query.lcd.js"; +import * as _331 from "./cert/v1beta2/query.lcd.js"; +import * as _332 from "./deployment/v1beta1/query.lcd.js"; +import * as _333 from "./deployment/v1beta2/query.lcd.js"; +import * as _334 from "./escrow/v1beta1/query.lcd.js"; +import * as _335 from "./escrow/v1beta2/query.lcd.js"; +import * as _336 from "./market/v1beta2/query.lcd.js"; +import * as _337 from "./provider/v1beta2/query.lcd.js"; +import * as _338 from "./audit/v1beta2/query.rpc.Query.js"; +import * as _339 from "./cert/v1beta2/query.rpc.Query.js"; +import * as _340 from "./deployment/v1beta2/query.rpc.Query.js"; +import * as _341 from "./escrow/v1beta1/query.rpc.Query.js"; +import * as _342 from "./escrow/v1beta2/query.rpc.Query.js"; +import * as _343 from "./market/v1beta2/query.rpc.Query.js"; +import * as _344 from "./provider/v1beta2/query.rpc.Query.js"; +import * as _345 from "./audit/v1beta1/audit.rpc.msg.js"; +import * as _346 from "./audit/v1beta2/audit.rpc.msg.js"; +import * as _347 from "./cert/v1beta2/cert.rpc.msg.js"; +import * as _348 from "./deployment/v1beta2/service.rpc.msg.js"; +import * as _349 from "./market/v1beta2/service.rpc.msg.js"; +import * as _350 from "./provider/v1beta1/provider.rpc.msg.js"; +import * as _351 from "./provider/v1beta2/provider.rpc.msg.js"; +import * as _352 from "./cert/v1beta2/query.pinia.store.js"; +import * as _536 from "./lcd.js"; +import * as _537 from "./rpc.query.js"; +import * as _538 from "./rpc.tx.js"; export namespace akash { export namespace audit { export const v1beta1 = { ..._0, - ..._366, - ..._373, - ..._395 + ..._316, + ..._323, + ..._345 }; export const v1beta2 = { ..._1, ..._2, ..._3, - ..._367, - ..._374, - ..._380, - ..._388, - ..._396 + ..._317, + ..._324, + ..._330, + ..._338, + ..._346 }; } export namespace base { @@ -129,11 +130,12 @@ export namespace akash { ..._13, ..._14, ..._15, - ..._368, - ..._375, - ..._381, - ..._389, - ..._397 + ..._318, + ..._325, + ..._331, + ..._339, + ..._347, + ..._352 }; } export namespace deployment { @@ -144,7 +146,7 @@ export namespace akash { ..._19, ..._20, ..._21, - ..._382 + ..._332 }; export const v1beta2 = { ..._22, @@ -159,11 +161,11 @@ export namespace akash { ..._31, ..._32, ..._33, - ..._369, - ..._376, - ..._383, - ..._390, - ..._398 + ..._319, + ..._326, + ..._333, + ..._340, + ..._348 }; } export namespace escrow { @@ -171,15 +173,15 @@ export namespace akash { ..._34, ..._35, ..._36, - ..._384, - ..._391 + ..._334, + ..._341 }; export const v1beta2 = { ..._37, ..._38, ..._39, - ..._385, - ..._392 + ..._335, + ..._342 }; } export namespace inflation { @@ -197,34 +199,34 @@ export namespace akash { ..._46, ..._47, ..._48, - ..._370, - ..._377, - ..._386, - ..._393, - ..._399 + ..._320, + ..._327, + ..._336, + ..._343, + ..._349 }; } export namespace provider { export const v1beta1 = { ..._49, - ..._371, - ..._378, - ..._400 + ..._321, + ..._328, + ..._350 }; export const v1beta2 = { ..._50, ..._51, ..._52, - ..._372, - ..._379, - ..._387, - ..._394, - ..._401 + ..._322, + ..._329, + ..._337, + ..._344, + ..._351 }; } export const ClientFactory = { - ..._620, - ..._621, - ..._622 + ..._536, + ..._537, + ..._538 }; } \ No newline at end of file diff --git a/__fixtures__/v-next/outputv4/akash/lcd.ts b/__fixtures__/v-next/outputv4/akash/lcd.ts index 66a438a113..00e538ff1b 100644 --- a/__fixtures__/v-next/outputv4/akash/lcd.ts +++ b/__fixtures__/v-next/outputv4/akash/lcd.ts @@ -75,11 +75,6 @@ export const createLCDClient = async ({ v1beta1: new (await import("../cosmos/base/tendermint/v1beta1/query.lcd")).LCDQueryClient({ requestClient }) - }, - node: { - v1beta1: new (await import("../cosmos/base/node/v1beta1/query.lcd")).LCDQueryClient({ - requestClient - }) } }, distribution: { diff --git a/__fixtures__/v-next/outputv4/akash/rpc.query.ts b/__fixtures__/v-next/outputv4/akash/rpc.query.ts index 6fc8c9cfec..a55e40d7f3 100644 --- a/__fixtures__/v-next/outputv4/akash/rpc.query.ts +++ b/__fixtures__/v-next/outputv4/akash/rpc.query.ts @@ -1,96 +1,93 @@ -import { Rpc } from "../helpers"; -import { Tendermint34Client, HttpEndpoint } from "@cosmjs/tendermint-rpc"; +import { Rpc } from "../helpers.js"; +import { connectComet, HttpEndpoint } from "@cosmjs/tendermint-rpc"; import { QueryClient } from "@cosmjs/stargate"; export const createRPCQueryClient = async ({ rpcEndpoint }: { rpcEndpoint: string | HttpEndpoint; }) => { - const tmClient = await Tendermint34Client.connect(rpcEndpoint); + const tmClient = await connectComet(rpcEndpoint); const client = new QueryClient(tmClient); return { akash: { audit: { - v1beta2: (await import("./audit/v1beta2/query.rpc.Query")).createRpcQueryExtension(client) + v1beta2: (await import("./audit/v1beta2/query.rpc.Query.js")).createRpcQueryExtension(client) }, cert: { - v1beta2: (await import("./cert/v1beta2/query.rpc.Query")).createRpcQueryExtension(client) + v1beta2: (await import("./cert/v1beta2/query.rpc.Query.js")).createRpcQueryExtension(client) }, deployment: { - v1beta2: (await import("./deployment/v1beta2/query.rpc.Query")).createRpcQueryExtension(client) + v1beta2: (await import("./deployment/v1beta2/query.rpc.Query.js")).createRpcQueryExtension(client) }, escrow: { - v1beta1: (await import("./escrow/v1beta1/query.rpc.Query")).createRpcQueryExtension(client), - v1beta2: (await import("./escrow/v1beta2/query.rpc.Query")).createRpcQueryExtension(client) + v1beta1: (await import("./escrow/v1beta1/query.rpc.Query.js")).createRpcQueryExtension(client), + v1beta2: (await import("./escrow/v1beta2/query.rpc.Query.js")).createRpcQueryExtension(client) }, market: { - v1beta2: (await import("./market/v1beta2/query.rpc.Query")).createRpcQueryExtension(client) + v1beta2: (await import("./market/v1beta2/query.rpc.Query.js")).createRpcQueryExtension(client) }, provider: { - v1beta2: (await import("./provider/v1beta2/query.rpc.Query")).createRpcQueryExtension(client) + v1beta2: (await import("./provider/v1beta2/query.rpc.Query.js")).createRpcQueryExtension(client) } }, cosmos: { app: { - v1alpha1: (await import("../cosmos/app/v1alpha1/query.rpc.Query")).createRpcQueryExtension(client) + v1alpha1: (await import("../cosmos/app/v1alpha1/query.rpc.Query.js")).createRpcQueryExtension(client) }, auth: { - v1beta1: (await import("../cosmos/auth/v1beta1/query.rpc.Query")).createRpcQueryExtension(client) + v1beta1: (await import("../cosmos/auth/v1beta1/query.rpc.Query.js")).createRpcQueryExtension(client) }, authz: { - v1beta1: (await import("../cosmos/authz/v1beta1/query.rpc.Query")).createRpcQueryExtension(client) + v1beta1: (await import("../cosmos/authz/v1beta1/query.rpc.Query.js")).createRpcQueryExtension(client) }, bank: { - v1beta1: (await import("../cosmos/bank/v1beta1/query.rpc.Query")).createRpcQueryExtension(client) + v1beta1: (await import("../cosmos/bank/v1beta1/query.rpc.Query.js")).createRpcQueryExtension(client) }, base: { reflection: { - v1beta1: (await import("../cosmos/base/reflection/v1beta1/reflection.rpc.ReflectionService")).createRpcQueryExtension(client), - v2alpha1: (await import("../cosmos/base/reflection/v2alpha1/reflection.rpc.ReflectionService")).createRpcQueryExtension(client) + v1beta1: (await import("../cosmos/base/reflection/v1beta1/reflection.rpc.ReflectionService.js")).createRpcQueryExtension(client), + v2alpha1: (await import("../cosmos/base/reflection/v2alpha1/reflection.rpc.ReflectionService.js")).createRpcQueryExtension(client) }, tendermint: { - v1beta1: (await import("../cosmos/base/tendermint/v1beta1/query.rpc.Service")).createRpcQueryExtension(client) - }, - node: { - v1beta1: (await import("../cosmos/base/node/v1beta1/query.rpc.Service")).createRpcQueryExtension(client) + v1beta1: (await import("../cosmos/base/tendermint/v1beta1/query.rpc.Service.js")).createRpcQueryExtension(client) } }, distribution: { - v1beta1: (await import("../cosmos/distribution/v1beta1/query.rpc.Query")).createRpcQueryExtension(client) + v1beta1: (await import("../cosmos/distribution/v1beta1/query.rpc.Query.js")).createRpcQueryExtension(client) }, evidence: { - v1beta1: (await import("../cosmos/evidence/v1beta1/query.rpc.Query")).createRpcQueryExtension(client) + v1beta1: (await import("../cosmos/evidence/v1beta1/query.rpc.Query.js")).createRpcQueryExtension(client) }, feegrant: { - v1beta1: (await import("../cosmos/feegrant/v1beta1/query.rpc.Query")).createRpcQueryExtension(client) + v1beta1: (await import("../cosmos/feegrant/v1beta1/query.rpc.Query.js")).createRpcQueryExtension(client) }, gov: { - v1: (await import("../cosmos/gov/v1/query.rpc.Query")).createRpcQueryExtension(client), - v1beta1: (await import("../cosmos/gov/v1beta1/query.rpc.Query")).createRpcQueryExtension(client) + v1: (await import("../cosmos/gov/v1/query.rpc.Query.js")).createRpcQueryExtension(client), + v1beta1: (await import("../cosmos/gov/v1beta1/query.rpc.Query.js")).createRpcQueryExtension(client) }, group: { - v1: (await import("../cosmos/group/v1/query.rpc.Query")).createRpcQueryExtension(client) + v1: (await import("../cosmos/group/v1/query.rpc.Query.js")).createRpcQueryExtension(client) }, mint: { - v1beta1: (await import("../cosmos/mint/v1beta1/query.rpc.Query")).createRpcQueryExtension(client) + v1beta1: (await import("../cosmos/mint/v1beta1/query.rpc.Query.js")).createRpcQueryExtension(client) }, nft: { - v1beta1: (await import("../cosmos/nft/v1beta1/query.rpc.Query")).createRpcQueryExtension(client) + v1beta1: (await import("../cosmos/nft/v1beta1/query.rpc.Query.js")).createRpcQueryExtension(client) }, params: { - v1beta1: (await import("../cosmos/params/v1beta1/query.rpc.Query")).createRpcQueryExtension(client) + v1beta1: (await import("../cosmos/params/v1beta1/query.rpc.Query.js")).createRpcQueryExtension(client) }, slashing: { - v1beta1: (await import("../cosmos/slashing/v1beta1/query.rpc.Query")).createRpcQueryExtension(client) + v1beta1: (await import("../cosmos/slashing/v1beta1/query.rpc.Query.js")).createRpcQueryExtension(client) }, staking: { - v1beta1: (await import("../cosmos/staking/v1beta1/query.rpc.Query")).createRpcQueryExtension(client) + v1beta1: (await import("../cosmos/staking/v1beta1/query.rpc.Query.js")).createRpcQueryExtension(client) }, tx: { - v1beta1: (await import("../cosmos/tx/v1beta1/service.rpc.Service")).createRpcQueryExtension(client) + v1beta1: (await import("../cosmos/tx/v1beta1/service.rpc.Service.js")).createRpcQueryExtension(client) }, upgrade: { - v1beta1: (await import("../cosmos/upgrade/v1beta1/query.rpc.Query")).createRpcQueryExtension(client) + v1beta1: (await import("../cosmos/upgrade/v1beta1/query.rpc.Query.js")).createRpcQueryExtension(client) } } }; diff --git a/__fixtures__/v-next/outputv4/akash/rpc.tx.ts b/__fixtures__/v-next/outputv4/akash/rpc.tx.ts index 3e11aa81ec..2295931723 100644 --- a/__fixtures__/v-next/outputv4/akash/rpc.tx.ts +++ b/__fixtures__/v-next/outputv4/akash/rpc.tx.ts @@ -1,4 +1,4 @@ -import { Rpc } from "../helpers"; +import { Rpc } from "../helpers.js"; export const createRPCMsgClient = async ({ rpc }: { @@ -6,63 +6,63 @@ export const createRPCMsgClient = async ({ }) => ({ akash: { audit: { - v1beta1: new (await import("./audit/v1beta1/audit.rpc.msg")).MsgClientImpl(rpc), - v1beta2: new (await import("./audit/v1beta2/audit.rpc.msg")).MsgClientImpl(rpc) + v1beta1: new (await import("./audit/v1beta1/audit.rpc.msg.js")).MsgClientImpl(rpc), + v1beta2: new (await import("./audit/v1beta2/audit.rpc.msg.js")).MsgClientImpl(rpc) }, cert: { - v1beta2: new (await import("./cert/v1beta2/cert.rpc.msg")).MsgClientImpl(rpc) + v1beta2: new (await import("./cert/v1beta2/cert.rpc.msg.js")).MsgClientImpl(rpc) }, deployment: { - v1beta2: new (await import("./deployment/v1beta2/service.rpc.msg")).MsgClientImpl(rpc) + v1beta2: new (await import("./deployment/v1beta2/service.rpc.msg.js")).MsgClientImpl(rpc) }, market: { - v1beta2: new (await import("./market/v1beta2/service.rpc.msg")).MsgClientImpl(rpc) + v1beta2: new (await import("./market/v1beta2/service.rpc.msg.js")).MsgClientImpl(rpc) }, provider: { - v1beta1: new (await import("./provider/v1beta1/provider.rpc.msg")).MsgClientImpl(rpc), - v1beta2: new (await import("./provider/v1beta2/provider.rpc.msg")).MsgClientImpl(rpc) + v1beta1: new (await import("./provider/v1beta1/provider.rpc.msg.js")).MsgClientImpl(rpc), + v1beta2: new (await import("./provider/v1beta2/provider.rpc.msg.js")).MsgClientImpl(rpc) } }, cosmos: { authz: { - v1beta1: new (await import("../cosmos/authz/v1beta1/tx.rpc.msg")).MsgClientImpl(rpc) + v1beta1: new (await import("../cosmos/authz/v1beta1/tx.rpc.msg.js")).MsgClientImpl(rpc) }, bank: { - v1beta1: new (await import("../cosmos/bank/v1beta1/tx.rpc.msg")).MsgClientImpl(rpc) + v1beta1: new (await import("../cosmos/bank/v1beta1/tx.rpc.msg.js")).MsgClientImpl(rpc) }, crisis: { - v1beta1: new (await import("../cosmos/crisis/v1beta1/tx.rpc.msg")).MsgClientImpl(rpc) + v1beta1: new (await import("../cosmos/crisis/v1beta1/tx.rpc.msg.js")).MsgClientImpl(rpc) }, distribution: { - v1beta1: new (await import("../cosmos/distribution/v1beta1/tx.rpc.msg")).MsgClientImpl(rpc) + v1beta1: new (await import("../cosmos/distribution/v1beta1/tx.rpc.msg.js")).MsgClientImpl(rpc) }, evidence: { - v1beta1: new (await import("../cosmos/evidence/v1beta1/tx.rpc.msg")).MsgClientImpl(rpc) + v1beta1: new (await import("../cosmos/evidence/v1beta1/tx.rpc.msg.js")).MsgClientImpl(rpc) }, feegrant: { - v1beta1: new (await import("../cosmos/feegrant/v1beta1/tx.rpc.msg")).MsgClientImpl(rpc) + v1beta1: new (await import("../cosmos/feegrant/v1beta1/tx.rpc.msg.js")).MsgClientImpl(rpc) }, gov: { - v1: new (await import("../cosmos/gov/v1/tx.rpc.msg")).MsgClientImpl(rpc), - v1beta1: new (await import("../cosmos/gov/v1beta1/tx.rpc.msg")).MsgClientImpl(rpc) + v1: new (await import("../cosmos/gov/v1/tx.rpc.msg.js")).MsgClientImpl(rpc), + v1beta1: new (await import("../cosmos/gov/v1beta1/tx.rpc.msg.js")).MsgClientImpl(rpc) }, group: { - v1: new (await import("../cosmos/group/v1/tx.rpc.msg")).MsgClientImpl(rpc) + v1: new (await import("../cosmos/group/v1/tx.rpc.msg.js")).MsgClientImpl(rpc) }, nft: { - v1beta1: new (await import("../cosmos/nft/v1beta1/tx.rpc.msg")).MsgClientImpl(rpc) + v1beta1: new (await import("../cosmos/nft/v1beta1/tx.rpc.msg.js")).MsgClientImpl(rpc) }, slashing: { - v1beta1: new (await import("../cosmos/slashing/v1beta1/tx.rpc.msg")).MsgClientImpl(rpc) + v1beta1: new (await import("../cosmos/slashing/v1beta1/tx.rpc.msg.js")).MsgClientImpl(rpc) }, staking: { - v1beta1: new (await import("../cosmos/staking/v1beta1/tx.rpc.msg")).MsgClientImpl(rpc) + v1beta1: new (await import("../cosmos/staking/v1beta1/tx.rpc.msg.js")).MsgClientImpl(rpc) }, upgrade: { - v1beta1: new (await import("../cosmos/upgrade/v1beta1/tx.rpc.msg")).MsgClientImpl(rpc) + v1beta1: new (await import("../cosmos/upgrade/v1beta1/tx.rpc.msg.js")).MsgClientImpl(rpc) }, vesting: { - v1beta1: new (await import("../cosmos/vesting/v1beta1/tx.rpc.msg")).MsgClientImpl(rpc) + v1beta1: new (await import("../cosmos/vesting/v1beta1/tx.rpc.msg.js")).MsgClientImpl(rpc) } } }); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv4/amino/amino.ts b/__fixtures__/v-next/outputv4/amino/amino.ts deleted file mode 100644 index 693da49fc4..0000000000 --- a/__fixtures__/v-next/outputv4/amino/amino.ts +++ /dev/null @@ -1 +0,0 @@ -export {} \ No newline at end of file diff --git a/__fixtures__/v-next/outputv4/amino/bundle.ts b/__fixtures__/v-next/outputv4/amino/bundle.ts deleted file mode 100644 index e64aa1df44..0000000000 --- a/__fixtures__/v-next/outputv4/amino/bundle.ts +++ /dev/null @@ -1,4 +0,0 @@ -import * as _363 from "./amino"; -export const amino = { - ..._363 -}; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv4/binary.ts b/__fixtures__/v-next/outputv4/binary.ts index 85549bde0e..fbcdd5dade 100644 --- a/__fixtures__/v-next/outputv4/binary.ts +++ b/__fixtures__/v-next/outputv4/binary.ts @@ -39,7 +39,7 @@ // 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 { utf8Length, utf8Read, utf8Write } from "./utf8.js"; import { int64ToString, readInt32, @@ -55,7 +55,7 @@ import { writeByte, zzDecode, zzEncode, -} from "./varint"; +} from "./varint.js"; export enum WireType { Varint = 0, diff --git a/__fixtures__/v-next/outputv4/capability/bundle.ts b/__fixtures__/v-next/outputv4/capability/bundle.ts deleted file mode 100644 index 9272c4b5ea..0000000000 --- a/__fixtures__/v-next/outputv4/capability/bundle.ts +++ /dev/null @@ -1,8 +0,0 @@ -import * as _364 from "./v1/capability"; -import * as _365 from "./v1/genesis"; -export namespace capability { - export const v1 = { - ..._364, - ..._365 - }; -} \ No newline at end of file diff --git a/__fixtures__/v-next/outputv4/capability/v1/capability.ts b/__fixtures__/v-next/outputv4/capability/v1/capability.ts deleted file mode 100644 index 14d6ef040f..0000000000 --- a/__fixtures__/v-next/outputv4/capability/v1/capability.ts +++ /dev/null @@ -1,362 +0,0 @@ -import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial } from "../../helpers"; -import { JsonSafe } from "../../json-safe"; -import { ComputedRef } from "vue"; -export const protobufPackage = "capability.v1"; -/** - * Capability defines an implementation of an object capability. The index - * provided to a Capability must be globally unique. - */ -export interface Capability { - index: bigint; -} -export interface ReactiveCapability { - index: ComputedRef; -} -export interface CapabilityProtoMsg { - typeUrl: "/capability.v1.Capability"; - value: Uint8Array; -} -/** - * Capability defines an implementation of an object capability. The index - * provided to a Capability must be globally unique. - */ -export interface CapabilitySDKType { - index: bigint; -} -/** - * Owner defines a single capability owner. An owner is defined by the name of - * capability and the module name. - */ -export interface Owner { - module: string; - name: string; -} -export interface ReactiveOwner { - module: ComputedRef; - name: ComputedRef; -} -export interface OwnerProtoMsg { - typeUrl: "/capability.v1.Owner"; - value: Uint8Array; -} -/** - * Owner defines a single capability owner. An owner is defined by the name of - * capability and the module name. - */ -export interface OwnerSDKType { - module: string; - name: string; -} -/** - * CapabilityOwners defines a set of owners of a single Capability. The set of - * owners must be unique. - */ -export interface CapabilityOwners { - owners: Owner[]; -} -export interface ReactiveCapabilityOwners { - owners: ComputedRef; -} -export interface CapabilityOwnersProtoMsg { - typeUrl: "/capability.v1.CapabilityOwners"; - value: Uint8Array; -} -/** - * CapabilityOwners defines a set of owners of a single Capability. The set of - * owners must be unique. - */ -export interface CapabilityOwnersSDKType { - owners: OwnerSDKType[]; -} -function createBaseCapability(): Capability { - return { - index: BigInt(0) - }; -} -export const Capability = { - typeUrl: "/capability.v1.Capability", - encode(message: Capability, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.index !== BigInt(0)) { - writer.uint32(8).uint64(message.index); - } - return writer; - }, - decode(input: BinaryReader | Uint8Array, length?: number): Capability { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseCapability(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.index = reader.uint64(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - fromJSON(object: any): Capability { - return { - index: isSet(object.index) ? BigInt(object.index.toString()) : BigInt(0) - }; - }, - toJSON(message: Capability): JsonSafe { - const obj: any = {}; - message.index !== undefined && (obj.index = (message.index || BigInt(0)).toString()); - return obj; - }, - fromPartial(object: DeepPartial): Capability { - const message = createBaseCapability(); - message.index = object.index !== undefined && object.index !== null ? BigInt(object.index.toString()) : BigInt(0); - return message; - }, - fromSDK(object: CapabilitySDKType): Capability { - return { - index: object?.index - }; - }, - fromSDKJSON(object: any): CapabilitySDKType { - return { - index: isSet(object.index) ? BigInt(object.index.toString()) : BigInt(0) - }; - }, - toSDK(message: Capability): CapabilitySDKType { - const obj: any = {}; - obj.index = message.index; - return obj; - }, - fromAmino(object: CapabilityAmino): Capability { - const message = createBaseCapability(); - if (object.index !== undefined && object.index !== null) { - message.index = BigInt(object.index); - } - return message; - }, - toAmino(message: Capability): CapabilityAmino { - const obj: any = {}; - obj.index = message.index !== BigInt(0) ? message.index?.toString() : undefined; - return obj; - }, - fromAminoMsg(object: CapabilityAminoMsg): Capability { - return Capability.fromAmino(object.value); - }, - fromProtoMsg(message: CapabilityProtoMsg): Capability { - return Capability.decode(message.value); - }, - toProto(message: Capability): Uint8Array { - return Capability.encode(message).finish(); - }, - toProtoMsg(message: Capability): CapabilityProtoMsg { - return { - typeUrl: "/capability.v1.Capability", - value: Capability.encode(message).finish() - }; - } -}; -function createBaseOwner(): Owner { - return { - module: "", - name: "" - }; -} -export const Owner = { - typeUrl: "/capability.v1.Owner", - encode(message: Owner, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.module !== "") { - writer.uint32(10).string(message.module); - } - if (message.name !== "") { - writer.uint32(18).string(message.name); - } - return writer; - }, - decode(input: BinaryReader | Uint8Array, length?: number): Owner { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseOwner(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.module = reader.string(); - break; - case 2: - message.name = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - fromJSON(object: any): Owner { - return { - module: isSet(object.module) ? String(object.module) : "", - name: isSet(object.name) ? String(object.name) : "" - }; - }, - toJSON(message: Owner): JsonSafe { - const obj: any = {}; - message.module !== undefined && (obj.module = message.module); - message.name !== undefined && (obj.name = message.name); - return obj; - }, - fromPartial(object: DeepPartial): Owner { - const message = createBaseOwner(); - message.module = object.module ?? ""; - message.name = object.name ?? ""; - return message; - }, - fromSDK(object: OwnerSDKType): Owner { - return { - module: object?.module, - name: object?.name - }; - }, - fromSDKJSON(object: any): OwnerSDKType { - return { - module: isSet(object.module) ? String(object.module) : "", - name: isSet(object.name) ? String(object.name) : "" - }; - }, - toSDK(message: Owner): OwnerSDKType { - const obj: any = {}; - obj.module = message.module; - obj.name = message.name; - return obj; - }, - fromAmino(object: OwnerAmino): Owner { - const message = createBaseOwner(); - if (object.module !== undefined && object.module !== null) { - message.module = object.module; - } - if (object.name !== undefined && object.name !== null) { - message.name = object.name; - } - return message; - }, - toAmino(message: Owner): OwnerAmino { - const obj: any = {}; - obj.module = message.module === "" ? undefined : message.module; - obj.name = message.name === "" ? undefined : message.name; - return obj; - }, - fromAminoMsg(object: OwnerAminoMsg): Owner { - return Owner.fromAmino(object.value); - }, - fromProtoMsg(message: OwnerProtoMsg): Owner { - return Owner.decode(message.value); - }, - toProto(message: Owner): Uint8Array { - return Owner.encode(message).finish(); - }, - toProtoMsg(message: Owner): OwnerProtoMsg { - return { - typeUrl: "/capability.v1.Owner", - value: Owner.encode(message).finish() - }; - } -}; -function createBaseCapabilityOwners(): CapabilityOwners { - return { - owners: [] - }; -} -export const CapabilityOwners = { - typeUrl: "/capability.v1.CapabilityOwners", - encode(message: CapabilityOwners, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - for (const v of message.owners) { - Owner.encode(v!, writer.uint32(10).fork()).ldelim(); - } - return writer; - }, - decode(input: BinaryReader | Uint8Array, length?: number): CapabilityOwners { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseCapabilityOwners(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.owners.push(Owner.decode(reader, reader.uint32())); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - fromJSON(object: any): CapabilityOwners { - return { - owners: Array.isArray(object?.owners) ? object.owners.map((e: any) => Owner.fromJSON(e)) : [] - }; - }, - toJSON(message: CapabilityOwners): JsonSafe { - const obj: any = {}; - if (message.owners) { - obj.owners = message.owners.map(e => e ? Owner.toJSON(e) : undefined); - } else { - obj.owners = []; - } - return obj; - }, - fromPartial(object: DeepPartial): CapabilityOwners { - const message = createBaseCapabilityOwners(); - message.owners = object.owners?.map(e => Owner.fromPartial(e)) || []; - return message; - }, - fromSDK(object: CapabilityOwnersSDKType): CapabilityOwners { - return { - owners: Array.isArray(object?.owners) ? object.owners.map((e: any) => Owner.fromSDK(e)) : [] - }; - }, - fromSDKJSON(object: any): CapabilityOwnersSDKType { - return { - owners: Array.isArray(object?.owners) ? object.owners.map((e: any) => Owner.fromSDKJSON(e)) : [] - }; - }, - toSDK(message: CapabilityOwners): CapabilityOwnersSDKType { - const obj: any = {}; - if (message.owners) { - obj.owners = message.owners.map(e => e ? Owner.toSDK(e) : undefined); - } else { - obj.owners = []; - } - return obj; - }, - fromAmino(object: CapabilityOwnersAmino): CapabilityOwners { - const message = createBaseCapabilityOwners(); - message.owners = object.owners?.map(e => Owner.fromAmino(e)) || []; - return message; - }, - toAmino(message: CapabilityOwners): CapabilityOwnersAmino { - const obj: any = {}; - if (message.owners) { - obj.owners = message.owners.map(e => e ? Owner.toAmino(e) : undefined); - } else { - obj.owners = message.owners; - } - return obj; - }, - fromAminoMsg(object: CapabilityOwnersAminoMsg): CapabilityOwners { - return CapabilityOwners.fromAmino(object.value); - }, - fromProtoMsg(message: CapabilityOwnersProtoMsg): CapabilityOwners { - return CapabilityOwners.decode(message.value); - }, - toProto(message: CapabilityOwners): Uint8Array { - return CapabilityOwners.encode(message).finish(); - }, - toProtoMsg(message: CapabilityOwners): CapabilityOwnersProtoMsg { - return { - typeUrl: "/capability.v1.CapabilityOwners", - value: CapabilityOwners.encode(message).finish() - }; - } -}; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv4/capability/v1/genesis.ts b/__fixtures__/v-next/outputv4/capability/v1/genesis.ts deleted file mode 100644 index f3492699ac..0000000000 --- a/__fixtures__/v-next/outputv4/capability/v1/genesis.ts +++ /dev/null @@ -1,269 +0,0 @@ -import { CapabilityOwners, CapabilityOwnersSDKType } from "./capability"; -import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial } from "../../helpers"; -import { JsonSafe } from "../../json-safe"; -import { ComputedRef } from "vue"; -export const protobufPackage = "capability.v1"; -/** GenesisOwners defines the capability owners with their corresponding index. */ -export interface GenesisOwners { - /** index is the index of the capability owner. */ - index: bigint; - /** index_owners are the owners at the given index. */ - indexOwners: CapabilityOwners; -} -export interface ReactiveGenesisOwners { - index: ComputedRef; - indexOwners: ComputedRef; -} -export interface GenesisOwnersProtoMsg { - typeUrl: "/capability.v1.GenesisOwners"; - value: Uint8Array; -} -/** GenesisOwners defines the capability owners with their corresponding index. */ -export interface GenesisOwnersSDKType { - index: bigint; - index_owners: CapabilityOwnersSDKType; -} -/** GenesisState defines the capability module's genesis state. */ -export interface GenesisState { - /** index is the capability global index. */ - index: bigint; - /** - * owners represents a map from index to owners of the capability index - * index key is string to allow amino marshalling. - */ - owners: GenesisOwners[]; -} -export interface ReactiveGenesisState { - index: ComputedRef; - owners: ComputedRef; -} -export interface GenesisStateProtoMsg { - typeUrl: "/capability.v1.GenesisState"; - value: Uint8Array; -} -/** GenesisState defines the capability module's genesis state. */ -export interface GenesisStateSDKType { - index: bigint; - owners: GenesisOwnersSDKType[]; -} -function createBaseGenesisOwners(): GenesisOwners { - return { - index: BigInt(0), - indexOwners: CapabilityOwners.fromPartial({}) - }; -} -export const GenesisOwners = { - typeUrl: "/capability.v1.GenesisOwners", - encode(message: GenesisOwners, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.index !== BigInt(0)) { - writer.uint32(8).uint64(message.index); - } - if (message.indexOwners !== undefined) { - CapabilityOwners.encode(message.indexOwners, writer.uint32(18).fork()).ldelim(); - } - return writer; - }, - decode(input: BinaryReader | Uint8Array, length?: number): GenesisOwners { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseGenesisOwners(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.index = reader.uint64(); - break; - case 2: - message.indexOwners = CapabilityOwners.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - fromJSON(object: any): GenesisOwners { - return { - index: isSet(object.index) ? BigInt(object.index.toString()) : BigInt(0), - indexOwners: isSet(object.indexOwners) ? CapabilityOwners.fromJSON(object.indexOwners) : undefined - }; - }, - toJSON(message: GenesisOwners): JsonSafe { - const obj: any = {}; - message.index !== undefined && (obj.index = (message.index || BigInt(0)).toString()); - message.indexOwners !== undefined && (obj.indexOwners = message.indexOwners ? CapabilityOwners.toJSON(message.indexOwners) : undefined); - return obj; - }, - fromPartial(object: DeepPartial): GenesisOwners { - const message = createBaseGenesisOwners(); - message.index = object.index !== undefined && object.index !== null ? BigInt(object.index.toString()) : BigInt(0); - message.indexOwners = object.indexOwners !== undefined && object.indexOwners !== null ? CapabilityOwners.fromPartial(object.indexOwners) : undefined; - return message; - }, - fromSDK(object: GenesisOwnersSDKType): GenesisOwners { - return { - index: object?.index, - indexOwners: object.index_owners ? CapabilityOwners.fromSDK(object.index_owners) : undefined - }; - }, - fromSDKJSON(object: any): GenesisOwnersSDKType { - return { - index: isSet(object.index) ? BigInt(object.index.toString()) : BigInt(0), - index_owners: isSet(object.index_owners) ? CapabilityOwners.fromSDKJSON(object.index_owners) : undefined - }; - }, - toSDK(message: GenesisOwners): GenesisOwnersSDKType { - const obj: any = {}; - obj.index = message.index; - message.indexOwners !== undefined && (obj.index_owners = message.indexOwners ? CapabilityOwners.toSDK(message.indexOwners) : undefined); - return obj; - }, - fromAmino(object: GenesisOwnersAmino): GenesisOwners { - const message = createBaseGenesisOwners(); - if (object.index !== undefined && object.index !== null) { - message.index = BigInt(object.index); - } - if (object.index_owners !== undefined && object.index_owners !== null) { - message.indexOwners = CapabilityOwners.fromAmino(object.index_owners); - } - return message; - }, - toAmino(message: GenesisOwners): GenesisOwnersAmino { - const obj: any = {}; - 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 { - return GenesisOwners.fromAmino(object.value); - }, - fromProtoMsg(message: GenesisOwnersProtoMsg): GenesisOwners { - return GenesisOwners.decode(message.value); - }, - toProto(message: GenesisOwners): Uint8Array { - return GenesisOwners.encode(message).finish(); - }, - toProtoMsg(message: GenesisOwners): GenesisOwnersProtoMsg { - return { - typeUrl: "/capability.v1.GenesisOwners", - value: GenesisOwners.encode(message).finish() - }; - } -}; -function createBaseGenesisState(): GenesisState { - return { - index: BigInt(0), - owners: [] - }; -} -export const GenesisState = { - typeUrl: "/capability.v1.GenesisState", - encode(message: GenesisState, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.index !== BigInt(0)) { - writer.uint32(8).uint64(message.index); - } - for (const v of message.owners) { - GenesisOwners.encode(v!, writer.uint32(18).fork()).ldelim(); - } - return writer; - }, - decode(input: BinaryReader | Uint8Array, length?: number): GenesisState { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseGenesisState(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.index = reader.uint64(); - break; - case 2: - message.owners.push(GenesisOwners.decode(reader, reader.uint32())); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - fromJSON(object: any): GenesisState { - return { - index: isSet(object.index) ? BigInt(object.index.toString()) : BigInt(0), - owners: Array.isArray(object?.owners) ? object.owners.map((e: any) => GenesisOwners.fromJSON(e)) : [] - }; - }, - toJSON(message: GenesisState): JsonSafe { - const obj: any = {}; - message.index !== undefined && (obj.index = (message.index || BigInt(0)).toString()); - if (message.owners) { - obj.owners = message.owners.map(e => e ? GenesisOwners.toJSON(e) : undefined); - } else { - obj.owners = []; - } - return obj; - }, - fromPartial(object: DeepPartial): GenesisState { - const message = createBaseGenesisState(); - message.index = object.index !== undefined && object.index !== null ? BigInt(object.index.toString()) : BigInt(0); - message.owners = object.owners?.map(e => GenesisOwners.fromPartial(e)) || []; - return message; - }, - fromSDK(object: GenesisStateSDKType): GenesisState { - return { - index: object?.index, - owners: Array.isArray(object?.owners) ? object.owners.map((e: any) => GenesisOwners.fromSDK(e)) : [] - }; - }, - fromSDKJSON(object: any): GenesisStateSDKType { - return { - index: isSet(object.index) ? BigInt(object.index.toString()) : BigInt(0), - owners: Array.isArray(object?.owners) ? object.owners.map((e: any) => GenesisOwners.fromSDKJSON(e)) : [] - }; - }, - toSDK(message: GenesisState): GenesisStateSDKType { - const obj: any = {}; - obj.index = message.index; - if (message.owners) { - obj.owners = message.owners.map(e => e ? GenesisOwners.toSDK(e) : undefined); - } else { - obj.owners = []; - } - return obj; - }, - fromAmino(object: GenesisStateAmino): GenesisState { - const message = createBaseGenesisState(); - if (object.index !== undefined && object.index !== null) { - message.index = BigInt(object.index); - } - message.owners = object.owners?.map(e => GenesisOwners.fromAmino(e)) || []; - return message; - }, - toAmino(message: GenesisState): GenesisStateAmino { - const obj: any = {}; - 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 { - obj.owners = message.owners; - } - return obj; - }, - fromAminoMsg(object: GenesisStateAminoMsg): GenesisState { - return GenesisState.fromAmino(object.value); - }, - fromProtoMsg(message: GenesisStateProtoMsg): GenesisState { - return GenesisState.decode(message.value); - }, - toProto(message: GenesisState): Uint8Array { - return GenesisState.encode(message).finish(); - }, - toProtoMsg(message: GenesisState): GenesisStateProtoMsg { - return { - typeUrl: "/capability.v1.GenesisState", - value: GenesisState.encode(message).finish() - }; - } -}; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv4/cosmos/app/v1alpha1/query.rpc.Query.ts b/__fixtures__/v-next/outputv4/cosmos/app/v1alpha1/query.rpc.Query.ts index 71de75b770..ac71cea766 100644 --- a/__fixtures__/v-next/outputv4/cosmos/app/v1alpha1/query.rpc.Query.ts +++ b/__fixtures__/v-next/outputv4/cosmos/app/v1alpha1/query.rpc.Query.ts @@ -1,8 +1,8 @@ -import { Config, ConfigSDKType } from "./config"; -import { Rpc } from "../../../helpers"; -import { BinaryReader } from "../../../binary"; +import { Config, ConfigSDKType } from "./config.js"; +import { Rpc } from "../../../helpers.js"; +import { BinaryReader } from "../../../binary.js"; import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; -import { QueryConfigRequest, QueryConfigRequestSDKType, QueryConfigResponse, QueryConfigResponseSDKType, ReactiveQueryConfigRequest } from "./query"; +import { QueryConfigRequest, QueryConfigRequestSDKType, QueryConfigResponse, QueryConfigResponseSDKType } from "./query.js"; /** Query is the app module query service. */ export interface Query { /** Config returns the current app config. */ diff --git a/__fixtures__/v-next/outputv4/cosmos/auth/v1beta1/query.lcd.ts b/__fixtures__/v-next/outputv4/cosmos/auth/v1beta1/query.lcd.ts index 129b885eee..743d501447 100644 --- a/__fixtures__/v-next/outputv4/cosmos/auth/v1beta1/query.lcd.ts +++ b/__fixtures__/v-next/outputv4/cosmos/auth/v1beta1/query.lcd.ts @@ -1,9 +1,9 @@ -import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../base/query/v1beta1/pagination"; -import { Any, AnySDKType } from "../../../google/protobuf/any"; -import { Params, ParamsSDKType } from "./auth"; -import { setPaginationParams } from "../../../helpers"; +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../base/query/v1beta1/pagination.js"; +import { Any, AnySDKType } from "../../../google/protobuf/any.js"; +import { Params, ParamsSDKType } from "./auth.js"; +import { setPaginationParams } from "../../../helpers.js"; import { LCDClient } from "@cosmology/lcd"; -import { QueryAccountsRequest, QueryAccountsRequestSDKType, QueryAccountsResponse, QueryAccountsResponseSDKType, QueryAccountRequest, QueryAccountRequestSDKType, QueryAccountResponse, QueryAccountResponseSDKType, QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType, QueryModuleAccountsRequest, QueryModuleAccountsRequestSDKType, QueryModuleAccountsResponse, QueryModuleAccountsResponseSDKType, Bech32PrefixRequest, Bech32PrefixRequestSDKType, Bech32PrefixResponse, Bech32PrefixResponseSDKType, AddressBytesToStringRequest, AddressBytesToStringRequestSDKType, AddressBytesToStringResponse, AddressBytesToStringResponseSDKType, AddressStringToBytesRequest, AddressStringToBytesRequestSDKType, AddressStringToBytesResponse, AddressStringToBytesResponseSDKType } from "./query"; +import { QueryAccountsRequest, QueryAccountsRequestSDKType, QueryAccountsResponse, QueryAccountsResponseSDKType, QueryAccountRequest, QueryAccountRequestSDKType, QueryAccountResponse, QueryAccountResponseSDKType, QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType, QueryModuleAccountsRequest, QueryModuleAccountsRequestSDKType, QueryModuleAccountsResponse, QueryModuleAccountsResponseSDKType, Bech32PrefixRequest, Bech32PrefixRequestSDKType, Bech32PrefixResponse, Bech32PrefixResponseSDKType, AddressBytesToStringRequest, AddressBytesToStringRequestSDKType, AddressBytesToStringResponse, AddressBytesToStringResponseSDKType, AddressStringToBytesRequest, AddressStringToBytesRequestSDKType, AddressStringToBytesResponse, AddressStringToBytesResponseSDKType } from "./query.js"; export class LCDQueryClient { req: LCDClient; constructor({ @@ -24,7 +24,7 @@ export class LCDQueryClient { Since: cosmos-sdk 0.43 */ async accounts(params: QueryAccountsRequest = { - pagination: undefined + pagination: PageRequest.fromPartial({}) }): Promise { const options: any = { params: {} diff --git a/__fixtures__/v-next/outputv4/cosmos/auth/v1beta1/query.rpc.Query.ts b/__fixtures__/v-next/outputv4/cosmos/auth/v1beta1/query.rpc.Query.ts index 45f5e6ccbe..828662a3b0 100644 --- a/__fixtures__/v-next/outputv4/cosmos/auth/v1beta1/query.rpc.Query.ts +++ b/__fixtures__/v-next/outputv4/cosmos/auth/v1beta1/query.rpc.Query.ts @@ -1,10 +1,12 @@ -import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../base/query/v1beta1/pagination"; -import { Any, AnySDKType } from "../../../google/protobuf/any"; -import { Params, ParamsSDKType } from "./auth"; -import { Rpc } from "../../../helpers"; -import { BinaryReader } from "../../../binary"; -import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; -import { QueryAccountsRequest, QueryAccountsRequestSDKType, QueryAccountsResponse, QueryAccountsResponseSDKType, QueryAccountRequest, QueryAccountRequestSDKType, QueryAccountResponse, QueryAccountResponseSDKType, QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType, QueryModuleAccountsRequest, QueryModuleAccountsRequestSDKType, QueryModuleAccountsResponse, QueryModuleAccountsResponseSDKType, Bech32PrefixRequest, Bech32PrefixRequestSDKType, Bech32PrefixResponse, Bech32PrefixResponseSDKType, AddressBytesToStringRequest, AddressBytesToStringRequestSDKType, AddressBytesToStringResponse, AddressBytesToStringResponseSDKType, AddressStringToBytesRequest, AddressStringToBytesRequestSDKType, AddressStringToBytesResponse, AddressStringToBytesResponseSDKType, ReactiveQueryAccountsRequest, ReactiveQueryAccountRequest, ReactiveQueryParamsRequest, ReactiveQueryModuleAccountsRequest } from "./query"; +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../base/query/v1beta1/pagination.js"; +import { Any, AnySDKType } from "../../../google/protobuf/any.js"; +import { Params, ParamsSDKType } from "./auth.js"; +import { Rpc } from "../../../helpers.js"; +import { BinaryReader } from "../../../binary.js"; +import { QueryClient, createProtobufRpcClient, ProtobufRpcClient } from "@cosmjs/stargate"; +import { ReactQueryParams } from "../../../react-query.js"; +import { useQuery } from "@tanstack/react-query"; +import { QueryAccountsRequest, QueryAccountsRequestSDKType, QueryAccountsResponse, QueryAccountsResponseSDKType, QueryAccountRequest, QueryAccountRequestSDKType, QueryAccountResponse, QueryAccountResponseSDKType, QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType, QueryModuleAccountsRequest, QueryModuleAccountsRequestSDKType, QueryModuleAccountsResponse, QueryModuleAccountsResponseSDKType, Bech32PrefixRequest, Bech32PrefixRequestSDKType, Bech32PrefixResponse, Bech32PrefixResponseSDKType, AddressBytesToStringRequest, AddressBytesToStringRequestSDKType, AddressBytesToStringResponse, AddressBytesToStringResponseSDKType, AddressStringToBytesRequest, AddressStringToBytesRequestSDKType, AddressStringToBytesResponse, AddressStringToBytesResponseSDKType } from "./query.js"; /** Query defines the gRPC querier service. */ export interface Query { /** @@ -39,7 +41,7 @@ export class QueryClientImpl implements Query { this.addressStringToBytes = this.addressStringToBytes.bind(this); } accounts(request: QueryAccountsRequest = { - pagination: undefined + pagination: PageRequest.fromPartial({}) }): Promise { const data = QueryAccountsRequest.encode(request).finish(); const promise = this.rpc.request("cosmos.auth.v1beta1.Query", "Accounts", data); @@ -102,4 +104,115 @@ export const createRpcQueryExtension = (base: QueryClient) => { return queryService.addressStringToBytes(request); } }; +}; +export interface UseAccountsQuery extends ReactQueryParams { + request?: QueryAccountsRequest; +} +export interface UseAccountQuery extends ReactQueryParams { + request: QueryAccountRequest; +} +export interface UseParamsQuery extends ReactQueryParams { + request?: QueryParamsRequest; +} +export interface UseModuleAccountsQuery extends ReactQueryParams { + request?: QueryModuleAccountsRequest; +} +export interface UseBech32PrefixQuery extends ReactQueryParams { + request?: Bech32PrefixRequest; +} +export interface UseAddressBytesToStringQuery extends ReactQueryParams { + request: AddressBytesToStringRequest; +} +export interface UseAddressStringToBytesQuery extends ReactQueryParams { + request: AddressStringToBytesRequest; +} +const _queryClients: WeakMap = new WeakMap(); +const getQueryService = (rpc: ProtobufRpcClient | undefined): QueryClientImpl | undefined => { + if (!rpc) return; + if (_queryClients.has(rpc)) { + return _queryClients.get(rpc); + } + const queryService = new QueryClientImpl(rpc); + _queryClients.set(rpc, queryService); + return queryService; +}; +export const createRpcQueryHooks = (rpc: ProtobufRpcClient | undefined) => { + const queryService = getQueryService(rpc); + const useAccounts = ({ + request, + options + }: UseAccountsQuery) => { + return useQuery(["accountsQuery", request], () => { + if (!queryService) throw new Error("Query Service not initialized"); + return queryService.accounts(request); + }, options); + }; + const useAccount = ({ + request, + options + }: UseAccountQuery) => { + return useQuery(["accountQuery", request], () => { + if (!queryService) throw new Error("Query Service not initialized"); + return queryService.account(request); + }, options); + }; + const useParams = ({ + request, + options + }: UseParamsQuery) => { + return useQuery(["paramsQuery", request], () => { + if (!queryService) throw new Error("Query Service not initialized"); + return queryService.params(request); + }, options); + }; + const useModuleAccounts = ({ + request, + options + }: UseModuleAccountsQuery) => { + return useQuery(["moduleAccountsQuery", request], () => { + if (!queryService) throw new Error("Query Service not initialized"); + return queryService.moduleAccounts(request); + }, options); + }; + const useBech32Prefix = ({ + request, + options + }: UseBech32PrefixQuery) => { + return useQuery(["bech32PrefixQuery", request], () => { + if (!queryService) throw new Error("Query Service not initialized"); + return queryService.bech32Prefix(request); + }, options); + }; + const useAddressBytesToString = ({ + request, + options + }: UseAddressBytesToStringQuery) => { + return useQuery(["addressBytesToStringQuery", request], () => { + if (!queryService) throw new Error("Query Service not initialized"); + return queryService.addressBytesToString(request); + }, options); + }; + const useAddressStringToBytes = ({ + request, + options + }: UseAddressStringToBytesQuery) => { + return useQuery(["addressStringToBytesQuery", request], () => { + if (!queryService) throw new Error("Query Service not initialized"); + return queryService.addressStringToBytes(request); + }, options); + }; + return { + /** + * Accounts returns all the existing accounts + * + * Since: cosmos-sdk 0.43 + */ + useAccounts, + /** Account returns account details based on address. */useAccount, + /** Params queries all parameters. */useParams, + /** ModuleAccounts returns all the existing module accounts. */useModuleAccounts, + /** Bech32 queries bech32Prefix */useBech32Prefix, + /** AddressBytesToString converts Account Address bytes to string */useAddressBytesToString, + /** AddressStringToBytes converts Address string to bytes */useAddressStringToBytes + }; }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv4/cosmos/authz/v1beta1/query.lcd.ts b/__fixtures__/v-next/outputv4/cosmos/authz/v1beta1/query.lcd.ts index ccc4bcaed1..97f6258383 100644 --- a/__fixtures__/v-next/outputv4/cosmos/authz/v1beta1/query.lcd.ts +++ b/__fixtures__/v-next/outputv4/cosmos/authz/v1beta1/query.lcd.ts @@ -1,8 +1,8 @@ -import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../base/query/v1beta1/pagination"; -import { Grant, GrantSDKType, GrantAuthorization, GrantAuthorizationSDKType } from "./authz"; -import { setPaginationParams } from "../../../helpers"; +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../base/query/v1beta1/pagination.js"; +import { Grant, GrantSDKType, GrantAuthorization, GrantAuthorizationSDKType } from "./authz.js"; +import { setPaginationParams } from "../../../helpers.js"; import { LCDClient } from "@cosmology/lcd"; -import { QueryGrantsRequest, QueryGrantsRequestSDKType, QueryGrantsResponse, QueryGrantsResponseSDKType, QueryGranterGrantsRequest, QueryGranterGrantsRequestSDKType, QueryGranterGrantsResponse, QueryGranterGrantsResponseSDKType, QueryGranteeGrantsRequest, QueryGranteeGrantsRequestSDKType, QueryGranteeGrantsResponse, QueryGranteeGrantsResponseSDKType } from "./query"; +import { QueryGrantsRequest, QueryGrantsRequestSDKType, QueryGrantsResponse, QueryGrantsResponseSDKType, QueryGranterGrantsRequest, QueryGranterGrantsRequestSDKType, QueryGranterGrantsResponse, QueryGranterGrantsResponseSDKType, QueryGranteeGrantsRequest, QueryGranteeGrantsRequestSDKType, QueryGranteeGrantsResponse, QueryGranteeGrantsResponseSDKType } from "./query.js"; export class LCDQueryClient { req: LCDClient; constructor({ diff --git a/__fixtures__/v-next/outputv4/cosmos/authz/v1beta1/query.rpc.Query.ts b/__fixtures__/v-next/outputv4/cosmos/authz/v1beta1/query.rpc.Query.ts index dd8edf0345..e22e435eb1 100644 --- a/__fixtures__/v-next/outputv4/cosmos/authz/v1beta1/query.rpc.Query.ts +++ b/__fixtures__/v-next/outputv4/cosmos/authz/v1beta1/query.rpc.Query.ts @@ -1,9 +1,9 @@ -import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../base/query/v1beta1/pagination"; -import { Grant, GrantSDKType, GrantAuthorization, GrantAuthorizationSDKType } from "./authz"; -import { Rpc } from "../../../helpers"; -import { BinaryReader } from "../../../binary"; +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../base/query/v1beta1/pagination.js"; +import { Grant, GrantSDKType, GrantAuthorization, GrantAuthorizationSDKType } from "./authz.js"; +import { Rpc } from "../../../helpers.js"; +import { BinaryReader } from "../../../binary.js"; import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; -import { QueryGrantsRequest, QueryGrantsRequestSDKType, QueryGrantsResponse, QueryGrantsResponseSDKType, QueryGranterGrantsRequest, QueryGranterGrantsRequestSDKType, QueryGranterGrantsResponse, QueryGranterGrantsResponseSDKType, QueryGranteeGrantsRequest, QueryGranteeGrantsRequestSDKType, QueryGranteeGrantsResponse, QueryGranteeGrantsResponseSDKType, ReactiveQueryGrantsRequest, ReactiveQueryGranterGrantsRequest, ReactiveQueryGranteeGrantsRequest } from "./query"; +import { QueryGrantsRequest, QueryGrantsRequestSDKType, QueryGrantsResponse, QueryGrantsResponseSDKType, QueryGranterGrantsRequest, QueryGranterGrantsRequestSDKType, QueryGranterGrantsResponse, QueryGranterGrantsResponseSDKType, QueryGranteeGrantsRequest, QueryGranteeGrantsRequestSDKType, QueryGranteeGrantsResponse, QueryGranteeGrantsResponseSDKType } from "./query.js"; /** Query defines the gRPC querier service. */ export interface Query { /** Returns list of `Authorization`, granted to the grantee by the granter. */ 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..fbb03d7f8e 100644 --- a/__fixtures__/v-next/outputv4/cosmos/authz/v1beta1/tx.amino.ts +++ b/__fixtures__/v-next/outputv4/cosmos/authz/v1beta1/tx.amino.ts @@ -1,7 +1,7 @@ -import { Grant, GrantSDKType } from "./authz"; -import { Any, AnySDKType } from "../../../google/protobuf/any"; +import { Grant, GrantSDKType } from "./authz.js"; +import { Any, AnySDKType } from "../../../google/protobuf/any.js"; import { AminoMsg } from "@cosmjs/amino"; -import { MsgGrant, MsgGrantSDKType, MsgExec, MsgExecSDKType, MsgRevoke, MsgRevokeSDKType } from "./tx"; +import { MsgGrant, MsgGrantSDKType, MsgExec, MsgExecSDKType, MsgRevoke, MsgRevokeSDKType } from "./tx.js"; export interface MsgGrantAminoType extends AminoMsg { type: "cosmos-sdk/MsgGrant"; value: { diff --git a/__fixtures__/v-next/outputv4/cosmos/authz/v1beta1/tx.registry.ts b/__fixtures__/v-next/outputv4/cosmos/authz/v1beta1/tx.registry.ts index 273cecc9e3..2aaa8a5465 100644 --- a/__fixtures__/v-next/outputv4/cosmos/authz/v1beta1/tx.registry.ts +++ b/__fixtures__/v-next/outputv4/cosmos/authz/v1beta1/tx.registry.ts @@ -1,7 +1,7 @@ -import { Grant, GrantSDKType } from "./authz"; -import { Any, AnySDKType } from "../../../google/protobuf/any"; +import { Grant, GrantSDKType } from "./authz.js"; +import { Any, AnySDKType } from "../../../google/protobuf/any.js"; import { GeneratedType, Registry } from "@cosmjs/proto-signing"; -import { MsgGrant, MsgGrantSDKType, MsgExec, MsgExecSDKType, MsgRevoke, MsgRevokeSDKType } from "./tx"; +import { MsgGrant, MsgGrantSDKType, MsgExec, MsgExecSDKType, MsgRevoke, MsgRevokeSDKType } from "./tx.js"; 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]) => { diff --git a/__fixtures__/v-next/outputv4/cosmos/authz/v1beta1/tx.rpc.msg.ts b/__fixtures__/v-next/outputv4/cosmos/authz/v1beta1/tx.rpc.msg.ts index 9f6a262bfb..3dc11bc1c9 100644 --- a/__fixtures__/v-next/outputv4/cosmos/authz/v1beta1/tx.rpc.msg.ts +++ b/__fixtures__/v-next/outputv4/cosmos/authz/v1beta1/tx.rpc.msg.ts @@ -1,8 +1,8 @@ -import { Grant, GrantSDKType } from "./authz"; -import { Any, 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"; +import { Grant, GrantSDKType } from "./authz.js"; +import { Any, AnySDKType } from "../../../google/protobuf/any.js"; +import { Rpc } from "../../../helpers.js"; +import { BinaryReader } from "../../../binary.js"; +import { MsgGrant, MsgGrantSDKType, MsgGrantResponse, MsgGrantResponseSDKType, MsgExec, MsgExecSDKType, MsgExecResponse, MsgExecResponseSDKType, MsgRevoke, MsgRevokeSDKType, MsgRevokeResponse, MsgRevokeResponseSDKType } from "./tx.js"; /** Msg defines the authz Msg service. */ export interface Msg { /** diff --git a/__fixtures__/v-next/outputv4/cosmos/bank/v1beta1/query.lcd.ts b/__fixtures__/v-next/outputv4/cosmos/bank/v1beta1/query.lcd.ts index d0de75cfdb..b79ca342a1 100644 --- a/__fixtures__/v-next/outputv4/cosmos/bank/v1beta1/query.lcd.ts +++ b/__fixtures__/v-next/outputv4/cosmos/bank/v1beta1/query.lcd.ts @@ -1,9 +1,9 @@ -import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../base/query/v1beta1/pagination"; -import { Coin, CoinSDKType } from "../../base/v1beta1/coin"; -import { Params, ParamsSDKType, Metadata, MetadataSDKType } from "./bank"; -import { setPaginationParams } from "../../../helpers"; +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../base/query/v1beta1/pagination.js"; +import { Coin, CoinSDKType } from "../../base/v1beta1/coin.js"; +import { Params, ParamsSDKType, Metadata, MetadataSDKType } from "./bank.js"; +import { setPaginationParams } from "../../../helpers.js"; import { LCDClient } from "@cosmology/lcd"; -import { QueryBalanceRequest, QueryBalanceRequestSDKType, QueryBalanceResponse, QueryBalanceResponseSDKType, QueryAllBalancesRequest, QueryAllBalancesRequestSDKType, QueryAllBalancesResponse, QueryAllBalancesResponseSDKType, QuerySpendableBalancesRequest, QuerySpendableBalancesRequestSDKType, QuerySpendableBalancesResponse, QuerySpendableBalancesResponseSDKType, QueryTotalSupplyRequest, QueryTotalSupplyRequestSDKType, QueryTotalSupplyResponse, QueryTotalSupplyResponseSDKType, QuerySupplyOfRequest, QuerySupplyOfRequestSDKType, QuerySupplyOfResponse, QuerySupplyOfResponseSDKType, QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType, QueryDenomMetadataRequest, QueryDenomMetadataRequestSDKType, QueryDenomMetadataResponse, QueryDenomMetadataResponseSDKType, QueryDenomsMetadataRequest, QueryDenomsMetadataRequestSDKType, QueryDenomsMetadataResponse, QueryDenomsMetadataResponseSDKType, QueryDenomOwnersRequest, QueryDenomOwnersRequestSDKType, QueryDenomOwnersResponse, QueryDenomOwnersResponseSDKType } from "./query"; +import { QueryBalanceRequest, QueryBalanceRequestSDKType, QueryBalanceResponse, QueryBalanceResponseSDKType, QueryAllBalancesRequest, QueryAllBalancesRequestSDKType, QueryAllBalancesResponse, QueryAllBalancesResponseSDKType, QuerySpendableBalancesRequest, QuerySpendableBalancesRequestSDKType, QuerySpendableBalancesResponse, QuerySpendableBalancesResponseSDKType, QueryTotalSupplyRequest, QueryTotalSupplyRequestSDKType, QueryTotalSupplyResponse, QueryTotalSupplyResponseSDKType, QuerySupplyOfRequest, QuerySupplyOfRequestSDKType, QuerySupplyOfResponse, QuerySupplyOfResponseSDKType, QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType, QueryDenomMetadataRequest, QueryDenomMetadataRequestSDKType, QueryDenomMetadataResponse, QueryDenomMetadataResponseSDKType, QueryDenomsMetadataRequest, QueryDenomsMetadataRequestSDKType, QueryDenomsMetadataResponse, QueryDenomsMetadataResponseSDKType, QueryDenomOwnersRequest, QueryDenomOwnersRequestSDKType, QueryDenomOwnersResponse, QueryDenomOwnersResponseSDKType } from "./query.js"; export class LCDQueryClient { req: LCDClient; constructor({ @@ -58,7 +58,7 @@ export class LCDQueryClient { } /* TotalSupply queries the total supply of all coins. */ async totalSupply(params: QueryTotalSupplyRequest = { - pagination: undefined + pagination: PageRequest.fromPartial({}) }): Promise { const options: any = { params: {} @@ -93,7 +93,7 @@ export class LCDQueryClient { /* DenomsMetadata queries the client metadata for all registered coin denominations. */ async denomsMetadata(params: QueryDenomsMetadataRequest = { - pagination: undefined + pagination: PageRequest.fromPartial({}) }): Promise { const options: any = { params: {} diff --git a/__fixtures__/v-next/outputv4/cosmos/bank/v1beta1/query.rpc.Query.ts b/__fixtures__/v-next/outputv4/cosmos/bank/v1beta1/query.rpc.Query.ts index e1afd61410..a89321c1bb 100644 --- a/__fixtures__/v-next/outputv4/cosmos/bank/v1beta1/query.rpc.Query.ts +++ b/__fixtures__/v-next/outputv4/cosmos/bank/v1beta1/query.rpc.Query.ts @@ -1,13 +1,12 @@ -import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../base/query/v1beta1/pagination"; -import { Coin, CoinSDKType } from "../../base/v1beta1/coin"; -import { Params, ParamsSDKType, Metadata, MetadataSDKType } from "./bank"; -import { Rpc } from "../../../helpers"; -import { BinaryReader } from "../../../binary"; +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../base/query/v1beta1/pagination.js"; +import { Coin, CoinSDKType } from "../../base/v1beta1/coin.js"; +import { Params, ParamsSDKType, Metadata, MetadataSDKType } from "./bank.js"; +import { Rpc } from "../../../helpers.js"; +import { BinaryReader } from "../../../binary.js"; import { QueryClient, createProtobufRpcClient, ProtobufRpcClient } from "@cosmjs/stargate"; -import { VueQueryParams } from "../../../vue-query"; -import { ComputedRef, computed, Ref } from "vue"; -import { useQuery } from "@tanstack/vue-query"; -import { QueryBalanceRequest, QueryBalanceRequestSDKType, QueryBalanceResponse, QueryBalanceResponseSDKType, QueryAllBalancesRequest, QueryAllBalancesRequestSDKType, QueryAllBalancesResponse, QueryAllBalancesResponseSDKType, QuerySpendableBalancesRequest, QuerySpendableBalancesRequestSDKType, QuerySpendableBalancesResponse, QuerySpendableBalancesResponseSDKType, QueryTotalSupplyRequest, QueryTotalSupplyRequestSDKType, QueryTotalSupplyResponse, QueryTotalSupplyResponseSDKType, QuerySupplyOfRequest, QuerySupplyOfRequestSDKType, QuerySupplyOfResponse, QuerySupplyOfResponseSDKType, QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType, QueryDenomMetadataRequest, QueryDenomMetadataRequestSDKType, QueryDenomMetadataResponse, QueryDenomMetadataResponseSDKType, QueryDenomsMetadataRequest, QueryDenomsMetadataRequestSDKType, QueryDenomsMetadataResponse, QueryDenomsMetadataResponseSDKType, QueryDenomOwnersRequest, QueryDenomOwnersRequestSDKType, QueryDenomOwnersResponse, QueryDenomOwnersResponseSDKType, ReactiveQueryBalanceRequest, ReactiveQueryAllBalancesRequest, ReactiveQuerySpendableBalancesRequest, ReactiveQueryTotalSupplyRequest, ReactiveQuerySupplyOfRequest, ReactiveQueryParamsRequest, ReactiveQueryDenomMetadataRequest, ReactiveQueryDenomsMetadataRequest, ReactiveQueryDenomOwnersRequest } from "./query"; +import { ReactQueryParams } from "../../../react-query.js"; +import { useQuery } from "@tanstack/react-query"; +import { QueryBalanceRequest, QueryBalanceRequestSDKType, QueryBalanceResponse, QueryBalanceResponseSDKType, QueryAllBalancesRequest, QueryAllBalancesRequestSDKType, QueryAllBalancesResponse, QueryAllBalancesResponseSDKType, QuerySpendableBalancesRequest, QuerySpendableBalancesRequestSDKType, QuerySpendableBalancesResponse, QuerySpendableBalancesResponseSDKType, QueryTotalSupplyRequest, QueryTotalSupplyRequestSDKType, QueryTotalSupplyResponse, QueryTotalSupplyResponseSDKType, QuerySupplyOfRequest, QuerySupplyOfRequestSDKType, QuerySupplyOfResponse, QuerySupplyOfResponseSDKType, QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType, QueryDenomMetadataRequest, QueryDenomMetadataRequestSDKType, QueryDenomMetadataResponse, QueryDenomMetadataResponseSDKType, QueryDenomsMetadataRequest, QueryDenomsMetadataRequestSDKType, QueryDenomsMetadataResponse, QueryDenomsMetadataResponseSDKType, QueryDenomOwnersRequest, QueryDenomOwnersRequestSDKType, QueryDenomOwnersResponse, QueryDenomOwnersResponseSDKType } from "./query.js"; /** Query defines the gRPC querier service. */ export interface Query { /** Balance queries the balance of a single coin for a single account. */ @@ -68,7 +67,7 @@ export class QueryClientImpl implements Query { return promise.then(data => QuerySpendableBalancesResponse.decode(new BinaryReader(data))); } totalSupply(request: QueryTotalSupplyRequest = { - pagination: undefined + pagination: PageRequest.fromPartial({}) }): Promise { const data = QueryTotalSupplyRequest.encode(request).finish(); const promise = this.rpc.request("cosmos.bank.v1beta1.Query", "TotalSupply", data); @@ -90,7 +89,7 @@ export class QueryClientImpl implements Query { return promise.then(data => QueryDenomMetadataResponse.decode(new BinaryReader(data))); } denomsMetadata(request: QueryDenomsMetadataRequest = { - pagination: undefined + pagination: PageRequest.fromPartial({}) }): Promise { const data = QueryDenomsMetadataRequest.encode(request).finish(); const promise = this.rpc.request("cosmos.bank.v1beta1.Query", "DenomsMetadata", data); @@ -135,272 +134,125 @@ export const createRpcQueryExtension = (base: QueryClient) => { } }; }; -export interface UseBalanceQuery extends VueQueryParams { - request: ReactiveQueryBalanceRequest; +export interface UseBalanceQuery extends ReactQueryParams { + request: QueryBalanceRequest; } -export interface UseAllBalancesQuery extends VueQueryParams { - request: ReactiveQueryAllBalancesRequest; +export interface UseAllBalancesQuery extends ReactQueryParams { + request: QueryAllBalancesRequest; } -export interface UseSpendableBalancesQuery extends VueQueryParams { - request: ReactiveQuerySpendableBalancesRequest; +export interface UseSpendableBalancesQuery extends ReactQueryParams { + request: QuerySpendableBalancesRequest; } -export interface UseTotalSupplyQuery extends VueQueryParams { - request?: ReactiveQueryTotalSupplyRequest; +export interface UseTotalSupplyQuery extends ReactQueryParams { + request?: QueryTotalSupplyRequest; } -export interface UseSupplyOfQuery extends VueQueryParams { - request: ReactiveQuerySupplyOfRequest; +export interface UseSupplyOfQuery extends ReactQueryParams { + request: QuerySupplyOfRequest; } -export interface UseParamsQuery extends VueQueryParams { - request?: ReactiveQueryParamsRequest; +export interface UseParamsQuery extends ReactQueryParams { + request?: QueryParamsRequest; } -export interface UseDenomMetadataQuery extends VueQueryParams { - request: ReactiveQueryDenomMetadataRequest; +export interface UseDenomMetadataQuery extends ReactQueryParams { + request: QueryDenomMetadataRequest; } -export interface UseDenomsMetadataQuery extends VueQueryParams { - request?: ReactiveQueryDenomsMetadataRequest; +export interface UseDenomsMetadataQuery extends ReactQueryParams { + request?: QueryDenomsMetadataRequest; } -export interface UseDenomOwnersQuery extends VueQueryParams { - request: ReactiveQueryDenomOwnersRequest; +export interface UseDenomOwnersQuery extends ReactQueryParams { + request: QueryDenomOwnersRequest; } -export const useQueryService = (rpc: Ref): ComputedRef => { - const _queryClients = new WeakMap(); - return computed(() => { - if (rpc.value) { - if (_queryClients.has(rpc.value)) { - return _queryClients.get(rpc.value); - } - const queryService = new QueryClientImpl(rpc.value); - _queryClients.set(rpc.value, queryService); - return queryService; - } - }); +const _queryClients: WeakMap = new WeakMap(); +const getQueryService = (rpc: ProtobufRpcClient | undefined): QueryClientImpl | undefined => { + if (!rpc) return; + if (_queryClients.has(rpc)) { + return _queryClients.get(rpc); + } + const queryService = new QueryClientImpl(rpc); + _queryClients.set(rpc, queryService); + return queryService; }; -export const createRpcQueryHooks = (rpc: Ref) => { - const queryService = useQueryService(rpc); +export const createRpcQueryHooks = (rpc: ProtobufRpcClient | undefined) => { + const queryService = getQueryService(rpc); const useBalance = ({ request, options }: UseBalanceQuery) => { - const queryKey = ["balanceQuery", queryService]; - if (request) { - Object.values(request).forEach((val: any) => { - queryKey.push(val); - }); - } - return useQuery({ - queryKey, - queryFn: () => { - if (!queryService.value) throw new Error("Query Service not initialized"); - let params = ({} as any); - if (request) { - Object.entries(request).forEach(([key, val]) => { - params[key] = val.value; - }); - } - return queryService.value.balance(params); - }, - ...options - }); + return useQuery(["balanceQuery", request], () => { + if (!queryService) throw new Error("Query Service not initialized"); + return queryService.balance(request); + }, options); }; const useAllBalances = ({ request, options }: UseAllBalancesQuery) => { - const queryKey = ["allBalancesQuery", queryService]; - if (request) { - Object.values(request).forEach((val: any) => { - queryKey.push(val); - }); - } - return useQuery({ - queryKey, - queryFn: () => { - if (!queryService.value) throw new Error("Query Service not initialized"); - let params = ({} as any); - if (request) { - Object.entries(request).forEach(([key, val]) => { - params[key] = val.value; - }); - } - return queryService.value.allBalances(params); - }, - ...options - }); + return useQuery(["allBalancesQuery", request], () => { + if (!queryService) throw new Error("Query Service not initialized"); + return queryService.allBalances(request); + }, options); }; const useSpendableBalances = ({ request, options }: UseSpendableBalancesQuery) => { - const queryKey = ["spendableBalancesQuery", queryService]; - if (request) { - Object.values(request).forEach((val: any) => { - queryKey.push(val); - }); - } - return useQuery({ - queryKey, - queryFn: () => { - if (!queryService.value) throw new Error("Query Service not initialized"); - let params = ({} as any); - if (request) { - Object.entries(request).forEach(([key, val]) => { - params[key] = val.value; - }); - } - return queryService.value.spendableBalances(params); - }, - ...options - }); + return useQuery(["spendableBalancesQuery", request], () => { + if (!queryService) throw new Error("Query Service not initialized"); + return queryService.spendableBalances(request); + }, options); }; const useTotalSupply = ({ request, options }: UseTotalSupplyQuery) => { - const queryKey = ["totalSupplyQuery", queryService]; - if (request) { - Object.values(request).forEach((val: any) => { - queryKey.push(val); - }); - } - return useQuery({ - queryKey, - queryFn: () => { - if (!queryService.value) throw new Error("Query Service not initialized"); - let params = ({} as any); - if (request) { - Object.entries(request).forEach(([key, val]) => { - params[key] = val.value; - }); - } - return queryService.value.totalSupply(params); - }, - ...options - }); + return useQuery(["totalSupplyQuery", request], () => { + if (!queryService) throw new Error("Query Service not initialized"); + return queryService.totalSupply(request); + }, options); }; const useSupplyOf = ({ request, options }: UseSupplyOfQuery) => { - const queryKey = ["supplyOfQuery", queryService]; - if (request) { - Object.values(request).forEach((val: any) => { - queryKey.push(val); - }); - } - return useQuery({ - queryKey, - queryFn: () => { - if (!queryService.value) throw new Error("Query Service not initialized"); - let params = ({} as any); - if (request) { - Object.entries(request).forEach(([key, val]) => { - params[key] = val.value; - }); - } - return queryService.value.supplyOf(params); - }, - ...options - }); + return useQuery(["supplyOfQuery", request], () => { + if (!queryService) throw new Error("Query Service not initialized"); + return queryService.supplyOf(request); + }, options); }; const useParams = ({ request, options }: UseParamsQuery) => { - const queryKey = ["paramsQuery", queryService]; - if (request) { - Object.values(request).forEach((val: any) => { - queryKey.push(val); - }); - } - return useQuery({ - queryKey, - queryFn: () => { - if (!queryService.value) throw new Error("Query Service not initialized"); - let params = ({} as any); - if (request) { - Object.entries(request).forEach(([key, val]) => { - params[key] = val.value; - }); - } - return queryService.value.params(params); - }, - ...options - }); + return useQuery(["paramsQuery", request], () => { + if (!queryService) throw new Error("Query Service not initialized"); + return queryService.params(request); + }, options); }; const useDenomMetadata = ({ request, options }: UseDenomMetadataQuery) => { - const queryKey = ["denomMetadataQuery", queryService]; - if (request) { - Object.values(request).forEach((val: any) => { - queryKey.push(val); - }); - } - return useQuery({ - queryKey, - queryFn: () => { - if (!queryService.value) throw new Error("Query Service not initialized"); - let params = ({} as any); - if (request) { - Object.entries(request).forEach(([key, val]) => { - params[key] = val.value; - }); - } - return queryService.value.denomMetadata(params); - }, - ...options - }); + return useQuery(["denomMetadataQuery", request], () => { + if (!queryService) throw new Error("Query Service not initialized"); + return queryService.denomMetadata(request); + }, options); }; const useDenomsMetadata = ({ request, options }: UseDenomsMetadataQuery) => { - const queryKey = ["denomsMetadataQuery", queryService]; - if (request) { - Object.values(request).forEach((val: any) => { - queryKey.push(val); - }); - } - return useQuery({ - queryKey, - queryFn: () => { - if (!queryService.value) throw new Error("Query Service not initialized"); - let params = ({} as any); - if (request) { - Object.entries(request).forEach(([key, val]) => { - params[key] = val.value; - }); - } - return queryService.value.denomsMetadata(params); - }, - ...options - }); + return useQuery(["denomsMetadataQuery", request], () => { + if (!queryService) throw new Error("Query Service not initialized"); + return queryService.denomsMetadata(request); + }, options); }; const useDenomOwners = ({ request, options }: UseDenomOwnersQuery) => { - const queryKey = ["denomOwnersQuery", queryService]; - if (request) { - Object.values(request).forEach((val: any) => { - queryKey.push(val); - }); - } - return useQuery({ - queryKey, - queryFn: () => { - if (!queryService.value) throw new Error("Query Service not initialized"); - let params = ({} as any); - if (request) { - Object.entries(request).forEach(([key, val]) => { - params[key] = val.value; - }); - } - return queryService.value.denomOwners(params); - }, - ...options - }); + return useQuery(["denomOwnersQuery", request], () => { + if (!queryService) throw new Error("Query Service not initialized"); + return queryService.denomOwners(request); + }, options); }; return { /** Balance queries the balance of a single coin for a single account. */useBalance, 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..7a90fe04a8 100644 --- a/__fixtures__/v-next/outputv4/cosmos/bank/v1beta1/tx.amino.ts +++ b/__fixtures__/v-next/outputv4/cosmos/bank/v1beta1/tx.amino.ts @@ -1,7 +1,7 @@ -import { Coin, CoinSDKType } from "../../base/v1beta1/coin"; -import { Input, InputSDKType, Output, OutputSDKType } from "./bank"; +import { Coin, CoinSDKType } from "../../base/v1beta1/coin.js"; +import { Input, InputSDKType, Output, OutputSDKType } from "./bank.js"; import { AminoMsg } from "@cosmjs/amino"; -import { MsgSend, MsgSendSDKType, MsgMultiSend, MsgMultiSendSDKType } from "./tx"; +import { MsgSend, MsgSendSDKType, MsgMultiSend, MsgMultiSendSDKType } from "./tx.js"; export interface MsgSendAminoType extends AminoMsg { type: "cosmos-sdk/MsgSend"; value: { diff --git a/__fixtures__/v-next/outputv4/cosmos/bank/v1beta1/tx.registry.ts b/__fixtures__/v-next/outputv4/cosmos/bank/v1beta1/tx.registry.ts index 0bd58f9efc..6ac4d5f72b 100644 --- a/__fixtures__/v-next/outputv4/cosmos/bank/v1beta1/tx.registry.ts +++ b/__fixtures__/v-next/outputv4/cosmos/bank/v1beta1/tx.registry.ts @@ -1,7 +1,7 @@ -import { Coin, CoinSDKType } from "../../base/v1beta1/coin"; -import { Input, InputSDKType, Output, OutputSDKType } from "./bank"; +import { Coin, CoinSDKType } from "../../base/v1beta1/coin.js"; +import { Input, InputSDKType, Output, OutputSDKType } from "./bank.js"; import { GeneratedType, Registry } from "@cosmjs/proto-signing"; -import { MsgSend, MsgSendSDKType, MsgMultiSend, MsgMultiSendSDKType } from "./tx"; +import { MsgSend, MsgSendSDKType, MsgMultiSend, MsgMultiSendSDKType } from "./tx.js"; export const registry: ReadonlyArray<[string, GeneratedType]> = [["/cosmos.bank.v1beta1.MsgSend", MsgSend], ["/cosmos.bank.v1beta1.MsgMultiSend", MsgMultiSend]]; export const load = (protoRegistry: Registry) => { registry.forEach(([typeUrl, mod]) => { diff --git a/__fixtures__/v-next/outputv4/cosmos/bank/v1beta1/tx.rpc.msg.ts b/__fixtures__/v-next/outputv4/cosmos/bank/v1beta1/tx.rpc.msg.ts index 252d95dc7d..50076e3fcb 100644 --- a/__fixtures__/v-next/outputv4/cosmos/bank/v1beta1/tx.rpc.msg.ts +++ b/__fixtures__/v-next/outputv4/cosmos/bank/v1beta1/tx.rpc.msg.ts @@ -1,8 +1,8 @@ -import { Coin, CoinSDKType } from "../../base/v1beta1/coin"; -import { Input, InputSDKType, Output, OutputSDKType } from "./bank"; -import { Rpc } from "../../../helpers"; -import { BinaryReader } from "../../../binary"; -import { MsgSend, MsgSendSDKType, MsgSendResponse, MsgSendResponseSDKType, MsgMultiSend, MsgMultiSendSDKType, MsgMultiSendResponse, MsgMultiSendResponseSDKType } from "./tx"; +import { Coin, CoinSDKType } from "../../base/v1beta1/coin.js"; +import { Input, InputSDKType, Output, OutputSDKType } from "./bank.js"; +import { Rpc } from "../../../helpers.js"; +import { BinaryReader } from "../../../binary.js"; +import { MsgSend, MsgSendSDKType, MsgSendResponse, MsgSendResponseSDKType, MsgMultiSend, MsgMultiSendSDKType, MsgMultiSendResponse, MsgMultiSendResponseSDKType } from "./tx.js"; /** Msg defines the bank Msg service. */ export interface Msg { /** Send defines a method for sending coins from one account to another account. */ diff --git a/__fixtures__/v-next/outputv4/cosmos/base/node/v1beta1/query.lcd.ts b/__fixtures__/v-next/outputv4/cosmos/base/node/v1beta1/query.lcd.ts deleted file mode 100644 index 820d8bdd0a..0000000000 --- a/__fixtures__/v-next/outputv4/cosmos/base/node/v1beta1/query.lcd.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { LCDClient } from "@cosmology/lcd"; -import { ConfigRequest, ConfigRequestSDKType, ConfigResponse, ConfigResponseSDKType } from "./query"; -export class LCDQueryClient { - req: LCDClient; - constructor({ - requestClient - }: { - requestClient: LCDClient; - }) { - this.req = requestClient; - this.config = this.config.bind(this); - } - /* Config queries for the operator configuration. */ - async config(_params: ConfigRequest = {}): Promise { - const endpoint = `cosmos/base/node/v1beta1/config`; - return ConfigResponse.fromSDKJSON(await this.req.get(endpoint)); - } -} \ No newline at end of file diff --git a/__fixtures__/v-next/outputv4/cosmos/base/node/v1beta1/query.rpc.Service.ts b/__fixtures__/v-next/outputv4/cosmos/base/node/v1beta1/query.rpc.Service.ts deleted file mode 100644 index 3c6058c257..0000000000 --- a/__fixtures__/v-next/outputv4/cosmos/base/node/v1beta1/query.rpc.Service.ts +++ /dev/null @@ -1,30 +0,0 @@ -import { Rpc } from "../../../../helpers"; -import { BinaryReader } from "../../../../binary"; -import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; -import { ConfigRequest, ConfigRequestSDKType, ConfigResponse, ConfigResponseSDKType } from "./query"; -/** Service defines the gRPC querier service for node related queries. */ -export interface Service { - /** Config queries for the operator configuration. */ - config(request?: ConfigRequest): Promise; -} -export class ServiceClientImpl implements Service { - private readonly rpc: Rpc; - constructor(rpc: Rpc) { - this.rpc = rpc; - this.config = this.config.bind(this); - } - config(request: ConfigRequest = {}): Promise { - const data = ConfigRequest.encode(request).finish(); - const promise = this.rpc.request("cosmos.base.node.v1beta1.Service", "Config", data); - return promise.then(data => ConfigResponse.decode(new BinaryReader(data))); - } -} -export const createRpcQueryExtension = (base: QueryClient) => { - const rpc = createProtobufRpcClient(base); - const queryService = new ServiceClientImpl(rpc); - return { - config(request?: ConfigRequest): Promise { - return queryService.config(request); - } - }; -}; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv4/cosmos/base/node/v1beta1/query.ts b/__fixtures__/v-next/outputv4/cosmos/base/node/v1beta1/query.ts deleted file mode 100644 index 3368646993..0000000000 --- a/__fixtures__/v-next/outputv4/cosmos/base/node/v1beta1/query.ts +++ /dev/null @@ -1,196 +0,0 @@ -import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { JsonSafe } from "../../../../json-safe"; -import { DeepPartial, isSet } from "../../../../helpers"; -import { ComputedRef } from "vue"; -export const protobufPackage = "cosmos.base.node.v1beta1"; -/** ConfigRequest defines the request structure for the Config gRPC query. */ -export interface ConfigRequest {} -export interface ReactiveConfigRequest {} -export interface ConfigRequestProtoMsg { - typeUrl: "/cosmos.base.node.v1beta1.ConfigRequest"; - value: Uint8Array; -} -/** ConfigRequest defines the request structure for the Config gRPC query. */ -export interface ConfigRequestSDKType {} -/** ConfigResponse defines the response structure for the Config gRPC query. */ -export interface ConfigResponse { - minimumGasPrice: string; -} -export interface ReactiveConfigResponse { - minimumGasPrice: ComputedRef; -} -export interface ConfigResponseProtoMsg { - typeUrl: "/cosmos.base.node.v1beta1.ConfigResponse"; - value: Uint8Array; -} -/** ConfigResponse defines the response structure for the Config gRPC query. */ -export interface ConfigResponseSDKType { - minimum_gas_price: string; -} -function createBaseConfigRequest(): ConfigRequest { - return {}; -} -export const ConfigRequest = { - typeUrl: "/cosmos.base.node.v1beta1.ConfigRequest", - encode(_: ConfigRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - return writer; - }, - decode(input: BinaryReader | Uint8Array, length?: number): ConfigRequest { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseConfigRequest(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - fromJSON(_: any): ConfigRequest { - return {}; - }, - toJSON(_: ConfigRequest): JsonSafe { - const obj: any = {}; - return obj; - }, - fromPartial(_: DeepPartial): ConfigRequest { - const message = createBaseConfigRequest(); - return message; - }, - fromSDK(_: ConfigRequestSDKType): ConfigRequest { - return {}; - }, - fromSDKJSON(_: any): ConfigRequestSDKType { - return {}; - }, - toSDK(_: ConfigRequest): ConfigRequestSDKType { - const obj: any = {}; - return obj; - }, - fromAmino(_: ConfigRequestAmino): ConfigRequest { - const message = createBaseConfigRequest(); - return message; - }, - toAmino(_: ConfigRequest): ConfigRequestAmino { - const obj: any = {}; - return obj; - }, - fromAminoMsg(object: ConfigRequestAminoMsg): ConfigRequest { - return ConfigRequest.fromAmino(object.value); - }, - toAminoMsg(message: ConfigRequest): ConfigRequestAminoMsg { - return { - type: "cosmos-sdk/ConfigRequest", - value: ConfigRequest.toAmino(message) - }; - }, - fromProtoMsg(message: ConfigRequestProtoMsg): ConfigRequest { - return ConfigRequest.decode(message.value); - }, - toProto(message: ConfigRequest): Uint8Array { - return ConfigRequest.encode(message).finish(); - }, - toProtoMsg(message: ConfigRequest): ConfigRequestProtoMsg { - return { - typeUrl: "/cosmos.base.node.v1beta1.ConfigRequest", - value: ConfigRequest.encode(message).finish() - }; - } -}; -function createBaseConfigResponse(): ConfigResponse { - return { - minimumGasPrice: "" - }; -} -export const ConfigResponse = { - typeUrl: "/cosmos.base.node.v1beta1.ConfigResponse", - encode(message: ConfigResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.minimumGasPrice !== "") { - writer.uint32(10).string(message.minimumGasPrice); - } - return writer; - }, - decode(input: BinaryReader | Uint8Array, length?: number): ConfigResponse { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseConfigResponse(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.minimumGasPrice = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - fromJSON(object: any): ConfigResponse { - return { - minimumGasPrice: isSet(object.minimumGasPrice) ? String(object.minimumGasPrice) : "" - }; - }, - toJSON(message: ConfigResponse): JsonSafe { - const obj: any = {}; - message.minimumGasPrice !== undefined && (obj.minimumGasPrice = message.minimumGasPrice); - return obj; - }, - fromPartial(object: DeepPartial): ConfigResponse { - const message = createBaseConfigResponse(); - message.minimumGasPrice = object.minimumGasPrice ?? ""; - return message; - }, - fromSDK(object: ConfigResponseSDKType): ConfigResponse { - return { - minimumGasPrice: object?.minimum_gas_price - }; - }, - fromSDKJSON(object: any): ConfigResponseSDKType { - return { - minimum_gas_price: isSet(object.minimum_gas_price) ? String(object.minimum_gas_price) : "" - }; - }, - toSDK(message: ConfigResponse): ConfigResponseSDKType { - const obj: any = {}; - obj.minimum_gas_price = message.minimumGasPrice; - return obj; - }, - fromAmino(object: ConfigResponseAmino): ConfigResponse { - const message = createBaseConfigResponse(); - if (object.minimum_gas_price !== undefined && object.minimum_gas_price !== null) { - message.minimumGasPrice = object.minimum_gas_price; - } - return message; - }, - toAmino(message: ConfigResponse): ConfigResponseAmino { - const obj: any = {}; - obj.minimum_gas_price = message.minimumGasPrice === "" ? undefined : message.minimumGasPrice; - return obj; - }, - fromAminoMsg(object: ConfigResponseAminoMsg): ConfigResponse { - return ConfigResponse.fromAmino(object.value); - }, - toAminoMsg(message: ConfigResponse): ConfigResponseAminoMsg { - return { - type: "cosmos-sdk/ConfigResponse", - value: ConfigResponse.toAmino(message) - }; - }, - fromProtoMsg(message: ConfigResponseProtoMsg): ConfigResponse { - return ConfigResponse.decode(message.value); - }, - toProto(message: ConfigResponse): Uint8Array { - return ConfigResponse.encode(message).finish(); - }, - toProtoMsg(message: ConfigResponse): ConfigResponseProtoMsg { - return { - typeUrl: "/cosmos.base.node.v1beta1.ConfigResponse", - value: ConfigResponse.encode(message).finish() - }; - } -}; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv4/cosmos/base/reflection/v1beta1/reflection.lcd.ts b/__fixtures__/v-next/outputv4/cosmos/base/reflection/v1beta1/reflection.lcd.ts index fc9dc97286..b8c9756f28 100644 --- a/__fixtures__/v-next/outputv4/cosmos/base/reflection/v1beta1/reflection.lcd.ts +++ b/__fixtures__/v-next/outputv4/cosmos/base/reflection/v1beta1/reflection.lcd.ts @@ -1,5 +1,5 @@ import { LCDClient } from "@cosmology/lcd"; -import { ListAllInterfacesRequest, ListAllInterfacesRequestSDKType, ListAllInterfacesResponse, ListAllInterfacesResponseSDKType, ListImplementationsRequest, ListImplementationsRequestSDKType, ListImplementationsResponse, ListImplementationsResponseSDKType } from "./reflection"; +import { ListAllInterfacesRequest, ListAllInterfacesRequestSDKType, ListAllInterfacesResponse, ListAllInterfacesResponseSDKType, ListImplementationsRequest, ListImplementationsRequestSDKType, ListImplementationsResponse, ListImplementationsResponseSDKType } from "./reflection.js"; export class LCDQueryClient { req: LCDClient; constructor({ diff --git a/__fixtures__/v-next/outputv4/cosmos/base/reflection/v1beta1/reflection.rpc.ReflectionService.ts b/__fixtures__/v-next/outputv4/cosmos/base/reflection/v1beta1/reflection.rpc.ReflectionService.ts index 0a2876d475..6bdcf494ff 100644 --- a/__fixtures__/v-next/outputv4/cosmos/base/reflection/v1beta1/reflection.rpc.ReflectionService.ts +++ b/__fixtures__/v-next/outputv4/cosmos/base/reflection/v1beta1/reflection.rpc.ReflectionService.ts @@ -1,7 +1,7 @@ -import { Rpc } from "../../../../helpers"; -import { BinaryReader } from "../../../../binary"; +import { Rpc } from "../../../../helpers.js"; +import { BinaryReader } from "../../../../binary.js"; import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; -import { ListAllInterfacesRequest, ListAllInterfacesRequestSDKType, ListAllInterfacesResponse, ListAllInterfacesResponseSDKType, ListImplementationsRequest, ListImplementationsRequestSDKType, ListImplementationsResponse, ListImplementationsResponseSDKType } from "./reflection"; +import { ListAllInterfacesRequest, ListAllInterfacesRequestSDKType, ListAllInterfacesResponse, ListAllInterfacesResponseSDKType, ListImplementationsRequest, ListImplementationsRequestSDKType, ListImplementationsResponse, ListImplementationsResponseSDKType } from "./reflection.js"; /** ReflectionService defines a service for interface reflection. */ export interface ReflectionService { /** diff --git a/__fixtures__/v-next/outputv4/cosmos/base/reflection/v2alpha1/reflection.lcd.ts b/__fixtures__/v-next/outputv4/cosmos/base/reflection/v2alpha1/reflection.lcd.ts index b1aff05930..3277110496 100644 --- a/__fixtures__/v-next/outputv4/cosmos/base/reflection/v2alpha1/reflection.lcd.ts +++ b/__fixtures__/v-next/outputv4/cosmos/base/reflection/v2alpha1/reflection.lcd.ts @@ -1,5 +1,5 @@ import { LCDClient } from "@cosmology/lcd"; -import { GetAuthnDescriptorRequest, GetAuthnDescriptorRequestSDKType, GetAuthnDescriptorResponse, GetAuthnDescriptorResponseSDKType, GetChainDescriptorRequest, GetChainDescriptorRequestSDKType, GetChainDescriptorResponse, GetChainDescriptorResponseSDKType, GetCodecDescriptorRequest, GetCodecDescriptorRequestSDKType, GetCodecDescriptorResponse, GetCodecDescriptorResponseSDKType, GetConfigurationDescriptorRequest, GetConfigurationDescriptorRequestSDKType, GetConfigurationDescriptorResponse, GetConfigurationDescriptorResponseSDKType, GetQueryServicesDescriptorRequest, GetQueryServicesDescriptorRequestSDKType, GetQueryServicesDescriptorResponse, GetQueryServicesDescriptorResponseSDKType, GetTxDescriptorRequest, GetTxDescriptorRequestSDKType, GetTxDescriptorResponse, GetTxDescriptorResponseSDKType } from "./reflection"; +import { GetAuthnDescriptorRequest, GetAuthnDescriptorRequestSDKType, GetAuthnDescriptorResponse, GetAuthnDescriptorResponseSDKType, GetChainDescriptorRequest, GetChainDescriptorRequestSDKType, GetChainDescriptorResponse, GetChainDescriptorResponseSDKType, GetCodecDescriptorRequest, GetCodecDescriptorRequestSDKType, GetCodecDescriptorResponse, GetCodecDescriptorResponseSDKType, GetConfigurationDescriptorRequest, GetConfigurationDescriptorRequestSDKType, GetConfigurationDescriptorResponse, GetConfigurationDescriptorResponseSDKType, GetQueryServicesDescriptorRequest, GetQueryServicesDescriptorRequestSDKType, GetQueryServicesDescriptorResponse, GetQueryServicesDescriptorResponseSDKType, GetTxDescriptorRequest, GetTxDescriptorRequestSDKType, GetTxDescriptorResponse, GetTxDescriptorResponseSDKType } from "./reflection.js"; export class LCDQueryClient { req: LCDClient; constructor({ diff --git a/__fixtures__/v-next/outputv4/cosmos/base/reflection/v2alpha1/reflection.rpc.ReflectionService.ts b/__fixtures__/v-next/outputv4/cosmos/base/reflection/v2alpha1/reflection.rpc.ReflectionService.ts index 51a2e52526..84542cc6ea 100644 --- a/__fixtures__/v-next/outputv4/cosmos/base/reflection/v2alpha1/reflection.rpc.ReflectionService.ts +++ b/__fixtures__/v-next/outputv4/cosmos/base/reflection/v2alpha1/reflection.rpc.ReflectionService.ts @@ -1,7 +1,7 @@ -import { Rpc } from "../../../../helpers"; -import { BinaryReader } from "../../../../binary"; +import { Rpc } from "../../../../helpers.js"; +import { BinaryReader } from "../../../../binary.js"; import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; -import { GetAuthnDescriptorRequest, GetAuthnDescriptorRequestSDKType, GetAuthnDescriptorResponse, GetAuthnDescriptorResponseSDKType, GetChainDescriptorRequest, GetChainDescriptorRequestSDKType, GetChainDescriptorResponse, GetChainDescriptorResponseSDKType, GetCodecDescriptorRequest, GetCodecDescriptorRequestSDKType, GetCodecDescriptorResponse, GetCodecDescriptorResponseSDKType, GetConfigurationDescriptorRequest, GetConfigurationDescriptorRequestSDKType, GetConfigurationDescriptorResponse, GetConfigurationDescriptorResponseSDKType, GetQueryServicesDescriptorRequest, GetQueryServicesDescriptorRequestSDKType, GetQueryServicesDescriptorResponse, GetQueryServicesDescriptorResponseSDKType, GetTxDescriptorRequest, GetTxDescriptorRequestSDKType, GetTxDescriptorResponse, GetTxDescriptorResponseSDKType } from "./reflection"; +import { GetAuthnDescriptorRequest, GetAuthnDescriptorRequestSDKType, GetAuthnDescriptorResponse, GetAuthnDescriptorResponseSDKType, GetChainDescriptorRequest, GetChainDescriptorRequestSDKType, GetChainDescriptorResponse, GetChainDescriptorResponseSDKType, GetCodecDescriptorRequest, GetCodecDescriptorRequestSDKType, GetCodecDescriptorResponse, GetCodecDescriptorResponseSDKType, GetConfigurationDescriptorRequest, GetConfigurationDescriptorRequestSDKType, GetConfigurationDescriptorResponse, GetConfigurationDescriptorResponseSDKType, GetQueryServicesDescriptorRequest, GetQueryServicesDescriptorRequestSDKType, GetQueryServicesDescriptorResponse, GetQueryServicesDescriptorResponseSDKType, GetTxDescriptorRequest, GetTxDescriptorRequestSDKType, GetTxDescriptorResponse, GetTxDescriptorResponseSDKType } from "./reflection.js"; /** ReflectionService defines a service for application reflection. */ export interface ReflectionService { /** diff --git a/__fixtures__/v-next/outputv4/cosmos/base/tendermint/v1beta1/query.lcd.ts b/__fixtures__/v-next/outputv4/cosmos/base/tendermint/v1beta1/query.lcd.ts index 8344be264e..71ebde02c2 100644 --- a/__fixtures__/v-next/outputv4/cosmos/base/tendermint/v1beta1/query.lcd.ts +++ b/__fixtures__/v-next/outputv4/cosmos/base/tendermint/v1beta1/query.lcd.ts @@ -1,11 +1,11 @@ -import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../query/v1beta1/pagination"; -import { Any, AnySDKType } from "../../../../google/protobuf/any"; -import { BlockID, BlockIDSDKType } from "../../../../tendermint/types/types"; -import { Block, BlockSDKType } from "../../../../tendermint/types/block"; -import { NodeInfo, NodeInfoSDKType } from "../../../../tendermint/p2p/types"; -import { setPaginationParams } from "../../../../helpers"; +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../query/v1beta1/pagination.js"; +import { Any, AnySDKType } from "../../../../google/protobuf/any.js"; +import { BlockID, BlockIDSDKType } from "../../../../tendermint/types/types.js"; +import { Block, BlockSDKType } from "../../../../tendermint/types/block.js"; +import { NodeInfo, NodeInfoSDKType } from "../../../../tendermint/p2p/types.js"; +import { setPaginationParams } from "../../../../helpers.js"; import { LCDClient } from "@cosmology/lcd"; -import { GetNodeInfoRequest, GetNodeInfoRequestSDKType, GetNodeInfoResponse, GetNodeInfoResponseSDKType, GetSyncingRequest, GetSyncingRequestSDKType, GetSyncingResponse, GetSyncingResponseSDKType, GetLatestBlockRequest, GetLatestBlockRequestSDKType, GetLatestBlockResponse, GetLatestBlockResponseSDKType, GetBlockByHeightRequest, GetBlockByHeightRequestSDKType, GetBlockByHeightResponse, GetBlockByHeightResponseSDKType, GetLatestValidatorSetRequest, GetLatestValidatorSetRequestSDKType, GetLatestValidatorSetResponse, GetLatestValidatorSetResponseSDKType, GetValidatorSetByHeightRequest, GetValidatorSetByHeightRequestSDKType, GetValidatorSetByHeightResponse, GetValidatorSetByHeightResponseSDKType } from "./query"; +import { GetNodeInfoRequest, GetNodeInfoRequestSDKType, GetNodeInfoResponse, GetNodeInfoResponseSDKType, GetSyncingRequest, GetSyncingRequestSDKType, GetSyncingResponse, GetSyncingResponseSDKType, GetLatestBlockRequest, GetLatestBlockRequestSDKType, GetLatestBlockResponse, GetLatestBlockResponseSDKType, GetBlockByHeightRequest, GetBlockByHeightRequestSDKType, GetBlockByHeightResponse, GetBlockByHeightResponseSDKType, GetLatestValidatorSetRequest, GetLatestValidatorSetRequestSDKType, GetLatestValidatorSetResponse, GetLatestValidatorSetResponseSDKType, GetValidatorSetByHeightRequest, GetValidatorSetByHeightRequestSDKType, GetValidatorSetByHeightResponse, GetValidatorSetByHeightResponseSDKType } from "./query.js"; export class LCDQueryClient { req: LCDClient; constructor({ @@ -43,7 +43,7 @@ export class LCDQueryClient { } /* GetLatestValidatorSet queries latest validator-set. */ async getLatestValidatorSet(params: GetLatestValidatorSetRequest = { - pagination: undefined + pagination: PageRequest.fromPartial({}) }): Promise { const options: any = { params: {} diff --git a/__fixtures__/v-next/outputv4/cosmos/base/tendermint/v1beta1/query.rpc.Service.ts b/__fixtures__/v-next/outputv4/cosmos/base/tendermint/v1beta1/query.rpc.Service.ts index 2d426d3d4c..cdfeebe4e2 100644 --- a/__fixtures__/v-next/outputv4/cosmos/base/tendermint/v1beta1/query.rpc.Service.ts +++ b/__fixtures__/v-next/outputv4/cosmos/base/tendermint/v1beta1/query.rpc.Service.ts @@ -1,12 +1,12 @@ -import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../query/v1beta1/pagination"; -import { Any, AnySDKType } from "../../../../google/protobuf/any"; -import { BlockID, BlockIDSDKType } from "../../../../tendermint/types/types"; -import { Block, BlockSDKType } from "../../../../tendermint/types/block"; -import { NodeInfo, NodeInfoSDKType } from "../../../../tendermint/p2p/types"; -import { Rpc } from "../../../../helpers"; -import { BinaryReader } from "../../../../binary"; +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../query/v1beta1/pagination.js"; +import { Any, AnySDKType } from "../../../../google/protobuf/any.js"; +import { BlockID, BlockIDSDKType } from "../../../../tendermint/types/types.js"; +import { Block, BlockSDKType } from "../../../../tendermint/types/block.js"; +import { NodeInfo, NodeInfoSDKType } from "../../../../tendermint/p2p/types.js"; +import { Rpc } from "../../../../helpers.js"; +import { BinaryReader } from "../../../../binary.js"; import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; -import { GetNodeInfoRequest, GetNodeInfoRequestSDKType, GetNodeInfoResponse, GetNodeInfoResponseSDKType, GetSyncingRequest, GetSyncingRequestSDKType, GetSyncingResponse, GetSyncingResponseSDKType, GetLatestBlockRequest, GetLatestBlockRequestSDKType, GetLatestBlockResponse, GetLatestBlockResponseSDKType, GetBlockByHeightRequest, GetBlockByHeightRequestSDKType, GetBlockByHeightResponse, GetBlockByHeightResponseSDKType, GetLatestValidatorSetRequest, GetLatestValidatorSetRequestSDKType, GetLatestValidatorSetResponse, GetLatestValidatorSetResponseSDKType, GetValidatorSetByHeightRequest, GetValidatorSetByHeightRequestSDKType, GetValidatorSetByHeightResponse, GetValidatorSetByHeightResponseSDKType } from "./query"; +import { GetNodeInfoRequest, GetNodeInfoRequestSDKType, GetNodeInfoResponse, GetNodeInfoResponseSDKType, GetSyncingRequest, GetSyncingRequestSDKType, GetSyncingResponse, GetSyncingResponseSDKType, GetLatestBlockRequest, GetLatestBlockRequestSDKType, GetLatestBlockResponse, GetLatestBlockResponseSDKType, GetBlockByHeightRequest, GetBlockByHeightRequestSDKType, GetBlockByHeightResponse, GetBlockByHeightResponseSDKType, GetLatestValidatorSetRequest, GetLatestValidatorSetRequestSDKType, GetLatestValidatorSetResponse, GetLatestValidatorSetResponseSDKType, GetValidatorSetByHeightRequest, GetValidatorSetByHeightRequestSDKType, GetValidatorSetByHeightResponse, GetValidatorSetByHeightResponseSDKType } from "./query.js"; /** Service defines the gRPC querier service for tendermint queries. */ export interface Service { /** GetNodeInfo queries the current node info. */ @@ -54,7 +54,7 @@ export class ServiceClientImpl implements Service { return promise.then(data => GetBlockByHeightResponse.decode(new BinaryReader(data))); } getLatestValidatorSet(request: GetLatestValidatorSetRequest = { - pagination: undefined + pagination: PageRequest.fromPartial({}) }): Promise { const data = GetLatestValidatorSetRequest.encode(request).finish(); const promise = this.rpc.request("cosmos.base.tendermint.v1beta1.Service", "GetLatestValidatorSet", data); diff --git a/__fixtures__/v-next/outputv4/cosmos/bundle.ts b/__fixtures__/v-next/outputv4/cosmos/bundle.ts index 5444a4c00a..99a745f8a0 100644 --- a/__fixtures__/v-next/outputv4/cosmos/bundle.ts +++ b/__fixtures__/v-next/outputv4/cosmos/bundle.ts @@ -1,192 +1,188 @@ -import * as _55 from "./app/v1alpha1/config"; -import * as _56 from "./app/v1alpha1/module"; -import * as _57 from "./app/v1alpha1/query"; -import * as _58 from "./auth/v1beta1/auth"; -import * as _59 from "./auth/v1beta1/genesis"; -import * as _60 from "./auth/v1beta1/query"; -import * as _61 from "./authz/v1beta1/authz"; -import * as _62 from "./authz/v1beta1/genesis"; -import * as _63 from "./authz/v1beta1/query"; -import * as _64 from "./authz/v1beta1/tx"; -import * as _65 from "./bank/v1beta1/authz"; -import * as _66 from "./bank/v1beta1/bank"; -import * as _67 from "./bank/v1beta1/genesis"; -import * as _68 from "./bank/v1beta1/query"; -import * as _69 from "./bank/v1beta1/tx"; -import * as _70 from "./base/abci/v1beta1/abci"; -import * as _71 from "./base/kv/v1beta1/kv"; -import * as _72 from "./base/query/v1beta1/pagination"; -import * as _73 from "./base/reflection/v1beta1/reflection"; -import * as _74 from "./base/reflection/v2alpha1/reflection"; -import * as _75 from "./base/snapshots/v1beta1/snapshot"; -import * as _76 from "./base/store/v1beta1/commit_info"; -import * as _77 from "./base/store/v1beta1/listening"; -import * as _78 from "./base/tendermint/v1beta1/query"; -import * as _79 from "./base/v1beta1/coin"; -import * as _80 from "./base/node/v1beta1/query"; -import * as _81 from "./capability/v1beta1/capability"; -import * as _82 from "./capability/v1beta1/genesis"; -import * as _83 from "./crisis/v1beta1/genesis"; -import * as _84 from "./crisis/v1beta1/tx"; -import * as _85 from "./crypto/ed25519/keys"; -import * as _86 from "./crypto/hd/v1/hd"; -import * as _87 from "./crypto/keyring/v1/record"; -import * as _88 from "./crypto/multisig/keys"; -import * as _89 from "./crypto/secp256k1/keys"; -import * as _90 from "./crypto/secp256r1/keys"; -import * as _91 from "./distribution/v1beta1/distribution"; -import * as _92 from "./distribution/v1beta1/genesis"; -import * as _93 from "./distribution/v1beta1/query"; -import * as _94 from "./distribution/v1beta1/tx"; -import * as _95 from "./evidence/v1beta1/evidence"; -import * as _96 from "./evidence/v1beta1/genesis"; -import * as _97 from "./evidence/v1beta1/query"; -import * as _98 from "./evidence/v1beta1/tx"; -import * as _99 from "./feegrant/v1beta1/feegrant"; -import * as _100 from "./feegrant/v1beta1/genesis"; -import * as _101 from "./feegrant/v1beta1/query"; -import * as _102 from "./feegrant/v1beta1/tx"; -import * as _103 from "./genutil/v1beta1/genesis"; -import * as _104 from "./gov/v1/genesis"; -import * as _105 from "./gov/v1/gov"; -import * as _106 from "./gov/v1/query"; -import * as _107 from "./gov/v1/tx"; -import * as _108 from "./gov/v1beta1/genesis"; -import * as _109 from "./gov/v1beta1/gov"; -import * as _110 from "./gov/v1beta1/query"; -import * as _111 from "./gov/v1beta1/tx"; -import * as _112 from "./group/v1/events"; -import * as _113 from "./group/v1/genesis"; -import * as _114 from "./group/v1/query"; -import * as _115 from "./group/v1/tx"; -import * as _116 from "./group/v1/types"; -import * as _117 from "./mint/v1beta1/genesis"; -import * as _118 from "./mint/v1beta1/mint"; -import * as _119 from "./mint/v1beta1/query"; -import * as _120 from "./msg/v1/msg"; -import * as _121 from "./nft/v1beta1/event"; -import * as _122 from "./nft/v1beta1/genesis"; -import * as _123 from "./nft/v1beta1/nft"; -import * as _124 from "./nft/v1beta1/query"; -import * as _125 from "./nft/v1beta1/tx"; -import * as _126 from "./orm/module/v1alpha1/module"; -import * as _127 from "./orm/v1/orm"; -import * as _128 from "./orm/v1alpha1/schema"; -import * as _129 from "./params/v1beta1/params"; -import * as _130 from "./params/v1beta1/query"; -import * as _131 from "./slashing/v1beta1/genesis"; -import * as _132 from "./slashing/v1beta1/query"; -import * as _133 from "./slashing/v1beta1/slashing"; -import * as _134 from "./slashing/v1beta1/tx"; -import * as _135 from "./staking/v1beta1/authz"; -import * as _136 from "./staking/v1beta1/genesis"; -import * as _137 from "./staking/v1beta1/query"; -import * as _138 from "./staking/v1beta1/staking"; -import * as _139 from "./staking/v1beta1/tx"; -import * as _140 from "./tx/signing/v1beta1/signing"; -import * as _141 from "./tx/v1beta1/service"; -import * as _142 from "./tx/v1beta1/tx"; -import * as _143 from "./upgrade/v1beta1/query"; -import * as _144 from "./upgrade/v1beta1/tx"; -import * as _145 from "./upgrade/v1beta1/upgrade"; -import * as _146 from "./vesting/v1beta1/tx"; -import * as _147 from "./vesting/v1beta1/vesting"; -import * as _148 from "./ics23/v1/proofs"; -import * as _402 from "./authz/v1beta1/tx.amino"; -import * as _403 from "./bank/v1beta1/tx.amino"; -import * as _404 from "./crisis/v1beta1/tx.amino"; -import * as _405 from "./distribution/v1beta1/tx.amino"; -import * as _406 from "./evidence/v1beta1/tx.amino"; -import * as _407 from "./feegrant/v1beta1/tx.amino"; -import * as _408 from "./gov/v1/tx.amino"; -import * as _409 from "./gov/v1beta1/tx.amino"; -import * as _410 from "./group/v1/tx.amino"; -import * as _411 from "./nft/v1beta1/tx.amino"; -import * as _412 from "./slashing/v1beta1/tx.amino"; -import * as _413 from "./staking/v1beta1/tx.amino"; -import * as _414 from "./upgrade/v1beta1/tx.amino"; -import * as _415 from "./vesting/v1beta1/tx.amino"; -import * as _416 from "./authz/v1beta1/tx.registry"; -import * as _417 from "./bank/v1beta1/tx.registry"; -import * as _418 from "./crisis/v1beta1/tx.registry"; -import * as _419 from "./distribution/v1beta1/tx.registry"; -import * as _420 from "./evidence/v1beta1/tx.registry"; -import * as _421 from "./feegrant/v1beta1/tx.registry"; -import * as _422 from "./gov/v1/tx.registry"; -import * as _423 from "./gov/v1beta1/tx.registry"; -import * as _424 from "./group/v1/tx.registry"; -import * as _425 from "./nft/v1beta1/tx.registry"; -import * as _426 from "./slashing/v1beta1/tx.registry"; -import * as _427 from "./staking/v1beta1/tx.registry"; -import * as _428 from "./upgrade/v1beta1/tx.registry"; -import * as _429 from "./vesting/v1beta1/tx.registry"; -import * as _430 from "./auth/v1beta1/query.lcd"; -import * as _431 from "./authz/v1beta1/query.lcd"; -import * as _432 from "./bank/v1beta1/query.lcd"; -import * as _433 from "./base/reflection/v1beta1/reflection.lcd"; -import * as _434 from "./base/reflection/v2alpha1/reflection.lcd"; -import * as _435 from "./base/tendermint/v1beta1/query.lcd"; -import * as _436 from "./distribution/v1beta1/query.lcd"; -import * as _437 from "./evidence/v1beta1/query.lcd"; -import * as _438 from "./feegrant/v1beta1/query.lcd"; -import * as _439 from "./gov/v1/query.lcd"; -import * as _440 from "./gov/v1beta1/query.lcd"; -import * as _441 from "./group/v1/query.lcd"; -import * as _442 from "./mint/v1beta1/query.lcd"; -import * as _443 from "./nft/v1beta1/query.lcd"; -import * as _444 from "./params/v1beta1/query.lcd"; -import * as _445 from "./slashing/v1beta1/query.lcd"; -import * as _446 from "./staking/v1beta1/query.lcd"; -import * as _447 from "./tx/v1beta1/service.lcd"; -import * as _448 from "./upgrade/v1beta1/query.lcd"; -import * as _449 from "./base/node/v1beta1/query.lcd"; -import * as _450 from "./app/v1alpha1/query.rpc.Query"; -import * as _451 from "./auth/v1beta1/query.rpc.Query"; -import * as _452 from "./authz/v1beta1/query.rpc.Query"; -import * as _453 from "./bank/v1beta1/query.rpc.Query"; -import * as _454 from "./base/reflection/v1beta1/reflection.rpc.ReflectionService"; -import * as _455 from "./base/reflection/v2alpha1/reflection.rpc.ReflectionService"; -import * as _456 from "./base/tendermint/v1beta1/query.rpc.Service"; -import * as _457 from "./distribution/v1beta1/query.rpc.Query"; -import * as _458 from "./evidence/v1beta1/query.rpc.Query"; -import * as _459 from "./feegrant/v1beta1/query.rpc.Query"; -import * as _460 from "./gov/v1/query.rpc.Query"; -import * as _461 from "./gov/v1beta1/query.rpc.Query"; -import * as _462 from "./group/v1/query.rpc.Query"; -import * as _463 from "./mint/v1beta1/query.rpc.Query"; -import * as _464 from "./nft/v1beta1/query.rpc.Query"; -import * as _465 from "./params/v1beta1/query.rpc.Query"; -import * as _466 from "./slashing/v1beta1/query.rpc.Query"; -import * as _467 from "./staking/v1beta1/query.rpc.Query"; -import * as _468 from "./tx/v1beta1/service.rpc.Service"; -import * as _469 from "./upgrade/v1beta1/query.rpc.Query"; -import * as _470 from "./base/node/v1beta1/query.rpc.Service"; -import * as _471 from "./authz/v1beta1/tx.rpc.msg"; -import * as _472 from "./bank/v1beta1/tx.rpc.msg"; -import * as _473 from "./crisis/v1beta1/tx.rpc.msg"; -import * as _474 from "./distribution/v1beta1/tx.rpc.msg"; -import * as _475 from "./evidence/v1beta1/tx.rpc.msg"; -import * as _476 from "./feegrant/v1beta1/tx.rpc.msg"; -import * as _477 from "./gov/v1/tx.rpc.msg"; -import * as _478 from "./gov/v1beta1/tx.rpc.msg"; -import * as _479 from "./group/v1/tx.rpc.msg"; -import * as _480 from "./nft/v1beta1/tx.rpc.msg"; -import * as _481 from "./slashing/v1beta1/tx.rpc.msg"; -import * as _482 from "./staking/v1beta1/tx.rpc.msg"; -import * as _483 from "./upgrade/v1beta1/tx.rpc.msg"; -import * as _484 from "./vesting/v1beta1/tx.rpc.msg"; -import * as _623 from "./lcd"; -import * as _624 from "./rpc.query"; -import * as _625 from "./cosmos-rpc-client.query"; -import * as _626 from "./rpc.tx"; -import * as _627 from "./cosmos-rpc-client.tx"; +import * as _55 from "./app/v1alpha1/config.js"; +import * as _56 from "./app/v1alpha1/module.js"; +import * as _57 from "./app/v1alpha1/query.js"; +import * as _58 from "./auth/v1beta1/auth.js"; +import * as _59 from "./auth/v1beta1/genesis.js"; +import * as _60 from "./auth/v1beta1/query.js"; +import * as _61 from "./authz/v1beta1/authz.js"; +import * as _62 from "./authz/v1beta1/genesis.js"; +import * as _63 from "./authz/v1beta1/query.js"; +import * as _64 from "./authz/v1beta1/tx.js"; +import * as _65 from "./bank/v1beta1/authz.js"; +import * as _66 from "./bank/v1beta1/bank.js"; +import * as _67 from "./bank/v1beta1/genesis.js"; +import * as _68 from "./bank/v1beta1/query.js"; +import * as _69 from "./bank/v1beta1/tx.js"; +import * as _70 from "./base/abci/v1beta1/abci.js"; +import * as _71 from "./base/kv/v1beta1/kv.js"; +import * as _72 from "./base/query/v1beta1/pagination.js"; +import * as _73 from "./base/reflection/v1beta1/reflection.js"; +import * as _74 from "./base/reflection/v2alpha1/reflection.js"; +import * as _75 from "./base/snapshots/v1beta1/snapshot.js"; +import * as _76 from "./base/store/v1beta1/commit_info.js"; +import * as _77 from "./base/store/v1beta1/listening.js"; +import * as _78 from "./base/tendermint/v1beta1/query.js"; +import * as _79 from "./base/v1beta1/coin.js"; +import * as _80 from "./capability/v1beta1/capability.js"; +import * as _81 from "./capability/v1beta1/genesis.js"; +import * as _82 from "./crisis/v1beta1/genesis.js"; +import * as _83 from "./crisis/v1beta1/tx.js"; +import * as _84 from "./crypto/ed25519/keys.js"; +import * as _85 from "./crypto/hd/v1/hd.js"; +import * as _86 from "./crypto/keyring/v1/record.js"; +import * as _87 from "./crypto/multisig/keys.js"; +import * as _88 from "./crypto/secp256k1/keys.js"; +import * as _89 from "./crypto/secp256r1/keys.js"; +import * as _90 from "./distribution/v1beta1/distribution.js"; +import * as _91 from "./distribution/v1beta1/genesis.js"; +import * as _92 from "./distribution/v1beta1/query.js"; +import * as _93 from "./distribution/v1beta1/tx.js"; +import * as _94 from "./evidence/v1beta1/evidence.js"; +import * as _95 from "./evidence/v1beta1/genesis.js"; +import * as _96 from "./evidence/v1beta1/query.js"; +import * as _97 from "./evidence/v1beta1/tx.js"; +import * as _98 from "./feegrant/v1beta1/feegrant.js"; +import * as _99 from "./feegrant/v1beta1/genesis.js"; +import * as _100 from "./feegrant/v1beta1/query.js"; +import * as _101 from "./feegrant/v1beta1/tx.js"; +import * as _102 from "./genutil/v1beta1/genesis.js"; +import * as _103 from "./gov/v1/genesis.js"; +import * as _104 from "./gov/v1/gov.js"; +import * as _105 from "./gov/v1/query.js"; +import * as _106 from "./gov/v1/tx.js"; +import * as _107 from "./gov/v1beta1/genesis.js"; +import * as _108 from "./gov/v1beta1/gov.js"; +import * as _109 from "./gov/v1beta1/query.js"; +import * as _110 from "./gov/v1beta1/tx.js"; +import * as _111 from "./group/v1/events.js"; +import * as _112 from "./group/v1/genesis.js"; +import * as _113 from "./group/v1/query.js"; +import * as _114 from "./group/v1/tx.js"; +import * as _115 from "./group/v1/types.js"; +import * as _116 from "./mint/v1beta1/genesis.js"; +import * as _117 from "./mint/v1beta1/mint.js"; +import * as _118 from "./mint/v1beta1/query.js"; +import * as _119 from "./msg/v1/msg.js"; +import * as _120 from "./nft/v1beta1/event.js"; +import * as _121 from "./nft/v1beta1/genesis.js"; +import * as _122 from "./nft/v1beta1/nft.js"; +import * as _123 from "./nft/v1beta1/query.js"; +import * as _124 from "./nft/v1beta1/tx.js"; +import * as _125 from "./orm/module/v1alpha1/module.js"; +import * as _126 from "./orm/v1/orm.js"; +import * as _127 from "./orm/v1alpha1/schema.js"; +import * as _128 from "./params/v1beta1/params.js"; +import * as _129 from "./params/v1beta1/query.js"; +import * as _130 from "./slashing/v1beta1/genesis.js"; +import * as _131 from "./slashing/v1beta1/query.js"; +import * as _132 from "./slashing/v1beta1/slashing.js"; +import * as _133 from "./slashing/v1beta1/tx.js"; +import * as _134 from "./staking/v1beta1/authz.js"; +import * as _135 from "./staking/v1beta1/genesis.js"; +import * as _136 from "./staking/v1beta1/query.js"; +import * as _137 from "./staking/v1beta1/staking.js"; +import * as _138 from "./staking/v1beta1/tx.js"; +import * as _139 from "./tx/signing/v1beta1/signing.js"; +import * as _140 from "./tx/v1beta1/service.js"; +import * as _141 from "./tx/v1beta1/tx.js"; +import * as _142 from "./upgrade/v1beta1/query.js"; +import * as _143 from "./upgrade/v1beta1/tx.js"; +import * as _144 from "./upgrade/v1beta1/upgrade.js"; +import * as _145 from "./vesting/v1beta1/tx.js"; +import * as _146 from "./vesting/v1beta1/vesting.js"; +import * as _353 from "./authz/v1beta1/tx.amino.js"; +import * as _354 from "./bank/v1beta1/tx.amino.js"; +import * as _355 from "./crisis/v1beta1/tx.amino.js"; +import * as _356 from "./distribution/v1beta1/tx.amino.js"; +import * as _357 from "./evidence/v1beta1/tx.amino.js"; +import * as _358 from "./feegrant/v1beta1/tx.amino.js"; +import * as _359 from "./gov/v1/tx.amino.js"; +import * as _360 from "./gov/v1beta1/tx.amino.js"; +import * as _361 from "./group/v1/tx.amino.js"; +import * as _362 from "./nft/v1beta1/tx.amino.js"; +import * as _363 from "./slashing/v1beta1/tx.amino.js"; +import * as _364 from "./staking/v1beta1/tx.amino.js"; +import * as _365 from "./upgrade/v1beta1/tx.amino.js"; +import * as _366 from "./vesting/v1beta1/tx.amino.js"; +import * as _367 from "./authz/v1beta1/tx.registry.js"; +import * as _368 from "./bank/v1beta1/tx.registry.js"; +import * as _369 from "./crisis/v1beta1/tx.registry.js"; +import * as _370 from "./distribution/v1beta1/tx.registry.js"; +import * as _371 from "./evidence/v1beta1/tx.registry.js"; +import * as _372 from "./feegrant/v1beta1/tx.registry.js"; +import * as _373 from "./gov/v1/tx.registry.js"; +import * as _374 from "./gov/v1beta1/tx.registry.js"; +import * as _375 from "./group/v1/tx.registry.js"; +import * as _376 from "./nft/v1beta1/tx.registry.js"; +import * as _377 from "./slashing/v1beta1/tx.registry.js"; +import * as _378 from "./staking/v1beta1/tx.registry.js"; +import * as _379 from "./upgrade/v1beta1/tx.registry.js"; +import * as _380 from "./vesting/v1beta1/tx.registry.js"; +import * as _381 from "./auth/v1beta1/query.lcd.js"; +import * as _382 from "./authz/v1beta1/query.lcd.js"; +import * as _383 from "./bank/v1beta1/query.lcd.js"; +import * as _384 from "./base/reflection/v1beta1/reflection.lcd.js"; +import * as _385 from "./base/reflection/v2alpha1/reflection.lcd.js"; +import * as _386 from "./base/tendermint/v1beta1/query.lcd.js"; +import * as _387 from "./distribution/v1beta1/query.lcd.js"; +import * as _388 from "./evidence/v1beta1/query.lcd.js"; +import * as _389 from "./feegrant/v1beta1/query.lcd.js"; +import * as _390 from "./gov/v1/query.lcd.js"; +import * as _391 from "./gov/v1beta1/query.lcd.js"; +import * as _392 from "./group/v1/query.lcd.js"; +import * as _393 from "./mint/v1beta1/query.lcd.js"; +import * as _394 from "./nft/v1beta1/query.lcd.js"; +import * as _395 from "./params/v1beta1/query.lcd.js"; +import * as _396 from "./slashing/v1beta1/query.lcd.js"; +import * as _397 from "./staking/v1beta1/query.lcd.js"; +import * as _398 from "./tx/v1beta1/service.lcd.js"; +import * as _399 from "./upgrade/v1beta1/query.lcd.js"; +import * as _400 from "./app/v1alpha1/query.rpc.Query.js"; +import * as _401 from "./auth/v1beta1/query.rpc.Query.js"; +import * as _402 from "./authz/v1beta1/query.rpc.Query.js"; +import * as _403 from "./bank/v1beta1/query.rpc.Query.js"; +import * as _404 from "./base/reflection/v1beta1/reflection.rpc.ReflectionService.js"; +import * as _405 from "./base/reflection/v2alpha1/reflection.rpc.ReflectionService.js"; +import * as _406 from "./base/tendermint/v1beta1/query.rpc.Service.js"; +import * as _407 from "./distribution/v1beta1/query.rpc.Query.js"; +import * as _408 from "./evidence/v1beta1/query.rpc.Query.js"; +import * as _409 from "./feegrant/v1beta1/query.rpc.Query.js"; +import * as _410 from "./gov/v1/query.rpc.Query.js"; +import * as _411 from "./gov/v1beta1/query.rpc.Query.js"; +import * as _412 from "./group/v1/query.rpc.Query.js"; +import * as _413 from "./mint/v1beta1/query.rpc.Query.js"; +import * as _414 from "./nft/v1beta1/query.rpc.Query.js"; +import * as _415 from "./params/v1beta1/query.rpc.Query.js"; +import * as _416 from "./slashing/v1beta1/query.rpc.Query.js"; +import * as _417 from "./staking/v1beta1/query.rpc.Query.js"; +import * as _418 from "./tx/v1beta1/service.rpc.Service.js"; +import * as _419 from "./upgrade/v1beta1/query.rpc.Query.js"; +import * as _420 from "./authz/v1beta1/tx.rpc.msg.js"; +import * as _421 from "./bank/v1beta1/tx.rpc.msg.js"; +import * as _422 from "./crisis/v1beta1/tx.rpc.msg.js"; +import * as _423 from "./distribution/v1beta1/tx.rpc.msg.js"; +import * as _424 from "./evidence/v1beta1/tx.rpc.msg.js"; +import * as _425 from "./feegrant/v1beta1/tx.rpc.msg.js"; +import * as _426 from "./gov/v1/tx.rpc.msg.js"; +import * as _427 from "./gov/v1beta1/tx.rpc.msg.js"; +import * as _428 from "./group/v1/tx.rpc.msg.js"; +import * as _429 from "./nft/v1beta1/tx.rpc.msg.js"; +import * as _430 from "./slashing/v1beta1/tx.rpc.msg.js"; +import * as _431 from "./staking/v1beta1/tx.rpc.msg.js"; +import * as _432 from "./upgrade/v1beta1/tx.rpc.msg.js"; +import * as _433 from "./vesting/v1beta1/tx.rpc.msg.js"; +import * as _539 from "./lcd.js"; +import * as _540 from "./rpc.query.js"; +import * as _541 from "./cosmos-rpc-client.query.js"; +import * as _542 from "./rpc.tx.js"; +import * as _543 from "./cosmos-rpc-client.tx.js"; export namespace cosmos { export namespace app { export const v1alpha1 = { ..._55, ..._56, ..._57, - ..._450 + ..._400 }; } export namespace auth { @@ -194,8 +190,8 @@ export namespace cosmos { ..._58, ..._59, ..._60, - ..._430, - ..._451 + ..._381, + ..._401 }; } export namespace authz { @@ -204,11 +200,11 @@ export namespace cosmos { ..._62, ..._63, ..._64, + ..._353, + ..._367, + ..._382, ..._402, - ..._416, - ..._431, - ..._452, - ..._471 + ..._420 }; } export namespace bank { @@ -218,11 +214,11 @@ export namespace cosmos { ..._67, ..._68, ..._69, + ..._354, + ..._368, + ..._383, ..._403, - ..._417, - ..._432, - ..._453, - ..._472 + ..._421 }; } export namespace base { @@ -244,13 +240,13 @@ export namespace cosmos { export namespace reflection { export const v1beta1 = { ..._73, - ..._433, - ..._454 + ..._384, + ..._404 }; export const v2alpha1 = { ..._74, - ..._434, - ..._455 + ..._385, + ..._405 }; } export namespace snapshots { @@ -267,262 +263,250 @@ export namespace cosmos { export namespace tendermint { export const v1beta1 = { ..._78, - ..._435, - ..._456 + ..._386, + ..._406 }; } export const v1beta1 = { ..._79 }; - export namespace node { - export const v1beta1 = { - ..._80, - ..._449, - ..._470 - }; - } } export namespace capability { export const v1beta1 = { - ..._81, - ..._82 + ..._80, + ..._81 }; } export namespace crisis { export const v1beta1 = { + ..._82, ..._83, - ..._84, - ..._404, - ..._418, - ..._473 + ..._355, + ..._369, + ..._422 }; } export namespace crypto { export const ed25519 = { - ..._85 + ..._84 }; export namespace hd { export const v1 = { - ..._86 + ..._85 }; } export namespace keyring { export const v1 = { - ..._87 + ..._86 }; } export const multisig = { - ..._88 + ..._87 }; export const secp256k1 = { - ..._89 + ..._88 }; export const secp256r1 = { - ..._90 + ..._89 }; } export namespace distribution { export const v1beta1 = { + ..._90, ..._91, ..._92, ..._93, - ..._94, - ..._405, - ..._419, - ..._436, - ..._457, - ..._474 + ..._356, + ..._370, + ..._387, + ..._407, + ..._423 }; } export namespace evidence { export const v1beta1 = { + ..._94, ..._95, ..._96, ..._97, - ..._98, - ..._406, - ..._420, - ..._437, - ..._458, - ..._475 + ..._357, + ..._371, + ..._388, + ..._408, + ..._424 }; } export namespace feegrant { export const v1beta1 = { + ..._98, ..._99, ..._100, ..._101, - ..._102, - ..._407, - ..._421, - ..._438, - ..._459, - ..._476 + ..._358, + ..._372, + ..._389, + ..._409, + ..._425 }; } export namespace genutil { export const v1beta1 = { - ..._103 + ..._102 }; } export namespace gov { export const v1 = { + ..._103, ..._104, ..._105, ..._106, - ..._107, - ..._408, - ..._422, - ..._439, - ..._460, - ..._477 + ..._359, + ..._373, + ..._390, + ..._410, + ..._426 }; export const v1beta1 = { + ..._107, ..._108, ..._109, ..._110, - ..._111, - ..._409, - ..._423, - ..._440, - ..._461, - ..._478 + ..._360, + ..._374, + ..._391, + ..._411, + ..._427 }; } export namespace group { export const v1 = { + ..._111, ..._112, ..._113, ..._114, ..._115, - ..._116, - ..._410, - ..._424, - ..._441, - ..._462, - ..._479 + ..._361, + ..._375, + ..._392, + ..._412, + ..._428 }; } export namespace mint { export const v1beta1 = { + ..._116, ..._117, ..._118, - ..._119, - ..._442, - ..._463 + ..._393, + ..._413 }; } export namespace msg { export const v1 = { - ..._120 + ..._119 }; } export namespace nft { export const v1beta1 = { + ..._120, ..._121, ..._122, ..._123, ..._124, - ..._125, - ..._411, - ..._425, - ..._443, - ..._464, - ..._480 + ..._362, + ..._376, + ..._394, + ..._414, + ..._429 }; } export namespace orm { export namespace module { export const v1alpha1 = { - ..._126 + ..._125 }; } export const v1 = { - ..._127 + ..._126 }; export const v1alpha1 = { - ..._128 + ..._127 }; } export namespace params { export const v1beta1 = { + ..._128, ..._129, - ..._130, - ..._444, - ..._465 + ..._395, + ..._415 }; } export namespace slashing { export const v1beta1 = { + ..._130, ..._131, ..._132, ..._133, - ..._134, - ..._412, - ..._426, - ..._445, - ..._466, - ..._481 + ..._363, + ..._377, + ..._396, + ..._416, + ..._430 }; } export namespace staking { export const v1beta1 = { + ..._134, ..._135, ..._136, ..._137, ..._138, - ..._139, - ..._413, - ..._427, - ..._446, - ..._467, - ..._482 + ..._364, + ..._378, + ..._397, + ..._417, + ..._431 }; } export namespace tx { export namespace signing { export const v1beta1 = { - ..._140 + ..._139 }; } export const v1beta1 = { + ..._140, ..._141, - ..._142, - ..._447, - ..._468 + ..._398, + ..._418 }; } export namespace upgrade { export const v1beta1 = { + ..._142, ..._143, ..._144, - ..._145, - ..._414, - ..._428, - ..._448, - ..._469, - ..._483 + ..._365, + ..._379, + ..._399, + ..._419, + ..._432 }; } export namespace vesting { export const v1beta1 = { + ..._145, ..._146, - ..._147, - ..._415, - ..._429, - ..._484 - }; - } - export namespace ics23 { - export const v1 = { - ..._148 + ..._366, + ..._380, + ..._433 }; } export const ClientFactory = { - ..._623, - ..._624, - ..._625, - ..._626, - ..._627 + ..._539, + ..._540, + ..._541, + ..._542, + ..._543 }; } \ No newline at end of file diff --git a/__fixtures__/v-next/outputv4/cosmos/client.ts b/__fixtures__/v-next/outputv4/cosmos/client.ts index d71646865f..d0d7602d75 100644 --- a/__fixtures__/v-next/outputv4/cosmos/client.ts +++ b/__fixtures__/v-next/outputv4/cosmos/client.ts @@ -1,34 +1,34 @@ 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 cosmosBankV1beta1TxRegistry from "./bank/v1beta1/tx.registry"; -import * as cosmosCrisisV1beta1TxRegistry from "./crisis/v1beta1/tx.registry"; -import * as cosmosDistributionV1beta1TxRegistry from "./distribution/v1beta1/tx.registry"; -import * as cosmosEvidenceV1beta1TxRegistry from "./evidence/v1beta1/tx.registry"; -import * as cosmosFeegrantV1beta1TxRegistry from "./feegrant/v1beta1/tx.registry"; -import * as cosmosGovV1TxRegistry from "./gov/v1/tx.registry"; -import * as cosmosGovV1beta1TxRegistry from "./gov/v1beta1/tx.registry"; -import * as cosmosGroupV1TxRegistry from "./group/v1/tx.registry"; -import * as cosmosNftV1beta1TxRegistry from "./nft/v1beta1/tx.registry"; -import * as cosmosSlashingV1beta1TxRegistry from "./slashing/v1beta1/tx.registry"; -import * as cosmosStakingV1beta1TxRegistry from "./staking/v1beta1/tx.registry"; -import * as cosmosUpgradeV1beta1TxRegistry from "./upgrade/v1beta1/tx.registry"; -import * as cosmosVestingV1beta1TxRegistry from "./vesting/v1beta1/tx.registry"; -import * as cosmosAuthzV1beta1TxAmino from "./authz/v1beta1/tx.amino"; -import * as cosmosBankV1beta1TxAmino from "./bank/v1beta1/tx.amino"; -import * as cosmosCrisisV1beta1TxAmino from "./crisis/v1beta1/tx.amino"; -import * as cosmosDistributionV1beta1TxAmino from "./distribution/v1beta1/tx.amino"; -import * as cosmosEvidenceV1beta1TxAmino from "./evidence/v1beta1/tx.amino"; -import * as cosmosFeegrantV1beta1TxAmino from "./feegrant/v1beta1/tx.amino"; -import * as cosmosGovV1TxAmino from "./gov/v1/tx.amino"; -import * as cosmosGovV1beta1TxAmino from "./gov/v1beta1/tx.amino"; -import * as cosmosGroupV1TxAmino from "./group/v1/tx.amino"; -import * as cosmosNftV1beta1TxAmino from "./nft/v1beta1/tx.amino"; -import * as cosmosSlashingV1beta1TxAmino from "./slashing/v1beta1/tx.amino"; -import * as cosmosStakingV1beta1TxAmino from "./staking/v1beta1/tx.amino"; -import * as cosmosUpgradeV1beta1TxAmino from "./upgrade/v1beta1/tx.amino"; -import * as cosmosVestingV1beta1TxAmino from "./vesting/v1beta1/tx.amino"; +import * as cosmosAuthzV1beta1TxRegistry from "./authz/v1beta1/tx.registry.js"; +import * as cosmosBankV1beta1TxRegistry from "./bank/v1beta1/tx.registry.js"; +import * as cosmosCrisisV1beta1TxRegistry from "./crisis/v1beta1/tx.registry.js"; +import * as cosmosDistributionV1beta1TxRegistry from "./distribution/v1beta1/tx.registry.js"; +import * as cosmosEvidenceV1beta1TxRegistry from "./evidence/v1beta1/tx.registry.js"; +import * as cosmosFeegrantV1beta1TxRegistry from "./feegrant/v1beta1/tx.registry.js"; +import * as cosmosGovV1TxRegistry from "./gov/v1/tx.registry.js"; +import * as cosmosGovV1beta1TxRegistry from "./gov/v1beta1/tx.registry.js"; +import * as cosmosGroupV1TxRegistry from "./group/v1/tx.registry.js"; +import * as cosmosNftV1beta1TxRegistry from "./nft/v1beta1/tx.registry.js"; +import * as cosmosSlashingV1beta1TxRegistry from "./slashing/v1beta1/tx.registry.js"; +import * as cosmosStakingV1beta1TxRegistry from "./staking/v1beta1/tx.registry.js"; +import * as cosmosUpgradeV1beta1TxRegistry from "./upgrade/v1beta1/tx.registry.js"; +import * as cosmosVestingV1beta1TxRegistry from "./vesting/v1beta1/tx.registry.js"; +import * as cosmosAuthzV1beta1TxAmino from "./authz/v1beta1/tx.amino.js"; +import * as cosmosBankV1beta1TxAmino from "./bank/v1beta1/tx.amino.js"; +import * as cosmosCrisisV1beta1TxAmino from "./crisis/v1beta1/tx.amino.js"; +import * as cosmosDistributionV1beta1TxAmino from "./distribution/v1beta1/tx.amino.js"; +import * as cosmosEvidenceV1beta1TxAmino from "./evidence/v1beta1/tx.amino.js"; +import * as cosmosFeegrantV1beta1TxAmino from "./feegrant/v1beta1/tx.amino.js"; +import * as cosmosGovV1TxAmino from "./gov/v1/tx.amino.js"; +import * as cosmosGovV1beta1TxAmino from "./gov/v1beta1/tx.amino.js"; +import * as cosmosGroupV1TxAmino from "./group/v1/tx.amino.js"; +import * as cosmosNftV1beta1TxAmino from "./nft/v1beta1/tx.amino.js"; +import * as cosmosSlashingV1beta1TxAmino from "./slashing/v1beta1/tx.amino.js"; +import * as cosmosStakingV1beta1TxAmino from "./staking/v1beta1/tx.amino.js"; +import * as cosmosUpgradeV1beta1TxAmino from "./upgrade/v1beta1/tx.amino.js"; +import * as cosmosVestingV1beta1TxAmino from "./vesting/v1beta1/tx.amino.js"; export const cosmosAminoConverters = { ...cosmosAuthzV1beta1TxAmino.AminoConverter, ...cosmosBankV1beta1TxAmino.AminoConverter, diff --git a/__fixtures__/v-next/outputv4/cosmos/cosmos-rpc-client.query.ts b/__fixtures__/v-next/outputv4/cosmos/cosmos-rpc-client.query.ts index 2928925a4a..bc37ce0db3 100644 --- a/__fixtures__/v-next/outputv4/cosmos/cosmos-rpc-client.query.ts +++ b/__fixtures__/v-next/outputv4/cosmos/cosmos-rpc-client.query.ts @@ -1,20 +1,20 @@ -import { Rpc } from "../helpers"; -import { Tendermint34Client, HttpEndpoint } from "@cosmjs/tendermint-rpc"; +import { Rpc } from "../helpers.js"; +import { connectComet, HttpEndpoint } from "@cosmjs/tendermint-rpc"; import { QueryClient } from "@cosmjs/stargate"; export const createCosmicRPCQueryClient = async ({ rpcEndpoint }: { rpcEndpoint: string | HttpEndpoint; }) => { - const tmClient = await Tendermint34Client.connect(rpcEndpoint); + const tmClient = await connectComet(rpcEndpoint); const client = new QueryClient(tmClient); return { cosmos: { bank: { - v1beta1: (await import("./bank/v1beta1/query.rpc.Query")).createRpcQueryExtension(client) + v1beta1: (await import("./bank/v1beta1/query.rpc.Query.js")).createRpcQueryExtension(client) }, gov: { - v1beta1: (await import("./gov/v1beta1/query.rpc.Query")).createRpcQueryExtension(client) + v1beta1: (await import("./gov/v1beta1/query.rpc.Query.js")).createRpcQueryExtension(client) } } }; diff --git a/__fixtures__/v-next/outputv4/cosmos/cosmos-rpc-client.tx.ts b/__fixtures__/v-next/outputv4/cosmos/cosmos-rpc-client.tx.ts index 796bd656a8..c0ba0ed327 100644 --- a/__fixtures__/v-next/outputv4/cosmos/cosmos-rpc-client.tx.ts +++ b/__fixtures__/v-next/outputv4/cosmos/cosmos-rpc-client.tx.ts @@ -1,4 +1,4 @@ -import { Rpc } from "../helpers"; +import { Rpc } from "../helpers.js"; export const createCosmicRPCTxClient = async ({ rpc }: { @@ -6,10 +6,10 @@ export const createCosmicRPCTxClient = async ({ }) => ({ cosmos: { bank: { - v1beta1: new (await import("./bank/v1beta1/tx.rpc.msg")).MsgClientImpl(rpc) + v1beta1: new (await import("./bank/v1beta1/tx.rpc.msg.js")).MsgClientImpl(rpc) }, gov: { - v1beta1: new (await import("./gov/v1beta1/tx.rpc.msg")).MsgClientImpl(rpc) + v1beta1: new (await import("./gov/v1beta1/tx.rpc.msg.js")).MsgClientImpl(rpc) } } }); \ No newline at end of file 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..aff0ab7b6c 100644 --- a/__fixtures__/v-next/outputv4/cosmos/crisis/v1beta1/tx.amino.ts +++ b/__fixtures__/v-next/outputv4/cosmos/crisis/v1beta1/tx.amino.ts @@ -1,5 +1,5 @@ import { AminoMsg } from "@cosmjs/amino"; -import { MsgVerifyInvariant, MsgVerifyInvariantSDKType } from "./tx"; +import { MsgVerifyInvariant, MsgVerifyInvariantSDKType } from "./tx.js"; export interface MsgVerifyInvariantAminoType extends AminoMsg { type: "cosmos-sdk/MsgVerifyInvariant"; value: { diff --git a/__fixtures__/v-next/outputv4/cosmos/crisis/v1beta1/tx.registry.ts b/__fixtures__/v-next/outputv4/cosmos/crisis/v1beta1/tx.registry.ts index 77f206ab58..19c8d0c9d5 100644 --- a/__fixtures__/v-next/outputv4/cosmos/crisis/v1beta1/tx.registry.ts +++ b/__fixtures__/v-next/outputv4/cosmos/crisis/v1beta1/tx.registry.ts @@ -1,5 +1,5 @@ import { GeneratedType, Registry } from "@cosmjs/proto-signing"; -import { MsgVerifyInvariant, MsgVerifyInvariantSDKType } from "./tx"; +import { MsgVerifyInvariant, MsgVerifyInvariantSDKType } from "./tx.js"; export const registry: ReadonlyArray<[string, GeneratedType]> = [["/cosmos.crisis.v1beta1.MsgVerifyInvariant", MsgVerifyInvariant]]; export const load = (protoRegistry: Registry) => { registry.forEach(([typeUrl, mod]) => { diff --git a/__fixtures__/v-next/outputv4/cosmos/crisis/v1beta1/tx.rpc.msg.ts b/__fixtures__/v-next/outputv4/cosmos/crisis/v1beta1/tx.rpc.msg.ts index 0c0a897cff..a0d77e7f67 100644 --- a/__fixtures__/v-next/outputv4/cosmos/crisis/v1beta1/tx.rpc.msg.ts +++ b/__fixtures__/v-next/outputv4/cosmos/crisis/v1beta1/tx.rpc.msg.ts @@ -1,6 +1,6 @@ -import { Rpc } from "../../../helpers"; -import { BinaryReader } from "../../../binary"; -import { MsgVerifyInvariant, MsgVerifyInvariantSDKType, MsgVerifyInvariantResponse, MsgVerifyInvariantResponseSDKType } from "./tx"; +import { Rpc } from "../../../helpers.js"; +import { BinaryReader } from "../../../binary.js"; +import { MsgVerifyInvariant, MsgVerifyInvariantSDKType, MsgVerifyInvariantResponse, MsgVerifyInvariantResponseSDKType } from "./tx.js"; /** Msg defines the bank Msg service. */ export interface Msg { /** VerifyInvariant defines a method to verify a particular invariance. */ diff --git a/__fixtures__/v-next/outputv4/cosmos/distribution/v1beta1/query.lcd.ts b/__fixtures__/v-next/outputv4/cosmos/distribution/v1beta1/query.lcd.ts index 0637971dae..671459f85d 100644 --- a/__fixtures__/v-next/outputv4/cosmos/distribution/v1beta1/query.lcd.ts +++ b/__fixtures__/v-next/outputv4/cosmos/distribution/v1beta1/query.lcd.ts @@ -1,9 +1,9 @@ -import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../base/query/v1beta1/pagination"; -import { Params, ParamsSDKType, ValidatorOutstandingRewards, ValidatorOutstandingRewardsSDKType, ValidatorAccumulatedCommission, ValidatorAccumulatedCommissionSDKType, ValidatorSlashEvent, ValidatorSlashEventSDKType, DelegationDelegatorReward, DelegationDelegatorRewardSDKType } from "./distribution"; -import { DecCoin, DecCoinSDKType } from "../../base/v1beta1/coin"; -import { setPaginationParams } from "../../../helpers"; +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../base/query/v1beta1/pagination.js"; +import { Params, ParamsSDKType, ValidatorOutstandingRewards, ValidatorOutstandingRewardsSDKType, ValidatorAccumulatedCommission, ValidatorAccumulatedCommissionSDKType, ValidatorSlashEvent, ValidatorSlashEventSDKType, DelegationDelegatorReward, DelegationDelegatorRewardSDKType } from "./distribution.js"; +import { DecCoin, DecCoinSDKType } from "../../base/v1beta1/coin.js"; +import { setPaginationParams } from "../../../helpers.js"; import { LCDClient } from "@cosmology/lcd"; -import { QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType, QueryValidatorOutstandingRewardsRequest, QueryValidatorOutstandingRewardsRequestSDKType, QueryValidatorOutstandingRewardsResponse, QueryValidatorOutstandingRewardsResponseSDKType, QueryValidatorCommissionRequest, QueryValidatorCommissionRequestSDKType, QueryValidatorCommissionResponse, QueryValidatorCommissionResponseSDKType, QueryValidatorSlashesRequest, QueryValidatorSlashesRequestSDKType, QueryValidatorSlashesResponse, QueryValidatorSlashesResponseSDKType, QueryDelegationRewardsRequest, QueryDelegationRewardsRequestSDKType, QueryDelegationRewardsResponse, QueryDelegationRewardsResponseSDKType, QueryDelegationTotalRewardsRequest, QueryDelegationTotalRewardsRequestSDKType, QueryDelegationTotalRewardsResponse, QueryDelegationTotalRewardsResponseSDKType, QueryDelegatorValidatorsRequest, QueryDelegatorValidatorsRequestSDKType, QueryDelegatorValidatorsResponse, QueryDelegatorValidatorsResponseSDKType, QueryDelegatorWithdrawAddressRequest, QueryDelegatorWithdrawAddressRequestSDKType, QueryDelegatorWithdrawAddressResponse, QueryDelegatorWithdrawAddressResponseSDKType, QueryCommunityPoolRequest, QueryCommunityPoolRequestSDKType, QueryCommunityPoolResponse, QueryCommunityPoolResponseSDKType } from "./query"; +import { QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType, QueryValidatorOutstandingRewardsRequest, QueryValidatorOutstandingRewardsRequestSDKType, QueryValidatorOutstandingRewardsResponse, QueryValidatorOutstandingRewardsResponseSDKType, QueryValidatorCommissionRequest, QueryValidatorCommissionRequestSDKType, QueryValidatorCommissionResponse, QueryValidatorCommissionResponseSDKType, QueryValidatorSlashesRequest, QueryValidatorSlashesRequestSDKType, QueryValidatorSlashesResponse, QueryValidatorSlashesResponseSDKType, QueryDelegationRewardsRequest, QueryDelegationRewardsRequestSDKType, QueryDelegationRewardsResponse, QueryDelegationRewardsResponseSDKType, QueryDelegationTotalRewardsRequest, QueryDelegationTotalRewardsRequestSDKType, QueryDelegationTotalRewardsResponse, QueryDelegationTotalRewardsResponseSDKType, QueryDelegatorValidatorsRequest, QueryDelegatorValidatorsRequestSDKType, QueryDelegatorValidatorsResponse, QueryDelegatorValidatorsResponseSDKType, QueryDelegatorWithdrawAddressRequest, QueryDelegatorWithdrawAddressRequestSDKType, QueryDelegatorWithdrawAddressResponse, QueryDelegatorWithdrawAddressResponseSDKType, QueryCommunityPoolRequest, QueryCommunityPoolRequestSDKType, QueryCommunityPoolResponse, QueryCommunityPoolResponseSDKType } from "./query.js"; export class LCDQueryClient { req: LCDClient; constructor({ diff --git a/__fixtures__/v-next/outputv4/cosmos/distribution/v1beta1/query.rpc.Query.ts b/__fixtures__/v-next/outputv4/cosmos/distribution/v1beta1/query.rpc.Query.ts index 2948d63594..5226a4c28c 100644 --- a/__fixtures__/v-next/outputv4/cosmos/distribution/v1beta1/query.rpc.Query.ts +++ b/__fixtures__/v-next/outputv4/cosmos/distribution/v1beta1/query.rpc.Query.ts @@ -1,10 +1,10 @@ -import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../base/query/v1beta1/pagination"; -import { Params, ParamsSDKType, ValidatorOutstandingRewards, ValidatorOutstandingRewardsSDKType, ValidatorAccumulatedCommission, ValidatorAccumulatedCommissionSDKType, ValidatorSlashEvent, ValidatorSlashEventSDKType, DelegationDelegatorReward, DelegationDelegatorRewardSDKType } from "./distribution"; -import { DecCoin, DecCoinSDKType } from "../../base/v1beta1/coin"; -import { Rpc } from "../../../helpers"; -import { BinaryReader } from "../../../binary"; +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../base/query/v1beta1/pagination.js"; +import { Params, ParamsSDKType, ValidatorOutstandingRewards, ValidatorOutstandingRewardsSDKType, ValidatorAccumulatedCommission, ValidatorAccumulatedCommissionSDKType, ValidatorSlashEvent, ValidatorSlashEventSDKType, DelegationDelegatorReward, DelegationDelegatorRewardSDKType } from "./distribution.js"; +import { DecCoin, DecCoinSDKType } from "../../base/v1beta1/coin.js"; +import { Rpc } from "../../../helpers.js"; +import { BinaryReader } from "../../../binary.js"; import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; -import { QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType, QueryValidatorOutstandingRewardsRequest, QueryValidatorOutstandingRewardsRequestSDKType, QueryValidatorOutstandingRewardsResponse, QueryValidatorOutstandingRewardsResponseSDKType, QueryValidatorCommissionRequest, QueryValidatorCommissionRequestSDKType, QueryValidatorCommissionResponse, QueryValidatorCommissionResponseSDKType, QueryValidatorSlashesRequest, QueryValidatorSlashesRequestSDKType, QueryValidatorSlashesResponse, QueryValidatorSlashesResponseSDKType, QueryDelegationRewardsRequest, QueryDelegationRewardsRequestSDKType, QueryDelegationRewardsResponse, QueryDelegationRewardsResponseSDKType, QueryDelegationTotalRewardsRequest, QueryDelegationTotalRewardsRequestSDKType, QueryDelegationTotalRewardsResponse, QueryDelegationTotalRewardsResponseSDKType, QueryDelegatorValidatorsRequest, QueryDelegatorValidatorsRequestSDKType, QueryDelegatorValidatorsResponse, QueryDelegatorValidatorsResponseSDKType, QueryDelegatorWithdrawAddressRequest, QueryDelegatorWithdrawAddressRequestSDKType, QueryDelegatorWithdrawAddressResponse, QueryDelegatorWithdrawAddressResponseSDKType, QueryCommunityPoolRequest, QueryCommunityPoolRequestSDKType, QueryCommunityPoolResponse, QueryCommunityPoolResponseSDKType, ReactiveQueryParamsRequest, ReactiveQueryValidatorOutstandingRewardsRequest, ReactiveQueryValidatorCommissionRequest, ReactiveQueryValidatorSlashesRequest, ReactiveQueryDelegationRewardsRequest, ReactiveQueryDelegationTotalRewardsRequest, ReactiveQueryDelegatorValidatorsRequest, ReactiveQueryDelegatorWithdrawAddressRequest, ReactiveQueryCommunityPoolRequest } from "./query"; +import { QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType, QueryValidatorOutstandingRewardsRequest, QueryValidatorOutstandingRewardsRequestSDKType, QueryValidatorOutstandingRewardsResponse, QueryValidatorOutstandingRewardsResponseSDKType, QueryValidatorCommissionRequest, QueryValidatorCommissionRequestSDKType, QueryValidatorCommissionResponse, QueryValidatorCommissionResponseSDKType, QueryValidatorSlashesRequest, QueryValidatorSlashesRequestSDKType, QueryValidatorSlashesResponse, QueryValidatorSlashesResponseSDKType, QueryDelegationRewardsRequest, QueryDelegationRewardsRequestSDKType, QueryDelegationRewardsResponse, QueryDelegationRewardsResponseSDKType, QueryDelegationTotalRewardsRequest, QueryDelegationTotalRewardsRequestSDKType, QueryDelegationTotalRewardsResponse, QueryDelegationTotalRewardsResponseSDKType, QueryDelegatorValidatorsRequest, QueryDelegatorValidatorsRequestSDKType, QueryDelegatorValidatorsResponse, QueryDelegatorValidatorsResponseSDKType, QueryDelegatorWithdrawAddressRequest, QueryDelegatorWithdrawAddressRequestSDKType, QueryDelegatorWithdrawAddressResponse, QueryDelegatorWithdrawAddressResponseSDKType, QueryCommunityPoolRequest, QueryCommunityPoolRequestSDKType, QueryCommunityPoolResponse, QueryCommunityPoolResponseSDKType } from "./query.js"; /** Query defines the gRPC querier service for distribution module. */ export interface Query { /** Params queries params of the distribution module. */ 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..6bf3e36a32 100644 --- a/__fixtures__/v-next/outputv4/cosmos/distribution/v1beta1/tx.amino.ts +++ b/__fixtures__/v-next/outputv4/cosmos/distribution/v1beta1/tx.amino.ts @@ -1,6 +1,6 @@ -import { Coin, CoinSDKType } from "../../base/v1beta1/coin"; +import { Coin, CoinSDKType } from "../../base/v1beta1/coin.js"; import { AminoMsg } from "@cosmjs/amino"; -import { MsgSetWithdrawAddress, MsgSetWithdrawAddressSDKType, MsgWithdrawDelegatorReward, MsgWithdrawDelegatorRewardSDKType, MsgWithdrawValidatorCommission, MsgWithdrawValidatorCommissionSDKType, MsgFundCommunityPool, MsgFundCommunityPoolSDKType } from "./tx"; +import { MsgSetWithdrawAddress, MsgSetWithdrawAddressSDKType, MsgWithdrawDelegatorReward, MsgWithdrawDelegatorRewardSDKType, MsgWithdrawValidatorCommission, MsgWithdrawValidatorCommissionSDKType, MsgFundCommunityPool, MsgFundCommunityPoolSDKType } from "./tx.js"; export interface MsgSetWithdrawAddressAminoType extends AminoMsg { type: "cosmos-sdk/MsgModifyWithdrawAddress"; value: { diff --git a/__fixtures__/v-next/outputv4/cosmos/distribution/v1beta1/tx.registry.ts b/__fixtures__/v-next/outputv4/cosmos/distribution/v1beta1/tx.registry.ts index 6241519ba0..bba6fce4eb 100644 --- a/__fixtures__/v-next/outputv4/cosmos/distribution/v1beta1/tx.registry.ts +++ b/__fixtures__/v-next/outputv4/cosmos/distribution/v1beta1/tx.registry.ts @@ -1,6 +1,6 @@ -import { Coin, CoinSDKType } from "../../base/v1beta1/coin"; +import { Coin, CoinSDKType } from "../../base/v1beta1/coin.js"; import { GeneratedType, Registry } from "@cosmjs/proto-signing"; -import { MsgSetWithdrawAddress, MsgSetWithdrawAddressSDKType, MsgWithdrawDelegatorReward, MsgWithdrawDelegatorRewardSDKType, MsgWithdrawValidatorCommission, MsgWithdrawValidatorCommissionSDKType, MsgFundCommunityPool, MsgFundCommunityPoolSDKType } from "./tx"; +import { MsgSetWithdrawAddress, MsgSetWithdrawAddressSDKType, MsgWithdrawDelegatorReward, MsgWithdrawDelegatorRewardSDKType, MsgWithdrawValidatorCommission, MsgWithdrawValidatorCommissionSDKType, MsgFundCommunityPool, MsgFundCommunityPoolSDKType } from "./tx.js"; export const registry: ReadonlyArray<[string, GeneratedType]> = [["/cosmos.distribution.v1beta1.MsgSetWithdrawAddress", MsgSetWithdrawAddress], ["/cosmos.distribution.v1beta1.MsgWithdrawDelegatorReward", MsgWithdrawDelegatorReward], ["/cosmos.distribution.v1beta1.MsgWithdrawValidatorCommission", MsgWithdrawValidatorCommission], ["/cosmos.distribution.v1beta1.MsgFundCommunityPool", MsgFundCommunityPool]]; export const load = (protoRegistry: Registry) => { registry.forEach(([typeUrl, mod]) => { diff --git a/__fixtures__/v-next/outputv4/cosmos/distribution/v1beta1/tx.rpc.msg.ts b/__fixtures__/v-next/outputv4/cosmos/distribution/v1beta1/tx.rpc.msg.ts index 4a6132c737..0701f88ef2 100644 --- a/__fixtures__/v-next/outputv4/cosmos/distribution/v1beta1/tx.rpc.msg.ts +++ b/__fixtures__/v-next/outputv4/cosmos/distribution/v1beta1/tx.rpc.msg.ts @@ -1,7 +1,7 @@ -import { Coin, CoinSDKType } from "../../base/v1beta1/coin"; -import { Rpc } from "../../../helpers"; -import { BinaryReader } from "../../../binary"; -import { MsgSetWithdrawAddress, MsgSetWithdrawAddressSDKType, MsgSetWithdrawAddressResponse, MsgSetWithdrawAddressResponseSDKType, MsgWithdrawDelegatorReward, MsgWithdrawDelegatorRewardSDKType, MsgWithdrawDelegatorRewardResponse, MsgWithdrawDelegatorRewardResponseSDKType, MsgWithdrawValidatorCommission, MsgWithdrawValidatorCommissionSDKType, MsgWithdrawValidatorCommissionResponse, MsgWithdrawValidatorCommissionResponseSDKType, MsgFundCommunityPool, MsgFundCommunityPoolSDKType, MsgFundCommunityPoolResponse, MsgFundCommunityPoolResponseSDKType } from "./tx"; +import { Coin, CoinSDKType } from "../../base/v1beta1/coin.js"; +import { Rpc } from "../../../helpers.js"; +import { BinaryReader } from "../../../binary.js"; +import { MsgSetWithdrawAddress, MsgSetWithdrawAddressSDKType, MsgSetWithdrawAddressResponse, MsgSetWithdrawAddressResponseSDKType, MsgWithdrawDelegatorReward, MsgWithdrawDelegatorRewardSDKType, MsgWithdrawDelegatorRewardResponse, MsgWithdrawDelegatorRewardResponseSDKType, MsgWithdrawValidatorCommission, MsgWithdrawValidatorCommissionSDKType, MsgWithdrawValidatorCommissionResponse, MsgWithdrawValidatorCommissionResponseSDKType, MsgFundCommunityPool, MsgFundCommunityPoolSDKType, MsgFundCommunityPoolResponse, MsgFundCommunityPoolResponseSDKType } from "./tx.js"; /** Msg defines the distribution Msg service. */ export interface Msg { /** diff --git a/__fixtures__/v-next/outputv4/cosmos/evidence/v1beta1/query.lcd.ts b/__fixtures__/v-next/outputv4/cosmos/evidence/v1beta1/query.lcd.ts index 1ce1230060..bb742ee30e 100644 --- a/__fixtures__/v-next/outputv4/cosmos/evidence/v1beta1/query.lcd.ts +++ b/__fixtures__/v-next/outputv4/cosmos/evidence/v1beta1/query.lcd.ts @@ -1,8 +1,8 @@ -import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../base/query/v1beta1/pagination"; -import { Any, AnySDKType } from "../../../google/protobuf/any"; -import { setPaginationParams } from "../../../helpers"; +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../base/query/v1beta1/pagination.js"; +import { Any, AnySDKType } from "../../../google/protobuf/any.js"; +import { setPaginationParams } from "../../../helpers.js"; import { LCDClient } from "@cosmology/lcd"; -import { QueryEvidenceRequest, QueryEvidenceRequestSDKType, QueryEvidenceResponse, QueryEvidenceResponseSDKType, QueryAllEvidenceRequest, QueryAllEvidenceRequestSDKType, QueryAllEvidenceResponse, QueryAllEvidenceResponseSDKType } from "./query"; +import { QueryEvidenceRequest, QueryEvidenceRequestSDKType, QueryEvidenceResponse, QueryEvidenceResponseSDKType, QueryAllEvidenceRequest, QueryAllEvidenceRequestSDKType, QueryAllEvidenceResponse, QueryAllEvidenceResponseSDKType } from "./query.js"; export class LCDQueryClient { req: LCDClient; constructor({ @@ -21,7 +21,7 @@ export class LCDQueryClient { } /* AllEvidence queries all evidence. */ async allEvidence(params: QueryAllEvidenceRequest = { - pagination: undefined + pagination: PageRequest.fromPartial({}) }): Promise { const options: any = { params: {} diff --git a/__fixtures__/v-next/outputv4/cosmos/evidence/v1beta1/query.rpc.Query.ts b/__fixtures__/v-next/outputv4/cosmos/evidence/v1beta1/query.rpc.Query.ts index 3c48a14072..92090f9b74 100644 --- a/__fixtures__/v-next/outputv4/cosmos/evidence/v1beta1/query.rpc.Query.ts +++ b/__fixtures__/v-next/outputv4/cosmos/evidence/v1beta1/query.rpc.Query.ts @@ -1,9 +1,9 @@ -import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../base/query/v1beta1/pagination"; -import { Any, AnySDKType } from "../../../google/protobuf/any"; -import { Rpc } from "../../../helpers"; -import { BinaryReader } from "../../../binary"; +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../base/query/v1beta1/pagination.js"; +import { Any, AnySDKType } from "../../../google/protobuf/any.js"; +import { Rpc } from "../../../helpers.js"; +import { BinaryReader } from "../../../binary.js"; import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; -import { QueryEvidenceRequest, QueryEvidenceRequestSDKType, QueryEvidenceResponse, QueryEvidenceResponseSDKType, QueryAllEvidenceRequest, QueryAllEvidenceRequestSDKType, QueryAllEvidenceResponse, QueryAllEvidenceResponseSDKType, ReactiveQueryEvidenceRequest, ReactiveQueryAllEvidenceRequest } from "./query"; +import { QueryEvidenceRequest, QueryEvidenceRequestSDKType, QueryEvidenceResponse, QueryEvidenceResponseSDKType, QueryAllEvidenceRequest, QueryAllEvidenceRequestSDKType, QueryAllEvidenceResponse, QueryAllEvidenceResponseSDKType } from "./query.js"; /** Query defines the gRPC querier service. */ export interface Query { /** Evidence queries evidence based on evidence hash. */ @@ -24,7 +24,7 @@ export class QueryClientImpl implements Query { return promise.then(data => QueryEvidenceResponse.decode(new BinaryReader(data))); } allEvidence(request: QueryAllEvidenceRequest = { - pagination: undefined + pagination: PageRequest.fromPartial({}) }): Promise { const data = QueryAllEvidenceRequest.encode(request).finish(); const promise = this.rpc.request("cosmos.evidence.v1beta1.Query", "AllEvidence", data); 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..7446a3fd88 100644 --- a/__fixtures__/v-next/outputv4/cosmos/evidence/v1beta1/tx.amino.ts +++ b/__fixtures__/v-next/outputv4/cosmos/evidence/v1beta1/tx.amino.ts @@ -1,6 +1,6 @@ -import { Any, AnySDKType } from "../../../google/protobuf/any"; +import { Any, AnySDKType } from "../../../google/protobuf/any.js"; import { AminoMsg } from "@cosmjs/amino"; -import { MsgSubmitEvidence, MsgSubmitEvidenceSDKType } from "./tx"; +import { MsgSubmitEvidence, MsgSubmitEvidenceSDKType } from "./tx.js"; export interface MsgSubmitEvidenceAminoType extends AminoMsg { type: "cosmos-sdk/MsgSubmitEvidence"; value: { diff --git a/__fixtures__/v-next/outputv4/cosmos/evidence/v1beta1/tx.registry.ts b/__fixtures__/v-next/outputv4/cosmos/evidence/v1beta1/tx.registry.ts index d48dba61f0..6085b1e689 100644 --- a/__fixtures__/v-next/outputv4/cosmos/evidence/v1beta1/tx.registry.ts +++ b/__fixtures__/v-next/outputv4/cosmos/evidence/v1beta1/tx.registry.ts @@ -1,6 +1,6 @@ -import { Any, AnySDKType } from "../../../google/protobuf/any"; +import { Any, AnySDKType } from "../../../google/protobuf/any.js"; import { GeneratedType, Registry } from "@cosmjs/proto-signing"; -import { MsgSubmitEvidence, MsgSubmitEvidenceSDKType } from "./tx"; +import { MsgSubmitEvidence, MsgSubmitEvidenceSDKType } from "./tx.js"; export const registry: ReadonlyArray<[string, GeneratedType]> = [["/cosmos.evidence.v1beta1.MsgSubmitEvidence", MsgSubmitEvidence]]; export const load = (protoRegistry: Registry) => { registry.forEach(([typeUrl, mod]) => { diff --git a/__fixtures__/v-next/outputv4/cosmos/evidence/v1beta1/tx.rpc.msg.ts b/__fixtures__/v-next/outputv4/cosmos/evidence/v1beta1/tx.rpc.msg.ts index 0b661ab18f..b4f8d1e215 100644 --- a/__fixtures__/v-next/outputv4/cosmos/evidence/v1beta1/tx.rpc.msg.ts +++ b/__fixtures__/v-next/outputv4/cosmos/evidence/v1beta1/tx.rpc.msg.ts @@ -1,7 +1,7 @@ -import { Any, AnySDKType } from "../../../google/protobuf/any"; -import { Rpc } from "../../../helpers"; -import { BinaryReader } from "../../../binary"; -import { MsgSubmitEvidence, MsgSubmitEvidenceSDKType, MsgSubmitEvidenceResponse, MsgSubmitEvidenceResponseSDKType } from "./tx"; +import { Any, AnySDKType } from "../../../google/protobuf/any.js"; +import { Rpc } from "../../../helpers.js"; +import { BinaryReader } from "../../../binary.js"; +import { MsgSubmitEvidence, MsgSubmitEvidenceSDKType, MsgSubmitEvidenceResponse, MsgSubmitEvidenceResponseSDKType } from "./tx.js"; /** Msg defines the evidence Msg service. */ export interface Msg { /** diff --git a/__fixtures__/v-next/outputv4/cosmos/feegrant/v1beta1/query.lcd.ts b/__fixtures__/v-next/outputv4/cosmos/feegrant/v1beta1/query.lcd.ts index 6c712121a4..0a922871b4 100644 --- a/__fixtures__/v-next/outputv4/cosmos/feegrant/v1beta1/query.lcd.ts +++ b/__fixtures__/v-next/outputv4/cosmos/feegrant/v1beta1/query.lcd.ts @@ -1,8 +1,8 @@ -import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../base/query/v1beta1/pagination"; -import { Grant, GrantSDKType } from "./feegrant"; -import { setPaginationParams } from "../../../helpers"; +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../base/query/v1beta1/pagination.js"; +import { Grant, GrantSDKType } from "./feegrant.js"; +import { setPaginationParams } from "../../../helpers.js"; import { LCDClient } from "@cosmology/lcd"; -import { QueryAllowanceRequest, QueryAllowanceRequestSDKType, QueryAllowanceResponse, QueryAllowanceResponseSDKType, QueryAllowancesRequest, QueryAllowancesRequestSDKType, QueryAllowancesResponse, QueryAllowancesResponseSDKType, QueryAllowancesByGranterRequest, QueryAllowancesByGranterRequestSDKType, QueryAllowancesByGranterResponse, QueryAllowancesByGranterResponseSDKType } from "./query"; +import { QueryAllowanceRequest, QueryAllowanceRequestSDKType, QueryAllowanceResponse, QueryAllowanceResponseSDKType, QueryAllowancesRequest, QueryAllowancesRequestSDKType, QueryAllowancesResponse, QueryAllowancesResponseSDKType, QueryAllowancesByGranterRequest, QueryAllowancesByGranterRequestSDKType, QueryAllowancesByGranterResponse, QueryAllowancesByGranterResponseSDKType } from "./query.js"; export class LCDQueryClient { req: LCDClient; constructor({ diff --git a/__fixtures__/v-next/outputv4/cosmos/feegrant/v1beta1/query.rpc.Query.ts b/__fixtures__/v-next/outputv4/cosmos/feegrant/v1beta1/query.rpc.Query.ts index 7070e7779a..ce3428cbd6 100644 --- a/__fixtures__/v-next/outputv4/cosmos/feegrant/v1beta1/query.rpc.Query.ts +++ b/__fixtures__/v-next/outputv4/cosmos/feegrant/v1beta1/query.rpc.Query.ts @@ -1,9 +1,9 @@ -import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../base/query/v1beta1/pagination"; -import { Grant, GrantSDKType } from "./feegrant"; -import { Rpc } from "../../../helpers"; -import { BinaryReader } from "../../../binary"; +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../base/query/v1beta1/pagination.js"; +import { Grant, GrantSDKType } from "./feegrant.js"; +import { Rpc } from "../../../helpers.js"; +import { BinaryReader } from "../../../binary.js"; import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; -import { QueryAllowanceRequest, QueryAllowanceRequestSDKType, QueryAllowanceResponse, QueryAllowanceResponseSDKType, QueryAllowancesRequest, QueryAllowancesRequestSDKType, QueryAllowancesResponse, QueryAllowancesResponseSDKType, QueryAllowancesByGranterRequest, QueryAllowancesByGranterRequestSDKType, QueryAllowancesByGranterResponse, QueryAllowancesByGranterResponseSDKType, ReactiveQueryAllowanceRequest, ReactiveQueryAllowancesRequest, ReactiveQueryAllowancesByGranterRequest } from "./query"; +import { QueryAllowanceRequest, QueryAllowanceRequestSDKType, QueryAllowanceResponse, QueryAllowanceResponseSDKType, QueryAllowancesRequest, QueryAllowancesRequestSDKType, QueryAllowancesResponse, QueryAllowancesResponseSDKType, QueryAllowancesByGranterRequest, QueryAllowancesByGranterRequestSDKType, QueryAllowancesByGranterResponse, QueryAllowancesByGranterResponseSDKType } from "./query.js"; /** Query defines the gRPC querier service. */ export interface Query { /** Allowance returns fee granted to the grantee by the granter. */ 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..81a24f8cb1 100644 --- a/__fixtures__/v-next/outputv4/cosmos/feegrant/v1beta1/tx.amino.ts +++ b/__fixtures__/v-next/outputv4/cosmos/feegrant/v1beta1/tx.amino.ts @@ -1,6 +1,6 @@ -import { Any, AnySDKType } from "../../../google/protobuf/any"; +import { Any, AnySDKType } from "../../../google/protobuf/any.js"; import { AminoMsg } from "@cosmjs/amino"; -import { MsgGrantAllowance, MsgGrantAllowanceSDKType, MsgRevokeAllowance, MsgRevokeAllowanceSDKType } from "./tx"; +import { MsgGrantAllowance, MsgGrantAllowanceSDKType, MsgRevokeAllowance, MsgRevokeAllowanceSDKType } from "./tx.js"; export interface MsgGrantAllowanceAminoType extends AminoMsg { type: "cosmos-sdk/MsgGrantAllowance"; value: { diff --git a/__fixtures__/v-next/outputv4/cosmos/feegrant/v1beta1/tx.registry.ts b/__fixtures__/v-next/outputv4/cosmos/feegrant/v1beta1/tx.registry.ts index 071630f5c9..0dc7e2d320 100644 --- a/__fixtures__/v-next/outputv4/cosmos/feegrant/v1beta1/tx.registry.ts +++ b/__fixtures__/v-next/outputv4/cosmos/feegrant/v1beta1/tx.registry.ts @@ -1,6 +1,6 @@ -import { Any, AnySDKType } from "../../../google/protobuf/any"; +import { Any, AnySDKType } from "../../../google/protobuf/any.js"; import { GeneratedType, Registry } from "@cosmjs/proto-signing"; -import { MsgGrantAllowance, MsgGrantAllowanceSDKType, MsgRevokeAllowance, MsgRevokeAllowanceSDKType } from "./tx"; +import { MsgGrantAllowance, MsgGrantAllowanceSDKType, MsgRevokeAllowance, MsgRevokeAllowanceSDKType } from "./tx.js"; export const registry: ReadonlyArray<[string, GeneratedType]> = [["/cosmos.feegrant.v1beta1.MsgGrantAllowance", MsgGrantAllowance], ["/cosmos.feegrant.v1beta1.MsgRevokeAllowance", MsgRevokeAllowance]]; export const load = (protoRegistry: Registry) => { registry.forEach(([typeUrl, mod]) => { diff --git a/__fixtures__/v-next/outputv4/cosmos/feegrant/v1beta1/tx.rpc.msg.ts b/__fixtures__/v-next/outputv4/cosmos/feegrant/v1beta1/tx.rpc.msg.ts index 26ad0c4e9d..44ebe5cae3 100644 --- a/__fixtures__/v-next/outputv4/cosmos/feegrant/v1beta1/tx.rpc.msg.ts +++ b/__fixtures__/v-next/outputv4/cosmos/feegrant/v1beta1/tx.rpc.msg.ts @@ -1,7 +1,7 @@ -import { Any, AnySDKType } from "../../../google/protobuf/any"; -import { Rpc } from "../../../helpers"; -import { BinaryReader } from "../../../binary"; -import { MsgGrantAllowance, MsgGrantAllowanceSDKType, MsgGrantAllowanceResponse, MsgGrantAllowanceResponseSDKType, MsgRevokeAllowance, MsgRevokeAllowanceSDKType, MsgRevokeAllowanceResponse, MsgRevokeAllowanceResponseSDKType } from "./tx"; +import { Any, AnySDKType } from "../../../google/protobuf/any.js"; +import { Rpc } from "../../../helpers.js"; +import { BinaryReader } from "../../../binary.js"; +import { MsgGrantAllowance, MsgGrantAllowanceSDKType, MsgGrantAllowanceResponse, MsgGrantAllowanceResponseSDKType, MsgRevokeAllowance, MsgRevokeAllowanceSDKType, MsgRevokeAllowanceResponse, MsgRevokeAllowanceResponseSDKType } from "./tx.js"; /** Msg defines the feegrant msg service. */ export interface Msg { /** diff --git a/__fixtures__/v-next/outputv4/cosmos/gov/v1/query.lcd.ts b/__fixtures__/v-next/outputv4/cosmos/gov/v1/query.lcd.ts index 0ce2ded595..6050fa1f4d 100644 --- a/__fixtures__/v-next/outputv4/cosmos/gov/v1/query.lcd.ts +++ b/__fixtures__/v-next/outputv4/cosmos/gov/v1/query.lcd.ts @@ -1,8 +1,8 @@ -import { ProposalStatus, ProposalStatusSDKType, Proposal, ProposalSDKType, Vote, VoteSDKType, VotingParams, VotingParamsSDKType, DepositParams, DepositParamsSDKType, TallyParams, TallyParamsSDKType, Deposit, DepositSDKType, TallyResult, TallyResultSDKType } from "./gov"; -import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../base/query/v1beta1/pagination"; -import { setPaginationParams } from "../../../helpers"; +import { ProposalStatus, ProposalStatusSDKType, Proposal, ProposalSDKType, Vote, VoteSDKType, VotingParams, VotingParamsSDKType, DepositParams, DepositParamsSDKType, TallyParams, TallyParamsSDKType, Deposit, DepositSDKType, TallyResult, TallyResultSDKType } from "./gov.js"; +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../base/query/v1beta1/pagination.js"; +import { setPaginationParams } from "../../../helpers.js"; import { LCDClient } from "@cosmology/lcd"; -import { QueryProposalRequest, QueryProposalRequestSDKType, QueryProposalResponse, QueryProposalResponseSDKType, QueryProposalsRequest, QueryProposalsRequestSDKType, QueryProposalsResponse, QueryProposalsResponseSDKType, QueryVoteRequest, QueryVoteRequestSDKType, QueryVoteResponse, QueryVoteResponseSDKType, QueryVotesRequest, QueryVotesRequestSDKType, QueryVotesResponse, QueryVotesResponseSDKType, QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType, QueryDepositRequest, QueryDepositRequestSDKType, QueryDepositResponse, QueryDepositResponseSDKType, QueryDepositsRequest, QueryDepositsRequestSDKType, QueryDepositsResponse, QueryDepositsResponseSDKType, QueryTallyResultRequest, QueryTallyResultRequestSDKType, QueryTallyResultResponse, QueryTallyResultResponseSDKType } from "./query"; +import { QueryProposalRequest, QueryProposalRequestSDKType, QueryProposalResponse, QueryProposalResponseSDKType, QueryProposalsRequest, QueryProposalsRequestSDKType, QueryProposalsResponse, QueryProposalsResponseSDKType, QueryVoteRequest, QueryVoteRequestSDKType, QueryVoteResponse, QueryVoteResponseSDKType, QueryVotesRequest, QueryVotesRequestSDKType, QueryVotesResponse, QueryVotesResponseSDKType, QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType, QueryDepositRequest, QueryDepositRequestSDKType, QueryDepositResponse, QueryDepositResponseSDKType, QueryDepositsRequest, QueryDepositsRequestSDKType, QueryDepositsResponse, QueryDepositsResponseSDKType, QueryTallyResultRequest, QueryTallyResultRequestSDKType, QueryTallyResultResponse, QueryTallyResultResponseSDKType } from "./query.js"; export class LCDQueryClient { req: LCDClient; constructor({ diff --git a/__fixtures__/v-next/outputv4/cosmos/gov/v1/query.rpc.Query.ts b/__fixtures__/v-next/outputv4/cosmos/gov/v1/query.rpc.Query.ts index c9a6ad6e6a..a2c2f959ff 100644 --- a/__fixtures__/v-next/outputv4/cosmos/gov/v1/query.rpc.Query.ts +++ b/__fixtures__/v-next/outputv4/cosmos/gov/v1/query.rpc.Query.ts @@ -1,12 +1,9 @@ -import { ProposalStatus, ProposalStatusSDKType, Proposal, ProposalSDKType, Vote, VoteSDKType, VotingParams, VotingParamsSDKType, DepositParams, DepositParamsSDKType, TallyParams, TallyParamsSDKType, Deposit, DepositSDKType, TallyResult, TallyResultSDKType } from "./gov"; -import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../base/query/v1beta1/pagination"; -import { Rpc } from "../../../helpers"; -import { BinaryReader } from "../../../binary"; -import { QueryClient, createProtobufRpcClient, ProtobufRpcClient } from "@cosmjs/stargate"; -import { VueQueryParams } from "../../../vue-query"; -import { ComputedRef, computed, Ref } from "vue"; -import { useQuery } from "@tanstack/vue-query"; -import { QueryProposalRequest, QueryProposalRequestSDKType, QueryProposalResponse, QueryProposalResponseSDKType, QueryProposalsRequest, QueryProposalsRequestSDKType, QueryProposalsResponse, QueryProposalsResponseSDKType, QueryVoteRequest, QueryVoteRequestSDKType, QueryVoteResponse, QueryVoteResponseSDKType, QueryVotesRequest, QueryVotesRequestSDKType, QueryVotesResponse, QueryVotesResponseSDKType, QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType, QueryDepositRequest, QueryDepositRequestSDKType, QueryDepositResponse, QueryDepositResponseSDKType, QueryDepositsRequest, QueryDepositsRequestSDKType, QueryDepositsResponse, QueryDepositsResponseSDKType, QueryTallyResultRequest, QueryTallyResultRequestSDKType, QueryTallyResultResponse, QueryTallyResultResponseSDKType, ReactiveQueryProposalRequest, ReactiveQueryProposalsRequest, ReactiveQueryVoteRequest, ReactiveQueryVotesRequest, ReactiveQueryParamsRequest, ReactiveQueryDepositRequest, ReactiveQueryDepositsRequest, ReactiveQueryTallyResultRequest } from "./query"; +import { ProposalStatus, ProposalStatusSDKType, Proposal, ProposalSDKType, Vote, VoteSDKType, VotingParams, VotingParamsSDKType, DepositParams, DepositParamsSDKType, TallyParams, TallyParamsSDKType, Deposit, DepositSDKType, TallyResult, TallyResultSDKType } from "./gov.js"; +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../base/query/v1beta1/pagination.js"; +import { Rpc } from "../../../helpers.js"; +import { BinaryReader } from "../../../binary.js"; +import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; +import { QueryProposalRequest, QueryProposalRequestSDKType, QueryProposalResponse, QueryProposalResponseSDKType, QueryProposalsRequest, QueryProposalsRequestSDKType, QueryProposalsResponse, QueryProposalsResponseSDKType, QueryVoteRequest, QueryVoteRequestSDKType, QueryVoteResponse, QueryVoteResponseSDKType, QueryVotesRequest, QueryVotesRequestSDKType, QueryVotesResponse, QueryVotesResponseSDKType, QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType, QueryDepositRequest, QueryDepositRequestSDKType, QueryDepositResponse, QueryDepositResponseSDKType, QueryDepositsRequest, QueryDepositsRequestSDKType, QueryDepositsResponse, QueryDepositsResponseSDKType, QueryTallyResultRequest, QueryTallyResultRequestSDKType, QueryTallyResultResponse, QueryTallyResultResponseSDKType } from "./query.js"; /** Query defines the gRPC querier service for gov module */ export interface Query { /** Proposal queries proposal details based on ProposalID. */ @@ -109,254 +106,4 @@ export const createRpcQueryExtension = (base: QueryClient) => { return queryService.tallyResult(request); } }; -}; -export interface UseProposalQuery extends VueQueryParams { - request: ReactiveQueryProposalRequest; -} -export interface UseProposalsQuery extends VueQueryParams { - request: ReactiveQueryProposalsRequest; -} -export interface UseVoteQuery extends VueQueryParams { - request: ReactiveQueryVoteRequest; -} -export interface UseVotesQuery extends VueQueryParams { - request: ReactiveQueryVotesRequest; -} -export interface UseParamsQuery extends VueQueryParams { - request: ReactiveQueryParamsRequest; -} -export interface UseDepositQuery extends VueQueryParams { - request: ReactiveQueryDepositRequest; -} -export interface UseDepositsQuery extends VueQueryParams { - request: ReactiveQueryDepositsRequest; -} -export interface UseTallyResultQuery extends VueQueryParams { - request: ReactiveQueryTallyResultRequest; -} -export const useQueryService = (rpc: Ref): ComputedRef => { - const _queryClients = new WeakMap(); - return computed(() => { - if (rpc.value) { - if (_queryClients.has(rpc.value)) { - return _queryClients.get(rpc.value); - } - const queryService = new QueryClientImpl(rpc.value); - _queryClients.set(rpc.value, queryService); - return queryService; - } - }); -}; -export const createRpcQueryHooks = (rpc: Ref) => { - const queryService = useQueryService(rpc); - const useProposal = ({ - request, - options - }: UseProposalQuery) => { - const queryKey = ["proposalQuery", queryService]; - if (request) { - Object.values(request).forEach((val: any) => { - queryKey.push(val); - }); - } - return useQuery({ - queryKey, - queryFn: () => { - if (!queryService.value) throw new Error("Query Service not initialized"); - let params = ({} as any); - if (request) { - Object.entries(request).forEach(([key, val]) => { - params[key] = val.value; - }); - } - return queryService.value.proposal(params); - }, - ...options - }); - }; - const useProposals = ({ - request, - options - }: UseProposalsQuery) => { - const queryKey = ["proposalsQuery", queryService]; - if (request) { - Object.values(request).forEach((val: any) => { - queryKey.push(val); - }); - } - return useQuery({ - queryKey, - queryFn: () => { - if (!queryService.value) throw new Error("Query Service not initialized"); - let params = ({} as any); - if (request) { - Object.entries(request).forEach(([key, val]) => { - params[key] = val.value; - }); - } - return queryService.value.proposals(params); - }, - ...options - }); - }; - const useVote = ({ - request, - options - }: UseVoteQuery) => { - const queryKey = ["voteQuery", queryService]; - if (request) { - Object.values(request).forEach((val: any) => { - queryKey.push(val); - }); - } - return useQuery({ - queryKey, - queryFn: () => { - if (!queryService.value) throw new Error("Query Service not initialized"); - let params = ({} as any); - if (request) { - Object.entries(request).forEach(([key, val]) => { - params[key] = val.value; - }); - } - return queryService.value.vote(params); - }, - ...options - }); - }; - const useVotes = ({ - request, - options - }: UseVotesQuery) => { - const queryKey = ["votesQuery", queryService]; - if (request) { - Object.values(request).forEach((val: any) => { - queryKey.push(val); - }); - } - return useQuery({ - queryKey, - queryFn: () => { - if (!queryService.value) throw new Error("Query Service not initialized"); - let params = ({} as any); - if (request) { - Object.entries(request).forEach(([key, val]) => { - params[key] = val.value; - }); - } - return queryService.value.votes(params); - }, - ...options - }); - }; - const useParams = ({ - request, - options - }: UseParamsQuery) => { - const queryKey = ["paramsQuery", queryService]; - if (request) { - Object.values(request).forEach((val: any) => { - queryKey.push(val); - }); - } - return useQuery({ - queryKey, - queryFn: () => { - if (!queryService.value) throw new Error("Query Service not initialized"); - let params = ({} as any); - if (request) { - Object.entries(request).forEach(([key, val]) => { - params[key] = val.value; - }); - } - return queryService.value.params(params); - }, - ...options - }); - }; - const useDeposit = ({ - request, - options - }: UseDepositQuery) => { - const queryKey = ["depositQuery", queryService]; - if (request) { - Object.values(request).forEach((val: any) => { - queryKey.push(val); - }); - } - return useQuery({ - queryKey, - queryFn: () => { - if (!queryService.value) throw new Error("Query Service not initialized"); - let params = ({} as any); - if (request) { - Object.entries(request).forEach(([key, val]) => { - params[key] = val.value; - }); - } - return queryService.value.deposit(params); - }, - ...options - }); - }; - const useDeposits = ({ - request, - options - }: UseDepositsQuery) => { - const queryKey = ["depositsQuery", queryService]; - if (request) { - Object.values(request).forEach((val: any) => { - queryKey.push(val); - }); - } - return useQuery({ - queryKey, - queryFn: () => { - if (!queryService.value) throw new Error("Query Service not initialized"); - let params = ({} as any); - if (request) { - Object.entries(request).forEach(([key, val]) => { - params[key] = val.value; - }); - } - return queryService.value.deposits(params); - }, - ...options - }); - }; - const useTallyResult = ({ - request, - options - }: UseTallyResultQuery) => { - const queryKey = ["tallyResultQuery", queryService]; - if (request) { - Object.values(request).forEach((val: any) => { - queryKey.push(val); - }); - } - return useQuery({ - queryKey, - queryFn: () => { - if (!queryService.value) throw new Error("Query Service not initialized"); - let params = ({} as any); - if (request) { - Object.entries(request).forEach(([key, val]) => { - params[key] = val.value; - }); - } - return queryService.value.tallyResult(params); - }, - ...options - }); - }; - return { - /** Proposal queries proposal details based on ProposalID. */useProposal, - /** Proposals queries all proposals based on given status. */useProposals, - /** Vote queries voted information based on proposalID, voterAddr. */useVote, - /** Votes queries votes of a given proposal. */useVotes, - /** Params queries all parameters of the gov module. */useParams, - /** Deposit queries single deposit information based proposalID, depositAddr. */useDeposit, - /** Deposits queries all deposits of a single proposal. */useDeposits, - /** TallyResult queries the tally of a proposal vote. */useTallyResult - }; }; \ No newline at end of file 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..9b40c6b182 100644 --- a/__fixtures__/v-next/outputv4/cosmos/gov/v1/tx.amino.ts +++ b/__fixtures__/v-next/outputv4/cosmos/gov/v1/tx.amino.ts @@ -1,8 +1,8 @@ -import { Any, AnySDKType } from "../../../google/protobuf/any"; -import { Coin, CoinSDKType } from "../../base/v1beta1/coin"; -import { VoteOption, VoteOptionSDKType, WeightedVoteOption, WeightedVoteOptionSDKType, voteOptionFromJSON } from "./gov"; +import { Any, AnySDKType } from "../../../google/protobuf/any.js"; +import { Coin, CoinSDKType } from "../../base/v1beta1/coin.js"; +import { VoteOption, VoteOptionSDKType, WeightedVoteOption, WeightedVoteOptionSDKType, voteOptionFromJSON } from "./gov.js"; import { AminoMsg } from "@cosmjs/amino"; -import { MsgSubmitProposal, MsgSubmitProposalSDKType, MsgExecLegacyContent, MsgExecLegacyContentSDKType, MsgVote, MsgVoteSDKType, MsgVoteWeighted, MsgVoteWeightedSDKType, MsgDeposit, MsgDepositSDKType } from "./tx"; +import { MsgSubmitProposal, MsgSubmitProposalSDKType, MsgExecLegacyContent, MsgExecLegacyContentSDKType, MsgVote, MsgVoteSDKType, MsgVoteWeighted, MsgVoteWeightedSDKType, MsgDeposit, MsgDepositSDKType } from "./tx.js"; export interface MsgSubmitProposalAminoType extends AminoMsg { type: "cosmos-sdk/v1/MsgSubmitProposal"; value: { diff --git a/__fixtures__/v-next/outputv4/cosmos/gov/v1/tx.registry.ts b/__fixtures__/v-next/outputv4/cosmos/gov/v1/tx.registry.ts index eeb73d2528..95857b5b68 100644 --- a/__fixtures__/v-next/outputv4/cosmos/gov/v1/tx.registry.ts +++ b/__fixtures__/v-next/outputv4/cosmos/gov/v1/tx.registry.ts @@ -1,8 +1,8 @@ -import { Any, AnySDKType } from "../../../google/protobuf/any"; -import { Coin, CoinSDKType } from "../../base/v1beta1/coin"; -import { VoteOption, VoteOptionSDKType, WeightedVoteOption, WeightedVoteOptionSDKType } from "./gov"; +import { Any, AnySDKType } from "../../../google/protobuf/any.js"; +import { Coin, CoinSDKType } from "../../base/v1beta1/coin.js"; +import { VoteOption, VoteOptionSDKType, WeightedVoteOption, WeightedVoteOptionSDKType } from "./gov.js"; import { GeneratedType, Registry } from "@cosmjs/proto-signing"; -import { MsgSubmitProposal, MsgSubmitProposalSDKType, MsgExecLegacyContent, MsgExecLegacyContentSDKType, MsgVote, MsgVoteSDKType, MsgVoteWeighted, MsgVoteWeightedSDKType, MsgDeposit, MsgDepositSDKType } from "./tx"; +import { MsgSubmitProposal, MsgSubmitProposalSDKType, MsgExecLegacyContent, MsgExecLegacyContentSDKType, MsgVote, MsgVoteSDKType, MsgVoteWeighted, MsgVoteWeightedSDKType, MsgDeposit, MsgDepositSDKType } from "./tx.js"; export const registry: ReadonlyArray<[string, GeneratedType]> = [["/cosmos.gov.v1.MsgSubmitProposal", MsgSubmitProposal], ["/cosmos.gov.v1.MsgExecLegacyContent", MsgExecLegacyContent], ["/cosmos.gov.v1.MsgVote", MsgVote], ["/cosmos.gov.v1.MsgVoteWeighted", MsgVoteWeighted], ["/cosmos.gov.v1.MsgDeposit", MsgDeposit]]; export const load = (protoRegistry: Registry) => { registry.forEach(([typeUrl, mod]) => { diff --git a/__fixtures__/v-next/outputv4/cosmos/gov/v1/tx.rpc.msg.ts b/__fixtures__/v-next/outputv4/cosmos/gov/v1/tx.rpc.msg.ts index fe1fce32e3..e12346b1ea 100644 --- a/__fixtures__/v-next/outputv4/cosmos/gov/v1/tx.rpc.msg.ts +++ b/__fixtures__/v-next/outputv4/cosmos/gov/v1/tx.rpc.msg.ts @@ -1,9 +1,9 @@ -import { Any, AnySDKType } from "../../../google/protobuf/any"; -import { Coin, CoinSDKType } from "../../base/v1beta1/coin"; -import { VoteOption, VoteOptionSDKType, WeightedVoteOption, WeightedVoteOptionSDKType } from "./gov"; -import { Rpc } from "../../../helpers"; -import { BinaryReader } from "../../../binary"; -import { MsgSubmitProposal, MsgSubmitProposalSDKType, MsgSubmitProposalResponse, MsgSubmitProposalResponseSDKType, MsgExecLegacyContent, MsgExecLegacyContentSDKType, MsgExecLegacyContentResponse, MsgExecLegacyContentResponseSDKType, MsgVote, MsgVoteSDKType, MsgVoteResponse, MsgVoteResponseSDKType, MsgVoteWeighted, MsgVoteWeightedSDKType, MsgVoteWeightedResponse, MsgVoteWeightedResponseSDKType, MsgDeposit, MsgDepositSDKType, MsgDepositResponse, MsgDepositResponseSDKType } from "./tx"; +import { Any, AnySDKType } from "../../../google/protobuf/any.js"; +import { Coin, CoinSDKType } from "../../base/v1beta1/coin.js"; +import { VoteOption, VoteOptionSDKType, WeightedVoteOption, WeightedVoteOptionSDKType } from "./gov.js"; +import { Rpc } from "../../../helpers.js"; +import { BinaryReader } from "../../../binary.js"; +import { MsgSubmitProposal, MsgSubmitProposalSDKType, MsgSubmitProposalResponse, MsgSubmitProposalResponseSDKType, MsgExecLegacyContent, MsgExecLegacyContentSDKType, MsgExecLegacyContentResponse, MsgExecLegacyContentResponseSDKType, MsgVote, MsgVoteSDKType, MsgVoteResponse, MsgVoteResponseSDKType, MsgVoteWeighted, MsgVoteWeightedSDKType, MsgVoteWeightedResponse, MsgVoteWeightedResponseSDKType, MsgDeposit, MsgDepositSDKType, MsgDepositResponse, MsgDepositResponseSDKType } from "./tx.js"; /** Msg defines the gov Msg service. */ export interface Msg { /** SubmitProposal defines a method to create new proposal given a content. */ diff --git a/__fixtures__/v-next/outputv4/cosmos/gov/v1beta1/query.lcd.ts b/__fixtures__/v-next/outputv4/cosmos/gov/v1beta1/query.lcd.ts index 97d81716e3..7eb6b46465 100644 --- a/__fixtures__/v-next/outputv4/cosmos/gov/v1beta1/query.lcd.ts +++ b/__fixtures__/v-next/outputv4/cosmos/gov/v1beta1/query.lcd.ts @@ -1,8 +1,8 @@ -import { ProposalStatus, ProposalStatusSDKType, Proposal, ProposalSDKType, Vote, VoteSDKType, VotingParams, VotingParamsSDKType, DepositParams, DepositParamsSDKType, TallyParams, TallyParamsSDKType, Deposit, DepositSDKType, TallyResult, TallyResultSDKType } from "./gov"; -import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../base/query/v1beta1/pagination"; -import { setPaginationParams } from "../../../helpers"; +import { ProposalStatus, ProposalStatusSDKType, Proposal, ProposalSDKType, Vote, VoteSDKType, VotingParams, VotingParamsSDKType, DepositParams, DepositParamsSDKType, TallyParams, TallyParamsSDKType, Deposit, DepositSDKType, TallyResult, TallyResultSDKType } from "./gov.js"; +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../base/query/v1beta1/pagination.js"; +import { setPaginationParams } from "../../../helpers.js"; import { LCDClient } from "@cosmology/lcd"; -import { QueryProposalRequest, QueryProposalRequestSDKType, QueryProposalResponse, QueryProposalResponseSDKType, QueryProposalsRequest, QueryProposalsRequestSDKType, QueryProposalsResponse, QueryProposalsResponseSDKType, QueryVoteRequest, QueryVoteRequestSDKType, QueryVoteResponse, QueryVoteResponseSDKType, QueryVotesRequest, QueryVotesRequestSDKType, QueryVotesResponse, QueryVotesResponseSDKType, QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType, QueryDepositRequest, QueryDepositRequestSDKType, QueryDepositResponse, QueryDepositResponseSDKType, QueryDepositsRequest, QueryDepositsRequestSDKType, QueryDepositsResponse, QueryDepositsResponseSDKType, QueryTallyResultRequest, QueryTallyResultRequestSDKType, QueryTallyResultResponse, QueryTallyResultResponseSDKType } from "./query"; +import { QueryProposalRequest, QueryProposalRequestSDKType, QueryProposalResponse, QueryProposalResponseSDKType, QueryProposalsRequest, QueryProposalsRequestSDKType, QueryProposalsResponse, QueryProposalsResponseSDKType, QueryVoteRequest, QueryVoteRequestSDKType, QueryVoteResponse, QueryVoteResponseSDKType, QueryVotesRequest, QueryVotesRequestSDKType, QueryVotesResponse, QueryVotesResponseSDKType, QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType, QueryDepositRequest, QueryDepositRequestSDKType, QueryDepositResponse, QueryDepositResponseSDKType, QueryDepositsRequest, QueryDepositsRequestSDKType, QueryDepositsResponse, QueryDepositsResponseSDKType, QueryTallyResultRequest, QueryTallyResultRequestSDKType, QueryTallyResultResponse, QueryTallyResultResponseSDKType } from "./query.js"; export class LCDQueryClient { req: LCDClient; constructor({ diff --git a/__fixtures__/v-next/outputv4/cosmos/gov/v1beta1/query.rpc.Query.ts b/__fixtures__/v-next/outputv4/cosmos/gov/v1beta1/query.rpc.Query.ts index 04d80971b2..636bddd19b 100644 --- a/__fixtures__/v-next/outputv4/cosmos/gov/v1beta1/query.rpc.Query.ts +++ b/__fixtures__/v-next/outputv4/cosmos/gov/v1beta1/query.rpc.Query.ts @@ -1,9 +1,11 @@ -import { ProposalStatus, ProposalStatusSDKType, Proposal, ProposalSDKType, Vote, VoteSDKType, VotingParams, VotingParamsSDKType, DepositParams, DepositParamsSDKType, TallyParams, TallyParamsSDKType, Deposit, DepositSDKType, TallyResult, TallyResultSDKType } from "./gov"; -import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../base/query/v1beta1/pagination"; -import { Rpc } from "../../../helpers"; -import { BinaryReader } from "../../../binary"; -import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; -import { QueryProposalRequest, QueryProposalRequestSDKType, QueryProposalResponse, QueryProposalResponseSDKType, QueryProposalsRequest, QueryProposalsRequestSDKType, QueryProposalsResponse, QueryProposalsResponseSDKType, QueryVoteRequest, QueryVoteRequestSDKType, QueryVoteResponse, QueryVoteResponseSDKType, QueryVotesRequest, QueryVotesRequestSDKType, QueryVotesResponse, QueryVotesResponseSDKType, QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType, QueryDepositRequest, QueryDepositRequestSDKType, QueryDepositResponse, QueryDepositResponseSDKType, QueryDepositsRequest, QueryDepositsRequestSDKType, QueryDepositsResponse, QueryDepositsResponseSDKType, QueryTallyResultRequest, QueryTallyResultRequestSDKType, QueryTallyResultResponse, QueryTallyResultResponseSDKType, ReactiveQueryProposalRequest, ReactiveQueryProposalsRequest, ReactiveQueryVoteRequest, ReactiveQueryVotesRequest, ReactiveQueryParamsRequest, ReactiveQueryDepositRequest, ReactiveQueryDepositsRequest, ReactiveQueryTallyResultRequest } from "./query"; +import { ProposalStatus, ProposalStatusSDKType, Proposal, ProposalSDKType, Vote, VoteSDKType, VotingParams, VotingParamsSDKType, DepositParams, DepositParamsSDKType, TallyParams, TallyParamsSDKType, Deposit, DepositSDKType, TallyResult, TallyResultSDKType } from "./gov.js"; +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../base/query/v1beta1/pagination.js"; +import { Rpc } from "../../../helpers.js"; +import { BinaryReader } from "../../../binary.js"; +import { QueryClient, createProtobufRpcClient, ProtobufRpcClient } from "@cosmjs/stargate"; +import { QueryStore, MobxResponse } from "../../../mobx.js"; +import { makeObservable, override } from "mobx"; +import { QueryProposalRequest, QueryProposalRequestSDKType, QueryProposalResponse, QueryProposalResponseSDKType, QueryProposalsRequest, QueryProposalsRequestSDKType, QueryProposalsResponse, QueryProposalsResponseSDKType, QueryVoteRequest, QueryVoteRequestSDKType, QueryVoteResponse, QueryVoteResponseSDKType, QueryVotesRequest, QueryVotesRequestSDKType, QueryVotesResponse, QueryVotesResponseSDKType, QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType, QueryDepositRequest, QueryDepositRequestSDKType, QueryDepositResponse, QueryDepositResponseSDKType, QueryDepositsRequest, QueryDepositsRequestSDKType, QueryDepositsResponse, QueryDepositsResponseSDKType, QueryTallyResultRequest, QueryTallyResultRequestSDKType, QueryTallyResultResponse, QueryTallyResultResponseSDKType } from "./query.js"; /** Query defines the gRPC querier service for gov module */ export interface Query { /** Proposal queries proposal details based on ProposalID. */ @@ -106,4 +108,75 @@ export const createRpcQueryExtension = (base: QueryClient) => { return queryService.tallyResult(request); } }; +}; +const _queryClients: WeakMap = new WeakMap(); +const getQueryService = (rpc: ProtobufRpcClient | undefined): QueryClientImpl | undefined => { + if (!rpc) return; + if (_queryClients.has(rpc)) { + return _queryClients.get(rpc); + } + const queryService = new QueryClientImpl(rpc); + _queryClients.set(rpc, queryService); + return queryService; +}; +export const createRpcQueryMobxStores = (rpc: ProtobufRpcClient | undefined) => { + const queryService = getQueryService(rpc); + class QueryProposalStore { + store = new QueryStore(queryService?.proposal); + proposal(request: QueryProposalRequest) { + return this.store.getData(request); + } + } + class QueryProposalsStore { + store = new QueryStore(queryService?.proposals); + proposals(request: QueryProposalsRequest) { + return this.store.getData(request); + } + } + class QueryVoteStore { + store = new QueryStore(queryService?.vote); + vote(request: QueryVoteRequest) { + return this.store.getData(request); + } + } + class QueryVotesStore { + store = new QueryStore(queryService?.votes); + votes(request: QueryVotesRequest) { + return this.store.getData(request); + } + } + class QueryParamsStore { + store = new QueryStore(queryService?.params); + params(request: QueryParamsRequest) { + return this.store.getData(request); + } + } + class QueryDepositStore { + store = new QueryStore(queryService?.deposit); + deposit(request: QueryDepositRequest) { + return this.store.getData(request); + } + } + class QueryDepositsStore { + store = new QueryStore(queryService?.deposits); + deposits(request: QueryDepositsRequest) { + return this.store.getData(request); + } + } + class QueryTallyResultStore { + store = new QueryStore(queryService?.tallyResult); + tallyResult(request: QueryTallyResultRequest) { + return this.store.getData(request); + } + } + return { + /** Proposal queries proposal details based on ProposalID. */QueryProposalStore, + /** Proposals queries all proposals based on given status. */QueryProposalsStore, + /** Vote queries voted information based on proposalID, voterAddr. */QueryVoteStore, + /** Votes queries votes of a given proposal. */QueryVotesStore, + /** Params queries all parameters of the gov module. */QueryParamsStore, + /** Deposit queries single deposit information based proposalID, depositAddr. */QueryDepositStore, + /** Deposits queries all deposits of a single proposal. */QueryDepositsStore, + /** TallyResult queries the tally of a proposal vote. */QueryTallyResultStore + }; }; \ No newline at end of file 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..000404777d 100644 --- a/__fixtures__/v-next/outputv4/cosmos/gov/v1beta1/tx.amino.ts +++ b/__fixtures__/v-next/outputv4/cosmos/gov/v1beta1/tx.amino.ts @@ -1,8 +1,8 @@ -import { Any, AnySDKType } from "../../../google/protobuf/any"; -import { Coin, CoinSDKType } from "../../base/v1beta1/coin"; -import { VoteOption, VoteOptionSDKType, WeightedVoteOption, WeightedVoteOptionSDKType, voteOptionFromJSON } from "./gov"; +import { Any, AnySDKType } from "../../../google/protobuf/any.js"; +import { Coin, CoinSDKType } from "../../base/v1beta1/coin.js"; +import { VoteOption, VoteOptionSDKType, WeightedVoteOption, WeightedVoteOptionSDKType, voteOptionFromJSON } from "./gov.js"; import { AminoMsg } from "@cosmjs/amino"; -import { MsgSubmitProposal, MsgSubmitProposalSDKType, MsgVote, MsgVoteSDKType, MsgVoteWeighted, MsgVoteWeightedSDKType, MsgDeposit, MsgDepositSDKType } from "./tx"; +import { MsgSubmitProposal, MsgSubmitProposalSDKType, MsgVote, MsgVoteSDKType, MsgVoteWeighted, MsgVoteWeightedSDKType, MsgDeposit, MsgDepositSDKType } from "./tx.js"; export interface MsgSubmitProposalAminoType extends AminoMsg { type: "cosmos-sdk/MsgSubmitProposal"; value: { diff --git a/__fixtures__/v-next/outputv4/cosmos/gov/v1beta1/tx.registry.ts b/__fixtures__/v-next/outputv4/cosmos/gov/v1beta1/tx.registry.ts index 0b7996cb4f..ed11331d36 100644 --- a/__fixtures__/v-next/outputv4/cosmos/gov/v1beta1/tx.registry.ts +++ b/__fixtures__/v-next/outputv4/cosmos/gov/v1beta1/tx.registry.ts @@ -1,8 +1,8 @@ -import { Any, AnySDKType } from "../../../google/protobuf/any"; -import { Coin, CoinSDKType } from "../../base/v1beta1/coin"; -import { VoteOption, VoteOptionSDKType, WeightedVoteOption, WeightedVoteOptionSDKType } from "./gov"; +import { Any, AnySDKType } from "../../../google/protobuf/any.js"; +import { Coin, CoinSDKType } from "../../base/v1beta1/coin.js"; +import { VoteOption, VoteOptionSDKType, WeightedVoteOption, WeightedVoteOptionSDKType } from "./gov.js"; import { GeneratedType, Registry } from "@cosmjs/proto-signing"; -import { MsgSubmitProposal, MsgSubmitProposalSDKType, MsgVote, MsgVoteSDKType, MsgVoteWeighted, MsgVoteWeightedSDKType, MsgDeposit, MsgDepositSDKType } from "./tx"; +import { MsgSubmitProposal, MsgSubmitProposalSDKType, MsgVote, MsgVoteSDKType, MsgVoteWeighted, MsgVoteWeightedSDKType, MsgDeposit, MsgDepositSDKType } from "./tx.js"; export const registry: ReadonlyArray<[string, GeneratedType]> = [["/cosmos.gov.v1beta1.MsgSubmitProposal", MsgSubmitProposal], ["/cosmos.gov.v1beta1.MsgVote", MsgVote], ["/cosmos.gov.v1beta1.MsgVoteWeighted", MsgVoteWeighted], ["/cosmos.gov.v1beta1.MsgDeposit", MsgDeposit]]; export const load = (protoRegistry: Registry) => { registry.forEach(([typeUrl, mod]) => { diff --git a/__fixtures__/v-next/outputv4/cosmos/gov/v1beta1/tx.rpc.msg.ts b/__fixtures__/v-next/outputv4/cosmos/gov/v1beta1/tx.rpc.msg.ts index 1d377e2fcd..604dbe4e16 100644 --- a/__fixtures__/v-next/outputv4/cosmos/gov/v1beta1/tx.rpc.msg.ts +++ b/__fixtures__/v-next/outputv4/cosmos/gov/v1beta1/tx.rpc.msg.ts @@ -1,9 +1,9 @@ -import { Any, AnySDKType } from "../../../google/protobuf/any"; -import { Coin, CoinSDKType } from "../../base/v1beta1/coin"; -import { VoteOption, VoteOptionSDKType, WeightedVoteOption, WeightedVoteOptionSDKType } from "./gov"; -import { Rpc } from "../../../helpers"; -import { BinaryReader } from "../../../binary"; -import { MsgSubmitProposal, MsgSubmitProposalSDKType, MsgSubmitProposalResponse, MsgSubmitProposalResponseSDKType, MsgVote, MsgVoteSDKType, MsgVoteResponse, MsgVoteResponseSDKType, MsgVoteWeighted, MsgVoteWeightedSDKType, MsgVoteWeightedResponse, MsgVoteWeightedResponseSDKType, MsgDeposit, MsgDepositSDKType, MsgDepositResponse, MsgDepositResponseSDKType } from "./tx"; +import { Any, AnySDKType } from "../../../google/protobuf/any.js"; +import { Coin, CoinSDKType } from "../../base/v1beta1/coin.js"; +import { VoteOption, VoteOptionSDKType, WeightedVoteOption, WeightedVoteOptionSDKType } from "./gov.js"; +import { Rpc } from "../../../helpers.js"; +import { BinaryReader } from "../../../binary.js"; +import { MsgSubmitProposal, MsgSubmitProposalSDKType, MsgSubmitProposalResponse, MsgSubmitProposalResponseSDKType, MsgVote, MsgVoteSDKType, MsgVoteResponse, MsgVoteResponseSDKType, MsgVoteWeighted, MsgVoteWeightedSDKType, MsgVoteWeightedResponse, MsgVoteWeightedResponseSDKType, MsgDeposit, MsgDepositSDKType, MsgDepositResponse, MsgDepositResponseSDKType } from "./tx.js"; /** Msg defines the bank Msg service. */ export interface Msg { /** SubmitProposal defines a method to create new proposal given a content. */ diff --git a/__fixtures__/v-next/outputv4/cosmos/group/v1/query.lcd.ts b/__fixtures__/v-next/outputv4/cosmos/group/v1/query.lcd.ts index 3e6ed1019c..edf01079c2 100644 --- a/__fixtures__/v-next/outputv4/cosmos/group/v1/query.lcd.ts +++ b/__fixtures__/v-next/outputv4/cosmos/group/v1/query.lcd.ts @@ -1,8 +1,8 @@ -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 { setPaginationParams } from "../../../helpers"; +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../base/query/v1beta1/pagination.js"; +import { GroupInfo, GroupInfoSDKType, GroupPolicyInfo, GroupPolicyInfoSDKType, GroupMember, GroupMemberSDKType, Proposal, ProposalSDKType, Vote, VoteSDKType, TallyResult, TallyResultSDKType } from "./types.js"; +import { setPaginationParams } from "../../../helpers.js"; import { LCDClient } from "@cosmology/lcd"; -import { QueryGroupInfoRequest, QueryGroupInfoRequestSDKType, QueryGroupInfoResponse, QueryGroupInfoResponseSDKType, QueryGroupPolicyInfoRequest, QueryGroupPolicyInfoRequestSDKType, QueryGroupPolicyInfoResponse, QueryGroupPolicyInfoResponseSDKType, QueryGroupMembersRequest, QueryGroupMembersRequestSDKType, QueryGroupMembersResponse, QueryGroupMembersResponseSDKType, QueryGroupsByAdminRequest, QueryGroupsByAdminRequestSDKType, QueryGroupsByAdminResponse, QueryGroupsByAdminResponseSDKType, QueryGroupPoliciesByGroupRequest, QueryGroupPoliciesByGroupRequestSDKType, QueryGroupPoliciesByGroupResponse, QueryGroupPoliciesByGroupResponseSDKType, QueryGroupPoliciesByAdminRequest, QueryGroupPoliciesByAdminRequestSDKType, QueryGroupPoliciesByAdminResponse, QueryGroupPoliciesByAdminResponseSDKType, QueryProposalRequest, QueryProposalRequestSDKType, QueryProposalResponse, QueryProposalResponseSDKType, QueryProposalsByGroupPolicyRequest, QueryProposalsByGroupPolicyRequestSDKType, QueryProposalsByGroupPolicyResponse, QueryProposalsByGroupPolicyResponseSDKType, QueryVoteByProposalVoterRequest, QueryVoteByProposalVoterRequestSDKType, QueryVoteByProposalVoterResponse, QueryVoteByProposalVoterResponseSDKType, QueryVotesByProposalRequest, QueryVotesByProposalRequestSDKType, QueryVotesByProposalResponse, QueryVotesByProposalResponseSDKType, QueryVotesByVoterRequest, QueryVotesByVoterRequestSDKType, QueryVotesByVoterResponse, QueryVotesByVoterResponseSDKType, QueryGroupsByMemberRequest, QueryGroupsByMemberRequestSDKType, QueryGroupsByMemberResponse, QueryGroupsByMemberResponseSDKType, QueryTallyResultRequest, QueryTallyResultRequestSDKType, QueryTallyResultResponse, QueryTallyResultResponseSDKType } from "./query"; +import { QueryGroupInfoRequest, QueryGroupInfoRequestSDKType, QueryGroupInfoResponse, QueryGroupInfoResponseSDKType, QueryGroupPolicyInfoRequest, QueryGroupPolicyInfoRequestSDKType, QueryGroupPolicyInfoResponse, QueryGroupPolicyInfoResponseSDKType, QueryGroupMembersRequest, QueryGroupMembersRequestSDKType, QueryGroupMembersResponse, QueryGroupMembersResponseSDKType, QueryGroupsByAdminRequest, QueryGroupsByAdminRequestSDKType, QueryGroupsByAdminResponse, QueryGroupsByAdminResponseSDKType, QueryGroupPoliciesByGroupRequest, QueryGroupPoliciesByGroupRequestSDKType, QueryGroupPoliciesByGroupResponse, QueryGroupPoliciesByGroupResponseSDKType, QueryGroupPoliciesByAdminRequest, QueryGroupPoliciesByAdminRequestSDKType, QueryGroupPoliciesByAdminResponse, QueryGroupPoliciesByAdminResponseSDKType, QueryProposalRequest, QueryProposalRequestSDKType, QueryProposalResponse, QueryProposalResponseSDKType, QueryProposalsByGroupPolicyRequest, QueryProposalsByGroupPolicyRequestSDKType, QueryProposalsByGroupPolicyResponse, QueryProposalsByGroupPolicyResponseSDKType, QueryVoteByProposalVoterRequest, QueryVoteByProposalVoterRequestSDKType, QueryVoteByProposalVoterResponse, QueryVoteByProposalVoterResponseSDKType, QueryVotesByProposalRequest, QueryVotesByProposalRequestSDKType, QueryVotesByProposalResponse, QueryVotesByProposalResponseSDKType, QueryVotesByVoterRequest, QueryVotesByVoterRequestSDKType, QueryVotesByVoterResponse, QueryVotesByVoterResponseSDKType, QueryGroupsByMemberRequest, QueryGroupsByMemberRequestSDKType, QueryGroupsByMemberResponse, QueryGroupsByMemberResponseSDKType, QueryTallyResultRequest, QueryTallyResultRequestSDKType, QueryTallyResultResponse, QueryTallyResultResponseSDKType } from "./query.js"; export class LCDQueryClient { req: LCDClient; constructor({ diff --git a/__fixtures__/v-next/outputv4/cosmos/group/v1/query.rpc.Query.ts b/__fixtures__/v-next/outputv4/cosmos/group/v1/query.rpc.Query.ts index 4640176a79..9c11b2042f 100644 --- a/__fixtures__/v-next/outputv4/cosmos/group/v1/query.rpc.Query.ts +++ b/__fixtures__/v-next/outputv4/cosmos/group/v1/query.rpc.Query.ts @@ -1,9 +1,9 @@ -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 { Rpc } from "../../../helpers"; -import { BinaryReader } from "../../../binary"; +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../base/query/v1beta1/pagination.js"; +import { GroupInfo, GroupInfoSDKType, GroupPolicyInfo, GroupPolicyInfoSDKType, GroupMember, GroupMemberSDKType, Proposal, ProposalSDKType, Vote, VoteSDKType, TallyResult, TallyResultSDKType } from "./types.js"; +import { Rpc } from "../../../helpers.js"; +import { BinaryReader } from "../../../binary.js"; import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; -import { QueryGroupInfoRequest, QueryGroupInfoRequestSDKType, QueryGroupInfoResponse, QueryGroupInfoResponseSDKType, QueryGroupPolicyInfoRequest, QueryGroupPolicyInfoRequestSDKType, QueryGroupPolicyInfoResponse, QueryGroupPolicyInfoResponseSDKType, QueryGroupMembersRequest, QueryGroupMembersRequestSDKType, QueryGroupMembersResponse, QueryGroupMembersResponseSDKType, QueryGroupsByAdminRequest, QueryGroupsByAdminRequestSDKType, QueryGroupsByAdminResponse, QueryGroupsByAdminResponseSDKType, QueryGroupPoliciesByGroupRequest, QueryGroupPoliciesByGroupRequestSDKType, QueryGroupPoliciesByGroupResponse, QueryGroupPoliciesByGroupResponseSDKType, QueryGroupPoliciesByAdminRequest, QueryGroupPoliciesByAdminRequestSDKType, QueryGroupPoliciesByAdminResponse, QueryGroupPoliciesByAdminResponseSDKType, QueryProposalRequest, QueryProposalRequestSDKType, QueryProposalResponse, QueryProposalResponseSDKType, QueryProposalsByGroupPolicyRequest, QueryProposalsByGroupPolicyRequestSDKType, QueryProposalsByGroupPolicyResponse, QueryProposalsByGroupPolicyResponseSDKType, QueryVoteByProposalVoterRequest, QueryVoteByProposalVoterRequestSDKType, QueryVoteByProposalVoterResponse, QueryVoteByProposalVoterResponseSDKType, QueryVotesByProposalRequest, QueryVotesByProposalRequestSDKType, QueryVotesByProposalResponse, QueryVotesByProposalResponseSDKType, QueryVotesByVoterRequest, QueryVotesByVoterRequestSDKType, QueryVotesByVoterResponse, QueryVotesByVoterResponseSDKType, QueryGroupsByMemberRequest, QueryGroupsByMemberRequestSDKType, QueryGroupsByMemberResponse, QueryGroupsByMemberResponseSDKType, QueryTallyResultRequest, QueryTallyResultRequestSDKType, QueryTallyResultResponse, QueryTallyResultResponseSDKType, ReactiveQueryGroupInfoRequest, ReactiveQueryGroupPolicyInfoRequest, ReactiveQueryGroupMembersRequest, ReactiveQueryGroupsByAdminRequest, ReactiveQueryGroupPoliciesByGroupRequest, ReactiveQueryGroupPoliciesByAdminRequest, ReactiveQueryProposalRequest, ReactiveQueryProposalsByGroupPolicyRequest, ReactiveQueryVoteByProposalVoterRequest, ReactiveQueryVotesByProposalRequest, ReactiveQueryVotesByVoterRequest, ReactiveQueryGroupsByMemberRequest, ReactiveQueryTallyResultRequest } from "./query"; +import { QueryGroupInfoRequest, QueryGroupInfoRequestSDKType, QueryGroupInfoResponse, QueryGroupInfoResponseSDKType, QueryGroupPolicyInfoRequest, QueryGroupPolicyInfoRequestSDKType, QueryGroupPolicyInfoResponse, QueryGroupPolicyInfoResponseSDKType, QueryGroupMembersRequest, QueryGroupMembersRequestSDKType, QueryGroupMembersResponse, QueryGroupMembersResponseSDKType, QueryGroupsByAdminRequest, QueryGroupsByAdminRequestSDKType, QueryGroupsByAdminResponse, QueryGroupsByAdminResponseSDKType, QueryGroupPoliciesByGroupRequest, QueryGroupPoliciesByGroupRequestSDKType, QueryGroupPoliciesByGroupResponse, QueryGroupPoliciesByGroupResponseSDKType, QueryGroupPoliciesByAdminRequest, QueryGroupPoliciesByAdminRequestSDKType, QueryGroupPoliciesByAdminResponse, QueryGroupPoliciesByAdminResponseSDKType, QueryProposalRequest, QueryProposalRequestSDKType, QueryProposalResponse, QueryProposalResponseSDKType, QueryProposalsByGroupPolicyRequest, QueryProposalsByGroupPolicyRequestSDKType, QueryProposalsByGroupPolicyResponse, QueryProposalsByGroupPolicyResponseSDKType, QueryVoteByProposalVoterRequest, QueryVoteByProposalVoterRequestSDKType, QueryVoteByProposalVoterResponse, QueryVoteByProposalVoterResponseSDKType, QueryVotesByProposalRequest, QueryVotesByProposalRequestSDKType, QueryVotesByProposalResponse, QueryVotesByProposalResponseSDKType, QueryVotesByVoterRequest, QueryVotesByVoterRequestSDKType, QueryVotesByVoterResponse, QueryVotesByVoterResponseSDKType, QueryGroupsByMemberRequest, QueryGroupsByMemberRequestSDKType, QueryGroupsByMemberResponse, QueryGroupsByMemberResponseSDKType, QueryTallyResultRequest, QueryTallyResultRequestSDKType, QueryTallyResultResponse, QueryTallyResultResponseSDKType } from "./query.js"; /** Query is the cosmos.group.v1 Query service. */ export interface Query { /** GroupInfo queries group info based on group id. */ 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..50a9650a46 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,7 @@ -import { Member, MemberSDKType, VoteOption, VoteOptionSDKType, voteOptionFromJSON } from "./types"; -import { Any, AnySDKType } from "../../../google/protobuf/any"; +import { Member, MemberSDKType, VoteOption, VoteOptionSDKType, voteOptionFromJSON } from "./types.js"; +import { Any, AnySDKType } from "../../../google/protobuf/any.js"; import { AminoMsg } from "@cosmjs/amino"; -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"; +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.js"; export interface MsgCreateGroupAminoType extends AminoMsg { type: "cosmos-sdk/MsgCreateGroup"; value: { diff --git a/__fixtures__/v-next/outputv4/cosmos/group/v1/tx.registry.ts b/__fixtures__/v-next/outputv4/cosmos/group/v1/tx.registry.ts index acd413bd4d..b821652035 100644 --- a/__fixtures__/v-next/outputv4/cosmos/group/v1/tx.registry.ts +++ b/__fixtures__/v-next/outputv4/cosmos/group/v1/tx.registry.ts @@ -1,7 +1,7 @@ -import { Member, MemberSDKType, VoteOption, VoteOptionSDKType } from "./types"; -import { Any, AnySDKType } from "../../../google/protobuf/any"; +import { Member, MemberSDKType, VoteOption, VoteOptionSDKType } from "./types.js"; +import { Any, AnySDKType } from "../../../google/protobuf/any.js"; import { GeneratedType, Registry } from "@cosmjs/proto-signing"; -import { 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"; +import { 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.js"; export const registry: ReadonlyArray<[string, GeneratedType]> = [["/cosmos.group.v1.MsgCreateGroup", MsgCreateGroup], ["/cosmos.group.v1.MsgUpdateGroupMembers", MsgUpdateGroupMembers], ["/cosmos.group.v1.MsgUpdateGroupAdmin", MsgUpdateGroupAdmin], ["/cosmos.group.v1.MsgUpdateGroupMetadata", MsgUpdateGroupMetadata], ["/cosmos.group.v1.MsgCreateGroupPolicy", MsgCreateGroupPolicy], ["/cosmos.group.v1.MsgCreateGroupWithPolicy", MsgCreateGroupWithPolicy], ["/cosmos.group.v1.MsgUpdateGroupPolicyAdmin", MsgUpdateGroupPolicyAdmin], ["/cosmos.group.v1.MsgUpdateGroupPolicyDecisionPolicy", MsgUpdateGroupPolicyDecisionPolicy], ["/cosmos.group.v1.MsgUpdateGroupPolicyMetadata", MsgUpdateGroupPolicyMetadata], ["/cosmos.group.v1.MsgSubmitProposal", MsgSubmitProposal], ["/cosmos.group.v1.MsgWithdrawProposal", MsgWithdrawProposal], ["/cosmos.group.v1.MsgVote", MsgVote], ["/cosmos.group.v1.MsgExec", MsgExec], ["/cosmos.group.v1.MsgLeaveGroup", MsgLeaveGroup]]; export const load = (protoRegistry: Registry) => { registry.forEach(([typeUrl, mod]) => { diff --git a/__fixtures__/v-next/outputv4/cosmos/group/v1/tx.rpc.msg.ts b/__fixtures__/v-next/outputv4/cosmos/group/v1/tx.rpc.msg.ts index 67b6593653..fb494e3543 100644 --- a/__fixtures__/v-next/outputv4/cosmos/group/v1/tx.rpc.msg.ts +++ b/__fixtures__/v-next/outputv4/cosmos/group/v1/tx.rpc.msg.ts @@ -1,8 +1,8 @@ -import { Member, MemberSDKType, VoteOption, VoteOptionSDKType } from "./types"; -import { Any, AnySDKType } from "../../../google/protobuf/any"; -import { Rpc } from "../../../helpers"; -import { BinaryReader } from "../../../binary"; -import { MsgCreateGroup, MsgCreateGroupSDKType, MsgCreateGroupResponse, MsgCreateGroupResponseSDKType, MsgUpdateGroupMembers, MsgUpdateGroupMembersSDKType, MsgUpdateGroupMembersResponse, MsgUpdateGroupMembersResponseSDKType, MsgUpdateGroupAdmin, MsgUpdateGroupAdminSDKType, MsgUpdateGroupAdminResponse, MsgUpdateGroupAdminResponseSDKType, MsgUpdateGroupMetadata, MsgUpdateGroupMetadataSDKType, MsgUpdateGroupMetadataResponse, MsgUpdateGroupMetadataResponseSDKType, MsgCreateGroupPolicy, MsgCreateGroupPolicySDKType, MsgCreateGroupPolicyResponse, MsgCreateGroupPolicyResponseSDKType, MsgCreateGroupWithPolicy, MsgCreateGroupWithPolicySDKType, MsgCreateGroupWithPolicyResponse, MsgCreateGroupWithPolicyResponseSDKType, MsgUpdateGroupPolicyAdmin, MsgUpdateGroupPolicyAdminSDKType, MsgUpdateGroupPolicyAdminResponse, MsgUpdateGroupPolicyAdminResponseSDKType, MsgUpdateGroupPolicyDecisionPolicy, MsgUpdateGroupPolicyDecisionPolicySDKType, MsgUpdateGroupPolicyDecisionPolicyResponse, MsgUpdateGroupPolicyDecisionPolicyResponseSDKType, MsgUpdateGroupPolicyMetadata, MsgUpdateGroupPolicyMetadataSDKType, MsgUpdateGroupPolicyMetadataResponse, MsgUpdateGroupPolicyMetadataResponseSDKType, MsgSubmitProposal, MsgSubmitProposalSDKType, MsgSubmitProposalResponse, MsgSubmitProposalResponseSDKType, MsgWithdrawProposal, MsgWithdrawProposalSDKType, MsgWithdrawProposalResponse, MsgWithdrawProposalResponseSDKType, MsgVote, MsgVoteSDKType, MsgVoteResponse, MsgVoteResponseSDKType, MsgExec, MsgExecSDKType, MsgExecResponse, MsgExecResponseSDKType, MsgLeaveGroup, MsgLeaveGroupSDKType, MsgLeaveGroupResponse, MsgLeaveGroupResponseSDKType } from "./tx"; +import { Member, MemberSDKType, VoteOption, VoteOptionSDKType } from "./types.js"; +import { Any, AnySDKType } from "../../../google/protobuf/any.js"; +import { Rpc } from "../../../helpers.js"; +import { BinaryReader } from "../../../binary.js"; +import { MsgCreateGroup, MsgCreateGroupSDKType, MsgCreateGroupResponse, MsgCreateGroupResponseSDKType, MsgUpdateGroupMembers, MsgUpdateGroupMembersSDKType, MsgUpdateGroupMembersResponse, MsgUpdateGroupMembersResponseSDKType, MsgUpdateGroupAdmin, MsgUpdateGroupAdminSDKType, MsgUpdateGroupAdminResponse, MsgUpdateGroupAdminResponseSDKType, MsgUpdateGroupMetadata, MsgUpdateGroupMetadataSDKType, MsgUpdateGroupMetadataResponse, MsgUpdateGroupMetadataResponseSDKType, MsgCreateGroupPolicy, MsgCreateGroupPolicySDKType, MsgCreateGroupPolicyResponse, MsgCreateGroupPolicyResponseSDKType, MsgCreateGroupWithPolicy, MsgCreateGroupWithPolicySDKType, MsgCreateGroupWithPolicyResponse, MsgCreateGroupWithPolicyResponseSDKType, MsgUpdateGroupPolicyAdmin, MsgUpdateGroupPolicyAdminSDKType, MsgUpdateGroupPolicyAdminResponse, MsgUpdateGroupPolicyAdminResponseSDKType, MsgUpdateGroupPolicyDecisionPolicy, MsgUpdateGroupPolicyDecisionPolicySDKType, MsgUpdateGroupPolicyDecisionPolicyResponse, MsgUpdateGroupPolicyDecisionPolicyResponseSDKType, MsgUpdateGroupPolicyMetadata, MsgUpdateGroupPolicyMetadataSDKType, MsgUpdateGroupPolicyMetadataResponse, MsgUpdateGroupPolicyMetadataResponseSDKType, MsgSubmitProposal, MsgSubmitProposalSDKType, MsgSubmitProposalResponse, MsgSubmitProposalResponseSDKType, MsgWithdrawProposal, MsgWithdrawProposalSDKType, MsgWithdrawProposalResponse, MsgWithdrawProposalResponseSDKType, MsgVote, MsgVoteSDKType, MsgVoteResponse, MsgVoteResponseSDKType, MsgExec, MsgExecSDKType, MsgExecResponse, MsgExecResponseSDKType, MsgLeaveGroup, MsgLeaveGroupSDKType, MsgLeaveGroupResponse, MsgLeaveGroupResponseSDKType } from "./tx.js"; /** Msg is the cosmos.group.v1 Msg service. */ export interface Msg { /** CreateGroup creates a new group with an admin account address, a list of members and some optional metadata. */ diff --git a/__fixtures__/v-next/outputv4/cosmos/group/v1/tx.ts b/__fixtures__/v-next/outputv4/cosmos/group/v1/tx.ts index 1fe400de41..781a3a119b 100644 --- a/__fixtures__/v-next/outputv4/cosmos/group/v1/tx.ts +++ b/__fixtures__/v-next/outputv4/cosmos/group/v1/tx.ts @@ -1,9 +1,8 @@ -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 { JsonSafe } from "../../../json-safe"; -import { ComputedRef } from "vue"; +import { Member, MemberSDKType, VoteOption, VoteOptionSDKType, voteOptionFromJSON, voteOptionToJSON } from "./types.js"; +import { Any, AnySDKType } from "../../../google/protobuf/any.js"; +import { BinaryReader, BinaryWriter } from "../../../binary.js"; +import { isSet, DeepPartial } from "../../../helpers.js"; +import { JsonSafe } from "../../../json-safe.js"; export const protobufPackage = "cosmos.group.v1"; /** Exec defines modes of execution of a proposal on creation or on new vote. */ export enum Exec { @@ -56,11 +55,6 @@ export interface MsgCreateGroup { /** metadata is any arbitrary metadata to attached to the group. */ metadata: string; } -export interface ReactiveMsgCreateGroup { - admin: ComputedRef; - members: ComputedRef; - metadata: ComputedRef; -} export interface MsgCreateGroupProtoMsg { typeUrl: "/cosmos.group.v1.MsgCreateGroup"; value: Uint8Array; @@ -76,9 +70,6 @@ export interface MsgCreateGroupResponse { /** group_id is the unique ID of the newly created group. */ groupId: bigint; } -export interface ReactiveMsgCreateGroupResponse { - groupId: ComputedRef; -} export interface MsgCreateGroupResponseProtoMsg { typeUrl: "/cosmos.group.v1.MsgCreateGroupResponse"; value: Uint8Array; @@ -99,11 +90,6 @@ export interface MsgUpdateGroupMembers { */ memberUpdates: Member[]; } -export interface ReactiveMsgUpdateGroupMembers { - admin: ComputedRef; - groupId: ComputedRef; - memberUpdates: ComputedRef; -} export interface MsgUpdateGroupMembersProtoMsg { typeUrl: "/cosmos.group.v1.MsgUpdateGroupMembers"; value: Uint8Array; @@ -116,7 +102,6 @@ export interface MsgUpdateGroupMembersSDKType { } /** MsgUpdateGroupMembersResponse is the Msg/UpdateGroupMembers response type. */ export interface MsgUpdateGroupMembersResponse {} -export interface ReactiveMsgUpdateGroupMembersResponse {} export interface MsgUpdateGroupMembersResponseProtoMsg { typeUrl: "/cosmos.group.v1.MsgUpdateGroupMembersResponse"; value: Uint8Array; @@ -132,11 +117,6 @@ export interface MsgUpdateGroupAdmin { /** new_admin is the group new admin account address. */ newAdmin: string; } -export interface ReactiveMsgUpdateGroupAdmin { - admin: ComputedRef; - groupId: ComputedRef; - newAdmin: ComputedRef; -} export interface MsgUpdateGroupAdminProtoMsg { typeUrl: "/cosmos.group.v1.MsgUpdateGroupAdmin"; value: Uint8Array; @@ -149,7 +129,6 @@ export interface MsgUpdateGroupAdminSDKType { } /** MsgUpdateGroupAdminResponse is the Msg/UpdateGroupAdmin response type. */ export interface MsgUpdateGroupAdminResponse {} -export interface ReactiveMsgUpdateGroupAdminResponse {} export interface MsgUpdateGroupAdminResponseProtoMsg { typeUrl: "/cosmos.group.v1.MsgUpdateGroupAdminResponse"; value: Uint8Array; @@ -165,11 +144,6 @@ export interface MsgUpdateGroupMetadata { /** metadata is the updated group's metadata. */ metadata: string; } -export interface ReactiveMsgUpdateGroupMetadata { - admin: ComputedRef; - groupId: ComputedRef; - metadata: ComputedRef; -} export interface MsgUpdateGroupMetadataProtoMsg { typeUrl: "/cosmos.group.v1.MsgUpdateGroupMetadata"; value: Uint8Array; @@ -182,7 +156,6 @@ export interface MsgUpdateGroupMetadataSDKType { } /** MsgUpdateGroupMetadataResponse is the Msg/UpdateGroupMetadata response type. */ export interface MsgUpdateGroupMetadataResponse {} -export interface ReactiveMsgUpdateGroupMetadataResponse {} export interface MsgUpdateGroupMetadataResponseProtoMsg { typeUrl: "/cosmos.group.v1.MsgUpdateGroupMetadataResponse"; value: Uint8Array; @@ -200,12 +173,6 @@ export interface MsgCreateGroupPolicy { /** decision_policy specifies the group policy's decision policy. */ decisionPolicy?: Any; } -export interface ReactiveMsgCreateGroupPolicy { - admin: ComputedRef; - groupId: ComputedRef; - metadata: ComputedRef; - decisionPolicy?: ComputedRef; -} export interface MsgCreateGroupPolicyProtoMsg { typeUrl: "/cosmos.group.v1.MsgCreateGroupPolicy"; value: Uint8Array; @@ -222,9 +189,6 @@ export interface MsgCreateGroupPolicyResponse { /** address is the account address of the newly created group policy. */ address: string; } -export interface ReactiveMsgCreateGroupPolicyResponse { - address: ComputedRef; -} export interface MsgCreateGroupPolicyResponseProtoMsg { typeUrl: "/cosmos.group.v1.MsgCreateGroupPolicyResponse"; value: Uint8Array; @@ -242,11 +206,6 @@ export interface MsgUpdateGroupPolicyAdmin { /** new_admin is the new group policy admin. */ newAdmin: string; } -export interface ReactiveMsgUpdateGroupPolicyAdmin { - admin: ComputedRef; - address: ComputedRef; - newAdmin: ComputedRef; -} export interface MsgUpdateGroupPolicyAdminProtoMsg { typeUrl: "/cosmos.group.v1.MsgUpdateGroupPolicyAdmin"; value: Uint8Array; @@ -272,14 +231,6 @@ export interface MsgCreateGroupWithPolicy { /** decision_policy specifies the group policy's decision policy. */ decisionPolicy?: Any; } -export interface ReactiveMsgCreateGroupWithPolicy { - admin: ComputedRef; - members: ComputedRef; - groupMetadata: ComputedRef; - groupPolicyMetadata: ComputedRef; - groupPolicyAsAdmin: ComputedRef; - decisionPolicy?: ComputedRef; -} export interface MsgCreateGroupWithPolicyProtoMsg { typeUrl: "/cosmos.group.v1.MsgCreateGroupWithPolicy"; value: Uint8Array; @@ -300,10 +251,6 @@ export interface MsgCreateGroupWithPolicyResponse { /** group_policy_address is the account address of the newly created group policy. */ groupPolicyAddress: string; } -export interface ReactiveMsgCreateGroupWithPolicyResponse { - groupId: ComputedRef; - groupPolicyAddress: ComputedRef; -} export interface MsgCreateGroupWithPolicyResponseProtoMsg { typeUrl: "/cosmos.group.v1.MsgCreateGroupWithPolicyResponse"; value: Uint8Array; @@ -315,7 +262,6 @@ export interface MsgCreateGroupWithPolicyResponseSDKType { } /** MsgUpdateGroupPolicyAdminResponse is the Msg/UpdateGroupPolicyAdmin response type. */ export interface MsgUpdateGroupPolicyAdminResponse {} -export interface ReactiveMsgUpdateGroupPolicyAdminResponse {} export interface MsgUpdateGroupPolicyAdminResponseProtoMsg { typeUrl: "/cosmos.group.v1.MsgUpdateGroupPolicyAdminResponse"; value: Uint8Array; @@ -331,11 +277,6 @@ export interface MsgUpdateGroupPolicyDecisionPolicy { /** decision_policy is the updated group policy's decision policy. */ decisionPolicy?: Any; } -export interface ReactiveMsgUpdateGroupPolicyDecisionPolicy { - admin: ComputedRef; - address: ComputedRef; - decisionPolicy?: ComputedRef; -} export interface MsgUpdateGroupPolicyDecisionPolicyProtoMsg { typeUrl: "/cosmos.group.v1.MsgUpdateGroupPolicyDecisionPolicy"; value: Uint8Array; @@ -348,7 +289,6 @@ export interface MsgUpdateGroupPolicyDecisionPolicySDKType { } /** MsgUpdateGroupPolicyDecisionPolicyResponse is the Msg/UpdateGroupPolicyDecisionPolicy response type. */ export interface MsgUpdateGroupPolicyDecisionPolicyResponse {} -export interface ReactiveMsgUpdateGroupPolicyDecisionPolicyResponse {} export interface MsgUpdateGroupPolicyDecisionPolicyResponseProtoMsg { typeUrl: "/cosmos.group.v1.MsgUpdateGroupPolicyDecisionPolicyResponse"; value: Uint8Array; @@ -364,11 +304,6 @@ export interface MsgUpdateGroupPolicyMetadata { /** metadata is the updated group policy metadata. */ metadata: string; } -export interface ReactiveMsgUpdateGroupPolicyMetadata { - admin: ComputedRef; - address: ComputedRef; - metadata: ComputedRef; -} export interface MsgUpdateGroupPolicyMetadataProtoMsg { typeUrl: "/cosmos.group.v1.MsgUpdateGroupPolicyMetadata"; value: Uint8Array; @@ -381,7 +316,6 @@ export interface MsgUpdateGroupPolicyMetadataSDKType { } /** MsgUpdateGroupPolicyMetadataResponse is the Msg/UpdateGroupPolicyMetadata response type. */ export interface MsgUpdateGroupPolicyMetadataResponse {} -export interface ReactiveMsgUpdateGroupPolicyMetadataResponse {} export interface MsgUpdateGroupPolicyMetadataResponseProtoMsg { typeUrl: "/cosmos.group.v1.MsgUpdateGroupPolicyMetadataResponse"; value: Uint8Array; @@ -408,13 +342,6 @@ export interface MsgSubmitProposal { */ exec: Exec; } -export interface ReactiveMsgSubmitProposal { - address: ComputedRef; - proposers: ComputedRef; - metadata: ComputedRef; - messages: ComputedRef; - exec: ComputedRef; -} export interface MsgSubmitProposalProtoMsg { typeUrl: "/cosmos.group.v1.MsgSubmitProposal"; value: Uint8Array; @@ -432,9 +359,6 @@ export interface MsgSubmitProposalResponse { /** proposal is the unique ID of the proposal. */ proposalId: bigint; } -export interface ReactiveMsgSubmitProposalResponse { - proposalId: ComputedRef; -} export interface MsgSubmitProposalResponseProtoMsg { typeUrl: "/cosmos.group.v1.MsgSubmitProposalResponse"; value: Uint8Array; @@ -450,10 +374,6 @@ export interface MsgWithdrawProposal { /** address is the admin of the group policy or one of the proposer of the proposal. */ address: string; } -export interface ReactiveMsgWithdrawProposal { - proposalId: ComputedRef; - address: ComputedRef; -} export interface MsgWithdrawProposalProtoMsg { typeUrl: "/cosmos.group.v1.MsgWithdrawProposal"; value: Uint8Array; @@ -465,7 +385,6 @@ export interface MsgWithdrawProposalSDKType { } /** MsgWithdrawProposalResponse is the Msg/WithdrawProposal response type. */ export interface MsgWithdrawProposalResponse {} -export interface ReactiveMsgWithdrawProposalResponse {} export interface MsgWithdrawProposalResponseProtoMsg { typeUrl: "/cosmos.group.v1.MsgWithdrawProposalResponse"; value: Uint8Array; @@ -488,13 +407,6 @@ export interface MsgVote { */ exec: Exec; } -export interface ReactiveMsgVote { - proposalId: ComputedRef; - voter: ComputedRef; - option: ComputedRef; - metadata: ComputedRef; - exec: ComputedRef; -} export interface MsgVoteProtoMsg { typeUrl: "/cosmos.group.v1.MsgVote"; value: Uint8Array; @@ -509,7 +421,6 @@ export interface MsgVoteSDKType { } /** MsgVoteResponse is the Msg/Vote response type. */ export interface MsgVoteResponse {} -export interface ReactiveMsgVoteResponse {} export interface MsgVoteResponseProtoMsg { typeUrl: "/cosmos.group.v1.MsgVoteResponse"; value: Uint8Array; @@ -523,10 +434,6 @@ export interface MsgExec { /** signer is the account address used to execute the proposal. */ signer: string; } -export interface ReactiveMsgExec { - proposalId: ComputedRef; - signer: ComputedRef; -} export interface MsgExecProtoMsg { typeUrl: "/cosmos.group.v1.MsgExec"; value: Uint8Array; @@ -538,7 +445,6 @@ export interface MsgExecSDKType { } /** MsgExecResponse is the Msg/Exec request type. */ export interface MsgExecResponse {} -export interface ReactiveMsgExecResponse {} export interface MsgExecResponseProtoMsg { typeUrl: "/cosmos.group.v1.MsgExecResponse"; value: Uint8Array; @@ -552,10 +458,6 @@ export interface MsgLeaveGroup { /** group_id is the unique ID of the group. */ groupId: bigint; } -export interface ReactiveMsgLeaveGroup { - address: ComputedRef; - groupId: ComputedRef; -} export interface MsgLeaveGroupProtoMsg { typeUrl: "/cosmos.group.v1.MsgLeaveGroup"; value: Uint8Array; @@ -567,7 +469,6 @@ export interface MsgLeaveGroupSDKType { } /** MsgLeaveGroupResponse is the Msg/LeaveGroup response type. */ export interface MsgLeaveGroupResponse {} -export interface ReactiveMsgLeaveGroupResponse {} export interface MsgLeaveGroupResponseProtoMsg { typeUrl: "/cosmos.group.v1.MsgLeaveGroupResponse"; value: Uint8Array; @@ -584,13 +485,13 @@ function createBaseMsgCreateGroup(): MsgCreateGroup { export const MsgCreateGroup = { typeUrl: "/cosmos.group.v1.MsgCreateGroup", encode(message: MsgCreateGroup, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.admin !== "") { + if (message.admin !== undefined) { writer.uint32(10).string(message.admin); } for (const v of message.members) { Member.encode(v!, writer.uint32(18).fork()).ldelim(); } - if (message.metadata !== "") { + if (message.metadata !== undefined) { writer.uint32(26).string(message.metadata); } return writer; @@ -619,11 +520,11 @@ export const MsgCreateGroup = { return message; }, fromJSON(object: any): MsgCreateGroup { - return { - admin: isSet(object.admin) ? String(object.admin) : "", - members: Array.isArray(object?.members) ? object.members.map((e: any) => Member.fromJSON(e)) : [], - metadata: isSet(object.metadata) ? String(object.metadata) : "" - }; + const obj = createBaseMsgCreateGroup(); + if (isSet(object.admin)) obj.admin = String(object.admin); + if (Array.isArray(object?.members)) obj.members = object.members.map((e: any) => Member.fromJSON(e)); + if (isSet(object.metadata)) obj.metadata = String(object.metadata); + return obj; }, toJSON(message: MsgCreateGroup): JsonSafe { const obj: any = {}; @@ -720,7 +621,7 @@ function createBaseMsgCreateGroupResponse(): MsgCreateGroupResponse { export const MsgCreateGroupResponse = { typeUrl: "/cosmos.group.v1.MsgCreateGroupResponse", encode(message: MsgCreateGroupResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.groupId !== BigInt(0)) { + if (message.groupId !== undefined) { writer.uint32(8).uint64(message.groupId); } return writer; @@ -743,9 +644,9 @@ export const MsgCreateGroupResponse = { return message; }, fromJSON(object: any): MsgCreateGroupResponse { - return { - groupId: isSet(object.groupId) ? BigInt(object.groupId.toString()) : BigInt(0) - }; + const obj = createBaseMsgCreateGroupResponse(); + if (isSet(object.groupId)) obj.groupId = BigInt(object.groupId.toString()); + return obj; }, toJSON(message: MsgCreateGroupResponse): JsonSafe { const obj: any = {}; @@ -754,7 +655,9 @@ export const MsgCreateGroupResponse = { }, fromPartial(object: DeepPartial): MsgCreateGroupResponse { const message = createBaseMsgCreateGroupResponse(); - message.groupId = object.groupId !== undefined && object.groupId !== null ? BigInt(object.groupId.toString()) : BigInt(0); + if (object.groupId !== undefined && object.groupId !== null) { + message.groupId = BigInt(object.groupId.toString()); + } return message; }, fromSDK(object: MsgCreateGroupResponseSDKType): MsgCreateGroupResponse { @@ -816,10 +719,10 @@ function createBaseMsgUpdateGroupMembers(): MsgUpdateGroupMembers { export const MsgUpdateGroupMembers = { typeUrl: "/cosmos.group.v1.MsgUpdateGroupMembers", encode(message: MsgUpdateGroupMembers, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.admin !== "") { + if (message.admin !== undefined) { writer.uint32(10).string(message.admin); } - if (message.groupId !== BigInt(0)) { + if (message.groupId !== undefined) { writer.uint32(16).uint64(message.groupId); } for (const v of message.memberUpdates) { @@ -851,11 +754,11 @@ export const MsgUpdateGroupMembers = { return message; }, fromJSON(object: any): MsgUpdateGroupMembers { - return { - admin: isSet(object.admin) ? String(object.admin) : "", - groupId: isSet(object.groupId) ? BigInt(object.groupId.toString()) : BigInt(0), - memberUpdates: Array.isArray(object?.memberUpdates) ? object.memberUpdates.map((e: any) => Member.fromJSON(e)) : [] - }; + const obj = createBaseMsgUpdateGroupMembers(); + if (isSet(object.admin)) obj.admin = String(object.admin); + if (isSet(object.groupId)) obj.groupId = BigInt(object.groupId.toString()); + if (Array.isArray(object?.memberUpdates)) obj.memberUpdates = object.memberUpdates.map((e: any) => Member.fromJSON(e)); + return obj; }, toJSON(message: MsgUpdateGroupMembers): JsonSafe { const obj: any = {}; @@ -871,7 +774,9 @@ export const MsgUpdateGroupMembers = { fromPartial(object: DeepPartial): MsgUpdateGroupMembers { const message = createBaseMsgUpdateGroupMembers(); message.admin = object.admin ?? ""; - message.groupId = object.groupId !== undefined && object.groupId !== null ? BigInt(object.groupId.toString()) : BigInt(0); + if (object.groupId !== undefined && object.groupId !== null) { + message.groupId = BigInt(object.groupId.toString()); + } message.memberUpdates = object.memberUpdates?.map(e => Member.fromPartial(e)) || []; return message; }, @@ -967,7 +872,8 @@ export const MsgUpdateGroupMembersResponse = { return message; }, fromJSON(_: any): MsgUpdateGroupMembersResponse { - return {}; + const obj = createBaseMsgUpdateGroupMembersResponse(); + return obj; }, toJSON(_: MsgUpdateGroupMembersResponse): JsonSafe { const obj: any = {}; @@ -1027,13 +933,13 @@ function createBaseMsgUpdateGroupAdmin(): MsgUpdateGroupAdmin { export const MsgUpdateGroupAdmin = { typeUrl: "/cosmos.group.v1.MsgUpdateGroupAdmin", encode(message: MsgUpdateGroupAdmin, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.admin !== "") { + if (message.admin !== undefined) { writer.uint32(10).string(message.admin); } - if (message.groupId !== BigInt(0)) { + if (message.groupId !== undefined) { writer.uint32(16).uint64(message.groupId); } - if (message.newAdmin !== "") { + if (message.newAdmin !== undefined) { writer.uint32(26).string(message.newAdmin); } return writer; @@ -1062,11 +968,11 @@ export const MsgUpdateGroupAdmin = { return message; }, fromJSON(object: any): MsgUpdateGroupAdmin { - return { - admin: isSet(object.admin) ? String(object.admin) : "", - groupId: isSet(object.groupId) ? BigInt(object.groupId.toString()) : BigInt(0), - newAdmin: isSet(object.newAdmin) ? String(object.newAdmin) : "" - }; + const obj = createBaseMsgUpdateGroupAdmin(); + if (isSet(object.admin)) obj.admin = String(object.admin); + if (isSet(object.groupId)) obj.groupId = BigInt(object.groupId.toString()); + if (isSet(object.newAdmin)) obj.newAdmin = String(object.newAdmin); + return obj; }, toJSON(message: MsgUpdateGroupAdmin): JsonSafe { const obj: any = {}; @@ -1078,7 +984,9 @@ export const MsgUpdateGroupAdmin = { fromPartial(object: DeepPartial): MsgUpdateGroupAdmin { const message = createBaseMsgUpdateGroupAdmin(); message.admin = object.admin ?? ""; - message.groupId = object.groupId !== undefined && object.groupId !== null ? BigInt(object.groupId.toString()) : BigInt(0); + if (object.groupId !== undefined && object.groupId !== null) { + message.groupId = BigInt(object.groupId.toString()); + } message.newAdmin = object.newAdmin ?? ""; return message; }, @@ -1168,7 +1076,8 @@ export const MsgUpdateGroupAdminResponse = { return message; }, fromJSON(_: any): MsgUpdateGroupAdminResponse { - return {}; + const obj = createBaseMsgUpdateGroupAdminResponse(); + return obj; }, toJSON(_: MsgUpdateGroupAdminResponse): JsonSafe { const obj: any = {}; @@ -1228,13 +1137,13 @@ function createBaseMsgUpdateGroupMetadata(): MsgUpdateGroupMetadata { export const MsgUpdateGroupMetadata = { typeUrl: "/cosmos.group.v1.MsgUpdateGroupMetadata", encode(message: MsgUpdateGroupMetadata, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.admin !== "") { + if (message.admin !== undefined) { writer.uint32(10).string(message.admin); } - if (message.groupId !== BigInt(0)) { + if (message.groupId !== undefined) { writer.uint32(16).uint64(message.groupId); } - if (message.metadata !== "") { + if (message.metadata !== undefined) { writer.uint32(26).string(message.metadata); } return writer; @@ -1263,11 +1172,11 @@ export const MsgUpdateGroupMetadata = { return message; }, fromJSON(object: any): MsgUpdateGroupMetadata { - return { - admin: isSet(object.admin) ? String(object.admin) : "", - groupId: isSet(object.groupId) ? BigInt(object.groupId.toString()) : BigInt(0), - metadata: isSet(object.metadata) ? String(object.metadata) : "" - }; + const obj = createBaseMsgUpdateGroupMetadata(); + if (isSet(object.admin)) obj.admin = String(object.admin); + if (isSet(object.groupId)) obj.groupId = BigInt(object.groupId.toString()); + if (isSet(object.metadata)) obj.metadata = String(object.metadata); + return obj; }, toJSON(message: MsgUpdateGroupMetadata): JsonSafe { const obj: any = {}; @@ -1279,7 +1188,9 @@ export const MsgUpdateGroupMetadata = { fromPartial(object: DeepPartial): MsgUpdateGroupMetadata { const message = createBaseMsgUpdateGroupMetadata(); message.admin = object.admin ?? ""; - message.groupId = object.groupId !== undefined && object.groupId !== null ? BigInt(object.groupId.toString()) : BigInt(0); + if (object.groupId !== undefined && object.groupId !== null) { + message.groupId = BigInt(object.groupId.toString()); + } message.metadata = object.metadata ?? ""; return message; }, @@ -1369,7 +1280,8 @@ export const MsgUpdateGroupMetadataResponse = { return message; }, fromJSON(_: any): MsgUpdateGroupMetadataResponse { - return {}; + const obj = createBaseMsgUpdateGroupMetadataResponse(); + return obj; }, toJSON(_: MsgUpdateGroupMetadataResponse): JsonSafe { const obj: any = {}; @@ -1430,13 +1342,13 @@ function createBaseMsgCreateGroupPolicy(): MsgCreateGroupPolicy { export const MsgCreateGroupPolicy = { typeUrl: "/cosmos.group.v1.MsgCreateGroupPolicy", encode(message: MsgCreateGroupPolicy, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.admin !== "") { + if (message.admin !== undefined) { writer.uint32(10).string(message.admin); } - if (message.groupId !== BigInt(0)) { + if (message.groupId !== undefined) { writer.uint32(16).uint64(message.groupId); } - if (message.metadata !== "") { + if (message.metadata !== undefined) { writer.uint32(26).string(message.metadata); } if (message.decisionPolicy !== undefined) { @@ -1471,12 +1383,12 @@ export const MsgCreateGroupPolicy = { return message; }, fromJSON(object: any): MsgCreateGroupPolicy { - return { - admin: isSet(object.admin) ? String(object.admin) : "", - groupId: isSet(object.groupId) ? BigInt(object.groupId.toString()) : BigInt(0), - metadata: isSet(object.metadata) ? String(object.metadata) : "", - decisionPolicy: isSet(object.decisionPolicy) ? Any.fromJSON(object.decisionPolicy) : undefined - }; + const obj = createBaseMsgCreateGroupPolicy(); + if (isSet(object.admin)) obj.admin = String(object.admin); + if (isSet(object.groupId)) obj.groupId = BigInt(object.groupId.toString()); + if (isSet(object.metadata)) obj.metadata = String(object.metadata); + if (isSet(object.decisionPolicy)) obj.decisionPolicy = Any.fromJSON(object.decisionPolicy); + return obj; }, toJSON(message: MsgCreateGroupPolicy): JsonSafe { const obj: any = {}; @@ -1489,9 +1401,13 @@ export const MsgCreateGroupPolicy = { fromPartial(object: DeepPartial): MsgCreateGroupPolicy { const message = createBaseMsgCreateGroupPolicy(); message.admin = object.admin ?? ""; - message.groupId = object.groupId !== undefined && object.groupId !== null ? BigInt(object.groupId.toString()) : BigInt(0); + if (object.groupId !== undefined && object.groupId !== null) { + message.groupId = BigInt(object.groupId.toString()); + } message.metadata = object.metadata ?? ""; - message.decisionPolicy = object.decisionPolicy !== undefined && object.decisionPolicy !== null ? Any.fromPartial(object.decisionPolicy) : undefined; + if (object.decisionPolicy !== undefined && object.decisionPolicy !== null) { + message.decisionPolicy = Any.fromPartial(object.decisionPolicy); + } return message; }, fromSDK(object: MsgCreateGroupPolicySDKType): MsgCreateGroupPolicy { @@ -1572,7 +1488,7 @@ function createBaseMsgCreateGroupPolicyResponse(): MsgCreateGroupPolicyResponse export const MsgCreateGroupPolicyResponse = { typeUrl: "/cosmos.group.v1.MsgCreateGroupPolicyResponse", encode(message: MsgCreateGroupPolicyResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.address !== "") { + if (message.address !== undefined) { writer.uint32(10).string(message.address); } return writer; @@ -1595,9 +1511,9 @@ export const MsgCreateGroupPolicyResponse = { return message; }, fromJSON(object: any): MsgCreateGroupPolicyResponse { - return { - address: isSet(object.address) ? String(object.address) : "" - }; + const obj = createBaseMsgCreateGroupPolicyResponse(); + if (isSet(object.address)) obj.address = String(object.address); + return obj; }, toJSON(message: MsgCreateGroupPolicyResponse): JsonSafe { const obj: any = {}; @@ -1668,13 +1584,13 @@ function createBaseMsgUpdateGroupPolicyAdmin(): MsgUpdateGroupPolicyAdmin { export const MsgUpdateGroupPolicyAdmin = { typeUrl: "/cosmos.group.v1.MsgUpdateGroupPolicyAdmin", encode(message: MsgUpdateGroupPolicyAdmin, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.admin !== "") { + if (message.admin !== undefined) { writer.uint32(10).string(message.admin); } - if (message.address !== "") { + if (message.address !== undefined) { writer.uint32(18).string(message.address); } - if (message.newAdmin !== "") { + if (message.newAdmin !== undefined) { writer.uint32(26).string(message.newAdmin); } return writer; @@ -1703,11 +1619,11 @@ export const MsgUpdateGroupPolicyAdmin = { return message; }, fromJSON(object: any): MsgUpdateGroupPolicyAdmin { - return { - admin: isSet(object.admin) ? String(object.admin) : "", - address: isSet(object.address) ? String(object.address) : "", - newAdmin: isSet(object.newAdmin) ? String(object.newAdmin) : "" - }; + const obj = createBaseMsgUpdateGroupPolicyAdmin(); + if (isSet(object.admin)) obj.admin = String(object.admin); + if (isSet(object.address)) obj.address = String(object.address); + if (isSet(object.newAdmin)) obj.newAdmin = String(object.newAdmin); + return obj; }, toJSON(message: MsgUpdateGroupPolicyAdmin): JsonSafe { const obj: any = {}; @@ -1799,19 +1715,19 @@ function createBaseMsgCreateGroupWithPolicy(): MsgCreateGroupWithPolicy { export const MsgCreateGroupWithPolicy = { typeUrl: "/cosmos.group.v1.MsgCreateGroupWithPolicy", encode(message: MsgCreateGroupWithPolicy, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.admin !== "") { + if (message.admin !== undefined) { writer.uint32(10).string(message.admin); } for (const v of message.members) { Member.encode(v!, writer.uint32(18).fork()).ldelim(); } - if (message.groupMetadata !== "") { + if (message.groupMetadata !== undefined) { writer.uint32(26).string(message.groupMetadata); } - if (message.groupPolicyMetadata !== "") { + if (message.groupPolicyMetadata !== undefined) { writer.uint32(34).string(message.groupPolicyMetadata); } - if (message.groupPolicyAsAdmin === true) { + if (message.groupPolicyAsAdmin !== undefined) { writer.uint32(40).bool(message.groupPolicyAsAdmin); } if (message.decisionPolicy !== undefined) { @@ -1852,14 +1768,14 @@ export const MsgCreateGroupWithPolicy = { return message; }, fromJSON(object: any): MsgCreateGroupWithPolicy { - return { - admin: isSet(object.admin) ? String(object.admin) : "", - members: Array.isArray(object?.members) ? object.members.map((e: any) => Member.fromJSON(e)) : [], - groupMetadata: isSet(object.groupMetadata) ? String(object.groupMetadata) : "", - groupPolicyMetadata: isSet(object.groupPolicyMetadata) ? String(object.groupPolicyMetadata) : "", - groupPolicyAsAdmin: isSet(object.groupPolicyAsAdmin) ? Boolean(object.groupPolicyAsAdmin) : false, - decisionPolicy: isSet(object.decisionPolicy) ? Any.fromJSON(object.decisionPolicy) : undefined - }; + const obj = createBaseMsgCreateGroupWithPolicy(); + if (isSet(object.admin)) obj.admin = String(object.admin); + if (Array.isArray(object?.members)) obj.members = object.members.map((e: any) => Member.fromJSON(e)); + if (isSet(object.groupMetadata)) obj.groupMetadata = String(object.groupMetadata); + if (isSet(object.groupPolicyMetadata)) obj.groupPolicyMetadata = String(object.groupPolicyMetadata); + if (isSet(object.groupPolicyAsAdmin)) obj.groupPolicyAsAdmin = Boolean(object.groupPolicyAsAdmin); + if (isSet(object.decisionPolicy)) obj.decisionPolicy = Any.fromJSON(object.decisionPolicy); + return obj; }, toJSON(message: MsgCreateGroupWithPolicy): JsonSafe { const obj: any = {}; @@ -1882,7 +1798,9 @@ export const MsgCreateGroupWithPolicy = { message.groupMetadata = object.groupMetadata ?? ""; message.groupPolicyMetadata = object.groupPolicyMetadata ?? ""; message.groupPolicyAsAdmin = object.groupPolicyAsAdmin ?? false; - message.decisionPolicy = object.decisionPolicy !== undefined && object.decisionPolicy !== null ? Any.fromPartial(object.decisionPolicy) : undefined; + if (object.decisionPolicy !== undefined && object.decisionPolicy !== null) { + message.decisionPolicy = Any.fromPartial(object.decisionPolicy); + } return message; }, fromSDK(object: MsgCreateGroupWithPolicySDKType): MsgCreateGroupWithPolicy { @@ -1984,10 +1902,10 @@ function createBaseMsgCreateGroupWithPolicyResponse(): MsgCreateGroupWithPolicyR export const MsgCreateGroupWithPolicyResponse = { typeUrl: "/cosmos.group.v1.MsgCreateGroupWithPolicyResponse", encode(message: MsgCreateGroupWithPolicyResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.groupId !== BigInt(0)) { + if (message.groupId !== undefined) { writer.uint32(8).uint64(message.groupId); } - if (message.groupPolicyAddress !== "") { + if (message.groupPolicyAddress !== undefined) { writer.uint32(18).string(message.groupPolicyAddress); } return writer; @@ -2013,10 +1931,10 @@ export const MsgCreateGroupWithPolicyResponse = { return message; }, fromJSON(object: any): MsgCreateGroupWithPolicyResponse { - return { - groupId: isSet(object.groupId) ? BigInt(object.groupId.toString()) : BigInt(0), - groupPolicyAddress: isSet(object.groupPolicyAddress) ? String(object.groupPolicyAddress) : "" - }; + const obj = createBaseMsgCreateGroupWithPolicyResponse(); + if (isSet(object.groupId)) obj.groupId = BigInt(object.groupId.toString()); + if (isSet(object.groupPolicyAddress)) obj.groupPolicyAddress = String(object.groupPolicyAddress); + return obj; }, toJSON(message: MsgCreateGroupWithPolicyResponse): JsonSafe { const obj: any = {}; @@ -2026,7 +1944,9 @@ export const MsgCreateGroupWithPolicyResponse = { }, fromPartial(object: DeepPartial): MsgCreateGroupWithPolicyResponse { const message = createBaseMsgCreateGroupWithPolicyResponse(); - message.groupId = object.groupId !== undefined && object.groupId !== null ? BigInt(object.groupId.toString()) : BigInt(0); + if (object.groupId !== undefined && object.groupId !== null) { + message.groupId = BigInt(object.groupId.toString()); + } message.groupPolicyAddress = object.groupPolicyAddress ?? ""; return message; }, @@ -2109,7 +2029,8 @@ export const MsgUpdateGroupPolicyAdminResponse = { return message; }, fromJSON(_: any): MsgUpdateGroupPolicyAdminResponse { - return {}; + const obj = createBaseMsgUpdateGroupPolicyAdminResponse(); + return obj; }, toJSON(_: MsgUpdateGroupPolicyAdminResponse): JsonSafe { const obj: any = {}; @@ -2169,10 +2090,10 @@ function createBaseMsgUpdateGroupPolicyDecisionPolicy(): MsgUpdateGroupPolicyDec export const MsgUpdateGroupPolicyDecisionPolicy = { typeUrl: "/cosmos.group.v1.MsgUpdateGroupPolicyDecisionPolicy", encode(message: MsgUpdateGroupPolicyDecisionPolicy, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.admin !== "") { + if (message.admin !== undefined) { writer.uint32(10).string(message.admin); } - if (message.address !== "") { + if (message.address !== undefined) { writer.uint32(18).string(message.address); } if (message.decisionPolicy !== undefined) { @@ -2204,11 +2125,11 @@ export const MsgUpdateGroupPolicyDecisionPolicy = { return message; }, fromJSON(object: any): MsgUpdateGroupPolicyDecisionPolicy { - return { - admin: isSet(object.admin) ? String(object.admin) : "", - address: isSet(object.address) ? String(object.address) : "", - decisionPolicy: isSet(object.decisionPolicy) ? Any.fromJSON(object.decisionPolicy) : undefined - }; + const obj = createBaseMsgUpdateGroupPolicyDecisionPolicy(); + if (isSet(object.admin)) obj.admin = String(object.admin); + if (isSet(object.address)) obj.address = String(object.address); + if (isSet(object.decisionPolicy)) obj.decisionPolicy = Any.fromJSON(object.decisionPolicy); + return obj; }, toJSON(message: MsgUpdateGroupPolicyDecisionPolicy): JsonSafe { const obj: any = {}; @@ -2221,7 +2142,9 @@ export const MsgUpdateGroupPolicyDecisionPolicy = { const message = createBaseMsgUpdateGroupPolicyDecisionPolicy(); message.admin = object.admin ?? ""; message.address = object.address ?? ""; - message.decisionPolicy = object.decisionPolicy !== undefined && object.decisionPolicy !== null ? Any.fromPartial(object.decisionPolicy) : undefined; + if (object.decisionPolicy !== undefined && object.decisionPolicy !== null) { + message.decisionPolicy = Any.fromPartial(object.decisionPolicy); + } return message; }, fromSDK(object: MsgUpdateGroupPolicyDecisionPolicySDKType): MsgUpdateGroupPolicyDecisionPolicy { @@ -2310,7 +2233,8 @@ export const MsgUpdateGroupPolicyDecisionPolicyResponse = { return message; }, fromJSON(_: any): MsgUpdateGroupPolicyDecisionPolicyResponse { - return {}; + const obj = createBaseMsgUpdateGroupPolicyDecisionPolicyResponse(); + return obj; }, toJSON(_: MsgUpdateGroupPolicyDecisionPolicyResponse): JsonSafe { const obj: any = {}; @@ -2370,13 +2294,13 @@ function createBaseMsgUpdateGroupPolicyMetadata(): MsgUpdateGroupPolicyMetadata export const MsgUpdateGroupPolicyMetadata = { typeUrl: "/cosmos.group.v1.MsgUpdateGroupPolicyMetadata", encode(message: MsgUpdateGroupPolicyMetadata, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.admin !== "") { + if (message.admin !== undefined) { writer.uint32(10).string(message.admin); } - if (message.address !== "") { + if (message.address !== undefined) { writer.uint32(18).string(message.address); } - if (message.metadata !== "") { + if (message.metadata !== undefined) { writer.uint32(26).string(message.metadata); } return writer; @@ -2405,11 +2329,11 @@ export const MsgUpdateGroupPolicyMetadata = { return message; }, fromJSON(object: any): MsgUpdateGroupPolicyMetadata { - return { - admin: isSet(object.admin) ? String(object.admin) : "", - address: isSet(object.address) ? String(object.address) : "", - metadata: isSet(object.metadata) ? String(object.metadata) : "" - }; + const obj = createBaseMsgUpdateGroupPolicyMetadata(); + if (isSet(object.admin)) obj.admin = String(object.admin); + if (isSet(object.address)) obj.address = String(object.address); + if (isSet(object.metadata)) obj.metadata = String(object.metadata); + return obj; }, toJSON(message: MsgUpdateGroupPolicyMetadata): JsonSafe { const obj: any = {}; @@ -2511,7 +2435,8 @@ export const MsgUpdateGroupPolicyMetadataResponse = { return message; }, fromJSON(_: any): MsgUpdateGroupPolicyMetadataResponse { - return {}; + const obj = createBaseMsgUpdateGroupPolicyMetadataResponse(); + return obj; }, toJSON(_: MsgUpdateGroupPolicyMetadataResponse): JsonSafe { const obj: any = {}; @@ -2573,13 +2498,13 @@ function createBaseMsgSubmitProposal(): MsgSubmitProposal { export const MsgSubmitProposal = { typeUrl: "/cosmos.group.v1.MsgSubmitProposal", encode(message: MsgSubmitProposal, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.address !== "") { + if (message.address !== undefined) { writer.uint32(10).string(message.address); } for (const v of message.proposers) { writer.uint32(18).string(v!); } - if (message.metadata !== "") { + if (message.metadata !== undefined) { writer.uint32(26).string(message.metadata); } for (const v of message.messages) { @@ -2620,13 +2545,13 @@ export const MsgSubmitProposal = { return message; }, fromJSON(object: any): MsgSubmitProposal { - return { - address: isSet(object.address) ? String(object.address) : "", - proposers: Array.isArray(object?.proposers) ? object.proposers.map((e: any) => String(e)) : [], - metadata: isSet(object.metadata) ? String(object.metadata) : "", - messages: Array.isArray(object?.messages) ? object.messages.map((e: any) => Any.fromJSON(e)) : [], - exec: isSet(object.exec) ? execFromJSON(object.exec) : -1 - }; + const obj = createBaseMsgSubmitProposal(); + if (isSet(object.address)) obj.address = String(object.address); + if (Array.isArray(object?.proposers)) obj.proposers = object.proposers.map((e: any) => String(e)); + if (isSet(object.metadata)) obj.metadata = String(object.metadata); + if (Array.isArray(object?.messages)) obj.messages = object.messages.map((e: any) => Any.fromJSON(e)); + if (isSet(object.exec)) obj.exec = execFromJSON(object.exec); + return obj; }, toJSON(message: MsgSubmitProposal): JsonSafe { const obj: any = {}; @@ -2751,7 +2676,7 @@ function createBaseMsgSubmitProposalResponse(): MsgSubmitProposalResponse { export const MsgSubmitProposalResponse = { typeUrl: "/cosmos.group.v1.MsgSubmitProposalResponse", encode(message: MsgSubmitProposalResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.proposalId !== BigInt(0)) { + if (message.proposalId !== undefined) { writer.uint32(8).uint64(message.proposalId); } return writer; @@ -2774,9 +2699,9 @@ export const MsgSubmitProposalResponse = { return message; }, fromJSON(object: any): MsgSubmitProposalResponse { - return { - proposalId: isSet(object.proposalId) ? BigInt(object.proposalId.toString()) : BigInt(0) - }; + const obj = createBaseMsgSubmitProposalResponse(); + if (isSet(object.proposalId)) obj.proposalId = BigInt(object.proposalId.toString()); + return obj; }, toJSON(message: MsgSubmitProposalResponse): JsonSafe { const obj: any = {}; @@ -2785,7 +2710,9 @@ export const MsgSubmitProposalResponse = { }, fromPartial(object: DeepPartial): MsgSubmitProposalResponse { const message = createBaseMsgSubmitProposalResponse(); - message.proposalId = object.proposalId !== undefined && object.proposalId !== null ? BigInt(object.proposalId.toString()) : BigInt(0); + if (object.proposalId !== undefined && object.proposalId !== null) { + message.proposalId = BigInt(object.proposalId.toString()); + } return message; }, fromSDK(object: MsgSubmitProposalResponseSDKType): MsgSubmitProposalResponse { @@ -2846,10 +2773,10 @@ function createBaseMsgWithdrawProposal(): MsgWithdrawProposal { export const MsgWithdrawProposal = { typeUrl: "/cosmos.group.v1.MsgWithdrawProposal", encode(message: MsgWithdrawProposal, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.proposalId !== BigInt(0)) { + if (message.proposalId !== undefined) { writer.uint32(8).uint64(message.proposalId); } - if (message.address !== "") { + if (message.address !== undefined) { writer.uint32(18).string(message.address); } return writer; @@ -2875,10 +2802,10 @@ export const MsgWithdrawProposal = { return message; }, fromJSON(object: any): MsgWithdrawProposal { - return { - proposalId: isSet(object.proposalId) ? BigInt(object.proposalId.toString()) : BigInt(0), - address: isSet(object.address) ? String(object.address) : "" - }; + const obj = createBaseMsgWithdrawProposal(); + if (isSet(object.proposalId)) obj.proposalId = BigInt(object.proposalId.toString()); + if (isSet(object.address)) obj.address = String(object.address); + return obj; }, toJSON(message: MsgWithdrawProposal): JsonSafe { const obj: any = {}; @@ -2888,7 +2815,9 @@ export const MsgWithdrawProposal = { }, fromPartial(object: DeepPartial): MsgWithdrawProposal { const message = createBaseMsgWithdrawProposal(); - message.proposalId = object.proposalId !== undefined && object.proposalId !== null ? BigInt(object.proposalId.toString()) : BigInt(0); + if (object.proposalId !== undefined && object.proposalId !== null) { + message.proposalId = BigInt(object.proposalId.toString()); + } message.address = object.address ?? ""; return message; }, @@ -2971,7 +2900,8 @@ export const MsgWithdrawProposalResponse = { return message; }, fromJSON(_: any): MsgWithdrawProposalResponse { - return {}; + const obj = createBaseMsgWithdrawProposalResponse(); + return obj; }, toJSON(_: MsgWithdrawProposalResponse): JsonSafe { const obj: any = {}; @@ -3033,16 +2963,16 @@ function createBaseMsgVote(): MsgVote { export const MsgVote = { typeUrl: "/cosmos.group.v1.MsgVote", encode(message: MsgVote, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.proposalId !== BigInt(0)) { + if (message.proposalId !== undefined) { writer.uint32(8).uint64(message.proposalId); } - if (message.voter !== "") { + if (message.voter !== undefined) { writer.uint32(18).string(message.voter); } if (message.option !== 0) { writer.uint32(24).int32(message.option); } - if (message.metadata !== "") { + if (message.metadata !== undefined) { writer.uint32(34).string(message.metadata); } if (message.exec !== 0) { @@ -3080,13 +3010,13 @@ export const MsgVote = { return message; }, fromJSON(object: any): MsgVote { - return { - proposalId: isSet(object.proposalId) ? BigInt(object.proposalId.toString()) : BigInt(0), - voter: isSet(object.voter) ? String(object.voter) : "", - option: isSet(object.option) ? voteOptionFromJSON(object.option) : -1, - metadata: isSet(object.metadata) ? String(object.metadata) : "", - exec: isSet(object.exec) ? execFromJSON(object.exec) : -1 - }; + const obj = createBaseMsgVote(); + if (isSet(object.proposalId)) obj.proposalId = BigInt(object.proposalId.toString()); + if (isSet(object.voter)) obj.voter = String(object.voter); + if (isSet(object.option)) obj.option = voteOptionFromJSON(object.option); + if (isSet(object.metadata)) obj.metadata = String(object.metadata); + if (isSet(object.exec)) obj.exec = execFromJSON(object.exec); + return obj; }, toJSON(message: MsgVote): JsonSafe { const obj: any = {}; @@ -3099,7 +3029,9 @@ export const MsgVote = { }, fromPartial(object: DeepPartial): MsgVote { const message = createBaseMsgVote(); - message.proposalId = object.proposalId !== undefined && object.proposalId !== null ? BigInt(object.proposalId.toString()) : BigInt(0); + if (object.proposalId !== undefined && object.proposalId !== null) { + message.proposalId = BigInt(object.proposalId.toString()); + } message.voter = object.voter ?? ""; message.option = object.option ?? 0; message.metadata = object.metadata ?? ""; @@ -3206,7 +3138,8 @@ export const MsgVoteResponse = { return message; }, fromJSON(_: any): MsgVoteResponse { - return {}; + const obj = createBaseMsgVoteResponse(); + return obj; }, toJSON(_: MsgVoteResponse): JsonSafe { const obj: any = {}; @@ -3265,10 +3198,10 @@ function createBaseMsgExec(): MsgExec { export const MsgExec = { typeUrl: "/cosmos.group.v1.MsgExec", encode(message: MsgExec, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.proposalId !== BigInt(0)) { + if (message.proposalId !== undefined) { writer.uint32(8).uint64(message.proposalId); } - if (message.signer !== "") { + if (message.signer !== undefined) { writer.uint32(18).string(message.signer); } return writer; @@ -3294,10 +3227,10 @@ export const MsgExec = { return message; }, fromJSON(object: any): MsgExec { - return { - proposalId: isSet(object.proposalId) ? BigInt(object.proposalId.toString()) : BigInt(0), - signer: isSet(object.signer) ? String(object.signer) : "" - }; + const obj = createBaseMsgExec(); + if (isSet(object.proposalId)) obj.proposalId = BigInt(object.proposalId.toString()); + if (isSet(object.signer)) obj.signer = String(object.signer); + return obj; }, toJSON(message: MsgExec): JsonSafe { const obj: any = {}; @@ -3307,7 +3240,9 @@ export const MsgExec = { }, fromPartial(object: DeepPartial): MsgExec { const message = createBaseMsgExec(); - message.proposalId = object.proposalId !== undefined && object.proposalId !== null ? BigInt(object.proposalId.toString()) : BigInt(0); + if (object.proposalId !== undefined && object.proposalId !== null) { + message.proposalId = BigInt(object.proposalId.toString()); + } message.signer = object.signer ?? ""; return message; }, @@ -3390,7 +3325,8 @@ export const MsgExecResponse = { return message; }, fromJSON(_: any): MsgExecResponse { - return {}; + const obj = createBaseMsgExecResponse(); + return obj; }, toJSON(_: MsgExecResponse): JsonSafe { const obj: any = {}; @@ -3449,10 +3385,10 @@ function createBaseMsgLeaveGroup(): MsgLeaveGroup { export const MsgLeaveGroup = { typeUrl: "/cosmos.group.v1.MsgLeaveGroup", encode(message: MsgLeaveGroup, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.address !== "") { + if (message.address !== undefined) { writer.uint32(10).string(message.address); } - if (message.groupId !== BigInt(0)) { + if (message.groupId !== undefined) { writer.uint32(16).uint64(message.groupId); } return writer; @@ -3478,10 +3414,10 @@ export const MsgLeaveGroup = { return message; }, fromJSON(object: any): MsgLeaveGroup { - return { - address: isSet(object.address) ? String(object.address) : "", - groupId: isSet(object.groupId) ? BigInt(object.groupId.toString()) : BigInt(0) - }; + const obj = createBaseMsgLeaveGroup(); + if (isSet(object.address)) obj.address = String(object.address); + if (isSet(object.groupId)) obj.groupId = BigInt(object.groupId.toString()); + return obj; }, toJSON(message: MsgLeaveGroup): JsonSafe { const obj: any = {}; @@ -3492,7 +3428,9 @@ export const MsgLeaveGroup = { fromPartial(object: DeepPartial): MsgLeaveGroup { const message = createBaseMsgLeaveGroup(); message.address = object.address ?? ""; - message.groupId = object.groupId !== undefined && object.groupId !== null ? BigInt(object.groupId.toString()) : BigInt(0); + if (object.groupId !== undefined && object.groupId !== null) { + message.groupId = BigInt(object.groupId.toString()); + } return message; }, fromSDK(object: MsgLeaveGroupSDKType): MsgLeaveGroup { @@ -3574,7 +3512,8 @@ export const MsgLeaveGroupResponse = { return message; }, fromJSON(_: any): MsgLeaveGroupResponse { - return {}; + const obj = createBaseMsgLeaveGroupResponse(); + return obj; }, toJSON(_: MsgLeaveGroupResponse): JsonSafe { const obj: any = {}; diff --git a/__fixtures__/v-next/outputv4/cosmos/group/v1/types.ts b/__fixtures__/v-next/outputv4/cosmos/group/v1/types.ts index 29c6d464a1..c4caae9c4f 100644 --- a/__fixtures__/v-next/outputv4/cosmos/group/v1/types.ts +++ b/__fixtures__/v-next/outputv4/cosmos/group/v1/types.ts @@ -1,10 +1,9 @@ -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 { JsonSafe } from "../../../json-safe"; -import { ComputedRef } from "vue"; +import { Timestamp, TimestampSDKType } from "../../../google/protobuf/timestamp.js"; +import { Duration, DurationSDKType } from "../../../google/protobuf/duration.js"; +import { Any, AnySDKType } from "../../../google/protobuf/any.js"; +import { BinaryReader, BinaryWriter } from "../../../binary.js"; +import { toTimestamp, fromTimestamp, isSet, DeepPartial } from "../../../helpers.js"; +import { JsonSafe } from "../../../json-safe.js"; export const protobufPackage = "cosmos.group.v1"; /** VoteOption enumerates the valid vote options for a given proposal. */ export enum VoteOption { @@ -229,12 +228,6 @@ export interface Member { /** added_at is a timestamp specifying when a member was added. */ addedAt: Date; } -export interface ReactiveMember { - address: ComputedRef; - weight: ComputedRef; - metadata: ComputedRef; - addedAt: ComputedRef; -} export interface MemberProtoMsg { typeUrl: "/cosmos.group.v1.Member"; value: Uint8Array; @@ -254,9 +247,6 @@ export interface Members { /** members is the list of members. */ members: Member[]; } -export interface ReactiveMembers { - members: ComputedRef; -} export interface MembersProtoMsg { typeUrl: "/cosmos.group.v1.Members"; value: Uint8Array; @@ -272,10 +262,6 @@ export interface ThresholdDecisionPolicy { /** windows defines the different windows for voting and execution. */ windows?: DecisionPolicyWindows; } -export interface ReactiveThresholdDecisionPolicy { - threshold: ComputedRef; - windows?: ComputedRef; -} export interface ThresholdDecisionPolicyProtoMsg { typeUrl: "/cosmos.group.v1.ThresholdDecisionPolicy"; value: Uint8Array; @@ -292,10 +278,6 @@ export interface PercentageDecisionPolicy { /** windows defines the different windows for voting and execution. */ windows?: DecisionPolicyWindows; } -export interface ReactivePercentageDecisionPolicy { - percentage: ComputedRef; - windows?: ComputedRef; -} export interface PercentageDecisionPolicyProtoMsg { typeUrl: "/cosmos.group.v1.PercentageDecisionPolicy"; value: Uint8Array; @@ -327,10 +309,6 @@ export interface DecisionPolicyWindows { */ minExecutionPeriod: Duration; } -export interface ReactiveDecisionPolicyWindows { - votingPeriod: ComputedRef; - minExecutionPeriod: ComputedRef; -} export interface DecisionPolicyWindowsProtoMsg { typeUrl: "/cosmos.group.v1.DecisionPolicyWindows"; value: Uint8Array; @@ -360,14 +338,6 @@ export interface GroupInfo { /** created_at is a timestamp specifying when a group was created. */ createdAt: Date; } -export interface ReactiveGroupInfo { - id: ComputedRef; - admin: ComputedRef; - metadata: ComputedRef; - version: ComputedRef; - totalWeight: ComputedRef; - createdAt: ComputedRef; -} export interface GroupInfoProtoMsg { typeUrl: "/cosmos.group.v1.GroupInfo"; value: Uint8Array; @@ -388,10 +358,6 @@ export interface GroupMember { /** member is the member data. */ member?: Member; } -export interface ReactiveGroupMember { - groupId: ComputedRef; - member?: ComputedRef; -} export interface GroupMemberProtoMsg { typeUrl: "/cosmos.group.v1.GroupMember"; value: Uint8Array; @@ -421,15 +387,6 @@ export interface GroupPolicyInfo { /** created_at is a timestamp specifying when a group policy was created. */ createdAt: Date; } -export interface ReactiveGroupPolicyInfo { - address: ComputedRef; - groupId: ComputedRef; - admin: ComputedRef; - metadata: ComputedRef; - version: ComputedRef; - decisionPolicy?: ComputedRef; - createdAt: ComputedRef; -} export interface GroupPolicyInfoProtoMsg { typeUrl: "/cosmos.group.v1.GroupPolicyInfo"; value: Uint8Array; @@ -498,21 +455,6 @@ export interface Proposal { /** messages is a list of Msgs that will be executed if the proposal passes. */ messages: Any[]; } -export interface ReactiveProposal { - id: ComputedRef; - address: ComputedRef; - metadata: ComputedRef; - proposers: ComputedRef; - submitTime: ComputedRef; - groupVersion: ComputedRef; - groupPolicyVersion: ComputedRef; - status: ComputedRef; - result: ComputedRef; - finalTallyResult: ComputedRef; - votingPeriodEnd: ComputedRef; - executorResult: ComputedRef; - messages: ComputedRef; -} export interface ProposalProtoMsg { typeUrl: "/cosmos.group.v1.Proposal"; value: Uint8Array; @@ -549,12 +491,6 @@ export interface TallyResult { /** no_with_veto_count is the weighted sum of veto. */ noWithVetoCount: string; } -export interface ReactiveTallyResult { - yesCount: ComputedRef; - abstainCount: ComputedRef; - noCount: ComputedRef; - noWithVetoCount: ComputedRef; -} export interface TallyResultProtoMsg { typeUrl: "/cosmos.group.v1.TallyResult"; value: Uint8Array; @@ -579,13 +515,6 @@ export interface Vote { /** submit_time is the timestamp when the vote was submitted. */ submitTime: Date; } -export interface ReactiveVote { - proposalId: ComputedRef; - voter: ComputedRef; - option: ComputedRef; - metadata: ComputedRef; - submitTime: ComputedRef; -} export interface VoteProtoMsg { typeUrl: "/cosmos.group.v1.Vote"; value: Uint8Array; @@ -609,13 +538,13 @@ function createBaseMember(): Member { export const Member = { typeUrl: "/cosmos.group.v1.Member", encode(message: Member, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.address !== "") { + if (message.address !== undefined) { writer.uint32(10).string(message.address); } - if (message.weight !== "") { + if (message.weight !== undefined) { writer.uint32(18).string(message.weight); } - if (message.metadata !== "") { + if (message.metadata !== undefined) { writer.uint32(26).string(message.metadata); } if (message.addedAt !== undefined) { @@ -650,12 +579,12 @@ export const Member = { return message; }, fromJSON(object: any): Member { - return { - address: isSet(object.address) ? String(object.address) : "", - weight: isSet(object.weight) ? String(object.weight) : "", - metadata: isSet(object.metadata) ? String(object.metadata) : "", - addedAt: isSet(object.addedAt) ? new Date(object.addedAt) : undefined - }; + const obj = createBaseMember(); + if (isSet(object.address)) obj.address = String(object.address); + if (isSet(object.weight)) obj.weight = String(object.weight); + if (isSet(object.metadata)) obj.metadata = String(object.metadata); + if (isSet(object.addedAt)) obj.addedAt = new Date(object.addedAt); + return obj; }, toJSON(message: Member): JsonSafe { const obj: any = {}; @@ -774,9 +703,9 @@ export const Members = { return message; }, fromJSON(object: any): Members { - return { - members: Array.isArray(object?.members) ? object.members.map((e: any) => Member.fromJSON(e)) : [] - }; + const obj = createBaseMembers(); + if (Array.isArray(object?.members)) obj.members = object.members.map((e: any) => Member.fromJSON(e)); + return obj; }, toJSON(message: Members): JsonSafe { const obj: any = {}; @@ -856,7 +785,7 @@ function createBaseThresholdDecisionPolicy(): ThresholdDecisionPolicy { export const ThresholdDecisionPolicy = { typeUrl: "/cosmos.group.v1.ThresholdDecisionPolicy", encode(message: ThresholdDecisionPolicy, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.threshold !== "") { + if (message.threshold !== undefined) { writer.uint32(10).string(message.threshold); } if (message.windows !== undefined) { @@ -885,10 +814,10 @@ export const ThresholdDecisionPolicy = { return message; }, fromJSON(object: any): ThresholdDecisionPolicy { - return { - threshold: isSet(object.threshold) ? String(object.threshold) : "", - windows: isSet(object.windows) ? DecisionPolicyWindows.fromJSON(object.windows) : undefined - }; + const obj = createBaseThresholdDecisionPolicy(); + if (isSet(object.threshold)) obj.threshold = String(object.threshold); + if (isSet(object.windows)) obj.windows = DecisionPolicyWindows.fromJSON(object.windows); + return obj; }, toJSON(message: ThresholdDecisionPolicy): JsonSafe { const obj: any = {}; @@ -899,7 +828,9 @@ export const ThresholdDecisionPolicy = { fromPartial(object: DeepPartial): ThresholdDecisionPolicy { const message = createBaseThresholdDecisionPolicy(); message.threshold = object.threshold ?? ""; - message.windows = object.windows !== undefined && object.windows !== null ? DecisionPolicyWindows.fromPartial(object.windows) : undefined; + if (object.windows !== undefined && object.windows !== null) { + message.windows = DecisionPolicyWindows.fromPartial(object.windows); + } return message; }, fromSDK(object: ThresholdDecisionPolicySDKType): ThresholdDecisionPolicy { @@ -967,7 +898,7 @@ function createBasePercentageDecisionPolicy(): PercentageDecisionPolicy { export const PercentageDecisionPolicy = { typeUrl: "/cosmos.group.v1.PercentageDecisionPolicy", encode(message: PercentageDecisionPolicy, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.percentage !== "") { + if (message.percentage !== undefined) { writer.uint32(10).string(message.percentage); } if (message.windows !== undefined) { @@ -996,10 +927,10 @@ export const PercentageDecisionPolicy = { return message; }, fromJSON(object: any): PercentageDecisionPolicy { - return { - percentage: isSet(object.percentage) ? String(object.percentage) : "", - windows: isSet(object.windows) ? DecisionPolicyWindows.fromJSON(object.windows) : undefined - }; + const obj = createBasePercentageDecisionPolicy(); + if (isSet(object.percentage)) obj.percentage = String(object.percentage); + if (isSet(object.windows)) obj.windows = DecisionPolicyWindows.fromJSON(object.windows); + return obj; }, toJSON(message: PercentageDecisionPolicy): JsonSafe { const obj: any = {}; @@ -1010,7 +941,9 @@ export const PercentageDecisionPolicy = { fromPartial(object: DeepPartial): PercentageDecisionPolicy { const message = createBasePercentageDecisionPolicy(); message.percentage = object.percentage ?? ""; - message.windows = object.windows !== undefined && object.windows !== null ? DecisionPolicyWindows.fromPartial(object.windows) : undefined; + if (object.windows !== undefined && object.windows !== null) { + message.windows = DecisionPolicyWindows.fromPartial(object.windows); + } return message; }, fromSDK(object: PercentageDecisionPolicySDKType): PercentageDecisionPolicy { @@ -1107,10 +1040,10 @@ export const DecisionPolicyWindows = { return message; }, fromJSON(object: any): DecisionPolicyWindows { - return { - votingPeriod: isSet(object.votingPeriod) ? Duration.fromJSON(object.votingPeriod) : undefined, - minExecutionPeriod: isSet(object.minExecutionPeriod) ? Duration.fromJSON(object.minExecutionPeriod) : undefined - }; + const obj = createBaseDecisionPolicyWindows(); + if (isSet(object.votingPeriod)) obj.votingPeriod = Duration.fromJSON(object.votingPeriod); + if (isSet(object.minExecutionPeriod)) obj.minExecutionPeriod = Duration.fromJSON(object.minExecutionPeriod); + return obj; }, toJSON(message: DecisionPolicyWindows): JsonSafe { const obj: any = {}; @@ -1120,8 +1053,12 @@ export const DecisionPolicyWindows = { }, fromPartial(object: DeepPartial): DecisionPolicyWindows { const message = createBaseDecisionPolicyWindows(); - message.votingPeriod = object.votingPeriod !== undefined && object.votingPeriod !== null ? Duration.fromPartial(object.votingPeriod) : undefined; - message.minExecutionPeriod = object.minExecutionPeriod !== undefined && object.minExecutionPeriod !== null ? Duration.fromPartial(object.minExecutionPeriod) : undefined; + if (object.votingPeriod !== undefined && object.votingPeriod !== null) { + message.votingPeriod = Duration.fromPartial(object.votingPeriod); + } + if (object.minExecutionPeriod !== undefined && object.minExecutionPeriod !== null) { + message.minExecutionPeriod = Duration.fromPartial(object.minExecutionPeriod); + } return message; }, fromSDK(object: DecisionPolicyWindowsSDKType): DecisionPolicyWindows { @@ -1193,19 +1130,19 @@ function createBaseGroupInfo(): GroupInfo { export const GroupInfo = { typeUrl: "/cosmos.group.v1.GroupInfo", encode(message: GroupInfo, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.id !== BigInt(0)) { + if (message.id !== undefined) { writer.uint32(8).uint64(message.id); } - if (message.admin !== "") { + if (message.admin !== undefined) { writer.uint32(18).string(message.admin); } - if (message.metadata !== "") { + if (message.metadata !== undefined) { writer.uint32(26).string(message.metadata); } - if (message.version !== BigInt(0)) { + if (message.version !== undefined) { writer.uint32(32).uint64(message.version); } - if (message.totalWeight !== "") { + if (message.totalWeight !== undefined) { writer.uint32(42).string(message.totalWeight); } if (message.createdAt !== undefined) { @@ -1246,14 +1183,14 @@ export const GroupInfo = { return message; }, fromJSON(object: any): GroupInfo { - return { - id: isSet(object.id) ? BigInt(object.id.toString()) : BigInt(0), - admin: isSet(object.admin) ? String(object.admin) : "", - metadata: isSet(object.metadata) ? String(object.metadata) : "", - version: isSet(object.version) ? BigInt(object.version.toString()) : BigInt(0), - totalWeight: isSet(object.totalWeight) ? String(object.totalWeight) : "", - createdAt: isSet(object.createdAt) ? new Date(object.createdAt) : undefined - }; + const obj = createBaseGroupInfo(); + if (isSet(object.id)) obj.id = BigInt(object.id.toString()); + if (isSet(object.admin)) obj.admin = String(object.admin); + if (isSet(object.metadata)) obj.metadata = String(object.metadata); + if (isSet(object.version)) obj.version = BigInt(object.version.toString()); + if (isSet(object.totalWeight)) obj.totalWeight = String(object.totalWeight); + if (isSet(object.createdAt)) obj.createdAt = new Date(object.createdAt); + return obj; }, toJSON(message: GroupInfo): JsonSafe { const obj: any = {}; @@ -1267,10 +1204,14 @@ export const GroupInfo = { }, fromPartial(object: DeepPartial): GroupInfo { const message = createBaseGroupInfo(); - message.id = object.id !== undefined && object.id !== null ? BigInt(object.id.toString()) : BigInt(0); + if (object.id !== undefined && object.id !== null) { + message.id = BigInt(object.id.toString()); + } message.admin = object.admin ?? ""; message.metadata = object.metadata ?? ""; - message.version = object.version !== undefined && object.version !== null ? BigInt(object.version.toString()) : BigInt(0); + if (object.version !== undefined && object.version !== null) { + message.version = BigInt(object.version.toString()); + } message.totalWeight = object.totalWeight ?? ""; message.createdAt = object.createdAt ?? undefined; return message; @@ -1368,7 +1309,7 @@ function createBaseGroupMember(): GroupMember { export const GroupMember = { typeUrl: "/cosmos.group.v1.GroupMember", encode(message: GroupMember, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.groupId !== BigInt(0)) { + if (message.groupId !== undefined) { writer.uint32(8).uint64(message.groupId); } if (message.member !== undefined) { @@ -1397,10 +1338,10 @@ export const GroupMember = { return message; }, fromJSON(object: any): GroupMember { - return { - groupId: isSet(object.groupId) ? BigInt(object.groupId.toString()) : BigInt(0), - member: isSet(object.member) ? Member.fromJSON(object.member) : undefined - }; + const obj = createBaseGroupMember(); + if (isSet(object.groupId)) obj.groupId = BigInt(object.groupId.toString()); + if (isSet(object.member)) obj.member = Member.fromJSON(object.member); + return obj; }, toJSON(message: GroupMember): JsonSafe { const obj: any = {}; @@ -1410,8 +1351,12 @@ export const GroupMember = { }, fromPartial(object: DeepPartial): GroupMember { const message = createBaseGroupMember(); - message.groupId = object.groupId !== undefined && object.groupId !== null ? BigInt(object.groupId.toString()) : BigInt(0); - message.member = object.member !== undefined && object.member !== null ? Member.fromPartial(object.member) : undefined; + if (object.groupId !== undefined && object.groupId !== null) { + message.groupId = BigInt(object.groupId.toString()); + } + if (object.member !== undefined && object.member !== null) { + message.member = Member.fromPartial(object.member); + } return message; }, fromSDK(object: GroupMemberSDKType): GroupMember { @@ -1484,19 +1429,19 @@ function createBaseGroupPolicyInfo(): GroupPolicyInfo { export const GroupPolicyInfo = { typeUrl: "/cosmos.group.v1.GroupPolicyInfo", encode(message: GroupPolicyInfo, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.address !== "") { + if (message.address !== undefined) { writer.uint32(10).string(message.address); } - if (message.groupId !== BigInt(0)) { + if (message.groupId !== undefined) { writer.uint32(16).uint64(message.groupId); } - if (message.admin !== "") { + if (message.admin !== undefined) { writer.uint32(26).string(message.admin); } - if (message.metadata !== "") { + if (message.metadata !== undefined) { writer.uint32(34).string(message.metadata); } - if (message.version !== BigInt(0)) { + if (message.version !== undefined) { writer.uint32(40).uint64(message.version); } if (message.decisionPolicy !== undefined) { @@ -1543,15 +1488,15 @@ export const GroupPolicyInfo = { return message; }, fromJSON(object: any): GroupPolicyInfo { - return { - address: isSet(object.address) ? String(object.address) : "", - groupId: isSet(object.groupId) ? BigInt(object.groupId.toString()) : BigInt(0), - admin: isSet(object.admin) ? String(object.admin) : "", - metadata: isSet(object.metadata) ? String(object.metadata) : "", - version: isSet(object.version) ? BigInt(object.version.toString()) : BigInt(0), - decisionPolicy: isSet(object.decisionPolicy) ? Any.fromJSON(object.decisionPolicy) : undefined, - createdAt: isSet(object.createdAt) ? new Date(object.createdAt) : undefined - }; + const obj = createBaseGroupPolicyInfo(); + if (isSet(object.address)) obj.address = String(object.address); + if (isSet(object.groupId)) obj.groupId = BigInt(object.groupId.toString()); + if (isSet(object.admin)) obj.admin = String(object.admin); + if (isSet(object.metadata)) obj.metadata = String(object.metadata); + if (isSet(object.version)) obj.version = BigInt(object.version.toString()); + if (isSet(object.decisionPolicy)) obj.decisionPolicy = Any.fromJSON(object.decisionPolicy); + if (isSet(object.createdAt)) obj.createdAt = new Date(object.createdAt); + return obj; }, toJSON(message: GroupPolicyInfo): JsonSafe { const obj: any = {}; @@ -1567,11 +1512,17 @@ export const GroupPolicyInfo = { fromPartial(object: DeepPartial): GroupPolicyInfo { const message = createBaseGroupPolicyInfo(); message.address = object.address ?? ""; - message.groupId = object.groupId !== undefined && object.groupId !== null ? BigInt(object.groupId.toString()) : BigInt(0); + if (object.groupId !== undefined && object.groupId !== null) { + message.groupId = BigInt(object.groupId.toString()); + } message.admin = object.admin ?? ""; message.metadata = object.metadata ?? ""; - message.version = object.version !== undefined && object.version !== null ? BigInt(object.version.toString()) : BigInt(0); - message.decisionPolicy = object.decisionPolicy !== undefined && object.decisionPolicy !== null ? Any.fromPartial(object.decisionPolicy) : undefined; + if (object.version !== undefined && object.version !== null) { + message.version = BigInt(object.version.toString()); + } + if (object.decisionPolicy !== undefined && object.decisionPolicy !== null) { + message.decisionPolicy = Any.fromPartial(object.decisionPolicy); + } message.createdAt = object.createdAt ?? undefined; return message; }, @@ -1686,13 +1637,13 @@ function createBaseProposal(): Proposal { export const Proposal = { typeUrl: "/cosmos.group.v1.Proposal", encode(message: Proposal, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.id !== BigInt(0)) { + if (message.id !== undefined) { writer.uint32(8).uint64(message.id); } - if (message.address !== "") { + if (message.address !== undefined) { writer.uint32(18).string(message.address); } - if (message.metadata !== "") { + if (message.metadata !== undefined) { writer.uint32(26).string(message.metadata); } for (const v of message.proposers) { @@ -1701,10 +1652,10 @@ export const Proposal = { if (message.submitTime !== undefined) { Timestamp.encode(toTimestamp(message.submitTime), writer.uint32(42).fork()).ldelim(); } - if (message.groupVersion !== BigInt(0)) { + if (message.groupVersion !== undefined) { writer.uint32(48).uint64(message.groupVersion); } - if (message.groupPolicyVersion !== BigInt(0)) { + if (message.groupPolicyVersion !== undefined) { writer.uint32(56).uint64(message.groupPolicyVersion); } if (message.status !== 0) { @@ -1781,21 +1732,21 @@ export const Proposal = { return message; }, fromJSON(object: any): Proposal { - return { - id: isSet(object.id) ? BigInt(object.id.toString()) : BigInt(0), - address: isSet(object.address) ? String(object.address) : "", - metadata: isSet(object.metadata) ? String(object.metadata) : "", - proposers: Array.isArray(object?.proposers) ? object.proposers.map((e: any) => String(e)) : [], - submitTime: isSet(object.submitTime) ? new Date(object.submitTime) : undefined, - groupVersion: isSet(object.groupVersion) ? BigInt(object.groupVersion.toString()) : BigInt(0), - groupPolicyVersion: isSet(object.groupPolicyVersion) ? BigInt(object.groupPolicyVersion.toString()) : BigInt(0), - status: isSet(object.status) ? proposalStatusFromJSON(object.status) : -1, - result: isSet(object.result) ? proposalResultFromJSON(object.result) : -1, - finalTallyResult: isSet(object.finalTallyResult) ? TallyResult.fromJSON(object.finalTallyResult) : undefined, - votingPeriodEnd: isSet(object.votingPeriodEnd) ? new Date(object.votingPeriodEnd) : undefined, - executorResult: isSet(object.executorResult) ? proposalExecutorResultFromJSON(object.executorResult) : -1, - messages: Array.isArray(object?.messages) ? object.messages.map((e: any) => Any.fromJSON(e)) : [] - }; + const obj = createBaseProposal(); + if (isSet(object.id)) obj.id = BigInt(object.id.toString()); + if (isSet(object.address)) obj.address = String(object.address); + if (isSet(object.metadata)) obj.metadata = String(object.metadata); + if (Array.isArray(object?.proposers)) obj.proposers = object.proposers.map((e: any) => String(e)); + if (isSet(object.submitTime)) obj.submitTime = new Date(object.submitTime); + if (isSet(object.groupVersion)) obj.groupVersion = BigInt(object.groupVersion.toString()); + if (isSet(object.groupPolicyVersion)) obj.groupPolicyVersion = BigInt(object.groupPolicyVersion.toString()); + if (isSet(object.status)) obj.status = proposalStatusFromJSON(object.status); + if (isSet(object.result)) obj.result = proposalResultFromJSON(object.result); + if (isSet(object.finalTallyResult)) obj.finalTallyResult = TallyResult.fromJSON(object.finalTallyResult); + if (isSet(object.votingPeriodEnd)) obj.votingPeriodEnd = new Date(object.votingPeriodEnd); + if (isSet(object.executorResult)) obj.executorResult = proposalExecutorResultFromJSON(object.executorResult); + if (Array.isArray(object?.messages)) obj.messages = object.messages.map((e: any) => Any.fromJSON(e)); + return obj; }, toJSON(message: Proposal): JsonSafe { const obj: any = {}; @@ -1824,16 +1775,24 @@ export const Proposal = { }, fromPartial(object: DeepPartial): Proposal { const message = createBaseProposal(); - message.id = object.id !== undefined && object.id !== null ? BigInt(object.id.toString()) : BigInt(0); + if (object.id !== undefined && object.id !== null) { + message.id = BigInt(object.id.toString()); + } message.address = object.address ?? ""; message.metadata = object.metadata ?? ""; message.proposers = object.proposers?.map(e => e) || []; message.submitTime = object.submitTime ?? undefined; - message.groupVersion = object.groupVersion !== undefined && object.groupVersion !== null ? BigInt(object.groupVersion.toString()) : BigInt(0); - message.groupPolicyVersion = object.groupPolicyVersion !== undefined && object.groupPolicyVersion !== null ? BigInt(object.groupPolicyVersion.toString()) : BigInt(0); + if (object.groupVersion !== undefined && object.groupVersion !== null) { + message.groupVersion = BigInt(object.groupVersion.toString()); + } + if (object.groupPolicyVersion !== undefined && object.groupPolicyVersion !== null) { + message.groupPolicyVersion = BigInt(object.groupPolicyVersion.toString()); + } message.status = object.status ?? 0; message.result = object.result ?? 0; - message.finalTallyResult = object.finalTallyResult !== undefined && object.finalTallyResult !== null ? TallyResult.fromPartial(object.finalTallyResult) : undefined; + if (object.finalTallyResult !== undefined && object.finalTallyResult !== null) { + message.finalTallyResult = TallyResult.fromPartial(object.finalTallyResult); + } message.votingPeriodEnd = object.votingPeriodEnd ?? undefined; message.executorResult = object.executorResult ?? 0; message.messages = object.messages?.map(e => Any.fromPartial(e)) || []; @@ -1995,16 +1954,16 @@ function createBaseTallyResult(): TallyResult { export const TallyResult = { typeUrl: "/cosmos.group.v1.TallyResult", encode(message: TallyResult, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.yesCount !== "") { + if (message.yesCount !== undefined) { writer.uint32(10).string(message.yesCount); } - if (message.abstainCount !== "") { + if (message.abstainCount !== undefined) { writer.uint32(18).string(message.abstainCount); } - if (message.noCount !== "") { + if (message.noCount !== undefined) { writer.uint32(26).string(message.noCount); } - if (message.noWithVetoCount !== "") { + if (message.noWithVetoCount !== undefined) { writer.uint32(34).string(message.noWithVetoCount); } return writer; @@ -2036,12 +1995,12 @@ export const TallyResult = { return message; }, fromJSON(object: any): TallyResult { - return { - yesCount: isSet(object.yesCount) ? String(object.yesCount) : "", - abstainCount: isSet(object.abstainCount) ? String(object.abstainCount) : "", - noCount: isSet(object.noCount) ? String(object.noCount) : "", - noWithVetoCount: isSet(object.noWithVetoCount) ? String(object.noWithVetoCount) : "" - }; + const obj = createBaseTallyResult(); + if (isSet(object.yesCount)) obj.yesCount = String(object.yesCount); + if (isSet(object.abstainCount)) obj.abstainCount = String(object.abstainCount); + if (isSet(object.noCount)) obj.noCount = String(object.noCount); + if (isSet(object.noWithVetoCount)) obj.noWithVetoCount = String(object.noWithVetoCount); + return obj; }, toJSON(message: TallyResult): JsonSafe { const obj: any = {}; @@ -2141,16 +2100,16 @@ function createBaseVote(): Vote { export const Vote = { typeUrl: "/cosmos.group.v1.Vote", encode(message: Vote, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.proposalId !== BigInt(0)) { + if (message.proposalId !== undefined) { writer.uint32(8).uint64(message.proposalId); } - if (message.voter !== "") { + if (message.voter !== undefined) { writer.uint32(18).string(message.voter); } if (message.option !== 0) { writer.uint32(24).int32(message.option); } - if (message.metadata !== "") { + if (message.metadata !== undefined) { writer.uint32(34).string(message.metadata); } if (message.submitTime !== undefined) { @@ -2188,13 +2147,13 @@ export const Vote = { return message; }, fromJSON(object: any): Vote { - return { - proposalId: isSet(object.proposalId) ? BigInt(object.proposalId.toString()) : BigInt(0), - voter: isSet(object.voter) ? String(object.voter) : "", - option: isSet(object.option) ? voteOptionFromJSON(object.option) : -1, - metadata: isSet(object.metadata) ? String(object.metadata) : "", - submitTime: isSet(object.submitTime) ? new Date(object.submitTime) : undefined - }; + const obj = createBaseVote(); + if (isSet(object.proposalId)) obj.proposalId = BigInt(object.proposalId.toString()); + if (isSet(object.voter)) obj.voter = String(object.voter); + if (isSet(object.option)) obj.option = voteOptionFromJSON(object.option); + if (isSet(object.metadata)) obj.metadata = String(object.metadata); + if (isSet(object.submitTime)) obj.submitTime = new Date(object.submitTime); + return obj; }, toJSON(message: Vote): JsonSafe { const obj: any = {}; @@ -2207,7 +2166,9 @@ export const Vote = { }, fromPartial(object: DeepPartial): Vote { const message = createBaseVote(); - message.proposalId = object.proposalId !== undefined && object.proposalId !== null ? BigInt(object.proposalId.toString()) : BigInt(0); + if (object.proposalId !== undefined && object.proposalId !== null) { + message.proposalId = BigInt(object.proposalId.toString()); + } message.voter = object.voter ?? ""; message.option = object.option ?? 0; message.metadata = object.metadata ?? ""; diff --git a/__fixtures__/v-next/outputv4/cosmos/ics23/v1/proofs.ts b/__fixtures__/v-next/outputv4/cosmos/ics23/v1/proofs.ts deleted file mode 100644 index 9977a1d2c6..0000000000 --- a/__fixtures__/v-next/outputv4/cosmos/ics23/v1/proofs.ts +++ /dev/null @@ -1,2415 +0,0 @@ -import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, bytesFromBase64, base64FromBytes, DeepPartial } from "../../../helpers"; -import { JsonSafe } from "../../../json-safe"; -import { ComputedRef } from "vue"; -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. */ - NO_HASH = 0, - SHA256 = 1, - SHA512 = 2, - KECCAK = 3, - RIPEMD160 = 4, - /** BITCOIN - ripemd160(sha256(x)) */ - BITCOIN = 5, - SHA512_256 = 6, - UNRECOGNIZED = -1, -} -export const HashOpSDKType = HashOp; -export function hashOpFromJSON(object: any): HashOp { - switch (object) { - case 0: - case "NO_HASH": - return HashOp.NO_HASH; - case 1: - case "SHA256": - return HashOp.SHA256; - case 2: - case "SHA512": - return HashOp.SHA512; - case 3: - case "KECCAK": - return HashOp.KECCAK; - case 4: - case "RIPEMD160": - return HashOp.RIPEMD160; - case 5: - case "BITCOIN": - return HashOp.BITCOIN; - case 6: - case "SHA512_256": - return HashOp.SHA512_256; - case -1: - case "UNRECOGNIZED": - default: - return HashOp.UNRECOGNIZED; - } -} -export function hashOpToJSON(object: HashOp): string { - switch (object) { - case HashOp.NO_HASH: - return "NO_HASH"; - case HashOp.SHA256: - return "SHA256"; - case HashOp.SHA512: - return "SHA512"; - case HashOp.KECCAK: - return "KECCAK"; - case HashOp.RIPEMD160: - return "RIPEMD160"; - case HashOp.BITCOIN: - return "BITCOIN"; - case HashOp.SHA512_256: - return "SHA512_256"; - case HashOp.UNRECOGNIZED: - default: - return "UNRECOGNIZED"; - } -} -/** - * LengthOp defines how to process the key and value of the LeafOp - * to include length information. After encoding the length with the given - * algorithm, the length will be prepended to the key and value bytes. - * (Each one with it's own encoded length) - */ -export enum LengthOp { - /** NO_PREFIX - NO_PREFIX don't include any length info */ - NO_PREFIX = 0, - /** VAR_PROTO - VAR_PROTO uses protobuf (and go-amino) varint encoding of the length */ - VAR_PROTO = 1, - /** VAR_RLP - VAR_RLP uses rlp int encoding of the length */ - VAR_RLP = 2, - /** FIXED32_BIG - FIXED32_BIG uses big-endian encoding of the length as a 32 bit integer */ - FIXED32_BIG = 3, - /** FIXED32_LITTLE - FIXED32_LITTLE uses little-endian encoding of the length as a 32 bit integer */ - FIXED32_LITTLE = 4, - /** FIXED64_BIG - FIXED64_BIG uses big-endian encoding of the length as a 64 bit integer */ - FIXED64_BIG = 5, - /** FIXED64_LITTLE - FIXED64_LITTLE uses little-endian encoding of the length as a 64 bit integer */ - FIXED64_LITTLE = 6, - /** REQUIRE_32_BYTES - REQUIRE_32_BYTES is like NONE, but will fail if the input is not exactly 32 bytes (sha256 output) */ - REQUIRE_32_BYTES = 7, - /** REQUIRE_64_BYTES - REQUIRE_64_BYTES is like NONE, but will fail if the input is not exactly 64 bytes (sha512 output) */ - REQUIRE_64_BYTES = 8, - UNRECOGNIZED = -1, -} -export const LengthOpSDKType = LengthOp; -export function lengthOpFromJSON(object: any): LengthOp { - switch (object) { - case 0: - case "NO_PREFIX": - return LengthOp.NO_PREFIX; - case 1: - case "VAR_PROTO": - return LengthOp.VAR_PROTO; - case 2: - case "VAR_RLP": - return LengthOp.VAR_RLP; - case 3: - case "FIXED32_BIG": - return LengthOp.FIXED32_BIG; - case 4: - case "FIXED32_LITTLE": - return LengthOp.FIXED32_LITTLE; - case 5: - case "FIXED64_BIG": - return LengthOp.FIXED64_BIG; - case 6: - case "FIXED64_LITTLE": - return LengthOp.FIXED64_LITTLE; - case 7: - case "REQUIRE_32_BYTES": - return LengthOp.REQUIRE_32_BYTES; - case 8: - case "REQUIRE_64_BYTES": - return LengthOp.REQUIRE_64_BYTES; - case -1: - case "UNRECOGNIZED": - default: - return LengthOp.UNRECOGNIZED; - } -} -export function lengthOpToJSON(object: LengthOp): string { - switch (object) { - case LengthOp.NO_PREFIX: - return "NO_PREFIX"; - case LengthOp.VAR_PROTO: - return "VAR_PROTO"; - case LengthOp.VAR_RLP: - return "VAR_RLP"; - case LengthOp.FIXED32_BIG: - return "FIXED32_BIG"; - case LengthOp.FIXED32_LITTLE: - return "FIXED32_LITTLE"; - case LengthOp.FIXED64_BIG: - return "FIXED64_BIG"; - case LengthOp.FIXED64_LITTLE: - return "FIXED64_LITTLE"; - case LengthOp.REQUIRE_32_BYTES: - return "REQUIRE_32_BYTES"; - case LengthOp.REQUIRE_64_BYTES: - return "REQUIRE_64_BYTES"; - case LengthOp.UNRECOGNIZED: - default: - return "UNRECOGNIZED"; - } -} -/** - * ExistenceProof takes a key and a value and a set of steps to perform on it. - * The result of peforming all these steps will provide a "root hash", which can - * be compared to the value in a header. - * - * Since it is computationally infeasible to produce a hash collission for any of the used - * cryptographic hash functions, if someone can provide a series of operations to transform - * a given key and value into a root hash that matches some trusted root, these key and values - * must be in the referenced merkle tree. - * - * The only possible issue is maliablity in LeafOp, such as providing extra prefix data, - * which should be controlled by a spec. Eg. with lengthOp as NONE, - * prefix = FOO, key = BAR, value = CHOICE - * and - * prefix = F, key = OOBAR, value = CHOICE - * would produce the same value. - * - * With LengthOp this is tricker but not impossible. Which is why the "leafPrefixEqual" field - * in the ProofSpec is valuable to prevent this mutability. And why all trees should - * length-prefix the data before hashing it. - */ -export interface ExistenceProof { - key: Uint8Array; - value: Uint8Array; - leaf?: LeafOp; - path: InnerOp[]; -} -export interface ReactiveExistenceProof { - key: ComputedRef; - value: ComputedRef; - leaf?: ComputedRef; - path: ComputedRef; -} -export interface ExistenceProofProtoMsg { - typeUrl: "/cosmos.ics23.v1.ExistenceProof"; - value: Uint8Array; -} -/** - * ExistenceProof takes a key and a value and a set of steps to perform on it. - * The result of peforming all these steps will provide a "root hash", which can - * be compared to the value in a header. - * - * Since it is computationally infeasible to produce a hash collission for any of the used - * cryptographic hash functions, if someone can provide a series of operations to transform - * a given key and value into a root hash that matches some trusted root, these key and values - * must be in the referenced merkle tree. - * - * The only possible issue is maliablity in LeafOp, such as providing extra prefix data, - * which should be controlled by a spec. Eg. with lengthOp as NONE, - * prefix = FOO, key = BAR, value = CHOICE - * and - * prefix = F, key = OOBAR, value = CHOICE - * would produce the same value. - * - * With LengthOp this is tricker but not impossible. Which is why the "leafPrefixEqual" field - * in the ProofSpec is valuable to prevent this mutability. And why all trees should - * length-prefix the data before hashing it. - */ -export interface ExistenceProofSDKType { - key: Uint8Array; - value: Uint8Array; - leaf?: LeafOpSDKType; - path: InnerOpSDKType[]; -} -/** - * NonExistenceProof takes a proof of two neighbors, one left of the desired key, - * one right of the desired key. If both proofs are valid AND they are neighbors, - * then there is no valid proof for the given key. - */ -export interface NonExistenceProof { - /** TODO: remove this as unnecessary??? we prove a range */ - key: Uint8Array; - left?: ExistenceProof; - right?: ExistenceProof; -} -export interface ReactiveNonExistenceProof { - key: ComputedRef; - left?: ComputedRef; - right?: ComputedRef; -} -export interface NonExistenceProofProtoMsg { - typeUrl: "/cosmos.ics23.v1.NonExistenceProof"; - value: Uint8Array; -} -/** - * NonExistenceProof takes a proof of two neighbors, one left of the desired key, - * one right of the desired key. If both proofs are valid AND they are neighbors, - * then there is no valid proof for the given key. - */ -export interface NonExistenceProofSDKType { - key: Uint8Array; - left?: ExistenceProofSDKType; - right?: ExistenceProofSDKType; -} -/** CommitmentProof is either an ExistenceProof or a NonExistenceProof, or a Batch of such messages */ -export interface CommitmentProof { - exist?: ExistenceProof; - nonexist?: NonExistenceProof; - batch?: BatchProof; - compressed?: CompressedBatchProof; -} -export interface ReactiveCommitmentProof { - exist?: ComputedRef; - nonexist?: ComputedRef; - batch?: ComputedRef; - compressed?: ComputedRef; -} -export interface CommitmentProofProtoMsg { - typeUrl: "/cosmos.ics23.v1.CommitmentProof"; - value: Uint8Array; -} -/** CommitmentProof is either an ExistenceProof or a NonExistenceProof, or a Batch of such messages */ -export interface CommitmentProofSDKType { - exist?: ExistenceProofSDKType; - nonexist?: NonExistenceProofSDKType; - batch?: BatchProofSDKType; - compressed?: CompressedBatchProofSDKType; -} -/** - * LeafOp represents the raw key-value data we wish to prove, and - * must be flexible to represent the internal transformation from - * the original key-value pairs into the basis hash, for many existing - * merkle trees. - * - * key and value are passed in. So that the signature of this operation is: - * leafOp(key, value) -> output - * - * To process this, first prehash the keys and values if needed (ANY means no hash in this case): - * hkey = prehashKey(key) - * hvalue = prehashValue(value) - * - * Then combine the bytes, and hash it - * output = hash(prefix || length(hkey) || hkey || length(hvalue) || hvalue) - */ -export interface LeafOp { - hash: HashOp; - prehashKey: HashOp; - prehashValue: HashOp; - length: LengthOp; - /** - * prefix is a fixed bytes that may optionally be included at the beginning to differentiate - * a leaf node from an inner node. - */ - prefix: Uint8Array; -} -export interface ReactiveLeafOp { - hash: ComputedRef; - prehashKey: ComputedRef; - prehashValue: ComputedRef; - length: ComputedRef; - prefix: ComputedRef; -} -export interface LeafOpProtoMsg { - typeUrl: "/cosmos.ics23.v1.LeafOp"; - value: Uint8Array; -} -/** - * LeafOp represents the raw key-value data we wish to prove, and - * must be flexible to represent the internal transformation from - * the original key-value pairs into the basis hash, for many existing - * merkle trees. - * - * key and value are passed in. So that the signature of this operation is: - * leafOp(key, value) -> output - * - * To process this, first prehash the keys and values if needed (ANY means no hash in this case): - * hkey = prehashKey(key) - * hvalue = prehashValue(value) - * - * Then combine the bytes, and hash it - * output = hash(prefix || length(hkey) || hkey || length(hvalue) || hvalue) - */ -export interface LeafOpSDKType { - hash: HashOp; - prehash_key: HashOp; - prehash_value: HashOp; - length: LengthOp; - prefix: Uint8Array; -} -/** - * InnerOp represents a merkle-proof step that is not a leaf. - * It represents concatenating two children and hashing them to provide the next result. - * - * The result of the previous step is passed in, so the signature of this op is: - * innerOp(child) -> output - * - * The result of applying InnerOp should be: - * output = op.hash(op.prefix || child || op.suffix) - * - * where the || operator is concatenation of binary data, - * and child is the result of hashing all the tree below this step. - * - * Any special data, like prepending child with the length, or prepending the entire operation with - * some value to differentiate from leaf nodes, should be included in prefix and suffix. - * If either of prefix or suffix is empty, we just treat it as an empty string - */ -export interface InnerOp { - hash: HashOp; - prefix: Uint8Array; - suffix: Uint8Array; -} -export interface ReactiveInnerOp { - hash: ComputedRef; - prefix: ComputedRef; - suffix: ComputedRef; -} -export interface InnerOpProtoMsg { - typeUrl: "/cosmos.ics23.v1.InnerOp"; - value: Uint8Array; -} -/** - * InnerOp represents a merkle-proof step that is not a leaf. - * It represents concatenating two children and hashing them to provide the next result. - * - * The result of the previous step is passed in, so the signature of this op is: - * innerOp(child) -> output - * - * The result of applying InnerOp should be: - * output = op.hash(op.prefix || child || op.suffix) - * - * where the || operator is concatenation of binary data, - * and child is the result of hashing all the tree below this step. - * - * Any special data, like prepending child with the length, or prepending the entire operation with - * some value to differentiate from leaf nodes, should be included in prefix and suffix. - * If either of prefix or suffix is empty, we just treat it as an empty string - */ -export interface InnerOpSDKType { - hash: HashOp; - prefix: Uint8Array; - suffix: Uint8Array; -} -/** - * ProofSpec defines what the expected parameters are for a given proof type. - * This can be stored in the client and used to validate any incoming proofs. - * - * verify(ProofSpec, Proof) -> Proof | Error - * - * As demonstrated in tests, if we don't fix the algorithm used to calculate the - * LeafHash for a given tree, there are many possible key-value pairs that can - * generate a given hash (by interpretting the preimage differently). - * We need this for proper security, requires client knows a priori what - * tree format server uses. But not in code, rather a configuration object. - */ -export interface ProofSpec { - /** - * any field in the ExistenceProof must be the same as in this spec. - * except Prefix, which is just the first bytes of prefix (spec can be longer) - */ - leafSpec?: LeafOp; - innerSpec?: InnerSpec; - /** max_depth (if > 0) is the maximum number of InnerOps allowed (mainly for fixed-depth tries) */ - maxDepth: number; - /** min_depth (if > 0) is the minimum number of InnerOps allowed (mainly for fixed-depth tries) */ - minDepth: number; -} -export interface ReactiveProofSpec { - leafSpec?: ComputedRef; - innerSpec?: ComputedRef; - maxDepth: ComputedRef; - minDepth: ComputedRef; -} -export interface ProofSpecProtoMsg { - typeUrl: "/cosmos.ics23.v1.ProofSpec"; - value: Uint8Array; -} -/** - * ProofSpec defines what the expected parameters are for a given proof type. - * This can be stored in the client and used to validate any incoming proofs. - * - * verify(ProofSpec, Proof) -> Proof | Error - * - * As demonstrated in tests, if we don't fix the algorithm used to calculate the - * LeafHash for a given tree, there are many possible key-value pairs that can - * generate a given hash (by interpretting the preimage differently). - * We need this for proper security, requires client knows a priori what - * tree format server uses. But not in code, rather a configuration object. - */ -export interface ProofSpecSDKType { - leaf_spec?: LeafOpSDKType; - inner_spec?: InnerSpecSDKType; - max_depth: number; - min_depth: number; -} -/** - * InnerSpec contains all store-specific structure info to determine if two proofs from a - * given store are neighbors. - * - * This enables: - * - * isLeftMost(spec: InnerSpec, op: InnerOp) - * isRightMost(spec: InnerSpec, op: InnerOp) - * isLeftNeighbor(spec: InnerSpec, left: InnerOp, right: InnerOp) - */ -export interface InnerSpec { - /** - * Child order is the ordering of the children node, must count from 0 - * iavl tree is [0, 1] (left then right) - * merk is [0, 2, 1] (left, right, here) - */ - childOrder: number[]; - childSize: number; - minPrefixLength: number; - maxPrefixLength: number; - /** empty child is the prehash image that is used when one child is nil (eg. 20 bytes of 0) */ - emptyChild: Uint8Array; - /** hash is the algorithm that must be used for each InnerOp */ - hash: HashOp; -} -export interface ReactiveInnerSpec { - childOrder: ComputedRef; - childSize: ComputedRef; - minPrefixLength: ComputedRef; - maxPrefixLength: ComputedRef; - emptyChild: ComputedRef; - hash: ComputedRef; -} -export interface InnerSpecProtoMsg { - typeUrl: "/cosmos.ics23.v1.InnerSpec"; - value: Uint8Array; -} -/** - * InnerSpec contains all store-specific structure info to determine if two proofs from a - * given store are neighbors. - * - * This enables: - * - * isLeftMost(spec: InnerSpec, op: InnerOp) - * isRightMost(spec: InnerSpec, op: InnerOp) - * isLeftNeighbor(spec: InnerSpec, left: InnerOp, right: InnerOp) - */ -export interface InnerSpecSDKType { - child_order: number[]; - child_size: number; - min_prefix_length: number; - max_prefix_length: number; - empty_child: Uint8Array; - hash: HashOp; -} -/** BatchProof is a group of multiple proof types than can be compressed */ -export interface BatchProof { - entries: BatchEntry[]; -} -export interface ReactiveBatchProof { - entries: ComputedRef; -} -export interface BatchProofProtoMsg { - typeUrl: "/cosmos.ics23.v1.BatchProof"; - value: Uint8Array; -} -/** BatchProof is a group of multiple proof types than can be compressed */ -export interface BatchProofSDKType { - entries: BatchEntrySDKType[]; -} -/** Use BatchEntry not CommitmentProof, to avoid recursion */ -export interface BatchEntry { - exist?: ExistenceProof; - nonexist?: NonExistenceProof; -} -export interface ReactiveBatchEntry { - exist?: ComputedRef; - nonexist?: ComputedRef; -} -export interface BatchEntryProtoMsg { - typeUrl: "/cosmos.ics23.v1.BatchEntry"; - value: Uint8Array; -} -/** Use BatchEntry not CommitmentProof, to avoid recursion */ -export interface BatchEntrySDKType { - exist?: ExistenceProofSDKType; - nonexist?: NonExistenceProofSDKType; -} -export interface CompressedBatchProof { - entries: CompressedBatchEntry[]; - lookupInners: InnerOp[]; -} -export interface ReactiveCompressedBatchProof { - entries: ComputedRef; - lookupInners: ComputedRef; -} -export interface CompressedBatchProofProtoMsg { - typeUrl: "/cosmos.ics23.v1.CompressedBatchProof"; - value: Uint8Array; -} -export interface CompressedBatchProofSDKType { - entries: CompressedBatchEntrySDKType[]; - lookup_inners: InnerOpSDKType[]; -} -/** Use BatchEntry not CommitmentProof, to avoid recursion */ -export interface CompressedBatchEntry { - exist?: CompressedExistenceProof; - nonexist?: CompressedNonExistenceProof; -} -export interface ReactiveCompressedBatchEntry { - exist?: ComputedRef; - nonexist?: ComputedRef; -} -export interface CompressedBatchEntryProtoMsg { - typeUrl: "/cosmos.ics23.v1.CompressedBatchEntry"; - value: Uint8Array; -} -/** Use BatchEntry not CommitmentProof, to avoid recursion */ -export interface CompressedBatchEntrySDKType { - exist?: CompressedExistenceProofSDKType; - nonexist?: CompressedNonExistenceProofSDKType; -} -export interface CompressedExistenceProof { - key: Uint8Array; - value: Uint8Array; - leaf?: LeafOp; - /** these are indexes into the lookup_inners table in CompressedBatchProof */ - path: number[]; -} -export interface ReactiveCompressedExistenceProof { - key: ComputedRef; - value: ComputedRef; - leaf?: ComputedRef; - path: ComputedRef; -} -export interface CompressedExistenceProofProtoMsg { - typeUrl: "/cosmos.ics23.v1.CompressedExistenceProof"; - value: Uint8Array; -} -export interface CompressedExistenceProofSDKType { - key: Uint8Array; - value: Uint8Array; - leaf?: LeafOpSDKType; - path: number[]; -} -export interface CompressedNonExistenceProof { - /** TODO: remove this as unnecessary??? we prove a range */ - key: Uint8Array; - left?: CompressedExistenceProof; - right?: CompressedExistenceProof; -} -export interface ReactiveCompressedNonExistenceProof { - key: ComputedRef; - left?: ComputedRef; - right?: ComputedRef; -} -export interface CompressedNonExistenceProofProtoMsg { - typeUrl: "/cosmos.ics23.v1.CompressedNonExistenceProof"; - value: Uint8Array; -} -export interface CompressedNonExistenceProofSDKType { - key: Uint8Array; - left?: CompressedExistenceProofSDKType; - right?: CompressedExistenceProofSDKType; -} -function createBaseExistenceProof(): ExistenceProof { - return { - key: new Uint8Array(), - value: new Uint8Array(), - leaf: undefined, - path: [] - }; -} -export const ExistenceProof = { - typeUrl: "/cosmos.ics23.v1.ExistenceProof", - encode(message: ExistenceProof, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.key.length !== 0) { - writer.uint32(10).bytes(message.key); - } - if (message.value.length !== 0) { - writer.uint32(18).bytes(message.value); - } - if (message.leaf !== undefined) { - LeafOp.encode(message.leaf, writer.uint32(26).fork()).ldelim(); - } - for (const v of message.path) { - InnerOp.encode(v!, writer.uint32(34).fork()).ldelim(); - } - return writer; - }, - decode(input: BinaryReader | Uint8Array, length?: number): ExistenceProof { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseExistenceProof(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.key = reader.bytes(); - break; - case 2: - message.value = reader.bytes(); - break; - case 3: - message.leaf = LeafOp.decode(reader, reader.uint32()); - break; - case 4: - message.path.push(InnerOp.decode(reader, reader.uint32())); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - fromJSON(object: any): ExistenceProof { - return { - key: isSet(object.key) ? bytesFromBase64(object.key) : new Uint8Array(), - value: isSet(object.value) ? bytesFromBase64(object.value) : new Uint8Array(), - leaf: isSet(object.leaf) ? LeafOp.fromJSON(object.leaf) : undefined, - path: Array.isArray(object?.path) ? object.path.map((e: any) => InnerOp.fromJSON(e)) : [] - }; - }, - toJSON(message: ExistenceProof): JsonSafe { - const obj: any = {}; - message.key !== undefined && (obj.key = base64FromBytes(message.key !== undefined ? message.key : new Uint8Array())); - message.value !== undefined && (obj.value = base64FromBytes(message.value !== undefined ? message.value : new Uint8Array())); - message.leaf !== undefined && (obj.leaf = message.leaf ? LeafOp.toJSON(message.leaf) : undefined); - if (message.path) { - obj.path = message.path.map(e => e ? InnerOp.toJSON(e) : undefined); - } else { - obj.path = []; - } - return obj; - }, - fromPartial(object: DeepPartial): ExistenceProof { - const message = createBaseExistenceProof(); - message.key = object.key ?? new Uint8Array(); - message.value = object.value ?? new Uint8Array(); - message.leaf = object.leaf !== undefined && object.leaf !== null ? LeafOp.fromPartial(object.leaf) : undefined; - message.path = object.path?.map(e => InnerOp.fromPartial(e)) || []; - return message; - }, - fromSDK(object: ExistenceProofSDKType): ExistenceProof { - return { - key: object?.key, - value: object?.value, - leaf: object.leaf ? LeafOp.fromSDK(object.leaf) : undefined, - path: Array.isArray(object?.path) ? object.path.map((e: any) => InnerOp.fromSDK(e)) : [] - }; - }, - fromSDKJSON(object: any): ExistenceProofSDKType { - return { - key: isSet(object.key) ? bytesFromBase64(object.key) : new Uint8Array(), - value: isSet(object.value) ? bytesFromBase64(object.value) : new Uint8Array(), - leaf: isSet(object.leaf) ? LeafOp.fromSDKJSON(object.leaf) : undefined, - path: Array.isArray(object?.path) ? object.path.map((e: any) => InnerOp.fromSDKJSON(e)) : [] - }; - }, - toSDK(message: ExistenceProof): ExistenceProofSDKType { - const obj: any = {}; - obj.key = message.key; - obj.value = message.value; - message.leaf !== undefined && (obj.leaf = message.leaf ? LeafOp.toSDK(message.leaf) : undefined); - if (message.path) { - obj.path = message.path.map(e => e ? InnerOp.toSDK(e) : undefined); - } else { - obj.path = []; - } - return obj; - }, - fromAmino(object: ExistenceProofAmino): ExistenceProof { - const message = createBaseExistenceProof(); - if (object.key !== undefined && object.key !== null) { - message.key = bytesFromBase64(object.key); - } - if (object.value !== undefined && object.value !== null) { - message.value = bytesFromBase64(object.value); - } - if (object.leaf !== undefined && object.leaf !== null) { - message.leaf = LeafOp.fromAmino(object.leaf); - } - message.path = object.path?.map(e => InnerOp.fromAmino(e)) || []; - return message; - }, - toAmino(message: ExistenceProof): ExistenceProofAmino { - const obj: any = {}; - obj.key = message.key ? base64FromBytes(message.key) : undefined; - obj.value = message.value ? base64FromBytes(message.value) : undefined; - obj.leaf = message.leaf ? LeafOp.toAmino(message.leaf) : undefined; - if (message.path) { - obj.path = message.path.map(e => e ? InnerOp.toAmino(e) : undefined); - } else { - obj.path = message.path; - } - return obj; - }, - fromAminoMsg(object: ExistenceProofAminoMsg): ExistenceProof { - return ExistenceProof.fromAmino(object.value); - }, - toAminoMsg(message: ExistenceProof): ExistenceProofAminoMsg { - return { - type: "cosmos-sdk/ExistenceProof", - value: ExistenceProof.toAmino(message) - }; - }, - fromProtoMsg(message: ExistenceProofProtoMsg): ExistenceProof { - return ExistenceProof.decode(message.value); - }, - toProto(message: ExistenceProof): Uint8Array { - return ExistenceProof.encode(message).finish(); - }, - toProtoMsg(message: ExistenceProof): ExistenceProofProtoMsg { - return { - typeUrl: "/cosmos.ics23.v1.ExistenceProof", - value: ExistenceProof.encode(message).finish() - }; - } -}; -function createBaseNonExistenceProof(): NonExistenceProof { - return { - key: new Uint8Array(), - left: undefined, - right: undefined - }; -} -export const NonExistenceProof = { - typeUrl: "/cosmos.ics23.v1.NonExistenceProof", - encode(message: NonExistenceProof, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.key.length !== 0) { - writer.uint32(10).bytes(message.key); - } - if (message.left !== undefined) { - ExistenceProof.encode(message.left, writer.uint32(18).fork()).ldelim(); - } - if (message.right !== undefined) { - ExistenceProof.encode(message.right, writer.uint32(26).fork()).ldelim(); - } - return writer; - }, - decode(input: BinaryReader | Uint8Array, length?: number): NonExistenceProof { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseNonExistenceProof(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.key = reader.bytes(); - break; - case 2: - message.left = ExistenceProof.decode(reader, reader.uint32()); - break; - case 3: - message.right = ExistenceProof.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - fromJSON(object: any): NonExistenceProof { - return { - key: isSet(object.key) ? bytesFromBase64(object.key) : new Uint8Array(), - left: isSet(object.left) ? ExistenceProof.fromJSON(object.left) : undefined, - right: isSet(object.right) ? ExistenceProof.fromJSON(object.right) : undefined - }; - }, - toJSON(message: NonExistenceProof): JsonSafe { - const obj: any = {}; - message.key !== undefined && (obj.key = base64FromBytes(message.key !== undefined ? message.key : new Uint8Array())); - message.left !== undefined && (obj.left = message.left ? ExistenceProof.toJSON(message.left) : undefined); - message.right !== undefined && (obj.right = message.right ? ExistenceProof.toJSON(message.right) : undefined); - return obj; - }, - fromPartial(object: DeepPartial): NonExistenceProof { - const message = createBaseNonExistenceProof(); - message.key = object.key ?? new Uint8Array(); - message.left = object.left !== undefined && object.left !== null ? ExistenceProof.fromPartial(object.left) : undefined; - message.right = object.right !== undefined && object.right !== null ? ExistenceProof.fromPartial(object.right) : undefined; - return message; - }, - fromSDK(object: NonExistenceProofSDKType): NonExistenceProof { - return { - key: object?.key, - left: object.left ? ExistenceProof.fromSDK(object.left) : undefined, - right: object.right ? ExistenceProof.fromSDK(object.right) : undefined - }; - }, - fromSDKJSON(object: any): NonExistenceProofSDKType { - return { - key: isSet(object.key) ? bytesFromBase64(object.key) : new Uint8Array(), - left: isSet(object.left) ? ExistenceProof.fromSDKJSON(object.left) : undefined, - right: isSet(object.right) ? ExistenceProof.fromSDKJSON(object.right) : undefined - }; - }, - toSDK(message: NonExistenceProof): NonExistenceProofSDKType { - const obj: any = {}; - obj.key = message.key; - message.left !== undefined && (obj.left = message.left ? ExistenceProof.toSDK(message.left) : undefined); - message.right !== undefined && (obj.right = message.right ? ExistenceProof.toSDK(message.right) : undefined); - return obj; - }, - fromAmino(object: NonExistenceProofAmino): NonExistenceProof { - const message = createBaseNonExistenceProof(); - if (object.key !== undefined && object.key !== null) { - message.key = bytesFromBase64(object.key); - } - if (object.left !== undefined && object.left !== null) { - message.left = ExistenceProof.fromAmino(object.left); - } - if (object.right !== undefined && object.right !== null) { - message.right = ExistenceProof.fromAmino(object.right); - } - return message; - }, - toAmino(message: NonExistenceProof): NonExistenceProofAmino { - const obj: any = {}; - obj.key = message.key ? base64FromBytes(message.key) : undefined; - obj.left = message.left ? ExistenceProof.toAmino(message.left) : undefined; - obj.right = message.right ? ExistenceProof.toAmino(message.right) : undefined; - return obj; - }, - fromAminoMsg(object: NonExistenceProofAminoMsg): NonExistenceProof { - return NonExistenceProof.fromAmino(object.value); - }, - toAminoMsg(message: NonExistenceProof): NonExistenceProofAminoMsg { - return { - type: "cosmos-sdk/NonExistenceProof", - value: NonExistenceProof.toAmino(message) - }; - }, - fromProtoMsg(message: NonExistenceProofProtoMsg): NonExistenceProof { - return NonExistenceProof.decode(message.value); - }, - toProto(message: NonExistenceProof): Uint8Array { - return NonExistenceProof.encode(message).finish(); - }, - toProtoMsg(message: NonExistenceProof): NonExistenceProofProtoMsg { - return { - typeUrl: "/cosmos.ics23.v1.NonExistenceProof", - value: NonExistenceProof.encode(message).finish() - }; - } -}; -function createBaseCommitmentProof(): CommitmentProof { - return { - exist: undefined, - nonexist: undefined, - batch: undefined, - compressed: undefined - }; -} -export const CommitmentProof = { - typeUrl: "/cosmos.ics23.v1.CommitmentProof", - encode(message: CommitmentProof, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.exist !== undefined) { - ExistenceProof.encode(message.exist, writer.uint32(10).fork()).ldelim(); - } - if (message.nonexist !== undefined) { - NonExistenceProof.encode(message.nonexist, writer.uint32(18).fork()).ldelim(); - } - if (message.batch !== undefined) { - BatchProof.encode(message.batch, writer.uint32(26).fork()).ldelim(); - } - if (message.compressed !== undefined) { - CompressedBatchProof.encode(message.compressed, writer.uint32(34).fork()).ldelim(); - } - return writer; - }, - decode(input: BinaryReader | Uint8Array, length?: number): CommitmentProof { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseCommitmentProof(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.exist = ExistenceProof.decode(reader, reader.uint32()); - break; - case 2: - message.nonexist = NonExistenceProof.decode(reader, reader.uint32()); - break; - case 3: - message.batch = BatchProof.decode(reader, reader.uint32()); - break; - case 4: - message.compressed = CompressedBatchProof.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - fromJSON(object: any): CommitmentProof { - return { - exist: isSet(object.exist) ? ExistenceProof.fromJSON(object.exist) : undefined, - nonexist: isSet(object.nonexist) ? NonExistenceProof.fromJSON(object.nonexist) : undefined, - batch: isSet(object.batch) ? BatchProof.fromJSON(object.batch) : undefined, - compressed: isSet(object.compressed) ? CompressedBatchProof.fromJSON(object.compressed) : undefined - }; - }, - toJSON(message: CommitmentProof): JsonSafe { - const obj: any = {}; - message.exist !== undefined && (obj.exist = message.exist ? ExistenceProof.toJSON(message.exist) : undefined); - message.nonexist !== undefined && (obj.nonexist = message.nonexist ? NonExistenceProof.toJSON(message.nonexist) : undefined); - message.batch !== undefined && (obj.batch = message.batch ? BatchProof.toJSON(message.batch) : undefined); - message.compressed !== undefined && (obj.compressed = message.compressed ? CompressedBatchProof.toJSON(message.compressed) : undefined); - return obj; - }, - fromPartial(object: DeepPartial): CommitmentProof { - const message = createBaseCommitmentProof(); - message.exist = object.exist !== undefined && object.exist !== null ? ExistenceProof.fromPartial(object.exist) : undefined; - message.nonexist = object.nonexist !== undefined && object.nonexist !== null ? NonExistenceProof.fromPartial(object.nonexist) : undefined; - message.batch = object.batch !== undefined && object.batch !== null ? BatchProof.fromPartial(object.batch) : undefined; - message.compressed = object.compressed !== undefined && object.compressed !== null ? CompressedBatchProof.fromPartial(object.compressed) : undefined; - return message; - }, - fromSDK(object: CommitmentProofSDKType): CommitmentProof { - return { - exist: object.exist ? ExistenceProof.fromSDK(object.exist) : undefined, - nonexist: object.nonexist ? NonExistenceProof.fromSDK(object.nonexist) : undefined, - batch: object.batch ? BatchProof.fromSDK(object.batch) : undefined, - compressed: object.compressed ? CompressedBatchProof.fromSDK(object.compressed) : undefined - }; - }, - fromSDKJSON(object: any): CommitmentProofSDKType { - return { - exist: isSet(object.exist) ? ExistenceProof.fromSDKJSON(object.exist) : undefined, - nonexist: isSet(object.nonexist) ? NonExistenceProof.fromSDKJSON(object.nonexist) : undefined, - batch: isSet(object.batch) ? BatchProof.fromSDKJSON(object.batch) : undefined, - compressed: isSet(object.compressed) ? CompressedBatchProof.fromSDKJSON(object.compressed) : undefined - }; - }, - toSDK(message: CommitmentProof): CommitmentProofSDKType { - const obj: any = {}; - message.exist !== undefined && (obj.exist = message.exist ? ExistenceProof.toSDK(message.exist) : undefined); - message.nonexist !== undefined && (obj.nonexist = message.nonexist ? NonExistenceProof.toSDK(message.nonexist) : undefined); - message.batch !== undefined && (obj.batch = message.batch ? BatchProof.toSDK(message.batch) : undefined); - message.compressed !== undefined && (obj.compressed = message.compressed ? CompressedBatchProof.toSDK(message.compressed) : undefined); - return obj; - }, - fromAmino(object: CommitmentProofAmino): CommitmentProof { - const message = createBaseCommitmentProof(); - if (object.exist !== undefined && object.exist !== null) { - message.exist = ExistenceProof.fromAmino(object.exist); - } - if (object.nonexist !== undefined && object.nonexist !== null) { - message.nonexist = NonExistenceProof.fromAmino(object.nonexist); - } - if (object.batch !== undefined && object.batch !== null) { - message.batch = BatchProof.fromAmino(object.batch); - } - if (object.compressed !== undefined && object.compressed !== null) { - message.compressed = CompressedBatchProof.fromAmino(object.compressed); - } - return message; - }, - toAmino(message: CommitmentProof): CommitmentProofAmino { - const obj: any = {}; - obj.exist = message.exist ? ExistenceProof.toAmino(message.exist) : undefined; - obj.nonexist = message.nonexist ? NonExistenceProof.toAmino(message.nonexist) : undefined; - obj.batch = message.batch ? BatchProof.toAmino(message.batch) : undefined; - obj.compressed = message.compressed ? CompressedBatchProof.toAmino(message.compressed) : undefined; - return obj; - }, - fromAminoMsg(object: CommitmentProofAminoMsg): CommitmentProof { - return CommitmentProof.fromAmino(object.value); - }, - toAminoMsg(message: CommitmentProof): CommitmentProofAminoMsg { - return { - type: "cosmos-sdk/CommitmentProof", - value: CommitmentProof.toAmino(message) - }; - }, - fromProtoMsg(message: CommitmentProofProtoMsg): CommitmentProof { - return CommitmentProof.decode(message.value); - }, - toProto(message: CommitmentProof): Uint8Array { - return CommitmentProof.encode(message).finish(); - }, - toProtoMsg(message: CommitmentProof): CommitmentProofProtoMsg { - return { - typeUrl: "/cosmos.ics23.v1.CommitmentProof", - value: CommitmentProof.encode(message).finish() - }; - } -}; -function createBaseLeafOp(): LeafOp { - return { - hash: 0, - prehashKey: 0, - prehashValue: 0, - length: 0, - prefix: new Uint8Array() - }; -} -export const LeafOp = { - typeUrl: "/cosmos.ics23.v1.LeafOp", - encode(message: LeafOp, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.hash !== 0) { - writer.uint32(8).int32(message.hash); - } - if (message.prehashKey !== 0) { - writer.uint32(16).int32(message.prehashKey); - } - if (message.prehashValue !== 0) { - writer.uint32(24).int32(message.prehashValue); - } - if (message.length !== 0) { - writer.uint32(32).int32(message.length); - } - if (message.prefix.length !== 0) { - writer.uint32(42).bytes(message.prefix); - } - return writer; - }, - decode(input: BinaryReader | Uint8Array, length?: number): LeafOp { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseLeafOp(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.hash = (reader.int32() as any); - break; - case 2: - message.prehashKey = (reader.int32() as any); - break; - case 3: - message.prehashValue = (reader.int32() as any); - break; - case 4: - message.length = (reader.int32() as any); - break; - case 5: - message.prefix = reader.bytes(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - fromJSON(object: any): LeafOp { - return { - hash: isSet(object.hash) ? hashOpFromJSON(object.hash) : -1, - prehashKey: isSet(object.prehashKey) ? hashOpFromJSON(object.prehashKey) : -1, - prehashValue: isSet(object.prehashValue) ? hashOpFromJSON(object.prehashValue) : -1, - length: isSet(object.length) ? lengthOpFromJSON(object.length) : -1, - prefix: isSet(object.prefix) ? bytesFromBase64(object.prefix) : new Uint8Array() - }; - }, - toJSON(message: LeafOp): JsonSafe { - const obj: any = {}; - message.hash !== undefined && (obj.hash = hashOpToJSON(message.hash)); - message.prehashKey !== undefined && (obj.prehashKey = hashOpToJSON(message.prehashKey)); - message.prehashValue !== undefined && (obj.prehashValue = hashOpToJSON(message.prehashValue)); - message.length !== undefined && (obj.length = lengthOpToJSON(message.length)); - message.prefix !== undefined && (obj.prefix = base64FromBytes(message.prefix !== undefined ? message.prefix : new Uint8Array())); - return obj; - }, - fromPartial(object: DeepPartial): LeafOp { - const message = createBaseLeafOp(); - message.hash = object.hash ?? 0; - message.prehashKey = object.prehashKey ?? 0; - message.prehashValue = object.prehashValue ?? 0; - message.length = object.length ?? 0; - message.prefix = object.prefix ?? new Uint8Array(); - return message; - }, - fromSDK(object: LeafOpSDKType): LeafOp { - return { - hash: isSet(object.hash) ? hashOpFromJSON(object.hash) : -1, - prehashKey: isSet(object.prehash_key) ? hashOpFromJSON(object.prehash_key) : -1, - prehashValue: isSet(object.prehash_value) ? hashOpFromJSON(object.prehash_value) : -1, - length: isSet(object.length) ? lengthOpFromJSON(object.length) : -1, - prefix: object?.prefix - }; - }, - fromSDKJSON(object: any): LeafOpSDKType { - return { - hash: isSet(object.hash) ? hashOpFromJSON(object.hash) : -1, - prehash_key: isSet(object.prehash_key) ? hashOpFromJSON(object.prehash_key) : -1, - prehash_value: isSet(object.prehash_value) ? hashOpFromJSON(object.prehash_value) : -1, - length: isSet(object.length) ? lengthOpFromJSON(object.length) : -1, - prefix: isSet(object.prefix) ? bytesFromBase64(object.prefix) : new Uint8Array() - }; - }, - toSDK(message: LeafOp): LeafOpSDKType { - const obj: any = {}; - message.hash !== undefined && (obj.hash = hashOpToJSON(message.hash)); - message.prehashKey !== undefined && (obj.prehash_key = hashOpToJSON(message.prehashKey)); - message.prehashValue !== undefined && (obj.prehash_value = hashOpToJSON(message.prehashValue)); - message.length !== undefined && (obj.length = lengthOpToJSON(message.length)); - obj.prefix = message.prefix; - return obj; - }, - fromAmino(object: LeafOpAmino): LeafOp { - const message = createBaseLeafOp(); - if (object.hash !== undefined && object.hash !== null) { - message.hash = object.hash; - } - if (object.prehash_key !== undefined && object.prehash_key !== null) { - message.prehashKey = object.prehash_key; - } - if (object.prehash_value !== undefined && object.prehash_value !== null) { - message.prehashValue = object.prehash_value; - } - if (object.length !== undefined && object.length !== null) { - message.length = object.length; - } - if (object.prefix !== undefined && object.prefix !== null) { - message.prefix = bytesFromBase64(object.prefix); - } - return message; - }, - toAmino(message: LeafOp): LeafOpAmino { - const obj: any = {}; - 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; - }, - fromAminoMsg(object: LeafOpAminoMsg): LeafOp { - return LeafOp.fromAmino(object.value); - }, - toAminoMsg(message: LeafOp): LeafOpAminoMsg { - return { - type: "cosmos-sdk/LeafOp", - value: LeafOp.toAmino(message) - }; - }, - fromProtoMsg(message: LeafOpProtoMsg): LeafOp { - return LeafOp.decode(message.value); - }, - toProto(message: LeafOp): Uint8Array { - return LeafOp.encode(message).finish(); - }, - toProtoMsg(message: LeafOp): LeafOpProtoMsg { - return { - typeUrl: "/cosmos.ics23.v1.LeafOp", - value: LeafOp.encode(message).finish() - }; - } -}; -function createBaseInnerOp(): InnerOp { - return { - hash: 0, - prefix: new Uint8Array(), - suffix: new Uint8Array() - }; -} -export const InnerOp = { - typeUrl: "/cosmos.ics23.v1.InnerOp", - encode(message: InnerOp, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.hash !== 0) { - writer.uint32(8).int32(message.hash); - } - if (message.prefix.length !== 0) { - writer.uint32(18).bytes(message.prefix); - } - if (message.suffix.length !== 0) { - writer.uint32(26).bytes(message.suffix); - } - return writer; - }, - decode(input: BinaryReader | Uint8Array, length?: number): InnerOp { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseInnerOp(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.hash = (reader.int32() as any); - break; - case 2: - message.prefix = reader.bytes(); - break; - case 3: - message.suffix = reader.bytes(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - fromJSON(object: any): InnerOp { - return { - hash: isSet(object.hash) ? hashOpFromJSON(object.hash) : -1, - prefix: isSet(object.prefix) ? bytesFromBase64(object.prefix) : new Uint8Array(), - suffix: isSet(object.suffix) ? bytesFromBase64(object.suffix) : new Uint8Array() - }; - }, - toJSON(message: InnerOp): JsonSafe { - const obj: any = {}; - message.hash !== undefined && (obj.hash = hashOpToJSON(message.hash)); - message.prefix !== undefined && (obj.prefix = base64FromBytes(message.prefix !== undefined ? message.prefix : new Uint8Array())); - message.suffix !== undefined && (obj.suffix = base64FromBytes(message.suffix !== undefined ? message.suffix : new Uint8Array())); - return obj; - }, - fromPartial(object: DeepPartial): InnerOp { - const message = createBaseInnerOp(); - message.hash = object.hash ?? 0; - message.prefix = object.prefix ?? new Uint8Array(); - message.suffix = object.suffix ?? new Uint8Array(); - return message; - }, - fromSDK(object: InnerOpSDKType): InnerOp { - return { - hash: isSet(object.hash) ? hashOpFromJSON(object.hash) : -1, - prefix: object?.prefix, - suffix: object?.suffix - }; - }, - fromSDKJSON(object: any): InnerOpSDKType { - return { - hash: isSet(object.hash) ? hashOpFromJSON(object.hash) : -1, - prefix: isSet(object.prefix) ? bytesFromBase64(object.prefix) : new Uint8Array(), - suffix: isSet(object.suffix) ? bytesFromBase64(object.suffix) : new Uint8Array() - }; - }, - toSDK(message: InnerOp): InnerOpSDKType { - const obj: any = {}; - message.hash !== undefined && (obj.hash = hashOpToJSON(message.hash)); - obj.prefix = message.prefix; - obj.suffix = message.suffix; - return obj; - }, - fromAmino(object: InnerOpAmino): InnerOp { - const message = createBaseInnerOp(); - if (object.hash !== undefined && object.hash !== null) { - message.hash = object.hash; - } - if (object.prefix !== undefined && object.prefix !== null) { - message.prefix = bytesFromBase64(object.prefix); - } - if (object.suffix !== undefined && object.suffix !== null) { - message.suffix = bytesFromBase64(object.suffix); - } - return message; - }, - toAmino(message: InnerOp): InnerOpAmino { - const obj: any = {}; - 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; - }, - fromAminoMsg(object: InnerOpAminoMsg): InnerOp { - return InnerOp.fromAmino(object.value); - }, - toAminoMsg(message: InnerOp): InnerOpAminoMsg { - return { - type: "cosmos-sdk/InnerOp", - value: InnerOp.toAmino(message) - }; - }, - fromProtoMsg(message: InnerOpProtoMsg): InnerOp { - return InnerOp.decode(message.value); - }, - toProto(message: InnerOp): Uint8Array { - return InnerOp.encode(message).finish(); - }, - toProtoMsg(message: InnerOp): InnerOpProtoMsg { - return { - typeUrl: "/cosmos.ics23.v1.InnerOp", - value: InnerOp.encode(message).finish() - }; - } -}; -function createBaseProofSpec(): ProofSpec { - return { - leafSpec: undefined, - innerSpec: undefined, - maxDepth: 0, - minDepth: 0 - }; -} -export const ProofSpec = { - typeUrl: "/cosmos.ics23.v1.ProofSpec", - encode(message: ProofSpec, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.leafSpec !== undefined) { - LeafOp.encode(message.leafSpec, writer.uint32(10).fork()).ldelim(); - } - if (message.innerSpec !== undefined) { - InnerSpec.encode(message.innerSpec, writer.uint32(18).fork()).ldelim(); - } - if (message.maxDepth !== 0) { - writer.uint32(24).int32(message.maxDepth); - } - if (message.minDepth !== 0) { - writer.uint32(32).int32(message.minDepth); - } - return writer; - }, - decode(input: BinaryReader | Uint8Array, length?: number): ProofSpec { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseProofSpec(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.leafSpec = LeafOp.decode(reader, reader.uint32()); - break; - case 2: - message.innerSpec = InnerSpec.decode(reader, reader.uint32()); - break; - case 3: - message.maxDepth = reader.int32(); - break; - case 4: - message.minDepth = reader.int32(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - fromJSON(object: any): ProofSpec { - return { - leafSpec: isSet(object.leafSpec) ? LeafOp.fromJSON(object.leafSpec) : undefined, - innerSpec: isSet(object.innerSpec) ? InnerSpec.fromJSON(object.innerSpec) : undefined, - maxDepth: isSet(object.maxDepth) ? Number(object.maxDepth) : 0, - minDepth: isSet(object.minDepth) ? Number(object.minDepth) : 0 - }; - }, - toJSON(message: ProofSpec): JsonSafe { - const obj: any = {}; - message.leafSpec !== undefined && (obj.leafSpec = message.leafSpec ? LeafOp.toJSON(message.leafSpec) : undefined); - message.innerSpec !== undefined && (obj.innerSpec = message.innerSpec ? InnerSpec.toJSON(message.innerSpec) : undefined); - message.maxDepth !== undefined && (obj.maxDepth = Math.round(message.maxDepth)); - message.minDepth !== undefined && (obj.minDepth = Math.round(message.minDepth)); - return obj; - }, - fromPartial(object: DeepPartial): ProofSpec { - const message = createBaseProofSpec(); - message.leafSpec = object.leafSpec !== undefined && object.leafSpec !== null ? LeafOp.fromPartial(object.leafSpec) : undefined; - message.innerSpec = object.innerSpec !== undefined && object.innerSpec !== null ? InnerSpec.fromPartial(object.innerSpec) : undefined; - message.maxDepth = object.maxDepth ?? 0; - message.minDepth = object.minDepth ?? 0; - return message; - }, - fromSDK(object: ProofSpecSDKType): ProofSpec { - return { - leafSpec: object.leaf_spec ? LeafOp.fromSDK(object.leaf_spec) : undefined, - innerSpec: object.inner_spec ? InnerSpec.fromSDK(object.inner_spec) : undefined, - maxDepth: object?.max_depth, - minDepth: object?.min_depth - }; - }, - fromSDKJSON(object: any): ProofSpecSDKType { - return { - leaf_spec: isSet(object.leaf_spec) ? LeafOp.fromSDKJSON(object.leaf_spec) : undefined, - inner_spec: isSet(object.inner_spec) ? InnerSpec.fromSDKJSON(object.inner_spec) : undefined, - max_depth: isSet(object.max_depth) ? Number(object.max_depth) : 0, - min_depth: isSet(object.min_depth) ? Number(object.min_depth) : 0 - }; - }, - toSDK(message: ProofSpec): ProofSpecSDKType { - const obj: any = {}; - message.leafSpec !== undefined && (obj.leaf_spec = message.leafSpec ? LeafOp.toSDK(message.leafSpec) : undefined); - message.innerSpec !== undefined && (obj.inner_spec = message.innerSpec ? InnerSpec.toSDK(message.innerSpec) : undefined); - obj.max_depth = message.maxDepth; - obj.min_depth = message.minDepth; - return obj; - }, - fromAmino(object: ProofSpecAmino): ProofSpec { - const message = createBaseProofSpec(); - if (object.leaf_spec !== undefined && object.leaf_spec !== null) { - message.leafSpec = LeafOp.fromAmino(object.leaf_spec); - } - if (object.inner_spec !== undefined && object.inner_spec !== null) { - message.innerSpec = InnerSpec.fromAmino(object.inner_spec); - } - if (object.max_depth !== undefined && object.max_depth !== null) { - message.maxDepth = object.max_depth; - } - if (object.min_depth !== undefined && object.min_depth !== null) { - message.minDepth = object.min_depth; - } - return message; - }, - toAmino(message: ProofSpec): ProofSpecAmino { - 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 === 0 ? undefined : message.maxDepth; - obj.min_depth = message.minDepth === 0 ? undefined : message.minDepth; - return obj; - }, - fromAminoMsg(object: ProofSpecAminoMsg): ProofSpec { - return ProofSpec.fromAmino(object.value); - }, - toAminoMsg(message: ProofSpec): ProofSpecAminoMsg { - return { - type: "cosmos-sdk/ProofSpec", - value: ProofSpec.toAmino(message) - }; - }, - fromProtoMsg(message: ProofSpecProtoMsg): ProofSpec { - return ProofSpec.decode(message.value); - }, - toProto(message: ProofSpec): Uint8Array { - return ProofSpec.encode(message).finish(); - }, - toProtoMsg(message: ProofSpec): ProofSpecProtoMsg { - return { - typeUrl: "/cosmos.ics23.v1.ProofSpec", - value: ProofSpec.encode(message).finish() - }; - } -}; -function createBaseInnerSpec(): InnerSpec { - return { - childOrder: [], - childSize: 0, - minPrefixLength: 0, - maxPrefixLength: 0, - emptyChild: new Uint8Array(), - hash: 0 - }; -} -export const InnerSpec = { - typeUrl: "/cosmos.ics23.v1.InnerSpec", - encode(message: InnerSpec, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - writer.uint32(10).fork(); - for (const v of message.childOrder) { - writer.int32(v); - } - writer.ldelim(); - if (message.childSize !== 0) { - writer.uint32(16).int32(message.childSize); - } - if (message.minPrefixLength !== 0) { - writer.uint32(24).int32(message.minPrefixLength); - } - if (message.maxPrefixLength !== 0) { - writer.uint32(32).int32(message.maxPrefixLength); - } - if (message.emptyChild.length !== 0) { - writer.uint32(42).bytes(message.emptyChild); - } - if (message.hash !== 0) { - writer.uint32(48).int32(message.hash); - } - return writer; - }, - decode(input: BinaryReader | Uint8Array, length?: number): InnerSpec { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseInnerSpec(); - 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.childOrder.push(reader.int32()); - } - } else { - message.childOrder.push(reader.int32()); - } - break; - case 2: - message.childSize = reader.int32(); - break; - case 3: - message.minPrefixLength = reader.int32(); - break; - case 4: - message.maxPrefixLength = reader.int32(); - break; - case 5: - message.emptyChild = reader.bytes(); - break; - case 6: - message.hash = (reader.int32() as any); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - fromJSON(object: any): InnerSpec { - return { - childOrder: Array.isArray(object?.childOrder) ? object.childOrder.map((e: any) => Number(e)) : [], - childSize: isSet(object.childSize) ? Number(object.childSize) : 0, - minPrefixLength: isSet(object.minPrefixLength) ? Number(object.minPrefixLength) : 0, - maxPrefixLength: isSet(object.maxPrefixLength) ? Number(object.maxPrefixLength) : 0, - emptyChild: isSet(object.emptyChild) ? bytesFromBase64(object.emptyChild) : new Uint8Array(), - hash: isSet(object.hash) ? hashOpFromJSON(object.hash) : -1 - }; - }, - toJSON(message: InnerSpec): JsonSafe { - const obj: any = {}; - if (message.childOrder) { - obj.childOrder = message.childOrder.map(e => Math.round(e)); - } else { - obj.childOrder = []; - } - message.childSize !== undefined && (obj.childSize = Math.round(message.childSize)); - message.minPrefixLength !== undefined && (obj.minPrefixLength = Math.round(message.minPrefixLength)); - message.maxPrefixLength !== undefined && (obj.maxPrefixLength = Math.round(message.maxPrefixLength)); - message.emptyChild !== undefined && (obj.emptyChild = base64FromBytes(message.emptyChild !== undefined ? message.emptyChild : new Uint8Array())); - message.hash !== undefined && (obj.hash = hashOpToJSON(message.hash)); - return obj; - }, - fromPartial(object: DeepPartial): InnerSpec { - const message = createBaseInnerSpec(); - message.childOrder = object.childOrder?.map(e => e) || []; - message.childSize = object.childSize ?? 0; - message.minPrefixLength = object.minPrefixLength ?? 0; - message.maxPrefixLength = object.maxPrefixLength ?? 0; - message.emptyChild = object.emptyChild ?? new Uint8Array(); - message.hash = object.hash ?? 0; - return message; - }, - fromSDK(object: InnerSpecSDKType): InnerSpec { - return { - childOrder: Array.isArray(object?.child_order) ? object.child_order.map((e: any) => e) : [], - childSize: object?.child_size, - minPrefixLength: object?.min_prefix_length, - maxPrefixLength: object?.max_prefix_length, - emptyChild: object?.empty_child, - hash: isSet(object.hash) ? hashOpFromJSON(object.hash) : -1 - }; - }, - fromSDKJSON(object: any): InnerSpecSDKType { - return { - child_order: Array.isArray(object?.child_order) ? object.child_order.map((e: any) => Number(e)) : [], - child_size: isSet(object.child_size) ? Number(object.child_size) : 0, - min_prefix_length: isSet(object.min_prefix_length) ? Number(object.min_prefix_length) : 0, - max_prefix_length: isSet(object.max_prefix_length) ? Number(object.max_prefix_length) : 0, - empty_child: isSet(object.empty_child) ? bytesFromBase64(object.empty_child) : new Uint8Array(), - hash: isSet(object.hash) ? hashOpFromJSON(object.hash) : -1 - }; - }, - toSDK(message: InnerSpec): InnerSpecSDKType { - const obj: any = {}; - if (message.childOrder) { - obj.child_order = message.childOrder.map(e => e); - } else { - obj.child_order = []; - } - obj.child_size = message.childSize; - obj.min_prefix_length = message.minPrefixLength; - obj.max_prefix_length = message.maxPrefixLength; - obj.empty_child = message.emptyChild; - message.hash !== undefined && (obj.hash = hashOpToJSON(message.hash)); - return obj; - }, - fromAmino(object: InnerSpecAmino): InnerSpec { - const message = createBaseInnerSpec(); - message.childOrder = object.child_order?.map(e => e) || []; - if (object.child_size !== undefined && object.child_size !== null) { - message.childSize = object.child_size; - } - if (object.min_prefix_length !== undefined && object.min_prefix_length !== null) { - message.minPrefixLength = object.min_prefix_length; - } - if (object.max_prefix_length !== undefined && object.max_prefix_length !== null) { - message.maxPrefixLength = object.max_prefix_length; - } - if (object.empty_child !== undefined && object.empty_child !== null) { - message.emptyChild = bytesFromBase64(object.empty_child); - } - if (object.hash !== undefined && object.hash !== null) { - message.hash = object.hash; - } - return message; - }, - toAmino(message: InnerSpec): InnerSpecAmino { - const obj: any = {}; - if (message.childOrder) { - obj.child_order = message.childOrder.map(e => e); - } else { - obj.child_order = message.childOrder; - } - 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 = message.hash === 0 ? undefined : message.hash; - return obj; - }, - fromAminoMsg(object: InnerSpecAminoMsg): InnerSpec { - return InnerSpec.fromAmino(object.value); - }, - toAminoMsg(message: InnerSpec): InnerSpecAminoMsg { - return { - type: "cosmos-sdk/InnerSpec", - value: InnerSpec.toAmino(message) - }; - }, - fromProtoMsg(message: InnerSpecProtoMsg): InnerSpec { - return InnerSpec.decode(message.value); - }, - toProto(message: InnerSpec): Uint8Array { - return InnerSpec.encode(message).finish(); - }, - toProtoMsg(message: InnerSpec): InnerSpecProtoMsg { - return { - typeUrl: "/cosmos.ics23.v1.InnerSpec", - value: InnerSpec.encode(message).finish() - }; - } -}; -function createBaseBatchProof(): BatchProof { - return { - entries: [] - }; -} -export const BatchProof = { - typeUrl: "/cosmos.ics23.v1.BatchProof", - encode(message: BatchProof, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - for (const v of message.entries) { - BatchEntry.encode(v!, writer.uint32(10).fork()).ldelim(); - } - return writer; - }, - decode(input: BinaryReader | Uint8Array, length?: number): BatchProof { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseBatchProof(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.entries.push(BatchEntry.decode(reader, reader.uint32())); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - fromJSON(object: any): BatchProof { - return { - entries: Array.isArray(object?.entries) ? object.entries.map((e: any) => BatchEntry.fromJSON(e)) : [] - }; - }, - toJSON(message: BatchProof): JsonSafe { - const obj: any = {}; - if (message.entries) { - obj.entries = message.entries.map(e => e ? BatchEntry.toJSON(e) : undefined); - } else { - obj.entries = []; - } - return obj; - }, - fromPartial(object: DeepPartial): BatchProof { - const message = createBaseBatchProof(); - message.entries = object.entries?.map(e => BatchEntry.fromPartial(e)) || []; - return message; - }, - fromSDK(object: BatchProofSDKType): BatchProof { - return { - entries: Array.isArray(object?.entries) ? object.entries.map((e: any) => BatchEntry.fromSDK(e)) : [] - }; - }, - fromSDKJSON(object: any): BatchProofSDKType { - return { - entries: Array.isArray(object?.entries) ? object.entries.map((e: any) => BatchEntry.fromSDKJSON(e)) : [] - }; - }, - toSDK(message: BatchProof): BatchProofSDKType { - const obj: any = {}; - if (message.entries) { - obj.entries = message.entries.map(e => e ? BatchEntry.toSDK(e) : undefined); - } else { - obj.entries = []; - } - return obj; - }, - fromAmino(object: BatchProofAmino): BatchProof { - const message = createBaseBatchProof(); - message.entries = object.entries?.map(e => BatchEntry.fromAmino(e)) || []; - return message; - }, - toAmino(message: BatchProof): BatchProofAmino { - const obj: any = {}; - if (message.entries) { - obj.entries = message.entries.map(e => e ? BatchEntry.toAmino(e) : undefined); - } else { - obj.entries = message.entries; - } - return obj; - }, - fromAminoMsg(object: BatchProofAminoMsg): BatchProof { - return BatchProof.fromAmino(object.value); - }, - toAminoMsg(message: BatchProof): BatchProofAminoMsg { - return { - type: "cosmos-sdk/BatchProof", - value: BatchProof.toAmino(message) - }; - }, - fromProtoMsg(message: BatchProofProtoMsg): BatchProof { - return BatchProof.decode(message.value); - }, - toProto(message: BatchProof): Uint8Array { - return BatchProof.encode(message).finish(); - }, - toProtoMsg(message: BatchProof): BatchProofProtoMsg { - return { - typeUrl: "/cosmos.ics23.v1.BatchProof", - value: BatchProof.encode(message).finish() - }; - } -}; -function createBaseBatchEntry(): BatchEntry { - return { - exist: undefined, - nonexist: undefined - }; -} -export const BatchEntry = { - typeUrl: "/cosmos.ics23.v1.BatchEntry", - encode(message: BatchEntry, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.exist !== undefined) { - ExistenceProof.encode(message.exist, writer.uint32(10).fork()).ldelim(); - } - if (message.nonexist !== undefined) { - NonExistenceProof.encode(message.nonexist, writer.uint32(18).fork()).ldelim(); - } - return writer; - }, - decode(input: BinaryReader | Uint8Array, length?: number): BatchEntry { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseBatchEntry(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.exist = ExistenceProof.decode(reader, reader.uint32()); - break; - case 2: - message.nonexist = NonExistenceProof.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - fromJSON(object: any): BatchEntry { - return { - exist: isSet(object.exist) ? ExistenceProof.fromJSON(object.exist) : undefined, - nonexist: isSet(object.nonexist) ? NonExistenceProof.fromJSON(object.nonexist) : undefined - }; - }, - toJSON(message: BatchEntry): JsonSafe { - const obj: any = {}; - message.exist !== undefined && (obj.exist = message.exist ? ExistenceProof.toJSON(message.exist) : undefined); - message.nonexist !== undefined && (obj.nonexist = message.nonexist ? NonExistenceProof.toJSON(message.nonexist) : undefined); - return obj; - }, - fromPartial(object: DeepPartial): BatchEntry { - const message = createBaseBatchEntry(); - message.exist = object.exist !== undefined && object.exist !== null ? ExistenceProof.fromPartial(object.exist) : undefined; - message.nonexist = object.nonexist !== undefined && object.nonexist !== null ? NonExistenceProof.fromPartial(object.nonexist) : undefined; - return message; - }, - fromSDK(object: BatchEntrySDKType): BatchEntry { - return { - exist: object.exist ? ExistenceProof.fromSDK(object.exist) : undefined, - nonexist: object.nonexist ? NonExistenceProof.fromSDK(object.nonexist) : undefined - }; - }, - fromSDKJSON(object: any): BatchEntrySDKType { - return { - exist: isSet(object.exist) ? ExistenceProof.fromSDKJSON(object.exist) : undefined, - nonexist: isSet(object.nonexist) ? NonExistenceProof.fromSDKJSON(object.nonexist) : undefined - }; - }, - toSDK(message: BatchEntry): BatchEntrySDKType { - const obj: any = {}; - message.exist !== undefined && (obj.exist = message.exist ? ExistenceProof.toSDK(message.exist) : undefined); - message.nonexist !== undefined && (obj.nonexist = message.nonexist ? NonExistenceProof.toSDK(message.nonexist) : undefined); - return obj; - }, - fromAmino(object: BatchEntryAmino): BatchEntry { - const message = createBaseBatchEntry(); - if (object.exist !== undefined && object.exist !== null) { - message.exist = ExistenceProof.fromAmino(object.exist); - } - if (object.nonexist !== undefined && object.nonexist !== null) { - message.nonexist = NonExistenceProof.fromAmino(object.nonexist); - } - return message; - }, - toAmino(message: BatchEntry): BatchEntryAmino { - const obj: any = {}; - obj.exist = message.exist ? ExistenceProof.toAmino(message.exist) : undefined; - obj.nonexist = message.nonexist ? NonExistenceProof.toAmino(message.nonexist) : undefined; - return obj; - }, - fromAminoMsg(object: BatchEntryAminoMsg): BatchEntry { - return BatchEntry.fromAmino(object.value); - }, - toAminoMsg(message: BatchEntry): BatchEntryAminoMsg { - return { - type: "cosmos-sdk/BatchEntry", - value: BatchEntry.toAmino(message) - }; - }, - fromProtoMsg(message: BatchEntryProtoMsg): BatchEntry { - return BatchEntry.decode(message.value); - }, - toProto(message: BatchEntry): Uint8Array { - return BatchEntry.encode(message).finish(); - }, - toProtoMsg(message: BatchEntry): BatchEntryProtoMsg { - return { - typeUrl: "/cosmos.ics23.v1.BatchEntry", - value: BatchEntry.encode(message).finish() - }; - } -}; -function createBaseCompressedBatchProof(): CompressedBatchProof { - return { - entries: [], - lookupInners: [] - }; -} -export const CompressedBatchProof = { - typeUrl: "/cosmos.ics23.v1.CompressedBatchProof", - encode(message: CompressedBatchProof, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - for (const v of message.entries) { - CompressedBatchEntry.encode(v!, writer.uint32(10).fork()).ldelim(); - } - for (const v of message.lookupInners) { - InnerOp.encode(v!, writer.uint32(18).fork()).ldelim(); - } - return writer; - }, - decode(input: BinaryReader | Uint8Array, length?: number): CompressedBatchProof { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseCompressedBatchProof(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.entries.push(CompressedBatchEntry.decode(reader, reader.uint32())); - break; - case 2: - message.lookupInners.push(InnerOp.decode(reader, reader.uint32())); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - fromJSON(object: any): CompressedBatchProof { - return { - entries: Array.isArray(object?.entries) ? object.entries.map((e: any) => CompressedBatchEntry.fromJSON(e)) : [], - lookupInners: Array.isArray(object?.lookupInners) ? object.lookupInners.map((e: any) => InnerOp.fromJSON(e)) : [] - }; - }, - toJSON(message: CompressedBatchProof): JsonSafe { - const obj: any = {}; - if (message.entries) { - obj.entries = message.entries.map(e => e ? CompressedBatchEntry.toJSON(e) : undefined); - } else { - obj.entries = []; - } - if (message.lookupInners) { - obj.lookupInners = message.lookupInners.map(e => e ? InnerOp.toJSON(e) : undefined); - } else { - obj.lookupInners = []; - } - return obj; - }, - fromPartial(object: DeepPartial): CompressedBatchProof { - const message = createBaseCompressedBatchProof(); - message.entries = object.entries?.map(e => CompressedBatchEntry.fromPartial(e)) || []; - message.lookupInners = object.lookupInners?.map(e => InnerOp.fromPartial(e)) || []; - return message; - }, - fromSDK(object: CompressedBatchProofSDKType): CompressedBatchProof { - return { - entries: Array.isArray(object?.entries) ? object.entries.map((e: any) => CompressedBatchEntry.fromSDK(e)) : [], - lookupInners: Array.isArray(object?.lookup_inners) ? object.lookup_inners.map((e: any) => InnerOp.fromSDK(e)) : [] - }; - }, - fromSDKJSON(object: any): CompressedBatchProofSDKType { - return { - entries: Array.isArray(object?.entries) ? object.entries.map((e: any) => CompressedBatchEntry.fromSDKJSON(e)) : [], - lookup_inners: Array.isArray(object?.lookup_inners) ? object.lookup_inners.map((e: any) => InnerOp.fromSDKJSON(e)) : [] - }; - }, - toSDK(message: CompressedBatchProof): CompressedBatchProofSDKType { - const obj: any = {}; - if (message.entries) { - obj.entries = message.entries.map(e => e ? CompressedBatchEntry.toSDK(e) : undefined); - } else { - obj.entries = []; - } - if (message.lookupInners) { - obj.lookup_inners = message.lookupInners.map(e => e ? InnerOp.toSDK(e) : undefined); - } else { - obj.lookup_inners = []; - } - return obj; - }, - fromAmino(object: CompressedBatchProofAmino): CompressedBatchProof { - const message = createBaseCompressedBatchProof(); - message.entries = object.entries?.map(e => CompressedBatchEntry.fromAmino(e)) || []; - message.lookupInners = object.lookup_inners?.map(e => InnerOp.fromAmino(e)) || []; - return message; - }, - toAmino(message: CompressedBatchProof): CompressedBatchProofAmino { - const obj: any = {}; - if (message.entries) { - obj.entries = message.entries.map(e => e ? CompressedBatchEntry.toAmino(e) : undefined); - } else { - obj.entries = message.entries; - } - if (message.lookupInners) { - obj.lookup_inners = message.lookupInners.map(e => e ? InnerOp.toAmino(e) : undefined); - } else { - obj.lookup_inners = message.lookupInners; - } - return obj; - }, - fromAminoMsg(object: CompressedBatchProofAminoMsg): CompressedBatchProof { - return CompressedBatchProof.fromAmino(object.value); - }, - toAminoMsg(message: CompressedBatchProof): CompressedBatchProofAminoMsg { - return { - type: "cosmos-sdk/CompressedBatchProof", - value: CompressedBatchProof.toAmino(message) - }; - }, - fromProtoMsg(message: CompressedBatchProofProtoMsg): CompressedBatchProof { - return CompressedBatchProof.decode(message.value); - }, - toProto(message: CompressedBatchProof): Uint8Array { - return CompressedBatchProof.encode(message).finish(); - }, - toProtoMsg(message: CompressedBatchProof): CompressedBatchProofProtoMsg { - return { - typeUrl: "/cosmos.ics23.v1.CompressedBatchProof", - value: CompressedBatchProof.encode(message).finish() - }; - } -}; -function createBaseCompressedBatchEntry(): CompressedBatchEntry { - return { - exist: undefined, - nonexist: undefined - }; -} -export const CompressedBatchEntry = { - typeUrl: "/cosmos.ics23.v1.CompressedBatchEntry", - encode(message: CompressedBatchEntry, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.exist !== undefined) { - CompressedExistenceProof.encode(message.exist, writer.uint32(10).fork()).ldelim(); - } - if (message.nonexist !== undefined) { - CompressedNonExistenceProof.encode(message.nonexist, writer.uint32(18).fork()).ldelim(); - } - return writer; - }, - decode(input: BinaryReader | Uint8Array, length?: number): CompressedBatchEntry { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseCompressedBatchEntry(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.exist = CompressedExistenceProof.decode(reader, reader.uint32()); - break; - case 2: - message.nonexist = CompressedNonExistenceProof.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - fromJSON(object: any): CompressedBatchEntry { - return { - exist: isSet(object.exist) ? CompressedExistenceProof.fromJSON(object.exist) : undefined, - nonexist: isSet(object.nonexist) ? CompressedNonExistenceProof.fromJSON(object.nonexist) : undefined - }; - }, - toJSON(message: CompressedBatchEntry): JsonSafe { - const obj: any = {}; - message.exist !== undefined && (obj.exist = message.exist ? CompressedExistenceProof.toJSON(message.exist) : undefined); - message.nonexist !== undefined && (obj.nonexist = message.nonexist ? CompressedNonExistenceProof.toJSON(message.nonexist) : undefined); - return obj; - }, - fromPartial(object: DeepPartial): CompressedBatchEntry { - const message = createBaseCompressedBatchEntry(); - message.exist = object.exist !== undefined && object.exist !== null ? CompressedExistenceProof.fromPartial(object.exist) : undefined; - message.nonexist = object.nonexist !== undefined && object.nonexist !== null ? CompressedNonExistenceProof.fromPartial(object.nonexist) : undefined; - return message; - }, - fromSDK(object: CompressedBatchEntrySDKType): CompressedBatchEntry { - return { - exist: object.exist ? CompressedExistenceProof.fromSDK(object.exist) : undefined, - nonexist: object.nonexist ? CompressedNonExistenceProof.fromSDK(object.nonexist) : undefined - }; - }, - fromSDKJSON(object: any): CompressedBatchEntrySDKType { - return { - exist: isSet(object.exist) ? CompressedExistenceProof.fromSDKJSON(object.exist) : undefined, - nonexist: isSet(object.nonexist) ? CompressedNonExistenceProof.fromSDKJSON(object.nonexist) : undefined - }; - }, - toSDK(message: CompressedBatchEntry): CompressedBatchEntrySDKType { - const obj: any = {}; - message.exist !== undefined && (obj.exist = message.exist ? CompressedExistenceProof.toSDK(message.exist) : undefined); - message.nonexist !== undefined && (obj.nonexist = message.nonexist ? CompressedNonExistenceProof.toSDK(message.nonexist) : undefined); - return obj; - }, - fromAmino(object: CompressedBatchEntryAmino): CompressedBatchEntry { - const message = createBaseCompressedBatchEntry(); - if (object.exist !== undefined && object.exist !== null) { - message.exist = CompressedExistenceProof.fromAmino(object.exist); - } - if (object.nonexist !== undefined && object.nonexist !== null) { - message.nonexist = CompressedNonExistenceProof.fromAmino(object.nonexist); - } - return message; - }, - toAmino(message: CompressedBatchEntry): CompressedBatchEntryAmino { - const obj: any = {}; - obj.exist = message.exist ? CompressedExistenceProof.toAmino(message.exist) : undefined; - obj.nonexist = message.nonexist ? CompressedNonExistenceProof.toAmino(message.nonexist) : undefined; - return obj; - }, - fromAminoMsg(object: CompressedBatchEntryAminoMsg): CompressedBatchEntry { - return CompressedBatchEntry.fromAmino(object.value); - }, - toAminoMsg(message: CompressedBatchEntry): CompressedBatchEntryAminoMsg { - return { - type: "cosmos-sdk/CompressedBatchEntry", - value: CompressedBatchEntry.toAmino(message) - }; - }, - fromProtoMsg(message: CompressedBatchEntryProtoMsg): CompressedBatchEntry { - return CompressedBatchEntry.decode(message.value); - }, - toProto(message: CompressedBatchEntry): Uint8Array { - return CompressedBatchEntry.encode(message).finish(); - }, - toProtoMsg(message: CompressedBatchEntry): CompressedBatchEntryProtoMsg { - return { - typeUrl: "/cosmos.ics23.v1.CompressedBatchEntry", - value: CompressedBatchEntry.encode(message).finish() - }; - } -}; -function createBaseCompressedExistenceProof(): CompressedExistenceProof { - return { - key: new Uint8Array(), - value: new Uint8Array(), - leaf: undefined, - path: [] - }; -} -export const CompressedExistenceProof = { - typeUrl: "/cosmos.ics23.v1.CompressedExistenceProof", - encode(message: CompressedExistenceProof, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.key.length !== 0) { - writer.uint32(10).bytes(message.key); - } - if (message.value.length !== 0) { - writer.uint32(18).bytes(message.value); - } - if (message.leaf !== undefined) { - LeafOp.encode(message.leaf, writer.uint32(26).fork()).ldelim(); - } - writer.uint32(34).fork(); - for (const v of message.path) { - writer.int32(v); - } - writer.ldelim(); - return writer; - }, - decode(input: BinaryReader | Uint8Array, length?: number): CompressedExistenceProof { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseCompressedExistenceProof(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.key = reader.bytes(); - break; - case 2: - message.value = reader.bytes(); - break; - case 3: - message.leaf = LeafOp.decode(reader, reader.uint32()); - break; - case 4: - 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; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - fromJSON(object: any): CompressedExistenceProof { - return { - key: isSet(object.key) ? bytesFromBase64(object.key) : new Uint8Array(), - value: isSet(object.value) ? bytesFromBase64(object.value) : new Uint8Array(), - leaf: isSet(object.leaf) ? LeafOp.fromJSON(object.leaf) : undefined, - path: Array.isArray(object?.path) ? object.path.map((e: any) => Number(e)) : [] - }; - }, - toJSON(message: CompressedExistenceProof): JsonSafe { - const obj: any = {}; - message.key !== undefined && (obj.key = base64FromBytes(message.key !== undefined ? message.key : new Uint8Array())); - message.value !== undefined && (obj.value = base64FromBytes(message.value !== undefined ? message.value : new Uint8Array())); - message.leaf !== undefined && (obj.leaf = message.leaf ? LeafOp.toJSON(message.leaf) : undefined); - if (message.path) { - obj.path = message.path.map(e => Math.round(e)); - } else { - obj.path = []; - } - return obj; - }, - fromPartial(object: DeepPartial): CompressedExistenceProof { - const message = createBaseCompressedExistenceProof(); - message.key = object.key ?? new Uint8Array(); - message.value = object.value ?? new Uint8Array(); - message.leaf = object.leaf !== undefined && object.leaf !== null ? LeafOp.fromPartial(object.leaf) : undefined; - message.path = object.path?.map(e => e) || []; - return message; - }, - fromSDK(object: CompressedExistenceProofSDKType): CompressedExistenceProof { - return { - key: object?.key, - value: object?.value, - leaf: object.leaf ? LeafOp.fromSDK(object.leaf) : undefined, - path: Array.isArray(object?.path) ? object.path.map((e: any) => e) : [] - }; - }, - fromSDKJSON(object: any): CompressedExistenceProofSDKType { - return { - key: isSet(object.key) ? bytesFromBase64(object.key) : new Uint8Array(), - value: isSet(object.value) ? bytesFromBase64(object.value) : new Uint8Array(), - leaf: isSet(object.leaf) ? LeafOp.fromSDKJSON(object.leaf) : undefined, - path: Array.isArray(object?.path) ? object.path.map((e: any) => Number(e)) : [] - }; - }, - toSDK(message: CompressedExistenceProof): CompressedExistenceProofSDKType { - const obj: any = {}; - obj.key = message.key; - obj.value = message.value; - message.leaf !== undefined && (obj.leaf = message.leaf ? LeafOp.toSDK(message.leaf) : undefined); - if (message.path) { - obj.path = message.path.map(e => e); - } else { - obj.path = []; - } - return obj; - }, - fromAmino(object: CompressedExistenceProofAmino): CompressedExistenceProof { - const message = createBaseCompressedExistenceProof(); - if (object.key !== undefined && object.key !== null) { - message.key = bytesFromBase64(object.key); - } - if (object.value !== undefined && object.value !== null) { - message.value = bytesFromBase64(object.value); - } - if (object.leaf !== undefined && object.leaf !== null) { - message.leaf = LeafOp.fromAmino(object.leaf); - } - message.path = object.path?.map(e => e) || []; - return message; - }, - toAmino(message: CompressedExistenceProof): CompressedExistenceProofAmino { - const obj: any = {}; - obj.key = message.key ? base64FromBytes(message.key) : undefined; - obj.value = message.value ? base64FromBytes(message.value) : undefined; - obj.leaf = message.leaf ? LeafOp.toAmino(message.leaf) : undefined; - if (message.path) { - obj.path = message.path.map(e => e); - } else { - obj.path = message.path; - } - return obj; - }, - fromAminoMsg(object: CompressedExistenceProofAminoMsg): CompressedExistenceProof { - return CompressedExistenceProof.fromAmino(object.value); - }, - toAminoMsg(message: CompressedExistenceProof): CompressedExistenceProofAminoMsg { - return { - type: "cosmos-sdk/CompressedExistenceProof", - value: CompressedExistenceProof.toAmino(message) - }; - }, - fromProtoMsg(message: CompressedExistenceProofProtoMsg): CompressedExistenceProof { - return CompressedExistenceProof.decode(message.value); - }, - toProto(message: CompressedExistenceProof): Uint8Array { - return CompressedExistenceProof.encode(message).finish(); - }, - toProtoMsg(message: CompressedExistenceProof): CompressedExistenceProofProtoMsg { - return { - typeUrl: "/cosmos.ics23.v1.CompressedExistenceProof", - value: CompressedExistenceProof.encode(message).finish() - }; - } -}; -function createBaseCompressedNonExistenceProof(): CompressedNonExistenceProof { - return { - key: new Uint8Array(), - left: undefined, - right: undefined - }; -} -export const CompressedNonExistenceProof = { - typeUrl: "/cosmos.ics23.v1.CompressedNonExistenceProof", - encode(message: CompressedNonExistenceProof, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.key.length !== 0) { - writer.uint32(10).bytes(message.key); - } - if (message.left !== undefined) { - CompressedExistenceProof.encode(message.left, writer.uint32(18).fork()).ldelim(); - } - if (message.right !== undefined) { - CompressedExistenceProof.encode(message.right, writer.uint32(26).fork()).ldelim(); - } - return writer; - }, - decode(input: BinaryReader | Uint8Array, length?: number): CompressedNonExistenceProof { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseCompressedNonExistenceProof(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.key = reader.bytes(); - break; - case 2: - message.left = CompressedExistenceProof.decode(reader, reader.uint32()); - break; - case 3: - message.right = CompressedExistenceProof.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - fromJSON(object: any): CompressedNonExistenceProof { - return { - key: isSet(object.key) ? bytesFromBase64(object.key) : new Uint8Array(), - left: isSet(object.left) ? CompressedExistenceProof.fromJSON(object.left) : undefined, - right: isSet(object.right) ? CompressedExistenceProof.fromJSON(object.right) : undefined - }; - }, - toJSON(message: CompressedNonExistenceProof): JsonSafe { - const obj: any = {}; - message.key !== undefined && (obj.key = base64FromBytes(message.key !== undefined ? message.key : new Uint8Array())); - message.left !== undefined && (obj.left = message.left ? CompressedExistenceProof.toJSON(message.left) : undefined); - message.right !== undefined && (obj.right = message.right ? CompressedExistenceProof.toJSON(message.right) : undefined); - return obj; - }, - fromPartial(object: DeepPartial): CompressedNonExistenceProof { - const message = createBaseCompressedNonExistenceProof(); - message.key = object.key ?? new Uint8Array(); - message.left = object.left !== undefined && object.left !== null ? CompressedExistenceProof.fromPartial(object.left) : undefined; - message.right = object.right !== undefined && object.right !== null ? CompressedExistenceProof.fromPartial(object.right) : undefined; - return message; - }, - fromSDK(object: CompressedNonExistenceProofSDKType): CompressedNonExistenceProof { - return { - key: object?.key, - left: object.left ? CompressedExistenceProof.fromSDK(object.left) : undefined, - right: object.right ? CompressedExistenceProof.fromSDK(object.right) : undefined - }; - }, - fromSDKJSON(object: any): CompressedNonExistenceProofSDKType { - return { - key: isSet(object.key) ? bytesFromBase64(object.key) : new Uint8Array(), - left: isSet(object.left) ? CompressedExistenceProof.fromSDKJSON(object.left) : undefined, - right: isSet(object.right) ? CompressedExistenceProof.fromSDKJSON(object.right) : undefined - }; - }, - toSDK(message: CompressedNonExistenceProof): CompressedNonExistenceProofSDKType { - const obj: any = {}; - obj.key = message.key; - message.left !== undefined && (obj.left = message.left ? CompressedExistenceProof.toSDK(message.left) : undefined); - message.right !== undefined && (obj.right = message.right ? CompressedExistenceProof.toSDK(message.right) : undefined); - return obj; - }, - fromAmino(object: CompressedNonExistenceProofAmino): CompressedNonExistenceProof { - const message = createBaseCompressedNonExistenceProof(); - if (object.key !== undefined && object.key !== null) { - message.key = bytesFromBase64(object.key); - } - if (object.left !== undefined && object.left !== null) { - message.left = CompressedExistenceProof.fromAmino(object.left); - } - if (object.right !== undefined && object.right !== null) { - message.right = CompressedExistenceProof.fromAmino(object.right); - } - return message; - }, - toAmino(message: CompressedNonExistenceProof): CompressedNonExistenceProofAmino { - const obj: any = {}; - obj.key = message.key ? base64FromBytes(message.key) : undefined; - obj.left = message.left ? CompressedExistenceProof.toAmino(message.left) : undefined; - obj.right = message.right ? CompressedExistenceProof.toAmino(message.right) : undefined; - return obj; - }, - fromAminoMsg(object: CompressedNonExistenceProofAminoMsg): CompressedNonExistenceProof { - return CompressedNonExistenceProof.fromAmino(object.value); - }, - toAminoMsg(message: CompressedNonExistenceProof): CompressedNonExistenceProofAminoMsg { - return { - type: "cosmos-sdk/CompressedNonExistenceProof", - value: CompressedNonExistenceProof.toAmino(message) - }; - }, - fromProtoMsg(message: CompressedNonExistenceProofProtoMsg): CompressedNonExistenceProof { - return CompressedNonExistenceProof.decode(message.value); - }, - toProto(message: CompressedNonExistenceProof): Uint8Array { - return CompressedNonExistenceProof.encode(message).finish(); - }, - toProtoMsg(message: CompressedNonExistenceProof): CompressedNonExistenceProofProtoMsg { - return { - typeUrl: "/cosmos.ics23.v1.CompressedNonExistenceProof", - value: CompressedNonExistenceProof.encode(message).finish() - }; - } -}; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv4/cosmos/lcd.ts b/__fixtures__/v-next/outputv4/cosmos/lcd.ts index 99ccbfad85..8623b1e3f9 100644 --- a/__fixtures__/v-next/outputv4/cosmos/lcd.ts +++ b/__fixtures__/v-next/outputv4/cosmos/lcd.ts @@ -37,11 +37,6 @@ export const createLCDClient = async ({ v1beta1: new (await import("./base/tendermint/v1beta1/query.lcd")).LCDQueryClient({ requestClient }) - }, - node: { - v1beta1: new (await import("./base/node/v1beta1/query.lcd")).LCDQueryClient({ - requestClient - }) } }, distribution: { diff --git a/__fixtures__/v-next/outputv4/cosmos/mint/v1beta1/genesis.ts b/__fixtures__/v-next/outputv4/cosmos/mint/v1beta1/genesis.ts index 6bae293df0..0e2ff61b68 100644 --- a/__fixtures__/v-next/outputv4/cosmos/mint/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputv4/cosmos/mint/v1beta1/genesis.ts @@ -1,8 +1,7 @@ -import { Minter, MinterSDKType, Params, ParamsSDKType } from "./mint"; -import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; -import { JsonSafe } from "../../../json-safe"; -import { ComputedRef } from "vue"; +import { Minter, MinterSDKType, Params, ParamsSDKType } from "./mint.js"; +import { BinaryReader, BinaryWriter } from "../../../binary.js"; +import { isSet, DeepPartial } from "../../../helpers.js"; +import { JsonSafe } from "../../../json-safe.js"; export const protobufPackage = "cosmos.mint.v1beta1"; /** GenesisState defines the mint module's genesis state. */ export interface GenesisState { @@ -11,10 +10,6 @@ export interface GenesisState { /** params defines all the paramaters of the module. */ params: Params; } -export interface ReactiveGenesisState { - minter: ComputedRef; - params: ComputedRef; -} export interface GenesisStateProtoMsg { typeUrl: "/cosmos.mint.v1beta1.GenesisState"; value: Uint8Array; @@ -62,10 +57,10 @@ export const GenesisState = { return message; }, fromJSON(object: any): GenesisState { - return { - minter: isSet(object.minter) ? Minter.fromJSON(object.minter) : undefined, - params: isSet(object.params) ? Params.fromJSON(object.params) : undefined - }; + const obj = createBaseGenesisState(); + if (isSet(object.minter)) obj.minter = Minter.fromJSON(object.minter); + if (isSet(object.params)) obj.params = Params.fromJSON(object.params); + return obj; }, toJSON(message: GenesisState): JsonSafe { const obj: any = {}; @@ -75,8 +70,12 @@ export const GenesisState = { }, fromPartial(object: DeepPartial): GenesisState { const message = createBaseGenesisState(); - message.minter = object.minter !== undefined && object.minter !== null ? Minter.fromPartial(object.minter) : undefined; - message.params = object.params !== undefined && object.params !== null ? Params.fromPartial(object.params) : undefined; + if (object.minter !== undefined && object.minter !== null) { + message.minter = Minter.fromPartial(object.minter); + } + if (object.params !== undefined && object.params !== null) { + message.params = Params.fromPartial(object.params); + } return message; }, fromSDK(object: GenesisStateSDKType): GenesisState { diff --git a/__fixtures__/v-next/outputv4/cosmos/mint/v1beta1/mint.ts b/__fixtures__/v-next/outputv4/cosmos/mint/v1beta1/mint.ts index 7c33a5f8ee..313d2b1a56 100644 --- a/__fixtures__/v-next/outputv4/cosmos/mint/v1beta1/mint.ts +++ b/__fixtures__/v-next/outputv4/cosmos/mint/v1beta1/mint.ts @@ -1,8 +1,7 @@ -import { BinaryReader, BinaryWriter } from "../../../binary"; +import { BinaryReader, BinaryWriter } from "../../../binary.js"; import { Decimal } from "@cosmjs/math"; -import { isSet, DeepPartial } from "../../../helpers"; -import { JsonSafe } from "../../../json-safe"; -import { ComputedRef } from "vue"; +import { isSet, DeepPartial } from "../../../helpers.js"; +import { JsonSafe } from "../../../json-safe.js"; export const protobufPackage = "cosmos.mint.v1beta1"; /** Minter represents the minting state. */ export interface Minter { @@ -11,10 +10,6 @@ export interface Minter { /** current annual expected provisions */ annualProvisions: string; } -export interface ReactiveMinter { - inflation: ComputedRef; - annualProvisions: ComputedRef; -} export interface MinterProtoMsg { typeUrl: "/cosmos.mint.v1beta1.Minter"; value: Uint8Array; @@ -39,14 +34,6 @@ export interface Params { /** expected blocks per year */ blocksPerYear: bigint; } -export interface ReactiveParams { - mintDenom: ComputedRef; - inflationRateChange: ComputedRef; - inflationMax: ComputedRef; - inflationMin: ComputedRef; - goalBonded: ComputedRef; - blocksPerYear: ComputedRef; -} export interface ParamsProtoMsg { typeUrl: "/cosmos.mint.v1beta1.Params"; value: Uint8Array; @@ -69,10 +56,10 @@ function createBaseMinter(): Minter { export const Minter = { typeUrl: "/cosmos.mint.v1beta1.Minter", encode(message: Minter, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.inflation !== "") { + if (message.inflation !== undefined) { writer.uint32(10).string(Decimal.fromUserInput(message.inflation, 18).atomics); } - if (message.annualProvisions !== "") { + if (message.annualProvisions !== undefined) { writer.uint32(18).string(Decimal.fromUserInput(message.annualProvisions, 18).atomics); } return writer; @@ -98,10 +85,10 @@ export const Minter = { return message; }, fromJSON(object: any): Minter { - return { - inflation: isSet(object.inflation) ? String(object.inflation) : "", - annualProvisions: isSet(object.annualProvisions) ? String(object.annualProvisions) : "" - }; + const obj = createBaseMinter(); + if (isSet(object.inflation)) obj.inflation = String(object.inflation); + if (isSet(object.annualProvisions)) obj.annualProvisions = String(object.annualProvisions); + return obj; }, toJSON(message: Minter): JsonSafe { const obj: any = {}; @@ -184,22 +171,22 @@ function createBaseParams(): Params { export const Params = { typeUrl: "/cosmos.mint.v1beta1.Params", encode(message: Params, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.mintDenom !== "") { + if (message.mintDenom !== undefined) { writer.uint32(10).string(message.mintDenom); } - if (message.inflationRateChange !== "") { + if (message.inflationRateChange !== undefined) { writer.uint32(18).string(Decimal.fromUserInput(message.inflationRateChange, 18).atomics); } - if (message.inflationMax !== "") { + if (message.inflationMax !== undefined) { writer.uint32(26).string(Decimal.fromUserInput(message.inflationMax, 18).atomics); } - if (message.inflationMin !== "") { + if (message.inflationMin !== undefined) { writer.uint32(34).string(Decimal.fromUserInput(message.inflationMin, 18).atomics); } - if (message.goalBonded !== "") { + if (message.goalBonded !== undefined) { writer.uint32(42).string(Decimal.fromUserInput(message.goalBonded, 18).atomics); } - if (message.blocksPerYear !== BigInt(0)) { + if (message.blocksPerYear !== undefined) { writer.uint32(48).uint64(message.blocksPerYear); } return writer; @@ -237,14 +224,14 @@ export const Params = { return message; }, fromJSON(object: any): Params { - return { - mintDenom: isSet(object.mintDenom) ? String(object.mintDenom) : "", - inflationRateChange: isSet(object.inflationRateChange) ? String(object.inflationRateChange) : "", - inflationMax: isSet(object.inflationMax) ? String(object.inflationMax) : "", - inflationMin: isSet(object.inflationMin) ? String(object.inflationMin) : "", - goalBonded: isSet(object.goalBonded) ? String(object.goalBonded) : "", - blocksPerYear: isSet(object.blocksPerYear) ? BigInt(object.blocksPerYear.toString()) : BigInt(0) - }; + const obj = createBaseParams(); + if (isSet(object.mintDenom)) obj.mintDenom = String(object.mintDenom); + if (isSet(object.inflationRateChange)) obj.inflationRateChange = String(object.inflationRateChange); + if (isSet(object.inflationMax)) obj.inflationMax = String(object.inflationMax); + if (isSet(object.inflationMin)) obj.inflationMin = String(object.inflationMin); + if (isSet(object.goalBonded)) obj.goalBonded = String(object.goalBonded); + if (isSet(object.blocksPerYear)) obj.blocksPerYear = BigInt(object.blocksPerYear.toString()); + return obj; }, toJSON(message: Params): JsonSafe { const obj: any = {}; @@ -263,7 +250,9 @@ export const Params = { message.inflationMax = object.inflationMax ?? ""; message.inflationMin = object.inflationMin ?? ""; message.goalBonded = object.goalBonded ?? ""; - message.blocksPerYear = object.blocksPerYear !== undefined && object.blocksPerYear !== null ? BigInt(object.blocksPerYear.toString()) : BigInt(0); + if (object.blocksPerYear !== undefined && object.blocksPerYear !== null) { + message.blocksPerYear = BigInt(object.blocksPerYear.toString()); + } return message; }, fromSDK(object: ParamsSDKType): Params { diff --git a/__fixtures__/v-next/outputv4/cosmos/mint/v1beta1/query.lcd.ts b/__fixtures__/v-next/outputv4/cosmos/mint/v1beta1/query.lcd.ts index 258bd02e3e..7e3077001b 100644 --- a/__fixtures__/v-next/outputv4/cosmos/mint/v1beta1/query.lcd.ts +++ b/__fixtures__/v-next/outputv4/cosmos/mint/v1beta1/query.lcd.ts @@ -1,6 +1,6 @@ -import { Params, ParamsSDKType } from "./mint"; +import { Params, ParamsSDKType } from "./mint.js"; import { LCDClient } from "@cosmology/lcd"; -import { QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType, QueryInflationRequest, QueryInflationRequestSDKType, QueryInflationResponse, QueryInflationResponseSDKType, QueryAnnualProvisionsRequest, QueryAnnualProvisionsRequestSDKType, QueryAnnualProvisionsResponse, QueryAnnualProvisionsResponseSDKType } from "./query"; +import { QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType, QueryInflationRequest, QueryInflationRequestSDKType, QueryInflationResponse, QueryInflationResponseSDKType, QueryAnnualProvisionsRequest, QueryAnnualProvisionsRequestSDKType, QueryAnnualProvisionsResponse, QueryAnnualProvisionsResponseSDKType } from "./query.js"; export class LCDQueryClient { req: LCDClient; constructor({ diff --git a/__fixtures__/v-next/outputv4/cosmos/mint/v1beta1/query.rpc.Query.ts b/__fixtures__/v-next/outputv4/cosmos/mint/v1beta1/query.rpc.Query.ts index 4c9ea1ba77..60a24be7ad 100644 --- a/__fixtures__/v-next/outputv4/cosmos/mint/v1beta1/query.rpc.Query.ts +++ b/__fixtures__/v-next/outputv4/cosmos/mint/v1beta1/query.rpc.Query.ts @@ -1,8 +1,8 @@ -import { Params, ParamsSDKType } from "./mint"; -import { Rpc } from "../../../helpers"; -import { BinaryReader } from "../../../binary"; +import { Params, ParamsSDKType } from "./mint.js"; +import { Rpc } from "../../../helpers.js"; +import { BinaryReader } from "../../../binary.js"; import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; -import { QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType, QueryInflationRequest, QueryInflationRequestSDKType, QueryInflationResponse, QueryInflationResponseSDKType, QueryAnnualProvisionsRequest, QueryAnnualProvisionsRequestSDKType, QueryAnnualProvisionsResponse, QueryAnnualProvisionsResponseSDKType, ReactiveQueryParamsRequest, ReactiveQueryInflationRequest, ReactiveQueryAnnualProvisionsRequest } from "./query"; +import { QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType, QueryInflationRequest, QueryInflationRequestSDKType, QueryInflationResponse, QueryInflationResponseSDKType, QueryAnnualProvisionsRequest, QueryAnnualProvisionsRequestSDKType, QueryAnnualProvisionsResponse, QueryAnnualProvisionsResponseSDKType } from "./query.js"; /** Query provides defines the gRPC querier service. */ export interface Query { /** Params returns the total set of minting parameters. */ diff --git a/__fixtures__/v-next/outputv4/cosmos/mint/v1beta1/query.ts b/__fixtures__/v-next/outputv4/cosmos/mint/v1beta1/query.ts index 7bbb78b885..bedcf3f214 100644 --- a/__fixtures__/v-next/outputv4/cosmos/mint/v1beta1/query.ts +++ b/__fixtures__/v-next/outputv4/cosmos/mint/v1beta1/query.ts @@ -1,12 +1,10 @@ -import { Params, ParamsSDKType } from "./mint"; -import { BinaryReader, BinaryWriter } from "../../../binary"; -import { JsonSafe } from "../../../json-safe"; -import { DeepPartial, isSet, bytesFromBase64, base64FromBytes } from "../../../helpers"; -import { ComputedRef } from "vue"; +import { Params, ParamsSDKType } from "./mint.js"; +import { BinaryReader, BinaryWriter } from "../../../binary.js"; +import { JsonSafe } from "../../../json-safe.js"; +import { DeepPartial, isSet, bytesFromBase64, base64FromBytes } from "../../../helpers.js"; export const protobufPackage = "cosmos.mint.v1beta1"; /** QueryParamsRequest is the request type for the Query/Params RPC method. */ export interface QueryParamsRequest {} -export interface ReactiveQueryParamsRequest {} export interface QueryParamsRequestProtoMsg { typeUrl: "/cosmos.mint.v1beta1.QueryParamsRequest"; value: Uint8Array; @@ -18,9 +16,6 @@ export interface QueryParamsResponse { /** params defines the parameters of the module. */ params: Params; } -export interface ReactiveQueryParamsResponse { - params: ComputedRef; -} export interface QueryParamsResponseProtoMsg { typeUrl: "/cosmos.mint.v1beta1.QueryParamsResponse"; value: Uint8Array; @@ -31,7 +26,6 @@ export interface QueryParamsResponseSDKType { } /** QueryInflationRequest is the request type for the Query/Inflation RPC method. */ export interface QueryInflationRequest {} -export interface ReactiveQueryInflationRequest {} export interface QueryInflationRequestProtoMsg { typeUrl: "/cosmos.mint.v1beta1.QueryInflationRequest"; value: Uint8Array; @@ -46,9 +40,6 @@ export interface QueryInflationResponse { /** inflation is the current minting inflation value. */ inflation: Uint8Array; } -export interface ReactiveQueryInflationResponse { - inflation: ComputedRef; -} export interface QueryInflationResponseProtoMsg { typeUrl: "/cosmos.mint.v1beta1.QueryInflationResponse"; value: Uint8Array; @@ -65,7 +56,6 @@ export interface QueryInflationResponseSDKType { * Query/AnnualProvisions RPC method. */ export interface QueryAnnualProvisionsRequest {} -export interface ReactiveQueryAnnualProvisionsRequest {} export interface QueryAnnualProvisionsRequestProtoMsg { typeUrl: "/cosmos.mint.v1beta1.QueryAnnualProvisionsRequest"; value: Uint8Array; @@ -83,9 +73,6 @@ export interface QueryAnnualProvisionsResponse { /** annual_provisions is the current minting annual provisions value. */ annualProvisions: Uint8Array; } -export interface ReactiveQueryAnnualProvisionsResponse { - annualProvisions: ComputedRef; -} export interface QueryAnnualProvisionsResponseProtoMsg { typeUrl: "/cosmos.mint.v1beta1.QueryAnnualProvisionsResponse"; value: Uint8Array; @@ -120,7 +107,8 @@ export const QueryParamsRequest = { return message; }, fromJSON(_: any): QueryParamsRequest { - return {}; + const obj = createBaseQueryParamsRequest(); + return obj; }, toJSON(_: QueryParamsRequest): JsonSafe { const obj: any = {}; @@ -201,9 +189,9 @@ export const QueryParamsResponse = { return message; }, fromJSON(object: any): QueryParamsResponse { - return { - params: isSet(object.params) ? Params.fromJSON(object.params) : undefined - }; + const obj = createBaseQueryParamsResponse(); + if (isSet(object.params)) obj.params = Params.fromJSON(object.params); + return obj; }, toJSON(message: QueryParamsResponse): JsonSafe { const obj: any = {}; @@ -212,7 +200,9 @@ export const QueryParamsResponse = { }, fromPartial(object: DeepPartial): QueryParamsResponse { const message = createBaseQueryParamsResponse(); - message.params = object.params !== undefined && object.params !== null ? Params.fromPartial(object.params) : undefined; + if (object.params !== undefined && object.params !== null) { + message.params = Params.fromPartial(object.params); + } return message; }, fromSDK(object: QueryParamsResponseSDKType): QueryParamsResponse { @@ -287,7 +277,8 @@ export const QueryInflationRequest = { return message; }, fromJSON(_: any): QueryInflationRequest { - return {}; + const obj = createBaseQueryInflationRequest(); + return obj; }, toJSON(_: QueryInflationRequest): JsonSafe { const obj: any = {}; @@ -368,9 +359,9 @@ export const QueryInflationResponse = { return message; }, fromJSON(object: any): QueryInflationResponse { - return { - inflation: isSet(object.inflation) ? bytesFromBase64(object.inflation) : new Uint8Array() - }; + const obj = createBaseQueryInflationResponse(); + if (isSet(object.inflation)) obj.inflation = bytesFromBase64(object.inflation); + return obj; }, toJSON(message: QueryInflationResponse): JsonSafe { const obj: any = {}; @@ -454,7 +445,8 @@ export const QueryAnnualProvisionsRequest = { return message; }, fromJSON(_: any): QueryAnnualProvisionsRequest { - return {}; + const obj = createBaseQueryAnnualProvisionsRequest(); + return obj; }, toJSON(_: QueryAnnualProvisionsRequest): JsonSafe { const obj: any = {}; @@ -535,9 +527,9 @@ export const QueryAnnualProvisionsResponse = { return message; }, fromJSON(object: any): QueryAnnualProvisionsResponse { - return { - annualProvisions: isSet(object.annualProvisions) ? bytesFromBase64(object.annualProvisions) : new Uint8Array() - }; + const obj = createBaseQueryAnnualProvisionsResponse(); + if (isSet(object.annualProvisions)) obj.annualProvisions = bytesFromBase64(object.annualProvisions); + return obj; }, toJSON(message: QueryAnnualProvisionsResponse): JsonSafe { const obj: any = {}; diff --git a/__fixtures__/v-next/outputv4/cosmos/nft/v1beta1/event.ts b/__fixtures__/v-next/outputv4/cosmos/nft/v1beta1/event.ts index e0e0012615..4acae30a1d 100644 --- a/__fixtures__/v-next/outputv4/cosmos/nft/v1beta1/event.ts +++ b/__fixtures__/v-next/outputv4/cosmos/nft/v1beta1/event.ts @@ -1,7 +1,6 @@ -import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; -import { JsonSafe } from "../../../json-safe"; -import { ComputedRef } from "vue"; +import { BinaryReader, BinaryWriter } from "../../../binary.js"; +import { isSet, DeepPartial } from "../../../helpers.js"; +import { JsonSafe } from "../../../json-safe.js"; export const protobufPackage = "cosmos.nft.v1beta1"; /** EventSend is emitted on Msg/Send */ export interface EventSend { @@ -10,12 +9,6 @@ export interface EventSend { sender: string; receiver: string; } -export interface ReactiveEventSend { - classId: ComputedRef; - id: ComputedRef; - sender: ComputedRef; - receiver: ComputedRef; -} export interface EventSendProtoMsg { typeUrl: "/cosmos.nft.v1beta1.EventSend"; value: Uint8Array; @@ -33,11 +26,6 @@ export interface EventMint { id: string; owner: string; } -export interface ReactiveEventMint { - classId: ComputedRef; - id: ComputedRef; - owner: ComputedRef; -} export interface EventMintProtoMsg { typeUrl: "/cosmos.nft.v1beta1.EventMint"; value: Uint8Array; @@ -54,11 +42,6 @@ export interface EventBurn { id: string; owner: string; } -export interface ReactiveEventBurn { - classId: ComputedRef; - id: ComputedRef; - owner: ComputedRef; -} export interface EventBurnProtoMsg { typeUrl: "/cosmos.nft.v1beta1.EventBurn"; value: Uint8Array; @@ -80,16 +63,16 @@ function createBaseEventSend(): EventSend { export const EventSend = { typeUrl: "/cosmos.nft.v1beta1.EventSend", encode(message: EventSend, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.classId !== "") { + if (message.classId !== undefined) { writer.uint32(10).string(message.classId); } - if (message.id !== "") { + if (message.id !== undefined) { writer.uint32(18).string(message.id); } - if (message.sender !== "") { + if (message.sender !== undefined) { writer.uint32(26).string(message.sender); } - if (message.receiver !== "") { + if (message.receiver !== undefined) { writer.uint32(34).string(message.receiver); } return writer; @@ -121,12 +104,12 @@ export const EventSend = { return message; }, fromJSON(object: any): EventSend { - return { - classId: isSet(object.classId) ? String(object.classId) : "", - id: isSet(object.id) ? String(object.id) : "", - sender: isSet(object.sender) ? String(object.sender) : "", - receiver: isSet(object.receiver) ? String(object.receiver) : "" - }; + const obj = createBaseEventSend(); + if (isSet(object.classId)) obj.classId = String(object.classId); + if (isSet(object.id)) obj.id = String(object.id); + if (isSet(object.sender)) obj.sender = String(object.sender); + if (isSet(object.receiver)) obj.receiver = String(object.receiver); + return obj; }, toJSON(message: EventSend): JsonSafe { const obj: any = {}; @@ -224,13 +207,13 @@ function createBaseEventMint(): EventMint { export const EventMint = { typeUrl: "/cosmos.nft.v1beta1.EventMint", encode(message: EventMint, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.classId !== "") { + if (message.classId !== undefined) { writer.uint32(10).string(message.classId); } - if (message.id !== "") { + if (message.id !== undefined) { writer.uint32(18).string(message.id); } - if (message.owner !== "") { + if (message.owner !== undefined) { writer.uint32(26).string(message.owner); } return writer; @@ -259,11 +242,11 @@ export const EventMint = { return message; }, fromJSON(object: any): EventMint { - return { - classId: isSet(object.classId) ? String(object.classId) : "", - id: isSet(object.id) ? String(object.id) : "", - owner: isSet(object.owner) ? String(object.owner) : "" - }; + const obj = createBaseEventMint(); + if (isSet(object.classId)) obj.classId = String(object.classId); + if (isSet(object.id)) obj.id = String(object.id); + if (isSet(object.owner)) obj.owner = String(object.owner); + return obj; }, toJSON(message: EventMint): JsonSafe { const obj: any = {}; @@ -352,13 +335,13 @@ function createBaseEventBurn(): EventBurn { export const EventBurn = { typeUrl: "/cosmos.nft.v1beta1.EventBurn", encode(message: EventBurn, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.classId !== "") { + if (message.classId !== undefined) { writer.uint32(10).string(message.classId); } - if (message.id !== "") { + if (message.id !== undefined) { writer.uint32(18).string(message.id); } - if (message.owner !== "") { + if (message.owner !== undefined) { writer.uint32(26).string(message.owner); } return writer; @@ -387,11 +370,11 @@ export const EventBurn = { return message; }, fromJSON(object: any): EventBurn { - return { - classId: isSet(object.classId) ? String(object.classId) : "", - id: isSet(object.id) ? String(object.id) : "", - owner: isSet(object.owner) ? String(object.owner) : "" - }; + const obj = createBaseEventBurn(); + if (isSet(object.classId)) obj.classId = String(object.classId); + if (isSet(object.id)) obj.id = String(object.id); + if (isSet(object.owner)) obj.owner = String(object.owner); + return obj; }, toJSON(message: EventBurn): JsonSafe { const obj: any = {}; diff --git a/__fixtures__/v-next/outputv4/cosmos/nft/v1beta1/genesis.ts b/__fixtures__/v-next/outputv4/cosmos/nft/v1beta1/genesis.ts index f0feeb04de..ee5576545b 100644 --- a/__fixtures__/v-next/outputv4/cosmos/nft/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputv4/cosmos/nft/v1beta1/genesis.ts @@ -1,8 +1,7 @@ -import { Class, ClassSDKType, NFT, NFTSDKType } from "./nft"; -import { BinaryReader, BinaryWriter } from "../../../binary"; -import { JsonSafe } from "../../../json-safe"; -import { DeepPartial, isSet } from "../../../helpers"; -import { ComputedRef } from "vue"; +import { Class, ClassSDKType, NFT, NFTSDKType } from "./nft.js"; +import { BinaryReader, BinaryWriter } from "../../../binary.js"; +import { JsonSafe } from "../../../json-safe.js"; +import { DeepPartial, isSet } from "../../../helpers.js"; export const protobufPackage = "cosmos.nft.v1beta1"; /** GenesisState defines the nft module's genesis state. */ export interface GenesisState { @@ -10,10 +9,6 @@ export interface GenesisState { classes: Class[]; entries: Entry[]; } -export interface ReactiveGenesisState { - classes: ComputedRef; - entries: ComputedRef; -} export interface GenesisStateProtoMsg { typeUrl: "/cosmos.nft.v1beta1.GenesisState"; value: Uint8Array; @@ -30,10 +25,6 @@ export interface Entry { /** nfts is a group of nfts of the same owner */ nfts: NFT[]; } -export interface ReactiveEntry { - owner: ComputedRef; - nfts: ComputedRef; -} export interface EntryProtoMsg { typeUrl: "/cosmos.nft.v1beta1.Entry"; value: Uint8Array; @@ -81,10 +72,10 @@ export const GenesisState = { return message; }, fromJSON(object: any): GenesisState { - return { - classes: Array.isArray(object?.classes) ? object.classes.map((e: any) => Class.fromJSON(e)) : [], - entries: Array.isArray(object?.entries) ? object.entries.map((e: any) => Entry.fromJSON(e)) : [] - }; + const obj = createBaseGenesisState(); + if (Array.isArray(object?.classes)) obj.classes = object.classes.map((e: any) => Class.fromJSON(e)); + if (Array.isArray(object?.entries)) obj.entries = object.entries.map((e: any) => Entry.fromJSON(e)); + return obj; }, toJSON(message: GenesisState): JsonSafe { const obj: any = {}; @@ -183,7 +174,7 @@ function createBaseEntry(): Entry { export const Entry = { typeUrl: "/cosmos.nft.v1beta1.Entry", encode(message: Entry, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.owner !== "") { + if (message.owner !== undefined) { writer.uint32(10).string(message.owner); } for (const v of message.nfts) { @@ -212,10 +203,10 @@ export const Entry = { return message; }, fromJSON(object: any): Entry { - return { - owner: isSet(object.owner) ? String(object.owner) : "", - nfts: Array.isArray(object?.nfts) ? object.nfts.map((e: any) => NFT.fromJSON(e)) : [] - }; + const obj = createBaseEntry(); + if (isSet(object.owner)) obj.owner = String(object.owner); + if (Array.isArray(object?.nfts)) obj.nfts = object.nfts.map((e: any) => NFT.fromJSON(e)); + return obj; }, toJSON(message: Entry): JsonSafe { const obj: any = {}; diff --git a/__fixtures__/v-next/outputv4/cosmos/nft/v1beta1/nft.ts b/__fixtures__/v-next/outputv4/cosmos/nft/v1beta1/nft.ts index a79417626d..9ae4741ebd 100644 --- a/__fixtures__/v-next/outputv4/cosmos/nft/v1beta1/nft.ts +++ b/__fixtures__/v-next/outputv4/cosmos/nft/v1beta1/nft.ts @@ -1,8 +1,7 @@ -import { Any, AnySDKType } from "../../../google/protobuf/any"; -import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; -import { JsonSafe } from "../../../json-safe"; -import { ComputedRef } from "vue"; +import { Any, AnySDKType } from "../../../google/protobuf/any.js"; +import { BinaryReader, BinaryWriter } from "../../../binary.js"; +import { isSet, DeepPartial } from "../../../helpers.js"; +import { JsonSafe } from "../../../json-safe.js"; export const protobufPackage = "cosmos.nft.v1beta1"; /** Class defines the class of the nft type. */ export interface Class { @@ -21,15 +20,6 @@ export interface Class { /** data is the app specific metadata of the NFT class. Optional */ data?: Any; } -export interface ReactiveClass { - id: ComputedRef; - name: ComputedRef; - symbol: ComputedRef; - description: ComputedRef; - uri: ComputedRef; - uriHash: ComputedRef; - data?: ComputedRef; -} export interface ClassProtoMsg { typeUrl: "/cosmos.nft.v1beta1.Class"; value: Uint8Array; @@ -57,13 +47,6 @@ export interface NFT { /** data is an app specific data of the NFT. Optional */ data?: Any; } -export interface ReactiveNFT { - classId: ComputedRef; - id: ComputedRef; - uri: ComputedRef; - uriHash: ComputedRef; - data?: ComputedRef; -} export interface NFTProtoMsg { typeUrl: "/cosmos.nft.v1beta1.NFT"; value: Uint8Array; @@ -90,22 +73,22 @@ function createBaseClass(): Class { export const Class = { typeUrl: "/cosmos.nft.v1beta1.Class", encode(message: Class, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.id !== "") { + if (message.id !== undefined) { writer.uint32(10).string(message.id); } - if (message.name !== "") { + if (message.name !== undefined) { writer.uint32(18).string(message.name); } - if (message.symbol !== "") { + if (message.symbol !== undefined) { writer.uint32(26).string(message.symbol); } - if (message.description !== "") { + if (message.description !== undefined) { writer.uint32(34).string(message.description); } - if (message.uri !== "") { + if (message.uri !== undefined) { writer.uint32(42).string(message.uri); } - if (message.uriHash !== "") { + if (message.uriHash !== undefined) { writer.uint32(50).string(message.uriHash); } if (message.data !== undefined) { @@ -149,15 +132,15 @@ export const Class = { return message; }, fromJSON(object: any): Class { - return { - id: isSet(object.id) ? String(object.id) : "", - name: isSet(object.name) ? String(object.name) : "", - symbol: isSet(object.symbol) ? String(object.symbol) : "", - description: isSet(object.description) ? String(object.description) : "", - uri: isSet(object.uri) ? String(object.uri) : "", - uriHash: isSet(object.uriHash) ? String(object.uriHash) : "", - data: isSet(object.data) ? Any.fromJSON(object.data) : undefined - }; + const obj = createBaseClass(); + if (isSet(object.id)) obj.id = String(object.id); + if (isSet(object.name)) obj.name = String(object.name); + if (isSet(object.symbol)) obj.symbol = String(object.symbol); + if (isSet(object.description)) obj.description = String(object.description); + if (isSet(object.uri)) obj.uri = String(object.uri); + if (isSet(object.uriHash)) obj.uriHash = String(object.uriHash); + if (isSet(object.data)) obj.data = Any.fromJSON(object.data); + return obj; }, toJSON(message: Class): JsonSafe { const obj: any = {}; @@ -178,7 +161,9 @@ export const Class = { message.description = object.description ?? ""; message.uri = object.uri ?? ""; message.uriHash = object.uriHash ?? ""; - message.data = object.data !== undefined && object.data !== null ? Any.fromPartial(object.data) : undefined; + if (object.data !== undefined && object.data !== null) { + message.data = Any.fromPartial(object.data); + } return message; }, fromSDK(object: ClassSDKType): Class { @@ -284,16 +269,16 @@ function createBaseNFT(): NFT { export const NFT = { typeUrl: "/cosmos.nft.v1beta1.NFT", encode(message: NFT, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.classId !== "") { + if (message.classId !== undefined) { writer.uint32(10).string(message.classId); } - if (message.id !== "") { + if (message.id !== undefined) { writer.uint32(18).string(message.id); } - if (message.uri !== "") { + if (message.uri !== undefined) { writer.uint32(26).string(message.uri); } - if (message.uriHash !== "") { + if (message.uriHash !== undefined) { writer.uint32(34).string(message.uriHash); } if (message.data !== undefined) { @@ -331,13 +316,13 @@ export const NFT = { return message; }, fromJSON(object: any): NFT { - return { - classId: isSet(object.classId) ? String(object.classId) : "", - id: isSet(object.id) ? String(object.id) : "", - uri: isSet(object.uri) ? String(object.uri) : "", - uriHash: isSet(object.uriHash) ? String(object.uriHash) : "", - data: isSet(object.data) ? Any.fromJSON(object.data) : undefined - }; + const obj = createBaseNFT(); + if (isSet(object.classId)) obj.classId = String(object.classId); + if (isSet(object.id)) obj.id = String(object.id); + if (isSet(object.uri)) obj.uri = String(object.uri); + if (isSet(object.uriHash)) obj.uriHash = String(object.uriHash); + if (isSet(object.data)) obj.data = Any.fromJSON(object.data); + return obj; }, toJSON(message: NFT): JsonSafe { const obj: any = {}; @@ -354,7 +339,9 @@ export const NFT = { message.id = object.id ?? ""; message.uri = object.uri ?? ""; message.uriHash = object.uriHash ?? ""; - message.data = object.data !== undefined && object.data !== null ? Any.fromPartial(object.data) : undefined; + if (object.data !== undefined && object.data !== null) { + message.data = Any.fromPartial(object.data); + } return message; }, fromSDK(object: NFTSDKType): NFT { diff --git a/__fixtures__/v-next/outputv4/cosmos/nft/v1beta1/query.lcd.ts b/__fixtures__/v-next/outputv4/cosmos/nft/v1beta1/query.lcd.ts index f75cb05451..046df45272 100644 --- a/__fixtures__/v-next/outputv4/cosmos/nft/v1beta1/query.lcd.ts +++ b/__fixtures__/v-next/outputv4/cosmos/nft/v1beta1/query.lcd.ts @@ -1,8 +1,8 @@ -import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../base/query/v1beta1/pagination"; -import { NFT, NFTSDKType, Class, ClassSDKType } from "./nft"; -import { setPaginationParams } from "../../../helpers"; +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../base/query/v1beta1/pagination.js"; +import { NFT, NFTSDKType, Class, ClassSDKType } from "./nft.js"; +import { setPaginationParams } from "../../../helpers.js"; import { LCDClient } from "@cosmology/lcd"; -import { QueryBalanceRequest, QueryBalanceRequestSDKType, QueryBalanceResponse, QueryBalanceResponseSDKType, QueryOwnerRequest, QueryOwnerRequestSDKType, QueryOwnerResponse, QueryOwnerResponseSDKType, QuerySupplyRequest, QuerySupplyRequestSDKType, QuerySupplyResponse, QuerySupplyResponseSDKType, QueryNFTsRequest, QueryNFTsRequestSDKType, QueryNFTsResponse, QueryNFTsResponseSDKType, QueryNFTRequest, QueryNFTRequestSDKType, QueryNFTResponse, QueryNFTResponseSDKType, QueryClassRequest, QueryClassRequestSDKType, QueryClassResponse, QueryClassResponseSDKType, QueryClassesRequest, QueryClassesRequestSDKType, QueryClassesResponse, QueryClassesResponseSDKType } from "./query"; +import { QueryBalanceRequest, QueryBalanceRequestSDKType, QueryBalanceResponse, QueryBalanceResponseSDKType, QueryOwnerRequest, QueryOwnerRequestSDKType, QueryOwnerResponse, QueryOwnerResponseSDKType, QuerySupplyRequest, QuerySupplyRequestSDKType, QuerySupplyResponse, QuerySupplyResponseSDKType, QueryNFTsRequest, QueryNFTsRequestSDKType, QueryNFTsResponse, QueryNFTsResponseSDKType, QueryNFTRequest, QueryNFTRequestSDKType, QueryNFTResponse, QueryNFTResponseSDKType, QueryClassRequest, QueryClassRequestSDKType, QueryClassResponse, QueryClassResponseSDKType, QueryClassesRequest, QueryClassesRequestSDKType, QueryClassesResponse, QueryClassesResponseSDKType } from "./query.js"; export class LCDQueryClient { req: LCDClient; constructor({ @@ -64,7 +64,7 @@ export class LCDQueryClient { } /* Classes queries all NFT classes */ async classes(params: QueryClassesRequest = { - pagination: undefined + pagination: PageRequest.fromPartial({}) }): Promise { const options: any = { params: {} diff --git a/__fixtures__/v-next/outputv4/cosmos/nft/v1beta1/query.rpc.Query.ts b/__fixtures__/v-next/outputv4/cosmos/nft/v1beta1/query.rpc.Query.ts index d4a07ff1aa..abe44f5797 100644 --- a/__fixtures__/v-next/outputv4/cosmos/nft/v1beta1/query.rpc.Query.ts +++ b/__fixtures__/v-next/outputv4/cosmos/nft/v1beta1/query.rpc.Query.ts @@ -1,9 +1,11 @@ -import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../base/query/v1beta1/pagination"; -import { NFT, NFTSDKType, Class, ClassSDKType } from "./nft"; -import { Rpc } from "../../../helpers"; -import { BinaryReader } from "../../../binary"; -import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; -import { QueryBalanceRequest, QueryBalanceRequestSDKType, QueryBalanceResponse, QueryBalanceResponseSDKType, QueryOwnerRequest, QueryOwnerRequestSDKType, QueryOwnerResponse, QueryOwnerResponseSDKType, QuerySupplyRequest, QuerySupplyRequestSDKType, QuerySupplyResponse, QuerySupplyResponseSDKType, QueryNFTsRequest, QueryNFTsRequestSDKType, QueryNFTsResponse, QueryNFTsResponseSDKType, QueryNFTRequest, QueryNFTRequestSDKType, QueryNFTResponse, QueryNFTResponseSDKType, QueryClassRequest, QueryClassRequestSDKType, QueryClassResponse, QueryClassResponseSDKType, QueryClassesRequest, QueryClassesRequestSDKType, QueryClassesResponse, QueryClassesResponseSDKType, ReactiveQueryBalanceRequest, ReactiveQueryOwnerRequest, ReactiveQuerySupplyRequest, ReactiveQueryNFTsRequest, ReactiveQueryNFTRequest, ReactiveQueryClassRequest, ReactiveQueryClassesRequest } from "./query"; +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../base/query/v1beta1/pagination.js"; +import { NFT, NFTSDKType, Class, ClassSDKType } from "./nft.js"; +import { Rpc } from "../../../helpers.js"; +import { BinaryReader } from "../../../binary.js"; +import { QueryClient, createProtobufRpcClient, ProtobufRpcClient } from "@cosmjs/stargate"; +import { ReactQueryParams } from "../../../react-query.js"; +import { useQuery } from "@tanstack/react-query"; +import { QueryBalanceRequest, QueryBalanceRequestSDKType, QueryBalanceResponse, QueryBalanceResponseSDKType, QueryOwnerRequest, QueryOwnerRequestSDKType, QueryOwnerResponse, QueryOwnerResponseSDKType, QuerySupplyRequest, QuerySupplyRequestSDKType, QuerySupplyResponse, QuerySupplyResponseSDKType, QueryNFTsRequest, QueryNFTsRequestSDKType, QueryNFTsResponse, QueryNFTsResponseSDKType, QueryNFTRequest, QueryNFTRequestSDKType, QueryNFTResponse, QueryNFTResponseSDKType, QueryClassRequest, QueryClassRequestSDKType, QueryClassResponse, QueryClassResponseSDKType, QueryClassesRequest, QueryClassesRequestSDKType, QueryClassesResponse, QueryClassesResponseSDKType } from "./query.js"; /** Query defines the gRPC querier service. */ export interface Query { /** Balance queries the number of NFTs of a given class owned by the owner, same as balanceOf in ERC721 */ @@ -67,7 +69,7 @@ export class QueryClientImpl implements Query { return promise.then(data => QueryClassResponse.decode(new BinaryReader(data))); } classes(request: QueryClassesRequest = { - pagination: undefined + pagination: PageRequest.fromPartial({}) }): Promise { const data = QueryClassesRequest.encode(request).finish(); const promise = this.rpc.request("cosmos.nft.v1beta1.Query", "Classes", data); @@ -100,4 +102,114 @@ export const createRpcQueryExtension = (base: QueryClient) => { return queryService.classes(request); } }; +}; +export interface UseBalanceQuery extends ReactQueryParams { + request: QueryBalanceRequest; +} +export interface UseOwnerQuery extends ReactQueryParams { + request: QueryOwnerRequest; +} +export interface UseSupplyQuery extends ReactQueryParams { + request: QuerySupplyRequest; +} +export interface UseNFTsQuery extends ReactQueryParams { + request: QueryNFTsRequest; +} +export interface UseNFTQuery extends ReactQueryParams { + request: QueryNFTRequest; +} +export interface UseClassQuery extends ReactQueryParams { + request: QueryClassRequest; +} +export interface UseClassesQuery extends ReactQueryParams { + request?: QueryClassesRequest; +} +const _queryClients: WeakMap = new WeakMap(); +const getQueryService = (rpc: ProtobufRpcClient | undefined): QueryClientImpl | undefined => { + if (!rpc) return; + if (_queryClients.has(rpc)) { + return _queryClients.get(rpc); + } + const queryService = new QueryClientImpl(rpc); + _queryClients.set(rpc, queryService); + return queryService; +}; +export const createRpcQueryHooks = (rpc: ProtobufRpcClient | undefined) => { + const queryService = getQueryService(rpc); + const useBalance = ({ + request, + options + }: UseBalanceQuery) => { + return useQuery(["balanceQuery", request], () => { + if (!queryService) throw new Error("Query Service not initialized"); + return queryService.balance(request); + }, options); + }; + const useOwner = ({ + request, + options + }: UseOwnerQuery) => { + return useQuery(["ownerQuery", request], () => { + if (!queryService) throw new Error("Query Service not initialized"); + return queryService.owner(request); + }, options); + }; + const useSupply = ({ + request, + options + }: UseSupplyQuery) => { + return useQuery(["supplyQuery", request], () => { + if (!queryService) throw new Error("Query Service not initialized"); + return queryService.supply(request); + }, options); + }; + const useNFTs = ({ + request, + options + }: UseNFTsQuery) => { + return useQuery(["nFTsQuery", request], () => { + if (!queryService) throw new Error("Query Service not initialized"); + return queryService.nFTs(request); + }, options); + }; + const useNFT = ({ + request, + options + }: UseNFTQuery) => { + return useQuery(["nFTQuery", request], () => { + if (!queryService) throw new Error("Query Service not initialized"); + return queryService.nFT(request); + }, options); + }; + const useClass = ({ + request, + options + }: UseClassQuery) => { + return useQuery(["classQuery", request], () => { + if (!queryService) throw new Error("Query Service not initialized"); + return queryService.class(request); + }, options); + }; + const useClasses = ({ + request, + options + }: UseClassesQuery) => { + return useQuery(["classesQuery", request], () => { + if (!queryService) throw new Error("Query Service not initialized"); + return queryService.classes(request); + }, options); + }; + return { + /** Balance queries the number of NFTs of a given class owned by the owner, same as balanceOf in ERC721 */useBalance, + /** Owner queries the owner of the NFT based on its class and id, same as ownerOf in ERC721 */useOwner, + /** Supply queries the number of NFTs from the given class, same as totalSupply of ERC721. */useSupply, + /** + * NFTs queries all NFTs of a given class or owner,choose at least one of the two, similar to tokenByIndex in + * ERC721Enumerable + */ + useNFTs, + /** NFT queries an NFT based on its class and id. */useNFT, + /** Class queries an NFT class based on its id */useClass, + /** Classes queries all NFT classes */useClasses + }; }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv4/cosmos/nft/v1beta1/query.ts b/__fixtures__/v-next/outputv4/cosmos/nft/v1beta1/query.ts index f38f8ff0bf..625bac32e8 100644 --- a/__fixtures__/v-next/outputv4/cosmos/nft/v1beta1/query.ts +++ b/__fixtures__/v-next/outputv4/cosmos/nft/v1beta1/query.ts @@ -1,19 +1,14 @@ -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 { JsonSafe } from "../../../json-safe"; -import { ComputedRef } from "vue"; +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../base/query/v1beta1/pagination.js"; +import { NFT, NFTSDKType, Class, ClassSDKType } from "./nft.js"; +import { BinaryReader, BinaryWriter } from "../../../binary.js"; +import { isSet, DeepPartial } from "../../../helpers.js"; +import { JsonSafe } from "../../../json-safe.js"; export const protobufPackage = "cosmos.nft.v1beta1"; /** QueryBalanceRequest is the request type for the Query/Balance RPC method */ export interface QueryBalanceRequest { classId: string; owner: string; } -export interface ReactiveQueryBalanceRequest { - classId: ComputedRef; - owner: ComputedRef; -} export interface QueryBalanceRequestProtoMsg { typeUrl: "/cosmos.nft.v1beta1.QueryBalanceRequest"; value: Uint8Array; @@ -27,9 +22,6 @@ export interface QueryBalanceRequestSDKType { export interface QueryBalanceResponse { amount: bigint; } -export interface ReactiveQueryBalanceResponse { - amount: ComputedRef; -} export interface QueryBalanceResponseProtoMsg { typeUrl: "/cosmos.nft.v1beta1.QueryBalanceResponse"; value: Uint8Array; @@ -43,10 +35,6 @@ export interface QueryOwnerRequest { classId: string; id: string; } -export interface ReactiveQueryOwnerRequest { - classId: ComputedRef; - id: ComputedRef; -} export interface QueryOwnerRequestProtoMsg { typeUrl: "/cosmos.nft.v1beta1.QueryOwnerRequest"; value: Uint8Array; @@ -60,9 +48,6 @@ export interface QueryOwnerRequestSDKType { export interface QueryOwnerResponse { owner: string; } -export interface ReactiveQueryOwnerResponse { - owner: ComputedRef; -} export interface QueryOwnerResponseProtoMsg { typeUrl: "/cosmos.nft.v1beta1.QueryOwnerResponse"; value: Uint8Array; @@ -75,9 +60,6 @@ export interface QueryOwnerResponseSDKType { export interface QuerySupplyRequest { classId: string; } -export interface ReactiveQuerySupplyRequest { - classId: ComputedRef; -} export interface QuerySupplyRequestProtoMsg { typeUrl: "/cosmos.nft.v1beta1.QuerySupplyRequest"; value: Uint8Array; @@ -90,9 +72,6 @@ export interface QuerySupplyRequestSDKType { export interface QuerySupplyResponse { amount: bigint; } -export interface ReactiveQuerySupplyResponse { - amount: ComputedRef; -} export interface QuerySupplyResponseProtoMsg { typeUrl: "/cosmos.nft.v1beta1.QuerySupplyResponse"; value: Uint8Array; @@ -107,11 +86,6 @@ export interface QueryNFTsRequest { owner: string; pagination?: PageRequest; } -export interface ReactiveQueryNFTsRequest { - classId: ComputedRef; - owner: ComputedRef; - pagination?: ComputedRef; -} export interface QueryNFTsRequestProtoMsg { typeUrl: "/cosmos.nft.v1beta1.QueryNFTsRequest"; value: Uint8Array; @@ -127,10 +101,6 @@ export interface QueryNFTsResponse { nfts: NFT[]; pagination?: PageResponse; } -export interface ReactiveQueryNFTsResponse { - nfts: ComputedRef; - pagination?: ComputedRef; -} export interface QueryNFTsResponseProtoMsg { typeUrl: "/cosmos.nft.v1beta1.QueryNFTsResponse"; value: Uint8Array; @@ -145,10 +115,6 @@ export interface QueryNFTRequest { classId: string; id: string; } -export interface ReactiveQueryNFTRequest { - classId: ComputedRef; - id: ComputedRef; -} export interface QueryNFTRequestProtoMsg { typeUrl: "/cosmos.nft.v1beta1.QueryNFTRequest"; value: Uint8Array; @@ -162,9 +128,6 @@ export interface QueryNFTRequestSDKType { export interface QueryNFTResponse { nft?: NFT; } -export interface ReactiveQueryNFTResponse { - nft?: ComputedRef; -} export interface QueryNFTResponseProtoMsg { typeUrl: "/cosmos.nft.v1beta1.QueryNFTResponse"; value: Uint8Array; @@ -177,9 +140,6 @@ export interface QueryNFTResponseSDKType { export interface QueryClassRequest { classId: string; } -export interface ReactiveQueryClassRequest { - classId: ComputedRef; -} export interface QueryClassRequestProtoMsg { typeUrl: "/cosmos.nft.v1beta1.QueryClassRequest"; value: Uint8Array; @@ -192,9 +152,6 @@ export interface QueryClassRequestSDKType { export interface QueryClassResponse { class?: Class; } -export interface ReactiveQueryClassResponse { - class?: ComputedRef; -} export interface QueryClassResponseProtoMsg { typeUrl: "/cosmos.nft.v1beta1.QueryClassResponse"; value: Uint8Array; @@ -208,9 +165,6 @@ export interface QueryClassesRequest { /** pagination defines an optional pagination for the request. */ pagination?: PageRequest; } -export interface ReactiveQueryClassesRequest { - pagination?: ComputedRef; -} export interface QueryClassesRequestProtoMsg { typeUrl: "/cosmos.nft.v1beta1.QueryClassesRequest"; value: Uint8Array; @@ -224,10 +178,6 @@ export interface QueryClassesResponse { classes: Class[]; pagination?: PageResponse; } -export interface ReactiveQueryClassesResponse { - classes: ComputedRef; - pagination?: ComputedRef; -} export interface QueryClassesResponseProtoMsg { typeUrl: "/cosmos.nft.v1beta1.QueryClassesResponse"; value: Uint8Array; @@ -246,10 +196,10 @@ function createBaseQueryBalanceRequest(): QueryBalanceRequest { export const QueryBalanceRequest = { typeUrl: "/cosmos.nft.v1beta1.QueryBalanceRequest", encode(message: QueryBalanceRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.classId !== "") { + if (message.classId !== undefined) { writer.uint32(10).string(message.classId); } - if (message.owner !== "") { + if (message.owner !== undefined) { writer.uint32(18).string(message.owner); } return writer; @@ -275,10 +225,10 @@ export const QueryBalanceRequest = { return message; }, fromJSON(object: any): QueryBalanceRequest { - return { - classId: isSet(object.classId) ? String(object.classId) : "", - owner: isSet(object.owner) ? String(object.owner) : "" - }; + const obj = createBaseQueryBalanceRequest(); + if (isSet(object.classId)) obj.classId = String(object.classId); + if (isSet(object.owner)) obj.owner = String(object.owner); + return obj; }, toJSON(message: QueryBalanceRequest): JsonSafe { const obj: any = {}; @@ -356,7 +306,7 @@ function createBaseQueryBalanceResponse(): QueryBalanceResponse { export const QueryBalanceResponse = { typeUrl: "/cosmos.nft.v1beta1.QueryBalanceResponse", encode(message: QueryBalanceResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.amount !== BigInt(0)) { + if (message.amount !== undefined) { writer.uint32(8).uint64(message.amount); } return writer; @@ -379,9 +329,9 @@ export const QueryBalanceResponse = { return message; }, fromJSON(object: any): QueryBalanceResponse { - return { - amount: isSet(object.amount) ? BigInt(object.amount.toString()) : BigInt(0) - }; + const obj = createBaseQueryBalanceResponse(); + if (isSet(object.amount)) obj.amount = BigInt(object.amount.toString()); + return obj; }, toJSON(message: QueryBalanceResponse): JsonSafe { const obj: any = {}; @@ -390,7 +340,9 @@ export const QueryBalanceResponse = { }, fromPartial(object: DeepPartial): QueryBalanceResponse { const message = createBaseQueryBalanceResponse(); - message.amount = object.amount !== undefined && object.amount !== null ? BigInt(object.amount.toString()) : BigInt(0); + if (object.amount !== undefined && object.amount !== null) { + message.amount = BigInt(object.amount.toString()); + } return message; }, fromSDK(object: QueryBalanceResponseSDKType): QueryBalanceResponse { @@ -451,10 +403,10 @@ function createBaseQueryOwnerRequest(): QueryOwnerRequest { export const QueryOwnerRequest = { typeUrl: "/cosmos.nft.v1beta1.QueryOwnerRequest", encode(message: QueryOwnerRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.classId !== "") { + if (message.classId !== undefined) { writer.uint32(10).string(message.classId); } - if (message.id !== "") { + if (message.id !== undefined) { writer.uint32(18).string(message.id); } return writer; @@ -480,10 +432,10 @@ export const QueryOwnerRequest = { return message; }, fromJSON(object: any): QueryOwnerRequest { - return { - classId: isSet(object.classId) ? String(object.classId) : "", - id: isSet(object.id) ? String(object.id) : "" - }; + const obj = createBaseQueryOwnerRequest(); + if (isSet(object.classId)) obj.classId = String(object.classId); + if (isSet(object.id)) obj.id = String(object.id); + return obj; }, toJSON(message: QueryOwnerRequest): JsonSafe { const obj: any = {}; @@ -561,7 +513,7 @@ function createBaseQueryOwnerResponse(): QueryOwnerResponse { export const QueryOwnerResponse = { typeUrl: "/cosmos.nft.v1beta1.QueryOwnerResponse", encode(message: QueryOwnerResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.owner !== "") { + if (message.owner !== undefined) { writer.uint32(10).string(message.owner); } return writer; @@ -584,9 +536,9 @@ export const QueryOwnerResponse = { return message; }, fromJSON(object: any): QueryOwnerResponse { - return { - owner: isSet(object.owner) ? String(object.owner) : "" - }; + const obj = createBaseQueryOwnerResponse(); + if (isSet(object.owner)) obj.owner = String(object.owner); + return obj; }, toJSON(message: QueryOwnerResponse): JsonSafe { const obj: any = {}; @@ -655,7 +607,7 @@ function createBaseQuerySupplyRequest(): QuerySupplyRequest { export const QuerySupplyRequest = { typeUrl: "/cosmos.nft.v1beta1.QuerySupplyRequest", encode(message: QuerySupplyRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.classId !== "") { + if (message.classId !== undefined) { writer.uint32(10).string(message.classId); } return writer; @@ -678,9 +630,9 @@ export const QuerySupplyRequest = { return message; }, fromJSON(object: any): QuerySupplyRequest { - return { - classId: isSet(object.classId) ? String(object.classId) : "" - }; + const obj = createBaseQuerySupplyRequest(); + if (isSet(object.classId)) obj.classId = String(object.classId); + return obj; }, toJSON(message: QuerySupplyRequest): JsonSafe { const obj: any = {}; @@ -749,7 +701,7 @@ function createBaseQuerySupplyResponse(): QuerySupplyResponse { export const QuerySupplyResponse = { typeUrl: "/cosmos.nft.v1beta1.QuerySupplyResponse", encode(message: QuerySupplyResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.amount !== BigInt(0)) { + if (message.amount !== undefined) { writer.uint32(8).uint64(message.amount); } return writer; @@ -772,9 +724,9 @@ export const QuerySupplyResponse = { return message; }, fromJSON(object: any): QuerySupplyResponse { - return { - amount: isSet(object.amount) ? BigInt(object.amount.toString()) : BigInt(0) - }; + const obj = createBaseQuerySupplyResponse(); + if (isSet(object.amount)) obj.amount = BigInt(object.amount.toString()); + return obj; }, toJSON(message: QuerySupplyResponse): JsonSafe { const obj: any = {}; @@ -783,7 +735,9 @@ export const QuerySupplyResponse = { }, fromPartial(object: DeepPartial): QuerySupplyResponse { const message = createBaseQuerySupplyResponse(); - message.amount = object.amount !== undefined && object.amount !== null ? BigInt(object.amount.toString()) : BigInt(0); + if (object.amount !== undefined && object.amount !== null) { + message.amount = BigInt(object.amount.toString()); + } return message; }, fromSDK(object: QuerySupplyResponseSDKType): QuerySupplyResponse { @@ -845,10 +799,10 @@ function createBaseQueryNFTsRequest(): QueryNFTsRequest { export const QueryNFTsRequest = { typeUrl: "/cosmos.nft.v1beta1.QueryNFTsRequest", encode(message: QueryNFTsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.classId !== "") { + if (message.classId !== undefined) { writer.uint32(10).string(message.classId); } - if (message.owner !== "") { + if (message.owner !== undefined) { writer.uint32(18).string(message.owner); } if (message.pagination !== undefined) { @@ -880,11 +834,11 @@ export const QueryNFTsRequest = { return message; }, fromJSON(object: any): QueryNFTsRequest { - return { - classId: isSet(object.classId) ? String(object.classId) : "", - owner: isSet(object.owner) ? String(object.owner) : "", - pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined - }; + const obj = createBaseQueryNFTsRequest(); + if (isSet(object.classId)) obj.classId = String(object.classId); + if (isSet(object.owner)) obj.owner = String(object.owner); + if (isSet(object.pagination)) obj.pagination = PageRequest.fromJSON(object.pagination); + return obj; }, toJSON(message: QueryNFTsRequest): JsonSafe { const obj: any = {}; @@ -897,7 +851,9 @@ export const QueryNFTsRequest = { const message = createBaseQueryNFTsRequest(); message.classId = object.classId ?? ""; message.owner = object.owner ?? ""; - message.pagination = object.pagination !== undefined && object.pagination !== null ? PageRequest.fromPartial(object.pagination) : undefined; + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageRequest.fromPartial(object.pagination); + } return message; }, fromSDK(object: QueryNFTsRequestSDKType): QueryNFTsRequest { @@ -1001,10 +957,10 @@ export const QueryNFTsResponse = { return message; }, fromJSON(object: any): QueryNFTsResponse { - return { - nfts: Array.isArray(object?.nfts) ? object.nfts.map((e: any) => NFT.fromJSON(e)) : [], - pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined - }; + const obj = createBaseQueryNFTsResponse(); + if (Array.isArray(object?.nfts)) obj.nfts = object.nfts.map((e: any) => NFT.fromJSON(e)); + if (isSet(object.pagination)) obj.pagination = PageResponse.fromJSON(object.pagination); + return obj; }, toJSON(message: QueryNFTsResponse): JsonSafe { const obj: any = {}; @@ -1019,7 +975,9 @@ export const QueryNFTsResponse = { fromPartial(object: DeepPartial): QueryNFTsResponse { const message = createBaseQueryNFTsResponse(); message.nfts = object.nfts?.map(e => NFT.fromPartial(e)) || []; - message.pagination = object.pagination !== undefined && object.pagination !== null ? PageResponse.fromPartial(object.pagination) : undefined; + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageResponse.fromPartial(object.pagination); + } return message; }, fromSDK(object: QueryNFTsResponseSDKType): QueryNFTsResponse { @@ -1093,10 +1051,10 @@ function createBaseQueryNFTRequest(): QueryNFTRequest { export const QueryNFTRequest = { typeUrl: "/cosmos.nft.v1beta1.QueryNFTRequest", encode(message: QueryNFTRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.classId !== "") { + if (message.classId !== undefined) { writer.uint32(10).string(message.classId); } - if (message.id !== "") { + if (message.id !== undefined) { writer.uint32(18).string(message.id); } return writer; @@ -1122,10 +1080,10 @@ export const QueryNFTRequest = { return message; }, fromJSON(object: any): QueryNFTRequest { - return { - classId: isSet(object.classId) ? String(object.classId) : "", - id: isSet(object.id) ? String(object.id) : "" - }; + const obj = createBaseQueryNFTRequest(); + if (isSet(object.classId)) obj.classId = String(object.classId); + if (isSet(object.id)) obj.id = String(object.id); + return obj; }, toJSON(message: QueryNFTRequest): JsonSafe { const obj: any = {}; @@ -1226,9 +1184,9 @@ export const QueryNFTResponse = { return message; }, fromJSON(object: any): QueryNFTResponse { - return { - nft: isSet(object.nft) ? NFT.fromJSON(object.nft) : undefined - }; + const obj = createBaseQueryNFTResponse(); + if (isSet(object.nft)) obj.nft = NFT.fromJSON(object.nft); + return obj; }, toJSON(message: QueryNFTResponse): JsonSafe { const obj: any = {}; @@ -1237,7 +1195,9 @@ export const QueryNFTResponse = { }, fromPartial(object: DeepPartial): QueryNFTResponse { const message = createBaseQueryNFTResponse(); - message.nft = object.nft !== undefined && object.nft !== null ? NFT.fromPartial(object.nft) : undefined; + if (object.nft !== undefined && object.nft !== null) { + message.nft = NFT.fromPartial(object.nft); + } return message; }, fromSDK(object: QueryNFTResponseSDKType): QueryNFTResponse { @@ -1297,7 +1257,7 @@ function createBaseQueryClassRequest(): QueryClassRequest { export const QueryClassRequest = { typeUrl: "/cosmos.nft.v1beta1.QueryClassRequest", encode(message: QueryClassRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.classId !== "") { + if (message.classId !== undefined) { writer.uint32(10).string(message.classId); } return writer; @@ -1320,9 +1280,9 @@ export const QueryClassRequest = { return message; }, fromJSON(object: any): QueryClassRequest { - return { - classId: isSet(object.classId) ? String(object.classId) : "" - }; + const obj = createBaseQueryClassRequest(); + if (isSet(object.classId)) obj.classId = String(object.classId); + return obj; }, toJSON(message: QueryClassRequest): JsonSafe { const obj: any = {}; @@ -1414,9 +1374,9 @@ export const QueryClassResponse = { return message; }, fromJSON(object: any): QueryClassResponse { - return { - class: isSet(object.class) ? Class.fromJSON(object.class) : undefined - }; + const obj = createBaseQueryClassResponse(); + if (isSet(object.class)) obj.class = Class.fromJSON(object.class); + return obj; }, toJSON(message: QueryClassResponse): JsonSafe { const obj: any = {}; @@ -1425,7 +1385,9 @@ export const QueryClassResponse = { }, fromPartial(object: DeepPartial): QueryClassResponse { const message = createBaseQueryClassResponse(); - message.class = object.class !== undefined && object.class !== null ? Class.fromPartial(object.class) : undefined; + if (object.class !== undefined && object.class !== null) { + message.class = Class.fromPartial(object.class); + } return message; }, fromSDK(object: QueryClassResponseSDKType): QueryClassResponse { @@ -1508,9 +1470,9 @@ export const QueryClassesRequest = { return message; }, fromJSON(object: any): QueryClassesRequest { - return { - pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined - }; + const obj = createBaseQueryClassesRequest(); + if (isSet(object.pagination)) obj.pagination = PageRequest.fromJSON(object.pagination); + return obj; }, toJSON(message: QueryClassesRequest): JsonSafe { const obj: any = {}; @@ -1519,7 +1481,9 @@ export const QueryClassesRequest = { }, fromPartial(object: DeepPartial): QueryClassesRequest { const message = createBaseQueryClassesRequest(); - message.pagination = object.pagination !== undefined && object.pagination !== null ? PageRequest.fromPartial(object.pagination) : undefined; + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageRequest.fromPartial(object.pagination); + } return message; }, fromSDK(object: QueryClassesRequestSDKType): QueryClassesRequest { @@ -1609,10 +1573,10 @@ export const QueryClassesResponse = { return message; }, fromJSON(object: any): QueryClassesResponse { - return { - classes: Array.isArray(object?.classes) ? object.classes.map((e: any) => Class.fromJSON(e)) : [], - pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined - }; + const obj = createBaseQueryClassesResponse(); + if (Array.isArray(object?.classes)) obj.classes = object.classes.map((e: any) => Class.fromJSON(e)); + if (isSet(object.pagination)) obj.pagination = PageResponse.fromJSON(object.pagination); + return obj; }, toJSON(message: QueryClassesResponse): JsonSafe { const obj: any = {}; @@ -1627,7 +1591,9 @@ export const QueryClassesResponse = { fromPartial(object: DeepPartial): QueryClassesResponse { const message = createBaseQueryClassesResponse(); message.classes = object.classes?.map(e => Class.fromPartial(e)) || []; - message.pagination = object.pagination !== undefined && object.pagination !== null ? PageResponse.fromPartial(object.pagination) : undefined; + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageResponse.fromPartial(object.pagination); + } return message; }, fromSDK(object: QueryClassesResponseSDKType): QueryClassesResponse { 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..1e948f6c30 100644 --- a/__fixtures__/v-next/outputv4/cosmos/nft/v1beta1/tx.amino.ts +++ b/__fixtures__/v-next/outputv4/cosmos/nft/v1beta1/tx.amino.ts @@ -1,5 +1,5 @@ import { AminoMsg } from "@cosmjs/amino"; -import { MsgSend, MsgSendSDKType } from "./tx"; +import { MsgSend, MsgSendSDKType } from "./tx.js"; export interface MsgSendAminoType extends AminoMsg { type: "cosmos-sdk/MsgNFTSend"; value: { diff --git a/__fixtures__/v-next/outputv4/cosmos/nft/v1beta1/tx.registry.ts b/__fixtures__/v-next/outputv4/cosmos/nft/v1beta1/tx.registry.ts index 49958a4bc4..e56ae140f0 100644 --- a/__fixtures__/v-next/outputv4/cosmos/nft/v1beta1/tx.registry.ts +++ b/__fixtures__/v-next/outputv4/cosmos/nft/v1beta1/tx.registry.ts @@ -1,5 +1,5 @@ import { GeneratedType, Registry } from "@cosmjs/proto-signing"; -import { MsgSend, MsgSendSDKType } from "./tx"; +import { MsgSend, MsgSendSDKType } from "./tx.js"; export const registry: ReadonlyArray<[string, GeneratedType]> = [["/cosmos.nft.v1beta1.MsgSend", MsgSend]]; export const load = (protoRegistry: Registry) => { registry.forEach(([typeUrl, mod]) => { diff --git a/__fixtures__/v-next/outputv4/cosmos/nft/v1beta1/tx.rpc.msg.ts b/__fixtures__/v-next/outputv4/cosmos/nft/v1beta1/tx.rpc.msg.ts index 8913d37649..4b5be7dfb5 100644 --- a/__fixtures__/v-next/outputv4/cosmos/nft/v1beta1/tx.rpc.msg.ts +++ b/__fixtures__/v-next/outputv4/cosmos/nft/v1beta1/tx.rpc.msg.ts @@ -1,6 +1,6 @@ -import { Rpc } from "../../../helpers"; -import { BinaryReader } from "../../../binary"; -import { MsgSend, MsgSendSDKType, MsgSendResponse, MsgSendResponseSDKType } from "./tx"; +import { Rpc } from "../../../helpers.js"; +import { BinaryReader } from "../../../binary.js"; +import { MsgSend, MsgSendSDKType, MsgSendResponse, MsgSendResponseSDKType } from "./tx.js"; /** Msg defines the nft Msg service. */ export interface Msg { /** Send defines a method to send a nft from one account to another account. */ diff --git a/__fixtures__/v-next/outputv4/cosmos/nft/v1beta1/tx.ts b/__fixtures__/v-next/outputv4/cosmos/nft/v1beta1/tx.ts index b9da052c32..1406834d09 100644 --- a/__fixtures__/v-next/outputv4/cosmos/nft/v1beta1/tx.ts +++ b/__fixtures__/v-next/outputv4/cosmos/nft/v1beta1/tx.ts @@ -1,7 +1,6 @@ -import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; -import { JsonSafe } from "../../../json-safe"; -import { ComputedRef } from "vue"; +import { BinaryReader, BinaryWriter } from "../../../binary.js"; +import { isSet, DeepPartial } from "../../../helpers.js"; +import { JsonSafe } from "../../../json-safe.js"; export const protobufPackage = "cosmos.nft.v1beta1"; /** MsgSend represents a message to send a nft from one account to another account. */ export interface MsgSend { @@ -14,12 +13,6 @@ export interface MsgSend { /** receiver is the receiver address of nft */ receiver: string; } -export interface ReactiveMsgSend { - classId: ComputedRef; - id: ComputedRef; - sender: ComputedRef; - receiver: ComputedRef; -} export interface MsgSendProtoMsg { typeUrl: "/cosmos.nft.v1beta1.MsgSend"; value: Uint8Array; @@ -33,7 +26,6 @@ export interface MsgSendSDKType { } /** MsgSendResponse defines the Msg/Send response type. */ export interface MsgSendResponse {} -export interface ReactiveMsgSendResponse {} export interface MsgSendResponseProtoMsg { typeUrl: "/cosmos.nft.v1beta1.MsgSendResponse"; value: Uint8Array; @@ -51,16 +43,16 @@ function createBaseMsgSend(): MsgSend { export const MsgSend = { typeUrl: "/cosmos.nft.v1beta1.MsgSend", encode(message: MsgSend, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.classId !== "") { + if (message.classId !== undefined) { writer.uint32(10).string(message.classId); } - if (message.id !== "") { + if (message.id !== undefined) { writer.uint32(18).string(message.id); } - if (message.sender !== "") { + if (message.sender !== undefined) { writer.uint32(26).string(message.sender); } - if (message.receiver !== "") { + if (message.receiver !== undefined) { writer.uint32(34).string(message.receiver); } return writer; @@ -92,12 +84,12 @@ export const MsgSend = { return message; }, fromJSON(object: any): MsgSend { - return { - classId: isSet(object.classId) ? String(object.classId) : "", - id: isSet(object.id) ? String(object.id) : "", - sender: isSet(object.sender) ? String(object.sender) : "", - receiver: isSet(object.receiver) ? String(object.receiver) : "" - }; + const obj = createBaseMsgSend(); + if (isSet(object.classId)) obj.classId = String(object.classId); + if (isSet(object.id)) obj.id = String(object.id); + if (isSet(object.sender)) obj.sender = String(object.sender); + if (isSet(object.receiver)) obj.receiver = String(object.receiver); + return obj; }, toJSON(message: MsgSend): JsonSafe { const obj: any = {}; @@ -208,7 +200,8 @@ export const MsgSendResponse = { return message; }, fromJSON(_: any): MsgSendResponse { - return {}; + const obj = createBaseMsgSendResponse(); + return obj; }, toJSON(_: MsgSendResponse): JsonSafe { const obj: any = {}; diff --git a/__fixtures__/v-next/outputv4/cosmos/orm/module/v1alpha1/module.ts b/__fixtures__/v-next/outputv4/cosmos/orm/module/v1alpha1/module.ts index a886721ac4..0ddd6499a8 100644 --- a/__fixtures__/v-next/outputv4/cosmos/orm/module/v1alpha1/module.ts +++ b/__fixtures__/v-next/outputv4/cosmos/orm/module/v1alpha1/module.ts @@ -1,7 +1,6 @@ -import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { JsonSafe } from "../../../../json-safe"; -import { DeepPartial } from "../../../../helpers"; -import { ComputedRef } from "vue"; +import { BinaryReader, BinaryWriter } from "../../../../binary.js"; +import { JsonSafe } from "../../../../json-safe.js"; +import { DeepPartial } from "../../../../helpers.js"; export const protobufPackage = "cosmos.orm.module.v1alpha1"; /** * Module defines the ORM module which adds providers to the app container for @@ -9,7 +8,6 @@ export const protobufPackage = "cosmos.orm.module.v1alpha1"; * with ORM data. */ export interface Module {} -export interface ReactiveModule {} export interface ModuleProtoMsg { typeUrl: "/cosmos.orm.module.v1alpha1.Module"; value: Uint8Array; @@ -43,7 +41,8 @@ export const Module = { return message; }, fromJSON(_: any): Module { - return {}; + const obj = createBaseModule(); + return obj; }, toJSON(_: Module): JsonSafe { const obj: any = {}; diff --git a/__fixtures__/v-next/outputv4/cosmos/orm/v1/orm.ts b/__fixtures__/v-next/outputv4/cosmos/orm/v1/orm.ts index 5bc7aaa458..2210cff480 100644 --- a/__fixtures__/v-next/outputv4/cosmos/orm/v1/orm.ts +++ b/__fixtures__/v-next/outputv4/cosmos/orm/v1/orm.ts @@ -1,7 +1,6 @@ -import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; -import { JsonSafe } from "../../../json-safe"; -import { ComputedRef } from "vue"; +import { BinaryReader, BinaryWriter } from "../../../binary.js"; +import { isSet, DeepPartial } from "../../../helpers.js"; +import { JsonSafe } from "../../../json-safe.js"; export const protobufPackage = "cosmos.orm.v1"; /** TableDescriptor describes an ORM table. */ export interface TableDescriptor { @@ -16,11 +15,6 @@ export interface TableDescriptor { */ id: number; } -export interface ReactiveTableDescriptor { - primaryKey?: ComputedRef; - index: ComputedRef; - id: ComputedRef; -} export interface TableDescriptorProtoMsg { typeUrl: "/cosmos.orm.v1.TableDescriptor"; value: Uint8Array; @@ -73,10 +67,6 @@ export interface PrimaryKeyDescriptor { */ autoIncrement: boolean; } -export interface ReactivePrimaryKeyDescriptor { - fields: ComputedRef; - autoIncrement: ComputedRef; -} export interface PrimaryKeyDescriptorProtoMsg { typeUrl: "/cosmos.orm.v1.PrimaryKeyDescriptor"; value: Uint8Array; @@ -109,11 +99,6 @@ export interface SecondaryIndexDescriptor { /** unique specifies that this an unique index. */ unique: boolean; } -export interface ReactiveSecondaryIndexDescriptor { - fields: ComputedRef; - id: ComputedRef; - unique: ComputedRef; -} export interface SecondaryIndexDescriptorProtoMsg { typeUrl: "/cosmos.orm.v1.SecondaryIndexDescriptor"; value: Uint8Array; @@ -133,9 +118,6 @@ export interface SingletonDescriptor { */ id: number; } -export interface ReactiveSingletonDescriptor { - id: ComputedRef; -} export interface SingletonDescriptorProtoMsg { typeUrl: "/cosmos.orm.v1.SingletonDescriptor"; value: Uint8Array; @@ -160,7 +142,7 @@ export const TableDescriptor = { for (const v of message.index) { SecondaryIndexDescriptor.encode(v!, writer.uint32(18).fork()).ldelim(); } - if (message.id !== 0) { + if (message.id !== undefined) { writer.uint32(24).uint32(message.id); } return writer; @@ -189,11 +171,11 @@ export const TableDescriptor = { return message; }, fromJSON(object: any): TableDescriptor { - return { - primaryKey: isSet(object.primaryKey) ? PrimaryKeyDescriptor.fromJSON(object.primaryKey) : undefined, - index: Array.isArray(object?.index) ? object.index.map((e: any) => SecondaryIndexDescriptor.fromJSON(e)) : [], - id: isSet(object.id) ? Number(object.id) : 0 - }; + const obj = createBaseTableDescriptor(); + if (isSet(object.primaryKey)) obj.primaryKey = PrimaryKeyDescriptor.fromJSON(object.primaryKey); + if (Array.isArray(object?.index)) obj.index = object.index.map((e: any) => SecondaryIndexDescriptor.fromJSON(e)); + if (isSet(object.id)) obj.id = Number(object.id); + return obj; }, toJSON(message: TableDescriptor): JsonSafe { const obj: any = {}; @@ -208,7 +190,9 @@ export const TableDescriptor = { }, fromPartial(object: DeepPartial): TableDescriptor { const message = createBaseTableDescriptor(); - message.primaryKey = object.primaryKey !== undefined && object.primaryKey !== null ? PrimaryKeyDescriptor.fromPartial(object.primaryKey) : undefined; + if (object.primaryKey !== undefined && object.primaryKey !== null) { + message.primaryKey = PrimaryKeyDescriptor.fromPartial(object.primaryKey); + } message.index = object.index?.map(e => SecondaryIndexDescriptor.fromPartial(e)) || []; message.id = object.id ?? 0; return message; @@ -291,10 +275,10 @@ function createBasePrimaryKeyDescriptor(): PrimaryKeyDescriptor { export const PrimaryKeyDescriptor = { typeUrl: "/cosmos.orm.v1.PrimaryKeyDescriptor", encode(message: PrimaryKeyDescriptor, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.fields !== "") { + if (message.fields !== undefined) { writer.uint32(10).string(message.fields); } - if (message.autoIncrement === true) { + if (message.autoIncrement !== undefined) { writer.uint32(16).bool(message.autoIncrement); } return writer; @@ -320,10 +304,10 @@ export const PrimaryKeyDescriptor = { return message; }, fromJSON(object: any): PrimaryKeyDescriptor { - return { - fields: isSet(object.fields) ? String(object.fields) : "", - autoIncrement: isSet(object.autoIncrement) ? Boolean(object.autoIncrement) : false - }; + const obj = createBasePrimaryKeyDescriptor(); + if (isSet(object.fields)) obj.fields = String(object.fields); + if (isSet(object.autoIncrement)) obj.autoIncrement = Boolean(object.autoIncrement); + return obj; }, toJSON(message: PrimaryKeyDescriptor): JsonSafe { const obj: any = {}; @@ -403,13 +387,13 @@ function createBaseSecondaryIndexDescriptor(): SecondaryIndexDescriptor { export const SecondaryIndexDescriptor = { typeUrl: "/cosmos.orm.v1.SecondaryIndexDescriptor", encode(message: SecondaryIndexDescriptor, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.fields !== "") { + if (message.fields !== undefined) { writer.uint32(10).string(message.fields); } - if (message.id !== 0) { + if (message.id !== undefined) { writer.uint32(16).uint32(message.id); } - if (message.unique === true) { + if (message.unique !== undefined) { writer.uint32(24).bool(message.unique); } return writer; @@ -438,11 +422,11 @@ export const SecondaryIndexDescriptor = { return message; }, fromJSON(object: any): SecondaryIndexDescriptor { - return { - fields: isSet(object.fields) ? String(object.fields) : "", - id: isSet(object.id) ? Number(object.id) : 0, - unique: isSet(object.unique) ? Boolean(object.unique) : false - }; + const obj = createBaseSecondaryIndexDescriptor(); + if (isSet(object.fields)) obj.fields = String(object.fields); + if (isSet(object.id)) obj.id = Number(object.id); + if (isSet(object.unique)) obj.unique = Boolean(object.unique); + return obj; }, toJSON(message: SecondaryIndexDescriptor): JsonSafe { const obj: any = {}; @@ -529,7 +513,7 @@ function createBaseSingletonDescriptor(): SingletonDescriptor { export const SingletonDescriptor = { typeUrl: "/cosmos.orm.v1.SingletonDescriptor", encode(message: SingletonDescriptor, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.id !== 0) { + if (message.id !== undefined) { writer.uint32(8).uint32(message.id); } return writer; @@ -552,9 +536,9 @@ export const SingletonDescriptor = { return message; }, fromJSON(object: any): SingletonDescriptor { - return { - id: isSet(object.id) ? Number(object.id) : 0 - }; + const obj = createBaseSingletonDescriptor(); + if (isSet(object.id)) obj.id = Number(object.id); + return obj; }, toJSON(message: SingletonDescriptor): JsonSafe { const obj: any = {}; diff --git a/__fixtures__/v-next/outputv4/cosmos/orm/v1alpha1/schema.ts b/__fixtures__/v-next/outputv4/cosmos/orm/v1alpha1/schema.ts index e1df4f34c2..cc5c217cf8 100644 --- a/__fixtures__/v-next/outputv4/cosmos/orm/v1alpha1/schema.ts +++ b/__fixtures__/v-next/outputv4/cosmos/orm/v1alpha1/schema.ts @@ -1,7 +1,6 @@ -import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, bytesFromBase64, base64FromBytes, DeepPartial } from "../../../helpers"; -import { JsonSafe } from "../../../json-safe"; -import { ComputedRef } from "vue"; +import { BinaryReader, BinaryWriter } from "../../../binary.js"; +import { isSet, bytesFromBase64, base64FromBytes, DeepPartial } from "../../../helpers.js"; +import { JsonSafe } from "../../../json-safe.js"; export const protobufPackage = "cosmos.orm.v1alpha1"; /** StorageType */ export enum StorageType { @@ -96,10 +95,6 @@ export interface ModuleSchemaDescriptor { */ prefix: Uint8Array; } -export interface ReactiveModuleSchemaDescriptor { - schemaFile: ComputedRef; - prefix: ComputedRef; -} export interface ModuleSchemaDescriptorProtoMsg { typeUrl: "/cosmos.orm.v1alpha1.ModuleSchemaDescriptor"; value: Uint8Array; @@ -129,11 +124,6 @@ export interface ModuleSchemaDescriptor_FileEntry { */ storageType: StorageType; } -export interface ReactiveModuleSchemaDescriptor_FileEntry { - id: ComputedRef; - protoFileName: ComputedRef; - storageType: ComputedRef; -} export interface ModuleSchemaDescriptor_FileEntryProtoMsg { typeUrl: "/cosmos.orm.v1alpha1.FileEntry"; value: Uint8Array; @@ -182,10 +172,10 @@ export const ModuleSchemaDescriptor = { return message; }, fromJSON(object: any): ModuleSchemaDescriptor { - return { - schemaFile: Array.isArray(object?.schemaFile) ? object.schemaFile.map((e: any) => ModuleSchemaDescriptor_FileEntry.fromJSON(e)) : [], - prefix: isSet(object.prefix) ? bytesFromBase64(object.prefix) : new Uint8Array() - }; + const obj = createBaseModuleSchemaDescriptor(); + if (Array.isArray(object?.schemaFile)) obj.schemaFile = object.schemaFile.map((e: any) => ModuleSchemaDescriptor_FileEntry.fromJSON(e)); + if (isSet(object.prefix)) obj.prefix = bytesFromBase64(object.prefix); + return obj; }, toJSON(message: ModuleSchemaDescriptor): JsonSafe { const obj: any = {}; @@ -275,10 +265,10 @@ function createBaseModuleSchemaDescriptor_FileEntry(): ModuleSchemaDescriptor_Fi export const ModuleSchemaDescriptor_FileEntry = { typeUrl: "/cosmos.orm.v1alpha1.FileEntry", encode(message: ModuleSchemaDescriptor_FileEntry, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.id !== 0) { + if (message.id !== undefined) { writer.uint32(8).uint32(message.id); } - if (message.protoFileName !== "") { + if (message.protoFileName !== undefined) { writer.uint32(18).string(message.protoFileName); } if (message.storageType !== 0) { @@ -310,11 +300,11 @@ export const ModuleSchemaDescriptor_FileEntry = { return message; }, fromJSON(object: any): ModuleSchemaDescriptor_FileEntry { - return { - id: isSet(object.id) ? Number(object.id) : 0, - protoFileName: isSet(object.protoFileName) ? String(object.protoFileName) : "", - storageType: isSet(object.storageType) ? storageTypeFromJSON(object.storageType) : -1 - }; + const obj = createBaseModuleSchemaDescriptor_FileEntry(); + if (isSet(object.id)) obj.id = Number(object.id); + if (isSet(object.protoFileName)) obj.protoFileName = String(object.protoFileName); + if (isSet(object.storageType)) obj.storageType = storageTypeFromJSON(object.storageType); + return obj; }, toJSON(message: ModuleSchemaDescriptor_FileEntry): JsonSafe { const obj: any = {}; diff --git a/__fixtures__/v-next/outputv4/cosmos/params/v1beta1/params.ts b/__fixtures__/v-next/outputv4/cosmos/params/v1beta1/params.ts index e99e88f269..2253d97aac 100644 --- a/__fixtures__/v-next/outputv4/cosmos/params/v1beta1/params.ts +++ b/__fixtures__/v-next/outputv4/cosmos/params/v1beta1/params.ts @@ -1,7 +1,6 @@ -import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; -import { JsonSafe } from "../../../json-safe"; -import { ComputedRef } from "vue"; +import { BinaryReader, BinaryWriter } from "../../../binary.js"; +import { isSet, DeepPartial } from "../../../helpers.js"; +import { JsonSafe } from "../../../json-safe.js"; export const protobufPackage = "cosmos.params.v1beta1"; /** ParameterChangeProposal defines a proposal to change one or more parameters. */ export interface ParameterChangeProposal { @@ -9,11 +8,6 @@ export interface ParameterChangeProposal { description: string; changes: ParamChange[]; } -export interface ReactiveParameterChangeProposal { - title: ComputedRef; - description: ComputedRef; - changes: ComputedRef; -} export interface ParameterChangeProposalProtoMsg { typeUrl: "/cosmos.params.v1beta1.ParameterChangeProposal"; value: Uint8Array; @@ -33,11 +27,6 @@ export interface ParamChange { key: string; value: string; } -export interface ReactiveParamChange { - subspace: ComputedRef; - key: ComputedRef; - value: ComputedRef; -} export interface ParamChangeProtoMsg { typeUrl: "/cosmos.params.v1beta1.ParamChange"; value: Uint8Array; @@ -61,10 +50,10 @@ function createBaseParameterChangeProposal(): ParameterChangeProposal { export const ParameterChangeProposal = { typeUrl: "/cosmos.params.v1beta1.ParameterChangeProposal", encode(message: ParameterChangeProposal, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.title !== "") { + if (message.title !== undefined) { writer.uint32(10).string(message.title); } - if (message.description !== "") { + if (message.description !== undefined) { writer.uint32(18).string(message.description); } for (const v of message.changes) { @@ -96,11 +85,11 @@ export const ParameterChangeProposal = { return message; }, fromJSON(object: any): ParameterChangeProposal { - return { - title: isSet(object.title) ? String(object.title) : "", - description: isSet(object.description) ? String(object.description) : "", - changes: Array.isArray(object?.changes) ? object.changes.map((e: any) => ParamChange.fromJSON(e)) : [] - }; + const obj = createBaseParameterChangeProposal(); + if (isSet(object.title)) obj.title = String(object.title); + if (isSet(object.description)) obj.description = String(object.description); + if (Array.isArray(object?.changes)) obj.changes = object.changes.map((e: any) => ParamChange.fromJSON(e)); + return obj; }, toJSON(message: ParameterChangeProposal): JsonSafe { const obj: any = {}; @@ -199,13 +188,13 @@ function createBaseParamChange(): ParamChange { export const ParamChange = { typeUrl: "/cosmos.params.v1beta1.ParamChange", encode(message: ParamChange, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.subspace !== "") { + if (message.subspace !== undefined) { writer.uint32(10).string(message.subspace); } - if (message.key !== "") { + if (message.key !== undefined) { writer.uint32(18).string(message.key); } - if (message.value !== "") { + if (message.value !== undefined) { writer.uint32(26).string(message.value); } return writer; @@ -234,11 +223,11 @@ export const ParamChange = { return message; }, fromJSON(object: any): ParamChange { - return { - subspace: isSet(object.subspace) ? String(object.subspace) : "", - key: isSet(object.key) ? String(object.key) : "", - value: isSet(object.value) ? String(object.value) : "" - }; + const obj = createBaseParamChange(); + if (isSet(object.subspace)) obj.subspace = String(object.subspace); + if (isSet(object.key)) obj.key = String(object.key); + if (isSet(object.value)) obj.value = String(object.value); + return obj; }, toJSON(message: ParamChange): JsonSafe { const obj: any = {}; diff --git a/__fixtures__/v-next/outputv4/cosmos/params/v1beta1/query.lcd.ts b/__fixtures__/v-next/outputv4/cosmos/params/v1beta1/query.lcd.ts index 05a89fd5a9..737ed229cf 100644 --- a/__fixtures__/v-next/outputv4/cosmos/params/v1beta1/query.lcd.ts +++ b/__fixtures__/v-next/outputv4/cosmos/params/v1beta1/query.lcd.ts @@ -1,6 +1,6 @@ -import { ParamChange, ParamChangeSDKType } from "./params"; +import { ParamChange, ParamChangeSDKType } from "./params.js"; import { LCDClient } from "@cosmology/lcd"; -import { QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType, QuerySubspacesRequest, QuerySubspacesRequestSDKType, QuerySubspacesResponse, QuerySubspacesResponseSDKType } from "./query"; +import { QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType, QuerySubspacesRequest, QuerySubspacesRequestSDKType, QuerySubspacesResponse, QuerySubspacesResponseSDKType } from "./query.js"; export class LCDQueryClient { req: LCDClient; constructor({ diff --git a/__fixtures__/v-next/outputv4/cosmos/params/v1beta1/query.rpc.Query.ts b/__fixtures__/v-next/outputv4/cosmos/params/v1beta1/query.rpc.Query.ts index aee096f907..79b76656f2 100644 --- a/__fixtures__/v-next/outputv4/cosmos/params/v1beta1/query.rpc.Query.ts +++ b/__fixtures__/v-next/outputv4/cosmos/params/v1beta1/query.rpc.Query.ts @@ -1,8 +1,8 @@ -import { ParamChange, ParamChangeSDKType } from "./params"; -import { Rpc } from "../../../helpers"; -import { BinaryReader } from "../../../binary"; +import { ParamChange, ParamChangeSDKType } from "./params.js"; +import { Rpc } from "../../../helpers.js"; +import { BinaryReader } from "../../../binary.js"; import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; -import { QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType, QuerySubspacesRequest, QuerySubspacesRequestSDKType, QuerySubspacesResponse, QuerySubspacesResponseSDKType, ReactiveQueryParamsRequest, ReactiveQuerySubspacesRequest } from "./query"; +import { QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType, QuerySubspacesRequest, QuerySubspacesRequestSDKType, QuerySubspacesResponse, QuerySubspacesResponseSDKType } from "./query.js"; /** Query defines the gRPC querier service. */ export interface Query { /** diff --git a/__fixtures__/v-next/outputv4/cosmos/params/v1beta1/query.ts b/__fixtures__/v-next/outputv4/cosmos/params/v1beta1/query.ts index 5c871bb282..206aeb146a 100644 --- a/__fixtures__/v-next/outputv4/cosmos/params/v1beta1/query.ts +++ b/__fixtures__/v-next/outputv4/cosmos/params/v1beta1/query.ts @@ -1,8 +1,7 @@ -import { ParamChange, ParamChangeSDKType } from "./params"; -import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; -import { JsonSafe } from "../../../json-safe"; -import { ComputedRef } from "vue"; +import { ParamChange, ParamChangeSDKType } from "./params.js"; +import { BinaryReader, BinaryWriter } from "../../../binary.js"; +import { isSet, DeepPartial } from "../../../helpers.js"; +import { JsonSafe } from "../../../json-safe.js"; export const protobufPackage = "cosmos.params.v1beta1"; /** QueryParamsRequest is request type for the Query/Params RPC method. */ export interface QueryParamsRequest { @@ -11,10 +10,6 @@ export interface QueryParamsRequest { /** key defines the key of the parameter in the subspace. */ key: string; } -export interface ReactiveQueryParamsRequest { - subspace: ComputedRef; - key: ComputedRef; -} export interface QueryParamsRequestProtoMsg { typeUrl: "/cosmos.params.v1beta1.QueryParamsRequest"; value: Uint8Array; @@ -29,9 +24,6 @@ export interface QueryParamsResponse { /** param defines the queried parameter. */ param: ParamChange; } -export interface ReactiveQueryParamsResponse { - param: ComputedRef; -} export interface QueryParamsResponseProtoMsg { typeUrl: "/cosmos.params.v1beta1.QueryParamsResponse"; value: Uint8Array; @@ -45,7 +37,6 @@ export interface QueryParamsResponseSDKType { * subspaces and all keys for a subspace. */ export interface QuerySubspacesRequest {} -export interface ReactiveQuerySubspacesRequest {} export interface QuerySubspacesRequestProtoMsg { typeUrl: "/cosmos.params.v1beta1.QuerySubspacesRequest"; value: Uint8Array; @@ -62,9 +53,6 @@ export interface QuerySubspacesRequestSDKType {} export interface QuerySubspacesResponse { subspaces: Subspace[]; } -export interface ReactiveQuerySubspacesResponse { - subspaces: ComputedRef; -} export interface QuerySubspacesResponseProtoMsg { typeUrl: "/cosmos.params.v1beta1.QuerySubspacesResponse"; value: Uint8Array; @@ -84,10 +72,6 @@ export interface Subspace { subspace: string; keys: string[]; } -export interface ReactiveSubspace { - subspace: ComputedRef; - keys: ComputedRef; -} export interface SubspaceProtoMsg { typeUrl: "/cosmos.params.v1beta1.Subspace"; value: Uint8Array; @@ -109,10 +93,10 @@ function createBaseQueryParamsRequest(): QueryParamsRequest { export const QueryParamsRequest = { typeUrl: "/cosmos.params.v1beta1.QueryParamsRequest", encode(message: QueryParamsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.subspace !== "") { + if (message.subspace !== undefined) { writer.uint32(10).string(message.subspace); } - if (message.key !== "") { + if (message.key !== undefined) { writer.uint32(18).string(message.key); } return writer; @@ -138,10 +122,10 @@ export const QueryParamsRequest = { return message; }, fromJSON(object: any): QueryParamsRequest { - return { - subspace: isSet(object.subspace) ? String(object.subspace) : "", - key: isSet(object.key) ? String(object.key) : "" - }; + const obj = createBaseQueryParamsRequest(); + if (isSet(object.subspace)) obj.subspace = String(object.subspace); + if (isSet(object.key)) obj.key = String(object.key); + return obj; }, toJSON(message: QueryParamsRequest): JsonSafe { const obj: any = {}; @@ -242,9 +226,9 @@ export const QueryParamsResponse = { return message; }, fromJSON(object: any): QueryParamsResponse { - return { - param: isSet(object.param) ? ParamChange.fromJSON(object.param) : undefined - }; + const obj = createBaseQueryParamsResponse(); + if (isSet(object.param)) obj.param = ParamChange.fromJSON(object.param); + return obj; }, toJSON(message: QueryParamsResponse): JsonSafe { const obj: any = {}; @@ -253,7 +237,9 @@ export const QueryParamsResponse = { }, fromPartial(object: DeepPartial): QueryParamsResponse { const message = createBaseQueryParamsResponse(); - message.param = object.param !== undefined && object.param !== null ? ParamChange.fromPartial(object.param) : undefined; + if (object.param !== undefined && object.param !== null) { + message.param = ParamChange.fromPartial(object.param); + } return message; }, fromSDK(object: QueryParamsResponseSDKType): QueryParamsResponse { @@ -328,7 +314,8 @@ export const QuerySubspacesRequest = { return message; }, fromJSON(_: any): QuerySubspacesRequest { - return {}; + const obj = createBaseQuerySubspacesRequest(); + return obj; }, toJSON(_: QuerySubspacesRequest): JsonSafe { const obj: any = {}; @@ -409,9 +396,9 @@ export const QuerySubspacesResponse = { return message; }, fromJSON(object: any): QuerySubspacesResponse { - return { - subspaces: Array.isArray(object?.subspaces) ? object.subspaces.map((e: any) => Subspace.fromJSON(e)) : [] - }; + const obj = createBaseQuerySubspacesResponse(); + if (Array.isArray(object?.subspaces)) obj.subspaces = object.subspaces.map((e: any) => Subspace.fromJSON(e)); + return obj; }, toJSON(message: QuerySubspacesResponse): JsonSafe { const obj: any = {}; @@ -491,7 +478,7 @@ function createBaseSubspace(): Subspace { export const Subspace = { typeUrl: "/cosmos.params.v1beta1.Subspace", encode(message: Subspace, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.subspace !== "") { + if (message.subspace !== undefined) { writer.uint32(10).string(message.subspace); } for (const v of message.keys) { @@ -520,10 +507,10 @@ export const Subspace = { return message; }, fromJSON(object: any): Subspace { - return { - subspace: isSet(object.subspace) ? String(object.subspace) : "", - keys: Array.isArray(object?.keys) ? object.keys.map((e: any) => String(e)) : [] - }; + const obj = createBaseSubspace(); + if (isSet(object.subspace)) obj.subspace = String(object.subspace); + if (Array.isArray(object?.keys)) obj.keys = object.keys.map((e: any) => String(e)); + return obj; }, toJSON(message: Subspace): JsonSafe { const obj: any = {}; diff --git a/__fixtures__/v-next/outputv4/cosmos/rpc.query.ts b/__fixtures__/v-next/outputv4/cosmos/rpc.query.ts index 0de82d5268..7a583ff3e2 100644 --- a/__fixtures__/v-next/outputv4/cosmos/rpc.query.ts +++ b/__fixtures__/v-next/outputv4/cosmos/rpc.query.ts @@ -1,75 +1,72 @@ -import { Rpc } from "../helpers"; -import { Tendermint34Client, HttpEndpoint } from "@cosmjs/tendermint-rpc"; +import { Rpc } from "../helpers.js"; +import { connectComet, HttpEndpoint } from "@cosmjs/tendermint-rpc"; import { QueryClient } from "@cosmjs/stargate"; export const createRPCQueryClient = async ({ rpcEndpoint }: { rpcEndpoint: string | HttpEndpoint; }) => { - const tmClient = await Tendermint34Client.connect(rpcEndpoint); + const tmClient = await connectComet(rpcEndpoint); const client = new QueryClient(tmClient); return { cosmos: { app: { - v1alpha1: (await import("./app/v1alpha1/query.rpc.Query")).createRpcQueryExtension(client) + v1alpha1: (await import("./app/v1alpha1/query.rpc.Query.js")).createRpcQueryExtension(client) }, auth: { - v1beta1: (await import("./auth/v1beta1/query.rpc.Query")).createRpcQueryExtension(client) + v1beta1: (await import("./auth/v1beta1/query.rpc.Query.js")).createRpcQueryExtension(client) }, authz: { - v1beta1: (await import("./authz/v1beta1/query.rpc.Query")).createRpcQueryExtension(client) + v1beta1: (await import("./authz/v1beta1/query.rpc.Query.js")).createRpcQueryExtension(client) }, bank: { - v1beta1: (await import("./bank/v1beta1/query.rpc.Query")).createRpcQueryExtension(client) + v1beta1: (await import("./bank/v1beta1/query.rpc.Query.js")).createRpcQueryExtension(client) }, base: { reflection: { - v1beta1: (await import("./base/reflection/v1beta1/reflection.rpc.ReflectionService")).createRpcQueryExtension(client), - v2alpha1: (await import("./base/reflection/v2alpha1/reflection.rpc.ReflectionService")).createRpcQueryExtension(client) + v1beta1: (await import("./base/reflection/v1beta1/reflection.rpc.ReflectionService.js")).createRpcQueryExtension(client), + v2alpha1: (await import("./base/reflection/v2alpha1/reflection.rpc.ReflectionService.js")).createRpcQueryExtension(client) }, tendermint: { - v1beta1: (await import("./base/tendermint/v1beta1/query.rpc.Service")).createRpcQueryExtension(client) - }, - node: { - v1beta1: (await import("./base/node/v1beta1/query.rpc.Service")).createRpcQueryExtension(client) + v1beta1: (await import("./base/tendermint/v1beta1/query.rpc.Service.js")).createRpcQueryExtension(client) } }, distribution: { - v1beta1: (await import("./distribution/v1beta1/query.rpc.Query")).createRpcQueryExtension(client) + v1beta1: (await import("./distribution/v1beta1/query.rpc.Query.js")).createRpcQueryExtension(client) }, evidence: { - v1beta1: (await import("./evidence/v1beta1/query.rpc.Query")).createRpcQueryExtension(client) + v1beta1: (await import("./evidence/v1beta1/query.rpc.Query.js")).createRpcQueryExtension(client) }, feegrant: { - v1beta1: (await import("./feegrant/v1beta1/query.rpc.Query")).createRpcQueryExtension(client) + v1beta1: (await import("./feegrant/v1beta1/query.rpc.Query.js")).createRpcQueryExtension(client) }, gov: { - v1: (await import("./gov/v1/query.rpc.Query")).createRpcQueryExtension(client), - v1beta1: (await import("./gov/v1beta1/query.rpc.Query")).createRpcQueryExtension(client) + v1: (await import("./gov/v1/query.rpc.Query.js")).createRpcQueryExtension(client), + v1beta1: (await import("./gov/v1beta1/query.rpc.Query.js")).createRpcQueryExtension(client) }, group: { - v1: (await import("./group/v1/query.rpc.Query")).createRpcQueryExtension(client) + v1: (await import("./group/v1/query.rpc.Query.js")).createRpcQueryExtension(client) }, mint: { - v1beta1: (await import("./mint/v1beta1/query.rpc.Query")).createRpcQueryExtension(client) + v1beta1: (await import("./mint/v1beta1/query.rpc.Query.js")).createRpcQueryExtension(client) }, nft: { - v1beta1: (await import("./nft/v1beta1/query.rpc.Query")).createRpcQueryExtension(client) + v1beta1: (await import("./nft/v1beta1/query.rpc.Query.js")).createRpcQueryExtension(client) }, params: { - v1beta1: (await import("./params/v1beta1/query.rpc.Query")).createRpcQueryExtension(client) + v1beta1: (await import("./params/v1beta1/query.rpc.Query.js")).createRpcQueryExtension(client) }, slashing: { - v1beta1: (await import("./slashing/v1beta1/query.rpc.Query")).createRpcQueryExtension(client) + v1beta1: (await import("./slashing/v1beta1/query.rpc.Query.js")).createRpcQueryExtension(client) }, staking: { - v1beta1: (await import("./staking/v1beta1/query.rpc.Query")).createRpcQueryExtension(client) + v1beta1: (await import("./staking/v1beta1/query.rpc.Query.js")).createRpcQueryExtension(client) }, tx: { - v1beta1: (await import("./tx/v1beta1/service.rpc.Service")).createRpcQueryExtension(client) + v1beta1: (await import("./tx/v1beta1/service.rpc.Service.js")).createRpcQueryExtension(client) }, upgrade: { - v1beta1: (await import("./upgrade/v1beta1/query.rpc.Query")).createRpcQueryExtension(client) + v1beta1: (await import("./upgrade/v1beta1/query.rpc.Query.js")).createRpcQueryExtension(client) } } }; diff --git a/__fixtures__/v-next/outputv4/cosmos/rpc.tx.ts b/__fixtures__/v-next/outputv4/cosmos/rpc.tx.ts index 3a4dbf9b6f..ee7fdfff0a 100644 --- a/__fixtures__/v-next/outputv4/cosmos/rpc.tx.ts +++ b/__fixtures__/v-next/outputv4/cosmos/rpc.tx.ts @@ -1,4 +1,4 @@ -import { Rpc } from "../helpers"; +import { Rpc } from "../helpers.js"; export const createRPCMsgClient = async ({ rpc }: { @@ -6,44 +6,44 @@ export const createRPCMsgClient = async ({ }) => ({ cosmos: { authz: { - v1beta1: new (await import("./authz/v1beta1/tx.rpc.msg")).MsgClientImpl(rpc) + v1beta1: new (await import("./authz/v1beta1/tx.rpc.msg.js")).MsgClientImpl(rpc) }, bank: { - v1beta1: new (await import("./bank/v1beta1/tx.rpc.msg")).MsgClientImpl(rpc) + v1beta1: new (await import("./bank/v1beta1/tx.rpc.msg.js")).MsgClientImpl(rpc) }, crisis: { - v1beta1: new (await import("./crisis/v1beta1/tx.rpc.msg")).MsgClientImpl(rpc) + v1beta1: new (await import("./crisis/v1beta1/tx.rpc.msg.js")).MsgClientImpl(rpc) }, distribution: { - v1beta1: new (await import("./distribution/v1beta1/tx.rpc.msg")).MsgClientImpl(rpc) + v1beta1: new (await import("./distribution/v1beta1/tx.rpc.msg.js")).MsgClientImpl(rpc) }, evidence: { - v1beta1: new (await import("./evidence/v1beta1/tx.rpc.msg")).MsgClientImpl(rpc) + v1beta1: new (await import("./evidence/v1beta1/tx.rpc.msg.js")).MsgClientImpl(rpc) }, feegrant: { - v1beta1: new (await import("./feegrant/v1beta1/tx.rpc.msg")).MsgClientImpl(rpc) + v1beta1: new (await import("./feegrant/v1beta1/tx.rpc.msg.js")).MsgClientImpl(rpc) }, gov: { - v1: new (await import("./gov/v1/tx.rpc.msg")).MsgClientImpl(rpc), - v1beta1: new (await import("./gov/v1beta1/tx.rpc.msg")).MsgClientImpl(rpc) + v1: new (await import("./gov/v1/tx.rpc.msg.js")).MsgClientImpl(rpc), + v1beta1: new (await import("./gov/v1beta1/tx.rpc.msg.js")).MsgClientImpl(rpc) }, group: { - v1: new (await import("./group/v1/tx.rpc.msg")).MsgClientImpl(rpc) + v1: new (await import("./group/v1/tx.rpc.msg.js")).MsgClientImpl(rpc) }, nft: { - v1beta1: new (await import("./nft/v1beta1/tx.rpc.msg")).MsgClientImpl(rpc) + v1beta1: new (await import("./nft/v1beta1/tx.rpc.msg.js")).MsgClientImpl(rpc) }, slashing: { - v1beta1: new (await import("./slashing/v1beta1/tx.rpc.msg")).MsgClientImpl(rpc) + v1beta1: new (await import("./slashing/v1beta1/tx.rpc.msg.js")).MsgClientImpl(rpc) }, staking: { - v1beta1: new (await import("./staking/v1beta1/tx.rpc.msg")).MsgClientImpl(rpc) + v1beta1: new (await import("./staking/v1beta1/tx.rpc.msg.js")).MsgClientImpl(rpc) }, upgrade: { - v1beta1: new (await import("./upgrade/v1beta1/tx.rpc.msg")).MsgClientImpl(rpc) + v1beta1: new (await import("./upgrade/v1beta1/tx.rpc.msg.js")).MsgClientImpl(rpc) }, vesting: { - v1beta1: new (await import("./vesting/v1beta1/tx.rpc.msg")).MsgClientImpl(rpc) + v1beta1: new (await import("./vesting/v1beta1/tx.rpc.msg.js")).MsgClientImpl(rpc) } } }); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv4/cosmos/slashing/v1beta1/genesis.ts b/__fixtures__/v-next/outputv4/cosmos/slashing/v1beta1/genesis.ts index f38dfd47bb..d99b4d75ce 100644 --- a/__fixtures__/v-next/outputv4/cosmos/slashing/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputv4/cosmos/slashing/v1beta1/genesis.ts @@ -1,8 +1,7 @@ -import { Params, ParamsSDKType, ValidatorSigningInfo, ValidatorSigningInfoSDKType } from "./slashing"; -import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; -import { JsonSafe } from "../../../json-safe"; -import { ComputedRef } from "vue"; +import { Params, ParamsSDKType, ValidatorSigningInfo, ValidatorSigningInfoSDKType } from "./slashing.js"; +import { BinaryReader, BinaryWriter } from "../../../binary.js"; +import { isSet, DeepPartial } from "../../../helpers.js"; +import { JsonSafe } from "../../../json-safe.js"; export const protobufPackage = "cosmos.slashing.v1beta1"; /** GenesisState defines the slashing module's genesis state. */ export interface GenesisState { @@ -19,11 +18,6 @@ export interface GenesisState { */ missedBlocks: ValidatorMissedBlocks[]; } -export interface ReactiveGenesisState { - params: ComputedRef; - signingInfos: ComputedRef; - missedBlocks: ComputedRef; -} export interface GenesisStateProtoMsg { typeUrl: "/cosmos.slashing.v1beta1.GenesisState"; value: Uint8Array; @@ -41,10 +35,6 @@ export interface SigningInfo { /** validator_signing_info represents the signing info of this validator. */ validatorSigningInfo: ValidatorSigningInfo; } -export interface ReactiveSigningInfo { - address: ComputedRef; - validatorSigningInfo: ComputedRef; -} export interface SigningInfoProtoMsg { typeUrl: "/cosmos.slashing.v1beta1.SigningInfo"; value: Uint8Array; @@ -64,10 +54,6 @@ export interface ValidatorMissedBlocks { /** missed_blocks is an array of missed blocks by the validator. */ missedBlocks: MissedBlock[]; } -export interface ReactiveValidatorMissedBlocks { - address: ComputedRef; - missedBlocks: ComputedRef; -} export interface ValidatorMissedBlocksProtoMsg { typeUrl: "/cosmos.slashing.v1beta1.ValidatorMissedBlocks"; value: Uint8Array; @@ -87,10 +73,6 @@ export interface MissedBlock { /** missed is the missed status. */ missed: boolean; } -export interface ReactiveMissedBlock { - index: ComputedRef; - missed: ComputedRef; -} export interface MissedBlockProtoMsg { typeUrl: "/cosmos.slashing.v1beta1.MissedBlock"; value: Uint8Array; @@ -145,11 +127,11 @@ export const GenesisState = { return message; }, fromJSON(object: any): GenesisState { - return { - params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, - signingInfos: Array.isArray(object?.signingInfos) ? object.signingInfos.map((e: any) => SigningInfo.fromJSON(e)) : [], - missedBlocks: Array.isArray(object?.missedBlocks) ? object.missedBlocks.map((e: any) => ValidatorMissedBlocks.fromJSON(e)) : [] - }; + const obj = createBaseGenesisState(); + if (isSet(object.params)) obj.params = Params.fromJSON(object.params); + if (Array.isArray(object?.signingInfos)) obj.signingInfos = object.signingInfos.map((e: any) => SigningInfo.fromJSON(e)); + if (Array.isArray(object?.missedBlocks)) obj.missedBlocks = object.missedBlocks.map((e: any) => ValidatorMissedBlocks.fromJSON(e)); + return obj; }, toJSON(message: GenesisState): JsonSafe { const obj: any = {}; @@ -168,7 +150,9 @@ export const GenesisState = { }, fromPartial(object: DeepPartial): GenesisState { const message = createBaseGenesisState(); - message.params = object.params !== undefined && object.params !== null ? Params.fromPartial(object.params) : undefined; + if (object.params !== undefined && object.params !== null) { + message.params = Params.fromPartial(object.params); + } message.signingInfos = object.signingInfos?.map(e => SigningInfo.fromPartial(e)) || []; message.missedBlocks = object.missedBlocks?.map(e => ValidatorMissedBlocks.fromPartial(e)) || []; return message; @@ -257,7 +241,7 @@ function createBaseSigningInfo(): SigningInfo { export const SigningInfo = { typeUrl: "/cosmos.slashing.v1beta1.SigningInfo", encode(message: SigningInfo, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.address !== "") { + if (message.address !== undefined) { writer.uint32(10).string(message.address); } if (message.validatorSigningInfo !== undefined) { @@ -286,10 +270,10 @@ export const SigningInfo = { return message; }, fromJSON(object: any): SigningInfo { - return { - address: isSet(object.address) ? String(object.address) : "", - validatorSigningInfo: isSet(object.validatorSigningInfo) ? ValidatorSigningInfo.fromJSON(object.validatorSigningInfo) : undefined - }; + const obj = createBaseSigningInfo(); + if (isSet(object.address)) obj.address = String(object.address); + if (isSet(object.validatorSigningInfo)) obj.validatorSigningInfo = ValidatorSigningInfo.fromJSON(object.validatorSigningInfo); + return obj; }, toJSON(message: SigningInfo): JsonSafe { const obj: any = {}; @@ -300,7 +284,9 @@ export const SigningInfo = { fromPartial(object: DeepPartial): SigningInfo { const message = createBaseSigningInfo(); message.address = object.address ?? ""; - message.validatorSigningInfo = object.validatorSigningInfo !== undefined && object.validatorSigningInfo !== null ? ValidatorSigningInfo.fromPartial(object.validatorSigningInfo) : undefined; + if (object.validatorSigningInfo !== undefined && object.validatorSigningInfo !== null) { + message.validatorSigningInfo = ValidatorSigningInfo.fromPartial(object.validatorSigningInfo); + } return message; }, fromSDK(object: SigningInfoSDKType): SigningInfo { @@ -368,7 +354,7 @@ function createBaseValidatorMissedBlocks(): ValidatorMissedBlocks { export const ValidatorMissedBlocks = { typeUrl: "/cosmos.slashing.v1beta1.ValidatorMissedBlocks", encode(message: ValidatorMissedBlocks, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.address !== "") { + if (message.address !== undefined) { writer.uint32(10).string(message.address); } for (const v of message.missedBlocks) { @@ -397,10 +383,10 @@ export const ValidatorMissedBlocks = { return message; }, fromJSON(object: any): ValidatorMissedBlocks { - return { - address: isSet(object.address) ? String(object.address) : "", - missedBlocks: Array.isArray(object?.missedBlocks) ? object.missedBlocks.map((e: any) => MissedBlock.fromJSON(e)) : [] - }; + const obj = createBaseValidatorMissedBlocks(); + if (isSet(object.address)) obj.address = String(object.address); + if (Array.isArray(object?.missedBlocks)) obj.missedBlocks = object.missedBlocks.map((e: any) => MissedBlock.fromJSON(e)); + return obj; }, toJSON(message: ValidatorMissedBlocks): JsonSafe { const obj: any = {}; @@ -489,10 +475,10 @@ function createBaseMissedBlock(): MissedBlock { export const MissedBlock = { typeUrl: "/cosmos.slashing.v1beta1.MissedBlock", encode(message: MissedBlock, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.index !== BigInt(0)) { + if (message.index !== undefined) { writer.uint32(8).int64(message.index); } - if (message.missed === true) { + if (message.missed !== undefined) { writer.uint32(16).bool(message.missed); } return writer; @@ -518,10 +504,10 @@ export const MissedBlock = { return message; }, fromJSON(object: any): MissedBlock { - return { - index: isSet(object.index) ? BigInt(object.index.toString()) : BigInt(0), - missed: isSet(object.missed) ? Boolean(object.missed) : false - }; + const obj = createBaseMissedBlock(); + if (isSet(object.index)) obj.index = BigInt(object.index.toString()); + if (isSet(object.missed)) obj.missed = Boolean(object.missed); + return obj; }, toJSON(message: MissedBlock): JsonSafe { const obj: any = {}; @@ -531,7 +517,9 @@ export const MissedBlock = { }, fromPartial(object: DeepPartial): MissedBlock { const message = createBaseMissedBlock(); - message.index = object.index !== undefined && object.index !== null ? BigInt(object.index.toString()) : BigInt(0); + if (object.index !== undefined && object.index !== null) { + message.index = BigInt(object.index.toString()); + } message.missed = object.missed ?? false; return message; }, diff --git a/__fixtures__/v-next/outputv4/cosmos/slashing/v1beta1/query.lcd.ts b/__fixtures__/v-next/outputv4/cosmos/slashing/v1beta1/query.lcd.ts index 71213b4975..7a1d6bbc68 100644 --- a/__fixtures__/v-next/outputv4/cosmos/slashing/v1beta1/query.lcd.ts +++ b/__fixtures__/v-next/outputv4/cosmos/slashing/v1beta1/query.lcd.ts @@ -1,8 +1,8 @@ -import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../base/query/v1beta1/pagination"; -import { Params, ParamsSDKType, ValidatorSigningInfo, ValidatorSigningInfoSDKType } from "./slashing"; -import { setPaginationParams } from "../../../helpers"; +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../base/query/v1beta1/pagination.js"; +import { Params, ParamsSDKType, ValidatorSigningInfo, ValidatorSigningInfoSDKType } from "./slashing.js"; +import { setPaginationParams } from "../../../helpers.js"; import { LCDClient } from "@cosmology/lcd"; -import { QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType, QuerySigningInfoRequest, QuerySigningInfoRequestSDKType, QuerySigningInfoResponse, QuerySigningInfoResponseSDKType, QuerySigningInfosRequest, QuerySigningInfosRequestSDKType, QuerySigningInfosResponse, QuerySigningInfosResponseSDKType } from "./query"; +import { QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType, QuerySigningInfoRequest, QuerySigningInfoRequestSDKType, QuerySigningInfoResponse, QuerySigningInfoResponseSDKType, QuerySigningInfosRequest, QuerySigningInfosRequestSDKType, QuerySigningInfosResponse, QuerySigningInfosResponseSDKType } from "./query.js"; export class LCDQueryClient { req: LCDClient; constructor({ @@ -27,7 +27,7 @@ export class LCDQueryClient { } /* SigningInfos queries signing info of all validators */ async signingInfos(params: QuerySigningInfosRequest = { - pagination: undefined + pagination: PageRequest.fromPartial({}) }): Promise { const options: any = { params: {} diff --git a/__fixtures__/v-next/outputv4/cosmos/slashing/v1beta1/query.rpc.Query.ts b/__fixtures__/v-next/outputv4/cosmos/slashing/v1beta1/query.rpc.Query.ts index 72d7ff102d..0808cf79b5 100644 --- a/__fixtures__/v-next/outputv4/cosmos/slashing/v1beta1/query.rpc.Query.ts +++ b/__fixtures__/v-next/outputv4/cosmos/slashing/v1beta1/query.rpc.Query.ts @@ -1,9 +1,9 @@ -import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../base/query/v1beta1/pagination"; -import { Params, ParamsSDKType, ValidatorSigningInfo, ValidatorSigningInfoSDKType } from "./slashing"; -import { Rpc } from "../../../helpers"; -import { BinaryReader } from "../../../binary"; +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../base/query/v1beta1/pagination.js"; +import { Params, ParamsSDKType, ValidatorSigningInfo, ValidatorSigningInfoSDKType } from "./slashing.js"; +import { Rpc } from "../../../helpers.js"; +import { BinaryReader } from "../../../binary.js"; import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; -import { QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType, QuerySigningInfoRequest, QuerySigningInfoRequestSDKType, QuerySigningInfoResponse, QuerySigningInfoResponseSDKType, QuerySigningInfosRequest, QuerySigningInfosRequestSDKType, QuerySigningInfosResponse, QuerySigningInfosResponseSDKType, ReactiveQueryParamsRequest, ReactiveQuerySigningInfoRequest, ReactiveQuerySigningInfosRequest } from "./query"; +import { QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType, QuerySigningInfoRequest, QuerySigningInfoRequestSDKType, QuerySigningInfoResponse, QuerySigningInfoResponseSDKType, QuerySigningInfosRequest, QuerySigningInfosRequestSDKType, QuerySigningInfosResponse, QuerySigningInfosResponseSDKType } from "./query.js"; /** Query provides defines the gRPC querier service */ export interface Query { /** Params queries the parameters of slashing module */ @@ -32,7 +32,7 @@ export class QueryClientImpl implements Query { return promise.then(data => QuerySigningInfoResponse.decode(new BinaryReader(data))); } signingInfos(request: QuerySigningInfosRequest = { - pagination: undefined + pagination: PageRequest.fromPartial({}) }): Promise { const data = QuerySigningInfosRequest.encode(request).finish(); const promise = this.rpc.request("cosmos.slashing.v1beta1.Query", "SigningInfos", data); diff --git a/__fixtures__/v-next/outputv4/cosmos/slashing/v1beta1/query.ts b/__fixtures__/v-next/outputv4/cosmos/slashing/v1beta1/query.ts index de8a4457b1..2156c1bcbb 100644 --- a/__fixtures__/v-next/outputv4/cosmos/slashing/v1beta1/query.ts +++ b/__fixtures__/v-next/outputv4/cosmos/slashing/v1beta1/query.ts @@ -1,13 +1,11 @@ -import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../base/query/v1beta1/pagination"; -import { Params, ParamsSDKType, ValidatorSigningInfo, ValidatorSigningInfoSDKType } from "./slashing"; -import { BinaryReader, BinaryWriter } from "../../../binary"; -import { JsonSafe } from "../../../json-safe"; -import { DeepPartial, isSet } from "../../../helpers"; -import { ComputedRef } from "vue"; +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../base/query/v1beta1/pagination.js"; +import { Params, ParamsSDKType, ValidatorSigningInfo, ValidatorSigningInfoSDKType } from "./slashing.js"; +import { BinaryReader, BinaryWriter } from "../../../binary.js"; +import { JsonSafe } from "../../../json-safe.js"; +import { DeepPartial, isSet } from "../../../helpers.js"; export const protobufPackage = "cosmos.slashing.v1beta1"; /** QueryParamsRequest is the request type for the Query/Params RPC method */ export interface QueryParamsRequest {} -export interface ReactiveQueryParamsRequest {} export interface QueryParamsRequestProtoMsg { typeUrl: "/cosmos.slashing.v1beta1.QueryParamsRequest"; value: Uint8Array; @@ -18,9 +16,6 @@ export interface QueryParamsRequestSDKType {} export interface QueryParamsResponse { params: Params; } -export interface ReactiveQueryParamsResponse { - params: ComputedRef; -} export interface QueryParamsResponseProtoMsg { typeUrl: "/cosmos.slashing.v1beta1.QueryParamsResponse"; value: Uint8Array; @@ -37,9 +32,6 @@ export interface QuerySigningInfoRequest { /** cons_address is the address to query signing info of */ consAddress: string; } -export interface ReactiveQuerySigningInfoRequest { - consAddress: ComputedRef; -} export interface QuerySigningInfoRequestProtoMsg { typeUrl: "/cosmos.slashing.v1beta1.QuerySigningInfoRequest"; value: Uint8Array; @@ -59,9 +51,6 @@ export interface QuerySigningInfoResponse { /** val_signing_info is the signing info of requested val cons address */ valSigningInfo: ValidatorSigningInfo; } -export interface ReactiveQuerySigningInfoResponse { - valSigningInfo: ComputedRef; -} export interface QuerySigningInfoResponseProtoMsg { typeUrl: "/cosmos.slashing.v1beta1.QuerySigningInfoResponse"; value: Uint8Array; @@ -80,9 +69,6 @@ export interface QuerySigningInfoResponseSDKType { export interface QuerySigningInfosRequest { pagination?: PageRequest; } -export interface ReactiveQuerySigningInfosRequest { - pagination?: ComputedRef; -} export interface QuerySigningInfosRequestProtoMsg { typeUrl: "/cosmos.slashing.v1beta1.QuerySigningInfosRequest"; value: Uint8Array; @@ -103,10 +89,6 @@ export interface QuerySigningInfosResponse { info: ValidatorSigningInfo[]; pagination?: PageResponse; } -export interface ReactiveQuerySigningInfosResponse { - info: ComputedRef; - pagination?: ComputedRef; -} export interface QuerySigningInfosResponseProtoMsg { typeUrl: "/cosmos.slashing.v1beta1.QuerySigningInfosResponse"; value: Uint8Array; @@ -142,7 +124,8 @@ export const QueryParamsRequest = { return message; }, fromJSON(_: any): QueryParamsRequest { - return {}; + const obj = createBaseQueryParamsRequest(); + return obj; }, toJSON(_: QueryParamsRequest): JsonSafe { const obj: any = {}; @@ -223,9 +206,9 @@ export const QueryParamsResponse = { return message; }, fromJSON(object: any): QueryParamsResponse { - return { - params: isSet(object.params) ? Params.fromJSON(object.params) : undefined - }; + const obj = createBaseQueryParamsResponse(); + if (isSet(object.params)) obj.params = Params.fromJSON(object.params); + return obj; }, toJSON(message: QueryParamsResponse): JsonSafe { const obj: any = {}; @@ -234,7 +217,9 @@ export const QueryParamsResponse = { }, fromPartial(object: DeepPartial): QueryParamsResponse { const message = createBaseQueryParamsResponse(); - message.params = object.params !== undefined && object.params !== null ? Params.fromPartial(object.params) : undefined; + if (object.params !== undefined && object.params !== null) { + message.params = Params.fromPartial(object.params); + } return message; }, fromSDK(object: QueryParamsResponseSDKType): QueryParamsResponse { @@ -294,7 +279,7 @@ function createBaseQuerySigningInfoRequest(): QuerySigningInfoRequest { export const QuerySigningInfoRequest = { typeUrl: "/cosmos.slashing.v1beta1.QuerySigningInfoRequest", encode(message: QuerySigningInfoRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.consAddress !== "") { + if (message.consAddress !== undefined) { writer.uint32(10).string(message.consAddress); } return writer; @@ -317,9 +302,9 @@ export const QuerySigningInfoRequest = { return message; }, fromJSON(object: any): QuerySigningInfoRequest { - return { - consAddress: isSet(object.consAddress) ? String(object.consAddress) : "" - }; + const obj = createBaseQuerySigningInfoRequest(); + if (isSet(object.consAddress)) obj.consAddress = String(object.consAddress); + return obj; }, toJSON(message: QuerySigningInfoRequest): JsonSafe { const obj: any = {}; @@ -411,9 +396,9 @@ export const QuerySigningInfoResponse = { return message; }, fromJSON(object: any): QuerySigningInfoResponse { - return { - valSigningInfo: isSet(object.valSigningInfo) ? ValidatorSigningInfo.fromJSON(object.valSigningInfo) : undefined - }; + const obj = createBaseQuerySigningInfoResponse(); + if (isSet(object.valSigningInfo)) obj.valSigningInfo = ValidatorSigningInfo.fromJSON(object.valSigningInfo); + return obj; }, toJSON(message: QuerySigningInfoResponse): JsonSafe { const obj: any = {}; @@ -422,7 +407,9 @@ export const QuerySigningInfoResponse = { }, fromPartial(object: DeepPartial): QuerySigningInfoResponse { const message = createBaseQuerySigningInfoResponse(); - message.valSigningInfo = object.valSigningInfo !== undefined && object.valSigningInfo !== null ? ValidatorSigningInfo.fromPartial(object.valSigningInfo) : undefined; + if (object.valSigningInfo !== undefined && object.valSigningInfo !== null) { + message.valSigningInfo = ValidatorSigningInfo.fromPartial(object.valSigningInfo); + } return message; }, fromSDK(object: QuerySigningInfoResponseSDKType): QuerySigningInfoResponse { @@ -505,9 +492,9 @@ export const QuerySigningInfosRequest = { return message; }, fromJSON(object: any): QuerySigningInfosRequest { - return { - pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined - }; + const obj = createBaseQuerySigningInfosRequest(); + if (isSet(object.pagination)) obj.pagination = PageRequest.fromJSON(object.pagination); + return obj; }, toJSON(message: QuerySigningInfosRequest): JsonSafe { const obj: any = {}; @@ -516,7 +503,9 @@ export const QuerySigningInfosRequest = { }, fromPartial(object: DeepPartial): QuerySigningInfosRequest { const message = createBaseQuerySigningInfosRequest(); - message.pagination = object.pagination !== undefined && object.pagination !== null ? PageRequest.fromPartial(object.pagination) : undefined; + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageRequest.fromPartial(object.pagination); + } return message; }, fromSDK(object: QuerySigningInfosRequestSDKType): QuerySigningInfosRequest { @@ -606,10 +595,10 @@ export const QuerySigningInfosResponse = { return message; }, fromJSON(object: any): QuerySigningInfosResponse { - return { - info: Array.isArray(object?.info) ? object.info.map((e: any) => ValidatorSigningInfo.fromJSON(e)) : [], - pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined - }; + const obj = createBaseQuerySigningInfosResponse(); + if (Array.isArray(object?.info)) obj.info = object.info.map((e: any) => ValidatorSigningInfo.fromJSON(e)); + if (isSet(object.pagination)) obj.pagination = PageResponse.fromJSON(object.pagination); + return obj; }, toJSON(message: QuerySigningInfosResponse): JsonSafe { const obj: any = {}; @@ -624,7 +613,9 @@ export const QuerySigningInfosResponse = { fromPartial(object: DeepPartial): QuerySigningInfosResponse { const message = createBaseQuerySigningInfosResponse(); message.info = object.info?.map(e => ValidatorSigningInfo.fromPartial(e)) || []; - message.pagination = object.pagination !== undefined && object.pagination !== null ? PageResponse.fromPartial(object.pagination) : undefined; + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageResponse.fromPartial(object.pagination); + } return message; }, fromSDK(object: QuerySigningInfosResponseSDKType): QuerySigningInfosResponse { diff --git a/__fixtures__/v-next/outputv4/cosmos/slashing/v1beta1/slashing.ts b/__fixtures__/v-next/outputv4/cosmos/slashing/v1beta1/slashing.ts index 892a374e3a..288dc3e078 100644 --- a/__fixtures__/v-next/outputv4/cosmos/slashing/v1beta1/slashing.ts +++ b/__fixtures__/v-next/outputv4/cosmos/slashing/v1beta1/slashing.ts @@ -1,9 +1,8 @@ -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 { JsonSafe } from "../../../json-safe"; -import { ComputedRef } from "vue"; +import { Timestamp, TimestampSDKType } from "../../../google/protobuf/timestamp.js"; +import { Duration, DurationSDKType } from "../../../google/protobuf/duration.js"; +import { BinaryReader, BinaryWriter } from "../../../binary.js"; +import { toTimestamp, fromTimestamp, isSet, DeepPartial, bytesFromBase64, base64FromBytes } from "../../../helpers.js"; +import { JsonSafe } from "../../../json-safe.js"; export const protobufPackage = "cosmos.slashing.v1beta1"; /** * ValidatorSigningInfo defines a validator's signing info for monitoring their @@ -32,14 +31,6 @@ export interface ValidatorSigningInfo { */ missedBlocksCounter: bigint; } -export interface ReactiveValidatorSigningInfo { - address: ComputedRef; - startHeight: ComputedRef; - indexOffset: ComputedRef; - jailedUntil: ComputedRef; - tombstoned: ComputedRef; - missedBlocksCounter: ComputedRef; -} export interface ValidatorSigningInfoProtoMsg { typeUrl: "/cosmos.slashing.v1beta1.ValidatorSigningInfo"; value: Uint8Array; @@ -64,13 +55,6 @@ export interface Params { slashFractionDoubleSign: Uint8Array; slashFractionDowntime: Uint8Array; } -export interface ReactiveParams { - signedBlocksWindow: ComputedRef; - minSignedPerWindow: ComputedRef; - downtimeJailDuration: ComputedRef; - slashFractionDoubleSign: ComputedRef; - slashFractionDowntime: ComputedRef; -} export interface ParamsProtoMsg { typeUrl: "/cosmos.slashing.v1beta1.Params"; value: Uint8Array; @@ -96,22 +80,22 @@ function createBaseValidatorSigningInfo(): ValidatorSigningInfo { export const ValidatorSigningInfo = { typeUrl: "/cosmos.slashing.v1beta1.ValidatorSigningInfo", encode(message: ValidatorSigningInfo, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.address !== "") { + if (message.address !== undefined) { writer.uint32(10).string(message.address); } - if (message.startHeight !== BigInt(0)) { + if (message.startHeight !== undefined) { writer.uint32(16).int64(message.startHeight); } - if (message.indexOffset !== BigInt(0)) { + if (message.indexOffset !== undefined) { writer.uint32(24).int64(message.indexOffset); } if (message.jailedUntil !== undefined) { Timestamp.encode(toTimestamp(message.jailedUntil), writer.uint32(34).fork()).ldelim(); } - if (message.tombstoned === true) { + if (message.tombstoned !== undefined) { writer.uint32(40).bool(message.tombstoned); } - if (message.missedBlocksCounter !== BigInt(0)) { + if (message.missedBlocksCounter !== undefined) { writer.uint32(48).int64(message.missedBlocksCounter); } return writer; @@ -149,14 +133,14 @@ export const ValidatorSigningInfo = { return message; }, fromJSON(object: any): ValidatorSigningInfo { - return { - address: isSet(object.address) ? String(object.address) : "", - startHeight: isSet(object.startHeight) ? BigInt(object.startHeight.toString()) : BigInt(0), - indexOffset: isSet(object.indexOffset) ? BigInt(object.indexOffset.toString()) : BigInt(0), - jailedUntil: isSet(object.jailedUntil) ? new Date(object.jailedUntil) : undefined, - tombstoned: isSet(object.tombstoned) ? Boolean(object.tombstoned) : false, - missedBlocksCounter: isSet(object.missedBlocksCounter) ? BigInt(object.missedBlocksCounter.toString()) : BigInt(0) - }; + const obj = createBaseValidatorSigningInfo(); + if (isSet(object.address)) obj.address = String(object.address); + if (isSet(object.startHeight)) obj.startHeight = BigInt(object.startHeight.toString()); + if (isSet(object.indexOffset)) obj.indexOffset = BigInt(object.indexOffset.toString()); + if (isSet(object.jailedUntil)) obj.jailedUntil = new Date(object.jailedUntil); + if (isSet(object.tombstoned)) obj.tombstoned = Boolean(object.tombstoned); + if (isSet(object.missedBlocksCounter)) obj.missedBlocksCounter = BigInt(object.missedBlocksCounter.toString()); + return obj; }, toJSON(message: ValidatorSigningInfo): JsonSafe { const obj: any = {}; @@ -171,11 +155,17 @@ export const ValidatorSigningInfo = { fromPartial(object: DeepPartial): ValidatorSigningInfo { const message = createBaseValidatorSigningInfo(); message.address = object.address ?? ""; - message.startHeight = object.startHeight !== undefined && object.startHeight !== null ? BigInt(object.startHeight.toString()) : BigInt(0); - message.indexOffset = object.indexOffset !== undefined && object.indexOffset !== null ? BigInt(object.indexOffset.toString()) : BigInt(0); + if (object.startHeight !== undefined && object.startHeight !== null) { + message.startHeight = BigInt(object.startHeight.toString()); + } + if (object.indexOffset !== undefined && object.indexOffset !== null) { + message.indexOffset = BigInt(object.indexOffset.toString()); + } message.jailedUntil = object.jailedUntil ?? undefined; message.tombstoned = object.tombstoned ?? false; - message.missedBlocksCounter = object.missedBlocksCounter !== undefined && object.missedBlocksCounter !== null ? BigInt(object.missedBlocksCounter.toString()) : BigInt(0); + if (object.missedBlocksCounter !== undefined && object.missedBlocksCounter !== null) { + message.missedBlocksCounter = BigInt(object.missedBlocksCounter.toString()); + } return message; }, fromSDK(object: ValidatorSigningInfoSDKType): ValidatorSigningInfo { @@ -274,7 +264,7 @@ function createBaseParams(): Params { export const Params = { typeUrl: "/cosmos.slashing.v1beta1.Params", encode(message: Params, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.signedBlocksWindow !== BigInt(0)) { + if (message.signedBlocksWindow !== undefined) { writer.uint32(8).int64(message.signedBlocksWindow); } if (message.minSignedPerWindow.length !== 0) { @@ -321,13 +311,13 @@ export const Params = { return message; }, fromJSON(object: any): Params { - return { - signedBlocksWindow: isSet(object.signedBlocksWindow) ? BigInt(object.signedBlocksWindow.toString()) : BigInt(0), - minSignedPerWindow: isSet(object.minSignedPerWindow) ? bytesFromBase64(object.minSignedPerWindow) : new Uint8Array(), - downtimeJailDuration: isSet(object.downtimeJailDuration) ? Duration.fromJSON(object.downtimeJailDuration) : undefined, - slashFractionDoubleSign: isSet(object.slashFractionDoubleSign) ? bytesFromBase64(object.slashFractionDoubleSign) : new Uint8Array(), - slashFractionDowntime: isSet(object.slashFractionDowntime) ? bytesFromBase64(object.slashFractionDowntime) : new Uint8Array() - }; + const obj = createBaseParams(); + if (isSet(object.signedBlocksWindow)) obj.signedBlocksWindow = BigInt(object.signedBlocksWindow.toString()); + if (isSet(object.minSignedPerWindow)) obj.minSignedPerWindow = bytesFromBase64(object.minSignedPerWindow); + if (isSet(object.downtimeJailDuration)) obj.downtimeJailDuration = Duration.fromJSON(object.downtimeJailDuration); + if (isSet(object.slashFractionDoubleSign)) obj.slashFractionDoubleSign = bytesFromBase64(object.slashFractionDoubleSign); + if (isSet(object.slashFractionDowntime)) obj.slashFractionDowntime = bytesFromBase64(object.slashFractionDowntime); + return obj; }, toJSON(message: Params): JsonSafe { const obj: any = {}; @@ -340,9 +330,13 @@ export const Params = { }, fromPartial(object: DeepPartial): Params { const message = createBaseParams(); - message.signedBlocksWindow = object.signedBlocksWindow !== undefined && object.signedBlocksWindow !== null ? BigInt(object.signedBlocksWindow.toString()) : BigInt(0); + if (object.signedBlocksWindow !== undefined && object.signedBlocksWindow !== null) { + message.signedBlocksWindow = BigInt(object.signedBlocksWindow.toString()); + } message.minSignedPerWindow = object.minSignedPerWindow ?? new Uint8Array(); - message.downtimeJailDuration = object.downtimeJailDuration !== undefined && object.downtimeJailDuration !== null ? Duration.fromPartial(object.downtimeJailDuration) : undefined; + if (object.downtimeJailDuration !== undefined && object.downtimeJailDuration !== null) { + message.downtimeJailDuration = Duration.fromPartial(object.downtimeJailDuration); + } message.slashFractionDoubleSign = object.slashFractionDoubleSign ?? new Uint8Array(); message.slashFractionDowntime = object.slashFractionDowntime ?? new Uint8Array(); return message; 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..78ca510244 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,5 @@ import { AminoMsg } from "@cosmjs/amino"; -import { MsgUnjail, MsgUnjailSDKType } from "./tx"; +import { MsgUnjail, MsgUnjailSDKType } from "./tx.js"; export interface MsgUnjailAminoType extends AminoMsg { type: "cosmos-sdk/MsgUnjail"; value: { diff --git a/__fixtures__/v-next/outputv4/cosmos/slashing/v1beta1/tx.registry.ts b/__fixtures__/v-next/outputv4/cosmos/slashing/v1beta1/tx.registry.ts index cbbf990ff1..c7c212537b 100644 --- a/__fixtures__/v-next/outputv4/cosmos/slashing/v1beta1/tx.registry.ts +++ b/__fixtures__/v-next/outputv4/cosmos/slashing/v1beta1/tx.registry.ts @@ -1,5 +1,5 @@ import { GeneratedType, Registry } from "@cosmjs/proto-signing"; -import { MsgUnjail, MsgUnjailSDKType } from "./tx"; +import { MsgUnjail, MsgUnjailSDKType } from "./tx.js"; export const registry: ReadonlyArray<[string, GeneratedType]> = [["/cosmos.slashing.v1beta1.MsgUnjail", MsgUnjail]]; export const load = (protoRegistry: Registry) => { registry.forEach(([typeUrl, mod]) => { diff --git a/__fixtures__/v-next/outputv4/cosmos/slashing/v1beta1/tx.rpc.msg.ts b/__fixtures__/v-next/outputv4/cosmos/slashing/v1beta1/tx.rpc.msg.ts index 7003cb7909..81e397e161 100644 --- a/__fixtures__/v-next/outputv4/cosmos/slashing/v1beta1/tx.rpc.msg.ts +++ b/__fixtures__/v-next/outputv4/cosmos/slashing/v1beta1/tx.rpc.msg.ts @@ -1,6 +1,6 @@ -import { Rpc } from "../../../helpers"; -import { BinaryReader } from "../../../binary"; -import { MsgUnjail, MsgUnjailSDKType, MsgUnjailResponse, MsgUnjailResponseSDKType } from "./tx"; +import { Rpc } from "../../../helpers.js"; +import { BinaryReader } from "../../../binary.js"; +import { MsgUnjail, MsgUnjailSDKType, MsgUnjailResponse, MsgUnjailResponseSDKType } from "./tx.js"; /** Msg defines the slashing Msg service. */ export interface Msg { /** diff --git a/__fixtures__/v-next/outputv4/cosmos/slashing/v1beta1/tx.ts b/__fixtures__/v-next/outputv4/cosmos/slashing/v1beta1/tx.ts index 384cc925a2..e46a2ba6f1 100644 --- a/__fixtures__/v-next/outputv4/cosmos/slashing/v1beta1/tx.ts +++ b/__fixtures__/v-next/outputv4/cosmos/slashing/v1beta1/tx.ts @@ -1,15 +1,11 @@ -import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; -import { JsonSafe } from "../../../json-safe"; -import { ComputedRef } from "vue"; +import { BinaryReader, BinaryWriter } from "../../../binary.js"; +import { isSet, DeepPartial } from "../../../helpers.js"; +import { JsonSafe } from "../../../json-safe.js"; export const protobufPackage = "cosmos.slashing.v1beta1"; /** MsgUnjail defines the Msg/Unjail request type */ export interface MsgUnjail { validatorAddr: string; } -export interface ReactiveMsgUnjail { - validatorAddr: ComputedRef; -} export interface MsgUnjailProtoMsg { typeUrl: "/cosmos.slashing.v1beta1.MsgUnjail"; value: Uint8Array; @@ -20,7 +16,6 @@ export interface MsgUnjailSDKType { } /** MsgUnjailResponse defines the Msg/Unjail response type */ export interface MsgUnjailResponse {} -export interface ReactiveMsgUnjailResponse {} export interface MsgUnjailResponseProtoMsg { typeUrl: "/cosmos.slashing.v1beta1.MsgUnjailResponse"; value: Uint8Array; @@ -35,7 +30,7 @@ function createBaseMsgUnjail(): MsgUnjail { export const MsgUnjail = { typeUrl: "/cosmos.slashing.v1beta1.MsgUnjail", encode(message: MsgUnjail, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.validatorAddr !== "") { + if (message.validatorAddr !== undefined) { writer.uint32(10).string(message.validatorAddr); } return writer; @@ -58,9 +53,9 @@ export const MsgUnjail = { return message; }, fromJSON(object: any): MsgUnjail { - return { - validatorAddr: isSet(object.validatorAddr) ? String(object.validatorAddr) : "" - }; + const obj = createBaseMsgUnjail(); + if (isSet(object.validatorAddr)) obj.validatorAddr = String(object.validatorAddr); + return obj; }, toJSON(message: MsgUnjail): JsonSafe { const obj: any = {}; @@ -144,7 +139,8 @@ export const MsgUnjailResponse = { return message; }, fromJSON(_: any): MsgUnjailResponse { - return {}; + const obj = createBaseMsgUnjailResponse(); + return obj; }, toJSON(_: MsgUnjailResponse): JsonSafe { const obj: any = {}; diff --git a/__fixtures__/v-next/outputv4/cosmos/staking/v1beta1/authz.ts b/__fixtures__/v-next/outputv4/cosmos/staking/v1beta1/authz.ts index 700e850e7b..eb1307bbe3 100644 --- a/__fixtures__/v-next/outputv4/cosmos/staking/v1beta1/authz.ts +++ b/__fixtures__/v-next/outputv4/cosmos/staking/v1beta1/authz.ts @@ -1,8 +1,7 @@ -import { Coin, CoinSDKType } from "../../base/v1beta1/coin"; -import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; -import { JsonSafe } from "../../../json-safe"; -import { ComputedRef } from "vue"; +import { Coin, CoinSDKType } from "../../base/v1beta1/coin.js"; +import { BinaryReader, BinaryWriter } from "../../../binary.js"; +import { isSet, DeepPartial } from "../../../helpers.js"; +import { JsonSafe } from "../../../json-safe.js"; export const protobufPackage = "cosmos.staking.v1beta1"; /** * AuthorizationType defines the type of staking module authorization type @@ -77,12 +76,6 @@ export interface StakeAuthorization { /** authorization_type defines one of AuthorizationType. */ authorizationType: AuthorizationType; } -export interface ReactiveStakeAuthorization { - maxTokens?: ComputedRef; - allowList?: ComputedRef; - denyList?: ComputedRef; - authorizationType: ComputedRef; -} export interface StakeAuthorizationProtoMsg { typeUrl: "/cosmos.staking.v1beta1.StakeAuthorization"; value: Uint8Array; @@ -102,9 +95,6 @@ export interface StakeAuthorizationSDKType { export interface StakeAuthorization_Validators { address: string[]; } -export interface ReactiveStakeAuthorization_Validators { - address: ComputedRef; -} export interface StakeAuthorization_ValidatorsProtoMsg { typeUrl: "/cosmos.staking.v1beta1.Validators"; value: Uint8Array; @@ -165,12 +155,12 @@ export const StakeAuthorization = { return message; }, fromJSON(object: any): StakeAuthorization { - return { - maxTokens: isSet(object.maxTokens) ? Coin.fromJSON(object.maxTokens) : undefined, - allowList: isSet(object.allowList) ? StakeAuthorization_Validators.fromJSON(object.allowList) : undefined, - denyList: isSet(object.denyList) ? StakeAuthorization_Validators.fromJSON(object.denyList) : undefined, - authorizationType: isSet(object.authorizationType) ? authorizationTypeFromJSON(object.authorizationType) : -1 - }; + const obj = createBaseStakeAuthorization(); + if (isSet(object.maxTokens)) obj.maxTokens = Coin.fromJSON(object.maxTokens); + if (isSet(object.allowList)) obj.allowList = StakeAuthorization_Validators.fromJSON(object.allowList); + if (isSet(object.denyList)) obj.denyList = StakeAuthorization_Validators.fromJSON(object.denyList); + if (isSet(object.authorizationType)) obj.authorizationType = authorizationTypeFromJSON(object.authorizationType); + return obj; }, toJSON(message: StakeAuthorization): JsonSafe { const obj: any = {}; @@ -182,9 +172,15 @@ export const StakeAuthorization = { }, fromPartial(object: DeepPartial): StakeAuthorization { const message = createBaseStakeAuthorization(); - message.maxTokens = object.maxTokens !== undefined && object.maxTokens !== null ? Coin.fromPartial(object.maxTokens) : undefined; - message.allowList = object.allowList !== undefined && object.allowList !== null ? StakeAuthorization_Validators.fromPartial(object.allowList) : undefined; - message.denyList = object.denyList !== undefined && object.denyList !== null ? StakeAuthorization_Validators.fromPartial(object.denyList) : undefined; + if (object.maxTokens !== undefined && object.maxTokens !== null) { + message.maxTokens = Coin.fromPartial(object.maxTokens); + } + if (object.allowList !== undefined && object.allowList !== null) { + message.allowList = StakeAuthorization_Validators.fromPartial(object.allowList); + } + if (object.denyList !== undefined && object.denyList !== null) { + message.denyList = StakeAuthorization_Validators.fromPartial(object.denyList); + } message.authorizationType = object.authorizationType ?? 0; return message; }, @@ -289,9 +285,9 @@ export const StakeAuthorization_Validators = { return message; }, fromJSON(object: any): StakeAuthorization_Validators { - return { - address: Array.isArray(object?.address) ? object.address.map((e: any) => String(e)) : [] - }; + const obj = createBaseStakeAuthorization_Validators(); + if (Array.isArray(object?.address)) obj.address = object.address.map((e: any) => String(e)); + return obj; }, toJSON(message: StakeAuthorization_Validators): JsonSafe { const obj: any = {}; diff --git a/__fixtures__/v-next/outputv4/cosmos/staking/v1beta1/genesis.ts b/__fixtures__/v-next/outputv4/cosmos/staking/v1beta1/genesis.ts index 42a32bbf93..17b0b3094d 100644 --- a/__fixtures__/v-next/outputv4/cosmos/staking/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputv4/cosmos/staking/v1beta1/genesis.ts @@ -1,8 +1,7 @@ -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 { JsonSafe } from "../../../json-safe"; -import { ComputedRef } from "vue"; +import { Params, ParamsSDKType, Validator, ValidatorSDKType, Delegation, DelegationSDKType, UnbondingDelegation, UnbondingDelegationSDKType, Redelegation, RedelegationSDKType } from "./staking.js"; +import { BinaryReader, BinaryWriter } from "../../../binary.js"; +import { isSet, bytesFromBase64, base64FromBytes, DeepPartial } from "../../../helpers.js"; +import { JsonSafe } from "../../../json-safe.js"; export const protobufPackage = "cosmos.staking.v1beta1"; /** GenesisState defines the staking module's genesis state. */ export interface GenesisState { @@ -28,16 +27,6 @@ export interface GenesisState { redelegations: Redelegation[]; exported: boolean; } -export interface ReactiveGenesisState { - params: ComputedRef; - lastTotalPower: ComputedRef; - lastValidatorPowers: ComputedRef; - validators: ComputedRef; - delegations: ComputedRef; - unbondingDelegations: ComputedRef; - redelegations: ComputedRef; - exported: ComputedRef; -} export interface GenesisStateProtoMsg { typeUrl: "/cosmos.staking.v1beta1.GenesisState"; value: Uint8Array; @@ -60,10 +49,6 @@ export interface LastValidatorPower { /** power defines the power of the validator. */ power: bigint; } -export interface ReactiveLastValidatorPower { - address: ComputedRef; - power: ComputedRef; -} export interface LastValidatorPowerProtoMsg { typeUrl: "/cosmos.staking.v1beta1.LastValidatorPower"; value: Uint8Array; @@ -109,7 +94,7 @@ export const GenesisState = { for (const v of message.redelegations) { Redelegation.encode(v!, writer.uint32(58).fork()).ldelim(); } - if (message.exported === true) { + if (message.exported !== undefined) { writer.uint32(64).bool(message.exported); } return writer; @@ -153,16 +138,16 @@ export const GenesisState = { return message; }, fromJSON(object: any): GenesisState { - return { - params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, - lastTotalPower: isSet(object.lastTotalPower) ? bytesFromBase64(object.lastTotalPower) : new Uint8Array(), - lastValidatorPowers: Array.isArray(object?.lastValidatorPowers) ? object.lastValidatorPowers.map((e: any) => LastValidatorPower.fromJSON(e)) : [], - validators: Array.isArray(object?.validators) ? object.validators.map((e: any) => Validator.fromJSON(e)) : [], - delegations: Array.isArray(object?.delegations) ? object.delegations.map((e: any) => Delegation.fromJSON(e)) : [], - unbondingDelegations: Array.isArray(object?.unbondingDelegations) ? object.unbondingDelegations.map((e: any) => UnbondingDelegation.fromJSON(e)) : [], - redelegations: Array.isArray(object?.redelegations) ? object.redelegations.map((e: any) => Redelegation.fromJSON(e)) : [], - exported: isSet(object.exported) ? Boolean(object.exported) : false - }; + const obj = createBaseGenesisState(); + if (isSet(object.params)) obj.params = Params.fromJSON(object.params); + if (isSet(object.lastTotalPower)) obj.lastTotalPower = bytesFromBase64(object.lastTotalPower); + if (Array.isArray(object?.lastValidatorPowers)) obj.lastValidatorPowers = object.lastValidatorPowers.map((e: any) => LastValidatorPower.fromJSON(e)); + if (Array.isArray(object?.validators)) obj.validators = object.validators.map((e: any) => Validator.fromJSON(e)); + if (Array.isArray(object?.delegations)) obj.delegations = object.delegations.map((e: any) => Delegation.fromJSON(e)); + if (Array.isArray(object?.unbondingDelegations)) obj.unbondingDelegations = object.unbondingDelegations.map((e: any) => UnbondingDelegation.fromJSON(e)); + if (Array.isArray(object?.redelegations)) obj.redelegations = object.redelegations.map((e: any) => Redelegation.fromJSON(e)); + if (isSet(object.exported)) obj.exported = Boolean(object.exported); + return obj; }, toJSON(message: GenesisState): JsonSafe { const obj: any = {}; @@ -198,7 +183,9 @@ export const GenesisState = { }, fromPartial(object: DeepPartial): GenesisState { const message = createBaseGenesisState(); - message.params = object.params !== undefined && object.params !== null ? Params.fromPartial(object.params) : undefined; + if (object.params !== undefined && object.params !== null) { + message.params = Params.fromPartial(object.params); + } message.lastTotalPower = object.lastTotalPower ?? new Uint8Array(); message.lastValidatorPowers = object.lastValidatorPowers?.map(e => LastValidatorPower.fromPartial(e)) || []; message.validators = object.validators?.map(e => Validator.fromPartial(e)) || []; @@ -345,10 +332,10 @@ function createBaseLastValidatorPower(): LastValidatorPower { export const LastValidatorPower = { typeUrl: "/cosmos.staking.v1beta1.LastValidatorPower", encode(message: LastValidatorPower, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.address !== "") { + if (message.address !== undefined) { writer.uint32(10).string(message.address); } - if (message.power !== BigInt(0)) { + if (message.power !== undefined) { writer.uint32(16).int64(message.power); } return writer; @@ -374,10 +361,10 @@ export const LastValidatorPower = { return message; }, fromJSON(object: any): LastValidatorPower { - return { - address: isSet(object.address) ? String(object.address) : "", - power: isSet(object.power) ? BigInt(object.power.toString()) : BigInt(0) - }; + const obj = createBaseLastValidatorPower(); + if (isSet(object.address)) obj.address = String(object.address); + if (isSet(object.power)) obj.power = BigInt(object.power.toString()); + return obj; }, toJSON(message: LastValidatorPower): JsonSafe { const obj: any = {}; @@ -388,7 +375,9 @@ export const LastValidatorPower = { fromPartial(object: DeepPartial): LastValidatorPower { const message = createBaseLastValidatorPower(); message.address = object.address ?? ""; - message.power = object.power !== undefined && object.power !== null ? BigInt(object.power.toString()) : BigInt(0); + if (object.power !== undefined && object.power !== null) { + message.power = BigInt(object.power.toString()); + } return message; }, fromSDK(object: LastValidatorPowerSDKType): LastValidatorPower { diff --git a/__fixtures__/v-next/outputv4/cosmos/staking/v1beta1/query.lcd.ts b/__fixtures__/v-next/outputv4/cosmos/staking/v1beta1/query.lcd.ts index 056cbdc1d3..385240543e 100644 --- a/__fixtures__/v-next/outputv4/cosmos/staking/v1beta1/query.lcd.ts +++ b/__fixtures__/v-next/outputv4/cosmos/staking/v1beta1/query.lcd.ts @@ -1,8 +1,8 @@ -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 { setPaginationParams } from "../../../helpers"; +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../base/query/v1beta1/pagination.js"; +import { Validator, ValidatorSDKType, DelegationResponse, DelegationResponseSDKType, UnbondingDelegation, UnbondingDelegationSDKType, RedelegationResponse, RedelegationResponseSDKType, HistoricalInfo, HistoricalInfoSDKType, Pool, PoolSDKType, Params, ParamsSDKType } from "./staking.js"; +import { setPaginationParams } from "../../../helpers.js"; import { LCDClient } from "@cosmology/lcd"; -import { QueryValidatorsRequest, QueryValidatorsRequestSDKType, QueryValidatorsResponse, QueryValidatorsResponseSDKType, QueryValidatorRequest, QueryValidatorRequestSDKType, QueryValidatorResponse, QueryValidatorResponseSDKType, QueryValidatorDelegationsRequest, QueryValidatorDelegationsRequestSDKType, QueryValidatorDelegationsResponse, QueryValidatorDelegationsResponseSDKType, QueryValidatorUnbondingDelegationsRequest, QueryValidatorUnbondingDelegationsRequestSDKType, QueryValidatorUnbondingDelegationsResponse, QueryValidatorUnbondingDelegationsResponseSDKType, QueryDelegationRequest, QueryDelegationRequestSDKType, QueryDelegationResponse, QueryDelegationResponseSDKType, QueryUnbondingDelegationRequest, QueryUnbondingDelegationRequestSDKType, QueryUnbondingDelegationResponse, QueryUnbondingDelegationResponseSDKType, QueryDelegatorDelegationsRequest, QueryDelegatorDelegationsRequestSDKType, QueryDelegatorDelegationsResponse, QueryDelegatorDelegationsResponseSDKType, QueryDelegatorUnbondingDelegationsRequest, QueryDelegatorUnbondingDelegationsRequestSDKType, QueryDelegatorUnbondingDelegationsResponse, QueryDelegatorUnbondingDelegationsResponseSDKType, QueryRedelegationsRequest, QueryRedelegationsRequestSDKType, QueryRedelegationsResponse, QueryRedelegationsResponseSDKType, QueryDelegatorValidatorsRequest, QueryDelegatorValidatorsRequestSDKType, QueryDelegatorValidatorsResponse, QueryDelegatorValidatorsResponseSDKType, QueryDelegatorValidatorRequest, QueryDelegatorValidatorRequestSDKType, QueryDelegatorValidatorResponse, QueryDelegatorValidatorResponseSDKType, QueryHistoricalInfoRequest, QueryHistoricalInfoRequestSDKType, QueryHistoricalInfoResponse, QueryHistoricalInfoResponseSDKType, QueryPoolRequest, QueryPoolRequestSDKType, QueryPoolResponse, QueryPoolResponseSDKType, QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType } from "./query"; +import { QueryValidatorsRequest, QueryValidatorsRequestSDKType, QueryValidatorsResponse, QueryValidatorsResponseSDKType, QueryValidatorRequest, QueryValidatorRequestSDKType, QueryValidatorResponse, QueryValidatorResponseSDKType, QueryValidatorDelegationsRequest, QueryValidatorDelegationsRequestSDKType, QueryValidatorDelegationsResponse, QueryValidatorDelegationsResponseSDKType, QueryValidatorUnbondingDelegationsRequest, QueryValidatorUnbondingDelegationsRequestSDKType, QueryValidatorUnbondingDelegationsResponse, QueryValidatorUnbondingDelegationsResponseSDKType, QueryDelegationRequest, QueryDelegationRequestSDKType, QueryDelegationResponse, QueryDelegationResponseSDKType, QueryUnbondingDelegationRequest, QueryUnbondingDelegationRequestSDKType, QueryUnbondingDelegationResponse, QueryUnbondingDelegationResponseSDKType, QueryDelegatorDelegationsRequest, QueryDelegatorDelegationsRequestSDKType, QueryDelegatorDelegationsResponse, QueryDelegatorDelegationsResponseSDKType, QueryDelegatorUnbondingDelegationsRequest, QueryDelegatorUnbondingDelegationsRequestSDKType, QueryDelegatorUnbondingDelegationsResponse, QueryDelegatorUnbondingDelegationsResponseSDKType, QueryRedelegationsRequest, QueryRedelegationsRequestSDKType, QueryRedelegationsResponse, QueryRedelegationsResponseSDKType, QueryDelegatorValidatorsRequest, QueryDelegatorValidatorsRequestSDKType, QueryDelegatorValidatorsResponse, QueryDelegatorValidatorsResponseSDKType, QueryDelegatorValidatorRequest, QueryDelegatorValidatorRequestSDKType, QueryDelegatorValidatorResponse, QueryDelegatorValidatorResponseSDKType, QueryHistoricalInfoRequest, QueryHistoricalInfoRequestSDKType, QueryHistoricalInfoResponse, QueryHistoricalInfoResponseSDKType, QueryPoolRequest, QueryPoolRequestSDKType, QueryPoolResponse, QueryPoolResponseSDKType, QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType } from "./query.js"; export class LCDQueryClient { req: LCDClient; constructor({ diff --git a/__fixtures__/v-next/outputv4/cosmos/staking/v1beta1/query.rpc.Query.ts b/__fixtures__/v-next/outputv4/cosmos/staking/v1beta1/query.rpc.Query.ts index 8d9ca64a2b..6cb4037052 100644 --- a/__fixtures__/v-next/outputv4/cosmos/staking/v1beta1/query.rpc.Query.ts +++ b/__fixtures__/v-next/outputv4/cosmos/staking/v1beta1/query.rpc.Query.ts @@ -1,12 +1,9 @@ -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 { Rpc } from "../../../helpers"; -import { BinaryReader } from "../../../binary"; -import { QueryClient, createProtobufRpcClient, ProtobufRpcClient } from "@cosmjs/stargate"; -import { VueQueryParams } from "../../../vue-query"; -import { ComputedRef, computed, Ref } from "vue"; -import { useQuery } from "@tanstack/vue-query"; -import { QueryValidatorsRequest, QueryValidatorsRequestSDKType, QueryValidatorsResponse, QueryValidatorsResponseSDKType, QueryValidatorRequest, QueryValidatorRequestSDKType, QueryValidatorResponse, QueryValidatorResponseSDKType, QueryValidatorDelegationsRequest, QueryValidatorDelegationsRequestSDKType, QueryValidatorDelegationsResponse, QueryValidatorDelegationsResponseSDKType, QueryValidatorUnbondingDelegationsRequest, QueryValidatorUnbondingDelegationsRequestSDKType, QueryValidatorUnbondingDelegationsResponse, QueryValidatorUnbondingDelegationsResponseSDKType, QueryDelegationRequest, QueryDelegationRequestSDKType, QueryDelegationResponse, QueryDelegationResponseSDKType, QueryUnbondingDelegationRequest, QueryUnbondingDelegationRequestSDKType, QueryUnbondingDelegationResponse, QueryUnbondingDelegationResponseSDKType, QueryDelegatorDelegationsRequest, QueryDelegatorDelegationsRequestSDKType, QueryDelegatorDelegationsResponse, QueryDelegatorDelegationsResponseSDKType, QueryDelegatorUnbondingDelegationsRequest, QueryDelegatorUnbondingDelegationsRequestSDKType, QueryDelegatorUnbondingDelegationsResponse, QueryDelegatorUnbondingDelegationsResponseSDKType, QueryRedelegationsRequest, QueryRedelegationsRequestSDKType, QueryRedelegationsResponse, QueryRedelegationsResponseSDKType, QueryDelegatorValidatorsRequest, QueryDelegatorValidatorsRequestSDKType, QueryDelegatorValidatorsResponse, QueryDelegatorValidatorsResponseSDKType, QueryDelegatorValidatorRequest, QueryDelegatorValidatorRequestSDKType, QueryDelegatorValidatorResponse, QueryDelegatorValidatorResponseSDKType, QueryHistoricalInfoRequest, QueryHistoricalInfoRequestSDKType, QueryHistoricalInfoResponse, QueryHistoricalInfoResponseSDKType, QueryPoolRequest, QueryPoolRequestSDKType, QueryPoolResponse, QueryPoolResponseSDKType, QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType, ReactiveQueryValidatorsRequest, ReactiveQueryValidatorRequest, ReactiveQueryValidatorDelegationsRequest, ReactiveQueryValidatorUnbondingDelegationsRequest, ReactiveQueryDelegationRequest, ReactiveQueryUnbondingDelegationRequest, ReactiveQueryDelegatorDelegationsRequest, ReactiveQueryDelegatorUnbondingDelegationsRequest, ReactiveQueryRedelegationsRequest, ReactiveQueryDelegatorValidatorsRequest, ReactiveQueryDelegatorValidatorRequest, ReactiveQueryHistoricalInfoRequest, ReactiveQueryPoolRequest, ReactiveQueryParamsRequest } from "./query"; +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../base/query/v1beta1/pagination.js"; +import { Validator, ValidatorSDKType, DelegationResponse, DelegationResponseSDKType, UnbondingDelegation, UnbondingDelegationSDKType, RedelegationResponse, RedelegationResponseSDKType, HistoricalInfo, HistoricalInfoSDKType, Pool, PoolSDKType, Params, ParamsSDKType } from "./staking.js"; +import { Rpc } from "../../../helpers.js"; +import { BinaryReader } from "../../../binary.js"; +import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; +import { QueryValidatorsRequest, QueryValidatorsRequestSDKType, QueryValidatorsResponse, QueryValidatorsResponseSDKType, QueryValidatorRequest, QueryValidatorRequestSDKType, QueryValidatorResponse, QueryValidatorResponseSDKType, QueryValidatorDelegationsRequest, QueryValidatorDelegationsRequestSDKType, QueryValidatorDelegationsResponse, QueryValidatorDelegationsResponseSDKType, QueryValidatorUnbondingDelegationsRequest, QueryValidatorUnbondingDelegationsRequestSDKType, QueryValidatorUnbondingDelegationsResponse, QueryValidatorUnbondingDelegationsResponseSDKType, QueryDelegationRequest, QueryDelegationRequestSDKType, QueryDelegationResponse, QueryDelegationResponseSDKType, QueryUnbondingDelegationRequest, QueryUnbondingDelegationRequestSDKType, QueryUnbondingDelegationResponse, QueryUnbondingDelegationResponseSDKType, QueryDelegatorDelegationsRequest, QueryDelegatorDelegationsRequestSDKType, QueryDelegatorDelegationsResponse, QueryDelegatorDelegationsResponseSDKType, QueryDelegatorUnbondingDelegationsRequest, QueryDelegatorUnbondingDelegationsRequestSDKType, QueryDelegatorUnbondingDelegationsResponse, QueryDelegatorUnbondingDelegationsResponseSDKType, QueryRedelegationsRequest, QueryRedelegationsRequestSDKType, QueryRedelegationsResponse, QueryRedelegationsResponseSDKType, QueryDelegatorValidatorsRequest, QueryDelegatorValidatorsRequestSDKType, QueryDelegatorValidatorsResponse, QueryDelegatorValidatorsResponseSDKType, QueryDelegatorValidatorRequest, QueryDelegatorValidatorRequestSDKType, QueryDelegatorValidatorResponse, QueryDelegatorValidatorResponseSDKType, QueryHistoricalInfoRequest, QueryHistoricalInfoRequestSDKType, QueryHistoricalInfoResponse, QueryHistoricalInfoResponseSDKType, QueryPoolRequest, QueryPoolRequestSDKType, QueryPoolResponse, QueryPoolResponseSDKType, QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType } from "./query.js"; /** Query defines the gRPC querier service. */ export interface Query { /** Validators queries all validators that match the given status. */ @@ -187,444 +184,4 @@ export const createRpcQueryExtension = (base: QueryClient) => { return queryService.params(request); } }; -}; -export interface UseValidatorsQuery extends VueQueryParams { - request: ReactiveQueryValidatorsRequest; -} -export interface UseValidatorQuery extends VueQueryParams { - request: ReactiveQueryValidatorRequest; -} -export interface UseValidatorDelegationsQuery extends VueQueryParams { - request: ReactiveQueryValidatorDelegationsRequest; -} -export interface UseValidatorUnbondingDelegationsQuery extends VueQueryParams { - request: ReactiveQueryValidatorUnbondingDelegationsRequest; -} -export interface UseDelegationQuery extends VueQueryParams { - request: ReactiveQueryDelegationRequest; -} -export interface UseUnbondingDelegationQuery extends VueQueryParams { - request: ReactiveQueryUnbondingDelegationRequest; -} -export interface UseDelegatorDelegationsQuery extends VueQueryParams { - request: ReactiveQueryDelegatorDelegationsRequest; -} -export interface UseDelegatorUnbondingDelegationsQuery extends VueQueryParams { - request: ReactiveQueryDelegatorUnbondingDelegationsRequest; -} -export interface UseRedelegationsQuery extends VueQueryParams { - request: ReactiveQueryRedelegationsRequest; -} -export interface UseDelegatorValidatorsQuery extends VueQueryParams { - request: ReactiveQueryDelegatorValidatorsRequest; -} -export interface UseDelegatorValidatorQuery extends VueQueryParams { - request: ReactiveQueryDelegatorValidatorRequest; -} -export interface UseHistoricalInfoQuery extends VueQueryParams { - request: ReactiveQueryHistoricalInfoRequest; -} -export interface UsePoolQuery extends VueQueryParams { - request?: ReactiveQueryPoolRequest; -} -export interface UseParamsQuery extends VueQueryParams { - request?: ReactiveQueryParamsRequest; -} -export const useQueryService = (rpc: Ref): ComputedRef => { - const _queryClients = new WeakMap(); - return computed(() => { - if (rpc.value) { - if (_queryClients.has(rpc.value)) { - return _queryClients.get(rpc.value); - } - const queryService = new QueryClientImpl(rpc.value); - _queryClients.set(rpc.value, queryService); - return queryService; - } - }); -}; -export const createRpcQueryHooks = (rpc: Ref) => { - const queryService = useQueryService(rpc); - const useValidators = ({ - request, - options - }: UseValidatorsQuery) => { - const queryKey = ["validatorsQuery", queryService]; - if (request) { - Object.values(request).forEach((val: any) => { - queryKey.push(val); - }); - } - return useQuery({ - queryKey, - queryFn: () => { - if (!queryService.value) throw new Error("Query Service not initialized"); - let params = ({} as any); - if (request) { - Object.entries(request).forEach(([key, val]) => { - params[key] = val.value; - }); - } - return queryService.value.validators(params); - }, - ...options - }); - }; - const useValidator = ({ - request, - options - }: UseValidatorQuery) => { - const queryKey = ["validatorQuery", queryService]; - if (request) { - Object.values(request).forEach((val: any) => { - queryKey.push(val); - }); - } - return useQuery({ - queryKey, - queryFn: () => { - if (!queryService.value) throw new Error("Query Service not initialized"); - let params = ({} as any); - if (request) { - Object.entries(request).forEach(([key, val]) => { - params[key] = val.value; - }); - } - return queryService.value.validator(params); - }, - ...options - }); - }; - const useValidatorDelegations = ({ - request, - options - }: UseValidatorDelegationsQuery) => { - const queryKey = ["validatorDelegationsQuery", queryService]; - if (request) { - Object.values(request).forEach((val: any) => { - queryKey.push(val); - }); - } - return useQuery({ - queryKey, - queryFn: () => { - if (!queryService.value) throw new Error("Query Service not initialized"); - let params = ({} as any); - if (request) { - Object.entries(request).forEach(([key, val]) => { - params[key] = val.value; - }); - } - return queryService.value.validatorDelegations(params); - }, - ...options - }); - }; - const useValidatorUnbondingDelegations = ({ - request, - options - }: UseValidatorUnbondingDelegationsQuery) => { - const queryKey = ["validatorUnbondingDelegationsQuery", queryService]; - if (request) { - Object.values(request).forEach((val: any) => { - queryKey.push(val); - }); - } - return useQuery({ - queryKey, - queryFn: () => { - if (!queryService.value) throw new Error("Query Service not initialized"); - let params = ({} as any); - if (request) { - Object.entries(request).forEach(([key, val]) => { - params[key] = val.value; - }); - } - return queryService.value.validatorUnbondingDelegations(params); - }, - ...options - }); - }; - const useDelegation = ({ - request, - options - }: UseDelegationQuery) => { - const queryKey = ["delegationQuery", queryService]; - if (request) { - Object.values(request).forEach((val: any) => { - queryKey.push(val); - }); - } - return useQuery({ - queryKey, - queryFn: () => { - if (!queryService.value) throw new Error("Query Service not initialized"); - let params = ({} as any); - if (request) { - Object.entries(request).forEach(([key, val]) => { - params[key] = val.value; - }); - } - return queryService.value.delegation(params); - }, - ...options - }); - }; - const useUnbondingDelegation = ({ - request, - options - }: UseUnbondingDelegationQuery) => { - const queryKey = ["unbondingDelegationQuery", queryService]; - if (request) { - Object.values(request).forEach((val: any) => { - queryKey.push(val); - }); - } - return useQuery({ - queryKey, - queryFn: () => { - if (!queryService.value) throw new Error("Query Service not initialized"); - let params = ({} as any); - if (request) { - Object.entries(request).forEach(([key, val]) => { - params[key] = val.value; - }); - } - return queryService.value.unbondingDelegation(params); - }, - ...options - }); - }; - const useDelegatorDelegations = ({ - request, - options - }: UseDelegatorDelegationsQuery) => { - const queryKey = ["delegatorDelegationsQuery", queryService]; - if (request) { - Object.values(request).forEach((val: any) => { - queryKey.push(val); - }); - } - return useQuery({ - queryKey, - queryFn: () => { - if (!queryService.value) throw new Error("Query Service not initialized"); - let params = ({} as any); - if (request) { - Object.entries(request).forEach(([key, val]) => { - params[key] = val.value; - }); - } - return queryService.value.delegatorDelegations(params); - }, - ...options - }); - }; - const useDelegatorUnbondingDelegations = ({ - request, - options - }: UseDelegatorUnbondingDelegationsQuery) => { - const queryKey = ["delegatorUnbondingDelegationsQuery", queryService]; - if (request) { - Object.values(request).forEach((val: any) => { - queryKey.push(val); - }); - } - return useQuery({ - queryKey, - queryFn: () => { - if (!queryService.value) throw new Error("Query Service not initialized"); - let params = ({} as any); - if (request) { - Object.entries(request).forEach(([key, val]) => { - params[key] = val.value; - }); - } - return queryService.value.delegatorUnbondingDelegations(params); - }, - ...options - }); - }; - const useRedelegations = ({ - request, - options - }: UseRedelegationsQuery) => { - const queryKey = ["redelegationsQuery", queryService]; - if (request) { - Object.values(request).forEach((val: any) => { - queryKey.push(val); - }); - } - return useQuery({ - queryKey, - queryFn: () => { - if (!queryService.value) throw new Error("Query Service not initialized"); - let params = ({} as any); - if (request) { - Object.entries(request).forEach(([key, val]) => { - params[key] = val.value; - }); - } - return queryService.value.redelegations(params); - }, - ...options - }); - }; - const useDelegatorValidators = ({ - request, - options - }: UseDelegatorValidatorsQuery) => { - const queryKey = ["delegatorValidatorsQuery", queryService]; - if (request) { - Object.values(request).forEach((val: any) => { - queryKey.push(val); - }); - } - return useQuery({ - queryKey, - queryFn: () => { - if (!queryService.value) throw new Error("Query Service not initialized"); - let params = ({} as any); - if (request) { - Object.entries(request).forEach(([key, val]) => { - params[key] = val.value; - }); - } - return queryService.value.delegatorValidators(params); - }, - ...options - }); - }; - const useDelegatorValidator = ({ - request, - options - }: UseDelegatorValidatorQuery) => { - const queryKey = ["delegatorValidatorQuery", queryService]; - if (request) { - Object.values(request).forEach((val: any) => { - queryKey.push(val); - }); - } - return useQuery({ - queryKey, - queryFn: () => { - if (!queryService.value) throw new Error("Query Service not initialized"); - let params = ({} as any); - if (request) { - Object.entries(request).forEach(([key, val]) => { - params[key] = val.value; - }); - } - return queryService.value.delegatorValidator(params); - }, - ...options - }); - }; - const useHistoricalInfo = ({ - request, - options - }: UseHistoricalInfoQuery) => { - const queryKey = ["historicalInfoQuery", queryService]; - if (request) { - Object.values(request).forEach((val: any) => { - queryKey.push(val); - }); - } - return useQuery({ - queryKey, - queryFn: () => { - if (!queryService.value) throw new Error("Query Service not initialized"); - let params = ({} as any); - if (request) { - Object.entries(request).forEach(([key, val]) => { - params[key] = val.value; - }); - } - return queryService.value.historicalInfo(params); - }, - ...options - }); - }; - const usePool = ({ - request, - options - }: UsePoolQuery) => { - const queryKey = ["poolQuery", queryService]; - if (request) { - Object.values(request).forEach((val: any) => { - queryKey.push(val); - }); - } - return useQuery({ - queryKey, - queryFn: () => { - if (!queryService.value) throw new Error("Query Service not initialized"); - let params = ({} as any); - if (request) { - Object.entries(request).forEach(([key, val]) => { - params[key] = val.value; - }); - } - return queryService.value.pool(params); - }, - ...options - }); - }; - const useParams = ({ - request, - options - }: UseParamsQuery) => { - const queryKey = ["paramsQuery", queryService]; - if (request) { - Object.values(request).forEach((val: any) => { - queryKey.push(val); - }); - } - return useQuery({ - queryKey, - queryFn: () => { - if (!queryService.value) throw new Error("Query Service not initialized"); - let params = ({} as any); - if (request) { - Object.entries(request).forEach(([key, val]) => { - params[key] = val.value; - }); - } - return queryService.value.params(params); - }, - ...options - }); - }; - return { - /** Validators queries all validators that match the given status. */useValidators, - /** Validator queries validator info for given validator address. */useValidator, - /** ValidatorDelegations queries delegate info for given validator. */useValidatorDelegations, - /** ValidatorUnbondingDelegations queries unbonding delegations of a validator. */useValidatorUnbondingDelegations, - /** Delegation queries delegate info for given validator delegator pair. */useDelegation, - /** - * UnbondingDelegation queries unbonding info for given validator delegator - * pair. - */ - useUnbondingDelegation, - /** DelegatorDelegations queries all delegations of a given delegator address. */useDelegatorDelegations, - /** - * DelegatorUnbondingDelegations queries all unbonding delegations of a given - * delegator address. - */ - useDelegatorUnbondingDelegations, - /** Redelegations queries redelegations of given address. */useRedelegations, - /** - * DelegatorValidators queries all validators info for given delegator - * address. - */ - useDelegatorValidators, - /** - * DelegatorValidator queries validator info for given delegator validator - * pair. - */ - useDelegatorValidator, - /** HistoricalInfo queries the historical info for given height. */useHistoricalInfo, - /** Pool queries the pool info. */usePool, - /** Parameters queries the staking parameters. */useParams - }; }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv4/cosmos/staking/v1beta1/query.ts b/__fixtures__/v-next/outputv4/cosmos/staking/v1beta1/query.ts index 8665874275..a89bebd5d4 100644 --- a/__fixtures__/v-next/outputv4/cosmos/staking/v1beta1/query.ts +++ b/__fixtures__/v-next/outputv4/cosmos/staking/v1beta1/query.ts @@ -1,9 +1,8 @@ -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 { JsonSafe } from "../../../json-safe"; -import { ComputedRef } from "vue"; +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../base/query/v1beta1/pagination.js"; +import { Validator, ValidatorSDKType, DelegationResponse, DelegationResponseSDKType, UnbondingDelegation, UnbondingDelegationSDKType, RedelegationResponse, RedelegationResponseSDKType, HistoricalInfo, HistoricalInfoSDKType, Pool, PoolSDKType, Params, ParamsSDKType } from "./staking.js"; +import { BinaryReader, BinaryWriter } from "../../../binary.js"; +import { isSet, DeepPartial } from "../../../helpers.js"; +import { JsonSafe } from "../../../json-safe.js"; export const protobufPackage = "cosmos.staking.v1beta1"; /** QueryValidatorsRequest is request type for Query/Validators RPC method. */ export interface QueryValidatorsRequest { @@ -12,10 +11,6 @@ export interface QueryValidatorsRequest { /** pagination defines an optional pagination for the request. */ pagination?: PageRequest; } -export interface ReactiveQueryValidatorsRequest { - status: ComputedRef; - pagination?: ComputedRef; -} export interface QueryValidatorsRequestProtoMsg { typeUrl: "/cosmos.staking.v1beta1.QueryValidatorsRequest"; value: Uint8Array; @@ -32,10 +27,6 @@ export interface QueryValidatorsResponse { /** pagination defines the pagination in the response. */ pagination?: PageResponse; } -export interface ReactiveQueryValidatorsResponse { - validators: ComputedRef; - pagination?: ComputedRef; -} export interface QueryValidatorsResponseProtoMsg { typeUrl: "/cosmos.staking.v1beta1.QueryValidatorsResponse"; value: Uint8Array; @@ -50,9 +41,6 @@ export interface QueryValidatorRequest { /** validator_addr defines the validator address to query for. */ validatorAddr: string; } -export interface ReactiveQueryValidatorRequest { - validatorAddr: ComputedRef; -} export interface QueryValidatorRequestProtoMsg { typeUrl: "/cosmos.staking.v1beta1.QueryValidatorRequest"; value: Uint8Array; @@ -66,9 +54,6 @@ export interface QueryValidatorResponse { /** validator defines the the validator info. */ validator: Validator; } -export interface ReactiveQueryValidatorResponse { - validator: ComputedRef; -} export interface QueryValidatorResponseProtoMsg { typeUrl: "/cosmos.staking.v1beta1.QueryValidatorResponse"; value: Uint8Array; @@ -87,10 +72,6 @@ export interface QueryValidatorDelegationsRequest { /** pagination defines an optional pagination for the request. */ pagination?: PageRequest; } -export interface ReactiveQueryValidatorDelegationsRequest { - validatorAddr: ComputedRef; - pagination?: ComputedRef; -} export interface QueryValidatorDelegationsRequestProtoMsg { typeUrl: "/cosmos.staking.v1beta1.QueryValidatorDelegationsRequest"; value: Uint8Array; @@ -112,10 +93,6 @@ export interface QueryValidatorDelegationsResponse { /** pagination defines the pagination in the response. */ pagination?: PageResponse; } -export interface ReactiveQueryValidatorDelegationsResponse { - delegationResponses: ComputedRef; - pagination?: ComputedRef; -} export interface QueryValidatorDelegationsResponseProtoMsg { typeUrl: "/cosmos.staking.v1beta1.QueryValidatorDelegationsResponse"; value: Uint8Array; @@ -138,10 +115,6 @@ export interface QueryValidatorUnbondingDelegationsRequest { /** pagination defines an optional pagination for the request. */ pagination?: PageRequest; } -export interface ReactiveQueryValidatorUnbondingDelegationsRequest { - validatorAddr: ComputedRef; - pagination?: ComputedRef; -} export interface QueryValidatorUnbondingDelegationsRequestProtoMsg { typeUrl: "/cosmos.staking.v1beta1.QueryValidatorUnbondingDelegationsRequest"; value: Uint8Array; @@ -163,10 +136,6 @@ export interface QueryValidatorUnbondingDelegationsResponse { /** pagination defines the pagination in the response. */ pagination?: PageResponse; } -export interface ReactiveQueryValidatorUnbondingDelegationsResponse { - unbondingResponses: ComputedRef; - pagination?: ComputedRef; -} export interface QueryValidatorUnbondingDelegationsResponseProtoMsg { typeUrl: "/cosmos.staking.v1beta1.QueryValidatorUnbondingDelegationsResponse"; value: Uint8Array; @@ -186,10 +155,6 @@ export interface QueryDelegationRequest { /** validator_addr defines the validator address to query for. */ validatorAddr: string; } -export interface ReactiveQueryDelegationRequest { - delegatorAddr: ComputedRef; - validatorAddr: ComputedRef; -} export interface QueryDelegationRequestProtoMsg { typeUrl: "/cosmos.staking.v1beta1.QueryDelegationRequest"; value: Uint8Array; @@ -204,9 +169,6 @@ export interface QueryDelegationResponse { /** delegation_responses defines the delegation info of a delegation. */ delegationResponse?: DelegationResponse; } -export interface ReactiveQueryDelegationResponse { - delegationResponse?: ComputedRef; -} export interface QueryDelegationResponseProtoMsg { typeUrl: "/cosmos.staking.v1beta1.QueryDelegationResponse"; value: Uint8Array; @@ -225,10 +187,6 @@ export interface QueryUnbondingDelegationRequest { /** validator_addr defines the validator address to query for. */ validatorAddr: string; } -export interface ReactiveQueryUnbondingDelegationRequest { - delegatorAddr: ComputedRef; - validatorAddr: ComputedRef; -} export interface QueryUnbondingDelegationRequestProtoMsg { typeUrl: "/cosmos.staking.v1beta1.QueryUnbondingDelegationRequest"; value: Uint8Array; @@ -249,9 +207,6 @@ export interface QueryUnbondingDelegationResponse { /** unbond defines the unbonding information of a delegation. */ unbond: UnbondingDelegation; } -export interface ReactiveQueryUnbondingDelegationResponse { - unbond: ComputedRef; -} export interface QueryUnbondingDelegationResponseProtoMsg { typeUrl: "/cosmos.staking.v1beta1.QueryUnbondingDelegationResponse"; value: Uint8Array; @@ -273,10 +228,6 @@ export interface QueryDelegatorDelegationsRequest { /** pagination defines an optional pagination for the request. */ pagination?: PageRequest; } -export interface ReactiveQueryDelegatorDelegationsRequest { - delegatorAddr: ComputedRef; - pagination?: ComputedRef; -} export interface QueryDelegatorDelegationsRequestProtoMsg { typeUrl: "/cosmos.staking.v1beta1.QueryDelegatorDelegationsRequest"; value: Uint8Array; @@ -299,10 +250,6 @@ export interface QueryDelegatorDelegationsResponse { /** pagination defines the pagination in the response. */ pagination?: PageResponse; } -export interface ReactiveQueryDelegatorDelegationsResponse { - delegationResponses: ComputedRef; - pagination?: ComputedRef; -} export interface QueryDelegatorDelegationsResponseProtoMsg { typeUrl: "/cosmos.staking.v1beta1.QueryDelegatorDelegationsResponse"; value: Uint8Array; @@ -325,10 +272,6 @@ export interface QueryDelegatorUnbondingDelegationsRequest { /** pagination defines an optional pagination for the request. */ pagination?: PageRequest; } -export interface ReactiveQueryDelegatorUnbondingDelegationsRequest { - delegatorAddr: ComputedRef; - pagination?: ComputedRef; -} export interface QueryDelegatorUnbondingDelegationsRequestProtoMsg { typeUrl: "/cosmos.staking.v1beta1.QueryDelegatorUnbondingDelegationsRequest"; value: Uint8Array; @@ -350,10 +293,6 @@ export interface QueryDelegatorUnbondingDelegationsResponse { /** pagination defines the pagination in the response. */ pagination?: PageResponse; } -export interface ReactiveQueryDelegatorUnbondingDelegationsResponse { - unbondingResponses: ComputedRef; - pagination?: ComputedRef; -} export interface QueryDelegatorUnbondingDelegationsResponseProtoMsg { typeUrl: "/cosmos.staking.v1beta1.QueryDelegatorUnbondingDelegationsResponse"; value: Uint8Array; @@ -380,12 +319,6 @@ export interface QueryRedelegationsRequest { /** pagination defines an optional pagination for the request. */ pagination?: PageRequest; } -export interface ReactiveQueryRedelegationsRequest { - delegatorAddr: ComputedRef; - srcValidatorAddr: ComputedRef; - dstValidatorAddr: ComputedRef; - pagination?: ComputedRef; -} export interface QueryRedelegationsRequestProtoMsg { typeUrl: "/cosmos.staking.v1beta1.QueryRedelegationsRequest"; value: Uint8Array; @@ -409,10 +342,6 @@ export interface QueryRedelegationsResponse { /** pagination defines the pagination in the response. */ pagination?: PageResponse; } -export interface ReactiveQueryRedelegationsResponse { - redelegationResponses: ComputedRef; - pagination?: ComputedRef; -} export interface QueryRedelegationsResponseProtoMsg { typeUrl: "/cosmos.staking.v1beta1.QueryRedelegationsResponse"; value: Uint8Array; @@ -435,10 +364,6 @@ export interface QueryDelegatorValidatorsRequest { /** pagination defines an optional pagination for the request. */ pagination?: PageRequest; } -export interface ReactiveQueryDelegatorValidatorsRequest { - delegatorAddr: ComputedRef; - pagination?: ComputedRef; -} export interface QueryDelegatorValidatorsRequestProtoMsg { typeUrl: "/cosmos.staking.v1beta1.QueryDelegatorValidatorsRequest"; value: Uint8Array; @@ -461,10 +386,6 @@ export interface QueryDelegatorValidatorsResponse { /** pagination defines the pagination in the response. */ pagination?: PageResponse; } -export interface ReactiveQueryDelegatorValidatorsResponse { - validators: ComputedRef; - pagination?: ComputedRef; -} export interface QueryDelegatorValidatorsResponseProtoMsg { typeUrl: "/cosmos.staking.v1beta1.QueryDelegatorValidatorsResponse"; value: Uint8Array; @@ -487,10 +408,6 @@ export interface QueryDelegatorValidatorRequest { /** validator_addr defines the validator address to query for. */ validatorAddr: string; } -export interface ReactiveQueryDelegatorValidatorRequest { - delegatorAddr: ComputedRef; - validatorAddr: ComputedRef; -} export interface QueryDelegatorValidatorRequestProtoMsg { typeUrl: "/cosmos.staking.v1beta1.QueryDelegatorValidatorRequest"; value: Uint8Array; @@ -511,9 +428,6 @@ export interface QueryDelegatorValidatorResponse { /** validator defines the the validator info. */ validator: Validator; } -export interface ReactiveQueryDelegatorValidatorResponse { - validator: ComputedRef; -} export interface QueryDelegatorValidatorResponseProtoMsg { typeUrl: "/cosmos.staking.v1beta1.QueryDelegatorValidatorResponse"; value: Uint8Array; @@ -533,9 +447,6 @@ export interface QueryHistoricalInfoRequest { /** height defines at which height to query the historical info. */ height: bigint; } -export interface ReactiveQueryHistoricalInfoRequest { - height: ComputedRef; -} export interface QueryHistoricalInfoRequestProtoMsg { typeUrl: "/cosmos.staking.v1beta1.QueryHistoricalInfoRequest"; value: Uint8Array; @@ -555,9 +466,6 @@ export interface QueryHistoricalInfoResponse { /** hist defines the historical info at the given height. */ hist?: HistoricalInfo; } -export interface ReactiveQueryHistoricalInfoResponse { - hist?: ComputedRef; -} export interface QueryHistoricalInfoResponseProtoMsg { typeUrl: "/cosmos.staking.v1beta1.QueryHistoricalInfoResponse"; value: Uint8Array; @@ -571,7 +479,6 @@ export interface QueryHistoricalInfoResponseSDKType { } /** QueryPoolRequest is request type for the Query/Pool RPC method. */ export interface QueryPoolRequest {} -export interface ReactiveQueryPoolRequest {} export interface QueryPoolRequestProtoMsg { typeUrl: "/cosmos.staking.v1beta1.QueryPoolRequest"; value: Uint8Array; @@ -583,9 +490,6 @@ export interface QueryPoolResponse { /** pool defines the pool info. */ pool: Pool; } -export interface ReactiveQueryPoolResponse { - pool: ComputedRef; -} export interface QueryPoolResponseProtoMsg { typeUrl: "/cosmos.staking.v1beta1.QueryPoolResponse"; value: Uint8Array; @@ -596,7 +500,6 @@ export interface QueryPoolResponseSDKType { } /** QueryParamsRequest is request type for the Query/Params RPC method. */ export interface QueryParamsRequest {} -export interface ReactiveQueryParamsRequest {} export interface QueryParamsRequestProtoMsg { typeUrl: "/cosmos.staking.v1beta1.QueryParamsRequest"; value: Uint8Array; @@ -608,9 +511,6 @@ export interface QueryParamsResponse { /** params holds all the parameters of this module. */ params: Params; } -export interface ReactiveQueryParamsResponse { - params: ComputedRef; -} export interface QueryParamsResponseProtoMsg { typeUrl: "/cosmos.staking.v1beta1.QueryParamsResponse"; value: Uint8Array; @@ -628,7 +528,7 @@ function createBaseQueryValidatorsRequest(): QueryValidatorsRequest { export const QueryValidatorsRequest = { typeUrl: "/cosmos.staking.v1beta1.QueryValidatorsRequest", encode(message: QueryValidatorsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.status !== "") { + if (message.status !== undefined) { writer.uint32(10).string(message.status); } if (message.pagination !== undefined) { @@ -657,10 +557,10 @@ export const QueryValidatorsRequest = { return message; }, fromJSON(object: any): QueryValidatorsRequest { - return { - status: isSet(object.status) ? String(object.status) : "", - pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined - }; + const obj = createBaseQueryValidatorsRequest(); + if (isSet(object.status)) obj.status = String(object.status); + if (isSet(object.pagination)) obj.pagination = PageRequest.fromJSON(object.pagination); + return obj; }, toJSON(message: QueryValidatorsRequest): JsonSafe { const obj: any = {}; @@ -671,7 +571,9 @@ export const QueryValidatorsRequest = { fromPartial(object: DeepPartial): QueryValidatorsRequest { const message = createBaseQueryValidatorsRequest(); message.status = object.status ?? ""; - message.pagination = object.pagination !== undefined && object.pagination !== null ? PageRequest.fromPartial(object.pagination) : undefined; + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageRequest.fromPartial(object.pagination); + } return message; }, fromSDK(object: QueryValidatorsRequestSDKType): QueryValidatorsRequest { @@ -768,10 +670,10 @@ export const QueryValidatorsResponse = { return message; }, fromJSON(object: any): QueryValidatorsResponse { - return { - validators: Array.isArray(object?.validators) ? object.validators.map((e: any) => Validator.fromJSON(e)) : [], - pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined - }; + const obj = createBaseQueryValidatorsResponse(); + if (Array.isArray(object?.validators)) obj.validators = object.validators.map((e: any) => Validator.fromJSON(e)); + if (isSet(object.pagination)) obj.pagination = PageResponse.fromJSON(object.pagination); + return obj; }, toJSON(message: QueryValidatorsResponse): JsonSafe { const obj: any = {}; @@ -786,7 +688,9 @@ export const QueryValidatorsResponse = { fromPartial(object: DeepPartial): QueryValidatorsResponse { const message = createBaseQueryValidatorsResponse(); message.validators = object.validators?.map(e => Validator.fromPartial(e)) || []; - message.pagination = object.pagination !== undefined && object.pagination !== null ? PageResponse.fromPartial(object.pagination) : undefined; + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageResponse.fromPartial(object.pagination); + } return message; }, fromSDK(object: QueryValidatorsResponseSDKType): QueryValidatorsResponse { @@ -859,7 +763,7 @@ function createBaseQueryValidatorRequest(): QueryValidatorRequest { export const QueryValidatorRequest = { typeUrl: "/cosmos.staking.v1beta1.QueryValidatorRequest", encode(message: QueryValidatorRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.validatorAddr !== "") { + if (message.validatorAddr !== undefined) { writer.uint32(10).string(message.validatorAddr); } return writer; @@ -882,9 +786,9 @@ export const QueryValidatorRequest = { return message; }, fromJSON(object: any): QueryValidatorRequest { - return { - validatorAddr: isSet(object.validatorAddr) ? String(object.validatorAddr) : "" - }; + const obj = createBaseQueryValidatorRequest(); + if (isSet(object.validatorAddr)) obj.validatorAddr = String(object.validatorAddr); + return obj; }, toJSON(message: QueryValidatorRequest): JsonSafe { const obj: any = {}; @@ -976,9 +880,9 @@ export const QueryValidatorResponse = { return message; }, fromJSON(object: any): QueryValidatorResponse { - return { - validator: isSet(object.validator) ? Validator.fromJSON(object.validator) : undefined - }; + const obj = createBaseQueryValidatorResponse(); + if (isSet(object.validator)) obj.validator = Validator.fromJSON(object.validator); + return obj; }, toJSON(message: QueryValidatorResponse): JsonSafe { const obj: any = {}; @@ -987,7 +891,9 @@ export const QueryValidatorResponse = { }, fromPartial(object: DeepPartial): QueryValidatorResponse { const message = createBaseQueryValidatorResponse(); - message.validator = object.validator !== undefined && object.validator !== null ? Validator.fromPartial(object.validator) : undefined; + if (object.validator !== undefined && object.validator !== null) { + message.validator = Validator.fromPartial(object.validator); + } return message; }, fromSDK(object: QueryValidatorResponseSDKType): QueryValidatorResponse { @@ -1048,7 +954,7 @@ function createBaseQueryValidatorDelegationsRequest(): QueryValidatorDelegations export const QueryValidatorDelegationsRequest = { typeUrl: "/cosmos.staking.v1beta1.QueryValidatorDelegationsRequest", encode(message: QueryValidatorDelegationsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.validatorAddr !== "") { + if (message.validatorAddr !== undefined) { writer.uint32(10).string(message.validatorAddr); } if (message.pagination !== undefined) { @@ -1077,10 +983,10 @@ export const QueryValidatorDelegationsRequest = { return message; }, fromJSON(object: any): QueryValidatorDelegationsRequest { - return { - validatorAddr: isSet(object.validatorAddr) ? String(object.validatorAddr) : "", - pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined - }; + const obj = createBaseQueryValidatorDelegationsRequest(); + if (isSet(object.validatorAddr)) obj.validatorAddr = String(object.validatorAddr); + if (isSet(object.pagination)) obj.pagination = PageRequest.fromJSON(object.pagination); + return obj; }, toJSON(message: QueryValidatorDelegationsRequest): JsonSafe { const obj: any = {}; @@ -1091,7 +997,9 @@ export const QueryValidatorDelegationsRequest = { fromPartial(object: DeepPartial): QueryValidatorDelegationsRequest { const message = createBaseQueryValidatorDelegationsRequest(); message.validatorAddr = object.validatorAddr ?? ""; - message.pagination = object.pagination !== undefined && object.pagination !== null ? PageRequest.fromPartial(object.pagination) : undefined; + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageRequest.fromPartial(object.pagination); + } return message; }, fromSDK(object: QueryValidatorDelegationsRequestSDKType): QueryValidatorDelegationsRequest { @@ -1188,10 +1096,10 @@ export const QueryValidatorDelegationsResponse = { return message; }, fromJSON(object: any): QueryValidatorDelegationsResponse { - return { - delegationResponses: Array.isArray(object?.delegationResponses) ? object.delegationResponses.map((e: any) => DelegationResponse.fromJSON(e)) : [], - pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined - }; + const obj = createBaseQueryValidatorDelegationsResponse(); + if (Array.isArray(object?.delegationResponses)) obj.delegationResponses = object.delegationResponses.map((e: any) => DelegationResponse.fromJSON(e)); + if (isSet(object.pagination)) obj.pagination = PageResponse.fromJSON(object.pagination); + return obj; }, toJSON(message: QueryValidatorDelegationsResponse): JsonSafe { const obj: any = {}; @@ -1206,7 +1114,9 @@ export const QueryValidatorDelegationsResponse = { fromPartial(object: DeepPartial): QueryValidatorDelegationsResponse { const message = createBaseQueryValidatorDelegationsResponse(); message.delegationResponses = object.delegationResponses?.map(e => DelegationResponse.fromPartial(e)) || []; - message.pagination = object.pagination !== undefined && object.pagination !== null ? PageResponse.fromPartial(object.pagination) : undefined; + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageResponse.fromPartial(object.pagination); + } return message; }, fromSDK(object: QueryValidatorDelegationsResponseSDKType): QueryValidatorDelegationsResponse { @@ -1280,7 +1190,7 @@ function createBaseQueryValidatorUnbondingDelegationsRequest(): QueryValidatorUn export const QueryValidatorUnbondingDelegationsRequest = { typeUrl: "/cosmos.staking.v1beta1.QueryValidatorUnbondingDelegationsRequest", encode(message: QueryValidatorUnbondingDelegationsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.validatorAddr !== "") { + if (message.validatorAddr !== undefined) { writer.uint32(10).string(message.validatorAddr); } if (message.pagination !== undefined) { @@ -1309,10 +1219,10 @@ export const QueryValidatorUnbondingDelegationsRequest = { return message; }, fromJSON(object: any): QueryValidatorUnbondingDelegationsRequest { - return { - validatorAddr: isSet(object.validatorAddr) ? String(object.validatorAddr) : "", - pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined - }; + const obj = createBaseQueryValidatorUnbondingDelegationsRequest(); + if (isSet(object.validatorAddr)) obj.validatorAddr = String(object.validatorAddr); + if (isSet(object.pagination)) obj.pagination = PageRequest.fromJSON(object.pagination); + return obj; }, toJSON(message: QueryValidatorUnbondingDelegationsRequest): JsonSafe { const obj: any = {}; @@ -1323,7 +1233,9 @@ export const QueryValidatorUnbondingDelegationsRequest = { fromPartial(object: DeepPartial): QueryValidatorUnbondingDelegationsRequest { const message = createBaseQueryValidatorUnbondingDelegationsRequest(); message.validatorAddr = object.validatorAddr ?? ""; - message.pagination = object.pagination !== undefined && object.pagination !== null ? PageRequest.fromPartial(object.pagination) : undefined; + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageRequest.fromPartial(object.pagination); + } return message; }, fromSDK(object: QueryValidatorUnbondingDelegationsRequestSDKType): QueryValidatorUnbondingDelegationsRequest { @@ -1420,10 +1332,10 @@ export const QueryValidatorUnbondingDelegationsResponse = { return message; }, fromJSON(object: any): QueryValidatorUnbondingDelegationsResponse { - return { - unbondingResponses: Array.isArray(object?.unbondingResponses) ? object.unbondingResponses.map((e: any) => UnbondingDelegation.fromJSON(e)) : [], - pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined - }; + const obj = createBaseQueryValidatorUnbondingDelegationsResponse(); + if (Array.isArray(object?.unbondingResponses)) obj.unbondingResponses = object.unbondingResponses.map((e: any) => UnbondingDelegation.fromJSON(e)); + if (isSet(object.pagination)) obj.pagination = PageResponse.fromJSON(object.pagination); + return obj; }, toJSON(message: QueryValidatorUnbondingDelegationsResponse): JsonSafe { const obj: any = {}; @@ -1438,7 +1350,9 @@ export const QueryValidatorUnbondingDelegationsResponse = { fromPartial(object: DeepPartial): QueryValidatorUnbondingDelegationsResponse { const message = createBaseQueryValidatorUnbondingDelegationsResponse(); message.unbondingResponses = object.unbondingResponses?.map(e => UnbondingDelegation.fromPartial(e)) || []; - message.pagination = object.pagination !== undefined && object.pagination !== null ? PageResponse.fromPartial(object.pagination) : undefined; + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageResponse.fromPartial(object.pagination); + } return message; }, fromSDK(object: QueryValidatorUnbondingDelegationsResponseSDKType): QueryValidatorUnbondingDelegationsResponse { @@ -1512,10 +1426,10 @@ function createBaseQueryDelegationRequest(): QueryDelegationRequest { export const QueryDelegationRequest = { typeUrl: "/cosmos.staking.v1beta1.QueryDelegationRequest", encode(message: QueryDelegationRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.delegatorAddr !== "") { + if (message.delegatorAddr !== undefined) { writer.uint32(10).string(message.delegatorAddr); } - if (message.validatorAddr !== "") { + if (message.validatorAddr !== undefined) { writer.uint32(18).string(message.validatorAddr); } return writer; @@ -1541,10 +1455,10 @@ export const QueryDelegationRequest = { return message; }, fromJSON(object: any): QueryDelegationRequest { - return { - delegatorAddr: isSet(object.delegatorAddr) ? String(object.delegatorAddr) : "", - validatorAddr: isSet(object.validatorAddr) ? String(object.validatorAddr) : "" - }; + const obj = createBaseQueryDelegationRequest(); + if (isSet(object.delegatorAddr)) obj.delegatorAddr = String(object.delegatorAddr); + if (isSet(object.validatorAddr)) obj.validatorAddr = String(object.validatorAddr); + return obj; }, toJSON(message: QueryDelegationRequest): JsonSafe { const obj: any = {}; @@ -1645,9 +1559,9 @@ export const QueryDelegationResponse = { return message; }, fromJSON(object: any): QueryDelegationResponse { - return { - delegationResponse: isSet(object.delegationResponse) ? DelegationResponse.fromJSON(object.delegationResponse) : undefined - }; + const obj = createBaseQueryDelegationResponse(); + if (isSet(object.delegationResponse)) obj.delegationResponse = DelegationResponse.fromJSON(object.delegationResponse); + return obj; }, toJSON(message: QueryDelegationResponse): JsonSafe { const obj: any = {}; @@ -1656,7 +1570,9 @@ export const QueryDelegationResponse = { }, fromPartial(object: DeepPartial): QueryDelegationResponse { const message = createBaseQueryDelegationResponse(); - message.delegationResponse = object.delegationResponse !== undefined && object.delegationResponse !== null ? DelegationResponse.fromPartial(object.delegationResponse) : undefined; + if (object.delegationResponse !== undefined && object.delegationResponse !== null) { + message.delegationResponse = DelegationResponse.fromPartial(object.delegationResponse); + } return message; }, fromSDK(object: QueryDelegationResponseSDKType): QueryDelegationResponse { @@ -1717,10 +1633,10 @@ function createBaseQueryUnbondingDelegationRequest(): QueryUnbondingDelegationRe export const QueryUnbondingDelegationRequest = { typeUrl: "/cosmos.staking.v1beta1.QueryUnbondingDelegationRequest", encode(message: QueryUnbondingDelegationRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.delegatorAddr !== "") { + if (message.delegatorAddr !== undefined) { writer.uint32(10).string(message.delegatorAddr); } - if (message.validatorAddr !== "") { + if (message.validatorAddr !== undefined) { writer.uint32(18).string(message.validatorAddr); } return writer; @@ -1746,10 +1662,10 @@ export const QueryUnbondingDelegationRequest = { return message; }, fromJSON(object: any): QueryUnbondingDelegationRequest { - return { - delegatorAddr: isSet(object.delegatorAddr) ? String(object.delegatorAddr) : "", - validatorAddr: isSet(object.validatorAddr) ? String(object.validatorAddr) : "" - }; + const obj = createBaseQueryUnbondingDelegationRequest(); + if (isSet(object.delegatorAddr)) obj.delegatorAddr = String(object.delegatorAddr); + if (isSet(object.validatorAddr)) obj.validatorAddr = String(object.validatorAddr); + return obj; }, toJSON(message: QueryUnbondingDelegationRequest): JsonSafe { const obj: any = {}; @@ -1850,9 +1766,9 @@ export const QueryUnbondingDelegationResponse = { return message; }, fromJSON(object: any): QueryUnbondingDelegationResponse { - return { - unbond: isSet(object.unbond) ? UnbondingDelegation.fromJSON(object.unbond) : undefined - }; + const obj = createBaseQueryUnbondingDelegationResponse(); + if (isSet(object.unbond)) obj.unbond = UnbondingDelegation.fromJSON(object.unbond); + return obj; }, toJSON(message: QueryUnbondingDelegationResponse): JsonSafe { const obj: any = {}; @@ -1861,7 +1777,9 @@ export const QueryUnbondingDelegationResponse = { }, fromPartial(object: DeepPartial): QueryUnbondingDelegationResponse { const message = createBaseQueryUnbondingDelegationResponse(); - message.unbond = object.unbond !== undefined && object.unbond !== null ? UnbondingDelegation.fromPartial(object.unbond) : undefined; + if (object.unbond !== undefined && object.unbond !== null) { + message.unbond = UnbondingDelegation.fromPartial(object.unbond); + } return message; }, fromSDK(object: QueryUnbondingDelegationResponseSDKType): QueryUnbondingDelegationResponse { @@ -1922,7 +1840,7 @@ function createBaseQueryDelegatorDelegationsRequest(): QueryDelegatorDelegations export const QueryDelegatorDelegationsRequest = { typeUrl: "/cosmos.staking.v1beta1.QueryDelegatorDelegationsRequest", encode(message: QueryDelegatorDelegationsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.delegatorAddr !== "") { + if (message.delegatorAddr !== undefined) { writer.uint32(10).string(message.delegatorAddr); } if (message.pagination !== undefined) { @@ -1951,10 +1869,10 @@ export const QueryDelegatorDelegationsRequest = { return message; }, fromJSON(object: any): QueryDelegatorDelegationsRequest { - return { - delegatorAddr: isSet(object.delegatorAddr) ? String(object.delegatorAddr) : "", - pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined - }; + const obj = createBaseQueryDelegatorDelegationsRequest(); + if (isSet(object.delegatorAddr)) obj.delegatorAddr = String(object.delegatorAddr); + if (isSet(object.pagination)) obj.pagination = PageRequest.fromJSON(object.pagination); + return obj; }, toJSON(message: QueryDelegatorDelegationsRequest): JsonSafe { const obj: any = {}; @@ -1965,7 +1883,9 @@ export const QueryDelegatorDelegationsRequest = { fromPartial(object: DeepPartial): QueryDelegatorDelegationsRequest { const message = createBaseQueryDelegatorDelegationsRequest(); message.delegatorAddr = object.delegatorAddr ?? ""; - message.pagination = object.pagination !== undefined && object.pagination !== null ? PageRequest.fromPartial(object.pagination) : undefined; + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageRequest.fromPartial(object.pagination); + } return message; }, fromSDK(object: QueryDelegatorDelegationsRequestSDKType): QueryDelegatorDelegationsRequest { @@ -2062,10 +1982,10 @@ export const QueryDelegatorDelegationsResponse = { return message; }, fromJSON(object: any): QueryDelegatorDelegationsResponse { - return { - delegationResponses: Array.isArray(object?.delegationResponses) ? object.delegationResponses.map((e: any) => DelegationResponse.fromJSON(e)) : [], - pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined - }; + const obj = createBaseQueryDelegatorDelegationsResponse(); + if (Array.isArray(object?.delegationResponses)) obj.delegationResponses = object.delegationResponses.map((e: any) => DelegationResponse.fromJSON(e)); + if (isSet(object.pagination)) obj.pagination = PageResponse.fromJSON(object.pagination); + return obj; }, toJSON(message: QueryDelegatorDelegationsResponse): JsonSafe { const obj: any = {}; @@ -2080,7 +2000,9 @@ export const QueryDelegatorDelegationsResponse = { fromPartial(object: DeepPartial): QueryDelegatorDelegationsResponse { const message = createBaseQueryDelegatorDelegationsResponse(); message.delegationResponses = object.delegationResponses?.map(e => DelegationResponse.fromPartial(e)) || []; - message.pagination = object.pagination !== undefined && object.pagination !== null ? PageResponse.fromPartial(object.pagination) : undefined; + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageResponse.fromPartial(object.pagination); + } return message; }, fromSDK(object: QueryDelegatorDelegationsResponseSDKType): QueryDelegatorDelegationsResponse { @@ -2154,7 +2076,7 @@ function createBaseQueryDelegatorUnbondingDelegationsRequest(): QueryDelegatorUn export const QueryDelegatorUnbondingDelegationsRequest = { typeUrl: "/cosmos.staking.v1beta1.QueryDelegatorUnbondingDelegationsRequest", encode(message: QueryDelegatorUnbondingDelegationsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.delegatorAddr !== "") { + if (message.delegatorAddr !== undefined) { writer.uint32(10).string(message.delegatorAddr); } if (message.pagination !== undefined) { @@ -2183,10 +2105,10 @@ export const QueryDelegatorUnbondingDelegationsRequest = { return message; }, fromJSON(object: any): QueryDelegatorUnbondingDelegationsRequest { - return { - delegatorAddr: isSet(object.delegatorAddr) ? String(object.delegatorAddr) : "", - pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined - }; + const obj = createBaseQueryDelegatorUnbondingDelegationsRequest(); + if (isSet(object.delegatorAddr)) obj.delegatorAddr = String(object.delegatorAddr); + if (isSet(object.pagination)) obj.pagination = PageRequest.fromJSON(object.pagination); + return obj; }, toJSON(message: QueryDelegatorUnbondingDelegationsRequest): JsonSafe { const obj: any = {}; @@ -2197,7 +2119,9 @@ export const QueryDelegatorUnbondingDelegationsRequest = { fromPartial(object: DeepPartial): QueryDelegatorUnbondingDelegationsRequest { const message = createBaseQueryDelegatorUnbondingDelegationsRequest(); message.delegatorAddr = object.delegatorAddr ?? ""; - message.pagination = object.pagination !== undefined && object.pagination !== null ? PageRequest.fromPartial(object.pagination) : undefined; + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageRequest.fromPartial(object.pagination); + } return message; }, fromSDK(object: QueryDelegatorUnbondingDelegationsRequestSDKType): QueryDelegatorUnbondingDelegationsRequest { @@ -2294,10 +2218,10 @@ export const QueryDelegatorUnbondingDelegationsResponse = { return message; }, fromJSON(object: any): QueryDelegatorUnbondingDelegationsResponse { - return { - unbondingResponses: Array.isArray(object?.unbondingResponses) ? object.unbondingResponses.map((e: any) => UnbondingDelegation.fromJSON(e)) : [], - pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined - }; + const obj = createBaseQueryDelegatorUnbondingDelegationsResponse(); + if (Array.isArray(object?.unbondingResponses)) obj.unbondingResponses = object.unbondingResponses.map((e: any) => UnbondingDelegation.fromJSON(e)); + if (isSet(object.pagination)) obj.pagination = PageResponse.fromJSON(object.pagination); + return obj; }, toJSON(message: QueryDelegatorUnbondingDelegationsResponse): JsonSafe { const obj: any = {}; @@ -2312,7 +2236,9 @@ export const QueryDelegatorUnbondingDelegationsResponse = { fromPartial(object: DeepPartial): QueryDelegatorUnbondingDelegationsResponse { const message = createBaseQueryDelegatorUnbondingDelegationsResponse(); message.unbondingResponses = object.unbondingResponses?.map(e => UnbondingDelegation.fromPartial(e)) || []; - message.pagination = object.pagination !== undefined && object.pagination !== null ? PageResponse.fromPartial(object.pagination) : undefined; + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageResponse.fromPartial(object.pagination); + } return message; }, fromSDK(object: QueryDelegatorUnbondingDelegationsResponseSDKType): QueryDelegatorUnbondingDelegationsResponse { @@ -2388,13 +2314,13 @@ function createBaseQueryRedelegationsRequest(): QueryRedelegationsRequest { export const QueryRedelegationsRequest = { typeUrl: "/cosmos.staking.v1beta1.QueryRedelegationsRequest", encode(message: QueryRedelegationsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.delegatorAddr !== "") { + if (message.delegatorAddr !== undefined) { writer.uint32(10).string(message.delegatorAddr); } - if (message.srcValidatorAddr !== "") { + if (message.srcValidatorAddr !== undefined) { writer.uint32(18).string(message.srcValidatorAddr); } - if (message.dstValidatorAddr !== "") { + if (message.dstValidatorAddr !== undefined) { writer.uint32(26).string(message.dstValidatorAddr); } if (message.pagination !== undefined) { @@ -2429,12 +2355,12 @@ export const QueryRedelegationsRequest = { return message; }, fromJSON(object: any): QueryRedelegationsRequest { - return { - delegatorAddr: isSet(object.delegatorAddr) ? String(object.delegatorAddr) : "", - srcValidatorAddr: isSet(object.srcValidatorAddr) ? String(object.srcValidatorAddr) : "", - dstValidatorAddr: isSet(object.dstValidatorAddr) ? String(object.dstValidatorAddr) : "", - pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined - }; + const obj = createBaseQueryRedelegationsRequest(); + if (isSet(object.delegatorAddr)) obj.delegatorAddr = String(object.delegatorAddr); + if (isSet(object.srcValidatorAddr)) obj.srcValidatorAddr = String(object.srcValidatorAddr); + if (isSet(object.dstValidatorAddr)) obj.dstValidatorAddr = String(object.dstValidatorAddr); + if (isSet(object.pagination)) obj.pagination = PageRequest.fromJSON(object.pagination); + return obj; }, toJSON(message: QueryRedelegationsRequest): JsonSafe { const obj: any = {}; @@ -2449,7 +2375,9 @@ export const QueryRedelegationsRequest = { message.delegatorAddr = object.delegatorAddr ?? ""; message.srcValidatorAddr = object.srcValidatorAddr ?? ""; message.dstValidatorAddr = object.dstValidatorAddr ?? ""; - message.pagination = object.pagination !== undefined && object.pagination !== null ? PageRequest.fromPartial(object.pagination) : undefined; + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageRequest.fromPartial(object.pagination); + } return message; }, fromSDK(object: QueryRedelegationsRequestSDKType): QueryRedelegationsRequest { @@ -2560,10 +2488,10 @@ export const QueryRedelegationsResponse = { return message; }, fromJSON(object: any): QueryRedelegationsResponse { - return { - redelegationResponses: Array.isArray(object?.redelegationResponses) ? object.redelegationResponses.map((e: any) => RedelegationResponse.fromJSON(e)) : [], - pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined - }; + const obj = createBaseQueryRedelegationsResponse(); + if (Array.isArray(object?.redelegationResponses)) obj.redelegationResponses = object.redelegationResponses.map((e: any) => RedelegationResponse.fromJSON(e)); + if (isSet(object.pagination)) obj.pagination = PageResponse.fromJSON(object.pagination); + return obj; }, toJSON(message: QueryRedelegationsResponse): JsonSafe { const obj: any = {}; @@ -2578,7 +2506,9 @@ export const QueryRedelegationsResponse = { fromPartial(object: DeepPartial): QueryRedelegationsResponse { const message = createBaseQueryRedelegationsResponse(); message.redelegationResponses = object.redelegationResponses?.map(e => RedelegationResponse.fromPartial(e)) || []; - message.pagination = object.pagination !== undefined && object.pagination !== null ? PageResponse.fromPartial(object.pagination) : undefined; + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageResponse.fromPartial(object.pagination); + } return message; }, fromSDK(object: QueryRedelegationsResponseSDKType): QueryRedelegationsResponse { @@ -2652,7 +2582,7 @@ function createBaseQueryDelegatorValidatorsRequest(): QueryDelegatorValidatorsRe export const QueryDelegatorValidatorsRequest = { typeUrl: "/cosmos.staking.v1beta1.QueryDelegatorValidatorsRequest", encode(message: QueryDelegatorValidatorsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.delegatorAddr !== "") { + if (message.delegatorAddr !== undefined) { writer.uint32(10).string(message.delegatorAddr); } if (message.pagination !== undefined) { @@ -2681,10 +2611,10 @@ export const QueryDelegatorValidatorsRequest = { return message; }, fromJSON(object: any): QueryDelegatorValidatorsRequest { - return { - delegatorAddr: isSet(object.delegatorAddr) ? String(object.delegatorAddr) : "", - pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined - }; + const obj = createBaseQueryDelegatorValidatorsRequest(); + if (isSet(object.delegatorAddr)) obj.delegatorAddr = String(object.delegatorAddr); + if (isSet(object.pagination)) obj.pagination = PageRequest.fromJSON(object.pagination); + return obj; }, toJSON(message: QueryDelegatorValidatorsRequest): JsonSafe { const obj: any = {}; @@ -2695,7 +2625,9 @@ export const QueryDelegatorValidatorsRequest = { fromPartial(object: DeepPartial): QueryDelegatorValidatorsRequest { const message = createBaseQueryDelegatorValidatorsRequest(); message.delegatorAddr = object.delegatorAddr ?? ""; - message.pagination = object.pagination !== undefined && object.pagination !== null ? PageRequest.fromPartial(object.pagination) : undefined; + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageRequest.fromPartial(object.pagination); + } return message; }, fromSDK(object: QueryDelegatorValidatorsRequestSDKType): QueryDelegatorValidatorsRequest { @@ -2792,10 +2724,10 @@ export const QueryDelegatorValidatorsResponse = { return message; }, fromJSON(object: any): QueryDelegatorValidatorsResponse { - return { - validators: Array.isArray(object?.validators) ? object.validators.map((e: any) => Validator.fromJSON(e)) : [], - pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined - }; + const obj = createBaseQueryDelegatorValidatorsResponse(); + if (Array.isArray(object?.validators)) obj.validators = object.validators.map((e: any) => Validator.fromJSON(e)); + if (isSet(object.pagination)) obj.pagination = PageResponse.fromJSON(object.pagination); + return obj; }, toJSON(message: QueryDelegatorValidatorsResponse): JsonSafe { const obj: any = {}; @@ -2810,7 +2742,9 @@ export const QueryDelegatorValidatorsResponse = { fromPartial(object: DeepPartial): QueryDelegatorValidatorsResponse { const message = createBaseQueryDelegatorValidatorsResponse(); message.validators = object.validators?.map(e => Validator.fromPartial(e)) || []; - message.pagination = object.pagination !== undefined && object.pagination !== null ? PageResponse.fromPartial(object.pagination) : undefined; + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageResponse.fromPartial(object.pagination); + } return message; }, fromSDK(object: QueryDelegatorValidatorsResponseSDKType): QueryDelegatorValidatorsResponse { @@ -2884,10 +2818,10 @@ function createBaseQueryDelegatorValidatorRequest(): QueryDelegatorValidatorRequ export const QueryDelegatorValidatorRequest = { typeUrl: "/cosmos.staking.v1beta1.QueryDelegatorValidatorRequest", encode(message: QueryDelegatorValidatorRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.delegatorAddr !== "") { + if (message.delegatorAddr !== undefined) { writer.uint32(10).string(message.delegatorAddr); } - if (message.validatorAddr !== "") { + if (message.validatorAddr !== undefined) { writer.uint32(18).string(message.validatorAddr); } return writer; @@ -2913,10 +2847,10 @@ export const QueryDelegatorValidatorRequest = { return message; }, fromJSON(object: any): QueryDelegatorValidatorRequest { - return { - delegatorAddr: isSet(object.delegatorAddr) ? String(object.delegatorAddr) : "", - validatorAddr: isSet(object.validatorAddr) ? String(object.validatorAddr) : "" - }; + const obj = createBaseQueryDelegatorValidatorRequest(); + if (isSet(object.delegatorAddr)) obj.delegatorAddr = String(object.delegatorAddr); + if (isSet(object.validatorAddr)) obj.validatorAddr = String(object.validatorAddr); + return obj; }, toJSON(message: QueryDelegatorValidatorRequest): JsonSafe { const obj: any = {}; @@ -3017,9 +2951,9 @@ export const QueryDelegatorValidatorResponse = { return message; }, fromJSON(object: any): QueryDelegatorValidatorResponse { - return { - validator: isSet(object.validator) ? Validator.fromJSON(object.validator) : undefined - }; + const obj = createBaseQueryDelegatorValidatorResponse(); + if (isSet(object.validator)) obj.validator = Validator.fromJSON(object.validator); + return obj; }, toJSON(message: QueryDelegatorValidatorResponse): JsonSafe { const obj: any = {}; @@ -3028,7 +2962,9 @@ export const QueryDelegatorValidatorResponse = { }, fromPartial(object: DeepPartial): QueryDelegatorValidatorResponse { const message = createBaseQueryDelegatorValidatorResponse(); - message.validator = object.validator !== undefined && object.validator !== null ? Validator.fromPartial(object.validator) : undefined; + if (object.validator !== undefined && object.validator !== null) { + message.validator = Validator.fromPartial(object.validator); + } return message; }, fromSDK(object: QueryDelegatorValidatorResponseSDKType): QueryDelegatorValidatorResponse { @@ -3088,7 +3024,7 @@ function createBaseQueryHistoricalInfoRequest(): QueryHistoricalInfoRequest { export const QueryHistoricalInfoRequest = { typeUrl: "/cosmos.staking.v1beta1.QueryHistoricalInfoRequest", encode(message: QueryHistoricalInfoRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.height !== BigInt(0)) { + if (message.height !== undefined) { writer.uint32(8).int64(message.height); } return writer; @@ -3111,9 +3047,9 @@ export const QueryHistoricalInfoRequest = { return message; }, fromJSON(object: any): QueryHistoricalInfoRequest { - return { - height: isSet(object.height) ? BigInt(object.height.toString()) : BigInt(0) - }; + const obj = createBaseQueryHistoricalInfoRequest(); + if (isSet(object.height)) obj.height = BigInt(object.height.toString()); + return obj; }, toJSON(message: QueryHistoricalInfoRequest): JsonSafe { const obj: any = {}; @@ -3122,7 +3058,9 @@ export const QueryHistoricalInfoRequest = { }, fromPartial(object: DeepPartial): QueryHistoricalInfoRequest { const message = createBaseQueryHistoricalInfoRequest(); - message.height = object.height !== undefined && object.height !== null ? BigInt(object.height.toString()) : BigInt(0); + if (object.height !== undefined && object.height !== null) { + message.height = BigInt(object.height.toString()); + } return message; }, fromSDK(object: QueryHistoricalInfoRequestSDKType): QueryHistoricalInfoRequest { @@ -3205,9 +3143,9 @@ export const QueryHistoricalInfoResponse = { return message; }, fromJSON(object: any): QueryHistoricalInfoResponse { - return { - hist: isSet(object.hist) ? HistoricalInfo.fromJSON(object.hist) : undefined - }; + const obj = createBaseQueryHistoricalInfoResponse(); + if (isSet(object.hist)) obj.hist = HistoricalInfo.fromJSON(object.hist); + return obj; }, toJSON(message: QueryHistoricalInfoResponse): JsonSafe { const obj: any = {}; @@ -3216,7 +3154,9 @@ export const QueryHistoricalInfoResponse = { }, fromPartial(object: DeepPartial): QueryHistoricalInfoResponse { const message = createBaseQueryHistoricalInfoResponse(); - message.hist = object.hist !== undefined && object.hist !== null ? HistoricalInfo.fromPartial(object.hist) : undefined; + if (object.hist !== undefined && object.hist !== null) { + message.hist = HistoricalInfo.fromPartial(object.hist); + } return message; }, fromSDK(object: QueryHistoricalInfoResponseSDKType): QueryHistoricalInfoResponse { @@ -3291,7 +3231,8 @@ export const QueryPoolRequest = { return message; }, fromJSON(_: any): QueryPoolRequest { - return {}; + const obj = createBaseQueryPoolRequest(); + return obj; }, toJSON(_: QueryPoolRequest): JsonSafe { const obj: any = {}; @@ -3372,9 +3313,9 @@ export const QueryPoolResponse = { return message; }, fromJSON(object: any): QueryPoolResponse { - return { - pool: isSet(object.pool) ? Pool.fromJSON(object.pool) : undefined - }; + const obj = createBaseQueryPoolResponse(); + if (isSet(object.pool)) obj.pool = Pool.fromJSON(object.pool); + return obj; }, toJSON(message: QueryPoolResponse): JsonSafe { const obj: any = {}; @@ -3383,7 +3324,9 @@ export const QueryPoolResponse = { }, fromPartial(object: DeepPartial): QueryPoolResponse { const message = createBaseQueryPoolResponse(); - message.pool = object.pool !== undefined && object.pool !== null ? Pool.fromPartial(object.pool) : undefined; + if (object.pool !== undefined && object.pool !== null) { + message.pool = Pool.fromPartial(object.pool); + } return message; }, fromSDK(object: QueryPoolResponseSDKType): QueryPoolResponse { @@ -3458,7 +3401,8 @@ export const QueryParamsRequest = { return message; }, fromJSON(_: any): QueryParamsRequest { - return {}; + const obj = createBaseQueryParamsRequest(); + return obj; }, toJSON(_: QueryParamsRequest): JsonSafe { const obj: any = {}; @@ -3539,9 +3483,9 @@ export const QueryParamsResponse = { return message; }, fromJSON(object: any): QueryParamsResponse { - return { - params: isSet(object.params) ? Params.fromJSON(object.params) : undefined - }; + const obj = createBaseQueryParamsResponse(); + if (isSet(object.params)) obj.params = Params.fromJSON(object.params); + return obj; }, toJSON(message: QueryParamsResponse): JsonSafe { const obj: any = {}; @@ -3550,7 +3494,9 @@ export const QueryParamsResponse = { }, fromPartial(object: DeepPartial): QueryParamsResponse { const message = createBaseQueryParamsResponse(); - message.params = object.params !== undefined && object.params !== null ? Params.fromPartial(object.params) : undefined; + if (object.params !== undefined && object.params !== null) { + message.params = Params.fromPartial(object.params); + } return message; }, fromSDK(object: QueryParamsResponseSDKType): QueryParamsResponse { diff --git a/__fixtures__/v-next/outputv4/cosmos/staking/v1beta1/staking.ts b/__fixtures__/v-next/outputv4/cosmos/staking/v1beta1/staking.ts index e3cb2aeaf1..2ed6ddbcbd 100644 --- a/__fixtures__/v-next/outputv4/cosmos/staking/v1beta1/staking.ts +++ b/__fixtures__/v-next/outputv4/cosmos/staking/v1beta1/staking.ts @@ -1,14 +1,13 @@ -import { Header, HeaderSDKType } from "../../../tendermint/types/types"; -import { Timestamp, TimestampSDKType } from "../../../google/protobuf/timestamp"; -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 { JsonSafe } from "../../../json-safe"; +import { Header, HeaderSDKType } from "../../../tendermint/types/types.js"; +import { Timestamp, TimestampSDKType } from "../../../google/protobuf/timestamp.js"; +import { Any, AnySDKType } from "../../../google/protobuf/any.js"; +import { Duration, DurationSDKType } from "../../../google/protobuf/duration.js"; +import { Coin, CoinSDKType } from "../../base/v1beta1/coin.js"; +import { BinaryReader, BinaryWriter } from "../../../binary.js"; +import { isSet, DeepPartial, toTimestamp, fromTimestamp } from "../../../helpers.js"; +import { JsonSafe } from "../../../json-safe.js"; import { Decimal } from "@cosmjs/math"; import { encodePubkey, decodePubkey } from "@cosmjs/proto-signing"; -import { ComputedRef } from "vue"; export const protobufPackage = "cosmos.staking.v1beta1"; /** BondStatus is the status of a validator. */ export enum BondStatus { @@ -68,10 +67,6 @@ export interface HistoricalInfo { header: Header; valset: Validator[]; } -export interface ReactiveHistoricalInfo { - header: ComputedRef
; - valset: ComputedRef; -} export interface HistoricalInfoProtoMsg { typeUrl: "/cosmos.staking.v1beta1.HistoricalInfo"; value: Uint8Array; @@ -98,11 +93,6 @@ export interface CommissionRates { /** max_change_rate defines the maximum daily increase of the validator commission, as a fraction. */ maxChangeRate: string; } -export interface ReactiveCommissionRates { - rate: ComputedRef; - maxRate: ComputedRef; - maxChangeRate: ComputedRef; -} export interface CommissionRatesProtoMsg { typeUrl: "/cosmos.staking.v1beta1.CommissionRates"; value: Uint8Array; @@ -123,10 +113,6 @@ export interface Commission { /** update_time is the last time the commission rate was changed. */ updateTime: Date; } -export interface ReactiveCommission { - commissionRates: ComputedRef; - updateTime: ComputedRef; -} export interface CommissionProtoMsg { typeUrl: "/cosmos.staking.v1beta1.Commission"; value: Uint8Array; @@ -149,13 +135,6 @@ export interface Description { /** details define other optional details. */ details: string; } -export interface ReactiveDescription { - moniker: ComputedRef; - identity: ComputedRef; - website: ComputedRef; - securityContact: ComputedRef; - details: ComputedRef; -} export interface DescriptionProtoMsg { typeUrl: "/cosmos.staking.v1beta1.Description"; value: Uint8Array; @@ -202,19 +181,6 @@ export interface Validator { /** min_self_delegation is the validator's self declared minimum self delegation. */ minSelfDelegation: string; } -export interface ReactiveValidator { - operatorAddress: ComputedRef; - consensusPubkey?: ComputedRef; - jailed: ComputedRef; - status: ComputedRef; - tokens: ComputedRef; - delegatorShares: ComputedRef; - description: ComputedRef; - unbondingHeight: ComputedRef; - unbondingTime: ComputedRef; - commission: ComputedRef; - minSelfDelegation: ComputedRef; -} export interface ValidatorProtoMsg { typeUrl: "/cosmos.staking.v1beta1.Validator"; value: Uint8Array; @@ -246,9 +212,6 @@ export interface ValidatorSDKType { export interface ValAddresses { addresses: string[]; } -export interface ReactiveValAddresses { - addresses: ComputedRef; -} export interface ValAddressesProtoMsg { typeUrl: "/cosmos.staking.v1beta1.ValAddresses"; value: Uint8Array; @@ -266,10 +229,6 @@ export interface DVPair { delegatorAddress: string; validatorAddress: string; } -export interface ReactiveDVPair { - delegatorAddress: ComputedRef; - validatorAddress: ComputedRef; -} export interface DVPairProtoMsg { typeUrl: "/cosmos.staking.v1beta1.DVPair"; value: Uint8Array; @@ -287,9 +246,6 @@ export interface DVPairSDKType { export interface DVPairs { pairs: DVPair[]; } -export interface ReactiveDVPairs { - pairs: ComputedRef; -} export interface DVPairsProtoMsg { typeUrl: "/cosmos.staking.v1beta1.DVPairs"; value: Uint8Array; @@ -309,11 +265,6 @@ export interface DVVTriplet { validatorSrcAddress: string; validatorDstAddress: string; } -export interface ReactiveDVVTriplet { - delegatorAddress: ComputedRef; - validatorSrcAddress: ComputedRef; - validatorDstAddress: ComputedRef; -} export interface DVVTripletProtoMsg { typeUrl: "/cosmos.staking.v1beta1.DVVTriplet"; value: Uint8Array; @@ -333,9 +284,6 @@ export interface DVVTripletSDKType { export interface DVVTriplets { triplets: DVVTriplet[]; } -export interface ReactiveDVVTriplets { - triplets: ComputedRef; -} export interface DVVTripletsProtoMsg { typeUrl: "/cosmos.staking.v1beta1.DVVTriplets"; value: Uint8Array; @@ -357,11 +305,6 @@ export interface Delegation { /** shares define the delegation shares received. */ shares: string; } -export interface ReactiveDelegation { - delegatorAddress: ComputedRef; - validatorAddress: ComputedRef; - shares: ComputedRef; -} export interface DelegationProtoMsg { typeUrl: "/cosmos.staking.v1beta1.Delegation"; value: Uint8Array; @@ -388,11 +331,6 @@ export interface UnbondingDelegation { /** entries are the unbonding delegation entries. */ entries: UnbondingDelegationEntry[]; } -export interface ReactiveUnbondingDelegation { - delegatorAddress: ComputedRef; - validatorAddress: ComputedRef; - entries: ComputedRef; -} export interface UnbondingDelegationProtoMsg { typeUrl: "/cosmos.staking.v1beta1.UnbondingDelegation"; value: Uint8Array; @@ -417,12 +355,6 @@ export interface UnbondingDelegationEntry { /** balance defines the tokens to receive at completion. */ balance: string; } -export interface ReactiveUnbondingDelegationEntry { - creationHeight: ComputedRef; - completionTime: ComputedRef; - initialBalance: ComputedRef; - balance: ComputedRef; -} export interface UnbondingDelegationEntryProtoMsg { typeUrl: "/cosmos.staking.v1beta1.UnbondingDelegationEntry"; value: Uint8Array; @@ -445,12 +377,6 @@ export interface RedelegationEntry { /** shares_dst is the amount of destination-validator shares created by redelegation. */ sharesDst: string; } -export interface ReactiveRedelegationEntry { - creationHeight: ComputedRef; - completionTime: ComputedRef; - initialBalance: ComputedRef; - sharesDst: ComputedRef; -} export interface RedelegationEntryProtoMsg { typeUrl: "/cosmos.staking.v1beta1.RedelegationEntry"; value: Uint8Array; @@ -476,12 +402,6 @@ export interface Redelegation { /** entries are the redelegation entries. */ entries: RedelegationEntry[]; } -export interface ReactiveRedelegation { - delegatorAddress: ComputedRef; - validatorSrcAddress: ComputedRef; - validatorDstAddress: ComputedRef; - entries: ComputedRef; -} export interface RedelegationProtoMsg { typeUrl: "/cosmos.staking.v1beta1.Redelegation"; value: Uint8Array; @@ -511,14 +431,6 @@ export interface Params { /** min_commission_rate is the chain-wide minimum commission rate that a validator can charge their delegators */ minCommissionRate: string; } -export interface ReactiveParams { - unbondingTime: ComputedRef; - maxValidators: ComputedRef; - maxEntries: ComputedRef; - historicalEntries: ComputedRef; - bondDenom: ComputedRef; - minCommissionRate: ComputedRef; -} export interface ParamsProtoMsg { typeUrl: "/cosmos.staking.v1beta1.Params"; value: Uint8Array; @@ -540,10 +452,6 @@ export interface DelegationResponse { delegation: Delegation; balance: Coin; } -export interface ReactiveDelegationResponse { - delegation: ComputedRef; - balance: ComputedRef; -} export interface DelegationResponseProtoMsg { typeUrl: "/cosmos.staking.v1beta1.DelegationResponse"; value: Uint8Array; @@ -565,10 +473,6 @@ export interface RedelegationEntryResponse { redelegationEntry: RedelegationEntry; balance: string; } -export interface ReactiveRedelegationEntryResponse { - redelegationEntry: ComputedRef; - balance: ComputedRef; -} export interface RedelegationEntryResponseProtoMsg { typeUrl: "/cosmos.staking.v1beta1.RedelegationEntryResponse"; value: Uint8Array; @@ -591,10 +495,6 @@ export interface RedelegationResponse { redelegation: Redelegation; entries: RedelegationEntryResponse[]; } -export interface ReactiveRedelegationResponse { - redelegation: ComputedRef; - entries: ComputedRef; -} export interface RedelegationResponseProtoMsg { typeUrl: "/cosmos.staking.v1beta1.RedelegationResponse"; value: Uint8Array; @@ -616,10 +516,6 @@ export interface Pool { notBondedTokens: string; bondedTokens: string; } -export interface ReactivePool { - notBondedTokens: ComputedRef; - bondedTokens: ComputedRef; -} export interface PoolProtoMsg { typeUrl: "/cosmos.staking.v1beta1.Pool"; value: Uint8Array; @@ -670,10 +566,10 @@ export const HistoricalInfo = { return message; }, fromJSON(object: any): HistoricalInfo { - return { - header: isSet(object.header) ? Header.fromJSON(object.header) : undefined, - valset: Array.isArray(object?.valset) ? object.valset.map((e: any) => Validator.fromJSON(e)) : [] - }; + const obj = createBaseHistoricalInfo(); + if (isSet(object.header)) obj.header = Header.fromJSON(object.header); + if (Array.isArray(object?.valset)) obj.valset = object.valset.map((e: any) => Validator.fromJSON(e)); + return obj; }, toJSON(message: HistoricalInfo): JsonSafe { const obj: any = {}; @@ -687,7 +583,9 @@ export const HistoricalInfo = { }, fromPartial(object: DeepPartial): HistoricalInfo { const message = createBaseHistoricalInfo(); - message.header = object.header !== undefined && object.header !== null ? Header.fromPartial(object.header) : undefined; + if (object.header !== undefined && object.header !== null) { + message.header = Header.fromPartial(object.header); + } message.valset = object.valset?.map(e => Validator.fromPartial(e)) || []; return message; }, @@ -763,13 +661,13 @@ function createBaseCommissionRates(): CommissionRates { export const CommissionRates = { typeUrl: "/cosmos.staking.v1beta1.CommissionRates", encode(message: CommissionRates, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.rate !== "") { + if (message.rate !== undefined) { writer.uint32(10).string(Decimal.fromUserInput(message.rate, 18).atomics); } - if (message.maxRate !== "") { + if (message.maxRate !== undefined) { writer.uint32(18).string(Decimal.fromUserInput(message.maxRate, 18).atomics); } - if (message.maxChangeRate !== "") { + if (message.maxChangeRate !== undefined) { writer.uint32(26).string(Decimal.fromUserInput(message.maxChangeRate, 18).atomics); } return writer; @@ -798,11 +696,11 @@ export const CommissionRates = { return message; }, fromJSON(object: any): CommissionRates { - return { - rate: isSet(object.rate) ? String(object.rate) : "", - maxRate: isSet(object.maxRate) ? String(object.maxRate) : "", - maxChangeRate: isSet(object.maxChangeRate) ? String(object.maxChangeRate) : "" - }; + const obj = createBaseCommissionRates(); + if (isSet(object.rate)) obj.rate = String(object.rate); + if (isSet(object.maxRate)) obj.maxRate = String(object.maxRate); + if (isSet(object.maxChangeRate)) obj.maxChangeRate = String(object.maxChangeRate); + return obj; }, toJSON(message: CommissionRates): JsonSafe { const obj: any = {}; @@ -919,10 +817,10 @@ export const Commission = { return message; }, fromJSON(object: any): Commission { - return { - commissionRates: isSet(object.commissionRates) ? CommissionRates.fromJSON(object.commissionRates) : undefined, - updateTime: isSet(object.updateTime) ? new Date(object.updateTime) : undefined - }; + const obj = createBaseCommission(); + if (isSet(object.commissionRates)) obj.commissionRates = CommissionRates.fromJSON(object.commissionRates); + if (isSet(object.updateTime)) obj.updateTime = new Date(object.updateTime); + return obj; }, toJSON(message: Commission): JsonSafe { const obj: any = {}; @@ -932,7 +830,9 @@ export const Commission = { }, fromPartial(object: DeepPartial): Commission { const message = createBaseCommission(); - message.commissionRates = object.commissionRates !== undefined && object.commissionRates !== null ? CommissionRates.fromPartial(object.commissionRates) : undefined; + if (object.commissionRates !== undefined && object.commissionRates !== null) { + message.commissionRates = CommissionRates.fromPartial(object.commissionRates); + } message.updateTime = object.updateTime ?? undefined; return message; }, @@ -1004,19 +904,19 @@ function createBaseDescription(): Description { export const Description = { typeUrl: "/cosmos.staking.v1beta1.Description", encode(message: Description, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.moniker !== "") { + if (message.moniker !== undefined) { writer.uint32(10).string(message.moniker); } - if (message.identity !== "") { + if (message.identity !== undefined) { writer.uint32(18).string(message.identity); } - if (message.website !== "") { + if (message.website !== undefined) { writer.uint32(26).string(message.website); } - if (message.securityContact !== "") { + if (message.securityContact !== undefined) { writer.uint32(34).string(message.securityContact); } - if (message.details !== "") { + if (message.details !== undefined) { writer.uint32(42).string(message.details); } return writer; @@ -1051,13 +951,13 @@ export const Description = { return message; }, fromJSON(object: any): Description { - return { - moniker: isSet(object.moniker) ? String(object.moniker) : "", - identity: isSet(object.identity) ? String(object.identity) : "", - website: isSet(object.website) ? String(object.website) : "", - securityContact: isSet(object.securityContact) ? String(object.securityContact) : "", - details: isSet(object.details) ? String(object.details) : "" - }; + const obj = createBaseDescription(); + if (isSet(object.moniker)) obj.moniker = String(object.moniker); + if (isSet(object.identity)) obj.identity = String(object.identity); + if (isSet(object.website)) obj.website = String(object.website); + if (isSet(object.securityContact)) obj.securityContact = String(object.securityContact); + if (isSet(object.details)) obj.details = String(object.details); + return obj; }, toJSON(message: Description): JsonSafe { const obj: any = {}; @@ -1172,28 +1072,28 @@ function createBaseValidator(): Validator { export const Validator = { typeUrl: "/cosmos.staking.v1beta1.Validator", encode(message: Validator, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.operatorAddress !== "") { + if (message.operatorAddress !== undefined) { writer.uint32(10).string(message.operatorAddress); } if (message.consensusPubkey !== undefined) { Any.encode(message.consensusPubkey, writer.uint32(18).fork()).ldelim(); } - if (message.jailed === true) { + if (message.jailed !== undefined) { writer.uint32(24).bool(message.jailed); } if (message.status !== 0) { writer.uint32(32).int32(message.status); } - if (message.tokens !== "") { + if (message.tokens !== undefined) { writer.uint32(42).string(message.tokens); } - if (message.delegatorShares !== "") { + if (message.delegatorShares !== undefined) { writer.uint32(50).string(Decimal.fromUserInput(message.delegatorShares, 18).atomics); } if (message.description !== undefined) { Description.encode(message.description, writer.uint32(58).fork()).ldelim(); } - if (message.unbondingHeight !== BigInt(0)) { + if (message.unbondingHeight !== undefined) { writer.uint32(64).int64(message.unbondingHeight); } if (message.unbondingTime !== undefined) { @@ -1202,7 +1102,7 @@ export const Validator = { if (message.commission !== undefined) { Commission.encode(message.commission, writer.uint32(82).fork()).ldelim(); } - if (message.minSelfDelegation !== "") { + if (message.minSelfDelegation !== undefined) { writer.uint32(90).string(message.minSelfDelegation); } return writer; @@ -1255,19 +1155,19 @@ export const Validator = { return message; }, fromJSON(object: any): Validator { - return { - operatorAddress: isSet(object.operatorAddress) ? String(object.operatorAddress) : "", - consensusPubkey: isSet(object.consensusPubkey) ? Any.fromJSON(object.consensusPubkey) : undefined, - jailed: isSet(object.jailed) ? Boolean(object.jailed) : false, - status: isSet(object.status) ? bondStatusFromJSON(object.status) : -1, - tokens: isSet(object.tokens) ? String(object.tokens) : "", - delegatorShares: isSet(object.delegatorShares) ? String(object.delegatorShares) : "", - description: isSet(object.description) ? Description.fromJSON(object.description) : undefined, - unbondingHeight: isSet(object.unbondingHeight) ? BigInt(object.unbondingHeight.toString()) : BigInt(0), - unbondingTime: isSet(object.unbondingTime) ? new Date(object.unbondingTime) : undefined, - commission: isSet(object.commission) ? Commission.fromJSON(object.commission) : undefined, - minSelfDelegation: isSet(object.minSelfDelegation) ? String(object.minSelfDelegation) : "" - }; + const obj = createBaseValidator(); + if (isSet(object.operatorAddress)) obj.operatorAddress = String(object.operatorAddress); + if (isSet(object.consensusPubkey)) obj.consensusPubkey = Any.fromJSON(object.consensusPubkey); + if (isSet(object.jailed)) obj.jailed = Boolean(object.jailed); + if (isSet(object.status)) obj.status = bondStatusFromJSON(object.status); + if (isSet(object.tokens)) obj.tokens = String(object.tokens); + if (isSet(object.delegatorShares)) obj.delegatorShares = String(object.delegatorShares); + if (isSet(object.description)) obj.description = Description.fromJSON(object.description); + if (isSet(object.unbondingHeight)) obj.unbondingHeight = BigInt(object.unbondingHeight.toString()); + if (isSet(object.unbondingTime)) obj.unbondingTime = new Date(object.unbondingTime); + if (isSet(object.commission)) obj.commission = Commission.fromJSON(object.commission); + if (isSet(object.minSelfDelegation)) obj.minSelfDelegation = String(object.minSelfDelegation); + return obj; }, toJSON(message: Validator): JsonSafe { const obj: any = {}; @@ -1287,15 +1187,23 @@ export const Validator = { fromPartial(object: DeepPartial): Validator { const message = createBaseValidator(); message.operatorAddress = object.operatorAddress ?? ""; - message.consensusPubkey = object.consensusPubkey !== undefined && object.consensusPubkey !== null ? Any.fromPartial(object.consensusPubkey) : undefined; + if (object.consensusPubkey !== undefined && object.consensusPubkey !== null) { + message.consensusPubkey = Any.fromPartial(object.consensusPubkey); + } message.jailed = object.jailed ?? false; message.status = object.status ?? 0; message.tokens = object.tokens ?? ""; message.delegatorShares = object.delegatorShares ?? ""; - message.description = object.description !== undefined && object.description !== null ? Description.fromPartial(object.description) : undefined; - message.unbondingHeight = object.unbondingHeight !== undefined && object.unbondingHeight !== null ? BigInt(object.unbondingHeight.toString()) : BigInt(0); + if (object.description !== undefined && object.description !== null) { + message.description = Description.fromPartial(object.description); + } + if (object.unbondingHeight !== undefined && object.unbondingHeight !== null) { + message.unbondingHeight = BigInt(object.unbondingHeight.toString()); + } message.unbondingTime = object.unbondingTime ?? undefined; - message.commission = object.commission !== undefined && object.commission !== null ? Commission.fromPartial(object.commission) : undefined; + if (object.commission !== undefined && object.commission !== null) { + message.commission = Commission.fromPartial(object.commission); + } message.minSelfDelegation = object.minSelfDelegation ?? ""; return message; }, @@ -1449,9 +1357,9 @@ export const ValAddresses = { return message; }, fromJSON(object: any): ValAddresses { - return { - addresses: Array.isArray(object?.addresses) ? object.addresses.map((e: any) => String(e)) : [] - }; + const obj = createBaseValAddresses(); + if (Array.isArray(object?.addresses)) obj.addresses = object.addresses.map((e: any) => String(e)); + return obj; }, toJSON(message: ValAddresses): JsonSafe { const obj: any = {}; @@ -1531,10 +1439,10 @@ function createBaseDVPair(): DVPair { export const DVPair = { typeUrl: "/cosmos.staking.v1beta1.DVPair", encode(message: DVPair, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.delegatorAddress !== "") { + if (message.delegatorAddress !== undefined) { writer.uint32(10).string(message.delegatorAddress); } - if (message.validatorAddress !== "") { + if (message.validatorAddress !== undefined) { writer.uint32(18).string(message.validatorAddress); } return writer; @@ -1560,10 +1468,10 @@ export const DVPair = { return message; }, fromJSON(object: any): DVPair { - return { - delegatorAddress: isSet(object.delegatorAddress) ? String(object.delegatorAddress) : "", - validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "" - }; + const obj = createBaseDVPair(); + if (isSet(object.delegatorAddress)) obj.delegatorAddress = String(object.delegatorAddress); + if (isSet(object.validatorAddress)) obj.validatorAddress = String(object.validatorAddress); + return obj; }, toJSON(message: DVPair): JsonSafe { const obj: any = {}; @@ -1664,9 +1572,9 @@ export const DVPairs = { return message; }, fromJSON(object: any): DVPairs { - return { - pairs: Array.isArray(object?.pairs) ? object.pairs.map((e: any) => DVPair.fromJSON(e)) : [] - }; + const obj = createBaseDVPairs(); + if (Array.isArray(object?.pairs)) obj.pairs = object.pairs.map((e: any) => DVPair.fromJSON(e)); + return obj; }, toJSON(message: DVPairs): JsonSafe { const obj: any = {}; @@ -1747,13 +1655,13 @@ function createBaseDVVTriplet(): DVVTriplet { export const DVVTriplet = { typeUrl: "/cosmos.staking.v1beta1.DVVTriplet", encode(message: DVVTriplet, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.delegatorAddress !== "") { + if (message.delegatorAddress !== undefined) { writer.uint32(10).string(message.delegatorAddress); } - if (message.validatorSrcAddress !== "") { + if (message.validatorSrcAddress !== undefined) { writer.uint32(18).string(message.validatorSrcAddress); } - if (message.validatorDstAddress !== "") { + if (message.validatorDstAddress !== undefined) { writer.uint32(26).string(message.validatorDstAddress); } return writer; @@ -1782,11 +1690,11 @@ export const DVVTriplet = { return message; }, fromJSON(object: any): DVVTriplet { - return { - delegatorAddress: isSet(object.delegatorAddress) ? String(object.delegatorAddress) : "", - validatorSrcAddress: isSet(object.validatorSrcAddress) ? String(object.validatorSrcAddress) : "", - validatorDstAddress: isSet(object.validatorDstAddress) ? String(object.validatorDstAddress) : "" - }; + const obj = createBaseDVVTriplet(); + if (isSet(object.delegatorAddress)) obj.delegatorAddress = String(object.delegatorAddress); + if (isSet(object.validatorSrcAddress)) obj.validatorSrcAddress = String(object.validatorSrcAddress); + if (isSet(object.validatorDstAddress)) obj.validatorDstAddress = String(object.validatorDstAddress); + return obj; }, toJSON(message: DVVTriplet): JsonSafe { const obj: any = {}; @@ -1896,9 +1804,9 @@ export const DVVTriplets = { return message; }, fromJSON(object: any): DVVTriplets { - return { - triplets: Array.isArray(object?.triplets) ? object.triplets.map((e: any) => DVVTriplet.fromJSON(e)) : [] - }; + const obj = createBaseDVVTriplets(); + if (Array.isArray(object?.triplets)) obj.triplets = object.triplets.map((e: any) => DVVTriplet.fromJSON(e)); + return obj; }, toJSON(message: DVVTriplets): JsonSafe { const obj: any = {}; @@ -1979,13 +1887,13 @@ function createBaseDelegation(): Delegation { export const Delegation = { typeUrl: "/cosmos.staking.v1beta1.Delegation", encode(message: Delegation, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.delegatorAddress !== "") { + if (message.delegatorAddress !== undefined) { writer.uint32(10).string(message.delegatorAddress); } - if (message.validatorAddress !== "") { + if (message.validatorAddress !== undefined) { writer.uint32(18).string(message.validatorAddress); } - if (message.shares !== "") { + if (message.shares !== undefined) { writer.uint32(26).string(Decimal.fromUserInput(message.shares, 18).atomics); } return writer; @@ -2014,11 +1922,11 @@ export const Delegation = { return message; }, fromJSON(object: any): Delegation { - return { - delegatorAddress: isSet(object.delegatorAddress) ? String(object.delegatorAddress) : "", - validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", - shares: isSet(object.shares) ? String(object.shares) : "" - }; + const obj = createBaseDelegation(); + if (isSet(object.delegatorAddress)) obj.delegatorAddress = String(object.delegatorAddress); + if (isSet(object.validatorAddress)) obj.validatorAddress = String(object.validatorAddress); + if (isSet(object.shares)) obj.shares = String(object.shares); + return obj; }, toJSON(message: Delegation): JsonSafe { const obj: any = {}; @@ -2107,10 +2015,10 @@ function createBaseUnbondingDelegation(): UnbondingDelegation { export const UnbondingDelegation = { typeUrl: "/cosmos.staking.v1beta1.UnbondingDelegation", encode(message: UnbondingDelegation, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.delegatorAddress !== "") { + if (message.delegatorAddress !== undefined) { writer.uint32(10).string(message.delegatorAddress); } - if (message.validatorAddress !== "") { + if (message.validatorAddress !== undefined) { writer.uint32(18).string(message.validatorAddress); } for (const v of message.entries) { @@ -2142,11 +2050,11 @@ export const UnbondingDelegation = { return message; }, fromJSON(object: any): UnbondingDelegation { - return { - delegatorAddress: isSet(object.delegatorAddress) ? String(object.delegatorAddress) : "", - validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", - entries: Array.isArray(object?.entries) ? object.entries.map((e: any) => UnbondingDelegationEntry.fromJSON(e)) : [] - }; + const obj = createBaseUnbondingDelegation(); + if (isSet(object.delegatorAddress)) obj.delegatorAddress = String(object.delegatorAddress); + if (isSet(object.validatorAddress)) obj.validatorAddress = String(object.validatorAddress); + if (Array.isArray(object?.entries)) obj.entries = object.entries.map((e: any) => UnbondingDelegationEntry.fromJSON(e)); + return obj; }, toJSON(message: UnbondingDelegation): JsonSafe { const obj: any = {}; @@ -2246,16 +2154,16 @@ function createBaseUnbondingDelegationEntry(): UnbondingDelegationEntry { export const UnbondingDelegationEntry = { typeUrl: "/cosmos.staking.v1beta1.UnbondingDelegationEntry", encode(message: UnbondingDelegationEntry, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.creationHeight !== BigInt(0)) { + if (message.creationHeight !== undefined) { writer.uint32(8).int64(message.creationHeight); } if (message.completionTime !== undefined) { Timestamp.encode(toTimestamp(message.completionTime), writer.uint32(18).fork()).ldelim(); } - if (message.initialBalance !== "") { + if (message.initialBalance !== undefined) { writer.uint32(26).string(message.initialBalance); } - if (message.balance !== "") { + if (message.balance !== undefined) { writer.uint32(34).string(message.balance); } return writer; @@ -2287,12 +2195,12 @@ export const UnbondingDelegationEntry = { return message; }, fromJSON(object: any): UnbondingDelegationEntry { - return { - creationHeight: isSet(object.creationHeight) ? BigInt(object.creationHeight.toString()) : BigInt(0), - completionTime: isSet(object.completionTime) ? new Date(object.completionTime) : undefined, - initialBalance: isSet(object.initialBalance) ? String(object.initialBalance) : "", - balance: isSet(object.balance) ? String(object.balance) : "" - }; + const obj = createBaseUnbondingDelegationEntry(); + if (isSet(object.creationHeight)) obj.creationHeight = BigInt(object.creationHeight.toString()); + if (isSet(object.completionTime)) obj.completionTime = new Date(object.completionTime); + if (isSet(object.initialBalance)) obj.initialBalance = String(object.initialBalance); + if (isSet(object.balance)) obj.balance = String(object.balance); + return obj; }, toJSON(message: UnbondingDelegationEntry): JsonSafe { const obj: any = {}; @@ -2304,7 +2212,9 @@ export const UnbondingDelegationEntry = { }, fromPartial(object: DeepPartial): UnbondingDelegationEntry { const message = createBaseUnbondingDelegationEntry(); - message.creationHeight = object.creationHeight !== undefined && object.creationHeight !== null ? BigInt(object.creationHeight.toString()) : BigInt(0); + if (object.creationHeight !== undefined && object.creationHeight !== null) { + message.creationHeight = BigInt(object.creationHeight.toString()); + } message.completionTime = object.completionTime ?? undefined; message.initialBalance = object.initialBalance ?? ""; message.balance = object.balance ?? ""; @@ -2391,16 +2301,16 @@ function createBaseRedelegationEntry(): RedelegationEntry { export const RedelegationEntry = { typeUrl: "/cosmos.staking.v1beta1.RedelegationEntry", encode(message: RedelegationEntry, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.creationHeight !== BigInt(0)) { + if (message.creationHeight !== undefined) { writer.uint32(8).int64(message.creationHeight); } if (message.completionTime !== undefined) { Timestamp.encode(toTimestamp(message.completionTime), writer.uint32(18).fork()).ldelim(); } - if (message.initialBalance !== "") { + if (message.initialBalance !== undefined) { writer.uint32(26).string(message.initialBalance); } - if (message.sharesDst !== "") { + if (message.sharesDst !== undefined) { writer.uint32(34).string(Decimal.fromUserInput(message.sharesDst, 18).atomics); } return writer; @@ -2432,12 +2342,12 @@ export const RedelegationEntry = { return message; }, fromJSON(object: any): RedelegationEntry { - return { - creationHeight: isSet(object.creationHeight) ? BigInt(object.creationHeight.toString()) : BigInt(0), - completionTime: isSet(object.completionTime) ? new Date(object.completionTime) : undefined, - initialBalance: isSet(object.initialBalance) ? String(object.initialBalance) : "", - sharesDst: isSet(object.sharesDst) ? String(object.sharesDst) : "" - }; + const obj = createBaseRedelegationEntry(); + if (isSet(object.creationHeight)) obj.creationHeight = BigInt(object.creationHeight.toString()); + if (isSet(object.completionTime)) obj.completionTime = new Date(object.completionTime); + if (isSet(object.initialBalance)) obj.initialBalance = String(object.initialBalance); + if (isSet(object.sharesDst)) obj.sharesDst = String(object.sharesDst); + return obj; }, toJSON(message: RedelegationEntry): JsonSafe { const obj: any = {}; @@ -2449,7 +2359,9 @@ export const RedelegationEntry = { }, fromPartial(object: DeepPartial): RedelegationEntry { const message = createBaseRedelegationEntry(); - message.creationHeight = object.creationHeight !== undefined && object.creationHeight !== null ? BigInt(object.creationHeight.toString()) : BigInt(0); + if (object.creationHeight !== undefined && object.creationHeight !== null) { + message.creationHeight = BigInt(object.creationHeight.toString()); + } message.completionTime = object.completionTime ?? undefined; message.initialBalance = object.initialBalance ?? ""; message.sharesDst = object.sharesDst ?? ""; @@ -2536,13 +2448,13 @@ function createBaseRedelegation(): Redelegation { export const Redelegation = { typeUrl: "/cosmos.staking.v1beta1.Redelegation", encode(message: Redelegation, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.delegatorAddress !== "") { + if (message.delegatorAddress !== undefined) { writer.uint32(10).string(message.delegatorAddress); } - if (message.validatorSrcAddress !== "") { + if (message.validatorSrcAddress !== undefined) { writer.uint32(18).string(message.validatorSrcAddress); } - if (message.validatorDstAddress !== "") { + if (message.validatorDstAddress !== undefined) { writer.uint32(26).string(message.validatorDstAddress); } for (const v of message.entries) { @@ -2577,12 +2489,12 @@ export const Redelegation = { return message; }, fromJSON(object: any): Redelegation { - return { - delegatorAddress: isSet(object.delegatorAddress) ? String(object.delegatorAddress) : "", - validatorSrcAddress: isSet(object.validatorSrcAddress) ? String(object.validatorSrcAddress) : "", - validatorDstAddress: isSet(object.validatorDstAddress) ? String(object.validatorDstAddress) : "", - entries: Array.isArray(object?.entries) ? object.entries.map((e: any) => RedelegationEntry.fromJSON(e)) : [] - }; + const obj = createBaseRedelegation(); + if (isSet(object.delegatorAddress)) obj.delegatorAddress = String(object.delegatorAddress); + if (isSet(object.validatorSrcAddress)) obj.validatorSrcAddress = String(object.validatorSrcAddress); + if (isSet(object.validatorDstAddress)) obj.validatorDstAddress = String(object.validatorDstAddress); + if (Array.isArray(object?.entries)) obj.entries = object.entries.map((e: any) => RedelegationEntry.fromJSON(e)); + return obj; }, toJSON(message: Redelegation): JsonSafe { const obj: any = {}; @@ -2696,19 +2608,19 @@ export const Params = { if (message.unbondingTime !== undefined) { Duration.encode(message.unbondingTime, writer.uint32(10).fork()).ldelim(); } - if (message.maxValidators !== 0) { + if (message.maxValidators !== undefined) { writer.uint32(16).uint32(message.maxValidators); } - if (message.maxEntries !== 0) { + if (message.maxEntries !== undefined) { writer.uint32(24).uint32(message.maxEntries); } - if (message.historicalEntries !== 0) { + if (message.historicalEntries !== undefined) { writer.uint32(32).uint32(message.historicalEntries); } - if (message.bondDenom !== "") { + if (message.bondDenom !== undefined) { writer.uint32(42).string(message.bondDenom); } - if (message.minCommissionRate !== "") { + if (message.minCommissionRate !== undefined) { writer.uint32(50).string(Decimal.fromUserInput(message.minCommissionRate, 18).atomics); } return writer; @@ -2746,14 +2658,14 @@ export const Params = { return message; }, fromJSON(object: any): Params { - return { - unbondingTime: isSet(object.unbondingTime) ? Duration.fromJSON(object.unbondingTime) : undefined, - maxValidators: isSet(object.maxValidators) ? Number(object.maxValidators) : 0, - maxEntries: isSet(object.maxEntries) ? Number(object.maxEntries) : 0, - historicalEntries: isSet(object.historicalEntries) ? Number(object.historicalEntries) : 0, - bondDenom: isSet(object.bondDenom) ? String(object.bondDenom) : "", - minCommissionRate: isSet(object.minCommissionRate) ? String(object.minCommissionRate) : "" - }; + const obj = createBaseParams(); + if (isSet(object.unbondingTime)) obj.unbondingTime = Duration.fromJSON(object.unbondingTime); + if (isSet(object.maxValidators)) obj.maxValidators = Number(object.maxValidators); + if (isSet(object.maxEntries)) obj.maxEntries = Number(object.maxEntries); + if (isSet(object.historicalEntries)) obj.historicalEntries = Number(object.historicalEntries); + if (isSet(object.bondDenom)) obj.bondDenom = String(object.bondDenom); + if (isSet(object.minCommissionRate)) obj.minCommissionRate = String(object.minCommissionRate); + return obj; }, toJSON(message: Params): JsonSafe { const obj: any = {}; @@ -2767,7 +2679,9 @@ export const Params = { }, fromPartial(object: DeepPartial): Params { const message = createBaseParams(); - message.unbondingTime = object.unbondingTime !== undefined && object.unbondingTime !== null ? Duration.fromPartial(object.unbondingTime) : undefined; + if (object.unbondingTime !== undefined && object.unbondingTime !== null) { + message.unbondingTime = Duration.fromPartial(object.unbondingTime); + } message.maxValidators = object.maxValidators ?? 0; message.maxEntries = object.maxEntries ?? 0; message.historicalEntries = object.historicalEntries ?? 0; @@ -2897,10 +2811,10 @@ export const DelegationResponse = { return message; }, fromJSON(object: any): DelegationResponse { - return { - delegation: isSet(object.delegation) ? Delegation.fromJSON(object.delegation) : undefined, - balance: isSet(object.balance) ? Coin.fromJSON(object.balance) : undefined - }; + const obj = createBaseDelegationResponse(); + if (isSet(object.delegation)) obj.delegation = Delegation.fromJSON(object.delegation); + if (isSet(object.balance)) obj.balance = Coin.fromJSON(object.balance); + return obj; }, toJSON(message: DelegationResponse): JsonSafe { const obj: any = {}; @@ -2910,8 +2824,12 @@ export const DelegationResponse = { }, fromPartial(object: DeepPartial): DelegationResponse { const message = createBaseDelegationResponse(); - message.delegation = object.delegation !== undefined && object.delegation !== null ? Delegation.fromPartial(object.delegation) : undefined; - message.balance = object.balance !== undefined && object.balance !== null ? Coin.fromPartial(object.balance) : undefined; + if (object.delegation !== undefined && object.delegation !== null) { + message.delegation = Delegation.fromPartial(object.delegation); + } + if (object.balance !== undefined && object.balance !== null) { + message.balance = Coin.fromPartial(object.balance); + } return message; }, fromSDK(object: DelegationResponseSDKType): DelegationResponse { @@ -2982,7 +2900,7 @@ export const RedelegationEntryResponse = { if (message.redelegationEntry !== undefined) { RedelegationEntry.encode(message.redelegationEntry, writer.uint32(10).fork()).ldelim(); } - if (message.balance !== "") { + if (message.balance !== undefined) { writer.uint32(34).string(message.balance); } return writer; @@ -3008,10 +2926,10 @@ export const RedelegationEntryResponse = { return message; }, fromJSON(object: any): RedelegationEntryResponse { - return { - redelegationEntry: isSet(object.redelegationEntry) ? RedelegationEntry.fromJSON(object.redelegationEntry) : undefined, - balance: isSet(object.balance) ? String(object.balance) : "" - }; + const obj = createBaseRedelegationEntryResponse(); + if (isSet(object.redelegationEntry)) obj.redelegationEntry = RedelegationEntry.fromJSON(object.redelegationEntry); + if (isSet(object.balance)) obj.balance = String(object.balance); + return obj; }, toJSON(message: RedelegationEntryResponse): JsonSafe { const obj: any = {}; @@ -3021,7 +2939,9 @@ export const RedelegationEntryResponse = { }, fromPartial(object: DeepPartial): RedelegationEntryResponse { const message = createBaseRedelegationEntryResponse(); - message.redelegationEntry = object.redelegationEntry !== undefined && object.redelegationEntry !== null ? RedelegationEntry.fromPartial(object.redelegationEntry) : undefined; + if (object.redelegationEntry !== undefined && object.redelegationEntry !== null) { + message.redelegationEntry = RedelegationEntry.fromPartial(object.redelegationEntry); + } message.balance = object.balance ?? ""; return message; }, @@ -3119,10 +3039,10 @@ export const RedelegationResponse = { return message; }, fromJSON(object: any): RedelegationResponse { - return { - redelegation: isSet(object.redelegation) ? Redelegation.fromJSON(object.redelegation) : undefined, - entries: Array.isArray(object?.entries) ? object.entries.map((e: any) => RedelegationEntryResponse.fromJSON(e)) : [] - }; + const obj = createBaseRedelegationResponse(); + if (isSet(object.redelegation)) obj.redelegation = Redelegation.fromJSON(object.redelegation); + if (Array.isArray(object?.entries)) obj.entries = object.entries.map((e: any) => RedelegationEntryResponse.fromJSON(e)); + return obj; }, toJSON(message: RedelegationResponse): JsonSafe { const obj: any = {}; @@ -3136,7 +3056,9 @@ export const RedelegationResponse = { }, fromPartial(object: DeepPartial): RedelegationResponse { const message = createBaseRedelegationResponse(); - message.redelegation = object.redelegation !== undefined && object.redelegation !== null ? Redelegation.fromPartial(object.redelegation) : undefined; + if (object.redelegation !== undefined && object.redelegation !== null) { + message.redelegation = Redelegation.fromPartial(object.redelegation); + } message.entries = object.entries?.map(e => RedelegationEntryResponse.fromPartial(e)) || []; return message; }, @@ -3211,10 +3133,10 @@ function createBasePool(): Pool { export const Pool = { typeUrl: "/cosmos.staking.v1beta1.Pool", encode(message: Pool, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.notBondedTokens !== "") { + if (message.notBondedTokens !== undefined) { writer.uint32(10).string(message.notBondedTokens); } - if (message.bondedTokens !== "") { + if (message.bondedTokens !== undefined) { writer.uint32(18).string(message.bondedTokens); } return writer; @@ -3240,10 +3162,10 @@ export const Pool = { return message; }, fromJSON(object: any): Pool { - return { - notBondedTokens: isSet(object.notBondedTokens) ? String(object.notBondedTokens) : "", - bondedTokens: isSet(object.bondedTokens) ? String(object.bondedTokens) : "" - }; + const obj = createBasePool(); + if (isSet(object.notBondedTokens)) obj.notBondedTokens = String(object.notBondedTokens); + if (isSet(object.bondedTokens)) obj.bondedTokens = String(object.bondedTokens); + return obj; }, toJSON(message: Pool): JsonSafe { const obj: any = {}; 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..7007045acd 100644 --- a/__fixtures__/v-next/outputv4/cosmos/staking/v1beta1/tx.amino.ts +++ b/__fixtures__/v-next/outputv4/cosmos/staking/v1beta1/tx.amino.ts @@ -1,10 +1,10 @@ -import { Description, DescriptionSDKType, CommissionRates, CommissionRatesSDKType } from "./staking"; -import { Any, AnySDKType } from "../../../google/protobuf/any"; -import { Coin, CoinSDKType } from "../../base/v1beta1/coin"; -import { Timestamp, TimestampSDKType } from "../../../google/protobuf/timestamp"; +import { Description, DescriptionSDKType, CommissionRates, CommissionRatesSDKType } from "./staking.js"; +import { Any, AnySDKType } from "../../../google/protobuf/any.js"; +import { Coin, CoinSDKType } from "../../base/v1beta1/coin.js"; +import { Timestamp, TimestampSDKType } from "../../../google/protobuf/timestamp.js"; import { AminoMsg, Pubkey } from "@cosmjs/amino"; import { decodePubkey, encodePubkey } from "@cosmjs/proto-signing"; -import { MsgCreateValidator, MsgCreateValidatorSDKType, MsgEditValidator, MsgEditValidatorSDKType, MsgDelegate, MsgDelegateSDKType, MsgBeginRedelegate, MsgBeginRedelegateSDKType, MsgUndelegate, MsgUndelegateSDKType } from "./tx"; +import { MsgCreateValidator, MsgCreateValidatorSDKType, MsgEditValidator, MsgEditValidatorSDKType, MsgDelegate, MsgDelegateSDKType, MsgBeginRedelegate, MsgBeginRedelegateSDKType, MsgUndelegate, MsgUndelegateSDKType } from "./tx.js"; export interface MsgCreateValidatorAminoType extends AminoMsg { type: "cosmos-sdk/MsgCreateValidator"; value: { diff --git a/__fixtures__/v-next/outputv4/cosmos/staking/v1beta1/tx.registry.ts b/__fixtures__/v-next/outputv4/cosmos/staking/v1beta1/tx.registry.ts index e93cb84370..bf55cd2deb 100644 --- a/__fixtures__/v-next/outputv4/cosmos/staking/v1beta1/tx.registry.ts +++ b/__fixtures__/v-next/outputv4/cosmos/staking/v1beta1/tx.registry.ts @@ -1,9 +1,9 @@ -import { Description, DescriptionSDKType, CommissionRates, CommissionRatesSDKType } from "./staking"; -import { Any, AnySDKType } from "../../../google/protobuf/any"; -import { Coin, CoinSDKType } from "../../base/v1beta1/coin"; -import { Timestamp, TimestampSDKType } from "../../../google/protobuf/timestamp"; +import { Description, DescriptionSDKType, CommissionRates, CommissionRatesSDKType } from "./staking.js"; +import { Any, AnySDKType } from "../../../google/protobuf/any.js"; +import { Coin, CoinSDKType } from "../../base/v1beta1/coin.js"; +import { Timestamp, TimestampSDKType } from "../../../google/protobuf/timestamp.js"; import { GeneratedType, Registry } from "@cosmjs/proto-signing"; -import { MsgCreateValidator, MsgCreateValidatorSDKType, MsgEditValidator, MsgEditValidatorSDKType, MsgDelegate, MsgDelegateSDKType, MsgBeginRedelegate, MsgBeginRedelegateSDKType, MsgUndelegate, MsgUndelegateSDKType } from "./tx"; +import { MsgCreateValidator, MsgCreateValidatorSDKType, MsgEditValidator, MsgEditValidatorSDKType, MsgDelegate, MsgDelegateSDKType, MsgBeginRedelegate, MsgBeginRedelegateSDKType, MsgUndelegate, MsgUndelegateSDKType } from "./tx.js"; export const registry: ReadonlyArray<[string, GeneratedType]> = [["/cosmos.staking.v1beta1.MsgCreateValidator", MsgCreateValidator], ["/cosmos.staking.v1beta1.MsgEditValidator", MsgEditValidator], ["/cosmos.staking.v1beta1.MsgDelegate", MsgDelegate], ["/cosmos.staking.v1beta1.MsgBeginRedelegate", MsgBeginRedelegate], ["/cosmos.staking.v1beta1.MsgUndelegate", MsgUndelegate]]; export const load = (protoRegistry: Registry) => { registry.forEach(([typeUrl, mod]) => { diff --git a/__fixtures__/v-next/outputv4/cosmos/staking/v1beta1/tx.rpc.msg.ts b/__fixtures__/v-next/outputv4/cosmos/staking/v1beta1/tx.rpc.msg.ts index c50d6c8f28..f807da072f 100644 --- a/__fixtures__/v-next/outputv4/cosmos/staking/v1beta1/tx.rpc.msg.ts +++ b/__fixtures__/v-next/outputv4/cosmos/staking/v1beta1/tx.rpc.msg.ts @@ -1,10 +1,10 @@ -import { Description, DescriptionSDKType, CommissionRates, CommissionRatesSDKType } from "./staking"; -import { Any, AnySDKType } from "../../../google/protobuf/any"; -import { Coin, CoinSDKType } from "../../base/v1beta1/coin"; -import { Timestamp, TimestampSDKType } from "../../../google/protobuf/timestamp"; -import { Rpc } from "../../../helpers"; -import { BinaryReader } from "../../../binary"; -import { MsgCreateValidator, MsgCreateValidatorSDKType, MsgCreateValidatorResponse, MsgCreateValidatorResponseSDKType, MsgEditValidator, MsgEditValidatorSDKType, MsgEditValidatorResponse, MsgEditValidatorResponseSDKType, MsgDelegate, MsgDelegateSDKType, MsgDelegateResponse, MsgDelegateResponseSDKType, MsgBeginRedelegate, MsgBeginRedelegateSDKType, MsgBeginRedelegateResponse, MsgBeginRedelegateResponseSDKType, MsgUndelegate, MsgUndelegateSDKType, MsgUndelegateResponse, MsgUndelegateResponseSDKType } from "./tx"; +import { Description, DescriptionSDKType, CommissionRates, CommissionRatesSDKType } from "./staking.js"; +import { Any, AnySDKType } from "../../../google/protobuf/any.js"; +import { Coin, CoinSDKType } from "../../base/v1beta1/coin.js"; +import { Timestamp, TimestampSDKType } from "../../../google/protobuf/timestamp.js"; +import { Rpc } from "../../../helpers.js"; +import { BinaryReader } from "../../../binary.js"; +import { MsgCreateValidator, MsgCreateValidatorSDKType, MsgCreateValidatorResponse, MsgCreateValidatorResponseSDKType, MsgEditValidator, MsgEditValidatorSDKType, MsgEditValidatorResponse, MsgEditValidatorResponseSDKType, MsgDelegate, MsgDelegateSDKType, MsgDelegateResponse, MsgDelegateResponseSDKType, MsgBeginRedelegate, MsgBeginRedelegateSDKType, MsgBeginRedelegateResponse, MsgBeginRedelegateResponseSDKType, MsgUndelegate, MsgUndelegateSDKType, MsgUndelegateResponse, MsgUndelegateResponseSDKType } from "./tx.js"; /** Msg defines the staking Msg service. */ export interface Msg { /** CreateValidator defines a method for creating a new validator. */ diff --git a/__fixtures__/v-next/outputv4/cosmos/staking/v1beta1/tx.ts b/__fixtures__/v-next/outputv4/cosmos/staking/v1beta1/tx.ts index ffe5f2b70e..2fc07ea2b2 100644 --- a/__fixtures__/v-next/outputv4/cosmos/staking/v1beta1/tx.ts +++ b/__fixtures__/v-next/outputv4/cosmos/staking/v1beta1/tx.ts @@ -1,13 +1,12 @@ -import { Description, DescriptionSDKType, CommissionRates, CommissionRatesSDKType } from "./staking"; -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 { JsonSafe } from "../../../json-safe"; +import { Description, DescriptionSDKType, CommissionRates, CommissionRatesSDKType } from "./staking.js"; +import { Any, AnySDKType } from "../../../google/protobuf/any.js"; +import { Coin, CoinSDKType } from "../../base/v1beta1/coin.js"; +import { Timestamp, TimestampSDKType } from "../../../google/protobuf/timestamp.js"; +import { BinaryReader, BinaryWriter } from "../../../binary.js"; +import { isSet, DeepPartial, toTimestamp, fromTimestamp } from "../../../helpers.js"; +import { JsonSafe } from "../../../json-safe.js"; import { encodePubkey, decodePubkey } from "@cosmjs/proto-signing"; import { Decimal } from "@cosmjs/math"; -import { ComputedRef } from "vue"; export const protobufPackage = "cosmos.staking.v1beta1"; /** MsgCreateValidator defines a SDK message for creating a new validator. */ export interface MsgCreateValidator { @@ -19,15 +18,6 @@ export interface MsgCreateValidator { pubkey?: Any; value: Coin; } -export interface ReactiveMsgCreateValidator { - description: ComputedRef; - commission: ComputedRef; - minSelfDelegation: ComputedRef; - delegatorAddress: ComputedRef; - validatorAddress: ComputedRef; - pubkey?: ComputedRef; - value: ComputedRef; -} export interface MsgCreateValidatorProtoMsg { typeUrl: "/cosmos.staking.v1beta1.MsgCreateValidator"; value: Uint8Array; @@ -44,7 +34,6 @@ export interface MsgCreateValidatorSDKType { } /** MsgCreateValidatorResponse defines the Msg/CreateValidator response type. */ export interface MsgCreateValidatorResponse {} -export interface ReactiveMsgCreateValidatorResponse {} export interface MsgCreateValidatorResponseProtoMsg { typeUrl: "/cosmos.staking.v1beta1.MsgCreateValidatorResponse"; value: Uint8Array; @@ -64,12 +53,6 @@ export interface MsgEditValidator { commissionRate: string; minSelfDelegation: string; } -export interface ReactiveMsgEditValidator { - description: ComputedRef; - validatorAddress: ComputedRef; - commissionRate: ComputedRef; - minSelfDelegation: ComputedRef; -} export interface MsgEditValidatorProtoMsg { typeUrl: "/cosmos.staking.v1beta1.MsgEditValidator"; value: Uint8Array; @@ -83,7 +66,6 @@ export interface MsgEditValidatorSDKType { } /** MsgEditValidatorResponse defines the Msg/EditValidator response type. */ export interface MsgEditValidatorResponse {} -export interface ReactiveMsgEditValidatorResponse {} export interface MsgEditValidatorResponseProtoMsg { typeUrl: "/cosmos.staking.v1beta1.MsgEditValidatorResponse"; value: Uint8Array; @@ -99,11 +81,6 @@ export interface MsgDelegate { validatorAddress: string; amount: Coin; } -export interface ReactiveMsgDelegate { - delegatorAddress: ComputedRef; - validatorAddress: ComputedRef; - amount: ComputedRef; -} export interface MsgDelegateProtoMsg { typeUrl: "/cosmos.staking.v1beta1.MsgDelegate"; value: Uint8Array; @@ -119,7 +96,6 @@ export interface MsgDelegateSDKType { } /** MsgDelegateResponse defines the Msg/Delegate response type. */ export interface MsgDelegateResponse {} -export interface ReactiveMsgDelegateResponse {} export interface MsgDelegateResponseProtoMsg { typeUrl: "/cosmos.staking.v1beta1.MsgDelegateResponse"; value: Uint8Array; @@ -136,12 +112,6 @@ export interface MsgBeginRedelegate { validatorDstAddress: string; amount: Coin; } -export interface ReactiveMsgBeginRedelegate { - delegatorAddress: ComputedRef; - validatorSrcAddress: ComputedRef; - validatorDstAddress: ComputedRef; - amount: ComputedRef; -} export interface MsgBeginRedelegateProtoMsg { typeUrl: "/cosmos.staking.v1beta1.MsgBeginRedelegate"; value: Uint8Array; @@ -160,9 +130,6 @@ export interface MsgBeginRedelegateSDKType { export interface MsgBeginRedelegateResponse { completionTime: Date; } -export interface ReactiveMsgBeginRedelegateResponse { - completionTime: ComputedRef; -} export interface MsgBeginRedelegateResponseProtoMsg { typeUrl: "/cosmos.staking.v1beta1.MsgBeginRedelegateResponse"; value: Uint8Array; @@ -180,11 +147,6 @@ export interface MsgUndelegate { validatorAddress: string; amount: Coin; } -export interface ReactiveMsgUndelegate { - delegatorAddress: ComputedRef; - validatorAddress: ComputedRef; - amount: ComputedRef; -} export interface MsgUndelegateProtoMsg { typeUrl: "/cosmos.staking.v1beta1.MsgUndelegate"; value: Uint8Array; @@ -202,9 +164,6 @@ export interface MsgUndelegateSDKType { export interface MsgUndelegateResponse { completionTime: Date; } -export interface ReactiveMsgUndelegateResponse { - completionTime: ComputedRef; -} export interface MsgUndelegateResponseProtoMsg { typeUrl: "/cosmos.staking.v1beta1.MsgUndelegateResponse"; value: Uint8Array; @@ -233,13 +192,13 @@ export const MsgCreateValidator = { if (message.commission !== undefined) { CommissionRates.encode(message.commission, writer.uint32(18).fork()).ldelim(); } - if (message.minSelfDelegation !== "") { + if (message.minSelfDelegation !== undefined) { writer.uint32(26).string(message.minSelfDelegation); } - if (message.delegatorAddress !== "") { + if (message.delegatorAddress !== undefined) { writer.uint32(34).string(message.delegatorAddress); } - if (message.validatorAddress !== "") { + if (message.validatorAddress !== undefined) { writer.uint32(42).string(message.validatorAddress); } if (message.pubkey !== undefined) { @@ -286,15 +245,15 @@ export const MsgCreateValidator = { return message; }, fromJSON(object: any): MsgCreateValidator { - return { - description: isSet(object.description) ? Description.fromJSON(object.description) : undefined, - commission: isSet(object.commission) ? CommissionRates.fromJSON(object.commission) : undefined, - minSelfDelegation: isSet(object.minSelfDelegation) ? String(object.minSelfDelegation) : "", - delegatorAddress: isSet(object.delegatorAddress) ? String(object.delegatorAddress) : "", - validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", - pubkey: isSet(object.pubkey) ? Any.fromJSON(object.pubkey) : undefined, - value: isSet(object.value) ? Coin.fromJSON(object.value) : undefined - }; + const obj = createBaseMsgCreateValidator(); + if (isSet(object.description)) obj.description = Description.fromJSON(object.description); + if (isSet(object.commission)) obj.commission = CommissionRates.fromJSON(object.commission); + if (isSet(object.minSelfDelegation)) obj.minSelfDelegation = String(object.minSelfDelegation); + if (isSet(object.delegatorAddress)) obj.delegatorAddress = String(object.delegatorAddress); + if (isSet(object.validatorAddress)) obj.validatorAddress = String(object.validatorAddress); + if (isSet(object.pubkey)) obj.pubkey = Any.fromJSON(object.pubkey); + if (isSet(object.value)) obj.value = Coin.fromJSON(object.value); + return obj; }, toJSON(message: MsgCreateValidator): JsonSafe { const obj: any = {}; @@ -309,13 +268,21 @@ export const MsgCreateValidator = { }, fromPartial(object: DeepPartial): MsgCreateValidator { const message = createBaseMsgCreateValidator(); - message.description = object.description !== undefined && object.description !== null ? Description.fromPartial(object.description) : undefined; - message.commission = object.commission !== undefined && object.commission !== null ? CommissionRates.fromPartial(object.commission) : undefined; + if (object.description !== undefined && object.description !== null) { + message.description = Description.fromPartial(object.description); + } + if (object.commission !== undefined && object.commission !== null) { + message.commission = CommissionRates.fromPartial(object.commission); + } message.minSelfDelegation = object.minSelfDelegation ?? ""; message.delegatorAddress = object.delegatorAddress ?? ""; message.validatorAddress = object.validatorAddress ?? ""; - message.pubkey = object.pubkey !== undefined && object.pubkey !== null ? Any.fromPartial(object.pubkey) : undefined; - message.value = object.value !== undefined && object.value !== null ? Coin.fromPartial(object.value) : undefined; + if (object.pubkey !== undefined && object.pubkey !== null) { + message.pubkey = Any.fromPartial(object.pubkey); + } + if (object.value !== undefined && object.value !== null) { + message.value = Coin.fromPartial(object.value); + } return message; }, fromSDK(object: MsgCreateValidatorSDKType): MsgCreateValidator { @@ -432,7 +399,8 @@ export const MsgCreateValidatorResponse = { return message; }, fromJSON(_: any): MsgCreateValidatorResponse { - return {}; + const obj = createBaseMsgCreateValidatorResponse(); + return obj; }, toJSON(_: MsgCreateValidatorResponse): JsonSafe { const obj: any = {}; @@ -496,13 +464,13 @@ export const MsgEditValidator = { if (message.description !== undefined) { Description.encode(message.description, writer.uint32(10).fork()).ldelim(); } - if (message.validatorAddress !== "") { + if (message.validatorAddress !== undefined) { writer.uint32(18).string(message.validatorAddress); } - if (message.commissionRate !== "") { + if (message.commissionRate !== undefined) { writer.uint32(26).string(Decimal.fromUserInput(message.commissionRate, 18).atomics); } - if (message.minSelfDelegation !== "") { + if (message.minSelfDelegation !== undefined) { writer.uint32(34).string(message.minSelfDelegation); } return writer; @@ -534,12 +502,12 @@ export const MsgEditValidator = { return message; }, fromJSON(object: any): MsgEditValidator { - return { - description: isSet(object.description) ? Description.fromJSON(object.description) : undefined, - validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", - commissionRate: isSet(object.commissionRate) ? String(object.commissionRate) : "", - minSelfDelegation: isSet(object.minSelfDelegation) ? String(object.minSelfDelegation) : "" - }; + const obj = createBaseMsgEditValidator(); + if (isSet(object.description)) obj.description = Description.fromJSON(object.description); + if (isSet(object.validatorAddress)) obj.validatorAddress = String(object.validatorAddress); + if (isSet(object.commissionRate)) obj.commissionRate = String(object.commissionRate); + if (isSet(object.minSelfDelegation)) obj.minSelfDelegation = String(object.minSelfDelegation); + return obj; }, toJSON(message: MsgEditValidator): JsonSafe { const obj: any = {}; @@ -551,7 +519,9 @@ export const MsgEditValidator = { }, fromPartial(object: DeepPartial): MsgEditValidator { const message = createBaseMsgEditValidator(); - message.description = object.description !== undefined && object.description !== null ? Description.fromPartial(object.description) : undefined; + if (object.description !== undefined && object.description !== null) { + message.description = Description.fromPartial(object.description); + } message.validatorAddress = object.validatorAddress ?? ""; message.commissionRate = object.commissionRate ?? ""; message.minSelfDelegation = object.minSelfDelegation ?? ""; @@ -650,7 +620,8 @@ export const MsgEditValidatorResponse = { return message; }, fromJSON(_: any): MsgEditValidatorResponse { - return {}; + const obj = createBaseMsgEditValidatorResponse(); + return obj; }, toJSON(_: MsgEditValidatorResponse): JsonSafe { const obj: any = {}; @@ -710,10 +681,10 @@ function createBaseMsgDelegate(): MsgDelegate { export const MsgDelegate = { typeUrl: "/cosmos.staking.v1beta1.MsgDelegate", encode(message: MsgDelegate, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.delegatorAddress !== "") { + if (message.delegatorAddress !== undefined) { writer.uint32(10).string(message.delegatorAddress); } - if (message.validatorAddress !== "") { + if (message.validatorAddress !== undefined) { writer.uint32(18).string(message.validatorAddress); } if (message.amount !== undefined) { @@ -745,11 +716,11 @@ export const MsgDelegate = { return message; }, fromJSON(object: any): MsgDelegate { - return { - delegatorAddress: isSet(object.delegatorAddress) ? String(object.delegatorAddress) : "", - validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", - amount: isSet(object.amount) ? Coin.fromJSON(object.amount) : undefined - }; + const obj = createBaseMsgDelegate(); + if (isSet(object.delegatorAddress)) obj.delegatorAddress = String(object.delegatorAddress); + if (isSet(object.validatorAddress)) obj.validatorAddress = String(object.validatorAddress); + if (isSet(object.amount)) obj.amount = Coin.fromJSON(object.amount); + return obj; }, toJSON(message: MsgDelegate): JsonSafe { const obj: any = {}; @@ -762,7 +733,9 @@ export const MsgDelegate = { const message = createBaseMsgDelegate(); message.delegatorAddress = object.delegatorAddress ?? ""; message.validatorAddress = object.validatorAddress ?? ""; - message.amount = object.amount !== undefined && object.amount !== null ? Coin.fromPartial(object.amount) : undefined; + if (object.amount !== undefined && object.amount !== null) { + message.amount = Coin.fromPartial(object.amount); + } return message; }, fromSDK(object: MsgDelegateSDKType): MsgDelegate { @@ -851,7 +824,8 @@ export const MsgDelegateResponse = { return message; }, fromJSON(_: any): MsgDelegateResponse { - return {}; + const obj = createBaseMsgDelegateResponse(); + return obj; }, toJSON(_: MsgDelegateResponse): JsonSafe { const obj: any = {}; @@ -912,13 +886,13 @@ function createBaseMsgBeginRedelegate(): MsgBeginRedelegate { export const MsgBeginRedelegate = { typeUrl: "/cosmos.staking.v1beta1.MsgBeginRedelegate", encode(message: MsgBeginRedelegate, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.delegatorAddress !== "") { + if (message.delegatorAddress !== undefined) { writer.uint32(10).string(message.delegatorAddress); } - if (message.validatorSrcAddress !== "") { + if (message.validatorSrcAddress !== undefined) { writer.uint32(18).string(message.validatorSrcAddress); } - if (message.validatorDstAddress !== "") { + if (message.validatorDstAddress !== undefined) { writer.uint32(26).string(message.validatorDstAddress); } if (message.amount !== undefined) { @@ -953,12 +927,12 @@ export const MsgBeginRedelegate = { return message; }, fromJSON(object: any): MsgBeginRedelegate { - return { - delegatorAddress: isSet(object.delegatorAddress) ? String(object.delegatorAddress) : "", - validatorSrcAddress: isSet(object.validatorSrcAddress) ? String(object.validatorSrcAddress) : "", - validatorDstAddress: isSet(object.validatorDstAddress) ? String(object.validatorDstAddress) : "", - amount: isSet(object.amount) ? Coin.fromJSON(object.amount) : undefined - }; + const obj = createBaseMsgBeginRedelegate(); + if (isSet(object.delegatorAddress)) obj.delegatorAddress = String(object.delegatorAddress); + if (isSet(object.validatorSrcAddress)) obj.validatorSrcAddress = String(object.validatorSrcAddress); + if (isSet(object.validatorDstAddress)) obj.validatorDstAddress = String(object.validatorDstAddress); + if (isSet(object.amount)) obj.amount = Coin.fromJSON(object.amount); + return obj; }, toJSON(message: MsgBeginRedelegate): JsonSafe { const obj: any = {}; @@ -973,7 +947,9 @@ export const MsgBeginRedelegate = { message.delegatorAddress = object.delegatorAddress ?? ""; message.validatorSrcAddress = object.validatorSrcAddress ?? ""; message.validatorDstAddress = object.validatorDstAddress ?? ""; - message.amount = object.amount !== undefined && object.amount !== null ? Coin.fromPartial(object.amount) : undefined; + if (object.amount !== undefined && object.amount !== null) { + message.amount = Coin.fromPartial(object.amount); + } return message; }, fromSDK(object: MsgBeginRedelegateSDKType): MsgBeginRedelegate { @@ -1077,9 +1053,9 @@ export const MsgBeginRedelegateResponse = { return message; }, fromJSON(object: any): MsgBeginRedelegateResponse { - return { - completionTime: isSet(object.completionTime) ? new Date(object.completionTime) : undefined - }; + const obj = createBaseMsgBeginRedelegateResponse(); + if (isSet(object.completionTime)) obj.completionTime = new Date(object.completionTime); + return obj; }, toJSON(message: MsgBeginRedelegateResponse): JsonSafe { const obj: any = {}; @@ -1150,10 +1126,10 @@ function createBaseMsgUndelegate(): MsgUndelegate { export const MsgUndelegate = { typeUrl: "/cosmos.staking.v1beta1.MsgUndelegate", encode(message: MsgUndelegate, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.delegatorAddress !== "") { + if (message.delegatorAddress !== undefined) { writer.uint32(10).string(message.delegatorAddress); } - if (message.validatorAddress !== "") { + if (message.validatorAddress !== undefined) { writer.uint32(18).string(message.validatorAddress); } if (message.amount !== undefined) { @@ -1185,11 +1161,11 @@ export const MsgUndelegate = { return message; }, fromJSON(object: any): MsgUndelegate { - return { - delegatorAddress: isSet(object.delegatorAddress) ? String(object.delegatorAddress) : "", - validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", - amount: isSet(object.amount) ? Coin.fromJSON(object.amount) : undefined - }; + const obj = createBaseMsgUndelegate(); + if (isSet(object.delegatorAddress)) obj.delegatorAddress = String(object.delegatorAddress); + if (isSet(object.validatorAddress)) obj.validatorAddress = String(object.validatorAddress); + if (isSet(object.amount)) obj.amount = Coin.fromJSON(object.amount); + return obj; }, toJSON(message: MsgUndelegate): JsonSafe { const obj: any = {}; @@ -1202,7 +1178,9 @@ export const MsgUndelegate = { const message = createBaseMsgUndelegate(); message.delegatorAddress = object.delegatorAddress ?? ""; message.validatorAddress = object.validatorAddress ?? ""; - message.amount = object.amount !== undefined && object.amount !== null ? Coin.fromPartial(object.amount) : undefined; + if (object.amount !== undefined && object.amount !== null) { + message.amount = Coin.fromPartial(object.amount); + } return message; }, fromSDK(object: MsgUndelegateSDKType): MsgUndelegate { @@ -1299,9 +1277,9 @@ export const MsgUndelegateResponse = { return message; }, fromJSON(object: any): MsgUndelegateResponse { - return { - completionTime: isSet(object.completionTime) ? new Date(object.completionTime) : undefined - }; + const obj = createBaseMsgUndelegateResponse(); + if (isSet(object.completionTime)) obj.completionTime = new Date(object.completionTime); + return obj; }, toJSON(message: MsgUndelegateResponse): JsonSafe { const obj: any = {}; 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 a8e84e7a6b..5e627b7fc1 100644 --- a/__fixtures__/v-next/outputv4/cosmos/tx/signing/v1beta1/signing.ts +++ b/__fixtures__/v-next/outputv4/cosmos/tx/signing/v1beta1/signing.ts @@ -1,9 +1,8 @@ -import { CompactBitArray, CompactBitArraySDKType } from "../../../crypto/multisig/v1beta1/multisig"; -import { Any, AnySDKType } from "../../../../google/protobuf/any"; -import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { JsonSafe } from "../../../../json-safe"; -import { DeepPartial, isSet, bytesFromBase64, base64FromBytes } from "../../../../helpers"; -import { ComputedRef } from "vue"; +import { CompactBitArray, CompactBitArraySDKType } from "../../../crypto/multisig/v1beta1/multisig.js"; +import { Any, AnySDKType } from "../../../../google/protobuf/any.js"; +import { BinaryReader, BinaryWriter } from "../../../../binary.js"; +import { JsonSafe } from "../../../../json-safe.js"; +import { DeepPartial, isSet, bytesFromBase64, base64FromBytes } from "../../../../helpers.js"; export const protobufPackage = "cosmos.tx.signing.v1beta1"; /** * SignMode represents a signing mode with its own security guarantees. @@ -94,9 +93,6 @@ export interface SignatureDescriptors { /** signatures are the signature descriptors */ signatures: SignatureDescriptor[]; } -export interface ReactiveSignatureDescriptors { - signatures: ComputedRef; -} export interface SignatureDescriptorsProtoMsg { typeUrl: "/cosmos.tx.signing.v1beta1.SignatureDescriptors"; value: Uint8Array; @@ -122,11 +118,6 @@ export interface SignatureDescriptor { */ sequence: bigint; } -export interface ReactiveSignatureDescriptor { - publicKey?: ComputedRef; - data?: ComputedRef; - sequence: ComputedRef; -} export interface SignatureDescriptorProtoMsg { typeUrl: "/cosmos.tx.signing.v1beta1.SignatureDescriptor"; value: Uint8Array; @@ -149,10 +140,6 @@ export interface SignatureDescriptor_Data { /** multi represents a multisig signer */ multi?: SignatureDescriptor_Data_Multi; } -export interface ReactiveSignatureDescriptor_Data { - single?: ComputedRef; - multi?: ComputedRef; -} export interface SignatureDescriptor_DataProtoMsg { typeUrl: "/cosmos.tx.signing.v1beta1.Data"; value: Uint8Array; @@ -169,10 +156,6 @@ export interface SignatureDescriptor_Data_Single { /** signature is the raw signature bytes */ signature: Uint8Array; } -export interface ReactiveSignatureDescriptor_Data_Single { - mode: ComputedRef; - signature: ComputedRef; -} export interface SignatureDescriptor_Data_SingleProtoMsg { typeUrl: "/cosmos.tx.signing.v1beta1.Single"; value: Uint8Array; @@ -189,10 +172,6 @@ export interface SignatureDescriptor_Data_Multi { /** signatures is the signatures of the multi-signature */ signatures: SignatureDescriptor_Data[]; } -export interface ReactiveSignatureDescriptor_Data_Multi { - bitarray?: ComputedRef; - signatures: ComputedRef; -} export interface SignatureDescriptor_Data_MultiProtoMsg { typeUrl: "/cosmos.tx.signing.v1beta1.Multi"; value: Uint8Array; @@ -233,9 +212,9 @@ export const SignatureDescriptors = { return message; }, fromJSON(object: any): SignatureDescriptors { - return { - signatures: Array.isArray(object?.signatures) ? object.signatures.map((e: any) => SignatureDescriptor.fromJSON(e)) : [] - }; + const obj = createBaseSignatureDescriptors(); + if (Array.isArray(object?.signatures)) obj.signatures = object.signatures.map((e: any) => SignatureDescriptor.fromJSON(e)); + return obj; }, toJSON(message: SignatureDescriptors): JsonSafe { const obj: any = {}; @@ -322,7 +301,7 @@ export const SignatureDescriptor = { if (message.data !== undefined) { SignatureDescriptor_Data.encode(message.data, writer.uint32(18).fork()).ldelim(); } - if (message.sequence !== BigInt(0)) { + if (message.sequence !== undefined) { writer.uint32(24).uint64(message.sequence); } return writer; @@ -351,11 +330,11 @@ export const SignatureDescriptor = { return message; }, fromJSON(object: any): SignatureDescriptor { - return { - publicKey: isSet(object.publicKey) ? Any.fromJSON(object.publicKey) : undefined, - data: isSet(object.data) ? SignatureDescriptor_Data.fromJSON(object.data) : undefined, - sequence: isSet(object.sequence) ? BigInt(object.sequence.toString()) : BigInt(0) - }; + const obj = createBaseSignatureDescriptor(); + if (isSet(object.publicKey)) obj.publicKey = Any.fromJSON(object.publicKey); + if (isSet(object.data)) obj.data = SignatureDescriptor_Data.fromJSON(object.data); + if (isSet(object.sequence)) obj.sequence = BigInt(object.sequence.toString()); + return obj; }, toJSON(message: SignatureDescriptor): JsonSafe { const obj: any = {}; @@ -366,9 +345,15 @@ export const SignatureDescriptor = { }, fromPartial(object: DeepPartial): SignatureDescriptor { const message = createBaseSignatureDescriptor(); - message.publicKey = object.publicKey !== undefined && object.publicKey !== null ? Any.fromPartial(object.publicKey) : undefined; - message.data = object.data !== undefined && object.data !== null ? SignatureDescriptor_Data.fromPartial(object.data) : undefined; - message.sequence = object.sequence !== undefined && object.sequence !== null ? BigInt(object.sequence.toString()) : BigInt(0); + if (object.publicKey !== undefined && object.publicKey !== null) { + message.publicKey = Any.fromPartial(object.publicKey); + } + if (object.data !== undefined && object.data !== null) { + message.data = SignatureDescriptor_Data.fromPartial(object.data); + } + if (object.sequence !== undefined && object.sequence !== null) { + message.sequence = BigInt(object.sequence.toString()); + } return message; }, fromSDK(object: SignatureDescriptorSDKType): SignatureDescriptor { @@ -472,10 +457,10 @@ export const SignatureDescriptor_Data = { return message; }, fromJSON(object: any): SignatureDescriptor_Data { - return { - single: isSet(object.single) ? SignatureDescriptor_Data_Single.fromJSON(object.single) : undefined, - multi: isSet(object.multi) ? SignatureDescriptor_Data_Multi.fromJSON(object.multi) : undefined - }; + const obj = createBaseSignatureDescriptor_Data(); + if (isSet(object.single)) obj.single = SignatureDescriptor_Data_Single.fromJSON(object.single); + if (isSet(object.multi)) obj.multi = SignatureDescriptor_Data_Multi.fromJSON(object.multi); + return obj; }, toJSON(message: SignatureDescriptor_Data): JsonSafe { const obj: any = {}; @@ -485,8 +470,12 @@ export const SignatureDescriptor_Data = { }, fromPartial(object: DeepPartial): SignatureDescriptor_Data { const message = createBaseSignatureDescriptor_Data(); - message.single = object.single !== undefined && object.single !== null ? SignatureDescriptor_Data_Single.fromPartial(object.single) : undefined; - message.multi = object.multi !== undefined && object.multi !== null ? SignatureDescriptor_Data_Multi.fromPartial(object.multi) : undefined; + if (object.single !== undefined && object.single !== null) { + message.single = SignatureDescriptor_Data_Single.fromPartial(object.single); + } + if (object.multi !== undefined && object.multi !== null) { + message.multi = SignatureDescriptor_Data_Multi.fromPartial(object.multi); + } return message; }, fromSDK(object: SignatureDescriptor_DataSDKType): SignatureDescriptor_Data { @@ -583,10 +572,10 @@ export const SignatureDescriptor_Data_Single = { return message; }, fromJSON(object: any): SignatureDescriptor_Data_Single { - return { - mode: isSet(object.mode) ? signModeFromJSON(object.mode) : -1, - signature: isSet(object.signature) ? bytesFromBase64(object.signature) : new Uint8Array() - }; + const obj = createBaseSignatureDescriptor_Data_Single(); + if (isSet(object.mode)) obj.mode = signModeFromJSON(object.mode); + if (isSet(object.signature)) obj.signature = bytesFromBase64(object.signature); + return obj; }, toJSON(message: SignatureDescriptor_Data_Single): JsonSafe { const obj: any = {}; @@ -694,10 +683,10 @@ export const SignatureDescriptor_Data_Multi = { return message; }, fromJSON(object: any): SignatureDescriptor_Data_Multi { - return { - bitarray: isSet(object.bitarray) ? CompactBitArray.fromJSON(object.bitarray) : undefined, - signatures: Array.isArray(object?.signatures) ? object.signatures.map((e: any) => SignatureDescriptor_Data.fromJSON(e)) : [] - }; + const obj = createBaseSignatureDescriptor_Data_Multi(); + if (isSet(object.bitarray)) obj.bitarray = CompactBitArray.fromJSON(object.bitarray); + if (Array.isArray(object?.signatures)) obj.signatures = object.signatures.map((e: any) => SignatureDescriptor_Data.fromJSON(e)); + return obj; }, toJSON(message: SignatureDescriptor_Data_Multi): JsonSafe { const obj: any = {}; @@ -711,7 +700,9 @@ export const SignatureDescriptor_Data_Multi = { }, fromPartial(object: DeepPartial): SignatureDescriptor_Data_Multi { const message = createBaseSignatureDescriptor_Data_Multi(); - message.bitarray = object.bitarray !== undefined && object.bitarray !== null ? CompactBitArray.fromPartial(object.bitarray) : undefined; + if (object.bitarray !== undefined && object.bitarray !== null) { + message.bitarray = CompactBitArray.fromPartial(object.bitarray); + } message.signatures = object.signatures?.map(e => SignatureDescriptor_Data.fromPartial(e)) || []; return message; }, diff --git a/__fixtures__/v-next/outputv4/cosmos/tx/v1beta1/service.lcd.ts b/__fixtures__/v-next/outputv4/cosmos/tx/v1beta1/service.lcd.ts index fa75aeddef..d2d8f63cd5 100644 --- a/__fixtures__/v-next/outputv4/cosmos/tx/v1beta1/service.lcd.ts +++ b/__fixtures__/v-next/outputv4/cosmos/tx/v1beta1/service.lcd.ts @@ -1,11 +1,11 @@ -import { Tx, TxSDKType } from "./tx"; -import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../base/query/v1beta1/pagination"; -import { TxResponse, TxResponseSDKType, GasInfo, GasInfoSDKType, Result, ResultSDKType } from "../../base/abci/v1beta1/abci"; -import { BlockID, BlockIDSDKType } from "../../../tendermint/types/types"; -import { Block, BlockSDKType } from "../../../tendermint/types/block"; -import { setPaginationParams } from "../../../helpers"; +import { Tx, TxSDKType } from "./tx.js"; +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../base/query/v1beta1/pagination.js"; +import { TxResponse, TxResponseSDKType, GasInfo, GasInfoSDKType, Result, ResultSDKType } from "../../base/abci/v1beta1/abci.js"; +import { BlockID, BlockIDSDKType } from "../../../tendermint/types/types.js"; +import { Block, BlockSDKType } from "../../../tendermint/types/block.js"; +import { setPaginationParams } from "../../../helpers.js"; import { LCDClient } from "@cosmology/lcd"; -import { SimulateRequest, SimulateRequestSDKType, SimulateResponse, SimulateResponseSDKType, GetTxRequest, GetTxRequestSDKType, GetTxResponse, GetTxResponseSDKType, BroadcastTxRequest, BroadcastTxRequestSDKType, BroadcastTxResponse, BroadcastTxResponseSDKType, GetTxsEventRequest, GetTxsEventRequestSDKType, GetTxsEventResponse, GetTxsEventResponseSDKType, GetBlockWithTxsRequest, GetBlockWithTxsRequestSDKType, GetBlockWithTxsResponse, GetBlockWithTxsResponseSDKType } from "./service"; +import { SimulateRequest, SimulateRequestSDKType, SimulateResponse, SimulateResponseSDKType, GetTxRequest, GetTxRequestSDKType, GetTxResponse, GetTxResponseSDKType, BroadcastTxRequest, BroadcastTxRequestSDKType, BroadcastTxResponse, BroadcastTxResponseSDKType, GetTxsEventRequest, GetTxsEventRequestSDKType, GetTxsEventResponse, GetTxsEventResponseSDKType, GetBlockWithTxsRequest, GetBlockWithTxsRequestSDKType, GetBlockWithTxsResponse, GetBlockWithTxsResponseSDKType } from "./service.js"; export class LCDQueryClient { req: LCDClient; constructor({ diff --git a/__fixtures__/v-next/outputv4/cosmos/tx/v1beta1/service.rpc.Service.ts b/__fixtures__/v-next/outputv4/cosmos/tx/v1beta1/service.rpc.Service.ts index bbc924eb0f..4dd76261b6 100644 --- a/__fixtures__/v-next/outputv4/cosmos/tx/v1beta1/service.rpc.Service.ts +++ b/__fixtures__/v-next/outputv4/cosmos/tx/v1beta1/service.rpc.Service.ts @@ -1,12 +1,12 @@ -import { Tx, TxSDKType } from "./tx"; -import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../base/query/v1beta1/pagination"; -import { TxResponse, TxResponseSDKType, GasInfo, GasInfoSDKType, Result, ResultSDKType } from "../../base/abci/v1beta1/abci"; -import { BlockID, BlockIDSDKType } from "../../../tendermint/types/types"; -import { Block, BlockSDKType } from "../../../tendermint/types/block"; -import { Rpc } from "../../../helpers"; -import { BinaryReader } from "../../../binary"; +import { Tx, TxSDKType } from "./tx.js"; +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../base/query/v1beta1/pagination.js"; +import { TxResponse, TxResponseSDKType, GasInfo, GasInfoSDKType, Result, ResultSDKType } from "../../base/abci/v1beta1/abci.js"; +import { BlockID, BlockIDSDKType } from "../../../tendermint/types/types.js"; +import { Block, BlockSDKType } from "../../../tendermint/types/block.js"; +import { Rpc } from "../../../helpers.js"; +import { BinaryReader } from "../../../binary.js"; import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; -import { SimulateRequest, SimulateRequestSDKType, SimulateResponse, SimulateResponseSDKType, GetTxRequest, GetTxRequestSDKType, GetTxResponse, GetTxResponseSDKType, BroadcastTxRequest, BroadcastTxRequestSDKType, BroadcastTxResponse, BroadcastTxResponseSDKType, GetTxsEventRequest, GetTxsEventRequestSDKType, GetTxsEventResponse, GetTxsEventResponseSDKType, GetBlockWithTxsRequest, GetBlockWithTxsRequestSDKType, GetBlockWithTxsResponse, GetBlockWithTxsResponseSDKType } from "./service"; +import { SimulateRequest, SimulateRequestSDKType, SimulateResponse, SimulateResponseSDKType, GetTxRequest, GetTxRequestSDKType, GetTxResponse, GetTxResponseSDKType, BroadcastTxRequest, BroadcastTxRequestSDKType, BroadcastTxResponse, BroadcastTxResponseSDKType, GetTxsEventRequest, GetTxsEventRequestSDKType, GetTxsEventResponse, GetTxsEventResponseSDKType, GetBlockWithTxsRequest, GetBlockWithTxsRequestSDKType, GetBlockWithTxsResponse, GetBlockWithTxsResponseSDKType } from "./service.js"; /** Service defines a gRPC service for interacting with transactions. */ export interface Service { /** Simulate simulates executing a transaction for estimating gas usage. */ diff --git a/__fixtures__/v-next/outputv4/cosmos/tx/v1beta1/service.ts b/__fixtures__/v-next/outputv4/cosmos/tx/v1beta1/service.ts index aebe038375..b0919e5265 100644 --- a/__fixtures__/v-next/outputv4/cosmos/tx/v1beta1/service.ts +++ b/__fixtures__/v-next/outputv4/cosmos/tx/v1beta1/service.ts @@ -1,12 +1,11 @@ -import { Tx, TxSDKType } from "./tx"; -import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../base/query/v1beta1/pagination"; -import { TxResponse, TxResponseSDKType, GasInfo, GasInfoSDKType, Result, ResultSDKType } from "../../base/abci/v1beta1/abci"; -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 { JsonSafe } from "../../../json-safe"; -import { ComputedRef } from "vue"; +import { Tx, TxSDKType } from "./tx.js"; +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../base/query/v1beta1/pagination.js"; +import { TxResponse, TxResponseSDKType, GasInfo, GasInfoSDKType, Result, ResultSDKType } from "../../base/abci/v1beta1/abci.js"; +import { BlockID, BlockIDSDKType } from "../../../tendermint/types/types.js"; +import { Block, BlockSDKType } from "../../../tendermint/types/block.js"; +import { BinaryReader, BinaryWriter } from "../../../binary.js"; +import { isSet, DeepPartial, bytesFromBase64, base64FromBytes } from "../../../helpers.js"; +import { JsonSafe } from "../../../json-safe.js"; export const protobufPackage = "cosmos.tx.v1beta1"; /** OrderBy defines the sorting order */ export enum OrderBy { @@ -117,11 +116,6 @@ export interface GetTxsEventRequest { pagination?: PageRequest; orderBy: OrderBy; } -export interface ReactiveGetTxsEventRequest { - events: ComputedRef; - pagination?: ComputedRef; - orderBy: ComputedRef; -} export interface GetTxsEventRequestProtoMsg { typeUrl: "/cosmos.tx.v1beta1.GetTxsEventRequest"; value: Uint8Array; @@ -147,11 +141,6 @@ export interface GetTxsEventResponse { /** pagination defines a pagination for the response. */ pagination?: PageResponse; } -export interface ReactiveGetTxsEventResponse { - txs: ComputedRef; - txResponses: ComputedRef; - pagination?: ComputedRef; -} export interface GetTxsEventResponseProtoMsg { typeUrl: "/cosmos.tx.v1beta1.GetTxsEventResponse"; value: Uint8Array; @@ -174,10 +163,6 @@ export interface BroadcastTxRequest { txBytes: Uint8Array; mode: BroadcastMode; } -export interface ReactiveBroadcastTxRequest { - txBytes: ComputedRef; - mode: ComputedRef; -} export interface BroadcastTxRequestProtoMsg { typeUrl: "/cosmos.tx.v1beta1.BroadcastTxRequest"; value: Uint8Array; @@ -198,9 +183,6 @@ export interface BroadcastTxResponse { /** tx_response is the queried TxResponses. */ txResponse?: TxResponse; } -export interface ReactiveBroadcastTxResponse { - txResponse?: ComputedRef; -} export interface BroadcastTxResponseProtoMsg { typeUrl: "/cosmos.tx.v1beta1.BroadcastTxResponse"; value: Uint8Array; @@ -230,10 +212,6 @@ export interface SimulateRequest { */ txBytes: Uint8Array; } -export interface ReactiveSimulateRequest { - tx?: ComputedRef; - txBytes: ComputedRef; -} export interface SimulateRequestProtoMsg { typeUrl: "/cosmos.tx.v1beta1.SimulateRequest"; value: Uint8Array; @@ -257,10 +235,6 @@ export interface SimulateResponse { /** result is the result of the simulation. */ result?: Result; } -export interface ReactiveSimulateResponse { - gasInfo?: ComputedRef; - result?: ComputedRef; -} export interface SimulateResponseProtoMsg { typeUrl: "/cosmos.tx.v1beta1.SimulateResponse"; value: Uint8Array; @@ -281,9 +255,6 @@ export interface GetTxRequest { /** hash is the tx hash to query, encoded as a hex string. */ hash: string; } -export interface ReactiveGetTxRequest { - hash: ComputedRef; -} export interface GetTxRequestProtoMsg { typeUrl: "/cosmos.tx.v1beta1.GetTxRequest"; value: Uint8Array; @@ -302,10 +273,6 @@ export interface GetTxResponse { /** tx_response is the queried TxResponses. */ txResponse?: TxResponse; } -export interface ReactiveGetTxResponse { - tx?: ComputedRef; - txResponse?: ComputedRef; -} export interface GetTxResponseProtoMsg { typeUrl: "/cosmos.tx.v1beta1.GetTxResponse"; value: Uint8Array; @@ -327,10 +294,6 @@ export interface GetBlockWithTxsRequest { /** pagination defines a pagination for the request. */ pagination?: PageRequest; } -export interface ReactiveGetBlockWithTxsRequest { - height: ComputedRef; - pagination?: ComputedRef; -} export interface GetBlockWithTxsRequestProtoMsg { typeUrl: "/cosmos.tx.v1beta1.GetBlockWithTxsRequest"; value: Uint8Array; @@ -358,12 +321,6 @@ export interface GetBlockWithTxsResponse { /** pagination defines a pagination for the response. */ pagination?: PageResponse; } -export interface ReactiveGetBlockWithTxsResponse { - txs: ComputedRef; - blockId?: ComputedRef; - block?: ComputedRef; - pagination?: ComputedRef; -} export interface GetBlockWithTxsResponseProtoMsg { typeUrl: "/cosmos.tx.v1beta1.GetBlockWithTxsResponse"; value: Uint8Array; @@ -424,11 +381,11 @@ export const GetTxsEventRequest = { return message; }, fromJSON(object: any): GetTxsEventRequest { - return { - events: Array.isArray(object?.events) ? object.events.map((e: any) => String(e)) : [], - pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, - orderBy: isSet(object.orderBy) ? orderByFromJSON(object.orderBy) : -1 - }; + const obj = createBaseGetTxsEventRequest(); + if (Array.isArray(object?.events)) obj.events = object.events.map((e: any) => String(e)); + if (isSet(object.pagination)) obj.pagination = PageRequest.fromJSON(object.pagination); + if (isSet(object.orderBy)) obj.orderBy = orderByFromJSON(object.orderBy); + return obj; }, toJSON(message: GetTxsEventRequest): JsonSafe { const obj: any = {}; @@ -444,7 +401,9 @@ export const GetTxsEventRequest = { fromPartial(object: DeepPartial): GetTxsEventRequest { const message = createBaseGetTxsEventRequest(); message.events = object.events?.map(e => e) || []; - message.pagination = object.pagination !== undefined && object.pagination !== null ? PageRequest.fromPartial(object.pagination) : undefined; + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageRequest.fromPartial(object.pagination); + } message.orderBy = object.orderBy ?? 0; return message; }, @@ -562,11 +521,11 @@ export const GetTxsEventResponse = { return message; }, fromJSON(object: any): GetTxsEventResponse { - return { - txs: Array.isArray(object?.txs) ? object.txs.map((e: any) => Tx.fromJSON(e)) : [], - txResponses: Array.isArray(object?.txResponses) ? object.txResponses.map((e: any) => TxResponse.fromJSON(e)) : [], - pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined - }; + const obj = createBaseGetTxsEventResponse(); + if (Array.isArray(object?.txs)) obj.txs = object.txs.map((e: any) => Tx.fromJSON(e)); + if (Array.isArray(object?.txResponses)) obj.txResponses = object.txResponses.map((e: any) => TxResponse.fromJSON(e)); + if (isSet(object.pagination)) obj.pagination = PageResponse.fromJSON(object.pagination); + return obj; }, toJSON(message: GetTxsEventResponse): JsonSafe { const obj: any = {}; @@ -587,7 +546,9 @@ export const GetTxsEventResponse = { const message = createBaseGetTxsEventResponse(); message.txs = object.txs?.map(e => Tx.fromPartial(e)) || []; message.txResponses = object.txResponses?.map(e => TxResponse.fromPartial(e)) || []; - message.pagination = object.pagination !== undefined && object.pagination !== null ? PageResponse.fromPartial(object.pagination) : undefined; + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageResponse.fromPartial(object.pagination); + } return message; }, fromSDK(object: GetTxsEventResponseSDKType): GetTxsEventResponse { @@ -703,10 +664,10 @@ export const BroadcastTxRequest = { return message; }, fromJSON(object: any): BroadcastTxRequest { - return { - txBytes: isSet(object.txBytes) ? bytesFromBase64(object.txBytes) : new Uint8Array(), - mode: isSet(object.mode) ? broadcastModeFromJSON(object.mode) : -1 - }; + const obj = createBaseBroadcastTxRequest(); + if (isSet(object.txBytes)) obj.txBytes = bytesFromBase64(object.txBytes); + if (isSet(object.mode)) obj.mode = broadcastModeFromJSON(object.mode); + return obj; }, toJSON(message: BroadcastTxRequest): JsonSafe { const obj: any = {}; @@ -807,9 +768,9 @@ export const BroadcastTxResponse = { return message; }, fromJSON(object: any): BroadcastTxResponse { - return { - txResponse: isSet(object.txResponse) ? TxResponse.fromJSON(object.txResponse) : undefined - }; + const obj = createBaseBroadcastTxResponse(); + if (isSet(object.txResponse)) obj.txResponse = TxResponse.fromJSON(object.txResponse); + return obj; }, toJSON(message: BroadcastTxResponse): JsonSafe { const obj: any = {}; @@ -818,7 +779,9 @@ export const BroadcastTxResponse = { }, fromPartial(object: DeepPartial): BroadcastTxResponse { const message = createBaseBroadcastTxResponse(); - message.txResponse = object.txResponse !== undefined && object.txResponse !== null ? TxResponse.fromPartial(object.txResponse) : undefined; + if (object.txResponse !== undefined && object.txResponse !== null) { + message.txResponse = TxResponse.fromPartial(object.txResponse); + } return message; }, fromSDK(object: BroadcastTxResponseSDKType): BroadcastTxResponse { @@ -908,10 +871,10 @@ export const SimulateRequest = { return message; }, fromJSON(object: any): SimulateRequest { - return { - tx: isSet(object.tx) ? Tx.fromJSON(object.tx) : undefined, - txBytes: isSet(object.txBytes) ? bytesFromBase64(object.txBytes) : new Uint8Array() - }; + const obj = createBaseSimulateRequest(); + if (isSet(object.tx)) obj.tx = Tx.fromJSON(object.tx); + if (isSet(object.txBytes)) obj.txBytes = bytesFromBase64(object.txBytes); + return obj; }, toJSON(message: SimulateRequest): JsonSafe { const obj: any = {}; @@ -921,7 +884,9 @@ export const SimulateRequest = { }, fromPartial(object: DeepPartial): SimulateRequest { const message = createBaseSimulateRequest(); - message.tx = object.tx !== undefined && object.tx !== null ? Tx.fromPartial(object.tx) : undefined; + if (object.tx !== undefined && object.tx !== null) { + message.tx = Tx.fromPartial(object.tx); + } message.txBytes = object.txBytes ?? new Uint8Array(); return message; }, @@ -1019,10 +984,10 @@ export const SimulateResponse = { return message; }, fromJSON(object: any): SimulateResponse { - return { - gasInfo: isSet(object.gasInfo) ? GasInfo.fromJSON(object.gasInfo) : undefined, - result: isSet(object.result) ? Result.fromJSON(object.result) : undefined - }; + const obj = createBaseSimulateResponse(); + if (isSet(object.gasInfo)) obj.gasInfo = GasInfo.fromJSON(object.gasInfo); + if (isSet(object.result)) obj.result = Result.fromJSON(object.result); + return obj; }, toJSON(message: SimulateResponse): JsonSafe { const obj: any = {}; @@ -1032,8 +997,12 @@ export const SimulateResponse = { }, fromPartial(object: DeepPartial): SimulateResponse { const message = createBaseSimulateResponse(); - message.gasInfo = object.gasInfo !== undefined && object.gasInfo !== null ? GasInfo.fromPartial(object.gasInfo) : undefined; - message.result = object.result !== undefined && object.result !== null ? Result.fromPartial(object.result) : undefined; + if (object.gasInfo !== undefined && object.gasInfo !== null) { + message.gasInfo = GasInfo.fromPartial(object.gasInfo); + } + if (object.result !== undefined && object.result !== null) { + message.result = Result.fromPartial(object.result); + } return message; }, fromSDK(object: SimulateResponseSDKType): SimulateResponse { @@ -1100,7 +1069,7 @@ function createBaseGetTxRequest(): GetTxRequest { export const GetTxRequest = { typeUrl: "/cosmos.tx.v1beta1.GetTxRequest", encode(message: GetTxRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.hash !== "") { + if (message.hash !== undefined) { writer.uint32(10).string(message.hash); } return writer; @@ -1123,9 +1092,9 @@ export const GetTxRequest = { return message; }, fromJSON(object: any): GetTxRequest { - return { - hash: isSet(object.hash) ? String(object.hash) : "" - }; + const obj = createBaseGetTxRequest(); + if (isSet(object.hash)) obj.hash = String(object.hash); + return obj; }, toJSON(message: GetTxRequest): JsonSafe { const obj: any = {}; @@ -1224,10 +1193,10 @@ export const GetTxResponse = { return message; }, fromJSON(object: any): GetTxResponse { - return { - tx: isSet(object.tx) ? Tx.fromJSON(object.tx) : undefined, - txResponse: isSet(object.txResponse) ? TxResponse.fromJSON(object.txResponse) : undefined - }; + const obj = createBaseGetTxResponse(); + if (isSet(object.tx)) obj.tx = Tx.fromJSON(object.tx); + if (isSet(object.txResponse)) obj.txResponse = TxResponse.fromJSON(object.txResponse); + return obj; }, toJSON(message: GetTxResponse): JsonSafe { const obj: any = {}; @@ -1237,8 +1206,12 @@ export const GetTxResponse = { }, fromPartial(object: DeepPartial): GetTxResponse { const message = createBaseGetTxResponse(); - message.tx = object.tx !== undefined && object.tx !== null ? Tx.fromPartial(object.tx) : undefined; - message.txResponse = object.txResponse !== undefined && object.txResponse !== null ? TxResponse.fromPartial(object.txResponse) : undefined; + if (object.tx !== undefined && object.tx !== null) { + message.tx = Tx.fromPartial(object.tx); + } + if (object.txResponse !== undefined && object.txResponse !== null) { + message.txResponse = TxResponse.fromPartial(object.txResponse); + } return message; }, fromSDK(object: GetTxResponseSDKType): GetTxResponse { @@ -1306,7 +1279,7 @@ function createBaseGetBlockWithTxsRequest(): GetBlockWithTxsRequest { export const GetBlockWithTxsRequest = { typeUrl: "/cosmos.tx.v1beta1.GetBlockWithTxsRequest", encode(message: GetBlockWithTxsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.height !== BigInt(0)) { + if (message.height !== undefined) { writer.uint32(8).int64(message.height); } if (message.pagination !== undefined) { @@ -1335,10 +1308,10 @@ export const GetBlockWithTxsRequest = { return message; }, fromJSON(object: any): GetBlockWithTxsRequest { - return { - height: isSet(object.height) ? BigInt(object.height.toString()) : BigInt(0), - pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined - }; + const obj = createBaseGetBlockWithTxsRequest(); + if (isSet(object.height)) obj.height = BigInt(object.height.toString()); + if (isSet(object.pagination)) obj.pagination = PageRequest.fromJSON(object.pagination); + return obj; }, toJSON(message: GetBlockWithTxsRequest): JsonSafe { const obj: any = {}; @@ -1348,8 +1321,12 @@ export const GetBlockWithTxsRequest = { }, fromPartial(object: DeepPartial): GetBlockWithTxsRequest { const message = createBaseGetBlockWithTxsRequest(); - message.height = object.height !== undefined && object.height !== null ? BigInt(object.height.toString()) : BigInt(0); - message.pagination = object.pagination !== undefined && object.pagination !== null ? PageRequest.fromPartial(object.pagination) : undefined; + if (object.height !== undefined && object.height !== null) { + message.height = BigInt(object.height.toString()); + } + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageRequest.fromPartial(object.pagination); + } return message; }, fromSDK(object: GetBlockWithTxsRequestSDKType): GetBlockWithTxsRequest { @@ -1460,12 +1437,12 @@ export const GetBlockWithTxsResponse = { return message; }, fromJSON(object: any): GetBlockWithTxsResponse { - return { - txs: Array.isArray(object?.txs) ? object.txs.map((e: any) => Tx.fromJSON(e)) : [], - blockId: isSet(object.blockId) ? BlockID.fromJSON(object.blockId) : undefined, - block: isSet(object.block) ? Block.fromJSON(object.block) : undefined, - pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined - }; + const obj = createBaseGetBlockWithTxsResponse(); + if (Array.isArray(object?.txs)) obj.txs = object.txs.map((e: any) => Tx.fromJSON(e)); + if (isSet(object.blockId)) obj.blockId = BlockID.fromJSON(object.blockId); + if (isSet(object.block)) obj.block = Block.fromJSON(object.block); + if (isSet(object.pagination)) obj.pagination = PageResponse.fromJSON(object.pagination); + return obj; }, toJSON(message: GetBlockWithTxsResponse): JsonSafe { const obj: any = {}; @@ -1482,9 +1459,15 @@ export const GetBlockWithTxsResponse = { fromPartial(object: DeepPartial): GetBlockWithTxsResponse { const message = createBaseGetBlockWithTxsResponse(); message.txs = object.txs?.map(e => Tx.fromPartial(e)) || []; - message.blockId = object.blockId !== undefined && object.blockId !== null ? BlockID.fromPartial(object.blockId) : undefined; - message.block = object.block !== undefined && object.block !== null ? Block.fromPartial(object.block) : undefined; - message.pagination = object.pagination !== undefined && object.pagination !== null ? PageResponse.fromPartial(object.pagination) : undefined; + if (object.blockId !== undefined && object.blockId !== null) { + message.blockId = BlockID.fromPartial(object.blockId); + } + if (object.block !== undefined && object.block !== null) { + message.block = Block.fromPartial(object.block); + } + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageResponse.fromPartial(object.pagination); + } return message; }, fromSDK(object: GetBlockWithTxsResponseSDKType): GetBlockWithTxsResponse { diff --git a/__fixtures__/v-next/outputv4/cosmos/tx/v1beta1/tx.ts b/__fixtures__/v-next/outputv4/cosmos/tx/v1beta1/tx.ts index 29dd69c5f1..13eadffee6 100644 --- a/__fixtures__/v-next/outputv4/cosmos/tx/v1beta1/tx.ts +++ b/__fixtures__/v-next/outputv4/cosmos/tx/v1beta1/tx.ts @@ -1,11 +1,10 @@ -import { Any, AnySDKType } from "../../../google/protobuf/any"; -import { SignMode, SignModeSDKType, signModeFromJSON, signModeToJSON } from "../signing/v1beta1/signing"; -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 { JsonSafe } from "../../../json-safe"; -import { ComputedRef } from "vue"; +import { Any, AnySDKType } from "../../../google/protobuf/any.js"; +import { SignMode, SignModeSDKType, signModeFromJSON, signModeToJSON } from "../signing/v1beta1/signing.js"; +import { CompactBitArray, CompactBitArraySDKType } from "../../crypto/multisig/v1beta1/multisig.js"; +import { Coin, CoinSDKType } from "../../base/v1beta1/coin.js"; +import { BinaryReader, BinaryWriter } from "../../../binary.js"; +import { isSet, bytesFromBase64, base64FromBytes, DeepPartial } from "../../../helpers.js"; +import { JsonSafe } from "../../../json-safe.js"; export const protobufPackage = "cosmos.tx.v1beta1"; /** Tx is the standard type used for broadcasting transactions. */ export interface Tx { @@ -23,11 +22,6 @@ export interface Tx { */ signatures: Uint8Array[]; } -export interface ReactiveTx { - body?: ComputedRef; - authInfo?: ComputedRef; - signatures: ComputedRef; -} export interface TxProtoMsg { typeUrl: "/cosmos.tx.v1beta1.Tx"; value: Uint8Array; @@ -63,11 +57,6 @@ export interface TxRaw { */ signatures: Uint8Array[]; } -export interface ReactiveTxRaw { - bodyBytes: ComputedRef; - authInfoBytes: ComputedRef; - signatures: ComputedRef; -} export interface TxRawProtoMsg { typeUrl: "/cosmos.tx.v1beta1.TxRaw"; value: Uint8Array; @@ -105,12 +94,6 @@ export interface SignDoc { /** account_number is the account number of the account in state */ accountNumber: bigint; } -export interface ReactiveSignDoc { - bodyBytes: ComputedRef; - authInfoBytes: ComputedRef; - chainId: ComputedRef; - accountNumber: ComputedRef; -} export interface SignDocProtoMsg { typeUrl: "/cosmos.tx.v1beta1.SignDoc"; value: Uint8Array; @@ -152,14 +135,6 @@ export interface SignDocDirectAux { */ tip?: Tip; } -export interface ReactiveSignDocDirectAux { - bodyBytes: ComputedRef; - publicKey?: ComputedRef; - chainId: ComputedRef; - accountNumber: ComputedRef; - sequence: ComputedRef; - tip?: ComputedRef; -} export interface SignDocDirectAuxProtoMsg { typeUrl: "/cosmos.tx.v1beta1.SignDocDirectAux"; value: Uint8Array; @@ -214,13 +189,6 @@ export interface TxBody { */ nonCriticalExtensionOptions: Any[]; } -export interface ReactiveTxBody { - messages: ComputedRef; - memo: ComputedRef; - timeoutHeight: ComputedRef; - extensionOptions: ComputedRef; - nonCriticalExtensionOptions: ComputedRef; -} export interface TxBodyProtoMsg { typeUrl: "/cosmos.tx.v1beta1.TxBody"; value: Uint8Array; @@ -259,11 +227,6 @@ export interface AuthInfo { */ tip?: Tip; } -export interface ReactiveAuthInfo { - signerInfos: ComputedRef; - fee?: ComputedRef; - tip?: ComputedRef; -} export interface AuthInfoProtoMsg { typeUrl: "/cosmos.tx.v1beta1.AuthInfo"; value: Uint8Array; @@ -300,11 +263,6 @@ export interface SignerInfo { */ sequence: bigint; } -export interface ReactiveSignerInfo { - publicKey?: ComputedRef; - modeInfo?: ComputedRef; - sequence: ComputedRef; -} export interface SignerInfoProtoMsg { typeUrl: "/cosmos.tx.v1beta1.SignerInfo"; value: Uint8Array; @@ -325,10 +283,6 @@ export interface ModeInfo { /** multi represents a nested multisig signer */ multi?: ModeInfo_Multi; } -export interface ReactiveModeInfo { - single?: ComputedRef; - multi?: ComputedRef; -} export interface ModeInfoProtoMsg { typeUrl: "/cosmos.tx.v1beta1.ModeInfo"; value: Uint8Array; @@ -347,9 +301,6 @@ export interface ModeInfo_Single { /** mode is the signing mode of the single signer */ mode: SignMode; } -export interface ReactiveModeInfo_Single { - mode: ComputedRef; -} export interface ModeInfo_SingleProtoMsg { typeUrl: "/cosmos.tx.v1beta1.Single"; value: Uint8Array; @@ -372,10 +323,6 @@ export interface ModeInfo_Multi { */ modeInfos: ModeInfo[]; } -export interface ReactiveModeInfo_Multi { - bitarray?: ComputedRef; - modeInfos: ComputedRef; -} export interface ModeInfo_MultiProtoMsg { typeUrl: "/cosmos.tx.v1beta1.Multi"; value: Uint8Array; @@ -411,12 +358,6 @@ export interface Fee { */ granter: string; } -export interface ReactiveFee { - amount: ComputedRef; - gasLimit: ComputedRef; - payer: ComputedRef; - granter: ComputedRef; -} export interface FeeProtoMsg { typeUrl: "/cosmos.tx.v1beta1.Fee"; value: Uint8Array; @@ -443,10 +384,6 @@ export interface Tip { /** tipper is the address of the account paying for the tip */ tipper: string; } -export interface ReactiveTip { - amount: ComputedRef; - tipper: ComputedRef; -} export interface TipProtoMsg { typeUrl: "/cosmos.tx.v1beta1.Tip"; value: Uint8Array; @@ -486,12 +423,6 @@ export interface AuxSignerData { /** sig is the signature of the sign doc. */ sig: Uint8Array; } -export interface ReactiveAuxSignerData { - address: ComputedRef; - signDoc?: ComputedRef; - mode: ComputedRef; - sig: ComputedRef; -} export interface AuxSignerDataProtoMsg { typeUrl: "/cosmos.tx.v1beta1.AuxSignerData"; value: Uint8Array; @@ -555,11 +486,11 @@ export const Tx = { return message; }, fromJSON(object: any): Tx { - return { - body: isSet(object.body) ? TxBody.fromJSON(object.body) : undefined, - authInfo: isSet(object.authInfo) ? AuthInfo.fromJSON(object.authInfo) : undefined, - signatures: Array.isArray(object?.signatures) ? object.signatures.map((e: any) => bytesFromBase64(e)) : [] - }; + const obj = createBaseTx(); + if (isSet(object.body)) obj.body = TxBody.fromJSON(object.body); + if (isSet(object.authInfo)) obj.authInfo = AuthInfo.fromJSON(object.authInfo); + if (Array.isArray(object?.signatures)) obj.signatures = object.signatures.map((e: any) => bytesFromBase64(e)); + return obj; }, toJSON(message: Tx): JsonSafe { const obj: any = {}; @@ -574,8 +505,12 @@ export const Tx = { }, fromPartial(object: DeepPartial): Tx { const message = createBaseTx(); - message.body = object.body !== undefined && object.body !== null ? TxBody.fromPartial(object.body) : undefined; - message.authInfo = object.authInfo !== undefined && object.authInfo !== null ? AuthInfo.fromPartial(object.authInfo) : undefined; + if (object.body !== undefined && object.body !== null) { + message.body = TxBody.fromPartial(object.body); + } + if (object.authInfo !== undefined && object.authInfo !== null) { + message.authInfo = AuthInfo.fromPartial(object.authInfo); + } message.signatures = object.signatures?.map(e => e) || []; return message; }, @@ -693,11 +628,11 @@ export const TxRaw = { return message; }, fromJSON(object: any): TxRaw { - return { - bodyBytes: isSet(object.bodyBytes) ? bytesFromBase64(object.bodyBytes) : new Uint8Array(), - authInfoBytes: isSet(object.authInfoBytes) ? bytesFromBase64(object.authInfoBytes) : new Uint8Array(), - signatures: Array.isArray(object?.signatures) ? object.signatures.map((e: any) => bytesFromBase64(e)) : [] - }; + const obj = createBaseTxRaw(); + if (isSet(object.bodyBytes)) obj.bodyBytes = bytesFromBase64(object.bodyBytes); + if (isSet(object.authInfoBytes)) obj.authInfoBytes = bytesFromBase64(object.authInfoBytes); + if (Array.isArray(object?.signatures)) obj.signatures = object.signatures.map((e: any) => bytesFromBase64(e)); + return obj; }, toJSON(message: TxRaw): JsonSafe { const obj: any = {}; @@ -803,10 +738,10 @@ export const SignDoc = { if (message.authInfoBytes.length !== 0) { writer.uint32(18).bytes(message.authInfoBytes); } - if (message.chainId !== "") { + if (message.chainId !== undefined) { writer.uint32(26).string(message.chainId); } - if (message.accountNumber !== BigInt(0)) { + if (message.accountNumber !== undefined) { writer.uint32(32).uint64(message.accountNumber); } return writer; @@ -838,12 +773,12 @@ export const SignDoc = { return message; }, fromJSON(object: any): SignDoc { - return { - bodyBytes: isSet(object.bodyBytes) ? bytesFromBase64(object.bodyBytes) : new Uint8Array(), - authInfoBytes: isSet(object.authInfoBytes) ? bytesFromBase64(object.authInfoBytes) : new Uint8Array(), - chainId: isSet(object.chainId) ? String(object.chainId) : "", - accountNumber: isSet(object.accountNumber) ? BigInt(object.accountNumber.toString()) : BigInt(0) - }; + const obj = createBaseSignDoc(); + if (isSet(object.bodyBytes)) obj.bodyBytes = bytesFromBase64(object.bodyBytes); + if (isSet(object.authInfoBytes)) obj.authInfoBytes = bytesFromBase64(object.authInfoBytes); + if (isSet(object.chainId)) obj.chainId = String(object.chainId); + if (isSet(object.accountNumber)) obj.accountNumber = BigInt(object.accountNumber.toString()); + return obj; }, toJSON(message: SignDoc): JsonSafe { const obj: any = {}; @@ -858,7 +793,9 @@ export const SignDoc = { message.bodyBytes = object.bodyBytes ?? new Uint8Array(); message.authInfoBytes = object.authInfoBytes ?? new Uint8Array(); message.chainId = object.chainId ?? ""; - message.accountNumber = object.accountNumber !== undefined && object.accountNumber !== null ? BigInt(object.accountNumber.toString()) : BigInt(0); + if (object.accountNumber !== undefined && object.accountNumber !== null) { + message.accountNumber = BigInt(object.accountNumber.toString()); + } return message; }, fromSDK(object: SignDocSDKType): SignDoc { @@ -950,13 +887,13 @@ export const SignDocDirectAux = { if (message.publicKey !== undefined) { Any.encode(message.publicKey, writer.uint32(18).fork()).ldelim(); } - if (message.chainId !== "") { + if (message.chainId !== undefined) { writer.uint32(26).string(message.chainId); } - if (message.accountNumber !== BigInt(0)) { + if (message.accountNumber !== undefined) { writer.uint32(32).uint64(message.accountNumber); } - if (message.sequence !== BigInt(0)) { + if (message.sequence !== undefined) { writer.uint32(40).uint64(message.sequence); } if (message.tip !== undefined) { @@ -997,14 +934,14 @@ export const SignDocDirectAux = { return message; }, fromJSON(object: any): SignDocDirectAux { - return { - bodyBytes: isSet(object.bodyBytes) ? bytesFromBase64(object.bodyBytes) : new Uint8Array(), - publicKey: isSet(object.publicKey) ? Any.fromJSON(object.publicKey) : undefined, - chainId: isSet(object.chainId) ? String(object.chainId) : "", - accountNumber: isSet(object.accountNumber) ? BigInt(object.accountNumber.toString()) : BigInt(0), - sequence: isSet(object.sequence) ? BigInt(object.sequence.toString()) : BigInt(0), - tip: isSet(object.tip) ? Tip.fromJSON(object.tip) : undefined - }; + const obj = createBaseSignDocDirectAux(); + if (isSet(object.bodyBytes)) obj.bodyBytes = bytesFromBase64(object.bodyBytes); + if (isSet(object.publicKey)) obj.publicKey = Any.fromJSON(object.publicKey); + if (isSet(object.chainId)) obj.chainId = String(object.chainId); + if (isSet(object.accountNumber)) obj.accountNumber = BigInt(object.accountNumber.toString()); + if (isSet(object.sequence)) obj.sequence = BigInt(object.sequence.toString()); + if (isSet(object.tip)) obj.tip = Tip.fromJSON(object.tip); + return obj; }, toJSON(message: SignDocDirectAux): JsonSafe { const obj: any = {}; @@ -1019,11 +956,19 @@ export const SignDocDirectAux = { fromPartial(object: DeepPartial): SignDocDirectAux { const message = createBaseSignDocDirectAux(); message.bodyBytes = object.bodyBytes ?? new Uint8Array(); - message.publicKey = object.publicKey !== undefined && object.publicKey !== null ? Any.fromPartial(object.publicKey) : undefined; + if (object.publicKey !== undefined && object.publicKey !== null) { + message.publicKey = Any.fromPartial(object.publicKey); + } message.chainId = object.chainId ?? ""; - message.accountNumber = object.accountNumber !== undefined && object.accountNumber !== null ? BigInt(object.accountNumber.toString()) : BigInt(0); - message.sequence = object.sequence !== undefined && object.sequence !== null ? BigInt(object.sequence.toString()) : BigInt(0); - message.tip = object.tip !== undefined && object.tip !== null ? Tip.fromPartial(object.tip) : undefined; + if (object.accountNumber !== undefined && object.accountNumber !== null) { + message.accountNumber = BigInt(object.accountNumber.toString()); + } + if (object.sequence !== undefined && object.sequence !== null) { + message.sequence = BigInt(object.sequence.toString()); + } + if (object.tip !== undefined && object.tip !== null) { + message.tip = Tip.fromPartial(object.tip); + } return message; }, fromSDK(object: SignDocDirectAuxSDKType): SignDocDirectAux { @@ -1125,10 +1070,10 @@ export const TxBody = { for (const v of message.messages) { Any.encode(v!, writer.uint32(10).fork()).ldelim(); } - if (message.memo !== "") { + if (message.memo !== undefined) { writer.uint32(18).string(message.memo); } - if (message.timeoutHeight !== BigInt(0)) { + if (message.timeoutHeight !== undefined) { writer.uint32(24).uint64(message.timeoutHeight); } for (const v of message.extensionOptions) { @@ -1169,13 +1114,13 @@ export const TxBody = { return message; }, fromJSON(object: any): TxBody { - return { - messages: Array.isArray(object?.messages) ? object.messages.map((e: any) => Any.fromJSON(e)) : [], - memo: isSet(object.memo) ? String(object.memo) : "", - timeoutHeight: isSet(object.timeoutHeight) ? BigInt(object.timeoutHeight.toString()) : BigInt(0), - extensionOptions: Array.isArray(object?.extensionOptions) ? object.extensionOptions.map((e: any) => Any.fromJSON(e)) : [], - nonCriticalExtensionOptions: Array.isArray(object?.nonCriticalExtensionOptions) ? object.nonCriticalExtensionOptions.map((e: any) => Any.fromJSON(e)) : [] - }; + const obj = createBaseTxBody(); + if (Array.isArray(object?.messages)) obj.messages = object.messages.map((e: any) => Any.fromJSON(e)); + if (isSet(object.memo)) obj.memo = String(object.memo); + if (isSet(object.timeoutHeight)) obj.timeoutHeight = BigInt(object.timeoutHeight.toString()); + if (Array.isArray(object?.extensionOptions)) obj.extensionOptions = object.extensionOptions.map((e: any) => Any.fromJSON(e)); + if (Array.isArray(object?.nonCriticalExtensionOptions)) obj.nonCriticalExtensionOptions = object.nonCriticalExtensionOptions.map((e: any) => Any.fromJSON(e)); + return obj; }, toJSON(message: TxBody): JsonSafe { const obj: any = {}; @@ -1202,7 +1147,9 @@ export const TxBody = { const message = createBaseTxBody(); message.messages = object.messages?.map(e => Any.fromPartial(e)) || []; message.memo = object.memo ?? ""; - message.timeoutHeight = object.timeoutHeight !== undefined && object.timeoutHeight !== null ? BigInt(object.timeoutHeight.toString()) : BigInt(0); + if (object.timeoutHeight !== undefined && object.timeoutHeight !== null) { + message.timeoutHeight = BigInt(object.timeoutHeight.toString()); + } message.extensionOptions = object.extensionOptions?.map(e => Any.fromPartial(e)) || []; message.nonCriticalExtensionOptions = object.nonCriticalExtensionOptions?.map(e => Any.fromPartial(e)) || []; return message; @@ -1347,11 +1294,11 @@ export const AuthInfo = { return message; }, fromJSON(object: any): AuthInfo { - return { - signerInfos: Array.isArray(object?.signerInfos) ? object.signerInfos.map((e: any) => SignerInfo.fromJSON(e)) : [], - fee: isSet(object.fee) ? Fee.fromJSON(object.fee) : undefined, - tip: isSet(object.tip) ? Tip.fromJSON(object.tip) : undefined - }; + const obj = createBaseAuthInfo(); + if (Array.isArray(object?.signerInfos)) obj.signerInfos = object.signerInfos.map((e: any) => SignerInfo.fromJSON(e)); + if (isSet(object.fee)) obj.fee = Fee.fromJSON(object.fee); + if (isSet(object.tip)) obj.tip = Tip.fromJSON(object.tip); + return obj; }, toJSON(message: AuthInfo): JsonSafe { const obj: any = {}; @@ -1367,8 +1314,12 @@ export const AuthInfo = { fromPartial(object: DeepPartial): AuthInfo { const message = createBaseAuthInfo(); message.signerInfos = object.signerInfos?.map(e => SignerInfo.fromPartial(e)) || []; - message.fee = object.fee !== undefined && object.fee !== null ? Fee.fromPartial(object.fee) : undefined; - message.tip = object.tip !== undefined && object.tip !== null ? Tip.fromPartial(object.tip) : undefined; + if (object.fee !== undefined && object.fee !== null) { + message.fee = Fee.fromPartial(object.fee); + } + if (object.tip !== undefined && object.tip !== null) { + message.tip = Tip.fromPartial(object.tip); + } return message; }, fromSDK(object: AuthInfoSDKType): AuthInfo { @@ -1456,7 +1407,7 @@ export const SignerInfo = { if (message.modeInfo !== undefined) { ModeInfo.encode(message.modeInfo, writer.uint32(18).fork()).ldelim(); } - if (message.sequence !== BigInt(0)) { + if (message.sequence !== undefined) { writer.uint32(24).uint64(message.sequence); } return writer; @@ -1485,11 +1436,11 @@ export const SignerInfo = { return message; }, fromJSON(object: any): SignerInfo { - return { - publicKey: isSet(object.publicKey) ? Any.fromJSON(object.publicKey) : undefined, - modeInfo: isSet(object.modeInfo) ? ModeInfo.fromJSON(object.modeInfo) : undefined, - sequence: isSet(object.sequence) ? BigInt(object.sequence.toString()) : BigInt(0) - }; + const obj = createBaseSignerInfo(); + if (isSet(object.publicKey)) obj.publicKey = Any.fromJSON(object.publicKey); + if (isSet(object.modeInfo)) obj.modeInfo = ModeInfo.fromJSON(object.modeInfo); + if (isSet(object.sequence)) obj.sequence = BigInt(object.sequence.toString()); + return obj; }, toJSON(message: SignerInfo): JsonSafe { const obj: any = {}; @@ -1500,9 +1451,15 @@ export const SignerInfo = { }, fromPartial(object: DeepPartial): SignerInfo { const message = createBaseSignerInfo(); - message.publicKey = object.publicKey !== undefined && object.publicKey !== null ? Any.fromPartial(object.publicKey) : undefined; - message.modeInfo = object.modeInfo !== undefined && object.modeInfo !== null ? ModeInfo.fromPartial(object.modeInfo) : undefined; - message.sequence = object.sequence !== undefined && object.sequence !== null ? BigInt(object.sequence.toString()) : BigInt(0); + if (object.publicKey !== undefined && object.publicKey !== null) { + message.publicKey = Any.fromPartial(object.publicKey); + } + if (object.modeInfo !== undefined && object.modeInfo !== null) { + message.modeInfo = ModeInfo.fromPartial(object.modeInfo); + } + if (object.sequence !== undefined && object.sequence !== null) { + message.sequence = BigInt(object.sequence.toString()); + } return message; }, fromSDK(object: SignerInfoSDKType): SignerInfo { @@ -1606,10 +1563,10 @@ export const ModeInfo = { return message; }, fromJSON(object: any): ModeInfo { - return { - single: isSet(object.single) ? ModeInfo_Single.fromJSON(object.single) : undefined, - multi: isSet(object.multi) ? ModeInfo_Multi.fromJSON(object.multi) : undefined - }; + const obj = createBaseModeInfo(); + if (isSet(object.single)) obj.single = ModeInfo_Single.fromJSON(object.single); + if (isSet(object.multi)) obj.multi = ModeInfo_Multi.fromJSON(object.multi); + return obj; }, toJSON(message: ModeInfo): JsonSafe { const obj: any = {}; @@ -1619,8 +1576,12 @@ export const ModeInfo = { }, fromPartial(object: DeepPartial): ModeInfo { const message = createBaseModeInfo(); - message.single = object.single !== undefined && object.single !== null ? ModeInfo_Single.fromPartial(object.single) : undefined; - message.multi = object.multi !== undefined && object.multi !== null ? ModeInfo_Multi.fromPartial(object.multi) : undefined; + if (object.single !== undefined && object.single !== null) { + message.single = ModeInfo_Single.fromPartial(object.single); + } + if (object.multi !== undefined && object.multi !== null) { + message.multi = ModeInfo_Multi.fromPartial(object.multi); + } return message; }, fromSDK(object: ModeInfoSDKType): ModeInfo { @@ -1710,9 +1671,9 @@ export const ModeInfo_Single = { return message; }, fromJSON(object: any): ModeInfo_Single { - return { - mode: isSet(object.mode) ? signModeFromJSON(object.mode) : -1 - }; + const obj = createBaseModeInfo_Single(); + if (isSet(object.mode)) obj.mode = signModeFromJSON(object.mode); + return obj; }, toJSON(message: ModeInfo_Single): JsonSafe { const obj: any = {}; @@ -1811,10 +1772,10 @@ export const ModeInfo_Multi = { return message; }, fromJSON(object: any): ModeInfo_Multi { - return { - bitarray: isSet(object.bitarray) ? CompactBitArray.fromJSON(object.bitarray) : undefined, - modeInfos: Array.isArray(object?.modeInfos) ? object.modeInfos.map((e: any) => ModeInfo.fromJSON(e)) : [] - }; + const obj = createBaseModeInfo_Multi(); + if (isSet(object.bitarray)) obj.bitarray = CompactBitArray.fromJSON(object.bitarray); + if (Array.isArray(object?.modeInfos)) obj.modeInfos = object.modeInfos.map((e: any) => ModeInfo.fromJSON(e)); + return obj; }, toJSON(message: ModeInfo_Multi): JsonSafe { const obj: any = {}; @@ -1828,7 +1789,9 @@ export const ModeInfo_Multi = { }, fromPartial(object: DeepPartial): ModeInfo_Multi { const message = createBaseModeInfo_Multi(); - message.bitarray = object.bitarray !== undefined && object.bitarray !== null ? CompactBitArray.fromPartial(object.bitarray) : undefined; + if (object.bitarray !== undefined && object.bitarray !== null) { + message.bitarray = CompactBitArray.fromPartial(object.bitarray); + } message.modeInfos = object.modeInfos?.map(e => ModeInfo.fromPartial(e)) || []; return message; }, @@ -1908,13 +1871,13 @@ export const Fee = { for (const v of message.amount) { Coin.encode(v!, writer.uint32(10).fork()).ldelim(); } - if (message.gasLimit !== BigInt(0)) { + if (message.gasLimit !== undefined) { writer.uint32(16).uint64(message.gasLimit); } - if (message.payer !== "") { + if (message.payer !== undefined) { writer.uint32(26).string(message.payer); } - if (message.granter !== "") { + if (message.granter !== undefined) { writer.uint32(34).string(message.granter); } return writer; @@ -1946,12 +1909,12 @@ export const Fee = { return message; }, fromJSON(object: any): Fee { - return { - amount: Array.isArray(object?.amount) ? object.amount.map((e: any) => Coin.fromJSON(e)) : [], - gasLimit: isSet(object.gasLimit) ? BigInt(object.gasLimit.toString()) : BigInt(0), - payer: isSet(object.payer) ? String(object.payer) : "", - granter: isSet(object.granter) ? String(object.granter) : "" - }; + const obj = createBaseFee(); + if (Array.isArray(object?.amount)) obj.amount = object.amount.map((e: any) => Coin.fromJSON(e)); + if (isSet(object.gasLimit)) obj.gasLimit = BigInt(object.gasLimit.toString()); + if (isSet(object.payer)) obj.payer = String(object.payer); + if (isSet(object.granter)) obj.granter = String(object.granter); + return obj; }, toJSON(message: Fee): JsonSafe { const obj: any = {}; @@ -1968,7 +1931,9 @@ export const Fee = { fromPartial(object: DeepPartial): Fee { const message = createBaseFee(); message.amount = object.amount?.map(e => Coin.fromPartial(e)) || []; - message.gasLimit = object.gasLimit !== undefined && object.gasLimit !== null ? BigInt(object.gasLimit.toString()) : BigInt(0); + if (object.gasLimit !== undefined && object.gasLimit !== null) { + message.gasLimit = BigInt(object.gasLimit.toString()); + } message.payer = object.payer ?? ""; message.granter = object.granter ?? ""; return message; @@ -2061,7 +2026,7 @@ export const Tip = { for (const v of message.amount) { Coin.encode(v!, writer.uint32(10).fork()).ldelim(); } - if (message.tipper !== "") { + if (message.tipper !== undefined) { writer.uint32(18).string(message.tipper); } return writer; @@ -2087,10 +2052,10 @@ export const Tip = { return message; }, fromJSON(object: any): Tip { - return { - amount: Array.isArray(object?.amount) ? object.amount.map((e: any) => Coin.fromJSON(e)) : [], - tipper: isSet(object.tipper) ? String(object.tipper) : "" - }; + const obj = createBaseTip(); + if (Array.isArray(object?.amount)) obj.amount = object.amount.map((e: any) => Coin.fromJSON(e)); + if (isSet(object.tipper)) obj.tipper = String(object.tipper); + return obj; }, toJSON(message: Tip): JsonSafe { const obj: any = {}; @@ -2181,7 +2146,7 @@ function createBaseAuxSignerData(): AuxSignerData { export const AuxSignerData = { typeUrl: "/cosmos.tx.v1beta1.AuxSignerData", encode(message: AuxSignerData, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.address !== "") { + if (message.address !== undefined) { writer.uint32(10).string(message.address); } if (message.signDoc !== undefined) { @@ -2222,12 +2187,12 @@ export const AuxSignerData = { return message; }, fromJSON(object: any): AuxSignerData { - return { - address: isSet(object.address) ? String(object.address) : "", - signDoc: isSet(object.signDoc) ? SignDocDirectAux.fromJSON(object.signDoc) : undefined, - mode: isSet(object.mode) ? signModeFromJSON(object.mode) : -1, - sig: isSet(object.sig) ? bytesFromBase64(object.sig) : new Uint8Array() - }; + const obj = createBaseAuxSignerData(); + if (isSet(object.address)) obj.address = String(object.address); + if (isSet(object.signDoc)) obj.signDoc = SignDocDirectAux.fromJSON(object.signDoc); + if (isSet(object.mode)) obj.mode = signModeFromJSON(object.mode); + if (isSet(object.sig)) obj.sig = bytesFromBase64(object.sig); + return obj; }, toJSON(message: AuxSignerData): JsonSafe { const obj: any = {}; @@ -2240,7 +2205,9 @@ export const AuxSignerData = { fromPartial(object: DeepPartial): AuxSignerData { const message = createBaseAuxSignerData(); message.address = object.address ?? ""; - message.signDoc = object.signDoc !== undefined && object.signDoc !== null ? SignDocDirectAux.fromPartial(object.signDoc) : undefined; + if (object.signDoc !== undefined && object.signDoc !== null) { + message.signDoc = SignDocDirectAux.fromPartial(object.signDoc); + } message.mode = object.mode ?? 0; message.sig = object.sig ?? new Uint8Array(); return message; diff --git a/__fixtures__/v-next/outputv4/cosmos/upgrade/v1beta1/query.lcd.ts b/__fixtures__/v-next/outputv4/cosmos/upgrade/v1beta1/query.lcd.ts index 70cb3779a6..e2a48e1e67 100644 --- a/__fixtures__/v-next/outputv4/cosmos/upgrade/v1beta1/query.lcd.ts +++ b/__fixtures__/v-next/outputv4/cosmos/upgrade/v1beta1/query.lcd.ts @@ -1,6 +1,6 @@ -import { Plan, PlanSDKType, ModuleVersion, ModuleVersionSDKType } from "./upgrade"; +import { Plan, PlanSDKType, ModuleVersion, ModuleVersionSDKType } from "./upgrade.js"; import { LCDClient } from "@cosmology/lcd"; -import { QueryCurrentPlanRequest, QueryCurrentPlanRequestSDKType, QueryCurrentPlanResponse, QueryCurrentPlanResponseSDKType, QueryAppliedPlanRequest, QueryAppliedPlanRequestSDKType, QueryAppliedPlanResponse, QueryAppliedPlanResponseSDKType, QueryUpgradedConsensusStateRequest, QueryUpgradedConsensusStateRequestSDKType, QueryUpgradedConsensusStateResponse, QueryUpgradedConsensusStateResponseSDKType, QueryModuleVersionsRequest, QueryModuleVersionsRequestSDKType, QueryModuleVersionsResponse, QueryModuleVersionsResponseSDKType, QueryAuthorityRequest, QueryAuthorityRequestSDKType, QueryAuthorityResponse, QueryAuthorityResponseSDKType } from "./query"; +import { QueryCurrentPlanRequest, QueryCurrentPlanRequestSDKType, QueryCurrentPlanResponse, QueryCurrentPlanResponseSDKType, QueryAppliedPlanRequest, QueryAppliedPlanRequestSDKType, QueryAppliedPlanResponse, QueryAppliedPlanResponseSDKType, QueryUpgradedConsensusStateRequest, QueryUpgradedConsensusStateRequestSDKType, QueryUpgradedConsensusStateResponse, QueryUpgradedConsensusStateResponseSDKType, QueryModuleVersionsRequest, QueryModuleVersionsRequestSDKType, QueryModuleVersionsResponse, QueryModuleVersionsResponseSDKType, QueryAuthorityRequest, QueryAuthorityRequestSDKType, QueryAuthorityResponse, QueryAuthorityResponseSDKType } from "./query.js"; export class LCDQueryClient { req: LCDClient; constructor({ diff --git a/__fixtures__/v-next/outputv4/cosmos/upgrade/v1beta1/query.rpc.Query.ts b/__fixtures__/v-next/outputv4/cosmos/upgrade/v1beta1/query.rpc.Query.ts index 80484b6d9d..80d127d58d 100644 --- a/__fixtures__/v-next/outputv4/cosmos/upgrade/v1beta1/query.rpc.Query.ts +++ b/__fixtures__/v-next/outputv4/cosmos/upgrade/v1beta1/query.rpc.Query.ts @@ -1,8 +1,8 @@ -import { Plan, PlanSDKType, ModuleVersion, ModuleVersionSDKType } from "./upgrade"; -import { Rpc } from "../../../helpers"; -import { BinaryReader } from "../../../binary"; +import { Plan, PlanSDKType, ModuleVersion, ModuleVersionSDKType } from "./upgrade.js"; +import { Rpc } from "../../../helpers.js"; +import { BinaryReader } from "../../../binary.js"; import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; -import { QueryCurrentPlanRequest, QueryCurrentPlanRequestSDKType, QueryCurrentPlanResponse, QueryCurrentPlanResponseSDKType, QueryAppliedPlanRequest, QueryAppliedPlanRequestSDKType, QueryAppliedPlanResponse, QueryAppliedPlanResponseSDKType, QueryUpgradedConsensusStateRequest, QueryUpgradedConsensusStateRequestSDKType, QueryUpgradedConsensusStateResponse, QueryUpgradedConsensusStateResponseSDKType, QueryModuleVersionsRequest, QueryModuleVersionsRequestSDKType, QueryModuleVersionsResponse, QueryModuleVersionsResponseSDKType, QueryAuthorityRequest, QueryAuthorityRequestSDKType, QueryAuthorityResponse, QueryAuthorityResponseSDKType, ReactiveQueryCurrentPlanRequest, ReactiveQueryAppliedPlanRequest, ReactiveQueryUpgradedConsensusStateRequest, ReactiveQueryModuleVersionsRequest, ReactiveQueryAuthorityRequest } from "./query"; +import { QueryCurrentPlanRequest, QueryCurrentPlanRequestSDKType, QueryCurrentPlanResponse, QueryCurrentPlanResponseSDKType, QueryAppliedPlanRequest, QueryAppliedPlanRequestSDKType, QueryAppliedPlanResponse, QueryAppliedPlanResponseSDKType, QueryUpgradedConsensusStateRequest, QueryUpgradedConsensusStateRequestSDKType, QueryUpgradedConsensusStateResponse, QueryUpgradedConsensusStateResponseSDKType, QueryModuleVersionsRequest, QueryModuleVersionsRequestSDKType, QueryModuleVersionsResponse, QueryModuleVersionsResponseSDKType, QueryAuthorityRequest, QueryAuthorityRequestSDKType, QueryAuthorityResponse, QueryAuthorityResponseSDKType } from "./query.js"; /** Query defines the gRPC upgrade querier service. */ export interface Query { /** CurrentPlan queries the current upgrade plan. */ diff --git a/__fixtures__/v-next/outputv4/cosmos/upgrade/v1beta1/query.ts b/__fixtures__/v-next/outputv4/cosmos/upgrade/v1beta1/query.ts index eaf8cdbf62..65e3031521 100644 --- a/__fixtures__/v-next/outputv4/cosmos/upgrade/v1beta1/query.ts +++ b/__fixtures__/v-next/outputv4/cosmos/upgrade/v1beta1/query.ts @@ -1,15 +1,13 @@ -import { Plan, PlanSDKType, ModuleVersion, ModuleVersionSDKType } from "./upgrade"; -import { BinaryReader, BinaryWriter } from "../../../binary"; -import { JsonSafe } from "../../../json-safe"; -import { DeepPartial, isSet, bytesFromBase64, base64FromBytes } from "../../../helpers"; -import { ComputedRef } from "vue"; +import { Plan, PlanSDKType, ModuleVersion, ModuleVersionSDKType } from "./upgrade.js"; +import { BinaryReader, BinaryWriter } from "../../../binary.js"; +import { JsonSafe } from "../../../json-safe.js"; +import { DeepPartial, isSet, bytesFromBase64, base64FromBytes } from "../../../helpers.js"; export const protobufPackage = "cosmos.upgrade.v1beta1"; /** * QueryCurrentPlanRequest is the request type for the Query/CurrentPlan RPC * method. */ export interface QueryCurrentPlanRequest {} -export interface ReactiveQueryCurrentPlanRequest {} export interface QueryCurrentPlanRequestProtoMsg { typeUrl: "/cosmos.upgrade.v1beta1.QueryCurrentPlanRequest"; value: Uint8Array; @@ -27,9 +25,6 @@ export interface QueryCurrentPlanResponse { /** plan is the current upgrade plan. */ plan?: Plan; } -export interface ReactiveQueryCurrentPlanResponse { - plan?: ComputedRef; -} export interface QueryCurrentPlanResponseProtoMsg { typeUrl: "/cosmos.upgrade.v1beta1.QueryCurrentPlanResponse"; value: Uint8Array; @@ -49,9 +44,6 @@ export interface QueryAppliedPlanRequest { /** name is the name of the applied plan to query for. */ name: string; } -export interface ReactiveQueryAppliedPlanRequest { - name: ComputedRef; -} export interface QueryAppliedPlanRequestProtoMsg { typeUrl: "/cosmos.upgrade.v1beta1.QueryAppliedPlanRequest"; value: Uint8Array; @@ -71,9 +63,6 @@ export interface QueryAppliedPlanResponse { /** height is the block height at which the plan was applied. */ height: bigint; } -export interface ReactiveQueryAppliedPlanResponse { - height: ComputedRef; -} export interface QueryAppliedPlanResponseProtoMsg { typeUrl: "/cosmos.upgrade.v1beta1.QueryAppliedPlanResponse"; value: Uint8Array; @@ -97,9 +86,6 @@ export interface QueryUpgradedConsensusStateRequest { */ lastHeight: bigint; } -export interface ReactiveQueryUpgradedConsensusStateRequest { - lastHeight: ComputedRef; -} export interface QueryUpgradedConsensusStateRequestProtoMsg { typeUrl: "/cosmos.upgrade.v1beta1.QueryUpgradedConsensusStateRequest"; value: Uint8Array; @@ -121,9 +107,6 @@ export interface QueryUpgradedConsensusStateResponse { /** Since: cosmos-sdk 0.43 */ upgradedConsensusState: Uint8Array; } -export interface ReactiveQueryUpgradedConsensusStateResponse { - upgradedConsensusState: ComputedRef; -} export interface QueryUpgradedConsensusStateResponseProtoMsg { typeUrl: "/cosmos.upgrade.v1beta1.QueryUpgradedConsensusStateResponse"; value: Uint8Array; @@ -150,9 +133,6 @@ export interface QueryModuleVersionsRequest { */ moduleName: string; } -export interface ReactiveQueryModuleVersionsRequest { - moduleName: ComputedRef; -} export interface QueryModuleVersionsRequestProtoMsg { typeUrl: "/cosmos.upgrade.v1beta1.QueryModuleVersionsRequest"; value: Uint8Array; @@ -176,9 +156,6 @@ export interface QueryModuleVersionsResponse { /** module_versions is a list of module names with their consensus versions. */ moduleVersions: ModuleVersion[]; } -export interface ReactiveQueryModuleVersionsResponse { - moduleVersions: ComputedRef; -} export interface QueryModuleVersionsResponseProtoMsg { typeUrl: "/cosmos.upgrade.v1beta1.QueryModuleVersionsResponse"; value: Uint8Array; @@ -198,7 +175,6 @@ export interface QueryModuleVersionsResponseSDKType { * Since: cosmos-sdk 0.46 */ export interface QueryAuthorityRequest {} -export interface ReactiveQueryAuthorityRequest {} export interface QueryAuthorityRequestProtoMsg { typeUrl: "/cosmos.upgrade.v1beta1.QueryAuthorityRequest"; value: Uint8Array; @@ -217,9 +193,6 @@ export interface QueryAuthorityRequestSDKType {} export interface QueryAuthorityResponse { address: string; } -export interface ReactiveQueryAuthorityResponse { - address: ComputedRef; -} export interface QueryAuthorityResponseProtoMsg { typeUrl: "/cosmos.upgrade.v1beta1.QueryAuthorityResponse"; value: Uint8Array; @@ -255,7 +228,8 @@ export const QueryCurrentPlanRequest = { return message; }, fromJSON(_: any): QueryCurrentPlanRequest { - return {}; + const obj = createBaseQueryCurrentPlanRequest(); + return obj; }, toJSON(_: QueryCurrentPlanRequest): JsonSafe { const obj: any = {}; @@ -336,9 +310,9 @@ export const QueryCurrentPlanResponse = { return message; }, fromJSON(object: any): QueryCurrentPlanResponse { - return { - plan: isSet(object.plan) ? Plan.fromJSON(object.plan) : undefined - }; + const obj = createBaseQueryCurrentPlanResponse(); + if (isSet(object.plan)) obj.plan = Plan.fromJSON(object.plan); + return obj; }, toJSON(message: QueryCurrentPlanResponse): JsonSafe { const obj: any = {}; @@ -347,7 +321,9 @@ export const QueryCurrentPlanResponse = { }, fromPartial(object: DeepPartial): QueryCurrentPlanResponse { const message = createBaseQueryCurrentPlanResponse(); - message.plan = object.plan !== undefined && object.plan !== null ? Plan.fromPartial(object.plan) : undefined; + if (object.plan !== undefined && object.plan !== null) { + message.plan = Plan.fromPartial(object.plan); + } return message; }, fromSDK(object: QueryCurrentPlanResponseSDKType): QueryCurrentPlanResponse { @@ -407,7 +383,7 @@ function createBaseQueryAppliedPlanRequest(): QueryAppliedPlanRequest { export const QueryAppliedPlanRequest = { typeUrl: "/cosmos.upgrade.v1beta1.QueryAppliedPlanRequest", encode(message: QueryAppliedPlanRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.name !== "") { + if (message.name !== undefined) { writer.uint32(10).string(message.name); } return writer; @@ -430,9 +406,9 @@ export const QueryAppliedPlanRequest = { return message; }, fromJSON(object: any): QueryAppliedPlanRequest { - return { - name: isSet(object.name) ? String(object.name) : "" - }; + const obj = createBaseQueryAppliedPlanRequest(); + if (isSet(object.name)) obj.name = String(object.name); + return obj; }, toJSON(message: QueryAppliedPlanRequest): JsonSafe { const obj: any = {}; @@ -501,7 +477,7 @@ function createBaseQueryAppliedPlanResponse(): QueryAppliedPlanResponse { export const QueryAppliedPlanResponse = { typeUrl: "/cosmos.upgrade.v1beta1.QueryAppliedPlanResponse", encode(message: QueryAppliedPlanResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.height !== BigInt(0)) { + if (message.height !== undefined) { writer.uint32(8).int64(message.height); } return writer; @@ -524,9 +500,9 @@ export const QueryAppliedPlanResponse = { return message; }, fromJSON(object: any): QueryAppliedPlanResponse { - return { - height: isSet(object.height) ? BigInt(object.height.toString()) : BigInt(0) - }; + const obj = createBaseQueryAppliedPlanResponse(); + if (isSet(object.height)) obj.height = BigInt(object.height.toString()); + return obj; }, toJSON(message: QueryAppliedPlanResponse): JsonSafe { const obj: any = {}; @@ -535,7 +511,9 @@ export const QueryAppliedPlanResponse = { }, fromPartial(object: DeepPartial): QueryAppliedPlanResponse { const message = createBaseQueryAppliedPlanResponse(); - message.height = object.height !== undefined && object.height !== null ? BigInt(object.height.toString()) : BigInt(0); + if (object.height !== undefined && object.height !== null) { + message.height = BigInt(object.height.toString()); + } return message; }, fromSDK(object: QueryAppliedPlanResponseSDKType): QueryAppliedPlanResponse { @@ -595,7 +573,7 @@ function createBaseQueryUpgradedConsensusStateRequest(): QueryUpgradedConsensusS export const QueryUpgradedConsensusStateRequest = { typeUrl: "/cosmos.upgrade.v1beta1.QueryUpgradedConsensusStateRequest", encode(message: QueryUpgradedConsensusStateRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.lastHeight !== BigInt(0)) { + if (message.lastHeight !== undefined) { writer.uint32(8).int64(message.lastHeight); } return writer; @@ -618,9 +596,9 @@ export const QueryUpgradedConsensusStateRequest = { return message; }, fromJSON(object: any): QueryUpgradedConsensusStateRequest { - return { - lastHeight: isSet(object.lastHeight) ? BigInt(object.lastHeight.toString()) : BigInt(0) - }; + const obj = createBaseQueryUpgradedConsensusStateRequest(); + if (isSet(object.lastHeight)) obj.lastHeight = BigInt(object.lastHeight.toString()); + return obj; }, toJSON(message: QueryUpgradedConsensusStateRequest): JsonSafe { const obj: any = {}; @@ -629,7 +607,9 @@ export const QueryUpgradedConsensusStateRequest = { }, fromPartial(object: DeepPartial): QueryUpgradedConsensusStateRequest { const message = createBaseQueryUpgradedConsensusStateRequest(); - message.lastHeight = object.lastHeight !== undefined && object.lastHeight !== null ? BigInt(object.lastHeight.toString()) : BigInt(0); + if (object.lastHeight !== undefined && object.lastHeight !== null) { + message.lastHeight = BigInt(object.lastHeight.toString()); + } return message; }, fromSDK(object: QueryUpgradedConsensusStateRequestSDKType): QueryUpgradedConsensusStateRequest { @@ -712,9 +692,9 @@ export const QueryUpgradedConsensusStateResponse = { return message; }, fromJSON(object: any): QueryUpgradedConsensusStateResponse { - return { - upgradedConsensusState: isSet(object.upgradedConsensusState) ? bytesFromBase64(object.upgradedConsensusState) : new Uint8Array() - }; + const obj = createBaseQueryUpgradedConsensusStateResponse(); + if (isSet(object.upgradedConsensusState)) obj.upgradedConsensusState = bytesFromBase64(object.upgradedConsensusState); + return obj; }, toJSON(message: QueryUpgradedConsensusStateResponse): JsonSafe { const obj: any = {}; @@ -783,7 +763,7 @@ function createBaseQueryModuleVersionsRequest(): QueryModuleVersionsRequest { export const QueryModuleVersionsRequest = { typeUrl: "/cosmos.upgrade.v1beta1.QueryModuleVersionsRequest", encode(message: QueryModuleVersionsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.moduleName !== "") { + if (message.moduleName !== undefined) { writer.uint32(10).string(message.moduleName); } return writer; @@ -806,9 +786,9 @@ export const QueryModuleVersionsRequest = { return message; }, fromJSON(object: any): QueryModuleVersionsRequest { - return { - moduleName: isSet(object.moduleName) ? String(object.moduleName) : "" - }; + const obj = createBaseQueryModuleVersionsRequest(); + if (isSet(object.moduleName)) obj.moduleName = String(object.moduleName); + return obj; }, toJSON(message: QueryModuleVersionsRequest): JsonSafe { const obj: any = {}; @@ -900,9 +880,9 @@ export const QueryModuleVersionsResponse = { return message; }, fromJSON(object: any): QueryModuleVersionsResponse { - return { - moduleVersions: Array.isArray(object?.moduleVersions) ? object.moduleVersions.map((e: any) => ModuleVersion.fromJSON(e)) : [] - }; + const obj = createBaseQueryModuleVersionsResponse(); + if (Array.isArray(object?.moduleVersions)) obj.moduleVersions = object.moduleVersions.map((e: any) => ModuleVersion.fromJSON(e)); + return obj; }, toJSON(message: QueryModuleVersionsResponse): JsonSafe { const obj: any = {}; @@ -996,7 +976,8 @@ export const QueryAuthorityRequest = { return message; }, fromJSON(_: any): QueryAuthorityRequest { - return {}; + const obj = createBaseQueryAuthorityRequest(); + return obj; }, toJSON(_: QueryAuthorityRequest): JsonSafe { const obj: any = {}; @@ -1054,7 +1035,7 @@ function createBaseQueryAuthorityResponse(): QueryAuthorityResponse { export const QueryAuthorityResponse = { typeUrl: "/cosmos.upgrade.v1beta1.QueryAuthorityResponse", encode(message: QueryAuthorityResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.address !== "") { + if (message.address !== undefined) { writer.uint32(10).string(message.address); } return writer; @@ -1077,9 +1058,9 @@ export const QueryAuthorityResponse = { return message; }, fromJSON(object: any): QueryAuthorityResponse { - return { - address: isSet(object.address) ? String(object.address) : "" - }; + const obj = createBaseQueryAuthorityResponse(); + if (isSet(object.address)) obj.address = String(object.address); + return obj; }, toJSON(message: QueryAuthorityResponse): JsonSafe { const obj: any = {}; 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..1a5ed48b86 100644 --- a/__fixtures__/v-next/outputv4/cosmos/upgrade/v1beta1/tx.amino.ts +++ b/__fixtures__/v-next/outputv4/cosmos/upgrade/v1beta1/tx.amino.ts @@ -1,7 +1,7 @@ -import { Plan, PlanSDKType } from "./upgrade"; +import { Plan, PlanSDKType } from "./upgrade.js"; import { AminoMsg } from "@cosmjs/amino"; -import { Any, AnySDKType } from "../../../google/protobuf/any"; -import { MsgSoftwareUpgrade, MsgSoftwareUpgradeSDKType, MsgCancelUpgrade, MsgCancelUpgradeSDKType } from "./tx"; +import { Any, AnySDKType } from "../../../google/protobuf/any.js"; +import { MsgSoftwareUpgrade, MsgSoftwareUpgradeSDKType, MsgCancelUpgrade, MsgCancelUpgradeSDKType } from "./tx.js"; export interface MsgSoftwareUpgradeAminoType extends AminoMsg { type: "cosmos-sdk/MsgSoftwareUpgrade"; value: { diff --git a/__fixtures__/v-next/outputv4/cosmos/upgrade/v1beta1/tx.registry.ts b/__fixtures__/v-next/outputv4/cosmos/upgrade/v1beta1/tx.registry.ts index 57f220dec3..e3fae09441 100644 --- a/__fixtures__/v-next/outputv4/cosmos/upgrade/v1beta1/tx.registry.ts +++ b/__fixtures__/v-next/outputv4/cosmos/upgrade/v1beta1/tx.registry.ts @@ -1,6 +1,6 @@ -import { Plan, PlanSDKType } from "./upgrade"; +import { Plan, PlanSDKType } from "./upgrade.js"; import { GeneratedType, Registry } from "@cosmjs/proto-signing"; -import { MsgSoftwareUpgrade, MsgSoftwareUpgradeSDKType, MsgCancelUpgrade, MsgCancelUpgradeSDKType } from "./tx"; +import { MsgSoftwareUpgrade, MsgSoftwareUpgradeSDKType, MsgCancelUpgrade, MsgCancelUpgradeSDKType } from "./tx.js"; export const registry: ReadonlyArray<[string, GeneratedType]> = [["/cosmos.upgrade.v1beta1.MsgSoftwareUpgrade", MsgSoftwareUpgrade], ["/cosmos.upgrade.v1beta1.MsgCancelUpgrade", MsgCancelUpgrade]]; export const load = (protoRegistry: Registry) => { registry.forEach(([typeUrl, mod]) => { diff --git a/__fixtures__/v-next/outputv4/cosmos/upgrade/v1beta1/tx.rpc.msg.ts b/__fixtures__/v-next/outputv4/cosmos/upgrade/v1beta1/tx.rpc.msg.ts index 7700a4b9b3..adeae6342a 100644 --- a/__fixtures__/v-next/outputv4/cosmos/upgrade/v1beta1/tx.rpc.msg.ts +++ b/__fixtures__/v-next/outputv4/cosmos/upgrade/v1beta1/tx.rpc.msg.ts @@ -1,7 +1,7 @@ -import { Plan, PlanSDKType } from "./upgrade"; -import { Rpc } from "../../../helpers"; -import { BinaryReader } from "../../../binary"; -import { MsgSoftwareUpgrade, MsgSoftwareUpgradeSDKType, MsgSoftwareUpgradeResponse, MsgSoftwareUpgradeResponseSDKType, MsgCancelUpgrade, MsgCancelUpgradeSDKType, MsgCancelUpgradeResponse, MsgCancelUpgradeResponseSDKType } from "./tx"; +import { Plan, PlanSDKType } from "./upgrade.js"; +import { Rpc } from "../../../helpers.js"; +import { BinaryReader } from "../../../binary.js"; +import { MsgSoftwareUpgrade, MsgSoftwareUpgradeSDKType, MsgSoftwareUpgradeResponse, MsgSoftwareUpgradeResponseSDKType, MsgCancelUpgrade, MsgCancelUpgradeSDKType, MsgCancelUpgradeResponse, MsgCancelUpgradeResponseSDKType } from "./tx.js"; /** Msg defines the upgrade Msg service. */ export interface Msg { /** diff --git a/__fixtures__/v-next/outputv4/cosmos/upgrade/v1beta1/tx.ts b/__fixtures__/v-next/outputv4/cosmos/upgrade/v1beta1/tx.ts index 5756f0a53f..e1e807d4af 100644 --- a/__fixtures__/v-next/outputv4/cosmos/upgrade/v1beta1/tx.ts +++ b/__fixtures__/v-next/outputv4/cosmos/upgrade/v1beta1/tx.ts @@ -1,8 +1,7 @@ -import { Plan, PlanSDKType } from "./upgrade"; -import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; -import { JsonSafe } from "../../../json-safe"; -import { ComputedRef } from "vue"; +import { Plan, PlanSDKType } from "./upgrade.js"; +import { BinaryReader, BinaryWriter } from "../../../binary.js"; +import { isSet, DeepPartial } from "../../../helpers.js"; +import { JsonSafe } from "../../../json-safe.js"; export const protobufPackage = "cosmos.upgrade.v1beta1"; /** * MsgSoftwareUpgrade is the Msg/SoftwareUpgrade request type. @@ -15,10 +14,6 @@ export interface MsgSoftwareUpgrade { /** plan is the upgrade plan. */ plan: Plan; } -export interface ReactiveMsgSoftwareUpgrade { - authority: ComputedRef; - plan: ComputedRef; -} export interface MsgSoftwareUpgradeProtoMsg { typeUrl: "/cosmos.upgrade.v1beta1.MsgSoftwareUpgrade"; value: Uint8Array; @@ -38,7 +33,6 @@ export interface MsgSoftwareUpgradeSDKType { * Since: cosmos-sdk 0.46 */ export interface MsgSoftwareUpgradeResponse {} -export interface ReactiveMsgSoftwareUpgradeResponse {} export interface MsgSoftwareUpgradeResponseProtoMsg { typeUrl: "/cosmos.upgrade.v1beta1.MsgSoftwareUpgradeResponse"; value: Uint8Array; @@ -58,9 +52,6 @@ export interface MsgCancelUpgrade { /** authority is the address of the governance account. */ authority: string; } -export interface ReactiveMsgCancelUpgrade { - authority: ComputedRef; -} export interface MsgCancelUpgradeProtoMsg { typeUrl: "/cosmos.upgrade.v1beta1.MsgCancelUpgrade"; value: Uint8Array; @@ -79,7 +70,6 @@ export interface MsgCancelUpgradeSDKType { * Since: cosmos-sdk 0.46 */ export interface MsgCancelUpgradeResponse {} -export interface ReactiveMsgCancelUpgradeResponse {} export interface MsgCancelUpgradeResponseProtoMsg { typeUrl: "/cosmos.upgrade.v1beta1.MsgCancelUpgradeResponse"; value: Uint8Array; @@ -99,7 +89,7 @@ function createBaseMsgSoftwareUpgrade(): MsgSoftwareUpgrade { export const MsgSoftwareUpgrade = { typeUrl: "/cosmos.upgrade.v1beta1.MsgSoftwareUpgrade", encode(message: MsgSoftwareUpgrade, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.authority !== "") { + if (message.authority !== undefined) { writer.uint32(10).string(message.authority); } if (message.plan !== undefined) { @@ -128,10 +118,10 @@ export const MsgSoftwareUpgrade = { return message; }, fromJSON(object: any): MsgSoftwareUpgrade { - return { - authority: isSet(object.authority) ? String(object.authority) : "", - plan: isSet(object.plan) ? Plan.fromJSON(object.plan) : undefined - }; + const obj = createBaseMsgSoftwareUpgrade(); + if (isSet(object.authority)) obj.authority = String(object.authority); + if (isSet(object.plan)) obj.plan = Plan.fromJSON(object.plan); + return obj; }, toJSON(message: MsgSoftwareUpgrade): JsonSafe { const obj: any = {}; @@ -142,7 +132,9 @@ export const MsgSoftwareUpgrade = { fromPartial(object: DeepPartial): MsgSoftwareUpgrade { const message = createBaseMsgSoftwareUpgrade(); message.authority = object.authority ?? ""; - message.plan = object.plan !== undefined && object.plan !== null ? Plan.fromPartial(object.plan) : undefined; + if (object.plan !== undefined && object.plan !== null) { + message.plan = Plan.fromPartial(object.plan); + } return message; }, fromSDK(object: MsgSoftwareUpgradeSDKType): MsgSoftwareUpgrade { @@ -224,7 +216,8 @@ export const MsgSoftwareUpgradeResponse = { return message; }, fromJSON(_: any): MsgSoftwareUpgradeResponse { - return {}; + const obj = createBaseMsgSoftwareUpgradeResponse(); + return obj; }, toJSON(_: MsgSoftwareUpgradeResponse): JsonSafe { const obj: any = {}; @@ -282,7 +275,7 @@ function createBaseMsgCancelUpgrade(): MsgCancelUpgrade { export const MsgCancelUpgrade = { typeUrl: "/cosmos.upgrade.v1beta1.MsgCancelUpgrade", encode(message: MsgCancelUpgrade, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.authority !== "") { + if (message.authority !== undefined) { writer.uint32(10).string(message.authority); } return writer; @@ -305,9 +298,9 @@ export const MsgCancelUpgrade = { return message; }, fromJSON(object: any): MsgCancelUpgrade { - return { - authority: isSet(object.authority) ? String(object.authority) : "" - }; + const obj = createBaseMsgCancelUpgrade(); + if (isSet(object.authority)) obj.authority = String(object.authority); + return obj; }, toJSON(message: MsgCancelUpgrade): JsonSafe { const obj: any = {}; @@ -391,7 +384,8 @@ export const MsgCancelUpgradeResponse = { return message; }, fromJSON(_: any): MsgCancelUpgradeResponse { - return {}; + const obj = createBaseMsgCancelUpgradeResponse(); + return obj; }, toJSON(_: MsgCancelUpgradeResponse): JsonSafe { const obj: any = {}; diff --git a/__fixtures__/v-next/outputv4/cosmos/upgrade/v1beta1/upgrade.ts b/__fixtures__/v-next/outputv4/cosmos/upgrade/v1beta1/upgrade.ts index 16155331b1..0c594529ac 100644 --- a/__fixtures__/v-next/outputv4/cosmos/upgrade/v1beta1/upgrade.ts +++ b/__fixtures__/v-next/outputv4/cosmos/upgrade/v1beta1/upgrade.ts @@ -1,9 +1,8 @@ -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 { JsonSafe } from "../../../json-safe"; -import { ComputedRef } from "vue"; +import { Timestamp, TimestampSDKType } from "../../../google/protobuf/timestamp.js"; +import { Any, AnySDKType } from "../../../google/protobuf/any.js"; +import { BinaryReader, BinaryWriter } from "../../../binary.js"; +import { toTimestamp, fromTimestamp, isSet, DeepPartial } from "../../../helpers.js"; +import { JsonSafe } from "../../../json-safe.js"; export const protobufPackage = "cosmos.upgrade.v1beta1"; /** Plan specifies information about a planned upgrade and when it should occur. */ export interface Plan { @@ -42,13 +41,6 @@ export interface Plan { /** @deprecated */ upgradedClientState?: Any; } -export interface ReactivePlan { - name: ComputedRef; - time: ComputedRef; - height: ComputedRef; - info: ComputedRef; - upgradedClientState?: ComputedRef; -} export interface PlanProtoMsg { typeUrl: "/cosmos.upgrade.v1beta1.Plan"; value: Uint8Array; @@ -75,11 +67,6 @@ export interface SoftwareUpgradeProposal { description: string; plan: Plan; } -export interface ReactiveSoftwareUpgradeProposal { - title: ComputedRef; - description: ComputedRef; - plan: ComputedRef; -} export interface SoftwareUpgradeProposalProtoMsg { typeUrl: "/cosmos.upgrade.v1beta1.SoftwareUpgradeProposal"; value: Uint8Array; @@ -107,10 +94,6 @@ export interface CancelSoftwareUpgradeProposal { title: string; description: string; } -export interface ReactiveCancelSoftwareUpgradeProposal { - title: ComputedRef; - description: ComputedRef; -} export interface CancelSoftwareUpgradeProposalProtoMsg { typeUrl: "/cosmos.upgrade.v1beta1.CancelSoftwareUpgradeProposal"; value: Uint8Array; @@ -137,10 +120,6 @@ export interface ModuleVersion { /** consensus version of the app module */ version: bigint; } -export interface ReactiveModuleVersion { - name: ComputedRef; - version: ComputedRef; -} export interface ModuleVersionProtoMsg { typeUrl: "/cosmos.upgrade.v1beta1.ModuleVersion"; value: Uint8Array; @@ -166,16 +145,16 @@ function createBasePlan(): Plan { export const Plan = { typeUrl: "/cosmos.upgrade.v1beta1.Plan", encode(message: Plan, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.name !== "") { + if (message.name !== undefined) { writer.uint32(10).string(message.name); } if (message.time !== undefined) { Timestamp.encode(toTimestamp(message.time), writer.uint32(18).fork()).ldelim(); } - if (message.height !== BigInt(0)) { + if (message.height !== undefined) { writer.uint32(24).int64(message.height); } - if (message.info !== "") { + if (message.info !== undefined) { writer.uint32(34).string(message.info); } if (message.upgradedClientState !== undefined) { @@ -213,13 +192,13 @@ export const Plan = { return message; }, fromJSON(object: any): Plan { - return { - name: isSet(object.name) ? String(object.name) : "", - time: isSet(object.time) ? new Date(object.time) : undefined, - height: isSet(object.height) ? BigInt(object.height.toString()) : BigInt(0), - info: isSet(object.info) ? String(object.info) : "", - upgradedClientState: isSet(object.upgradedClientState) ? Any.fromJSON(object.upgradedClientState) : undefined - }; + const obj = createBasePlan(); + if (isSet(object.name)) obj.name = String(object.name); + if (isSet(object.time)) obj.time = new Date(object.time); + if (isSet(object.height)) obj.height = BigInt(object.height.toString()); + if (isSet(object.info)) obj.info = String(object.info); + if (isSet(object.upgradedClientState)) obj.upgradedClientState = Any.fromJSON(object.upgradedClientState); + return obj; }, toJSON(message: Plan): JsonSafe { const obj: any = {}; @@ -234,9 +213,13 @@ export const Plan = { const message = createBasePlan(); message.name = object.name ?? ""; message.time = object.time ?? undefined; - message.height = object.height !== undefined && object.height !== null ? BigInt(object.height.toString()) : BigInt(0); + if (object.height !== undefined && object.height !== null) { + message.height = BigInt(object.height.toString()); + } message.info = object.info ?? ""; - message.upgradedClientState = object.upgradedClientState !== undefined && object.upgradedClientState !== null ? Any.fromPartial(object.upgradedClientState) : undefined; + if (object.upgradedClientState !== undefined && object.upgradedClientState !== null) { + message.upgradedClientState = Any.fromPartial(object.upgradedClientState); + } return message; }, fromSDK(object: PlanSDKType): Plan { @@ -326,10 +309,10 @@ function createBaseSoftwareUpgradeProposal(): SoftwareUpgradeProposal { export const SoftwareUpgradeProposal = { typeUrl: "/cosmos.upgrade.v1beta1.SoftwareUpgradeProposal", encode(message: SoftwareUpgradeProposal, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.title !== "") { + if (message.title !== undefined) { writer.uint32(10).string(message.title); } - if (message.description !== "") { + if (message.description !== undefined) { writer.uint32(18).string(message.description); } if (message.plan !== undefined) { @@ -361,11 +344,11 @@ export const SoftwareUpgradeProposal = { return message; }, fromJSON(object: any): SoftwareUpgradeProposal { - return { - title: isSet(object.title) ? String(object.title) : "", - description: isSet(object.description) ? String(object.description) : "", - plan: isSet(object.plan) ? Plan.fromJSON(object.plan) : undefined - }; + const obj = createBaseSoftwareUpgradeProposal(); + if (isSet(object.title)) obj.title = String(object.title); + if (isSet(object.description)) obj.description = String(object.description); + if (isSet(object.plan)) obj.plan = Plan.fromJSON(object.plan); + return obj; }, toJSON(message: SoftwareUpgradeProposal): JsonSafe { const obj: any = {}; @@ -378,7 +361,9 @@ export const SoftwareUpgradeProposal = { const message = createBaseSoftwareUpgradeProposal(); message.title = object.title ?? ""; message.description = object.description ?? ""; - message.plan = object.plan !== undefined && object.plan !== null ? Plan.fromPartial(object.plan) : undefined; + if (object.plan !== undefined && object.plan !== null) { + message.plan = Plan.fromPartial(object.plan); + } return message; }, fromSDK(object: SoftwareUpgradeProposalSDKType): SoftwareUpgradeProposal { @@ -453,10 +438,10 @@ function createBaseCancelSoftwareUpgradeProposal(): CancelSoftwareUpgradeProposa export const CancelSoftwareUpgradeProposal = { typeUrl: "/cosmos.upgrade.v1beta1.CancelSoftwareUpgradeProposal", encode(message: CancelSoftwareUpgradeProposal, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.title !== "") { + if (message.title !== undefined) { writer.uint32(10).string(message.title); } - if (message.description !== "") { + if (message.description !== undefined) { writer.uint32(18).string(message.description); } return writer; @@ -482,10 +467,10 @@ export const CancelSoftwareUpgradeProposal = { return message; }, fromJSON(object: any): CancelSoftwareUpgradeProposal { - return { - title: isSet(object.title) ? String(object.title) : "", - description: isSet(object.description) ? String(object.description) : "" - }; + const obj = createBaseCancelSoftwareUpgradeProposal(); + if (isSet(object.title)) obj.title = String(object.title); + if (isSet(object.description)) obj.description = String(object.description); + return obj; }, toJSON(message: CancelSoftwareUpgradeProposal): JsonSafe { const obj: any = {}; @@ -564,10 +549,10 @@ function createBaseModuleVersion(): ModuleVersion { export const ModuleVersion = { typeUrl: "/cosmos.upgrade.v1beta1.ModuleVersion", encode(message: ModuleVersion, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.name !== "") { + if (message.name !== undefined) { writer.uint32(10).string(message.name); } - if (message.version !== BigInt(0)) { + if (message.version !== undefined) { writer.uint32(16).uint64(message.version); } return writer; @@ -593,10 +578,10 @@ export const ModuleVersion = { return message; }, fromJSON(object: any): ModuleVersion { - return { - name: isSet(object.name) ? String(object.name) : "", - version: isSet(object.version) ? BigInt(object.version.toString()) : BigInt(0) - }; + const obj = createBaseModuleVersion(); + if (isSet(object.name)) obj.name = String(object.name); + if (isSet(object.version)) obj.version = BigInt(object.version.toString()); + return obj; }, toJSON(message: ModuleVersion): JsonSafe { const obj: any = {}; @@ -607,7 +592,9 @@ export const ModuleVersion = { fromPartial(object: DeepPartial): ModuleVersion { const message = createBaseModuleVersion(); message.name = object.name ?? ""; - message.version = object.version !== undefined && object.version !== null ? BigInt(object.version.toString()) : BigInt(0); + if (object.version !== undefined && object.version !== null) { + message.version = BigInt(object.version.toString()); + } return message; }, fromSDK(object: ModuleVersionSDKType): 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 b1829bb2bc..2688fc531c 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,7 @@ -import { Coin, CoinSDKType } from "../../base/v1beta1/coin"; -import { Period, PeriodSDKType } from "./vesting"; +import { Coin, CoinSDKType } from "../../base/v1beta1/coin.js"; +import { Period, PeriodSDKType } from "./vesting.js"; import { AminoMsg } from "@cosmjs/amino"; -import { MsgCreateVestingAccount, MsgCreateVestingAccountSDKType, MsgCreatePermanentLockedAccount, MsgCreatePermanentLockedAccountSDKType, MsgCreatePeriodicVestingAccount, MsgCreatePeriodicVestingAccountSDKType } from "./tx"; +import { MsgCreateVestingAccount, MsgCreateVestingAccountSDKType, MsgCreatePermanentLockedAccount, MsgCreatePermanentLockedAccountSDKType, MsgCreatePeriodicVestingAccount, MsgCreatePeriodicVestingAccountSDKType } from "./tx.js"; export interface MsgCreateVestingAccountAminoType extends AminoMsg { type: "cosmos-sdk/MsgCreateVestingAccount"; value: { diff --git a/__fixtures__/v-next/outputv4/cosmos/vesting/v1beta1/tx.registry.ts b/__fixtures__/v-next/outputv4/cosmos/vesting/v1beta1/tx.registry.ts index 2add4a8dc6..6351c655d7 100644 --- a/__fixtures__/v-next/outputv4/cosmos/vesting/v1beta1/tx.registry.ts +++ b/__fixtures__/v-next/outputv4/cosmos/vesting/v1beta1/tx.registry.ts @@ -1,7 +1,7 @@ -import { Coin, CoinSDKType } from "../../base/v1beta1/coin"; -import { Period, PeriodSDKType } from "./vesting"; +import { Coin, CoinSDKType } from "../../base/v1beta1/coin.js"; +import { Period, PeriodSDKType } from "./vesting.js"; import { GeneratedType, Registry } from "@cosmjs/proto-signing"; -import { MsgCreateVestingAccount, MsgCreateVestingAccountSDKType, MsgCreatePermanentLockedAccount, MsgCreatePermanentLockedAccountSDKType, MsgCreatePeriodicVestingAccount, MsgCreatePeriodicVestingAccountSDKType } from "./tx"; +import { MsgCreateVestingAccount, MsgCreateVestingAccountSDKType, MsgCreatePermanentLockedAccount, MsgCreatePermanentLockedAccountSDKType, MsgCreatePeriodicVestingAccount, MsgCreatePeriodicVestingAccountSDKType } from "./tx.js"; export const registry: ReadonlyArray<[string, GeneratedType]> = [["/cosmos.vesting.v1beta1.MsgCreateVestingAccount", MsgCreateVestingAccount], ["/cosmos.vesting.v1beta1.MsgCreatePermanentLockedAccount", MsgCreatePermanentLockedAccount], ["/cosmos.vesting.v1beta1.MsgCreatePeriodicVestingAccount", MsgCreatePeriodicVestingAccount]]; export const load = (protoRegistry: Registry) => { registry.forEach(([typeUrl, mod]) => { diff --git a/__fixtures__/v-next/outputv4/cosmos/vesting/v1beta1/tx.rpc.msg.ts b/__fixtures__/v-next/outputv4/cosmos/vesting/v1beta1/tx.rpc.msg.ts index dc8d141651..50da665cce 100644 --- a/__fixtures__/v-next/outputv4/cosmos/vesting/v1beta1/tx.rpc.msg.ts +++ b/__fixtures__/v-next/outputv4/cosmos/vesting/v1beta1/tx.rpc.msg.ts @@ -1,8 +1,8 @@ -import { Coin, CoinSDKType } from "../../base/v1beta1/coin"; -import { Period, PeriodSDKType } from "./vesting"; -import { Rpc } from "../../../helpers"; -import { BinaryReader } from "../../../binary"; -import { MsgCreateVestingAccount, MsgCreateVestingAccountSDKType, MsgCreateVestingAccountResponse, MsgCreateVestingAccountResponseSDKType, MsgCreatePermanentLockedAccount, MsgCreatePermanentLockedAccountSDKType, MsgCreatePermanentLockedAccountResponse, MsgCreatePermanentLockedAccountResponseSDKType, MsgCreatePeriodicVestingAccount, MsgCreatePeriodicVestingAccountSDKType, MsgCreatePeriodicVestingAccountResponse, MsgCreatePeriodicVestingAccountResponseSDKType } from "./tx"; +import { Coin, CoinSDKType } from "../../base/v1beta1/coin.js"; +import { Period, PeriodSDKType } from "./vesting.js"; +import { Rpc } from "../../../helpers.js"; +import { BinaryReader } from "../../../binary.js"; +import { MsgCreateVestingAccount, MsgCreateVestingAccountSDKType, MsgCreateVestingAccountResponse, MsgCreateVestingAccountResponseSDKType, MsgCreatePermanentLockedAccount, MsgCreatePermanentLockedAccountSDKType, MsgCreatePermanentLockedAccountResponse, MsgCreatePermanentLockedAccountResponseSDKType, MsgCreatePeriodicVestingAccount, MsgCreatePeriodicVestingAccountSDKType, MsgCreatePeriodicVestingAccountResponse, MsgCreatePeriodicVestingAccountResponseSDKType } from "./tx.js"; /** Msg defines the bank Msg service. */ export interface Msg { /** diff --git a/__fixtures__/v-next/outputv4/cosmos/vesting/v1beta1/tx.ts b/__fixtures__/v-next/outputv4/cosmos/vesting/v1beta1/tx.ts index 45aeac1ca2..89f9703250 100644 --- a/__fixtures__/v-next/outputv4/cosmos/vesting/v1beta1/tx.ts +++ b/__fixtures__/v-next/outputv4/cosmos/vesting/v1beta1/tx.ts @@ -1,9 +1,8 @@ -import { Coin, CoinSDKType } from "../../base/v1beta1/coin"; -import { Period, PeriodSDKType } from "./vesting"; -import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; -import { JsonSafe } from "../../../json-safe"; -import { ComputedRef } from "vue"; +import { Coin, CoinSDKType } from "../../base/v1beta1/coin.js"; +import { Period, PeriodSDKType } from "./vesting.js"; +import { BinaryReader, BinaryWriter } from "../../../binary.js"; +import { isSet, DeepPartial } from "../../../helpers.js"; +import { JsonSafe } from "../../../json-safe.js"; export const protobufPackage = "cosmos.vesting.v1beta1"; /** * MsgCreateVestingAccount defines a message that enables creating a vesting @@ -16,13 +15,6 @@ export interface MsgCreateVestingAccount { endTime: bigint; delayed: boolean; } -export interface ReactiveMsgCreateVestingAccount { - fromAddress: ComputedRef; - toAddress: ComputedRef; - amount: ComputedRef; - endTime: ComputedRef; - delayed: ComputedRef; -} export interface MsgCreateVestingAccountProtoMsg { typeUrl: "/cosmos.vesting.v1beta1.MsgCreateVestingAccount"; value: Uint8Array; @@ -40,7 +32,6 @@ export interface MsgCreateVestingAccountSDKType { } /** MsgCreateVestingAccountResponse defines the Msg/CreateVestingAccount response type. */ export interface MsgCreateVestingAccountResponse {} -export interface ReactiveMsgCreateVestingAccountResponse {} export interface MsgCreateVestingAccountResponseProtoMsg { typeUrl: "/cosmos.vesting.v1beta1.MsgCreateVestingAccountResponse"; value: Uint8Array; @@ -56,11 +47,6 @@ export interface MsgCreatePermanentLockedAccount { toAddress: string; amount: Coin[]; } -export interface ReactiveMsgCreatePermanentLockedAccount { - fromAddress: ComputedRef; - toAddress: ComputedRef; - amount: ComputedRef; -} export interface MsgCreatePermanentLockedAccountProtoMsg { typeUrl: "/cosmos.vesting.v1beta1.MsgCreatePermanentLockedAccount"; value: Uint8Array; @@ -76,7 +62,6 @@ export interface MsgCreatePermanentLockedAccountSDKType { } /** MsgCreatePermanentLockedAccountResponse defines the Msg/CreatePermanentLockedAccount response type. */ export interface MsgCreatePermanentLockedAccountResponse {} -export interface ReactiveMsgCreatePermanentLockedAccountResponse {} export interface MsgCreatePermanentLockedAccountResponseProtoMsg { typeUrl: "/cosmos.vesting.v1beta1.MsgCreatePermanentLockedAccountResponse"; value: Uint8Array; @@ -93,12 +78,6 @@ export interface MsgCreatePeriodicVestingAccount { startTime: bigint; vestingPeriods: Period[]; } -export interface ReactiveMsgCreatePeriodicVestingAccount { - fromAddress: ComputedRef; - toAddress: ComputedRef; - startTime: ComputedRef; - vestingPeriods: ComputedRef; -} export interface MsgCreatePeriodicVestingAccountProtoMsg { typeUrl: "/cosmos.vesting.v1beta1.MsgCreatePeriodicVestingAccount"; value: Uint8Array; @@ -118,7 +97,6 @@ export interface MsgCreatePeriodicVestingAccountSDKType { * response type. */ export interface MsgCreatePeriodicVestingAccountResponse {} -export interface ReactiveMsgCreatePeriodicVestingAccountResponse {} export interface MsgCreatePeriodicVestingAccountResponseProtoMsg { typeUrl: "/cosmos.vesting.v1beta1.MsgCreatePeriodicVestingAccountResponse"; value: Uint8Array; @@ -140,19 +118,19 @@ function createBaseMsgCreateVestingAccount(): MsgCreateVestingAccount { export const MsgCreateVestingAccount = { typeUrl: "/cosmos.vesting.v1beta1.MsgCreateVestingAccount", encode(message: MsgCreateVestingAccount, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.fromAddress !== "") { + if (message.fromAddress !== undefined) { writer.uint32(10).string(message.fromAddress); } - if (message.toAddress !== "") { + if (message.toAddress !== undefined) { writer.uint32(18).string(message.toAddress); } for (const v of message.amount) { Coin.encode(v!, writer.uint32(26).fork()).ldelim(); } - if (message.endTime !== BigInt(0)) { + if (message.endTime !== undefined) { writer.uint32(32).int64(message.endTime); } - if (message.delayed === true) { + if (message.delayed !== undefined) { writer.uint32(40).bool(message.delayed); } return writer; @@ -187,13 +165,13 @@ export const MsgCreateVestingAccount = { return message; }, fromJSON(object: any): MsgCreateVestingAccount { - return { - fromAddress: isSet(object.fromAddress) ? String(object.fromAddress) : "", - toAddress: isSet(object.toAddress) ? String(object.toAddress) : "", - amount: Array.isArray(object?.amount) ? object.amount.map((e: any) => Coin.fromJSON(e)) : [], - endTime: isSet(object.endTime) ? BigInt(object.endTime.toString()) : BigInt(0), - delayed: isSet(object.delayed) ? Boolean(object.delayed) : false - }; + const obj = createBaseMsgCreateVestingAccount(); + if (isSet(object.fromAddress)) obj.fromAddress = String(object.fromAddress); + if (isSet(object.toAddress)) obj.toAddress = String(object.toAddress); + if (Array.isArray(object?.amount)) obj.amount = object.amount.map((e: any) => Coin.fromJSON(e)); + if (isSet(object.endTime)) obj.endTime = BigInt(object.endTime.toString()); + if (isSet(object.delayed)) obj.delayed = Boolean(object.delayed); + return obj; }, toJSON(message: MsgCreateVestingAccount): JsonSafe { const obj: any = {}; @@ -213,7 +191,9 @@ export const MsgCreateVestingAccount = { message.fromAddress = object.fromAddress ?? ""; message.toAddress = object.toAddress ?? ""; message.amount = object.amount?.map(e => Coin.fromPartial(e)) || []; - message.endTime = object.endTime !== undefined && object.endTime !== null ? BigInt(object.endTime.toString()) : BigInt(0); + if (object.endTime !== undefined && object.endTime !== null) { + message.endTime = BigInt(object.endTime.toString()); + } message.delayed = object.delayed ?? false; return message; }, @@ -323,7 +303,8 @@ export const MsgCreateVestingAccountResponse = { return message; }, fromJSON(_: any): MsgCreateVestingAccountResponse { - return {}; + const obj = createBaseMsgCreateVestingAccountResponse(); + return obj; }, toJSON(_: MsgCreateVestingAccountResponse): JsonSafe { const obj: any = {}; @@ -383,10 +364,10 @@ function createBaseMsgCreatePermanentLockedAccount(): MsgCreatePermanentLockedAc export const MsgCreatePermanentLockedAccount = { typeUrl: "/cosmos.vesting.v1beta1.MsgCreatePermanentLockedAccount", encode(message: MsgCreatePermanentLockedAccount, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.fromAddress !== "") { + if (message.fromAddress !== undefined) { writer.uint32(10).string(message.fromAddress); } - if (message.toAddress !== "") { + if (message.toAddress !== undefined) { writer.uint32(18).string(message.toAddress); } for (const v of message.amount) { @@ -418,11 +399,11 @@ export const MsgCreatePermanentLockedAccount = { return message; }, fromJSON(object: any): MsgCreatePermanentLockedAccount { - return { - fromAddress: isSet(object.fromAddress) ? String(object.fromAddress) : "", - toAddress: isSet(object.toAddress) ? String(object.toAddress) : "", - amount: Array.isArray(object?.amount) ? object.amount.map((e: any) => Coin.fromJSON(e)) : [] - }; + const obj = createBaseMsgCreatePermanentLockedAccount(); + if (isSet(object.fromAddress)) obj.fromAddress = String(object.fromAddress); + if (isSet(object.toAddress)) obj.toAddress = String(object.toAddress); + if (Array.isArray(object?.amount)) obj.amount = object.amount.map((e: any) => Coin.fromJSON(e)); + return obj; }, toJSON(message: MsgCreatePermanentLockedAccount): JsonSafe { const obj: any = {}; @@ -534,7 +515,8 @@ export const MsgCreatePermanentLockedAccountResponse = { return message; }, fromJSON(_: any): MsgCreatePermanentLockedAccountResponse { - return {}; + const obj = createBaseMsgCreatePermanentLockedAccountResponse(); + return obj; }, toJSON(_: MsgCreatePermanentLockedAccountResponse): JsonSafe { const obj: any = {}; @@ -595,13 +577,13 @@ function createBaseMsgCreatePeriodicVestingAccount(): MsgCreatePeriodicVestingAc export const MsgCreatePeriodicVestingAccount = { typeUrl: "/cosmos.vesting.v1beta1.MsgCreatePeriodicVestingAccount", encode(message: MsgCreatePeriodicVestingAccount, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.fromAddress !== "") { + if (message.fromAddress !== undefined) { writer.uint32(10).string(message.fromAddress); } - if (message.toAddress !== "") { + if (message.toAddress !== undefined) { writer.uint32(18).string(message.toAddress); } - if (message.startTime !== BigInt(0)) { + if (message.startTime !== undefined) { writer.uint32(24).int64(message.startTime); } for (const v of message.vestingPeriods) { @@ -636,12 +618,12 @@ export const MsgCreatePeriodicVestingAccount = { return message; }, fromJSON(object: any): MsgCreatePeriodicVestingAccount { - return { - fromAddress: isSet(object.fromAddress) ? String(object.fromAddress) : "", - toAddress: isSet(object.toAddress) ? String(object.toAddress) : "", - startTime: isSet(object.startTime) ? BigInt(object.startTime.toString()) : BigInt(0), - vestingPeriods: Array.isArray(object?.vestingPeriods) ? object.vestingPeriods.map((e: any) => Period.fromJSON(e)) : [] - }; + const obj = createBaseMsgCreatePeriodicVestingAccount(); + if (isSet(object.fromAddress)) obj.fromAddress = String(object.fromAddress); + if (isSet(object.toAddress)) obj.toAddress = String(object.toAddress); + if (isSet(object.startTime)) obj.startTime = BigInt(object.startTime.toString()); + if (Array.isArray(object?.vestingPeriods)) obj.vestingPeriods = object.vestingPeriods.map((e: any) => Period.fromJSON(e)); + return obj; }, toJSON(message: MsgCreatePeriodicVestingAccount): JsonSafe { const obj: any = {}; @@ -659,7 +641,9 @@ export const MsgCreatePeriodicVestingAccount = { const message = createBaseMsgCreatePeriodicVestingAccount(); message.fromAddress = object.fromAddress ?? ""; message.toAddress = object.toAddress ?? ""; - message.startTime = object.startTime !== undefined && object.startTime !== null ? BigInt(object.startTime.toString()) : BigInt(0); + if (object.startTime !== undefined && object.startTime !== null) { + message.startTime = BigInt(object.startTime.toString()); + } message.vestingPeriods = object.vestingPeriods?.map(e => Period.fromPartial(e)) || []; return message; }, @@ -762,7 +746,8 @@ export const MsgCreatePeriodicVestingAccountResponse = { return message; }, fromJSON(_: any): MsgCreatePeriodicVestingAccountResponse { - return {}; + const obj = createBaseMsgCreatePeriodicVestingAccountResponse(); + return obj; }, toJSON(_: MsgCreatePeriodicVestingAccountResponse): JsonSafe { const obj: any = {}; diff --git a/__fixtures__/v-next/outputv4/cosmos/vesting/v1beta1/vesting.ts b/__fixtures__/v-next/outputv4/cosmos/vesting/v1beta1/vesting.ts index 73f8e7149f..cc55ab14df 100644 --- a/__fixtures__/v-next/outputv4/cosmos/vesting/v1beta1/vesting.ts +++ b/__fixtures__/v-next/outputv4/cosmos/vesting/v1beta1/vesting.ts @@ -1,9 +1,8 @@ -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 { JsonSafe } from "../../../json-safe"; -import { ComputedRef } from "vue"; +import { BaseAccount, BaseAccountSDKType } from "../../auth/v1beta1/auth.js"; +import { Coin, CoinSDKType } from "../../base/v1beta1/coin.js"; +import { BinaryReader, BinaryWriter } from "../../../binary.js"; +import { isSet, DeepPartial } from "../../../helpers.js"; +import { JsonSafe } from "../../../json-safe.js"; export const protobufPackage = "cosmos.vesting.v1beta1"; /** * BaseVestingAccount implements the VestingAccount interface. It contains all @@ -16,13 +15,6 @@ export interface BaseVestingAccount { delegatedVesting: Coin[]; endTime: bigint; } -export interface ReactiveBaseVestingAccount { - baseAccount?: ComputedRef; - originalVesting: ComputedRef; - delegatedFree: ComputedRef; - delegatedVesting: ComputedRef; - endTime: ComputedRef; -} export interface BaseVestingAccountProtoMsg { typeUrl: "/cosmos.vesting.v1beta1.BaseVestingAccount"; value: Uint8Array; @@ -46,10 +38,6 @@ export interface ContinuousVestingAccount { baseVestingAccount?: BaseVestingAccount; startTime: bigint; } -export interface ReactiveContinuousVestingAccount { - baseVestingAccount?: ComputedRef; - startTime: ComputedRef; -} export interface ContinuousVestingAccountProtoMsg { typeUrl: "/cosmos.vesting.v1beta1.ContinuousVestingAccount"; value: Uint8Array; @@ -70,9 +58,6 @@ export interface ContinuousVestingAccountSDKType { export interface DelayedVestingAccount { baseVestingAccount?: BaseVestingAccount; } -export interface ReactiveDelayedVestingAccount { - baseVestingAccount?: ComputedRef; -} export interface DelayedVestingAccountProtoMsg { typeUrl: "/cosmos.vesting.v1beta1.DelayedVestingAccount"; value: Uint8Array; @@ -90,10 +75,6 @@ export interface Period { length: bigint; amount: Coin[]; } -export interface ReactivePeriod { - length: ComputedRef; - amount: ComputedRef; -} export interface PeriodProtoMsg { typeUrl: "/cosmos.vesting.v1beta1.Period"; value: Uint8Array; @@ -112,11 +93,6 @@ export interface PeriodicVestingAccount { startTime: bigint; vestingPeriods: Period[]; } -export interface ReactivePeriodicVestingAccount { - baseVestingAccount?: ComputedRef; - startTime: ComputedRef; - vestingPeriods: ComputedRef; -} export interface PeriodicVestingAccountProtoMsg { typeUrl: "/cosmos.vesting.v1beta1.PeriodicVestingAccount"; value: Uint8Array; @@ -140,9 +116,6 @@ export interface PeriodicVestingAccountSDKType { export interface PermanentLockedAccount { baseVestingAccount?: BaseVestingAccount; } -export interface ReactivePermanentLockedAccount { - baseVestingAccount?: ComputedRef; -} export interface PermanentLockedAccountProtoMsg { typeUrl: "/cosmos.vesting.v1beta1.PermanentLockedAccount"; value: Uint8Array; @@ -181,7 +154,7 @@ export const BaseVestingAccount = { for (const v of message.delegatedVesting) { Coin.encode(v!, writer.uint32(34).fork()).ldelim(); } - if (message.endTime !== BigInt(0)) { + if (message.endTime !== undefined) { writer.uint32(40).int64(message.endTime); } return writer; @@ -216,13 +189,13 @@ export const BaseVestingAccount = { return message; }, fromJSON(object: any): BaseVestingAccount { - return { - baseAccount: isSet(object.baseAccount) ? BaseAccount.fromJSON(object.baseAccount) : undefined, - originalVesting: Array.isArray(object?.originalVesting) ? object.originalVesting.map((e: any) => Coin.fromJSON(e)) : [], - delegatedFree: Array.isArray(object?.delegatedFree) ? object.delegatedFree.map((e: any) => Coin.fromJSON(e)) : [], - delegatedVesting: Array.isArray(object?.delegatedVesting) ? object.delegatedVesting.map((e: any) => Coin.fromJSON(e)) : [], - endTime: isSet(object.endTime) ? BigInt(object.endTime.toString()) : BigInt(0) - }; + const obj = createBaseBaseVestingAccount(); + if (isSet(object.baseAccount)) obj.baseAccount = BaseAccount.fromJSON(object.baseAccount); + if (Array.isArray(object?.originalVesting)) obj.originalVesting = object.originalVesting.map((e: any) => Coin.fromJSON(e)); + if (Array.isArray(object?.delegatedFree)) obj.delegatedFree = object.delegatedFree.map((e: any) => Coin.fromJSON(e)); + if (Array.isArray(object?.delegatedVesting)) obj.delegatedVesting = object.delegatedVesting.map((e: any) => Coin.fromJSON(e)); + if (isSet(object.endTime)) obj.endTime = BigInt(object.endTime.toString()); + return obj; }, toJSON(message: BaseVestingAccount): JsonSafe { const obj: any = {}; @@ -247,11 +220,15 @@ export const BaseVestingAccount = { }, fromPartial(object: DeepPartial): BaseVestingAccount { const message = createBaseBaseVestingAccount(); - message.baseAccount = object.baseAccount !== undefined && object.baseAccount !== null ? BaseAccount.fromPartial(object.baseAccount) : undefined; + if (object.baseAccount !== undefined && object.baseAccount !== null) { + message.baseAccount = BaseAccount.fromPartial(object.baseAccount); + } message.originalVesting = object.originalVesting?.map(e => Coin.fromPartial(e)) || []; message.delegatedFree = object.delegatedFree?.map(e => Coin.fromPartial(e)) || []; message.delegatedVesting = object.delegatedVesting?.map(e => Coin.fromPartial(e)) || []; - message.endTime = object.endTime !== undefined && object.endTime !== null ? BigInt(object.endTime.toString()) : BigInt(0); + if (object.endTime !== undefined && object.endTime !== null) { + message.endTime = BigInt(object.endTime.toString()); + } return message; }, fromSDK(object: BaseVestingAccountSDKType): BaseVestingAccount { @@ -361,7 +338,7 @@ export const ContinuousVestingAccount = { if (message.baseVestingAccount !== undefined) { BaseVestingAccount.encode(message.baseVestingAccount, writer.uint32(10).fork()).ldelim(); } - if (message.startTime !== BigInt(0)) { + if (message.startTime !== undefined) { writer.uint32(16).int64(message.startTime); } return writer; @@ -387,10 +364,10 @@ export const ContinuousVestingAccount = { return message; }, fromJSON(object: any): ContinuousVestingAccount { - return { - baseVestingAccount: isSet(object.baseVestingAccount) ? BaseVestingAccount.fromJSON(object.baseVestingAccount) : undefined, - startTime: isSet(object.startTime) ? BigInt(object.startTime.toString()) : BigInt(0) - }; + const obj = createBaseContinuousVestingAccount(); + if (isSet(object.baseVestingAccount)) obj.baseVestingAccount = BaseVestingAccount.fromJSON(object.baseVestingAccount); + if (isSet(object.startTime)) obj.startTime = BigInt(object.startTime.toString()); + return obj; }, toJSON(message: ContinuousVestingAccount): JsonSafe { const obj: any = {}; @@ -400,8 +377,12 @@ export const ContinuousVestingAccount = { }, fromPartial(object: DeepPartial): ContinuousVestingAccount { const message = createBaseContinuousVestingAccount(); - message.baseVestingAccount = object.baseVestingAccount !== undefined && object.baseVestingAccount !== null ? BaseVestingAccount.fromPartial(object.baseVestingAccount) : undefined; - message.startTime = object.startTime !== undefined && object.startTime !== null ? BigInt(object.startTime.toString()) : BigInt(0); + if (object.baseVestingAccount !== undefined && object.baseVestingAccount !== null) { + message.baseVestingAccount = BaseVestingAccount.fromPartial(object.baseVestingAccount); + } + if (object.startTime !== undefined && object.startTime !== null) { + message.startTime = BigInt(object.startTime.toString()); + } return message; }, fromSDK(object: ContinuousVestingAccountSDKType): ContinuousVestingAccount { @@ -491,9 +472,9 @@ export const DelayedVestingAccount = { return message; }, fromJSON(object: any): DelayedVestingAccount { - return { - baseVestingAccount: isSet(object.baseVestingAccount) ? BaseVestingAccount.fromJSON(object.baseVestingAccount) : undefined - }; + const obj = createBaseDelayedVestingAccount(); + if (isSet(object.baseVestingAccount)) obj.baseVestingAccount = BaseVestingAccount.fromJSON(object.baseVestingAccount); + return obj; }, toJSON(message: DelayedVestingAccount): JsonSafe { const obj: any = {}; @@ -502,7 +483,9 @@ export const DelayedVestingAccount = { }, fromPartial(object: DeepPartial): DelayedVestingAccount { const message = createBaseDelayedVestingAccount(); - message.baseVestingAccount = object.baseVestingAccount !== undefined && object.baseVestingAccount !== null ? BaseVestingAccount.fromPartial(object.baseVestingAccount) : undefined; + if (object.baseVestingAccount !== undefined && object.baseVestingAccount !== null) { + message.baseVestingAccount = BaseVestingAccount.fromPartial(object.baseVestingAccount); + } return message; }, fromSDK(object: DelayedVestingAccountSDKType): DelayedVestingAccount { @@ -563,7 +546,7 @@ function createBasePeriod(): Period { export const Period = { typeUrl: "/cosmos.vesting.v1beta1.Period", encode(message: Period, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.length !== BigInt(0)) { + if (message.length !== undefined) { writer.uint32(8).int64(message.length); } for (const v of message.amount) { @@ -592,10 +575,10 @@ export const Period = { return message; }, fromJSON(object: any): Period { - return { - length: isSet(object.length) ? BigInt(object.length.toString()) : BigInt(0), - amount: Array.isArray(object?.amount) ? object.amount.map((e: any) => Coin.fromJSON(e)) : [] - }; + const obj = createBasePeriod(); + if (isSet(object.length)) obj.length = BigInt(object.length.toString()); + if (Array.isArray(object?.amount)) obj.amount = object.amount.map((e: any) => Coin.fromJSON(e)); + return obj; }, toJSON(message: Period): JsonSafe { const obj: any = {}; @@ -609,7 +592,9 @@ export const Period = { }, fromPartial(object: DeepPartial): Period { const message = createBasePeriod(); - message.length = object.length !== undefined && object.length !== null ? BigInt(object.length.toString()) : BigInt(0); + if (object.length !== undefined && object.length !== null) { + message.length = BigInt(object.length.toString()); + } message.amount = object.amount?.map(e => Coin.fromPartial(e)) || []; return message; }, @@ -688,7 +673,7 @@ export const PeriodicVestingAccount = { if (message.baseVestingAccount !== undefined) { BaseVestingAccount.encode(message.baseVestingAccount, writer.uint32(10).fork()).ldelim(); } - if (message.startTime !== BigInt(0)) { + if (message.startTime !== undefined) { writer.uint32(16).int64(message.startTime); } for (const v of message.vestingPeriods) { @@ -720,11 +705,11 @@ export const PeriodicVestingAccount = { return message; }, fromJSON(object: any): PeriodicVestingAccount { - return { - baseVestingAccount: isSet(object.baseVestingAccount) ? BaseVestingAccount.fromJSON(object.baseVestingAccount) : undefined, - startTime: isSet(object.startTime) ? BigInt(object.startTime.toString()) : BigInt(0), - vestingPeriods: Array.isArray(object?.vestingPeriods) ? object.vestingPeriods.map((e: any) => Period.fromJSON(e)) : [] - }; + const obj = createBasePeriodicVestingAccount(); + if (isSet(object.baseVestingAccount)) obj.baseVestingAccount = BaseVestingAccount.fromJSON(object.baseVestingAccount); + if (isSet(object.startTime)) obj.startTime = BigInt(object.startTime.toString()); + if (Array.isArray(object?.vestingPeriods)) obj.vestingPeriods = object.vestingPeriods.map((e: any) => Period.fromJSON(e)); + return obj; }, toJSON(message: PeriodicVestingAccount): JsonSafe { const obj: any = {}; @@ -739,8 +724,12 @@ export const PeriodicVestingAccount = { }, fromPartial(object: DeepPartial): PeriodicVestingAccount { const message = createBasePeriodicVestingAccount(); - message.baseVestingAccount = object.baseVestingAccount !== undefined && object.baseVestingAccount !== null ? BaseVestingAccount.fromPartial(object.baseVestingAccount) : undefined; - message.startTime = object.startTime !== undefined && object.startTime !== null ? BigInt(object.startTime.toString()) : BigInt(0); + if (object.baseVestingAccount !== undefined && object.baseVestingAccount !== null) { + message.baseVestingAccount = BaseVestingAccount.fromPartial(object.baseVestingAccount); + } + if (object.startTime !== undefined && object.startTime !== null) { + message.startTime = BigInt(object.startTime.toString()); + } message.vestingPeriods = object.vestingPeriods?.map(e => Period.fromPartial(e)) || []; return message; }, @@ -844,9 +833,9 @@ export const PermanentLockedAccount = { return message; }, fromJSON(object: any): PermanentLockedAccount { - return { - baseVestingAccount: isSet(object.baseVestingAccount) ? BaseVestingAccount.fromJSON(object.baseVestingAccount) : undefined - }; + const obj = createBasePermanentLockedAccount(); + if (isSet(object.baseVestingAccount)) obj.baseVestingAccount = BaseVestingAccount.fromJSON(object.baseVestingAccount); + return obj; }, toJSON(message: PermanentLockedAccount): JsonSafe { const obj: any = {}; @@ -855,7 +844,9 @@ export const PermanentLockedAccount = { }, fromPartial(object: DeepPartial): PermanentLockedAccount { const message = createBasePermanentLockedAccount(); - message.baseVestingAccount = object.baseVestingAccount !== undefined && object.baseVestingAccount !== null ? BaseVestingAccount.fromPartial(object.baseVestingAccount) : undefined; + if (object.baseVestingAccount !== undefined && object.baseVestingAccount !== null) { + message.baseVestingAccount = BaseVestingAccount.fromPartial(object.baseVestingAccount); + } return message; }, fromSDK(object: PermanentLockedAccountSDKType): PermanentLockedAccount { diff --git a/__fixtures__/v-next/outputv4/cosmos_proto/bundle.ts b/__fixtures__/v-next/outputv4/cosmos_proto/bundle.ts index 59f98efc24..6b937aef3a 100644 --- a/__fixtures__/v-next/outputv4/cosmos_proto/bundle.ts +++ b/__fixtures__/v-next/outputv4/cosmos_proto/bundle.ts @@ -1,4 +1,4 @@ -import * as _54 from "./cosmos"; +import * as _54 from "./cosmos.js"; export const cosmos_proto = { ..._54 }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv4/cosmwasm/bundle.ts b/__fixtures__/v-next/outputv4/cosmwasm/bundle.ts index bd5613ccd2..7509d6daa8 100644 --- a/__fixtures__/v-next/outputv4/cosmwasm/bundle.ts +++ b/__fixtures__/v-next/outputv4/cosmwasm/bundle.ts @@ -1,38 +1,36 @@ -import * as _149 from "./wasm/v1/genesis"; -import * as _150 from "./wasm/v1/ibc"; -import * as _151 from "./wasm/v1/proposal"; -import * as _152 from "./wasm/v1/query"; -import * as _153 from "./wasm/v1/tx"; -import * as _154 from "./wasm/v1/types"; -import * as _155 from "./wasm/v1/authz"; -import * as _485 from "./wasm/v1/tx.amino"; -import * as _486 from "./wasm/v1/tx.registry"; -import * as _487 from "./wasm/v1/query.lcd"; -import * as _488 from "./wasm/v1/query.rpc.Query"; -import * as _489 from "./wasm/v1/tx.rpc.msg"; -import * as _628 from "./lcd"; -import * as _629 from "./rpc.query"; -import * as _630 from "./rpc.tx"; +import * as _147 from "./wasm/v1/genesis.js"; +import * as _148 from "./wasm/v1/ibc.js"; +import * as _149 from "./wasm/v1/proposal.js"; +import * as _150 from "./wasm/v1/query.js"; +import * as _151 from "./wasm/v1/tx.js"; +import * as _152 from "./wasm/v1/types.js"; +import * as _434 from "./wasm/v1/tx.amino.js"; +import * as _435 from "./wasm/v1/tx.registry.js"; +import * as _436 from "./wasm/v1/query.lcd.js"; +import * as _437 from "./wasm/v1/query.rpc.Query.js"; +import * as _438 from "./wasm/v1/tx.rpc.msg.js"; +import * as _544 from "./lcd.js"; +import * as _545 from "./rpc.query.js"; +import * as _546 from "./rpc.tx.js"; export namespace cosmwasm { export namespace wasm { export const v1 = { + ..._147, + ..._148, ..._149, ..._150, ..._151, ..._152, - ..._153, - ..._154, - ..._155, - ..._485, - ..._486, - ..._487, - ..._488, - ..._489 + ..._434, + ..._435, + ..._436, + ..._437, + ..._438 }; } export const ClientFactory = { - ..._628, - ..._629, - ..._630 + ..._544, + ..._545, + ..._546 }; } \ No newline at end of file diff --git a/__fixtures__/v-next/outputv4/cosmwasm/client.ts b/__fixtures__/v-next/outputv4/cosmwasm/client.ts index 1b6196fc7f..c9f2fa6696 100644 --- a/__fixtures__/v-next/outputv4/cosmwasm/client.ts +++ b/__fixtures__/v-next/outputv4/cosmwasm/client.ts @@ -1,8 +1,8 @@ import { GeneratedType, Registry, OfflineSigner } from "@cosmjs/proto-signing"; import { defaultRegistryTypes, AminoTypes, SigningStargateClient } from "@cosmjs/stargate"; import { HttpEndpoint } from "@cosmjs/tendermint-rpc"; -import * as cosmwasmWasmV1TxRegistry from "./wasm/v1/tx.registry"; -import * as cosmwasmWasmV1TxAmino from "./wasm/v1/tx.amino"; +import * as cosmwasmWasmV1TxRegistry from "./wasm/v1/tx.registry.js"; +import * as cosmwasmWasmV1TxAmino from "./wasm/v1/tx.amino.js"; export const cosmwasmAminoConverters = { ...cosmwasmWasmV1TxAmino.AminoConverter }; diff --git a/__fixtures__/v-next/outputv4/cosmwasm/lcd.ts b/__fixtures__/v-next/outputv4/cosmwasm/lcd.ts index 94a334412c..311dbf0829 100644 --- a/__fixtures__/v-next/outputv4/cosmwasm/lcd.ts +++ b/__fixtures__/v-next/outputv4/cosmwasm/lcd.ts @@ -37,11 +37,6 @@ export const createLCDClient = async ({ v1beta1: new (await import("../cosmos/base/tendermint/v1beta1/query.lcd")).LCDQueryClient({ requestClient }) - }, - node: { - v1beta1: new (await import("../cosmos/base/node/v1beta1/query.lcd")).LCDQueryClient({ - requestClient - }) } }, distribution: { diff --git a/__fixtures__/v-next/outputv4/cosmwasm/rpc.query.ts b/__fixtures__/v-next/outputv4/cosmwasm/rpc.query.ts index 616b2d1cfd..f1213e3fa7 100644 --- a/__fixtures__/v-next/outputv4/cosmwasm/rpc.query.ts +++ b/__fixtures__/v-next/outputv4/cosmwasm/rpc.query.ts @@ -1,80 +1,77 @@ -import { Rpc } from "../helpers"; -import { Tendermint34Client, HttpEndpoint } from "@cosmjs/tendermint-rpc"; +import { Rpc } from "../helpers.js"; +import { connectComet, HttpEndpoint } from "@cosmjs/tendermint-rpc"; import { QueryClient } from "@cosmjs/stargate"; export const createRPCQueryClient = async ({ rpcEndpoint }: { rpcEndpoint: string | HttpEndpoint; }) => { - const tmClient = await Tendermint34Client.connect(rpcEndpoint); + const tmClient = await connectComet(rpcEndpoint); const client = new QueryClient(tmClient); return { cosmos: { app: { - v1alpha1: (await import("../cosmos/app/v1alpha1/query.rpc.Query")).createRpcQueryExtension(client) + v1alpha1: (await import("../cosmos/app/v1alpha1/query.rpc.Query.js")).createRpcQueryExtension(client) }, auth: { - v1beta1: (await import("../cosmos/auth/v1beta1/query.rpc.Query")).createRpcQueryExtension(client) + v1beta1: (await import("../cosmos/auth/v1beta1/query.rpc.Query.js")).createRpcQueryExtension(client) }, authz: { - v1beta1: (await import("../cosmos/authz/v1beta1/query.rpc.Query")).createRpcQueryExtension(client) + v1beta1: (await import("../cosmos/authz/v1beta1/query.rpc.Query.js")).createRpcQueryExtension(client) }, bank: { - v1beta1: (await import("../cosmos/bank/v1beta1/query.rpc.Query")).createRpcQueryExtension(client) + v1beta1: (await import("../cosmos/bank/v1beta1/query.rpc.Query.js")).createRpcQueryExtension(client) }, base: { reflection: { - v1beta1: (await import("../cosmos/base/reflection/v1beta1/reflection.rpc.ReflectionService")).createRpcQueryExtension(client), - v2alpha1: (await import("../cosmos/base/reflection/v2alpha1/reflection.rpc.ReflectionService")).createRpcQueryExtension(client) + v1beta1: (await import("../cosmos/base/reflection/v1beta1/reflection.rpc.ReflectionService.js")).createRpcQueryExtension(client), + v2alpha1: (await import("../cosmos/base/reflection/v2alpha1/reflection.rpc.ReflectionService.js")).createRpcQueryExtension(client) }, tendermint: { - v1beta1: (await import("../cosmos/base/tendermint/v1beta1/query.rpc.Service")).createRpcQueryExtension(client) - }, - node: { - v1beta1: (await import("../cosmos/base/node/v1beta1/query.rpc.Service")).createRpcQueryExtension(client) + v1beta1: (await import("../cosmos/base/tendermint/v1beta1/query.rpc.Service.js")).createRpcQueryExtension(client) } }, distribution: { - v1beta1: (await import("../cosmos/distribution/v1beta1/query.rpc.Query")).createRpcQueryExtension(client) + v1beta1: (await import("../cosmos/distribution/v1beta1/query.rpc.Query.js")).createRpcQueryExtension(client) }, evidence: { - v1beta1: (await import("../cosmos/evidence/v1beta1/query.rpc.Query")).createRpcQueryExtension(client) + v1beta1: (await import("../cosmos/evidence/v1beta1/query.rpc.Query.js")).createRpcQueryExtension(client) }, feegrant: { - v1beta1: (await import("../cosmos/feegrant/v1beta1/query.rpc.Query")).createRpcQueryExtension(client) + v1beta1: (await import("../cosmos/feegrant/v1beta1/query.rpc.Query.js")).createRpcQueryExtension(client) }, gov: { - v1: (await import("../cosmos/gov/v1/query.rpc.Query")).createRpcQueryExtension(client), - v1beta1: (await import("../cosmos/gov/v1beta1/query.rpc.Query")).createRpcQueryExtension(client) + v1: (await import("../cosmos/gov/v1/query.rpc.Query.js")).createRpcQueryExtension(client), + v1beta1: (await import("../cosmos/gov/v1beta1/query.rpc.Query.js")).createRpcQueryExtension(client) }, group: { - v1: (await import("../cosmos/group/v1/query.rpc.Query")).createRpcQueryExtension(client) + v1: (await import("../cosmos/group/v1/query.rpc.Query.js")).createRpcQueryExtension(client) }, mint: { - v1beta1: (await import("../cosmos/mint/v1beta1/query.rpc.Query")).createRpcQueryExtension(client) + v1beta1: (await import("../cosmos/mint/v1beta1/query.rpc.Query.js")).createRpcQueryExtension(client) }, nft: { - v1beta1: (await import("../cosmos/nft/v1beta1/query.rpc.Query")).createRpcQueryExtension(client) + v1beta1: (await import("../cosmos/nft/v1beta1/query.rpc.Query.js")).createRpcQueryExtension(client) }, params: { - v1beta1: (await import("../cosmos/params/v1beta1/query.rpc.Query")).createRpcQueryExtension(client) + v1beta1: (await import("../cosmos/params/v1beta1/query.rpc.Query.js")).createRpcQueryExtension(client) }, slashing: { - v1beta1: (await import("../cosmos/slashing/v1beta1/query.rpc.Query")).createRpcQueryExtension(client) + v1beta1: (await import("../cosmos/slashing/v1beta1/query.rpc.Query.js")).createRpcQueryExtension(client) }, staking: { - v1beta1: (await import("../cosmos/staking/v1beta1/query.rpc.Query")).createRpcQueryExtension(client) + v1beta1: (await import("../cosmos/staking/v1beta1/query.rpc.Query.js")).createRpcQueryExtension(client) }, tx: { - v1beta1: (await import("../cosmos/tx/v1beta1/service.rpc.Service")).createRpcQueryExtension(client) + v1beta1: (await import("../cosmos/tx/v1beta1/service.rpc.Service.js")).createRpcQueryExtension(client) }, upgrade: { - v1beta1: (await import("../cosmos/upgrade/v1beta1/query.rpc.Query")).createRpcQueryExtension(client) + v1beta1: (await import("../cosmos/upgrade/v1beta1/query.rpc.Query.js")).createRpcQueryExtension(client) } }, cosmwasm: { wasm: { - v1: (await import("./wasm/v1/query.rpc.Query")).createRpcQueryExtension(client) + v1: (await import("./wasm/v1/query.rpc.Query.js")).createRpcQueryExtension(client) } } }; diff --git a/__fixtures__/v-next/outputv4/cosmwasm/rpc.tx.ts b/__fixtures__/v-next/outputv4/cosmwasm/rpc.tx.ts index e0ff07d48f..51d72af436 100644 --- a/__fixtures__/v-next/outputv4/cosmwasm/rpc.tx.ts +++ b/__fixtures__/v-next/outputv4/cosmwasm/rpc.tx.ts @@ -1,4 +1,4 @@ -import { Rpc } from "../helpers"; +import { Rpc } from "../helpers.js"; export const createRPCMsgClient = async ({ rpc }: { @@ -6,49 +6,49 @@ export const createRPCMsgClient = async ({ }) => ({ cosmos: { authz: { - v1beta1: new (await import("../cosmos/authz/v1beta1/tx.rpc.msg")).MsgClientImpl(rpc) + v1beta1: new (await import("../cosmos/authz/v1beta1/tx.rpc.msg.js")).MsgClientImpl(rpc) }, bank: { - v1beta1: new (await import("../cosmos/bank/v1beta1/tx.rpc.msg")).MsgClientImpl(rpc) + v1beta1: new (await import("../cosmos/bank/v1beta1/tx.rpc.msg.js")).MsgClientImpl(rpc) }, crisis: { - v1beta1: new (await import("../cosmos/crisis/v1beta1/tx.rpc.msg")).MsgClientImpl(rpc) + v1beta1: new (await import("../cosmos/crisis/v1beta1/tx.rpc.msg.js")).MsgClientImpl(rpc) }, distribution: { - v1beta1: new (await import("../cosmos/distribution/v1beta1/tx.rpc.msg")).MsgClientImpl(rpc) + v1beta1: new (await import("../cosmos/distribution/v1beta1/tx.rpc.msg.js")).MsgClientImpl(rpc) }, evidence: { - v1beta1: new (await import("../cosmos/evidence/v1beta1/tx.rpc.msg")).MsgClientImpl(rpc) + v1beta1: new (await import("../cosmos/evidence/v1beta1/tx.rpc.msg.js")).MsgClientImpl(rpc) }, feegrant: { - v1beta1: new (await import("../cosmos/feegrant/v1beta1/tx.rpc.msg")).MsgClientImpl(rpc) + v1beta1: new (await import("../cosmos/feegrant/v1beta1/tx.rpc.msg.js")).MsgClientImpl(rpc) }, gov: { - v1: new (await import("../cosmos/gov/v1/tx.rpc.msg")).MsgClientImpl(rpc), - v1beta1: new (await import("../cosmos/gov/v1beta1/tx.rpc.msg")).MsgClientImpl(rpc) + v1: new (await import("../cosmos/gov/v1/tx.rpc.msg.js")).MsgClientImpl(rpc), + v1beta1: new (await import("../cosmos/gov/v1beta1/tx.rpc.msg.js")).MsgClientImpl(rpc) }, group: { - v1: new (await import("../cosmos/group/v1/tx.rpc.msg")).MsgClientImpl(rpc) + v1: new (await import("../cosmos/group/v1/tx.rpc.msg.js")).MsgClientImpl(rpc) }, nft: { - v1beta1: new (await import("../cosmos/nft/v1beta1/tx.rpc.msg")).MsgClientImpl(rpc) + v1beta1: new (await import("../cosmos/nft/v1beta1/tx.rpc.msg.js")).MsgClientImpl(rpc) }, slashing: { - v1beta1: new (await import("../cosmos/slashing/v1beta1/tx.rpc.msg")).MsgClientImpl(rpc) + v1beta1: new (await import("../cosmos/slashing/v1beta1/tx.rpc.msg.js")).MsgClientImpl(rpc) }, staking: { - v1beta1: new (await import("../cosmos/staking/v1beta1/tx.rpc.msg")).MsgClientImpl(rpc) + v1beta1: new (await import("../cosmos/staking/v1beta1/tx.rpc.msg.js")).MsgClientImpl(rpc) }, upgrade: { - v1beta1: new (await import("../cosmos/upgrade/v1beta1/tx.rpc.msg")).MsgClientImpl(rpc) + v1beta1: new (await import("../cosmos/upgrade/v1beta1/tx.rpc.msg.js")).MsgClientImpl(rpc) }, vesting: { - v1beta1: new (await import("../cosmos/vesting/v1beta1/tx.rpc.msg")).MsgClientImpl(rpc) + v1beta1: new (await import("../cosmos/vesting/v1beta1/tx.rpc.msg.js")).MsgClientImpl(rpc) } }, cosmwasm: { wasm: { - v1: new (await import("./wasm/v1/tx.rpc.msg")).MsgClientImpl(rpc) + v1: new (await import("./wasm/v1/tx.rpc.msg.js")).MsgClientImpl(rpc) } } }); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv4/cosmwasm/wasm/v1/authz.ts b/__fixtures__/v-next/outputv4/cosmwasm/wasm/v1/authz.ts deleted file mode 100644 index e0c03e7643..0000000000 --- a/__fixtures__/v-next/outputv4/cosmwasm/wasm/v1/authz.ts +++ /dev/null @@ -1,1162 +0,0 @@ -import { Any, AnySDKType } from "../../../google/protobuf/any"; -import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; -import { BinaryReader, BinaryWriter } from "../../../binary"; -import { JsonSafe } from "../../../json-safe"; -import { DeepPartial, isSet, bytesFromBase64, base64FromBytes } from "../../../helpers"; -import { toUtf8, fromUtf8 } from "@cosmjs/encoding"; -import { ComputedRef } from "vue"; -export const protobufPackage = "cosmwasm.wasm.v1"; -/** - * ContractExecutionAuthorization defines authorization for wasm execute. - * Since: wasmd 0.30 - */ -export interface ContractExecutionAuthorization { - /** Grants for contract executions */ - grants: ContractGrant[]; -} -export interface ReactiveContractExecutionAuthorization { - grants: ComputedRef; -} -export interface ContractExecutionAuthorizationProtoMsg { - typeUrl: "/cosmwasm.wasm.v1.ContractExecutionAuthorization"; - value: Uint8Array; -} -/** - * ContractExecutionAuthorization defines authorization for wasm execute. - * Since: wasmd 0.30 - */ -export interface ContractExecutionAuthorizationSDKType { - grants: ContractGrantSDKType[]; -} -/** - * ContractMigrationAuthorization defines authorization for wasm contract - * migration. Since: wasmd 0.30 - */ -export interface ContractMigrationAuthorization { - /** Grants for contract migrations */ - grants: ContractGrant[]; -} -export interface ReactiveContractMigrationAuthorization { - grants: ComputedRef; -} -export interface ContractMigrationAuthorizationProtoMsg { - typeUrl: "/cosmwasm.wasm.v1.ContractMigrationAuthorization"; - value: Uint8Array; -} -/** - * ContractMigrationAuthorization defines authorization for wasm contract - * migration. Since: wasmd 0.30 - */ -export interface ContractMigrationAuthorizationSDKType { - grants: ContractGrantSDKType[]; -} -/** - * ContractGrant a granted permission for a single contract - * Since: wasmd 0.30 - */ -export interface ContractGrant { - /** Contract is the bech32 address of the smart contract */ - contract: string; - /** - * Limit defines execution limits that are enforced and updated when the grant - * is applied. When the limit lapsed the grant is removed. - */ - limit?: Any; - /** - * Filter define more fine-grained control on the message payload passed - * to the contract in the operation. When no filter applies on execution, the - * operation is prohibited. - */ - filter?: Any; -} -export interface ReactiveContractGrant { - contract: ComputedRef; - limit?: ComputedRef; - filter?: ComputedRef; -} -export interface ContractGrantProtoMsg { - typeUrl: "/cosmwasm.wasm.v1.ContractGrant"; - value: Uint8Array; -} -/** - * ContractGrant a granted permission for a single contract - * Since: wasmd 0.30 - */ -export interface ContractGrantSDKType { - contract: string; - limit?: AnySDKType; - filter?: AnySDKType; -} -/** - * MaxCallsLimit limited number of calls to the contract. No funds transferable. - * Since: wasmd 0.30 - */ -export interface MaxCallsLimit { - /** Remaining number that is decremented on each execution */ - remaining: bigint; -} -export interface ReactiveMaxCallsLimit { - remaining: ComputedRef; -} -export interface MaxCallsLimitProtoMsg { - typeUrl: "/cosmwasm.wasm.v1.MaxCallsLimit"; - value: Uint8Array; -} -/** - * MaxCallsLimit limited number of calls to the contract. No funds transferable. - * Since: wasmd 0.30 - */ -export interface MaxCallsLimitSDKType { - remaining: bigint; -} -/** - * MaxFundsLimit defines the maximal amounts that can be sent to the contract. - * Since: wasmd 0.30 - */ -export interface MaxFundsLimit { - /** Amounts is the maximal amount of tokens transferable to the contract. */ - amounts: Coin[]; -} -export interface ReactiveMaxFundsLimit { - amounts: ComputedRef; -} -export interface MaxFundsLimitProtoMsg { - typeUrl: "/cosmwasm.wasm.v1.MaxFundsLimit"; - value: Uint8Array; -} -/** - * MaxFundsLimit defines the maximal amounts that can be sent to the contract. - * Since: wasmd 0.30 - */ -export interface MaxFundsLimitSDKType { - amounts: CoinSDKType[]; -} -/** - * CombinedLimit defines the maximal amounts that can be sent to a contract and - * the maximal number of calls executable. Both need to remain >0 to be valid. - * Since: wasmd 0.30 - */ -export interface CombinedLimit { - /** Remaining number that is decremented on each execution */ - callsRemaining: bigint; - /** Amounts is the maximal amount of tokens transferable to the contract. */ - amounts: Coin[]; -} -export interface ReactiveCombinedLimit { - callsRemaining: ComputedRef; - amounts: ComputedRef; -} -export interface CombinedLimitProtoMsg { - typeUrl: "/cosmwasm.wasm.v1.CombinedLimit"; - value: Uint8Array; -} -/** - * CombinedLimit defines the maximal amounts that can be sent to a contract and - * the maximal number of calls executable. Both need to remain >0 to be valid. - * Since: wasmd 0.30 - */ -export interface CombinedLimitSDKType { - calls_remaining: bigint; - amounts: CoinSDKType[]; -} -/** - * AllowAllMessagesFilter is a wildcard to allow any type of contract payload - * message. - * Since: wasmd 0.30 - */ -export interface AllowAllMessagesFilter {} -export interface ReactiveAllowAllMessagesFilter {} -export interface AllowAllMessagesFilterProtoMsg { - typeUrl: "/cosmwasm.wasm.v1.AllowAllMessagesFilter"; - value: Uint8Array; -} -/** - * AllowAllMessagesFilter is a wildcard to allow any type of contract payload - * message. - * Since: wasmd 0.30 - */ -export interface AllowAllMessagesFilterSDKType {} -/** - * AcceptedMessageKeysFilter accept only the specific contract message keys in - * the json object to be executed. - * Since: wasmd 0.30 - */ -export interface AcceptedMessageKeysFilter { - /** Messages is the list of unique keys */ - keys: string[]; -} -export interface ReactiveAcceptedMessageKeysFilter { - keys: ComputedRef; -} -export interface AcceptedMessageKeysFilterProtoMsg { - typeUrl: "/cosmwasm.wasm.v1.AcceptedMessageKeysFilter"; - value: Uint8Array; -} -/** - * AcceptedMessageKeysFilter accept only the specific contract message keys in - * the json object to be executed. - * Since: wasmd 0.30 - */ -export interface AcceptedMessageKeysFilterSDKType { - keys: string[]; -} -/** - * AcceptedMessagesFilter accept only the specific raw contract messages to be - * executed. - * Since: wasmd 0.30 - */ -export interface AcceptedMessagesFilter { - /** Messages is the list of raw contract messages */ - messages: Uint8Array[]; -} -export interface ReactiveAcceptedMessagesFilter { - messages: ComputedRef; -} -export interface AcceptedMessagesFilterProtoMsg { - typeUrl: "/cosmwasm.wasm.v1.AcceptedMessagesFilter"; - value: Uint8Array; -} -/** - * AcceptedMessagesFilter accept only the specific raw contract messages to be - * executed. - * Since: wasmd 0.30 - */ -export interface AcceptedMessagesFilterSDKType { - messages: Uint8Array[]; -} -function createBaseContractExecutionAuthorization(): ContractExecutionAuthorization { - return { - grants: [] - }; -} -export const ContractExecutionAuthorization = { - typeUrl: "/cosmwasm.wasm.v1.ContractExecutionAuthorization", - encode(message: ContractExecutionAuthorization, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - for (const v of message.grants) { - ContractGrant.encode(v!, writer.uint32(10).fork()).ldelim(); - } - return writer; - }, - decode(input: BinaryReader | Uint8Array, length?: number): ContractExecutionAuthorization { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseContractExecutionAuthorization(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.grants.push(ContractGrant.decode(reader, reader.uint32())); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - fromJSON(object: any): ContractExecutionAuthorization { - return { - grants: Array.isArray(object?.grants) ? object.grants.map((e: any) => ContractGrant.fromJSON(e)) : [] - }; - }, - toJSON(message: ContractExecutionAuthorization): JsonSafe { - const obj: any = {}; - if (message.grants) { - obj.grants = message.grants.map(e => e ? ContractGrant.toJSON(e) : undefined); - } else { - obj.grants = []; - } - return obj; - }, - fromPartial(object: DeepPartial): ContractExecutionAuthorization { - const message = createBaseContractExecutionAuthorization(); - message.grants = object.grants?.map(e => ContractGrant.fromPartial(e)) || []; - return message; - }, - fromSDK(object: ContractExecutionAuthorizationSDKType): ContractExecutionAuthorization { - return { - grants: Array.isArray(object?.grants) ? object.grants.map((e: any) => ContractGrant.fromSDK(e)) : [] - }; - }, - fromSDKJSON(object: any): ContractExecutionAuthorizationSDKType { - return { - grants: Array.isArray(object?.grants) ? object.grants.map((e: any) => ContractGrant.fromSDKJSON(e)) : [] - }; - }, - toSDK(message: ContractExecutionAuthorization): ContractExecutionAuthorizationSDKType { - const obj: any = {}; - if (message.grants) { - obj.grants = message.grants.map(e => e ? ContractGrant.toSDK(e) : undefined); - } else { - obj.grants = []; - } - return obj; - }, - fromAmino(object: ContractExecutionAuthorizationAmino): ContractExecutionAuthorization { - const message = createBaseContractExecutionAuthorization(); - message.grants = object.grants?.map(e => ContractGrant.fromAmino(e)) || []; - return message; - }, - toAmino(message: ContractExecutionAuthorization): ContractExecutionAuthorizationAmino { - const obj: any = {}; - if (message.grants) { - obj.grants = message.grants.map(e => e ? ContractGrant.toAmino(e) : undefined); - } else { - obj.grants = message.grants; - } - return obj; - }, - fromAminoMsg(object: ContractExecutionAuthorizationAminoMsg): ContractExecutionAuthorization { - return ContractExecutionAuthorization.fromAmino(object.value); - }, - toAminoMsg(message: ContractExecutionAuthorization): ContractExecutionAuthorizationAminoMsg { - return { - type: "wasm/ContractExecutionAuthorization", - value: ContractExecutionAuthorization.toAmino(message) - }; - }, - fromProtoMsg(message: ContractExecutionAuthorizationProtoMsg): ContractExecutionAuthorization { - return ContractExecutionAuthorization.decode(message.value); - }, - toProto(message: ContractExecutionAuthorization): Uint8Array { - return ContractExecutionAuthorization.encode(message).finish(); - }, - toProtoMsg(message: ContractExecutionAuthorization): ContractExecutionAuthorizationProtoMsg { - return { - typeUrl: "/cosmwasm.wasm.v1.ContractExecutionAuthorization", - value: ContractExecutionAuthorization.encode(message).finish() - }; - } -}; -function createBaseContractMigrationAuthorization(): ContractMigrationAuthorization { - return { - grants: [] - }; -} -export const ContractMigrationAuthorization = { - typeUrl: "/cosmwasm.wasm.v1.ContractMigrationAuthorization", - encode(message: ContractMigrationAuthorization, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - for (const v of message.grants) { - ContractGrant.encode(v!, writer.uint32(10).fork()).ldelim(); - } - return writer; - }, - decode(input: BinaryReader | Uint8Array, length?: number): ContractMigrationAuthorization { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseContractMigrationAuthorization(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.grants.push(ContractGrant.decode(reader, reader.uint32())); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - fromJSON(object: any): ContractMigrationAuthorization { - return { - grants: Array.isArray(object?.grants) ? object.grants.map((e: any) => ContractGrant.fromJSON(e)) : [] - }; - }, - toJSON(message: ContractMigrationAuthorization): JsonSafe { - const obj: any = {}; - if (message.grants) { - obj.grants = message.grants.map(e => e ? ContractGrant.toJSON(e) : undefined); - } else { - obj.grants = []; - } - return obj; - }, - fromPartial(object: DeepPartial): ContractMigrationAuthorization { - const message = createBaseContractMigrationAuthorization(); - message.grants = object.grants?.map(e => ContractGrant.fromPartial(e)) || []; - return message; - }, - fromSDK(object: ContractMigrationAuthorizationSDKType): ContractMigrationAuthorization { - return { - grants: Array.isArray(object?.grants) ? object.grants.map((e: any) => ContractGrant.fromSDK(e)) : [] - }; - }, - fromSDKJSON(object: any): ContractMigrationAuthorizationSDKType { - return { - grants: Array.isArray(object?.grants) ? object.grants.map((e: any) => ContractGrant.fromSDKJSON(e)) : [] - }; - }, - toSDK(message: ContractMigrationAuthorization): ContractMigrationAuthorizationSDKType { - const obj: any = {}; - if (message.grants) { - obj.grants = message.grants.map(e => e ? ContractGrant.toSDK(e) : undefined); - } else { - obj.grants = []; - } - return obj; - }, - fromAmino(object: ContractMigrationAuthorizationAmino): ContractMigrationAuthorization { - const message = createBaseContractMigrationAuthorization(); - message.grants = object.grants?.map(e => ContractGrant.fromAmino(e)) || []; - return message; - }, - toAmino(message: ContractMigrationAuthorization): ContractMigrationAuthorizationAmino { - const obj: any = {}; - if (message.grants) { - obj.grants = message.grants.map(e => e ? ContractGrant.toAmino(e) : undefined); - } else { - obj.grants = message.grants; - } - return obj; - }, - fromAminoMsg(object: ContractMigrationAuthorizationAminoMsg): ContractMigrationAuthorization { - return ContractMigrationAuthorization.fromAmino(object.value); - }, - toAminoMsg(message: ContractMigrationAuthorization): ContractMigrationAuthorizationAminoMsg { - return { - type: "wasm/ContractMigrationAuthorization", - value: ContractMigrationAuthorization.toAmino(message) - }; - }, - fromProtoMsg(message: ContractMigrationAuthorizationProtoMsg): ContractMigrationAuthorization { - return ContractMigrationAuthorization.decode(message.value); - }, - toProto(message: ContractMigrationAuthorization): Uint8Array { - return ContractMigrationAuthorization.encode(message).finish(); - }, - toProtoMsg(message: ContractMigrationAuthorization): ContractMigrationAuthorizationProtoMsg { - return { - typeUrl: "/cosmwasm.wasm.v1.ContractMigrationAuthorization", - value: ContractMigrationAuthorization.encode(message).finish() - }; - } -}; -function createBaseContractGrant(): ContractGrant { - return { - contract: "", - limit: undefined, - filter: undefined - }; -} -export const ContractGrant = { - typeUrl: "/cosmwasm.wasm.v1.ContractGrant", - encode(message: ContractGrant, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.contract !== "") { - writer.uint32(10).string(message.contract); - } - if (message.limit !== undefined) { - Any.encode(message.limit, writer.uint32(18).fork()).ldelim(); - } - if (message.filter !== undefined) { - Any.encode(message.filter, writer.uint32(26).fork()).ldelim(); - } - return writer; - }, - decode(input: BinaryReader | Uint8Array, length?: number): ContractGrant { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseContractGrant(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.contract = reader.string(); - break; - case 2: - message.limit = Any.decode(reader, reader.uint32()); - break; - case 3: - message.filter = Any.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - fromJSON(object: any): ContractGrant { - return { - contract: isSet(object.contract) ? String(object.contract) : "", - limit: isSet(object.limit) ? Any.fromJSON(object.limit) : undefined, - filter: isSet(object.filter) ? Any.fromJSON(object.filter) : undefined - }; - }, - toJSON(message: ContractGrant): JsonSafe { - const obj: any = {}; - message.contract !== undefined && (obj.contract = message.contract); - message.limit !== undefined && (obj.limit = message.limit ? Any.toJSON(message.limit) : undefined); - message.filter !== undefined && (obj.filter = message.filter ? Any.toJSON(message.filter) : undefined); - return obj; - }, - fromPartial(object: DeepPartial): ContractGrant { - const message = createBaseContractGrant(); - message.contract = object.contract ?? ""; - message.limit = object.limit !== undefined && object.limit !== null ? Any.fromPartial(object.limit) : undefined; - message.filter = object.filter !== undefined && object.filter !== null ? Any.fromPartial(object.filter) : undefined; - return message; - }, - fromSDK(object: ContractGrantSDKType): ContractGrant { - return { - contract: object?.contract, - limit: object.limit ? Any.fromSDK(object.limit) : undefined, - filter: object.filter ? Any.fromSDK(object.filter) : undefined - }; - }, - fromSDKJSON(object: any): ContractGrantSDKType { - return { - contract: isSet(object.contract) ? String(object.contract) : "", - limit: isSet(object.limit) ? Any.fromSDKJSON(object.limit) : undefined, - filter: isSet(object.filter) ? Any.fromSDKJSON(object.filter) : undefined - }; - }, - toSDK(message: ContractGrant): ContractGrantSDKType { - const obj: any = {}; - obj.contract = message.contract; - message.limit !== undefined && (obj.limit = message.limit ? Any.toSDK(message.limit) : undefined); - message.filter !== undefined && (obj.filter = message.filter ? Any.toSDK(message.filter) : undefined); - return obj; - }, - fromAmino(object: ContractGrantAmino): ContractGrant { - const message = createBaseContractGrant(); - if (object.contract !== undefined && object.contract !== null) { - message.contract = object.contract; - } - if (object.limit !== undefined && object.limit !== null) { - message.limit = Any.fromAmino(object.limit); - } - if (object.filter !== undefined && object.filter !== null) { - message.filter = Any.fromAmino(object.filter); - } - return message; - }, - toAmino(message: ContractGrant): ContractGrantAmino { - const obj: any = {}; - 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; - }, - fromAminoMsg(object: ContractGrantAminoMsg): ContractGrant { - return ContractGrant.fromAmino(object.value); - }, - toAminoMsg(message: ContractGrant): ContractGrantAminoMsg { - return { - type: "wasm/ContractGrant", - value: ContractGrant.toAmino(message) - }; - }, - fromProtoMsg(message: ContractGrantProtoMsg): ContractGrant { - return ContractGrant.decode(message.value); - }, - toProto(message: ContractGrant): Uint8Array { - return ContractGrant.encode(message).finish(); - }, - toProtoMsg(message: ContractGrant): ContractGrantProtoMsg { - return { - typeUrl: "/cosmwasm.wasm.v1.ContractGrant", - value: ContractGrant.encode(message).finish() - }; - } -}; -function createBaseMaxCallsLimit(): MaxCallsLimit { - return { - remaining: BigInt(0) - }; -} -export const MaxCallsLimit = { - typeUrl: "/cosmwasm.wasm.v1.MaxCallsLimit", - encode(message: MaxCallsLimit, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.remaining !== BigInt(0)) { - writer.uint32(8).uint64(message.remaining); - } - return writer; - }, - decode(input: BinaryReader | Uint8Array, length?: number): MaxCallsLimit { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseMaxCallsLimit(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.remaining = reader.uint64(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - fromJSON(object: any): MaxCallsLimit { - return { - remaining: isSet(object.remaining) ? BigInt(object.remaining.toString()) : BigInt(0) - }; - }, - toJSON(message: MaxCallsLimit): JsonSafe { - const obj: any = {}; - message.remaining !== undefined && (obj.remaining = (message.remaining || BigInt(0)).toString()); - return obj; - }, - fromPartial(object: DeepPartial): MaxCallsLimit { - const message = createBaseMaxCallsLimit(); - message.remaining = object.remaining !== undefined && object.remaining !== null ? BigInt(object.remaining.toString()) : BigInt(0); - return message; - }, - fromSDK(object: MaxCallsLimitSDKType): MaxCallsLimit { - return { - remaining: object?.remaining - }; - }, - fromSDKJSON(object: any): MaxCallsLimitSDKType { - return { - remaining: isSet(object.remaining) ? BigInt(object.remaining.toString()) : BigInt(0) - }; - }, - toSDK(message: MaxCallsLimit): MaxCallsLimitSDKType { - const obj: any = {}; - obj.remaining = message.remaining; - return obj; - }, - fromAmino(object: MaxCallsLimitAmino): MaxCallsLimit { - const message = createBaseMaxCallsLimit(); - if (object.remaining !== undefined && object.remaining !== null) { - message.remaining = BigInt(object.remaining); - } - return message; - }, - toAmino(message: MaxCallsLimit): MaxCallsLimitAmino { - const obj: any = {}; - obj.remaining = message.remaining !== BigInt(0) ? message.remaining?.toString() : undefined; - return obj; - }, - fromAminoMsg(object: MaxCallsLimitAminoMsg): MaxCallsLimit { - return MaxCallsLimit.fromAmino(object.value); - }, - toAminoMsg(message: MaxCallsLimit): MaxCallsLimitAminoMsg { - return { - type: "wasm/MaxCallsLimit", - value: MaxCallsLimit.toAmino(message) - }; - }, - fromProtoMsg(message: MaxCallsLimitProtoMsg): MaxCallsLimit { - return MaxCallsLimit.decode(message.value); - }, - toProto(message: MaxCallsLimit): Uint8Array { - return MaxCallsLimit.encode(message).finish(); - }, - toProtoMsg(message: MaxCallsLimit): MaxCallsLimitProtoMsg { - return { - typeUrl: "/cosmwasm.wasm.v1.MaxCallsLimit", - value: MaxCallsLimit.encode(message).finish() - }; - } -}; -function createBaseMaxFundsLimit(): MaxFundsLimit { - return { - amounts: [] - }; -} -export const MaxFundsLimit = { - typeUrl: "/cosmwasm.wasm.v1.MaxFundsLimit", - encode(message: MaxFundsLimit, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - for (const v of message.amounts) { - Coin.encode(v!, writer.uint32(10).fork()).ldelim(); - } - return writer; - }, - decode(input: BinaryReader | Uint8Array, length?: number): MaxFundsLimit { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseMaxFundsLimit(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.amounts.push(Coin.decode(reader, reader.uint32())); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - fromJSON(object: any): MaxFundsLimit { - return { - amounts: Array.isArray(object?.amounts) ? object.amounts.map((e: any) => Coin.fromJSON(e)) : [] - }; - }, - toJSON(message: MaxFundsLimit): JsonSafe { - const obj: any = {}; - if (message.amounts) { - obj.amounts = message.amounts.map(e => e ? Coin.toJSON(e) : undefined); - } else { - obj.amounts = []; - } - return obj; - }, - fromPartial(object: DeepPartial): MaxFundsLimit { - const message = createBaseMaxFundsLimit(); - message.amounts = object.amounts?.map(e => Coin.fromPartial(e)) || []; - return message; - }, - fromSDK(object: MaxFundsLimitSDKType): MaxFundsLimit { - return { - amounts: Array.isArray(object?.amounts) ? object.amounts.map((e: any) => Coin.fromSDK(e)) : [] - }; - }, - fromSDKJSON(object: any): MaxFundsLimitSDKType { - return { - amounts: Array.isArray(object?.amounts) ? object.amounts.map((e: any) => Coin.fromSDKJSON(e)) : [] - }; - }, - toSDK(message: MaxFundsLimit): MaxFundsLimitSDKType { - const obj: any = {}; - if (message.amounts) { - obj.amounts = message.amounts.map(e => e ? Coin.toSDK(e) : undefined); - } else { - obj.amounts = []; - } - return obj; - }, - fromAmino(object: MaxFundsLimitAmino): MaxFundsLimit { - const message = createBaseMaxFundsLimit(); - message.amounts = object.amounts?.map(e => Coin.fromAmino(e)) || []; - return message; - }, - toAmino(message: MaxFundsLimit): MaxFundsLimitAmino { - const obj: any = {}; - if (message.amounts) { - obj.amounts = message.amounts.map(e => e ? Coin.toAmino(e) : undefined); - } else { - obj.amounts = message.amounts; - } - return obj; - }, - fromAminoMsg(object: MaxFundsLimitAminoMsg): MaxFundsLimit { - return MaxFundsLimit.fromAmino(object.value); - }, - toAminoMsg(message: MaxFundsLimit): MaxFundsLimitAminoMsg { - return { - type: "wasm/MaxFundsLimit", - value: MaxFundsLimit.toAmino(message) - }; - }, - fromProtoMsg(message: MaxFundsLimitProtoMsg): MaxFundsLimit { - return MaxFundsLimit.decode(message.value); - }, - toProto(message: MaxFundsLimit): Uint8Array { - return MaxFundsLimit.encode(message).finish(); - }, - toProtoMsg(message: MaxFundsLimit): MaxFundsLimitProtoMsg { - return { - typeUrl: "/cosmwasm.wasm.v1.MaxFundsLimit", - value: MaxFundsLimit.encode(message).finish() - }; - } -}; -function createBaseCombinedLimit(): CombinedLimit { - return { - callsRemaining: BigInt(0), - amounts: [] - }; -} -export const CombinedLimit = { - typeUrl: "/cosmwasm.wasm.v1.CombinedLimit", - encode(message: CombinedLimit, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.callsRemaining !== BigInt(0)) { - writer.uint32(8).uint64(message.callsRemaining); - } - for (const v of message.amounts) { - Coin.encode(v!, writer.uint32(18).fork()).ldelim(); - } - return writer; - }, - decode(input: BinaryReader | Uint8Array, length?: number): CombinedLimit { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseCombinedLimit(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.callsRemaining = reader.uint64(); - break; - case 2: - message.amounts.push(Coin.decode(reader, reader.uint32())); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - fromJSON(object: any): CombinedLimit { - return { - callsRemaining: isSet(object.callsRemaining) ? BigInt(object.callsRemaining.toString()) : BigInt(0), - amounts: Array.isArray(object?.amounts) ? object.amounts.map((e: any) => Coin.fromJSON(e)) : [] - }; - }, - toJSON(message: CombinedLimit): JsonSafe { - const obj: any = {}; - message.callsRemaining !== undefined && (obj.callsRemaining = (message.callsRemaining || BigInt(0)).toString()); - if (message.amounts) { - obj.amounts = message.amounts.map(e => e ? Coin.toJSON(e) : undefined); - } else { - obj.amounts = []; - } - return obj; - }, - fromPartial(object: DeepPartial): CombinedLimit { - const message = createBaseCombinedLimit(); - message.callsRemaining = object.callsRemaining !== undefined && object.callsRemaining !== null ? BigInt(object.callsRemaining.toString()) : BigInt(0); - message.amounts = object.amounts?.map(e => Coin.fromPartial(e)) || []; - return message; - }, - fromSDK(object: CombinedLimitSDKType): CombinedLimit { - return { - callsRemaining: object?.calls_remaining, - amounts: Array.isArray(object?.amounts) ? object.amounts.map((e: any) => Coin.fromSDK(e)) : [] - }; - }, - fromSDKJSON(object: any): CombinedLimitSDKType { - return { - calls_remaining: isSet(object.calls_remaining) ? BigInt(object.calls_remaining.toString()) : BigInt(0), - amounts: Array.isArray(object?.amounts) ? object.amounts.map((e: any) => Coin.fromSDKJSON(e)) : [] - }; - }, - toSDK(message: CombinedLimit): CombinedLimitSDKType { - const obj: any = {}; - obj.calls_remaining = message.callsRemaining; - if (message.amounts) { - obj.amounts = message.amounts.map(e => e ? Coin.toSDK(e) : undefined); - } else { - obj.amounts = []; - } - return obj; - }, - fromAmino(object: CombinedLimitAmino): CombinedLimit { - const message = createBaseCombinedLimit(); - if (object.calls_remaining !== undefined && object.calls_remaining !== null) { - message.callsRemaining = BigInt(object.calls_remaining); - } - message.amounts = object.amounts?.map(e => Coin.fromAmino(e)) || []; - return message; - }, - toAmino(message: CombinedLimit): CombinedLimitAmino { - const obj: any = {}; - 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 { - obj.amounts = message.amounts; - } - return obj; - }, - fromAminoMsg(object: CombinedLimitAminoMsg): CombinedLimit { - return CombinedLimit.fromAmino(object.value); - }, - toAminoMsg(message: CombinedLimit): CombinedLimitAminoMsg { - return { - type: "wasm/CombinedLimit", - value: CombinedLimit.toAmino(message) - }; - }, - fromProtoMsg(message: CombinedLimitProtoMsg): CombinedLimit { - return CombinedLimit.decode(message.value); - }, - toProto(message: CombinedLimit): Uint8Array { - return CombinedLimit.encode(message).finish(); - }, - toProtoMsg(message: CombinedLimit): CombinedLimitProtoMsg { - return { - typeUrl: "/cosmwasm.wasm.v1.CombinedLimit", - value: CombinedLimit.encode(message).finish() - }; - } -}; -function createBaseAllowAllMessagesFilter(): AllowAllMessagesFilter { - return {}; -} -export const AllowAllMessagesFilter = { - typeUrl: "/cosmwasm.wasm.v1.AllowAllMessagesFilter", - encode(_: AllowAllMessagesFilter, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - return writer; - }, - decode(input: BinaryReader | Uint8Array, length?: number): AllowAllMessagesFilter { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseAllowAllMessagesFilter(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - fromJSON(_: any): AllowAllMessagesFilter { - return {}; - }, - toJSON(_: AllowAllMessagesFilter): JsonSafe { - const obj: any = {}; - return obj; - }, - fromPartial(_: DeepPartial): AllowAllMessagesFilter { - const message = createBaseAllowAllMessagesFilter(); - return message; - }, - fromSDK(_: AllowAllMessagesFilterSDKType): AllowAllMessagesFilter { - return {}; - }, - fromSDKJSON(_: any): AllowAllMessagesFilterSDKType { - return {}; - }, - toSDK(_: AllowAllMessagesFilter): AllowAllMessagesFilterSDKType { - const obj: any = {}; - return obj; - }, - fromAmino(_: AllowAllMessagesFilterAmino): AllowAllMessagesFilter { - const message = createBaseAllowAllMessagesFilter(); - return message; - }, - toAmino(_: AllowAllMessagesFilter): AllowAllMessagesFilterAmino { - const obj: any = {}; - return obj; - }, - fromAminoMsg(object: AllowAllMessagesFilterAminoMsg): AllowAllMessagesFilter { - return AllowAllMessagesFilter.fromAmino(object.value); - }, - toAminoMsg(message: AllowAllMessagesFilter): AllowAllMessagesFilterAminoMsg { - return { - type: "wasm/AllowAllMessagesFilter", - value: AllowAllMessagesFilter.toAmino(message) - }; - }, - fromProtoMsg(message: AllowAllMessagesFilterProtoMsg): AllowAllMessagesFilter { - return AllowAllMessagesFilter.decode(message.value); - }, - toProto(message: AllowAllMessagesFilter): Uint8Array { - return AllowAllMessagesFilter.encode(message).finish(); - }, - toProtoMsg(message: AllowAllMessagesFilter): AllowAllMessagesFilterProtoMsg { - return { - typeUrl: "/cosmwasm.wasm.v1.AllowAllMessagesFilter", - value: AllowAllMessagesFilter.encode(message).finish() - }; - } -}; -function createBaseAcceptedMessageKeysFilter(): AcceptedMessageKeysFilter { - return { - keys: [] - }; -} -export const AcceptedMessageKeysFilter = { - typeUrl: "/cosmwasm.wasm.v1.AcceptedMessageKeysFilter", - encode(message: AcceptedMessageKeysFilter, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - for (const v of message.keys) { - writer.uint32(10).string(v!); - } - return writer; - }, - decode(input: BinaryReader | Uint8Array, length?: number): AcceptedMessageKeysFilter { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseAcceptedMessageKeysFilter(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.keys.push(reader.string()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - fromJSON(object: any): AcceptedMessageKeysFilter { - return { - keys: Array.isArray(object?.keys) ? object.keys.map((e: any) => String(e)) : [] - }; - }, - toJSON(message: AcceptedMessageKeysFilter): JsonSafe { - const obj: any = {}; - if (message.keys) { - obj.keys = message.keys.map(e => e); - } else { - obj.keys = []; - } - return obj; - }, - fromPartial(object: DeepPartial): AcceptedMessageKeysFilter { - const message = createBaseAcceptedMessageKeysFilter(); - message.keys = object.keys?.map(e => e) || []; - return message; - }, - fromSDK(object: AcceptedMessageKeysFilterSDKType): AcceptedMessageKeysFilter { - return { - keys: Array.isArray(object?.keys) ? object.keys.map((e: any) => e) : [] - }; - }, - fromSDKJSON(object: any): AcceptedMessageKeysFilterSDKType { - return { - keys: Array.isArray(object?.keys) ? object.keys.map((e: any) => String(e)) : [] - }; - }, - toSDK(message: AcceptedMessageKeysFilter): AcceptedMessageKeysFilterSDKType { - const obj: any = {}; - if (message.keys) { - obj.keys = message.keys.map(e => e); - } else { - obj.keys = []; - } - return obj; - }, - fromAmino(object: AcceptedMessageKeysFilterAmino): AcceptedMessageKeysFilter { - const message = createBaseAcceptedMessageKeysFilter(); - message.keys = object.keys?.map(e => e) || []; - return message; - }, - toAmino(message: AcceptedMessageKeysFilter): AcceptedMessageKeysFilterAmino { - const obj: any = {}; - if (message.keys) { - obj.keys = message.keys.map(e => e); - } else { - obj.keys = message.keys; - } - return obj; - }, - fromAminoMsg(object: AcceptedMessageKeysFilterAminoMsg): AcceptedMessageKeysFilter { - return AcceptedMessageKeysFilter.fromAmino(object.value); - }, - toAminoMsg(message: AcceptedMessageKeysFilter): AcceptedMessageKeysFilterAminoMsg { - return { - type: "wasm/AcceptedMessageKeysFilter", - value: AcceptedMessageKeysFilter.toAmino(message) - }; - }, - fromProtoMsg(message: AcceptedMessageKeysFilterProtoMsg): AcceptedMessageKeysFilter { - return AcceptedMessageKeysFilter.decode(message.value); - }, - toProto(message: AcceptedMessageKeysFilter): Uint8Array { - return AcceptedMessageKeysFilter.encode(message).finish(); - }, - toProtoMsg(message: AcceptedMessageKeysFilter): AcceptedMessageKeysFilterProtoMsg { - return { - typeUrl: "/cosmwasm.wasm.v1.AcceptedMessageKeysFilter", - value: AcceptedMessageKeysFilter.encode(message).finish() - }; - } -}; -function createBaseAcceptedMessagesFilter(): AcceptedMessagesFilter { - return { - messages: [] - }; -} -export const AcceptedMessagesFilter = { - typeUrl: "/cosmwasm.wasm.v1.AcceptedMessagesFilter", - encode(message: AcceptedMessagesFilter, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - for (const v of message.messages) { - writer.uint32(10).bytes(v!); - } - return writer; - }, - decode(input: BinaryReader | Uint8Array, length?: number): AcceptedMessagesFilter { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseAcceptedMessagesFilter(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.messages.push(reader.bytes()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - fromJSON(object: any): AcceptedMessagesFilter { - return { - messages: Array.isArray(object?.messages) ? object.messages.map((e: any) => bytesFromBase64(e)) : [] - }; - }, - toJSON(message: AcceptedMessagesFilter): JsonSafe { - const obj: any = {}; - if (message.messages) { - obj.messages = message.messages.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); - } else { - obj.messages = []; - } - return obj; - }, - fromPartial(object: DeepPartial): AcceptedMessagesFilter { - const message = createBaseAcceptedMessagesFilter(); - message.messages = object.messages?.map(e => e) || []; - return message; - }, - fromSDK(object: AcceptedMessagesFilterSDKType): AcceptedMessagesFilter { - return { - messages: Array.isArray(object?.messages) ? object.messages.map((e: any) => e) : [] - }; - }, - fromSDKJSON(object: any): AcceptedMessagesFilterSDKType { - return { - messages: Array.isArray(object?.messages) ? object.messages.map((e: any) => bytesFromBase64(e)) : [] - }; - }, - toSDK(message: AcceptedMessagesFilter): AcceptedMessagesFilterSDKType { - const obj: any = {}; - if (message.messages) { - obj.messages = message.messages.map(e => e); - } else { - obj.messages = []; - } - return obj; - }, - fromAmino(object: AcceptedMessagesFilterAmino): AcceptedMessagesFilter { - const message = createBaseAcceptedMessagesFilter(); - message.messages = object.messages?.map(e => toUtf8(JSON.stringify(e))) || []; - return message; - }, - toAmino(message: AcceptedMessagesFilter): AcceptedMessagesFilterAmino { - const obj: any = {}; - if (message.messages) { - obj.messages = message.messages.map(e => JSON.parse(fromUtf8(e))); - } else { - obj.messages = message.messages; - } - return obj; - }, - fromAminoMsg(object: AcceptedMessagesFilterAminoMsg): AcceptedMessagesFilter { - return AcceptedMessagesFilter.fromAmino(object.value); - }, - toAminoMsg(message: AcceptedMessagesFilter): AcceptedMessagesFilterAminoMsg { - return { - type: "wasm/AcceptedMessagesFilter", - value: AcceptedMessagesFilter.toAmino(message) - }; - }, - fromProtoMsg(message: AcceptedMessagesFilterProtoMsg): AcceptedMessagesFilter { - return AcceptedMessagesFilter.decode(message.value); - }, - toProto(message: AcceptedMessagesFilter): Uint8Array { - return AcceptedMessagesFilter.encode(message).finish(); - }, - toProtoMsg(message: AcceptedMessagesFilter): AcceptedMessagesFilterProtoMsg { - return { - typeUrl: "/cosmwasm.wasm.v1.AcceptedMessagesFilter", - value: AcceptedMessagesFilter.encode(message).finish() - }; - } -}; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv4/cosmwasm/wasm/v1/genesis.ts b/__fixtures__/v-next/outputv4/cosmwasm/wasm/v1/genesis.ts index 6bfc17d1ff..2add1007dc 100644 --- a/__fixtures__/v-next/outputv4/cosmwasm/wasm/v1/genesis.ts +++ b/__fixtures__/v-next/outputv4/cosmwasm/wasm/v1/genesis.ts @@ -1,9 +1,8 @@ -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 { JsonSafe } from "../../../json-safe"; -import { ComputedRef } from "vue"; +import { MsgStoreCode, MsgStoreCodeSDKType, MsgInstantiateContract, MsgInstantiateContractSDKType, MsgExecuteContract, MsgExecuteContractSDKType } from "./tx.js"; +import { Params, ParamsSDKType, CodeInfo, CodeInfoSDKType, ContractInfo, ContractInfoSDKType, Model, ModelSDKType } from "./types.js"; +import { BinaryReader, BinaryWriter } from "../../../binary.js"; +import { isSet, DeepPartial, bytesFromBase64, base64FromBytes } from "../../../helpers.js"; +import { JsonSafe } from "../../../json-safe.js"; export const protobufPackage = "cosmwasm.wasm.v1"; /** GenesisState - genesis state of x/wasm */ export interface GenesisState { @@ -13,13 +12,6 @@ export interface GenesisState { sequences: Sequence[]; genMsgs: GenesisState_GenMsgs[]; } -export interface ReactiveGenesisState { - params: ComputedRef; - codes: ComputedRef; - contracts: ComputedRef; - sequences: ComputedRef; - genMsgs: ComputedRef; -} export interface GenesisStateProtoMsg { typeUrl: "/cosmwasm.wasm.v1.GenesisState"; value: Uint8Array; @@ -41,11 +33,6 @@ export interface GenesisState_GenMsgs { instantiateContract?: MsgInstantiateContract; executeContract?: MsgExecuteContract; } -export interface ReactiveGenesisState_GenMsgs { - storeCode?: ComputedRef; - instantiateContract?: ComputedRef; - executeContract?: ComputedRef; -} export interface GenesisState_GenMsgsProtoMsg { typeUrl: "/cosmwasm.wasm.v1.GenMsgs"; value: Uint8Array; @@ -67,12 +54,6 @@ export interface Code { /** Pinned to wasmvm cache */ pinned: boolean; } -export interface ReactiveCode { - codeId: ComputedRef; - codeInfo: ComputedRef; - codeBytes: ComputedRef; - pinned: ComputedRef; -} export interface CodeProtoMsg { typeUrl: "/cosmwasm.wasm.v1.Code"; value: Uint8Array; @@ -90,11 +71,6 @@ export interface Contract { contractInfo: ContractInfo; contractState: Model[]; } -export interface ReactiveContract { - contractAddress: ComputedRef; - contractInfo: ComputedRef; - contractState: ComputedRef; -} export interface ContractProtoMsg { typeUrl: "/cosmwasm.wasm.v1.Contract"; value: Uint8Array; @@ -110,10 +86,6 @@ export interface Sequence { idKey: Uint8Array; value: bigint; } -export interface ReactiveSequence { - idKey: ComputedRef; - value: ComputedRef; -} export interface SequenceProtoMsg { typeUrl: "/cosmwasm.wasm.v1.Sequence"; value: Uint8Array; @@ -182,13 +154,13 @@ export const GenesisState = { return message; }, fromJSON(object: any): GenesisState { - return { - params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, - codes: Array.isArray(object?.codes) ? object.codes.map((e: any) => Code.fromJSON(e)) : [], - contracts: Array.isArray(object?.contracts) ? object.contracts.map((e: any) => Contract.fromJSON(e)) : [], - sequences: Array.isArray(object?.sequences) ? object.sequences.map((e: any) => Sequence.fromJSON(e)) : [], - genMsgs: Array.isArray(object?.genMsgs) ? object.genMsgs.map((e: any) => GenesisState_GenMsgs.fromJSON(e)) : [] - }; + const obj = createBaseGenesisState(); + if (isSet(object.params)) obj.params = Params.fromJSON(object.params); + if (Array.isArray(object?.codes)) obj.codes = object.codes.map((e: any) => Code.fromJSON(e)); + if (Array.isArray(object?.contracts)) obj.contracts = object.contracts.map((e: any) => Contract.fromJSON(e)); + if (Array.isArray(object?.sequences)) obj.sequences = object.sequences.map((e: any) => Sequence.fromJSON(e)); + if (Array.isArray(object?.genMsgs)) obj.genMsgs = object.genMsgs.map((e: any) => GenesisState_GenMsgs.fromJSON(e)); + return obj; }, toJSON(message: GenesisState): JsonSafe { const obj: any = {}; @@ -217,7 +189,9 @@ export const GenesisState = { }, fromPartial(object: DeepPartial): GenesisState { const message = createBaseGenesisState(); - message.params = object.params !== undefined && object.params !== null ? Params.fromPartial(object.params) : undefined; + if (object.params !== undefined && object.params !== null) { + message.params = Params.fromPartial(object.params); + } message.codes = object.codes?.map(e => Code.fromPartial(e)) || []; message.contracts = object.contracts?.map(e => Contract.fromPartial(e)) || []; message.sequences = object.sequences?.map(e => Sequence.fromPartial(e)) || []; @@ -370,11 +344,11 @@ export const GenesisState_GenMsgs = { return message; }, fromJSON(object: any): GenesisState_GenMsgs { - return { - storeCode: isSet(object.storeCode) ? MsgStoreCode.fromJSON(object.storeCode) : undefined, - instantiateContract: isSet(object.instantiateContract) ? MsgInstantiateContract.fromJSON(object.instantiateContract) : undefined, - executeContract: isSet(object.executeContract) ? MsgExecuteContract.fromJSON(object.executeContract) : undefined - }; + const obj = createBaseGenesisState_GenMsgs(); + if (isSet(object.storeCode)) obj.storeCode = MsgStoreCode.fromJSON(object.storeCode); + if (isSet(object.instantiateContract)) obj.instantiateContract = MsgInstantiateContract.fromJSON(object.instantiateContract); + if (isSet(object.executeContract)) obj.executeContract = MsgExecuteContract.fromJSON(object.executeContract); + return obj; }, toJSON(message: GenesisState_GenMsgs): JsonSafe { const obj: any = {}; @@ -385,9 +359,15 @@ export const GenesisState_GenMsgs = { }, fromPartial(object: DeepPartial): GenesisState_GenMsgs { const message = createBaseGenesisState_GenMsgs(); - message.storeCode = object.storeCode !== undefined && object.storeCode !== null ? MsgStoreCode.fromPartial(object.storeCode) : undefined; - message.instantiateContract = object.instantiateContract !== undefined && object.instantiateContract !== null ? MsgInstantiateContract.fromPartial(object.instantiateContract) : undefined; - message.executeContract = object.executeContract !== undefined && object.executeContract !== null ? MsgExecuteContract.fromPartial(object.executeContract) : undefined; + if (object.storeCode !== undefined && object.storeCode !== null) { + message.storeCode = MsgStoreCode.fromPartial(object.storeCode); + } + if (object.instantiateContract !== undefined && object.instantiateContract !== null) { + message.instantiateContract = MsgInstantiateContract.fromPartial(object.instantiateContract); + } + if (object.executeContract !== undefined && object.executeContract !== null) { + message.executeContract = MsgExecuteContract.fromPartial(object.executeContract); + } return message; }, fromSDK(object: GenesisState_GenMsgsSDKType): GenesisState_GenMsgs { @@ -464,7 +444,7 @@ function createBaseCode(): Code { export const Code = { typeUrl: "/cosmwasm.wasm.v1.Code", encode(message: Code, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.codeId !== BigInt(0)) { + if (message.codeId !== undefined) { writer.uint32(8).uint64(message.codeId); } if (message.codeInfo !== undefined) { @@ -473,7 +453,7 @@ export const Code = { if (message.codeBytes.length !== 0) { writer.uint32(26).bytes(message.codeBytes); } - if (message.pinned === true) { + if (message.pinned !== undefined) { writer.uint32(32).bool(message.pinned); } return writer; @@ -505,12 +485,12 @@ export const Code = { return message; }, fromJSON(object: any): Code { - return { - codeId: isSet(object.codeId) ? BigInt(object.codeId.toString()) : BigInt(0), - codeInfo: isSet(object.codeInfo) ? CodeInfo.fromJSON(object.codeInfo) : undefined, - codeBytes: isSet(object.codeBytes) ? bytesFromBase64(object.codeBytes) : new Uint8Array(), - pinned: isSet(object.pinned) ? Boolean(object.pinned) : false - }; + const obj = createBaseCode(); + if (isSet(object.codeId)) obj.codeId = BigInt(object.codeId.toString()); + if (isSet(object.codeInfo)) obj.codeInfo = CodeInfo.fromJSON(object.codeInfo); + if (isSet(object.codeBytes)) obj.codeBytes = bytesFromBase64(object.codeBytes); + if (isSet(object.pinned)) obj.pinned = Boolean(object.pinned); + return obj; }, toJSON(message: Code): JsonSafe { const obj: any = {}; @@ -522,8 +502,12 @@ export const Code = { }, fromPartial(object: DeepPartial): Code { const message = createBaseCode(); - message.codeId = object.codeId !== undefined && object.codeId !== null ? BigInt(object.codeId.toString()) : BigInt(0); - message.codeInfo = object.codeInfo !== undefined && object.codeInfo !== null ? CodeInfo.fromPartial(object.codeInfo) : undefined; + if (object.codeId !== undefined && object.codeId !== null) { + message.codeId = BigInt(object.codeId.toString()); + } + if (object.codeInfo !== undefined && object.codeInfo !== null) { + message.codeInfo = CodeInfo.fromPartial(object.codeInfo); + } message.codeBytes = object.codeBytes ?? new Uint8Array(); message.pinned = object.pinned ?? false; return message; @@ -608,7 +592,7 @@ function createBaseContract(): Contract { export const Contract = { typeUrl: "/cosmwasm.wasm.v1.Contract", encode(message: Contract, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.contractAddress !== "") { + if (message.contractAddress !== undefined) { writer.uint32(10).string(message.contractAddress); } if (message.contractInfo !== undefined) { @@ -643,11 +627,11 @@ export const Contract = { return message; }, fromJSON(object: any): Contract { - return { - contractAddress: isSet(object.contractAddress) ? String(object.contractAddress) : "", - contractInfo: isSet(object.contractInfo) ? ContractInfo.fromJSON(object.contractInfo) : undefined, - contractState: Array.isArray(object?.contractState) ? object.contractState.map((e: any) => Model.fromJSON(e)) : [] - }; + const obj = createBaseContract(); + if (isSet(object.contractAddress)) obj.contractAddress = String(object.contractAddress); + if (isSet(object.contractInfo)) obj.contractInfo = ContractInfo.fromJSON(object.contractInfo); + if (Array.isArray(object?.contractState)) obj.contractState = object.contractState.map((e: any) => Model.fromJSON(e)); + return obj; }, toJSON(message: Contract): JsonSafe { const obj: any = {}; @@ -663,7 +647,9 @@ export const Contract = { fromPartial(object: DeepPartial): Contract { const message = createBaseContract(); message.contractAddress = object.contractAddress ?? ""; - message.contractInfo = object.contractInfo !== undefined && object.contractInfo !== null ? ContractInfo.fromPartial(object.contractInfo) : undefined; + if (object.contractInfo !== undefined && object.contractInfo !== null) { + message.contractInfo = ContractInfo.fromPartial(object.contractInfo); + } message.contractState = object.contractState?.map(e => Model.fromPartial(e)) || []; return message; }, @@ -748,7 +734,7 @@ export const Sequence = { if (message.idKey.length !== 0) { writer.uint32(10).bytes(message.idKey); } - if (message.value !== BigInt(0)) { + if (message.value !== undefined) { writer.uint32(16).uint64(message.value); } return writer; @@ -774,10 +760,10 @@ export const Sequence = { return message; }, fromJSON(object: any): Sequence { - return { - idKey: isSet(object.idKey) ? bytesFromBase64(object.idKey) : new Uint8Array(), - value: isSet(object.value) ? BigInt(object.value.toString()) : BigInt(0) - }; + const obj = createBaseSequence(); + if (isSet(object.idKey)) obj.idKey = bytesFromBase64(object.idKey); + if (isSet(object.value)) obj.value = BigInt(object.value.toString()); + return obj; }, toJSON(message: Sequence): JsonSafe { const obj: any = {}; @@ -788,7 +774,9 @@ export const Sequence = { fromPartial(object: DeepPartial): Sequence { const message = createBaseSequence(); message.idKey = object.idKey ?? new Uint8Array(); - message.value = object.value !== undefined && object.value !== null ? BigInt(object.value.toString()) : BigInt(0); + if (object.value !== undefined && object.value !== null) { + message.value = BigInt(object.value.toString()); + } return message; }, fromSDK(object: SequenceSDKType): Sequence { diff --git a/__fixtures__/v-next/outputv4/cosmwasm/wasm/v1/ibc.ts b/__fixtures__/v-next/outputv4/cosmwasm/wasm/v1/ibc.ts index 93ac4b0469..246a4c7a40 100644 --- a/__fixtures__/v-next/outputv4/cosmwasm/wasm/v1/ibc.ts +++ b/__fixtures__/v-next/outputv4/cosmwasm/wasm/v1/ibc.ts @@ -1,7 +1,6 @@ -import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, bytesFromBase64, base64FromBytes, DeepPartial } from "../../../helpers"; -import { JsonSafe } from "../../../json-safe"; -import { ComputedRef } from "vue"; +import { BinaryReader, BinaryWriter } from "../../../binary.js"; +import { isSet, bytesFromBase64, base64FromBytes, DeepPartial } from "../../../helpers.js"; +import { JsonSafe } from "../../../json-safe.js"; export const protobufPackage = "cosmwasm.wasm.v1"; /** MsgIBCSend */ export interface MsgIBCSend { @@ -23,12 +22,6 @@ export interface MsgIBCSend { */ data: Uint8Array; } -export interface ReactiveMsgIBCSend { - channel: ComputedRef; - timeoutHeight: ComputedRef; - timeoutTimestamp: ComputedRef; - data: ComputedRef; -} export interface MsgIBCSendProtoMsg { typeUrl: "/cosmwasm.wasm.v1.MsgIBCSend"; value: Uint8Array; @@ -44,9 +37,6 @@ export interface MsgIBCSendSDKType { export interface MsgIBCCloseChannel { channel: string; } -export interface ReactiveMsgIBCCloseChannel { - channel: ComputedRef; -} export interface MsgIBCCloseChannelProtoMsg { typeUrl: "/cosmwasm.wasm.v1.MsgIBCCloseChannel"; value: Uint8Array; @@ -66,13 +56,13 @@ function createBaseMsgIBCSend(): MsgIBCSend { export const MsgIBCSend = { typeUrl: "/cosmwasm.wasm.v1.MsgIBCSend", encode(message: MsgIBCSend, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.channel !== "") { + if (message.channel !== undefined) { writer.uint32(18).string(message.channel); } - if (message.timeoutHeight !== BigInt(0)) { + if (message.timeoutHeight !== undefined) { writer.uint32(32).uint64(message.timeoutHeight); } - if (message.timeoutTimestamp !== BigInt(0)) { + if (message.timeoutTimestamp !== undefined) { writer.uint32(40).uint64(message.timeoutTimestamp); } if (message.data.length !== 0) { @@ -107,12 +97,12 @@ export const MsgIBCSend = { return message; }, fromJSON(object: any): MsgIBCSend { - return { - channel: isSet(object.channel) ? String(object.channel) : "", - timeoutHeight: isSet(object.timeoutHeight) ? BigInt(object.timeoutHeight.toString()) : BigInt(0), - timeoutTimestamp: isSet(object.timeoutTimestamp) ? BigInt(object.timeoutTimestamp.toString()) : BigInt(0), - data: isSet(object.data) ? bytesFromBase64(object.data) : new Uint8Array() - }; + const obj = createBaseMsgIBCSend(); + if (isSet(object.channel)) obj.channel = String(object.channel); + if (isSet(object.timeoutHeight)) obj.timeoutHeight = BigInt(object.timeoutHeight.toString()); + if (isSet(object.timeoutTimestamp)) obj.timeoutTimestamp = BigInt(object.timeoutTimestamp.toString()); + if (isSet(object.data)) obj.data = bytesFromBase64(object.data); + return obj; }, toJSON(message: MsgIBCSend): JsonSafe { const obj: any = {}; @@ -125,8 +115,12 @@ export const MsgIBCSend = { fromPartial(object: DeepPartial): MsgIBCSend { const message = createBaseMsgIBCSend(); message.channel = object.channel ?? ""; - message.timeoutHeight = object.timeoutHeight !== undefined && object.timeoutHeight !== null ? BigInt(object.timeoutHeight.toString()) : BigInt(0); - message.timeoutTimestamp = object.timeoutTimestamp !== undefined && object.timeoutTimestamp !== null ? BigInt(object.timeoutTimestamp.toString()) : BigInt(0); + if (object.timeoutHeight !== undefined && object.timeoutHeight !== null) { + message.timeoutHeight = BigInt(object.timeoutHeight.toString()); + } + if (object.timeoutTimestamp !== undefined && object.timeoutTimestamp !== null) { + message.timeoutTimestamp = BigInt(object.timeoutTimestamp.toString()); + } message.data = object.data ?? new Uint8Array(); return message; }, @@ -208,7 +202,7 @@ function createBaseMsgIBCCloseChannel(): MsgIBCCloseChannel { export const MsgIBCCloseChannel = { typeUrl: "/cosmwasm.wasm.v1.MsgIBCCloseChannel", encode(message: MsgIBCCloseChannel, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.channel !== "") { + if (message.channel !== undefined) { writer.uint32(18).string(message.channel); } return writer; @@ -231,9 +225,9 @@ export const MsgIBCCloseChannel = { return message; }, fromJSON(object: any): MsgIBCCloseChannel { - return { - channel: isSet(object.channel) ? String(object.channel) : "" - }; + const obj = createBaseMsgIBCCloseChannel(); + if (isSet(object.channel)) obj.channel = String(object.channel); + return obj; }, toJSON(message: MsgIBCCloseChannel): JsonSafe { const obj: any = {}; diff --git a/__fixtures__/v-next/outputv4/cosmwasm/wasm/v1/proposal.ts b/__fixtures__/v-next/outputv4/cosmwasm/wasm/v1/proposal.ts index 0c8881c510..dd73766a61 100644 --- a/__fixtures__/v-next/outputv4/cosmwasm/wasm/v1/proposal.ts +++ b/__fixtures__/v-next/outputv4/cosmwasm/wasm/v1/proposal.ts @@ -1,10 +1,9 @@ -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 { JsonSafe } from "../../../json-safe"; +import { AccessConfig, AccessConfigSDKType } from "./types.js"; +import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin.js"; +import { BinaryReader, BinaryWriter } from "../../../binary.js"; +import { isSet, bytesFromBase64, base64FromBytes, DeepPartial } from "../../../helpers.js"; +import { JsonSafe } from "../../../json-safe.js"; import { fromBase64, toBase64, toUtf8, fromUtf8 } from "@cosmjs/encoding"; -import { ComputedRef } from "vue"; export const protobufPackage = "cosmwasm.wasm.v1"; /** StoreCodeProposal gov proposal content type to submit WASM code to the system */ export interface StoreCodeProposal { @@ -19,13 +18,6 @@ export interface StoreCodeProposal { /** InstantiatePermission to apply on contract creation, optional */ instantiatePermission?: AccessConfig; } -export interface ReactiveStoreCodeProposal { - title: ComputedRef; - description: ComputedRef; - runAs: ComputedRef; - wasmByteCode: ComputedRef; - instantiatePermission?: ComputedRef; -} export interface StoreCodeProposalProtoMsg { typeUrl: "/cosmwasm.wasm.v1.StoreCodeProposal"; value: Uint8Array; @@ -60,16 +52,6 @@ export interface InstantiateContractProposal { /** Funds coins that are transferred to the contract on instantiation */ funds: Coin[]; } -export interface ReactiveInstantiateContractProposal { - title: ComputedRef; - description: ComputedRef; - runAs: ComputedRef; - admin: ComputedRef; - codeId: ComputedRef; - label: ComputedRef; - msg: ComputedRef; - funds: ComputedRef; -} export interface InstantiateContractProposalProtoMsg { typeUrl: "/cosmwasm.wasm.v1.InstantiateContractProposal"; value: Uint8Array; @@ -101,13 +83,6 @@ export interface MigrateContractProposal { /** Msg json encoded message to be passed to the contract on migration */ msg: Uint8Array; } -export interface ReactiveMigrateContractProposal { - title: ComputedRef; - description: ComputedRef; - contract: ComputedRef; - codeId: ComputedRef; - msg: ComputedRef; -} export interface MigrateContractProposalProtoMsg { typeUrl: "/cosmwasm.wasm.v1.MigrateContractProposal"; value: Uint8Array; @@ -131,12 +106,6 @@ export interface SudoContractProposal { /** Msg json encoded message to be passed to the contract as sudo */ msg: Uint8Array; } -export interface ReactiveSudoContractProposal { - title: ComputedRef; - description: ComputedRef; - contract: ComputedRef; - msg: ComputedRef; -} export interface SudoContractProposalProtoMsg { typeUrl: "/cosmwasm.wasm.v1.SudoContractProposal"; value: Uint8Array; @@ -166,14 +135,6 @@ export interface ExecuteContractProposal { /** Funds coins that are transferred to the contract on instantiation */ funds: Coin[]; } -export interface ReactiveExecuteContractProposal { - title: ComputedRef; - description: ComputedRef; - runAs: ComputedRef; - contract: ComputedRef; - msg: ComputedRef; - funds: ComputedRef; -} export interface ExecuteContractProposalProtoMsg { typeUrl: "/cosmwasm.wasm.v1.ExecuteContractProposal"; value: Uint8Array; @@ -201,12 +162,6 @@ export interface UpdateAdminProposal { /** Contract is the address of the smart contract */ contract: string; } -export interface ReactiveUpdateAdminProposal { - title: ComputedRef; - description: ComputedRef; - newAdmin: ComputedRef; - contract: ComputedRef; -} export interface UpdateAdminProposalProtoMsg { typeUrl: "/cosmwasm.wasm.v1.UpdateAdminProposal"; value: Uint8Array; @@ -230,11 +185,6 @@ export interface ClearAdminProposal { /** Contract is the address of the smart contract */ contract: string; } -export interface ReactiveClearAdminProposal { - title: ComputedRef; - description: ComputedRef; - contract: ComputedRef; -} export interface ClearAdminProposalProtoMsg { typeUrl: "/cosmwasm.wasm.v1.ClearAdminProposal"; value: Uint8Array; @@ -260,11 +210,6 @@ export interface PinCodesProposal { /** CodeIDs references the new WASM codes */ codeIds: bigint[]; } -export interface ReactivePinCodesProposal { - title: ComputedRef; - description: ComputedRef; - codeIds: ComputedRef; -} export interface PinCodesProposalProtoMsg { typeUrl: "/cosmwasm.wasm.v1.PinCodesProposal"; value: Uint8Array; @@ -290,11 +235,6 @@ export interface UnpinCodesProposal { /** CodeIDs references the WASM codes */ codeIds: bigint[]; } -export interface ReactiveUnpinCodesProposal { - title: ComputedRef; - description: ComputedRef; - codeIds: ComputedRef; -} export interface UnpinCodesProposalProtoMsg { typeUrl: "/cosmwasm.wasm.v1.UnpinCodesProposal"; value: Uint8Array; @@ -320,13 +260,13 @@ function createBaseStoreCodeProposal(): StoreCodeProposal { export const StoreCodeProposal = { typeUrl: "/cosmwasm.wasm.v1.StoreCodeProposal", encode(message: StoreCodeProposal, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.title !== "") { + if (message.title !== undefined) { writer.uint32(10).string(message.title); } - if (message.description !== "") { + if (message.description !== undefined) { writer.uint32(18).string(message.description); } - if (message.runAs !== "") { + if (message.runAs !== undefined) { writer.uint32(26).string(message.runAs); } if (message.wasmByteCode.length !== 0) { @@ -367,13 +307,13 @@ export const StoreCodeProposal = { return message; }, fromJSON(object: any): StoreCodeProposal { - return { - title: isSet(object.title) ? String(object.title) : "", - description: isSet(object.description) ? String(object.description) : "", - runAs: isSet(object.runAs) ? String(object.runAs) : "", - wasmByteCode: isSet(object.wasmByteCode) ? bytesFromBase64(object.wasmByteCode) : new Uint8Array(), - instantiatePermission: isSet(object.instantiatePermission) ? AccessConfig.fromJSON(object.instantiatePermission) : undefined - }; + const obj = createBaseStoreCodeProposal(); + if (isSet(object.title)) obj.title = String(object.title); + if (isSet(object.description)) obj.description = String(object.description); + if (isSet(object.runAs)) obj.runAs = String(object.runAs); + if (isSet(object.wasmByteCode)) obj.wasmByteCode = bytesFromBase64(object.wasmByteCode); + if (isSet(object.instantiatePermission)) obj.instantiatePermission = AccessConfig.fromJSON(object.instantiatePermission); + return obj; }, toJSON(message: StoreCodeProposal): JsonSafe { const obj: any = {}; @@ -390,7 +330,9 @@ export const StoreCodeProposal = { message.description = object.description ?? ""; message.runAs = object.runAs ?? ""; message.wasmByteCode = object.wasmByteCode ?? new Uint8Array(); - message.instantiatePermission = object.instantiatePermission !== undefined && object.instantiatePermission !== null ? AccessConfig.fromPartial(object.instantiatePermission) : undefined; + if (object.instantiatePermission !== undefined && object.instantiatePermission !== null) { + message.instantiatePermission = AccessConfig.fromPartial(object.instantiatePermission); + } return message; }, fromSDK(object: StoreCodeProposalSDKType): StoreCodeProposal { @@ -485,22 +427,22 @@ function createBaseInstantiateContractProposal(): InstantiateContractProposal { export const InstantiateContractProposal = { typeUrl: "/cosmwasm.wasm.v1.InstantiateContractProposal", encode(message: InstantiateContractProposal, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.title !== "") { + if (message.title !== undefined) { writer.uint32(10).string(message.title); } - if (message.description !== "") { + if (message.description !== undefined) { writer.uint32(18).string(message.description); } - if (message.runAs !== "") { + if (message.runAs !== undefined) { writer.uint32(26).string(message.runAs); } - if (message.admin !== "") { + if (message.admin !== undefined) { writer.uint32(34).string(message.admin); } - if (message.codeId !== BigInt(0)) { + if (message.codeId !== undefined) { writer.uint32(40).uint64(message.codeId); } - if (message.label !== "") { + if (message.label !== undefined) { writer.uint32(50).string(message.label); } if (message.msg.length !== 0) { @@ -550,16 +492,16 @@ export const InstantiateContractProposal = { return message; }, fromJSON(object: any): InstantiateContractProposal { - return { - title: isSet(object.title) ? String(object.title) : "", - description: isSet(object.description) ? String(object.description) : "", - runAs: isSet(object.runAs) ? String(object.runAs) : "", - admin: isSet(object.admin) ? String(object.admin) : "", - codeId: isSet(object.codeId) ? BigInt(object.codeId.toString()) : BigInt(0), - label: isSet(object.label) ? String(object.label) : "", - msg: isSet(object.msg) ? bytesFromBase64(object.msg) : new Uint8Array(), - funds: Array.isArray(object?.funds) ? object.funds.map((e: any) => Coin.fromJSON(e)) : [] - }; + const obj = createBaseInstantiateContractProposal(); + if (isSet(object.title)) obj.title = String(object.title); + if (isSet(object.description)) obj.description = String(object.description); + if (isSet(object.runAs)) obj.runAs = String(object.runAs); + if (isSet(object.admin)) obj.admin = String(object.admin); + if (isSet(object.codeId)) obj.codeId = BigInt(object.codeId.toString()); + if (isSet(object.label)) obj.label = String(object.label); + if (isSet(object.msg)) obj.msg = bytesFromBase64(object.msg); + if (Array.isArray(object?.funds)) obj.funds = object.funds.map((e: any) => Coin.fromJSON(e)); + return obj; }, toJSON(message: InstantiateContractProposal): JsonSafe { const obj: any = {}; @@ -583,7 +525,9 @@ export const InstantiateContractProposal = { message.description = object.description ?? ""; message.runAs = object.runAs ?? ""; message.admin = object.admin ?? ""; - message.codeId = object.codeId !== undefined && object.codeId !== null ? BigInt(object.codeId.toString()) : BigInt(0); + if (object.codeId !== undefined && object.codeId !== null) { + message.codeId = BigInt(object.codeId.toString()); + } message.label = object.label ?? ""; message.msg = object.msg ?? new Uint8Array(); message.funds = object.funds?.map(e => Coin.fromPartial(e)) || []; @@ -705,16 +649,16 @@ function createBaseMigrateContractProposal(): MigrateContractProposal { export const MigrateContractProposal = { typeUrl: "/cosmwasm.wasm.v1.MigrateContractProposal", encode(message: MigrateContractProposal, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.title !== "") { + if (message.title !== undefined) { writer.uint32(10).string(message.title); } - if (message.description !== "") { + if (message.description !== undefined) { writer.uint32(18).string(message.description); } - if (message.contract !== "") { + if (message.contract !== undefined) { writer.uint32(34).string(message.contract); } - if (message.codeId !== BigInt(0)) { + if (message.codeId !== undefined) { writer.uint32(40).uint64(message.codeId); } if (message.msg.length !== 0) { @@ -752,13 +696,13 @@ export const MigrateContractProposal = { return message; }, fromJSON(object: any): MigrateContractProposal { - return { - title: isSet(object.title) ? String(object.title) : "", - description: isSet(object.description) ? String(object.description) : "", - contract: isSet(object.contract) ? String(object.contract) : "", - codeId: isSet(object.codeId) ? BigInt(object.codeId.toString()) : BigInt(0), - msg: isSet(object.msg) ? bytesFromBase64(object.msg) : new Uint8Array() - }; + const obj = createBaseMigrateContractProposal(); + if (isSet(object.title)) obj.title = String(object.title); + if (isSet(object.description)) obj.description = String(object.description); + if (isSet(object.contract)) obj.contract = String(object.contract); + if (isSet(object.codeId)) obj.codeId = BigInt(object.codeId.toString()); + if (isSet(object.msg)) obj.msg = bytesFromBase64(object.msg); + return obj; }, toJSON(message: MigrateContractProposal): JsonSafe { const obj: any = {}; @@ -774,7 +718,9 @@ export const MigrateContractProposal = { message.title = object.title ?? ""; message.description = object.description ?? ""; message.contract = object.contract ?? ""; - message.codeId = object.codeId !== undefined && object.codeId !== null ? BigInt(object.codeId.toString()) : BigInt(0); + if (object.codeId !== undefined && object.codeId !== null) { + message.codeId = BigInt(object.codeId.toString()); + } message.msg = object.msg ?? new Uint8Array(); return message; }, @@ -866,13 +812,13 @@ function createBaseSudoContractProposal(): SudoContractProposal { export const SudoContractProposal = { typeUrl: "/cosmwasm.wasm.v1.SudoContractProposal", encode(message: SudoContractProposal, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.title !== "") { + if (message.title !== undefined) { writer.uint32(10).string(message.title); } - if (message.description !== "") { + if (message.description !== undefined) { writer.uint32(18).string(message.description); } - if (message.contract !== "") { + if (message.contract !== undefined) { writer.uint32(26).string(message.contract); } if (message.msg.length !== 0) { @@ -907,12 +853,12 @@ export const SudoContractProposal = { return message; }, fromJSON(object: any): SudoContractProposal { - return { - title: isSet(object.title) ? String(object.title) : "", - description: isSet(object.description) ? String(object.description) : "", - contract: isSet(object.contract) ? String(object.contract) : "", - msg: isSet(object.msg) ? bytesFromBase64(object.msg) : new Uint8Array() - }; + const obj = createBaseSudoContractProposal(); + if (isSet(object.title)) obj.title = String(object.title); + if (isSet(object.description)) obj.description = String(object.description); + if (isSet(object.contract)) obj.contract = String(object.contract); + if (isSet(object.msg)) obj.msg = bytesFromBase64(object.msg); + return obj; }, toJSON(message: SudoContractProposal): JsonSafe { const obj: any = {}; @@ -1013,16 +959,16 @@ function createBaseExecuteContractProposal(): ExecuteContractProposal { export const ExecuteContractProposal = { typeUrl: "/cosmwasm.wasm.v1.ExecuteContractProposal", encode(message: ExecuteContractProposal, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.title !== "") { + if (message.title !== undefined) { writer.uint32(10).string(message.title); } - if (message.description !== "") { + if (message.description !== undefined) { writer.uint32(18).string(message.description); } - if (message.runAs !== "") { + if (message.runAs !== undefined) { writer.uint32(26).string(message.runAs); } - if (message.contract !== "") { + if (message.contract !== undefined) { writer.uint32(34).string(message.contract); } if (message.msg.length !== 0) { @@ -1066,14 +1012,14 @@ export const ExecuteContractProposal = { return message; }, fromJSON(object: any): ExecuteContractProposal { - return { - title: isSet(object.title) ? String(object.title) : "", - description: isSet(object.description) ? String(object.description) : "", - runAs: isSet(object.runAs) ? String(object.runAs) : "", - contract: isSet(object.contract) ? String(object.contract) : "", - msg: isSet(object.msg) ? bytesFromBase64(object.msg) : new Uint8Array(), - funds: Array.isArray(object?.funds) ? object.funds.map((e: any) => Coin.fromJSON(e)) : [] - }; + const obj = createBaseExecuteContractProposal(); + if (isSet(object.title)) obj.title = String(object.title); + if (isSet(object.description)) obj.description = String(object.description); + if (isSet(object.runAs)) obj.runAs = String(object.runAs); + if (isSet(object.contract)) obj.contract = String(object.contract); + if (isSet(object.msg)) obj.msg = bytesFromBase64(object.msg); + if (Array.isArray(object?.funds)) obj.funds = object.funds.map((e: any) => Coin.fromJSON(e)); + return obj; }, toJSON(message: ExecuteContractProposal): JsonSafe { const obj: any = {}; @@ -1200,16 +1146,16 @@ function createBaseUpdateAdminProposal(): UpdateAdminProposal { export const UpdateAdminProposal = { typeUrl: "/cosmwasm.wasm.v1.UpdateAdminProposal", encode(message: UpdateAdminProposal, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.title !== "") { + if (message.title !== undefined) { writer.uint32(10).string(message.title); } - if (message.description !== "") { + if (message.description !== undefined) { writer.uint32(18).string(message.description); } - if (message.newAdmin !== "") { + if (message.newAdmin !== undefined) { writer.uint32(26).string(message.newAdmin); } - if (message.contract !== "") { + if (message.contract !== undefined) { writer.uint32(34).string(message.contract); } return writer; @@ -1241,12 +1187,12 @@ export const UpdateAdminProposal = { return message; }, fromJSON(object: any): UpdateAdminProposal { - return { - title: isSet(object.title) ? String(object.title) : "", - description: isSet(object.description) ? String(object.description) : "", - newAdmin: isSet(object.newAdmin) ? String(object.newAdmin) : "", - contract: isSet(object.contract) ? String(object.contract) : "" - }; + const obj = createBaseUpdateAdminProposal(); + if (isSet(object.title)) obj.title = String(object.title); + if (isSet(object.description)) obj.description = String(object.description); + if (isSet(object.newAdmin)) obj.newAdmin = String(object.newAdmin); + if (isSet(object.contract)) obj.contract = String(object.contract); + return obj; }, toJSON(message: UpdateAdminProposal): JsonSafe { const obj: any = {}; @@ -1344,13 +1290,13 @@ function createBaseClearAdminProposal(): ClearAdminProposal { export const ClearAdminProposal = { typeUrl: "/cosmwasm.wasm.v1.ClearAdminProposal", encode(message: ClearAdminProposal, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.title !== "") { + if (message.title !== undefined) { writer.uint32(10).string(message.title); } - if (message.description !== "") { + if (message.description !== undefined) { writer.uint32(18).string(message.description); } - if (message.contract !== "") { + if (message.contract !== undefined) { writer.uint32(26).string(message.contract); } return writer; @@ -1379,11 +1325,11 @@ export const ClearAdminProposal = { return message; }, fromJSON(object: any): ClearAdminProposal { - return { - title: isSet(object.title) ? String(object.title) : "", - description: isSet(object.description) ? String(object.description) : "", - contract: isSet(object.contract) ? String(object.contract) : "" - }; + const obj = createBaseClearAdminProposal(); + if (isSet(object.title)) obj.title = String(object.title); + if (isSet(object.description)) obj.description = String(object.description); + if (isSet(object.contract)) obj.contract = String(object.contract); + return obj; }, toJSON(message: ClearAdminProposal): JsonSafe { const obj: any = {}; @@ -1472,10 +1418,10 @@ function createBasePinCodesProposal(): PinCodesProposal { export const PinCodesProposal = { typeUrl: "/cosmwasm.wasm.v1.PinCodesProposal", encode(message: PinCodesProposal, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.title !== "") { + if (message.title !== undefined) { writer.uint32(10).string(message.title); } - if (message.description !== "") { + if (message.description !== undefined) { writer.uint32(18).string(message.description); } writer.uint32(26).fork(); @@ -1516,11 +1462,11 @@ export const PinCodesProposal = { return message; }, fromJSON(object: any): PinCodesProposal { - return { - title: isSet(object.title) ? String(object.title) : "", - description: isSet(object.description) ? String(object.description) : "", - codeIds: Array.isArray(object?.codeIds) ? object.codeIds.map((e: any) => BigInt(e.toString())) : [] - }; + const obj = createBasePinCodesProposal(); + if (isSet(object.title)) obj.title = String(object.title); + if (isSet(object.description)) obj.description = String(object.description); + if (Array.isArray(object?.codeIds)) obj.codeIds = object.codeIds.map((e: any) => BigInt(e.toString())); + return obj; }, toJSON(message: PinCodesProposal): JsonSafe { const obj: any = {}; @@ -1619,10 +1565,10 @@ function createBaseUnpinCodesProposal(): UnpinCodesProposal { export const UnpinCodesProposal = { typeUrl: "/cosmwasm.wasm.v1.UnpinCodesProposal", encode(message: UnpinCodesProposal, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.title !== "") { + if (message.title !== undefined) { writer.uint32(10).string(message.title); } - if (message.description !== "") { + if (message.description !== undefined) { writer.uint32(18).string(message.description); } writer.uint32(26).fork(); @@ -1663,11 +1609,11 @@ export const UnpinCodesProposal = { return message; }, fromJSON(object: any): UnpinCodesProposal { - return { - title: isSet(object.title) ? String(object.title) : "", - description: isSet(object.description) ? String(object.description) : "", - codeIds: Array.isArray(object?.codeIds) ? object.codeIds.map((e: any) => BigInt(e.toString())) : [] - }; + const obj = createBaseUnpinCodesProposal(); + if (isSet(object.title)) obj.title = String(object.title); + if (isSet(object.description)) obj.description = String(object.description); + if (Array.isArray(object?.codeIds)) obj.codeIds = object.codeIds.map((e: any) => BigInt(e.toString())); + return obj; }, toJSON(message: UnpinCodesProposal): JsonSafe { const obj: any = {}; diff --git a/__fixtures__/v-next/outputv4/cosmwasm/wasm/v1/query.lcd.ts b/__fixtures__/v-next/outputv4/cosmwasm/wasm/v1/query.lcd.ts index 81951a23ff..1e785ed3fa 100644 --- a/__fixtures__/v-next/outputv4/cosmwasm/wasm/v1/query.lcd.ts +++ b/__fixtures__/v-next/outputv4/cosmwasm/wasm/v1/query.lcd.ts @@ -1,8 +1,8 @@ -import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../../cosmos/base/query/v1beta1/pagination"; -import { ContractInfo, ContractInfoSDKType, ContractCodeHistoryEntry, ContractCodeHistoryEntrySDKType, Model, ModelSDKType } from "./types"; -import { setPaginationParams } from "../../../helpers"; +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../../cosmos/base/query/v1beta1/pagination.js"; +import { ContractInfo, ContractInfoSDKType, ContractCodeHistoryEntry, ContractCodeHistoryEntrySDKType, Model, ModelSDKType } from "./types.js"; +import { setPaginationParams } from "../../../helpers.js"; import { LCDClient } from "@cosmology/lcd"; -import { QueryContractInfoRequest, QueryContractInfoRequestSDKType, QueryContractInfoResponse, QueryContractInfoResponseSDKType, QueryContractHistoryRequest, QueryContractHistoryRequestSDKType, QueryContractHistoryResponse, QueryContractHistoryResponseSDKType, QueryContractsByCodeRequest, QueryContractsByCodeRequestSDKType, QueryContractsByCodeResponse, QueryContractsByCodeResponseSDKType, QueryAllContractStateRequest, QueryAllContractStateRequestSDKType, QueryAllContractStateResponse, QueryAllContractStateResponseSDKType, QueryRawContractStateRequest, QueryRawContractStateRequestSDKType, QueryRawContractStateResponse, QueryRawContractStateResponseSDKType, QuerySmartContractStateRequest, QuerySmartContractStateRequestSDKType, QuerySmartContractStateResponse, QuerySmartContractStateResponseSDKType, QueryCodeRequest, QueryCodeRequestSDKType, QueryCodeResponse, QueryCodeResponseSDKType, QueryCodesRequest, QueryCodesRequestSDKType, QueryCodesResponse, QueryCodesResponseSDKType, QueryPinnedCodesRequest, QueryPinnedCodesRequestSDKType, QueryPinnedCodesResponse, QueryPinnedCodesResponseSDKType } from "./query"; +import { QueryContractInfoRequest, QueryContractInfoRequestSDKType, QueryContractInfoResponse, QueryContractInfoResponseSDKType, QueryContractHistoryRequest, QueryContractHistoryRequestSDKType, QueryContractHistoryResponse, QueryContractHistoryResponseSDKType, QueryContractsByCodeRequest, QueryContractsByCodeRequestSDKType, QueryContractsByCodeResponse, QueryContractsByCodeResponseSDKType, QueryAllContractStateRequest, QueryAllContractStateRequestSDKType, QueryAllContractStateResponse, QueryAllContractStateResponseSDKType, QueryRawContractStateRequest, QueryRawContractStateRequestSDKType, QueryRawContractStateResponse, QueryRawContractStateResponseSDKType, QuerySmartContractStateRequest, QuerySmartContractStateRequestSDKType, QuerySmartContractStateResponse, QuerySmartContractStateResponseSDKType, QueryCodeRequest, QueryCodeRequestSDKType, QueryCodeResponse, QueryCodeResponseSDKType, QueryCodesRequest, QueryCodesRequestSDKType, QueryCodesResponse, QueryCodesResponseSDKType, QueryPinnedCodesRequest, QueryPinnedCodesRequestSDKType, QueryPinnedCodesResponse, QueryPinnedCodesResponseSDKType } from "./query.js"; export class LCDQueryClient { req: LCDClient; constructor({ @@ -76,7 +76,7 @@ export class LCDQueryClient { } /* Codes gets the metadata for all stored wasm codes */ async codes(params: QueryCodesRequest = { - pagination: undefined + pagination: PageRequest.fromPartial({}) }): Promise { const options: any = { params: {} @@ -89,7 +89,7 @@ export class LCDQueryClient { } /* PinnedCodes gets the pinned code ids */ async pinnedCodes(params: QueryPinnedCodesRequest = { - pagination: undefined + pagination: PageRequest.fromPartial({}) }): Promise { const options: any = { params: {} diff --git a/__fixtures__/v-next/outputv4/cosmwasm/wasm/v1/query.rpc.Query.ts b/__fixtures__/v-next/outputv4/cosmwasm/wasm/v1/query.rpc.Query.ts index 5ab4db86c2..69dbaff5bd 100644 --- a/__fixtures__/v-next/outputv4/cosmwasm/wasm/v1/query.rpc.Query.ts +++ b/__fixtures__/v-next/outputv4/cosmwasm/wasm/v1/query.rpc.Query.ts @@ -1,9 +1,9 @@ -import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../../cosmos/base/query/v1beta1/pagination"; -import { ContractInfo, ContractInfoSDKType, ContractCodeHistoryEntry, ContractCodeHistoryEntrySDKType, Model, ModelSDKType } from "./types"; -import { Rpc } from "../../../helpers"; -import { BinaryReader } from "../../../binary"; +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../../cosmos/base/query/v1beta1/pagination.js"; +import { ContractInfo, ContractInfoSDKType, ContractCodeHistoryEntry, ContractCodeHistoryEntrySDKType, Model, ModelSDKType } from "./types.js"; +import { Rpc } from "../../../helpers.js"; +import { BinaryReader } from "../../../binary.js"; import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; -import { QueryContractInfoRequest, QueryContractInfoRequestSDKType, QueryContractInfoResponse, QueryContractInfoResponseSDKType, QueryContractHistoryRequest, QueryContractHistoryRequestSDKType, QueryContractHistoryResponse, QueryContractHistoryResponseSDKType, QueryContractsByCodeRequest, QueryContractsByCodeRequestSDKType, QueryContractsByCodeResponse, QueryContractsByCodeResponseSDKType, QueryAllContractStateRequest, QueryAllContractStateRequestSDKType, QueryAllContractStateResponse, QueryAllContractStateResponseSDKType, QueryRawContractStateRequest, QueryRawContractStateRequestSDKType, QueryRawContractStateResponse, QueryRawContractStateResponseSDKType, QuerySmartContractStateRequest, QuerySmartContractStateRequestSDKType, QuerySmartContractStateResponse, QuerySmartContractStateResponseSDKType, QueryCodeRequest, QueryCodeRequestSDKType, QueryCodeResponse, QueryCodeResponseSDKType, QueryCodesRequest, QueryCodesRequestSDKType, QueryCodesResponse, QueryCodesResponseSDKType, QueryPinnedCodesRequest, QueryPinnedCodesRequestSDKType, QueryPinnedCodesResponse, QueryPinnedCodesResponseSDKType, ReactiveQueryContractInfoRequest, ReactiveQueryContractHistoryRequest, ReactiveQueryContractsByCodeRequest, ReactiveQueryAllContractStateRequest, ReactiveQueryRawContractStateRequest, ReactiveQuerySmartContractStateRequest, ReactiveQueryCodeRequest, ReactiveQueryCodesRequest, ReactiveQueryPinnedCodesRequest } from "./query"; +import { QueryContractInfoRequest, QueryContractInfoRequestSDKType, QueryContractInfoResponse, QueryContractInfoResponseSDKType, QueryContractHistoryRequest, QueryContractHistoryRequestSDKType, QueryContractHistoryResponse, QueryContractHistoryResponseSDKType, QueryContractsByCodeRequest, QueryContractsByCodeRequestSDKType, QueryContractsByCodeResponse, QueryContractsByCodeResponseSDKType, QueryAllContractStateRequest, QueryAllContractStateRequestSDKType, QueryAllContractStateResponse, QueryAllContractStateResponseSDKType, QueryRawContractStateRequest, QueryRawContractStateRequestSDKType, QueryRawContractStateResponse, QueryRawContractStateResponseSDKType, QuerySmartContractStateRequest, QuerySmartContractStateRequestSDKType, QuerySmartContractStateResponse, QuerySmartContractStateResponseSDKType, QueryCodeRequest, QueryCodeRequestSDKType, QueryCodeResponse, QueryCodeResponseSDKType, QueryCodesRequest, QueryCodesRequestSDKType, QueryCodesResponse, QueryCodesResponseSDKType, QueryPinnedCodesRequest, QueryPinnedCodesRequestSDKType, QueryPinnedCodesResponse, QueryPinnedCodesResponseSDKType } from "./query.js"; /** Query provides defines the gRPC querier service */ export interface Query { /** ContractInfo gets the contract meta data */ @@ -75,14 +75,14 @@ export class QueryClientImpl implements Query { return promise.then(data => QueryCodeResponse.decode(new BinaryReader(data))); } codes(request: QueryCodesRequest = { - pagination: undefined + pagination: PageRequest.fromPartial({}) }): Promise { const data = QueryCodesRequest.encode(request).finish(); const promise = this.rpc.request("cosmwasm.wasm.v1.Query", "Codes", data); return promise.then(data => QueryCodesResponse.decode(new BinaryReader(data))); } pinnedCodes(request: QueryPinnedCodesRequest = { - pagination: undefined + pagination: PageRequest.fromPartial({}) }): Promise { const data = QueryPinnedCodesRequest.encode(request).finish(); const promise = this.rpc.request("cosmwasm.wasm.v1.Query", "PinnedCodes", data); diff --git a/__fixtures__/v-next/outputv4/cosmwasm/wasm/v1/query.ts b/__fixtures__/v-next/outputv4/cosmwasm/wasm/v1/query.ts index 7be5ed8169..262e35e445 100644 --- a/__fixtures__/v-next/outputv4/cosmwasm/wasm/v1/query.ts +++ b/__fixtures__/v-next/outputv4/cosmwasm/wasm/v1/query.ts @@ -1,10 +1,9 @@ -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 { JsonSafe } from "../../../json-safe"; +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../../cosmos/base/query/v1beta1/pagination.js"; +import { ContractInfo, ContractInfoSDKType, ContractCodeHistoryEntry, ContractCodeHistoryEntrySDKType, Model, ModelSDKType } from "./types.js"; +import { BinaryReader, BinaryWriter } from "../../../binary.js"; +import { isSet, DeepPartial, bytesFromBase64, base64FromBytes } from "../../../helpers.js"; +import { JsonSafe } from "../../../json-safe.js"; import { toUtf8, fromUtf8 } from "@cosmjs/encoding"; -import { ComputedRef } from "vue"; export const protobufPackage = "cosmwasm.wasm.v1"; /** * QueryContractInfoRequest is the request type for the Query/ContractInfo RPC @@ -14,9 +13,6 @@ export interface QueryContractInfoRequest { /** address is the address of the contract to query */ address: string; } -export interface ReactiveQueryContractInfoRequest { - address: ComputedRef; -} export interface QueryContractInfoRequestProtoMsg { typeUrl: "/cosmwasm.wasm.v1.QueryContractInfoRequest"; value: Uint8Array; @@ -37,10 +33,6 @@ export interface QueryContractInfoResponse { address: string; contractInfo: ContractInfo; } -export interface ReactiveQueryContractInfoResponse { - address: ComputedRef; - contractInfo: ComputedRef; -} export interface QueryContractInfoResponseProtoMsg { typeUrl: "/cosmwasm.wasm.v1.QueryContractInfoResponse"; value: Uint8Array; @@ -63,10 +55,6 @@ export interface QueryContractHistoryRequest { /** pagination defines an optional pagination for the request. */ pagination?: PageRequest; } -export interface ReactiveQueryContractHistoryRequest { - address: ComputedRef; - pagination?: ComputedRef; -} export interface QueryContractHistoryRequestProtoMsg { typeUrl: "/cosmwasm.wasm.v1.QueryContractHistoryRequest"; value: Uint8Array; @@ -88,10 +76,6 @@ export interface QueryContractHistoryResponse { /** pagination defines the pagination in the response. */ pagination?: PageResponse; } -export interface ReactiveQueryContractHistoryResponse { - entries: ComputedRef; - pagination?: ComputedRef; -} export interface QueryContractHistoryResponseProtoMsg { typeUrl: "/cosmwasm.wasm.v1.QueryContractHistoryResponse"; value: Uint8Array; @@ -114,10 +98,6 @@ export interface QueryContractsByCodeRequest { /** pagination defines an optional pagination for the request. */ pagination?: PageRequest; } -export interface ReactiveQueryContractsByCodeRequest { - codeId: ComputedRef; - pagination?: ComputedRef; -} export interface QueryContractsByCodeRequestProtoMsg { typeUrl: "/cosmwasm.wasm.v1.QueryContractsByCodeRequest"; value: Uint8Array; @@ -140,10 +120,6 @@ export interface QueryContractsByCodeResponse { /** pagination defines the pagination in the response. */ pagination?: PageResponse; } -export interface ReactiveQueryContractsByCodeResponse { - contracts: ComputedRef; - pagination?: ComputedRef; -} export interface QueryContractsByCodeResponseProtoMsg { typeUrl: "/cosmwasm.wasm.v1.QueryContractsByCodeResponse"; value: Uint8Array; @@ -166,10 +142,6 @@ export interface QueryAllContractStateRequest { /** pagination defines an optional pagination for the request. */ pagination?: PageRequest; } -export interface ReactiveQueryAllContractStateRequest { - address: ComputedRef; - pagination?: ComputedRef; -} export interface QueryAllContractStateRequestProtoMsg { typeUrl: "/cosmwasm.wasm.v1.QueryAllContractStateRequest"; value: Uint8Array; @@ -191,10 +163,6 @@ export interface QueryAllContractStateResponse { /** pagination defines the pagination in the response. */ pagination?: PageResponse; } -export interface ReactiveQueryAllContractStateResponse { - models: ComputedRef; - pagination?: ComputedRef; -} export interface QueryAllContractStateResponseProtoMsg { typeUrl: "/cosmwasm.wasm.v1.QueryAllContractStateResponse"; value: Uint8Array; @@ -216,10 +184,6 @@ export interface QueryRawContractStateRequest { address: string; queryData: Uint8Array; } -export interface ReactiveQueryRawContractStateRequest { - address: ComputedRef; - queryData: ComputedRef; -} export interface QueryRawContractStateRequestProtoMsg { typeUrl: "/cosmwasm.wasm.v1.QueryRawContractStateRequest"; value: Uint8Array; @@ -240,9 +204,6 @@ export interface QueryRawContractStateResponse { /** Data contains the raw store data */ data: Uint8Array; } -export interface ReactiveQueryRawContractStateResponse { - data: ComputedRef; -} export interface QueryRawContractStateResponseProtoMsg { typeUrl: "/cosmwasm.wasm.v1.QueryRawContractStateResponse"; value: Uint8Array; @@ -264,10 +225,6 @@ export interface QuerySmartContractStateRequest { /** QueryData contains the query data passed to the contract */ queryData: Uint8Array; } -export interface ReactiveQuerySmartContractStateRequest { - address: ComputedRef; - queryData: ComputedRef; -} export interface QuerySmartContractStateRequestProtoMsg { typeUrl: "/cosmwasm.wasm.v1.QuerySmartContractStateRequest"; value: Uint8Array; @@ -288,9 +245,6 @@ export interface QuerySmartContractStateResponse { /** Data contains the json data returned from the smart contract */ data: Uint8Array; } -export interface ReactiveQuerySmartContractStateResponse { - data: ComputedRef; -} export interface QuerySmartContractStateResponseProtoMsg { typeUrl: "/cosmwasm.wasm.v1.QuerySmartContractStateResponse"; value: Uint8Array; @@ -307,9 +261,6 @@ export interface QueryCodeRequest { /** grpc-gateway_out does not support Go style CodID */ codeId: bigint; } -export interface ReactiveQueryCodeRequest { - codeId: ComputedRef; -} export interface QueryCodeRequestProtoMsg { typeUrl: "/cosmwasm.wasm.v1.QueryCodeRequest"; value: Uint8Array; @@ -324,11 +275,6 @@ export interface CodeInfoResponse { creator: string; dataHash: Uint8Array; } -export interface ReactiveCodeInfoResponse { - codeId: ComputedRef; - creator: ComputedRef; - dataHash: ComputedRef; -} export interface CodeInfoResponseProtoMsg { typeUrl: "/cosmwasm.wasm.v1.CodeInfoResponse"; value: Uint8Array; @@ -344,10 +290,6 @@ export interface QueryCodeResponse { codeInfo?: CodeInfoResponse; data: Uint8Array; } -export interface ReactiveQueryCodeResponse { - codeInfo?: ComputedRef; - data: ComputedRef; -} export interface QueryCodeResponseProtoMsg { typeUrl: "/cosmwasm.wasm.v1.QueryCodeResponse"; value: Uint8Array; @@ -362,9 +304,6 @@ export interface QueryCodesRequest { /** pagination defines an optional pagination for the request. */ pagination?: PageRequest; } -export interface ReactiveQueryCodesRequest { - pagination?: ComputedRef; -} export interface QueryCodesRequestProtoMsg { typeUrl: "/cosmwasm.wasm.v1.QueryCodesRequest"; value: Uint8Array; @@ -379,10 +318,6 @@ export interface QueryCodesResponse { /** pagination defines the pagination in the response. */ pagination?: PageResponse; } -export interface ReactiveQueryCodesResponse { - codeInfos: ComputedRef; - pagination?: ComputedRef; -} export interface QueryCodesResponseProtoMsg { typeUrl: "/cosmwasm.wasm.v1.QueryCodesResponse"; value: Uint8Array; @@ -400,9 +335,6 @@ export interface QueryPinnedCodesRequest { /** pagination defines an optional pagination for the request. */ pagination?: PageRequest; } -export interface ReactiveQueryPinnedCodesRequest { - pagination?: ComputedRef; -} export interface QueryPinnedCodesRequestProtoMsg { typeUrl: "/cosmwasm.wasm.v1.QueryPinnedCodesRequest"; value: Uint8Array; @@ -423,10 +355,6 @@ export interface QueryPinnedCodesResponse { /** pagination defines the pagination in the response. */ pagination?: PageResponse; } -export interface ReactiveQueryPinnedCodesResponse { - codeIds: ComputedRef; - pagination?: ComputedRef; -} export interface QueryPinnedCodesResponseProtoMsg { typeUrl: "/cosmwasm.wasm.v1.QueryPinnedCodesResponse"; value: Uint8Array; @@ -447,7 +375,7 @@ function createBaseQueryContractInfoRequest(): QueryContractInfoRequest { export const QueryContractInfoRequest = { typeUrl: "/cosmwasm.wasm.v1.QueryContractInfoRequest", encode(message: QueryContractInfoRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.address !== "") { + if (message.address !== undefined) { writer.uint32(10).string(message.address); } return writer; @@ -470,9 +398,9 @@ export const QueryContractInfoRequest = { return message; }, fromJSON(object: any): QueryContractInfoRequest { - return { - address: isSet(object.address) ? String(object.address) : "" - }; + const obj = createBaseQueryContractInfoRequest(); + if (isSet(object.address)) obj.address = String(object.address); + return obj; }, toJSON(message: QueryContractInfoRequest): JsonSafe { const obj: any = {}; @@ -542,7 +470,7 @@ function createBaseQueryContractInfoResponse(): QueryContractInfoResponse { export const QueryContractInfoResponse = { typeUrl: "/cosmwasm.wasm.v1.QueryContractInfoResponse", encode(message: QueryContractInfoResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.address !== "") { + if (message.address !== undefined) { writer.uint32(10).string(message.address); } if (message.contractInfo !== undefined) { @@ -571,10 +499,10 @@ export const QueryContractInfoResponse = { return message; }, fromJSON(object: any): QueryContractInfoResponse { - return { - address: isSet(object.address) ? String(object.address) : "", - contractInfo: isSet(object.contractInfo) ? ContractInfo.fromJSON(object.contractInfo) : undefined - }; + const obj = createBaseQueryContractInfoResponse(); + if (isSet(object.address)) obj.address = String(object.address); + if (isSet(object.contractInfo)) obj.contractInfo = ContractInfo.fromJSON(object.contractInfo); + return obj; }, toJSON(message: QueryContractInfoResponse): JsonSafe { const obj: any = {}; @@ -585,7 +513,9 @@ export const QueryContractInfoResponse = { fromPartial(object: DeepPartial): QueryContractInfoResponse { const message = createBaseQueryContractInfoResponse(); message.address = object.address ?? ""; - message.contractInfo = object.contractInfo !== undefined && object.contractInfo !== null ? ContractInfo.fromPartial(object.contractInfo) : undefined; + if (object.contractInfo !== undefined && object.contractInfo !== null) { + message.contractInfo = ContractInfo.fromPartial(object.contractInfo); + } return message; }, fromSDK(object: QueryContractInfoResponseSDKType): QueryContractInfoResponse { @@ -653,7 +583,7 @@ function createBaseQueryContractHistoryRequest(): QueryContractHistoryRequest { export const QueryContractHistoryRequest = { typeUrl: "/cosmwasm.wasm.v1.QueryContractHistoryRequest", encode(message: QueryContractHistoryRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.address !== "") { + if (message.address !== undefined) { writer.uint32(10).string(message.address); } if (message.pagination !== undefined) { @@ -682,10 +612,10 @@ export const QueryContractHistoryRequest = { return message; }, fromJSON(object: any): QueryContractHistoryRequest { - return { - address: isSet(object.address) ? String(object.address) : "", - pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined - }; + const obj = createBaseQueryContractHistoryRequest(); + if (isSet(object.address)) obj.address = String(object.address); + if (isSet(object.pagination)) obj.pagination = PageRequest.fromJSON(object.pagination); + return obj; }, toJSON(message: QueryContractHistoryRequest): JsonSafe { const obj: any = {}; @@ -696,7 +626,9 @@ export const QueryContractHistoryRequest = { fromPartial(object: DeepPartial): QueryContractHistoryRequest { const message = createBaseQueryContractHistoryRequest(); message.address = object.address ?? ""; - message.pagination = object.pagination !== undefined && object.pagination !== null ? PageRequest.fromPartial(object.pagination) : undefined; + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageRequest.fromPartial(object.pagination); + } return message; }, fromSDK(object: QueryContractHistoryRequestSDKType): QueryContractHistoryRequest { @@ -793,10 +725,10 @@ export const QueryContractHistoryResponse = { return message; }, fromJSON(object: any): QueryContractHistoryResponse { - return { - entries: Array.isArray(object?.entries) ? object.entries.map((e: any) => ContractCodeHistoryEntry.fromJSON(e)) : [], - pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined - }; + const obj = createBaseQueryContractHistoryResponse(); + if (Array.isArray(object?.entries)) obj.entries = object.entries.map((e: any) => ContractCodeHistoryEntry.fromJSON(e)); + if (isSet(object.pagination)) obj.pagination = PageResponse.fromJSON(object.pagination); + return obj; }, toJSON(message: QueryContractHistoryResponse): JsonSafe { const obj: any = {}; @@ -811,7 +743,9 @@ export const QueryContractHistoryResponse = { fromPartial(object: DeepPartial): QueryContractHistoryResponse { const message = createBaseQueryContractHistoryResponse(); message.entries = object.entries?.map(e => ContractCodeHistoryEntry.fromPartial(e)) || []; - message.pagination = object.pagination !== undefined && object.pagination !== null ? PageResponse.fromPartial(object.pagination) : undefined; + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageResponse.fromPartial(object.pagination); + } return message; }, fromSDK(object: QueryContractHistoryResponseSDKType): QueryContractHistoryResponse { @@ -885,7 +819,7 @@ function createBaseQueryContractsByCodeRequest(): QueryContractsByCodeRequest { export const QueryContractsByCodeRequest = { typeUrl: "/cosmwasm.wasm.v1.QueryContractsByCodeRequest", encode(message: QueryContractsByCodeRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.codeId !== BigInt(0)) { + if (message.codeId !== undefined) { writer.uint32(8).uint64(message.codeId); } if (message.pagination !== undefined) { @@ -914,10 +848,10 @@ export const QueryContractsByCodeRequest = { return message; }, fromJSON(object: any): QueryContractsByCodeRequest { - return { - codeId: isSet(object.codeId) ? BigInt(object.codeId.toString()) : BigInt(0), - pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined - }; + const obj = createBaseQueryContractsByCodeRequest(); + if (isSet(object.codeId)) obj.codeId = BigInt(object.codeId.toString()); + if (isSet(object.pagination)) obj.pagination = PageRequest.fromJSON(object.pagination); + return obj; }, toJSON(message: QueryContractsByCodeRequest): JsonSafe { const obj: any = {}; @@ -927,8 +861,12 @@ export const QueryContractsByCodeRequest = { }, fromPartial(object: DeepPartial): QueryContractsByCodeRequest { const message = createBaseQueryContractsByCodeRequest(); - message.codeId = object.codeId !== undefined && object.codeId !== null ? BigInt(object.codeId.toString()) : BigInt(0); - message.pagination = object.pagination !== undefined && object.pagination !== null ? PageRequest.fromPartial(object.pagination) : undefined; + if (object.codeId !== undefined && object.codeId !== null) { + message.codeId = BigInt(object.codeId.toString()); + } + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageRequest.fromPartial(object.pagination); + } return message; }, fromSDK(object: QueryContractsByCodeRequestSDKType): QueryContractsByCodeRequest { @@ -1025,10 +963,10 @@ export const QueryContractsByCodeResponse = { return message; }, fromJSON(object: any): QueryContractsByCodeResponse { - return { - contracts: Array.isArray(object?.contracts) ? object.contracts.map((e: any) => String(e)) : [], - pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined - }; + const obj = createBaseQueryContractsByCodeResponse(); + if (Array.isArray(object?.contracts)) obj.contracts = object.contracts.map((e: any) => String(e)); + if (isSet(object.pagination)) obj.pagination = PageResponse.fromJSON(object.pagination); + return obj; }, toJSON(message: QueryContractsByCodeResponse): JsonSafe { const obj: any = {}; @@ -1043,7 +981,9 @@ export const QueryContractsByCodeResponse = { fromPartial(object: DeepPartial): QueryContractsByCodeResponse { const message = createBaseQueryContractsByCodeResponse(); message.contracts = object.contracts?.map(e => e) || []; - message.pagination = object.pagination !== undefined && object.pagination !== null ? PageResponse.fromPartial(object.pagination) : undefined; + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageResponse.fromPartial(object.pagination); + } return message; }, fromSDK(object: QueryContractsByCodeResponseSDKType): QueryContractsByCodeResponse { @@ -1117,7 +1057,7 @@ function createBaseQueryAllContractStateRequest(): QueryAllContractStateRequest export const QueryAllContractStateRequest = { typeUrl: "/cosmwasm.wasm.v1.QueryAllContractStateRequest", encode(message: QueryAllContractStateRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.address !== "") { + if (message.address !== undefined) { writer.uint32(10).string(message.address); } if (message.pagination !== undefined) { @@ -1146,10 +1086,10 @@ export const QueryAllContractStateRequest = { return message; }, fromJSON(object: any): QueryAllContractStateRequest { - return { - address: isSet(object.address) ? String(object.address) : "", - pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined - }; + const obj = createBaseQueryAllContractStateRequest(); + if (isSet(object.address)) obj.address = String(object.address); + if (isSet(object.pagination)) obj.pagination = PageRequest.fromJSON(object.pagination); + return obj; }, toJSON(message: QueryAllContractStateRequest): JsonSafe { const obj: any = {}; @@ -1160,7 +1100,9 @@ export const QueryAllContractStateRequest = { fromPartial(object: DeepPartial): QueryAllContractStateRequest { const message = createBaseQueryAllContractStateRequest(); message.address = object.address ?? ""; - message.pagination = object.pagination !== undefined && object.pagination !== null ? PageRequest.fromPartial(object.pagination) : undefined; + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageRequest.fromPartial(object.pagination); + } return message; }, fromSDK(object: QueryAllContractStateRequestSDKType): QueryAllContractStateRequest { @@ -1257,10 +1199,10 @@ export const QueryAllContractStateResponse = { return message; }, fromJSON(object: any): QueryAllContractStateResponse { - return { - models: Array.isArray(object?.models) ? object.models.map((e: any) => Model.fromJSON(e)) : [], - pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined - }; + const obj = createBaseQueryAllContractStateResponse(); + if (Array.isArray(object?.models)) obj.models = object.models.map((e: any) => Model.fromJSON(e)); + if (isSet(object.pagination)) obj.pagination = PageResponse.fromJSON(object.pagination); + return obj; }, toJSON(message: QueryAllContractStateResponse): JsonSafe { const obj: any = {}; @@ -1275,7 +1217,9 @@ export const QueryAllContractStateResponse = { fromPartial(object: DeepPartial): QueryAllContractStateResponse { const message = createBaseQueryAllContractStateResponse(); message.models = object.models?.map(e => Model.fromPartial(e)) || []; - message.pagination = object.pagination !== undefined && object.pagination !== null ? PageResponse.fromPartial(object.pagination) : undefined; + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageResponse.fromPartial(object.pagination); + } return message; }, fromSDK(object: QueryAllContractStateResponseSDKType): QueryAllContractStateResponse { @@ -1349,7 +1293,7 @@ function createBaseQueryRawContractStateRequest(): QueryRawContractStateRequest export const QueryRawContractStateRequest = { typeUrl: "/cosmwasm.wasm.v1.QueryRawContractStateRequest", encode(message: QueryRawContractStateRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.address !== "") { + if (message.address !== undefined) { writer.uint32(10).string(message.address); } if (message.queryData.length !== 0) { @@ -1378,10 +1322,10 @@ export const QueryRawContractStateRequest = { return message; }, fromJSON(object: any): QueryRawContractStateRequest { - return { - address: isSet(object.address) ? String(object.address) : "", - queryData: isSet(object.queryData) ? bytesFromBase64(object.queryData) : new Uint8Array() - }; + const obj = createBaseQueryRawContractStateRequest(); + if (isSet(object.address)) obj.address = String(object.address); + if (isSet(object.queryData)) obj.queryData = bytesFromBase64(object.queryData); + return obj; }, toJSON(message: QueryRawContractStateRequest): JsonSafe { const obj: any = {}; @@ -1482,9 +1426,9 @@ export const QueryRawContractStateResponse = { return message; }, fromJSON(object: any): QueryRawContractStateResponse { - return { - data: isSet(object.data) ? bytesFromBase64(object.data) : new Uint8Array() - }; + const obj = createBaseQueryRawContractStateResponse(); + if (isSet(object.data)) obj.data = bytesFromBase64(object.data); + return obj; }, toJSON(message: QueryRawContractStateResponse): JsonSafe { const obj: any = {}; @@ -1554,7 +1498,7 @@ function createBaseQuerySmartContractStateRequest(): QuerySmartContractStateRequ export const QuerySmartContractStateRequest = { typeUrl: "/cosmwasm.wasm.v1.QuerySmartContractStateRequest", encode(message: QuerySmartContractStateRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.address !== "") { + if (message.address !== undefined) { writer.uint32(10).string(message.address); } if (message.queryData.length !== 0) { @@ -1583,10 +1527,10 @@ export const QuerySmartContractStateRequest = { return message; }, fromJSON(object: any): QuerySmartContractStateRequest { - return { - address: isSet(object.address) ? String(object.address) : "", - queryData: isSet(object.queryData) ? bytesFromBase64(object.queryData) : new Uint8Array() - }; + const obj = createBaseQuerySmartContractStateRequest(); + if (isSet(object.address)) obj.address = String(object.address); + if (isSet(object.queryData)) obj.queryData = bytesFromBase64(object.queryData); + return obj; }, toJSON(message: QuerySmartContractStateRequest): JsonSafe { const obj: any = {}; @@ -1687,9 +1631,9 @@ export const QuerySmartContractStateResponse = { return message; }, fromJSON(object: any): QuerySmartContractStateResponse { - return { - data: isSet(object.data) ? bytesFromBase64(object.data) : new Uint8Array() - }; + const obj = createBaseQuerySmartContractStateResponse(); + if (isSet(object.data)) obj.data = bytesFromBase64(object.data); + return obj; }, toJSON(message: QuerySmartContractStateResponse): JsonSafe { const obj: any = {}; @@ -1758,7 +1702,7 @@ function createBaseQueryCodeRequest(): QueryCodeRequest { export const QueryCodeRequest = { typeUrl: "/cosmwasm.wasm.v1.QueryCodeRequest", encode(message: QueryCodeRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.codeId !== BigInt(0)) { + if (message.codeId !== undefined) { writer.uint32(8).uint64(message.codeId); } return writer; @@ -1781,9 +1725,9 @@ export const QueryCodeRequest = { return message; }, fromJSON(object: any): QueryCodeRequest { - return { - codeId: isSet(object.codeId) ? BigInt(object.codeId.toString()) : BigInt(0) - }; + const obj = createBaseQueryCodeRequest(); + if (isSet(object.codeId)) obj.codeId = BigInt(object.codeId.toString()); + return obj; }, toJSON(message: QueryCodeRequest): JsonSafe { const obj: any = {}; @@ -1792,7 +1736,9 @@ export const QueryCodeRequest = { }, fromPartial(object: DeepPartial): QueryCodeRequest { const message = createBaseQueryCodeRequest(); - message.codeId = object.codeId !== undefined && object.codeId !== null ? BigInt(object.codeId.toString()) : BigInt(0); + if (object.codeId !== undefined && object.codeId !== null) { + message.codeId = BigInt(object.codeId.toString()); + } return message; }, fromSDK(object: QueryCodeRequestSDKType): QueryCodeRequest { @@ -1854,10 +1800,10 @@ function createBaseCodeInfoResponse(): CodeInfoResponse { export const CodeInfoResponse = { typeUrl: "/cosmwasm.wasm.v1.CodeInfoResponse", encode(message: CodeInfoResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.codeId !== BigInt(0)) { + if (message.codeId !== undefined) { writer.uint32(8).uint64(message.codeId); } - if (message.creator !== "") { + if (message.creator !== undefined) { writer.uint32(18).string(message.creator); } if (message.dataHash.length !== 0) { @@ -1889,11 +1835,11 @@ export const CodeInfoResponse = { return message; }, fromJSON(object: any): CodeInfoResponse { - return { - codeId: isSet(object.codeId) ? BigInt(object.codeId.toString()) : BigInt(0), - creator: isSet(object.creator) ? String(object.creator) : "", - dataHash: isSet(object.dataHash) ? bytesFromBase64(object.dataHash) : new Uint8Array() - }; + const obj = createBaseCodeInfoResponse(); + if (isSet(object.codeId)) obj.codeId = BigInt(object.codeId.toString()); + if (isSet(object.creator)) obj.creator = String(object.creator); + if (isSet(object.dataHash)) obj.dataHash = bytesFromBase64(object.dataHash); + return obj; }, toJSON(message: CodeInfoResponse): JsonSafe { const obj: any = {}; @@ -1904,7 +1850,9 @@ export const CodeInfoResponse = { }, fromPartial(object: DeepPartial): CodeInfoResponse { const message = createBaseCodeInfoResponse(); - message.codeId = object.codeId !== undefined && object.codeId !== null ? BigInt(object.codeId.toString()) : BigInt(0); + if (object.codeId !== undefined && object.codeId !== null) { + message.codeId = BigInt(object.codeId.toString()); + } message.creator = object.creator ?? ""; message.dataHash = object.dataHash ?? new Uint8Array(); return message; @@ -2010,10 +1958,10 @@ export const QueryCodeResponse = { return message; }, fromJSON(object: any): QueryCodeResponse { - return { - codeInfo: isSet(object.codeInfo) ? CodeInfoResponse.fromJSON(object.codeInfo) : undefined, - data: isSet(object.data) ? bytesFromBase64(object.data) : new Uint8Array() - }; + const obj = createBaseQueryCodeResponse(); + if (isSet(object.codeInfo)) obj.codeInfo = CodeInfoResponse.fromJSON(object.codeInfo); + if (isSet(object.data)) obj.data = bytesFromBase64(object.data); + return obj; }, toJSON(message: QueryCodeResponse): JsonSafe { const obj: any = {}; @@ -2023,7 +1971,9 @@ export const QueryCodeResponse = { }, fromPartial(object: DeepPartial): QueryCodeResponse { const message = createBaseQueryCodeResponse(); - message.codeInfo = object.codeInfo !== undefined && object.codeInfo !== null ? CodeInfoResponse.fromPartial(object.codeInfo) : undefined; + if (object.codeInfo !== undefined && object.codeInfo !== null) { + message.codeInfo = CodeInfoResponse.fromPartial(object.codeInfo); + } message.data = object.data ?? new Uint8Array(); return message; }, @@ -2114,9 +2064,9 @@ export const QueryCodesRequest = { return message; }, fromJSON(object: any): QueryCodesRequest { - return { - pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined - }; + const obj = createBaseQueryCodesRequest(); + if (isSet(object.pagination)) obj.pagination = PageRequest.fromJSON(object.pagination); + return obj; }, toJSON(message: QueryCodesRequest): JsonSafe { const obj: any = {}; @@ -2125,7 +2075,9 @@ export const QueryCodesRequest = { }, fromPartial(object: DeepPartial): QueryCodesRequest { const message = createBaseQueryCodesRequest(); - message.pagination = object.pagination !== undefined && object.pagination !== null ? PageRequest.fromPartial(object.pagination) : undefined; + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageRequest.fromPartial(object.pagination); + } return message; }, fromSDK(object: QueryCodesRequestSDKType): QueryCodesRequest { @@ -2215,10 +2167,10 @@ export const QueryCodesResponse = { return message; }, fromJSON(object: any): QueryCodesResponse { - return { - codeInfos: Array.isArray(object?.codeInfos) ? object.codeInfos.map((e: any) => CodeInfoResponse.fromJSON(e)) : [], - pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined - }; + const obj = createBaseQueryCodesResponse(); + if (Array.isArray(object?.codeInfos)) obj.codeInfos = object.codeInfos.map((e: any) => CodeInfoResponse.fromJSON(e)); + if (isSet(object.pagination)) obj.pagination = PageResponse.fromJSON(object.pagination); + return obj; }, toJSON(message: QueryCodesResponse): JsonSafe { const obj: any = {}; @@ -2233,7 +2185,9 @@ export const QueryCodesResponse = { fromPartial(object: DeepPartial): QueryCodesResponse { const message = createBaseQueryCodesResponse(); message.codeInfos = object.codeInfos?.map(e => CodeInfoResponse.fromPartial(e)) || []; - message.pagination = object.pagination !== undefined && object.pagination !== null ? PageResponse.fromPartial(object.pagination) : undefined; + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageResponse.fromPartial(object.pagination); + } return message; }, fromSDK(object: QueryCodesResponseSDKType): QueryCodesResponse { @@ -2329,9 +2283,9 @@ export const QueryPinnedCodesRequest = { return message; }, fromJSON(object: any): QueryPinnedCodesRequest { - return { - pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined - }; + const obj = createBaseQueryPinnedCodesRequest(); + if (isSet(object.pagination)) obj.pagination = PageRequest.fromJSON(object.pagination); + return obj; }, toJSON(message: QueryPinnedCodesRequest): JsonSafe { const obj: any = {}; @@ -2340,7 +2294,9 @@ export const QueryPinnedCodesRequest = { }, fromPartial(object: DeepPartial): QueryPinnedCodesRequest { const message = createBaseQueryPinnedCodesRequest(); - message.pagination = object.pagination !== undefined && object.pagination !== null ? PageRequest.fromPartial(object.pagination) : undefined; + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageRequest.fromPartial(object.pagination); + } return message; }, fromSDK(object: QueryPinnedCodesRequestSDKType): QueryPinnedCodesRequest { @@ -2439,10 +2395,10 @@ export const QueryPinnedCodesResponse = { return message; }, fromJSON(object: any): QueryPinnedCodesResponse { - return { - codeIds: Array.isArray(object?.codeIds) ? object.codeIds.map((e: any) => BigInt(e.toString())) : [], - pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined - }; + const obj = createBaseQueryPinnedCodesResponse(); + if (Array.isArray(object?.codeIds)) obj.codeIds = object.codeIds.map((e: any) => BigInt(e.toString())); + if (isSet(object.pagination)) obj.pagination = PageResponse.fromJSON(object.pagination); + return obj; }, toJSON(message: QueryPinnedCodesResponse): JsonSafe { const obj: any = {}; @@ -2457,7 +2413,9 @@ export const QueryPinnedCodesResponse = { fromPartial(object: DeepPartial): QueryPinnedCodesResponse { const message = createBaseQueryPinnedCodesResponse(); message.codeIds = object.codeIds?.map(e => BigInt(e.toString())) || []; - message.pagination = object.pagination !== undefined && object.pagination !== null ? PageResponse.fromPartial(object.pagination) : undefined; + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageResponse.fromPartial(object.pagination); + } return message; }, fromSDK(object: QueryPinnedCodesResponseSDKType): QueryPinnedCodesResponse { 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..0cde59f330 100644 --- a/__fixtures__/v-next/outputv4/cosmwasm/wasm/v1/tx.amino.ts +++ b/__fixtures__/v-next/outputv4/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 { AccessConfig, AccessConfigSDKType, accessTypeFromJSON } from "./types.js"; +import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin.js"; import { AminoMsg } from "@cosmjs/amino"; import { toBase64, fromBase64, fromUtf8, toUtf8 } from "@cosmjs/encoding"; -import { MsgStoreCode, MsgStoreCodeSDKType, MsgInstantiateContract, MsgInstantiateContractSDKType, MsgExecuteContract, MsgExecuteContractSDKType, MsgMigrateContract, MsgMigrateContractSDKType, MsgUpdateAdmin, MsgUpdateAdminSDKType, MsgClearAdmin, MsgClearAdminSDKType } from "./tx"; +import { MsgStoreCode, MsgStoreCodeSDKType, MsgInstantiateContract, MsgInstantiateContractSDKType, MsgExecuteContract, MsgExecuteContractSDKType, MsgMigrateContract, MsgMigrateContractSDKType, MsgUpdateAdmin, MsgUpdateAdminSDKType, MsgClearAdmin, MsgClearAdminSDKType } from "./tx.js"; export interface MsgStoreCodeAminoType extends AminoMsg { type: "wasm/MsgStoreCode"; value: { diff --git a/__fixtures__/v-next/outputv4/cosmwasm/wasm/v1/tx.registry.ts b/__fixtures__/v-next/outputv4/cosmwasm/wasm/v1/tx.registry.ts index f5f468179a..894e6816c5 100644 --- a/__fixtures__/v-next/outputv4/cosmwasm/wasm/v1/tx.registry.ts +++ b/__fixtures__/v-next/outputv4/cosmwasm/wasm/v1/tx.registry.ts @@ -1,7 +1,7 @@ -import { AccessConfig, AccessConfigSDKType } from "./types"; -import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; +import { AccessConfig, AccessConfigSDKType } from "./types.js"; +import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin.js"; import { GeneratedType, Registry } from "@cosmjs/proto-signing"; -import { MsgStoreCode, MsgStoreCodeSDKType, MsgInstantiateContract, MsgInstantiateContractSDKType, MsgExecuteContract, MsgExecuteContractSDKType, MsgMigrateContract, MsgMigrateContractSDKType, MsgUpdateAdmin, MsgUpdateAdminSDKType, MsgClearAdmin, MsgClearAdminSDKType } from "./tx"; +import { MsgStoreCode, MsgStoreCodeSDKType, MsgInstantiateContract, MsgInstantiateContractSDKType, MsgExecuteContract, MsgExecuteContractSDKType, MsgMigrateContract, MsgMigrateContractSDKType, MsgUpdateAdmin, MsgUpdateAdminSDKType, MsgClearAdmin, MsgClearAdminSDKType } from "./tx.js"; export const registry: ReadonlyArray<[string, GeneratedType]> = [["/cosmwasm.wasm.v1.MsgStoreCode", MsgStoreCode], ["/cosmwasm.wasm.v1.MsgInstantiateContract", MsgInstantiateContract], ["/cosmwasm.wasm.v1.MsgExecuteContract", MsgExecuteContract], ["/cosmwasm.wasm.v1.MsgMigrateContract", MsgMigrateContract], ["/cosmwasm.wasm.v1.MsgUpdateAdmin", MsgUpdateAdmin], ["/cosmwasm.wasm.v1.MsgClearAdmin", MsgClearAdmin]]; export const load = (protoRegistry: Registry) => { registry.forEach(([typeUrl, mod]) => { diff --git a/__fixtures__/v-next/outputv4/cosmwasm/wasm/v1/tx.rpc.msg.ts b/__fixtures__/v-next/outputv4/cosmwasm/wasm/v1/tx.rpc.msg.ts index 9ac6092cc2..e38afee945 100644 --- a/__fixtures__/v-next/outputv4/cosmwasm/wasm/v1/tx.rpc.msg.ts +++ b/__fixtures__/v-next/outputv4/cosmwasm/wasm/v1/tx.rpc.msg.ts @@ -1,8 +1,8 @@ -import { AccessConfig, AccessConfigSDKType } from "./types"; -import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; -import { Rpc } from "../../../helpers"; -import { BinaryReader } from "../../../binary"; -import { MsgStoreCode, MsgStoreCodeSDKType, MsgStoreCodeResponse, MsgStoreCodeResponseSDKType, MsgInstantiateContract, MsgInstantiateContractSDKType, MsgInstantiateContractResponse, MsgInstantiateContractResponseSDKType, MsgExecuteContract, MsgExecuteContractSDKType, MsgExecuteContractResponse, MsgExecuteContractResponseSDKType, MsgMigrateContract, MsgMigrateContractSDKType, MsgMigrateContractResponse, MsgMigrateContractResponseSDKType, MsgUpdateAdmin, MsgUpdateAdminSDKType, MsgUpdateAdminResponse, MsgUpdateAdminResponseSDKType, MsgClearAdmin, MsgClearAdminSDKType, MsgClearAdminResponse, MsgClearAdminResponseSDKType } from "./tx"; +import { AccessConfig, AccessConfigSDKType } from "./types.js"; +import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin.js"; +import { Rpc } from "../../../helpers.js"; +import { BinaryReader } from "../../../binary.js"; +import { MsgStoreCode, MsgStoreCodeSDKType, MsgStoreCodeResponse, MsgStoreCodeResponseSDKType, MsgInstantiateContract, MsgInstantiateContractSDKType, MsgInstantiateContractResponse, MsgInstantiateContractResponseSDKType, MsgExecuteContract, MsgExecuteContractSDKType, MsgExecuteContractResponse, MsgExecuteContractResponseSDKType, MsgMigrateContract, MsgMigrateContractSDKType, MsgMigrateContractResponse, MsgMigrateContractResponseSDKType, MsgUpdateAdmin, MsgUpdateAdminSDKType, MsgUpdateAdminResponse, MsgUpdateAdminResponseSDKType, MsgClearAdmin, MsgClearAdminSDKType, MsgClearAdminResponse, MsgClearAdminResponseSDKType } from "./tx.js"; /** Msg defines the wasm Msg service. */ export interface Msg { /** StoreCode to submit Wasm code to the system */ diff --git a/__fixtures__/v-next/outputv4/cosmwasm/wasm/v1/tx.ts b/__fixtures__/v-next/outputv4/cosmwasm/wasm/v1/tx.ts index 306b2a23fe..6561ef6f9f 100644 --- a/__fixtures__/v-next/outputv4/cosmwasm/wasm/v1/tx.ts +++ b/__fixtures__/v-next/outputv4/cosmwasm/wasm/v1/tx.ts @@ -1,10 +1,9 @@ -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 { JsonSafe } from "../../../json-safe"; +import { AccessConfig, AccessConfigSDKType } from "./types.js"; +import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin.js"; +import { BinaryReader, BinaryWriter } from "../../../binary.js"; +import { isSet, bytesFromBase64, base64FromBytes, DeepPartial } from "../../../helpers.js"; +import { JsonSafe } from "../../../json-safe.js"; import { fromBase64, toBase64, toUtf8, fromUtf8 } from "@cosmjs/encoding"; -import { ComputedRef } from "vue"; export const protobufPackage = "cosmwasm.wasm.v1"; /** MsgStoreCode submit Wasm code to the system */ export interface MsgStoreCode { @@ -18,11 +17,6 @@ export interface MsgStoreCode { */ instantiatePermission?: AccessConfig; } -export interface ReactiveMsgStoreCode { - sender: ComputedRef; - wasmByteCode: ComputedRef; - instantiatePermission?: ComputedRef; -} export interface MsgStoreCodeProtoMsg { typeUrl: "/cosmwasm.wasm.v1.MsgStoreCode"; value: Uint8Array; @@ -38,9 +32,6 @@ export interface MsgStoreCodeResponse { /** CodeID is the reference to the stored WASM code */ codeId: bigint; } -export interface ReactiveMsgStoreCodeResponse { - codeId: ComputedRef; -} export interface MsgStoreCodeResponseProtoMsg { typeUrl: "/cosmwasm.wasm.v1.MsgStoreCodeResponse"; value: Uint8Array; @@ -67,14 +58,6 @@ export interface MsgInstantiateContract { /** Funds coins that are transferred to the contract on instantiation */ funds: Coin[]; } -export interface ReactiveMsgInstantiateContract { - sender: ComputedRef; - admin: ComputedRef; - codeId: ComputedRef; - label: ComputedRef; - msg: ComputedRef; - funds: ComputedRef; -} export interface MsgInstantiateContractProtoMsg { typeUrl: "/cosmwasm.wasm.v1.MsgInstantiateContract"; value: Uint8Array; @@ -98,10 +81,6 @@ export interface MsgInstantiateContractResponse { /** Data contains base64-encoded bytes to returned from the contract */ data: Uint8Array; } -export interface ReactiveMsgInstantiateContractResponse { - address: ComputedRef; - data: ComputedRef; -} export interface MsgInstantiateContractResponseProtoMsg { typeUrl: "/cosmwasm.wasm.v1.MsgInstantiateContractResponse"; value: Uint8Array; @@ -122,12 +101,6 @@ export interface MsgExecuteContract { /** Funds coins that are transferred to the contract on execution */ funds: Coin[]; } -export interface ReactiveMsgExecuteContract { - sender: ComputedRef; - contract: ComputedRef; - msg: ComputedRef; - funds: ComputedRef; -} export interface MsgExecuteContractProtoMsg { typeUrl: "/cosmwasm.wasm.v1.MsgExecuteContract"; value: Uint8Array; @@ -144,9 +117,6 @@ export interface MsgExecuteContractResponse { /** Data contains base64-encoded bytes to returned from the contract */ data: Uint8Array; } -export interface ReactiveMsgExecuteContractResponse { - data: ComputedRef; -} export interface MsgExecuteContractResponseProtoMsg { typeUrl: "/cosmwasm.wasm.v1.MsgExecuteContractResponse"; value: Uint8Array; @@ -166,12 +136,6 @@ export interface MsgMigrateContract { /** Msg json encoded message to be passed to the contract on migration */ msg: Uint8Array; } -export interface ReactiveMsgMigrateContract { - sender: ComputedRef; - contract: ComputedRef; - codeId: ComputedRef; - msg: ComputedRef; -} export interface MsgMigrateContractProtoMsg { typeUrl: "/cosmwasm.wasm.v1.MsgMigrateContract"; value: Uint8Array; @@ -191,9 +155,6 @@ export interface MsgMigrateContractResponse { */ data: Uint8Array; } -export interface ReactiveMsgMigrateContractResponse { - data: ComputedRef; -} export interface MsgMigrateContractResponseProtoMsg { typeUrl: "/cosmwasm.wasm.v1.MsgMigrateContractResponse"; value: Uint8Array; @@ -211,11 +172,6 @@ export interface MsgUpdateAdmin { /** Contract is the address of the smart contract */ contract: string; } -export interface ReactiveMsgUpdateAdmin { - sender: ComputedRef; - newAdmin: ComputedRef; - contract: ComputedRef; -} export interface MsgUpdateAdminProtoMsg { typeUrl: "/cosmwasm.wasm.v1.MsgUpdateAdmin"; value: Uint8Array; @@ -228,7 +184,6 @@ export interface MsgUpdateAdminSDKType { } /** MsgUpdateAdminResponse returns empty data */ export interface MsgUpdateAdminResponse {} -export interface ReactiveMsgUpdateAdminResponse {} export interface MsgUpdateAdminResponseProtoMsg { typeUrl: "/cosmwasm.wasm.v1.MsgUpdateAdminResponse"; value: Uint8Array; @@ -242,10 +197,6 @@ export interface MsgClearAdmin { /** Contract is the address of the smart contract */ contract: string; } -export interface ReactiveMsgClearAdmin { - sender: ComputedRef; - contract: ComputedRef; -} export interface MsgClearAdminProtoMsg { typeUrl: "/cosmwasm.wasm.v1.MsgClearAdmin"; value: Uint8Array; @@ -257,7 +208,6 @@ export interface MsgClearAdminSDKType { } /** MsgClearAdminResponse returns empty data */ export interface MsgClearAdminResponse {} -export interface ReactiveMsgClearAdminResponse {} export interface MsgClearAdminResponseProtoMsg { typeUrl: "/cosmwasm.wasm.v1.MsgClearAdminResponse"; value: Uint8Array; @@ -274,7 +224,7 @@ function createBaseMsgStoreCode(): MsgStoreCode { export const MsgStoreCode = { typeUrl: "/cosmwasm.wasm.v1.MsgStoreCode", encode(message: MsgStoreCode, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.sender !== "") { + if (message.sender !== undefined) { writer.uint32(10).string(message.sender); } if (message.wasmByteCode.length !== 0) { @@ -309,11 +259,11 @@ export const MsgStoreCode = { return message; }, fromJSON(object: any): MsgStoreCode { - return { - sender: isSet(object.sender) ? String(object.sender) : "", - wasmByteCode: isSet(object.wasmByteCode) ? bytesFromBase64(object.wasmByteCode) : new Uint8Array(), - instantiatePermission: isSet(object.instantiatePermission) ? AccessConfig.fromJSON(object.instantiatePermission) : undefined - }; + const obj = createBaseMsgStoreCode(); + if (isSet(object.sender)) obj.sender = String(object.sender); + if (isSet(object.wasmByteCode)) obj.wasmByteCode = bytesFromBase64(object.wasmByteCode); + if (isSet(object.instantiatePermission)) obj.instantiatePermission = AccessConfig.fromJSON(object.instantiatePermission); + return obj; }, toJSON(message: MsgStoreCode): JsonSafe { const obj: any = {}; @@ -326,7 +276,9 @@ export const MsgStoreCode = { const message = createBaseMsgStoreCode(); message.sender = object.sender ?? ""; message.wasmByteCode = object.wasmByteCode ?? new Uint8Array(); - message.instantiatePermission = object.instantiatePermission !== undefined && object.instantiatePermission !== null ? AccessConfig.fromPartial(object.instantiatePermission) : undefined; + if (object.instantiatePermission !== undefined && object.instantiatePermission !== null) { + message.instantiatePermission = AccessConfig.fromPartial(object.instantiatePermission); + } return message; }, fromSDK(object: MsgStoreCodeSDKType): MsgStoreCode { @@ -400,7 +352,7 @@ function createBaseMsgStoreCodeResponse(): MsgStoreCodeResponse { export const MsgStoreCodeResponse = { typeUrl: "/cosmwasm.wasm.v1.MsgStoreCodeResponse", encode(message: MsgStoreCodeResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.codeId !== BigInt(0)) { + if (message.codeId !== undefined) { writer.uint32(8).uint64(message.codeId); } return writer; @@ -423,9 +375,9 @@ export const MsgStoreCodeResponse = { return message; }, fromJSON(object: any): MsgStoreCodeResponse { - return { - codeId: isSet(object.codeId) ? BigInt(object.codeId.toString()) : BigInt(0) - }; + const obj = createBaseMsgStoreCodeResponse(); + if (isSet(object.codeId)) obj.codeId = BigInt(object.codeId.toString()); + return obj; }, toJSON(message: MsgStoreCodeResponse): JsonSafe { const obj: any = {}; @@ -434,7 +386,9 @@ export const MsgStoreCodeResponse = { }, fromPartial(object: DeepPartial): MsgStoreCodeResponse { const message = createBaseMsgStoreCodeResponse(); - message.codeId = object.codeId !== undefined && object.codeId !== null ? BigInt(object.codeId.toString()) : BigInt(0); + if (object.codeId !== undefined && object.codeId !== null) { + message.codeId = BigInt(object.codeId.toString()); + } return message; }, fromSDK(object: MsgStoreCodeResponseSDKType): MsgStoreCodeResponse { @@ -499,16 +453,16 @@ function createBaseMsgInstantiateContract(): MsgInstantiateContract { export const MsgInstantiateContract = { typeUrl: "/cosmwasm.wasm.v1.MsgInstantiateContract", encode(message: MsgInstantiateContract, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.sender !== "") { + if (message.sender !== undefined) { writer.uint32(10).string(message.sender); } - if (message.admin !== "") { + if (message.admin !== undefined) { writer.uint32(18).string(message.admin); } - if (message.codeId !== BigInt(0)) { + if (message.codeId !== undefined) { writer.uint32(24).uint64(message.codeId); } - if (message.label !== "") { + if (message.label !== undefined) { writer.uint32(34).string(message.label); } if (message.msg.length !== 0) { @@ -552,14 +506,14 @@ export const MsgInstantiateContract = { return message; }, fromJSON(object: any): MsgInstantiateContract { - return { - sender: isSet(object.sender) ? String(object.sender) : "", - admin: isSet(object.admin) ? String(object.admin) : "", - codeId: isSet(object.codeId) ? BigInt(object.codeId.toString()) : BigInt(0), - label: isSet(object.label) ? String(object.label) : "", - msg: isSet(object.msg) ? bytesFromBase64(object.msg) : new Uint8Array(), - funds: Array.isArray(object?.funds) ? object.funds.map((e: any) => Coin.fromJSON(e)) : [] - }; + const obj = createBaseMsgInstantiateContract(); + if (isSet(object.sender)) obj.sender = String(object.sender); + if (isSet(object.admin)) obj.admin = String(object.admin); + if (isSet(object.codeId)) obj.codeId = BigInt(object.codeId.toString()); + if (isSet(object.label)) obj.label = String(object.label); + if (isSet(object.msg)) obj.msg = bytesFromBase64(object.msg); + if (Array.isArray(object?.funds)) obj.funds = object.funds.map((e: any) => Coin.fromJSON(e)); + return obj; }, toJSON(message: MsgInstantiateContract): JsonSafe { const obj: any = {}; @@ -579,7 +533,9 @@ export const MsgInstantiateContract = { const message = createBaseMsgInstantiateContract(); message.sender = object.sender ?? ""; message.admin = object.admin ?? ""; - message.codeId = object.codeId !== undefined && object.codeId !== null ? BigInt(object.codeId.toString()) : BigInt(0); + if (object.codeId !== undefined && object.codeId !== null) { + message.codeId = BigInt(object.codeId.toString()); + } message.label = object.label ?? ""; message.msg = object.msg ?? new Uint8Array(); message.funds = object.funds?.map(e => Coin.fromPartial(e)) || []; @@ -684,7 +640,7 @@ function createBaseMsgInstantiateContractResponse(): MsgInstantiateContractRespo export const MsgInstantiateContractResponse = { typeUrl: "/cosmwasm.wasm.v1.MsgInstantiateContractResponse", encode(message: MsgInstantiateContractResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.address !== "") { + if (message.address !== undefined) { writer.uint32(10).string(message.address); } if (message.data.length !== 0) { @@ -713,10 +669,10 @@ export const MsgInstantiateContractResponse = { return message; }, fromJSON(object: any): MsgInstantiateContractResponse { - return { - address: isSet(object.address) ? String(object.address) : "", - data: isSet(object.data) ? bytesFromBase64(object.data) : new Uint8Array() - }; + const obj = createBaseMsgInstantiateContractResponse(); + if (isSet(object.address)) obj.address = String(object.address); + if (isSet(object.data)) obj.data = bytesFromBase64(object.data); + return obj; }, toJSON(message: MsgInstantiateContractResponse): JsonSafe { const obj: any = {}; @@ -797,10 +753,10 @@ function createBaseMsgExecuteContract(): MsgExecuteContract { export const MsgExecuteContract = { typeUrl: "/cosmwasm.wasm.v1.MsgExecuteContract", encode(message: MsgExecuteContract, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.sender !== "") { + if (message.sender !== undefined) { writer.uint32(10).string(message.sender); } - if (message.contract !== "") { + if (message.contract !== undefined) { writer.uint32(18).string(message.contract); } if (message.msg.length !== 0) { @@ -838,12 +794,12 @@ export const MsgExecuteContract = { return message; }, fromJSON(object: any): MsgExecuteContract { - return { - sender: isSet(object.sender) ? String(object.sender) : "", - contract: isSet(object.contract) ? String(object.contract) : "", - msg: isSet(object.msg) ? bytesFromBase64(object.msg) : new Uint8Array(), - funds: Array.isArray(object?.funds) ? object.funds.map((e: any) => Coin.fromJSON(e)) : [] - }; + const obj = createBaseMsgExecuteContract(); + if (isSet(object.sender)) obj.sender = String(object.sender); + if (isSet(object.contract)) obj.contract = String(object.contract); + if (isSet(object.msg)) obj.msg = bytesFromBase64(object.msg); + if (Array.isArray(object?.funds)) obj.funds = object.funds.map((e: any) => Coin.fromJSON(e)); + return obj; }, toJSON(message: MsgExecuteContract): JsonSafe { const obj: any = {}; @@ -972,9 +928,9 @@ export const MsgExecuteContractResponse = { return message; }, fromJSON(object: any): MsgExecuteContractResponse { - return { - data: isSet(object.data) ? bytesFromBase64(object.data) : new Uint8Array() - }; + const obj = createBaseMsgExecuteContractResponse(); + if (isSet(object.data)) obj.data = bytesFromBase64(object.data); + return obj; }, toJSON(message: MsgExecuteContractResponse): JsonSafe { const obj: any = {}; @@ -1046,13 +1002,13 @@ function createBaseMsgMigrateContract(): MsgMigrateContract { export const MsgMigrateContract = { typeUrl: "/cosmwasm.wasm.v1.MsgMigrateContract", encode(message: MsgMigrateContract, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.sender !== "") { + if (message.sender !== undefined) { writer.uint32(10).string(message.sender); } - if (message.contract !== "") { + if (message.contract !== undefined) { writer.uint32(18).string(message.contract); } - if (message.codeId !== BigInt(0)) { + if (message.codeId !== undefined) { writer.uint32(24).uint64(message.codeId); } if (message.msg.length !== 0) { @@ -1087,12 +1043,12 @@ export const MsgMigrateContract = { return message; }, fromJSON(object: any): MsgMigrateContract { - return { - sender: isSet(object.sender) ? String(object.sender) : "", - contract: isSet(object.contract) ? String(object.contract) : "", - codeId: isSet(object.codeId) ? BigInt(object.codeId.toString()) : BigInt(0), - msg: isSet(object.msg) ? bytesFromBase64(object.msg) : new Uint8Array() - }; + const obj = createBaseMsgMigrateContract(); + if (isSet(object.sender)) obj.sender = String(object.sender); + if (isSet(object.contract)) obj.contract = String(object.contract); + if (isSet(object.codeId)) obj.codeId = BigInt(object.codeId.toString()); + if (isSet(object.msg)) obj.msg = bytesFromBase64(object.msg); + return obj; }, toJSON(message: MsgMigrateContract): JsonSafe { const obj: any = {}; @@ -1106,7 +1062,9 @@ export const MsgMigrateContract = { const message = createBaseMsgMigrateContract(); message.sender = object.sender ?? ""; message.contract = object.contract ?? ""; - message.codeId = object.codeId !== undefined && object.codeId !== null ? BigInt(object.codeId.toString()) : BigInt(0); + if (object.codeId !== undefined && object.codeId !== null) { + message.codeId = BigInt(object.codeId.toString()); + } message.msg = object.msg ?? new Uint8Array(); return message; }, @@ -1211,9 +1169,9 @@ export const MsgMigrateContractResponse = { return message; }, fromJSON(object: any): MsgMigrateContractResponse { - return { - data: isSet(object.data) ? bytesFromBase64(object.data) : new Uint8Array() - }; + const obj = createBaseMsgMigrateContractResponse(); + if (isSet(object.data)) obj.data = bytesFromBase64(object.data); + return obj; }, toJSON(message: MsgMigrateContractResponse): JsonSafe { const obj: any = {}; @@ -1284,13 +1242,13 @@ function createBaseMsgUpdateAdmin(): MsgUpdateAdmin { export const MsgUpdateAdmin = { typeUrl: "/cosmwasm.wasm.v1.MsgUpdateAdmin", encode(message: MsgUpdateAdmin, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.sender !== "") { + if (message.sender !== undefined) { writer.uint32(10).string(message.sender); } - if (message.newAdmin !== "") { + if (message.newAdmin !== undefined) { writer.uint32(18).string(message.newAdmin); } - if (message.contract !== "") { + if (message.contract !== undefined) { writer.uint32(26).string(message.contract); } return writer; @@ -1319,11 +1277,11 @@ export const MsgUpdateAdmin = { return message; }, fromJSON(object: any): MsgUpdateAdmin { - return { - sender: isSet(object.sender) ? String(object.sender) : "", - newAdmin: isSet(object.newAdmin) ? String(object.newAdmin) : "", - contract: isSet(object.contract) ? String(object.contract) : "" - }; + const obj = createBaseMsgUpdateAdmin(); + if (isSet(object.sender)) obj.sender = String(object.sender); + if (isSet(object.newAdmin)) obj.newAdmin = String(object.newAdmin); + if (isSet(object.contract)) obj.contract = String(object.contract); + return obj; }, toJSON(message: MsgUpdateAdmin): JsonSafe { const obj: any = {}; @@ -1425,7 +1383,8 @@ export const MsgUpdateAdminResponse = { return message; }, fromJSON(_: any): MsgUpdateAdminResponse { - return {}; + const obj = createBaseMsgUpdateAdminResponse(); + return obj; }, toJSON(_: MsgUpdateAdminResponse): JsonSafe { const obj: any = {}; @@ -1484,10 +1443,10 @@ function createBaseMsgClearAdmin(): MsgClearAdmin { export const MsgClearAdmin = { typeUrl: "/cosmwasm.wasm.v1.MsgClearAdmin", encode(message: MsgClearAdmin, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.sender !== "") { + if (message.sender !== undefined) { writer.uint32(10).string(message.sender); } - if (message.contract !== "") { + if (message.contract !== undefined) { writer.uint32(26).string(message.contract); } return writer; @@ -1513,10 +1472,10 @@ export const MsgClearAdmin = { return message; }, fromJSON(object: any): MsgClearAdmin { - return { - sender: isSet(object.sender) ? String(object.sender) : "", - contract: isSet(object.contract) ? String(object.contract) : "" - }; + const obj = createBaseMsgClearAdmin(); + if (isSet(object.sender)) obj.sender = String(object.sender); + if (isSet(object.contract)) obj.contract = String(object.contract); + return obj; }, toJSON(message: MsgClearAdmin): JsonSafe { const obj: any = {}; @@ -1609,7 +1568,8 @@ export const MsgClearAdminResponse = { return message; }, fromJSON(_: any): MsgClearAdminResponse { - return {}; + const obj = createBaseMsgClearAdminResponse(); + return obj; }, toJSON(_: MsgClearAdminResponse): JsonSafe { const obj: any = {}; diff --git a/__fixtures__/v-next/outputv4/cosmwasm/wasm/v1/types.ts b/__fixtures__/v-next/outputv4/cosmwasm/wasm/v1/types.ts index 28a9a8f3ec..2bc908fd64 100644 --- a/__fixtures__/v-next/outputv4/cosmwasm/wasm/v1/types.ts +++ b/__fixtures__/v-next/outputv4/cosmwasm/wasm/v1/types.ts @@ -1,9 +1,8 @@ -import { Any, AnySDKType } from "../../../google/protobuf/any"; -import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, bytesFromBase64, base64FromBytes } from "../../../helpers"; -import { JsonSafe } from "../../../json-safe"; +import { Any, AnySDKType } from "../../../google/protobuf/any.js"; +import { BinaryReader, BinaryWriter } from "../../../binary.js"; +import { isSet, DeepPartial, bytesFromBase64, base64FromBytes } from "../../../helpers.js"; +import { JsonSafe } from "../../../json-safe.js"; import { toUtf8, fromUtf8 } from "@cosmjs/encoding"; -import { ComputedRef } from "vue"; export const protobufPackage = "cosmwasm.wasm.v1"; /** AccessType permission types */ export enum AccessType { @@ -105,9 +104,6 @@ export function contractCodeHistoryOperationTypeToJSON(object: ContractCodeHisto export interface AccessTypeParam { value: AccessType; } -export interface ReactiveAccessTypeParam { - value: ComputedRef; -} export interface AccessTypeParamProtoMsg { typeUrl: "/cosmwasm.wasm.v1.AccessTypeParam"; value: Uint8Array; @@ -121,10 +117,6 @@ export interface AccessConfig { permission: AccessType; address: string; } -export interface ReactiveAccessConfig { - permission: ComputedRef; - address: ComputedRef; -} export interface AccessConfigProtoMsg { typeUrl: "/cosmwasm.wasm.v1.AccessConfig"; value: Uint8Array; @@ -140,11 +132,6 @@ export interface Params { instantiateDefaultPermission: AccessType; maxWasmCodeSize: bigint; } -export interface ReactiveParams { - codeUploadAccess: ComputedRef; - instantiateDefaultPermission: ComputedRef; - maxWasmCodeSize: ComputedRef; -} export interface ParamsProtoMsg { typeUrl: "/cosmwasm.wasm.v1.Params"; value: Uint8Array; @@ -164,11 +151,6 @@ export interface CodeInfo { /** InstantiateConfig access control to apply on contract creation, optional */ instantiateConfig: AccessConfig; } -export interface ReactiveCodeInfo { - codeHash: ComputedRef; - creator: ComputedRef; - instantiateConfig: ComputedRef; -} export interface CodeInfoProtoMsg { typeUrl: "/cosmwasm.wasm.v1.CodeInfo"; value: Uint8Array; @@ -202,15 +184,6 @@ export interface ContractInfo { */ extension?: Any; } -export interface ReactiveContractInfo { - codeId: ComputedRef; - creator: ComputedRef; - admin: ComputedRef; - label: ComputedRef; - created?: ComputedRef; - ibcPortId: ComputedRef; - extension?: ComputedRef; -} export interface ContractInfoProtoMsg { typeUrl: "/cosmwasm.wasm.v1.ContractInfo"; value: Uint8Array; @@ -234,12 +207,6 @@ export interface ContractCodeHistoryEntry { updated?: AbsoluteTxPosition; msg: Uint8Array; } -export interface ReactiveContractCodeHistoryEntry { - operation: ComputedRef; - codeId: ComputedRef; - updated?: ComputedRef; - msg: ComputedRef; -} export interface ContractCodeHistoryEntryProtoMsg { typeUrl: "/cosmwasm.wasm.v1.ContractCodeHistoryEntry"; value: Uint8Array; @@ -264,10 +231,6 @@ export interface AbsoluteTxPosition { */ txIndex: bigint; } -export interface ReactiveAbsoluteTxPosition { - blockHeight: ComputedRef; - txIndex: ComputedRef; -} export interface AbsoluteTxPositionProtoMsg { typeUrl: "/cosmwasm.wasm.v1.AbsoluteTxPosition"; value: Uint8Array; @@ -287,10 +250,6 @@ export interface Model { /** base64-encode raw value */ value: Uint8Array; } -export interface ReactiveModel { - key: ComputedRef; - value: ComputedRef; -} export interface ModelProtoMsg { typeUrl: "/cosmwasm.wasm.v1.Model"; value: Uint8Array; @@ -331,9 +290,9 @@ export const AccessTypeParam = { return message; }, fromJSON(object: any): AccessTypeParam { - return { - value: isSet(object.value) ? accessTypeFromJSON(object.value) : -1 - }; + const obj = createBaseAccessTypeParam(); + if (isSet(object.value)) obj.value = accessTypeFromJSON(object.value); + return obj; }, toJSON(message: AccessTypeParam): JsonSafe { const obj: any = {}; @@ -406,7 +365,7 @@ export const AccessConfig = { if (message.permission !== 0) { writer.uint32(8).int32(message.permission); } - if (message.address !== "") { + if (message.address !== undefined) { writer.uint32(18).string(message.address); } return writer; @@ -432,10 +391,10 @@ export const AccessConfig = { return message; }, fromJSON(object: any): AccessConfig { - return { - permission: isSet(object.permission) ? accessTypeFromJSON(object.permission) : -1, - address: isSet(object.address) ? String(object.address) : "" - }; + const obj = createBaseAccessConfig(); + if (isSet(object.permission)) obj.permission = accessTypeFromJSON(object.permission); + if (isSet(object.address)) obj.address = String(object.address); + return obj; }, toJSON(message: AccessConfig): JsonSafe { const obj: any = {}; @@ -521,7 +480,7 @@ export const Params = { if (message.instantiateDefaultPermission !== 0) { writer.uint32(16).int32(message.instantiateDefaultPermission); } - if (message.maxWasmCodeSize !== BigInt(0)) { + if (message.maxWasmCodeSize !== undefined) { writer.uint32(24).uint64(message.maxWasmCodeSize); } return writer; @@ -550,11 +509,11 @@ export const Params = { return message; }, fromJSON(object: any): Params { - return { - codeUploadAccess: isSet(object.codeUploadAccess) ? AccessConfig.fromJSON(object.codeUploadAccess) : undefined, - instantiateDefaultPermission: isSet(object.instantiateDefaultPermission) ? accessTypeFromJSON(object.instantiateDefaultPermission) : -1, - maxWasmCodeSize: isSet(object.maxWasmCodeSize) ? BigInt(object.maxWasmCodeSize.toString()) : BigInt(0) - }; + const obj = createBaseParams(); + if (isSet(object.codeUploadAccess)) obj.codeUploadAccess = AccessConfig.fromJSON(object.codeUploadAccess); + if (isSet(object.instantiateDefaultPermission)) obj.instantiateDefaultPermission = accessTypeFromJSON(object.instantiateDefaultPermission); + if (isSet(object.maxWasmCodeSize)) obj.maxWasmCodeSize = BigInt(object.maxWasmCodeSize.toString()); + return obj; }, toJSON(message: Params): JsonSafe { const obj: any = {}; @@ -565,9 +524,13 @@ export const Params = { }, fromPartial(object: DeepPartial): Params { const message = createBaseParams(); - message.codeUploadAccess = object.codeUploadAccess !== undefined && object.codeUploadAccess !== null ? AccessConfig.fromPartial(object.codeUploadAccess) : undefined; + if (object.codeUploadAccess !== undefined && object.codeUploadAccess !== null) { + message.codeUploadAccess = AccessConfig.fromPartial(object.codeUploadAccess); + } message.instantiateDefaultPermission = object.instantiateDefaultPermission ?? 0; - message.maxWasmCodeSize = object.maxWasmCodeSize !== undefined && object.maxWasmCodeSize !== null ? BigInt(object.maxWasmCodeSize.toString()) : BigInt(0); + if (object.maxWasmCodeSize !== undefined && object.maxWasmCodeSize !== null) { + message.maxWasmCodeSize = BigInt(object.maxWasmCodeSize.toString()); + } return message; }, fromSDK(object: ParamsSDKType): Params { @@ -646,7 +609,7 @@ export const CodeInfo = { if (message.codeHash.length !== 0) { writer.uint32(10).bytes(message.codeHash); } - if (message.creator !== "") { + if (message.creator !== undefined) { writer.uint32(18).string(message.creator); } if (message.instantiateConfig !== undefined) { @@ -678,11 +641,11 @@ export const CodeInfo = { return message; }, fromJSON(object: any): CodeInfo { - return { - codeHash: isSet(object.codeHash) ? bytesFromBase64(object.codeHash) : new Uint8Array(), - creator: isSet(object.creator) ? String(object.creator) : "", - instantiateConfig: isSet(object.instantiateConfig) ? AccessConfig.fromJSON(object.instantiateConfig) : undefined - }; + const obj = createBaseCodeInfo(); + if (isSet(object.codeHash)) obj.codeHash = bytesFromBase64(object.codeHash); + if (isSet(object.creator)) obj.creator = String(object.creator); + if (isSet(object.instantiateConfig)) obj.instantiateConfig = AccessConfig.fromJSON(object.instantiateConfig); + return obj; }, toJSON(message: CodeInfo): JsonSafe { const obj: any = {}; @@ -695,7 +658,9 @@ export const CodeInfo = { const message = createBaseCodeInfo(); message.codeHash = object.codeHash ?? new Uint8Array(); message.creator = object.creator ?? ""; - message.instantiateConfig = object.instantiateConfig !== undefined && object.instantiateConfig !== null ? AccessConfig.fromPartial(object.instantiateConfig) : undefined; + if (object.instantiateConfig !== undefined && object.instantiateConfig !== null) { + message.instantiateConfig = AccessConfig.fromPartial(object.instantiateConfig); + } return message; }, fromSDK(object: CodeInfoSDKType): CodeInfo { @@ -775,22 +740,22 @@ function createBaseContractInfo(): ContractInfo { export const ContractInfo = { typeUrl: "/cosmwasm.wasm.v1.ContractInfo", encode(message: ContractInfo, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.codeId !== BigInt(0)) { + if (message.codeId !== undefined) { writer.uint32(8).uint64(message.codeId); } - if (message.creator !== "") { + if (message.creator !== undefined) { writer.uint32(18).string(message.creator); } - if (message.admin !== "") { + if (message.admin !== undefined) { writer.uint32(26).string(message.admin); } - if (message.label !== "") { + if (message.label !== undefined) { writer.uint32(34).string(message.label); } if (message.created !== undefined) { AbsoluteTxPosition.encode(message.created, writer.uint32(42).fork()).ldelim(); } - if (message.ibcPortId !== "") { + if (message.ibcPortId !== undefined) { writer.uint32(50).string(message.ibcPortId); } if (message.extension !== undefined) { @@ -834,15 +799,15 @@ export const ContractInfo = { return message; }, fromJSON(object: any): ContractInfo { - return { - codeId: isSet(object.codeId) ? BigInt(object.codeId.toString()) : BigInt(0), - creator: isSet(object.creator) ? String(object.creator) : "", - admin: isSet(object.admin) ? String(object.admin) : "", - label: isSet(object.label) ? String(object.label) : "", - created: isSet(object.created) ? AbsoluteTxPosition.fromJSON(object.created) : undefined, - ibcPortId: isSet(object.ibcPortId) ? String(object.ibcPortId) : "", - extension: isSet(object.extension) ? Any.fromJSON(object.extension) : undefined - }; + const obj = createBaseContractInfo(); + if (isSet(object.codeId)) obj.codeId = BigInt(object.codeId.toString()); + if (isSet(object.creator)) obj.creator = String(object.creator); + if (isSet(object.admin)) obj.admin = String(object.admin); + if (isSet(object.label)) obj.label = String(object.label); + if (isSet(object.created)) obj.created = AbsoluteTxPosition.fromJSON(object.created); + if (isSet(object.ibcPortId)) obj.ibcPortId = String(object.ibcPortId); + if (isSet(object.extension)) obj.extension = Any.fromJSON(object.extension); + return obj; }, toJSON(message: ContractInfo): JsonSafe { const obj: any = {}; @@ -857,13 +822,19 @@ export const ContractInfo = { }, fromPartial(object: DeepPartial): ContractInfo { const message = createBaseContractInfo(); - message.codeId = object.codeId !== undefined && object.codeId !== null ? BigInt(object.codeId.toString()) : BigInt(0); + if (object.codeId !== undefined && object.codeId !== null) { + message.codeId = BigInt(object.codeId.toString()); + } message.creator = object.creator ?? ""; message.admin = object.admin ?? ""; message.label = object.label ?? ""; - message.created = object.created !== undefined && object.created !== null ? AbsoluteTxPosition.fromPartial(object.created) : undefined; + if (object.created !== undefined && object.created !== null) { + message.created = AbsoluteTxPosition.fromPartial(object.created); + } message.ibcPortId = object.ibcPortId ?? ""; - message.extension = object.extension !== undefined && object.extension !== null ? Any.fromPartial(object.extension) : undefined; + if (object.extension !== undefined && object.extension !== null) { + message.extension = Any.fromPartial(object.extension); + } return message; }, fromSDK(object: ContractInfoSDKType): ContractInfo { @@ -971,7 +942,7 @@ export const ContractCodeHistoryEntry = { if (message.operation !== 0) { writer.uint32(8).int32(message.operation); } - if (message.codeId !== BigInt(0)) { + if (message.codeId !== undefined) { writer.uint32(16).uint64(message.codeId); } if (message.updated !== undefined) { @@ -1009,12 +980,12 @@ export const ContractCodeHistoryEntry = { return message; }, fromJSON(object: any): ContractCodeHistoryEntry { - return { - operation: isSet(object.operation) ? contractCodeHistoryOperationTypeFromJSON(object.operation) : -1, - codeId: isSet(object.codeId) ? BigInt(object.codeId.toString()) : BigInt(0), - updated: isSet(object.updated) ? AbsoluteTxPosition.fromJSON(object.updated) : undefined, - msg: isSet(object.msg) ? bytesFromBase64(object.msg) : new Uint8Array() - }; + const obj = createBaseContractCodeHistoryEntry(); + if (isSet(object.operation)) obj.operation = contractCodeHistoryOperationTypeFromJSON(object.operation); + if (isSet(object.codeId)) obj.codeId = BigInt(object.codeId.toString()); + if (isSet(object.updated)) obj.updated = AbsoluteTxPosition.fromJSON(object.updated); + if (isSet(object.msg)) obj.msg = bytesFromBase64(object.msg); + return obj; }, toJSON(message: ContractCodeHistoryEntry): JsonSafe { const obj: any = {}; @@ -1027,8 +998,12 @@ export const ContractCodeHistoryEntry = { fromPartial(object: DeepPartial): ContractCodeHistoryEntry { const message = createBaseContractCodeHistoryEntry(); message.operation = object.operation ?? 0; - message.codeId = object.codeId !== undefined && object.codeId !== null ? BigInt(object.codeId.toString()) : BigInt(0); - message.updated = object.updated !== undefined && object.updated !== null ? AbsoluteTxPosition.fromPartial(object.updated) : undefined; + if (object.codeId !== undefined && object.codeId !== null) { + message.codeId = BigInt(object.codeId.toString()); + } + if (object.updated !== undefined && object.updated !== null) { + message.updated = AbsoluteTxPosition.fromPartial(object.updated); + } message.msg = object.msg ?? new Uint8Array(); return message; }, @@ -1111,10 +1086,10 @@ function createBaseAbsoluteTxPosition(): AbsoluteTxPosition { export const AbsoluteTxPosition = { typeUrl: "/cosmwasm.wasm.v1.AbsoluteTxPosition", encode(message: AbsoluteTxPosition, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.blockHeight !== BigInt(0)) { + if (message.blockHeight !== undefined) { writer.uint32(8).uint64(message.blockHeight); } - if (message.txIndex !== BigInt(0)) { + if (message.txIndex !== undefined) { writer.uint32(16).uint64(message.txIndex); } return writer; @@ -1140,10 +1115,10 @@ export const AbsoluteTxPosition = { return message; }, fromJSON(object: any): AbsoluteTxPosition { - return { - blockHeight: isSet(object.blockHeight) ? BigInt(object.blockHeight.toString()) : BigInt(0), - txIndex: isSet(object.txIndex) ? BigInt(object.txIndex.toString()) : BigInt(0) - }; + const obj = createBaseAbsoluteTxPosition(); + if (isSet(object.blockHeight)) obj.blockHeight = BigInt(object.blockHeight.toString()); + if (isSet(object.txIndex)) obj.txIndex = BigInt(object.txIndex.toString()); + return obj; }, toJSON(message: AbsoluteTxPosition): JsonSafe { const obj: any = {}; @@ -1153,8 +1128,12 @@ export const AbsoluteTxPosition = { }, fromPartial(object: DeepPartial): AbsoluteTxPosition { const message = createBaseAbsoluteTxPosition(); - message.blockHeight = object.blockHeight !== undefined && object.blockHeight !== null ? BigInt(object.blockHeight.toString()) : BigInt(0); - message.txIndex = object.txIndex !== undefined && object.txIndex !== null ? BigInt(object.txIndex.toString()) : BigInt(0); + if (object.blockHeight !== undefined && object.blockHeight !== null) { + message.blockHeight = BigInt(object.blockHeight.toString()); + } + if (object.txIndex !== undefined && object.txIndex !== null) { + message.txIndex = BigInt(object.txIndex.toString()); + } return message; }, fromSDK(object: AbsoluteTxPositionSDKType): AbsoluteTxPosition { @@ -1251,10 +1230,10 @@ export const Model = { return message; }, fromJSON(object: any): Model { - return { - key: isSet(object.key) ? bytesFromBase64(object.key) : new Uint8Array(), - value: isSet(object.value) ? bytesFromBase64(object.value) : new Uint8Array() - }; + const obj = createBaseModel(); + if (isSet(object.key)) obj.key = bytesFromBase64(object.key); + if (isSet(object.value)) obj.value = bytesFromBase64(object.value); + return obj; }, toJSON(message: Model): JsonSafe { const obj: any = {}; diff --git a/__fixtures__/v-next/outputv4/evmos/bundle.ts b/__fixtures__/v-next/outputv4/evmos/bundle.ts index dcd9102122..a56ca08f5e 100644 --- a/__fixtures__/v-next/outputv4/evmos/bundle.ts +++ b/__fixtures__/v-next/outputv4/evmos/bundle.ts @@ -1,146 +1,148 @@ -import * as _156 from "./claims/v1/claims"; -import * as _157 from "./claims/v1/genesis"; -import * as _158 from "./claims/v1/query"; -import * as _159 from "./epochs/v1/genesis"; -import * as _160 from "./epochs/v1/query"; -import * as _161 from "./erc20/v1/erc20"; -import * as _162 from "./erc20/v1/genesis"; -import * as _163 from "./erc20/v1/query"; -import * as _164 from "./erc20/v1/tx"; -import * as _165 from "./fees/v1/fees"; -import * as _166 from "./fees/v1/genesis"; -import * as _167 from "./fees/v1/query"; -import * as _168 from "./fees/v1/tx"; -import * as _169 from "./incentives/v1/genesis"; -import * as _170 from "./incentives/v1/incentives"; -import * as _171 from "./incentives/v1/query"; -import * as _172 from "./inflation/v1/genesis"; -import * as _173 from "./inflation/v1/inflation"; -import * as _174 from "./inflation/v1/query"; -import * as _175 from "./recovery/v1/genesis"; -import * as _176 from "./recovery/v1/query"; -import * as _177 from "./vesting/v1/query"; -import * as _178 from "./vesting/v1/tx"; -import * as _179 from "./vesting/v1/vesting"; -import * as _490 from "./erc20/v1/tx.amino"; -import * as _491 from "./fees/v1/tx.amino"; -import * as _492 from "./vesting/v1/tx.amino"; -import * as _493 from "./erc20/v1/tx.registry"; -import * as _494 from "./fees/v1/tx.registry"; -import * as _495 from "./vesting/v1/tx.registry"; -import * as _496 from "./claims/v1/query.lcd"; -import * as _497 from "./epochs/v1/query.lcd"; -import * as _498 from "./erc20/v1/query.lcd"; -import * as _499 from "./fees/v1/query.lcd"; -import * as _500 from "./incentives/v1/query.lcd"; -import * as _501 from "./inflation/v1/query.lcd"; -import * as _502 from "./recovery/v1/query.lcd"; -import * as _503 from "./vesting/v1/query.lcd"; -import * as _504 from "./claims/v1/query.rpc.Query"; -import * as _505 from "./epochs/v1/query.rpc.Query"; -import * as _506 from "./erc20/v1/query.rpc.Query"; -import * as _507 from "./fees/v1/query.rpc.Query"; -import * as _508 from "./incentives/v1/query.rpc.Query"; -import * as _509 from "./inflation/v1/query.rpc.Query"; -import * as _510 from "./recovery/v1/query.rpc.Query"; -import * as _511 from "./vesting/v1/query.rpc.Query"; -import * as _512 from "./erc20/v1/tx.rpc.msg"; -import * as _513 from "./fees/v1/tx.rpc.msg"; -import * as _514 from "./vesting/v1/tx.rpc.msg"; -import * as _631 from "./lcd"; -import * as _632 from "./custom-lcd-client"; -import * as _633 from "./rpc.query"; -import * as _634 from "./evmos-rpc-client.query"; -import * as _635 from "./rpc.tx"; -import * as _636 from "./evmos-rpc-client.tx"; +import * as _153 from "./claims/v1/claims.js"; +import * as _154 from "./claims/v1/genesis.js"; +import * as _155 from "./claims/v1/query.js"; +import * as _156 from "./epochs/v1/genesis.js"; +import * as _157 from "./epochs/v1/query.js"; +import * as _158 from "./erc20/v1/erc20.js"; +import * as _159 from "./erc20/v1/genesis.js"; +import * as _160 from "./erc20/v1/query.js"; +import * as _161 from "./erc20/v1/tx.js"; +import * as _162 from "./fees/v1/fees.js"; +import * as _163 from "./fees/v1/genesis.js"; +import * as _164 from "./fees/v1/query.js"; +import * as _165 from "./fees/v1/tx.js"; +import * as _166 from "./incentives/v1/genesis.js"; +import * as _167 from "./incentives/v1/incentives.js"; +import * as _168 from "./incentives/v1/query.js"; +import * as _169 from "./inflation/v1/genesis.js"; +import * as _170 from "./inflation/v1/inflation.js"; +import * as _171 from "./inflation/v1/query.js"; +import * as _172 from "./recovery/v1/genesis.js"; +import * as _173 from "./recovery/v1/query.js"; +import * as _174 from "./vesting/v1/query.js"; +import * as _175 from "./vesting/v1/tx.js"; +import * as _176 from "./vesting/v1/vesting.js"; +import * as _439 from "./erc20/v1/tx.amino.js"; +import * as _440 from "./fees/v1/tx.amino.js"; +import * as _441 from "./vesting/v1/tx.amino.js"; +import * as _442 from "./erc20/v1/tx.registry.js"; +import * as _443 from "./fees/v1/tx.registry.js"; +import * as _444 from "./vesting/v1/tx.registry.js"; +import * as _445 from "./claims/v1/query.lcd.js"; +import * as _446 from "./epochs/v1/query.lcd.js"; +import * as _447 from "./erc20/v1/query.lcd.js"; +import * as _448 from "./fees/v1/query.lcd.js"; +import * as _449 from "./incentives/v1/query.lcd.js"; +import * as _450 from "./inflation/v1/query.lcd.js"; +import * as _451 from "./recovery/v1/query.lcd.js"; +import * as _452 from "./vesting/v1/query.lcd.js"; +import * as _453 from "./claims/v1/query.rpc.Query.js"; +import * as _454 from "./epochs/v1/query.rpc.Query.js"; +import * as _455 from "./erc20/v1/query.rpc.Query.js"; +import * as _456 from "./fees/v1/query.rpc.Query.js"; +import * as _457 from "./incentives/v1/query.rpc.Query.js"; +import * as _458 from "./inflation/v1/query.rpc.Query.js"; +import * as _459 from "./recovery/v1/query.rpc.Query.js"; +import * as _460 from "./vesting/v1/query.rpc.Query.js"; +import * as _461 from "./erc20/v1/tx.rpc.msg.js"; +import * as _462 from "./fees/v1/tx.rpc.msg.js"; +import * as _463 from "./vesting/v1/tx.rpc.msg.js"; +import * as _464 from "./erc20/v1/query.pinia.store.js"; +import * as _547 from "./lcd.js"; +import * as _548 from "./custom-lcd-client.js"; +import * as _549 from "./rpc.query.js"; +import * as _550 from "./evmos-rpc-client.query.js"; +import * as _551 from "./rpc.tx.js"; +import * as _552 from "./evmos-rpc-client.tx.js"; export namespace evmos { export namespace claims { + export const v1 = { + ..._153, + ..._154, + ..._155, + ..._445, + ..._453 + }; + } + export namespace epochs { export const v1 = { ..._156, ..._157, - ..._158, - ..._496, - ..._504 + ..._446, + ..._454 }; } - export namespace epochs { + export namespace erc20 { export const v1 = { + ..._158, ..._159, ..._160, - ..._497, - ..._505 + ..._161, + ..._439, + ..._442, + ..._447, + ..._455, + ..._461, + ..._464 }; } - export namespace erc20 { + export namespace fees { export const v1 = { - ..._161, ..._162, ..._163, ..._164, - ..._490, - ..._493, - ..._498, - ..._506, - ..._512 + ..._165, + ..._440, + ..._443, + ..._448, + ..._456, + ..._462 }; } - export namespace fees { + export namespace incentives { export const v1 = { - ..._165, ..._166, ..._167, ..._168, - ..._491, - ..._494, - ..._499, - ..._507, - ..._513 + ..._449, + ..._457 }; } - export namespace incentives { + export namespace inflation { export const v1 = { ..._169, ..._170, ..._171, - ..._500, - ..._508 + ..._450, + ..._458 }; } - export namespace inflation { + export namespace recovery { export const v1 = { ..._172, ..._173, - ..._174, - ..._501, - ..._509 + ..._451, + ..._459 }; } - export namespace recovery { + export namespace vesting { export const v1 = { + ..._174, ..._175, ..._176, - ..._502, - ..._510 - }; - } - export namespace vesting { - export const v1 = { - ..._177, - ..._178, - ..._179, - ..._492, - ..._495, - ..._503, - ..._511, - ..._514 + ..._441, + ..._444, + ..._452, + ..._460, + ..._463 }; } export const ClientFactory = { - ..._631, - ..._632, - ..._633, - ..._634, - ..._635, - ..._636 + ..._547, + ..._548, + ..._549, + ..._550, + ..._551, + ..._552 }; } \ No newline at end of file diff --git a/__fixtures__/v-next/outputv4/evmos/claims/v1/claims.ts b/__fixtures__/v-next/outputv4/evmos/claims/v1/claims.ts index 7fc598de5d..4bc258e731 100644 --- a/__fixtures__/v-next/outputv4/evmos/claims/v1/claims.ts +++ b/__fixtures__/v-next/outputv4/evmos/claims/v1/claims.ts @@ -1,7 +1,6 @@ -import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; -import { JsonSafe } from "../../../json-safe"; -import { ComputedRef } from "vue"; +import { BinaryReader, BinaryWriter } from "../../../binary.js"; +import { isSet, DeepPartial } from "../../../helpers.js"; +import { JsonSafe } from "../../../json-safe.js"; export const protobufPackage = "evmos.claims.v1"; /** Action defines the list of available actions to claim the airdrop tokens. */ export enum Action { @@ -70,11 +69,6 @@ export interface Claim { /** claimable token amount for the action. Zero if completed */ claimableAmount: string; } -export interface ReactiveClaim { - action: ComputedRef; - completed: ComputedRef; - claimableAmount: ComputedRef; -} export interface ClaimProtoMsg { typeUrl: "/evmos.claims.v1.Claim"; value: Uint8Array; @@ -97,11 +91,6 @@ export interface ClaimsRecordAddress { /** slice of the available actions completed */ actionsCompleted: boolean[]; } -export interface ReactiveClaimsRecordAddress { - address: ComputedRef; - initialClaimableAmount: ComputedRef; - actionsCompleted: ComputedRef; -} export interface ClaimsRecordAddressProtoMsg { typeUrl: "/evmos.claims.v1.ClaimsRecordAddress"; value: Uint8Array; @@ -122,10 +111,6 @@ export interface ClaimsRecord { /** slice of the available actions completed */ actionsCompleted: boolean[]; } -export interface ReactiveClaimsRecord { - initialClaimableAmount: ComputedRef; - actionsCompleted: ComputedRef; -} export interface ClaimsRecordProtoMsg { typeUrl: "/evmos.claims.v1.ClaimsRecord"; value: Uint8Array; @@ -151,10 +136,10 @@ export const Claim = { if (message.action !== 0) { writer.uint32(8).int32(message.action); } - if (message.completed === true) { + if (message.completed !== undefined) { writer.uint32(16).bool(message.completed); } - if (message.claimableAmount !== "") { + if (message.claimableAmount !== undefined) { writer.uint32(26).string(message.claimableAmount); } return writer; @@ -183,11 +168,11 @@ export const Claim = { return message; }, fromJSON(object: any): Claim { - return { - action: isSet(object.action) ? actionFromJSON(object.action) : -1, - completed: isSet(object.completed) ? Boolean(object.completed) : false, - claimableAmount: isSet(object.claimableAmount) ? String(object.claimableAmount) : "" - }; + const obj = createBaseClaim(); + if (isSet(object.action)) obj.action = actionFromJSON(object.action); + if (isSet(object.completed)) obj.completed = Boolean(object.completed); + if (isSet(object.claimableAmount)) obj.claimableAmount = String(object.claimableAmount); + return obj; }, toJSON(message: Claim): JsonSafe { const obj: any = {}; @@ -270,10 +255,10 @@ function createBaseClaimsRecordAddress(): ClaimsRecordAddress { export const ClaimsRecordAddress = { typeUrl: "/evmos.claims.v1.ClaimsRecordAddress", encode(message: ClaimsRecordAddress, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.address !== "") { + if (message.address !== undefined) { writer.uint32(10).string(message.address); } - if (message.initialClaimableAmount !== "") { + if (message.initialClaimableAmount !== undefined) { writer.uint32(18).string(message.initialClaimableAmount); } writer.uint32(26).fork(); @@ -314,11 +299,11 @@ export const ClaimsRecordAddress = { return message; }, fromJSON(object: any): ClaimsRecordAddress { - return { - address: isSet(object.address) ? String(object.address) : "", - initialClaimableAmount: isSet(object.initialClaimableAmount) ? String(object.initialClaimableAmount) : "", - actionsCompleted: Array.isArray(object?.actionsCompleted) ? object.actionsCompleted.map((e: any) => Boolean(e)) : [] - }; + const obj = createBaseClaimsRecordAddress(); + if (isSet(object.address)) obj.address = String(object.address); + if (isSet(object.initialClaimableAmount)) obj.initialClaimableAmount = String(object.initialClaimableAmount); + if (Array.isArray(object?.actionsCompleted)) obj.actionsCompleted = object.actionsCompleted.map((e: any) => Boolean(e)); + return obj; }, toJSON(message: ClaimsRecordAddress): JsonSafe { const obj: any = {}; @@ -410,7 +395,7 @@ function createBaseClaimsRecord(): ClaimsRecord { export const ClaimsRecord = { typeUrl: "/evmos.claims.v1.ClaimsRecord", encode(message: ClaimsRecord, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.initialClaimableAmount !== "") { + if (message.initialClaimableAmount !== undefined) { writer.uint32(10).string(message.initialClaimableAmount); } writer.uint32(18).fork(); @@ -448,10 +433,10 @@ export const ClaimsRecord = { return message; }, fromJSON(object: any): ClaimsRecord { - return { - initialClaimableAmount: isSet(object.initialClaimableAmount) ? String(object.initialClaimableAmount) : "", - actionsCompleted: Array.isArray(object?.actionsCompleted) ? object.actionsCompleted.map((e: any) => Boolean(e)) : [] - }; + const obj = createBaseClaimsRecord(); + if (isSet(object.initialClaimableAmount)) obj.initialClaimableAmount = String(object.initialClaimableAmount); + if (Array.isArray(object?.actionsCompleted)) obj.actionsCompleted = object.actionsCompleted.map((e: any) => Boolean(e)); + return obj; }, toJSON(message: ClaimsRecord): JsonSafe { const obj: any = {}; diff --git a/__fixtures__/v-next/outputv4/evmos/claims/v1/genesis.ts b/__fixtures__/v-next/outputv4/evmos/claims/v1/genesis.ts index e221dec7e5..df1fc00863 100644 --- a/__fixtures__/v-next/outputv4/evmos/claims/v1/genesis.ts +++ b/__fixtures__/v-next/outputv4/evmos/claims/v1/genesis.ts @@ -1,10 +1,9 @@ -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 { JsonSafe } from "../../../json-safe"; -import { ComputedRef } from "vue"; +import { ClaimsRecordAddress, ClaimsRecordAddressSDKType } from "./claims.js"; +import { Timestamp, TimestampSDKType } from "../../../google/protobuf/timestamp.js"; +import { Duration, DurationSDKType } from "../../../google/protobuf/duration.js"; +import { BinaryReader, BinaryWriter } from "../../../binary.js"; +import { isSet, DeepPartial, toTimestamp, fromTimestamp } from "../../../helpers.js"; +import { JsonSafe } from "../../../json-safe.js"; export const protobufPackage = "evmos.claims.v1"; /** GenesisState define the claims module's genesis state. */ export interface GenesisState { @@ -13,10 +12,6 @@ export interface GenesisState { /** list of claim records with the corresponding airdrop recipient */ claimsRecords: ClaimsRecordAddress[]; } -export interface ReactiveGenesisState { - params: ComputedRef; - claimsRecords: ComputedRef; -} export interface GenesisStateProtoMsg { typeUrl: "/evmos.claims.v1.GenesisState"; value: Uint8Array; @@ -46,15 +41,6 @@ export interface Params { /** list of channel identifiers from EVM compatible chains */ evmChannels: string[]; } -export interface ReactiveParams { - enableClaims: ComputedRef; - airdropStartTime: ComputedRef; - durationUntilDecay: ComputedRef; - durationOfDecay: ComputedRef; - claimsDenom: ComputedRef; - authorizedChannels: ComputedRef; - evmChannels: ComputedRef; -} export interface ParamsProtoMsg { typeUrl: "/evmos.claims.v1.Params"; value: Uint8Array; @@ -107,10 +93,10 @@ export const GenesisState = { return message; }, fromJSON(object: any): GenesisState { - return { - params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, - claimsRecords: Array.isArray(object?.claimsRecords) ? object.claimsRecords.map((e: any) => ClaimsRecordAddress.fromJSON(e)) : [] - }; + const obj = createBaseGenesisState(); + if (isSet(object.params)) obj.params = Params.fromJSON(object.params); + if (Array.isArray(object?.claimsRecords)) obj.claimsRecords = object.claimsRecords.map((e: any) => ClaimsRecordAddress.fromJSON(e)); + return obj; }, toJSON(message: GenesisState): JsonSafe { const obj: any = {}; @@ -124,7 +110,9 @@ export const GenesisState = { }, fromPartial(object: DeepPartial): GenesisState { const message = createBaseGenesisState(); - message.params = object.params !== undefined && object.params !== null ? Params.fromPartial(object.params) : undefined; + if (object.params !== undefined && object.params !== null) { + message.params = Params.fromPartial(object.params); + } message.claimsRecords = object.claimsRecords?.map(e => ClaimsRecordAddress.fromPartial(e)) || []; return message; }, @@ -198,7 +186,7 @@ function createBaseParams(): Params { export const Params = { typeUrl: "/evmos.claims.v1.Params", encode(message: Params, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.enableClaims === true) { + if (message.enableClaims !== undefined) { writer.uint32(8).bool(message.enableClaims); } if (message.airdropStartTime !== undefined) { @@ -210,7 +198,7 @@ export const Params = { if (message.durationOfDecay !== undefined) { Duration.encode(message.durationOfDecay, writer.uint32(34).fork()).ldelim(); } - if (message.claimsDenom !== "") { + if (message.claimsDenom !== undefined) { writer.uint32(42).string(message.claimsDenom); } for (const v of message.authorizedChannels) { @@ -257,15 +245,15 @@ export const Params = { return message; }, fromJSON(object: any): Params { - return { - enableClaims: isSet(object.enableClaims) ? Boolean(object.enableClaims) : false, - airdropStartTime: isSet(object.airdropStartTime) ? new Date(object.airdropStartTime) : undefined, - durationUntilDecay: isSet(object.durationUntilDecay) ? Duration.fromJSON(object.durationUntilDecay) : undefined, - durationOfDecay: isSet(object.durationOfDecay) ? Duration.fromJSON(object.durationOfDecay) : undefined, - claimsDenom: isSet(object.claimsDenom) ? String(object.claimsDenom) : "", - authorizedChannels: Array.isArray(object?.authorizedChannels) ? object.authorizedChannels.map((e: any) => String(e)) : [], - evmChannels: Array.isArray(object?.evmChannels) ? object.evmChannels.map((e: any) => String(e)) : [] - }; + const obj = createBaseParams(); + if (isSet(object.enableClaims)) obj.enableClaims = Boolean(object.enableClaims); + if (isSet(object.airdropStartTime)) obj.airdropStartTime = new Date(object.airdropStartTime); + if (isSet(object.durationUntilDecay)) obj.durationUntilDecay = Duration.fromJSON(object.durationUntilDecay); + if (isSet(object.durationOfDecay)) obj.durationOfDecay = Duration.fromJSON(object.durationOfDecay); + if (isSet(object.claimsDenom)) obj.claimsDenom = String(object.claimsDenom); + if (Array.isArray(object?.authorizedChannels)) obj.authorizedChannels = object.authorizedChannels.map((e: any) => String(e)); + if (Array.isArray(object?.evmChannels)) obj.evmChannels = object.evmChannels.map((e: any) => String(e)); + return obj; }, toJSON(message: Params): JsonSafe { const obj: any = {}; @@ -290,8 +278,12 @@ export const Params = { const message = createBaseParams(); message.enableClaims = object.enableClaims ?? false; message.airdropStartTime = object.airdropStartTime ?? undefined; - message.durationUntilDecay = object.durationUntilDecay !== undefined && object.durationUntilDecay !== null ? Duration.fromPartial(object.durationUntilDecay) : undefined; - message.durationOfDecay = object.durationOfDecay !== undefined && object.durationOfDecay !== null ? Duration.fromPartial(object.durationOfDecay) : undefined; + if (object.durationUntilDecay !== undefined && object.durationUntilDecay !== null) { + message.durationUntilDecay = Duration.fromPartial(object.durationUntilDecay); + } + if (object.durationOfDecay !== undefined && object.durationOfDecay !== null) { + message.durationOfDecay = Duration.fromPartial(object.durationOfDecay); + } message.claimsDenom = object.claimsDenom ?? ""; message.authorizedChannels = object.authorizedChannels?.map(e => e) || []; message.evmChannels = object.evmChannels?.map(e => e) || []; diff --git a/__fixtures__/v-next/outputv4/evmos/claims/v1/query.lcd.ts b/__fixtures__/v-next/outputv4/evmos/claims/v1/query.lcd.ts index 94fa0ada95..5fe187bd48 100644 --- a/__fixtures__/v-next/outputv4/evmos/claims/v1/query.lcd.ts +++ b/__fixtures__/v-next/outputv4/evmos/claims/v1/query.lcd.ts @@ -1,10 +1,10 @@ -import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../../cosmos/base/query/v1beta1/pagination"; -import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; -import { Params, ParamsSDKType } from "./genesis"; -import { ClaimsRecordAddress, ClaimsRecordAddressSDKType, Claim, ClaimSDKType } from "./claims"; -import { setPaginationParams } from "../../../helpers"; +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../../cosmos/base/query/v1beta1/pagination.js"; +import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin.js"; +import { Params, ParamsSDKType } from "./genesis.js"; +import { ClaimsRecordAddress, ClaimsRecordAddressSDKType, Claim, ClaimSDKType } from "./claims.js"; +import { setPaginationParams } from "../../../helpers.js"; import { LCDClient } from "@cosmology/lcd"; -import { QueryTotalUnclaimedRequest, QueryTotalUnclaimedRequestSDKType, QueryTotalUnclaimedResponse, QueryTotalUnclaimedResponseSDKType, QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType, QueryClaimsRecordsRequest, QueryClaimsRecordsRequestSDKType, QueryClaimsRecordsResponse, QueryClaimsRecordsResponseSDKType, QueryClaimsRecordRequest, QueryClaimsRecordRequestSDKType, QueryClaimsRecordResponse, QueryClaimsRecordResponseSDKType } from "./query"; +import { QueryTotalUnclaimedRequest, QueryTotalUnclaimedRequestSDKType, QueryTotalUnclaimedResponse, QueryTotalUnclaimedResponseSDKType, QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType, QueryClaimsRecordsRequest, QueryClaimsRecordsRequestSDKType, QueryClaimsRecordsResponse, QueryClaimsRecordsResponseSDKType, QueryClaimsRecordRequest, QueryClaimsRecordRequestSDKType, QueryClaimsRecordResponse, QueryClaimsRecordResponseSDKType } from "./query.js"; export class LCDQueryClient { req: LCDClient; constructor({ @@ -30,7 +30,7 @@ export class LCDQueryClient { } /* ClaimsRecords returns all claims records */ async claimsRecords(params: QueryClaimsRecordsRequest = { - pagination: undefined + pagination: PageRequest.fromPartial({}) }): Promise { const options: any = { params: {} diff --git a/__fixtures__/v-next/outputv4/evmos/claims/v1/query.rpc.Query.ts b/__fixtures__/v-next/outputv4/evmos/claims/v1/query.rpc.Query.ts index 9505ab0052..d477a713d7 100644 --- a/__fixtures__/v-next/outputv4/evmos/claims/v1/query.rpc.Query.ts +++ b/__fixtures__/v-next/outputv4/evmos/claims/v1/query.rpc.Query.ts @@ -1,11 +1,11 @@ -import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../../cosmos/base/query/v1beta1/pagination"; -import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; -import { Params, ParamsSDKType } from "./genesis"; -import { ClaimsRecordAddress, ClaimsRecordAddressSDKType, Claim, ClaimSDKType } from "./claims"; -import { Rpc } from "../../../helpers"; -import { BinaryReader } from "../../../binary"; +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../../cosmos/base/query/v1beta1/pagination.js"; +import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin.js"; +import { Params, ParamsSDKType } from "./genesis.js"; +import { ClaimsRecordAddress, ClaimsRecordAddressSDKType, Claim, ClaimSDKType } from "./claims.js"; +import { Rpc } from "../../../helpers.js"; +import { BinaryReader } from "../../../binary.js"; import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; -import { QueryTotalUnclaimedRequest, QueryTotalUnclaimedRequestSDKType, QueryTotalUnclaimedResponse, QueryTotalUnclaimedResponseSDKType, QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType, QueryClaimsRecordsRequest, QueryClaimsRecordsRequestSDKType, QueryClaimsRecordsResponse, QueryClaimsRecordsResponseSDKType, QueryClaimsRecordRequest, QueryClaimsRecordRequestSDKType, QueryClaimsRecordResponse, QueryClaimsRecordResponseSDKType, ReactiveQueryTotalUnclaimedRequest, ReactiveQueryParamsRequest, ReactiveQueryClaimsRecordsRequest, ReactiveQueryClaimsRecordRequest } from "./query"; +import { QueryTotalUnclaimedRequest, QueryTotalUnclaimedRequestSDKType, QueryTotalUnclaimedResponse, QueryTotalUnclaimedResponseSDKType, QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType, QueryClaimsRecordsRequest, QueryClaimsRecordsRequestSDKType, QueryClaimsRecordsResponse, QueryClaimsRecordsResponseSDKType, QueryClaimsRecordRequest, QueryClaimsRecordRequestSDKType, QueryClaimsRecordResponse, QueryClaimsRecordResponseSDKType } from "./query.js"; /** Query defines the gRPC querier service. */ export interface Query { /** TotalUnclaimed queries the total unclaimed tokens from the airdrop */ @@ -37,7 +37,7 @@ export class QueryClientImpl implements Query { return promise.then(data => QueryParamsResponse.decode(new BinaryReader(data))); } claimsRecords(request: QueryClaimsRecordsRequest = { - pagination: undefined + pagination: PageRequest.fromPartial({}) }): Promise { const data = QueryClaimsRecordsRequest.encode(request).finish(); const promise = this.rpc.request("evmos.claims.v1.Query", "ClaimsRecords", data); diff --git a/__fixtures__/v-next/outputv4/evmos/claims/v1/query.ts b/__fixtures__/v-next/outputv4/evmos/claims/v1/query.ts index 6b890f4142..c79acec275 100644 --- a/__fixtures__/v-next/outputv4/evmos/claims/v1/query.ts +++ b/__fixtures__/v-next/outputv4/evmos/claims/v1/query.ts @@ -1,18 +1,16 @@ -import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../../cosmos/base/query/v1beta1/pagination"; -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 { JsonSafe } from "../../../json-safe"; -import { DeepPartial, isSet } from "../../../helpers"; -import { ComputedRef } from "vue"; +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../../cosmos/base/query/v1beta1/pagination.js"; +import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin.js"; +import { Params, ParamsSDKType } from "./genesis.js"; +import { ClaimsRecordAddress, ClaimsRecordAddressSDKType, Claim, ClaimSDKType } from "./claims.js"; +import { BinaryReader, BinaryWriter } from "../../../binary.js"; +import { JsonSafe } from "../../../json-safe.js"; +import { DeepPartial, isSet } from "../../../helpers.js"; export const protobufPackage = "evmos.claims.v1"; /** * QueryTotalUnclaimedRequest is the request type for the Query/TotalUnclaimed * RPC method. */ export interface QueryTotalUnclaimedRequest {} -export interface ReactiveQueryTotalUnclaimedRequest {} export interface QueryTotalUnclaimedRequestProtoMsg { typeUrl: "/evmos.claims.v1.QueryTotalUnclaimedRequest"; value: Uint8Array; @@ -30,9 +28,6 @@ export interface QueryTotalUnclaimedResponse { /** coins defines the unclaimed coins */ coins: Coin[]; } -export interface ReactiveQueryTotalUnclaimedResponse { - coins: ComputedRef; -} export interface QueryTotalUnclaimedResponseProtoMsg { typeUrl: "/evmos.claims.v1.QueryTotalUnclaimedResponse"; value: Uint8Array; @@ -46,7 +41,6 @@ export interface QueryTotalUnclaimedResponseSDKType { } /** QueryParamsRequest is the request type for the Query/Params RPC method. */ export interface QueryParamsRequest {} -export interface ReactiveQueryParamsRequest {} export interface QueryParamsRequestProtoMsg { typeUrl: "/evmos.claims.v1.QueryParamsRequest"; value: Uint8Array; @@ -58,9 +52,6 @@ export interface QueryParamsResponse { /** params defines the parameters of the module. */ params: Params; } -export interface ReactiveQueryParamsResponse { - params: ComputedRef; -} export interface QueryParamsResponseProtoMsg { typeUrl: "/evmos.claims.v1.QueryParamsResponse"; value: Uint8Array; @@ -77,9 +68,6 @@ export interface QueryClaimsRecordsRequest { /** pagination defines an optional pagination for the request. */ pagination?: PageRequest; } -export interface ReactiveQueryClaimsRecordsRequest { - pagination?: ComputedRef; -} export interface QueryClaimsRecordsRequestProtoMsg { typeUrl: "/evmos.claims.v1.QueryClaimsRecordsRequest"; value: Uint8Array; @@ -101,10 +89,6 @@ export interface QueryClaimsRecordsResponse { /** pagination defines the pagination in the response. */ pagination?: PageResponse; } -export interface ReactiveQueryClaimsRecordsResponse { - claims: ComputedRef; - pagination?: ComputedRef; -} export interface QueryClaimsRecordsResponseProtoMsg { typeUrl: "/evmos.claims.v1.QueryClaimsRecordsResponse"; value: Uint8Array; @@ -125,9 +109,6 @@ export interface QueryClaimsRecordRequest { /** address defines the user to query claims record for */ address: string; } -export interface ReactiveQueryClaimsRecordRequest { - address: ComputedRef; -} export interface QueryClaimsRecordRequestProtoMsg { typeUrl: "/evmos.claims.v1.QueryClaimsRecordRequest"; value: Uint8Array; @@ -149,10 +130,6 @@ export interface QueryClaimsRecordResponse { /** the claims of the user */ claims: Claim[]; } -export interface ReactiveQueryClaimsRecordResponse { - initialClaimableAmount: ComputedRef; - claims: ComputedRef; -} export interface QueryClaimsRecordResponseProtoMsg { typeUrl: "/evmos.claims.v1.QueryClaimsRecordResponse"; value: Uint8Array; @@ -188,7 +165,8 @@ export const QueryTotalUnclaimedRequest = { return message; }, fromJSON(_: any): QueryTotalUnclaimedRequest { - return {}; + const obj = createBaseQueryTotalUnclaimedRequest(); + return obj; }, toJSON(_: QueryTotalUnclaimedRequest): JsonSafe { const obj: any = {}; @@ -263,9 +241,9 @@ export const QueryTotalUnclaimedResponse = { return message; }, fromJSON(object: any): QueryTotalUnclaimedResponse { - return { - coins: Array.isArray(object?.coins) ? object.coins.map((e: any) => Coin.fromJSON(e)) : [] - }; + const obj = createBaseQueryTotalUnclaimedResponse(); + if (Array.isArray(object?.coins)) obj.coins = object.coins.map((e: any) => Coin.fromJSON(e)); + return obj; }, toJSON(message: QueryTotalUnclaimedResponse): JsonSafe { const obj: any = {}; @@ -353,7 +331,8 @@ export const QueryParamsRequest = { return message; }, fromJSON(_: any): QueryParamsRequest { - return {}; + const obj = createBaseQueryParamsRequest(); + return obj; }, toJSON(_: QueryParamsRequest): JsonSafe { const obj: any = {}; @@ -428,9 +407,9 @@ export const QueryParamsResponse = { return message; }, fromJSON(object: any): QueryParamsResponse { - return { - params: isSet(object.params) ? Params.fromJSON(object.params) : undefined - }; + const obj = createBaseQueryParamsResponse(); + if (isSet(object.params)) obj.params = Params.fromJSON(object.params); + return obj; }, toJSON(message: QueryParamsResponse): JsonSafe { const obj: any = {}; @@ -439,7 +418,9 @@ export const QueryParamsResponse = { }, fromPartial(object: DeepPartial): QueryParamsResponse { const message = createBaseQueryParamsResponse(); - message.params = object.params !== undefined && object.params !== null ? Params.fromPartial(object.params) : undefined; + if (object.params !== undefined && object.params !== null) { + message.params = Params.fromPartial(object.params); + } return message; }, fromSDK(object: QueryParamsResponseSDKType): QueryParamsResponse { @@ -516,9 +497,9 @@ export const QueryClaimsRecordsRequest = { return message; }, fromJSON(object: any): QueryClaimsRecordsRequest { - return { - pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined - }; + const obj = createBaseQueryClaimsRecordsRequest(); + if (isSet(object.pagination)) obj.pagination = PageRequest.fromJSON(object.pagination); + return obj; }, toJSON(message: QueryClaimsRecordsRequest): JsonSafe { const obj: any = {}; @@ -527,7 +508,9 @@ export const QueryClaimsRecordsRequest = { }, fromPartial(object: DeepPartial): QueryClaimsRecordsRequest { const message = createBaseQueryClaimsRecordsRequest(); - message.pagination = object.pagination !== undefined && object.pagination !== null ? PageRequest.fromPartial(object.pagination) : undefined; + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageRequest.fromPartial(object.pagination); + } return message; }, fromSDK(object: QueryClaimsRecordsRequestSDKType): QueryClaimsRecordsRequest { @@ -611,10 +594,10 @@ export const QueryClaimsRecordsResponse = { return message; }, fromJSON(object: any): QueryClaimsRecordsResponse { - return { - claims: Array.isArray(object?.claims) ? object.claims.map((e: any) => ClaimsRecordAddress.fromJSON(e)) : [], - pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined - }; + const obj = createBaseQueryClaimsRecordsResponse(); + if (Array.isArray(object?.claims)) obj.claims = object.claims.map((e: any) => ClaimsRecordAddress.fromJSON(e)); + if (isSet(object.pagination)) obj.pagination = PageResponse.fromJSON(object.pagination); + return obj; }, toJSON(message: QueryClaimsRecordsResponse): JsonSafe { const obj: any = {}; @@ -629,7 +612,9 @@ export const QueryClaimsRecordsResponse = { fromPartial(object: DeepPartial): QueryClaimsRecordsResponse { const message = createBaseQueryClaimsRecordsResponse(); message.claims = object.claims?.map(e => ClaimsRecordAddress.fromPartial(e)) || []; - message.pagination = object.pagination !== undefined && object.pagination !== null ? PageResponse.fromPartial(object.pagination) : undefined; + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageResponse.fromPartial(object.pagination); + } return message; }, fromSDK(object: QueryClaimsRecordsResponseSDKType): QueryClaimsRecordsResponse { @@ -696,7 +681,7 @@ function createBaseQueryClaimsRecordRequest(): QueryClaimsRecordRequest { export const QueryClaimsRecordRequest = { typeUrl: "/evmos.claims.v1.QueryClaimsRecordRequest", encode(message: QueryClaimsRecordRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.address !== "") { + if (message.address !== undefined) { writer.uint32(10).string(message.address); } return writer; @@ -719,9 +704,9 @@ export const QueryClaimsRecordRequest = { return message; }, fromJSON(object: any): QueryClaimsRecordRequest { - return { - address: isSet(object.address) ? String(object.address) : "" - }; + const obj = createBaseQueryClaimsRecordRequest(); + if (isSet(object.address)) obj.address = String(object.address); + return obj; }, toJSON(message: QueryClaimsRecordRequest): JsonSafe { const obj: any = {}; @@ -785,7 +770,7 @@ function createBaseQueryClaimsRecordResponse(): QueryClaimsRecordResponse { export const QueryClaimsRecordResponse = { typeUrl: "/evmos.claims.v1.QueryClaimsRecordResponse", encode(message: QueryClaimsRecordResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.initialClaimableAmount !== "") { + if (message.initialClaimableAmount !== undefined) { writer.uint32(10).string(message.initialClaimableAmount); } for (const v of message.claims) { @@ -814,10 +799,10 @@ export const QueryClaimsRecordResponse = { return message; }, fromJSON(object: any): QueryClaimsRecordResponse { - return { - initialClaimableAmount: isSet(object.initialClaimableAmount) ? String(object.initialClaimableAmount) : "", - claims: Array.isArray(object?.claims) ? object.claims.map((e: any) => Claim.fromJSON(e)) : [] - }; + const obj = createBaseQueryClaimsRecordResponse(); + if (isSet(object.initialClaimableAmount)) obj.initialClaimableAmount = String(object.initialClaimableAmount); + if (Array.isArray(object?.claims)) obj.claims = object.claims.map((e: any) => Claim.fromJSON(e)); + return obj; }, toJSON(message: QueryClaimsRecordResponse): JsonSafe { const obj: any = {}; diff --git a/__fixtures__/v-next/outputv4/evmos/client.ts b/__fixtures__/v-next/outputv4/evmos/client.ts index 6b935a4a1d..f1a4c88c94 100644 --- a/__fixtures__/v-next/outputv4/evmos/client.ts +++ b/__fixtures__/v-next/outputv4/evmos/client.ts @@ -1,12 +1,12 @@ import { GeneratedType, Registry, OfflineSigner } from "@cosmjs/proto-signing"; import { defaultRegistryTypes, AminoTypes, SigningStargateClient } from "@cosmjs/stargate"; import { HttpEndpoint } from "@cosmjs/tendermint-rpc"; -import * as evmosErc20V1TxRegistry from "./erc20/v1/tx.registry"; -import * as evmosFeesV1TxRegistry from "./fees/v1/tx.registry"; -import * as evmosVestingV1TxRegistry from "./vesting/v1/tx.registry"; -import * as evmosErc20V1TxAmino from "./erc20/v1/tx.amino"; -import * as evmosFeesV1TxAmino from "./fees/v1/tx.amino"; -import * as evmosVestingV1TxAmino from "./vesting/v1/tx.amino"; +import * as evmosErc20V1TxRegistry from "./erc20/v1/tx.registry.js"; +import * as evmosFeesV1TxRegistry from "./fees/v1/tx.registry.js"; +import * as evmosVestingV1TxRegistry from "./vesting/v1/tx.registry.js"; +import * as evmosErc20V1TxAmino from "./erc20/v1/tx.amino.js"; +import * as evmosFeesV1TxAmino from "./fees/v1/tx.amino.js"; +import * as evmosVestingV1TxAmino from "./vesting/v1/tx.amino.js"; export const evmosAminoConverters = { ...evmosErc20V1TxAmino.AminoConverter, ...evmosFeesV1TxAmino.AminoConverter, diff --git a/__fixtures__/v-next/outputv4/evmos/epochs/v1/genesis.ts b/__fixtures__/v-next/outputv4/evmos/epochs/v1/genesis.ts index deabfccaf9..7bb574f8bd 100644 --- a/__fixtures__/v-next/outputv4/evmos/epochs/v1/genesis.ts +++ b/__fixtures__/v-next/outputv4/evmos/epochs/v1/genesis.ts @@ -1,9 +1,8 @@ -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 { JsonSafe } from "../../../json-safe"; -import { ComputedRef } from "vue"; +import { Timestamp, TimestampSDKType } from "../../../google/protobuf/timestamp.js"; +import { Duration, DurationSDKType } from "../../../google/protobuf/duration.js"; +import { BinaryReader, BinaryWriter } from "../../../binary.js"; +import { toTimestamp, fromTimestamp, isSet, DeepPartial } from "../../../helpers.js"; +import { JsonSafe } from "../../../json-safe.js"; export const protobufPackage = "evmos.epochs.v1"; export interface EpochInfo { identifier: string; @@ -14,15 +13,6 @@ export interface EpochInfo { epochCountingStarted: boolean; currentEpochStartHeight: bigint; } -export interface ReactiveEpochInfo { - identifier: ComputedRef; - startTime: ComputedRef; - duration: ComputedRef; - currentEpoch: ComputedRef; - currentEpochStartTime: ComputedRef; - epochCountingStarted: ComputedRef; - currentEpochStartHeight: ComputedRef; -} export interface EpochInfoProtoMsg { typeUrl: "/evmos.epochs.v1.EpochInfo"; value: Uint8Array; @@ -40,9 +30,6 @@ export interface EpochInfoSDKType { export interface GenesisState { epochs: EpochInfo[]; } -export interface ReactiveGenesisState { - epochs: ComputedRef; -} export interface GenesisStateProtoMsg { typeUrl: "/evmos.epochs.v1.GenesisState"; value: Uint8Array; @@ -65,7 +52,7 @@ function createBaseEpochInfo(): EpochInfo { export const EpochInfo = { typeUrl: "/evmos.epochs.v1.EpochInfo", encode(message: EpochInfo, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.identifier !== "") { + if (message.identifier !== undefined) { writer.uint32(10).string(message.identifier); } if (message.startTime !== undefined) { @@ -74,16 +61,16 @@ export const EpochInfo = { if (message.duration !== undefined) { Duration.encode(message.duration, writer.uint32(26).fork()).ldelim(); } - if (message.currentEpoch !== BigInt(0)) { + if (message.currentEpoch !== undefined) { writer.uint32(32).int64(message.currentEpoch); } if (message.currentEpochStartTime !== undefined) { Timestamp.encode(toTimestamp(message.currentEpochStartTime), writer.uint32(42).fork()).ldelim(); } - if (message.epochCountingStarted === true) { + if (message.epochCountingStarted !== undefined) { writer.uint32(48).bool(message.epochCountingStarted); } - if (message.currentEpochStartHeight !== BigInt(0)) { + if (message.currentEpochStartHeight !== undefined) { writer.uint32(56).int64(message.currentEpochStartHeight); } return writer; @@ -124,15 +111,15 @@ export const EpochInfo = { return message; }, fromJSON(object: any): EpochInfo { - return { - identifier: isSet(object.identifier) ? String(object.identifier) : "", - startTime: isSet(object.startTime) ? new Date(object.startTime) : undefined, - duration: isSet(object.duration) ? Duration.fromJSON(object.duration) : undefined, - currentEpoch: isSet(object.currentEpoch) ? BigInt(object.currentEpoch.toString()) : BigInt(0), - currentEpochStartTime: isSet(object.currentEpochStartTime) ? new Date(object.currentEpochStartTime) : undefined, - epochCountingStarted: isSet(object.epochCountingStarted) ? Boolean(object.epochCountingStarted) : false, - currentEpochStartHeight: isSet(object.currentEpochStartHeight) ? BigInt(object.currentEpochStartHeight.toString()) : BigInt(0) - }; + const obj = createBaseEpochInfo(); + if (isSet(object.identifier)) obj.identifier = String(object.identifier); + if (isSet(object.startTime)) obj.startTime = new Date(object.startTime); + if (isSet(object.duration)) obj.duration = Duration.fromJSON(object.duration); + if (isSet(object.currentEpoch)) obj.currentEpoch = BigInt(object.currentEpoch.toString()); + if (isSet(object.currentEpochStartTime)) obj.currentEpochStartTime = new Date(object.currentEpochStartTime); + if (isSet(object.epochCountingStarted)) obj.epochCountingStarted = Boolean(object.epochCountingStarted); + if (isSet(object.currentEpochStartHeight)) obj.currentEpochStartHeight = BigInt(object.currentEpochStartHeight.toString()); + return obj; }, toJSON(message: EpochInfo): JsonSafe { const obj: any = {}; @@ -149,11 +136,17 @@ export const EpochInfo = { const message = createBaseEpochInfo(); message.identifier = object.identifier ?? ""; message.startTime = object.startTime ?? undefined; - message.duration = object.duration !== undefined && object.duration !== null ? Duration.fromPartial(object.duration) : undefined; - message.currentEpoch = object.currentEpoch !== undefined && object.currentEpoch !== null ? BigInt(object.currentEpoch.toString()) : BigInt(0); + if (object.duration !== undefined && object.duration !== null) { + message.duration = Duration.fromPartial(object.duration); + } + if (object.currentEpoch !== undefined && object.currentEpoch !== null) { + message.currentEpoch = BigInt(object.currentEpoch.toString()); + } message.currentEpochStartTime = object.currentEpochStartTime ?? undefined; message.epochCountingStarted = object.epochCountingStarted ?? false; - message.currentEpochStartHeight = object.currentEpochStartHeight !== undefined && object.currentEpochStartHeight !== null ? BigInt(object.currentEpochStartHeight.toString()) : BigInt(0); + if (object.currentEpochStartHeight !== undefined && object.currentEpochStartHeight !== null) { + message.currentEpochStartHeight = BigInt(object.currentEpochStartHeight.toString()); + } return message; }, fromSDK(object: EpochInfoSDKType): EpochInfo { @@ -272,9 +265,9 @@ export const GenesisState = { return message; }, fromJSON(object: any): GenesisState { - return { - epochs: Array.isArray(object?.epochs) ? object.epochs.map((e: any) => EpochInfo.fromJSON(e)) : [] - }; + const obj = createBaseGenesisState(); + if (Array.isArray(object?.epochs)) obj.epochs = object.epochs.map((e: any) => EpochInfo.fromJSON(e)); + return obj; }, toJSON(message: GenesisState): JsonSafe { const obj: any = {}; diff --git a/__fixtures__/v-next/outputv4/evmos/epochs/v1/query.lcd.ts b/__fixtures__/v-next/outputv4/evmos/epochs/v1/query.lcd.ts index 5f039c08b0..adae7a040b 100644 --- a/__fixtures__/v-next/outputv4/evmos/epochs/v1/query.lcd.ts +++ b/__fixtures__/v-next/outputv4/evmos/epochs/v1/query.lcd.ts @@ -1,8 +1,8 @@ -import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../../cosmos/base/query/v1beta1/pagination"; -import { EpochInfo, EpochInfoSDKType } from "./genesis"; -import { setPaginationParams } from "../../../helpers"; +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../../cosmos/base/query/v1beta1/pagination.js"; +import { EpochInfo, EpochInfoSDKType } from "./genesis.js"; +import { setPaginationParams } from "../../../helpers.js"; import { LCDClient } from "@cosmology/lcd"; -import { QueryEpochsInfoRequest, QueryEpochsInfoRequestSDKType, QueryEpochsInfoResponse, QueryEpochsInfoResponseSDKType, QueryCurrentEpochRequest, QueryCurrentEpochRequestSDKType, QueryCurrentEpochResponse, QueryCurrentEpochResponseSDKType } from "./query"; +import { QueryEpochsInfoRequest, QueryEpochsInfoRequestSDKType, QueryEpochsInfoResponse, QueryEpochsInfoResponseSDKType, QueryCurrentEpochRequest, QueryCurrentEpochRequestSDKType, QueryCurrentEpochResponse, QueryCurrentEpochResponseSDKType } from "./query.js"; export class LCDQueryClient { req: LCDClient; constructor({ @@ -16,7 +16,7 @@ export class LCDQueryClient { } /* EpochInfos provide running epochInfos */ async epochInfos(params: QueryEpochsInfoRequest = { - pagination: undefined + pagination: PageRequest.fromPartial({}) }): Promise { const options: any = { params: {} diff --git a/__fixtures__/v-next/outputv4/evmos/epochs/v1/query.rpc.Query.ts b/__fixtures__/v-next/outputv4/evmos/epochs/v1/query.rpc.Query.ts index ff0ee5ddac..fce4616b32 100644 --- a/__fixtures__/v-next/outputv4/evmos/epochs/v1/query.rpc.Query.ts +++ b/__fixtures__/v-next/outputv4/evmos/epochs/v1/query.rpc.Query.ts @@ -1,9 +1,9 @@ -import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../../cosmos/base/query/v1beta1/pagination"; -import { EpochInfo, EpochInfoSDKType } from "./genesis"; -import { Rpc } from "../../../helpers"; -import { BinaryReader } from "../../../binary"; +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../../cosmos/base/query/v1beta1/pagination.js"; +import { EpochInfo, EpochInfoSDKType } from "./genesis.js"; +import { Rpc } from "../../../helpers.js"; +import { BinaryReader } from "../../../binary.js"; import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; -import { QueryEpochsInfoRequest, QueryEpochsInfoRequestSDKType, QueryEpochsInfoResponse, QueryEpochsInfoResponseSDKType, QueryCurrentEpochRequest, QueryCurrentEpochRequestSDKType, QueryCurrentEpochResponse, QueryCurrentEpochResponseSDKType, ReactiveQueryEpochsInfoRequest, ReactiveQueryCurrentEpochRequest } from "./query"; +import { QueryEpochsInfoRequest, QueryEpochsInfoRequestSDKType, QueryEpochsInfoResponse, QueryEpochsInfoResponseSDKType, QueryCurrentEpochRequest, QueryCurrentEpochRequestSDKType, QueryCurrentEpochResponse, QueryCurrentEpochResponseSDKType } from "./query.js"; /** Query defines the gRPC querier service. */ export interface Query { /** EpochInfos provide running epochInfos */ @@ -19,7 +19,7 @@ export class QueryClientImpl implements Query { this.currentEpoch = this.currentEpoch.bind(this); } epochInfos(request: QueryEpochsInfoRequest = { - pagination: undefined + pagination: PageRequest.fromPartial({}) }): Promise { const data = QueryEpochsInfoRequest.encode(request).finish(); const promise = this.rpc.request("evmos.epochs.v1.Query", "EpochInfos", data); diff --git a/__fixtures__/v-next/outputv4/evmos/epochs/v1/query.ts b/__fixtures__/v-next/outputv4/evmos/epochs/v1/query.ts index 524bfe4a72..1c985d7ede 100644 --- a/__fixtures__/v-next/outputv4/evmos/epochs/v1/query.ts +++ b/__fixtures__/v-next/outputv4/evmos/epochs/v1/query.ts @@ -1,16 +1,12 @@ -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 { JsonSafe } from "../../../json-safe"; -import { ComputedRef } from "vue"; +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../../cosmos/base/query/v1beta1/pagination.js"; +import { EpochInfo, EpochInfoSDKType } from "./genesis.js"; +import { BinaryReader, BinaryWriter } from "../../../binary.js"; +import { isSet, DeepPartial } from "../../../helpers.js"; +import { JsonSafe } from "../../../json-safe.js"; export const protobufPackage = "evmos.epochs.v1"; export interface QueryEpochsInfoRequest { pagination?: PageRequest; } -export interface ReactiveQueryEpochsInfoRequest { - pagination?: ComputedRef; -} export interface QueryEpochsInfoRequestProtoMsg { typeUrl: "/evmos.epochs.v1.QueryEpochsInfoRequest"; value: Uint8Array; @@ -22,10 +18,6 @@ export interface QueryEpochsInfoResponse { epochs: EpochInfo[]; pagination?: PageResponse; } -export interface ReactiveQueryEpochsInfoResponse { - epochs: ComputedRef; - pagination?: ComputedRef; -} export interface QueryEpochsInfoResponseProtoMsg { typeUrl: "/evmos.epochs.v1.QueryEpochsInfoResponse"; value: Uint8Array; @@ -37,9 +29,6 @@ export interface QueryEpochsInfoResponseSDKType { export interface QueryCurrentEpochRequest { identifier: string; } -export interface ReactiveQueryCurrentEpochRequest { - identifier: ComputedRef; -} export interface QueryCurrentEpochRequestProtoMsg { typeUrl: "/evmos.epochs.v1.QueryCurrentEpochRequest"; value: Uint8Array; @@ -50,9 +39,6 @@ export interface QueryCurrentEpochRequestSDKType { export interface QueryCurrentEpochResponse { currentEpoch: bigint; } -export interface ReactiveQueryCurrentEpochResponse { - currentEpoch: ComputedRef; -} export interface QueryCurrentEpochResponseProtoMsg { typeUrl: "/evmos.epochs.v1.QueryCurrentEpochResponse"; value: Uint8Array; @@ -91,9 +77,9 @@ export const QueryEpochsInfoRequest = { return message; }, fromJSON(object: any): QueryEpochsInfoRequest { - return { - pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined - }; + const obj = createBaseQueryEpochsInfoRequest(); + if (isSet(object.pagination)) obj.pagination = PageRequest.fromJSON(object.pagination); + return obj; }, toJSON(message: QueryEpochsInfoRequest): JsonSafe { const obj: any = {}; @@ -102,7 +88,9 @@ export const QueryEpochsInfoRequest = { }, fromPartial(object: DeepPartial): QueryEpochsInfoRequest { const message = createBaseQueryEpochsInfoRequest(); - message.pagination = object.pagination !== undefined && object.pagination !== null ? PageRequest.fromPartial(object.pagination) : undefined; + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageRequest.fromPartial(object.pagination); + } return message; }, fromSDK(object: QueryEpochsInfoRequestSDKType): QueryEpochsInfoRequest { @@ -186,10 +174,10 @@ export const QueryEpochsInfoResponse = { return message; }, fromJSON(object: any): QueryEpochsInfoResponse { - return { - epochs: Array.isArray(object?.epochs) ? object.epochs.map((e: any) => EpochInfo.fromJSON(e)) : [], - pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined - }; + const obj = createBaseQueryEpochsInfoResponse(); + if (Array.isArray(object?.epochs)) obj.epochs = object.epochs.map((e: any) => EpochInfo.fromJSON(e)); + if (isSet(object.pagination)) obj.pagination = PageResponse.fromJSON(object.pagination); + return obj; }, toJSON(message: QueryEpochsInfoResponse): JsonSafe { const obj: any = {}; @@ -204,7 +192,9 @@ export const QueryEpochsInfoResponse = { fromPartial(object: DeepPartial): QueryEpochsInfoResponse { const message = createBaseQueryEpochsInfoResponse(); message.epochs = object.epochs?.map(e => EpochInfo.fromPartial(e)) || []; - message.pagination = object.pagination !== undefined && object.pagination !== null ? PageResponse.fromPartial(object.pagination) : undefined; + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageResponse.fromPartial(object.pagination); + } return message; }, fromSDK(object: QueryEpochsInfoResponseSDKType): QueryEpochsInfoResponse { @@ -271,7 +261,7 @@ function createBaseQueryCurrentEpochRequest(): QueryCurrentEpochRequest { export const QueryCurrentEpochRequest = { typeUrl: "/evmos.epochs.v1.QueryCurrentEpochRequest", encode(message: QueryCurrentEpochRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.identifier !== "") { + if (message.identifier !== undefined) { writer.uint32(10).string(message.identifier); } return writer; @@ -294,9 +284,9 @@ export const QueryCurrentEpochRequest = { return message; }, fromJSON(object: any): QueryCurrentEpochRequest { - return { - identifier: isSet(object.identifier) ? String(object.identifier) : "" - }; + const obj = createBaseQueryCurrentEpochRequest(); + if (isSet(object.identifier)) obj.identifier = String(object.identifier); + return obj; }, toJSON(message: QueryCurrentEpochRequest): JsonSafe { const obj: any = {}; @@ -359,7 +349,7 @@ function createBaseQueryCurrentEpochResponse(): QueryCurrentEpochResponse { export const QueryCurrentEpochResponse = { typeUrl: "/evmos.epochs.v1.QueryCurrentEpochResponse", encode(message: QueryCurrentEpochResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.currentEpoch !== BigInt(0)) { + if (message.currentEpoch !== undefined) { writer.uint32(8).int64(message.currentEpoch); } return writer; @@ -382,9 +372,9 @@ export const QueryCurrentEpochResponse = { return message; }, fromJSON(object: any): QueryCurrentEpochResponse { - return { - currentEpoch: isSet(object.currentEpoch) ? BigInt(object.currentEpoch.toString()) : BigInt(0) - }; + const obj = createBaseQueryCurrentEpochResponse(); + if (isSet(object.currentEpoch)) obj.currentEpoch = BigInt(object.currentEpoch.toString()); + return obj; }, toJSON(message: QueryCurrentEpochResponse): JsonSafe { const obj: any = {}; @@ -393,7 +383,9 @@ export const QueryCurrentEpochResponse = { }, fromPartial(object: DeepPartial): QueryCurrentEpochResponse { const message = createBaseQueryCurrentEpochResponse(); - message.currentEpoch = object.currentEpoch !== undefined && object.currentEpoch !== null ? BigInt(object.currentEpoch.toString()) : BigInt(0); + if (object.currentEpoch !== undefined && object.currentEpoch !== null) { + message.currentEpoch = BigInt(object.currentEpoch.toString()); + } return message; }, fromSDK(object: QueryCurrentEpochResponseSDKType): QueryCurrentEpochResponse { diff --git a/__fixtures__/v-next/outputv4/evmos/erc20/v1/erc20.ts b/__fixtures__/v-next/outputv4/evmos/erc20/v1/erc20.ts index 54f066e82c..0f907122ba 100644 --- a/__fixtures__/v-next/outputv4/evmos/erc20/v1/erc20.ts +++ b/__fixtures__/v-next/outputv4/evmos/erc20/v1/erc20.ts @@ -1,8 +1,7 @@ -import { Metadata, MetadataSDKType } from "../../../cosmos/bank/v1beta1/bank"; -import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; -import { JsonSafe } from "../../../json-safe"; -import { ComputedRef } from "vue"; +import { Metadata, MetadataSDKType } from "../../../cosmos/bank/v1beta1/bank.js"; +import { BinaryReader, BinaryWriter } from "../../../binary.js"; +import { isSet, DeepPartial } from "../../../helpers.js"; +import { JsonSafe } from "../../../json-safe.js"; export const protobufPackage = "evmos.erc20.v1"; /** Owner enumerates the ownership of a ERC20 contract. */ export enum Owner { @@ -59,12 +58,6 @@ export interface TokenPair { /** ERC20 owner address ENUM (0 invalid, 1 ModuleAccount, 2 external address) */ contractOwner: Owner; } -export interface ReactiveTokenPair { - erc20Address: ComputedRef; - denom: ComputedRef; - enabled: ComputedRef; - contractOwner: ComputedRef; -} export interface TokenPairProtoMsg { typeUrl: "/evmos.erc20.v1.TokenPair"; value: Uint8Array; @@ -91,11 +84,6 @@ export interface RegisterCoinProposal { /** metadata of the native Cosmos coin */ metadata: Metadata; } -export interface ReactiveRegisterCoinProposal { - title: ComputedRef; - description: ComputedRef; - metadata: ComputedRef; -} export interface RegisterCoinProposalProtoMsg { typeUrl: "/evmos.erc20.v1.RegisterCoinProposal"; value: Uint8Array; @@ -121,11 +109,6 @@ export interface RegisterERC20Proposal { /** contract address of ERC20 token */ erc20address: string; } -export interface ReactiveRegisterERC20Proposal { - title: ComputedRef; - description: ComputedRef; - erc20address: ComputedRef; -} export interface RegisterERC20ProposalProtoMsg { typeUrl: "/evmos.erc20.v1.RegisterERC20Proposal"; value: Uint8Array; @@ -154,11 +137,6 @@ export interface ToggleTokenConversionProposal { */ token: string; } -export interface ReactiveToggleTokenConversionProposal { - title: ComputedRef; - description: ComputedRef; - token: ComputedRef; -} export interface ToggleTokenConversionProposalProtoMsg { typeUrl: "/evmos.erc20.v1.ToggleTokenConversionProposal"; value: Uint8Array; @@ -183,13 +161,13 @@ function createBaseTokenPair(): TokenPair { export const TokenPair = { typeUrl: "/evmos.erc20.v1.TokenPair", encode(message: TokenPair, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.erc20Address !== "") { + if (message.erc20Address !== undefined) { writer.uint32(10).string(message.erc20Address); } - if (message.denom !== "") { + if (message.denom !== undefined) { writer.uint32(18).string(message.denom); } - if (message.enabled === true) { + if (message.enabled !== undefined) { writer.uint32(24).bool(message.enabled); } if (message.contractOwner !== 0) { @@ -224,12 +202,12 @@ export const TokenPair = { return message; }, fromJSON(object: any): TokenPair { - return { - erc20Address: isSet(object.erc20Address) ? String(object.erc20Address) : "", - denom: isSet(object.denom) ? String(object.denom) : "", - enabled: isSet(object.enabled) ? Boolean(object.enabled) : false, - contractOwner: isSet(object.contractOwner) ? ownerFromJSON(object.contractOwner) : -1 - }; + const obj = createBaseTokenPair(); + if (isSet(object.erc20Address)) obj.erc20Address = String(object.erc20Address); + if (isSet(object.denom)) obj.denom = String(object.denom); + if (isSet(object.enabled)) obj.enabled = Boolean(object.enabled); + if (isSet(object.contractOwner)) obj.contractOwner = ownerFromJSON(object.contractOwner); + return obj; }, toJSON(message: TokenPair): JsonSafe { const obj: any = {}; @@ -321,10 +299,10 @@ function createBaseRegisterCoinProposal(): RegisterCoinProposal { export const RegisterCoinProposal = { typeUrl: "/evmos.erc20.v1.RegisterCoinProposal", encode(message: RegisterCoinProposal, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.title !== "") { + if (message.title !== undefined) { writer.uint32(10).string(message.title); } - if (message.description !== "") { + if (message.description !== undefined) { writer.uint32(18).string(message.description); } if (message.metadata !== undefined) { @@ -356,11 +334,11 @@ export const RegisterCoinProposal = { return message; }, fromJSON(object: any): RegisterCoinProposal { - return { - title: isSet(object.title) ? String(object.title) : "", - description: isSet(object.description) ? String(object.description) : "", - metadata: isSet(object.metadata) ? Metadata.fromJSON(object.metadata) : undefined - }; + const obj = createBaseRegisterCoinProposal(); + if (isSet(object.title)) obj.title = String(object.title); + if (isSet(object.description)) obj.description = String(object.description); + if (isSet(object.metadata)) obj.metadata = Metadata.fromJSON(object.metadata); + return obj; }, toJSON(message: RegisterCoinProposal): JsonSafe { const obj: any = {}; @@ -373,7 +351,9 @@ export const RegisterCoinProposal = { const message = createBaseRegisterCoinProposal(); message.title = object.title ?? ""; message.description = object.description ?? ""; - message.metadata = object.metadata !== undefined && object.metadata !== null ? Metadata.fromPartial(object.metadata) : undefined; + if (object.metadata !== undefined && object.metadata !== null) { + message.metadata = Metadata.fromPartial(object.metadata); + } return message; }, fromSDK(object: RegisterCoinProposalSDKType): RegisterCoinProposal { @@ -443,13 +423,13 @@ function createBaseRegisterERC20Proposal(): RegisterERC20Proposal { export const RegisterERC20Proposal = { typeUrl: "/evmos.erc20.v1.RegisterERC20Proposal", encode(message: RegisterERC20Proposal, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.title !== "") { + if (message.title !== undefined) { writer.uint32(10).string(message.title); } - if (message.description !== "") { + if (message.description !== undefined) { writer.uint32(18).string(message.description); } - if (message.erc20address !== "") { + if (message.erc20address !== undefined) { writer.uint32(26).string(message.erc20address); } return writer; @@ -478,11 +458,11 @@ export const RegisterERC20Proposal = { return message; }, fromJSON(object: any): RegisterERC20Proposal { - return { - title: isSet(object.title) ? String(object.title) : "", - description: isSet(object.description) ? String(object.description) : "", - erc20address: isSet(object.erc20address) ? String(object.erc20address) : "" - }; + const obj = createBaseRegisterERC20Proposal(); + if (isSet(object.title)) obj.title = String(object.title); + if (isSet(object.description)) obj.description = String(object.description); + if (isSet(object.erc20address)) obj.erc20address = String(object.erc20address); + return obj; }, toJSON(message: RegisterERC20Proposal): JsonSafe { const obj: any = {}; @@ -565,13 +545,13 @@ function createBaseToggleTokenConversionProposal(): ToggleTokenConversionProposa export const ToggleTokenConversionProposal = { typeUrl: "/evmos.erc20.v1.ToggleTokenConversionProposal", encode(message: ToggleTokenConversionProposal, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.title !== "") { + if (message.title !== undefined) { writer.uint32(10).string(message.title); } - if (message.description !== "") { + if (message.description !== undefined) { writer.uint32(18).string(message.description); } - if (message.token !== "") { + if (message.token !== undefined) { writer.uint32(26).string(message.token); } return writer; @@ -600,11 +580,11 @@ export const ToggleTokenConversionProposal = { return message; }, fromJSON(object: any): ToggleTokenConversionProposal { - return { - title: isSet(object.title) ? String(object.title) : "", - description: isSet(object.description) ? String(object.description) : "", - token: isSet(object.token) ? String(object.token) : "" - }; + const obj = createBaseToggleTokenConversionProposal(); + if (isSet(object.title)) obj.title = String(object.title); + if (isSet(object.description)) obj.description = String(object.description); + if (isSet(object.token)) obj.token = String(object.token); + return obj; }, toJSON(message: ToggleTokenConversionProposal): JsonSafe { const obj: any = {}; diff --git a/__fixtures__/v-next/outputv4/evmos/erc20/v1/genesis.ts b/__fixtures__/v-next/outputv4/evmos/erc20/v1/genesis.ts index 6985b9fabf..ab01fa0129 100644 --- a/__fixtures__/v-next/outputv4/evmos/erc20/v1/genesis.ts +++ b/__fixtures__/v-next/outputv4/evmos/erc20/v1/genesis.ts @@ -1,8 +1,7 @@ -import { TokenPair, TokenPairSDKType } from "./erc20"; -import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; -import { JsonSafe } from "../../../json-safe"; -import { ComputedRef } from "vue"; +import { TokenPair, TokenPairSDKType } from "./erc20.js"; +import { BinaryReader, BinaryWriter } from "../../../binary.js"; +import { isSet, DeepPartial } from "../../../helpers.js"; +import { JsonSafe } from "../../../json-safe.js"; export const protobufPackage = "evmos.erc20.v1"; /** GenesisState defines the module's genesis state. */ export interface GenesisState { @@ -11,10 +10,6 @@ export interface GenesisState { /** registered token pairs */ tokenPairs: TokenPair[]; } -export interface ReactiveGenesisState { - params: ComputedRef; - tokenPairs: ComputedRef; -} export interface GenesisStateProtoMsg { typeUrl: "/evmos.erc20.v1.GenesisState"; value: Uint8Array; @@ -35,10 +30,6 @@ export interface Params { */ enableEvmHook: boolean; } -export interface ReactiveParams { - enableErc20: ComputedRef; - enableEvmHook: ComputedRef; -} export interface ParamsProtoMsg { typeUrl: "/evmos.erc20.v1.Params"; value: Uint8Array; @@ -86,10 +77,10 @@ export const GenesisState = { return message; }, fromJSON(object: any): GenesisState { - return { - params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, - tokenPairs: Array.isArray(object?.tokenPairs) ? object.tokenPairs.map((e: any) => TokenPair.fromJSON(e)) : [] - }; + const obj = createBaseGenesisState(); + if (isSet(object.params)) obj.params = Params.fromJSON(object.params); + if (Array.isArray(object?.tokenPairs)) obj.tokenPairs = object.tokenPairs.map((e: any) => TokenPair.fromJSON(e)); + return obj; }, toJSON(message: GenesisState): JsonSafe { const obj: any = {}; @@ -103,7 +94,9 @@ export const GenesisState = { }, fromPartial(object: DeepPartial): GenesisState { const message = createBaseGenesisState(); - message.params = object.params !== undefined && object.params !== null ? Params.fromPartial(object.params) : undefined; + if (object.params !== undefined && object.params !== null) { + message.params = Params.fromPartial(object.params); + } message.tokenPairs = object.tokenPairs?.map(e => TokenPair.fromPartial(e)) || []; return message; }, @@ -172,10 +165,10 @@ function createBaseParams(): Params { export const Params = { typeUrl: "/evmos.erc20.v1.Params", encode(message: Params, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.enableErc20 === true) { + if (message.enableErc20 !== undefined) { writer.uint32(8).bool(message.enableErc20); } - if (message.enableEvmHook === true) { + if (message.enableEvmHook !== undefined) { writer.uint32(16).bool(message.enableEvmHook); } return writer; @@ -201,10 +194,10 @@ export const Params = { return message; }, fromJSON(object: any): Params { - return { - enableErc20: isSet(object.enableErc20) ? Boolean(object.enableErc20) : false, - enableEvmHook: isSet(object.enableEvmHook) ? Boolean(object.enableEvmHook) : false - }; + const obj = createBaseParams(); + if (isSet(object.enableErc20)) obj.enableErc20 = Boolean(object.enableErc20); + if (isSet(object.enableEvmHook)) obj.enableEvmHook = Boolean(object.enableEvmHook); + return obj; }, toJSON(message: Params): JsonSafe { const obj: any = {}; diff --git a/__fixtures__/v-next/outputv4/evmos/erc20/v1/query.lcd.ts b/__fixtures__/v-next/outputv4/evmos/erc20/v1/query.lcd.ts index 5e87666b0e..342838d766 100644 --- a/__fixtures__/v-next/outputv4/evmos/erc20/v1/query.lcd.ts +++ b/__fixtures__/v-next/outputv4/evmos/erc20/v1/query.lcd.ts @@ -1,9 +1,9 @@ -import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../../cosmos/base/query/v1beta1/pagination"; -import { TokenPair, TokenPairSDKType } from "./erc20"; -import { Params, ParamsSDKType } from "./genesis"; -import { setPaginationParams } from "../../../helpers"; +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../../cosmos/base/query/v1beta1/pagination.js"; +import { TokenPair, TokenPairSDKType } from "./erc20.js"; +import { Params, ParamsSDKType } from "./genesis.js"; +import { setPaginationParams } from "../../../helpers.js"; import { LCDClient } from "@cosmology/lcd"; -import { QueryTokenPairsRequest, QueryTokenPairsRequestSDKType, QueryTokenPairsResponse, QueryTokenPairsResponseSDKType, QueryTokenPairRequest, QueryTokenPairRequestSDKType, QueryTokenPairResponse, QueryTokenPairResponseSDKType, QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType } from "./query"; +import { QueryTokenPairsRequest, QueryTokenPairsRequestSDKType, QueryTokenPairsResponse, QueryTokenPairsResponseSDKType, QueryTokenPairRequest, QueryTokenPairRequestSDKType, QueryTokenPairResponse, QueryTokenPairResponseSDKType, QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType } from "./query.js"; export class LCDQueryClient { req: LCDClient; constructor({ @@ -18,7 +18,7 @@ export class LCDQueryClient { } /* TokenPairs retrieves registered token pairs */ async tokenPairs(params: QueryTokenPairsRequest = { - pagination: undefined + pagination: PageRequest.fromPartial({}) }): Promise { const options: any = { params: {} diff --git a/__fixtures__/v-next/outputv4/evmos/erc20/v1/query.rpc.Query.ts b/__fixtures__/v-next/outputv4/evmos/erc20/v1/query.rpc.Query.ts index b9bb36ea4b..39cb552d59 100644 --- a/__fixtures__/v-next/outputv4/evmos/erc20/v1/query.rpc.Query.ts +++ b/__fixtures__/v-next/outputv4/evmos/erc20/v1/query.rpc.Query.ts @@ -1,10 +1,10 @@ -import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../../cosmos/base/query/v1beta1/pagination"; -import { TokenPair, TokenPairSDKType } from "./erc20"; -import { Params, ParamsSDKType } from "./genesis"; -import { Rpc } from "../../../helpers"; -import { BinaryReader } from "../../../binary"; +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../../cosmos/base/query/v1beta1/pagination.js"; +import { TokenPair, TokenPairSDKType } from "./erc20.js"; +import { Params, ParamsSDKType } from "./genesis.js"; +import { Rpc } from "../../../helpers.js"; +import { BinaryReader } from "../../../binary.js"; import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; -import { QueryTokenPairsRequest, QueryTokenPairsRequestSDKType, QueryTokenPairsResponse, QueryTokenPairsResponseSDKType, QueryTokenPairRequest, QueryTokenPairRequestSDKType, QueryTokenPairResponse, QueryTokenPairResponseSDKType, QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType, ReactiveQueryTokenPairsRequest, ReactiveQueryTokenPairRequest, ReactiveQueryParamsRequest } from "./query"; +import { QueryTokenPairsRequest, QueryTokenPairsRequestSDKType, QueryTokenPairsResponse, QueryTokenPairsResponseSDKType, QueryTokenPairRequest, QueryTokenPairRequestSDKType, QueryTokenPairResponse, QueryTokenPairResponseSDKType, QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType } from "./query.js"; /** Query defines the gRPC querier service. */ export interface Query { /** TokenPairs retrieves registered token pairs */ @@ -23,7 +23,7 @@ export class QueryClientImpl implements Query { this.params = this.params.bind(this); } tokenPairs(request: QueryTokenPairsRequest = { - pagination: undefined + pagination: PageRequest.fromPartial({}) }): Promise { const data = QueryTokenPairsRequest.encode(request).finish(); const promise = this.rpc.request("evmos.erc20.v1.Query", "TokenPairs", data); diff --git a/__fixtures__/v-next/outputv4/evmos/erc20/v1/query.ts b/__fixtures__/v-next/outputv4/evmos/erc20/v1/query.ts index 6d12247f9f..f61037c59e 100644 --- a/__fixtures__/v-next/outputv4/evmos/erc20/v1/query.ts +++ b/__fixtures__/v-next/outputv4/evmos/erc20/v1/query.ts @@ -1,10 +1,9 @@ -import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../../cosmos/base/query/v1beta1/pagination"; -import { TokenPair, TokenPairSDKType } from "./erc20"; -import { Params, ParamsSDKType } from "./genesis"; -import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; -import { JsonSafe } from "../../../json-safe"; -import { ComputedRef } from "vue"; +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../../cosmos/base/query/v1beta1/pagination.js"; +import { TokenPair, TokenPairSDKType } from "./erc20.js"; +import { Params, ParamsSDKType } from "./genesis.js"; +import { BinaryReader, BinaryWriter } from "../../../binary.js"; +import { isSet, DeepPartial } from "../../../helpers.js"; +import { JsonSafe } from "../../../json-safe.js"; export const protobufPackage = "evmos.erc20.v1"; /** * QueryTokenPairsRequest is the request type for the Query/TokenPairs RPC @@ -14,9 +13,6 @@ export interface QueryTokenPairsRequest { /** pagination defines an optional pagination for the request. */ pagination?: PageRequest; } -export interface ReactiveQueryTokenPairsRequest { - pagination?: ComputedRef; -} export interface QueryTokenPairsRequestProtoMsg { typeUrl: "/evmos.erc20.v1.QueryTokenPairsRequest"; value: Uint8Array; @@ -37,10 +33,6 @@ export interface QueryTokenPairsResponse { /** pagination defines the pagination in the response. */ pagination?: PageResponse; } -export interface ReactiveQueryTokenPairsResponse { - tokenPairs: ComputedRef; - pagination?: ComputedRef; -} export interface QueryTokenPairsResponseProtoMsg { typeUrl: "/evmos.erc20.v1.QueryTokenPairsResponse"; value: Uint8Array; @@ -61,9 +53,6 @@ export interface QueryTokenPairRequest { */ token: string; } -export interface ReactiveQueryTokenPairRequest { - token: ComputedRef; -} export interface QueryTokenPairRequestProtoMsg { typeUrl: "/evmos.erc20.v1.QueryTokenPairRequest"; value: Uint8Array; @@ -79,9 +68,6 @@ export interface QueryTokenPairRequestSDKType { export interface QueryTokenPairResponse { tokenPair: TokenPair; } -export interface ReactiveQueryTokenPairResponse { - tokenPair: ComputedRef; -} export interface QueryTokenPairResponseProtoMsg { typeUrl: "/evmos.erc20.v1.QueryTokenPairResponse"; value: Uint8Array; @@ -95,7 +81,6 @@ export interface QueryTokenPairResponseSDKType { } /** QueryParamsRequest is the request type for the Query/Params RPC method. */ export interface QueryParamsRequest {} -export interface ReactiveQueryParamsRequest {} export interface QueryParamsRequestProtoMsg { typeUrl: "/evmos.erc20.v1.QueryParamsRequest"; value: Uint8Array; @@ -109,9 +94,6 @@ export interface QueryParamsRequestSDKType {} export interface QueryParamsResponse { params: Params; } -export interface ReactiveQueryParamsResponse { - params: ComputedRef; -} export interface QueryParamsResponseProtoMsg { typeUrl: "/evmos.erc20.v1.QueryParamsResponse"; value: Uint8Array; @@ -154,9 +136,9 @@ export const QueryTokenPairsRequest = { return message; }, fromJSON(object: any): QueryTokenPairsRequest { - return { - pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined - }; + const obj = createBaseQueryTokenPairsRequest(); + if (isSet(object.pagination)) obj.pagination = PageRequest.fromJSON(object.pagination); + return obj; }, toJSON(message: QueryTokenPairsRequest): JsonSafe { const obj: any = {}; @@ -165,7 +147,9 @@ export const QueryTokenPairsRequest = { }, fromPartial(object: DeepPartial): QueryTokenPairsRequest { const message = createBaseQueryTokenPairsRequest(); - message.pagination = object.pagination !== undefined && object.pagination !== null ? PageRequest.fromPartial(object.pagination) : undefined; + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageRequest.fromPartial(object.pagination); + } return message; }, fromSDK(object: QueryTokenPairsRequestSDKType): QueryTokenPairsRequest { @@ -249,10 +233,10 @@ export const QueryTokenPairsResponse = { return message; }, fromJSON(object: any): QueryTokenPairsResponse { - return { - tokenPairs: Array.isArray(object?.tokenPairs) ? object.tokenPairs.map((e: any) => TokenPair.fromJSON(e)) : [], - pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined - }; + const obj = createBaseQueryTokenPairsResponse(); + if (Array.isArray(object?.tokenPairs)) obj.tokenPairs = object.tokenPairs.map((e: any) => TokenPair.fromJSON(e)); + if (isSet(object.pagination)) obj.pagination = PageResponse.fromJSON(object.pagination); + return obj; }, toJSON(message: QueryTokenPairsResponse): JsonSafe { const obj: any = {}; @@ -267,7 +251,9 @@ export const QueryTokenPairsResponse = { fromPartial(object: DeepPartial): QueryTokenPairsResponse { const message = createBaseQueryTokenPairsResponse(); message.tokenPairs = object.tokenPairs?.map(e => TokenPair.fromPartial(e)) || []; - message.pagination = object.pagination !== undefined && object.pagination !== null ? PageResponse.fromPartial(object.pagination) : undefined; + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageResponse.fromPartial(object.pagination); + } return message; }, fromSDK(object: QueryTokenPairsResponseSDKType): QueryTokenPairsResponse { @@ -334,7 +320,7 @@ function createBaseQueryTokenPairRequest(): QueryTokenPairRequest { export const QueryTokenPairRequest = { typeUrl: "/evmos.erc20.v1.QueryTokenPairRequest", encode(message: QueryTokenPairRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.token !== "") { + if (message.token !== undefined) { writer.uint32(10).string(message.token); } return writer; @@ -357,9 +343,9 @@ export const QueryTokenPairRequest = { return message; }, fromJSON(object: any): QueryTokenPairRequest { - return { - token: isSet(object.token) ? String(object.token) : "" - }; + const obj = createBaseQueryTokenPairRequest(); + if (isSet(object.token)) obj.token = String(object.token); + return obj; }, toJSON(message: QueryTokenPairRequest): JsonSafe { const obj: any = {}; @@ -445,9 +431,9 @@ export const QueryTokenPairResponse = { return message; }, fromJSON(object: any): QueryTokenPairResponse { - return { - tokenPair: isSet(object.tokenPair) ? TokenPair.fromJSON(object.tokenPair) : undefined - }; + const obj = createBaseQueryTokenPairResponse(); + if (isSet(object.tokenPair)) obj.tokenPair = TokenPair.fromJSON(object.tokenPair); + return obj; }, toJSON(message: QueryTokenPairResponse): JsonSafe { const obj: any = {}; @@ -456,7 +442,9 @@ export const QueryTokenPairResponse = { }, fromPartial(object: DeepPartial): QueryTokenPairResponse { const message = createBaseQueryTokenPairResponse(); - message.tokenPair = object.tokenPair !== undefined && object.tokenPair !== null ? TokenPair.fromPartial(object.tokenPair) : undefined; + if (object.tokenPair !== undefined && object.tokenPair !== null) { + message.tokenPair = TokenPair.fromPartial(object.tokenPair); + } return message; }, fromSDK(object: QueryTokenPairResponseSDKType): QueryTokenPairResponse { @@ -525,7 +513,8 @@ export const QueryParamsRequest = { return message; }, fromJSON(_: any): QueryParamsRequest { - return {}; + const obj = createBaseQueryParamsRequest(); + return obj; }, toJSON(_: QueryParamsRequest): JsonSafe { const obj: any = {}; @@ -600,9 +589,9 @@ export const QueryParamsResponse = { return message; }, fromJSON(object: any): QueryParamsResponse { - return { - params: isSet(object.params) ? Params.fromJSON(object.params) : undefined - }; + const obj = createBaseQueryParamsResponse(); + if (isSet(object.params)) obj.params = Params.fromJSON(object.params); + return obj; }, toJSON(message: QueryParamsResponse): JsonSafe { const obj: any = {}; @@ -611,7 +600,9 @@ export const QueryParamsResponse = { }, fromPartial(object: DeepPartial): QueryParamsResponse { const message = createBaseQueryParamsResponse(); - message.params = object.params !== undefined && object.params !== null ? Params.fromPartial(object.params) : undefined; + if (object.params !== undefined && object.params !== null) { + message.params = Params.fromPartial(object.params); + } return message; }, fromSDK(object: QueryParamsResponseSDKType): QueryParamsResponse { 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..2f1ca2a5d9 100644 --- a/__fixtures__/v-next/outputv4/evmos/erc20/v1/tx.amino.ts +++ b/__fixtures__/v-next/outputv4/evmos/erc20/v1/tx.amino.ts @@ -1,6 +1,6 @@ -import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; +import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin.js"; import { AminoMsg } from "@cosmjs/amino"; -import { MsgConvertCoin, MsgConvertCoinSDKType, MsgConvertERC20, MsgConvertERC20SDKType } from "./tx"; +import { MsgConvertCoin, MsgConvertCoinSDKType, MsgConvertERC20, MsgConvertERC20SDKType } from "./tx.js"; export interface MsgConvertCoinAminoType extends AminoMsg { type: "/evmos.erc20.v1.MsgConvertCoin"; value: { diff --git a/__fixtures__/v-next/outputv4/evmos/erc20/v1/tx.registry.ts b/__fixtures__/v-next/outputv4/evmos/erc20/v1/tx.registry.ts index bc1f20222b..a7fa2b4a32 100644 --- a/__fixtures__/v-next/outputv4/evmos/erc20/v1/tx.registry.ts +++ b/__fixtures__/v-next/outputv4/evmos/erc20/v1/tx.registry.ts @@ -1,6 +1,6 @@ -import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; +import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin.js"; import { GeneratedType, Registry } from "@cosmjs/proto-signing"; -import { MsgConvertCoin, MsgConvertCoinSDKType, MsgConvertERC20, MsgConvertERC20SDKType } from "./tx"; +import { MsgConvertCoin, MsgConvertCoinSDKType, MsgConvertERC20, MsgConvertERC20SDKType } from "./tx.js"; export const registry: ReadonlyArray<[string, GeneratedType]> = [["/evmos.erc20.v1.MsgConvertCoin", MsgConvertCoin], ["/evmos.erc20.v1.MsgConvertERC20", MsgConvertERC20]]; export const load = (protoRegistry: Registry) => { registry.forEach(([typeUrl, mod]) => { diff --git a/__fixtures__/v-next/outputv4/evmos/erc20/v1/tx.rpc.msg.ts b/__fixtures__/v-next/outputv4/evmos/erc20/v1/tx.rpc.msg.ts index 63e3041b30..34d5454eff 100644 --- a/__fixtures__/v-next/outputv4/evmos/erc20/v1/tx.rpc.msg.ts +++ b/__fixtures__/v-next/outputv4/evmos/erc20/v1/tx.rpc.msg.ts @@ -1,7 +1,7 @@ -import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; -import { Rpc } from "../../../helpers"; -import { BinaryReader } from "../../../binary"; -import { MsgConvertCoin, MsgConvertCoinSDKType, MsgConvertCoinResponse, MsgConvertCoinResponseSDKType, MsgConvertERC20, MsgConvertERC20SDKType, MsgConvertERC20Response, MsgConvertERC20ResponseSDKType } from "./tx"; +import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin.js"; +import { Rpc } from "../../../helpers.js"; +import { BinaryReader } from "../../../binary.js"; +import { MsgConvertCoin, MsgConvertCoinSDKType, MsgConvertCoinResponse, MsgConvertCoinResponseSDKType, MsgConvertERC20, MsgConvertERC20SDKType, MsgConvertERC20Response, MsgConvertERC20ResponseSDKType } from "./tx.js"; /** Msg defines the erc20 Msg service. */ export interface Msg { /** diff --git a/__fixtures__/v-next/outputv4/evmos/erc20/v1/tx.ts b/__fixtures__/v-next/outputv4/evmos/erc20/v1/tx.ts index a3627f6f36..1eceacd9a2 100644 --- a/__fixtures__/v-next/outputv4/evmos/erc20/v1/tx.ts +++ b/__fixtures__/v-next/outputv4/evmos/erc20/v1/tx.ts @@ -1,8 +1,7 @@ -import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; -import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; -import { JsonSafe } from "../../../json-safe"; -import { ComputedRef } from "vue"; +import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin.js"; +import { BinaryReader, BinaryWriter } from "../../../binary.js"; +import { isSet, DeepPartial } from "../../../helpers.js"; +import { JsonSafe } from "../../../json-safe.js"; export const protobufPackage = "evmos.erc20.v1"; /** MsgConvertCoin defines a Msg to convert a native Cosmos coin to a ERC20 token */ export interface MsgConvertCoin { @@ -16,11 +15,6 @@ export interface MsgConvertCoin { /** cosmos bech32 address from the owner of the given Cosmos coins */ sender: string; } -export interface ReactiveMsgConvertCoin { - coin: ComputedRef; - receiver: ComputedRef; - sender: ComputedRef; -} export interface MsgConvertCoinProtoMsg { typeUrl: "/evmos.erc20.v1.MsgConvertCoin"; value: Uint8Array; @@ -33,7 +27,6 @@ export interface MsgConvertCoinSDKType { } /** MsgConvertCoinResponse returns no fields */ export interface MsgConvertCoinResponse {} -export interface ReactiveMsgConvertCoinResponse {} export interface MsgConvertCoinResponseProtoMsg { typeUrl: "/evmos.erc20.v1.MsgConvertCoinResponse"; value: Uint8Array; @@ -54,12 +47,6 @@ export interface MsgConvertERC20 { /** sender hex address from the owner of the given ERC20 tokens */ sender: string; } -export interface ReactiveMsgConvertERC20 { - contractAddress: ComputedRef; - amount: ComputedRef; - receiver: ComputedRef; - sender: ComputedRef; -} export interface MsgConvertERC20ProtoMsg { typeUrl: "/evmos.erc20.v1.MsgConvertERC20"; value: Uint8Array; @@ -76,7 +63,6 @@ export interface MsgConvertERC20SDKType { } /** MsgConvertERC20Response returns no fields */ export interface MsgConvertERC20Response {} -export interface ReactiveMsgConvertERC20Response {} export interface MsgConvertERC20ResponseProtoMsg { typeUrl: "/evmos.erc20.v1.MsgConvertERC20Response"; value: Uint8Array; @@ -96,10 +82,10 @@ export const MsgConvertCoin = { if (message.coin !== undefined) { Coin.encode(message.coin, writer.uint32(10).fork()).ldelim(); } - if (message.receiver !== "") { + if (message.receiver !== undefined) { writer.uint32(18).string(message.receiver); } - if (message.sender !== "") { + if (message.sender !== undefined) { writer.uint32(26).string(message.sender); } return writer; @@ -128,11 +114,11 @@ export const MsgConvertCoin = { return message; }, fromJSON(object: any): MsgConvertCoin { - return { - coin: isSet(object.coin) ? Coin.fromJSON(object.coin) : undefined, - receiver: isSet(object.receiver) ? String(object.receiver) : "", - sender: isSet(object.sender) ? String(object.sender) : "" - }; + const obj = createBaseMsgConvertCoin(); + if (isSet(object.coin)) obj.coin = Coin.fromJSON(object.coin); + if (isSet(object.receiver)) obj.receiver = String(object.receiver); + if (isSet(object.sender)) obj.sender = String(object.sender); + return obj; }, toJSON(message: MsgConvertCoin): JsonSafe { const obj: any = {}; @@ -143,7 +129,9 @@ export const MsgConvertCoin = { }, fromPartial(object: DeepPartial): MsgConvertCoin { const message = createBaseMsgConvertCoin(); - message.coin = object.coin !== undefined && object.coin !== null ? Coin.fromPartial(object.coin) : undefined; + if (object.coin !== undefined && object.coin !== null) { + message.coin = Coin.fromPartial(object.coin); + } message.receiver = object.receiver ?? ""; message.sender = object.sender ?? ""; return message; @@ -228,7 +216,8 @@ export const MsgConvertCoinResponse = { return message; }, fromJSON(_: any): MsgConvertCoinResponse { - return {}; + const obj = createBaseMsgConvertCoinResponse(); + return obj; }, toJSON(_: MsgConvertCoinResponse): JsonSafe { const obj: any = {}; @@ -283,16 +272,16 @@ function createBaseMsgConvertERC20(): MsgConvertERC20 { export const MsgConvertERC20 = { typeUrl: "/evmos.erc20.v1.MsgConvertERC20", encode(message: MsgConvertERC20, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.contractAddress !== "") { + if (message.contractAddress !== undefined) { writer.uint32(10).string(message.contractAddress); } - if (message.amount !== "") { + if (message.amount !== undefined) { writer.uint32(18).string(message.amount); } - if (message.receiver !== "") { + if (message.receiver !== undefined) { writer.uint32(26).string(message.receiver); } - if (message.sender !== "") { + if (message.sender !== undefined) { writer.uint32(34).string(message.sender); } return writer; @@ -324,12 +313,12 @@ export const MsgConvertERC20 = { return message; }, fromJSON(object: any): MsgConvertERC20 { - return { - contractAddress: isSet(object.contractAddress) ? String(object.contractAddress) : "", - amount: isSet(object.amount) ? String(object.amount) : "", - receiver: isSet(object.receiver) ? String(object.receiver) : "", - sender: isSet(object.sender) ? String(object.sender) : "" - }; + const obj = createBaseMsgConvertERC20(); + if (isSet(object.contractAddress)) obj.contractAddress = String(object.contractAddress); + if (isSet(object.amount)) obj.amount = String(object.amount); + if (isSet(object.receiver)) obj.receiver = String(object.receiver); + if (isSet(object.sender)) obj.sender = String(object.sender); + return obj; }, toJSON(message: MsgConvertERC20): JsonSafe { const obj: any = {}; @@ -434,7 +423,8 @@ export const MsgConvertERC20Response = { return message; }, fromJSON(_: any): MsgConvertERC20Response { - return {}; + const obj = createBaseMsgConvertERC20Response(); + return obj; }, toJSON(_: MsgConvertERC20Response): JsonSafe { const obj: any = {}; diff --git a/__fixtures__/v-next/outputv4/evmos/evmos-rpc-client.query.ts b/__fixtures__/v-next/outputv4/evmos/evmos-rpc-client.query.ts index 1adc9f91e5..84977f0638 100644 --- a/__fixtures__/v-next/outputv4/evmos/evmos-rpc-client.query.ts +++ b/__fixtures__/v-next/outputv4/evmos/evmos-rpc-client.query.ts @@ -1,25 +1,25 @@ -import { Rpc } from "../helpers"; -import { Tendermint34Client, HttpEndpoint } from "@cosmjs/tendermint-rpc"; +import { Rpc } from "../helpers.js"; +import { connectComet, HttpEndpoint } from "@cosmjs/tendermint-rpc"; import { QueryClient } from "@cosmjs/stargate"; export const createEvmosRPCQueryClient = async ({ rpcEndpoint }: { rpcEndpoint: string | HttpEndpoint; }) => { - const tmClient = await Tendermint34Client.connect(rpcEndpoint); + const tmClient = await connectComet(rpcEndpoint); const client = new QueryClient(tmClient); return { cosmos: { bank: { - v1beta1: (await import("../cosmos/bank/v1beta1/query.rpc.Query")).createRpcQueryExtension(client) + v1beta1: (await import("../cosmos/bank/v1beta1/query.rpc.Query.js")).createRpcQueryExtension(client) }, gov: { - v1beta1: (await import("../cosmos/gov/v1beta1/query.rpc.Query")).createRpcQueryExtension(client) + v1beta1: (await import("../cosmos/gov/v1beta1/query.rpc.Query.js")).createRpcQueryExtension(client) } }, evmos: { erc20: { - v1: (await import("./erc20/v1/query.rpc.Query")).createRpcQueryExtension(client) + v1: (await import("./erc20/v1/query.rpc.Query.js")).createRpcQueryExtension(client) } } }; diff --git a/__fixtures__/v-next/outputv4/evmos/evmos-rpc-client.tx.ts b/__fixtures__/v-next/outputv4/evmos/evmos-rpc-client.tx.ts index 764eca94b4..4ca08e9373 100644 --- a/__fixtures__/v-next/outputv4/evmos/evmos-rpc-client.tx.ts +++ b/__fixtures__/v-next/outputv4/evmos/evmos-rpc-client.tx.ts @@ -1,4 +1,4 @@ -import { Rpc } from "../helpers"; +import { Rpc } from "../helpers.js"; export const createEvmosRPCTxClient = async ({ rpc }: { @@ -6,15 +6,15 @@ export const createEvmosRPCTxClient = async ({ }) => ({ cosmos: { bank: { - v1beta1: new (await import("../cosmos/bank/v1beta1/tx.rpc.msg")).MsgClientImpl(rpc) + v1beta1: new (await import("../cosmos/bank/v1beta1/tx.rpc.msg.js")).MsgClientImpl(rpc) }, gov: { - v1beta1: new (await import("../cosmos/gov/v1beta1/tx.rpc.msg")).MsgClientImpl(rpc) + v1beta1: new (await import("../cosmos/gov/v1beta1/tx.rpc.msg.js")).MsgClientImpl(rpc) } }, evmos: { erc20: { - v1: new (await import("./erc20/v1/tx.rpc.msg")).MsgClientImpl(rpc) + v1: new (await import("./erc20/v1/tx.rpc.msg.js")).MsgClientImpl(rpc) } } }); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv4/evmos/fees/v1/fees.ts b/__fixtures__/v-next/outputv4/evmos/fees/v1/fees.ts index 70a331024d..f6dbec7d70 100644 --- a/__fixtures__/v-next/outputv4/evmos/fees/v1/fees.ts +++ b/__fixtures__/v-next/outputv4/evmos/fees/v1/fees.ts @@ -1,7 +1,6 @@ -import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; -import { JsonSafe } from "../../../json-safe"; -import { ComputedRef } from "vue"; +import { BinaryReader, BinaryWriter } from "../../../binary.js"; +import { isSet, DeepPartial } from "../../../helpers.js"; +import { JsonSafe } from "../../../json-safe.js"; export const protobufPackage = "evmos.fees.v1"; /** * DevFeeInfo defines an instance that organizes fee distribution conditions @@ -18,11 +17,6 @@ export interface DevFeeInfo { */ withdrawAddress: string; } -export interface ReactiveDevFeeInfo { - contractAddress: ComputedRef; - deployerAddress: ComputedRef; - withdrawAddress: ComputedRef; -} export interface DevFeeInfoProtoMsg { typeUrl: "/evmos.fees.v1.DevFeeInfo"; value: Uint8Array; @@ -46,13 +40,13 @@ function createBaseDevFeeInfo(): DevFeeInfo { export const DevFeeInfo = { typeUrl: "/evmos.fees.v1.DevFeeInfo", encode(message: DevFeeInfo, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.contractAddress !== "") { + if (message.contractAddress !== undefined) { writer.uint32(10).string(message.contractAddress); } - if (message.deployerAddress !== "") { + if (message.deployerAddress !== undefined) { writer.uint32(18).string(message.deployerAddress); } - if (message.withdrawAddress !== "") { + if (message.withdrawAddress !== undefined) { writer.uint32(26).string(message.withdrawAddress); } return writer; @@ -81,11 +75,11 @@ export const DevFeeInfo = { return message; }, fromJSON(object: any): DevFeeInfo { - return { - contractAddress: isSet(object.contractAddress) ? String(object.contractAddress) : "", - deployerAddress: isSet(object.deployerAddress) ? String(object.deployerAddress) : "", - withdrawAddress: isSet(object.withdrawAddress) ? String(object.withdrawAddress) : "" - }; + const obj = createBaseDevFeeInfo(); + if (isSet(object.contractAddress)) obj.contractAddress = String(object.contractAddress); + if (isSet(object.deployerAddress)) obj.deployerAddress = String(object.deployerAddress); + if (isSet(object.withdrawAddress)) obj.withdrawAddress = String(object.withdrawAddress); + return obj; }, toJSON(message: DevFeeInfo): JsonSafe { const obj: any = {}; diff --git a/__fixtures__/v-next/outputv4/evmos/fees/v1/genesis.ts b/__fixtures__/v-next/outputv4/evmos/fees/v1/genesis.ts index 3104412da2..28a14bc369 100644 --- a/__fixtures__/v-next/outputv4/evmos/fees/v1/genesis.ts +++ b/__fixtures__/v-next/outputv4/evmos/fees/v1/genesis.ts @@ -1,9 +1,8 @@ -import { DevFeeInfo, DevFeeInfoSDKType } from "./fees"; -import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; -import { JsonSafe } from "../../../json-safe"; +import { DevFeeInfo, DevFeeInfoSDKType } from "./fees.js"; +import { BinaryReader, BinaryWriter } from "../../../binary.js"; +import { isSet, DeepPartial } from "../../../helpers.js"; +import { JsonSafe } from "../../../json-safe.js"; import { Decimal } from "@cosmjs/math"; -import { ComputedRef } from "vue"; export const protobufPackage = "evmos.fees.v1"; /** GenesisState defines the module's genesis state. */ export interface GenesisState { @@ -12,10 +11,6 @@ export interface GenesisState { /** active registered contracts */ devFeeInfos: DevFeeInfo[]; } -export interface ReactiveGenesisState { - params: ComputedRef; - devFeeInfos: ComputedRef; -} export interface GenesisStateProtoMsg { typeUrl: "/evmos.fees.v1.GenesisState"; value: Uint8Array; @@ -47,13 +42,6 @@ export interface Params { /** min_gas_price defines the minimum gas price value for cosmos and eth transactions */ minGasPrice: string; } -export interface ReactiveParams { - enableFees: ComputedRef; - developerShares: ComputedRef; - validatorShares: ComputedRef; - addrDerivationCostCreate: ComputedRef; - minGasPrice: ComputedRef; -} export interface ParamsProtoMsg { typeUrl: "/evmos.fees.v1.Params"; value: Uint8Array; @@ -104,10 +92,10 @@ export const GenesisState = { return message; }, fromJSON(object: any): GenesisState { - return { - params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, - devFeeInfos: Array.isArray(object?.devFeeInfos) ? object.devFeeInfos.map((e: any) => DevFeeInfo.fromJSON(e)) : [] - }; + const obj = createBaseGenesisState(); + if (isSet(object.params)) obj.params = Params.fromJSON(object.params); + if (Array.isArray(object?.devFeeInfos)) obj.devFeeInfos = object.devFeeInfos.map((e: any) => DevFeeInfo.fromJSON(e)); + return obj; }, toJSON(message: GenesisState): JsonSafe { const obj: any = {}; @@ -121,7 +109,9 @@ export const GenesisState = { }, fromPartial(object: DeepPartial): GenesisState { const message = createBaseGenesisState(); - message.params = object.params !== undefined && object.params !== null ? Params.fromPartial(object.params) : undefined; + if (object.params !== undefined && object.params !== null) { + message.params = Params.fromPartial(object.params); + } message.devFeeInfos = object.devFeeInfos?.map(e => DevFeeInfo.fromPartial(e)) || []; return message; }, @@ -193,19 +183,19 @@ function createBaseParams(): Params { export const Params = { typeUrl: "/evmos.fees.v1.Params", encode(message: Params, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.enableFees === true) { + if (message.enableFees !== undefined) { writer.uint32(8).bool(message.enableFees); } - if (message.developerShares !== "") { + if (message.developerShares !== undefined) { writer.uint32(18).string(Decimal.fromUserInput(message.developerShares, 18).atomics); } - if (message.validatorShares !== "") { + if (message.validatorShares !== undefined) { writer.uint32(26).string(Decimal.fromUserInput(message.validatorShares, 18).atomics); } - if (message.addrDerivationCostCreate !== BigInt(0)) { + if (message.addrDerivationCostCreate !== undefined) { writer.uint32(32).uint64(message.addrDerivationCostCreate); } - if (message.minGasPrice !== "") { + if (message.minGasPrice !== undefined) { writer.uint32(42).string(Decimal.fromUserInput(message.minGasPrice, 18).atomics); } return writer; @@ -240,13 +230,13 @@ export const Params = { return message; }, fromJSON(object: any): Params { - return { - enableFees: isSet(object.enableFees) ? Boolean(object.enableFees) : false, - developerShares: isSet(object.developerShares) ? String(object.developerShares) : "", - validatorShares: isSet(object.validatorShares) ? String(object.validatorShares) : "", - addrDerivationCostCreate: isSet(object.addrDerivationCostCreate) ? BigInt(object.addrDerivationCostCreate.toString()) : BigInt(0), - minGasPrice: isSet(object.minGasPrice) ? String(object.minGasPrice) : "" - }; + const obj = createBaseParams(); + if (isSet(object.enableFees)) obj.enableFees = Boolean(object.enableFees); + if (isSet(object.developerShares)) obj.developerShares = String(object.developerShares); + if (isSet(object.validatorShares)) obj.validatorShares = String(object.validatorShares); + if (isSet(object.addrDerivationCostCreate)) obj.addrDerivationCostCreate = BigInt(object.addrDerivationCostCreate.toString()); + if (isSet(object.minGasPrice)) obj.minGasPrice = String(object.minGasPrice); + return obj; }, toJSON(message: Params): JsonSafe { const obj: any = {}; @@ -262,7 +252,9 @@ export const Params = { message.enableFees = object.enableFees ?? false; message.developerShares = object.developerShares ?? ""; message.validatorShares = object.validatorShares ?? ""; - message.addrDerivationCostCreate = object.addrDerivationCostCreate !== undefined && object.addrDerivationCostCreate !== null ? BigInt(object.addrDerivationCostCreate.toString()) : BigInt(0); + if (object.addrDerivationCostCreate !== undefined && object.addrDerivationCostCreate !== null) { + message.addrDerivationCostCreate = BigInt(object.addrDerivationCostCreate.toString()); + } message.minGasPrice = object.minGasPrice ?? ""; return message; }, diff --git a/__fixtures__/v-next/outputv4/evmos/fees/v1/query.lcd.ts b/__fixtures__/v-next/outputv4/evmos/fees/v1/query.lcd.ts index 78ab103d5a..75046f4615 100644 --- a/__fixtures__/v-next/outputv4/evmos/fees/v1/query.lcd.ts +++ b/__fixtures__/v-next/outputv4/evmos/fees/v1/query.lcd.ts @@ -1,9 +1,9 @@ -import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../../cosmos/base/query/v1beta1/pagination"; -import { DevFeeInfo, DevFeeInfoSDKType } from "./fees"; -import { Params, ParamsSDKType } from "./genesis"; -import { setPaginationParams } from "../../../helpers"; +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../../cosmos/base/query/v1beta1/pagination.js"; +import { DevFeeInfo, DevFeeInfoSDKType } from "./fees.js"; +import { Params, ParamsSDKType } from "./genesis.js"; +import { setPaginationParams } from "../../../helpers.js"; import { LCDClient } from "@cosmology/lcd"; -import { QueryDevFeeInfosRequest, QueryDevFeeInfosRequestSDKType, QueryDevFeeInfosResponse, QueryDevFeeInfosResponseSDKType, QueryDevFeeInfoRequest, QueryDevFeeInfoRequestSDKType, QueryDevFeeInfoResponse, QueryDevFeeInfoResponseSDKType, QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType, QueryDevFeeInfosPerDeployerRequest, QueryDevFeeInfosPerDeployerRequestSDKType, QueryDevFeeInfosPerDeployerResponse, QueryDevFeeInfosPerDeployerResponseSDKType } from "./query"; +import { QueryDevFeeInfosRequest, QueryDevFeeInfosRequestSDKType, QueryDevFeeInfosResponse, QueryDevFeeInfosResponseSDKType, QueryDevFeeInfoRequest, QueryDevFeeInfoRequestSDKType, QueryDevFeeInfoResponse, QueryDevFeeInfoResponseSDKType, QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType, QueryDevFeeInfosPerDeployerRequest, QueryDevFeeInfosPerDeployerRequestSDKType, QueryDevFeeInfosPerDeployerResponse, QueryDevFeeInfosPerDeployerResponseSDKType } from "./query.js"; export class LCDQueryClient { req: LCDClient; constructor({ @@ -19,7 +19,7 @@ export class LCDQueryClient { } /* DevFeeInfos retrieves all registered contracts for fee distribution */ async devFeeInfos(params: QueryDevFeeInfosRequest = { - pagination: undefined + pagination: PageRequest.fromPartial({}) }): Promise { const options: any = { params: {} diff --git a/__fixtures__/v-next/outputv4/evmos/fees/v1/query.rpc.Query.ts b/__fixtures__/v-next/outputv4/evmos/fees/v1/query.rpc.Query.ts index 9dd9e1b745..a7297b6f74 100644 --- a/__fixtures__/v-next/outputv4/evmos/fees/v1/query.rpc.Query.ts +++ b/__fixtures__/v-next/outputv4/evmos/fees/v1/query.rpc.Query.ts @@ -1,10 +1,10 @@ -import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../../cosmos/base/query/v1beta1/pagination"; -import { DevFeeInfo, DevFeeInfoSDKType } from "./fees"; -import { Params, ParamsSDKType } from "./genesis"; -import { Rpc } from "../../../helpers"; -import { BinaryReader } from "../../../binary"; +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../../cosmos/base/query/v1beta1/pagination.js"; +import { DevFeeInfo, DevFeeInfoSDKType } from "./fees.js"; +import { Params, ParamsSDKType } from "./genesis.js"; +import { Rpc } from "../../../helpers.js"; +import { BinaryReader } from "../../../binary.js"; import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; -import { QueryDevFeeInfosRequest, QueryDevFeeInfosRequestSDKType, QueryDevFeeInfosResponse, QueryDevFeeInfosResponseSDKType, QueryDevFeeInfoRequest, QueryDevFeeInfoRequestSDKType, QueryDevFeeInfoResponse, QueryDevFeeInfoResponseSDKType, QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType, QueryDevFeeInfosPerDeployerRequest, QueryDevFeeInfosPerDeployerRequestSDKType, QueryDevFeeInfosPerDeployerResponse, QueryDevFeeInfosPerDeployerResponseSDKType, ReactiveQueryDevFeeInfosRequest, ReactiveQueryDevFeeInfoRequest, ReactiveQueryParamsRequest, ReactiveQueryDevFeeInfosPerDeployerRequest } from "./query"; +import { QueryDevFeeInfosRequest, QueryDevFeeInfosRequestSDKType, QueryDevFeeInfosResponse, QueryDevFeeInfosResponseSDKType, QueryDevFeeInfoRequest, QueryDevFeeInfoRequestSDKType, QueryDevFeeInfoResponse, QueryDevFeeInfoResponseSDKType, QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType, QueryDevFeeInfosPerDeployerRequest, QueryDevFeeInfosPerDeployerRequestSDKType, QueryDevFeeInfosPerDeployerResponse, QueryDevFeeInfosPerDeployerResponseSDKType } from "./query.js"; /** Query defines the gRPC querier service. */ export interface Query { /** DevFeeInfos retrieves all registered contracts for fee distribution */ @@ -29,7 +29,7 @@ export class QueryClientImpl implements Query { this.devFeeInfosPerDeployer = this.devFeeInfosPerDeployer.bind(this); } devFeeInfos(request: QueryDevFeeInfosRequest = { - pagination: undefined + pagination: PageRequest.fromPartial({}) }): Promise { const data = QueryDevFeeInfosRequest.encode(request).finish(); const promise = this.rpc.request("evmos.fees.v1.Query", "DevFeeInfos", data); diff --git a/__fixtures__/v-next/outputv4/evmos/fees/v1/query.ts b/__fixtures__/v-next/outputv4/evmos/fees/v1/query.ts index 8b6868c092..3b1df4fbb6 100644 --- a/__fixtures__/v-next/outputv4/evmos/fees/v1/query.ts +++ b/__fixtures__/v-next/outputv4/evmos/fees/v1/query.ts @@ -1,10 +1,9 @@ -import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../../cosmos/base/query/v1beta1/pagination"; -import { DevFeeInfo, DevFeeInfoSDKType } from "./fees"; -import { Params, ParamsSDKType } from "./genesis"; -import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; -import { JsonSafe } from "../../../json-safe"; -import { ComputedRef } from "vue"; +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../../cosmos/base/query/v1beta1/pagination.js"; +import { DevFeeInfo, DevFeeInfoSDKType } from "./fees.js"; +import { Params, ParamsSDKType } from "./genesis.js"; +import { BinaryReader, BinaryWriter } from "../../../binary.js"; +import { isSet, DeepPartial } from "../../../helpers.js"; +import { JsonSafe } from "../../../json-safe.js"; export const protobufPackage = "evmos.fees.v1"; /** * QueryDevFeeInfosRequest is the request type for the Query/DevFeeInfos RPC @@ -14,9 +13,6 @@ export interface QueryDevFeeInfosRequest { /** pagination defines an optional pagination for the request. */ pagination?: PageRequest; } -export interface ReactiveQueryDevFeeInfosRequest { - pagination?: ComputedRef; -} export interface QueryDevFeeInfosRequestProtoMsg { typeUrl: "/evmos.fees.v1.QueryDevFeeInfosRequest"; value: Uint8Array; @@ -37,10 +33,6 @@ export interface QueryDevFeeInfosResponse { /** pagination defines the pagination in the response. */ pagination?: PageResponse; } -export interface ReactiveQueryDevFeeInfosResponse { - fees: ComputedRef; - pagination?: ComputedRef; -} export interface QueryDevFeeInfosResponseProtoMsg { typeUrl: "/evmos.fees.v1.QueryDevFeeInfosResponse"; value: Uint8Array; @@ -61,9 +53,6 @@ export interface QueryDevFeeInfoRequest { /** contract identifier is the hex contract address of a contract */ contractAddress: string; } -export interface ReactiveQueryDevFeeInfoRequest { - contractAddress: ComputedRef; -} export interface QueryDevFeeInfoRequestProtoMsg { typeUrl: "/evmos.fees.v1.QueryDevFeeInfoRequest"; value: Uint8Array; @@ -82,9 +71,6 @@ export interface QueryDevFeeInfoRequestSDKType { export interface QueryDevFeeInfoResponse { fee: DevFeeInfo; } -export interface ReactiveQueryDevFeeInfoResponse { - fee: ComputedRef; -} export interface QueryDevFeeInfoResponseProtoMsg { typeUrl: "/evmos.fees.v1.QueryDevFeeInfoResponse"; value: Uint8Array; @@ -98,7 +84,6 @@ export interface QueryDevFeeInfoResponseSDKType { } /** QueryParamsRequest is the request type for the Query/Params RPC method. */ export interface QueryParamsRequest {} -export interface ReactiveQueryParamsRequest {} export interface QueryParamsRequestProtoMsg { typeUrl: "/evmos.fees.v1.QueryParamsRequest"; value: Uint8Array; @@ -112,9 +97,6 @@ export interface QueryParamsRequestSDKType {} export interface QueryParamsResponse { params: Params; } -export interface ReactiveQueryParamsResponse { - params: ComputedRef; -} export interface QueryParamsResponseProtoMsg { typeUrl: "/evmos.fees.v1.QueryParamsResponse"; value: Uint8Array; @@ -136,10 +118,6 @@ export interface QueryDevFeeInfosPerDeployerRequest { /** pagination defines an optional pagination for the request. */ pagination?: PageRequest; } -export interface ReactiveQueryDevFeeInfosPerDeployerRequest { - deployerAddress: ComputedRef; - pagination?: ComputedRef; -} export interface QueryDevFeeInfosPerDeployerRequestProtoMsg { typeUrl: "/evmos.fees.v1.QueryDevFeeInfosPerDeployerRequest"; value: Uint8Array; @@ -161,10 +139,6 @@ export interface QueryDevFeeInfosPerDeployerResponse { /** pagination defines the pagination in the response. */ pagination?: PageResponse; } -export interface ReactiveQueryDevFeeInfosPerDeployerResponse { - fees: ComputedRef; - pagination?: ComputedRef; -} export interface QueryDevFeeInfosPerDeployerResponseProtoMsg { typeUrl: "/evmos.fees.v1.QueryDevFeeInfosPerDeployerResponse"; value: Uint8Array; @@ -208,9 +182,9 @@ export const QueryDevFeeInfosRequest = { return message; }, fromJSON(object: any): QueryDevFeeInfosRequest { - return { - pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined - }; + const obj = createBaseQueryDevFeeInfosRequest(); + if (isSet(object.pagination)) obj.pagination = PageRequest.fromJSON(object.pagination); + return obj; }, toJSON(message: QueryDevFeeInfosRequest): JsonSafe { const obj: any = {}; @@ -219,7 +193,9 @@ export const QueryDevFeeInfosRequest = { }, fromPartial(object: DeepPartial): QueryDevFeeInfosRequest { const message = createBaseQueryDevFeeInfosRequest(); - message.pagination = object.pagination !== undefined && object.pagination !== null ? PageRequest.fromPartial(object.pagination) : undefined; + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageRequest.fromPartial(object.pagination); + } return message; }, fromSDK(object: QueryDevFeeInfosRequestSDKType): QueryDevFeeInfosRequest { @@ -303,10 +279,10 @@ export const QueryDevFeeInfosResponse = { return message; }, fromJSON(object: any): QueryDevFeeInfosResponse { - return { - fees: Array.isArray(object?.fees) ? object.fees.map((e: any) => DevFeeInfo.fromJSON(e)) : [], - pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined - }; + const obj = createBaseQueryDevFeeInfosResponse(); + if (Array.isArray(object?.fees)) obj.fees = object.fees.map((e: any) => DevFeeInfo.fromJSON(e)); + if (isSet(object.pagination)) obj.pagination = PageResponse.fromJSON(object.pagination); + return obj; }, toJSON(message: QueryDevFeeInfosResponse): JsonSafe { const obj: any = {}; @@ -321,7 +297,9 @@ export const QueryDevFeeInfosResponse = { fromPartial(object: DeepPartial): QueryDevFeeInfosResponse { const message = createBaseQueryDevFeeInfosResponse(); message.fees = object.fees?.map(e => DevFeeInfo.fromPartial(e)) || []; - message.pagination = object.pagination !== undefined && object.pagination !== null ? PageResponse.fromPartial(object.pagination) : undefined; + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageResponse.fromPartial(object.pagination); + } return message; }, fromSDK(object: QueryDevFeeInfosResponseSDKType): QueryDevFeeInfosResponse { @@ -388,7 +366,7 @@ function createBaseQueryDevFeeInfoRequest(): QueryDevFeeInfoRequest { export const QueryDevFeeInfoRequest = { typeUrl: "/evmos.fees.v1.QueryDevFeeInfoRequest", encode(message: QueryDevFeeInfoRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.contractAddress !== "") { + if (message.contractAddress !== undefined) { writer.uint32(10).string(message.contractAddress); } return writer; @@ -411,9 +389,9 @@ export const QueryDevFeeInfoRequest = { return message; }, fromJSON(object: any): QueryDevFeeInfoRequest { - return { - contractAddress: isSet(object.contractAddress) ? String(object.contractAddress) : "" - }; + const obj = createBaseQueryDevFeeInfoRequest(); + if (isSet(object.contractAddress)) obj.contractAddress = String(object.contractAddress); + return obj; }, toJSON(message: QueryDevFeeInfoRequest): JsonSafe { const obj: any = {}; @@ -499,9 +477,9 @@ export const QueryDevFeeInfoResponse = { return message; }, fromJSON(object: any): QueryDevFeeInfoResponse { - return { - fee: isSet(object.fee) ? DevFeeInfo.fromJSON(object.fee) : undefined - }; + const obj = createBaseQueryDevFeeInfoResponse(); + if (isSet(object.fee)) obj.fee = DevFeeInfo.fromJSON(object.fee); + return obj; }, toJSON(message: QueryDevFeeInfoResponse): JsonSafe { const obj: any = {}; @@ -510,7 +488,9 @@ export const QueryDevFeeInfoResponse = { }, fromPartial(object: DeepPartial): QueryDevFeeInfoResponse { const message = createBaseQueryDevFeeInfoResponse(); - message.fee = object.fee !== undefined && object.fee !== null ? DevFeeInfo.fromPartial(object.fee) : undefined; + if (object.fee !== undefined && object.fee !== null) { + message.fee = DevFeeInfo.fromPartial(object.fee); + } return message; }, fromSDK(object: QueryDevFeeInfoResponseSDKType): QueryDevFeeInfoResponse { @@ -579,7 +559,8 @@ export const QueryParamsRequest = { return message; }, fromJSON(_: any): QueryParamsRequest { - return {}; + const obj = createBaseQueryParamsRequest(); + return obj; }, toJSON(_: QueryParamsRequest): JsonSafe { const obj: any = {}; @@ -654,9 +635,9 @@ export const QueryParamsResponse = { return message; }, fromJSON(object: any): QueryParamsResponse { - return { - params: isSet(object.params) ? Params.fromJSON(object.params) : undefined - }; + const obj = createBaseQueryParamsResponse(); + if (isSet(object.params)) obj.params = Params.fromJSON(object.params); + return obj; }, toJSON(message: QueryParamsResponse): JsonSafe { const obj: any = {}; @@ -665,7 +646,9 @@ export const QueryParamsResponse = { }, fromPartial(object: DeepPartial): QueryParamsResponse { const message = createBaseQueryParamsResponse(); - message.params = object.params !== undefined && object.params !== null ? Params.fromPartial(object.params) : undefined; + if (object.params !== undefined && object.params !== null) { + message.params = Params.fromPartial(object.params); + } return message; }, fromSDK(object: QueryParamsResponseSDKType): QueryParamsResponse { @@ -720,7 +703,7 @@ function createBaseQueryDevFeeInfosPerDeployerRequest(): QueryDevFeeInfosPerDepl export const QueryDevFeeInfosPerDeployerRequest = { typeUrl: "/evmos.fees.v1.QueryDevFeeInfosPerDeployerRequest", encode(message: QueryDevFeeInfosPerDeployerRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.deployerAddress !== "") { + if (message.deployerAddress !== undefined) { writer.uint32(10).string(message.deployerAddress); } if (message.pagination !== undefined) { @@ -749,10 +732,10 @@ export const QueryDevFeeInfosPerDeployerRequest = { return message; }, fromJSON(object: any): QueryDevFeeInfosPerDeployerRequest { - return { - deployerAddress: isSet(object.deployerAddress) ? String(object.deployerAddress) : "", - pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined - }; + const obj = createBaseQueryDevFeeInfosPerDeployerRequest(); + if (isSet(object.deployerAddress)) obj.deployerAddress = String(object.deployerAddress); + if (isSet(object.pagination)) obj.pagination = PageRequest.fromJSON(object.pagination); + return obj; }, toJSON(message: QueryDevFeeInfosPerDeployerRequest): JsonSafe { const obj: any = {}; @@ -763,7 +746,9 @@ export const QueryDevFeeInfosPerDeployerRequest = { fromPartial(object: DeepPartial): QueryDevFeeInfosPerDeployerRequest { const message = createBaseQueryDevFeeInfosPerDeployerRequest(); message.deployerAddress = object.deployerAddress ?? ""; - message.pagination = object.pagination !== undefined && object.pagination !== null ? PageRequest.fromPartial(object.pagination) : undefined; + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageRequest.fromPartial(object.pagination); + } return message; }, fromSDK(object: QueryDevFeeInfosPerDeployerRequestSDKType): QueryDevFeeInfosPerDeployerRequest { @@ -854,10 +839,10 @@ export const QueryDevFeeInfosPerDeployerResponse = { return message; }, fromJSON(object: any): QueryDevFeeInfosPerDeployerResponse { - return { - fees: Array.isArray(object?.fees) ? object.fees.map((e: any) => DevFeeInfo.fromJSON(e)) : [], - pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined - }; + const obj = createBaseQueryDevFeeInfosPerDeployerResponse(); + if (Array.isArray(object?.fees)) obj.fees = object.fees.map((e: any) => DevFeeInfo.fromJSON(e)); + if (isSet(object.pagination)) obj.pagination = PageResponse.fromJSON(object.pagination); + return obj; }, toJSON(message: QueryDevFeeInfosPerDeployerResponse): JsonSafe { const obj: any = {}; @@ -872,7 +857,9 @@ export const QueryDevFeeInfosPerDeployerResponse = { fromPartial(object: DeepPartial): QueryDevFeeInfosPerDeployerResponse { const message = createBaseQueryDevFeeInfosPerDeployerResponse(); message.fees = object.fees?.map(e => DevFeeInfo.fromPartial(e)) || []; - message.pagination = object.pagination !== undefined && object.pagination !== null ? PageResponse.fromPartial(object.pagination) : undefined; + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageResponse.fromPartial(object.pagination); + } return message; }, fromSDK(object: QueryDevFeeInfosPerDeployerResponseSDKType): QueryDevFeeInfosPerDeployerResponse { 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..95cd693f8a 100644 --- a/__fixtures__/v-next/outputv4/evmos/fees/v1/tx.amino.ts +++ b/__fixtures__/v-next/outputv4/evmos/fees/v1/tx.amino.ts @@ -1,5 +1,5 @@ import { AminoMsg } from "@cosmjs/amino"; -import { MsgRegisterDevFeeInfo, MsgRegisterDevFeeInfoSDKType, MsgCancelDevFeeInfo, MsgCancelDevFeeInfoSDKType, MsgUpdateDevFeeInfo, MsgUpdateDevFeeInfoSDKType } from "./tx"; +import { MsgRegisterDevFeeInfo, MsgRegisterDevFeeInfoSDKType, MsgCancelDevFeeInfo, MsgCancelDevFeeInfoSDKType, MsgUpdateDevFeeInfo, MsgUpdateDevFeeInfoSDKType } from "./tx.js"; export interface MsgRegisterDevFeeInfoAminoType extends AminoMsg { type: "/evmos.fees.v1.MsgRegisterDevFeeInfo"; value: { diff --git a/__fixtures__/v-next/outputv4/evmos/fees/v1/tx.registry.ts b/__fixtures__/v-next/outputv4/evmos/fees/v1/tx.registry.ts index fc2890b2d6..9b58158d72 100644 --- a/__fixtures__/v-next/outputv4/evmos/fees/v1/tx.registry.ts +++ b/__fixtures__/v-next/outputv4/evmos/fees/v1/tx.registry.ts @@ -1,5 +1,5 @@ import { GeneratedType, Registry } from "@cosmjs/proto-signing"; -import { MsgRegisterDevFeeInfo, MsgRegisterDevFeeInfoSDKType, MsgCancelDevFeeInfo, MsgCancelDevFeeInfoSDKType, MsgUpdateDevFeeInfo, MsgUpdateDevFeeInfoSDKType } from "./tx"; +import { MsgRegisterDevFeeInfo, MsgRegisterDevFeeInfoSDKType, MsgCancelDevFeeInfo, MsgCancelDevFeeInfoSDKType, MsgUpdateDevFeeInfo, MsgUpdateDevFeeInfoSDKType } from "./tx.js"; export const registry: ReadonlyArray<[string, GeneratedType]> = [["/evmos.fees.v1.MsgRegisterDevFeeInfo", MsgRegisterDevFeeInfo], ["/evmos.fees.v1.MsgCancelDevFeeInfo", MsgCancelDevFeeInfo], ["/evmos.fees.v1.MsgUpdateDevFeeInfo", MsgUpdateDevFeeInfo]]; export const load = (protoRegistry: Registry) => { registry.forEach(([typeUrl, mod]) => { diff --git a/__fixtures__/v-next/outputv4/evmos/fees/v1/tx.rpc.msg.ts b/__fixtures__/v-next/outputv4/evmos/fees/v1/tx.rpc.msg.ts index d5c4b6ff41..54e96de557 100644 --- a/__fixtures__/v-next/outputv4/evmos/fees/v1/tx.rpc.msg.ts +++ b/__fixtures__/v-next/outputv4/evmos/fees/v1/tx.rpc.msg.ts @@ -1,6 +1,6 @@ -import { Rpc } from "../../../helpers"; -import { BinaryReader } from "../../../binary"; -import { MsgRegisterDevFeeInfo, MsgRegisterDevFeeInfoSDKType, MsgRegisterDevFeeInfoResponse, MsgRegisterDevFeeInfoResponseSDKType, MsgCancelDevFeeInfo, MsgCancelDevFeeInfoSDKType, MsgCancelDevFeeInfoResponse, MsgCancelDevFeeInfoResponseSDKType, MsgUpdateDevFeeInfo, MsgUpdateDevFeeInfoSDKType, MsgUpdateDevFeeInfoResponse, MsgUpdateDevFeeInfoResponseSDKType } from "./tx"; +import { Rpc } from "../../../helpers.js"; +import { BinaryReader } from "../../../binary.js"; +import { MsgRegisterDevFeeInfo, MsgRegisterDevFeeInfoSDKType, MsgRegisterDevFeeInfoResponse, MsgRegisterDevFeeInfoResponseSDKType, MsgCancelDevFeeInfo, MsgCancelDevFeeInfoSDKType, MsgCancelDevFeeInfoResponse, MsgCancelDevFeeInfoResponseSDKType, MsgUpdateDevFeeInfo, MsgUpdateDevFeeInfoSDKType, MsgUpdateDevFeeInfoResponse, MsgUpdateDevFeeInfoResponseSDKType } from "./tx.js"; /** Msg defines the fees Msg service. */ export interface Msg { /** diff --git a/__fixtures__/v-next/outputv4/evmos/fees/v1/tx.ts b/__fixtures__/v-next/outputv4/evmos/fees/v1/tx.ts index 53a321b9f5..73c0171c9c 100644 --- a/__fixtures__/v-next/outputv4/evmos/fees/v1/tx.ts +++ b/__fixtures__/v-next/outputv4/evmos/fees/v1/tx.ts @@ -1,7 +1,6 @@ -import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; -import { JsonSafe } from "../../../json-safe"; -import { ComputedRef } from "vue"; +import { BinaryReader, BinaryWriter } from "../../../binary.js"; +import { isSet, DeepPartial } from "../../../helpers.js"; +import { JsonSafe } from "../../../json-safe.js"; export const protobufPackage = "evmos.fees.v1"; /** MsgRegisterFeesContract defines a message that registers a DevFeeInfo */ export interface MsgRegisterDevFeeInfo { @@ -21,12 +20,6 @@ export interface MsgRegisterDevFeeInfo { */ nonces: bigint[]; } -export interface ReactiveMsgRegisterDevFeeInfo { - contractAddress: ComputedRef; - deployerAddress: ComputedRef; - withdrawAddress: ComputedRef; - nonces: ComputedRef; -} export interface MsgRegisterDevFeeInfoProtoMsg { typeUrl: "/evmos.fees.v1.MsgRegisterDevFeeInfo"; value: Uint8Array; @@ -43,7 +36,6 @@ export interface MsgRegisterDevFeeInfoSDKType { * type */ export interface MsgRegisterDevFeeInfoResponse {} -export interface ReactiveMsgRegisterDevFeeInfoResponse {} export interface MsgRegisterDevFeeInfoResponseProtoMsg { typeUrl: "/evmos.fees.v1.MsgRegisterDevFeeInfoResponse"; value: Uint8Array; @@ -63,10 +55,6 @@ export interface MsgCancelDevFeeInfo { /** deployer bech32 address */ deployerAddress: string; } -export interface ReactiveMsgCancelDevFeeInfo { - contractAddress: ComputedRef; - deployerAddress: ComputedRef; -} export interface MsgCancelDevFeeInfoProtoMsg { typeUrl: "/evmos.fees.v1.MsgCancelDevFeeInfo"; value: Uint8Array; @@ -81,7 +69,6 @@ export interface MsgCancelDevFeeInfoSDKType { } /** MsgCancelDevFeeInfoResponse defines the MsgCancelDevFeeInfo response type */ export interface MsgCancelDevFeeInfoResponse {} -export interface ReactiveMsgCancelDevFeeInfoResponse {} export interface MsgCancelDevFeeInfoResponseProtoMsg { typeUrl: "/evmos.fees.v1.MsgCancelDevFeeInfoResponse"; value: Uint8Array; @@ -100,11 +87,6 @@ export interface MsgUpdateDevFeeInfo { /** new withdraw bech32 address for receiving the transaction fees */ withdrawAddress: string; } -export interface ReactiveMsgUpdateDevFeeInfo { - contractAddress: ComputedRef; - deployerAddress: ComputedRef; - withdrawAddress: ComputedRef; -} export interface MsgUpdateDevFeeInfoProtoMsg { typeUrl: "/evmos.fees.v1.MsgUpdateDevFeeInfo"; value: Uint8Array; @@ -120,7 +102,6 @@ export interface MsgUpdateDevFeeInfoSDKType { } /** MsgUpdateDevFeeInfoResponse defines the MsgUpdateDevFeeInfo response type */ export interface MsgUpdateDevFeeInfoResponse {} -export interface ReactiveMsgUpdateDevFeeInfoResponse {} export interface MsgUpdateDevFeeInfoResponseProtoMsg { typeUrl: "/evmos.fees.v1.MsgUpdateDevFeeInfoResponse"; value: Uint8Array; @@ -138,13 +119,13 @@ function createBaseMsgRegisterDevFeeInfo(): MsgRegisterDevFeeInfo { export const MsgRegisterDevFeeInfo = { typeUrl: "/evmos.fees.v1.MsgRegisterDevFeeInfo", encode(message: MsgRegisterDevFeeInfo, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.contractAddress !== "") { + if (message.contractAddress !== undefined) { writer.uint32(10).string(message.contractAddress); } - if (message.deployerAddress !== "") { + if (message.deployerAddress !== undefined) { writer.uint32(18).string(message.deployerAddress); } - if (message.withdrawAddress !== "") { + if (message.withdrawAddress !== undefined) { writer.uint32(26).string(message.withdrawAddress); } writer.uint32(34).fork(); @@ -188,12 +169,12 @@ export const MsgRegisterDevFeeInfo = { return message; }, fromJSON(object: any): MsgRegisterDevFeeInfo { - return { - contractAddress: isSet(object.contractAddress) ? String(object.contractAddress) : "", - deployerAddress: isSet(object.deployerAddress) ? String(object.deployerAddress) : "", - withdrawAddress: isSet(object.withdrawAddress) ? String(object.withdrawAddress) : "", - nonces: Array.isArray(object?.nonces) ? object.nonces.map((e: any) => BigInt(e.toString())) : [] - }; + const obj = createBaseMsgRegisterDevFeeInfo(); + if (isSet(object.contractAddress)) obj.contractAddress = String(object.contractAddress); + if (isSet(object.deployerAddress)) obj.deployerAddress = String(object.deployerAddress); + if (isSet(object.withdrawAddress)) obj.withdrawAddress = String(object.withdrawAddress); + if (Array.isArray(object?.nonces)) obj.nonces = object.nonces.map((e: any) => BigInt(e.toString())); + return obj; }, toJSON(message: MsgRegisterDevFeeInfo): JsonSafe { const obj: any = {}; @@ -308,7 +289,8 @@ export const MsgRegisterDevFeeInfoResponse = { return message; }, fromJSON(_: any): MsgRegisterDevFeeInfoResponse { - return {}; + const obj = createBaseMsgRegisterDevFeeInfoResponse(); + return obj; }, toJSON(_: MsgRegisterDevFeeInfoResponse): JsonSafe { const obj: any = {}; @@ -361,10 +343,10 @@ function createBaseMsgCancelDevFeeInfo(): MsgCancelDevFeeInfo { export const MsgCancelDevFeeInfo = { typeUrl: "/evmos.fees.v1.MsgCancelDevFeeInfo", encode(message: MsgCancelDevFeeInfo, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.contractAddress !== "") { + if (message.contractAddress !== undefined) { writer.uint32(10).string(message.contractAddress); } - if (message.deployerAddress !== "") { + if (message.deployerAddress !== undefined) { writer.uint32(18).string(message.deployerAddress); } return writer; @@ -390,10 +372,10 @@ export const MsgCancelDevFeeInfo = { return message; }, fromJSON(object: any): MsgCancelDevFeeInfo { - return { - contractAddress: isSet(object.contractAddress) ? String(object.contractAddress) : "", - deployerAddress: isSet(object.deployerAddress) ? String(object.deployerAddress) : "" - }; + const obj = createBaseMsgCancelDevFeeInfo(); + if (isSet(object.contractAddress)) obj.contractAddress = String(object.contractAddress); + if (isSet(object.deployerAddress)) obj.deployerAddress = String(object.deployerAddress); + return obj; }, toJSON(message: MsgCancelDevFeeInfo): JsonSafe { const obj: any = {}; @@ -480,7 +462,8 @@ export const MsgCancelDevFeeInfoResponse = { return message; }, fromJSON(_: any): MsgCancelDevFeeInfoResponse { - return {}; + const obj = createBaseMsgCancelDevFeeInfoResponse(); + return obj; }, toJSON(_: MsgCancelDevFeeInfoResponse): JsonSafe { const obj: any = {}; @@ -534,13 +517,13 @@ function createBaseMsgUpdateDevFeeInfo(): MsgUpdateDevFeeInfo { export const MsgUpdateDevFeeInfo = { typeUrl: "/evmos.fees.v1.MsgUpdateDevFeeInfo", encode(message: MsgUpdateDevFeeInfo, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.contractAddress !== "") { + if (message.contractAddress !== undefined) { writer.uint32(10).string(message.contractAddress); } - if (message.deployerAddress !== "") { + if (message.deployerAddress !== undefined) { writer.uint32(18).string(message.deployerAddress); } - if (message.withdrawAddress !== "") { + if (message.withdrawAddress !== undefined) { writer.uint32(26).string(message.withdrawAddress); } return writer; @@ -569,11 +552,11 @@ export const MsgUpdateDevFeeInfo = { return message; }, fromJSON(object: any): MsgUpdateDevFeeInfo { - return { - contractAddress: isSet(object.contractAddress) ? String(object.contractAddress) : "", - deployerAddress: isSet(object.deployerAddress) ? String(object.deployerAddress) : "", - withdrawAddress: isSet(object.withdrawAddress) ? String(object.withdrawAddress) : "" - }; + const obj = createBaseMsgUpdateDevFeeInfo(); + if (isSet(object.contractAddress)) obj.contractAddress = String(object.contractAddress); + if (isSet(object.deployerAddress)) obj.deployerAddress = String(object.deployerAddress); + if (isSet(object.withdrawAddress)) obj.withdrawAddress = String(object.withdrawAddress); + return obj; }, toJSON(message: MsgUpdateDevFeeInfo): JsonSafe { const obj: any = {}; @@ -669,7 +652,8 @@ export const MsgUpdateDevFeeInfoResponse = { return message; }, fromJSON(_: any): MsgUpdateDevFeeInfoResponse { - return {}; + const obj = createBaseMsgUpdateDevFeeInfoResponse(); + return obj; }, toJSON(_: MsgUpdateDevFeeInfoResponse): JsonSafe { const obj: any = {}; diff --git a/__fixtures__/v-next/outputv4/evmos/incentives/v1/genesis.ts b/__fixtures__/v-next/outputv4/evmos/incentives/v1/genesis.ts index 98cfc0c09f..de48b538ca 100644 --- a/__fixtures__/v-next/outputv4/evmos/incentives/v1/genesis.ts +++ b/__fixtures__/v-next/outputv4/evmos/incentives/v1/genesis.ts @@ -1,9 +1,8 @@ -import { Incentive, IncentiveSDKType, GasMeter, GasMeterSDKType } from "./incentives"; -import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; -import { JsonSafe } from "../../../json-safe"; +import { Incentive, IncentiveSDKType, GasMeter, GasMeterSDKType } from "./incentives.js"; +import { BinaryReader, BinaryWriter } from "../../../binary.js"; +import { isSet, DeepPartial } from "../../../helpers.js"; +import { JsonSafe } from "../../../json-safe.js"; import { Decimal } from "@cosmjs/math"; -import { ComputedRef } from "vue"; export const protobufPackage = "evmos.incentives.v1"; /** GenesisState defines the module's genesis state. */ export interface GenesisState { @@ -14,11 +13,6 @@ export interface GenesisState { /** active Gasmeters */ gasMeters: GasMeter[]; } -export interface ReactiveGenesisState { - params: ComputedRef; - incentives: ComputedRef; - gasMeters: ComputedRef; -} export interface GenesisStateProtoMsg { typeUrl: "/evmos.incentives.v1.GenesisState"; value: Uint8Array; @@ -40,12 +34,6 @@ export interface Params { /** scaling factor for capping rewards */ rewardScaler: string; } -export interface ReactiveParams { - enableIncentives: ComputedRef; - allocationLimit: ComputedRef; - incentivesEpochIdentifier: ComputedRef; - rewardScaler: ComputedRef; -} export interface ParamsProtoMsg { typeUrl: "/evmos.incentives.v1.Params"; value: Uint8Array; @@ -102,11 +90,11 @@ export const GenesisState = { return message; }, fromJSON(object: any): GenesisState { - return { - params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, - incentives: Array.isArray(object?.incentives) ? object.incentives.map((e: any) => Incentive.fromJSON(e)) : [], - gasMeters: Array.isArray(object?.gasMeters) ? object.gasMeters.map((e: any) => GasMeter.fromJSON(e)) : [] - }; + const obj = createBaseGenesisState(); + if (isSet(object.params)) obj.params = Params.fromJSON(object.params); + if (Array.isArray(object?.incentives)) obj.incentives = object.incentives.map((e: any) => Incentive.fromJSON(e)); + if (Array.isArray(object?.gasMeters)) obj.gasMeters = object.gasMeters.map((e: any) => GasMeter.fromJSON(e)); + return obj; }, toJSON(message: GenesisState): JsonSafe { const obj: any = {}; @@ -125,7 +113,9 @@ export const GenesisState = { }, fromPartial(object: DeepPartial): GenesisState { const message = createBaseGenesisState(); - message.params = object.params !== undefined && object.params !== null ? Params.fromPartial(object.params) : undefined; + if (object.params !== undefined && object.params !== null) { + message.params = Params.fromPartial(object.params); + } message.incentives = object.incentives?.map(e => Incentive.fromPartial(e)) || []; message.gasMeters = object.gasMeters?.map(e => GasMeter.fromPartial(e)) || []; return message; @@ -210,16 +200,16 @@ function createBaseParams(): Params { export const Params = { typeUrl: "/evmos.incentives.v1.Params", encode(message: Params, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.enableIncentives === true) { + if (message.enableIncentives !== undefined) { writer.uint32(8).bool(message.enableIncentives); } - if (message.allocationLimit !== "") { + if (message.allocationLimit !== undefined) { writer.uint32(18).string(Decimal.fromUserInput(message.allocationLimit, 18).atomics); } - if (message.incentivesEpochIdentifier !== "") { + if (message.incentivesEpochIdentifier !== undefined) { writer.uint32(26).string(message.incentivesEpochIdentifier); } - if (message.rewardScaler !== "") { + if (message.rewardScaler !== undefined) { writer.uint32(34).string(Decimal.fromUserInput(message.rewardScaler, 18).atomics); } return writer; @@ -251,12 +241,12 @@ export const Params = { return message; }, fromJSON(object: any): Params { - return { - enableIncentives: isSet(object.enableIncentives) ? Boolean(object.enableIncentives) : false, - allocationLimit: isSet(object.allocationLimit) ? String(object.allocationLimit) : "", - incentivesEpochIdentifier: isSet(object.incentivesEpochIdentifier) ? String(object.incentivesEpochIdentifier) : "", - rewardScaler: isSet(object.rewardScaler) ? String(object.rewardScaler) : "" - }; + const obj = createBaseParams(); + if (isSet(object.enableIncentives)) obj.enableIncentives = Boolean(object.enableIncentives); + if (isSet(object.allocationLimit)) obj.allocationLimit = String(object.allocationLimit); + if (isSet(object.incentivesEpochIdentifier)) obj.incentivesEpochIdentifier = String(object.incentivesEpochIdentifier); + if (isSet(object.rewardScaler)) obj.rewardScaler = String(object.rewardScaler); + return obj; }, toJSON(message: Params): JsonSafe { const obj: any = {}; diff --git a/__fixtures__/v-next/outputv4/evmos/incentives/v1/incentives.ts b/__fixtures__/v-next/outputv4/evmos/incentives/v1/incentives.ts index 31a6a5d7f9..10773706f2 100644 --- a/__fixtures__/v-next/outputv4/evmos/incentives/v1/incentives.ts +++ b/__fixtures__/v-next/outputv4/evmos/incentives/v1/incentives.ts @@ -1,9 +1,8 @@ -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 { JsonSafe } from "../../../json-safe"; -import { ComputedRef } from "vue"; +import { DecCoin, DecCoinSDKType } from "../../../cosmos/base/v1beta1/coin.js"; +import { Timestamp, TimestampSDKType } from "../../../google/protobuf/timestamp.js"; +import { BinaryReader, BinaryWriter } from "../../../binary.js"; +import { toTimestamp, fromTimestamp, isSet, DeepPartial } from "../../../helpers.js"; +import { JsonSafe } from "../../../json-safe.js"; export const protobufPackage = "evmos.incentives.v1"; /** * Incentive defines an instance that organizes distribution conditions for a @@ -21,13 +20,6 @@ export interface Incentive { /** cumulative gas spent by all gasmeters of the incentive during the epoch */ totalGas: bigint; } -export interface ReactiveIncentive { - contract: ComputedRef; - allocations: ComputedRef; - epochs: ComputedRef; - startTime: ComputedRef; - totalGas: ComputedRef; -} export interface IncentiveProtoMsg { typeUrl: "/evmos.incentives.v1.Incentive"; value: Uint8Array; @@ -52,11 +44,6 @@ export interface GasMeter { /** cumulative gas spent during the epoch */ cumulativeGas: bigint; } -export interface ReactiveGasMeter { - contract: ComputedRef; - participant: ComputedRef; - cumulativeGas: ComputedRef; -} export interface GasMeterProtoMsg { typeUrl: "/evmos.incentives.v1.GasMeter"; value: Uint8Array; @@ -80,13 +67,6 @@ export interface RegisterIncentiveProposal { /** number of remaining epochs */ epochs: number; } -export interface ReactiveRegisterIncentiveProposal { - title: ComputedRef; - description: ComputedRef; - contract: ComputedRef; - allocations: ComputedRef; - epochs: ComputedRef; -} export interface RegisterIncentiveProposalProtoMsg { typeUrl: "/evmos.incentives.v1.RegisterIncentiveProposal"; value: Uint8Array; @@ -108,11 +88,6 @@ export interface CancelIncentiveProposal { /** contract address */ contract: string; } -export interface ReactiveCancelIncentiveProposal { - title: ComputedRef; - description: ComputedRef; - contract: ComputedRef; -} export interface CancelIncentiveProposalProtoMsg { typeUrl: "/evmos.incentives.v1.CancelIncentiveProposal"; value: Uint8Array; @@ -135,19 +110,19 @@ function createBaseIncentive(): Incentive { export const Incentive = { typeUrl: "/evmos.incentives.v1.Incentive", encode(message: Incentive, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.contract !== "") { + if (message.contract !== undefined) { writer.uint32(10).string(message.contract); } for (const v of message.allocations) { DecCoin.encode(v!, writer.uint32(18).fork()).ldelim(); } - if (message.epochs !== 0) { + if (message.epochs !== undefined) { writer.uint32(24).uint32(message.epochs); } if (message.startTime !== undefined) { Timestamp.encode(toTimestamp(message.startTime), writer.uint32(34).fork()).ldelim(); } - if (message.totalGas !== BigInt(0)) { + if (message.totalGas !== undefined) { writer.uint32(40).uint64(message.totalGas); } return writer; @@ -182,13 +157,13 @@ export const Incentive = { return message; }, fromJSON(object: any): Incentive { - return { - contract: isSet(object.contract) ? String(object.contract) : "", - allocations: Array.isArray(object?.allocations) ? object.allocations.map((e: any) => DecCoin.fromJSON(e)) : [], - epochs: isSet(object.epochs) ? Number(object.epochs) : 0, - startTime: isSet(object.startTime) ? new Date(object.startTime) : undefined, - totalGas: isSet(object.totalGas) ? BigInt(object.totalGas.toString()) : BigInt(0) - }; + const obj = createBaseIncentive(); + if (isSet(object.contract)) obj.contract = String(object.contract); + if (Array.isArray(object?.allocations)) obj.allocations = object.allocations.map((e: any) => DecCoin.fromJSON(e)); + if (isSet(object.epochs)) obj.epochs = Number(object.epochs); + if (isSet(object.startTime)) obj.startTime = new Date(object.startTime); + if (isSet(object.totalGas)) obj.totalGas = BigInt(object.totalGas.toString()); + return obj; }, toJSON(message: Incentive): JsonSafe { const obj: any = {}; @@ -209,7 +184,9 @@ export const Incentive = { message.allocations = object.allocations?.map(e => DecCoin.fromPartial(e)) || []; message.epochs = object.epochs ?? 0; message.startTime = object.startTime ?? undefined; - message.totalGas = object.totalGas !== undefined && object.totalGas !== null ? BigInt(object.totalGas.toString()) : BigInt(0); + if (object.totalGas !== undefined && object.totalGas !== null) { + message.totalGas = BigInt(object.totalGas.toString()); + } return message; }, fromSDK(object: IncentiveSDKType): Incentive { @@ -299,13 +276,13 @@ function createBaseGasMeter(): GasMeter { export const GasMeter = { typeUrl: "/evmos.incentives.v1.GasMeter", encode(message: GasMeter, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.contract !== "") { + if (message.contract !== undefined) { writer.uint32(10).string(message.contract); } - if (message.participant !== "") { + if (message.participant !== undefined) { writer.uint32(18).string(message.participant); } - if (message.cumulativeGas !== BigInt(0)) { + if (message.cumulativeGas !== undefined) { writer.uint32(24).uint64(message.cumulativeGas); } return writer; @@ -334,11 +311,11 @@ export const GasMeter = { return message; }, fromJSON(object: any): GasMeter { - return { - contract: isSet(object.contract) ? String(object.contract) : "", - participant: isSet(object.participant) ? String(object.participant) : "", - cumulativeGas: isSet(object.cumulativeGas) ? BigInt(object.cumulativeGas.toString()) : BigInt(0) - }; + const obj = createBaseGasMeter(); + if (isSet(object.contract)) obj.contract = String(object.contract); + if (isSet(object.participant)) obj.participant = String(object.participant); + if (isSet(object.cumulativeGas)) obj.cumulativeGas = BigInt(object.cumulativeGas.toString()); + return obj; }, toJSON(message: GasMeter): JsonSafe { const obj: any = {}; @@ -351,7 +328,9 @@ export const GasMeter = { const message = createBaseGasMeter(); message.contract = object.contract ?? ""; message.participant = object.participant ?? ""; - message.cumulativeGas = object.cumulativeGas !== undefined && object.cumulativeGas !== null ? BigInt(object.cumulativeGas.toString()) : BigInt(0); + if (object.cumulativeGas !== undefined && object.cumulativeGas !== null) { + message.cumulativeGas = BigInt(object.cumulativeGas.toString()); + } return message; }, fromSDK(object: GasMeterSDKType): GasMeter { @@ -423,19 +402,19 @@ function createBaseRegisterIncentiveProposal(): RegisterIncentiveProposal { export const RegisterIncentiveProposal = { typeUrl: "/evmos.incentives.v1.RegisterIncentiveProposal", encode(message: RegisterIncentiveProposal, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.title !== "") { + if (message.title !== undefined) { writer.uint32(10).string(message.title); } - if (message.description !== "") { + if (message.description !== undefined) { writer.uint32(18).string(message.description); } - if (message.contract !== "") { + if (message.contract !== undefined) { writer.uint32(26).string(message.contract); } for (const v of message.allocations) { DecCoin.encode(v!, writer.uint32(34).fork()).ldelim(); } - if (message.epochs !== 0) { + if (message.epochs !== undefined) { writer.uint32(40).uint32(message.epochs); } return writer; @@ -470,13 +449,13 @@ export const RegisterIncentiveProposal = { return message; }, fromJSON(object: any): RegisterIncentiveProposal { - return { - title: isSet(object.title) ? String(object.title) : "", - description: isSet(object.description) ? String(object.description) : "", - contract: isSet(object.contract) ? String(object.contract) : "", - allocations: Array.isArray(object?.allocations) ? object.allocations.map((e: any) => DecCoin.fromJSON(e)) : [], - epochs: isSet(object.epochs) ? Number(object.epochs) : 0 - }; + const obj = createBaseRegisterIncentiveProposal(); + if (isSet(object.title)) obj.title = String(object.title); + if (isSet(object.description)) obj.description = String(object.description); + if (isSet(object.contract)) obj.contract = String(object.contract); + if (Array.isArray(object?.allocations)) obj.allocations = object.allocations.map((e: any) => DecCoin.fromJSON(e)); + if (isSet(object.epochs)) obj.epochs = Number(object.epochs); + return obj; }, toJSON(message: RegisterIncentiveProposal): JsonSafe { const obj: any = {}; @@ -587,13 +566,13 @@ function createBaseCancelIncentiveProposal(): CancelIncentiveProposal { export const CancelIncentiveProposal = { typeUrl: "/evmos.incentives.v1.CancelIncentiveProposal", encode(message: CancelIncentiveProposal, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.title !== "") { + if (message.title !== undefined) { writer.uint32(10).string(message.title); } - if (message.description !== "") { + if (message.description !== undefined) { writer.uint32(18).string(message.description); } - if (message.contract !== "") { + if (message.contract !== undefined) { writer.uint32(26).string(message.contract); } return writer; @@ -622,11 +601,11 @@ export const CancelIncentiveProposal = { return message; }, fromJSON(object: any): CancelIncentiveProposal { - return { - title: isSet(object.title) ? String(object.title) : "", - description: isSet(object.description) ? String(object.description) : "", - contract: isSet(object.contract) ? String(object.contract) : "" - }; + const obj = createBaseCancelIncentiveProposal(); + if (isSet(object.title)) obj.title = String(object.title); + if (isSet(object.description)) obj.description = String(object.description); + if (isSet(object.contract)) obj.contract = String(object.contract); + return obj; }, toJSON(message: CancelIncentiveProposal): JsonSafe { const obj: any = {}; diff --git a/__fixtures__/v-next/outputv4/evmos/incentives/v1/query.lcd.ts b/__fixtures__/v-next/outputv4/evmos/incentives/v1/query.lcd.ts index cd66d16083..db8fb0ef56 100644 --- a/__fixtures__/v-next/outputv4/evmos/incentives/v1/query.lcd.ts +++ b/__fixtures__/v-next/outputv4/evmos/incentives/v1/query.lcd.ts @@ -1,10 +1,10 @@ -import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../../cosmos/base/query/v1beta1/pagination"; -import { Incentive, IncentiveSDKType, GasMeter, GasMeterSDKType } from "./incentives"; -import { DecCoin, DecCoinSDKType } from "../../../cosmos/base/v1beta1/coin"; -import { Params, ParamsSDKType } from "./genesis"; -import { setPaginationParams } from "../../../helpers"; +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../../cosmos/base/query/v1beta1/pagination.js"; +import { Incentive, IncentiveSDKType, GasMeter, GasMeterSDKType } from "./incentives.js"; +import { DecCoin, DecCoinSDKType } from "../../../cosmos/base/v1beta1/coin.js"; +import { Params, ParamsSDKType } from "./genesis.js"; +import { setPaginationParams } from "../../../helpers.js"; import { LCDClient } from "@cosmology/lcd"; -import { QueryIncentivesRequest, QueryIncentivesRequestSDKType, QueryIncentivesResponse, QueryIncentivesResponseSDKType, QueryIncentiveRequest, QueryIncentiveRequestSDKType, QueryIncentiveResponse, QueryIncentiveResponseSDKType, QueryGasMetersRequest, QueryGasMetersRequestSDKType, QueryGasMetersResponse, QueryGasMetersResponseSDKType, QueryGasMeterRequest, QueryGasMeterRequestSDKType, QueryGasMeterResponse, QueryGasMeterResponseSDKType, QueryAllocationMetersRequest, QueryAllocationMetersRequestSDKType, QueryAllocationMetersResponse, QueryAllocationMetersResponseSDKType, QueryAllocationMeterRequest, QueryAllocationMeterRequestSDKType, QueryAllocationMeterResponse, QueryAllocationMeterResponseSDKType, QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType } from "./query"; +import { QueryIncentivesRequest, QueryIncentivesRequestSDKType, QueryIncentivesResponse, QueryIncentivesResponseSDKType, QueryIncentiveRequest, QueryIncentiveRequestSDKType, QueryIncentiveResponse, QueryIncentiveResponseSDKType, QueryGasMetersRequest, QueryGasMetersRequestSDKType, QueryGasMetersResponse, QueryGasMetersResponseSDKType, QueryGasMeterRequest, QueryGasMeterRequestSDKType, QueryGasMeterResponse, QueryGasMeterResponseSDKType, QueryAllocationMetersRequest, QueryAllocationMetersRequestSDKType, QueryAllocationMetersResponse, QueryAllocationMetersResponseSDKType, QueryAllocationMeterRequest, QueryAllocationMeterRequestSDKType, QueryAllocationMeterResponse, QueryAllocationMeterResponseSDKType, QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType } from "./query.js"; export class LCDQueryClient { req: LCDClient; constructor({ @@ -23,7 +23,7 @@ export class LCDQueryClient { } /* Incentives retrieves registered incentives */ async incentives(params: QueryIncentivesRequest = { - pagination: undefined + pagination: PageRequest.fromPartial({}) }): Promise { const options: any = { params: {} @@ -58,7 +58,7 @@ export class LCDQueryClient { /* AllocationMeters retrieves active allocation meters for a given denomination */ async allocationMeters(params: QueryAllocationMetersRequest = { - pagination: undefined + pagination: PageRequest.fromPartial({}) }): Promise { const options: any = { params: {} diff --git a/__fixtures__/v-next/outputv4/evmos/incentives/v1/query.rpc.Query.ts b/__fixtures__/v-next/outputv4/evmos/incentives/v1/query.rpc.Query.ts index c10afcd909..fbb2185e21 100644 --- a/__fixtures__/v-next/outputv4/evmos/incentives/v1/query.rpc.Query.ts +++ b/__fixtures__/v-next/outputv4/evmos/incentives/v1/query.rpc.Query.ts @@ -1,11 +1,11 @@ -import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../../cosmos/base/query/v1beta1/pagination"; -import { Incentive, IncentiveSDKType, GasMeter, GasMeterSDKType } from "./incentives"; -import { DecCoin, DecCoinSDKType } from "../../../cosmos/base/v1beta1/coin"; -import { Params, ParamsSDKType } from "./genesis"; -import { Rpc } from "../../../helpers"; -import { BinaryReader } from "../../../binary"; +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../../cosmos/base/query/v1beta1/pagination.js"; +import { Incentive, IncentiveSDKType, GasMeter, GasMeterSDKType } from "./incentives.js"; +import { DecCoin, DecCoinSDKType } from "../../../cosmos/base/v1beta1/coin.js"; +import { Params, ParamsSDKType } from "./genesis.js"; +import { Rpc } from "../../../helpers.js"; +import { BinaryReader } from "../../../binary.js"; import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; -import { QueryIncentivesRequest, QueryIncentivesRequestSDKType, QueryIncentivesResponse, QueryIncentivesResponseSDKType, QueryIncentiveRequest, QueryIncentiveRequestSDKType, QueryIncentiveResponse, QueryIncentiveResponseSDKType, QueryGasMetersRequest, QueryGasMetersRequestSDKType, QueryGasMetersResponse, QueryGasMetersResponseSDKType, QueryGasMeterRequest, QueryGasMeterRequestSDKType, QueryGasMeterResponse, QueryGasMeterResponseSDKType, QueryAllocationMetersRequest, QueryAllocationMetersRequestSDKType, QueryAllocationMetersResponse, QueryAllocationMetersResponseSDKType, QueryAllocationMeterRequest, QueryAllocationMeterRequestSDKType, QueryAllocationMeterResponse, QueryAllocationMeterResponseSDKType, QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType, ReactiveQueryIncentivesRequest, ReactiveQueryIncentiveRequest, ReactiveQueryGasMetersRequest, ReactiveQueryGasMeterRequest, ReactiveQueryAllocationMetersRequest, ReactiveQueryAllocationMeterRequest, ReactiveQueryParamsRequest } from "./query"; +import { QueryIncentivesRequest, QueryIncentivesRequestSDKType, QueryIncentivesResponse, QueryIncentivesResponseSDKType, QueryIncentiveRequest, QueryIncentiveRequestSDKType, QueryIncentiveResponse, QueryIncentiveResponseSDKType, QueryGasMetersRequest, QueryGasMetersRequestSDKType, QueryGasMetersResponse, QueryGasMetersResponseSDKType, QueryGasMeterRequest, QueryGasMeterRequestSDKType, QueryGasMeterResponse, QueryGasMeterResponseSDKType, QueryAllocationMetersRequest, QueryAllocationMetersRequestSDKType, QueryAllocationMetersResponse, QueryAllocationMetersResponseSDKType, QueryAllocationMeterRequest, QueryAllocationMeterRequestSDKType, QueryAllocationMeterResponse, QueryAllocationMeterResponseSDKType, QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType } from "./query.js"; /** Query defines the gRPC querier service. */ export interface Query { /** Incentives retrieves registered incentives */ @@ -39,7 +39,7 @@ export class QueryClientImpl implements Query { this.params = this.params.bind(this); } incentives(request: QueryIncentivesRequest = { - pagination: undefined + pagination: PageRequest.fromPartial({}) }): Promise { const data = QueryIncentivesRequest.encode(request).finish(); const promise = this.rpc.request("evmos.incentives.v1.Query", "Incentives", data); @@ -61,7 +61,7 @@ export class QueryClientImpl implements Query { return promise.then(data => QueryGasMeterResponse.decode(new BinaryReader(data))); } allocationMeters(request: QueryAllocationMetersRequest = { - pagination: undefined + pagination: PageRequest.fromPartial({}) }): Promise { const data = QueryAllocationMetersRequest.encode(request).finish(); const promise = this.rpc.request("evmos.incentives.v1.Query", "AllocationMeters", data); diff --git a/__fixtures__/v-next/outputv4/evmos/incentives/v1/query.ts b/__fixtures__/v-next/outputv4/evmos/incentives/v1/query.ts index e4f56c9f53..269c2b95ea 100644 --- a/__fixtures__/v-next/outputv4/evmos/incentives/v1/query.ts +++ b/__fixtures__/v-next/outputv4/evmos/incentives/v1/query.ts @@ -1,11 +1,10 @@ -import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../../cosmos/base/query/v1beta1/pagination"; -import { Incentive, IncentiveSDKType, GasMeter, GasMeterSDKType } from "./incentives"; -import { DecCoin, DecCoinSDKType } from "../../../cosmos/base/v1beta1/coin"; -import { Params, ParamsSDKType } from "./genesis"; -import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; -import { JsonSafe } from "../../../json-safe"; -import { ComputedRef } from "vue"; +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../../cosmos/base/query/v1beta1/pagination.js"; +import { Incentive, IncentiveSDKType, GasMeter, GasMeterSDKType } from "./incentives.js"; +import { DecCoin, DecCoinSDKType } from "../../../cosmos/base/v1beta1/coin.js"; +import { Params, ParamsSDKType } from "./genesis.js"; +import { BinaryReader, BinaryWriter } from "../../../binary.js"; +import { isSet, DeepPartial } from "../../../helpers.js"; +import { JsonSafe } from "../../../json-safe.js"; export const protobufPackage = "evmos.incentives.v1"; /** * QueryIncentivesRequest is the request type for the Query/Incentives RPC @@ -15,9 +14,6 @@ export interface QueryIncentivesRequest { /** pagination defines an optional pagination for the request. */ pagination?: PageRequest; } -export interface ReactiveQueryIncentivesRequest { - pagination?: ComputedRef; -} export interface QueryIncentivesRequestProtoMsg { typeUrl: "/evmos.incentives.v1.QueryIncentivesRequest"; value: Uint8Array; @@ -38,10 +34,6 @@ export interface QueryIncentivesResponse { /** pagination defines the pagination in the response. */ pagination?: PageResponse; } -export interface ReactiveQueryIncentivesResponse { - incentives: ComputedRef; - pagination?: ComputedRef; -} export interface QueryIncentivesResponseProtoMsg { typeUrl: "/evmos.incentives.v1.QueryIncentivesResponse"; value: Uint8Array; @@ -59,9 +51,6 @@ export interface QueryIncentiveRequest { /** contract identifier is the hex contract address of a contract */ contract: string; } -export interface ReactiveQueryIncentiveRequest { - contract: ComputedRef; -} export interface QueryIncentiveRequestProtoMsg { typeUrl: "/evmos.incentives.v1.QueryIncentiveRequest"; value: Uint8Array; @@ -77,9 +66,6 @@ export interface QueryIncentiveRequestSDKType { export interface QueryIncentiveResponse { incentive: Incentive; } -export interface ReactiveQueryIncentiveResponse { - incentive: ComputedRef; -} export interface QueryIncentiveResponseProtoMsg { typeUrl: "/evmos.incentives.v1.QueryIncentiveResponse"; value: Uint8Array; @@ -101,10 +87,6 @@ export interface QueryGasMetersRequest { /** pagination defines an optional pagination for the request. */ pagination?: PageRequest; } -export interface ReactiveQueryGasMetersRequest { - contract: ComputedRef; - pagination?: ComputedRef; -} export interface QueryGasMetersRequestProtoMsg { typeUrl: "/evmos.incentives.v1.QueryGasMetersRequest"; value: Uint8Array; @@ -126,10 +108,6 @@ export interface QueryGasMetersResponse { /** pagination defines the pagination in the response. */ pagination?: PageResponse; } -export interface ReactiveQueryGasMetersResponse { - gasMeters: ComputedRef; - pagination?: ComputedRef; -} export interface QueryGasMetersResponseProtoMsg { typeUrl: "/evmos.incentives.v1.QueryGasMetersResponse"; value: Uint8Array; @@ -149,10 +127,6 @@ export interface QueryGasMeterRequest { /** participant identifier is the hex address of a user */ participant: string; } -export interface ReactiveQueryGasMeterRequest { - contract: ComputedRef; - participant: ComputedRef; -} export interface QueryGasMeterRequestProtoMsg { typeUrl: "/evmos.incentives.v1.QueryGasMeterRequest"; value: Uint8Array; @@ -169,9 +143,6 @@ export interface QueryGasMeterRequestSDKType { export interface QueryGasMeterResponse { gasMeter: bigint; } -export interface ReactiveQueryGasMeterResponse { - gasMeter: ComputedRef; -} export interface QueryGasMeterResponseProtoMsg { typeUrl: "/evmos.incentives.v1.QueryGasMeterResponse"; value: Uint8Array; @@ -191,9 +162,6 @@ export interface QueryAllocationMetersRequest { /** pagination defines an optional pagination for the request. */ pagination?: PageRequest; } -export interface ReactiveQueryAllocationMetersRequest { - pagination?: ComputedRef; -} export interface QueryAllocationMetersRequestProtoMsg { typeUrl: "/evmos.incentives.v1.QueryAllocationMetersRequest"; value: Uint8Array; @@ -214,10 +182,6 @@ export interface QueryAllocationMetersResponse { /** pagination defines the pagination in the response. */ pagination?: PageResponse; } -export interface ReactiveQueryAllocationMetersResponse { - allocationMeters: ComputedRef; - pagination?: ComputedRef; -} export interface QueryAllocationMetersResponseProtoMsg { typeUrl: "/evmos.incentives.v1.QueryAllocationMetersResponse"; value: Uint8Array; @@ -238,9 +202,6 @@ export interface QueryAllocationMeterRequest { /** denom is the coin denom to query an allocation meter for. */ denom: string; } -export interface ReactiveQueryAllocationMeterRequest { - denom: ComputedRef; -} export interface QueryAllocationMeterRequestProtoMsg { typeUrl: "/evmos.incentives.v1.QueryAllocationMeterRequest"; value: Uint8Array; @@ -259,9 +220,6 @@ export interface QueryAllocationMeterRequestSDKType { export interface QueryAllocationMeterResponse { allocationMeter: DecCoin; } -export interface ReactiveQueryAllocationMeterResponse { - allocationMeter: ComputedRef; -} export interface QueryAllocationMeterResponseProtoMsg { typeUrl: "/evmos.incentives.v1.QueryAllocationMeterResponse"; value: Uint8Array; @@ -275,7 +233,6 @@ export interface QueryAllocationMeterResponseSDKType { } /** QueryParamsRequest is the request type for the Query/Params RPC method. */ export interface QueryParamsRequest {} -export interface ReactiveQueryParamsRequest {} export interface QueryParamsRequestProtoMsg { typeUrl: "/evmos.incentives.v1.QueryParamsRequest"; value: Uint8Array; @@ -289,9 +246,6 @@ export interface QueryParamsRequestSDKType {} export interface QueryParamsResponse { params: Params; } -export interface ReactiveQueryParamsResponse { - params: ComputedRef; -} export interface QueryParamsResponseProtoMsg { typeUrl: "/evmos.incentives.v1.QueryParamsResponse"; value: Uint8Array; @@ -334,9 +288,9 @@ export const QueryIncentivesRequest = { return message; }, fromJSON(object: any): QueryIncentivesRequest { - return { - pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined - }; + const obj = createBaseQueryIncentivesRequest(); + if (isSet(object.pagination)) obj.pagination = PageRequest.fromJSON(object.pagination); + return obj; }, toJSON(message: QueryIncentivesRequest): JsonSafe { const obj: any = {}; @@ -345,7 +299,9 @@ export const QueryIncentivesRequest = { }, fromPartial(object: DeepPartial): QueryIncentivesRequest { const message = createBaseQueryIncentivesRequest(); - message.pagination = object.pagination !== undefined && object.pagination !== null ? PageRequest.fromPartial(object.pagination) : undefined; + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageRequest.fromPartial(object.pagination); + } return message; }, fromSDK(object: QueryIncentivesRequestSDKType): QueryIncentivesRequest { @@ -429,10 +385,10 @@ export const QueryIncentivesResponse = { return message; }, fromJSON(object: any): QueryIncentivesResponse { - return { - incentives: Array.isArray(object?.incentives) ? object.incentives.map((e: any) => Incentive.fromJSON(e)) : [], - pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined - }; + const obj = createBaseQueryIncentivesResponse(); + if (Array.isArray(object?.incentives)) obj.incentives = object.incentives.map((e: any) => Incentive.fromJSON(e)); + if (isSet(object.pagination)) obj.pagination = PageResponse.fromJSON(object.pagination); + return obj; }, toJSON(message: QueryIncentivesResponse): JsonSafe { const obj: any = {}; @@ -447,7 +403,9 @@ export const QueryIncentivesResponse = { fromPartial(object: DeepPartial): QueryIncentivesResponse { const message = createBaseQueryIncentivesResponse(); message.incentives = object.incentives?.map(e => Incentive.fromPartial(e)) || []; - message.pagination = object.pagination !== undefined && object.pagination !== null ? PageResponse.fromPartial(object.pagination) : undefined; + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageResponse.fromPartial(object.pagination); + } return message; }, fromSDK(object: QueryIncentivesResponseSDKType): QueryIncentivesResponse { @@ -514,7 +472,7 @@ function createBaseQueryIncentiveRequest(): QueryIncentiveRequest { export const QueryIncentiveRequest = { typeUrl: "/evmos.incentives.v1.QueryIncentiveRequest", encode(message: QueryIncentiveRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.contract !== "") { + if (message.contract !== undefined) { writer.uint32(10).string(message.contract); } return writer; @@ -537,9 +495,9 @@ export const QueryIncentiveRequest = { return message; }, fromJSON(object: any): QueryIncentiveRequest { - return { - contract: isSet(object.contract) ? String(object.contract) : "" - }; + const obj = createBaseQueryIncentiveRequest(); + if (isSet(object.contract)) obj.contract = String(object.contract); + return obj; }, toJSON(message: QueryIncentiveRequest): JsonSafe { const obj: any = {}; @@ -625,9 +583,9 @@ export const QueryIncentiveResponse = { return message; }, fromJSON(object: any): QueryIncentiveResponse { - return { - incentive: isSet(object.incentive) ? Incentive.fromJSON(object.incentive) : undefined - }; + const obj = createBaseQueryIncentiveResponse(); + if (isSet(object.incentive)) obj.incentive = Incentive.fromJSON(object.incentive); + return obj; }, toJSON(message: QueryIncentiveResponse): JsonSafe { const obj: any = {}; @@ -636,7 +594,9 @@ export const QueryIncentiveResponse = { }, fromPartial(object: DeepPartial): QueryIncentiveResponse { const message = createBaseQueryIncentiveResponse(); - message.incentive = object.incentive !== undefined && object.incentive !== null ? Incentive.fromPartial(object.incentive) : undefined; + if (object.incentive !== undefined && object.incentive !== null) { + message.incentive = Incentive.fromPartial(object.incentive); + } return message; }, fromSDK(object: QueryIncentiveResponseSDKType): QueryIncentiveResponse { @@ -691,7 +651,7 @@ function createBaseQueryGasMetersRequest(): QueryGasMetersRequest { export const QueryGasMetersRequest = { typeUrl: "/evmos.incentives.v1.QueryGasMetersRequest", encode(message: QueryGasMetersRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.contract !== "") { + if (message.contract !== undefined) { writer.uint32(10).string(message.contract); } if (message.pagination !== undefined) { @@ -720,10 +680,10 @@ export const QueryGasMetersRequest = { return message; }, fromJSON(object: any): QueryGasMetersRequest { - return { - contract: isSet(object.contract) ? String(object.contract) : "", - pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined - }; + const obj = createBaseQueryGasMetersRequest(); + if (isSet(object.contract)) obj.contract = String(object.contract); + if (isSet(object.pagination)) obj.pagination = PageRequest.fromJSON(object.pagination); + return obj; }, toJSON(message: QueryGasMetersRequest): JsonSafe { const obj: any = {}; @@ -734,7 +694,9 @@ export const QueryGasMetersRequest = { fromPartial(object: DeepPartial): QueryGasMetersRequest { const message = createBaseQueryGasMetersRequest(); message.contract = object.contract ?? ""; - message.pagination = object.pagination !== undefined && object.pagination !== null ? PageRequest.fromPartial(object.pagination) : undefined; + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageRequest.fromPartial(object.pagination); + } return message; }, fromSDK(object: QueryGasMetersRequestSDKType): QueryGasMetersRequest { @@ -825,10 +787,10 @@ export const QueryGasMetersResponse = { return message; }, fromJSON(object: any): QueryGasMetersResponse { - return { - gasMeters: Array.isArray(object?.gasMeters) ? object.gasMeters.map((e: any) => GasMeter.fromJSON(e)) : [], - pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined - }; + const obj = createBaseQueryGasMetersResponse(); + if (Array.isArray(object?.gasMeters)) obj.gasMeters = object.gasMeters.map((e: any) => GasMeter.fromJSON(e)); + if (isSet(object.pagination)) obj.pagination = PageResponse.fromJSON(object.pagination); + return obj; }, toJSON(message: QueryGasMetersResponse): JsonSafe { const obj: any = {}; @@ -843,7 +805,9 @@ export const QueryGasMetersResponse = { fromPartial(object: DeepPartial): QueryGasMetersResponse { const message = createBaseQueryGasMetersResponse(); message.gasMeters = object.gasMeters?.map(e => GasMeter.fromPartial(e)) || []; - message.pagination = object.pagination !== undefined && object.pagination !== null ? PageResponse.fromPartial(object.pagination) : undefined; + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageResponse.fromPartial(object.pagination); + } return message; }, fromSDK(object: QueryGasMetersResponseSDKType): QueryGasMetersResponse { @@ -911,10 +875,10 @@ function createBaseQueryGasMeterRequest(): QueryGasMeterRequest { export const QueryGasMeterRequest = { typeUrl: "/evmos.incentives.v1.QueryGasMeterRequest", encode(message: QueryGasMeterRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.contract !== "") { + if (message.contract !== undefined) { writer.uint32(10).string(message.contract); } - if (message.participant !== "") { + if (message.participant !== undefined) { writer.uint32(18).string(message.participant); } return writer; @@ -940,10 +904,10 @@ export const QueryGasMeterRequest = { return message; }, fromJSON(object: any): QueryGasMeterRequest { - return { - contract: isSet(object.contract) ? String(object.contract) : "", - participant: isSet(object.participant) ? String(object.participant) : "" - }; + const obj = createBaseQueryGasMeterRequest(); + if (isSet(object.contract)) obj.contract = String(object.contract); + if (isSet(object.participant)) obj.participant = String(object.participant); + return obj; }, toJSON(message: QueryGasMeterRequest): JsonSafe { const obj: any = {}; @@ -1015,7 +979,7 @@ function createBaseQueryGasMeterResponse(): QueryGasMeterResponse { export const QueryGasMeterResponse = { typeUrl: "/evmos.incentives.v1.QueryGasMeterResponse", encode(message: QueryGasMeterResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.gasMeter !== BigInt(0)) { + if (message.gasMeter !== undefined) { writer.uint32(8).uint64(message.gasMeter); } return writer; @@ -1038,9 +1002,9 @@ export const QueryGasMeterResponse = { return message; }, fromJSON(object: any): QueryGasMeterResponse { - return { - gasMeter: isSet(object.gasMeter) ? BigInt(object.gasMeter.toString()) : BigInt(0) - }; + const obj = createBaseQueryGasMeterResponse(); + if (isSet(object.gasMeter)) obj.gasMeter = BigInt(object.gasMeter.toString()); + return obj; }, toJSON(message: QueryGasMeterResponse): JsonSafe { const obj: any = {}; @@ -1049,7 +1013,9 @@ export const QueryGasMeterResponse = { }, fromPartial(object: DeepPartial): QueryGasMeterResponse { const message = createBaseQueryGasMeterResponse(); - message.gasMeter = object.gasMeter !== undefined && object.gasMeter !== null ? BigInt(object.gasMeter.toString()) : BigInt(0); + if (object.gasMeter !== undefined && object.gasMeter !== null) { + message.gasMeter = BigInt(object.gasMeter.toString()); + } return message; }, fromSDK(object: QueryGasMeterResponseSDKType): QueryGasMeterResponse { @@ -1126,9 +1092,9 @@ export const QueryAllocationMetersRequest = { return message; }, fromJSON(object: any): QueryAllocationMetersRequest { - return { - pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined - }; + const obj = createBaseQueryAllocationMetersRequest(); + if (isSet(object.pagination)) obj.pagination = PageRequest.fromJSON(object.pagination); + return obj; }, toJSON(message: QueryAllocationMetersRequest): JsonSafe { const obj: any = {}; @@ -1137,7 +1103,9 @@ export const QueryAllocationMetersRequest = { }, fromPartial(object: DeepPartial): QueryAllocationMetersRequest { const message = createBaseQueryAllocationMetersRequest(); - message.pagination = object.pagination !== undefined && object.pagination !== null ? PageRequest.fromPartial(object.pagination) : undefined; + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageRequest.fromPartial(object.pagination); + } return message; }, fromSDK(object: QueryAllocationMetersRequestSDKType): QueryAllocationMetersRequest { @@ -1221,10 +1189,10 @@ export const QueryAllocationMetersResponse = { return message; }, fromJSON(object: any): QueryAllocationMetersResponse { - return { - allocationMeters: Array.isArray(object?.allocationMeters) ? object.allocationMeters.map((e: any) => DecCoin.fromJSON(e)) : [], - pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined - }; + const obj = createBaseQueryAllocationMetersResponse(); + if (Array.isArray(object?.allocationMeters)) obj.allocationMeters = object.allocationMeters.map((e: any) => DecCoin.fromJSON(e)); + if (isSet(object.pagination)) obj.pagination = PageResponse.fromJSON(object.pagination); + return obj; }, toJSON(message: QueryAllocationMetersResponse): JsonSafe { const obj: any = {}; @@ -1239,7 +1207,9 @@ export const QueryAllocationMetersResponse = { fromPartial(object: DeepPartial): QueryAllocationMetersResponse { const message = createBaseQueryAllocationMetersResponse(); message.allocationMeters = object.allocationMeters?.map(e => DecCoin.fromPartial(e)) || []; - message.pagination = object.pagination !== undefined && object.pagination !== null ? PageResponse.fromPartial(object.pagination) : undefined; + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageResponse.fromPartial(object.pagination); + } return message; }, fromSDK(object: QueryAllocationMetersResponseSDKType): QueryAllocationMetersResponse { @@ -1306,7 +1276,7 @@ function createBaseQueryAllocationMeterRequest(): QueryAllocationMeterRequest { export const QueryAllocationMeterRequest = { typeUrl: "/evmos.incentives.v1.QueryAllocationMeterRequest", encode(message: QueryAllocationMeterRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.denom !== "") { + if (message.denom !== undefined) { writer.uint32(10).string(message.denom); } return writer; @@ -1329,9 +1299,9 @@ export const QueryAllocationMeterRequest = { return message; }, fromJSON(object: any): QueryAllocationMeterRequest { - return { - denom: isSet(object.denom) ? String(object.denom) : "" - }; + const obj = createBaseQueryAllocationMeterRequest(); + if (isSet(object.denom)) obj.denom = String(object.denom); + return obj; }, toJSON(message: QueryAllocationMeterRequest): JsonSafe { const obj: any = {}; @@ -1417,9 +1387,9 @@ export const QueryAllocationMeterResponse = { return message; }, fromJSON(object: any): QueryAllocationMeterResponse { - return { - allocationMeter: isSet(object.allocationMeter) ? DecCoin.fromJSON(object.allocationMeter) : undefined - }; + const obj = createBaseQueryAllocationMeterResponse(); + if (isSet(object.allocationMeter)) obj.allocationMeter = DecCoin.fromJSON(object.allocationMeter); + return obj; }, toJSON(message: QueryAllocationMeterResponse): JsonSafe { const obj: any = {}; @@ -1428,7 +1398,9 @@ export const QueryAllocationMeterResponse = { }, fromPartial(object: DeepPartial): QueryAllocationMeterResponse { const message = createBaseQueryAllocationMeterResponse(); - message.allocationMeter = object.allocationMeter !== undefined && object.allocationMeter !== null ? DecCoin.fromPartial(object.allocationMeter) : undefined; + if (object.allocationMeter !== undefined && object.allocationMeter !== null) { + message.allocationMeter = DecCoin.fromPartial(object.allocationMeter); + } return message; }, fromSDK(object: QueryAllocationMeterResponseSDKType): QueryAllocationMeterResponse { @@ -1497,7 +1469,8 @@ export const QueryParamsRequest = { return message; }, fromJSON(_: any): QueryParamsRequest { - return {}; + const obj = createBaseQueryParamsRequest(); + return obj; }, toJSON(_: QueryParamsRequest): JsonSafe { const obj: any = {}; @@ -1572,9 +1545,9 @@ export const QueryParamsResponse = { return message; }, fromJSON(object: any): QueryParamsResponse { - return { - params: isSet(object.params) ? Params.fromJSON(object.params) : undefined - }; + const obj = createBaseQueryParamsResponse(); + if (isSet(object.params)) obj.params = Params.fromJSON(object.params); + return obj; }, toJSON(message: QueryParamsResponse): JsonSafe { const obj: any = {}; @@ -1583,7 +1556,9 @@ export const QueryParamsResponse = { }, fromPartial(object: DeepPartial): QueryParamsResponse { const message = createBaseQueryParamsResponse(); - message.params = object.params !== undefined && object.params !== null ? Params.fromPartial(object.params) : undefined; + if (object.params !== undefined && object.params !== null) { + message.params = Params.fromPartial(object.params); + } return message; }, fromSDK(object: QueryParamsResponseSDKType): QueryParamsResponse { diff --git a/__fixtures__/v-next/outputv4/evmos/inflation/v1/genesis.ts b/__fixtures__/v-next/outputv4/evmos/inflation/v1/genesis.ts index 437d9bc6ba..afd1e2695b 100644 --- a/__fixtures__/v-next/outputv4/evmos/inflation/v1/genesis.ts +++ b/__fixtures__/v-next/outputv4/evmos/inflation/v1/genesis.ts @@ -1,8 +1,7 @@ -import { ExponentialCalculation, ExponentialCalculationSDKType, InflationDistribution, InflationDistributionSDKType } from "./inflation"; -import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; -import { JsonSafe } from "../../../json-safe"; -import { ComputedRef } from "vue"; +import { ExponentialCalculation, ExponentialCalculationSDKType, InflationDistribution, InflationDistributionSDKType } from "./inflation.js"; +import { BinaryReader, BinaryWriter } from "../../../binary.js"; +import { isSet, DeepPartial } from "../../../helpers.js"; +import { JsonSafe } from "../../../json-safe.js"; export const protobufPackage = "evmos.inflation.v1"; /** GenesisState defines the inflation module's genesis state. */ export interface GenesisState { @@ -17,13 +16,6 @@ export interface GenesisState { /** number of epochs that have passed while inflation is disabled */ skippedEpochs: bigint; } -export interface ReactiveGenesisState { - params: ComputedRef; - period: ComputedRef; - epochIdentifier: ComputedRef; - epochsPerPeriod: ComputedRef; - skippedEpochs: ComputedRef; -} export interface GenesisStateProtoMsg { typeUrl: "/evmos.inflation.v1.GenesisState"; value: Uint8Array; @@ -47,12 +39,6 @@ export interface Params { /** parameter to enable inflation and halt increasing the skipped_epochs */ enableInflation: boolean; } -export interface ReactiveParams { - mintDenom: ComputedRef; - exponentialCalculation: ComputedRef; - inflationDistribution: ComputedRef; - enableInflation: ComputedRef; -} export interface ParamsProtoMsg { typeUrl: "/evmos.inflation.v1.Params"; value: Uint8Array; @@ -79,16 +65,16 @@ export const GenesisState = { if (message.params !== undefined) { Params.encode(message.params, writer.uint32(10).fork()).ldelim(); } - if (message.period !== BigInt(0)) { + if (message.period !== undefined) { writer.uint32(16).uint64(message.period); } - if (message.epochIdentifier !== "") { + if (message.epochIdentifier !== undefined) { writer.uint32(26).string(message.epochIdentifier); } - if (message.epochsPerPeriod !== BigInt(0)) { + if (message.epochsPerPeriod !== undefined) { writer.uint32(32).int64(message.epochsPerPeriod); } - if (message.skippedEpochs !== BigInt(0)) { + if (message.skippedEpochs !== undefined) { writer.uint32(40).uint64(message.skippedEpochs); } return writer; @@ -123,13 +109,13 @@ export const GenesisState = { return message; }, fromJSON(object: any): GenesisState { - return { - params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, - period: isSet(object.period) ? BigInt(object.period.toString()) : BigInt(0), - epochIdentifier: isSet(object.epochIdentifier) ? String(object.epochIdentifier) : "", - epochsPerPeriod: isSet(object.epochsPerPeriod) ? BigInt(object.epochsPerPeriod.toString()) : BigInt(0), - skippedEpochs: isSet(object.skippedEpochs) ? BigInt(object.skippedEpochs.toString()) : BigInt(0) - }; + const obj = createBaseGenesisState(); + if (isSet(object.params)) obj.params = Params.fromJSON(object.params); + if (isSet(object.period)) obj.period = BigInt(object.period.toString()); + if (isSet(object.epochIdentifier)) obj.epochIdentifier = String(object.epochIdentifier); + if (isSet(object.epochsPerPeriod)) obj.epochsPerPeriod = BigInt(object.epochsPerPeriod.toString()); + if (isSet(object.skippedEpochs)) obj.skippedEpochs = BigInt(object.skippedEpochs.toString()); + return obj; }, toJSON(message: GenesisState): JsonSafe { const obj: any = {}; @@ -142,11 +128,19 @@ export const GenesisState = { }, fromPartial(object: DeepPartial): GenesisState { const message = createBaseGenesisState(); - message.params = object.params !== undefined && object.params !== null ? Params.fromPartial(object.params) : undefined; - message.period = object.period !== undefined && object.period !== null ? BigInt(object.period.toString()) : BigInt(0); + if (object.params !== undefined && object.params !== null) { + message.params = Params.fromPartial(object.params); + } + if (object.period !== undefined && object.period !== null) { + message.period = BigInt(object.period.toString()); + } message.epochIdentifier = object.epochIdentifier ?? ""; - message.epochsPerPeriod = object.epochsPerPeriod !== undefined && object.epochsPerPeriod !== null ? BigInt(object.epochsPerPeriod.toString()) : BigInt(0); - message.skippedEpochs = object.skippedEpochs !== undefined && object.skippedEpochs !== null ? BigInt(object.skippedEpochs.toString()) : BigInt(0); + if (object.epochsPerPeriod !== undefined && object.epochsPerPeriod !== null) { + message.epochsPerPeriod = BigInt(object.epochsPerPeriod.toString()); + } + if (object.skippedEpochs !== undefined && object.skippedEpochs !== null) { + message.skippedEpochs = BigInt(object.skippedEpochs.toString()); + } return message; }, fromSDK(object: GenesisStateSDKType): GenesisState { @@ -231,7 +225,7 @@ function createBaseParams(): Params { export const Params = { typeUrl: "/evmos.inflation.v1.Params", encode(message: Params, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.mintDenom !== "") { + if (message.mintDenom !== undefined) { writer.uint32(10).string(message.mintDenom); } if (message.exponentialCalculation !== undefined) { @@ -240,7 +234,7 @@ export const Params = { if (message.inflationDistribution !== undefined) { InflationDistribution.encode(message.inflationDistribution, writer.uint32(26).fork()).ldelim(); } - if (message.enableInflation === true) { + if (message.enableInflation !== undefined) { writer.uint32(32).bool(message.enableInflation); } return writer; @@ -272,12 +266,12 @@ export const Params = { return message; }, fromJSON(object: any): Params { - return { - mintDenom: isSet(object.mintDenom) ? String(object.mintDenom) : "", - exponentialCalculation: isSet(object.exponentialCalculation) ? ExponentialCalculation.fromJSON(object.exponentialCalculation) : undefined, - inflationDistribution: isSet(object.inflationDistribution) ? InflationDistribution.fromJSON(object.inflationDistribution) : undefined, - enableInflation: isSet(object.enableInflation) ? Boolean(object.enableInflation) : false - }; + const obj = createBaseParams(); + if (isSet(object.mintDenom)) obj.mintDenom = String(object.mintDenom); + if (isSet(object.exponentialCalculation)) obj.exponentialCalculation = ExponentialCalculation.fromJSON(object.exponentialCalculation); + if (isSet(object.inflationDistribution)) obj.inflationDistribution = InflationDistribution.fromJSON(object.inflationDistribution); + if (isSet(object.enableInflation)) obj.enableInflation = Boolean(object.enableInflation); + return obj; }, toJSON(message: Params): JsonSafe { const obj: any = {}; @@ -290,8 +284,12 @@ export const Params = { fromPartial(object: DeepPartial): Params { const message = createBaseParams(); message.mintDenom = object.mintDenom ?? ""; - message.exponentialCalculation = object.exponentialCalculation !== undefined && object.exponentialCalculation !== null ? ExponentialCalculation.fromPartial(object.exponentialCalculation) : undefined; - message.inflationDistribution = object.inflationDistribution !== undefined && object.inflationDistribution !== null ? InflationDistribution.fromPartial(object.inflationDistribution) : undefined; + if (object.exponentialCalculation !== undefined && object.exponentialCalculation !== null) { + message.exponentialCalculation = ExponentialCalculation.fromPartial(object.exponentialCalculation); + } + if (object.inflationDistribution !== undefined && object.inflationDistribution !== null) { + message.inflationDistribution = InflationDistribution.fromPartial(object.inflationDistribution); + } message.enableInflation = object.enableInflation ?? false; return message; }, diff --git a/__fixtures__/v-next/outputv4/evmos/inflation/v1/inflation.ts b/__fixtures__/v-next/outputv4/evmos/inflation/v1/inflation.ts index 5efa496911..3e3e763054 100644 --- a/__fixtures__/v-next/outputv4/evmos/inflation/v1/inflation.ts +++ b/__fixtures__/v-next/outputv4/evmos/inflation/v1/inflation.ts @@ -1,8 +1,7 @@ -import { BinaryReader, BinaryWriter } from "../../../binary"; +import { BinaryReader, BinaryWriter } from "../../../binary.js"; import { Decimal } from "@cosmjs/math"; -import { isSet, DeepPartial } from "../../../helpers"; -import { JsonSafe } from "../../../json-safe"; -import { ComputedRef } from "vue"; +import { isSet, DeepPartial } from "../../../helpers.js"; +import { JsonSafe } from "../../../json-safe.js"; export const protobufPackage = "evmos.inflation.v1"; /** * InflationDistribution defines the distribution in which inflation is @@ -30,11 +29,6 @@ export interface InflationDistribution { */ communityPool: string; } -export interface ReactiveInflationDistribution { - stakingRewards: ComputedRef; - usageIncentives: ComputedRef; - communityPool: ComputedRef; -} export interface InflationDistributionProtoMsg { typeUrl: "/evmos.inflation.v1.InflationDistribution"; value: Uint8Array; @@ -72,13 +66,6 @@ export interface ExponentialCalculation { /** max variance */ maxVariance: string; } -export interface ReactiveExponentialCalculation { - a: ComputedRef; - r: ComputedRef; - c: ComputedRef; - bondingTarget: ComputedRef; - maxVariance: ComputedRef; -} export interface ExponentialCalculationProtoMsg { typeUrl: "/evmos.inflation.v1.ExponentialCalculation"; value: Uint8Array; @@ -107,13 +94,13 @@ function createBaseInflationDistribution(): InflationDistribution { export const InflationDistribution = { typeUrl: "/evmos.inflation.v1.InflationDistribution", encode(message: InflationDistribution, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.stakingRewards !== "") { + if (message.stakingRewards !== undefined) { writer.uint32(10).string(Decimal.fromUserInput(message.stakingRewards, 18).atomics); } - if (message.usageIncentives !== "") { + if (message.usageIncentives !== undefined) { writer.uint32(18).string(Decimal.fromUserInput(message.usageIncentives, 18).atomics); } - if (message.communityPool !== "") { + if (message.communityPool !== undefined) { writer.uint32(26).string(Decimal.fromUserInput(message.communityPool, 18).atomics); } return writer; @@ -142,11 +129,11 @@ export const InflationDistribution = { return message; }, fromJSON(object: any): InflationDistribution { - return { - stakingRewards: isSet(object.stakingRewards) ? String(object.stakingRewards) : "", - usageIncentives: isSet(object.usageIncentives) ? String(object.usageIncentives) : "", - communityPool: isSet(object.communityPool) ? String(object.communityPool) : "" - }; + const obj = createBaseInflationDistribution(); + if (isSet(object.stakingRewards)) obj.stakingRewards = String(object.stakingRewards); + if (isSet(object.usageIncentives)) obj.usageIncentives = String(object.usageIncentives); + if (isSet(object.communityPool)) obj.communityPool = String(object.communityPool); + return obj; }, toJSON(message: InflationDistribution): JsonSafe { const obj: any = {}; @@ -231,19 +218,19 @@ function createBaseExponentialCalculation(): ExponentialCalculation { export const ExponentialCalculation = { typeUrl: "/evmos.inflation.v1.ExponentialCalculation", encode(message: ExponentialCalculation, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.a !== "") { + if (message.a !== undefined) { writer.uint32(10).string(Decimal.fromUserInput(message.a, 18).atomics); } - if (message.r !== "") { + if (message.r !== undefined) { writer.uint32(18).string(Decimal.fromUserInput(message.r, 18).atomics); } - if (message.c !== "") { + if (message.c !== undefined) { writer.uint32(26).string(Decimal.fromUserInput(message.c, 18).atomics); } - if (message.bondingTarget !== "") { + if (message.bondingTarget !== undefined) { writer.uint32(34).string(Decimal.fromUserInput(message.bondingTarget, 18).atomics); } - if (message.maxVariance !== "") { + if (message.maxVariance !== undefined) { writer.uint32(42).string(Decimal.fromUserInput(message.maxVariance, 18).atomics); } return writer; @@ -278,13 +265,13 @@ export const ExponentialCalculation = { return message; }, fromJSON(object: any): ExponentialCalculation { - return { - a: isSet(object.a) ? String(object.a) : "", - r: isSet(object.r) ? String(object.r) : "", - c: isSet(object.c) ? String(object.c) : "", - bondingTarget: isSet(object.bondingTarget) ? String(object.bondingTarget) : "", - maxVariance: isSet(object.maxVariance) ? String(object.maxVariance) : "" - }; + const obj = createBaseExponentialCalculation(); + if (isSet(object.a)) obj.a = String(object.a); + if (isSet(object.r)) obj.r = String(object.r); + if (isSet(object.c)) obj.c = String(object.c); + if (isSet(object.bondingTarget)) obj.bondingTarget = String(object.bondingTarget); + if (isSet(object.maxVariance)) obj.maxVariance = String(object.maxVariance); + return obj; }, toJSON(message: ExponentialCalculation): JsonSafe { const obj: any = {}; diff --git a/__fixtures__/v-next/outputv4/evmos/inflation/v1/query.lcd.ts b/__fixtures__/v-next/outputv4/evmos/inflation/v1/query.lcd.ts index a97ae8c1ed..c0003be8a7 100644 --- a/__fixtures__/v-next/outputv4/evmos/inflation/v1/query.lcd.ts +++ b/__fixtures__/v-next/outputv4/evmos/inflation/v1/query.lcd.ts @@ -1,7 +1,7 @@ -import { DecCoin, DecCoinSDKType } from "../../../cosmos/base/v1beta1/coin"; -import { Params, ParamsSDKType } from "./genesis"; +import { DecCoin, DecCoinSDKType } from "../../../cosmos/base/v1beta1/coin.js"; +import { Params, ParamsSDKType } from "./genesis.js"; import { LCDClient } from "@cosmology/lcd"; -import { QueryPeriodRequest, QueryPeriodRequestSDKType, QueryPeriodResponse, QueryPeriodResponseSDKType, QueryEpochMintProvisionRequest, QueryEpochMintProvisionRequestSDKType, QueryEpochMintProvisionResponse, QueryEpochMintProvisionResponseSDKType, QuerySkippedEpochsRequest, QuerySkippedEpochsRequestSDKType, QuerySkippedEpochsResponse, QuerySkippedEpochsResponseSDKType, QueryCirculatingSupplyRequest, QueryCirculatingSupplyRequestSDKType, QueryCirculatingSupplyResponse, QueryCirculatingSupplyResponseSDKType, QueryInflationRateRequest, QueryInflationRateRequestSDKType, QueryInflationRateResponse, QueryInflationRateResponseSDKType, QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType } from "./query"; +import { QueryPeriodRequest, QueryPeriodRequestSDKType, QueryPeriodResponse, QueryPeriodResponseSDKType, QueryEpochMintProvisionRequest, QueryEpochMintProvisionRequestSDKType, QueryEpochMintProvisionResponse, QueryEpochMintProvisionResponseSDKType, QuerySkippedEpochsRequest, QuerySkippedEpochsRequestSDKType, QuerySkippedEpochsResponse, QuerySkippedEpochsResponseSDKType, QueryCirculatingSupplyRequest, QueryCirculatingSupplyRequestSDKType, QueryCirculatingSupplyResponse, QueryCirculatingSupplyResponseSDKType, QueryInflationRateRequest, QueryInflationRateRequestSDKType, QueryInflationRateResponse, QueryInflationRateResponseSDKType, QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType } from "./query.js"; export class LCDQueryClient { req: LCDClient; constructor({ diff --git a/__fixtures__/v-next/outputv4/evmos/inflation/v1/query.rpc.Query.ts b/__fixtures__/v-next/outputv4/evmos/inflation/v1/query.rpc.Query.ts index 64ac1847e1..8fd4bb0327 100644 --- a/__fixtures__/v-next/outputv4/evmos/inflation/v1/query.rpc.Query.ts +++ b/__fixtures__/v-next/outputv4/evmos/inflation/v1/query.rpc.Query.ts @@ -1,9 +1,9 @@ -import { DecCoin, DecCoinSDKType } from "../../../cosmos/base/v1beta1/coin"; -import { Params, ParamsSDKType } from "./genesis"; -import { Rpc } from "../../../helpers"; -import { BinaryReader } from "../../../binary"; +import { DecCoin, DecCoinSDKType } from "../../../cosmos/base/v1beta1/coin.js"; +import { Params, ParamsSDKType } from "./genesis.js"; +import { Rpc } from "../../../helpers.js"; +import { BinaryReader } from "../../../binary.js"; import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; -import { QueryPeriodRequest, QueryPeriodRequestSDKType, QueryPeriodResponse, QueryPeriodResponseSDKType, QueryEpochMintProvisionRequest, QueryEpochMintProvisionRequestSDKType, QueryEpochMintProvisionResponse, QueryEpochMintProvisionResponseSDKType, QuerySkippedEpochsRequest, QuerySkippedEpochsRequestSDKType, QuerySkippedEpochsResponse, QuerySkippedEpochsResponseSDKType, QueryCirculatingSupplyRequest, QueryCirculatingSupplyRequestSDKType, QueryCirculatingSupplyResponse, QueryCirculatingSupplyResponseSDKType, QueryInflationRateRequest, QueryInflationRateRequestSDKType, QueryInflationRateResponse, QueryInflationRateResponseSDKType, QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType, ReactiveQueryPeriodRequest, ReactiveQueryEpochMintProvisionRequest, ReactiveQuerySkippedEpochsRequest, ReactiveQueryCirculatingSupplyRequest, ReactiveQueryInflationRateRequest, ReactiveQueryParamsRequest } from "./query"; +import { QueryPeriodRequest, QueryPeriodRequestSDKType, QueryPeriodResponse, QueryPeriodResponseSDKType, QueryEpochMintProvisionRequest, QueryEpochMintProvisionRequestSDKType, QueryEpochMintProvisionResponse, QueryEpochMintProvisionResponseSDKType, QuerySkippedEpochsRequest, QuerySkippedEpochsRequestSDKType, QuerySkippedEpochsResponse, QuerySkippedEpochsResponseSDKType, QueryCirculatingSupplyRequest, QueryCirculatingSupplyRequestSDKType, QueryCirculatingSupplyResponse, QueryCirculatingSupplyResponseSDKType, QueryInflationRateRequest, QueryInflationRateRequestSDKType, QueryInflationRateResponse, QueryInflationRateResponseSDKType, QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType } from "./query.js"; /** Query provides defines the gRPC querier service. */ export interface Query { /** Period retrieves current period. */ diff --git a/__fixtures__/v-next/outputv4/evmos/inflation/v1/query.ts b/__fixtures__/v-next/outputv4/evmos/inflation/v1/query.ts index 84f1d230dc..3baa5c0dde 100644 --- a/__fixtures__/v-next/outputv4/evmos/inflation/v1/query.ts +++ b/__fixtures__/v-next/outputv4/evmos/inflation/v1/query.ts @@ -1,14 +1,12 @@ -import { DecCoin, DecCoinSDKType } from "../../../cosmos/base/v1beta1/coin"; -import { Params, ParamsSDKType } from "./genesis"; -import { BinaryReader, BinaryWriter } from "../../../binary"; -import { JsonSafe } from "../../../json-safe"; -import { DeepPartial, isSet } from "../../../helpers"; +import { DecCoin, DecCoinSDKType } from "../../../cosmos/base/v1beta1/coin.js"; +import { Params, ParamsSDKType } from "./genesis.js"; +import { BinaryReader, BinaryWriter } from "../../../binary.js"; +import { JsonSafe } from "../../../json-safe.js"; +import { DeepPartial, isSet } from "../../../helpers.js"; import { Decimal } from "@cosmjs/math"; -import { ComputedRef } from "vue"; export const protobufPackage = "evmos.inflation.v1"; /** QueryPeriodRequest is the request type for the Query/Period RPC method. */ export interface QueryPeriodRequest {} -export interface ReactiveQueryPeriodRequest {} export interface QueryPeriodRequestProtoMsg { typeUrl: "/evmos.inflation.v1.QueryPeriodRequest"; value: Uint8Array; @@ -20,9 +18,6 @@ export interface QueryPeriodResponse { /** period is the current minting per epoch provision value. */ period: bigint; } -export interface ReactiveQueryPeriodResponse { - period: ComputedRef; -} export interface QueryPeriodResponseProtoMsg { typeUrl: "/evmos.inflation.v1.QueryPeriodResponse"; value: Uint8Array; @@ -36,7 +31,6 @@ export interface QueryPeriodResponseSDKType { * Query/EpochMintProvision RPC method. */ export interface QueryEpochMintProvisionRequest {} -export interface ReactiveQueryEpochMintProvisionRequest {} export interface QueryEpochMintProvisionRequestProtoMsg { typeUrl: "/evmos.inflation.v1.QueryEpochMintProvisionRequest"; value: Uint8Array; @@ -54,9 +48,6 @@ export interface QueryEpochMintProvisionResponse { /** epoch_mint_provision is the current minting per epoch provision value. */ epochMintProvision: DecCoin; } -export interface ReactiveQueryEpochMintProvisionResponse { - epochMintProvision: ComputedRef; -} export interface QueryEpochMintProvisionResponseProtoMsg { typeUrl: "/evmos.inflation.v1.QueryEpochMintProvisionResponse"; value: Uint8Array; @@ -73,7 +64,6 @@ export interface QueryEpochMintProvisionResponseSDKType { * method. */ export interface QuerySkippedEpochsRequest {} -export interface ReactiveQuerySkippedEpochsRequest {} export interface QuerySkippedEpochsRequestProtoMsg { typeUrl: "/evmos.inflation.v1.QuerySkippedEpochsRequest"; value: Uint8Array; @@ -91,9 +81,6 @@ export interface QuerySkippedEpochsResponse { /** number of epochs that the inflation module has been disabled. */ skippedEpochs: bigint; } -export interface ReactiveQuerySkippedEpochsResponse { - skippedEpochs: ComputedRef; -} export interface QuerySkippedEpochsResponseProtoMsg { typeUrl: "/evmos.inflation.v1.QuerySkippedEpochsResponse"; value: Uint8Array; @@ -110,7 +97,6 @@ export interface QuerySkippedEpochsResponseSDKType { * Query/CirculatingSupply RPC method. */ export interface QueryCirculatingSupplyRequest {} -export interface ReactiveQueryCirculatingSupplyRequest {} export interface QueryCirculatingSupplyRequestProtoMsg { typeUrl: "/evmos.inflation.v1.QueryCirculatingSupplyRequest"; value: Uint8Array; @@ -128,9 +114,6 @@ export interface QueryCirculatingSupplyResponse { /** total amount of coins in circulation */ circulatingSupply: DecCoin; } -export interface ReactiveQueryCirculatingSupplyResponse { - circulatingSupply: ComputedRef; -} export interface QueryCirculatingSupplyResponseProtoMsg { typeUrl: "/evmos.inflation.v1.QueryCirculatingSupplyResponse"; value: Uint8Array; @@ -147,7 +130,6 @@ export interface QueryCirculatingSupplyResponseSDKType { * method. */ export interface QueryInflationRateRequest {} -export interface ReactiveQueryInflationRateRequest {} export interface QueryInflationRateRequestProtoMsg { typeUrl: "/evmos.inflation.v1.QueryInflationRateRequest"; value: Uint8Array; @@ -165,9 +147,6 @@ export interface QueryInflationRateResponse { /** rate by which the total supply increases within one period */ inflationRate: string; } -export interface ReactiveQueryInflationRateResponse { - inflationRate: ComputedRef; -} export interface QueryInflationRateResponseProtoMsg { typeUrl: "/evmos.inflation.v1.QueryInflationRateResponse"; value: Uint8Array; @@ -181,7 +160,6 @@ export interface QueryInflationRateResponseSDKType { } /** QueryParamsRequest is the request type for the Query/Params RPC method. */ export interface QueryParamsRequest {} -export interface ReactiveQueryParamsRequest {} export interface QueryParamsRequestProtoMsg { typeUrl: "/evmos.inflation.v1.QueryParamsRequest"; value: Uint8Array; @@ -193,9 +171,6 @@ export interface QueryParamsResponse { /** params defines the parameters of the module. */ params: Params; } -export interface ReactiveQueryParamsResponse { - params: ComputedRef; -} export interface QueryParamsResponseProtoMsg { typeUrl: "/evmos.inflation.v1.QueryParamsResponse"; value: Uint8Array; @@ -227,7 +202,8 @@ export const QueryPeriodRequest = { return message; }, fromJSON(_: any): QueryPeriodRequest { - return {}; + const obj = createBaseQueryPeriodRequest(); + return obj; }, toJSON(_: QueryPeriodRequest): JsonSafe { const obj: any = {}; @@ -279,7 +255,7 @@ function createBaseQueryPeriodResponse(): QueryPeriodResponse { export const QueryPeriodResponse = { typeUrl: "/evmos.inflation.v1.QueryPeriodResponse", encode(message: QueryPeriodResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.period !== BigInt(0)) { + if (message.period !== undefined) { writer.uint32(8).uint64(message.period); } return writer; @@ -302,9 +278,9 @@ export const QueryPeriodResponse = { return message; }, fromJSON(object: any): QueryPeriodResponse { - return { - period: isSet(object.period) ? BigInt(object.period.toString()) : BigInt(0) - }; + const obj = createBaseQueryPeriodResponse(); + if (isSet(object.period)) obj.period = BigInt(object.period.toString()); + return obj; }, toJSON(message: QueryPeriodResponse): JsonSafe { const obj: any = {}; @@ -313,7 +289,9 @@ export const QueryPeriodResponse = { }, fromPartial(object: DeepPartial): QueryPeriodResponse { const message = createBaseQueryPeriodResponse(); - message.period = object.period !== undefined && object.period !== null ? BigInt(object.period.toString()) : BigInt(0); + if (object.period !== undefined && object.period !== null) { + message.period = BigInt(object.period.toString()); + } return message; }, fromSDK(object: QueryPeriodResponseSDKType): QueryPeriodResponse { @@ -382,7 +360,8 @@ export const QueryEpochMintProvisionRequest = { return message; }, fromJSON(_: any): QueryEpochMintProvisionRequest { - return {}; + const obj = createBaseQueryEpochMintProvisionRequest(); + return obj; }, toJSON(_: QueryEpochMintProvisionRequest): JsonSafe { const obj: any = {}; @@ -457,9 +436,9 @@ export const QueryEpochMintProvisionResponse = { return message; }, fromJSON(object: any): QueryEpochMintProvisionResponse { - return { - epochMintProvision: isSet(object.epochMintProvision) ? DecCoin.fromJSON(object.epochMintProvision) : undefined - }; + const obj = createBaseQueryEpochMintProvisionResponse(); + if (isSet(object.epochMintProvision)) obj.epochMintProvision = DecCoin.fromJSON(object.epochMintProvision); + return obj; }, toJSON(message: QueryEpochMintProvisionResponse): JsonSafe { const obj: any = {}; @@ -468,7 +447,9 @@ export const QueryEpochMintProvisionResponse = { }, fromPartial(object: DeepPartial): QueryEpochMintProvisionResponse { const message = createBaseQueryEpochMintProvisionResponse(); - message.epochMintProvision = object.epochMintProvision !== undefined && object.epochMintProvision !== null ? DecCoin.fromPartial(object.epochMintProvision) : undefined; + if (object.epochMintProvision !== undefined && object.epochMintProvision !== null) { + message.epochMintProvision = DecCoin.fromPartial(object.epochMintProvision); + } return message; }, fromSDK(object: QueryEpochMintProvisionResponseSDKType): QueryEpochMintProvisionResponse { @@ -537,7 +518,8 @@ export const QuerySkippedEpochsRequest = { return message; }, fromJSON(_: any): QuerySkippedEpochsRequest { - return {}; + const obj = createBaseQuerySkippedEpochsRequest(); + return obj; }, toJSON(_: QuerySkippedEpochsRequest): JsonSafe { const obj: any = {}; @@ -589,7 +571,7 @@ function createBaseQuerySkippedEpochsResponse(): QuerySkippedEpochsResponse { export const QuerySkippedEpochsResponse = { typeUrl: "/evmos.inflation.v1.QuerySkippedEpochsResponse", encode(message: QuerySkippedEpochsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.skippedEpochs !== BigInt(0)) { + if (message.skippedEpochs !== undefined) { writer.uint32(8).uint64(message.skippedEpochs); } return writer; @@ -612,9 +594,9 @@ export const QuerySkippedEpochsResponse = { return message; }, fromJSON(object: any): QuerySkippedEpochsResponse { - return { - skippedEpochs: isSet(object.skippedEpochs) ? BigInt(object.skippedEpochs.toString()) : BigInt(0) - }; + const obj = createBaseQuerySkippedEpochsResponse(); + if (isSet(object.skippedEpochs)) obj.skippedEpochs = BigInt(object.skippedEpochs.toString()); + return obj; }, toJSON(message: QuerySkippedEpochsResponse): JsonSafe { const obj: any = {}; @@ -623,7 +605,9 @@ export const QuerySkippedEpochsResponse = { }, fromPartial(object: DeepPartial): QuerySkippedEpochsResponse { const message = createBaseQuerySkippedEpochsResponse(); - message.skippedEpochs = object.skippedEpochs !== undefined && object.skippedEpochs !== null ? BigInt(object.skippedEpochs.toString()) : BigInt(0); + if (object.skippedEpochs !== undefined && object.skippedEpochs !== null) { + message.skippedEpochs = BigInt(object.skippedEpochs.toString()); + } return message; }, fromSDK(object: QuerySkippedEpochsResponseSDKType): QuerySkippedEpochsResponse { @@ -692,7 +676,8 @@ export const QueryCirculatingSupplyRequest = { return message; }, fromJSON(_: any): QueryCirculatingSupplyRequest { - return {}; + const obj = createBaseQueryCirculatingSupplyRequest(); + return obj; }, toJSON(_: QueryCirculatingSupplyRequest): JsonSafe { const obj: any = {}; @@ -767,9 +752,9 @@ export const QueryCirculatingSupplyResponse = { return message; }, fromJSON(object: any): QueryCirculatingSupplyResponse { - return { - circulatingSupply: isSet(object.circulatingSupply) ? DecCoin.fromJSON(object.circulatingSupply) : undefined - }; + const obj = createBaseQueryCirculatingSupplyResponse(); + if (isSet(object.circulatingSupply)) obj.circulatingSupply = DecCoin.fromJSON(object.circulatingSupply); + return obj; }, toJSON(message: QueryCirculatingSupplyResponse): JsonSafe { const obj: any = {}; @@ -778,7 +763,9 @@ export const QueryCirculatingSupplyResponse = { }, fromPartial(object: DeepPartial): QueryCirculatingSupplyResponse { const message = createBaseQueryCirculatingSupplyResponse(); - message.circulatingSupply = object.circulatingSupply !== undefined && object.circulatingSupply !== null ? DecCoin.fromPartial(object.circulatingSupply) : undefined; + if (object.circulatingSupply !== undefined && object.circulatingSupply !== null) { + message.circulatingSupply = DecCoin.fromPartial(object.circulatingSupply); + } return message; }, fromSDK(object: QueryCirculatingSupplyResponseSDKType): QueryCirculatingSupplyResponse { @@ -847,7 +834,8 @@ export const QueryInflationRateRequest = { return message; }, fromJSON(_: any): QueryInflationRateRequest { - return {}; + const obj = createBaseQueryInflationRateRequest(); + return obj; }, toJSON(_: QueryInflationRateRequest): JsonSafe { const obj: any = {}; @@ -899,7 +887,7 @@ function createBaseQueryInflationRateResponse(): QueryInflationRateResponse { export const QueryInflationRateResponse = { typeUrl: "/evmos.inflation.v1.QueryInflationRateResponse", encode(message: QueryInflationRateResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.inflationRate !== "") { + if (message.inflationRate !== undefined) { writer.uint32(10).string(Decimal.fromUserInput(message.inflationRate, 18).atomics); } return writer; @@ -922,9 +910,9 @@ export const QueryInflationRateResponse = { return message; }, fromJSON(object: any): QueryInflationRateResponse { - return { - inflationRate: isSet(object.inflationRate) ? String(object.inflationRate) : "" - }; + const obj = createBaseQueryInflationRateResponse(); + if (isSet(object.inflationRate)) obj.inflationRate = String(object.inflationRate); + return obj; }, toJSON(message: QueryInflationRateResponse): JsonSafe { const obj: any = {}; @@ -1002,7 +990,8 @@ export const QueryParamsRequest = { return message; }, fromJSON(_: any): QueryParamsRequest { - return {}; + const obj = createBaseQueryParamsRequest(); + return obj; }, toJSON(_: QueryParamsRequest): JsonSafe { const obj: any = {}; @@ -1077,9 +1066,9 @@ export const QueryParamsResponse = { return message; }, fromJSON(object: any): QueryParamsResponse { - return { - params: isSet(object.params) ? Params.fromJSON(object.params) : undefined - }; + const obj = createBaseQueryParamsResponse(); + if (isSet(object.params)) obj.params = Params.fromJSON(object.params); + return obj; }, toJSON(message: QueryParamsResponse): JsonSafe { const obj: any = {}; @@ -1088,7 +1077,9 @@ export const QueryParamsResponse = { }, fromPartial(object: DeepPartial): QueryParamsResponse { const message = createBaseQueryParamsResponse(); - message.params = object.params !== undefined && object.params !== null ? Params.fromPartial(object.params) : undefined; + if (object.params !== undefined && object.params !== null) { + message.params = Params.fromPartial(object.params); + } return message; }, fromSDK(object: QueryParamsResponseSDKType): QueryParamsResponse { diff --git a/__fixtures__/v-next/outputv4/evmos/lcd.ts b/__fixtures__/v-next/outputv4/evmos/lcd.ts index 3ff6bf7276..5656a9fe3f 100644 --- a/__fixtures__/v-next/outputv4/evmos/lcd.ts +++ b/__fixtures__/v-next/outputv4/evmos/lcd.ts @@ -37,11 +37,6 @@ export const createLCDClient = async ({ v1beta1: new (await import("../cosmos/base/tendermint/v1beta1/query.lcd")).LCDQueryClient({ requestClient }) - }, - node: { - v1beta1: new (await import("../cosmos/base/node/v1beta1/query.lcd")).LCDQueryClient({ - requestClient - }) } }, distribution: { diff --git a/__fixtures__/v-next/outputv4/evmos/recovery/v1/genesis.ts b/__fixtures__/v-next/outputv4/evmos/recovery/v1/genesis.ts index 8cf198f032..846a95ccb1 100644 --- a/__fixtures__/v-next/outputv4/evmos/recovery/v1/genesis.ts +++ b/__fixtures__/v-next/outputv4/evmos/recovery/v1/genesis.ts @@ -1,17 +1,13 @@ -import { Duration, DurationSDKType } from "../../../google/protobuf/duration"; -import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; -import { JsonSafe } from "../../../json-safe"; -import { ComputedRef } from "vue"; +import { Duration, DurationSDKType } from "../../../google/protobuf/duration.js"; +import { BinaryReader, BinaryWriter } from "../../../binary.js"; +import { isSet, DeepPartial } from "../../../helpers.js"; +import { JsonSafe } from "../../../json-safe.js"; export const protobufPackage = "evmos.recovery.v1"; /** GenesisState defines the recovery module's genesis state. */ export interface GenesisState { /** params defines all the paramaters of the module. */ params: Params; } -export interface ReactiveGenesisState { - params: ComputedRef; -} export interface GenesisStateProtoMsg { typeUrl: "/evmos.recovery.v1.GenesisState"; value: Uint8Array; @@ -27,10 +23,6 @@ export interface Params { /** duration added to timeout timestamp for balances recovered via IBC packets */ packetTimeoutDuration: Duration; } -export interface ReactiveParams { - enableRecovery: ComputedRef; - packetTimeoutDuration: ComputedRef; -} export interface ParamsProtoMsg { typeUrl: "/evmos.recovery.v1.Params"; value: Uint8Array; @@ -71,9 +63,9 @@ export const GenesisState = { return message; }, fromJSON(object: any): GenesisState { - return { - params: isSet(object.params) ? Params.fromJSON(object.params) : undefined - }; + const obj = createBaseGenesisState(); + if (isSet(object.params)) obj.params = Params.fromJSON(object.params); + return obj; }, toJSON(message: GenesisState): JsonSafe { const obj: any = {}; @@ -82,7 +74,9 @@ export const GenesisState = { }, fromPartial(object: DeepPartial): GenesisState { const message = createBaseGenesisState(); - message.params = object.params !== undefined && object.params !== null ? Params.fromPartial(object.params) : undefined; + if (object.params !== undefined && object.params !== null) { + message.params = Params.fromPartial(object.params); + } return message; }, fromSDK(object: GenesisStateSDKType): GenesisState { @@ -137,7 +131,7 @@ function createBaseParams(): Params { export const Params = { typeUrl: "/evmos.recovery.v1.Params", encode(message: Params, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.enableRecovery === true) { + if (message.enableRecovery !== undefined) { writer.uint32(8).bool(message.enableRecovery); } if (message.packetTimeoutDuration !== undefined) { @@ -166,10 +160,10 @@ export const Params = { return message; }, fromJSON(object: any): Params { - return { - enableRecovery: isSet(object.enableRecovery) ? Boolean(object.enableRecovery) : false, - packetTimeoutDuration: isSet(object.packetTimeoutDuration) ? Duration.fromJSON(object.packetTimeoutDuration) : undefined - }; + const obj = createBaseParams(); + if (isSet(object.enableRecovery)) obj.enableRecovery = Boolean(object.enableRecovery); + if (isSet(object.packetTimeoutDuration)) obj.packetTimeoutDuration = Duration.fromJSON(object.packetTimeoutDuration); + return obj; }, toJSON(message: Params): JsonSafe { const obj: any = {}; @@ -180,7 +174,9 @@ export const Params = { fromPartial(object: DeepPartial): Params { const message = createBaseParams(); message.enableRecovery = object.enableRecovery ?? false; - message.packetTimeoutDuration = object.packetTimeoutDuration !== undefined && object.packetTimeoutDuration !== null ? Duration.fromPartial(object.packetTimeoutDuration) : undefined; + if (object.packetTimeoutDuration !== undefined && object.packetTimeoutDuration !== null) { + message.packetTimeoutDuration = Duration.fromPartial(object.packetTimeoutDuration); + } return message; }, fromSDK(object: ParamsSDKType): Params { diff --git a/__fixtures__/v-next/outputv4/evmos/recovery/v1/query.lcd.ts b/__fixtures__/v-next/outputv4/evmos/recovery/v1/query.lcd.ts index 6a74ba7a67..a0ca2d6f6a 100644 --- a/__fixtures__/v-next/outputv4/evmos/recovery/v1/query.lcd.ts +++ b/__fixtures__/v-next/outputv4/evmos/recovery/v1/query.lcd.ts @@ -1,6 +1,6 @@ -import { Params, ParamsSDKType } from "./genesis"; +import { Params, ParamsSDKType } from "./genesis.js"; import { LCDClient } from "@cosmology/lcd"; -import { QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType } from "./query"; +import { QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType } from "./query.js"; export class LCDQueryClient { req: LCDClient; constructor({ diff --git a/__fixtures__/v-next/outputv4/evmos/recovery/v1/query.rpc.Query.ts b/__fixtures__/v-next/outputv4/evmos/recovery/v1/query.rpc.Query.ts index a434c5c51c..c04b6e4e94 100644 --- a/__fixtures__/v-next/outputv4/evmos/recovery/v1/query.rpc.Query.ts +++ b/__fixtures__/v-next/outputv4/evmos/recovery/v1/query.rpc.Query.ts @@ -1,8 +1,8 @@ -import { Params, ParamsSDKType } from "./genesis"; -import { Rpc } from "../../../helpers"; -import { BinaryReader } from "../../../binary"; +import { Params, ParamsSDKType } from "./genesis.js"; +import { Rpc } from "../../../helpers.js"; +import { BinaryReader } from "../../../binary.js"; import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; -import { QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType, ReactiveQueryParamsRequest } from "./query"; +import { QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType } from "./query.js"; /** Query defines the gRPC querier service. */ export interface Query { /** Params retrieves the total set of recovery parameters. */ diff --git a/__fixtures__/v-next/outputv4/evmos/recovery/v1/query.ts b/__fixtures__/v-next/outputv4/evmos/recovery/v1/query.ts index 9e4c8fc4be..42c4a10bd4 100644 --- a/__fixtures__/v-next/outputv4/evmos/recovery/v1/query.ts +++ b/__fixtures__/v-next/outputv4/evmos/recovery/v1/query.ts @@ -1,12 +1,10 @@ -import { Params, ParamsSDKType } from "./genesis"; -import { BinaryReader, BinaryWriter } from "../../../binary"; -import { JsonSafe } from "../../../json-safe"; -import { DeepPartial, isSet } from "../../../helpers"; -import { ComputedRef } from "vue"; +import { Params, ParamsSDKType } from "./genesis.js"; +import { BinaryReader, BinaryWriter } from "../../../binary.js"; +import { JsonSafe } from "../../../json-safe.js"; +import { DeepPartial, isSet } from "../../../helpers.js"; export const protobufPackage = "evmos.recovery.v1"; /** QueryParamsRequest is the request type for the Query/Params RPC method. */ export interface QueryParamsRequest {} -export interface ReactiveQueryParamsRequest {} export interface QueryParamsRequestProtoMsg { typeUrl: "/evmos.recovery.v1.QueryParamsRequest"; value: Uint8Array; @@ -18,9 +16,6 @@ export interface QueryParamsResponse { /** params defines the parameters of the module. */ params: Params; } -export interface ReactiveQueryParamsResponse { - params: ComputedRef; -} export interface QueryParamsResponseProtoMsg { typeUrl: "/evmos.recovery.v1.QueryParamsResponse"; value: Uint8Array; @@ -52,7 +47,8 @@ export const QueryParamsRequest = { return message; }, fromJSON(_: any): QueryParamsRequest { - return {}; + const obj = createBaseQueryParamsRequest(); + return obj; }, toJSON(_: QueryParamsRequest): JsonSafe { const obj: any = {}; @@ -127,9 +123,9 @@ export const QueryParamsResponse = { return message; }, fromJSON(object: any): QueryParamsResponse { - return { - params: isSet(object.params) ? Params.fromJSON(object.params) : undefined - }; + const obj = createBaseQueryParamsResponse(); + if (isSet(object.params)) obj.params = Params.fromJSON(object.params); + return obj; }, toJSON(message: QueryParamsResponse): JsonSafe { const obj: any = {}; @@ -138,7 +134,9 @@ export const QueryParamsResponse = { }, fromPartial(object: DeepPartial): QueryParamsResponse { const message = createBaseQueryParamsResponse(); - message.params = object.params !== undefined && object.params !== null ? Params.fromPartial(object.params) : undefined; + if (object.params !== undefined && object.params !== null) { + message.params = Params.fromPartial(object.params); + } return message; }, fromSDK(object: QueryParamsResponseSDKType): QueryParamsResponse { diff --git a/__fixtures__/v-next/outputv4/evmos/rpc.query.ts b/__fixtures__/v-next/outputv4/evmos/rpc.query.ts index 7bd88a0622..9169126902 100644 --- a/__fixtures__/v-next/outputv4/evmos/rpc.query.ts +++ b/__fixtures__/v-next/outputv4/evmos/rpc.query.ts @@ -1,101 +1,98 @@ -import { Rpc } from "../helpers"; -import { Tendermint34Client, HttpEndpoint } from "@cosmjs/tendermint-rpc"; +import { Rpc } from "../helpers.js"; +import { connectComet, HttpEndpoint } from "@cosmjs/tendermint-rpc"; import { QueryClient } from "@cosmjs/stargate"; export const createRPCQueryClient = async ({ rpcEndpoint }: { rpcEndpoint: string | HttpEndpoint; }) => { - const tmClient = await Tendermint34Client.connect(rpcEndpoint); + const tmClient = await connectComet(rpcEndpoint); const client = new QueryClient(tmClient); return { cosmos: { app: { - v1alpha1: (await import("../cosmos/app/v1alpha1/query.rpc.Query")).createRpcQueryExtension(client) + v1alpha1: (await import("../cosmos/app/v1alpha1/query.rpc.Query.js")).createRpcQueryExtension(client) }, auth: { - v1beta1: (await import("../cosmos/auth/v1beta1/query.rpc.Query")).createRpcQueryExtension(client) + v1beta1: (await import("../cosmos/auth/v1beta1/query.rpc.Query.js")).createRpcQueryExtension(client) }, authz: { - v1beta1: (await import("../cosmos/authz/v1beta1/query.rpc.Query")).createRpcQueryExtension(client) + v1beta1: (await import("../cosmos/authz/v1beta1/query.rpc.Query.js")).createRpcQueryExtension(client) }, bank: { - v1beta1: (await import("../cosmos/bank/v1beta1/query.rpc.Query")).createRpcQueryExtension(client) + v1beta1: (await import("../cosmos/bank/v1beta1/query.rpc.Query.js")).createRpcQueryExtension(client) }, base: { reflection: { - v1beta1: (await import("../cosmos/base/reflection/v1beta1/reflection.rpc.ReflectionService")).createRpcQueryExtension(client), - v2alpha1: (await import("../cosmos/base/reflection/v2alpha1/reflection.rpc.ReflectionService")).createRpcQueryExtension(client) + v1beta1: (await import("../cosmos/base/reflection/v1beta1/reflection.rpc.ReflectionService.js")).createRpcQueryExtension(client), + v2alpha1: (await import("../cosmos/base/reflection/v2alpha1/reflection.rpc.ReflectionService.js")).createRpcQueryExtension(client) }, tendermint: { - v1beta1: (await import("../cosmos/base/tendermint/v1beta1/query.rpc.Service")).createRpcQueryExtension(client) - }, - node: { - v1beta1: (await import("../cosmos/base/node/v1beta1/query.rpc.Service")).createRpcQueryExtension(client) + v1beta1: (await import("../cosmos/base/tendermint/v1beta1/query.rpc.Service.js")).createRpcQueryExtension(client) } }, distribution: { - v1beta1: (await import("../cosmos/distribution/v1beta1/query.rpc.Query")).createRpcQueryExtension(client) + v1beta1: (await import("../cosmos/distribution/v1beta1/query.rpc.Query.js")).createRpcQueryExtension(client) }, evidence: { - v1beta1: (await import("../cosmos/evidence/v1beta1/query.rpc.Query")).createRpcQueryExtension(client) + v1beta1: (await import("../cosmos/evidence/v1beta1/query.rpc.Query.js")).createRpcQueryExtension(client) }, feegrant: { - v1beta1: (await import("../cosmos/feegrant/v1beta1/query.rpc.Query")).createRpcQueryExtension(client) + v1beta1: (await import("../cosmos/feegrant/v1beta1/query.rpc.Query.js")).createRpcQueryExtension(client) }, gov: { - v1: (await import("../cosmos/gov/v1/query.rpc.Query")).createRpcQueryExtension(client), - v1beta1: (await import("../cosmos/gov/v1beta1/query.rpc.Query")).createRpcQueryExtension(client) + v1: (await import("../cosmos/gov/v1/query.rpc.Query.js")).createRpcQueryExtension(client), + v1beta1: (await import("../cosmos/gov/v1beta1/query.rpc.Query.js")).createRpcQueryExtension(client) }, group: { - v1: (await import("../cosmos/group/v1/query.rpc.Query")).createRpcQueryExtension(client) + v1: (await import("../cosmos/group/v1/query.rpc.Query.js")).createRpcQueryExtension(client) }, mint: { - v1beta1: (await import("../cosmos/mint/v1beta1/query.rpc.Query")).createRpcQueryExtension(client) + v1beta1: (await import("../cosmos/mint/v1beta1/query.rpc.Query.js")).createRpcQueryExtension(client) }, nft: { - v1beta1: (await import("../cosmos/nft/v1beta1/query.rpc.Query")).createRpcQueryExtension(client) + v1beta1: (await import("../cosmos/nft/v1beta1/query.rpc.Query.js")).createRpcQueryExtension(client) }, params: { - v1beta1: (await import("../cosmos/params/v1beta1/query.rpc.Query")).createRpcQueryExtension(client) + v1beta1: (await import("../cosmos/params/v1beta1/query.rpc.Query.js")).createRpcQueryExtension(client) }, slashing: { - v1beta1: (await import("../cosmos/slashing/v1beta1/query.rpc.Query")).createRpcQueryExtension(client) + v1beta1: (await import("../cosmos/slashing/v1beta1/query.rpc.Query.js")).createRpcQueryExtension(client) }, staking: { - v1beta1: (await import("../cosmos/staking/v1beta1/query.rpc.Query")).createRpcQueryExtension(client) + v1beta1: (await import("../cosmos/staking/v1beta1/query.rpc.Query.js")).createRpcQueryExtension(client) }, tx: { - v1beta1: (await import("../cosmos/tx/v1beta1/service.rpc.Service")).createRpcQueryExtension(client) + v1beta1: (await import("../cosmos/tx/v1beta1/service.rpc.Service.js")).createRpcQueryExtension(client) }, upgrade: { - v1beta1: (await import("../cosmos/upgrade/v1beta1/query.rpc.Query")).createRpcQueryExtension(client) + v1beta1: (await import("../cosmos/upgrade/v1beta1/query.rpc.Query.js")).createRpcQueryExtension(client) } }, evmos: { claims: { - v1: (await import("./claims/v1/query.rpc.Query")).createRpcQueryExtension(client) + v1: (await import("./claims/v1/query.rpc.Query.js")).createRpcQueryExtension(client) }, epochs: { - v1: (await import("./epochs/v1/query.rpc.Query")).createRpcQueryExtension(client) + v1: (await import("./epochs/v1/query.rpc.Query.js")).createRpcQueryExtension(client) }, erc20: { - v1: (await import("./erc20/v1/query.rpc.Query")).createRpcQueryExtension(client) + v1: (await import("./erc20/v1/query.rpc.Query.js")).createRpcQueryExtension(client) }, fees: { - v1: (await import("./fees/v1/query.rpc.Query")).createRpcQueryExtension(client) + v1: (await import("./fees/v1/query.rpc.Query.js")).createRpcQueryExtension(client) }, incentives: { - v1: (await import("./incentives/v1/query.rpc.Query")).createRpcQueryExtension(client) + v1: (await import("./incentives/v1/query.rpc.Query.js")).createRpcQueryExtension(client) }, inflation: { - v1: (await import("./inflation/v1/query.rpc.Query")).createRpcQueryExtension(client) + v1: (await import("./inflation/v1/query.rpc.Query.js")).createRpcQueryExtension(client) }, recovery: { - v1: (await import("./recovery/v1/query.rpc.Query")).createRpcQueryExtension(client) + v1: (await import("./recovery/v1/query.rpc.Query.js")).createRpcQueryExtension(client) }, vesting: { - v1: (await import("./vesting/v1/query.rpc.Query")).createRpcQueryExtension(client) + v1: (await import("./vesting/v1/query.rpc.Query.js")).createRpcQueryExtension(client) } } }; diff --git a/__fixtures__/v-next/outputv4/evmos/rpc.tx.ts b/__fixtures__/v-next/outputv4/evmos/rpc.tx.ts index 3d21b2d10d..d5df45eb42 100644 --- a/__fixtures__/v-next/outputv4/evmos/rpc.tx.ts +++ b/__fixtures__/v-next/outputv4/evmos/rpc.tx.ts @@ -1,4 +1,4 @@ -import { Rpc } from "../helpers"; +import { Rpc } from "../helpers.js"; export const createRPCMsgClient = async ({ rpc }: { @@ -6,55 +6,55 @@ export const createRPCMsgClient = async ({ }) => ({ cosmos: { authz: { - v1beta1: new (await import("../cosmos/authz/v1beta1/tx.rpc.msg")).MsgClientImpl(rpc) + v1beta1: new (await import("../cosmos/authz/v1beta1/tx.rpc.msg.js")).MsgClientImpl(rpc) }, bank: { - v1beta1: new (await import("../cosmos/bank/v1beta1/tx.rpc.msg")).MsgClientImpl(rpc) + v1beta1: new (await import("../cosmos/bank/v1beta1/tx.rpc.msg.js")).MsgClientImpl(rpc) }, crisis: { - v1beta1: new (await import("../cosmos/crisis/v1beta1/tx.rpc.msg")).MsgClientImpl(rpc) + v1beta1: new (await import("../cosmos/crisis/v1beta1/tx.rpc.msg.js")).MsgClientImpl(rpc) }, distribution: { - v1beta1: new (await import("../cosmos/distribution/v1beta1/tx.rpc.msg")).MsgClientImpl(rpc) + v1beta1: new (await import("../cosmos/distribution/v1beta1/tx.rpc.msg.js")).MsgClientImpl(rpc) }, evidence: { - v1beta1: new (await import("../cosmos/evidence/v1beta1/tx.rpc.msg")).MsgClientImpl(rpc) + v1beta1: new (await import("../cosmos/evidence/v1beta1/tx.rpc.msg.js")).MsgClientImpl(rpc) }, feegrant: { - v1beta1: new (await import("../cosmos/feegrant/v1beta1/tx.rpc.msg")).MsgClientImpl(rpc) + v1beta1: new (await import("../cosmos/feegrant/v1beta1/tx.rpc.msg.js")).MsgClientImpl(rpc) }, gov: { - v1: new (await import("../cosmos/gov/v1/tx.rpc.msg")).MsgClientImpl(rpc), - v1beta1: new (await import("../cosmos/gov/v1beta1/tx.rpc.msg")).MsgClientImpl(rpc) + v1: new (await import("../cosmos/gov/v1/tx.rpc.msg.js")).MsgClientImpl(rpc), + v1beta1: new (await import("../cosmos/gov/v1beta1/tx.rpc.msg.js")).MsgClientImpl(rpc) }, group: { - v1: new (await import("../cosmos/group/v1/tx.rpc.msg")).MsgClientImpl(rpc) + v1: new (await import("../cosmos/group/v1/tx.rpc.msg.js")).MsgClientImpl(rpc) }, nft: { - v1beta1: new (await import("../cosmos/nft/v1beta1/tx.rpc.msg")).MsgClientImpl(rpc) + v1beta1: new (await import("../cosmos/nft/v1beta1/tx.rpc.msg.js")).MsgClientImpl(rpc) }, slashing: { - v1beta1: new (await import("../cosmos/slashing/v1beta1/tx.rpc.msg")).MsgClientImpl(rpc) + v1beta1: new (await import("../cosmos/slashing/v1beta1/tx.rpc.msg.js")).MsgClientImpl(rpc) }, staking: { - v1beta1: new (await import("../cosmos/staking/v1beta1/tx.rpc.msg")).MsgClientImpl(rpc) + v1beta1: new (await import("../cosmos/staking/v1beta1/tx.rpc.msg.js")).MsgClientImpl(rpc) }, upgrade: { - v1beta1: new (await import("../cosmos/upgrade/v1beta1/tx.rpc.msg")).MsgClientImpl(rpc) + v1beta1: new (await import("../cosmos/upgrade/v1beta1/tx.rpc.msg.js")).MsgClientImpl(rpc) }, vesting: { - v1beta1: new (await import("../cosmos/vesting/v1beta1/tx.rpc.msg")).MsgClientImpl(rpc) + v1beta1: new (await import("../cosmos/vesting/v1beta1/tx.rpc.msg.js")).MsgClientImpl(rpc) } }, evmos: { erc20: { - v1: new (await import("./erc20/v1/tx.rpc.msg")).MsgClientImpl(rpc) + v1: new (await import("./erc20/v1/tx.rpc.msg.js")).MsgClientImpl(rpc) }, fees: { - v1: new (await import("./fees/v1/tx.rpc.msg")).MsgClientImpl(rpc) + v1: new (await import("./fees/v1/tx.rpc.msg.js")).MsgClientImpl(rpc) }, vesting: { - v1: new (await import("./vesting/v1/tx.rpc.msg")).MsgClientImpl(rpc) + v1: new (await import("./vesting/v1/tx.rpc.msg.js")).MsgClientImpl(rpc) } } }); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv4/evmos/vesting/v1/query.lcd.ts b/__fixtures__/v-next/outputv4/evmos/vesting/v1/query.lcd.ts index 65fcd82713..74d8aa2f62 100644 --- a/__fixtures__/v-next/outputv4/evmos/vesting/v1/query.lcd.ts +++ b/__fixtures__/v-next/outputv4/evmos/vesting/v1/query.lcd.ts @@ -1,6 +1,6 @@ -import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; +import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin.js"; import { LCDClient } from "@cosmology/lcd"; -import { QueryBalancesRequest, QueryBalancesRequestSDKType, QueryBalancesResponse, QueryBalancesResponseSDKType } from "./query"; +import { QueryBalancesRequest, QueryBalancesRequestSDKType, QueryBalancesResponse, QueryBalancesResponseSDKType } from "./query.js"; export class LCDQueryClient { req: LCDClient; constructor({ diff --git a/__fixtures__/v-next/outputv4/evmos/vesting/v1/query.rpc.Query.ts b/__fixtures__/v-next/outputv4/evmos/vesting/v1/query.rpc.Query.ts index 47bf474fcd..f74296c6ac 100644 --- a/__fixtures__/v-next/outputv4/evmos/vesting/v1/query.rpc.Query.ts +++ b/__fixtures__/v-next/outputv4/evmos/vesting/v1/query.rpc.Query.ts @@ -1,8 +1,8 @@ -import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; -import { Rpc } from "../../../helpers"; -import { BinaryReader } from "../../../binary"; +import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin.js"; +import { Rpc } from "../../../helpers.js"; +import { BinaryReader } from "../../../binary.js"; import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; -import { QueryBalancesRequest, QueryBalancesRequestSDKType, QueryBalancesResponse, QueryBalancesResponseSDKType, ReactiveQueryBalancesRequest } from "./query"; +import { QueryBalancesRequest, QueryBalancesRequestSDKType, QueryBalancesResponse, QueryBalancesResponseSDKType } from "./query.js"; /** Query defines the gRPC querier service. */ export interface Query { /** Retrieves the unvested, vested and locked tokens for a vesting account */ diff --git a/__fixtures__/v-next/outputv4/evmos/vesting/v1/query.ts b/__fixtures__/v-next/outputv4/evmos/vesting/v1/query.ts index 3a0f4fc141..9327e5db67 100644 --- a/__fixtures__/v-next/outputv4/evmos/vesting/v1/query.ts +++ b/__fixtures__/v-next/outputv4/evmos/vesting/v1/query.ts @@ -1,17 +1,13 @@ -import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; -import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; -import { JsonSafe } from "../../../json-safe"; -import { ComputedRef } from "vue"; +import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin.js"; +import { BinaryReader, BinaryWriter } from "../../../binary.js"; +import { isSet, DeepPartial } from "../../../helpers.js"; +import { JsonSafe } from "../../../json-safe.js"; export const protobufPackage = "evmos.vesting.v1"; /** QueryBalancesRequest is the request type for the Query/Balances RPC method. */ export interface QueryBalancesRequest { /** address of the clawback vesting account */ address: string; } -export interface ReactiveQueryBalancesRequest { - address: ComputedRef; -} export interface QueryBalancesRequestProtoMsg { typeUrl: "/evmos.vesting.v1.QueryBalancesRequest"; value: Uint8Array; @@ -32,11 +28,6 @@ export interface QueryBalancesResponse { /** current amount of vested tokens */ vested: Coin[]; } -export interface ReactiveQueryBalancesResponse { - locked: ComputedRef; - unvested: ComputedRef; - vested: ComputedRef; -} export interface QueryBalancesResponseProtoMsg { typeUrl: "/evmos.vesting.v1.QueryBalancesResponse"; value: Uint8Array; @@ -58,7 +49,7 @@ function createBaseQueryBalancesRequest(): QueryBalancesRequest { export const QueryBalancesRequest = { typeUrl: "/evmos.vesting.v1.QueryBalancesRequest", encode(message: QueryBalancesRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.address !== "") { + if (message.address !== undefined) { writer.uint32(10).string(message.address); } return writer; @@ -81,9 +72,9 @@ export const QueryBalancesRequest = { return message; }, fromJSON(object: any): QueryBalancesRequest { - return { - address: isSet(object.address) ? String(object.address) : "" - }; + const obj = createBaseQueryBalancesRequest(); + if (isSet(object.address)) obj.address = String(object.address); + return obj; }, toJSON(message: QueryBalancesRequest): JsonSafe { const obj: any = {}; @@ -183,11 +174,11 @@ export const QueryBalancesResponse = { return message; }, fromJSON(object: any): QueryBalancesResponse { - return { - locked: Array.isArray(object?.locked) ? object.locked.map((e: any) => Coin.fromJSON(e)) : [], - unvested: Array.isArray(object?.unvested) ? object.unvested.map((e: any) => Coin.fromJSON(e)) : [], - vested: Array.isArray(object?.vested) ? object.vested.map((e: any) => Coin.fromJSON(e)) : [] - }; + const obj = createBaseQueryBalancesResponse(); + if (Array.isArray(object?.locked)) obj.locked = object.locked.map((e: any) => Coin.fromJSON(e)); + if (Array.isArray(object?.unvested)) obj.unvested = object.unvested.map((e: any) => Coin.fromJSON(e)); + if (Array.isArray(object?.vested)) obj.vested = object.vested.map((e: any) => Coin.fromJSON(e)); + return obj; }, toJSON(message: QueryBalancesResponse): JsonSafe { const obj: any = {}; 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 ef55f48dca..c54d1c6a11 100644 --- a/__fixtures__/v-next/outputv4/evmos/vesting/v1/tx.amino.ts +++ b/__fixtures__/v-next/outputv4/evmos/vesting/v1/tx.amino.ts @@ -1,8 +1,8 @@ -import { Timestamp, TimestampSDKType } from "../../../google/protobuf/timestamp"; -import { Period, PeriodSDKType } from "../../../cosmos/vesting/v1beta1/vesting"; +import { Timestamp, TimestampSDKType } from "../../../google/protobuf/timestamp.js"; +import { Period, PeriodSDKType } from "../../../cosmos/vesting/v1beta1/vesting.js"; import { AminoMsg } from "@cosmjs/amino"; -import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; -import { MsgCreateClawbackVestingAccount, MsgCreateClawbackVestingAccountSDKType, MsgClawback, MsgClawbackSDKType } from "./tx"; +import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin.js"; +import { MsgCreateClawbackVestingAccount, MsgCreateClawbackVestingAccountSDKType, MsgClawback, MsgClawbackSDKType } from "./tx.js"; export interface MsgCreateClawbackVestingAccountAminoType extends AminoMsg { type: "/evmos.vesting.v1.MsgCreateClawbackVestingAccount"; value: { diff --git a/__fixtures__/v-next/outputv4/evmos/vesting/v1/tx.registry.ts b/__fixtures__/v-next/outputv4/evmos/vesting/v1/tx.registry.ts index 2336f7dc27..cc6a7ed7e2 100644 --- a/__fixtures__/v-next/outputv4/evmos/vesting/v1/tx.registry.ts +++ b/__fixtures__/v-next/outputv4/evmos/vesting/v1/tx.registry.ts @@ -1,7 +1,7 @@ -import { Timestamp, TimestampSDKType } from "../../../google/protobuf/timestamp"; -import { Period, PeriodSDKType } from "../../../cosmos/vesting/v1beta1/vesting"; +import { Timestamp, TimestampSDKType } from "../../../google/protobuf/timestamp.js"; +import { Period, PeriodSDKType } from "../../../cosmos/vesting/v1beta1/vesting.js"; import { GeneratedType, Registry } from "@cosmjs/proto-signing"; -import { MsgCreateClawbackVestingAccount, MsgCreateClawbackVestingAccountSDKType, MsgClawback, MsgClawbackSDKType } from "./tx"; +import { MsgCreateClawbackVestingAccount, MsgCreateClawbackVestingAccountSDKType, MsgClawback, MsgClawbackSDKType } from "./tx.js"; export const registry: ReadonlyArray<[string, GeneratedType]> = [["/evmos.vesting.v1.MsgCreateClawbackVestingAccount", MsgCreateClawbackVestingAccount], ["/evmos.vesting.v1.MsgClawback", MsgClawback]]; export const load = (protoRegistry: Registry) => { registry.forEach(([typeUrl, mod]) => { diff --git a/__fixtures__/v-next/outputv4/evmos/vesting/v1/tx.rpc.msg.ts b/__fixtures__/v-next/outputv4/evmos/vesting/v1/tx.rpc.msg.ts index a49badd9d1..23323e5074 100644 --- a/__fixtures__/v-next/outputv4/evmos/vesting/v1/tx.rpc.msg.ts +++ b/__fixtures__/v-next/outputv4/evmos/vesting/v1/tx.rpc.msg.ts @@ -1,8 +1,8 @@ -import { Timestamp, TimestampSDKType } from "../../../google/protobuf/timestamp"; -import { Period, PeriodSDKType } from "../../../cosmos/vesting/v1beta1/vesting"; -import { Rpc } from "../../../helpers"; -import { BinaryReader } from "../../../binary"; -import { MsgCreateClawbackVestingAccount, MsgCreateClawbackVestingAccountSDKType, MsgCreateClawbackVestingAccountResponse, MsgCreateClawbackVestingAccountResponseSDKType, MsgClawback, MsgClawbackSDKType, MsgClawbackResponse, MsgClawbackResponseSDKType } from "./tx"; +import { Timestamp, TimestampSDKType } from "../../../google/protobuf/timestamp.js"; +import { Period, PeriodSDKType } from "../../../cosmos/vesting/v1beta1/vesting.js"; +import { Rpc } from "../../../helpers.js"; +import { BinaryReader } from "../../../binary.js"; +import { MsgCreateClawbackVestingAccount, MsgCreateClawbackVestingAccountSDKType, MsgCreateClawbackVestingAccountResponse, MsgCreateClawbackVestingAccountResponseSDKType, MsgClawback, MsgClawbackSDKType, MsgClawbackResponse, MsgClawbackResponseSDKType } from "./tx.js"; /** Msg defines the vesting Msg service. */ export interface Msg { /** diff --git a/__fixtures__/v-next/outputv4/evmos/vesting/v1/tx.ts b/__fixtures__/v-next/outputv4/evmos/vesting/v1/tx.ts index 54bdc10559..91e7084dbd 100644 --- a/__fixtures__/v-next/outputv4/evmos/vesting/v1/tx.ts +++ b/__fixtures__/v-next/outputv4/evmos/vesting/v1/tx.ts @@ -1,9 +1,8 @@ -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 { JsonSafe } from "../../../json-safe"; -import { ComputedRef } from "vue"; +import { Timestamp, TimestampSDKType } from "../../../google/protobuf/timestamp.js"; +import { Period, PeriodSDKType } from "../../../cosmos/vesting/v1beta1/vesting.js"; +import { BinaryReader, BinaryWriter } from "../../../binary.js"; +import { toTimestamp, fromTimestamp, isSet, DeepPartial } from "../../../helpers.js"; +import { JsonSafe } from "../../../json-safe.js"; export const protobufPackage = "evmos.vesting.v1"; /** MsgCreateClawbackVestingAccount defines a message that enables creating a ClawbackVestingAccount. */ export interface MsgCreateClawbackVestingAccount { @@ -29,14 +28,6 @@ export interface MsgCreateClawbackVestingAccount { */ merge: boolean; } -export interface ReactiveMsgCreateClawbackVestingAccount { - fromAddress: ComputedRef; - toAddress: ComputedRef; - startTime: ComputedRef; - lockupPeriods: ComputedRef; - vestingPeriods: ComputedRef; - merge: ComputedRef; -} export interface MsgCreateClawbackVestingAccountProtoMsg { typeUrl: "/evmos.vesting.v1.MsgCreateClawbackVestingAccount"; value: Uint8Array; @@ -55,7 +46,6 @@ export interface MsgCreateClawbackVestingAccountSDKType { * MsgCreateClawbackVestingAccount response type. */ export interface MsgCreateClawbackVestingAccountResponse {} -export interface ReactiveMsgCreateClawbackVestingAccountResponse {} export interface MsgCreateClawbackVestingAccountResponseProtoMsg { typeUrl: "/evmos.vesting.v1.MsgCreateClawbackVestingAccountResponse"; value: Uint8Array; @@ -81,11 +71,6 @@ export interface MsgClawback { */ destAddress: string; } -export interface ReactiveMsgClawback { - funderAddress: ComputedRef; - accountAddress: ComputedRef; - destAddress: ComputedRef; -} export interface MsgClawbackProtoMsg { typeUrl: "/evmos.vesting.v1.MsgClawback"; value: Uint8Array; @@ -101,7 +86,6 @@ export interface MsgClawbackSDKType { } /** MsgClawbackResponse defines the MsgClawback response type. */ export interface MsgClawbackResponse {} -export interface ReactiveMsgClawbackResponse {} export interface MsgClawbackResponseProtoMsg { typeUrl: "/evmos.vesting.v1.MsgClawbackResponse"; value: Uint8Array; @@ -121,10 +105,10 @@ function createBaseMsgCreateClawbackVestingAccount(): MsgCreateClawbackVestingAc export const MsgCreateClawbackVestingAccount = { typeUrl: "/evmos.vesting.v1.MsgCreateClawbackVestingAccount", encode(message: MsgCreateClawbackVestingAccount, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.fromAddress !== "") { + if (message.fromAddress !== undefined) { writer.uint32(10).string(message.fromAddress); } - if (message.toAddress !== "") { + if (message.toAddress !== undefined) { writer.uint32(18).string(message.toAddress); } if (message.startTime !== undefined) { @@ -136,7 +120,7 @@ export const MsgCreateClawbackVestingAccount = { for (const v of message.vestingPeriods) { Period.encode(v!, writer.uint32(42).fork()).ldelim(); } - if (message.merge === true) { + if (message.merge !== undefined) { writer.uint32(48).bool(message.merge); } return writer; @@ -174,14 +158,14 @@ export const MsgCreateClawbackVestingAccount = { return message; }, fromJSON(object: any): MsgCreateClawbackVestingAccount { - return { - fromAddress: isSet(object.fromAddress) ? String(object.fromAddress) : "", - toAddress: isSet(object.toAddress) ? String(object.toAddress) : "", - startTime: isSet(object.startTime) ? new Date(object.startTime) : undefined, - lockupPeriods: Array.isArray(object?.lockupPeriods) ? object.lockupPeriods.map((e: any) => Period.fromJSON(e)) : [], - vestingPeriods: Array.isArray(object?.vestingPeriods) ? object.vestingPeriods.map((e: any) => Period.fromJSON(e)) : [], - merge: isSet(object.merge) ? Boolean(object.merge) : false - }; + const obj = createBaseMsgCreateClawbackVestingAccount(); + if (isSet(object.fromAddress)) obj.fromAddress = String(object.fromAddress); + if (isSet(object.toAddress)) obj.toAddress = String(object.toAddress); + if (isSet(object.startTime)) obj.startTime = new Date(object.startTime); + if (Array.isArray(object?.lockupPeriods)) obj.lockupPeriods = object.lockupPeriods.map((e: any) => Period.fromJSON(e)); + if (Array.isArray(object?.vestingPeriods)) obj.vestingPeriods = object.vestingPeriods.map((e: any) => Period.fromJSON(e)); + if (isSet(object.merge)) obj.merge = Boolean(object.merge); + return obj; }, toJSON(message: MsgCreateClawbackVestingAccount): JsonSafe { const obj: any = {}; @@ -324,7 +308,8 @@ export const MsgCreateClawbackVestingAccountResponse = { return message; }, fromJSON(_: any): MsgCreateClawbackVestingAccountResponse { - return {}; + const obj = createBaseMsgCreateClawbackVestingAccountResponse(); + return obj; }, toJSON(_: MsgCreateClawbackVestingAccountResponse): JsonSafe { const obj: any = {}; @@ -378,13 +363,13 @@ function createBaseMsgClawback(): MsgClawback { export const MsgClawback = { typeUrl: "/evmos.vesting.v1.MsgClawback", encode(message: MsgClawback, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.funderAddress !== "") { + if (message.funderAddress !== undefined) { writer.uint32(10).string(message.funderAddress); } - if (message.accountAddress !== "") { + if (message.accountAddress !== undefined) { writer.uint32(18).string(message.accountAddress); } - if (message.destAddress !== "") { + if (message.destAddress !== undefined) { writer.uint32(26).string(message.destAddress); } return writer; @@ -413,11 +398,11 @@ export const MsgClawback = { return message; }, fromJSON(object: any): MsgClawback { - return { - funderAddress: isSet(object.funderAddress) ? String(object.funderAddress) : "", - accountAddress: isSet(object.accountAddress) ? String(object.accountAddress) : "", - destAddress: isSet(object.destAddress) ? String(object.destAddress) : "" - }; + const obj = createBaseMsgClawback(); + if (isSet(object.funderAddress)) obj.funderAddress = String(object.funderAddress); + if (isSet(object.accountAddress)) obj.accountAddress = String(object.accountAddress); + if (isSet(object.destAddress)) obj.destAddress = String(object.destAddress); + return obj; }, toJSON(message: MsgClawback): JsonSafe { const obj: any = {}; @@ -513,7 +498,8 @@ export const MsgClawbackResponse = { return message; }, fromJSON(_: any): MsgClawbackResponse { - return {}; + const obj = createBaseMsgClawbackResponse(); + return obj; }, toJSON(_: MsgClawbackResponse): JsonSafe { const obj: any = {}; diff --git a/__fixtures__/v-next/outputv4/evmos/vesting/v1/vesting.ts b/__fixtures__/v-next/outputv4/evmos/vesting/v1/vesting.ts index 1d8bfd8fca..1a5cddd31a 100644 --- a/__fixtures__/v-next/outputv4/evmos/vesting/v1/vesting.ts +++ b/__fixtures__/v-next/outputv4/evmos/vesting/v1/vesting.ts @@ -1,9 +1,8 @@ -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 { JsonSafe } from "../../../json-safe"; -import { ComputedRef } from "vue"; +import { BaseVestingAccount, BaseVestingAccountSDKType, Period, PeriodSDKType } from "../../../cosmos/vesting/v1beta1/vesting.js"; +import { Timestamp, TimestampSDKType } from "../../../google/protobuf/timestamp.js"; +import { BinaryReader, BinaryWriter } from "../../../binary.js"; +import { toTimestamp, fromTimestamp, isSet, DeepPartial } from "../../../helpers.js"; +import { JsonSafe } from "../../../json-safe.js"; export const protobufPackage = "evmos.vesting.v1"; /** * ClawbackVestingAccount implements the VestingAccount interface. It provides @@ -26,13 +25,6 @@ export interface ClawbackVestingAccount { /** vesting_periods defines the vesting schedule relative to the start_time */ vestingPeriods: Period[]; } -export interface ReactiveClawbackVestingAccount { - baseVestingAccount?: ComputedRef; - funderAddress: ComputedRef; - startTime: ComputedRef; - lockupPeriods: ComputedRef; - vestingPeriods: ComputedRef; -} export interface ClawbackVestingAccountProtoMsg { typeUrl: "/evmos.vesting.v1.ClawbackVestingAccount"; value: Uint8Array; @@ -65,7 +57,7 @@ export const ClawbackVestingAccount = { if (message.baseVestingAccount !== undefined) { BaseVestingAccount.encode(message.baseVestingAccount, writer.uint32(10).fork()).ldelim(); } - if (message.funderAddress !== "") { + if (message.funderAddress !== undefined) { writer.uint32(18).string(message.funderAddress); } if (message.startTime !== undefined) { @@ -109,13 +101,13 @@ export const ClawbackVestingAccount = { return message; }, fromJSON(object: any): ClawbackVestingAccount { - return { - baseVestingAccount: isSet(object.baseVestingAccount) ? BaseVestingAccount.fromJSON(object.baseVestingAccount) : undefined, - funderAddress: isSet(object.funderAddress) ? String(object.funderAddress) : "", - startTime: isSet(object.startTime) ? new Date(object.startTime) : undefined, - lockupPeriods: Array.isArray(object?.lockupPeriods) ? object.lockupPeriods.map((e: any) => Period.fromJSON(e)) : [], - vestingPeriods: Array.isArray(object?.vestingPeriods) ? object.vestingPeriods.map((e: any) => Period.fromJSON(e)) : [] - }; + const obj = createBaseClawbackVestingAccount(); + if (isSet(object.baseVestingAccount)) obj.baseVestingAccount = BaseVestingAccount.fromJSON(object.baseVestingAccount); + if (isSet(object.funderAddress)) obj.funderAddress = String(object.funderAddress); + if (isSet(object.startTime)) obj.startTime = new Date(object.startTime); + if (Array.isArray(object?.lockupPeriods)) obj.lockupPeriods = object.lockupPeriods.map((e: any) => Period.fromJSON(e)); + if (Array.isArray(object?.vestingPeriods)) obj.vestingPeriods = object.vestingPeriods.map((e: any) => Period.fromJSON(e)); + return obj; }, toJSON(message: ClawbackVestingAccount): JsonSafe { const obj: any = {}; @@ -136,7 +128,9 @@ export const ClawbackVestingAccount = { }, fromPartial(object: DeepPartial): ClawbackVestingAccount { const message = createBaseClawbackVestingAccount(); - message.baseVestingAccount = object.baseVestingAccount !== undefined && object.baseVestingAccount !== null ? BaseVestingAccount.fromPartial(object.baseVestingAccount) : undefined; + if (object.baseVestingAccount !== undefined && object.baseVestingAccount !== null) { + message.baseVestingAccount = BaseVestingAccount.fromPartial(object.baseVestingAccount); + } message.funderAddress = object.funderAddress ?? ""; message.startTime = object.startTime ?? undefined; message.lockupPeriods = object.lockupPeriods?.map(e => Period.fromPartial(e)) || []; diff --git a/__fixtures__/v-next/outputv4/extern.ts b/__fixtures__/v-next/outputv4/extern.ts index f60ecaf86f..b56caf20e4 100644 --- a/__fixtures__/v-next/outputv4/extern.ts +++ b/__fixtures__/v-next/outputv4/extern.ts @@ -5,7 +5,7 @@ */ import { QueryClient, createProtobufRpcClient, ProtobufRpcClient } from '@cosmjs/stargate' -import { Tendermint34Client, HttpEndpoint } from "@cosmjs/tendermint-rpc"; +import { connectComet, HttpEndpoint } from "@cosmjs/tendermint-rpc"; const _rpcClients: Record = {}; @@ -24,10 +24,19 @@ export const getRpcClient = async (rpcEndpoint: string | HttpEndpoint) => { if (_rpcClients.hasOwnProperty(key)) { return _rpcClients[key]; } - const tmClient = await Tendermint34Client.connect(rpcEndpoint); + const cometClient = await connectComet(rpcEndpoint); //@ts-ignore - const client = new QueryClient(tmClient); + const client = new QueryClient(cometClient); const rpc = createProtobufRpcClient(client); _rpcClients[key] = rpc; return rpc; } + +export const createRpcClient = async (rpcEndpoint: string | HttpEndpoint) => { + const cometClient = await connectComet(rpcEndpoint); + //@ts-ignore + const client = new QueryClient(cometClient); + const rpc = createProtobufRpcClient(client); + + return rpc; +} diff --git a/__fixtures__/v-next/outputv4/gogoproto/bundle.ts b/__fixtures__/v-next/outputv4/gogoproto/bundle.ts index 088726b0af..2ce1d53fa4 100644 --- a/__fixtures__/v-next/outputv4/gogoproto/bundle.ts +++ b/__fixtures__/v-next/outputv4/gogoproto/bundle.ts @@ -1,4 +1,4 @@ -import * as _180 from "./gogo"; +import * as _177 from "./gogo.js"; export const gogoproto = { - ..._180 + ..._177 }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv4/google/api/auth.ts b/__fixtures__/v-next/outputv4/google/api/auth.ts index 393dd0b8f3..37ab1a6359 100644 --- a/__fixtures__/v-next/outputv4/google/api/auth.ts +++ b/__fixtures__/v-next/outputv4/google/api/auth.ts @@ -1,7 +1,6 @@ -import { BinaryReader, BinaryWriter } from "../../binary"; -import { JsonSafe } from "../../json-safe"; -import { DeepPartial, isSet } from "../../helpers"; -import { ComputedRef } from "vue"; +import { BinaryReader, BinaryWriter } from "../../binary.js"; +import { JsonSafe } from "../../json-safe.js"; +import { DeepPartial, isSet } from "../../helpers.js"; export const protobufPackage = "google.api"; /** * `Authentication` defines the authentication configuration for API methods @@ -33,10 +32,6 @@ export interface Authentication { /** Defines a set of authentication providers that a service supports. */ providers: AuthProvider[]; } -export interface ReactiveAuthentication { - rules: ComputedRef; - providers: ComputedRef; -} export interface AuthenticationProtoMsg { typeUrl: "/google.api.Authentication"; value: Uint8Array; @@ -93,12 +88,6 @@ export interface AuthenticationRule { /** Requirements for additional authentication providers. */ requirements: AuthRequirement[]; } -export interface ReactiveAuthenticationRule { - selector: ComputedRef; - oauth?: ComputedRef; - allowWithoutCredential: ComputedRef; - requirements: ComputedRef; -} export interface AuthenticationRuleProtoMsg { typeUrl: "/google.api.AuthenticationRule"; value: Uint8Array; @@ -138,11 +127,6 @@ export interface JwtLocation { */ valuePrefix: string; } -export interface ReactiveJwtLocation { - header?: ComputedRef; - query?: ComputedRef; - valuePrefix: ComputedRef; -} export interface JwtLocationProtoMsg { typeUrl: "/google.api.JwtLocation"; value: Uint8Array; @@ -236,14 +220,6 @@ export interface AuthProvider { */ jwtLocations: JwtLocation[]; } -export interface ReactiveAuthProvider { - id: ComputedRef; - issuer: ComputedRef; - jwksUri: ComputedRef; - audiences: ComputedRef; - authorizationUrl: ComputedRef; - jwtLocations: ComputedRef; -} export interface AuthProviderProtoMsg { typeUrl: "/google.api.AuthProvider"; value: Uint8Array; @@ -293,9 +269,6 @@ export interface OAuthRequirements { */ canonicalScopes: string; } -export interface ReactiveOAuthRequirements { - canonicalScopes: ComputedRef; -} export interface OAuthRequirementsProtoMsg { typeUrl: "/google.api.OAuthRequirements"; value: Uint8Array; @@ -357,10 +330,6 @@ export interface AuthRequirement { */ audiences: string; } -export interface ReactiveAuthRequirement { - providerId: ComputedRef; - audiences: ComputedRef; -} export interface AuthRequirementProtoMsg { typeUrl: "/google.api.AuthRequirement"; value: Uint8Array; @@ -412,10 +381,10 @@ export const Authentication = { return message; }, fromJSON(object: any): Authentication { - return { - rules: Array.isArray(object?.rules) ? object.rules.map((e: any) => AuthenticationRule.fromJSON(e)) : [], - providers: Array.isArray(object?.providers) ? object.providers.map((e: any) => AuthProvider.fromJSON(e)) : [] - }; + const obj = createBaseAuthentication(); + if (Array.isArray(object?.rules)) obj.rules = object.rules.map((e: any) => AuthenticationRule.fromJSON(e)); + if (Array.isArray(object?.providers)) obj.providers = object.providers.map((e: any) => AuthProvider.fromJSON(e)); + return obj; }, toJSON(message: Authentication): JsonSafe { const obj: any = {}; @@ -510,13 +479,13 @@ function createBaseAuthenticationRule(): AuthenticationRule { export const AuthenticationRule = { typeUrl: "/google.api.AuthenticationRule", encode(message: AuthenticationRule, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.selector !== "") { + if (message.selector !== undefined) { writer.uint32(10).string(message.selector); } if (message.oauth !== undefined) { OAuthRequirements.encode(message.oauth, writer.uint32(18).fork()).ldelim(); } - if (message.allowWithoutCredential === true) { + if (message.allowWithoutCredential !== undefined) { writer.uint32(40).bool(message.allowWithoutCredential); } for (const v of message.requirements) { @@ -551,12 +520,12 @@ export const AuthenticationRule = { return message; }, fromJSON(object: any): AuthenticationRule { - return { - selector: isSet(object.selector) ? String(object.selector) : "", - oauth: isSet(object.oauth) ? OAuthRequirements.fromJSON(object.oauth) : undefined, - allowWithoutCredential: isSet(object.allowWithoutCredential) ? Boolean(object.allowWithoutCredential) : false, - requirements: Array.isArray(object?.requirements) ? object.requirements.map((e: any) => AuthRequirement.fromJSON(e)) : [] - }; + const obj = createBaseAuthenticationRule(); + if (isSet(object.selector)) obj.selector = String(object.selector); + if (isSet(object.oauth)) obj.oauth = OAuthRequirements.fromJSON(object.oauth); + if (isSet(object.allowWithoutCredential)) obj.allowWithoutCredential = Boolean(object.allowWithoutCredential); + if (Array.isArray(object?.requirements)) obj.requirements = object.requirements.map((e: any) => AuthRequirement.fromJSON(e)); + return obj; }, toJSON(message: AuthenticationRule): JsonSafe { const obj: any = {}; @@ -573,7 +542,9 @@ export const AuthenticationRule = { fromPartial(object: DeepPartial): AuthenticationRule { const message = createBaseAuthenticationRule(); message.selector = object.selector ?? ""; - message.oauth = object.oauth !== undefined && object.oauth !== null ? OAuthRequirements.fromPartial(object.oauth) : undefined; + if (object.oauth !== undefined && object.oauth !== null) { + message.oauth = OAuthRequirements.fromPartial(object.oauth); + } message.allowWithoutCredential = object.allowWithoutCredential ?? false; message.requirements = object.requirements?.map(e => AuthRequirement.fromPartial(e)) || []; return message; @@ -664,7 +635,7 @@ export const JwtLocation = { if (message.query !== undefined) { writer.uint32(18).string(message.query); } - if (message.valuePrefix !== "") { + if (message.valuePrefix !== undefined) { writer.uint32(26).string(message.valuePrefix); } return writer; @@ -693,11 +664,11 @@ export const JwtLocation = { return message; }, fromJSON(object: any): JwtLocation { - return { - header: isSet(object.header) ? String(object.header) : undefined, - query: isSet(object.query) ? String(object.query) : undefined, - valuePrefix: isSet(object.valuePrefix) ? String(object.valuePrefix) : "" - }; + const obj = createBaseJwtLocation(); + if (isSet(object.header)) obj.header = String(object.header); + if (isSet(object.query)) obj.query = String(object.query); + if (isSet(object.valuePrefix)) obj.valuePrefix = String(object.valuePrefix); + return obj; }, toJSON(message: JwtLocation): JsonSafe { const obj: any = {}; @@ -783,19 +754,19 @@ function createBaseAuthProvider(): AuthProvider { export const AuthProvider = { typeUrl: "/google.api.AuthProvider", encode(message: AuthProvider, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.id !== "") { + if (message.id !== undefined) { writer.uint32(10).string(message.id); } - if (message.issuer !== "") { + if (message.issuer !== undefined) { writer.uint32(18).string(message.issuer); } - if (message.jwksUri !== "") { + if (message.jwksUri !== undefined) { writer.uint32(26).string(message.jwksUri); } - if (message.audiences !== "") { + if (message.audiences !== undefined) { writer.uint32(34).string(message.audiences); } - if (message.authorizationUrl !== "") { + if (message.authorizationUrl !== undefined) { writer.uint32(42).string(message.authorizationUrl); } for (const v of message.jwtLocations) { @@ -836,14 +807,14 @@ export const AuthProvider = { return message; }, fromJSON(object: any): AuthProvider { - return { - id: isSet(object.id) ? String(object.id) : "", - issuer: isSet(object.issuer) ? String(object.issuer) : "", - jwksUri: isSet(object.jwksUri) ? String(object.jwksUri) : "", - audiences: isSet(object.audiences) ? String(object.audiences) : "", - authorizationUrl: isSet(object.authorizationUrl) ? String(object.authorizationUrl) : "", - jwtLocations: Array.isArray(object?.jwtLocations) ? object.jwtLocations.map((e: any) => JwtLocation.fromJSON(e)) : [] - }; + const obj = createBaseAuthProvider(); + if (isSet(object.id)) obj.id = String(object.id); + if (isSet(object.issuer)) obj.issuer = String(object.issuer); + if (isSet(object.jwksUri)) obj.jwksUri = String(object.jwksUri); + if (isSet(object.audiences)) obj.audiences = String(object.audiences); + if (isSet(object.authorizationUrl)) obj.authorizationUrl = String(object.authorizationUrl); + if (Array.isArray(object?.jwtLocations)) obj.jwtLocations = object.jwtLocations.map((e: any) => JwtLocation.fromJSON(e)); + return obj; }, toJSON(message: AuthProvider): JsonSafe { const obj: any = {}; @@ -961,7 +932,7 @@ function createBaseOAuthRequirements(): OAuthRequirements { export const OAuthRequirements = { typeUrl: "/google.api.OAuthRequirements", encode(message: OAuthRequirements, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.canonicalScopes !== "") { + if (message.canonicalScopes !== undefined) { writer.uint32(10).string(message.canonicalScopes); } return writer; @@ -984,9 +955,9 @@ export const OAuthRequirements = { return message; }, fromJSON(object: any): OAuthRequirements { - return { - canonicalScopes: isSet(object.canonicalScopes) ? String(object.canonicalScopes) : "" - }; + const obj = createBaseOAuthRequirements(); + if (isSet(object.canonicalScopes)) obj.canonicalScopes = String(object.canonicalScopes); + return obj; }, toJSON(message: OAuthRequirements): JsonSafe { const obj: any = {}; @@ -1050,10 +1021,10 @@ function createBaseAuthRequirement(): AuthRequirement { export const AuthRequirement = { typeUrl: "/google.api.AuthRequirement", encode(message: AuthRequirement, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.providerId !== "") { + if (message.providerId !== undefined) { writer.uint32(10).string(message.providerId); } - if (message.audiences !== "") { + if (message.audiences !== undefined) { writer.uint32(18).string(message.audiences); } return writer; @@ -1079,10 +1050,10 @@ export const AuthRequirement = { return message; }, fromJSON(object: any): AuthRequirement { - return { - providerId: isSet(object.providerId) ? String(object.providerId) : "", - audiences: isSet(object.audiences) ? String(object.audiences) : "" - }; + const obj = createBaseAuthRequirement(); + if (isSet(object.providerId)) obj.providerId = String(object.providerId); + if (isSet(object.audiences)) obj.audiences = String(object.audiences); + return obj; }, toJSON(message: AuthRequirement): JsonSafe { const obj: any = {}; diff --git a/__fixtures__/v-next/outputv4/google/api/backend.ts b/__fixtures__/v-next/outputv4/google/api/backend.ts index 959274a296..8a1cdc029e 100644 --- a/__fixtures__/v-next/outputv4/google/api/backend.ts +++ b/__fixtures__/v-next/outputv4/google/api/backend.ts @@ -1,7 +1,6 @@ -import { BinaryReader, BinaryWriter } from "../../binary"; -import { JsonSafe } from "../../json-safe"; -import { DeepPartial, isSet } from "../../helpers"; -import { ComputedRef } from "vue"; +import { BinaryReader, BinaryWriter } from "../../binary.js"; +import { JsonSafe } from "../../json-safe.js"; +import { DeepPartial, isSet } from "../../helpers.js"; export const protobufPackage = "google.api"; /** * Path Translation specifies how to combine the backend address with the @@ -104,9 +103,6 @@ export interface Backend { */ rules: BackendRule[]; } -export interface ReactiveBackend { - rules: ComputedRef; -} export interface BackendProtoMsg { typeUrl: "/google.api.Backend"; value: Uint8Array; @@ -200,17 +196,6 @@ export interface BackendRule { */ protocol: string; } -export interface ReactiveBackendRule { - selector: ComputedRef; - address: ComputedRef; - deadline: ComputedRef; - minDeadline: ComputedRef; - operationDeadline: ComputedRef; - pathTranslation: ComputedRef; - jwtAudience?: ComputedRef; - disableAuth?: ComputedRef; - protocol: ComputedRef; -} export interface BackendRuleProtoMsg { typeUrl: "/google.api.BackendRule"; value: Uint8Array; @@ -258,9 +243,9 @@ export const Backend = { return message; }, fromJSON(object: any): Backend { - return { - rules: Array.isArray(object?.rules) ? object.rules.map((e: any) => BackendRule.fromJSON(e)) : [] - }; + const obj = createBaseBackend(); + if (Array.isArray(object?.rules)) obj.rules = object.rules.map((e: any) => BackendRule.fromJSON(e)); + return obj; }, toJSON(message: Backend): JsonSafe { const obj: any = {}; @@ -341,19 +326,19 @@ function createBaseBackendRule(): BackendRule { export const BackendRule = { typeUrl: "/google.api.BackendRule", encode(message: BackendRule, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.selector !== "") { + if (message.selector !== undefined) { writer.uint32(10).string(message.selector); } - if (message.address !== "") { + if (message.address !== undefined) { writer.uint32(18).string(message.address); } - if (message.deadline !== 0) { + if (message.deadline !== undefined) { writer.uint32(25).double(message.deadline); } - if (message.minDeadline !== 0) { + if (message.minDeadline !== undefined) { writer.uint32(33).double(message.minDeadline); } - if (message.operationDeadline !== 0) { + if (message.operationDeadline !== undefined) { writer.uint32(41).double(message.operationDeadline); } if (message.pathTranslation !== 0) { @@ -365,7 +350,7 @@ export const BackendRule = { if (message.disableAuth !== undefined) { writer.uint32(64).bool(message.disableAuth); } - if (message.protocol !== "") { + if (message.protocol !== undefined) { writer.uint32(74).string(message.protocol); } return writer; @@ -412,17 +397,17 @@ export const BackendRule = { return message; }, fromJSON(object: any): BackendRule { - return { - selector: isSet(object.selector) ? String(object.selector) : "", - address: isSet(object.address) ? String(object.address) : "", - deadline: isSet(object.deadline) ? Number(object.deadline) : 0, - minDeadline: isSet(object.minDeadline) ? Number(object.minDeadline) : 0, - operationDeadline: isSet(object.operationDeadline) ? Number(object.operationDeadline) : 0, - pathTranslation: isSet(object.pathTranslation) ? backendRule_PathTranslationFromJSON(object.pathTranslation) : -1, - jwtAudience: isSet(object.jwtAudience) ? String(object.jwtAudience) : undefined, - disableAuth: isSet(object.disableAuth) ? Boolean(object.disableAuth) : undefined, - protocol: isSet(object.protocol) ? String(object.protocol) : "" - }; + const obj = createBaseBackendRule(); + if (isSet(object.selector)) obj.selector = String(object.selector); + if (isSet(object.address)) obj.address = String(object.address); + if (isSet(object.deadline)) obj.deadline = Number(object.deadline); + if (isSet(object.minDeadline)) obj.minDeadline = Number(object.minDeadline); + if (isSet(object.operationDeadline)) obj.operationDeadline = Number(object.operationDeadline); + if (isSet(object.pathTranslation)) obj.pathTranslation = backendRule_PathTranslationFromJSON(object.pathTranslation); + if (isSet(object.jwtAudience)) obj.jwtAudience = String(object.jwtAudience); + if (isSet(object.disableAuth)) obj.disableAuth = Boolean(object.disableAuth); + if (isSet(object.protocol)) obj.protocol = String(object.protocol); + return obj; }, toJSON(message: BackendRule): JsonSafe { const obj: any = {}; diff --git a/__fixtures__/v-next/outputv4/google/api/billing.ts b/__fixtures__/v-next/outputv4/google/api/billing.ts index bbb599b69e..3767cd5423 100644 --- a/__fixtures__/v-next/outputv4/google/api/billing.ts +++ b/__fixtures__/v-next/outputv4/google/api/billing.ts @@ -1,7 +1,6 @@ -import { BinaryReader, BinaryWriter } from "../../binary"; -import { JsonSafe } from "../../json-safe"; -import { DeepPartial, isSet } from "../../helpers"; -import { ComputedRef } from "vue"; +import { BinaryReader, BinaryWriter } from "../../binary.js"; +import { JsonSafe } from "../../json-safe.js"; +import { DeepPartial, isSet } from "../../helpers.js"; export const protobufPackage = "google.api"; /** * Billing related configuration of the service. @@ -46,9 +45,6 @@ export interface Billing { */ consumerDestinations: Billing_BillingDestination[]; } -export interface ReactiveBilling { - consumerDestinations: ComputedRef; -} export interface BillingProtoMsg { typeUrl: "/google.api.Billing"; value: Uint8Array; @@ -106,10 +102,6 @@ export interface Billing_BillingDestination { */ metrics: string[]; } -export interface ReactiveBilling_BillingDestination { - monitoredResource: ComputedRef; - metrics: ComputedRef; -} export interface Billing_BillingDestinationProtoMsg { typeUrl: "/google.api.BillingDestination"; value: Uint8Array; @@ -153,9 +145,9 @@ export const Billing = { return message; }, fromJSON(object: any): Billing { - return { - consumerDestinations: Array.isArray(object?.consumerDestinations) ? object.consumerDestinations.map((e: any) => Billing_BillingDestination.fromJSON(e)) : [] - }; + const obj = createBaseBilling(); + if (Array.isArray(object?.consumerDestinations)) obj.consumerDestinations = object.consumerDestinations.map((e: any) => Billing_BillingDestination.fromJSON(e)); + return obj; }, toJSON(message: Billing): JsonSafe { const obj: any = {}; @@ -229,7 +221,7 @@ function createBaseBilling_BillingDestination(): Billing_BillingDestination { export const Billing_BillingDestination = { typeUrl: "/google.api.BillingDestination", encode(message: Billing_BillingDestination, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.monitoredResource !== "") { + if (message.monitoredResource !== undefined) { writer.uint32(10).string(message.monitoredResource); } for (const v of message.metrics) { @@ -258,10 +250,10 @@ export const Billing_BillingDestination = { return message; }, fromJSON(object: any): Billing_BillingDestination { - return { - monitoredResource: isSet(object.monitoredResource) ? String(object.monitoredResource) : "", - metrics: Array.isArray(object?.metrics) ? object.metrics.map((e: any) => String(e)) : [] - }; + const obj = createBaseBilling_BillingDestination(); + if (isSet(object.monitoredResource)) obj.monitoredResource = String(object.monitoredResource); + if (Array.isArray(object?.metrics)) obj.metrics = object.metrics.map((e: any) => String(e)); + return obj; }, toJSON(message: Billing_BillingDestination): JsonSafe { const obj: any = {}; diff --git a/__fixtures__/v-next/outputv4/google/api/config_change.ts b/__fixtures__/v-next/outputv4/google/api/config_change.ts index 79fbaf0c87..6602d4b451 100644 --- a/__fixtures__/v-next/outputv4/google/api/config_change.ts +++ b/__fixtures__/v-next/outputv4/google/api/config_change.ts @@ -1,7 +1,6 @@ -import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial } from "../../helpers"; -import { JsonSafe } from "../../json-safe"; -import { ComputedRef } from "vue"; +import { BinaryReader, BinaryWriter } from "../../binary.js"; +import { isSet, DeepPartial } from "../../helpers.js"; +import { JsonSafe } from "../../json-safe.js"; export const protobufPackage = "google.api"; /** * Classifies set of possible modifications to an object in the service @@ -102,13 +101,6 @@ export interface ConfigChange { */ advices: Advice[]; } -export interface ReactiveConfigChange { - element: ComputedRef; - oldValue: ComputedRef; - newValue: ComputedRef; - changeType: ComputedRef; - advices: ComputedRef; -} export interface ConfigChangeProtoMsg { typeUrl: "/google.api.ConfigChange"; value: Uint8Array; @@ -139,9 +131,6 @@ export interface Advice { */ description: string; } -export interface ReactiveAdvice { - description: ComputedRef; -} export interface AdviceProtoMsg { typeUrl: "/google.api.Advice"; value: Uint8Array; @@ -165,13 +154,13 @@ function createBaseConfigChange(): ConfigChange { export const ConfigChange = { typeUrl: "/google.api.ConfigChange", encode(message: ConfigChange, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.element !== "") { + if (message.element !== undefined) { writer.uint32(10).string(message.element); } - if (message.oldValue !== "") { + if (message.oldValue !== undefined) { writer.uint32(18).string(message.oldValue); } - if (message.newValue !== "") { + if (message.newValue !== undefined) { writer.uint32(26).string(message.newValue); } if (message.changeType !== 0) { @@ -212,13 +201,13 @@ export const ConfigChange = { return message; }, fromJSON(object: any): ConfigChange { - return { - element: isSet(object.element) ? String(object.element) : "", - oldValue: isSet(object.oldValue) ? String(object.oldValue) : "", - newValue: isSet(object.newValue) ? String(object.newValue) : "", - changeType: isSet(object.changeType) ? changeTypeFromJSON(object.changeType) : -1, - advices: Array.isArray(object?.advices) ? object.advices.map((e: any) => Advice.fromJSON(e)) : [] - }; + const obj = createBaseConfigChange(); + if (isSet(object.element)) obj.element = String(object.element); + if (isSet(object.oldValue)) obj.oldValue = String(object.oldValue); + if (isSet(object.newValue)) obj.newValue = String(object.newValue); + if (isSet(object.changeType)) obj.changeType = changeTypeFromJSON(object.changeType); + if (Array.isArray(object?.advices)) obj.advices = object.advices.map((e: any) => Advice.fromJSON(e)); + return obj; }, toJSON(message: ConfigChange): JsonSafe { const obj: any = {}; @@ -327,7 +316,7 @@ function createBaseAdvice(): Advice { export const Advice = { typeUrl: "/google.api.Advice", encode(message: Advice, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.description !== "") { + if (message.description !== undefined) { writer.uint32(18).string(message.description); } return writer; @@ -350,9 +339,9 @@ export const Advice = { return message; }, fromJSON(object: any): Advice { - return { - description: isSet(object.description) ? String(object.description) : "" - }; + const obj = createBaseAdvice(); + if (isSet(object.description)) obj.description = String(object.description); + return obj; }, toJSON(message: Advice): JsonSafe { const obj: any = {}; diff --git a/__fixtures__/v-next/outputv4/google/api/consumer.ts b/__fixtures__/v-next/outputv4/google/api/consumer.ts index d5a5f39625..f16c13dd81 100644 --- a/__fixtures__/v-next/outputv4/google/api/consumer.ts +++ b/__fixtures__/v-next/outputv4/google/api/consumer.ts @@ -1,7 +1,6 @@ -import { BinaryReader, BinaryWriter } from "../../binary"; -import { JsonSafe } from "../../json-safe"; -import { DeepPartial, isSet } from "../../helpers"; -import { ComputedRef } from "vue"; +import { BinaryReader, BinaryWriter } from "../../binary.js"; +import { JsonSafe } from "../../json-safe.js"; +import { DeepPartial, isSet } from "../../helpers.js"; export const protobufPackage = "google.api"; /** Supported data type of the property values */ export enum Property_PropertyType { @@ -80,9 +79,6 @@ export interface ProjectProperties { /** List of per consumer project-specific properties. */ properties: Property[]; } -export interface ReactiveProjectProperties { - properties: ComputedRef; -} export interface ProjectPropertiesProtoMsg { typeUrl: "/google.api.ProjectProperties"; value: Uint8Array; @@ -128,11 +124,6 @@ export interface Property { /** The description of the property */ description: string; } -export interface ReactiveProperty { - name: ComputedRef; - type: ComputedRef; - description: ComputedRef; -} export interface PropertyProtoMsg { typeUrl: "/google.api.Property"; value: Uint8Array; @@ -185,9 +176,9 @@ export const ProjectProperties = { return message; }, fromJSON(object: any): ProjectProperties { - return { - properties: Array.isArray(object?.properties) ? object.properties.map((e: any) => Property.fromJSON(e)) : [] - }; + const obj = createBaseProjectProperties(); + if (Array.isArray(object?.properties)) obj.properties = object.properties.map((e: any) => Property.fromJSON(e)); + return obj; }, toJSON(message: ProjectProperties): JsonSafe { const obj: any = {}; @@ -262,13 +253,13 @@ function createBaseProperty(): Property { export const Property = { typeUrl: "/google.api.Property", encode(message: Property, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.name !== "") { + if (message.name !== undefined) { writer.uint32(10).string(message.name); } if (message.type !== 0) { writer.uint32(16).int32(message.type); } - if (message.description !== "") { + if (message.description !== undefined) { writer.uint32(26).string(message.description); } return writer; @@ -297,11 +288,11 @@ export const Property = { return message; }, fromJSON(object: any): Property { - return { - name: isSet(object.name) ? String(object.name) : "", - type: isSet(object.type) ? property_PropertyTypeFromJSON(object.type) : -1, - description: isSet(object.description) ? String(object.description) : "" - }; + const obj = createBaseProperty(); + if (isSet(object.name)) obj.name = String(object.name); + if (isSet(object.type)) obj.type = property_PropertyTypeFromJSON(object.type); + if (isSet(object.description)) obj.description = String(object.description); + return obj; }, toJSON(message: Property): JsonSafe { const obj: any = {}; diff --git a/__fixtures__/v-next/outputv4/google/api/context.ts b/__fixtures__/v-next/outputv4/google/api/context.ts index 55cddaa6a1..20634acf30 100644 --- a/__fixtures__/v-next/outputv4/google/api/context.ts +++ b/__fixtures__/v-next/outputv4/google/api/context.ts @@ -1,7 +1,6 @@ -import { BinaryReader, BinaryWriter } from "../../binary"; -import { JsonSafe } from "../../json-safe"; -import { DeepPartial, isSet } from "../../helpers"; -import { ComputedRef } from "vue"; +import { BinaryReader, BinaryWriter } from "../../binary.js"; +import { JsonSafe } from "../../json-safe.js"; +import { DeepPartial, isSet } from "../../helpers.js"; export const protobufPackage = "google.api"; /** * `Context` defines which contexts an API requests. @@ -49,9 +48,6 @@ export interface Context { */ rules: ContextRule[]; } -export interface ReactiveContext { - rules: ComputedRef; -} export interface ContextProtoMsg { typeUrl: "/google.api.Context"; value: Uint8Array; @@ -123,13 +119,6 @@ export interface ContextRule { */ allowedResponseExtensions: string[]; } -export interface ReactiveContextRule { - selector: ComputedRef; - requested: ComputedRef; - provided: ComputedRef; - allowedRequestExtensions: ComputedRef; - allowedResponseExtensions: ComputedRef; -} export interface ContextRuleProtoMsg { typeUrl: "/google.api.ContextRule"; value: Uint8Array; @@ -176,9 +165,9 @@ export const Context = { return message; }, fromJSON(object: any): Context { - return { - rules: Array.isArray(object?.rules) ? object.rules.map((e: any) => ContextRule.fromJSON(e)) : [] - }; + const obj = createBaseContext(); + if (Array.isArray(object?.rules)) obj.rules = object.rules.map((e: any) => ContextRule.fromJSON(e)); + return obj; }, toJSON(message: Context): JsonSafe { const obj: any = {}; @@ -255,7 +244,7 @@ function createBaseContextRule(): ContextRule { export const ContextRule = { typeUrl: "/google.api.ContextRule", encode(message: ContextRule, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.selector !== "") { + if (message.selector !== undefined) { writer.uint32(10).string(message.selector); } for (const v of message.requested) { @@ -302,13 +291,13 @@ export const ContextRule = { return message; }, fromJSON(object: any): ContextRule { - return { - selector: isSet(object.selector) ? String(object.selector) : "", - requested: Array.isArray(object?.requested) ? object.requested.map((e: any) => String(e)) : [], - provided: Array.isArray(object?.provided) ? object.provided.map((e: any) => String(e)) : [], - allowedRequestExtensions: Array.isArray(object?.allowedRequestExtensions) ? object.allowedRequestExtensions.map((e: any) => String(e)) : [], - allowedResponseExtensions: Array.isArray(object?.allowedResponseExtensions) ? object.allowedResponseExtensions.map((e: any) => String(e)) : [] - }; + const obj = createBaseContextRule(); + if (isSet(object.selector)) obj.selector = String(object.selector); + if (Array.isArray(object?.requested)) obj.requested = object.requested.map((e: any) => String(e)); + if (Array.isArray(object?.provided)) obj.provided = object.provided.map((e: any) => String(e)); + if (Array.isArray(object?.allowedRequestExtensions)) obj.allowedRequestExtensions = object.allowedRequestExtensions.map((e: any) => String(e)); + if (Array.isArray(object?.allowedResponseExtensions)) obj.allowedResponseExtensions = object.allowedResponseExtensions.map((e: any) => String(e)); + return obj; }, toJSON(message: ContextRule): JsonSafe { const obj: any = {}; diff --git a/__fixtures__/v-next/outputv4/google/api/control.ts b/__fixtures__/v-next/outputv4/google/api/control.ts index ef7caf9ed6..a021cfcb77 100644 --- a/__fixtures__/v-next/outputv4/google/api/control.ts +++ b/__fixtures__/v-next/outputv4/google/api/control.ts @@ -1,7 +1,6 @@ -import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial } from "../../helpers"; -import { JsonSafe } from "../../json-safe"; -import { ComputedRef } from "vue"; +import { BinaryReader, BinaryWriter } from "../../binary.js"; +import { isSet, DeepPartial } from "../../helpers.js"; +import { JsonSafe } from "../../json-safe.js"; export const protobufPackage = "google.api"; /** * Selects and configures the service controller used by the service. The @@ -15,9 +14,6 @@ export interface Control { */ environment: string; } -export interface ReactiveControl { - environment: ComputedRef; -} export interface ControlProtoMsg { typeUrl: "/google.api.Control"; value: Uint8Array; @@ -38,7 +34,7 @@ function createBaseControl(): Control { export const Control = { typeUrl: "/google.api.Control", encode(message: Control, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.environment !== "") { + if (message.environment !== undefined) { writer.uint32(10).string(message.environment); } return writer; @@ -61,9 +57,9 @@ export const Control = { return message; }, fromJSON(object: any): Control { - return { - environment: isSet(object.environment) ? String(object.environment) : "" - }; + const obj = createBaseControl(); + if (isSet(object.environment)) obj.environment = String(object.environment); + return obj; }, toJSON(message: Control): JsonSafe { const obj: any = {}; diff --git a/__fixtures__/v-next/outputv4/google/api/distribution.ts b/__fixtures__/v-next/outputv4/google/api/distribution.ts index 96fb396db9..78227415e7 100644 --- a/__fixtures__/v-next/outputv4/google/api/distribution.ts +++ b/__fixtures__/v-next/outputv4/google/api/distribution.ts @@ -1,9 +1,8 @@ -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 { JsonSafe } from "../../json-safe"; -import { ComputedRef } from "vue"; +import { Timestamp, TimestampSDKType } from "../protobuf/timestamp.js"; +import { Any, AnySDKType } from "../protobuf/any.js"; +import { BinaryReader, BinaryWriter } from "../../binary.js"; +import { isSet, DeepPartial, toTimestamp, fromTimestamp } from "../../helpers.js"; +import { JsonSafe } from "../../json-safe.js"; export const protobufPackage = "google.api"; /** * `Distribution` contains summary statistics for a population of values. It @@ -76,15 +75,6 @@ export interface Distribution { /** Must be in increasing order of `value` field. */ exemplars: Distribution_Exemplar[]; } -export interface ReactiveDistribution { - count: ComputedRef; - mean: ComputedRef; - sumOfSquaredDeviation: ComputedRef; - range?: ComputedRef; - bucketOptions?: ComputedRef; - bucketCounts: ComputedRef; - exemplars: ComputedRef; -} export interface DistributionProtoMsg { typeUrl: "/google.api.Distribution"; value: Uint8Array; @@ -121,10 +111,6 @@ export interface Distribution_Range { /** The maximum of the population values. */ max: number; } -export interface ReactiveDistribution_Range { - min: ComputedRef; - max: ComputedRef; -} export interface Distribution_RangeProtoMsg { typeUrl: "/google.api.Range"; value: Uint8Array; @@ -159,11 +145,6 @@ export interface Distribution_BucketOptions { /** The explicit buckets. */ explicitBuckets?: Distribution_BucketOptions_Explicit; } -export interface ReactiveDistribution_BucketOptions { - linearBuckets?: ComputedRef; - exponentialBuckets?: ComputedRef; - explicitBuckets?: ComputedRef; -} export interface Distribution_BucketOptionsProtoMsg { typeUrl: "/google.api.BucketOptions"; value: Uint8Array; @@ -209,11 +190,6 @@ export interface Distribution_BucketOptions_Linear { /** Lower bound of the first bucket. */ offset: number; } -export interface ReactiveDistribution_BucketOptions_Linear { - numFiniteBuckets: ComputedRef; - width: ComputedRef; - offset: ComputedRef; -} export interface Distribution_BucketOptions_LinearProtoMsg { typeUrl: "/google.api.Linear"; value: Uint8Array; @@ -253,11 +229,6 @@ export interface Distribution_BucketOptions_Exponential { /** Must be greater than 0. */ scale: number; } -export interface ReactiveDistribution_BucketOptions_Exponential { - numFiniteBuckets: ComputedRef; - growthFactor: ComputedRef; - scale: ComputedRef; -} export interface Distribution_BucketOptions_ExponentialProtoMsg { typeUrl: "/google.api.Exponential"; value: Uint8Array; @@ -295,9 +266,6 @@ export interface Distribution_BucketOptions_Explicit { /** The values must be monotonically increasing. */ bounds: number[]; } -export interface ReactiveDistribution_BucketOptions_Explicit { - bounds: ComputedRef; -} export interface Distribution_BucketOptions_ExplicitProtoMsg { typeUrl: "/google.api.Explicit"; value: Uint8Array; @@ -348,11 +316,6 @@ export interface Distribution_Exemplar { */ attachments: Any[]; } -export interface ReactiveDistribution_Exemplar { - value: ComputedRef; - timestamp?: ComputedRef; - attachments: ComputedRef; -} export interface Distribution_ExemplarProtoMsg { typeUrl: "/google.api.Exemplar"; value: Uint8Array; @@ -383,13 +346,13 @@ function createBaseDistribution(): Distribution { export const Distribution = { typeUrl: "/google.api.Distribution", encode(message: Distribution, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.count !== BigInt(0)) { + if (message.count !== undefined) { writer.uint32(8).int64(message.count); } - if (message.mean !== 0) { + if (message.mean !== undefined) { writer.uint32(17).double(message.mean); } - if (message.sumOfSquaredDeviation !== 0) { + if (message.sumOfSquaredDeviation !== undefined) { writer.uint32(25).double(message.sumOfSquaredDeviation); } if (message.range !== undefined) { @@ -451,15 +414,15 @@ export const Distribution = { return message; }, fromJSON(object: any): Distribution { - return { - count: isSet(object.count) ? BigInt(object.count.toString()) : BigInt(0), - mean: isSet(object.mean) ? Number(object.mean) : 0, - sumOfSquaredDeviation: isSet(object.sumOfSquaredDeviation) ? Number(object.sumOfSquaredDeviation) : 0, - range: isSet(object.range) ? Distribution_Range.fromJSON(object.range) : undefined, - bucketOptions: isSet(object.bucketOptions) ? Distribution_BucketOptions.fromJSON(object.bucketOptions) : undefined, - bucketCounts: Array.isArray(object?.bucketCounts) ? object.bucketCounts.map((e: any) => BigInt(e.toString())) : [], - exemplars: Array.isArray(object?.exemplars) ? object.exemplars.map((e: any) => Distribution_Exemplar.fromJSON(e)) : [] - }; + const obj = createBaseDistribution(); + if (isSet(object.count)) obj.count = BigInt(object.count.toString()); + if (isSet(object.mean)) obj.mean = Number(object.mean); + if (isSet(object.sumOfSquaredDeviation)) obj.sumOfSquaredDeviation = Number(object.sumOfSquaredDeviation); + if (isSet(object.range)) obj.range = Distribution_Range.fromJSON(object.range); + if (isSet(object.bucketOptions)) obj.bucketOptions = Distribution_BucketOptions.fromJSON(object.bucketOptions); + if (Array.isArray(object?.bucketCounts)) obj.bucketCounts = object.bucketCounts.map((e: any) => BigInt(e.toString())); + if (Array.isArray(object?.exemplars)) obj.exemplars = object.exemplars.map((e: any) => Distribution_Exemplar.fromJSON(e)); + return obj; }, toJSON(message: Distribution): JsonSafe { const obj: any = {}; @@ -482,11 +445,17 @@ export const Distribution = { }, fromPartial(object: DeepPartial): Distribution { const message = createBaseDistribution(); - message.count = object.count !== undefined && object.count !== null ? BigInt(object.count.toString()) : BigInt(0); + if (object.count !== undefined && object.count !== null) { + message.count = BigInt(object.count.toString()); + } message.mean = object.mean ?? 0; message.sumOfSquaredDeviation = object.sumOfSquaredDeviation ?? 0; - message.range = object.range !== undefined && object.range !== null ? Distribution_Range.fromPartial(object.range) : undefined; - message.bucketOptions = object.bucketOptions !== undefined && object.bucketOptions !== null ? Distribution_BucketOptions.fromPartial(object.bucketOptions) : undefined; + if (object.range !== undefined && object.range !== null) { + message.range = Distribution_Range.fromPartial(object.range); + } + if (object.bucketOptions !== undefined && object.bucketOptions !== null) { + message.bucketOptions = Distribution_BucketOptions.fromPartial(object.bucketOptions); + } message.bucketCounts = object.bucketCounts?.map(e => BigInt(e.toString())) || []; message.exemplars = object.exemplars?.map(e => Distribution_Exemplar.fromPartial(e)) || []; return message; @@ -597,10 +566,10 @@ function createBaseDistribution_Range(): Distribution_Range { export const Distribution_Range = { typeUrl: "/google.api.Range", encode(message: Distribution_Range, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.min !== 0) { + if (message.min !== undefined) { writer.uint32(9).double(message.min); } - if (message.max !== 0) { + if (message.max !== undefined) { writer.uint32(17).double(message.max); } return writer; @@ -626,10 +595,10 @@ export const Distribution_Range = { return message; }, fromJSON(object: any): Distribution_Range { - return { - min: isSet(object.min) ? Number(object.min) : 0, - max: isSet(object.max) ? Number(object.max) : 0 - }; + const obj = createBaseDistribution_Range(); + if (isSet(object.min)) obj.min = Number(object.min); + if (isSet(object.max)) obj.max = Number(object.max); + return obj; }, toJSON(message: Distribution_Range): JsonSafe { const obj: any = {}; @@ -738,11 +707,11 @@ export const Distribution_BucketOptions = { return message; }, fromJSON(object: any): Distribution_BucketOptions { - return { - linearBuckets: isSet(object.linearBuckets) ? Distribution_BucketOptions_Linear.fromJSON(object.linearBuckets) : undefined, - exponentialBuckets: isSet(object.exponentialBuckets) ? Distribution_BucketOptions_Exponential.fromJSON(object.exponentialBuckets) : undefined, - explicitBuckets: isSet(object.explicitBuckets) ? Distribution_BucketOptions_Explicit.fromJSON(object.explicitBuckets) : undefined - }; + const obj = createBaseDistribution_BucketOptions(); + if (isSet(object.linearBuckets)) obj.linearBuckets = Distribution_BucketOptions_Linear.fromJSON(object.linearBuckets); + if (isSet(object.exponentialBuckets)) obj.exponentialBuckets = Distribution_BucketOptions_Exponential.fromJSON(object.exponentialBuckets); + if (isSet(object.explicitBuckets)) obj.explicitBuckets = Distribution_BucketOptions_Explicit.fromJSON(object.explicitBuckets); + return obj; }, toJSON(message: Distribution_BucketOptions): JsonSafe { const obj: any = {}; @@ -753,9 +722,15 @@ export const Distribution_BucketOptions = { }, fromPartial(object: DeepPartial): Distribution_BucketOptions { const message = createBaseDistribution_BucketOptions(); - message.linearBuckets = object.linearBuckets !== undefined && object.linearBuckets !== null ? Distribution_BucketOptions_Linear.fromPartial(object.linearBuckets) : undefined; - message.exponentialBuckets = object.exponentialBuckets !== undefined && object.exponentialBuckets !== null ? Distribution_BucketOptions_Exponential.fromPartial(object.exponentialBuckets) : undefined; - message.explicitBuckets = object.explicitBuckets !== undefined && object.explicitBuckets !== null ? Distribution_BucketOptions_Explicit.fromPartial(object.explicitBuckets) : undefined; + if (object.linearBuckets !== undefined && object.linearBuckets !== null) { + message.linearBuckets = Distribution_BucketOptions_Linear.fromPartial(object.linearBuckets); + } + if (object.exponentialBuckets !== undefined && object.exponentialBuckets !== null) { + message.exponentialBuckets = Distribution_BucketOptions_Exponential.fromPartial(object.exponentialBuckets); + } + if (object.explicitBuckets !== undefined && object.explicitBuckets !== null) { + message.explicitBuckets = Distribution_BucketOptions_Explicit.fromPartial(object.explicitBuckets); + } return message; }, fromSDK(object: Distribution_BucketOptionsSDKType): Distribution_BucketOptions { @@ -825,13 +800,13 @@ function createBaseDistribution_BucketOptions_Linear(): Distribution_BucketOptio export const Distribution_BucketOptions_Linear = { typeUrl: "/google.api.Linear", encode(message: Distribution_BucketOptions_Linear, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.numFiniteBuckets !== 0) { + if (message.numFiniteBuckets !== undefined) { writer.uint32(8).int32(message.numFiniteBuckets); } - if (message.width !== 0) { + if (message.width !== undefined) { writer.uint32(17).double(message.width); } - if (message.offset !== 0) { + if (message.offset !== undefined) { writer.uint32(25).double(message.offset); } return writer; @@ -860,11 +835,11 @@ export const Distribution_BucketOptions_Linear = { return message; }, fromJSON(object: any): Distribution_BucketOptions_Linear { - return { - numFiniteBuckets: isSet(object.numFiniteBuckets) ? Number(object.numFiniteBuckets) : 0, - width: isSet(object.width) ? Number(object.width) : 0, - offset: isSet(object.offset) ? Number(object.offset) : 0 - }; + const obj = createBaseDistribution_BucketOptions_Linear(); + if (isSet(object.numFiniteBuckets)) obj.numFiniteBuckets = Number(object.numFiniteBuckets); + if (isSet(object.width)) obj.width = Number(object.width); + if (isSet(object.offset)) obj.offset = Number(object.offset); + return obj; }, toJSON(message: Distribution_BucketOptions_Linear): JsonSafe { const obj: any = {}; @@ -947,13 +922,13 @@ function createBaseDistribution_BucketOptions_Exponential(): Distribution_Bucket export const Distribution_BucketOptions_Exponential = { typeUrl: "/google.api.Exponential", encode(message: Distribution_BucketOptions_Exponential, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.numFiniteBuckets !== 0) { + if (message.numFiniteBuckets !== undefined) { writer.uint32(8).int32(message.numFiniteBuckets); } - if (message.growthFactor !== 0) { + if (message.growthFactor !== undefined) { writer.uint32(17).double(message.growthFactor); } - if (message.scale !== 0) { + if (message.scale !== undefined) { writer.uint32(25).double(message.scale); } return writer; @@ -982,11 +957,11 @@ export const Distribution_BucketOptions_Exponential = { return message; }, fromJSON(object: any): Distribution_BucketOptions_Exponential { - return { - numFiniteBuckets: isSet(object.numFiniteBuckets) ? Number(object.numFiniteBuckets) : 0, - growthFactor: isSet(object.growthFactor) ? Number(object.growthFactor) : 0, - scale: isSet(object.scale) ? Number(object.scale) : 0 - }; + const obj = createBaseDistribution_BucketOptions_Exponential(); + if (isSet(object.numFiniteBuckets)) obj.numFiniteBuckets = Number(object.numFiniteBuckets); + if (isSet(object.growthFactor)) obj.growthFactor = Number(object.growthFactor); + if (isSet(object.scale)) obj.scale = Number(object.scale); + return obj; }, toJSON(message: Distribution_BucketOptions_Exponential): JsonSafe { const obj: any = {}; @@ -1099,9 +1074,9 @@ export const Distribution_BucketOptions_Explicit = { return message; }, fromJSON(object: any): Distribution_BucketOptions_Explicit { - return { - bounds: Array.isArray(object?.bounds) ? object.bounds.map((e: any) => Number(e)) : [] - }; + const obj = createBaseDistribution_BucketOptions_Explicit(); + if (Array.isArray(object?.bounds)) obj.bounds = object.bounds.map((e: any) => Number(e)); + return obj; }, toJSON(message: Distribution_BucketOptions_Explicit): JsonSafe { const obj: any = {}; @@ -1176,7 +1151,7 @@ function createBaseDistribution_Exemplar(): Distribution_Exemplar { export const Distribution_Exemplar = { typeUrl: "/google.api.Exemplar", encode(message: Distribution_Exemplar, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.value !== 0) { + if (message.value !== undefined) { writer.uint32(9).double(message.value); } if (message.timestamp !== undefined) { @@ -1211,11 +1186,11 @@ export const Distribution_Exemplar = { return message; }, fromJSON(object: any): Distribution_Exemplar { - return { - value: isSet(object.value) ? Number(object.value) : 0, - timestamp: isSet(object.timestamp) ? new Date(object.timestamp) : undefined, - attachments: Array.isArray(object?.attachments) ? object.attachments.map((e: any) => Any.fromJSON(e)) : [] - }; + const obj = createBaseDistribution_Exemplar(); + if (isSet(object.value)) obj.value = Number(object.value); + if (isSet(object.timestamp)) obj.timestamp = new Date(object.timestamp); + if (Array.isArray(object?.attachments)) obj.attachments = object.attachments.map((e: any) => Any.fromJSON(e)); + return obj; }, toJSON(message: Distribution_Exemplar): JsonSafe { const obj: any = {}; diff --git a/__fixtures__/v-next/outputv4/google/api/documentation.ts b/__fixtures__/v-next/outputv4/google/api/documentation.ts index f1f16814b9..ac7891c63e 100644 --- a/__fixtures__/v-next/outputv4/google/api/documentation.ts +++ b/__fixtures__/v-next/outputv4/google/api/documentation.ts @@ -1,7 +1,6 @@ -import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial } from "../../helpers"; -import { JsonSafe } from "../../json-safe"; -import { ComputedRef } from "vue"; +import { BinaryReader, BinaryWriter } from "../../binary.js"; +import { isSet, DeepPartial } from "../../helpers.js"; +import { JsonSafe } from "../../json-safe.js"; export const protobufPackage = "google.api"; /** * `Documentation` provides the information for describing a service. @@ -100,14 +99,6 @@ export interface Documentation { */ overview: string; } -export interface ReactiveDocumentation { - summary: ComputedRef; - pages: ComputedRef; - rules: ComputedRef; - documentationRootUrl: ComputedRef; - serviceRootUrl: ComputedRef; - overview: ComputedRef; -} export interface DocumentationProtoMsg { typeUrl: "/google.api.Documentation"; value: Uint8Array; @@ -196,11 +187,6 @@ export interface DocumentationRule { */ deprecationDescription: string; } -export interface ReactiveDocumentationRule { - selector: ComputedRef; - description: ComputedRef; - deprecationDescription: ComputedRef; -} export interface DocumentationRuleProtoMsg { typeUrl: "/google.api.DocumentationRule"; value: Uint8Array; @@ -244,11 +230,6 @@ export interface Page { */ subpages: Page[]; } -export interface ReactivePage { - name: ComputedRef; - content: ComputedRef; - subpages: ComputedRef; -} export interface PageProtoMsg { typeUrl: "/google.api.Page"; value: Uint8Array; @@ -275,7 +256,7 @@ function createBaseDocumentation(): Documentation { export const Documentation = { typeUrl: "/google.api.Documentation", encode(message: Documentation, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.summary !== "") { + if (message.summary !== undefined) { writer.uint32(10).string(message.summary); } for (const v of message.pages) { @@ -284,13 +265,13 @@ export const Documentation = { for (const v of message.rules) { DocumentationRule.encode(v!, writer.uint32(26).fork()).ldelim(); } - if (message.documentationRootUrl !== "") { + if (message.documentationRootUrl !== undefined) { writer.uint32(34).string(message.documentationRootUrl); } - if (message.serviceRootUrl !== "") { + if (message.serviceRootUrl !== undefined) { writer.uint32(50).string(message.serviceRootUrl); } - if (message.overview !== "") { + if (message.overview !== undefined) { writer.uint32(18).string(message.overview); } return writer; @@ -328,14 +309,14 @@ export const Documentation = { return message; }, fromJSON(object: any): Documentation { - return { - summary: isSet(object.summary) ? String(object.summary) : "", - pages: Array.isArray(object?.pages) ? object.pages.map((e: any) => Page.fromJSON(e)) : [], - rules: Array.isArray(object?.rules) ? object.rules.map((e: any) => DocumentationRule.fromJSON(e)) : [], - documentationRootUrl: isSet(object.documentationRootUrl) ? String(object.documentationRootUrl) : "", - serviceRootUrl: isSet(object.serviceRootUrl) ? String(object.serviceRootUrl) : "", - overview: isSet(object.overview) ? String(object.overview) : "" - }; + const obj = createBaseDocumentation(); + if (isSet(object.summary)) obj.summary = String(object.summary); + if (Array.isArray(object?.pages)) obj.pages = object.pages.map((e: any) => Page.fromJSON(e)); + if (Array.isArray(object?.rules)) obj.rules = object.rules.map((e: any) => DocumentationRule.fromJSON(e)); + if (isSet(object.documentationRootUrl)) obj.documentationRootUrl = String(object.documentationRootUrl); + if (isSet(object.serviceRootUrl)) obj.serviceRootUrl = String(object.serviceRootUrl); + if (isSet(object.overview)) obj.overview = String(object.overview); + return obj; }, toJSON(message: Documentation): JsonSafe { const obj: any = {}; @@ -465,13 +446,13 @@ function createBaseDocumentationRule(): DocumentationRule { export const DocumentationRule = { typeUrl: "/google.api.DocumentationRule", encode(message: DocumentationRule, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.selector !== "") { + if (message.selector !== undefined) { writer.uint32(10).string(message.selector); } - if (message.description !== "") { + if (message.description !== undefined) { writer.uint32(18).string(message.description); } - if (message.deprecationDescription !== "") { + if (message.deprecationDescription !== undefined) { writer.uint32(26).string(message.deprecationDescription); } return writer; @@ -500,11 +481,11 @@ export const DocumentationRule = { return message; }, fromJSON(object: any): DocumentationRule { - return { - selector: isSet(object.selector) ? String(object.selector) : "", - description: isSet(object.description) ? String(object.description) : "", - deprecationDescription: isSet(object.deprecationDescription) ? String(object.deprecationDescription) : "" - }; + const obj = createBaseDocumentationRule(); + if (isSet(object.selector)) obj.selector = String(object.selector); + if (isSet(object.description)) obj.description = String(object.description); + if (isSet(object.deprecationDescription)) obj.deprecationDescription = String(object.deprecationDescription); + return obj; }, toJSON(message: DocumentationRule): JsonSafe { const obj: any = {}; @@ -587,10 +568,10 @@ function createBasePage(): Page { export const Page = { typeUrl: "/google.api.Page", encode(message: Page, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.name !== "") { + if (message.name !== undefined) { writer.uint32(10).string(message.name); } - if (message.content !== "") { + if (message.content !== undefined) { writer.uint32(18).string(message.content); } for (const v of message.subpages) { @@ -622,11 +603,11 @@ export const Page = { return message; }, fromJSON(object: any): Page { - return { - name: isSet(object.name) ? String(object.name) : "", - content: isSet(object.content) ? String(object.content) : "", - subpages: Array.isArray(object?.subpages) ? object.subpages.map((e: any) => Page.fromJSON(e)) : [] - }; + const obj = createBasePage(); + if (isSet(object.name)) obj.name = String(object.name); + if (isSet(object.content)) obj.content = String(object.content); + if (Array.isArray(object?.subpages)) obj.subpages = object.subpages.map((e: any) => Page.fromJSON(e)); + return obj; }, toJSON(message: Page): JsonSafe { const obj: any = {}; diff --git a/__fixtures__/v-next/outputv4/google/api/endpoint.ts b/__fixtures__/v-next/outputv4/google/api/endpoint.ts index 1dbc68bce6..df0ef1e71e 100644 --- a/__fixtures__/v-next/outputv4/google/api/endpoint.ts +++ b/__fixtures__/v-next/outputv4/google/api/endpoint.ts @@ -1,7 +1,6 @@ -import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial } from "../../helpers"; -import { JsonSafe } from "../../json-safe"; -import { ComputedRef } from "vue"; +import { BinaryReader, BinaryWriter } from "../../binary.js"; +import { isSet, DeepPartial } from "../../helpers.js"; +import { JsonSafe } from "../../json-safe.js"; export const protobufPackage = "google.api"; /** * `Endpoint` describes a network endpoint of a service that serves a set of @@ -53,12 +52,6 @@ export interface Endpoint { */ allowCors: boolean; } -export interface ReactiveEndpoint { - name: ComputedRef; - aliases: ComputedRef; - target: ComputedRef; - allowCors: ComputedRef; -} export interface EndpointProtoMsg { typeUrl: "/google.api.Endpoint"; value: Uint8Array; @@ -99,16 +92,16 @@ function createBaseEndpoint(): Endpoint { export const Endpoint = { typeUrl: "/google.api.Endpoint", encode(message: Endpoint, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.name !== "") { + if (message.name !== undefined) { writer.uint32(10).string(message.name); } for (const v of message.aliases) { writer.uint32(18).string(v!); } - if (message.target !== "") { + if (message.target !== undefined) { writer.uint32(810).string(message.target); } - if (message.allowCors === true) { + if (message.allowCors !== undefined) { writer.uint32(40).bool(message.allowCors); } return writer; @@ -140,12 +133,12 @@ export const Endpoint = { return message; }, fromJSON(object: any): Endpoint { - return { - name: isSet(object.name) ? String(object.name) : "", - aliases: Array.isArray(object?.aliases) ? object.aliases.map((e: any) => String(e)) : [], - target: isSet(object.target) ? String(object.target) : "", - allowCors: isSet(object.allowCors) ? Boolean(object.allowCors) : false - }; + const obj = createBaseEndpoint(); + if (isSet(object.name)) obj.name = String(object.name); + if (Array.isArray(object?.aliases)) obj.aliases = object.aliases.map((e: any) => String(e)); + if (isSet(object.target)) obj.target = String(object.target); + if (isSet(object.allowCors)) obj.allowCors = Boolean(object.allowCors); + return obj; }, toJSON(message: Endpoint): JsonSafe { const obj: any = {}; diff --git a/__fixtures__/v-next/outputv4/google/api/error_reason.ts b/__fixtures__/v-next/outputv4/google/api/error_reason.ts index a30a484e8d..1052f8145d 100644 --- a/__fixtures__/v-next/outputv4/google/api/error_reason.ts +++ b/__fixtures__/v-next/outputv4/google/api/error_reason.ts @@ -1,4 +1,3 @@ -import { ComputedRef } from "vue"; export const protobufPackage = "google.api"; /** * Defines the supported values for `google.rpc.ErrorInfo.reason` for the 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 e1eaa38417..501ba956ec 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 @@ -1,11 +1,10 @@ -import { ParsedExpr, ParsedExprSDKType, SourcePosition, SourcePositionSDKType } from "../../v1alpha1/syntax"; -import { Decl, DeclSDKType, CheckedExpr, CheckedExprSDKType } from "../../v1alpha1/checked"; -import { ExprValue, ExprValueSDKType } from "../../v1alpha1/eval"; -import { Status, StatusSDKType } from "../../../../rpc/status"; -import { BinaryReader, BinaryWriter } from "../../../../../binary"; -import { isSet, DeepPartial, isObject } from "../../../../../helpers"; -import { JsonSafe } from "../../../../../json-safe"; -import { ComputedRef } from "vue"; +import { ParsedExpr, ParsedExprSDKType, SourcePosition, SourcePositionSDKType } from "../../v1alpha1/syntax.js"; +import { Decl, DeclSDKType, CheckedExpr, CheckedExprSDKType } from "../../v1alpha1/checked.js"; +import { ExprValue, ExprValueSDKType } from "../../v1alpha1/eval.js"; +import { Status, StatusSDKType } from "../../../../rpc/status.js"; +import { BinaryReader, BinaryWriter } from "../../../../../binary.js"; +import { isSet, DeepPartial, isObject } from "../../../../../helpers.js"; +import { JsonSafe } from "../../../../../json-safe.js"; export const protobufPackage = "google.api.expr.conformance.v1alpha1"; /** Severities of issues. */ export enum IssueDetails_Severity { @@ -69,12 +68,6 @@ export interface ParseRequest { /** Prevent macro expansion. See "Macros" in Language Defiinition. */ disableMacros: boolean; } -export interface ReactiveParseRequest { - celSource: ComputedRef; - syntaxVersion: ComputedRef; - sourceLocation: ComputedRef; - disableMacros: ComputedRef; -} export interface ParseRequestProtoMsg { typeUrl: "/google.api.expr.conformance.v1alpha1.ParseRequest"; value: Uint8Array; @@ -93,10 +86,6 @@ export interface ParseResponse { /** Any number of issues with [StatusDetails][] as the details. */ issues: Status[]; } -export interface ReactiveParseResponse { - parsedExpr?: ComputedRef; - issues: ComputedRef; -} export interface ParseResponseProtoMsg { typeUrl: "/google.api.expr.conformance.v1alpha1.ParseResponse"; value: Uint8Array; @@ -128,12 +117,6 @@ export interface CheckRequest { */ noStdEnv: boolean; } -export interface ReactiveCheckRequest { - parsedExpr?: ComputedRef; - typeEnv: ComputedRef; - container: ComputedRef; - noStdEnv: ComputedRef; -} export interface CheckRequestProtoMsg { typeUrl: "/google.api.expr.conformance.v1alpha1.CheckRequest"; value: Uint8Array; @@ -152,10 +135,6 @@ export interface CheckResponse { /** Any number of issues with [StatusDetails][] as the details. */ issues: Status[]; } -export interface ReactiveCheckResponse { - checkedExpr?: ComputedRef; - issues: ComputedRef; -} export interface CheckResponseProtoMsg { typeUrl: "/google.api.expr.conformance.v1alpha1.CheckResponse"; value: Uint8Array; @@ -169,10 +148,6 @@ export interface EvalRequest_BindingsEntry { key: string; value?: ExprValue; } -export interface ReactiveEvalRequest_BindingsEntry { - key: ComputedRef; - value?: ComputedRef; -} export interface EvalRequest_BindingsEntryProtoMsg { typeUrl: string; value: Uint8Array; @@ -197,14 +172,6 @@ export interface EvalRequest { /** SHOULD be the same container as used in [CheckRequest][google.api.expr.conformance.v1alpha1.CheckRequest], if checked. */ container: string; } -export interface ReactiveEvalRequest { - parsedExpr?: ComputedRef; - checkedExpr?: ComputedRef; - bindings: ComputedRef<{ - [key: string]: ExprValue; - }>; - container: ComputedRef; -} export interface EvalRequestProtoMsg { typeUrl: "/google.api.expr.conformance.v1alpha1.EvalRequest"; value: Uint8Array; @@ -230,10 +197,6 @@ export interface EvalResponse { */ issues: Status[]; } -export interface ReactiveEvalResponse { - result?: ComputedRef; - issues: ComputedRef; -} export interface EvalResponseProtoMsg { typeUrl: "/google.api.expr.conformance.v1alpha1.EvalResponse"; value: Uint8Array; @@ -256,11 +219,6 @@ export interface IssueDetails { /** Expression ID from [Expr][], 0 if unknown. */ id: bigint; } -export interface ReactiveIssueDetails { - severity: ComputedRef; - position?: ComputedRef; - id: ComputedRef; -} export interface IssueDetailsProtoMsg { typeUrl: "/google.api.expr.conformance.v1alpha1.IssueDetails"; value: Uint8Array; @@ -286,16 +244,16 @@ function createBaseParseRequest(): ParseRequest { export const ParseRequest = { typeUrl: "/google.api.expr.conformance.v1alpha1.ParseRequest", encode(message: ParseRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.celSource !== "") { + if (message.celSource !== undefined) { writer.uint32(10).string(message.celSource); } - if (message.syntaxVersion !== "") { + if (message.syntaxVersion !== undefined) { writer.uint32(18).string(message.syntaxVersion); } - if (message.sourceLocation !== "") { + if (message.sourceLocation !== undefined) { writer.uint32(26).string(message.sourceLocation); } - if (message.disableMacros === true) { + if (message.disableMacros !== undefined) { writer.uint32(32).bool(message.disableMacros); } return writer; @@ -327,12 +285,12 @@ export const ParseRequest = { return message; }, fromJSON(object: any): ParseRequest { - return { - celSource: isSet(object.celSource) ? String(object.celSource) : "", - syntaxVersion: isSet(object.syntaxVersion) ? String(object.syntaxVersion) : "", - sourceLocation: isSet(object.sourceLocation) ? String(object.sourceLocation) : "", - disableMacros: isSet(object.disableMacros) ? Boolean(object.disableMacros) : false - }; + const obj = createBaseParseRequest(); + if (isSet(object.celSource)) obj.celSource = String(object.celSource); + if (isSet(object.syntaxVersion)) obj.syntaxVersion = String(object.syntaxVersion); + if (isSet(object.sourceLocation)) obj.sourceLocation = String(object.sourceLocation); + if (isSet(object.disableMacros)) obj.disableMacros = Boolean(object.disableMacros); + return obj; }, toJSON(message: ParseRequest): JsonSafe { const obj: any = {}; @@ -452,10 +410,10 @@ export const ParseResponse = { return message; }, fromJSON(object: any): ParseResponse { - return { - parsedExpr: isSet(object.parsedExpr) ? ParsedExpr.fromJSON(object.parsedExpr) : undefined, - issues: Array.isArray(object?.issues) ? object.issues.map((e: any) => Status.fromJSON(e)) : [] - }; + const obj = createBaseParseResponse(); + if (isSet(object.parsedExpr)) obj.parsedExpr = ParsedExpr.fromJSON(object.parsedExpr); + if (Array.isArray(object?.issues)) obj.issues = object.issues.map((e: any) => Status.fromJSON(e)); + return obj; }, toJSON(message: ParseResponse): JsonSafe { const obj: any = {}; @@ -469,7 +427,9 @@ export const ParseResponse = { }, fromPartial(object: DeepPartial): ParseResponse { const message = createBaseParseResponse(); - message.parsedExpr = object.parsedExpr !== undefined && object.parsedExpr !== null ? ParsedExpr.fromPartial(object.parsedExpr) : undefined; + if (object.parsedExpr !== undefined && object.parsedExpr !== null) { + message.parsedExpr = ParsedExpr.fromPartial(object.parsedExpr); + } message.issues = object.issues?.map(e => Status.fromPartial(e)) || []; return message; }, @@ -546,10 +506,10 @@ export const CheckRequest = { for (const v of message.typeEnv) { Decl.encode(v!, writer.uint32(18).fork()).ldelim(); } - if (message.container !== "") { + if (message.container !== undefined) { writer.uint32(26).string(message.container); } - if (message.noStdEnv === true) { + if (message.noStdEnv !== undefined) { writer.uint32(32).bool(message.noStdEnv); } return writer; @@ -581,12 +541,12 @@ export const CheckRequest = { return message; }, fromJSON(object: any): CheckRequest { - return { - parsedExpr: isSet(object.parsedExpr) ? ParsedExpr.fromJSON(object.parsedExpr) : undefined, - typeEnv: Array.isArray(object?.typeEnv) ? object.typeEnv.map((e: any) => Decl.fromJSON(e)) : [], - container: isSet(object.container) ? String(object.container) : "", - noStdEnv: isSet(object.noStdEnv) ? Boolean(object.noStdEnv) : false - }; + const obj = createBaseCheckRequest(); + if (isSet(object.parsedExpr)) obj.parsedExpr = ParsedExpr.fromJSON(object.parsedExpr); + if (Array.isArray(object?.typeEnv)) obj.typeEnv = object.typeEnv.map((e: any) => Decl.fromJSON(e)); + if (isSet(object.container)) obj.container = String(object.container); + if (isSet(object.noStdEnv)) obj.noStdEnv = Boolean(object.noStdEnv); + return obj; }, toJSON(message: CheckRequest): JsonSafe { const obj: any = {}; @@ -602,7 +562,9 @@ export const CheckRequest = { }, fromPartial(object: DeepPartial): CheckRequest { const message = createBaseCheckRequest(); - message.parsedExpr = object.parsedExpr !== undefined && object.parsedExpr !== null ? ParsedExpr.fromPartial(object.parsedExpr) : undefined; + if (object.parsedExpr !== undefined && object.parsedExpr !== null) { + message.parsedExpr = ParsedExpr.fromPartial(object.parsedExpr); + } message.typeEnv = object.typeEnv?.map(e => Decl.fromPartial(e)) || []; message.container = object.container ?? ""; message.noStdEnv = object.noStdEnv ?? false; @@ -716,10 +678,10 @@ export const CheckResponse = { return message; }, fromJSON(object: any): CheckResponse { - return { - checkedExpr: isSet(object.checkedExpr) ? CheckedExpr.fromJSON(object.checkedExpr) : undefined, - issues: Array.isArray(object?.issues) ? object.issues.map((e: any) => Status.fromJSON(e)) : [] - }; + const obj = createBaseCheckResponse(); + if (isSet(object.checkedExpr)) obj.checkedExpr = CheckedExpr.fromJSON(object.checkedExpr); + if (Array.isArray(object?.issues)) obj.issues = object.issues.map((e: any) => Status.fromJSON(e)); + return obj; }, toJSON(message: CheckResponse): JsonSafe { const obj: any = {}; @@ -733,7 +695,9 @@ export const CheckResponse = { }, fromPartial(object: DeepPartial): CheckResponse { const message = createBaseCheckResponse(); - message.checkedExpr = object.checkedExpr !== undefined && object.checkedExpr !== null ? CheckedExpr.fromPartial(object.checkedExpr) : undefined; + if (object.checkedExpr !== undefined && object.checkedExpr !== null) { + message.checkedExpr = CheckedExpr.fromPartial(object.checkedExpr); + } message.issues = object.issues?.map(e => Status.fromPartial(e)) || []; return message; }, @@ -801,7 +765,7 @@ function createBaseEvalRequest_BindingsEntry(): EvalRequest_BindingsEntry { } export const EvalRequest_BindingsEntry = { encode(message: EvalRequest_BindingsEntry, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.key !== "") { + if (message.key !== undefined) { writer.uint32(10).string(message.key); } if (message.value !== undefined) { @@ -830,10 +794,10 @@ export const EvalRequest_BindingsEntry = { return message; }, fromJSON(object: any): EvalRequest_BindingsEntry { - return { - key: isSet(object.key) ? String(object.key) : "", - value: isSet(object.value) ? ExprValue.fromJSON(object.value) : undefined - }; + 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): JsonSafe { const obj: any = {}; @@ -844,7 +808,9 @@ export const EvalRequest_BindingsEntry = { fromPartial(object: DeepPartial): EvalRequest_BindingsEntry { const message = createBaseEvalRequest_BindingsEntry(); message.key = object.key ?? ""; - message.value = object.value !== undefined && object.value !== null ? ExprValue.fromPartial(object.value) : undefined; + if (object.value !== undefined && object.value !== null) { + message.value = ExprValue.fromPartial(object.value); + } return message; }, fromSDK(object: EvalRequest_BindingsEntrySDKType): EvalRequest_BindingsEntry { @@ -914,7 +880,7 @@ export const EvalRequest = { value }, writer.uint32(26).fork()).ldelim(); }); - if (message.container !== "") { + if (message.container !== undefined) { writer.uint32(34).string(message.container); } return writer; @@ -949,17 +915,17 @@ export const EvalRequest = { return message; }, fromJSON(object: any): EvalRequest { - return { - parsedExpr: isSet(object.parsedExpr) ? ParsedExpr.fromJSON(object.parsedExpr) : undefined, - checkedExpr: isSet(object.checkedExpr) ? CheckedExpr.fromJSON(object.checkedExpr) : undefined, - bindings: isObject(object.bindings) ? Object.entries(object.bindings).reduce<{ - [key: string]: ExprValue; - }>((acc, [key, value]) => { - acc[key] = ExprValue.fromJSON(value); - return acc; - }, {}) : {}, - container: isSet(object.container) ? String(object.container) : "" - }; + const obj = createBaseEvalRequest(); + if (isSet(object.parsedExpr)) obj.parsedExpr = ParsedExpr.fromJSON(object.parsedExpr); + if (isSet(object.checkedExpr)) obj.checkedExpr = CheckedExpr.fromJSON(object.checkedExpr); + 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 (isSet(object.container)) obj.container = String(object.container); + return obj; }, toJSON(message: EvalRequest): JsonSafe { const obj: any = {}; @@ -976,8 +942,12 @@ export const EvalRequest = { }, fromPartial(object: DeepPartial): EvalRequest { const message = createBaseEvalRequest(); - message.parsedExpr = object.parsedExpr !== undefined && object.parsedExpr !== null ? ParsedExpr.fromPartial(object.parsedExpr) : undefined; - message.checkedExpr = object.checkedExpr !== undefined && object.checkedExpr !== null ? CheckedExpr.fromPartial(object.checkedExpr) : undefined; + if (object.parsedExpr !== undefined && object.parsedExpr !== null) { + message.parsedExpr = ParsedExpr.fromPartial(object.parsedExpr); + } + if (object.checkedExpr !== undefined && object.checkedExpr !== null) { + message.checkedExpr = CheckedExpr.fromPartial(object.checkedExpr); + } message.bindings = Object.entries(object.bindings ?? {}).reduce<{ [key: string]: ExprValue; }>((acc, [key, value]) => { @@ -1116,10 +1086,10 @@ export const EvalResponse = { return message; }, fromJSON(object: any): EvalResponse { - return { - result: isSet(object.result) ? ExprValue.fromJSON(object.result) : undefined, - issues: Array.isArray(object?.issues) ? object.issues.map((e: any) => Status.fromJSON(e)) : [] - }; + const obj = createBaseEvalResponse(); + if (isSet(object.result)) obj.result = ExprValue.fromJSON(object.result); + if (Array.isArray(object?.issues)) obj.issues = object.issues.map((e: any) => Status.fromJSON(e)); + return obj; }, toJSON(message: EvalResponse): JsonSafe { const obj: any = {}; @@ -1133,7 +1103,9 @@ export const EvalResponse = { }, fromPartial(object: DeepPartial): EvalResponse { const message = createBaseEvalResponse(); - message.result = object.result !== undefined && object.result !== null ? ExprValue.fromPartial(object.result) : undefined; + if (object.result !== undefined && object.result !== null) { + message.result = ExprValue.fromPartial(object.result); + } message.issues = object.issues?.map(e => Status.fromPartial(e)) || []; return message; }, @@ -1209,7 +1181,7 @@ export const IssueDetails = { if (message.position !== undefined) { SourcePosition.encode(message.position, writer.uint32(18).fork()).ldelim(); } - if (message.id !== BigInt(0)) { + if (message.id !== undefined) { writer.uint32(24).int64(message.id); } return writer; @@ -1238,11 +1210,11 @@ export const IssueDetails = { return message; }, fromJSON(object: any): IssueDetails { - return { - severity: isSet(object.severity) ? issueDetails_SeverityFromJSON(object.severity) : -1, - position: isSet(object.position) ? SourcePosition.fromJSON(object.position) : undefined, - id: isSet(object.id) ? BigInt(object.id.toString()) : BigInt(0) - }; + const obj = createBaseIssueDetails(); + if (isSet(object.severity)) obj.severity = issueDetails_SeverityFromJSON(object.severity); + if (isSet(object.position)) obj.position = SourcePosition.fromJSON(object.position); + if (isSet(object.id)) obj.id = BigInt(object.id.toString()); + return obj; }, toJSON(message: IssueDetails): JsonSafe { const obj: any = {}; @@ -1254,8 +1226,12 @@ export const IssueDetails = { fromPartial(object: DeepPartial): IssueDetails { const message = createBaseIssueDetails(); message.severity = object.severity ?? 0; - message.position = object.position !== undefined && object.position !== null ? SourcePosition.fromPartial(object.position) : undefined; - message.id = object.id !== undefined && object.id !== null ? BigInt(object.id.toString()) : BigInt(0); + if (object.position !== undefined && object.position !== null) { + message.position = SourcePosition.fromPartial(object.position); + } + if (object.id !== undefined && object.id !== null) { + message.id = BigInt(object.id.toString()); + } return message; }, fromSDK(object: IssueDetailsSDKType): 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 a9c14dfa4f..893f1e63f0 100644 --- a/__fixtures__/v-next/outputv4/google/api/expr/v1alpha1/checked.ts +++ b/__fixtures__/v-next/outputv4/google/api/expr/v1alpha1/checked.ts @@ -1,10 +1,9 @@ -import { SourceInfo, SourceInfoSDKType, Expr, ExprSDKType, Constant, ConstantSDKType } from "./syntax"; -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 { JsonSafe } from "../../../../json-safe"; -import { ComputedRef } from "vue"; +import { SourceInfo, SourceInfoSDKType, Expr, ExprSDKType, Constant, ConstantSDKType } from "./syntax.js"; +import { Empty, EmptySDKType } from "../../../protobuf/empty.js"; +import { NullValue, NullValueSDKType, nullValueFromJSON, nullValueToJSON } from "../../../protobuf/struct.js"; +import { BinaryReader, BinaryWriter } from "../../../../binary.js"; +import { isSet, DeepPartial, isObject } from "../../../../helpers.js"; +import { JsonSafe } from "../../../../json-safe.js"; export const protobufPackage = "google.api.expr.v1alpha1"; /** CEL primitive types. */ export enum Type_PrimitiveType { @@ -145,10 +144,6 @@ export interface CheckedExpr_ReferenceMapEntry { key: bigint; value?: Reference; } -export interface ReactiveCheckedExpr_ReferenceMapEntry { - key: ComputedRef; - value?: ComputedRef; -} export interface CheckedExpr_ReferenceMapEntryProtoMsg { typeUrl: string; value: Uint8Array; @@ -161,10 +156,6 @@ export interface CheckedExpr_TypeMapEntry { key: bigint; value?: Type; } -export interface ReactiveCheckedExpr_TypeMapEntry { - key: ComputedRef; - value?: ComputedRef; -} export interface CheckedExpr_TypeMapEntryProtoMsg { typeUrl: string; value: Uint8Array; @@ -226,17 +217,6 @@ export interface CheckedExpr { */ expr?: Expr; } -export interface ReactiveCheckedExpr { - referenceMap: ComputedRef<{ - [key: bigint]: Reference; - }>; - typeMap: ComputedRef<{ - [key: bigint]: Type; - }>; - sourceInfo?: ComputedRef; - exprVersion: ComputedRef; - expr?: ComputedRef; -} export interface CheckedExprProtoMsg { typeUrl: "/google.api.expr.v1alpha1.CheckedExpr"; value: Uint8Array; @@ -304,21 +284,6 @@ export interface Type { /** Abstract, application defined type. */ abstractType?: Type_AbstractType; } -export interface ReactiveType { - dyn?: ComputedRef; - null?: ComputedRef; - primitive?: ComputedRef; - wrapper?: ComputedRef; - wellKnown?: ComputedRef; - listType?: ComputedRef; - mapType?: ComputedRef; - function?: ComputedRef; - messageType?: ComputedRef; - typeParam?: ComputedRef; - type?: ComputedRef; - error?: ComputedRef; - abstractType?: ComputedRef; -} export interface TypeProtoMsg { typeUrl: "/google.api.expr.v1alpha1.Type"; value: Uint8Array; @@ -344,9 +309,6 @@ export interface Type_ListType { /** The element type. */ elemType?: Type; } -export interface ReactiveType_ListType { - elemType?: ComputedRef; -} export interface Type_ListTypeProtoMsg { typeUrl: "/google.api.expr.v1alpha1.ListType"; value: Uint8Array; @@ -362,10 +324,6 @@ export interface Type_MapType { /** The type of the value. */ valueType?: Type; } -export interface ReactiveType_MapType { - keyType?: ComputedRef; - valueType?: ComputedRef; -} export interface Type_MapTypeProtoMsg { typeUrl: "/google.api.expr.v1alpha1.MapType"; value: Uint8Array; @@ -382,10 +340,6 @@ export interface Type_FunctionType { /** Argument types of the function. */ argTypes: Type[]; } -export interface ReactiveType_FunctionType { - resultType?: ComputedRef; - argTypes: ComputedRef; -} export interface Type_FunctionTypeProtoMsg { typeUrl: "/google.api.expr.v1alpha1.FunctionType"; value: Uint8Array; @@ -402,10 +356,6 @@ export interface Type_AbstractType { /** Parameter types for this abstract type. */ parameterTypes: Type[]; } -export interface ReactiveType_AbstractType { - name: ComputedRef; - parameterTypes: ComputedRef; -} export interface Type_AbstractTypeProtoMsg { typeUrl: "/google.api.expr.v1alpha1.AbstractType"; value: Uint8Array; @@ -438,11 +388,6 @@ export interface Decl { /** Function declaration. */ function?: Decl_FunctionDecl; } -export interface ReactiveDecl { - name: ComputedRef; - ident?: ComputedRef; - function?: ComputedRef; -} export interface DeclProtoMsg { typeUrl: "/google.api.expr.v1alpha1.Decl"; value: Uint8Array; @@ -477,11 +422,6 @@ export interface Decl_IdentDecl { /** Documentation string for the identifier. */ doc: string; } -export interface ReactiveDecl_IdentDecl { - type?: ComputedRef; - value?: ComputedRef; - doc: ComputedRef; -} export interface Decl_IdentDeclProtoMsg { typeUrl: "/google.api.expr.v1alpha1.IdentDecl"; value: Uint8Array; @@ -510,9 +450,6 @@ export interface Decl_FunctionDecl { /** Required. List of function overloads, must contain at least one overload. */ overloads: Decl_FunctionDecl_Overload[]; } -export interface ReactiveDecl_FunctionDecl { - overloads: ComputedRef; -} export interface Decl_FunctionDeclProtoMsg { typeUrl: "/google.api.expr.v1alpha1.FunctionDecl"; value: Uint8Array; @@ -584,14 +521,6 @@ export interface Decl_FunctionDecl_Overload { /** Documentation string for the overload. */ doc: string; } -export interface ReactiveDecl_FunctionDecl_Overload { - overloadId: ComputedRef; - params: ComputedRef; - typeParams: ComputedRef; - resultType?: ComputedRef; - isInstanceFunction: ComputedRef; - doc: ComputedRef; -} export interface Decl_FunctionDecl_OverloadProtoMsg { typeUrl: "/google.api.expr.v1alpha1.Overload"; value: Uint8Array; @@ -637,11 +566,6 @@ export interface Reference { */ value?: Constant; } -export interface ReactiveReference { - name: ComputedRef; - overloadId: ComputedRef; - value?: ComputedRef; -} export interface ReferenceProtoMsg { typeUrl: "/google.api.expr.v1alpha1.Reference"; value: Uint8Array; @@ -660,7 +584,7 @@ function createBaseCheckedExpr_ReferenceMapEntry(): CheckedExpr_ReferenceMapEntr } export const CheckedExpr_ReferenceMapEntry = { encode(message: CheckedExpr_ReferenceMapEntry, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.key !== BigInt(0)) { + if (message.key !== undefined) { writer.uint32(8).int64(message.key); } if (message.value !== undefined) { @@ -689,10 +613,10 @@ export const CheckedExpr_ReferenceMapEntry = { return message; }, fromJSON(object: any): CheckedExpr_ReferenceMapEntry { - return { - key: isSet(object.key) ? BigInt(object.key.toString()) : BigInt(0), - value: isSet(object.value) ? Reference.fromJSON(object.value) : undefined - }; + const obj = createBaseCheckedExpr_ReferenceMapEntry(); + if (isSet(object.key)) obj.key = BigInt(object.key.toString()); + if (isSet(object.value)) obj.value = Reference.fromJSON(object.value); + return obj; }, toJSON(message: CheckedExpr_ReferenceMapEntry): JsonSafe { const obj: any = {}; @@ -702,8 +626,12 @@ export const CheckedExpr_ReferenceMapEntry = { }, fromPartial(object: DeepPartial): CheckedExpr_ReferenceMapEntry { const message = createBaseCheckedExpr_ReferenceMapEntry(); - message.key = object.key !== undefined && object.key !== null ? BigInt(object.key.toString()) : BigInt(0); - message.value = object.value !== undefined && object.value !== null ? Reference.fromPartial(object.value) : undefined; + if (object.key !== undefined && object.key !== null) { + message.key = BigInt(object.key.toString()); + } + if (object.value !== undefined && object.value !== null) { + message.value = Reference.fromPartial(object.value); + } return message; }, fromSDK(object: CheckedExpr_ReferenceMapEntrySDKType): CheckedExpr_ReferenceMapEntry { @@ -758,7 +686,7 @@ function createBaseCheckedExpr_TypeMapEntry(): CheckedExpr_TypeMapEntry { } export const CheckedExpr_TypeMapEntry = { encode(message: CheckedExpr_TypeMapEntry, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.key !== BigInt(0)) { + if (message.key !== undefined) { writer.uint32(8).int64(message.key); } if (message.value !== undefined) { @@ -787,10 +715,10 @@ export const CheckedExpr_TypeMapEntry = { return message; }, fromJSON(object: any): CheckedExpr_TypeMapEntry { - return { - key: isSet(object.key) ? BigInt(object.key.toString()) : BigInt(0), - value: isSet(object.value) ? Type.fromJSON(object.value) : undefined - }; + const obj = createBaseCheckedExpr_TypeMapEntry(); + if (isSet(object.key)) obj.key = BigInt(object.key.toString()); + if (isSet(object.value)) obj.value = Type.fromJSON(object.value); + return obj; }, toJSON(message: CheckedExpr_TypeMapEntry): JsonSafe { const obj: any = {}; @@ -800,8 +728,12 @@ export const CheckedExpr_TypeMapEntry = { }, fromPartial(object: DeepPartial): CheckedExpr_TypeMapEntry { const message = createBaseCheckedExpr_TypeMapEntry(); - message.key = object.key !== undefined && object.key !== null ? BigInt(object.key.toString()) : BigInt(0); - message.value = object.value !== undefined && object.value !== null ? Type.fromPartial(object.value) : undefined; + if (object.key !== undefined && object.key !== null) { + message.key = BigInt(object.key.toString()); + } + if (object.value !== undefined && object.value !== null) { + message.value = Type.fromPartial(object.value); + } return message; }, fromSDK(object: CheckedExpr_TypeMapEntrySDKType): CheckedExpr_TypeMapEntry { @@ -875,7 +807,7 @@ export const CheckedExpr = { if (message.sourceInfo !== undefined) { SourceInfo.encode(message.sourceInfo, writer.uint32(42).fork()).ldelim(); } - if (message.exprVersion !== "") { + if (message.exprVersion !== undefined) { writer.uint32(50).string(message.exprVersion); } if (message.expr !== undefined) { @@ -919,23 +851,23 @@ export const CheckedExpr = { return message; }, fromJSON(object: any): CheckedExpr { - return { - referenceMap: isObject(object.referenceMap) ? Object.entries(object.referenceMap).reduce<{ - [key: bigint]: Reference; - }>((acc, [key, value]) => { - acc[Number(key)] = Reference.fromJSON(value); - return acc; - }, {}) : {}, - typeMap: isObject(object.typeMap) ? Object.entries(object.typeMap).reduce<{ - [key: bigint]: Type; - }>((acc, [key, value]) => { - acc[Number(key)] = Type.fromJSON(value); - return acc; - }, {}) : {}, - sourceInfo: isSet(object.sourceInfo) ? SourceInfo.fromJSON(object.sourceInfo) : undefined, - exprVersion: isSet(object.exprVersion) ? String(object.exprVersion) : "", - expr: isSet(object.expr) ? Expr.fromJSON(object.expr) : undefined - }; + const obj = createBaseCheckedExpr(); + if (isObject(object.referenceMap)) obj.referenceMap = Object.entries(object.referenceMap).reduce<{ + [key: bigint]: Reference; + }>((acc, [key, value]) => { + acc[Number(key)] = Reference.fromJSON(value); + return acc; + }, {}); + if (isObject(object.typeMap)) obj.typeMap = Object.entries(object.typeMap).reduce<{ + [key: bigint]: Type; + }>((acc, [key, value]) => { + acc[Number(key)] = Type.fromJSON(value); + return acc; + }, {}); + if (isSet(object.sourceInfo)) obj.sourceInfo = SourceInfo.fromJSON(object.sourceInfo); + if (isSet(object.exprVersion)) obj.exprVersion = String(object.exprVersion); + if (isSet(object.expr)) obj.expr = Expr.fromJSON(object.expr); + return obj; }, toJSON(message: CheckedExpr): JsonSafe { const obj: any = {}; @@ -974,9 +906,13 @@ export const CheckedExpr = { } return acc; }, {}); - message.sourceInfo = object.sourceInfo !== undefined && object.sourceInfo !== null ? SourceInfo.fromPartial(object.sourceInfo) : undefined; + if (object.sourceInfo !== undefined && object.sourceInfo !== null) { + message.sourceInfo = SourceInfo.fromPartial(object.sourceInfo); + } message.exprVersion = object.exprVersion ?? ""; - message.expr = object.expr !== undefined && object.expr !== null ? Expr.fromPartial(object.expr) : undefined; + if (object.expr !== undefined && object.expr !== null) { + message.expr = Expr.fromPartial(object.expr); + } return message; }, fromSDK(object: CheckedExprSDKType): CheckedExpr { @@ -1215,21 +1151,21 @@ export const Type = { return message; }, fromJSON(object: any): Type { - return { - dyn: isSet(object.dyn) ? Empty.fromJSON(object.dyn) : undefined, - null: isSet(object.null) ? nullValueFromJSON(object.null) : undefined, - primitive: isSet(object.primitive) ? type_PrimitiveTypeFromJSON(object.primitive) : undefined, - wrapper: isSet(object.wrapper) ? type_PrimitiveTypeFromJSON(object.wrapper) : undefined, - wellKnown: isSet(object.wellKnown) ? type_WellKnownTypeFromJSON(object.wellKnown) : undefined, - listType: isSet(object.listType) ? Type_ListType.fromJSON(object.listType) : undefined, - mapType: isSet(object.mapType) ? Type_MapType.fromJSON(object.mapType) : undefined, - function: isSet(object.function) ? Type_FunctionType.fromJSON(object.function) : undefined, - messageType: isSet(object.messageType) ? String(object.messageType) : undefined, - typeParam: isSet(object.typeParam) ? String(object.typeParam) : undefined, - type: isSet(object.type) ? Type.fromJSON(object.type) : undefined, - error: isSet(object.error) ? Empty.fromJSON(object.error) : undefined, - abstractType: isSet(object.abstractType) ? Type_AbstractType.fromJSON(object.abstractType) : undefined - }; + const obj = createBaseType(); + if (isSet(object.dyn)) obj.dyn = Empty.fromJSON(object.dyn); + if (isSet(object.null)) obj.null = nullValueFromJSON(object.null); + if (isSet(object.primitive)) obj.primitive = type_PrimitiveTypeFromJSON(object.primitive); + if (isSet(object.wrapper)) obj.wrapper = type_PrimitiveTypeFromJSON(object.wrapper); + if (isSet(object.wellKnown)) obj.wellKnown = type_WellKnownTypeFromJSON(object.wellKnown); + if (isSet(object.listType)) obj.listType = Type_ListType.fromJSON(object.listType); + if (isSet(object.mapType)) obj.mapType = Type_MapType.fromJSON(object.mapType); + if (isSet(object.function)) obj.function = Type_FunctionType.fromJSON(object.function); + if (isSet(object.messageType)) obj.messageType = String(object.messageType); + if (isSet(object.typeParam)) obj.typeParam = String(object.typeParam); + if (isSet(object.type)) obj.type = Type.fromJSON(object.type); + if (isSet(object.error)) obj.error = Empty.fromJSON(object.error); + if (isSet(object.abstractType)) obj.abstractType = Type_AbstractType.fromJSON(object.abstractType); + return obj; }, toJSON(message: Type): JsonSafe { const obj: any = {}; @@ -1250,19 +1186,33 @@ export const Type = { }, fromPartial(object: DeepPartial): Type { const message = createBaseType(); - message.dyn = object.dyn !== undefined && object.dyn !== null ? Empty.fromPartial(object.dyn) : undefined; + if (object.dyn !== undefined && object.dyn !== null) { + message.dyn = Empty.fromPartial(object.dyn); + } message.null = object.null ?? undefined; message.primitive = object.primitive ?? undefined; message.wrapper = object.wrapper ?? undefined; message.wellKnown = object.wellKnown ?? undefined; - message.listType = object.listType !== undefined && object.listType !== null ? Type_ListType.fromPartial(object.listType) : undefined; - message.mapType = object.mapType !== undefined && object.mapType !== null ? Type_MapType.fromPartial(object.mapType) : undefined; - message.function = object.function !== undefined && object.function !== null ? Type_FunctionType.fromPartial(object.function) : undefined; + if (object.listType !== undefined && object.listType !== null) { + message.listType = Type_ListType.fromPartial(object.listType); + } + if (object.mapType !== undefined && object.mapType !== null) { + message.mapType = Type_MapType.fromPartial(object.mapType); + } + if (object.function !== undefined && object.function !== null) { + message.function = Type_FunctionType.fromPartial(object.function); + } message.messageType = object.messageType ?? undefined; message.typeParam = object.typeParam ?? undefined; - message.type = object.type !== undefined && object.type !== null ? Type.fromPartial(object.type) : undefined; - message.error = object.error !== undefined && object.error !== null ? Empty.fromPartial(object.error) : undefined; - message.abstractType = object.abstractType !== undefined && object.abstractType !== null ? Type_AbstractType.fromPartial(object.abstractType) : undefined; + if (object.type !== undefined && object.type !== null) { + message.type = Type.fromPartial(object.type); + } + if (object.error !== undefined && object.error !== null) { + message.error = Empty.fromPartial(object.error); + } + if (object.abstractType !== undefined && object.abstractType !== null) { + message.abstractType = Type_AbstractType.fromPartial(object.abstractType); + } return message; }, fromSDK(object: TypeSDKType): Type { @@ -1423,9 +1373,9 @@ export const Type_ListType = { return message; }, fromJSON(object: any): Type_ListType { - return { - elemType: isSet(object.elemType) ? Type.fromJSON(object.elemType) : undefined - }; + const obj = createBaseType_ListType(); + if (isSet(object.elemType)) obj.elemType = Type.fromJSON(object.elemType); + return obj; }, toJSON(message: Type_ListType): JsonSafe { const obj: any = {}; @@ -1434,7 +1384,9 @@ export const Type_ListType = { }, fromPartial(object: DeepPartial): Type_ListType { const message = createBaseType_ListType(); - message.elemType = object.elemType !== undefined && object.elemType !== null ? Type.fromPartial(object.elemType) : undefined; + if (object.elemType !== undefined && object.elemType !== null) { + message.elemType = Type.fromPartial(object.elemType); + } return message; }, fromSDK(object: Type_ListTypeSDKType): Type_ListType { @@ -1518,10 +1470,10 @@ export const Type_MapType = { return message; }, fromJSON(object: any): Type_MapType { - return { - keyType: isSet(object.keyType) ? Type.fromJSON(object.keyType) : undefined, - valueType: isSet(object.valueType) ? Type.fromJSON(object.valueType) : undefined - }; + const obj = createBaseType_MapType(); + if (isSet(object.keyType)) obj.keyType = Type.fromJSON(object.keyType); + if (isSet(object.valueType)) obj.valueType = Type.fromJSON(object.valueType); + return obj; }, toJSON(message: Type_MapType): JsonSafe { const obj: any = {}; @@ -1531,8 +1483,12 @@ export const Type_MapType = { }, fromPartial(object: DeepPartial): Type_MapType { const message = createBaseType_MapType(); - message.keyType = object.keyType !== undefined && object.keyType !== null ? Type.fromPartial(object.keyType) : undefined; - message.valueType = object.valueType !== undefined && object.valueType !== null ? Type.fromPartial(object.valueType) : undefined; + if (object.keyType !== undefined && object.keyType !== null) { + message.keyType = Type.fromPartial(object.keyType); + } + if (object.valueType !== undefined && object.valueType !== null) { + message.valueType = Type.fromPartial(object.valueType); + } return message; }, fromSDK(object: Type_MapTypeSDKType): Type_MapType { @@ -1623,10 +1579,10 @@ export const Type_FunctionType = { return message; }, fromJSON(object: any): Type_FunctionType { - return { - resultType: isSet(object.resultType) ? Type.fromJSON(object.resultType) : undefined, - argTypes: Array.isArray(object?.argTypes) ? object.argTypes.map((e: any) => Type.fromJSON(e)) : [] - }; + const obj = createBaseType_FunctionType(); + if (isSet(object.resultType)) obj.resultType = Type.fromJSON(object.resultType); + if (Array.isArray(object?.argTypes)) obj.argTypes = object.argTypes.map((e: any) => Type.fromJSON(e)); + return obj; }, toJSON(message: Type_FunctionType): JsonSafe { const obj: any = {}; @@ -1640,7 +1596,9 @@ export const Type_FunctionType = { }, fromPartial(object: DeepPartial): Type_FunctionType { const message = createBaseType_FunctionType(); - message.resultType = object.resultType !== undefined && object.resultType !== null ? Type.fromPartial(object.resultType) : undefined; + if (object.resultType !== undefined && object.resultType !== null) { + message.resultType = Type.fromPartial(object.resultType); + } message.argTypes = object.argTypes?.map(e => Type.fromPartial(e)) || []; return message; }, @@ -1709,7 +1667,7 @@ function createBaseType_AbstractType(): Type_AbstractType { export const Type_AbstractType = { typeUrl: "/google.api.expr.v1alpha1.AbstractType", encode(message: Type_AbstractType, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.name !== "") { + if (message.name !== undefined) { writer.uint32(10).string(message.name); } for (const v of message.parameterTypes) { @@ -1738,10 +1696,10 @@ export const Type_AbstractType = { return message; }, fromJSON(object: any): Type_AbstractType { - return { - name: isSet(object.name) ? String(object.name) : "", - parameterTypes: Array.isArray(object?.parameterTypes) ? object.parameterTypes.map((e: any) => Type.fromJSON(e)) : [] - }; + const obj = createBaseType_AbstractType(); + if (isSet(object.name)) obj.name = String(object.name); + if (Array.isArray(object?.parameterTypes)) obj.parameterTypes = object.parameterTypes.map((e: any) => Type.fromJSON(e)); + return obj; }, toJSON(message: Type_AbstractType): JsonSafe { const obj: any = {}; @@ -1825,7 +1783,7 @@ function createBaseDecl(): Decl { export const Decl = { typeUrl: "/google.api.expr.v1alpha1.Decl", encode(message: Decl, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.name !== "") { + if (message.name !== undefined) { writer.uint32(10).string(message.name); } if (message.ident !== undefined) { @@ -1860,11 +1818,11 @@ export const Decl = { return message; }, fromJSON(object: any): Decl { - return { - name: isSet(object.name) ? String(object.name) : "", - ident: isSet(object.ident) ? Decl_IdentDecl.fromJSON(object.ident) : undefined, - function: isSet(object.function) ? Decl_FunctionDecl.fromJSON(object.function) : undefined - }; + const obj = createBaseDecl(); + if (isSet(object.name)) obj.name = String(object.name); + if (isSet(object.ident)) obj.ident = Decl_IdentDecl.fromJSON(object.ident); + if (isSet(object.function)) obj.function = Decl_FunctionDecl.fromJSON(object.function); + return obj; }, toJSON(message: Decl): JsonSafe { const obj: any = {}; @@ -1876,8 +1834,12 @@ export const Decl = { fromPartial(object: DeepPartial): Decl { const message = createBaseDecl(); message.name = object.name ?? ""; - message.ident = object.ident !== undefined && object.ident !== null ? Decl_IdentDecl.fromPartial(object.ident) : undefined; - message.function = object.function !== undefined && object.function !== null ? Decl_FunctionDecl.fromPartial(object.function) : undefined; + if (object.ident !== undefined && object.ident !== null) { + message.ident = Decl_IdentDecl.fromPartial(object.ident); + } + if (object.function !== undefined && object.function !== null) { + message.function = Decl_FunctionDecl.fromPartial(object.function); + } return message; }, fromSDK(object: DeclSDKType): Decl { @@ -1953,7 +1915,7 @@ export const Decl_IdentDecl = { if (message.value !== undefined) { Constant.encode(message.value, writer.uint32(18).fork()).ldelim(); } - if (message.doc !== "") { + if (message.doc !== undefined) { writer.uint32(26).string(message.doc); } return writer; @@ -1982,11 +1944,11 @@ export const Decl_IdentDecl = { return message; }, fromJSON(object: any): Decl_IdentDecl { - return { - type: isSet(object.type) ? Type.fromJSON(object.type) : undefined, - value: isSet(object.value) ? Constant.fromJSON(object.value) : undefined, - doc: isSet(object.doc) ? String(object.doc) : "" - }; + const obj = createBaseDecl_IdentDecl(); + if (isSet(object.type)) obj.type = Type.fromJSON(object.type); + if (isSet(object.value)) obj.value = Constant.fromJSON(object.value); + if (isSet(object.doc)) obj.doc = String(object.doc); + return obj; }, toJSON(message: Decl_IdentDecl): JsonSafe { const obj: any = {}; @@ -1997,8 +1959,12 @@ export const Decl_IdentDecl = { }, fromPartial(object: DeepPartial): Decl_IdentDecl { const message = createBaseDecl_IdentDecl(); - message.type = object.type !== undefined && object.type !== null ? Type.fromPartial(object.type) : undefined; - message.value = object.value !== undefined && object.value !== null ? Constant.fromPartial(object.value) : undefined; + if (object.type !== undefined && object.type !== null) { + message.type = Type.fromPartial(object.type); + } + if (object.value !== undefined && object.value !== null) { + message.value = Constant.fromPartial(object.value); + } message.doc = object.doc ?? ""; return message; }, @@ -2090,9 +2056,9 @@ export const Decl_FunctionDecl = { return message; }, fromJSON(object: any): Decl_FunctionDecl { - return { - overloads: Array.isArray(object?.overloads) ? object.overloads.map((e: any) => Decl_FunctionDecl_Overload.fromJSON(e)) : [] - }; + const obj = createBaseDecl_FunctionDecl(); + if (Array.isArray(object?.overloads)) obj.overloads = object.overloads.map((e: any) => Decl_FunctionDecl_Overload.fromJSON(e)); + return obj; }, toJSON(message: Decl_FunctionDecl): JsonSafe { const obj: any = {}; @@ -2170,7 +2136,7 @@ function createBaseDecl_FunctionDecl_Overload(): Decl_FunctionDecl_Overload { export const Decl_FunctionDecl_Overload = { typeUrl: "/google.api.expr.v1alpha1.Overload", encode(message: Decl_FunctionDecl_Overload, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.overloadId !== "") { + if (message.overloadId !== undefined) { writer.uint32(10).string(message.overloadId); } for (const v of message.params) { @@ -2182,10 +2148,10 @@ export const Decl_FunctionDecl_Overload = { if (message.resultType !== undefined) { Type.encode(message.resultType, writer.uint32(34).fork()).ldelim(); } - if (message.isInstanceFunction === true) { + if (message.isInstanceFunction !== undefined) { writer.uint32(40).bool(message.isInstanceFunction); } - if (message.doc !== "") { + if (message.doc !== undefined) { writer.uint32(50).string(message.doc); } return writer; @@ -2223,14 +2189,14 @@ export const Decl_FunctionDecl_Overload = { return message; }, fromJSON(object: any): Decl_FunctionDecl_Overload { - return { - overloadId: isSet(object.overloadId) ? String(object.overloadId) : "", - params: Array.isArray(object?.params) ? object.params.map((e: any) => Type.fromJSON(e)) : [], - typeParams: Array.isArray(object?.typeParams) ? object.typeParams.map((e: any) => String(e)) : [], - resultType: isSet(object.resultType) ? Type.fromJSON(object.resultType) : undefined, - isInstanceFunction: isSet(object.isInstanceFunction) ? Boolean(object.isInstanceFunction) : false, - doc: isSet(object.doc) ? String(object.doc) : "" - }; + const obj = createBaseDecl_FunctionDecl_Overload(); + if (isSet(object.overloadId)) obj.overloadId = String(object.overloadId); + if (Array.isArray(object?.params)) obj.params = object.params.map((e: any) => Type.fromJSON(e)); + if (Array.isArray(object?.typeParams)) obj.typeParams = object.typeParams.map((e: any) => String(e)); + if (isSet(object.resultType)) obj.resultType = Type.fromJSON(object.resultType); + if (isSet(object.isInstanceFunction)) obj.isInstanceFunction = Boolean(object.isInstanceFunction); + if (isSet(object.doc)) obj.doc = String(object.doc); + return obj; }, toJSON(message: Decl_FunctionDecl_Overload): JsonSafe { const obj: any = {}; @@ -2255,7 +2221,9 @@ export const Decl_FunctionDecl_Overload = { message.overloadId = object.overloadId ?? ""; message.params = object.params?.map(e => Type.fromPartial(e)) || []; message.typeParams = object.typeParams?.map(e => e) || []; - message.resultType = object.resultType !== undefined && object.resultType !== null ? Type.fromPartial(object.resultType) : undefined; + if (object.resultType !== undefined && object.resultType !== null) { + message.resultType = Type.fromPartial(object.resultType); + } message.isInstanceFunction = object.isInstanceFunction ?? false; message.doc = object.doc ?? ""; return message; @@ -2360,7 +2328,7 @@ function createBaseReference(): Reference { export const Reference = { typeUrl: "/google.api.expr.v1alpha1.Reference", encode(message: Reference, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.name !== "") { + if (message.name !== undefined) { writer.uint32(10).string(message.name); } for (const v of message.overloadId) { @@ -2395,11 +2363,11 @@ export const Reference = { return message; }, fromJSON(object: any): Reference { - return { - name: isSet(object.name) ? String(object.name) : "", - overloadId: Array.isArray(object?.overloadId) ? object.overloadId.map((e: any) => String(e)) : [], - value: isSet(object.value) ? Constant.fromJSON(object.value) : undefined - }; + const obj = createBaseReference(); + if (isSet(object.name)) obj.name = String(object.name); + if (Array.isArray(object?.overloadId)) obj.overloadId = object.overloadId.map((e: any) => String(e)); + if (isSet(object.value)) obj.value = Constant.fromJSON(object.value); + return obj; }, toJSON(message: Reference): JsonSafe { const obj: any = {}; @@ -2416,7 +2384,9 @@ export const Reference = { const message = createBaseReference(); message.name = object.name ?? ""; message.overloadId = object.overloadId?.map(e => e) || []; - message.value = object.value !== undefined && object.value !== null ? Constant.fromPartial(object.value) : undefined; + if (object.value !== undefined && object.value !== null) { + message.value = Constant.fromPartial(object.value); + } return message; }, fromSDK(object: ReferenceSDKType): Reference { 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 361e225fec..3d622489c7 100644 --- a/__fixtures__/v-next/outputv4/google/api/expr/v1alpha1/eval.ts +++ b/__fixtures__/v-next/outputv4/google/api/expr/v1alpha1/eval.ts @@ -1,9 +1,8 @@ -import { Value, ValueSDKType } from "./value"; -import { Status, StatusSDKType } from "../../../rpc/status"; -import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { JsonSafe } from "../../../../json-safe"; -import { DeepPartial, isSet } from "../../../../helpers"; -import { ComputedRef } from "vue"; +import { Value, ValueSDKType } from "./value.js"; +import { Status, StatusSDKType } from "../../../rpc/status.js"; +import { BinaryReader, BinaryWriter } from "../../../../binary.js"; +import { JsonSafe } from "../../../../json-safe.js"; +import { DeepPartial, isSet } from "../../../../helpers.js"; export const protobufPackage = "google.api.expr.v1alpha1"; /** * The state of an evaluation. @@ -21,10 +20,6 @@ export interface EvalState { */ results: EvalState_Result[]; } -export interface ReactiveEvalState { - values: ComputedRef; - results: ComputedRef; -} export interface EvalStateProtoMsg { typeUrl: "/google.api.expr.v1alpha1.EvalState"; value: Uint8Array; @@ -45,10 +40,6 @@ export interface EvalState_Result { /** The index in `values` of the resulting value. */ value: bigint; } -export interface ReactiveEvalState_Result { - expr: ComputedRef; - value: ComputedRef; -} export interface EvalState_ResultProtoMsg { typeUrl: "/google.api.expr.v1alpha1.Result"; value: Uint8Array; @@ -109,11 +100,6 @@ export interface ExprValue { */ unknown?: UnknownSet; } -export interface ReactiveExprValue { - value?: ComputedRef; - error?: ComputedRef; - unknown?: ComputedRef; -} export interface ExprValueProtoMsg { typeUrl: "/google.api.expr.v1alpha1.ExprValue"; value: Uint8Array; @@ -133,9 +119,6 @@ export interface ErrorSet { /** The errors in the set. */ errors: Status[]; } -export interface ReactiveErrorSet { - errors: ComputedRef; -} export interface ErrorSetProtoMsg { typeUrl: "/google.api.expr.v1alpha1.ErrorSet"; value: Uint8Array; @@ -157,9 +140,6 @@ export interface UnknownSet { /** The ids of the expressions with unknown values. */ exprs: bigint[]; } -export interface ReactiveUnknownSet { - exprs: ComputedRef; -} export interface UnknownSetProtoMsg { typeUrl: "/google.api.expr.v1alpha1.UnknownSet"; value: Uint8Array; @@ -210,10 +190,10 @@ export const EvalState = { return message; }, fromJSON(object: any): EvalState { - return { - values: Array.isArray(object?.values) ? object.values.map((e: any) => ExprValue.fromJSON(e)) : [], - results: Array.isArray(object?.results) ? object.results.map((e: any) => EvalState_Result.fromJSON(e)) : [] - }; + const obj = createBaseEvalState(); + if (Array.isArray(object?.values)) obj.values = object.values.map((e: any) => ExprValue.fromJSON(e)); + if (Array.isArray(object?.results)) obj.results = object.results.map((e: any) => EvalState_Result.fromJSON(e)); + return obj; }, toJSON(message: EvalState): JsonSafe { const obj: any = {}; @@ -306,10 +286,10 @@ function createBaseEvalState_Result(): EvalState_Result { export const EvalState_Result = { typeUrl: "/google.api.expr.v1alpha1.Result", encode(message: EvalState_Result, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.expr !== BigInt(0)) { + if (message.expr !== undefined) { writer.uint32(8).int64(message.expr); } - if (message.value !== BigInt(0)) { + if (message.value !== undefined) { writer.uint32(16).int64(message.value); } return writer; @@ -335,10 +315,10 @@ export const EvalState_Result = { return message; }, fromJSON(object: any): EvalState_Result { - return { - expr: isSet(object.expr) ? BigInt(object.expr.toString()) : BigInt(0), - value: isSet(object.value) ? BigInt(object.value.toString()) : BigInt(0) - }; + const obj = createBaseEvalState_Result(); + if (isSet(object.expr)) obj.expr = BigInt(object.expr.toString()); + if (isSet(object.value)) obj.value = BigInt(object.value.toString()); + return obj; }, toJSON(message: EvalState_Result): JsonSafe { const obj: any = {}; @@ -348,8 +328,12 @@ export const EvalState_Result = { }, fromPartial(object: DeepPartial): EvalState_Result { const message = createBaseEvalState_Result(); - message.expr = object.expr !== undefined && object.expr !== null ? BigInt(object.expr.toString()) : BigInt(0); - message.value = object.value !== undefined && object.value !== null ? BigInt(object.value.toString()) : BigInt(0); + if (object.expr !== undefined && object.expr !== null) { + message.expr = BigInt(object.expr.toString()); + } + if (object.value !== undefined && object.value !== null) { + message.value = BigInt(object.value.toString()); + } return message; }, fromSDK(object: EvalState_ResultSDKType): EvalState_Result { @@ -447,11 +431,11 @@ export const ExprValue = { return message; }, fromJSON(object: any): ExprValue { - return { - value: isSet(object.value) ? Value.fromJSON(object.value) : undefined, - error: isSet(object.error) ? ErrorSet.fromJSON(object.error) : undefined, - unknown: isSet(object.unknown) ? UnknownSet.fromJSON(object.unknown) : undefined - }; + const obj = createBaseExprValue(); + if (isSet(object.value)) obj.value = Value.fromJSON(object.value); + if (isSet(object.error)) obj.error = ErrorSet.fromJSON(object.error); + if (isSet(object.unknown)) obj.unknown = UnknownSet.fromJSON(object.unknown); + return obj; }, toJSON(message: ExprValue): JsonSafe { const obj: any = {}; @@ -462,9 +446,15 @@ export const ExprValue = { }, fromPartial(object: DeepPartial): ExprValue { const message = createBaseExprValue(); - message.value = object.value !== undefined && object.value !== null ? Value.fromPartial(object.value) : undefined; - message.error = object.error !== undefined && object.error !== null ? ErrorSet.fromPartial(object.error) : undefined; - message.unknown = object.unknown !== undefined && object.unknown !== null ? UnknownSet.fromPartial(object.unknown) : undefined; + if (object.value !== undefined && object.value !== null) { + message.value = Value.fromPartial(object.value); + } + if (object.error !== undefined && object.error !== null) { + message.error = ErrorSet.fromPartial(object.error); + } + if (object.unknown !== undefined && object.unknown !== null) { + message.unknown = UnknownSet.fromPartial(object.unknown); + } return message; }, fromSDK(object: ExprValueSDKType): ExprValue { @@ -555,9 +545,9 @@ export const ErrorSet = { return message; }, fromJSON(object: any): ErrorSet { - return { - errors: Array.isArray(object?.errors) ? object.errors.map((e: any) => Status.fromJSON(e)) : [] - }; + const obj = createBaseErrorSet(); + if (Array.isArray(object?.errors)) obj.errors = object.errors.map((e: any) => Status.fromJSON(e)); + return obj; }, toJSON(message: ErrorSet): JsonSafe { const obj: any = {}; @@ -662,9 +652,9 @@ export const UnknownSet = { return message; }, fromJSON(object: any): UnknownSet { - return { - exprs: Array.isArray(object?.exprs) ? object.exprs.map((e: any) => BigInt(e.toString())) : [] - }; + const obj = createBaseUnknownSet(); + if (Array.isArray(object?.exprs)) obj.exprs = object.exprs.map((e: any) => BigInt(e.toString())); + return obj; }, toJSON(message: UnknownSet): JsonSafe { const obj: any = {}; 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 f606aba169..f24dd302f3 100644 --- a/__fixtures__/v-next/outputv4/google/api/expr/v1alpha1/explain.ts +++ b/__fixtures__/v-next/outputv4/google/api/expr/v1alpha1/explain.ts @@ -1,8 +1,7 @@ -import { Value, ValueSDKType } from "./value"; -import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { JsonSafe } from "../../../../json-safe"; -import { DeepPartial, isSet } from "../../../../helpers"; -import { ComputedRef } from "vue"; +import { Value, ValueSDKType } from "./value.js"; +import { BinaryReader, BinaryWriter } from "../../../../binary.js"; +import { JsonSafe } from "../../../../json-safe.js"; +import { DeepPartial, isSet } from "../../../../helpers.js"; export const protobufPackage = "google.api.expr.v1alpha1"; /** * Values of intermediate expressions produced when evaluating expression. @@ -26,10 +25,6 @@ export interface Explain { */ exprSteps: Explain_ExprStep[]; } -export interface ReactiveExplain { - values: ComputedRef; - exprSteps: ComputedRef; -} export interface ExplainProtoMsg { typeUrl: "/google.api.expr.v1alpha1.Explain"; value: Uint8Array; @@ -50,10 +45,6 @@ export interface Explain_ExprStep { /** Index of the value in the values list. */ valueIndex: number; } -export interface ReactiveExplain_ExprStep { - id: ComputedRef; - valueIndex: ComputedRef; -} export interface Explain_ExprStepProtoMsg { typeUrl: "/google.api.expr.v1alpha1.ExprStep"; value: Uint8Array; @@ -101,10 +92,10 @@ export const Explain = { return message; }, fromJSON(object: any): Explain { - return { - values: Array.isArray(object?.values) ? object.values.map((e: any) => Value.fromJSON(e)) : [], - exprSteps: Array.isArray(object?.exprSteps) ? object.exprSteps.map((e: any) => Explain_ExprStep.fromJSON(e)) : [] - }; + const obj = createBaseExplain(); + if (Array.isArray(object?.values)) obj.values = object.values.map((e: any) => Value.fromJSON(e)); + if (Array.isArray(object?.exprSteps)) obj.exprSteps = object.exprSteps.map((e: any) => Explain_ExprStep.fromJSON(e)); + return obj; }, toJSON(message: Explain): JsonSafe { const obj: any = {}; @@ -197,10 +188,10 @@ function createBaseExplain_ExprStep(): Explain_ExprStep { export const Explain_ExprStep = { typeUrl: "/google.api.expr.v1alpha1.ExprStep", encode(message: Explain_ExprStep, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.id !== BigInt(0)) { + if (message.id !== undefined) { writer.uint32(8).int64(message.id); } - if (message.valueIndex !== 0) { + if (message.valueIndex !== undefined) { writer.uint32(16).int32(message.valueIndex); } return writer; @@ -226,10 +217,10 @@ export const Explain_ExprStep = { return message; }, fromJSON(object: any): Explain_ExprStep { - return { - id: isSet(object.id) ? BigInt(object.id.toString()) : BigInt(0), - valueIndex: isSet(object.valueIndex) ? Number(object.valueIndex) : 0 - }; + const obj = createBaseExplain_ExprStep(); + if (isSet(object.id)) obj.id = BigInt(object.id.toString()); + if (isSet(object.valueIndex)) obj.valueIndex = Number(object.valueIndex); + return obj; }, toJSON(message: Explain_ExprStep): JsonSafe { const obj: any = {}; @@ -239,7 +230,9 @@ export const Explain_ExprStep = { }, fromPartial(object: DeepPartial): Explain_ExprStep { const message = createBaseExplain_ExprStep(); - message.id = object.id !== undefined && object.id !== null ? BigInt(object.id.toString()) : BigInt(0); + if (object.id !== undefined && object.id !== null) { + message.id = BigInt(object.id.toString()); + } message.valueIndex = object.valueIndex ?? 0; return message; }, 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 361bc4f31f..4d1fb151e3 100644 --- a/__fixtures__/v-next/outputv4/google/api/expr/v1alpha1/syntax.ts +++ b/__fixtures__/v-next/outputv4/google/api/expr/v1alpha1/syntax.ts @@ -1,10 +1,9 @@ -import { NullValue, NullValueSDKType, nullValueFromJSON, nullValueToJSON } from "../../../protobuf/struct"; -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 { JsonSafe } from "../../../../json-safe"; -import { ComputedRef } from "vue"; +import { NullValue, NullValueSDKType, nullValueFromJSON, nullValueToJSON } from "../../../protobuf/struct.js"; +import { Duration, DurationSDKType } from "../../../protobuf/duration.js"; +import { Timestamp, TimestampSDKType } from "../../../protobuf/timestamp.js"; +import { BinaryReader, BinaryWriter } from "../../../../binary.js"; +import { isSet, DeepPartial, toTimestamp, fromTimestamp, bytesFromBase64, base64FromBytes, isObject } from "../../../../helpers.js"; +import { JsonSafe } from "../../../../json-safe.js"; export const protobufPackage = "google.api.expr.v1alpha1"; /** An expression together with source information as returned by the parser. */ export interface ParsedExpr { @@ -13,10 +12,6 @@ export interface ParsedExpr { /** The source info derived from input that generated the parsed `expr`. */ sourceInfo?: SourceInfo; } -export interface ReactiveParsedExpr { - expr?: ComputedRef; - sourceInfo?: ComputedRef; -} export interface ParsedExprProtoMsg { typeUrl: "/google.api.expr.v1alpha1.ParsedExpr"; value: Uint8Array; @@ -65,16 +60,6 @@ export interface Expr { /** A comprehension expression. */ comprehensionExpr?: Expr_Comprehension; } -export interface ReactiveExpr { - id: ComputedRef; - constExpr?: ComputedRef; - identExpr?: ComputedRef; - selectExpr?: ComputedRef; - callExpr?: ComputedRef; - listExpr?: ComputedRef; - structExpr?: ComputedRef; - comprehensionExpr?: ComputedRef; -} export interface ExprProtoMsg { typeUrl: "/google.api.expr.v1alpha1.Expr"; value: Uint8Array; @@ -116,9 +101,6 @@ export interface Expr_Ident { */ name: string; } -export interface ReactiveExpr_Ident { - name: ComputedRef; -} export interface Expr_IdentProtoMsg { typeUrl: "/google.api.expr.v1alpha1.Ident"; value: Uint8Array; @@ -150,11 +132,6 @@ export interface Expr_Select { */ testOnly: boolean; } -export interface ReactiveExpr_Select { - operand?: ComputedRef; - field: ComputedRef; - testOnly: ComputedRef; -} export interface Expr_SelectProtoMsg { typeUrl: "/google.api.expr.v1alpha1.Select"; value: Uint8Array; @@ -181,11 +158,6 @@ export interface Expr_Call { /** The arguments. */ args: Expr[]; } -export interface ReactiveExpr_Call { - target?: ComputedRef; - function: ComputedRef; - args: ComputedRef; -} export interface Expr_CallProtoMsg { typeUrl: "/google.api.expr.v1alpha1.Call"; value: Uint8Array; @@ -210,9 +182,6 @@ export interface Expr_CreateList { /** The elements part of the list. */ elements: Expr[]; } -export interface ReactiveExpr_CreateList { - elements: ComputedRef; -} export interface Expr_CreateListProtoMsg { typeUrl: "/google.api.expr.v1alpha1.CreateList"; value: Uint8Array; @@ -242,10 +211,6 @@ export interface Expr_CreateStruct { /** The entries in the creation expression. */ entries: Expr_CreateStruct_Entry[]; } -export interface ReactiveExpr_CreateStruct { - messageName: ComputedRef; - entries: ComputedRef; -} export interface Expr_CreateStructProtoMsg { typeUrl: "/google.api.expr.v1alpha1.CreateStruct"; value: Uint8Array; @@ -276,12 +241,6 @@ export interface Expr_CreateStruct_Entry { /** Required. The value assigned to the key. */ value?: Expr; } -export interface ReactiveExpr_CreateStruct_Entry { - id: ComputedRef; - fieldKey?: ComputedRef; - mapKey?: ComputedRef; - value?: ComputedRef; -} export interface Expr_CreateStruct_EntryProtoMsg { typeUrl: "/google.api.expr.v1alpha1.Entry"; value: Uint8Array; @@ -350,15 +309,6 @@ export interface Expr_Comprehension { */ result?: Expr; } -export interface ReactiveExpr_Comprehension { - iterVar: ComputedRef; - iterRange?: ComputedRef; - accuVar: ComputedRef; - accuInit?: ComputedRef; - loopCondition?: ComputedRef; - loopStep?: ComputedRef; - result?: ComputedRef; -} export interface Expr_ComprehensionProtoMsg { typeUrl: "/google.api.expr.v1alpha1.Comprehension"; value: Uint8Array; @@ -445,17 +395,6 @@ export interface Constant { /** @deprecated */ timestampValue?: Date; } -export interface ReactiveConstant { - nullValue?: ComputedRef; - boolValue?: ComputedRef; - int64Value?: ComputedRef; - uint64Value?: ComputedRef; - doubleValue?: ComputedRef; - stringValue?: ComputedRef; - bytesValue?: ComputedRef; - durationValue?: ComputedRef; - timestampValue?: ComputedRef; -} export interface ConstantProtoMsg { typeUrl: "/google.api.expr.v1alpha1.Constant"; value: Uint8Array; @@ -492,10 +431,6 @@ export interface SourceInfo_PositionsEntry { key: bigint; value: number; } -export interface ReactiveSourceInfo_PositionsEntry { - key: ComputedRef; - value: ComputedRef; -} export interface SourceInfo_PositionsEntryProtoMsg { typeUrl: string; value: Uint8Array; @@ -508,10 +443,6 @@ export interface SourceInfo_MacroCallsEntry { key: bigint; value?: Expr; } -export interface ReactiveSourceInfo_MacroCallsEntry { - key: ComputedRef; - value?: ComputedRef; -} export interface SourceInfo_MacroCallsEntryProtoMsg { typeUrl: string; value: Uint8Array; @@ -562,17 +493,6 @@ export interface SourceInfo { [key: bigint]: Expr; }; } -export interface ReactiveSourceInfo { - syntaxVersion: ComputedRef; - location: ComputedRef; - lineOffsets: ComputedRef; - positions: ComputedRef<{ - [key: bigint]: number; - }>; - macroCalls: ComputedRef<{ - [key: bigint]: Expr; - }>; -} export interface SourceInfoProtoMsg { typeUrl: "/google.api.expr.v1alpha1.SourceInfo"; value: Uint8Array; @@ -606,12 +526,6 @@ export interface SourcePosition { */ column: number; } -export interface ReactiveSourcePosition { - location: ComputedRef; - offset: ComputedRef; - line: ComputedRef; - column: ComputedRef; -} export interface SourcePositionProtoMsg { typeUrl: "/google.api.expr.v1alpha1.SourcePosition"; value: Uint8Array; @@ -661,10 +575,10 @@ export const ParsedExpr = { return message; }, fromJSON(object: any): ParsedExpr { - return { - expr: isSet(object.expr) ? Expr.fromJSON(object.expr) : undefined, - sourceInfo: isSet(object.sourceInfo) ? SourceInfo.fromJSON(object.sourceInfo) : undefined - }; + const obj = createBaseParsedExpr(); + if (isSet(object.expr)) obj.expr = Expr.fromJSON(object.expr); + if (isSet(object.sourceInfo)) obj.sourceInfo = SourceInfo.fromJSON(object.sourceInfo); + return obj; }, toJSON(message: ParsedExpr): JsonSafe { const obj: any = {}; @@ -674,8 +588,12 @@ export const ParsedExpr = { }, fromPartial(object: DeepPartial): ParsedExpr { const message = createBaseParsedExpr(); - message.expr = object.expr !== undefined && object.expr !== null ? Expr.fromPartial(object.expr) : undefined; - message.sourceInfo = object.sourceInfo !== undefined && object.sourceInfo !== null ? SourceInfo.fromPartial(object.sourceInfo) : undefined; + if (object.expr !== undefined && object.expr !== null) { + message.expr = Expr.fromPartial(object.expr); + } + if (object.sourceInfo !== undefined && object.sourceInfo !== null) { + message.sourceInfo = SourceInfo.fromPartial(object.sourceInfo); + } return message; }, fromSDK(object: ParsedExprSDKType): ParsedExpr { @@ -743,7 +661,7 @@ function createBaseExpr(): Expr { export const Expr = { typeUrl: "/google.api.expr.v1alpha1.Expr", encode(message: Expr, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.id !== BigInt(0)) { + if (message.id !== undefined) { writer.uint32(16).int64(message.id); } if (message.constExpr !== undefined) { @@ -808,16 +726,16 @@ export const Expr = { return message; }, fromJSON(object: any): Expr { - return { - id: isSet(object.id) ? BigInt(object.id.toString()) : BigInt(0), - constExpr: isSet(object.constExpr) ? Constant.fromJSON(object.constExpr) : undefined, - identExpr: isSet(object.identExpr) ? Expr_Ident.fromJSON(object.identExpr) : undefined, - selectExpr: isSet(object.selectExpr) ? Expr_Select.fromJSON(object.selectExpr) : undefined, - callExpr: isSet(object.callExpr) ? Expr_Call.fromJSON(object.callExpr) : undefined, - listExpr: isSet(object.listExpr) ? Expr_CreateList.fromJSON(object.listExpr) : undefined, - structExpr: isSet(object.structExpr) ? Expr_CreateStruct.fromJSON(object.structExpr) : undefined, - comprehensionExpr: isSet(object.comprehensionExpr) ? Expr_Comprehension.fromJSON(object.comprehensionExpr) : undefined - }; + const obj = createBaseExpr(); + if (isSet(object.id)) obj.id = BigInt(object.id.toString()); + if (isSet(object.constExpr)) obj.constExpr = Constant.fromJSON(object.constExpr); + if (isSet(object.identExpr)) obj.identExpr = Expr_Ident.fromJSON(object.identExpr); + if (isSet(object.selectExpr)) obj.selectExpr = Expr_Select.fromJSON(object.selectExpr); + if (isSet(object.callExpr)) obj.callExpr = Expr_Call.fromJSON(object.callExpr); + if (isSet(object.listExpr)) obj.listExpr = Expr_CreateList.fromJSON(object.listExpr); + if (isSet(object.structExpr)) obj.structExpr = Expr_CreateStruct.fromJSON(object.structExpr); + if (isSet(object.comprehensionExpr)) obj.comprehensionExpr = Expr_Comprehension.fromJSON(object.comprehensionExpr); + return obj; }, toJSON(message: Expr): JsonSafe { const obj: any = {}; @@ -833,14 +751,30 @@ export const Expr = { }, fromPartial(object: DeepPartial): Expr { const message = createBaseExpr(); - message.id = object.id !== undefined && object.id !== null ? BigInt(object.id.toString()) : BigInt(0); - message.constExpr = object.constExpr !== undefined && object.constExpr !== null ? Constant.fromPartial(object.constExpr) : undefined; - message.identExpr = object.identExpr !== undefined && object.identExpr !== null ? Expr_Ident.fromPartial(object.identExpr) : undefined; - message.selectExpr = object.selectExpr !== undefined && object.selectExpr !== null ? Expr_Select.fromPartial(object.selectExpr) : undefined; - message.callExpr = object.callExpr !== undefined && object.callExpr !== null ? Expr_Call.fromPartial(object.callExpr) : undefined; - message.listExpr = object.listExpr !== undefined && object.listExpr !== null ? Expr_CreateList.fromPartial(object.listExpr) : undefined; - message.structExpr = object.structExpr !== undefined && object.structExpr !== null ? Expr_CreateStruct.fromPartial(object.structExpr) : undefined; - message.comprehensionExpr = object.comprehensionExpr !== undefined && object.comprehensionExpr !== null ? Expr_Comprehension.fromPartial(object.comprehensionExpr) : undefined; + if (object.id !== undefined && object.id !== null) { + message.id = BigInt(object.id.toString()); + } + if (object.constExpr !== undefined && object.constExpr !== null) { + message.constExpr = Constant.fromPartial(object.constExpr); + } + if (object.identExpr !== undefined && object.identExpr !== null) { + message.identExpr = Expr_Ident.fromPartial(object.identExpr); + } + if (object.selectExpr !== undefined && object.selectExpr !== null) { + message.selectExpr = Expr_Select.fromPartial(object.selectExpr); + } + if (object.callExpr !== undefined && object.callExpr !== null) { + message.callExpr = Expr_Call.fromPartial(object.callExpr); + } + if (object.listExpr !== undefined && object.listExpr !== null) { + message.listExpr = Expr_CreateList.fromPartial(object.listExpr); + } + if (object.structExpr !== undefined && object.structExpr !== null) { + message.structExpr = Expr_CreateStruct.fromPartial(object.structExpr); + } + if (object.comprehensionExpr !== undefined && object.comprehensionExpr !== null) { + message.comprehensionExpr = Expr_Comprehension.fromPartial(object.comprehensionExpr); + } return message; }, fromSDK(object: ExprSDKType): Expr { @@ -943,7 +877,7 @@ function createBaseExpr_Ident(): Expr_Ident { export const Expr_Ident = { typeUrl: "/google.api.expr.v1alpha1.Ident", encode(message: Expr_Ident, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.name !== "") { + if (message.name !== undefined) { writer.uint32(10).string(message.name); } return writer; @@ -966,9 +900,9 @@ export const Expr_Ident = { return message; }, fromJSON(object: any): Expr_Ident { - return { - name: isSet(object.name) ? String(object.name) : "" - }; + const obj = createBaseExpr_Ident(); + if (isSet(object.name)) obj.name = String(object.name); + return obj; }, toJSON(message: Expr_Ident): JsonSafe { const obj: any = {}; @@ -1036,10 +970,10 @@ export const Expr_Select = { if (message.operand !== undefined) { Expr.encode(message.operand, writer.uint32(10).fork()).ldelim(); } - if (message.field !== "") { + if (message.field !== undefined) { writer.uint32(18).string(message.field); } - if (message.testOnly === true) { + if (message.testOnly !== undefined) { writer.uint32(24).bool(message.testOnly); } return writer; @@ -1068,11 +1002,11 @@ export const Expr_Select = { return message; }, fromJSON(object: any): Expr_Select { - return { - operand: isSet(object.operand) ? Expr.fromJSON(object.operand) : undefined, - field: isSet(object.field) ? String(object.field) : "", - testOnly: isSet(object.testOnly) ? Boolean(object.testOnly) : false - }; + const obj = createBaseExpr_Select(); + if (isSet(object.operand)) obj.operand = Expr.fromJSON(object.operand); + if (isSet(object.field)) obj.field = String(object.field); + if (isSet(object.testOnly)) obj.testOnly = Boolean(object.testOnly); + return obj; }, toJSON(message: Expr_Select): JsonSafe { const obj: any = {}; @@ -1083,7 +1017,9 @@ export const Expr_Select = { }, fromPartial(object: DeepPartial): Expr_Select { const message = createBaseExpr_Select(); - message.operand = object.operand !== undefined && object.operand !== null ? Expr.fromPartial(object.operand) : undefined; + if (object.operand !== undefined && object.operand !== null) { + message.operand = Expr.fromPartial(object.operand); + } message.field = object.field ?? ""; message.testOnly = object.testOnly ?? false; return message; @@ -1158,7 +1094,7 @@ export const Expr_Call = { if (message.target !== undefined) { Expr.encode(message.target, writer.uint32(10).fork()).ldelim(); } - if (message.function !== "") { + if (message.function !== undefined) { writer.uint32(18).string(message.function); } for (const v of message.args) { @@ -1190,11 +1126,11 @@ export const Expr_Call = { return message; }, fromJSON(object: any): Expr_Call { - return { - target: isSet(object.target) ? Expr.fromJSON(object.target) : undefined, - function: isSet(object.function) ? String(object.function) : "", - args: Array.isArray(object?.args) ? object.args.map((e: any) => Expr.fromJSON(e)) : [] - }; + const obj = createBaseExpr_Call(); + if (isSet(object.target)) obj.target = Expr.fromJSON(object.target); + if (isSet(object.function)) obj.function = String(object.function); + if (Array.isArray(object?.args)) obj.args = object.args.map((e: any) => Expr.fromJSON(e)); + return obj; }, toJSON(message: Expr_Call): JsonSafe { const obj: any = {}; @@ -1209,7 +1145,9 @@ export const Expr_Call = { }, fromPartial(object: DeepPartial): Expr_Call { const message = createBaseExpr_Call(); - message.target = object.target !== undefined && object.target !== null ? Expr.fromPartial(object.target) : undefined; + if (object.target !== undefined && object.target !== null) { + message.target = Expr.fromPartial(object.target); + } message.function = object.function ?? ""; message.args = object.args?.map(e => Expr.fromPartial(e)) || []; return message; @@ -1308,9 +1246,9 @@ export const Expr_CreateList = { return message; }, fromJSON(object: any): Expr_CreateList { - return { - elements: Array.isArray(object?.elements) ? object.elements.map((e: any) => Expr.fromJSON(e)) : [] - }; + const obj = createBaseExpr_CreateList(); + if (Array.isArray(object?.elements)) obj.elements = object.elements.map((e: any) => Expr.fromJSON(e)); + return obj; }, toJSON(message: Expr_CreateList): JsonSafe { const obj: any = {}; @@ -1384,7 +1322,7 @@ function createBaseExpr_CreateStruct(): Expr_CreateStruct { export const Expr_CreateStruct = { typeUrl: "/google.api.expr.v1alpha1.CreateStruct", encode(message: Expr_CreateStruct, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.messageName !== "") { + if (message.messageName !== undefined) { writer.uint32(10).string(message.messageName); } for (const v of message.entries) { @@ -1413,10 +1351,10 @@ export const Expr_CreateStruct = { return message; }, fromJSON(object: any): Expr_CreateStruct { - return { - messageName: isSet(object.messageName) ? String(object.messageName) : "", - entries: Array.isArray(object?.entries) ? object.entries.map((e: any) => Expr_CreateStruct_Entry.fromJSON(e)) : [] - }; + const obj = createBaseExpr_CreateStruct(); + if (isSet(object.messageName)) obj.messageName = String(object.messageName); + if (Array.isArray(object?.entries)) obj.entries = object.entries.map((e: any) => Expr_CreateStruct_Entry.fromJSON(e)); + return obj; }, toJSON(message: Expr_CreateStruct): JsonSafe { const obj: any = {}; @@ -1501,7 +1439,7 @@ function createBaseExpr_CreateStruct_Entry(): Expr_CreateStruct_Entry { export const Expr_CreateStruct_Entry = { typeUrl: "/google.api.expr.v1alpha1.Entry", encode(message: Expr_CreateStruct_Entry, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.id !== BigInt(0)) { + if (message.id !== undefined) { writer.uint32(8).int64(message.id); } if (message.fieldKey !== undefined) { @@ -1542,12 +1480,12 @@ export const Expr_CreateStruct_Entry = { return message; }, fromJSON(object: any): Expr_CreateStruct_Entry { - return { - id: isSet(object.id) ? BigInt(object.id.toString()) : BigInt(0), - fieldKey: isSet(object.fieldKey) ? String(object.fieldKey) : undefined, - mapKey: isSet(object.mapKey) ? Expr.fromJSON(object.mapKey) : undefined, - value: isSet(object.value) ? Expr.fromJSON(object.value) : undefined - }; + const obj = createBaseExpr_CreateStruct_Entry(); + if (isSet(object.id)) obj.id = BigInt(object.id.toString()); + if (isSet(object.fieldKey)) obj.fieldKey = String(object.fieldKey); + if (isSet(object.mapKey)) obj.mapKey = Expr.fromJSON(object.mapKey); + if (isSet(object.value)) obj.value = Expr.fromJSON(object.value); + return obj; }, toJSON(message: Expr_CreateStruct_Entry): JsonSafe { const obj: any = {}; @@ -1559,10 +1497,16 @@ export const Expr_CreateStruct_Entry = { }, fromPartial(object: DeepPartial): Expr_CreateStruct_Entry { const message = createBaseExpr_CreateStruct_Entry(); - message.id = object.id !== undefined && object.id !== null ? BigInt(object.id.toString()) : BigInt(0); + if (object.id !== undefined && object.id !== null) { + message.id = BigInt(object.id.toString()); + } message.fieldKey = object.fieldKey ?? undefined; - message.mapKey = object.mapKey !== undefined && object.mapKey !== null ? Expr.fromPartial(object.mapKey) : undefined; - message.value = object.value !== undefined && object.value !== null ? Expr.fromPartial(object.value) : undefined; + if (object.mapKey !== undefined && object.mapKey !== null) { + message.mapKey = Expr.fromPartial(object.mapKey); + } + if (object.value !== undefined && object.value !== null) { + message.value = Expr.fromPartial(object.value); + } return message; }, fromSDK(object: Expr_CreateStruct_EntrySDKType): Expr_CreateStruct_Entry { @@ -1643,13 +1587,13 @@ function createBaseExpr_Comprehension(): Expr_Comprehension { export const Expr_Comprehension = { typeUrl: "/google.api.expr.v1alpha1.Comprehension", encode(message: Expr_Comprehension, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.iterVar !== "") { + if (message.iterVar !== undefined) { writer.uint32(10).string(message.iterVar); } if (message.iterRange !== undefined) { Expr.encode(message.iterRange, writer.uint32(18).fork()).ldelim(); } - if (message.accuVar !== "") { + if (message.accuVar !== undefined) { writer.uint32(26).string(message.accuVar); } if (message.accuInit !== undefined) { @@ -1702,15 +1646,15 @@ export const Expr_Comprehension = { return message; }, fromJSON(object: any): Expr_Comprehension { - return { - iterVar: isSet(object.iterVar) ? String(object.iterVar) : "", - iterRange: isSet(object.iterRange) ? Expr.fromJSON(object.iterRange) : undefined, - accuVar: isSet(object.accuVar) ? String(object.accuVar) : "", - accuInit: isSet(object.accuInit) ? Expr.fromJSON(object.accuInit) : undefined, - loopCondition: isSet(object.loopCondition) ? Expr.fromJSON(object.loopCondition) : undefined, - loopStep: isSet(object.loopStep) ? Expr.fromJSON(object.loopStep) : undefined, - result: isSet(object.result) ? Expr.fromJSON(object.result) : undefined - }; + const obj = createBaseExpr_Comprehension(); + if (isSet(object.iterVar)) obj.iterVar = String(object.iterVar); + if (isSet(object.iterRange)) obj.iterRange = Expr.fromJSON(object.iterRange); + if (isSet(object.accuVar)) obj.accuVar = String(object.accuVar); + if (isSet(object.accuInit)) obj.accuInit = Expr.fromJSON(object.accuInit); + if (isSet(object.loopCondition)) obj.loopCondition = Expr.fromJSON(object.loopCondition); + if (isSet(object.loopStep)) obj.loopStep = Expr.fromJSON(object.loopStep); + if (isSet(object.result)) obj.result = Expr.fromJSON(object.result); + return obj; }, toJSON(message: Expr_Comprehension): JsonSafe { const obj: any = {}; @@ -1726,12 +1670,22 @@ export const Expr_Comprehension = { fromPartial(object: DeepPartial): Expr_Comprehension { const message = createBaseExpr_Comprehension(); message.iterVar = object.iterVar ?? ""; - message.iterRange = object.iterRange !== undefined && object.iterRange !== null ? Expr.fromPartial(object.iterRange) : undefined; + if (object.iterRange !== undefined && object.iterRange !== null) { + message.iterRange = Expr.fromPartial(object.iterRange); + } message.accuVar = object.accuVar ?? ""; - message.accuInit = object.accuInit !== undefined && object.accuInit !== null ? Expr.fromPartial(object.accuInit) : undefined; - message.loopCondition = object.loopCondition !== undefined && object.loopCondition !== null ? Expr.fromPartial(object.loopCondition) : undefined; - message.loopStep = object.loopStep !== undefined && object.loopStep !== null ? Expr.fromPartial(object.loopStep) : undefined; - message.result = object.result !== undefined && object.result !== null ? Expr.fromPartial(object.result) : undefined; + if (object.accuInit !== undefined && object.accuInit !== null) { + message.accuInit = Expr.fromPartial(object.accuInit); + } + if (object.loopCondition !== undefined && object.loopCondition !== null) { + message.loopCondition = Expr.fromPartial(object.loopCondition); + } + if (object.loopStep !== undefined && object.loopStep !== null) { + message.loopStep = Expr.fromPartial(object.loopStep); + } + if (object.result !== undefined && object.result !== null) { + message.result = Expr.fromPartial(object.result); + } return message; }, fromSDK(object: Expr_ComprehensionSDKType): Expr_Comprehension { @@ -1906,17 +1860,17 @@ export const Constant = { return message; }, fromJSON(object: any): Constant { - return { - nullValue: isSet(object.nullValue) ? nullValueFromJSON(object.nullValue) : undefined, - boolValue: isSet(object.boolValue) ? Boolean(object.boolValue) : undefined, - int64Value: isSet(object.int64Value) ? BigInt(object.int64Value.toString()) : undefined, - uint64Value: isSet(object.uint64Value) ? BigInt(object.uint64Value.toString()) : undefined, - doubleValue: isSet(object.doubleValue) ? Number(object.doubleValue) : undefined, - stringValue: isSet(object.stringValue) ? String(object.stringValue) : undefined, - bytesValue: isSet(object.bytesValue) ? bytesFromBase64(object.bytesValue) : undefined, - durationValue: isSet(object.durationValue) ? Duration.fromJSON(object.durationValue) : undefined, - timestampValue: isSet(object.timestampValue) ? new Date(object.timestampValue) : undefined - }; + const obj = createBaseConstant(); + if (isSet(object.nullValue)) obj.nullValue = nullValueFromJSON(object.nullValue); + if (isSet(object.boolValue)) obj.boolValue = Boolean(object.boolValue); + if (isSet(object.int64Value)) obj.int64Value = BigInt(object.int64Value.toString()); + if (isSet(object.uint64Value)) obj.uint64Value = BigInt(object.uint64Value.toString()); + if (isSet(object.doubleValue)) obj.doubleValue = Number(object.doubleValue); + if (isSet(object.stringValue)) obj.stringValue = String(object.stringValue); + if (isSet(object.bytesValue)) obj.bytesValue = bytesFromBase64(object.bytesValue); + if (isSet(object.durationValue)) obj.durationValue = Duration.fromJSON(object.durationValue); + if (isSet(object.timestampValue)) obj.timestampValue = new Date(object.timestampValue); + return obj; }, toJSON(message: Constant): JsonSafe { const obj: any = {}; @@ -1939,12 +1893,18 @@ export const Constant = { const message = createBaseConstant(); message.nullValue = object.nullValue ?? undefined; message.boolValue = object.boolValue ?? undefined; - message.int64Value = object.int64Value !== undefined && object.int64Value !== null ? BigInt(object.int64Value.toString()) : undefined; - message.uint64Value = object.uint64Value !== undefined && object.uint64Value !== null ? BigInt(object.uint64Value.toString()) : undefined; + if (object.int64Value !== undefined && object.int64Value !== null) { + message.int64Value = BigInt(object.int64Value.toString()); + } + if (object.uint64Value !== undefined && object.uint64Value !== null) { + message.uint64Value = BigInt(object.uint64Value.toString()); + } message.doubleValue = object.doubleValue ?? undefined; message.stringValue = object.stringValue ?? undefined; message.bytesValue = object.bytesValue ?? undefined; - message.durationValue = object.durationValue !== undefined && object.durationValue !== null ? Duration.fromPartial(object.durationValue) : undefined; + if (object.durationValue !== undefined && object.durationValue !== null) { + message.durationValue = Duration.fromPartial(object.durationValue); + } message.timestampValue = object.timestampValue ?? undefined; return message; }, @@ -2055,10 +2015,10 @@ function createBaseSourceInfo_PositionsEntry(): SourceInfo_PositionsEntry { } export const SourceInfo_PositionsEntry = { encode(message: SourceInfo_PositionsEntry, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.key !== BigInt(0)) { + if (message.key !== undefined) { writer.uint32(8).int64(message.key); } - if (message.value !== 0) { + if (message.value !== undefined) { writer.uint32(16).int32(message.value); } return writer; @@ -2084,10 +2044,10 @@ export const SourceInfo_PositionsEntry = { return message; }, fromJSON(object: any): SourceInfo_PositionsEntry { - return { - key: isSet(object.key) ? BigInt(object.key.toString()) : BigInt(0), - value: isSet(object.value) ? Number(object.value) : 0 - }; + const obj = createBaseSourceInfo_PositionsEntry(); + if (isSet(object.key)) obj.key = BigInt(object.key.toString()); + if (isSet(object.value)) obj.value = Number(object.value); + return obj; }, toJSON(message: SourceInfo_PositionsEntry): JsonSafe { const obj: any = {}; @@ -2097,7 +2057,9 @@ export const SourceInfo_PositionsEntry = { }, fromPartial(object: DeepPartial): SourceInfo_PositionsEntry { const message = createBaseSourceInfo_PositionsEntry(); - message.key = object.key !== undefined && object.key !== null ? BigInt(object.key.toString()) : BigInt(0); + if (object.key !== undefined && object.key !== null) { + message.key = BigInt(object.key.toString()); + } message.value = object.value ?? 0; return message; }, @@ -2153,7 +2115,7 @@ function createBaseSourceInfo_MacroCallsEntry(): SourceInfo_MacroCallsEntry { } export const SourceInfo_MacroCallsEntry = { encode(message: SourceInfo_MacroCallsEntry, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.key !== BigInt(0)) { + if (message.key !== undefined) { writer.uint32(8).int64(message.key); } if (message.value !== undefined) { @@ -2182,10 +2144,10 @@ export const SourceInfo_MacroCallsEntry = { return message; }, fromJSON(object: any): SourceInfo_MacroCallsEntry { - return { - key: isSet(object.key) ? BigInt(object.key.toString()) : BigInt(0), - value: isSet(object.value) ? Expr.fromJSON(object.value) : undefined - }; + const obj = createBaseSourceInfo_MacroCallsEntry(); + if (isSet(object.key)) obj.key = BigInt(object.key.toString()); + if (isSet(object.value)) obj.value = Expr.fromJSON(object.value); + return obj; }, toJSON(message: SourceInfo_MacroCallsEntry): JsonSafe { const obj: any = {}; @@ -2195,8 +2157,12 @@ export const SourceInfo_MacroCallsEntry = { }, fromPartial(object: DeepPartial): SourceInfo_MacroCallsEntry { const message = createBaseSourceInfo_MacroCallsEntry(); - message.key = object.key !== undefined && object.key !== null ? BigInt(object.key.toString()) : BigInt(0); - message.value = object.value !== undefined && object.value !== null ? Expr.fromPartial(object.value) : undefined; + if (object.key !== undefined && object.key !== null) { + message.key = BigInt(object.key.toString()); + } + if (object.value !== undefined && object.value !== null) { + message.value = Expr.fromPartial(object.value); + } return message; }, fromSDK(object: SourceInfo_MacroCallsEntrySDKType): SourceInfo_MacroCallsEntry { @@ -2255,10 +2221,10 @@ function createBaseSourceInfo(): SourceInfo { export const SourceInfo = { typeUrl: "/google.api.expr.v1alpha1.SourceInfo", encode(message: SourceInfo, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.syntaxVersion !== "") { + if (message.syntaxVersion !== undefined) { writer.uint32(10).string(message.syntaxVersion); } - if (message.location !== "") { + if (message.location !== undefined) { writer.uint32(18).string(message.location); } writer.uint32(26).fork(); @@ -2323,23 +2289,23 @@ export const SourceInfo = { return message; }, fromJSON(object: any): SourceInfo { - return { - syntaxVersion: isSet(object.syntaxVersion) ? String(object.syntaxVersion) : "", - location: isSet(object.location) ? String(object.location) : "", - lineOffsets: Array.isArray(object?.lineOffsets) ? object.lineOffsets.map((e: any) => Number(e)) : [], - positions: isObject(object.positions) ? Object.entries(object.positions).reduce<{ - [key: bigint]: number; - }>((acc, [key, value]) => { - acc[Number(key)] = Number(value); - return acc; - }, {}) : {}, - macroCalls: isObject(object.macroCalls) ? Object.entries(object.macroCalls).reduce<{ - [key: bigint]: Expr; - }>((acc, [key, value]) => { - acc[Number(key)] = Expr.fromJSON(value); - return acc; - }, {}) : {} - }; + const obj = createBaseSourceInfo(); + if (isSet(object.syntaxVersion)) obj.syntaxVersion = String(object.syntaxVersion); + if (isSet(object.location)) obj.location = String(object.location); + if (Array.isArray(object?.lineOffsets)) obj.lineOffsets = object.lineOffsets.map((e: any) => Number(e)); + if (isObject(object.positions)) obj.positions = Object.entries(object.positions).reduce<{ + [key: bigint]: number; + }>((acc, [key, value]) => { + acc[Number(key)] = Number(value); + return acc; + }, {}); + if (isObject(object.macroCalls)) obj.macroCalls = Object.entries(object.macroCalls).reduce<{ + [key: bigint]: Expr; + }>((acc, [key, value]) => { + acc[Number(key)] = Expr.fromJSON(value); + return acc; + }, {}); + return obj; }, toJSON(message: SourceInfo): JsonSafe { const obj: any = {}; @@ -2525,16 +2491,16 @@ function createBaseSourcePosition(): SourcePosition { export const SourcePosition = { typeUrl: "/google.api.expr.v1alpha1.SourcePosition", encode(message: SourcePosition, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.location !== "") { + if (message.location !== undefined) { writer.uint32(10).string(message.location); } - if (message.offset !== 0) { + if (message.offset !== undefined) { writer.uint32(16).int32(message.offset); } - if (message.line !== 0) { + if (message.line !== undefined) { writer.uint32(24).int32(message.line); } - if (message.column !== 0) { + if (message.column !== undefined) { writer.uint32(32).int32(message.column); } return writer; @@ -2566,12 +2532,12 @@ export const SourcePosition = { return message; }, fromJSON(object: any): SourcePosition { - return { - location: isSet(object.location) ? String(object.location) : "", - offset: isSet(object.offset) ? Number(object.offset) : 0, - line: isSet(object.line) ? Number(object.line) : 0, - column: isSet(object.column) ? Number(object.column) : 0 - }; + const obj = createBaseSourcePosition(); + if (isSet(object.location)) obj.location = String(object.location); + if (isSet(object.offset)) obj.offset = Number(object.offset); + if (isSet(object.line)) obj.line = Number(object.line); + if (isSet(object.column)) obj.column = Number(object.column); + return obj; }, toJSON(message: SourcePosition): JsonSafe { const obj: any = {}; 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 f835ee499c..f6a2b19c5c 100644 --- a/__fixtures__/v-next/outputv4/google/api/expr/v1alpha1/value.ts +++ b/__fixtures__/v-next/outputv4/google/api/expr/v1alpha1/value.ts @@ -1,9 +1,8 @@ -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 { JsonSafe } from "../../../../json-safe"; -import { ComputedRef } from "vue"; +import { NullValue, NullValueSDKType, nullValueFromJSON, nullValueToJSON } from "../../../protobuf/struct.js"; +import { Any, AnySDKType } from "../../../protobuf/any.js"; +import { BinaryReader, BinaryWriter } from "../../../../binary.js"; +import { isSet, bytesFromBase64, base64FromBytes, DeepPartial } from "../../../../helpers.js"; +import { JsonSafe } from "../../../../json-safe.js"; export const protobufPackage = "google.api.expr.v1alpha1"; /** * Represents a CEL value. @@ -37,20 +36,6 @@ export interface Value { /** Type value. */ typeValue?: string; } -export interface ReactiveValue { - nullValue?: ComputedRef; - boolValue?: ComputedRef; - int64Value?: ComputedRef; - uint64Value?: ComputedRef; - doubleValue?: ComputedRef; - stringValue?: ComputedRef; - bytesValue?: ComputedRef; - enumValue?: ComputedRef; - objectValue?: ComputedRef; - mapValue?: ComputedRef; - listValue?: ComputedRef; - typeValue?: ComputedRef; -} export interface ValueProtoMsg { typeUrl: "/google.api.expr.v1alpha1.Value"; value: Uint8Array; @@ -82,10 +67,6 @@ export interface EnumValue { /** The value of the enum. */ value: number; } -export interface ReactiveEnumValue { - type: ComputedRef; - value: ComputedRef; -} export interface EnumValueProtoMsg { typeUrl: "/google.api.expr.v1alpha1.EnumValue"; value: Uint8Array; @@ -105,9 +86,6 @@ export interface ListValue { /** The ordered values in the list. */ values: Value[]; } -export interface ReactiveListValue { - values: ComputedRef; -} export interface ListValueProtoMsg { typeUrl: "/google.api.expr.v1alpha1.ListValue"; value: Uint8Array; @@ -136,9 +114,6 @@ export interface MapValue { */ entries: MapValue_Entry[]; } -export interface ReactiveMapValue { - entries: ComputedRef; -} export interface MapValueProtoMsg { typeUrl: "/google.api.expr.v1alpha1.MapValue"; value: Uint8Array; @@ -164,10 +139,6 @@ export interface MapValue_Entry { /** The value. */ value?: Value; } -export interface ReactiveMapValue_Entry { - key?: ComputedRef; - value?: ComputedRef; -} export interface MapValue_EntryProtoMsg { typeUrl: "/google.api.expr.v1alpha1.Entry"; value: Uint8Array; @@ -285,20 +256,20 @@ export const Value = { return message; }, fromJSON(object: any): Value { - return { - nullValue: isSet(object.nullValue) ? nullValueFromJSON(object.nullValue) : undefined, - boolValue: isSet(object.boolValue) ? Boolean(object.boolValue) : undefined, - int64Value: isSet(object.int64Value) ? BigInt(object.int64Value.toString()) : undefined, - uint64Value: isSet(object.uint64Value) ? BigInt(object.uint64Value.toString()) : undefined, - doubleValue: isSet(object.doubleValue) ? Number(object.doubleValue) : undefined, - stringValue: isSet(object.stringValue) ? String(object.stringValue) : undefined, - bytesValue: isSet(object.bytesValue) ? bytesFromBase64(object.bytesValue) : undefined, - enumValue: isSet(object.enumValue) ? EnumValue.fromJSON(object.enumValue) : undefined, - objectValue: isSet(object.objectValue) ? Any.fromJSON(object.objectValue) : undefined, - mapValue: isSet(object.mapValue) ? MapValue.fromJSON(object.mapValue) : undefined, - listValue: isSet(object.listValue) ? ListValue.fromJSON(object.listValue) : undefined, - typeValue: isSet(object.typeValue) ? String(object.typeValue) : undefined - }; + const obj = createBaseValue(); + if (isSet(object.nullValue)) obj.nullValue = nullValueFromJSON(object.nullValue); + if (isSet(object.boolValue)) obj.boolValue = Boolean(object.boolValue); + if (isSet(object.int64Value)) obj.int64Value = BigInt(object.int64Value.toString()); + if (isSet(object.uint64Value)) obj.uint64Value = BigInt(object.uint64Value.toString()); + if (isSet(object.doubleValue)) obj.doubleValue = Number(object.doubleValue); + if (isSet(object.stringValue)) obj.stringValue = String(object.stringValue); + if (isSet(object.bytesValue)) obj.bytesValue = bytesFromBase64(object.bytesValue); + if (isSet(object.enumValue)) obj.enumValue = EnumValue.fromJSON(object.enumValue); + if (isSet(object.objectValue)) obj.objectValue = Any.fromJSON(object.objectValue); + if (isSet(object.mapValue)) obj.mapValue = MapValue.fromJSON(object.mapValue); + if (isSet(object.listValue)) obj.listValue = ListValue.fromJSON(object.listValue); + if (isSet(object.typeValue)) obj.typeValue = String(object.typeValue); + return obj; }, toJSON(message: Value): JsonSafe { const obj: any = {}; @@ -324,15 +295,27 @@ export const Value = { const message = createBaseValue(); message.nullValue = object.nullValue ?? undefined; message.boolValue = object.boolValue ?? undefined; - message.int64Value = object.int64Value !== undefined && object.int64Value !== null ? BigInt(object.int64Value.toString()) : undefined; - message.uint64Value = object.uint64Value !== undefined && object.uint64Value !== null ? BigInt(object.uint64Value.toString()) : undefined; + if (object.int64Value !== undefined && object.int64Value !== null) { + message.int64Value = BigInt(object.int64Value.toString()); + } + if (object.uint64Value !== undefined && object.uint64Value !== null) { + message.uint64Value = BigInt(object.uint64Value.toString()); + } message.doubleValue = object.doubleValue ?? undefined; message.stringValue = object.stringValue ?? undefined; message.bytesValue = object.bytesValue ?? undefined; - message.enumValue = object.enumValue !== undefined && object.enumValue !== null ? EnumValue.fromPartial(object.enumValue) : undefined; - message.objectValue = object.objectValue !== undefined && object.objectValue !== null ? Any.fromPartial(object.objectValue) : undefined; - message.mapValue = object.mapValue !== undefined && object.mapValue !== null ? MapValue.fromPartial(object.mapValue) : undefined; - message.listValue = object.listValue !== undefined && object.listValue !== null ? ListValue.fromPartial(object.listValue) : undefined; + if (object.enumValue !== undefined && object.enumValue !== null) { + message.enumValue = EnumValue.fromPartial(object.enumValue); + } + if (object.objectValue !== undefined && object.objectValue !== null) { + message.objectValue = Any.fromPartial(object.objectValue); + } + if (object.mapValue !== undefined && object.mapValue !== null) { + message.mapValue = MapValue.fromPartial(object.mapValue); + } + if (object.listValue !== undefined && object.listValue !== null) { + message.listValue = ListValue.fromPartial(object.listValue); + } message.typeValue = object.typeValue ?? undefined; return message; }, @@ -465,10 +448,10 @@ function createBaseEnumValue(): EnumValue { export const EnumValue = { typeUrl: "/google.api.expr.v1alpha1.EnumValue", encode(message: EnumValue, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.type !== "") { + if (message.type !== undefined) { writer.uint32(10).string(message.type); } - if (message.value !== 0) { + if (message.value !== undefined) { writer.uint32(16).int32(message.value); } return writer; @@ -494,10 +477,10 @@ export const EnumValue = { return message; }, fromJSON(object: any): EnumValue { - return { - type: isSet(object.type) ? String(object.type) : "", - value: isSet(object.value) ? Number(object.value) : 0 - }; + const obj = createBaseEnumValue(); + if (isSet(object.type)) obj.type = String(object.type); + if (isSet(object.value)) obj.value = Number(object.value); + return obj; }, toJSON(message: EnumValue): JsonSafe { const obj: any = {}; @@ -592,9 +575,9 @@ export const ListValue = { return message; }, fromJSON(object: any): ListValue { - return { - values: Array.isArray(object?.values) ? object.values.map((e: any) => Value.fromJSON(e)) : [] - }; + const obj = createBaseListValue(); + if (Array.isArray(object?.values)) obj.values = object.values.map((e: any) => Value.fromJSON(e)); + return obj; }, toJSON(message: ListValue): JsonSafe { const obj: any = {}; @@ -690,9 +673,9 @@ export const MapValue = { return message; }, fromJSON(object: any): MapValue { - return { - entries: Array.isArray(object?.entries) ? object.entries.map((e: any) => MapValue_Entry.fromJSON(e)) : [] - }; + const obj = createBaseMapValue(); + if (Array.isArray(object?.entries)) obj.entries = object.entries.map((e: any) => MapValue_Entry.fromJSON(e)); + return obj; }, toJSON(message: MapValue): JsonSafe { const obj: any = {}; @@ -795,10 +778,10 @@ export const MapValue_Entry = { return message; }, fromJSON(object: any): MapValue_Entry { - return { - key: isSet(object.key) ? Value.fromJSON(object.key) : undefined, - value: isSet(object.value) ? Value.fromJSON(object.value) : undefined - }; + const obj = createBaseMapValue_Entry(); + if (isSet(object.key)) obj.key = Value.fromJSON(object.key); + if (isSet(object.value)) obj.value = Value.fromJSON(object.value); + return obj; }, toJSON(message: MapValue_Entry): JsonSafe { const obj: any = {}; @@ -808,8 +791,12 @@ export const MapValue_Entry = { }, fromPartial(object: DeepPartial): MapValue_Entry { const message = createBaseMapValue_Entry(); - message.key = object.key !== undefined && object.key !== null ? Value.fromPartial(object.key) : undefined; - message.value = object.value !== undefined && object.value !== null ? Value.fromPartial(object.value) : undefined; + if (object.key !== undefined && object.key !== null) { + message.key = Value.fromPartial(object.key); + } + if (object.value !== undefined && object.value !== null) { + message.value = Value.fromPartial(object.value); + } return message; }, fromSDK(object: MapValue_EntrySDKType): MapValue_Entry { 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 089e74b1db..441dd94c7d 100644 --- a/__fixtures__/v-next/outputv4/google/api/expr/v1beta1/decl.ts +++ b/__fixtures__/v-next/outputv4/google/api/expr/v1beta1/decl.ts @@ -1,8 +1,7 @@ -import { Expr, ExprSDKType } from "./expr"; -import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial } from "../../../../helpers"; -import { JsonSafe } from "../../../../json-safe"; -import { ComputedRef } from "vue"; +import { Expr, ExprSDKType } from "./expr.js"; +import { BinaryReader, BinaryWriter } from "../../../../binary.js"; +import { isSet, DeepPartial } from "../../../../helpers.js"; +import { JsonSafe } from "../../../../json-safe.js"; export const protobufPackage = "google.api.expr.v1beta1"; /** A declaration. */ export interface Decl { @@ -17,13 +16,6 @@ export interface Decl { /** A function declaration. */ function?: FunctionDecl; } -export interface ReactiveDecl { - id: ComputedRef; - name: ComputedRef; - doc: ComputedRef; - ident?: ComputedRef; - function?: ComputedRef; -} export interface DeclProtoMsg { typeUrl: "/google.api.expr.v1beta1.Decl"; value: Uint8Array; @@ -53,11 +45,6 @@ export interface DeclType { */ typeParams: DeclType[]; } -export interface ReactiveDeclType { - id: ComputedRef; - type: ComputedRef; - typeParams: ComputedRef; -} export interface DeclTypeProtoMsg { typeUrl: "/google.api.expr.v1beta1.DeclType"; value: Uint8Array; @@ -80,10 +67,6 @@ export interface IdentDecl { /** Optional value of the identifier. */ value?: Expr; } -export interface ReactiveIdentDecl { - type?: ComputedRef; - value?: ComputedRef; -} export interface IdentDeclProtoMsg { typeUrl: "/google.api.expr.v1beta1.IdentDecl"; value: Uint8Array; @@ -102,11 +85,6 @@ export interface FunctionDecl { /** If the first argument of the function is the receiver. */ receiverFunction: boolean; } -export interface ReactiveFunctionDecl { - args: ComputedRef; - returnType?: ComputedRef; - receiverFunction: ComputedRef; -} export interface FunctionDeclProtoMsg { typeUrl: "/google.api.expr.v1beta1.FunctionDecl"; value: Uint8Array; @@ -129,13 +107,13 @@ function createBaseDecl(): Decl { export const Decl = { typeUrl: "/google.api.expr.v1beta1.Decl", encode(message: Decl, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.id !== 0) { + if (message.id !== undefined) { writer.uint32(8).int32(message.id); } - if (message.name !== "") { + if (message.name !== undefined) { writer.uint32(18).string(message.name); } - if (message.doc !== "") { + if (message.doc !== undefined) { writer.uint32(26).string(message.doc); } if (message.ident !== undefined) { @@ -176,13 +154,13 @@ export const Decl = { return message; }, fromJSON(object: any): Decl { - return { - id: isSet(object.id) ? Number(object.id) : 0, - name: isSet(object.name) ? String(object.name) : "", - doc: isSet(object.doc) ? String(object.doc) : "", - ident: isSet(object.ident) ? IdentDecl.fromJSON(object.ident) : undefined, - function: isSet(object.function) ? FunctionDecl.fromJSON(object.function) : undefined - }; + const obj = createBaseDecl(); + if (isSet(object.id)) obj.id = Number(object.id); + if (isSet(object.name)) obj.name = String(object.name); + if (isSet(object.doc)) obj.doc = String(object.doc); + if (isSet(object.ident)) obj.ident = IdentDecl.fromJSON(object.ident); + if (isSet(object.function)) obj.function = FunctionDecl.fromJSON(object.function); + return obj; }, toJSON(message: Decl): JsonSafe { const obj: any = {}; @@ -198,8 +176,12 @@ export const Decl = { message.id = object.id ?? 0; message.name = object.name ?? ""; message.doc = object.doc ?? ""; - message.ident = object.ident !== undefined && object.ident !== null ? IdentDecl.fromPartial(object.ident) : undefined; - message.function = object.function !== undefined && object.function !== null ? FunctionDecl.fromPartial(object.function) : undefined; + if (object.ident !== undefined && object.ident !== null) { + message.ident = IdentDecl.fromPartial(object.ident); + } + if (object.function !== undefined && object.function !== null) { + message.function = FunctionDecl.fromPartial(object.function); + } return message; }, fromSDK(object: DeclSDKType): Decl { @@ -283,10 +265,10 @@ function createBaseDeclType(): DeclType { export const DeclType = { typeUrl: "/google.api.expr.v1beta1.DeclType", encode(message: DeclType, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.id !== 0) { + if (message.id !== undefined) { writer.uint32(8).int32(message.id); } - if (message.type !== "") { + if (message.type !== undefined) { writer.uint32(18).string(message.type); } for (const v of message.typeParams) { @@ -318,11 +300,11 @@ export const DeclType = { return message; }, fromJSON(object: any): DeclType { - return { - id: isSet(object.id) ? Number(object.id) : 0, - type: isSet(object.type) ? String(object.type) : "", - typeParams: Array.isArray(object?.typeParams) ? object.typeParams.map((e: any) => DeclType.fromJSON(e)) : [] - }; + const obj = createBaseDeclType(); + if (isSet(object.id)) obj.id = Number(object.id); + if (isSet(object.type)) obj.type = String(object.type); + if (Array.isArray(object?.typeParams)) obj.typeParams = object.typeParams.map((e: any) => DeclType.fromJSON(e)); + return obj; }, toJSON(message: DeclType): JsonSafe { const obj: any = {}; @@ -443,10 +425,10 @@ export const IdentDecl = { return message; }, fromJSON(object: any): IdentDecl { - return { - type: isSet(object.type) ? DeclType.fromJSON(object.type) : undefined, - value: isSet(object.value) ? Expr.fromJSON(object.value) : undefined - }; + const obj = createBaseIdentDecl(); + if (isSet(object.type)) obj.type = DeclType.fromJSON(object.type); + if (isSet(object.value)) obj.value = Expr.fromJSON(object.value); + return obj; }, toJSON(message: IdentDecl): JsonSafe { const obj: any = {}; @@ -456,8 +438,12 @@ export const IdentDecl = { }, fromPartial(object: DeepPartial): IdentDecl { const message = createBaseIdentDecl(); - message.type = object.type !== undefined && object.type !== null ? DeclType.fromPartial(object.type) : undefined; - message.value = object.value !== undefined && object.value !== null ? Expr.fromPartial(object.value) : undefined; + if (object.type !== undefined && object.type !== null) { + message.type = DeclType.fromPartial(object.type); + } + if (object.value !== undefined && object.value !== null) { + message.value = Expr.fromPartial(object.value); + } return message; }, fromSDK(object: IdentDeclSDKType): IdentDecl { @@ -526,7 +512,7 @@ export const FunctionDecl = { if (message.returnType !== undefined) { DeclType.encode(message.returnType, writer.uint32(18).fork()).ldelim(); } - if (message.receiverFunction === true) { + if (message.receiverFunction !== undefined) { writer.uint32(24).bool(message.receiverFunction); } return writer; @@ -555,11 +541,11 @@ export const FunctionDecl = { return message; }, fromJSON(object: any): FunctionDecl { - return { - args: Array.isArray(object?.args) ? object.args.map((e: any) => IdentDecl.fromJSON(e)) : [], - returnType: isSet(object.returnType) ? DeclType.fromJSON(object.returnType) : undefined, - receiverFunction: isSet(object.receiverFunction) ? Boolean(object.receiverFunction) : false - }; + const obj = createBaseFunctionDecl(); + if (Array.isArray(object?.args)) obj.args = object.args.map((e: any) => IdentDecl.fromJSON(e)); + if (isSet(object.returnType)) obj.returnType = DeclType.fromJSON(object.returnType); + if (isSet(object.receiverFunction)) obj.receiverFunction = Boolean(object.receiverFunction); + return obj; }, toJSON(message: FunctionDecl): JsonSafe { const obj: any = {}; @@ -575,7 +561,9 @@ export const FunctionDecl = { fromPartial(object: DeepPartial): FunctionDecl { const message = createBaseFunctionDecl(); message.args = object.args?.map(e => IdentDecl.fromPartial(e)) || []; - message.returnType = object.returnType !== undefined && object.returnType !== null ? DeclType.fromPartial(object.returnType) : undefined; + if (object.returnType !== undefined && object.returnType !== null) { + message.returnType = DeclType.fromPartial(object.returnType); + } message.receiverFunction = object.receiverFunction ?? false; return message; }, 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 582b66ff37..f3d7fa3abf 100644 --- a/__fixtures__/v-next/outputv4/google/api/expr/v1beta1/eval.ts +++ b/__fixtures__/v-next/outputv4/google/api/expr/v1beta1/eval.ts @@ -1,9 +1,8 @@ -import { Value, ValueSDKType } from "./value"; -import { Status, StatusSDKType } from "../../../rpc/status"; -import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { JsonSafe } from "../../../../json-safe"; -import { DeepPartial, isSet } from "../../../../helpers"; -import { ComputedRef } from "vue"; +import { Value, ValueSDKType } from "./value.js"; +import { Status, StatusSDKType } from "../../../rpc/status.js"; +import { BinaryReader, BinaryWriter } from "../../../../binary.js"; +import { JsonSafe } from "../../../../json-safe.js"; +import { DeepPartial, isSet } from "../../../../helpers.js"; export const protobufPackage = "google.api.expr.v1beta1"; /** * The state of an evaluation. @@ -21,10 +20,6 @@ export interface EvalState { */ results: EvalState_Result[]; } -export interface ReactiveEvalState { - values: ComputedRef; - results: ComputedRef; -} export interface EvalStateProtoMsg { typeUrl: "/google.api.expr.v1beta1.EvalState"; value: Uint8Array; @@ -45,10 +40,6 @@ export interface EvalState_Result { /** The index in `values` of the resulting value. */ value: number; } -export interface ReactiveEvalState_Result { - expr?: ComputedRef; - value: ComputedRef; -} export interface EvalState_ResultProtoMsg { typeUrl: "/google.api.expr.v1beta1.Result"; value: Uint8Array; @@ -109,11 +100,6 @@ export interface ExprValue { */ unknown?: UnknownSet; } -export interface ReactiveExprValue { - value?: ComputedRef; - error?: ComputedRef; - unknown?: ComputedRef; -} export interface ExprValueProtoMsg { typeUrl: "/google.api.expr.v1beta1.ExprValue"; value: Uint8Array; @@ -133,9 +119,6 @@ export interface ErrorSet { /** The errors in the set. */ errors: Status[]; } -export interface ReactiveErrorSet { - errors: ComputedRef; -} export interface ErrorSetProtoMsg { typeUrl: "/google.api.expr.v1beta1.ErrorSet"; value: Uint8Array; @@ -157,9 +140,6 @@ export interface UnknownSet { /** The ids of the expressions with unknown values. */ exprs: IdRef[]; } -export interface ReactiveUnknownSet { - exprs: ComputedRef; -} export interface UnknownSetProtoMsg { typeUrl: "/google.api.expr.v1beta1.UnknownSet"; value: Uint8Array; @@ -177,9 +157,6 @@ export interface IdRef { /** The expression id. */ id: number; } -export interface ReactiveIdRef { - id: ComputedRef; -} export interface IdRefProtoMsg { typeUrl: "/google.api.expr.v1beta1.IdRef"; value: Uint8Array; @@ -226,10 +203,10 @@ export const EvalState = { return message; }, fromJSON(object: any): EvalState { - return { - values: Array.isArray(object?.values) ? object.values.map((e: any) => ExprValue.fromJSON(e)) : [], - results: Array.isArray(object?.results) ? object.results.map((e: any) => EvalState_Result.fromJSON(e)) : [] - }; + const obj = createBaseEvalState(); + if (Array.isArray(object?.values)) obj.values = object.values.map((e: any) => ExprValue.fromJSON(e)); + if (Array.isArray(object?.results)) obj.results = object.results.map((e: any) => EvalState_Result.fromJSON(e)); + return obj; }, toJSON(message: EvalState): JsonSafe { const obj: any = {}; @@ -325,7 +302,7 @@ export const EvalState_Result = { if (message.expr !== undefined) { IdRef.encode(message.expr, writer.uint32(10).fork()).ldelim(); } - if (message.value !== 0) { + if (message.value !== undefined) { writer.uint32(16).int32(message.value); } return writer; @@ -351,10 +328,10 @@ export const EvalState_Result = { return message; }, fromJSON(object: any): EvalState_Result { - return { - expr: isSet(object.expr) ? IdRef.fromJSON(object.expr) : undefined, - value: isSet(object.value) ? Number(object.value) : 0 - }; + const obj = createBaseEvalState_Result(); + if (isSet(object.expr)) obj.expr = IdRef.fromJSON(object.expr); + if (isSet(object.value)) obj.value = Number(object.value); + return obj; }, toJSON(message: EvalState_Result): JsonSafe { const obj: any = {}; @@ -364,7 +341,9 @@ export const EvalState_Result = { }, fromPartial(object: DeepPartial): EvalState_Result { const message = createBaseEvalState_Result(); - message.expr = object.expr !== undefined && object.expr !== null ? IdRef.fromPartial(object.expr) : undefined; + if (object.expr !== undefined && object.expr !== null) { + message.expr = IdRef.fromPartial(object.expr); + } message.value = object.value ?? 0; return message; }, @@ -463,11 +442,11 @@ export const ExprValue = { return message; }, fromJSON(object: any): ExprValue { - return { - value: isSet(object.value) ? Value.fromJSON(object.value) : undefined, - error: isSet(object.error) ? ErrorSet.fromJSON(object.error) : undefined, - unknown: isSet(object.unknown) ? UnknownSet.fromJSON(object.unknown) : undefined - }; + const obj = createBaseExprValue(); + if (isSet(object.value)) obj.value = Value.fromJSON(object.value); + if (isSet(object.error)) obj.error = ErrorSet.fromJSON(object.error); + if (isSet(object.unknown)) obj.unknown = UnknownSet.fromJSON(object.unknown); + return obj; }, toJSON(message: ExprValue): JsonSafe { const obj: any = {}; @@ -478,9 +457,15 @@ export const ExprValue = { }, fromPartial(object: DeepPartial): ExprValue { const message = createBaseExprValue(); - message.value = object.value !== undefined && object.value !== null ? Value.fromPartial(object.value) : undefined; - message.error = object.error !== undefined && object.error !== null ? ErrorSet.fromPartial(object.error) : undefined; - message.unknown = object.unknown !== undefined && object.unknown !== null ? UnknownSet.fromPartial(object.unknown) : undefined; + if (object.value !== undefined && object.value !== null) { + message.value = Value.fromPartial(object.value); + } + if (object.error !== undefined && object.error !== null) { + message.error = ErrorSet.fromPartial(object.error); + } + if (object.unknown !== undefined && object.unknown !== null) { + message.unknown = UnknownSet.fromPartial(object.unknown); + } return message; }, fromSDK(object: ExprValueSDKType): ExprValue { @@ -571,9 +556,9 @@ export const ErrorSet = { return message; }, fromJSON(object: any): ErrorSet { - return { - errors: Array.isArray(object?.errors) ? object.errors.map((e: any) => Status.fromJSON(e)) : [] - }; + const obj = createBaseErrorSet(); + if (Array.isArray(object?.errors)) obj.errors = object.errors.map((e: any) => Status.fromJSON(e)); + return obj; }, toJSON(message: ErrorSet): JsonSafe { const obj: any = {}; @@ -669,9 +654,9 @@ export const UnknownSet = { return message; }, fromJSON(object: any): UnknownSet { - return { - exprs: Array.isArray(object?.exprs) ? object.exprs.map((e: any) => IdRef.fromJSON(e)) : [] - }; + const obj = createBaseUnknownSet(); + if (Array.isArray(object?.exprs)) obj.exprs = object.exprs.map((e: any) => IdRef.fromJSON(e)); + return obj; }, toJSON(message: UnknownSet): JsonSafe { const obj: any = {}; @@ -744,7 +729,7 @@ function createBaseIdRef(): IdRef { export const IdRef = { typeUrl: "/google.api.expr.v1beta1.IdRef", encode(message: IdRef, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.id !== 0) { + if (message.id !== undefined) { writer.uint32(8).int32(message.id); } return writer; @@ -767,9 +752,9 @@ export const IdRef = { return message; }, fromJSON(object: any): IdRef { - return { - id: isSet(object.id) ? Number(object.id) : 0 - }; + const obj = createBaseIdRef(); + if (isSet(object.id)) obj.id = Number(object.id); + return obj; }, toJSON(message: IdRef): JsonSafe { const obj: any = {}; 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 c15ba44dd2..387732b235 100644 --- a/__fixtures__/v-next/outputv4/google/api/expr/v1beta1/expr.ts +++ b/__fixtures__/v-next/outputv4/google/api/expr/v1beta1/expr.ts @@ -1,9 +1,8 @@ -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 { JsonSafe } from "../../../../json-safe"; -import { ComputedRef } from "vue"; +import { SourceInfo, SourceInfoSDKType } from "./source.js"; +import { NullValue, NullValueSDKType, nullValueFromJSON, nullValueToJSON } from "../../../protobuf/struct.js"; +import { BinaryReader, BinaryWriter } from "../../../../binary.js"; +import { isSet, DeepPartial, bytesFromBase64, base64FromBytes } from "../../../../helpers.js"; +import { JsonSafe } from "../../../../json-safe.js"; export const protobufPackage = "google.api.expr.v1beta1"; /** An expression together with source information as returned by the parser. */ export interface ParsedExpr { @@ -14,11 +13,6 @@ export interface ParsedExpr { /** The syntax version of the source, e.g. `cel1`. */ syntaxVersion: string; } -export interface ReactiveParsedExpr { - expr?: ComputedRef; - sourceInfo?: ComputedRef; - syntaxVersion: ComputedRef; -} export interface ParsedExprProtoMsg { typeUrl: "/google.api.expr.v1beta1.ParsedExpr"; value: Uint8Array; @@ -68,16 +62,6 @@ export interface Expr { /** A comprehension expression. */ comprehensionExpr?: Expr_Comprehension; } -export interface ReactiveExpr { - id: ComputedRef; - literalExpr?: ComputedRef; - identExpr?: ComputedRef; - selectExpr?: ComputedRef; - callExpr?: ComputedRef; - listExpr?: ComputedRef; - structExpr?: ComputedRef; - comprehensionExpr?: ComputedRef; -} export interface ExprProtoMsg { typeUrl: "/google.api.expr.v1beta1.Expr"; value: Uint8Array; @@ -119,9 +103,6 @@ export interface Expr_Ident { */ name: string; } -export interface ReactiveExpr_Ident { - name: ComputedRef; -} export interface Expr_IdentProtoMsg { typeUrl: "/google.api.expr.v1beta1.Ident"; value: Uint8Array; @@ -153,11 +134,6 @@ export interface Expr_Select { */ testOnly: boolean; } -export interface ReactiveExpr_Select { - operand?: ComputedRef; - field: ComputedRef; - testOnly: ComputedRef; -} export interface Expr_SelectProtoMsg { typeUrl: "/google.api.expr.v1beta1.Select"; value: Uint8Array; @@ -184,11 +160,6 @@ export interface Expr_Call { /** The arguments. */ args: Expr[]; } -export interface ReactiveExpr_Call { - target?: ComputedRef; - function: ComputedRef; - args: ComputedRef; -} export interface Expr_CallProtoMsg { typeUrl: "/google.api.expr.v1beta1.Call"; value: Uint8Array; @@ -213,9 +184,6 @@ export interface Expr_CreateList { /** The elements part of the list. */ elements: Expr[]; } -export interface ReactiveExpr_CreateList { - elements: ComputedRef; -} export interface Expr_CreateListProtoMsg { typeUrl: "/google.api.expr.v1beta1.CreateList"; value: Uint8Array; @@ -245,10 +213,6 @@ export interface Expr_CreateStruct { /** The entries in the creation expression. */ entries: Expr_CreateStruct_Entry[]; } -export interface ReactiveExpr_CreateStruct { - type: ComputedRef; - entries: ComputedRef; -} export interface Expr_CreateStructProtoMsg { typeUrl: "/google.api.expr.v1beta1.CreateStruct"; value: Uint8Array; @@ -279,12 +243,6 @@ export interface Expr_CreateStruct_Entry { /** Required. The value assigned to the key. */ value?: Expr; } -export interface ReactiveExpr_CreateStruct_Entry { - id: ComputedRef; - fieldKey?: ComputedRef; - mapKey?: ComputedRef; - value?: ComputedRef; -} export interface Expr_CreateStruct_EntryProtoMsg { typeUrl: "/google.api.expr.v1beta1.Entry"; value: Uint8Array; @@ -353,15 +311,6 @@ export interface Expr_Comprehension { */ result?: Expr; } -export interface ReactiveExpr_Comprehension { - iterVar: ComputedRef; - iterRange?: ComputedRef; - accuVar: ComputedRef; - accuInit?: ComputedRef; - loopCondition?: ComputedRef; - loopStep?: ComputedRef; - result?: ComputedRef; -} export interface Expr_ComprehensionProtoMsg { typeUrl: "/google.api.expr.v1beta1.Comprehension"; value: Uint8Array; @@ -432,15 +381,6 @@ export interface Literal { /** bytes value. */ bytesValue?: Uint8Array; } -export interface ReactiveLiteral { - nullValue?: ComputedRef; - boolValue?: ComputedRef; - int64Value?: ComputedRef; - uint64Value?: ComputedRef; - doubleValue?: ComputedRef; - stringValue?: ComputedRef; - bytesValue?: ComputedRef; -} export interface LiteralProtoMsg { typeUrl: "/google.api.expr.v1beta1.Literal"; value: Uint8Array; @@ -483,7 +423,7 @@ export const ParsedExpr = { if (message.sourceInfo !== undefined) { SourceInfo.encode(message.sourceInfo, writer.uint32(26).fork()).ldelim(); } - if (message.syntaxVersion !== "") { + if (message.syntaxVersion !== undefined) { writer.uint32(34).string(message.syntaxVersion); } return writer; @@ -512,11 +452,11 @@ export const ParsedExpr = { return message; }, fromJSON(object: any): ParsedExpr { - return { - expr: isSet(object.expr) ? Expr.fromJSON(object.expr) : undefined, - sourceInfo: isSet(object.sourceInfo) ? SourceInfo.fromJSON(object.sourceInfo) : undefined, - syntaxVersion: isSet(object.syntaxVersion) ? String(object.syntaxVersion) : "" - }; + const obj = createBaseParsedExpr(); + if (isSet(object.expr)) obj.expr = Expr.fromJSON(object.expr); + if (isSet(object.sourceInfo)) obj.sourceInfo = SourceInfo.fromJSON(object.sourceInfo); + if (isSet(object.syntaxVersion)) obj.syntaxVersion = String(object.syntaxVersion); + return obj; }, toJSON(message: ParsedExpr): JsonSafe { const obj: any = {}; @@ -527,8 +467,12 @@ export const ParsedExpr = { }, fromPartial(object: DeepPartial): ParsedExpr { const message = createBaseParsedExpr(); - message.expr = object.expr !== undefined && object.expr !== null ? Expr.fromPartial(object.expr) : undefined; - message.sourceInfo = object.sourceInfo !== undefined && object.sourceInfo !== null ? SourceInfo.fromPartial(object.sourceInfo) : undefined; + if (object.expr !== undefined && object.expr !== null) { + message.expr = Expr.fromPartial(object.expr); + } + if (object.sourceInfo !== undefined && object.sourceInfo !== null) { + message.sourceInfo = SourceInfo.fromPartial(object.sourceInfo); + } message.syntaxVersion = object.syntaxVersion ?? ""; return message; }, @@ -604,7 +548,7 @@ function createBaseExpr(): Expr { export const Expr = { typeUrl: "/google.api.expr.v1beta1.Expr", encode(message: Expr, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.id !== 0) { + if (message.id !== undefined) { writer.uint32(16).int32(message.id); } if (message.literalExpr !== undefined) { @@ -669,16 +613,16 @@ export const Expr = { return message; }, fromJSON(object: any): Expr { - return { - id: isSet(object.id) ? Number(object.id) : 0, - literalExpr: isSet(object.literalExpr) ? Literal.fromJSON(object.literalExpr) : undefined, - identExpr: isSet(object.identExpr) ? Expr_Ident.fromJSON(object.identExpr) : undefined, - selectExpr: isSet(object.selectExpr) ? Expr_Select.fromJSON(object.selectExpr) : undefined, - callExpr: isSet(object.callExpr) ? Expr_Call.fromJSON(object.callExpr) : undefined, - listExpr: isSet(object.listExpr) ? Expr_CreateList.fromJSON(object.listExpr) : undefined, - structExpr: isSet(object.structExpr) ? Expr_CreateStruct.fromJSON(object.structExpr) : undefined, - comprehensionExpr: isSet(object.comprehensionExpr) ? Expr_Comprehension.fromJSON(object.comprehensionExpr) : undefined - }; + const obj = createBaseExpr(); + if (isSet(object.id)) obj.id = Number(object.id); + if (isSet(object.literalExpr)) obj.literalExpr = Literal.fromJSON(object.literalExpr); + if (isSet(object.identExpr)) obj.identExpr = Expr_Ident.fromJSON(object.identExpr); + if (isSet(object.selectExpr)) obj.selectExpr = Expr_Select.fromJSON(object.selectExpr); + if (isSet(object.callExpr)) obj.callExpr = Expr_Call.fromJSON(object.callExpr); + if (isSet(object.listExpr)) obj.listExpr = Expr_CreateList.fromJSON(object.listExpr); + if (isSet(object.structExpr)) obj.structExpr = Expr_CreateStruct.fromJSON(object.structExpr); + if (isSet(object.comprehensionExpr)) obj.comprehensionExpr = Expr_Comprehension.fromJSON(object.comprehensionExpr); + return obj; }, toJSON(message: Expr): JsonSafe { const obj: any = {}; @@ -695,13 +639,27 @@ export const Expr = { fromPartial(object: DeepPartial): Expr { const message = createBaseExpr(); message.id = object.id ?? 0; - message.literalExpr = object.literalExpr !== undefined && object.literalExpr !== null ? Literal.fromPartial(object.literalExpr) : undefined; - message.identExpr = object.identExpr !== undefined && object.identExpr !== null ? Expr_Ident.fromPartial(object.identExpr) : undefined; - message.selectExpr = object.selectExpr !== undefined && object.selectExpr !== null ? Expr_Select.fromPartial(object.selectExpr) : undefined; - message.callExpr = object.callExpr !== undefined && object.callExpr !== null ? Expr_Call.fromPartial(object.callExpr) : undefined; - message.listExpr = object.listExpr !== undefined && object.listExpr !== null ? Expr_CreateList.fromPartial(object.listExpr) : undefined; - message.structExpr = object.structExpr !== undefined && object.structExpr !== null ? Expr_CreateStruct.fromPartial(object.structExpr) : undefined; - message.comprehensionExpr = object.comprehensionExpr !== undefined && object.comprehensionExpr !== null ? Expr_Comprehension.fromPartial(object.comprehensionExpr) : undefined; + if (object.literalExpr !== undefined && object.literalExpr !== null) { + message.literalExpr = Literal.fromPartial(object.literalExpr); + } + if (object.identExpr !== undefined && object.identExpr !== null) { + message.identExpr = Expr_Ident.fromPartial(object.identExpr); + } + if (object.selectExpr !== undefined && object.selectExpr !== null) { + message.selectExpr = Expr_Select.fromPartial(object.selectExpr); + } + if (object.callExpr !== undefined && object.callExpr !== null) { + message.callExpr = Expr_Call.fromPartial(object.callExpr); + } + if (object.listExpr !== undefined && object.listExpr !== null) { + message.listExpr = Expr_CreateList.fromPartial(object.listExpr); + } + if (object.structExpr !== undefined && object.structExpr !== null) { + message.structExpr = Expr_CreateStruct.fromPartial(object.structExpr); + } + if (object.comprehensionExpr !== undefined && object.comprehensionExpr !== null) { + message.comprehensionExpr = Expr_Comprehension.fromPartial(object.comprehensionExpr); + } return message; }, fromSDK(object: ExprSDKType): Expr { @@ -804,7 +762,7 @@ function createBaseExpr_Ident(): Expr_Ident { export const Expr_Ident = { typeUrl: "/google.api.expr.v1beta1.Ident", encode(message: Expr_Ident, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.name !== "") { + if (message.name !== undefined) { writer.uint32(10).string(message.name); } return writer; @@ -827,9 +785,9 @@ export const Expr_Ident = { return message; }, fromJSON(object: any): Expr_Ident { - return { - name: isSet(object.name) ? String(object.name) : "" - }; + const obj = createBaseExpr_Ident(); + if (isSet(object.name)) obj.name = String(object.name); + return obj; }, toJSON(message: Expr_Ident): JsonSafe { const obj: any = {}; @@ -897,10 +855,10 @@ export const Expr_Select = { if (message.operand !== undefined) { Expr.encode(message.operand, writer.uint32(10).fork()).ldelim(); } - if (message.field !== "") { + if (message.field !== undefined) { writer.uint32(18).string(message.field); } - if (message.testOnly === true) { + if (message.testOnly !== undefined) { writer.uint32(24).bool(message.testOnly); } return writer; @@ -929,11 +887,11 @@ export const Expr_Select = { return message; }, fromJSON(object: any): Expr_Select { - return { - operand: isSet(object.operand) ? Expr.fromJSON(object.operand) : undefined, - field: isSet(object.field) ? String(object.field) : "", - testOnly: isSet(object.testOnly) ? Boolean(object.testOnly) : false - }; + const obj = createBaseExpr_Select(); + if (isSet(object.operand)) obj.operand = Expr.fromJSON(object.operand); + if (isSet(object.field)) obj.field = String(object.field); + if (isSet(object.testOnly)) obj.testOnly = Boolean(object.testOnly); + return obj; }, toJSON(message: Expr_Select): JsonSafe { const obj: any = {}; @@ -944,7 +902,9 @@ export const Expr_Select = { }, fromPartial(object: DeepPartial): Expr_Select { const message = createBaseExpr_Select(); - message.operand = object.operand !== undefined && object.operand !== null ? Expr.fromPartial(object.operand) : undefined; + if (object.operand !== undefined && object.operand !== null) { + message.operand = Expr.fromPartial(object.operand); + } message.field = object.field ?? ""; message.testOnly = object.testOnly ?? false; return message; @@ -1019,7 +979,7 @@ export const Expr_Call = { if (message.target !== undefined) { Expr.encode(message.target, writer.uint32(10).fork()).ldelim(); } - if (message.function !== "") { + if (message.function !== undefined) { writer.uint32(18).string(message.function); } for (const v of message.args) { @@ -1051,11 +1011,11 @@ export const Expr_Call = { return message; }, fromJSON(object: any): Expr_Call { - return { - target: isSet(object.target) ? Expr.fromJSON(object.target) : undefined, - function: isSet(object.function) ? String(object.function) : "", - args: Array.isArray(object?.args) ? object.args.map((e: any) => Expr.fromJSON(e)) : [] - }; + const obj = createBaseExpr_Call(); + if (isSet(object.target)) obj.target = Expr.fromJSON(object.target); + if (isSet(object.function)) obj.function = String(object.function); + if (Array.isArray(object?.args)) obj.args = object.args.map((e: any) => Expr.fromJSON(e)); + return obj; }, toJSON(message: Expr_Call): JsonSafe { const obj: any = {}; @@ -1070,7 +1030,9 @@ export const Expr_Call = { }, fromPartial(object: DeepPartial): Expr_Call { const message = createBaseExpr_Call(); - message.target = object.target !== undefined && object.target !== null ? Expr.fromPartial(object.target) : undefined; + if (object.target !== undefined && object.target !== null) { + message.target = Expr.fromPartial(object.target); + } message.function = object.function ?? ""; message.args = object.args?.map(e => Expr.fromPartial(e)) || []; return message; @@ -1169,9 +1131,9 @@ export const Expr_CreateList = { return message; }, fromJSON(object: any): Expr_CreateList { - return { - elements: Array.isArray(object?.elements) ? object.elements.map((e: any) => Expr.fromJSON(e)) : [] - }; + const obj = createBaseExpr_CreateList(); + if (Array.isArray(object?.elements)) obj.elements = object.elements.map((e: any) => Expr.fromJSON(e)); + return obj; }, toJSON(message: Expr_CreateList): JsonSafe { const obj: any = {}; @@ -1245,7 +1207,7 @@ function createBaseExpr_CreateStruct(): Expr_CreateStruct { export const Expr_CreateStruct = { typeUrl: "/google.api.expr.v1beta1.CreateStruct", encode(message: Expr_CreateStruct, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.type !== "") { + if (message.type !== undefined) { writer.uint32(10).string(message.type); } for (const v of message.entries) { @@ -1274,10 +1236,10 @@ export const Expr_CreateStruct = { return message; }, fromJSON(object: any): Expr_CreateStruct { - return { - type: isSet(object.type) ? String(object.type) : "", - entries: Array.isArray(object?.entries) ? object.entries.map((e: any) => Expr_CreateStruct_Entry.fromJSON(e)) : [] - }; + const obj = createBaseExpr_CreateStruct(); + if (isSet(object.type)) obj.type = String(object.type); + if (Array.isArray(object?.entries)) obj.entries = object.entries.map((e: any) => Expr_CreateStruct_Entry.fromJSON(e)); + return obj; }, toJSON(message: Expr_CreateStruct): JsonSafe { const obj: any = {}; @@ -1362,7 +1324,7 @@ function createBaseExpr_CreateStruct_Entry(): Expr_CreateStruct_Entry { export const Expr_CreateStruct_Entry = { typeUrl: "/google.api.expr.v1beta1.Entry", encode(message: Expr_CreateStruct_Entry, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.id !== 0) { + if (message.id !== undefined) { writer.uint32(8).int32(message.id); } if (message.fieldKey !== undefined) { @@ -1403,12 +1365,12 @@ export const Expr_CreateStruct_Entry = { return message; }, fromJSON(object: any): Expr_CreateStruct_Entry { - return { - id: isSet(object.id) ? Number(object.id) : 0, - fieldKey: isSet(object.fieldKey) ? String(object.fieldKey) : undefined, - mapKey: isSet(object.mapKey) ? Expr.fromJSON(object.mapKey) : undefined, - value: isSet(object.value) ? Expr.fromJSON(object.value) : undefined - }; + const obj = createBaseExpr_CreateStruct_Entry(); + if (isSet(object.id)) obj.id = Number(object.id); + if (isSet(object.fieldKey)) obj.fieldKey = String(object.fieldKey); + if (isSet(object.mapKey)) obj.mapKey = Expr.fromJSON(object.mapKey); + if (isSet(object.value)) obj.value = Expr.fromJSON(object.value); + return obj; }, toJSON(message: Expr_CreateStruct_Entry): JsonSafe { const obj: any = {}; @@ -1422,8 +1384,12 @@ export const Expr_CreateStruct_Entry = { const message = createBaseExpr_CreateStruct_Entry(); message.id = object.id ?? 0; message.fieldKey = object.fieldKey ?? undefined; - message.mapKey = object.mapKey !== undefined && object.mapKey !== null ? Expr.fromPartial(object.mapKey) : undefined; - message.value = object.value !== undefined && object.value !== null ? Expr.fromPartial(object.value) : undefined; + if (object.mapKey !== undefined && object.mapKey !== null) { + message.mapKey = Expr.fromPartial(object.mapKey); + } + if (object.value !== undefined && object.value !== null) { + message.value = Expr.fromPartial(object.value); + } return message; }, fromSDK(object: Expr_CreateStruct_EntrySDKType): Expr_CreateStruct_Entry { @@ -1504,13 +1470,13 @@ function createBaseExpr_Comprehension(): Expr_Comprehension { export const Expr_Comprehension = { typeUrl: "/google.api.expr.v1beta1.Comprehension", encode(message: Expr_Comprehension, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.iterVar !== "") { + if (message.iterVar !== undefined) { writer.uint32(10).string(message.iterVar); } if (message.iterRange !== undefined) { Expr.encode(message.iterRange, writer.uint32(18).fork()).ldelim(); } - if (message.accuVar !== "") { + if (message.accuVar !== undefined) { writer.uint32(26).string(message.accuVar); } if (message.accuInit !== undefined) { @@ -1563,15 +1529,15 @@ export const Expr_Comprehension = { return message; }, fromJSON(object: any): Expr_Comprehension { - return { - iterVar: isSet(object.iterVar) ? String(object.iterVar) : "", - iterRange: isSet(object.iterRange) ? Expr.fromJSON(object.iterRange) : undefined, - accuVar: isSet(object.accuVar) ? String(object.accuVar) : "", - accuInit: isSet(object.accuInit) ? Expr.fromJSON(object.accuInit) : undefined, - loopCondition: isSet(object.loopCondition) ? Expr.fromJSON(object.loopCondition) : undefined, - loopStep: isSet(object.loopStep) ? Expr.fromJSON(object.loopStep) : undefined, - result: isSet(object.result) ? Expr.fromJSON(object.result) : undefined - }; + const obj = createBaseExpr_Comprehension(); + if (isSet(object.iterVar)) obj.iterVar = String(object.iterVar); + if (isSet(object.iterRange)) obj.iterRange = Expr.fromJSON(object.iterRange); + if (isSet(object.accuVar)) obj.accuVar = String(object.accuVar); + if (isSet(object.accuInit)) obj.accuInit = Expr.fromJSON(object.accuInit); + if (isSet(object.loopCondition)) obj.loopCondition = Expr.fromJSON(object.loopCondition); + if (isSet(object.loopStep)) obj.loopStep = Expr.fromJSON(object.loopStep); + if (isSet(object.result)) obj.result = Expr.fromJSON(object.result); + return obj; }, toJSON(message: Expr_Comprehension): JsonSafe { const obj: any = {}; @@ -1587,12 +1553,22 @@ export const Expr_Comprehension = { fromPartial(object: DeepPartial): Expr_Comprehension { const message = createBaseExpr_Comprehension(); message.iterVar = object.iterVar ?? ""; - message.iterRange = object.iterRange !== undefined && object.iterRange !== null ? Expr.fromPartial(object.iterRange) : undefined; + if (object.iterRange !== undefined && object.iterRange !== null) { + message.iterRange = Expr.fromPartial(object.iterRange); + } message.accuVar = object.accuVar ?? ""; - message.accuInit = object.accuInit !== undefined && object.accuInit !== null ? Expr.fromPartial(object.accuInit) : undefined; - message.loopCondition = object.loopCondition !== undefined && object.loopCondition !== null ? Expr.fromPartial(object.loopCondition) : undefined; - message.loopStep = object.loopStep !== undefined && object.loopStep !== null ? Expr.fromPartial(object.loopStep) : undefined; - message.result = object.result !== undefined && object.result !== null ? Expr.fromPartial(object.result) : undefined; + if (object.accuInit !== undefined && object.accuInit !== null) { + message.accuInit = Expr.fromPartial(object.accuInit); + } + if (object.loopCondition !== undefined && object.loopCondition !== null) { + message.loopCondition = Expr.fromPartial(object.loopCondition); + } + if (object.loopStep !== undefined && object.loopStep !== null) { + message.loopStep = Expr.fromPartial(object.loopStep); + } + if (object.result !== undefined && object.result !== null) { + message.result = Expr.fromPartial(object.result); + } return message; }, fromSDK(object: Expr_ComprehensionSDKType): Expr_Comprehension { @@ -1753,15 +1729,15 @@ export const Literal = { return message; }, fromJSON(object: any): Literal { - return { - nullValue: isSet(object.nullValue) ? nullValueFromJSON(object.nullValue) : undefined, - boolValue: isSet(object.boolValue) ? Boolean(object.boolValue) : undefined, - int64Value: isSet(object.int64Value) ? BigInt(object.int64Value.toString()) : undefined, - uint64Value: isSet(object.uint64Value) ? BigInt(object.uint64Value.toString()) : undefined, - doubleValue: isSet(object.doubleValue) ? Number(object.doubleValue) : undefined, - stringValue: isSet(object.stringValue) ? String(object.stringValue) : undefined, - bytesValue: isSet(object.bytesValue) ? bytesFromBase64(object.bytesValue) : undefined - }; + const obj = createBaseLiteral(); + if (isSet(object.nullValue)) obj.nullValue = nullValueFromJSON(object.nullValue); + if (isSet(object.boolValue)) obj.boolValue = Boolean(object.boolValue); + if (isSet(object.int64Value)) obj.int64Value = BigInt(object.int64Value.toString()); + if (isSet(object.uint64Value)) obj.uint64Value = BigInt(object.uint64Value.toString()); + if (isSet(object.doubleValue)) obj.doubleValue = Number(object.doubleValue); + if (isSet(object.stringValue)) obj.stringValue = String(object.stringValue); + if (isSet(object.bytesValue)) obj.bytesValue = bytesFromBase64(object.bytesValue); + return obj; }, toJSON(message: Literal): JsonSafe { const obj: any = {}; @@ -1782,8 +1758,12 @@ export const Literal = { const message = createBaseLiteral(); message.nullValue = object.nullValue ?? undefined; message.boolValue = object.boolValue ?? undefined; - message.int64Value = object.int64Value !== undefined && object.int64Value !== null ? BigInt(object.int64Value.toString()) : undefined; - message.uint64Value = object.uint64Value !== undefined && object.uint64Value !== null ? BigInt(object.uint64Value.toString()) : undefined; + if (object.int64Value !== undefined && object.int64Value !== null) { + message.int64Value = BigInt(object.int64Value.toString()); + } + if (object.uint64Value !== undefined && object.uint64Value !== null) { + message.uint64Value = BigInt(object.uint64Value.toString()); + } message.doubleValue = object.doubleValue ?? undefined; message.stringValue = object.stringValue ?? undefined; message.bytesValue = object.bytesValue ?? undefined; 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 fc892178d1..ec052b5a2f 100644 --- a/__fixtures__/v-next/outputv4/google/api/expr/v1beta1/source.ts +++ b/__fixtures__/v-next/outputv4/google/api/expr/v1beta1/source.ts @@ -1,16 +1,11 @@ -import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial, isObject } from "../../../../helpers"; -import { JsonSafe } from "../../../../json-safe"; -import { ComputedRef } from "vue"; +import { BinaryReader, BinaryWriter } from "../../../../binary.js"; +import { isSet, DeepPartial, isObject } from "../../../../helpers.js"; +import { JsonSafe } from "../../../../json-safe.js"; export const protobufPackage = "google.api.expr.v1beta1"; export interface SourceInfo_PositionsEntry { key: number; value: number; } -export interface ReactiveSourceInfo_PositionsEntry { - key: ComputedRef; - value: ComputedRef; -} export interface SourceInfo_PositionsEntryProtoMsg { typeUrl: string; value: Uint8Array; @@ -45,13 +40,6 @@ export interface SourceInfo { [key: number]: number; }; } -export interface ReactiveSourceInfo { - location: ComputedRef; - lineOffsets: ComputedRef; - positions: ComputedRef<{ - [key: number]: number; - }>; -} export interface SourceInfoProtoMsg { typeUrl: "/google.api.expr.v1beta1.SourceInfo"; value: Uint8Array; @@ -81,12 +69,6 @@ export interface SourcePosition { */ column: number; } -export interface ReactiveSourcePosition { - location: ComputedRef; - offset: ComputedRef; - line: ComputedRef; - column: ComputedRef; -} export interface SourcePositionProtoMsg { typeUrl: "/google.api.expr.v1beta1.SourcePosition"; value: Uint8Array; @@ -106,10 +88,10 @@ function createBaseSourceInfo_PositionsEntry(): SourceInfo_PositionsEntry { } export const SourceInfo_PositionsEntry = { encode(message: SourceInfo_PositionsEntry, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.key !== 0) { + if (message.key !== undefined) { writer.uint32(8).int32(message.key); } - if (message.value !== 0) { + if (message.value !== undefined) { writer.uint32(16).int32(message.value); } return writer; @@ -135,10 +117,10 @@ export const SourceInfo_PositionsEntry = { return message; }, fromJSON(object: any): SourceInfo_PositionsEntry { - return { - key: isSet(object.key) ? Number(object.key) : 0, - value: isSet(object.value) ? Number(object.value) : 0 - }; + const obj = createBaseSourceInfo_PositionsEntry(); + if (isSet(object.key)) obj.key = Number(object.key); + if (isSet(object.value)) obj.value = Number(object.value); + return obj; }, toJSON(message: SourceInfo_PositionsEntry): JsonSafe { const obj: any = {}; @@ -206,7 +188,7 @@ function createBaseSourceInfo(): SourceInfo { export const SourceInfo = { typeUrl: "/google.api.expr.v1beta1.SourceInfo", encode(message: SourceInfo, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.location !== "") { + if (message.location !== undefined) { writer.uint32(18).string(message.location); } writer.uint32(26).fork(); @@ -256,16 +238,16 @@ export const SourceInfo = { return message; }, fromJSON(object: any): SourceInfo { - return { - location: isSet(object.location) ? String(object.location) : "", - lineOffsets: Array.isArray(object?.lineOffsets) ? object.lineOffsets.map((e: any) => Number(e)) : [], - positions: isObject(object.positions) ? Object.entries(object.positions).reduce<{ - [key: number]: number; - }>((acc, [key, value]) => { - acc[Number(key)] = Number(value); - return acc; - }, {}) : {} - }; + const obj = createBaseSourceInfo(); + if (isSet(object.location)) obj.location = String(object.location); + if (Array.isArray(object?.lineOffsets)) obj.lineOffsets = object.lineOffsets.map((e: any) => Number(e)); + if (isObject(object.positions)) obj.positions = Object.entries(object.positions).reduce<{ + [key: number]: number; + }>((acc, [key, value]) => { + acc[Number(key)] = Number(value); + return acc; + }, {}); + return obj; }, toJSON(message: SourceInfo): JsonSafe { const obj: any = {}; @@ -396,16 +378,16 @@ function createBaseSourcePosition(): SourcePosition { export const SourcePosition = { typeUrl: "/google.api.expr.v1beta1.SourcePosition", encode(message: SourcePosition, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.location !== "") { + if (message.location !== undefined) { writer.uint32(10).string(message.location); } - if (message.offset !== 0) { + if (message.offset !== undefined) { writer.uint32(16).int32(message.offset); } - if (message.line !== 0) { + if (message.line !== undefined) { writer.uint32(24).int32(message.line); } - if (message.column !== 0) { + if (message.column !== undefined) { writer.uint32(32).int32(message.column); } return writer; @@ -437,12 +419,12 @@ export const SourcePosition = { return message; }, fromJSON(object: any): SourcePosition { - return { - location: isSet(object.location) ? String(object.location) : "", - offset: isSet(object.offset) ? Number(object.offset) : 0, - line: isSet(object.line) ? Number(object.line) : 0, - column: isSet(object.column) ? Number(object.column) : 0 - }; + const obj = createBaseSourcePosition(); + if (isSet(object.location)) obj.location = String(object.location); + if (isSet(object.offset)) obj.offset = Number(object.offset); + if (isSet(object.line)) obj.line = Number(object.line); + if (isSet(object.column)) obj.column = Number(object.column); + return obj; }, toJSON(message: SourcePosition): JsonSafe { const obj: any = {}; 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 c325378152..4eaa31c41e 100644 --- a/__fixtures__/v-next/outputv4/google/api/expr/v1beta1/value.ts +++ b/__fixtures__/v-next/outputv4/google/api/expr/v1beta1/value.ts @@ -1,9 +1,8 @@ -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 { JsonSafe } from "../../../../json-safe"; -import { ComputedRef } from "vue"; +import { NullValue, NullValueSDKType, nullValueFromJSON, nullValueToJSON } from "../../../protobuf/struct.js"; +import { Any, AnySDKType } from "../../../protobuf/any.js"; +import { BinaryReader, BinaryWriter } from "../../../../binary.js"; +import { isSet, bytesFromBase64, base64FromBytes, DeepPartial } from "../../../../helpers.js"; +import { JsonSafe } from "../../../../json-safe.js"; export const protobufPackage = "google.api.expr.v1beta1"; /** * Represents a CEL value. @@ -37,20 +36,6 @@ export interface Value { /** A Type value represented by the fully qualified name of the type. */ typeValue?: string; } -export interface ReactiveValue { - nullValue?: ComputedRef; - boolValue?: ComputedRef; - int64Value?: ComputedRef; - uint64Value?: ComputedRef; - doubleValue?: ComputedRef; - stringValue?: ComputedRef; - bytesValue?: ComputedRef; - enumValue?: ComputedRef; - objectValue?: ComputedRef; - mapValue?: ComputedRef; - listValue?: ComputedRef; - typeValue?: ComputedRef; -} export interface ValueProtoMsg { typeUrl: "/google.api.expr.v1beta1.Value"; value: Uint8Array; @@ -82,10 +67,6 @@ export interface EnumValue { /** The value of the enum. */ value: number; } -export interface ReactiveEnumValue { - type: ComputedRef; - value: ComputedRef; -} export interface EnumValueProtoMsg { typeUrl: "/google.api.expr.v1beta1.EnumValue"; value: Uint8Array; @@ -105,9 +86,6 @@ export interface ListValue { /** The ordered values in the list. */ values: Value[]; } -export interface ReactiveListValue { - values: ComputedRef; -} export interface ListValueProtoMsg { typeUrl: "/google.api.expr.v1beta1.ListValue"; value: Uint8Array; @@ -136,9 +114,6 @@ export interface MapValue { */ entries: MapValue_Entry[]; } -export interface ReactiveMapValue { - entries: ComputedRef; -} export interface MapValueProtoMsg { typeUrl: "/google.api.expr.v1beta1.MapValue"; value: Uint8Array; @@ -164,10 +139,6 @@ export interface MapValue_Entry { /** The value. */ value?: Value; } -export interface ReactiveMapValue_Entry { - key?: ComputedRef; - value?: ComputedRef; -} export interface MapValue_EntryProtoMsg { typeUrl: "/google.api.expr.v1beta1.Entry"; value: Uint8Array; @@ -285,20 +256,20 @@ export const Value = { return message; }, fromJSON(object: any): Value { - return { - nullValue: isSet(object.nullValue) ? nullValueFromJSON(object.nullValue) : undefined, - boolValue: isSet(object.boolValue) ? Boolean(object.boolValue) : undefined, - int64Value: isSet(object.int64Value) ? BigInt(object.int64Value.toString()) : undefined, - uint64Value: isSet(object.uint64Value) ? BigInt(object.uint64Value.toString()) : undefined, - doubleValue: isSet(object.doubleValue) ? Number(object.doubleValue) : undefined, - stringValue: isSet(object.stringValue) ? String(object.stringValue) : undefined, - bytesValue: isSet(object.bytesValue) ? bytesFromBase64(object.bytesValue) : undefined, - enumValue: isSet(object.enumValue) ? EnumValue.fromJSON(object.enumValue) : undefined, - objectValue: isSet(object.objectValue) ? Any.fromJSON(object.objectValue) : undefined, - mapValue: isSet(object.mapValue) ? MapValue.fromJSON(object.mapValue) : undefined, - listValue: isSet(object.listValue) ? ListValue.fromJSON(object.listValue) : undefined, - typeValue: isSet(object.typeValue) ? String(object.typeValue) : undefined - }; + const obj = createBaseValue(); + if (isSet(object.nullValue)) obj.nullValue = nullValueFromJSON(object.nullValue); + if (isSet(object.boolValue)) obj.boolValue = Boolean(object.boolValue); + if (isSet(object.int64Value)) obj.int64Value = BigInt(object.int64Value.toString()); + if (isSet(object.uint64Value)) obj.uint64Value = BigInt(object.uint64Value.toString()); + if (isSet(object.doubleValue)) obj.doubleValue = Number(object.doubleValue); + if (isSet(object.stringValue)) obj.stringValue = String(object.stringValue); + if (isSet(object.bytesValue)) obj.bytesValue = bytesFromBase64(object.bytesValue); + if (isSet(object.enumValue)) obj.enumValue = EnumValue.fromJSON(object.enumValue); + if (isSet(object.objectValue)) obj.objectValue = Any.fromJSON(object.objectValue); + if (isSet(object.mapValue)) obj.mapValue = MapValue.fromJSON(object.mapValue); + if (isSet(object.listValue)) obj.listValue = ListValue.fromJSON(object.listValue); + if (isSet(object.typeValue)) obj.typeValue = String(object.typeValue); + return obj; }, toJSON(message: Value): JsonSafe { const obj: any = {}; @@ -324,15 +295,27 @@ export const Value = { const message = createBaseValue(); message.nullValue = object.nullValue ?? undefined; message.boolValue = object.boolValue ?? undefined; - message.int64Value = object.int64Value !== undefined && object.int64Value !== null ? BigInt(object.int64Value.toString()) : undefined; - message.uint64Value = object.uint64Value !== undefined && object.uint64Value !== null ? BigInt(object.uint64Value.toString()) : undefined; + if (object.int64Value !== undefined && object.int64Value !== null) { + message.int64Value = BigInt(object.int64Value.toString()); + } + if (object.uint64Value !== undefined && object.uint64Value !== null) { + message.uint64Value = BigInt(object.uint64Value.toString()); + } message.doubleValue = object.doubleValue ?? undefined; message.stringValue = object.stringValue ?? undefined; message.bytesValue = object.bytesValue ?? undefined; - message.enumValue = object.enumValue !== undefined && object.enumValue !== null ? EnumValue.fromPartial(object.enumValue) : undefined; - message.objectValue = object.objectValue !== undefined && object.objectValue !== null ? Any.fromPartial(object.objectValue) : undefined; - message.mapValue = object.mapValue !== undefined && object.mapValue !== null ? MapValue.fromPartial(object.mapValue) : undefined; - message.listValue = object.listValue !== undefined && object.listValue !== null ? ListValue.fromPartial(object.listValue) : undefined; + if (object.enumValue !== undefined && object.enumValue !== null) { + message.enumValue = EnumValue.fromPartial(object.enumValue); + } + if (object.objectValue !== undefined && object.objectValue !== null) { + message.objectValue = Any.fromPartial(object.objectValue); + } + if (object.mapValue !== undefined && object.mapValue !== null) { + message.mapValue = MapValue.fromPartial(object.mapValue); + } + if (object.listValue !== undefined && object.listValue !== null) { + message.listValue = ListValue.fromPartial(object.listValue); + } message.typeValue = object.typeValue ?? undefined; return message; }, @@ -465,10 +448,10 @@ function createBaseEnumValue(): EnumValue { export const EnumValue = { typeUrl: "/google.api.expr.v1beta1.EnumValue", encode(message: EnumValue, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.type !== "") { + if (message.type !== undefined) { writer.uint32(10).string(message.type); } - if (message.value !== 0) { + if (message.value !== undefined) { writer.uint32(16).int32(message.value); } return writer; @@ -494,10 +477,10 @@ export const EnumValue = { return message; }, fromJSON(object: any): EnumValue { - return { - type: isSet(object.type) ? String(object.type) : "", - value: isSet(object.value) ? Number(object.value) : 0 - }; + const obj = createBaseEnumValue(); + if (isSet(object.type)) obj.type = String(object.type); + if (isSet(object.value)) obj.value = Number(object.value); + return obj; }, toJSON(message: EnumValue): JsonSafe { const obj: any = {}; @@ -592,9 +575,9 @@ export const ListValue = { return message; }, fromJSON(object: any): ListValue { - return { - values: Array.isArray(object?.values) ? object.values.map((e: any) => Value.fromJSON(e)) : [] - }; + const obj = createBaseListValue(); + if (Array.isArray(object?.values)) obj.values = object.values.map((e: any) => Value.fromJSON(e)); + return obj; }, toJSON(message: ListValue): JsonSafe { const obj: any = {}; @@ -690,9 +673,9 @@ export const MapValue = { return message; }, fromJSON(object: any): MapValue { - return { - entries: Array.isArray(object?.entries) ? object.entries.map((e: any) => MapValue_Entry.fromJSON(e)) : [] - }; + const obj = createBaseMapValue(); + if (Array.isArray(object?.entries)) obj.entries = object.entries.map((e: any) => MapValue_Entry.fromJSON(e)); + return obj; }, toJSON(message: MapValue): JsonSafe { const obj: any = {}; @@ -795,10 +778,10 @@ export const MapValue_Entry = { return message; }, fromJSON(object: any): MapValue_Entry { - return { - key: isSet(object.key) ? Value.fromJSON(object.key) : undefined, - value: isSet(object.value) ? Value.fromJSON(object.value) : undefined - }; + const obj = createBaseMapValue_Entry(); + if (isSet(object.key)) obj.key = Value.fromJSON(object.key); + if (isSet(object.value)) obj.value = Value.fromJSON(object.value); + return obj; }, toJSON(message: MapValue_Entry): JsonSafe { const obj: any = {}; @@ -808,8 +791,12 @@ export const MapValue_Entry = { }, fromPartial(object: DeepPartial): MapValue_Entry { const message = createBaseMapValue_Entry(); - message.key = object.key !== undefined && object.key !== null ? Value.fromPartial(object.key) : undefined; - message.value = object.value !== undefined && object.value !== null ? Value.fromPartial(object.value) : undefined; + if (object.key !== undefined && object.key !== null) { + message.key = Value.fromPartial(object.key); + } + if (object.value !== undefined && object.value !== null) { + message.value = Value.fromPartial(object.value); + } return message; }, fromSDK(object: MapValue_EntrySDKType): MapValue_Entry { diff --git a/__fixtures__/v-next/outputv4/google/api/field_behavior.ts b/__fixtures__/v-next/outputv4/google/api/field_behavior.ts index 0dce0875aa..15b1a8e1b6 100644 --- a/__fixtures__/v-next/outputv4/google/api/field_behavior.ts +++ b/__fixtures__/v-next/outputv4/google/api/field_behavior.ts @@ -1,4 +1,3 @@ -import { ComputedRef } from "vue"; export const protobufPackage = "google.api"; /** * An indicator of the behavior of a given field (for example, that a field diff --git a/__fixtures__/v-next/outputv4/google/api/http.ts b/__fixtures__/v-next/outputv4/google/api/http.ts index ff7434f372..f964e4d912 100644 --- a/__fixtures__/v-next/outputv4/google/api/http.ts +++ b/__fixtures__/v-next/outputv4/google/api/http.ts @@ -1,7 +1,6 @@ -import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial } from "../../helpers"; -import { JsonSafe } from "../../json-safe"; -import { ComputedRef } from "vue"; +import { BinaryReader, BinaryWriter } from "../../binary.js"; +import { isSet, DeepPartial } from "../../helpers.js"; +import { JsonSafe } from "../../json-safe.js"; export const protobufPackage = "google.api"; /** * Defines the HTTP configuration for an API service. It contains a list of @@ -25,10 +24,6 @@ export interface Http { */ fullyDecodeReservedExpansion: boolean; } -export interface ReactiveHttp { - rules: ComputedRef; - fullyDecodeReservedExpansion: ComputedRef; -} export interface HttpProtoMsg { typeUrl: "/google.api.Http"; value: Uint8Array; @@ -365,18 +360,6 @@ export interface HttpRule { */ additionalBindings: HttpRule[]; } -export interface ReactiveHttpRule { - selector: ComputedRef; - get?: ComputedRef; - put?: ComputedRef; - post?: ComputedRef; - delete?: ComputedRef; - patch?: ComputedRef; - custom?: ComputedRef; - body: ComputedRef; - responseBody: ComputedRef; - additionalBindings: ComputedRef; -} export interface HttpRuleProtoMsg { typeUrl: "/google.api.HttpRule"; value: Uint8Array; @@ -671,10 +654,6 @@ export interface CustomHttpPattern { /** The path matched by this custom verb. */ path: string; } -export interface ReactiveCustomHttpPattern { - kind: ComputedRef; - path: ComputedRef; -} export interface CustomHttpPatternProtoMsg { typeUrl: "/google.api.CustomHttpPattern"; value: Uint8Array; @@ -696,7 +675,7 @@ export const Http = { for (const v of message.rules) { HttpRule.encode(v!, writer.uint32(10).fork()).ldelim(); } - if (message.fullyDecodeReservedExpansion === true) { + if (message.fullyDecodeReservedExpansion !== undefined) { writer.uint32(16).bool(message.fullyDecodeReservedExpansion); } return writer; @@ -722,10 +701,10 @@ export const Http = { return message; }, fromJSON(object: any): Http { - return { - rules: Array.isArray(object?.rules) ? object.rules.map((e: any) => HttpRule.fromJSON(e)) : [], - fullyDecodeReservedExpansion: isSet(object.fullyDecodeReservedExpansion) ? Boolean(object.fullyDecodeReservedExpansion) : false - }; + const obj = createBaseHttp(); + if (Array.isArray(object?.rules)) obj.rules = object.rules.map((e: any) => HttpRule.fromJSON(e)); + if (isSet(object.fullyDecodeReservedExpansion)) obj.fullyDecodeReservedExpansion = Boolean(object.fullyDecodeReservedExpansion); + return obj; }, toJSON(message: Http): JsonSafe { const obj: any = {}; @@ -816,7 +795,7 @@ function createBaseHttpRule(): HttpRule { export const HttpRule = { typeUrl: "/google.api.HttpRule", encode(message: HttpRule, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.selector !== "") { + if (message.selector !== undefined) { writer.uint32(10).string(message.selector); } if (message.get !== undefined) { @@ -837,10 +816,10 @@ export const HttpRule = { if (message.custom !== undefined) { CustomHttpPattern.encode(message.custom, writer.uint32(66).fork()).ldelim(); } - if (message.body !== "") { + if (message.body !== undefined) { writer.uint32(58).string(message.body); } - if (message.responseBody !== "") { + if (message.responseBody !== undefined) { writer.uint32(98).string(message.responseBody); } for (const v of message.additionalBindings) { @@ -893,18 +872,18 @@ export const HttpRule = { return message; }, fromJSON(object: any): HttpRule { - return { - selector: isSet(object.selector) ? String(object.selector) : "", - get: isSet(object.get) ? String(object.get) : undefined, - put: isSet(object.put) ? String(object.put) : undefined, - post: isSet(object.post) ? String(object.post) : undefined, - delete: isSet(object.delete) ? String(object.delete) : undefined, - patch: isSet(object.patch) ? String(object.patch) : undefined, - custom: isSet(object.custom) ? CustomHttpPattern.fromJSON(object.custom) : undefined, - body: isSet(object.body) ? String(object.body) : "", - responseBody: isSet(object.responseBody) ? String(object.responseBody) : "", - additionalBindings: Array.isArray(object?.additionalBindings) ? object.additionalBindings.map((e: any) => HttpRule.fromJSON(e)) : [] - }; + const obj = createBaseHttpRule(); + if (isSet(object.selector)) obj.selector = String(object.selector); + if (isSet(object.get)) obj.get = String(object.get); + if (isSet(object.put)) obj.put = String(object.put); + if (isSet(object.post)) obj.post = String(object.post); + if (isSet(object.delete)) obj.delete = String(object.delete); + if (isSet(object.patch)) obj.patch = String(object.patch); + if (isSet(object.custom)) obj.custom = CustomHttpPattern.fromJSON(object.custom); + if (isSet(object.body)) obj.body = String(object.body); + if (isSet(object.responseBody)) obj.responseBody = String(object.responseBody); + if (Array.isArray(object?.additionalBindings)) obj.additionalBindings = object.additionalBindings.map((e: any) => HttpRule.fromJSON(e)); + return obj; }, toJSON(message: HttpRule): JsonSafe { const obj: any = {}; @@ -932,7 +911,9 @@ export const HttpRule = { message.post = object.post ?? undefined; message.delete = object.delete ?? undefined; message.patch = object.patch ?? undefined; - message.custom = object.custom !== undefined && object.custom !== null ? CustomHttpPattern.fromPartial(object.custom) : undefined; + if (object.custom !== undefined && object.custom !== null) { + message.custom = CustomHttpPattern.fromPartial(object.custom); + } message.body = object.body ?? ""; message.responseBody = object.responseBody ?? ""; message.additionalBindings = object.additionalBindings?.map(e => HttpRule.fromPartial(e)) || []; @@ -1059,10 +1040,10 @@ function createBaseCustomHttpPattern(): CustomHttpPattern { export const CustomHttpPattern = { typeUrl: "/google.api.CustomHttpPattern", encode(message: CustomHttpPattern, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.kind !== "") { + if (message.kind !== undefined) { writer.uint32(10).string(message.kind); } - if (message.path !== "") { + if (message.path !== undefined) { writer.uint32(18).string(message.path); } return writer; @@ -1088,10 +1069,10 @@ export const CustomHttpPattern = { return message; }, fromJSON(object: any): CustomHttpPattern { - return { - kind: isSet(object.kind) ? String(object.kind) : "", - path: isSet(object.path) ? String(object.path) : "" - }; + const obj = createBaseCustomHttpPattern(); + if (isSet(object.kind)) obj.kind = String(object.kind); + if (isSet(object.path)) obj.path = String(object.path); + return obj; }, toJSON(message: CustomHttpPattern): JsonSafe { const obj: any = {}; diff --git a/__fixtures__/v-next/outputv4/google/api/httpbody.ts b/__fixtures__/v-next/outputv4/google/api/httpbody.ts index a0ef7ee833..d0e10f302b 100644 --- a/__fixtures__/v-next/outputv4/google/api/httpbody.ts +++ b/__fixtures__/v-next/outputv4/google/api/httpbody.ts @@ -1,8 +1,7 @@ -import { Any, AnySDKType } from "../protobuf/any"; -import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, bytesFromBase64, base64FromBytes, DeepPartial } from "../../helpers"; -import { JsonSafe } from "../../json-safe"; -import { ComputedRef } from "vue"; +import { Any, AnySDKType } from "../protobuf/any.js"; +import { BinaryReader, BinaryWriter } from "../../binary.js"; +import { isSet, bytesFromBase64, base64FromBytes, DeepPartial } from "../../helpers.js"; +import { JsonSafe } from "../../json-safe.js"; export const protobufPackage = "google.api"; /** * Message that represents an arbitrary HTTP body. It should only be used for @@ -60,11 +59,6 @@ export interface HttpBody { */ extensions: Any[]; } -export interface ReactiveHttpBody { - contentType: ComputedRef; - data: ComputedRef; - extensions: ComputedRef; -} export interface HttpBodyProtoMsg { typeUrl: "/google.api.HttpBody"; value: Uint8Array; @@ -129,7 +123,7 @@ function createBaseHttpBody(): HttpBody { export const HttpBody = { typeUrl: "/google.api.HttpBody", encode(message: HttpBody, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.contentType !== "") { + if (message.contentType !== undefined) { writer.uint32(10).string(message.contentType); } if (message.data.length !== 0) { @@ -164,11 +158,11 @@ export const HttpBody = { return message; }, fromJSON(object: any): HttpBody { - return { - contentType: isSet(object.contentType) ? String(object.contentType) : "", - data: isSet(object.data) ? bytesFromBase64(object.data) : new Uint8Array(), - extensions: Array.isArray(object?.extensions) ? object.extensions.map((e: any) => Any.fromJSON(e)) : [] - }; + const obj = createBaseHttpBody(); + if (isSet(object.contentType)) obj.contentType = String(object.contentType); + if (isSet(object.data)) obj.data = bytesFromBase64(object.data); + if (Array.isArray(object?.extensions)) obj.extensions = object.extensions.map((e: any) => Any.fromJSON(e)); + return obj; }, toJSON(message: HttpBody): JsonSafe { const obj: any = {}; diff --git a/__fixtures__/v-next/outputv4/google/api/label.ts b/__fixtures__/v-next/outputv4/google/api/label.ts index 6f3c8de540..806911edc5 100644 --- a/__fixtures__/v-next/outputv4/google/api/label.ts +++ b/__fixtures__/v-next/outputv4/google/api/label.ts @@ -1,7 +1,6 @@ -import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial } from "../../helpers"; -import { JsonSafe } from "../../json-safe"; -import { ComputedRef } from "vue"; +import { BinaryReader, BinaryWriter } from "../../binary.js"; +import { isSet, DeepPartial } from "../../helpers.js"; +import { JsonSafe } from "../../json-safe.js"; export const protobufPackage = "google.api"; /** Value types that can be used as label values. */ export enum LabelDescriptor_ValueType { @@ -53,11 +52,6 @@ export interface LabelDescriptor { /** A human-readable description for the label. */ description: string; } -export interface ReactiveLabelDescriptor { - key: ComputedRef; - valueType: ComputedRef; - description: ComputedRef; -} export interface LabelDescriptorProtoMsg { typeUrl: "/google.api.LabelDescriptor"; value: Uint8Array; @@ -78,13 +72,13 @@ function createBaseLabelDescriptor(): LabelDescriptor { export const LabelDescriptor = { typeUrl: "/google.api.LabelDescriptor", encode(message: LabelDescriptor, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.key !== "") { + if (message.key !== undefined) { writer.uint32(10).string(message.key); } if (message.valueType !== 0) { writer.uint32(16).int32(message.valueType); } - if (message.description !== "") { + if (message.description !== undefined) { writer.uint32(26).string(message.description); } return writer; @@ -113,11 +107,11 @@ export const LabelDescriptor = { return message; }, fromJSON(object: any): LabelDescriptor { - return { - key: isSet(object.key) ? String(object.key) : "", - valueType: isSet(object.valueType) ? labelDescriptor_ValueTypeFromJSON(object.valueType) : -1, - description: isSet(object.description) ? String(object.description) : "" - }; + const obj = createBaseLabelDescriptor(); + if (isSet(object.key)) obj.key = String(object.key); + if (isSet(object.valueType)) obj.valueType = labelDescriptor_ValueTypeFromJSON(object.valueType); + if (isSet(object.description)) obj.description = String(object.description); + return obj; }, toJSON(message: LabelDescriptor): JsonSafe { const obj: any = {}; diff --git a/__fixtures__/v-next/outputv4/google/api/launch_stage.ts b/__fixtures__/v-next/outputv4/google/api/launch_stage.ts index 94b721aaf0..6abb3525f3 100644 --- a/__fixtures__/v-next/outputv4/google/api/launch_stage.ts +++ b/__fixtures__/v-next/outputv4/google/api/launch_stage.ts @@ -1,4 +1,3 @@ -import { ComputedRef } from "vue"; export const protobufPackage = "google.api"; /** * The launch stage as defined by [Google Cloud Platform diff --git a/__fixtures__/v-next/outputv4/google/api/log.ts b/__fixtures__/v-next/outputv4/google/api/log.ts index 7dc0ed0e0d..f96c626293 100644 --- a/__fixtures__/v-next/outputv4/google/api/log.ts +++ b/__fixtures__/v-next/outputv4/google/api/log.ts @@ -1,8 +1,7 @@ -import { LabelDescriptor, LabelDescriptorSDKType } from "./label"; -import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial } from "../../helpers"; -import { JsonSafe } from "../../json-safe"; -import { ComputedRef } from "vue"; +import { LabelDescriptor, LabelDescriptorSDKType } from "./label.js"; +import { BinaryReader, BinaryWriter } from "../../binary.js"; +import { isSet, DeepPartial } from "../../helpers.js"; +import { JsonSafe } from "../../json-safe.js"; export const protobufPackage = "google.api"; /** * A description of a log type. Example in YAML format: @@ -39,12 +38,6 @@ export interface LogDescriptor { */ displayName: string; } -export interface ReactiveLogDescriptor { - name: ComputedRef; - labels: ComputedRef; - description: ComputedRef; - displayName: ComputedRef; -} export interface LogDescriptorProtoMsg { typeUrl: "/google.api.LogDescriptor"; value: Uint8Array; @@ -76,16 +69,16 @@ function createBaseLogDescriptor(): LogDescriptor { export const LogDescriptor = { typeUrl: "/google.api.LogDescriptor", encode(message: LogDescriptor, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.name !== "") { + if (message.name !== undefined) { writer.uint32(10).string(message.name); } for (const v of message.labels) { LabelDescriptor.encode(v!, writer.uint32(18).fork()).ldelim(); } - if (message.description !== "") { + if (message.description !== undefined) { writer.uint32(26).string(message.description); } - if (message.displayName !== "") { + if (message.displayName !== undefined) { writer.uint32(34).string(message.displayName); } return writer; @@ -117,12 +110,12 @@ export const LogDescriptor = { return message; }, fromJSON(object: any): LogDescriptor { - return { - name: isSet(object.name) ? String(object.name) : "", - labels: Array.isArray(object?.labels) ? object.labels.map((e: any) => LabelDescriptor.fromJSON(e)) : [], - description: isSet(object.description) ? String(object.description) : "", - displayName: isSet(object.displayName) ? String(object.displayName) : "" - }; + const obj = createBaseLogDescriptor(); + if (isSet(object.name)) obj.name = String(object.name); + if (Array.isArray(object?.labels)) obj.labels = object.labels.map((e: any) => LabelDescriptor.fromJSON(e)); + if (isSet(object.description)) obj.description = String(object.description); + if (isSet(object.displayName)) obj.displayName = String(object.displayName); + return obj; }, toJSON(message: LogDescriptor): JsonSafe { const obj: any = {}; diff --git a/__fixtures__/v-next/outputv4/google/api/logging.ts b/__fixtures__/v-next/outputv4/google/api/logging.ts index d96ca86305..52e42d32a6 100644 --- a/__fixtures__/v-next/outputv4/google/api/logging.ts +++ b/__fixtures__/v-next/outputv4/google/api/logging.ts @@ -1,7 +1,6 @@ -import { BinaryReader, BinaryWriter } from "../../binary"; -import { JsonSafe } from "../../json-safe"; -import { DeepPartial, isSet } from "../../helpers"; -import { ComputedRef } from "vue"; +import { BinaryReader, BinaryWriter } from "../../binary.js"; +import { JsonSafe } from "../../json-safe.js"; +import { DeepPartial, isSet } from "../../helpers.js"; export const protobufPackage = "google.api"; /** * Logging configuration of the service. @@ -50,10 +49,6 @@ export interface Logging { */ consumerDestinations: Logging_LoggingDestination[]; } -export interface ReactiveLogging { - producerDestinations: ComputedRef; - consumerDestinations: ComputedRef; -} export interface LoggingProtoMsg { typeUrl: "/google.api.Logging"; value: Uint8Array; @@ -111,10 +106,6 @@ export interface Logging_LoggingDestination { */ logs: string[]; } -export interface ReactiveLogging_LoggingDestination { - monitoredResource: ComputedRef; - logs: ComputedRef; -} export interface Logging_LoggingDestinationProtoMsg { typeUrl: "/google.api.LoggingDestination"; value: Uint8Array; @@ -165,10 +156,10 @@ export const Logging = { return message; }, fromJSON(object: any): Logging { - return { - producerDestinations: Array.isArray(object?.producerDestinations) ? object.producerDestinations.map((e: any) => Logging_LoggingDestination.fromJSON(e)) : [], - consumerDestinations: Array.isArray(object?.consumerDestinations) ? object.consumerDestinations.map((e: any) => Logging_LoggingDestination.fromJSON(e)) : [] - }; + const obj = createBaseLogging(); + if (Array.isArray(object?.producerDestinations)) obj.producerDestinations = object.producerDestinations.map((e: any) => Logging_LoggingDestination.fromJSON(e)); + if (Array.isArray(object?.consumerDestinations)) obj.consumerDestinations = object.consumerDestinations.map((e: any) => Logging_LoggingDestination.fromJSON(e)); + return obj; }, toJSON(message: Logging): JsonSafe { const obj: any = {}; @@ -261,7 +252,7 @@ function createBaseLogging_LoggingDestination(): Logging_LoggingDestination { export const Logging_LoggingDestination = { typeUrl: "/google.api.LoggingDestination", encode(message: Logging_LoggingDestination, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.monitoredResource !== "") { + if (message.monitoredResource !== undefined) { writer.uint32(26).string(message.monitoredResource); } for (const v of message.logs) { @@ -290,10 +281,10 @@ export const Logging_LoggingDestination = { return message; }, fromJSON(object: any): Logging_LoggingDestination { - return { - monitoredResource: isSet(object.monitoredResource) ? String(object.monitoredResource) : "", - logs: Array.isArray(object?.logs) ? object.logs.map((e: any) => String(e)) : [] - }; + const obj = createBaseLogging_LoggingDestination(); + if (isSet(object.monitoredResource)) obj.monitoredResource = String(object.monitoredResource); + if (Array.isArray(object?.logs)) obj.logs = object.logs.map((e: any) => String(e)); + return obj; }, toJSON(message: Logging_LoggingDestination): JsonSafe { const obj: any = {}; diff --git a/__fixtures__/v-next/outputv4/google/api/metric.ts b/__fixtures__/v-next/outputv4/google/api/metric.ts index fdced099cf..b146a9bd45 100644 --- a/__fixtures__/v-next/outputv4/google/api/metric.ts +++ b/__fixtures__/v-next/outputv4/google/api/metric.ts @@ -1,10 +1,9 @@ -import { LaunchStage, LaunchStageSDKType, launchStageFromJSON, launchStageToJSON } from "./launch_stage"; -import { Duration, DurationSDKType } from "../protobuf/duration"; -import { LabelDescriptor, LabelDescriptorSDKType } from "./label"; -import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial, isObject } from "../../helpers"; -import { JsonSafe } from "../../json-safe"; -import { ComputedRef } from "vue"; +import { LaunchStage, LaunchStageSDKType, launchStageFromJSON, launchStageToJSON } from "./launch_stage.js"; +import { Duration, DurationSDKType } from "../protobuf/duration.js"; +import { LabelDescriptor, LabelDescriptorSDKType } from "./label.js"; +import { BinaryReader, BinaryWriter } from "../../binary.js"; +import { isSet, DeepPartial, isObject } from "../../helpers.js"; +import { JsonSafe } from "../../json-safe.js"; export const protobufPackage = "google.api"; /** * The kind of measurement. It describes how the data is reported. @@ -304,19 +303,6 @@ export interface MetricDescriptor { */ monitoredResourceTypes: string[]; } -export interface ReactiveMetricDescriptor { - name: ComputedRef; - type: ComputedRef; - labels: ComputedRef; - metricKind: ComputedRef; - valueType: ComputedRef; - unit: ComputedRef; - description: ComputedRef; - displayName: ComputedRef; - metadata?: ComputedRef; - launchStage: ComputedRef; - monitoredResourceTypes: ComputedRef; -} export interface MetricDescriptorProtoMsg { typeUrl: "/google.api.MetricDescriptor"; value: Uint8Array; @@ -358,11 +344,6 @@ export interface MetricDescriptor_MetricDescriptorMetadata { */ ingestDelay?: Duration; } -export interface ReactiveMetricDescriptor_MetricDescriptorMetadata { - launchStage: ComputedRef; - samplePeriod?: ComputedRef; - ingestDelay?: ComputedRef; -} export interface MetricDescriptor_MetricDescriptorMetadataProtoMsg { typeUrl: "/google.api.MetricDescriptorMetadata"; value: Uint8Array; @@ -378,10 +359,6 @@ export interface Metric_LabelsEntry { key: string; value: string; } -export interface ReactiveMetric_LabelsEntry { - key: ComputedRef; - value: ComputedRef; -} export interface Metric_LabelsEntryProtoMsg { typeUrl: string; value: Uint8Array; @@ -408,12 +385,6 @@ export interface Metric { [key: string]: string; }; } -export interface ReactiveMetric { - type: ComputedRef; - labels: ComputedRef<{ - [key: string]: string; - }>; -} export interface MetricProtoMsg { typeUrl: "/google.api.Metric"; value: Uint8Array; @@ -446,10 +417,10 @@ function createBaseMetricDescriptor(): MetricDescriptor { export const MetricDescriptor = { typeUrl: "/google.api.MetricDescriptor", encode(message: MetricDescriptor, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.name !== "") { + if (message.name !== undefined) { writer.uint32(10).string(message.name); } - if (message.type !== "") { + if (message.type !== undefined) { writer.uint32(66).string(message.type); } for (const v of message.labels) { @@ -461,13 +432,13 @@ export const MetricDescriptor = { if (message.valueType !== 0) { writer.uint32(32).int32(message.valueType); } - if (message.unit !== "") { + if (message.unit !== undefined) { writer.uint32(42).string(message.unit); } - if (message.description !== "") { + if (message.description !== undefined) { writer.uint32(50).string(message.description); } - if (message.displayName !== "") { + if (message.displayName !== undefined) { writer.uint32(58).string(message.displayName); } if (message.metadata !== undefined) { @@ -529,19 +500,19 @@ export const MetricDescriptor = { return message; }, fromJSON(object: any): MetricDescriptor { - return { - name: isSet(object.name) ? String(object.name) : "", - type: isSet(object.type) ? String(object.type) : "", - labels: Array.isArray(object?.labels) ? object.labels.map((e: any) => LabelDescriptor.fromJSON(e)) : [], - metricKind: isSet(object.metricKind) ? metricDescriptor_MetricKindFromJSON(object.metricKind) : -1, - valueType: isSet(object.valueType) ? metricDescriptor_ValueTypeFromJSON(object.valueType) : -1, - unit: isSet(object.unit) ? String(object.unit) : "", - description: isSet(object.description) ? String(object.description) : "", - displayName: isSet(object.displayName) ? String(object.displayName) : "", - metadata: isSet(object.metadata) ? MetricDescriptor_MetricDescriptorMetadata.fromJSON(object.metadata) : undefined, - launchStage: isSet(object.launchStage) ? launchStageFromJSON(object.launchStage) : -1, - monitoredResourceTypes: Array.isArray(object?.monitoredResourceTypes) ? object.monitoredResourceTypes.map((e: any) => String(e)) : [] - }; + const obj = createBaseMetricDescriptor(); + if (isSet(object.name)) obj.name = String(object.name); + if (isSet(object.type)) obj.type = String(object.type); + if (Array.isArray(object?.labels)) obj.labels = object.labels.map((e: any) => LabelDescriptor.fromJSON(e)); + if (isSet(object.metricKind)) obj.metricKind = metricDescriptor_MetricKindFromJSON(object.metricKind); + if (isSet(object.valueType)) obj.valueType = metricDescriptor_ValueTypeFromJSON(object.valueType); + if (isSet(object.unit)) obj.unit = String(object.unit); + if (isSet(object.description)) obj.description = String(object.description); + if (isSet(object.displayName)) obj.displayName = String(object.displayName); + if (isSet(object.metadata)) obj.metadata = MetricDescriptor_MetricDescriptorMetadata.fromJSON(object.metadata); + if (isSet(object.launchStage)) obj.launchStage = launchStageFromJSON(object.launchStage); + if (Array.isArray(object?.monitoredResourceTypes)) obj.monitoredResourceTypes = object.monitoredResourceTypes.map((e: any) => String(e)); + return obj; }, toJSON(message: MetricDescriptor): JsonSafe { const obj: any = {}; @@ -576,7 +547,9 @@ export const MetricDescriptor = { message.unit = object.unit ?? ""; message.description = object.description ?? ""; message.displayName = object.displayName ?? ""; - message.metadata = object.metadata !== undefined && object.metadata !== null ? MetricDescriptor_MetricDescriptorMetadata.fromPartial(object.metadata) : undefined; + if (object.metadata !== undefined && object.metadata !== null) { + message.metadata = MetricDescriptor_MetricDescriptorMetadata.fromPartial(object.metadata); + } message.launchStage = object.launchStage ?? 0; message.monitoredResourceTypes = object.monitoredResourceTypes?.map(e => e) || []; return message; @@ -751,11 +724,11 @@ export const MetricDescriptor_MetricDescriptorMetadata = { return message; }, fromJSON(object: any): MetricDescriptor_MetricDescriptorMetadata { - return { - launchStage: isSet(object.launchStage) ? launchStageFromJSON(object.launchStage) : -1, - samplePeriod: isSet(object.samplePeriod) ? Duration.fromJSON(object.samplePeriod) : undefined, - ingestDelay: isSet(object.ingestDelay) ? Duration.fromJSON(object.ingestDelay) : undefined - }; + const obj = createBaseMetricDescriptor_MetricDescriptorMetadata(); + if (isSet(object.launchStage)) obj.launchStage = launchStageFromJSON(object.launchStage); + if (isSet(object.samplePeriod)) obj.samplePeriod = Duration.fromJSON(object.samplePeriod); + if (isSet(object.ingestDelay)) obj.ingestDelay = Duration.fromJSON(object.ingestDelay); + return obj; }, toJSON(message: MetricDescriptor_MetricDescriptorMetadata): JsonSafe { const obj: any = {}; @@ -767,8 +740,12 @@ export const MetricDescriptor_MetricDescriptorMetadata = { fromPartial(object: DeepPartial): MetricDescriptor_MetricDescriptorMetadata { const message = createBaseMetricDescriptor_MetricDescriptorMetadata(); message.launchStage = object.launchStage ?? 0; - message.samplePeriod = object.samplePeriod !== undefined && object.samplePeriod !== null ? Duration.fromPartial(object.samplePeriod) : undefined; - message.ingestDelay = object.ingestDelay !== undefined && object.ingestDelay !== null ? Duration.fromPartial(object.ingestDelay) : undefined; + if (object.samplePeriod !== undefined && object.samplePeriod !== null) { + message.samplePeriod = Duration.fromPartial(object.samplePeriod); + } + if (object.ingestDelay !== undefined && object.ingestDelay !== null) { + message.ingestDelay = Duration.fromPartial(object.ingestDelay); + } return message; }, fromSDK(object: MetricDescriptor_MetricDescriptorMetadataSDKType): MetricDescriptor_MetricDescriptorMetadata { @@ -836,10 +813,10 @@ function createBaseMetric_LabelsEntry(): Metric_LabelsEntry { } export const Metric_LabelsEntry = { encode(message: Metric_LabelsEntry, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.key !== "") { + if (message.key !== undefined) { writer.uint32(10).string(message.key); } - if (message.value !== "") { + if (message.value !== undefined) { writer.uint32(18).string(message.value); } return writer; @@ -865,10 +842,10 @@ export const Metric_LabelsEntry = { return message; }, fromJSON(object: any): Metric_LabelsEntry { - return { - key: isSet(object.key) ? String(object.key) : "", - value: isSet(object.value) ? String(object.value) : "" - }; + const obj = createBaseMetric_LabelsEntry(); + if (isSet(object.key)) obj.key = String(object.key); + if (isSet(object.value)) obj.value = String(object.value); + return obj; }, toJSON(message: Metric_LabelsEntry): JsonSafe { const obj: any = {}; @@ -935,7 +912,7 @@ function createBaseMetric(): Metric { export const Metric = { typeUrl: "/google.api.Metric", encode(message: Metric, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.type !== "") { + if (message.type !== undefined) { writer.uint32(26).string(message.type); } Object.entries(message.labels).forEach(([key, value]) => { @@ -970,15 +947,15 @@ export const Metric = { return message; }, fromJSON(object: any): Metric { - return { - type: isSet(object.type) ? String(object.type) : "", - labels: isObject(object.labels) ? Object.entries(object.labels).reduce<{ - [key: string]: string; - }>((acc, [key, value]) => { - acc[key] = String(value); - return acc; - }, {}) : {} - }; + const obj = createBaseMetric(); + if (isSet(object.type)) obj.type = String(object.type); + if (isObject(object.labels)) obj.labels = Object.entries(object.labels).reduce<{ + [key: string]: string; + }>((acc, [key, value]) => { + acc[key] = String(value); + return acc; + }, {}); + return obj; }, toJSON(message: Metric): JsonSafe { const obj: any = {}; diff --git a/__fixtures__/v-next/outputv4/google/api/monitored_resource.ts b/__fixtures__/v-next/outputv4/google/api/monitored_resource.ts index 710eba58ad..145d16fdc8 100644 --- a/__fixtures__/v-next/outputv4/google/api/monitored_resource.ts +++ b/__fixtures__/v-next/outputv4/google/api/monitored_resource.ts @@ -1,10 +1,9 @@ -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 { JsonSafe } from "../../json-safe"; -import { ComputedRef } from "vue"; +import { LabelDescriptor, LabelDescriptorSDKType } from "./label.js"; +import { LaunchStage, LaunchStageSDKType, launchStageFromJSON, launchStageToJSON } from "./launch_stage.js"; +import { Struct, StructSDKType } from "../protobuf/struct.js"; +import { BinaryReader, BinaryWriter } from "../../binary.js"; +import { isSet, DeepPartial, isObject } from "../../helpers.js"; +import { JsonSafe } from "../../json-safe.js"; export const protobufPackage = "google.api"; /** * An object that describes the schema of a [MonitoredResource][google.api.MonitoredResource] object using a @@ -53,14 +52,6 @@ export interface MonitoredResourceDescriptor { /** Optional. The launch stage of the monitored resource definition. */ launchStage: LaunchStage; } -export interface ReactiveMonitoredResourceDescriptor { - name: ComputedRef; - type: ComputedRef; - displayName: ComputedRef; - description: ComputedRef; - labels: ComputedRef; - launchStage: ComputedRef; -} export interface MonitoredResourceDescriptorProtoMsg { typeUrl: "/google.api.MonitoredResourceDescriptor"; value: Uint8Array; @@ -88,10 +79,6 @@ export interface MonitoredResource_LabelsEntry { key: string; value: string; } -export interface ReactiveMonitoredResource_LabelsEntry { - key: ComputedRef; - value: ComputedRef; -} export interface MonitoredResource_LabelsEntryProtoMsg { typeUrl: string; value: Uint8Array; @@ -131,12 +118,6 @@ export interface MonitoredResource { [key: string]: string; }; } -export interface ReactiveMonitoredResource { - type: ComputedRef; - labels: ComputedRef<{ - [key: string]: string; - }>; -} export interface MonitoredResourceProtoMsg { typeUrl: "/google.api.MonitoredResource"; value: Uint8Array; @@ -166,10 +147,6 @@ export interface MonitoredResourceMetadata_UserLabelsEntry { key: string; value: string; } -export interface ReactiveMonitoredResourceMetadata_UserLabelsEntry { - key: ComputedRef; - value: ComputedRef; -} export interface MonitoredResourceMetadata_UserLabelsEntryProtoMsg { typeUrl: string; value: Uint8Array; @@ -205,12 +182,6 @@ export interface MonitoredResourceMetadata { [key: string]: string; }; } -export interface ReactiveMonitoredResourceMetadata { - systemLabels?: ComputedRef; - userLabels: ComputedRef<{ - [key: string]: string; - }>; -} export interface MonitoredResourceMetadataProtoMsg { typeUrl: "/google.api.MonitoredResourceMetadata"; value: Uint8Array; @@ -242,16 +213,16 @@ function createBaseMonitoredResourceDescriptor(): MonitoredResourceDescriptor { export const MonitoredResourceDescriptor = { typeUrl: "/google.api.MonitoredResourceDescriptor", encode(message: MonitoredResourceDescriptor, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.name !== "") { + if (message.name !== undefined) { writer.uint32(42).string(message.name); } - if (message.type !== "") { + if (message.type !== undefined) { writer.uint32(10).string(message.type); } - if (message.displayName !== "") { + if (message.displayName !== undefined) { writer.uint32(18).string(message.displayName); } - if (message.description !== "") { + if (message.description !== undefined) { writer.uint32(26).string(message.description); } for (const v of message.labels) { @@ -295,14 +266,14 @@ export const MonitoredResourceDescriptor = { return message; }, fromJSON(object: any): MonitoredResourceDescriptor { - return { - name: isSet(object.name) ? String(object.name) : "", - type: isSet(object.type) ? String(object.type) : "", - displayName: isSet(object.displayName) ? String(object.displayName) : "", - description: isSet(object.description) ? String(object.description) : "", - labels: Array.isArray(object?.labels) ? object.labels.map((e: any) => LabelDescriptor.fromJSON(e)) : [], - launchStage: isSet(object.launchStage) ? launchStageFromJSON(object.launchStage) : -1 - }; + const obj = createBaseMonitoredResourceDescriptor(); + if (isSet(object.name)) obj.name = String(object.name); + if (isSet(object.type)) obj.type = String(object.type); + if (isSet(object.displayName)) obj.displayName = String(object.displayName); + if (isSet(object.description)) obj.description = String(object.description); + if (Array.isArray(object?.labels)) obj.labels = object.labels.map((e: any) => LabelDescriptor.fromJSON(e)); + if (isSet(object.launchStage)) obj.launchStage = launchStageFromJSON(object.launchStage); + return obj; }, toJSON(message: MonitoredResourceDescriptor): JsonSafe { const obj: any = {}; @@ -420,10 +391,10 @@ function createBaseMonitoredResource_LabelsEntry(): MonitoredResource_LabelsEntr } export const MonitoredResource_LabelsEntry = { encode(message: MonitoredResource_LabelsEntry, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.key !== "") { + if (message.key !== undefined) { writer.uint32(10).string(message.key); } - if (message.value !== "") { + if (message.value !== undefined) { writer.uint32(18).string(message.value); } return writer; @@ -449,10 +420,10 @@ export const MonitoredResource_LabelsEntry = { return message; }, fromJSON(object: any): MonitoredResource_LabelsEntry { - return { - key: isSet(object.key) ? String(object.key) : "", - value: isSet(object.value) ? String(object.value) : "" - }; + const obj = createBaseMonitoredResource_LabelsEntry(); + if (isSet(object.key)) obj.key = String(object.key); + if (isSet(object.value)) obj.value = String(object.value); + return obj; }, toJSON(message: MonitoredResource_LabelsEntry): JsonSafe { const obj: any = {}; @@ -519,7 +490,7 @@ function createBaseMonitoredResource(): MonitoredResource { export const MonitoredResource = { typeUrl: "/google.api.MonitoredResource", encode(message: MonitoredResource, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.type !== "") { + if (message.type !== undefined) { writer.uint32(10).string(message.type); } Object.entries(message.labels).forEach(([key, value]) => { @@ -554,15 +525,15 @@ export const MonitoredResource = { return message; }, fromJSON(object: any): MonitoredResource { - return { - type: isSet(object.type) ? String(object.type) : "", - labels: isObject(object.labels) ? Object.entries(object.labels).reduce<{ - [key: string]: string; - }>((acc, [key, value]) => { - acc[key] = String(value); - return acc; - }, {}) : {} - }; + const obj = createBaseMonitoredResource(); + if (isSet(object.type)) obj.type = String(object.type); + if (isObject(object.labels)) obj.labels = Object.entries(object.labels).reduce<{ + [key: string]: string; + }>((acc, [key, value]) => { + acc[key] = String(value); + return acc; + }, {}); + return obj; }, toJSON(message: MonitoredResource): JsonSafe { const obj: any = {}; @@ -671,10 +642,10 @@ function createBaseMonitoredResourceMetadata_UserLabelsEntry(): MonitoredResourc } export const MonitoredResourceMetadata_UserLabelsEntry = { encode(message: MonitoredResourceMetadata_UserLabelsEntry, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.key !== "") { + if (message.key !== undefined) { writer.uint32(10).string(message.key); } - if (message.value !== "") { + if (message.value !== undefined) { writer.uint32(18).string(message.value); } return writer; @@ -700,10 +671,10 @@ export const MonitoredResourceMetadata_UserLabelsEntry = { return message; }, fromJSON(object: any): MonitoredResourceMetadata_UserLabelsEntry { - return { - key: isSet(object.key) ? String(object.key) : "", - value: isSet(object.value) ? String(object.value) : "" - }; + const obj = createBaseMonitoredResourceMetadata_UserLabelsEntry(); + if (isSet(object.key)) obj.key = String(object.key); + if (isSet(object.value)) obj.value = String(object.value); + return obj; }, toJSON(message: MonitoredResourceMetadata_UserLabelsEntry): JsonSafe { const obj: any = {}; @@ -805,15 +776,15 @@ export const MonitoredResourceMetadata = { return message; }, fromJSON(object: any): MonitoredResourceMetadata { - return { - systemLabels: isSet(object.systemLabels) ? Struct.fromJSON(object.systemLabels) : undefined, - userLabels: isObject(object.userLabels) ? Object.entries(object.userLabels).reduce<{ - [key: string]: string; - }>((acc, [key, value]) => { - acc[key] = String(value); - return acc; - }, {}) : {} - }; + const obj = createBaseMonitoredResourceMetadata(); + if (isSet(object.systemLabels)) obj.systemLabels = Struct.fromJSON(object.systemLabels); + if (isObject(object.userLabels)) obj.userLabels = Object.entries(object.userLabels).reduce<{ + [key: string]: string; + }>((acc, [key, value]) => { + acc[key] = String(value); + return acc; + }, {}); + return obj; }, toJSON(message: MonitoredResourceMetadata): JsonSafe { const obj: any = {}; @@ -828,7 +799,9 @@ export const MonitoredResourceMetadata = { }, fromPartial(object: DeepPartial): MonitoredResourceMetadata { const message = createBaseMonitoredResourceMetadata(); - message.systemLabels = object.systemLabels !== undefined && object.systemLabels !== null ? Struct.fromPartial(object.systemLabels) : undefined; + if (object.systemLabels !== undefined && object.systemLabels !== null) { + message.systemLabels = Struct.fromPartial(object.systemLabels); + } message.userLabels = Object.entries(object.userLabels ?? {}).reduce<{ [key: string]: string; }>((acc, [key, value]) => { diff --git a/__fixtures__/v-next/outputv4/google/api/monitoring.ts b/__fixtures__/v-next/outputv4/google/api/monitoring.ts index 13e40875b6..8c498f9aab 100644 --- a/__fixtures__/v-next/outputv4/google/api/monitoring.ts +++ b/__fixtures__/v-next/outputv4/google/api/monitoring.ts @@ -1,7 +1,6 @@ -import { BinaryReader, BinaryWriter } from "../../binary"; -import { JsonSafe } from "../../json-safe"; -import { DeepPartial, isSet } from "../../helpers"; -import { ComputedRef } from "vue"; +import { BinaryReader, BinaryWriter } from "../../binary.js"; +import { JsonSafe } from "../../json-safe.js"; +import { DeepPartial, isSet } from "../../helpers.js"; export const protobufPackage = "google.api"; /** * Monitoring configuration of the service. @@ -77,10 +76,6 @@ export interface Monitoring { */ consumerDestinations: Monitoring_MonitoringDestination[]; } -export interface ReactiveMonitoring { - producerDestinations: ComputedRef; - consumerDestinations: ComputedRef; -} export interface MonitoringProtoMsg { typeUrl: "/google.api.Monitoring"; value: Uint8Array; @@ -159,10 +154,6 @@ export interface Monitoring_MonitoringDestination { */ metrics: string[]; } -export interface ReactiveMonitoring_MonitoringDestination { - monitoredResource: ComputedRef; - metrics: ComputedRef; -} export interface Monitoring_MonitoringDestinationProtoMsg { typeUrl: "/google.api.MonitoringDestination"; value: Uint8Array; @@ -213,10 +204,10 @@ export const Monitoring = { return message; }, fromJSON(object: any): Monitoring { - return { - producerDestinations: Array.isArray(object?.producerDestinations) ? object.producerDestinations.map((e: any) => Monitoring_MonitoringDestination.fromJSON(e)) : [], - consumerDestinations: Array.isArray(object?.consumerDestinations) ? object.consumerDestinations.map((e: any) => Monitoring_MonitoringDestination.fromJSON(e)) : [] - }; + const obj = createBaseMonitoring(); + if (Array.isArray(object?.producerDestinations)) obj.producerDestinations = object.producerDestinations.map((e: any) => Monitoring_MonitoringDestination.fromJSON(e)); + if (Array.isArray(object?.consumerDestinations)) obj.consumerDestinations = object.consumerDestinations.map((e: any) => Monitoring_MonitoringDestination.fromJSON(e)); + return obj; }, toJSON(message: Monitoring): JsonSafe { const obj: any = {}; @@ -309,7 +300,7 @@ function createBaseMonitoring_MonitoringDestination(): Monitoring_MonitoringDest export const Monitoring_MonitoringDestination = { typeUrl: "/google.api.MonitoringDestination", encode(message: Monitoring_MonitoringDestination, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.monitoredResource !== "") { + if (message.monitoredResource !== undefined) { writer.uint32(10).string(message.monitoredResource); } for (const v of message.metrics) { @@ -338,10 +329,10 @@ export const Monitoring_MonitoringDestination = { return message; }, fromJSON(object: any): Monitoring_MonitoringDestination { - return { - monitoredResource: isSet(object.monitoredResource) ? String(object.monitoredResource) : "", - metrics: Array.isArray(object?.metrics) ? object.metrics.map((e: any) => String(e)) : [] - }; + const obj = createBaseMonitoring_MonitoringDestination(); + if (isSet(object.monitoredResource)) obj.monitoredResource = String(object.monitoredResource); + if (Array.isArray(object?.metrics)) obj.metrics = object.metrics.map((e: any) => String(e)); + return obj; }, toJSON(message: Monitoring_MonitoringDestination): JsonSafe { const obj: any = {}; diff --git a/__fixtures__/v-next/outputv4/google/api/quota.ts b/__fixtures__/v-next/outputv4/google/api/quota.ts index 0e930f65a3..fff33aa53e 100644 --- a/__fixtures__/v-next/outputv4/google/api/quota.ts +++ b/__fixtures__/v-next/outputv4/google/api/quota.ts @@ -1,7 +1,6 @@ -import { BinaryReader, BinaryWriter } from "../../binary"; -import { JsonSafe } from "../../json-safe"; -import { DeepPartial, isSet, isObject } from "../../helpers"; -import { ComputedRef } from "vue"; +import { BinaryReader, BinaryWriter } from "../../binary.js"; +import { JsonSafe } from "../../json-safe.js"; +import { DeepPartial, isSet, isObject } from "../../helpers.js"; export const protobufPackage = "google.api"; /** * Quota configuration helps to achieve fairness and budgeting in service @@ -63,10 +62,6 @@ export interface Quota { */ metricRules: MetricRule[]; } -export interface ReactiveQuota { - limits: ComputedRef; - metricRules: ComputedRef; -} export interface QuotaProtoMsg { typeUrl: "/google.api.Quota"; value: Uint8Array; @@ -130,10 +125,6 @@ export interface MetricRule_MetricCostsEntry { key: string; value: bigint; } -export interface ReactiveMetricRule_MetricCostsEntry { - key: ComputedRef; - value: ComputedRef; -} export interface MetricRule_MetricCostsEntryProtoMsg { typeUrl: string; value: Uint8Array; @@ -165,12 +156,6 @@ export interface MetricRule { [key: string]: bigint; }; } -export interface ReactiveMetricRule { - selector: ComputedRef; - metricCosts: ComputedRef<{ - [key: string]: bigint; - }>; -} export interface MetricRuleProtoMsg { typeUrl: "/google.api.MetricRule"; value: Uint8Array; @@ -189,10 +174,6 @@ export interface QuotaLimit_ValuesEntry { key: string; value: bigint; } -export interface ReactiveQuotaLimit_ValuesEntry { - key: ComputedRef; - value: ComputedRef; -} export interface QuotaLimit_ValuesEntryProtoMsg { typeUrl: string; value: Uint8Array; @@ -298,20 +279,6 @@ export interface QuotaLimit { */ displayName: string; } -export interface ReactiveQuotaLimit { - name: ComputedRef; - description: ComputedRef; - defaultLimit: ComputedRef; - maxLimit: ComputedRef; - freeTier: ComputedRef; - duration: ComputedRef; - metric: ComputedRef; - unit: ComputedRef; - values: ComputedRef<{ - [key: string]: bigint; - }>; - displayName: ComputedRef; -} export interface QuotaLimitProtoMsg { typeUrl: "/google.api.QuotaLimit"; value: Uint8Array; @@ -373,10 +340,10 @@ export const Quota = { return message; }, fromJSON(object: any): Quota { - return { - limits: Array.isArray(object?.limits) ? object.limits.map((e: any) => QuotaLimit.fromJSON(e)) : [], - metricRules: Array.isArray(object?.metricRules) ? object.metricRules.map((e: any) => MetricRule.fromJSON(e)) : [] - }; + const obj = createBaseQuota(); + if (Array.isArray(object?.limits)) obj.limits = object.limits.map((e: any) => QuotaLimit.fromJSON(e)); + if (Array.isArray(object?.metricRules)) obj.metricRules = object.metricRules.map((e: any) => MetricRule.fromJSON(e)); + return obj; }, toJSON(message: Quota): JsonSafe { const obj: any = {}; @@ -468,10 +435,10 @@ function createBaseMetricRule_MetricCostsEntry(): MetricRule_MetricCostsEntry { } export const MetricRule_MetricCostsEntry = { encode(message: MetricRule_MetricCostsEntry, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.key !== "") { + if (message.key !== undefined) { writer.uint32(10).string(message.key); } - if (message.value !== BigInt(0)) { + if (message.value !== undefined) { writer.uint32(16).int64(message.value); } return writer; @@ -497,10 +464,10 @@ export const MetricRule_MetricCostsEntry = { return message; }, fromJSON(object: any): MetricRule_MetricCostsEntry { - return { - key: isSet(object.key) ? String(object.key) : "", - value: isSet(object.value) ? BigInt(object.value.toString()) : BigInt(0) - }; + const obj = createBaseMetricRule_MetricCostsEntry(); + if (isSet(object.key)) obj.key = String(object.key); + if (isSet(object.value)) obj.value = BigInt(object.value.toString()); + return obj; }, toJSON(message: MetricRule_MetricCostsEntry): JsonSafe { const obj: any = {}; @@ -511,7 +478,9 @@ export const MetricRule_MetricCostsEntry = { fromPartial(object: DeepPartial): MetricRule_MetricCostsEntry { const message = createBaseMetricRule_MetricCostsEntry(); message.key = object.key ?? ""; - message.value = object.value !== undefined && object.value !== null ? BigInt(object.value.toString()) : BigInt(0); + if (object.value !== undefined && object.value !== null) { + message.value = BigInt(object.value.toString()); + } return message; }, fromSDK(object: MetricRule_MetricCostsEntrySDKType): MetricRule_MetricCostsEntry { @@ -567,7 +536,7 @@ function createBaseMetricRule(): MetricRule { export const MetricRule = { typeUrl: "/google.api.MetricRule", encode(message: MetricRule, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.selector !== "") { + if (message.selector !== undefined) { writer.uint32(10).string(message.selector); } Object.entries(message.metricCosts).forEach(([key, value]) => { @@ -602,15 +571,15 @@ export const MetricRule = { return message; }, fromJSON(object: any): MetricRule { - return { - selector: isSet(object.selector) ? String(object.selector) : "", - metricCosts: isObject(object.metricCosts) ? Object.entries(object.metricCosts).reduce<{ - [key: string]: bigint; - }>((acc, [key, value]) => { - acc[key] = BigInt((value as bigint | string).toString()); - return acc; - }, {}) : {} - }; + const obj = createBaseMetricRule(); + if (isSet(object.selector)) obj.selector = String(object.selector); + if (isObject(object.metricCosts)) obj.metricCosts = Object.entries(object.metricCosts).reduce<{ + [key: string]: bigint; + }>((acc, [key, value]) => { + acc[key] = BigInt((value as bigint | string).toString()); + return acc; + }, {}); + return obj; }, toJSON(message: MetricRule): JsonSafe { const obj: any = {}; @@ -719,10 +688,10 @@ function createBaseQuotaLimit_ValuesEntry(): QuotaLimit_ValuesEntry { } export const QuotaLimit_ValuesEntry = { encode(message: QuotaLimit_ValuesEntry, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.key !== "") { + if (message.key !== undefined) { writer.uint32(10).string(message.key); } - if (message.value !== BigInt(0)) { + if (message.value !== undefined) { writer.uint32(16).int64(message.value); } return writer; @@ -748,10 +717,10 @@ export const QuotaLimit_ValuesEntry = { return message; }, fromJSON(object: any): QuotaLimit_ValuesEntry { - return { - key: isSet(object.key) ? String(object.key) : "", - value: isSet(object.value) ? BigInt(object.value.toString()) : BigInt(0) - }; + const obj = createBaseQuotaLimit_ValuesEntry(); + if (isSet(object.key)) obj.key = String(object.key); + if (isSet(object.value)) obj.value = BigInt(object.value.toString()); + return obj; }, toJSON(message: QuotaLimit_ValuesEntry): JsonSafe { const obj: any = {}; @@ -762,7 +731,9 @@ export const QuotaLimit_ValuesEntry = { fromPartial(object: DeepPartial): QuotaLimit_ValuesEntry { const message = createBaseQuotaLimit_ValuesEntry(); message.key = object.key ?? ""; - message.value = object.value !== undefined && object.value !== null ? BigInt(object.value.toString()) : BigInt(0); + if (object.value !== undefined && object.value !== null) { + message.value = BigInt(object.value.toString()); + } return message; }, fromSDK(object: QuotaLimit_ValuesEntrySDKType): QuotaLimit_ValuesEntry { @@ -826,28 +797,28 @@ function createBaseQuotaLimit(): QuotaLimit { export const QuotaLimit = { typeUrl: "/google.api.QuotaLimit", encode(message: QuotaLimit, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.name !== "") { + if (message.name !== undefined) { writer.uint32(50).string(message.name); } - if (message.description !== "") { + if (message.description !== undefined) { writer.uint32(18).string(message.description); } - if (message.defaultLimit !== BigInt(0)) { + if (message.defaultLimit !== undefined) { writer.uint32(24).int64(message.defaultLimit); } - if (message.maxLimit !== BigInt(0)) { + if (message.maxLimit !== undefined) { writer.uint32(32).int64(message.maxLimit); } - if (message.freeTier !== BigInt(0)) { + if (message.freeTier !== undefined) { writer.uint32(56).int64(message.freeTier); } - if (message.duration !== "") { + if (message.duration !== undefined) { writer.uint32(42).string(message.duration); } - if (message.metric !== "") { + if (message.metric !== undefined) { writer.uint32(66).string(message.metric); } - if (message.unit !== "") { + if (message.unit !== undefined) { writer.uint32(74).string(message.unit); } Object.entries(message.values).forEach(([key, value]) => { @@ -856,7 +827,7 @@ export const QuotaLimit = { value }, writer.uint32(80).fork()).ldelim(); }); - if (message.displayName !== "") { + if (message.displayName !== undefined) { writer.uint32(98).string(message.displayName); } return writer; @@ -909,23 +880,23 @@ export const QuotaLimit = { return message; }, fromJSON(object: any): QuotaLimit { - return { - name: isSet(object.name) ? String(object.name) : "", - description: isSet(object.description) ? String(object.description) : "", - defaultLimit: isSet(object.defaultLimit) ? BigInt(object.defaultLimit.toString()) : BigInt(0), - maxLimit: isSet(object.maxLimit) ? BigInt(object.maxLimit.toString()) : BigInt(0), - freeTier: isSet(object.freeTier) ? BigInt(object.freeTier.toString()) : BigInt(0), - duration: isSet(object.duration) ? String(object.duration) : "", - metric: isSet(object.metric) ? String(object.metric) : "", - unit: isSet(object.unit) ? String(object.unit) : "", - values: isObject(object.values) ? Object.entries(object.values).reduce<{ - [key: string]: bigint; - }>((acc, [key, value]) => { - acc[key] = BigInt((value as bigint | string).toString()); - return acc; - }, {}) : {}, - displayName: isSet(object.displayName) ? String(object.displayName) : "" - }; + const obj = createBaseQuotaLimit(); + if (isSet(object.name)) obj.name = String(object.name); + if (isSet(object.description)) obj.description = String(object.description); + if (isSet(object.defaultLimit)) obj.defaultLimit = BigInt(object.defaultLimit.toString()); + if (isSet(object.maxLimit)) obj.maxLimit = BigInt(object.maxLimit.toString()); + if (isSet(object.freeTier)) obj.freeTier = BigInt(object.freeTier.toString()); + if (isSet(object.duration)) obj.duration = String(object.duration); + if (isSet(object.metric)) obj.metric = String(object.metric); + if (isSet(object.unit)) obj.unit = String(object.unit); + if (isObject(object.values)) obj.values = Object.entries(object.values).reduce<{ + [key: string]: bigint; + }>((acc, [key, value]) => { + acc[key] = BigInt((value as bigint | string).toString()); + return acc; + }, {}); + if (isSet(object.displayName)) obj.displayName = String(object.displayName); + return obj; }, toJSON(message: QuotaLimit): JsonSafe { const obj: any = {}; @@ -950,9 +921,15 @@ export const QuotaLimit = { const message = createBaseQuotaLimit(); message.name = object.name ?? ""; message.description = object.description ?? ""; - message.defaultLimit = object.defaultLimit !== undefined && object.defaultLimit !== null ? BigInt(object.defaultLimit.toString()) : BigInt(0); - message.maxLimit = object.maxLimit !== undefined && object.maxLimit !== null ? BigInt(object.maxLimit.toString()) : BigInt(0); - message.freeTier = object.freeTier !== undefined && object.freeTier !== null ? BigInt(object.freeTier.toString()) : BigInt(0); + if (object.defaultLimit !== undefined && object.defaultLimit !== null) { + message.defaultLimit = BigInt(object.defaultLimit.toString()); + } + if (object.maxLimit !== undefined && object.maxLimit !== null) { + message.maxLimit = BigInt(object.maxLimit.toString()); + } + if (object.freeTier !== undefined && object.freeTier !== null) { + message.freeTier = BigInt(object.freeTier.toString()); + } message.duration = object.duration ?? ""; message.metric = object.metric ?? ""; message.unit = object.unit ?? ""; diff --git a/__fixtures__/v-next/outputv4/google/api/resource.ts b/__fixtures__/v-next/outputv4/google/api/resource.ts index b288109691..81b8db510d 100644 --- a/__fixtures__/v-next/outputv4/google/api/resource.ts +++ b/__fixtures__/v-next/outputv4/google/api/resource.ts @@ -1,7 +1,6 @@ -import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial } from "../../helpers"; -import { JsonSafe } from "../../json-safe"; -import { ComputedRef } from "vue"; +import { BinaryReader, BinaryWriter } from "../../binary.js"; +import { isSet, DeepPartial } from "../../helpers.js"; +import { JsonSafe } from "../../json-safe.js"; export const protobufPackage = "google.api"; /** * A description of the historical or future-looking state of the @@ -229,15 +228,6 @@ export interface ResourceDescriptor { */ style: ResourceDescriptor_Style[]; } -export interface ReactiveResourceDescriptor { - type: ComputedRef; - pattern: ComputedRef; - nameField: ComputedRef; - history: ComputedRef; - plural: ComputedRef; - singular: ComputedRef; - style: ComputedRef; -} export interface ResourceDescriptorProtoMsg { typeUrl: "/google.api.ResourceDescriptor"; value: Uint8Array; @@ -343,10 +333,6 @@ export interface ResourceReference { */ childType: string; } -export interface ReactiveResourceReference { - type: ComputedRef; - childType: ComputedRef; -} export interface ResourceReferenceProtoMsg { typeUrl: "/google.api.ResourceReference"; value: Uint8Array; @@ -373,22 +359,22 @@ function createBaseResourceDescriptor(): ResourceDescriptor { export const ResourceDescriptor = { typeUrl: "/google.api.ResourceDescriptor", encode(message: ResourceDescriptor, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.type !== "") { + if (message.type !== undefined) { writer.uint32(10).string(message.type); } for (const v of message.pattern) { writer.uint32(18).string(v!); } - if (message.nameField !== "") { + if (message.nameField !== undefined) { writer.uint32(26).string(message.nameField); } if (message.history !== 0) { writer.uint32(32).int32(message.history); } - if (message.plural !== "") { + if (message.plural !== undefined) { writer.uint32(42).string(message.plural); } - if (message.singular !== "") { + if (message.singular !== undefined) { writer.uint32(50).string(message.singular); } writer.uint32(82).fork(); @@ -441,15 +427,15 @@ export const ResourceDescriptor = { return message; }, fromJSON(object: any): ResourceDescriptor { - return { - type: isSet(object.type) ? String(object.type) : "", - pattern: Array.isArray(object?.pattern) ? object.pattern.map((e: any) => String(e)) : [], - nameField: isSet(object.nameField) ? String(object.nameField) : "", - history: isSet(object.history) ? resourceDescriptor_HistoryFromJSON(object.history) : -1, - plural: isSet(object.plural) ? String(object.plural) : "", - singular: isSet(object.singular) ? String(object.singular) : "", - style: Array.isArray(object?.style) ? object.style.map((e: any) => resourceDescriptor_StyleFromJSON(e)) : [] - }; + const obj = createBaseResourceDescriptor(); + if (isSet(object.type)) obj.type = String(object.type); + if (Array.isArray(object?.pattern)) obj.pattern = object.pattern.map((e: any) => String(e)); + if (isSet(object.nameField)) obj.nameField = String(object.nameField); + if (isSet(object.history)) obj.history = resourceDescriptor_HistoryFromJSON(object.history); + if (isSet(object.plural)) obj.plural = String(object.plural); + if (isSet(object.singular)) obj.singular = String(object.singular); + if (Array.isArray(object?.style)) obj.style = object.style.map((e: any) => resourceDescriptor_StyleFromJSON(e)); + return obj; }, toJSON(message: ResourceDescriptor): JsonSafe { const obj: any = {}; @@ -587,10 +573,10 @@ function createBaseResourceReference(): ResourceReference { export const ResourceReference = { typeUrl: "/google.api.ResourceReference", encode(message: ResourceReference, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.type !== "") { + if (message.type !== undefined) { writer.uint32(10).string(message.type); } - if (message.childType !== "") { + if (message.childType !== undefined) { writer.uint32(18).string(message.childType); } return writer; @@ -616,10 +602,10 @@ export const ResourceReference = { return message; }, fromJSON(object: any): ResourceReference { - return { - type: isSet(object.type) ? String(object.type) : "", - childType: isSet(object.childType) ? String(object.childType) : "" - }; + const obj = createBaseResourceReference(); + if (isSet(object.type)) obj.type = String(object.type); + if (isSet(object.childType)) obj.childType = String(object.childType); + return obj; }, toJSON(message: ResourceReference): JsonSafe { const obj: any = {}; diff --git a/__fixtures__/v-next/outputv4/google/api/routing.ts b/__fixtures__/v-next/outputv4/google/api/routing.ts index 2ec214fd7d..d86d2e3190 100644 --- a/__fixtures__/v-next/outputv4/google/api/routing.ts +++ b/__fixtures__/v-next/outputv4/google/api/routing.ts @@ -1,7 +1,6 @@ -import { BinaryReader, BinaryWriter } from "../../binary"; -import { JsonSafe } from "../../json-safe"; -import { DeepPartial, isSet } from "../../helpers"; -import { ComputedRef } from "vue"; +import { BinaryReader, BinaryWriter } from "../../binary.js"; +import { JsonSafe } from "../../json-safe.js"; +import { DeepPartial, isSet } from "../../helpers.js"; export const protobufPackage = "google.api"; /** * Specifies the routing information that should be sent along with the request @@ -375,9 +374,6 @@ export interface RoutingRule { */ routingParameters: RoutingParameter[]; } -export interface ReactiveRoutingRule { - routingParameters: ComputedRef; -} export interface RoutingRuleProtoMsg { typeUrl: "/google.api.RoutingRule"; value: Uint8Array; @@ -808,10 +804,6 @@ export interface RoutingParameter { */ pathTemplate: string; } -export interface ReactiveRoutingParameter { - field: ComputedRef; - pathTemplate: ComputedRef; -} export interface RoutingParameterProtoMsg { typeUrl: "/google.api.RoutingParameter"; value: Uint8Array; @@ -852,9 +844,9 @@ export const RoutingRule = { return message; }, fromJSON(object: any): RoutingRule { - return { - routingParameters: Array.isArray(object?.routingParameters) ? object.routingParameters.map((e: any) => RoutingParameter.fromJSON(e)) : [] - }; + const obj = createBaseRoutingRule(); + if (Array.isArray(object?.routingParameters)) obj.routingParameters = object.routingParameters.map((e: any) => RoutingParameter.fromJSON(e)); + return obj; }, toJSON(message: RoutingRule): JsonSafe { const obj: any = {}; @@ -928,10 +920,10 @@ function createBaseRoutingParameter(): RoutingParameter { export const RoutingParameter = { typeUrl: "/google.api.RoutingParameter", encode(message: RoutingParameter, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.field !== "") { + if (message.field !== undefined) { writer.uint32(10).string(message.field); } - if (message.pathTemplate !== "") { + if (message.pathTemplate !== undefined) { writer.uint32(18).string(message.pathTemplate); } return writer; @@ -957,10 +949,10 @@ export const RoutingParameter = { return message; }, fromJSON(object: any): RoutingParameter { - return { - field: isSet(object.field) ? String(object.field) : "", - pathTemplate: isSet(object.pathTemplate) ? String(object.pathTemplate) : "" - }; + const obj = createBaseRoutingParameter(); + if (isSet(object.field)) obj.field = String(object.field); + if (isSet(object.pathTemplate)) obj.pathTemplate = String(object.pathTemplate); + return obj; }, toJSON(message: RoutingParameter): JsonSafe { const obj: any = {}; diff --git a/__fixtures__/v-next/outputv4/google/api/service.ts b/__fixtures__/v-next/outputv4/google/api/service.ts index 5b54012126..61c5acb193 100644 --- a/__fixtures__/v-next/outputv4/google/api/service.ts +++ b/__fixtures__/v-next/outputv4/google/api/service.ts @@ -1,27 +1,26 @@ -import { Api, ApiSDKType } from "../protobuf/api"; -import { Type, TypeSDKType, Enum, EnumSDKType } from "../protobuf/type"; -import { Documentation, DocumentationSDKType } from "./documentation"; -import { Backend, BackendSDKType } from "./backend"; -import { Http, HttpSDKType } from "./http"; -import { Quota, QuotaSDKType } from "./quota"; -import { Authentication, AuthenticationSDKType } from "./auth"; -import { Context, ContextSDKType } from "./context"; -import { Usage, UsageSDKType } from "./usage"; -import { Endpoint, EndpointSDKType } from "./endpoint"; -import { Control, ControlSDKType } from "./control"; -import { LogDescriptor, LogDescriptorSDKType } from "./log"; -import { MetricDescriptor, MetricDescriptorSDKType } from "./metric"; -import { MonitoredResourceDescriptor, MonitoredResourceDescriptorSDKType } from "./monitored_resource"; -import { Billing, BillingSDKType } from "./billing"; -import { Logging, LoggingSDKType } from "./logging"; -import { Monitoring, MonitoringSDKType } from "./monitoring"; -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 { JsonSafe } from "../../json-safe"; -import { ComputedRef } from "vue"; +import { Api, ApiSDKType } from "../protobuf/api.js"; +import { Type, TypeSDKType, Enum, EnumSDKType } from "../protobuf/type.js"; +import { Documentation, DocumentationSDKType } from "./documentation.js"; +import { Backend, BackendSDKType } from "./backend.js"; +import { Http, HttpSDKType } from "./http.js"; +import { Quota, QuotaSDKType } from "./quota.js"; +import { Authentication, AuthenticationSDKType } from "./auth.js"; +import { Context, ContextSDKType } from "./context.js"; +import { Usage, UsageSDKType } from "./usage.js"; +import { Endpoint, EndpointSDKType } from "./endpoint.js"; +import { Control, ControlSDKType } from "./control.js"; +import { LogDescriptor, LogDescriptorSDKType } from "./log.js"; +import { MetricDescriptor, MetricDescriptorSDKType } from "./metric.js"; +import { MonitoredResourceDescriptor, MonitoredResourceDescriptorSDKType } from "./monitored_resource.js"; +import { Billing, BillingSDKType } from "./billing.js"; +import { Logging, LoggingSDKType } from "./logging.js"; +import { Monitoring, MonitoringSDKType } from "./monitoring.js"; +import { SystemParameters, SystemParametersSDKType } from "./system_parameter.js"; +import { SourceInfo, SourceInfoSDKType } from "./source_info.js"; +import { UInt32Value, UInt32ValueSDKType } from "../protobuf/wrappers.js"; +import { BinaryReader, BinaryWriter } from "../../binary.js"; +import { isSet, DeepPartial } from "../../helpers.js"; +import { JsonSafe } from "../../json-safe.js"; export const protobufPackage = "google.api"; /** * `Service` is the root object of Google service configuration schema. It @@ -145,33 +144,6 @@ export interface Service { /** @deprecated */ configVersion?: UInt32Value; } -export interface ReactiveService { - name: ComputedRef; - title: ComputedRef; - producerProjectId: ComputedRef; - id: ComputedRef; - apis: ComputedRef; - types: ComputedRef; - enums: ComputedRef; - documentation?: ComputedRef; - backend?: ComputedRef; - http?: ComputedRef; - quota?: ComputedRef; - authentication?: ComputedRef; - context?: ComputedRef; - usage?: ComputedRef; - endpoints: ComputedRef; - control?: ComputedRef; - logs: ComputedRef; - metrics: ComputedRef; - monitoredResources: ComputedRef; - billing?: ComputedRef; - logging?: ComputedRef; - monitoring?: ComputedRef; - systemParameters?: ComputedRef; - sourceInfo?: ComputedRef; - configVersion?: ComputedRef; -} export interface ServiceProtoMsg { typeUrl: "/google.api.Service"; value: Uint8Array; @@ -260,16 +232,16 @@ function createBaseService(): Service { export const Service = { typeUrl: "/google.api.Service", encode(message: Service, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.name !== "") { + if (message.name !== undefined) { writer.uint32(10).string(message.name); } - if (message.title !== "") { + if (message.title !== undefined) { writer.uint32(18).string(message.title); } - if (message.producerProjectId !== "") { + if (message.producerProjectId !== undefined) { writer.uint32(178).string(message.producerProjectId); } - if (message.id !== "") { + if (message.id !== undefined) { writer.uint32(266).string(message.id); } for (const v of message.apis) { @@ -427,33 +399,33 @@ export const Service = { return message; }, fromJSON(object: any): Service { - return { - name: isSet(object.name) ? String(object.name) : "", - title: isSet(object.title) ? String(object.title) : "", - producerProjectId: isSet(object.producerProjectId) ? String(object.producerProjectId) : "", - id: isSet(object.id) ? String(object.id) : "", - apis: Array.isArray(object?.apis) ? object.apis.map((e: any) => Api.fromJSON(e)) : [], - types: Array.isArray(object?.types) ? object.types.map((e: any) => Type.fromJSON(e)) : [], - enums: Array.isArray(object?.enums) ? object.enums.map((e: any) => Enum.fromJSON(e)) : [], - documentation: isSet(object.documentation) ? Documentation.fromJSON(object.documentation) : undefined, - backend: isSet(object.backend) ? Backend.fromJSON(object.backend) : undefined, - http: isSet(object.http) ? Http.fromJSON(object.http) : undefined, - quota: isSet(object.quota) ? Quota.fromJSON(object.quota) : undefined, - authentication: isSet(object.authentication) ? Authentication.fromJSON(object.authentication) : undefined, - context: isSet(object.context) ? Context.fromJSON(object.context) : undefined, - usage: isSet(object.usage) ? Usage.fromJSON(object.usage) : undefined, - endpoints: Array.isArray(object?.endpoints) ? object.endpoints.map((e: any) => Endpoint.fromJSON(e)) : [], - control: isSet(object.control) ? Control.fromJSON(object.control) : undefined, - logs: Array.isArray(object?.logs) ? object.logs.map((e: any) => LogDescriptor.fromJSON(e)) : [], - metrics: Array.isArray(object?.metrics) ? object.metrics.map((e: any) => MetricDescriptor.fromJSON(e)) : [], - monitoredResources: Array.isArray(object?.monitoredResources) ? object.monitoredResources.map((e: any) => MonitoredResourceDescriptor.fromJSON(e)) : [], - billing: isSet(object.billing) ? Billing.fromJSON(object.billing) : undefined, - logging: isSet(object.logging) ? Logging.fromJSON(object.logging) : undefined, - monitoring: isSet(object.monitoring) ? Monitoring.fromJSON(object.monitoring) : undefined, - systemParameters: isSet(object.systemParameters) ? SystemParameters.fromJSON(object.systemParameters) : undefined, - sourceInfo: isSet(object.sourceInfo) ? SourceInfo.fromJSON(object.sourceInfo) : undefined, - configVersion: isSet(object.configVersion) ? UInt32Value.fromJSON(object.configVersion) : undefined - }; + const obj = createBaseService(); + if (isSet(object.name)) obj.name = String(object.name); + if (isSet(object.title)) obj.title = String(object.title); + if (isSet(object.producerProjectId)) obj.producerProjectId = String(object.producerProjectId); + if (isSet(object.id)) obj.id = String(object.id); + if (Array.isArray(object?.apis)) obj.apis = object.apis.map((e: any) => Api.fromJSON(e)); + if (Array.isArray(object?.types)) obj.types = object.types.map((e: any) => Type.fromJSON(e)); + if (Array.isArray(object?.enums)) obj.enums = object.enums.map((e: any) => Enum.fromJSON(e)); + if (isSet(object.documentation)) obj.documentation = Documentation.fromJSON(object.documentation); + if (isSet(object.backend)) obj.backend = Backend.fromJSON(object.backend); + if (isSet(object.http)) obj.http = Http.fromJSON(object.http); + if (isSet(object.quota)) obj.quota = Quota.fromJSON(object.quota); + if (isSet(object.authentication)) obj.authentication = Authentication.fromJSON(object.authentication); + if (isSet(object.context)) obj.context = Context.fromJSON(object.context); + if (isSet(object.usage)) obj.usage = Usage.fromJSON(object.usage); + if (Array.isArray(object?.endpoints)) obj.endpoints = object.endpoints.map((e: any) => Endpoint.fromJSON(e)); + if (isSet(object.control)) obj.control = Control.fromJSON(object.control); + if (Array.isArray(object?.logs)) obj.logs = object.logs.map((e: any) => LogDescriptor.fromJSON(e)); + if (Array.isArray(object?.metrics)) obj.metrics = object.metrics.map((e: any) => MetricDescriptor.fromJSON(e)); + if (Array.isArray(object?.monitoredResources)) obj.monitoredResources = object.monitoredResources.map((e: any) => MonitoredResourceDescriptor.fromJSON(e)); + if (isSet(object.billing)) obj.billing = Billing.fromJSON(object.billing); + if (isSet(object.logging)) obj.logging = Logging.fromJSON(object.logging); + if (isSet(object.monitoring)) obj.monitoring = Monitoring.fromJSON(object.monitoring); + if (isSet(object.systemParameters)) obj.systemParameters = SystemParameters.fromJSON(object.systemParameters); + if (isSet(object.sourceInfo)) obj.sourceInfo = SourceInfo.fromJSON(object.sourceInfo); + if (isSet(object.configVersion)) obj.configVersion = UInt32Value.fromJSON(object.configVersion); + return obj; }, toJSON(message: Service): JsonSafe { const obj: any = {}; @@ -521,24 +493,52 @@ export const Service = { message.apis = object.apis?.map(e => Api.fromPartial(e)) || []; message.types = object.types?.map(e => Type.fromPartial(e)) || []; message.enums = object.enums?.map(e => Enum.fromPartial(e)) || []; - message.documentation = object.documentation !== undefined && object.documentation !== null ? Documentation.fromPartial(object.documentation) : undefined; - message.backend = object.backend !== undefined && object.backend !== null ? Backend.fromPartial(object.backend) : undefined; - message.http = object.http !== undefined && object.http !== null ? Http.fromPartial(object.http) : undefined; - message.quota = object.quota !== undefined && object.quota !== null ? Quota.fromPartial(object.quota) : undefined; - message.authentication = object.authentication !== undefined && object.authentication !== null ? Authentication.fromPartial(object.authentication) : undefined; - message.context = object.context !== undefined && object.context !== null ? Context.fromPartial(object.context) : undefined; - message.usage = object.usage !== undefined && object.usage !== null ? Usage.fromPartial(object.usage) : undefined; + if (object.documentation !== undefined && object.documentation !== null) { + message.documentation = Documentation.fromPartial(object.documentation); + } + if (object.backend !== undefined && object.backend !== null) { + message.backend = Backend.fromPartial(object.backend); + } + if (object.http !== undefined && object.http !== null) { + message.http = Http.fromPartial(object.http); + } + if (object.quota !== undefined && object.quota !== null) { + message.quota = Quota.fromPartial(object.quota); + } + if (object.authentication !== undefined && object.authentication !== null) { + message.authentication = Authentication.fromPartial(object.authentication); + } + if (object.context !== undefined && object.context !== null) { + message.context = Context.fromPartial(object.context); + } + if (object.usage !== undefined && object.usage !== null) { + message.usage = Usage.fromPartial(object.usage); + } message.endpoints = object.endpoints?.map(e => Endpoint.fromPartial(e)) || []; - message.control = object.control !== undefined && object.control !== null ? Control.fromPartial(object.control) : undefined; + if (object.control !== undefined && object.control !== null) { + message.control = Control.fromPartial(object.control); + } message.logs = object.logs?.map(e => LogDescriptor.fromPartial(e)) || []; message.metrics = object.metrics?.map(e => MetricDescriptor.fromPartial(e)) || []; message.monitoredResources = object.monitoredResources?.map(e => MonitoredResourceDescriptor.fromPartial(e)) || []; - message.billing = object.billing !== undefined && object.billing !== null ? Billing.fromPartial(object.billing) : undefined; - message.logging = object.logging !== undefined && object.logging !== null ? Logging.fromPartial(object.logging) : undefined; - message.monitoring = object.monitoring !== undefined && object.monitoring !== null ? Monitoring.fromPartial(object.monitoring) : undefined; - message.systemParameters = object.systemParameters !== undefined && object.systemParameters !== null ? SystemParameters.fromPartial(object.systemParameters) : undefined; - message.sourceInfo = object.sourceInfo !== undefined && object.sourceInfo !== null ? SourceInfo.fromPartial(object.sourceInfo) : undefined; - message.configVersion = object.configVersion !== undefined && object.configVersion !== null ? UInt32Value.fromPartial(object.configVersion) : undefined; + if (object.billing !== undefined && object.billing !== null) { + message.billing = Billing.fromPartial(object.billing); + } + if (object.logging !== undefined && object.logging !== null) { + message.logging = Logging.fromPartial(object.logging); + } + if (object.monitoring !== undefined && object.monitoring !== null) { + message.monitoring = Monitoring.fromPartial(object.monitoring); + } + if (object.systemParameters !== undefined && object.systemParameters !== null) { + message.systemParameters = SystemParameters.fromPartial(object.systemParameters); + } + if (object.sourceInfo !== undefined && object.sourceInfo !== null) { + message.sourceInfo = SourceInfo.fromPartial(object.sourceInfo); + } + if (object.configVersion !== undefined && object.configVersion !== null) { + message.configVersion = UInt32Value.fromPartial(object.configVersion); + } return message; }, fromSDK(object: ServiceSDKType): Service { 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 34f9fdfb5d..cb644474a6 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,8 +1,7 @@ -import { Status, StatusSDKType } from "../../../rpc/status"; -import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial } from "../../../../helpers"; -import { JsonSafe } from "../../../../json-safe"; -import { ComputedRef } from "vue"; +import { Status, StatusSDKType } from "../../../rpc/status.js"; +import { BinaryReader, BinaryWriter } from "../../../../binary.js"; +import { isSet, DeepPartial } from "../../../../helpers.js"; +import { JsonSafe } from "../../../../json-safe.js"; export const protobufPackage = "google.api.servicecontrol.v1"; /** Error codes for Check responses. */ export enum CheckError_Code { @@ -217,12 +216,6 @@ export interface CheckError { */ status?: Status; } -export interface ReactiveCheckError { - code: ComputedRef; - subject: ComputedRef; - detail: ComputedRef; - status?: ComputedRef; -} export interface CheckErrorProtoMsg { typeUrl: "/google.api.servicecontrol.v1.CheckError"; value: Uint8Array; @@ -251,10 +244,10 @@ export const CheckError = { if (message.code !== 0) { writer.uint32(8).int32(message.code); } - if (message.subject !== "") { + if (message.subject !== undefined) { writer.uint32(34).string(message.subject); } - if (message.detail !== "") { + if (message.detail !== undefined) { writer.uint32(18).string(message.detail); } if (message.status !== undefined) { @@ -289,12 +282,12 @@ export const CheckError = { return message; }, fromJSON(object: any): CheckError { - return { - code: isSet(object.code) ? checkError_CodeFromJSON(object.code) : -1, - subject: isSet(object.subject) ? String(object.subject) : "", - detail: isSet(object.detail) ? String(object.detail) : "", - status: isSet(object.status) ? Status.fromJSON(object.status) : undefined - }; + const obj = createBaseCheckError(); + if (isSet(object.code)) obj.code = checkError_CodeFromJSON(object.code); + if (isSet(object.subject)) obj.subject = String(object.subject); + if (isSet(object.detail)) obj.detail = String(object.detail); + if (isSet(object.status)) obj.status = Status.fromJSON(object.status); + return obj; }, toJSON(message: CheckError): JsonSafe { const obj: any = {}; @@ -309,7 +302,9 @@ export const CheckError = { message.code = object.code ?? 0; message.subject = object.subject ?? ""; message.detail = object.detail ?? ""; - message.status = object.status !== undefined && object.status !== null ? Status.fromPartial(object.status) : undefined; + if (object.status !== undefined && object.status !== null) { + message.status = Status.fromPartial(object.status); + } return message; }, fromSDK(object: CheckErrorSDKType): CheckError { 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 ec696f599b..5e64cd199a 100644 --- a/__fixtures__/v-next/outputv4/google/api/servicecontrol/v1/distribution.ts +++ b/__fixtures__/v-next/outputv4/google/api/servicecontrol/v1/distribution.ts @@ -1,8 +1,7 @@ -import { Distribution_Exemplar, Distribution_ExemplarSDKType } from "../../distribution"; -import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial } from "../../../../helpers"; -import { JsonSafe } from "../../../../json-safe"; -import { ComputedRef } from "vue"; +import { Distribution_Exemplar, Distribution_ExemplarSDKType } from "../../distribution.js"; +import { BinaryReader, BinaryWriter } from "../../../../binary.js"; +import { isSet, DeepPartial } from "../../../../helpers.js"; +import { JsonSafe } from "../../../../json-safe.js"; export const protobufPackage = "google.api.servicecontrol.v1"; /** * Distribution represents a frequency distribution of double-valued sample @@ -56,18 +55,6 @@ export interface Distribution { /** Example points. Must be in increasing order of `value` field. */ exemplars: Distribution_Exemplar[]; } -export interface ReactiveDistribution { - count: ComputedRef; - mean: ComputedRef; - minimum: ComputedRef; - maximum: ComputedRef; - sumOfSquaredDeviation: ComputedRef; - bucketCounts: ComputedRef; - linearBuckets?: ComputedRef; - exponentialBuckets?: ComputedRef; - explicitBuckets?: ComputedRef; - exemplars: ComputedRef; -} export interface DistributionProtoMsg { typeUrl: "/google.api.servicecontrol.v1.Distribution"; value: Uint8Array; @@ -116,11 +103,6 @@ export interface Distribution_LinearBuckets { */ offset: number; } -export interface ReactiveDistribution_LinearBuckets { - numFiniteBuckets: ComputedRef; - width: ComputedRef; - offset: ComputedRef; -} export interface Distribution_LinearBucketsProtoMsg { typeUrl: "/google.api.servicecontrol.v1.LinearBuckets"; value: Uint8Array; @@ -154,11 +136,6 @@ export interface Distribution_ExponentialBuckets { */ scale: number; } -export interface ReactiveDistribution_ExponentialBuckets { - numFiniteBuckets: ComputedRef; - growthFactor: ComputedRef; - scale: ComputedRef; -} export interface Distribution_ExponentialBucketsProtoMsg { typeUrl: "/google.api.servicecontrol.v1.ExponentialBuckets"; value: Uint8Array; @@ -190,9 +167,6 @@ export interface Distribution_ExplicitBuckets { */ bounds: number[]; } -export interface ReactiveDistribution_ExplicitBuckets { - bounds: ComputedRef; -} export interface Distribution_ExplicitBucketsProtoMsg { typeUrl: "/google.api.servicecontrol.v1.ExplicitBuckets"; value: Uint8Array; @@ -218,19 +192,19 @@ function createBaseDistribution(): Distribution { export const Distribution = { typeUrl: "/google.api.servicecontrol.v1.Distribution", encode(message: Distribution, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.count !== BigInt(0)) { + if (message.count !== undefined) { writer.uint32(8).int64(message.count); } - if (message.mean !== 0) { + if (message.mean !== undefined) { writer.uint32(17).double(message.mean); } - if (message.minimum !== 0) { + if (message.minimum !== undefined) { writer.uint32(25).double(message.minimum); } - if (message.maximum !== 0) { + if (message.maximum !== undefined) { writer.uint32(33).double(message.maximum); } - if (message.sumOfSquaredDeviation !== 0) { + if (message.sumOfSquaredDeviation !== undefined) { writer.uint32(41).double(message.sumOfSquaredDeviation); } writer.uint32(50).fork(); @@ -304,18 +278,18 @@ export const Distribution = { return message; }, fromJSON(object: any): Distribution { - return { - count: isSet(object.count) ? BigInt(object.count.toString()) : BigInt(0), - mean: isSet(object.mean) ? Number(object.mean) : 0, - minimum: isSet(object.minimum) ? Number(object.minimum) : 0, - maximum: isSet(object.maximum) ? Number(object.maximum) : 0, - sumOfSquaredDeviation: isSet(object.sumOfSquaredDeviation) ? Number(object.sumOfSquaredDeviation) : 0, - bucketCounts: Array.isArray(object?.bucketCounts) ? object.bucketCounts.map((e: any) => BigInt(e.toString())) : [], - linearBuckets: isSet(object.linearBuckets) ? Distribution_LinearBuckets.fromJSON(object.linearBuckets) : undefined, - exponentialBuckets: isSet(object.exponentialBuckets) ? Distribution_ExponentialBuckets.fromJSON(object.exponentialBuckets) : undefined, - explicitBuckets: isSet(object.explicitBuckets) ? Distribution_ExplicitBuckets.fromJSON(object.explicitBuckets) : undefined, - exemplars: Array.isArray(object?.exemplars) ? object.exemplars.map((e: any) => Distribution_Exemplar.fromJSON(e)) : [] - }; + const obj = createBaseDistribution(); + if (isSet(object.count)) obj.count = BigInt(object.count.toString()); + if (isSet(object.mean)) obj.mean = Number(object.mean); + if (isSet(object.minimum)) obj.minimum = Number(object.minimum); + if (isSet(object.maximum)) obj.maximum = Number(object.maximum); + if (isSet(object.sumOfSquaredDeviation)) obj.sumOfSquaredDeviation = Number(object.sumOfSquaredDeviation); + if (Array.isArray(object?.bucketCounts)) obj.bucketCounts = object.bucketCounts.map((e: any) => BigInt(e.toString())); + if (isSet(object.linearBuckets)) obj.linearBuckets = Distribution_LinearBuckets.fromJSON(object.linearBuckets); + if (isSet(object.exponentialBuckets)) obj.exponentialBuckets = Distribution_ExponentialBuckets.fromJSON(object.exponentialBuckets); + if (isSet(object.explicitBuckets)) obj.explicitBuckets = Distribution_ExplicitBuckets.fromJSON(object.explicitBuckets); + if (Array.isArray(object?.exemplars)) obj.exemplars = object.exemplars.map((e: any) => Distribution_Exemplar.fromJSON(e)); + return obj; }, toJSON(message: Distribution): JsonSafe { const obj: any = {}; @@ -341,15 +315,23 @@ export const Distribution = { }, fromPartial(object: DeepPartial): Distribution { const message = createBaseDistribution(); - message.count = object.count !== undefined && object.count !== null ? BigInt(object.count.toString()) : BigInt(0); + if (object.count !== undefined && object.count !== null) { + message.count = BigInt(object.count.toString()); + } message.mean = object.mean ?? 0; message.minimum = object.minimum ?? 0; message.maximum = object.maximum ?? 0; message.sumOfSquaredDeviation = object.sumOfSquaredDeviation ?? 0; message.bucketCounts = object.bucketCounts?.map(e => BigInt(e.toString())) || []; - message.linearBuckets = object.linearBuckets !== undefined && object.linearBuckets !== null ? Distribution_LinearBuckets.fromPartial(object.linearBuckets) : undefined; - message.exponentialBuckets = object.exponentialBuckets !== undefined && object.exponentialBuckets !== null ? Distribution_ExponentialBuckets.fromPartial(object.exponentialBuckets) : undefined; - message.explicitBuckets = object.explicitBuckets !== undefined && object.explicitBuckets !== null ? Distribution_ExplicitBuckets.fromPartial(object.explicitBuckets) : undefined; + if (object.linearBuckets !== undefined && object.linearBuckets !== null) { + message.linearBuckets = Distribution_LinearBuckets.fromPartial(object.linearBuckets); + } + if (object.exponentialBuckets !== undefined && object.exponentialBuckets !== null) { + message.exponentialBuckets = Distribution_ExponentialBuckets.fromPartial(object.exponentialBuckets); + } + if (object.explicitBuckets !== undefined && object.explicitBuckets !== null) { + message.explicitBuckets = Distribution_ExplicitBuckets.fromPartial(object.explicitBuckets); + } message.exemplars = object.exemplars?.map(e => Distribution_Exemplar.fromPartial(e)) || []; return message; }, @@ -481,13 +463,13 @@ function createBaseDistribution_LinearBuckets(): Distribution_LinearBuckets { export const Distribution_LinearBuckets = { typeUrl: "/google.api.servicecontrol.v1.LinearBuckets", encode(message: Distribution_LinearBuckets, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.numFiniteBuckets !== 0) { + if (message.numFiniteBuckets !== undefined) { writer.uint32(8).int32(message.numFiniteBuckets); } - if (message.width !== 0) { + if (message.width !== undefined) { writer.uint32(17).double(message.width); } - if (message.offset !== 0) { + if (message.offset !== undefined) { writer.uint32(25).double(message.offset); } return writer; @@ -516,11 +498,11 @@ export const Distribution_LinearBuckets = { return message; }, fromJSON(object: any): Distribution_LinearBuckets { - return { - numFiniteBuckets: isSet(object.numFiniteBuckets) ? Number(object.numFiniteBuckets) : 0, - width: isSet(object.width) ? Number(object.width) : 0, - offset: isSet(object.offset) ? Number(object.offset) : 0 - }; + const obj = createBaseDistribution_LinearBuckets(); + if (isSet(object.numFiniteBuckets)) obj.numFiniteBuckets = Number(object.numFiniteBuckets); + if (isSet(object.width)) obj.width = Number(object.width); + if (isSet(object.offset)) obj.offset = Number(object.offset); + return obj; }, toJSON(message: Distribution_LinearBuckets): JsonSafe { const obj: any = {}; @@ -603,13 +585,13 @@ function createBaseDistribution_ExponentialBuckets(): Distribution_ExponentialBu export const Distribution_ExponentialBuckets = { typeUrl: "/google.api.servicecontrol.v1.ExponentialBuckets", encode(message: Distribution_ExponentialBuckets, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.numFiniteBuckets !== 0) { + if (message.numFiniteBuckets !== undefined) { writer.uint32(8).int32(message.numFiniteBuckets); } - if (message.growthFactor !== 0) { + if (message.growthFactor !== undefined) { writer.uint32(17).double(message.growthFactor); } - if (message.scale !== 0) { + if (message.scale !== undefined) { writer.uint32(25).double(message.scale); } return writer; @@ -638,11 +620,11 @@ export const Distribution_ExponentialBuckets = { return message; }, fromJSON(object: any): Distribution_ExponentialBuckets { - return { - numFiniteBuckets: isSet(object.numFiniteBuckets) ? Number(object.numFiniteBuckets) : 0, - growthFactor: isSet(object.growthFactor) ? Number(object.growthFactor) : 0, - scale: isSet(object.scale) ? Number(object.scale) : 0 - }; + const obj = createBaseDistribution_ExponentialBuckets(); + if (isSet(object.numFiniteBuckets)) obj.numFiniteBuckets = Number(object.numFiniteBuckets); + if (isSet(object.growthFactor)) obj.growthFactor = Number(object.growthFactor); + if (isSet(object.scale)) obj.scale = Number(object.scale); + return obj; }, toJSON(message: Distribution_ExponentialBuckets): JsonSafe { const obj: any = {}; @@ -755,9 +737,9 @@ export const Distribution_ExplicitBuckets = { return message; }, fromJSON(object: any): Distribution_ExplicitBuckets { - return { - bounds: Array.isArray(object?.bounds) ? object.bounds.map((e: any) => Number(e)) : [] - }; + const obj = createBaseDistribution_ExplicitBuckets(); + if (Array.isArray(object?.bounds)) obj.bounds = object.bounds.map((e: any) => Number(e)); + return obj; }, toJSON(message: Distribution_ExplicitBuckets): JsonSafe { const obj: any = {}; 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 c2a6e5612e..2c54f6b0db 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,8 +1,7 @@ -import { Duration, DurationSDKType } from "../../../protobuf/duration"; -import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial } from "../../../../helpers"; -import { JsonSafe } from "../../../../json-safe"; -import { ComputedRef } from "vue"; +import { Duration, DurationSDKType } from "../../../protobuf/duration.js"; +import { BinaryReader, BinaryWriter } from "../../../../binary.js"; +import { isSet, DeepPartial } from "../../../../helpers.js"; +import { JsonSafe } from "../../../../json-safe.js"; export const protobufPackage = "google.api.servicecontrol.v1"; /** * A common proto for logging HTTP requests. Only contains semantics @@ -81,23 +80,6 @@ export interface HttpRequest { /** Protocol used for the request. Examples: "HTTP/1.1", "HTTP/2", "websocket" */ protocol: string; } -export interface ReactiveHttpRequest { - requestMethod: ComputedRef; - requestUrl: ComputedRef; - requestSize: ComputedRef; - status: ComputedRef; - responseSize: ComputedRef; - userAgent: ComputedRef; - remoteIp: ComputedRef; - serverIp: ComputedRef; - referer: ComputedRef; - latency?: ComputedRef; - cacheLookup: ComputedRef; - cacheHit: ComputedRef; - cacheValidatedWithOriginServer: ComputedRef; - cacheFillBytes: ComputedRef; - protocol: ComputedRef; -} export interface HttpRequestProtoMsg { typeUrl: "/google.api.servicecontrol.v1.HttpRequest"; value: Uint8Array; @@ -146,49 +128,49 @@ function createBaseHttpRequest(): HttpRequest { export const HttpRequest = { typeUrl: "/google.api.servicecontrol.v1.HttpRequest", encode(message: HttpRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.requestMethod !== "") { + if (message.requestMethod !== undefined) { writer.uint32(10).string(message.requestMethod); } - if (message.requestUrl !== "") { + if (message.requestUrl !== undefined) { writer.uint32(18).string(message.requestUrl); } - if (message.requestSize !== BigInt(0)) { + if (message.requestSize !== undefined) { writer.uint32(24).int64(message.requestSize); } - if (message.status !== 0) { + if (message.status !== undefined) { writer.uint32(32).int32(message.status); } - if (message.responseSize !== BigInt(0)) { + if (message.responseSize !== undefined) { writer.uint32(40).int64(message.responseSize); } - if (message.userAgent !== "") { + if (message.userAgent !== undefined) { writer.uint32(50).string(message.userAgent); } - if (message.remoteIp !== "") { + if (message.remoteIp !== undefined) { writer.uint32(58).string(message.remoteIp); } - if (message.serverIp !== "") { + if (message.serverIp !== undefined) { writer.uint32(106).string(message.serverIp); } - if (message.referer !== "") { + if (message.referer !== undefined) { writer.uint32(66).string(message.referer); } if (message.latency !== undefined) { Duration.encode(message.latency, writer.uint32(114).fork()).ldelim(); } - if (message.cacheLookup === true) { + if (message.cacheLookup !== undefined) { writer.uint32(88).bool(message.cacheLookup); } - if (message.cacheHit === true) { + if (message.cacheHit !== undefined) { writer.uint32(72).bool(message.cacheHit); } - if (message.cacheValidatedWithOriginServer === true) { + if (message.cacheValidatedWithOriginServer !== undefined) { writer.uint32(80).bool(message.cacheValidatedWithOriginServer); } - if (message.cacheFillBytes !== BigInt(0)) { + if (message.cacheFillBytes !== undefined) { writer.uint32(96).int64(message.cacheFillBytes); } - if (message.protocol !== "") { + if (message.protocol !== undefined) { writer.uint32(122).string(message.protocol); } return writer; @@ -253,23 +235,23 @@ export const HttpRequest = { return message; }, fromJSON(object: any): HttpRequest { - return { - requestMethod: isSet(object.requestMethod) ? String(object.requestMethod) : "", - requestUrl: isSet(object.requestUrl) ? String(object.requestUrl) : "", - requestSize: isSet(object.requestSize) ? BigInt(object.requestSize.toString()) : BigInt(0), - status: isSet(object.status) ? Number(object.status) : 0, - responseSize: isSet(object.responseSize) ? BigInt(object.responseSize.toString()) : BigInt(0), - userAgent: isSet(object.userAgent) ? String(object.userAgent) : "", - remoteIp: isSet(object.remoteIp) ? String(object.remoteIp) : "", - serverIp: isSet(object.serverIp) ? String(object.serverIp) : "", - referer: isSet(object.referer) ? String(object.referer) : "", - latency: isSet(object.latency) ? Duration.fromJSON(object.latency) : undefined, - cacheLookup: isSet(object.cacheLookup) ? Boolean(object.cacheLookup) : false, - cacheHit: isSet(object.cacheHit) ? Boolean(object.cacheHit) : false, - cacheValidatedWithOriginServer: isSet(object.cacheValidatedWithOriginServer) ? Boolean(object.cacheValidatedWithOriginServer) : false, - cacheFillBytes: isSet(object.cacheFillBytes) ? BigInt(object.cacheFillBytes.toString()) : BigInt(0), - protocol: isSet(object.protocol) ? String(object.protocol) : "" - }; + const obj = createBaseHttpRequest(); + if (isSet(object.requestMethod)) obj.requestMethod = String(object.requestMethod); + if (isSet(object.requestUrl)) obj.requestUrl = String(object.requestUrl); + if (isSet(object.requestSize)) obj.requestSize = BigInt(object.requestSize.toString()); + if (isSet(object.status)) obj.status = Number(object.status); + if (isSet(object.responseSize)) obj.responseSize = BigInt(object.responseSize.toString()); + if (isSet(object.userAgent)) obj.userAgent = String(object.userAgent); + if (isSet(object.remoteIp)) obj.remoteIp = String(object.remoteIp); + if (isSet(object.serverIp)) obj.serverIp = String(object.serverIp); + if (isSet(object.referer)) obj.referer = String(object.referer); + if (isSet(object.latency)) obj.latency = Duration.fromJSON(object.latency); + if (isSet(object.cacheLookup)) obj.cacheLookup = Boolean(object.cacheLookup); + if (isSet(object.cacheHit)) obj.cacheHit = Boolean(object.cacheHit); + if (isSet(object.cacheValidatedWithOriginServer)) obj.cacheValidatedWithOriginServer = Boolean(object.cacheValidatedWithOriginServer); + if (isSet(object.cacheFillBytes)) obj.cacheFillBytes = BigInt(object.cacheFillBytes.toString()); + if (isSet(object.protocol)) obj.protocol = String(object.protocol); + return obj; }, toJSON(message: HttpRequest): JsonSafe { const obj: any = {}; @@ -294,18 +276,26 @@ export const HttpRequest = { const message = createBaseHttpRequest(); message.requestMethod = object.requestMethod ?? ""; message.requestUrl = object.requestUrl ?? ""; - message.requestSize = object.requestSize !== undefined && object.requestSize !== null ? BigInt(object.requestSize.toString()) : BigInt(0); + if (object.requestSize !== undefined && object.requestSize !== null) { + message.requestSize = BigInt(object.requestSize.toString()); + } message.status = object.status ?? 0; - message.responseSize = object.responseSize !== undefined && object.responseSize !== null ? BigInt(object.responseSize.toString()) : BigInt(0); + if (object.responseSize !== undefined && object.responseSize !== null) { + message.responseSize = BigInt(object.responseSize.toString()); + } message.userAgent = object.userAgent ?? ""; message.remoteIp = object.remoteIp ?? ""; message.serverIp = object.serverIp ?? ""; message.referer = object.referer ?? ""; - message.latency = object.latency !== undefined && object.latency !== null ? Duration.fromPartial(object.latency) : undefined; + if (object.latency !== undefined && object.latency !== null) { + message.latency = Duration.fromPartial(object.latency); + } message.cacheLookup = object.cacheLookup ?? false; message.cacheHit = object.cacheHit ?? false; message.cacheValidatedWithOriginServer = object.cacheValidatedWithOriginServer ?? false; - message.cacheFillBytes = object.cacheFillBytes !== undefined && object.cacheFillBytes !== null ? BigInt(object.cacheFillBytes.toString()) : BigInt(0); + if (object.cacheFillBytes !== undefined && object.cacheFillBytes !== null) { + message.cacheFillBytes = BigInt(object.cacheFillBytes.toString()); + } message.protocol = object.protocol ?? ""; return message; }, 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 e2eb0527c5..8dfc555571 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 @@ -1,21 +1,16 @@ -import { Timestamp, TimestampSDKType } from "../../../protobuf/timestamp"; -import { LogSeverity, LogSeveritySDKType, logSeverityFromJSON, logSeverityToJSON } from "../../../logging/type/log_severity"; -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 { JsonSafe } from "../../../../json-safe"; -import { ComputedRef } from "vue"; +import { Timestamp, TimestampSDKType } from "../../../protobuf/timestamp.js"; +import { LogSeverity, LogSeveritySDKType, logSeverityFromJSON, logSeverityToJSON } from "../../../logging/type/log_severity.js"; +import { HttpRequest, HttpRequestSDKType } from "./http_request.js"; +import { Any, AnySDKType } from "../../../protobuf/any.js"; +import { Struct, StructSDKType } from "../../../protobuf/struct.js"; +import { BinaryReader, BinaryWriter } from "../../../../binary.js"; +import { isSet, DeepPartial, toTimestamp, fromTimestamp, isObject } from "../../../../helpers.js"; +import { JsonSafe } from "../../../../json-safe.js"; export const protobufPackage = "google.api.servicecontrol.v1"; export interface LogEntry_LabelsEntry { key: string; value: string; } -export interface ReactiveLogEntry_LabelsEntry { - key: ComputedRef; - value: ComputedRef; -} export interface LogEntry_LabelsEntryProtoMsg { typeUrl: string; value: Uint8Array; @@ -89,22 +84,6 @@ export interface LogEntry { */ sourceLocation?: LogEntrySourceLocation; } -export interface ReactiveLogEntry { - name: ComputedRef; - timestamp?: ComputedRef; - severity: ComputedRef; - httpRequest?: ComputedRef; - trace: ComputedRef; - insertId: ComputedRef; - labels: ComputedRef<{ - [key: string]: string; - }>; - protoPayload?: ComputedRef; - textPayload?: ComputedRef; - structPayload?: ComputedRef; - operation?: ComputedRef; - sourceLocation?: ComputedRef; -} export interface LogEntryProtoMsg { typeUrl: "/google.api.servicecontrol.v1.LogEntry"; value: Uint8Array; @@ -147,12 +126,6 @@ export interface LogEntryOperation { /** Optional. Set this to True if this is the last log entry in the operation. */ last: boolean; } -export interface ReactiveLogEntryOperation { - id: ComputedRef; - producer: ComputedRef; - first: ComputedRef; - last: ComputedRef; -} export interface LogEntryOperationProtoMsg { typeUrl: "/google.api.servicecontrol.v1.LogEntryOperation"; value: Uint8Array; @@ -192,11 +165,6 @@ export interface LogEntrySourceLocation { */ function: string; } -export interface ReactiveLogEntrySourceLocation { - file: ComputedRef; - line: ComputedRef; - function: ComputedRef; -} export interface LogEntrySourceLocationProtoMsg { typeUrl: "/google.api.servicecontrol.v1.LogEntrySourceLocation"; value: Uint8Array; @@ -218,10 +186,10 @@ function createBaseLogEntry_LabelsEntry(): LogEntry_LabelsEntry { } export const LogEntry_LabelsEntry = { encode(message: LogEntry_LabelsEntry, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.key !== "") { + if (message.key !== undefined) { writer.uint32(10).string(message.key); } - if (message.value !== "") { + if (message.value !== undefined) { writer.uint32(18).string(message.value); } return writer; @@ -247,10 +215,10 @@ export const LogEntry_LabelsEntry = { return message; }, fromJSON(object: any): LogEntry_LabelsEntry { - return { - key: isSet(object.key) ? String(object.key) : "", - value: isSet(object.value) ? String(object.value) : "" - }; + const obj = createBaseLogEntry_LabelsEntry(); + if (isSet(object.key)) obj.key = String(object.key); + if (isSet(object.value)) obj.value = String(object.value); + return obj; }, toJSON(message: LogEntry_LabelsEntry): JsonSafe { const obj: any = {}; @@ -327,7 +295,7 @@ function createBaseLogEntry(): LogEntry { export const LogEntry = { typeUrl: "/google.api.servicecontrol.v1.LogEntry", encode(message: LogEntry, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.name !== "") { + if (message.name !== undefined) { writer.uint32(82).string(message.name); } if (message.timestamp !== undefined) { @@ -339,10 +307,10 @@ export const LogEntry = { if (message.httpRequest !== undefined) { HttpRequest.encode(message.httpRequest, writer.uint32(114).fork()).ldelim(); } - if (message.trace !== "") { + if (message.trace !== undefined) { writer.uint32(122).string(message.trace); } - if (message.insertId !== "") { + if (message.insertId !== undefined) { writer.uint32(34).string(message.insertId); } Object.entries(message.labels).forEach(([key, value]) => { @@ -422,25 +390,25 @@ export const LogEntry = { return message; }, fromJSON(object: any): LogEntry { - return { - name: isSet(object.name) ? String(object.name) : "", - timestamp: isSet(object.timestamp) ? new Date(object.timestamp) : undefined, - severity: isSet(object.severity) ? logSeverityFromJSON(object.severity) : -1, - httpRequest: isSet(object.httpRequest) ? HttpRequest.fromJSON(object.httpRequest) : undefined, - trace: isSet(object.trace) ? String(object.trace) : "", - insertId: isSet(object.insertId) ? String(object.insertId) : "", - labels: isObject(object.labels) ? Object.entries(object.labels).reduce<{ - [key: string]: string; - }>((acc, [key, value]) => { - acc[key] = String(value); - return acc; - }, {}) : {}, - protoPayload: isSet(object.protoPayload) ? Any.fromJSON(object.protoPayload) : undefined, - textPayload: isSet(object.textPayload) ? String(object.textPayload) : undefined, - structPayload: isSet(object.structPayload) ? Struct.fromJSON(object.structPayload) : undefined, - operation: isSet(object.operation) ? LogEntryOperation.fromJSON(object.operation) : undefined, - sourceLocation: isSet(object.sourceLocation) ? LogEntrySourceLocation.fromJSON(object.sourceLocation) : undefined - }; + const obj = createBaseLogEntry(); + if (isSet(object.name)) obj.name = String(object.name); + if (isSet(object.timestamp)) obj.timestamp = new Date(object.timestamp); + if (isSet(object.severity)) obj.severity = logSeverityFromJSON(object.severity); + if (isSet(object.httpRequest)) obj.httpRequest = HttpRequest.fromJSON(object.httpRequest); + if (isSet(object.trace)) obj.trace = String(object.trace); + if (isSet(object.insertId)) obj.insertId = String(object.insertId); + if (isObject(object.labels)) obj.labels = Object.entries(object.labels).reduce<{ + [key: string]: string; + }>((acc, [key, value]) => { + acc[key] = String(value); + return acc; + }, {}); + if (isSet(object.protoPayload)) obj.protoPayload = Any.fromJSON(object.protoPayload); + if (isSet(object.textPayload)) obj.textPayload = String(object.textPayload); + if (isSet(object.structPayload)) obj.structPayload = Struct.fromJSON(object.structPayload); + if (isSet(object.operation)) obj.operation = LogEntryOperation.fromJSON(object.operation); + if (isSet(object.sourceLocation)) obj.sourceLocation = LogEntrySourceLocation.fromJSON(object.sourceLocation); + return obj; }, toJSON(message: LogEntry): JsonSafe { const obj: any = {}; @@ -468,7 +436,9 @@ export const LogEntry = { message.name = object.name ?? ""; message.timestamp = object.timestamp ?? undefined; message.severity = object.severity ?? 0; - message.httpRequest = object.httpRequest !== undefined && object.httpRequest !== null ? HttpRequest.fromPartial(object.httpRequest) : undefined; + if (object.httpRequest !== undefined && object.httpRequest !== null) { + message.httpRequest = HttpRequest.fromPartial(object.httpRequest); + } message.trace = object.trace ?? ""; message.insertId = object.insertId ?? ""; message.labels = Object.entries(object.labels ?? {}).reduce<{ @@ -479,11 +449,19 @@ export const LogEntry = { } return acc; }, {}); - message.protoPayload = object.protoPayload !== undefined && object.protoPayload !== null ? Any.fromPartial(object.protoPayload) : undefined; + if (object.protoPayload !== undefined && object.protoPayload !== null) { + message.protoPayload = Any.fromPartial(object.protoPayload); + } message.textPayload = object.textPayload ?? undefined; - message.structPayload = object.structPayload !== undefined && object.structPayload !== null ? Struct.fromPartial(object.structPayload) : undefined; - message.operation = object.operation !== undefined && object.operation !== null ? LogEntryOperation.fromPartial(object.operation) : undefined; - message.sourceLocation = object.sourceLocation !== undefined && object.sourceLocation !== null ? LogEntrySourceLocation.fromPartial(object.sourceLocation) : undefined; + if (object.structPayload !== undefined && object.structPayload !== null) { + message.structPayload = Struct.fromPartial(object.structPayload); + } + if (object.operation !== undefined && object.operation !== null) { + message.operation = LogEntryOperation.fromPartial(object.operation); + } + if (object.sourceLocation !== undefined && object.sourceLocation !== null) { + message.sourceLocation = LogEntrySourceLocation.fromPartial(object.sourceLocation); + } return message; }, fromSDK(object: LogEntrySDKType): LogEntry { @@ -642,16 +620,16 @@ function createBaseLogEntryOperation(): LogEntryOperation { export const LogEntryOperation = { typeUrl: "/google.api.servicecontrol.v1.LogEntryOperation", encode(message: LogEntryOperation, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.id !== "") { + if (message.id !== undefined) { writer.uint32(10).string(message.id); } - if (message.producer !== "") { + if (message.producer !== undefined) { writer.uint32(18).string(message.producer); } - if (message.first === true) { + if (message.first !== undefined) { writer.uint32(24).bool(message.first); } - if (message.last === true) { + if (message.last !== undefined) { writer.uint32(32).bool(message.last); } return writer; @@ -683,12 +661,12 @@ export const LogEntryOperation = { return message; }, fromJSON(object: any): LogEntryOperation { - return { - id: isSet(object.id) ? String(object.id) : "", - producer: isSet(object.producer) ? String(object.producer) : "", - first: isSet(object.first) ? Boolean(object.first) : false, - last: isSet(object.last) ? Boolean(object.last) : false - }; + const obj = createBaseLogEntryOperation(); + if (isSet(object.id)) obj.id = String(object.id); + if (isSet(object.producer)) obj.producer = String(object.producer); + if (isSet(object.first)) obj.first = Boolean(object.first); + if (isSet(object.last)) obj.last = Boolean(object.last); + return obj; }, toJSON(message: LogEntryOperation): JsonSafe { const obj: any = {}; @@ -780,13 +758,13 @@ function createBaseLogEntrySourceLocation(): LogEntrySourceLocation { export const LogEntrySourceLocation = { typeUrl: "/google.api.servicecontrol.v1.LogEntrySourceLocation", encode(message: LogEntrySourceLocation, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.file !== "") { + if (message.file !== undefined) { writer.uint32(10).string(message.file); } - if (message.line !== BigInt(0)) { + if (message.line !== undefined) { writer.uint32(16).int64(message.line); } - if (message.function !== "") { + if (message.function !== undefined) { writer.uint32(26).string(message.function); } return writer; @@ -815,11 +793,11 @@ export const LogEntrySourceLocation = { return message; }, fromJSON(object: any): LogEntrySourceLocation { - return { - file: isSet(object.file) ? String(object.file) : "", - line: isSet(object.line) ? BigInt(object.line.toString()) : BigInt(0), - function: isSet(object.function) ? String(object.function) : "" - }; + const obj = createBaseLogEntrySourceLocation(); + if (isSet(object.file)) obj.file = String(object.file); + if (isSet(object.line)) obj.line = BigInt(object.line.toString()); + if (isSet(object.function)) obj.function = String(object.function); + return obj; }, toJSON(message: LogEntrySourceLocation): JsonSafe { const obj: any = {}; @@ -831,7 +809,9 @@ export const LogEntrySourceLocation = { fromPartial(object: DeepPartial): LogEntrySourceLocation { const message = createBaseLogEntrySourceLocation(); message.file = object.file ?? ""; - message.line = object.line !== undefined && object.line !== null ? BigInt(object.line.toString()) : BigInt(0); + if (object.line !== undefined && object.line !== null) { + message.line = BigInt(object.line.toString()); + } message.function = object.function ?? ""; return message; }, 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 0a12b41491..46230777df 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,18 +1,13 @@ -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 { JsonSafe } from "../../../../json-safe"; -import { ComputedRef } from "vue"; +import { Timestamp, TimestampSDKType } from "../../../protobuf/timestamp.js"; +import { Distribution, DistributionSDKType } from "./distribution.js"; +import { BinaryReader, BinaryWriter } from "../../../../binary.js"; +import { isSet, DeepPartial, toTimestamp, fromTimestamp, isObject } from "../../../../helpers.js"; +import { JsonSafe } from "../../../../json-safe.js"; export const protobufPackage = "google.api.servicecontrol.v1"; export interface MetricValue_LabelsEntry { key: string; value: string; } -export interface ReactiveMetricValue_LabelsEntry { - key: ComputedRef; - value: ComputedRef; -} export interface MetricValue_LabelsEntryProtoMsg { typeUrl: string; value: Uint8Array; @@ -57,18 +52,6 @@ export interface MetricValue { /** A distribution value. */ distributionValue?: Distribution; } -export interface ReactiveMetricValue { - labels: ComputedRef<{ - [key: string]: string; - }>; - startTime?: ComputedRef; - endTime?: ComputedRef; - boolValue?: ComputedRef; - int64Value?: ComputedRef; - doubleValue?: ComputedRef; - stringValue?: ComputedRef; - distributionValue?: ComputedRef; -} export interface MetricValueProtoMsg { typeUrl: "/google.api.servicecontrol.v1.MetricValue"; value: Uint8Array; @@ -97,10 +80,6 @@ export interface MetricValueSet { /** The values in this metric. */ metricValues: MetricValue[]; } -export interface ReactiveMetricValueSet { - metricName: ComputedRef; - metricValues: ComputedRef; -} export interface MetricValueSetProtoMsg { typeUrl: "/google.api.servicecontrol.v1.MetricValueSet"; value: Uint8Array; @@ -122,10 +101,10 @@ function createBaseMetricValue_LabelsEntry(): MetricValue_LabelsEntry { } export const MetricValue_LabelsEntry = { encode(message: MetricValue_LabelsEntry, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.key !== "") { + if (message.key !== undefined) { writer.uint32(10).string(message.key); } - if (message.value !== "") { + if (message.value !== undefined) { writer.uint32(18).string(message.value); } return writer; @@ -151,10 +130,10 @@ export const MetricValue_LabelsEntry = { return message; }, fromJSON(object: any): MetricValue_LabelsEntry { - return { - key: isSet(object.key) ? String(object.key) : "", - value: isSet(object.value) ? String(object.value) : "" - }; + const obj = createBaseMetricValue_LabelsEntry(); + if (isSet(object.key)) obj.key = String(object.key); + if (isSet(object.value)) obj.value = String(object.value); + return obj; }, toJSON(message: MetricValue_LabelsEntry): JsonSafe { const obj: any = {}; @@ -298,21 +277,21 @@ export const MetricValue = { return message; }, fromJSON(object: any): MetricValue { - return { - labels: isObject(object.labels) ? Object.entries(object.labels).reduce<{ - [key: string]: string; - }>((acc, [key, value]) => { - acc[key] = String(value); - return acc; - }, {}) : {}, - startTime: isSet(object.startTime) ? new Date(object.startTime) : undefined, - endTime: isSet(object.endTime) ? new Date(object.endTime) : undefined, - boolValue: isSet(object.boolValue) ? Boolean(object.boolValue) : undefined, - int64Value: isSet(object.int64Value) ? BigInt(object.int64Value.toString()) : undefined, - doubleValue: isSet(object.doubleValue) ? Number(object.doubleValue) : undefined, - stringValue: isSet(object.stringValue) ? String(object.stringValue) : undefined, - distributionValue: isSet(object.distributionValue) ? Distribution.fromJSON(object.distributionValue) : undefined - }; + const obj = createBaseMetricValue(); + if (isObject(object.labels)) obj.labels = Object.entries(object.labels).reduce<{ + [key: string]: string; + }>((acc, [key, value]) => { + acc[key] = String(value); + return acc; + }, {}); + if (isSet(object.startTime)) obj.startTime = new Date(object.startTime); + if (isSet(object.endTime)) obj.endTime = new Date(object.endTime); + if (isSet(object.boolValue)) obj.boolValue = Boolean(object.boolValue); + if (isSet(object.int64Value)) obj.int64Value = BigInt(object.int64Value.toString()); + if (isSet(object.doubleValue)) obj.doubleValue = Number(object.doubleValue); + if (isSet(object.stringValue)) obj.stringValue = String(object.stringValue); + if (isSet(object.distributionValue)) obj.distributionValue = Distribution.fromJSON(object.distributionValue); + return obj; }, toJSON(message: MetricValue): JsonSafe { const obj: any = {}; @@ -346,10 +325,14 @@ export const MetricValue = { message.startTime = object.startTime ?? undefined; message.endTime = object.endTime ?? undefined; message.boolValue = object.boolValue ?? undefined; - message.int64Value = object.int64Value !== undefined && object.int64Value !== null ? BigInt(object.int64Value.toString()) : undefined; + if (object.int64Value !== undefined && object.int64Value !== null) { + message.int64Value = BigInt(object.int64Value.toString()); + } message.doubleValue = object.doubleValue ?? undefined; message.stringValue = object.stringValue ?? undefined; - message.distributionValue = object.distributionValue !== undefined && object.distributionValue !== null ? Distribution.fromPartial(object.distributionValue) : undefined; + if (object.distributionValue !== undefined && object.distributionValue !== null) { + message.distributionValue = Distribution.fromPartial(object.distributionValue); + } return message; }, fromSDK(object: MetricValueSDKType): MetricValue { @@ -478,7 +461,7 @@ function createBaseMetricValueSet(): MetricValueSet { export const MetricValueSet = { typeUrl: "/google.api.servicecontrol.v1.MetricValueSet", encode(message: MetricValueSet, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.metricName !== "") { + if (message.metricName !== undefined) { writer.uint32(10).string(message.metricName); } for (const v of message.metricValues) { @@ -507,10 +490,10 @@ export const MetricValueSet = { return message; }, fromJSON(object: any): MetricValueSet { - return { - metricName: isSet(object.metricName) ? String(object.metricName) : "", - metricValues: Array.isArray(object?.metricValues) ? object.metricValues.map((e: any) => MetricValue.fromJSON(e)) : [] - }; + const obj = createBaseMetricValueSet(); + if (isSet(object.metricName)) obj.metricName = String(object.metricName); + if (Array.isArray(object?.metricValues)) obj.metricValues = object.metricValues.map((e: any) => MetricValue.fromJSON(e)); + return obj; }, toJSON(message: MetricValueSet): JsonSafe { const obj: any = {}; 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 926ca16f27..717d7008f3 100644 --- a/__fixtures__/v-next/outputv4/google/api/servicecontrol/v1/operation.ts +++ b/__fixtures__/v-next/outputv4/google/api/servicecontrol/v1/operation.ts @@ -1,11 +1,10 @@ -import { Timestamp, TimestampSDKType } from "../../../protobuf/timestamp"; -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 { JsonSafe } from "../../../../json-safe"; -import { ComputedRef } from "vue"; +import { Timestamp, TimestampSDKType } from "../../../protobuf/timestamp.js"; +import { MetricValueSet, MetricValueSetSDKType } from "./metric_value.js"; +import { LogEntry, LogEntrySDKType } from "./log_entry.js"; +import { Any, AnySDKType } from "../../../protobuf/any.js"; +import { BinaryReader, BinaryWriter } from "../../../../binary.js"; +import { isSet, DeepPartial, toTimestamp, fromTimestamp, isObject } from "../../../../helpers.js"; +import { JsonSafe } from "../../../../json-safe.js"; export const protobufPackage = "google.api.servicecontrol.v1"; /** Defines the importance of the data contained in the operation. */ export enum Operation_Importance { @@ -52,10 +51,6 @@ export interface Operation_LabelsEntry { key: string; value: string; } -export interface ReactiveOperation_LabelsEntry { - key: ComputedRef; - value: ComputedRef; -} export interface Operation_LabelsEntryProtoMsg { typeUrl: string; value: Uint8Array; @@ -146,20 +141,6 @@ export interface Operation { /** Unimplemented. */ extensions: Any[]; } -export interface ReactiveOperation { - operationId: ComputedRef; - operationName: ComputedRef; - consumerId: ComputedRef; - startTime?: ComputedRef; - endTime?: ComputedRef; - labels: ComputedRef<{ - [key: string]: string; - }>; - metricValueSets: ComputedRef; - logEntries: ComputedRef; - importance: ComputedRef; - extensions: ComputedRef; -} export interface OperationProtoMsg { typeUrl: "/google.api.servicecontrol.v1.Operation"; value: Uint8Array; @@ -187,10 +168,10 @@ function createBaseOperation_LabelsEntry(): Operation_LabelsEntry { } export const Operation_LabelsEntry = { encode(message: Operation_LabelsEntry, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.key !== "") { + if (message.key !== undefined) { writer.uint32(10).string(message.key); } - if (message.value !== "") { + if (message.value !== undefined) { writer.uint32(18).string(message.value); } return writer; @@ -216,10 +197,10 @@ export const Operation_LabelsEntry = { return message; }, fromJSON(object: any): Operation_LabelsEntry { - return { - key: isSet(object.key) ? String(object.key) : "", - value: isSet(object.value) ? String(object.value) : "" - }; + const obj = createBaseOperation_LabelsEntry(); + if (isSet(object.key)) obj.key = String(object.key); + if (isSet(object.value)) obj.value = String(object.value); + return obj; }, toJSON(message: Operation_LabelsEntry): JsonSafe { const obj: any = {}; @@ -294,13 +275,13 @@ function createBaseOperation(): Operation { export const Operation = { typeUrl: "/google.api.servicecontrol.v1.Operation", encode(message: Operation, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.operationId !== "") { + if (message.operationId !== undefined) { writer.uint32(10).string(message.operationId); } - if (message.operationName !== "") { + if (message.operationName !== undefined) { writer.uint32(18).string(message.operationName); } - if (message.consumerId !== "") { + if (message.consumerId !== undefined) { writer.uint32(26).string(message.consumerId); } if (message.startTime !== undefined) { @@ -377,23 +358,23 @@ export const Operation = { return message; }, fromJSON(object: any): Operation { - return { - operationId: isSet(object.operationId) ? String(object.operationId) : "", - operationName: isSet(object.operationName) ? String(object.operationName) : "", - consumerId: isSet(object.consumerId) ? String(object.consumerId) : "", - startTime: isSet(object.startTime) ? new Date(object.startTime) : undefined, - endTime: isSet(object.endTime) ? new Date(object.endTime) : undefined, - labels: isObject(object.labels) ? Object.entries(object.labels).reduce<{ - [key: string]: string; - }>((acc, [key, value]) => { - acc[key] = String(value); - return acc; - }, {}) : {}, - metricValueSets: Array.isArray(object?.metricValueSets) ? object.metricValueSets.map((e: any) => MetricValueSet.fromJSON(e)) : [], - logEntries: Array.isArray(object?.logEntries) ? object.logEntries.map((e: any) => LogEntry.fromJSON(e)) : [], - importance: isSet(object.importance) ? operation_ImportanceFromJSON(object.importance) : -1, - extensions: Array.isArray(object?.extensions) ? object.extensions.map((e: any) => Any.fromJSON(e)) : [] - }; + const obj = createBaseOperation(); + if (isSet(object.operationId)) obj.operationId = String(object.operationId); + if (isSet(object.operationName)) obj.operationName = String(object.operationName); + if (isSet(object.consumerId)) obj.consumerId = String(object.consumerId); + if (isSet(object.startTime)) obj.startTime = new Date(object.startTime); + if (isSet(object.endTime)) obj.endTime = new Date(object.endTime); + if (isObject(object.labels)) obj.labels = Object.entries(object.labels).reduce<{ + [key: string]: string; + }>((acc, [key, value]) => { + acc[key] = String(value); + return acc; + }, {}); + if (Array.isArray(object?.metricValueSets)) obj.metricValueSets = object.metricValueSets.map((e: any) => MetricValueSet.fromJSON(e)); + if (Array.isArray(object?.logEntries)) obj.logEntries = object.logEntries.map((e: any) => LogEntry.fromJSON(e)); + if (isSet(object.importance)) obj.importance = operation_ImportanceFromJSON(object.importance); + if (Array.isArray(object?.extensions)) obj.extensions = object.extensions.map((e: any) => Any.fromJSON(e)); + return obj; }, toJSON(message: Operation): JsonSafe { const obj: any = {}; 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 166fe7fb9b..70b2364f03 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,9 +1,8 @@ -import { MetricValueSet, MetricValueSetSDKType } from "./metric_value"; -import { Status, StatusSDKType } from "../../../rpc/status"; -import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial, isObject } from "../../../../helpers"; -import { JsonSafe } from "../../../../json-safe"; -import { ComputedRef } from "vue"; +import { MetricValueSet, MetricValueSetSDKType } from "./metric_value.js"; +import { Status, StatusSDKType } from "../../../rpc/status.js"; +import { BinaryReader, BinaryWriter } from "../../../../binary.js"; +import { isSet, DeepPartial, isObject } from "../../../../helpers.js"; +import { JsonSafe } from "../../../../json-safe.js"; export const protobufPackage = "google.api.servicecontrol.v1"; /** Supported quota modes. */ export enum QuotaOperation_QuotaMode { @@ -191,11 +190,6 @@ export interface AllocateQuotaRequest { */ serviceConfigId: string; } -export interface ReactiveAllocateQuotaRequest { - serviceName: ComputedRef; - allocateOperation?: ComputedRef; - serviceConfigId: ComputedRef; -} export interface AllocateQuotaRequestProtoMsg { typeUrl: "/google.api.servicecontrol.v1.AllocateQuotaRequest"; value: Uint8Array; @@ -210,10 +204,6 @@ export interface QuotaOperation_LabelsEntry { key: string; value: string; } -export interface ReactiveQuotaOperation_LabelsEntry { - key: ComputedRef; - value: ComputedRef; -} export interface QuotaOperation_LabelsEntryProtoMsg { typeUrl: string; value: Uint8Array; @@ -281,16 +271,6 @@ export interface QuotaOperation { /** Quota mode for this operation. */ quotaMode: QuotaOperation_QuotaMode; } -export interface ReactiveQuotaOperation { - operationId: ComputedRef; - methodName: ComputedRef; - consumerId: ComputedRef; - labels: ComputedRef<{ - [key: string]: string; - }>; - quotaMetrics: ComputedRef; - quotaMode: ComputedRef; -} export interface QuotaOperationProtoMsg { typeUrl: "/google.api.servicecontrol.v1.QuotaOperation"; value: Uint8Array; @@ -331,12 +311,6 @@ export interface AllocateQuotaResponse { /** ID of the actual config used to process the request. */ serviceConfigId: string; } -export interface ReactiveAllocateQuotaResponse { - operationId: ComputedRef; - allocateErrors: ComputedRef; - quotaMetrics: ComputedRef; - serviceConfigId: ComputedRef; -} export interface AllocateQuotaResponseProtoMsg { typeUrl: "/google.api.servicecontrol.v1.AllocateQuotaResponse"; value: Uint8Array; @@ -366,12 +340,6 @@ export interface QuotaError { */ status?: Status; } -export interface ReactiveQuotaError { - code: ComputedRef; - subject: ComputedRef; - description: ComputedRef; - status?: ComputedRef; -} export interface QuotaErrorProtoMsg { typeUrl: "/google.api.servicecontrol.v1.QuotaError"; value: Uint8Array; @@ -393,13 +361,13 @@ function createBaseAllocateQuotaRequest(): AllocateQuotaRequest { export const AllocateQuotaRequest = { typeUrl: "/google.api.servicecontrol.v1.AllocateQuotaRequest", encode(message: AllocateQuotaRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.serviceName !== "") { + if (message.serviceName !== undefined) { writer.uint32(10).string(message.serviceName); } if (message.allocateOperation !== undefined) { QuotaOperation.encode(message.allocateOperation, writer.uint32(18).fork()).ldelim(); } - if (message.serviceConfigId !== "") { + if (message.serviceConfigId !== undefined) { writer.uint32(34).string(message.serviceConfigId); } return writer; @@ -428,11 +396,11 @@ export const AllocateQuotaRequest = { return message; }, fromJSON(object: any): AllocateQuotaRequest { - return { - serviceName: isSet(object.serviceName) ? String(object.serviceName) : "", - allocateOperation: isSet(object.allocateOperation) ? QuotaOperation.fromJSON(object.allocateOperation) : undefined, - serviceConfigId: isSet(object.serviceConfigId) ? String(object.serviceConfigId) : "" - }; + const obj = createBaseAllocateQuotaRequest(); + if (isSet(object.serviceName)) obj.serviceName = String(object.serviceName); + if (isSet(object.allocateOperation)) obj.allocateOperation = QuotaOperation.fromJSON(object.allocateOperation); + if (isSet(object.serviceConfigId)) obj.serviceConfigId = String(object.serviceConfigId); + return obj; }, toJSON(message: AllocateQuotaRequest): JsonSafe { const obj: any = {}; @@ -444,7 +412,9 @@ export const AllocateQuotaRequest = { fromPartial(object: DeepPartial): AllocateQuotaRequest { const message = createBaseAllocateQuotaRequest(); message.serviceName = object.serviceName ?? ""; - message.allocateOperation = object.allocateOperation !== undefined && object.allocateOperation !== null ? QuotaOperation.fromPartial(object.allocateOperation) : undefined; + if (object.allocateOperation !== undefined && object.allocateOperation !== null) { + message.allocateOperation = QuotaOperation.fromPartial(object.allocateOperation); + } message.serviceConfigId = object.serviceConfigId ?? ""; return message; }, @@ -513,10 +483,10 @@ function createBaseQuotaOperation_LabelsEntry(): QuotaOperation_LabelsEntry { } export const QuotaOperation_LabelsEntry = { encode(message: QuotaOperation_LabelsEntry, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.key !== "") { + if (message.key !== undefined) { writer.uint32(10).string(message.key); } - if (message.value !== "") { + if (message.value !== undefined) { writer.uint32(18).string(message.value); } return writer; @@ -542,10 +512,10 @@ export const QuotaOperation_LabelsEntry = { return message; }, fromJSON(object: any): QuotaOperation_LabelsEntry { - return { - key: isSet(object.key) ? String(object.key) : "", - value: isSet(object.value) ? String(object.value) : "" - }; + const obj = createBaseQuotaOperation_LabelsEntry(); + if (isSet(object.key)) obj.key = String(object.key); + if (isSet(object.value)) obj.value = String(object.value); + return obj; }, toJSON(message: QuotaOperation_LabelsEntry): JsonSafe { const obj: any = {}; @@ -616,13 +586,13 @@ function createBaseQuotaOperation(): QuotaOperation { export const QuotaOperation = { typeUrl: "/google.api.servicecontrol.v1.QuotaOperation", encode(message: QuotaOperation, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.operationId !== "") { + if (message.operationId !== undefined) { writer.uint32(10).string(message.operationId); } - if (message.methodName !== "") { + if (message.methodName !== undefined) { writer.uint32(18).string(message.methodName); } - if (message.consumerId !== "") { + if (message.consumerId !== undefined) { writer.uint32(26).string(message.consumerId); } Object.entries(message.labels).forEach(([key, value]) => { @@ -675,19 +645,19 @@ export const QuotaOperation = { return message; }, fromJSON(object: any): QuotaOperation { - return { - operationId: isSet(object.operationId) ? String(object.operationId) : "", - methodName: isSet(object.methodName) ? String(object.methodName) : "", - consumerId: isSet(object.consumerId) ? String(object.consumerId) : "", - labels: isObject(object.labels) ? Object.entries(object.labels).reduce<{ - [key: string]: string; - }>((acc, [key, value]) => { - acc[key] = String(value); - return acc; - }, {}) : {}, - quotaMetrics: Array.isArray(object?.quotaMetrics) ? object.quotaMetrics.map((e: any) => MetricValueSet.fromJSON(e)) : [], - quotaMode: isSet(object.quotaMode) ? quotaOperation_QuotaModeFromJSON(object.quotaMode) : -1 - }; + const obj = createBaseQuotaOperation(); + if (isSet(object.operationId)) obj.operationId = String(object.operationId); + if (isSet(object.methodName)) obj.methodName = String(object.methodName); + if (isSet(object.consumerId)) obj.consumerId = String(object.consumerId); + if (isObject(object.labels)) obj.labels = Object.entries(object.labels).reduce<{ + [key: string]: string; + }>((acc, [key, value]) => { + acc[key] = String(value); + return acc; + }, {}); + if (Array.isArray(object?.quotaMetrics)) obj.quotaMetrics = object.quotaMetrics.map((e: any) => MetricValueSet.fromJSON(e)); + if (isSet(object.quotaMode)) obj.quotaMode = quotaOperation_QuotaModeFromJSON(object.quotaMode); + return obj; }, toJSON(message: QuotaOperation): JsonSafe { const obj: any = {}; @@ -845,7 +815,7 @@ function createBaseAllocateQuotaResponse(): AllocateQuotaResponse { export const AllocateQuotaResponse = { typeUrl: "/google.api.servicecontrol.v1.AllocateQuotaResponse", encode(message: AllocateQuotaResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.operationId !== "") { + if (message.operationId !== undefined) { writer.uint32(10).string(message.operationId); } for (const v of message.allocateErrors) { @@ -854,7 +824,7 @@ export const AllocateQuotaResponse = { for (const v of message.quotaMetrics) { MetricValueSet.encode(v!, writer.uint32(26).fork()).ldelim(); } - if (message.serviceConfigId !== "") { + if (message.serviceConfigId !== undefined) { writer.uint32(34).string(message.serviceConfigId); } return writer; @@ -886,12 +856,12 @@ export const AllocateQuotaResponse = { return message; }, fromJSON(object: any): AllocateQuotaResponse { - return { - operationId: isSet(object.operationId) ? String(object.operationId) : "", - allocateErrors: Array.isArray(object?.allocateErrors) ? object.allocateErrors.map((e: any) => QuotaError.fromJSON(e)) : [], - quotaMetrics: Array.isArray(object?.quotaMetrics) ? object.quotaMetrics.map((e: any) => MetricValueSet.fromJSON(e)) : [], - serviceConfigId: isSet(object.serviceConfigId) ? String(object.serviceConfigId) : "" - }; + const obj = createBaseAllocateQuotaResponse(); + if (isSet(object.operationId)) obj.operationId = String(object.operationId); + if (Array.isArray(object?.allocateErrors)) obj.allocateErrors = object.allocateErrors.map((e: any) => QuotaError.fromJSON(e)); + if (Array.isArray(object?.quotaMetrics)) obj.quotaMetrics = object.quotaMetrics.map((e: any) => MetricValueSet.fromJSON(e)); + if (isSet(object.serviceConfigId)) obj.serviceConfigId = String(object.serviceConfigId); + return obj; }, toJSON(message: AllocateQuotaResponse): JsonSafe { const obj: any = {}; @@ -1007,10 +977,10 @@ export const QuotaError = { if (message.code !== 0) { writer.uint32(8).int32(message.code); } - if (message.subject !== "") { + if (message.subject !== undefined) { writer.uint32(18).string(message.subject); } - if (message.description !== "") { + if (message.description !== undefined) { writer.uint32(26).string(message.description); } if (message.status !== undefined) { @@ -1045,12 +1015,12 @@ export const QuotaError = { return message; }, fromJSON(object: any): QuotaError { - return { - code: isSet(object.code) ? quotaError_CodeFromJSON(object.code) : -1, - subject: isSet(object.subject) ? String(object.subject) : "", - description: isSet(object.description) ? String(object.description) : "", - status: isSet(object.status) ? Status.fromJSON(object.status) : undefined - }; + const obj = createBaseQuotaError(); + if (isSet(object.code)) obj.code = quotaError_CodeFromJSON(object.code); + if (isSet(object.subject)) obj.subject = String(object.subject); + if (isSet(object.description)) obj.description = String(object.description); + if (isSet(object.status)) obj.status = Status.fromJSON(object.status); + return obj; }, toJSON(message: QuotaError): JsonSafe { const obj: any = {}; @@ -1065,7 +1035,9 @@ export const QuotaError = { message.code = object.code ?? 0; message.subject = object.subject ?? ""; message.description = object.description ?? ""; - message.status = object.status !== undefined && object.status !== null ? Status.fromPartial(object.status) : undefined; + if (object.status !== undefined && object.status !== null) { + message.status = Status.fromPartial(object.status); + } return message; }, fromSDK(object: QuotaErrorSDKType): QuotaError { 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 18038cd91f..8acacf66a6 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 @@ -1,10 +1,9 @@ -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 { JsonSafe } from "../../../../json-safe"; -import { ComputedRef } from "vue"; +import { Operation, OperationSDKType } from "./operation.js"; +import { CheckError, CheckErrorSDKType } from "./check_error.js"; +import { Status, StatusSDKType } from "../../../rpc/status.js"; +import { BinaryReader, BinaryWriter } from "../../../../binary.js"; +import { isSet, DeepPartial } from "../../../../helpers.js"; +import { JsonSafe } from "../../../../json-safe.js"; export const protobufPackage = "google.api.servicecontrol.v1"; /** * The type of the consumer as defined in @@ -90,11 +89,6 @@ export interface CheckRequest { */ serviceConfigId: string; } -export interface ReactiveCheckRequest { - serviceName: ComputedRef; - operation?: ComputedRef; - serviceConfigId: ComputedRef; -} export interface CheckRequestProtoMsg { typeUrl: "/google.api.servicecontrol.v1.CheckRequest"; value: Uint8Array; @@ -128,13 +122,6 @@ export interface CheckResponse { /** Feedback data returned from the server during processing a Check request. */ checkInfo?: CheckResponse_CheckInfo; } -export interface ReactiveCheckResponse { - operationId: ComputedRef; - checkErrors: ComputedRef; - serviceConfigId: ComputedRef; - serviceRolloutId: ComputedRef; - checkInfo?: ComputedRef; -} export interface CheckResponseProtoMsg { typeUrl: "/google.api.servicecontrol.v1.CheckResponse"; value: Uint8Array; @@ -158,10 +145,6 @@ export interface CheckResponse_CheckInfo { /** Consumer info of this check. */ consumerInfo?: CheckResponse_ConsumerInfo; } -export interface ReactiveCheckResponse_CheckInfo { - unusedArguments: ComputedRef; - consumerInfo?: ComputedRef; -} export interface CheckResponse_CheckInfoProtoMsg { typeUrl: "/google.api.servicecontrol.v1.CheckInfo"; value: Uint8Array; @@ -193,11 +176,6 @@ export interface CheckResponse_ConsumerInfo { */ consumerNumber: bigint; } -export interface ReactiveCheckResponse_ConsumerInfo { - projectNumber: ComputedRef; - type: ComputedRef; - consumerNumber: ComputedRef; -} export interface CheckResponse_ConsumerInfoProtoMsg { typeUrl: "/google.api.servicecontrol.v1.ConsumerInfo"; value: Uint8Array; @@ -242,11 +220,6 @@ export interface ReportRequest { */ serviceConfigId: string; } -export interface ReactiveReportRequest { - serviceName: ComputedRef; - operations: ComputedRef; - serviceConfigId: ComputedRef; -} export interface ReportRequestProtoMsg { typeUrl: "/google.api.servicecontrol.v1.ReportRequest"; value: Uint8Array; @@ -281,11 +254,6 @@ export interface ReportResponse { /** The current service rollout id used to process the request. */ serviceRolloutId: string; } -export interface ReactiveReportResponse { - reportErrors: ComputedRef; - serviceConfigId: ComputedRef; - serviceRolloutId: ComputedRef; -} export interface ReportResponseProtoMsg { typeUrl: "/google.api.servicecontrol.v1.ReportResponse"; value: Uint8Array; @@ -313,10 +281,6 @@ export interface ReportResponse_ReportError { */ status?: Status; } -export interface ReactiveReportResponse_ReportError { - operationId: ComputedRef; - status?: ComputedRef; -} export interface ReportResponse_ReportErrorProtoMsg { typeUrl: "/google.api.servicecontrol.v1.ReportError"; value: Uint8Array; @@ -339,13 +303,13 @@ function createBaseCheckRequest(): CheckRequest { export const CheckRequest = { typeUrl: "/google.api.servicecontrol.v1.CheckRequest", encode(message: CheckRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.serviceName !== "") { + if (message.serviceName !== undefined) { writer.uint32(10).string(message.serviceName); } if (message.operation !== undefined) { Operation.encode(message.operation, writer.uint32(18).fork()).ldelim(); } - if (message.serviceConfigId !== "") { + if (message.serviceConfigId !== undefined) { writer.uint32(34).string(message.serviceConfigId); } return writer; @@ -374,11 +338,11 @@ export const CheckRequest = { return message; }, fromJSON(object: any): CheckRequest { - return { - serviceName: isSet(object.serviceName) ? String(object.serviceName) : "", - operation: isSet(object.operation) ? Operation.fromJSON(object.operation) : undefined, - serviceConfigId: isSet(object.serviceConfigId) ? String(object.serviceConfigId) : "" - }; + const obj = createBaseCheckRequest(); + if (isSet(object.serviceName)) obj.serviceName = String(object.serviceName); + if (isSet(object.operation)) obj.operation = Operation.fromJSON(object.operation); + if (isSet(object.serviceConfigId)) obj.serviceConfigId = String(object.serviceConfigId); + return obj; }, toJSON(message: CheckRequest): JsonSafe { const obj: any = {}; @@ -390,7 +354,9 @@ export const CheckRequest = { fromPartial(object: DeepPartial): CheckRequest { const message = createBaseCheckRequest(); message.serviceName = object.serviceName ?? ""; - message.operation = object.operation !== undefined && object.operation !== null ? Operation.fromPartial(object.operation) : undefined; + if (object.operation !== undefined && object.operation !== null) { + message.operation = Operation.fromPartial(object.operation); + } message.serviceConfigId = object.serviceConfigId ?? ""; return message; }, @@ -463,16 +429,16 @@ function createBaseCheckResponse(): CheckResponse { export const CheckResponse = { typeUrl: "/google.api.servicecontrol.v1.CheckResponse", encode(message: CheckResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.operationId !== "") { + if (message.operationId !== undefined) { writer.uint32(10).string(message.operationId); } for (const v of message.checkErrors) { CheckError.encode(v!, writer.uint32(18).fork()).ldelim(); } - if (message.serviceConfigId !== "") { + if (message.serviceConfigId !== undefined) { writer.uint32(42).string(message.serviceConfigId); } - if (message.serviceRolloutId !== "") { + if (message.serviceRolloutId !== undefined) { writer.uint32(90).string(message.serviceRolloutId); } if (message.checkInfo !== undefined) { @@ -510,13 +476,13 @@ export const CheckResponse = { return message; }, fromJSON(object: any): CheckResponse { - return { - operationId: isSet(object.operationId) ? String(object.operationId) : "", - checkErrors: Array.isArray(object?.checkErrors) ? object.checkErrors.map((e: any) => CheckError.fromJSON(e)) : [], - serviceConfigId: isSet(object.serviceConfigId) ? String(object.serviceConfigId) : "", - serviceRolloutId: isSet(object.serviceRolloutId) ? String(object.serviceRolloutId) : "", - checkInfo: isSet(object.checkInfo) ? CheckResponse_CheckInfo.fromJSON(object.checkInfo) : undefined - }; + const obj = createBaseCheckResponse(); + if (isSet(object.operationId)) obj.operationId = String(object.operationId); + if (Array.isArray(object?.checkErrors)) obj.checkErrors = object.checkErrors.map((e: any) => CheckError.fromJSON(e)); + if (isSet(object.serviceConfigId)) obj.serviceConfigId = String(object.serviceConfigId); + if (isSet(object.serviceRolloutId)) obj.serviceRolloutId = String(object.serviceRolloutId); + if (isSet(object.checkInfo)) obj.checkInfo = CheckResponse_CheckInfo.fromJSON(object.checkInfo); + return obj; }, toJSON(message: CheckResponse): JsonSafe { const obj: any = {}; @@ -537,7 +503,9 @@ export const CheckResponse = { message.checkErrors = object.checkErrors?.map(e => CheckError.fromPartial(e)) || []; message.serviceConfigId = object.serviceConfigId ?? ""; message.serviceRolloutId = object.serviceRolloutId ?? ""; - message.checkInfo = object.checkInfo !== undefined && object.checkInfo !== null ? CheckResponse_CheckInfo.fromPartial(object.checkInfo) : undefined; + if (object.checkInfo !== undefined && object.checkInfo !== null) { + message.checkInfo = CheckResponse_CheckInfo.fromPartial(object.checkInfo); + } return message; }, fromSDK(object: CheckResponseSDKType): CheckResponse { @@ -655,10 +623,10 @@ export const CheckResponse_CheckInfo = { return message; }, fromJSON(object: any): CheckResponse_CheckInfo { - return { - unusedArguments: Array.isArray(object?.unusedArguments) ? object.unusedArguments.map((e: any) => String(e)) : [], - consumerInfo: isSet(object.consumerInfo) ? CheckResponse_ConsumerInfo.fromJSON(object.consumerInfo) : undefined - }; + const obj = createBaseCheckResponse_CheckInfo(); + if (Array.isArray(object?.unusedArguments)) obj.unusedArguments = object.unusedArguments.map((e: any) => String(e)); + if (isSet(object.consumerInfo)) obj.consumerInfo = CheckResponse_ConsumerInfo.fromJSON(object.consumerInfo); + return obj; }, toJSON(message: CheckResponse_CheckInfo): JsonSafe { const obj: any = {}; @@ -673,7 +641,9 @@ export const CheckResponse_CheckInfo = { fromPartial(object: DeepPartial): CheckResponse_CheckInfo { const message = createBaseCheckResponse_CheckInfo(); message.unusedArguments = object.unusedArguments?.map(e => e) || []; - message.consumerInfo = object.consumerInfo !== undefined && object.consumerInfo !== null ? CheckResponse_ConsumerInfo.fromPartial(object.consumerInfo) : undefined; + if (object.consumerInfo !== undefined && object.consumerInfo !== null) { + message.consumerInfo = CheckResponse_ConsumerInfo.fromPartial(object.consumerInfo); + } return message; }, fromSDK(object: CheckResponse_CheckInfoSDKType): CheckResponse_CheckInfo { @@ -742,13 +712,13 @@ function createBaseCheckResponse_ConsumerInfo(): CheckResponse_ConsumerInfo { export const CheckResponse_ConsumerInfo = { typeUrl: "/google.api.servicecontrol.v1.ConsumerInfo", encode(message: CheckResponse_ConsumerInfo, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.projectNumber !== BigInt(0)) { + if (message.projectNumber !== undefined) { writer.uint32(8).int64(message.projectNumber); } if (message.type !== 0) { writer.uint32(16).int32(message.type); } - if (message.consumerNumber !== BigInt(0)) { + if (message.consumerNumber !== undefined) { writer.uint32(24).int64(message.consumerNumber); } return writer; @@ -777,11 +747,11 @@ export const CheckResponse_ConsumerInfo = { return message; }, fromJSON(object: any): CheckResponse_ConsumerInfo { - return { - projectNumber: isSet(object.projectNumber) ? BigInt(object.projectNumber.toString()) : BigInt(0), - type: isSet(object.type) ? checkResponse_ConsumerInfo_ConsumerTypeFromJSON(object.type) : -1, - consumerNumber: isSet(object.consumerNumber) ? BigInt(object.consumerNumber.toString()) : BigInt(0) - }; + const obj = createBaseCheckResponse_ConsumerInfo(); + if (isSet(object.projectNumber)) obj.projectNumber = BigInt(object.projectNumber.toString()); + if (isSet(object.type)) obj.type = checkResponse_ConsumerInfo_ConsumerTypeFromJSON(object.type); + if (isSet(object.consumerNumber)) obj.consumerNumber = BigInt(object.consumerNumber.toString()); + return obj; }, toJSON(message: CheckResponse_ConsumerInfo): JsonSafe { const obj: any = {}; @@ -792,9 +762,13 @@ export const CheckResponse_ConsumerInfo = { }, fromPartial(object: DeepPartial): CheckResponse_ConsumerInfo { const message = createBaseCheckResponse_ConsumerInfo(); - message.projectNumber = object.projectNumber !== undefined && object.projectNumber !== null ? BigInt(object.projectNumber.toString()) : BigInt(0); + if (object.projectNumber !== undefined && object.projectNumber !== null) { + message.projectNumber = BigInt(object.projectNumber.toString()); + } message.type = object.type ?? 0; - message.consumerNumber = object.consumerNumber !== undefined && object.consumerNumber !== null ? BigInt(object.consumerNumber.toString()) : BigInt(0); + if (object.consumerNumber !== undefined && object.consumerNumber !== null) { + message.consumerNumber = BigInt(object.consumerNumber.toString()); + } return message; }, fromSDK(object: CheckResponse_ConsumerInfoSDKType): CheckResponse_ConsumerInfo { @@ -864,13 +838,13 @@ function createBaseReportRequest(): ReportRequest { export const ReportRequest = { typeUrl: "/google.api.servicecontrol.v1.ReportRequest", encode(message: ReportRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.serviceName !== "") { + if (message.serviceName !== undefined) { writer.uint32(10).string(message.serviceName); } for (const v of message.operations) { Operation.encode(v!, writer.uint32(18).fork()).ldelim(); } - if (message.serviceConfigId !== "") { + if (message.serviceConfigId !== undefined) { writer.uint32(26).string(message.serviceConfigId); } return writer; @@ -899,11 +873,11 @@ export const ReportRequest = { return message; }, fromJSON(object: any): ReportRequest { - return { - serviceName: isSet(object.serviceName) ? String(object.serviceName) : "", - operations: Array.isArray(object?.operations) ? object.operations.map((e: any) => Operation.fromJSON(e)) : [], - serviceConfigId: isSet(object.serviceConfigId) ? String(object.serviceConfigId) : "" - }; + const obj = createBaseReportRequest(); + if (isSet(object.serviceName)) obj.serviceName = String(object.serviceName); + if (Array.isArray(object?.operations)) obj.operations = object.operations.map((e: any) => Operation.fromJSON(e)); + if (isSet(object.serviceConfigId)) obj.serviceConfigId = String(object.serviceConfigId); + return obj; }, toJSON(message: ReportRequest): JsonSafe { const obj: any = {}; @@ -999,10 +973,10 @@ export const ReportResponse = { for (const v of message.reportErrors) { ReportResponse_ReportError.encode(v!, writer.uint32(10).fork()).ldelim(); } - if (message.serviceConfigId !== "") { + if (message.serviceConfigId !== undefined) { writer.uint32(18).string(message.serviceConfigId); } - if (message.serviceRolloutId !== "") { + if (message.serviceRolloutId !== undefined) { writer.uint32(34).string(message.serviceRolloutId); } return writer; @@ -1031,11 +1005,11 @@ export const ReportResponse = { return message; }, fromJSON(object: any): ReportResponse { - return { - reportErrors: Array.isArray(object?.reportErrors) ? object.reportErrors.map((e: any) => ReportResponse_ReportError.fromJSON(e)) : [], - serviceConfigId: isSet(object.serviceConfigId) ? String(object.serviceConfigId) : "", - serviceRolloutId: isSet(object.serviceRolloutId) ? String(object.serviceRolloutId) : "" - }; + const obj = createBaseReportResponse(); + if (Array.isArray(object?.reportErrors)) obj.reportErrors = object.reportErrors.map((e: any) => ReportResponse_ReportError.fromJSON(e)); + if (isSet(object.serviceConfigId)) obj.serviceConfigId = String(object.serviceConfigId); + if (isSet(object.serviceRolloutId)) obj.serviceRolloutId = String(object.serviceRolloutId); + return obj; }, toJSON(message: ReportResponse): JsonSafe { const obj: any = {}; @@ -1127,7 +1101,7 @@ function createBaseReportResponse_ReportError(): ReportResponse_ReportError { export const ReportResponse_ReportError = { typeUrl: "/google.api.servicecontrol.v1.ReportError", encode(message: ReportResponse_ReportError, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.operationId !== "") { + if (message.operationId !== undefined) { writer.uint32(10).string(message.operationId); } if (message.status !== undefined) { @@ -1156,10 +1130,10 @@ export const ReportResponse_ReportError = { return message; }, fromJSON(object: any): ReportResponse_ReportError { - return { - operationId: isSet(object.operationId) ? String(object.operationId) : "", - status: isSet(object.status) ? Status.fromJSON(object.status) : undefined - }; + const obj = createBaseReportResponse_ReportError(); + if (isSet(object.operationId)) obj.operationId = String(object.operationId); + if (isSet(object.status)) obj.status = Status.fromJSON(object.status); + return obj; }, toJSON(message: ReportResponse_ReportError): JsonSafe { const obj: any = {}; @@ -1170,7 +1144,9 @@ export const ReportResponse_ReportError = { fromPartial(object: DeepPartial): ReportResponse_ReportError { const message = createBaseReportResponse_ReportError(); message.operationId = object.operationId ?? ""; - message.status = object.status !== undefined && object.status !== null ? Status.fromPartial(object.status) : undefined; + if (object.status !== undefined && object.status !== null) { + message.status = Status.fromPartial(object.status); + } return message; }, fromSDK(object: ReportResponse_ReportErrorSDKType): ReportResponse_ReportError { 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 c0c26ef4d3..b629773762 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,9 +1,8 @@ -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 { JsonSafe } from "../../../../json-safe"; -import { ComputedRef } from "vue"; +import { AttributeContext, AttributeContextSDKType } from "../../../rpc/context/attribute_context.js"; +import { Status, StatusSDKType } from "../../../rpc/status.js"; +import { BinaryReader, BinaryWriter } from "../../../../binary.js"; +import { isSet, DeepPartial, isObject } from "../../../../helpers.js"; +import { JsonSafe } from "../../../../json-safe.js"; export const protobufPackage = "google.api.servicecontrol.v2"; /** Request message for the Check method. */ export interface CheckRequest { @@ -29,13 +28,6 @@ export interface CheckRequest { /** Optional. Contains a comma-separated list of flags. */ flags: string; } -export interface ReactiveCheckRequest { - serviceName: ComputedRef; - serviceConfigId: ComputedRef; - attributes?: ComputedRef; - resources: ComputedRef; - flags: ComputedRef; -} export interface CheckRequestProtoMsg { typeUrl: "/google.api.servicecontrol.v2.CheckRequest"; value: Uint8Array; @@ -77,13 +69,6 @@ export interface ResourceInfo { */ location: string; } -export interface ReactiveResourceInfo { - name: ComputedRef; - type: ComputedRef; - permission: ComputedRef; - container: ComputedRef; - location: ComputedRef; -} export interface ResourceInfoProtoMsg { typeUrl: "/google.api.servicecontrol.v2.ResourceInfo"; value: Uint8Array; @@ -100,10 +85,6 @@ export interface CheckResponse_HeadersEntry { key: string; value: string; } -export interface ReactiveCheckResponse_HeadersEntry { - key: ComputedRef; - value: ComputedRef; -} export interface CheckResponse_HeadersEntryProtoMsg { typeUrl: string; value: Uint8Array; @@ -125,12 +106,6 @@ export interface CheckResponse { [key: string]: string; }; } -export interface ReactiveCheckResponse { - status?: ComputedRef; - headers: ComputedRef<{ - [key: string]: string; - }>; -} export interface CheckResponseProtoMsg { typeUrl: "/google.api.servicecontrol.v2.CheckResponse"; value: Uint8Array; @@ -166,11 +141,6 @@ export interface ReportRequest { */ operations: AttributeContext[]; } -export interface ReactiveReportRequest { - serviceName: ComputedRef; - serviceConfigId: ComputedRef; - operations: ComputedRef; -} export interface ReportRequestProtoMsg { typeUrl: "/google.api.servicecontrol.v2.ReportRequest"; value: Uint8Array; @@ -186,7 +156,6 @@ export interface ReportRequestSDKType { * If the request contains any invalid data, the server returns an RPC error. */ export interface ReportResponse {} -export interface ReactiveReportResponse {} export interface ReportResponseProtoMsg { typeUrl: "/google.api.servicecontrol.v2.ReportResponse"; value: Uint8Array; @@ -208,10 +177,10 @@ function createBaseCheckRequest(): CheckRequest { export const CheckRequest = { typeUrl: "/google.api.servicecontrol.v2.CheckRequest", encode(message: CheckRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.serviceName !== "") { + if (message.serviceName !== undefined) { writer.uint32(10).string(message.serviceName); } - if (message.serviceConfigId !== "") { + if (message.serviceConfigId !== undefined) { writer.uint32(18).string(message.serviceConfigId); } if (message.attributes !== undefined) { @@ -220,7 +189,7 @@ export const CheckRequest = { for (const v of message.resources) { ResourceInfo.encode(v!, writer.uint32(34).fork()).ldelim(); } - if (message.flags !== "") { + if (message.flags !== undefined) { writer.uint32(42).string(message.flags); } return writer; @@ -255,13 +224,13 @@ export const CheckRequest = { return message; }, fromJSON(object: any): CheckRequest { - return { - serviceName: isSet(object.serviceName) ? String(object.serviceName) : "", - serviceConfigId: isSet(object.serviceConfigId) ? String(object.serviceConfigId) : "", - attributes: isSet(object.attributes) ? AttributeContext.fromJSON(object.attributes) : undefined, - resources: Array.isArray(object?.resources) ? object.resources.map((e: any) => ResourceInfo.fromJSON(e)) : [], - flags: isSet(object.flags) ? String(object.flags) : "" - }; + const obj = createBaseCheckRequest(); + if (isSet(object.serviceName)) obj.serviceName = String(object.serviceName); + if (isSet(object.serviceConfigId)) obj.serviceConfigId = String(object.serviceConfigId); + if (isSet(object.attributes)) obj.attributes = AttributeContext.fromJSON(object.attributes); + if (Array.isArray(object?.resources)) obj.resources = object.resources.map((e: any) => ResourceInfo.fromJSON(e)); + if (isSet(object.flags)) obj.flags = String(object.flags); + return obj; }, toJSON(message: CheckRequest): JsonSafe { const obj: any = {}; @@ -280,7 +249,9 @@ export const CheckRequest = { const message = createBaseCheckRequest(); message.serviceName = object.serviceName ?? ""; message.serviceConfigId = object.serviceConfigId ?? ""; - message.attributes = object.attributes !== undefined && object.attributes !== null ? AttributeContext.fromPartial(object.attributes) : undefined; + if (object.attributes !== undefined && object.attributes !== null) { + message.attributes = AttributeContext.fromPartial(object.attributes); + } message.resources = object.resources?.map(e => ResourceInfo.fromPartial(e)) || []; message.flags = object.flags ?? ""; return message; @@ -374,19 +345,19 @@ function createBaseResourceInfo(): ResourceInfo { export const ResourceInfo = { typeUrl: "/google.api.servicecontrol.v2.ResourceInfo", encode(message: ResourceInfo, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.name !== "") { + if (message.name !== undefined) { writer.uint32(10).string(message.name); } - if (message.type !== "") { + if (message.type !== undefined) { writer.uint32(18).string(message.type); } - if (message.permission !== "") { + if (message.permission !== undefined) { writer.uint32(26).string(message.permission); } - if (message.container !== "") { + if (message.container !== undefined) { writer.uint32(34).string(message.container); } - if (message.location !== "") { + if (message.location !== undefined) { writer.uint32(42).string(message.location); } return writer; @@ -421,13 +392,13 @@ export const ResourceInfo = { return message; }, fromJSON(object: any): ResourceInfo { - return { - name: isSet(object.name) ? String(object.name) : "", - type: isSet(object.type) ? String(object.type) : "", - permission: isSet(object.permission) ? String(object.permission) : "", - container: isSet(object.container) ? String(object.container) : "", - location: isSet(object.location) ? String(object.location) : "" - }; + const obj = createBaseResourceInfo(); + if (isSet(object.name)) obj.name = String(object.name); + if (isSet(object.type)) obj.type = String(object.type); + if (isSet(object.permission)) obj.permission = String(object.permission); + if (isSet(object.container)) obj.container = String(object.container); + if (isSet(object.location)) obj.location = String(object.location); + return obj; }, toJSON(message: ResourceInfo): JsonSafe { const obj: any = {}; @@ -526,10 +497,10 @@ function createBaseCheckResponse_HeadersEntry(): CheckResponse_HeadersEntry { } export const CheckResponse_HeadersEntry = { encode(message: CheckResponse_HeadersEntry, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.key !== "") { + if (message.key !== undefined) { writer.uint32(10).string(message.key); } - if (message.value !== "") { + if (message.value !== undefined) { writer.uint32(18).string(message.value); } return writer; @@ -555,10 +526,10 @@ export const CheckResponse_HeadersEntry = { return message; }, fromJSON(object: any): CheckResponse_HeadersEntry { - return { - key: isSet(object.key) ? String(object.key) : "", - value: isSet(object.value) ? String(object.value) : "" - }; + const obj = createBaseCheckResponse_HeadersEntry(); + if (isSet(object.key)) obj.key = String(object.key); + if (isSet(object.value)) obj.value = String(object.value); + return obj; }, toJSON(message: CheckResponse_HeadersEntry): JsonSafe { const obj: any = {}; @@ -660,15 +631,15 @@ export const CheckResponse = { return message; }, fromJSON(object: any): CheckResponse { - return { - status: isSet(object.status) ? Status.fromJSON(object.status) : undefined, - headers: isObject(object.headers) ? Object.entries(object.headers).reduce<{ - [key: string]: string; - }>((acc, [key, value]) => { - acc[key] = String(value); - return acc; - }, {}) : {} - }; + const obj = createBaseCheckResponse(); + if (isSet(object.status)) obj.status = Status.fromJSON(object.status); + if (isObject(object.headers)) obj.headers = Object.entries(object.headers).reduce<{ + [key: string]: string; + }>((acc, [key, value]) => { + acc[key] = String(value); + return acc; + }, {}); + return obj; }, toJSON(message: CheckResponse): JsonSafe { const obj: any = {}; @@ -683,7 +654,9 @@ export const CheckResponse = { }, fromPartial(object: DeepPartial): CheckResponse { const message = createBaseCheckResponse(); - message.status = object.status !== undefined && object.status !== null ? Status.fromPartial(object.status) : undefined; + if (object.status !== undefined && object.status !== null) { + message.status = Status.fromPartial(object.status); + } message.headers = Object.entries(object.headers ?? {}).reduce<{ [key: string]: string; }>((acc, [key, value]) => { @@ -779,10 +752,10 @@ function createBaseReportRequest(): ReportRequest { export const ReportRequest = { typeUrl: "/google.api.servicecontrol.v2.ReportRequest", encode(message: ReportRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.serviceName !== "") { + if (message.serviceName !== undefined) { writer.uint32(10).string(message.serviceName); } - if (message.serviceConfigId !== "") { + if (message.serviceConfigId !== undefined) { writer.uint32(18).string(message.serviceConfigId); } for (const v of message.operations) { @@ -814,11 +787,11 @@ export const ReportRequest = { return message; }, fromJSON(object: any): ReportRequest { - return { - serviceName: isSet(object.serviceName) ? String(object.serviceName) : "", - serviceConfigId: isSet(object.serviceConfigId) ? String(object.serviceConfigId) : "", - operations: Array.isArray(object?.operations) ? object.operations.map((e: any) => AttributeContext.fromJSON(e)) : [] - }; + const obj = createBaseReportRequest(); + if (isSet(object.serviceName)) obj.serviceName = String(object.serviceName); + if (isSet(object.serviceConfigId)) obj.serviceConfigId = String(object.serviceConfigId); + if (Array.isArray(object?.operations)) obj.operations = object.operations.map((e: any) => AttributeContext.fromJSON(e)); + return obj; }, toJSON(message: ReportRequest): JsonSafe { const obj: any = {}; @@ -924,7 +897,8 @@ export const ReportResponse = { return message; }, fromJSON(_: any): ReportResponse { - return {}; + const obj = createBaseReportResponse(); + return obj; }, toJSON(_: ReportResponse): JsonSafe { const obj: any = {}; 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 2d2f860e15..17594c42ac 100644 --- a/__fixtures__/v-next/outputv4/google/api/servicemanagement/v1/resources.ts +++ b/__fixtures__/v-next/outputv4/google/api/servicemanagement/v1/resources.ts @@ -1,9 +1,8 @@ -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 { JsonSafe } from "../../../../json-safe"; -import { ComputedRef } from "vue"; +import { Timestamp, TimestampSDKType } from "../../../protobuf/timestamp.js"; +import { ConfigChange, ConfigChangeSDKType } from "../../config_change.js"; +import { BinaryReader, BinaryWriter } from "../../../../binary.js"; +import { isSet, DeepPartial, toTimestamp, fromTimestamp, bytesFromBase64, base64FromBytes, isObject } from "../../../../helpers.js"; +import { JsonSafe } from "../../../../json-safe.js"; export const protobufPackage = "google.api.servicemanagement.v1"; /** Code describes the status of the operation (or one of its steps). */ export enum OperationMetadata_Status { @@ -267,10 +266,6 @@ export interface ManagedService { /** ID of the project that produces and owns this service. */ producerProjectId: string; } -export interface ReactiveManagedService { - serviceName: ComputedRef; - producerProjectId: ComputedRef; -} export interface ManagedServiceProtoMsg { typeUrl: "/google.api.servicemanagement.v1.ManagedService"; value: Uint8Array; @@ -297,12 +292,6 @@ export interface OperationMetadata { /** The start time of the operation. */ startTime?: Date; } -export interface ReactiveOperationMetadata { - resourceNames: ComputedRef; - steps: ComputedRef; - progressPercentage: ComputedRef; - startTime?: ComputedRef; -} export interface OperationMetadataProtoMsg { typeUrl: "/google.api.servicemanagement.v1.OperationMetadata"; value: Uint8Array; @@ -321,10 +310,6 @@ export interface OperationMetadata_Step { /** The status code. */ status: OperationMetadata_Status; } -export interface ReactiveOperationMetadata_Step { - description: ComputedRef; - status: ComputedRef; -} export interface OperationMetadata_StepProtoMsg { typeUrl: "/google.api.servicemanagement.v1.Step"; value: Uint8Array; @@ -343,11 +328,6 @@ export interface Diagnostic { /** Message describing the error or warning. */ message: string; } -export interface ReactiveDiagnostic { - location: ComputedRef; - kind: ComputedRef; - message: ComputedRef; -} export interface DiagnosticProtoMsg { typeUrl: "/google.api.servicemanagement.v1.Diagnostic"; value: Uint8Array; @@ -375,10 +355,6 @@ export interface ConfigSource { */ files: ConfigFile[]; } -export interface ReactiveConfigSource { - id: ComputedRef; - files: ComputedRef; -} export interface ConfigSourceProtoMsg { typeUrl: "/google.api.servicemanagement.v1.ConfigSource"; value: Uint8Array; @@ -400,11 +376,6 @@ export interface ConfigFile { /** The type of configuration file this represents. */ fileType: ConfigFile_FileType; } -export interface ReactiveConfigFile { - filePath: ComputedRef; - fileContents: ComputedRef; - fileType: ComputedRef; -} export interface ConfigFileProtoMsg { typeUrl: "/google.api.servicemanagement.v1.ConfigFile"; value: Uint8Array; @@ -423,9 +394,6 @@ export interface ConfigRef { */ name: string; } -export interface ReactiveConfigRef { - name: ComputedRef; -} export interface ConfigRefProtoMsg { typeUrl: "/google.api.servicemanagement.v1.ConfigRef"; value: Uint8Array; @@ -450,9 +418,6 @@ export interface ChangeReport { */ configChanges: ConfigChange[]; } -export interface ReactiveChangeReport { - configChanges: ComputedRef; -} export interface ChangeReportProtoMsg { typeUrl: "/google.api.servicemanagement.v1.ChangeReport"; value: Uint8Array; @@ -506,15 +471,6 @@ export interface Rollout { /** The name of the service associated with this Rollout. */ serviceName: string; } -export interface ReactiveRollout { - rolloutId: ComputedRef; - createTime?: ComputedRef; - createdBy: ComputedRef; - status: ComputedRef; - trafficPercentStrategy?: ComputedRef; - deleteServiceStrategy?: ComputedRef; - serviceName: ComputedRef; -} export interface RolloutProtoMsg { typeUrl: "/google.api.servicemanagement.v1.Rollout"; value: Uint8Array; @@ -537,10 +493,6 @@ export interface Rollout_TrafficPercentStrategy_PercentagesEntry { key: string; value: number; } -export interface ReactiveRollout_TrafficPercentStrategy_PercentagesEntry { - key: ComputedRef; - value: ComputedRef; -} export interface Rollout_TrafficPercentStrategy_PercentagesEntryProtoMsg { typeUrl: string; value: Uint8Array; @@ -591,11 +543,6 @@ export interface Rollout_TrafficPercentStrategy { [key: string]: number; }; } -export interface ReactiveRollout_TrafficPercentStrategy { - percentages: ComputedRef<{ - [key: string]: number; - }>; -} export interface Rollout_TrafficPercentStrategyProtoMsg { typeUrl: "/google.api.servicemanagement.v1.TrafficPercentStrategy"; value: Uint8Array; @@ -642,7 +589,6 @@ export interface Rollout_TrafficPercentStrategySDKType { * used by the system generated rollout to delete a service. */ export interface Rollout_DeleteServiceStrategy {} -export interface ReactiveRollout_DeleteServiceStrategy {} export interface Rollout_DeleteServiceStrategyProtoMsg { typeUrl: "/google.api.servicemanagement.v1.DeleteServiceStrategy"; value: Uint8Array; @@ -661,10 +607,10 @@ function createBaseManagedService(): ManagedService { export const ManagedService = { typeUrl: "/google.api.servicemanagement.v1.ManagedService", encode(message: ManagedService, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.serviceName !== "") { + if (message.serviceName !== undefined) { writer.uint32(18).string(message.serviceName); } - if (message.producerProjectId !== "") { + if (message.producerProjectId !== undefined) { writer.uint32(26).string(message.producerProjectId); } return writer; @@ -690,10 +636,10 @@ export const ManagedService = { return message; }, fromJSON(object: any): ManagedService { - return { - serviceName: isSet(object.serviceName) ? String(object.serviceName) : "", - producerProjectId: isSet(object.producerProjectId) ? String(object.producerProjectId) : "" - }; + const obj = createBaseManagedService(); + if (isSet(object.serviceName)) obj.serviceName = String(object.serviceName); + if (isSet(object.producerProjectId)) obj.producerProjectId = String(object.producerProjectId); + return obj; }, toJSON(message: ManagedService): JsonSafe { const obj: any = {}; @@ -774,7 +720,7 @@ export const OperationMetadata = { for (const v of message.steps) { OperationMetadata_Step.encode(v!, writer.uint32(18).fork()).ldelim(); } - if (message.progressPercentage !== 0) { + if (message.progressPercentage !== undefined) { writer.uint32(24).int32(message.progressPercentage); } if (message.startTime !== undefined) { @@ -809,12 +755,12 @@ export const OperationMetadata = { return message; }, fromJSON(object: any): OperationMetadata { - return { - resourceNames: Array.isArray(object?.resourceNames) ? object.resourceNames.map((e: any) => String(e)) : [], - steps: Array.isArray(object?.steps) ? object.steps.map((e: any) => OperationMetadata_Step.fromJSON(e)) : [], - progressPercentage: isSet(object.progressPercentage) ? Number(object.progressPercentage) : 0, - startTime: isSet(object.startTime) ? new Date(object.startTime) : undefined - }; + const obj = createBaseOperationMetadata(); + if (Array.isArray(object?.resourceNames)) obj.resourceNames = object.resourceNames.map((e: any) => String(e)); + if (Array.isArray(object?.steps)) obj.steps = object.steps.map((e: any) => OperationMetadata_Step.fromJSON(e)); + if (isSet(object.progressPercentage)) obj.progressPercentage = Number(object.progressPercentage); + if (isSet(object.startTime)) obj.startTime = new Date(object.startTime); + return obj; }, toJSON(message: OperationMetadata): JsonSafe { const obj: any = {}; @@ -925,7 +871,7 @@ function createBaseOperationMetadata_Step(): OperationMetadata_Step { export const OperationMetadata_Step = { typeUrl: "/google.api.servicemanagement.v1.Step", encode(message: OperationMetadata_Step, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.description !== "") { + if (message.description !== undefined) { writer.uint32(18).string(message.description); } if (message.status !== 0) { @@ -954,10 +900,10 @@ export const OperationMetadata_Step = { return message; }, fromJSON(object: any): OperationMetadata_Step { - return { - description: isSet(object.description) ? String(object.description) : "", - status: isSet(object.status) ? operationMetadata_StatusFromJSON(object.status) : -1 - }; + const obj = createBaseOperationMetadata_Step(); + if (isSet(object.description)) obj.description = String(object.description); + if (isSet(object.status)) obj.status = operationMetadata_StatusFromJSON(object.status); + return obj; }, toJSON(message: OperationMetadata_Step): JsonSafe { const obj: any = {}; @@ -1031,13 +977,13 @@ function createBaseDiagnostic(): Diagnostic { export const Diagnostic = { typeUrl: "/google.api.servicemanagement.v1.Diagnostic", encode(message: Diagnostic, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.location !== "") { + if (message.location !== undefined) { writer.uint32(10).string(message.location); } if (message.kind !== 0) { writer.uint32(16).int32(message.kind); } - if (message.message !== "") { + if (message.message !== undefined) { writer.uint32(26).string(message.message); } return writer; @@ -1066,11 +1012,11 @@ export const Diagnostic = { return message; }, fromJSON(object: any): Diagnostic { - return { - location: isSet(object.location) ? String(object.location) : "", - kind: isSet(object.kind) ? diagnostic_KindFromJSON(object.kind) : -1, - message: isSet(object.message) ? String(object.message) : "" - }; + const obj = createBaseDiagnostic(); + if (isSet(object.location)) obj.location = String(object.location); + if (isSet(object.kind)) obj.kind = diagnostic_KindFromJSON(object.kind); + if (isSet(object.message)) obj.message = String(object.message); + return obj; }, toJSON(message: Diagnostic): JsonSafe { const obj: any = {}; @@ -1152,7 +1098,7 @@ function createBaseConfigSource(): ConfigSource { export const ConfigSource = { typeUrl: "/google.api.servicemanagement.v1.ConfigSource", encode(message: ConfigSource, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.id !== "") { + if (message.id !== undefined) { writer.uint32(42).string(message.id); } for (const v of message.files) { @@ -1181,10 +1127,10 @@ export const ConfigSource = { return message; }, fromJSON(object: any): ConfigSource { - return { - id: isSet(object.id) ? String(object.id) : "", - files: Array.isArray(object?.files) ? object.files.map((e: any) => ConfigFile.fromJSON(e)) : [] - }; + const obj = createBaseConfigSource(); + if (isSet(object.id)) obj.id = String(object.id); + if (Array.isArray(object?.files)) obj.files = object.files.map((e: any) => ConfigFile.fromJSON(e)); + return obj; }, toJSON(message: ConfigSource): JsonSafe { const obj: any = {}; @@ -1268,7 +1214,7 @@ function createBaseConfigFile(): ConfigFile { export const ConfigFile = { typeUrl: "/google.api.servicemanagement.v1.ConfigFile", encode(message: ConfigFile, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.filePath !== "") { + if (message.filePath !== undefined) { writer.uint32(10).string(message.filePath); } if (message.fileContents.length !== 0) { @@ -1303,11 +1249,11 @@ export const ConfigFile = { return message; }, fromJSON(object: any): ConfigFile { - return { - filePath: isSet(object.filePath) ? String(object.filePath) : "", - fileContents: isSet(object.fileContents) ? bytesFromBase64(object.fileContents) : new Uint8Array(), - fileType: isSet(object.fileType) ? configFile_FileTypeFromJSON(object.fileType) : -1 - }; + const obj = createBaseConfigFile(); + if (isSet(object.filePath)) obj.filePath = String(object.filePath); + if (isSet(object.fileContents)) obj.fileContents = bytesFromBase64(object.fileContents); + if (isSet(object.fileType)) obj.fileType = configFile_FileTypeFromJSON(object.fileType); + return obj; }, toJSON(message: ConfigFile): JsonSafe { const obj: any = {}; @@ -1388,7 +1334,7 @@ function createBaseConfigRef(): ConfigRef { export const ConfigRef = { typeUrl: "/google.api.servicemanagement.v1.ConfigRef", encode(message: ConfigRef, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.name !== "") { + if (message.name !== undefined) { writer.uint32(10).string(message.name); } return writer; @@ -1411,9 +1357,9 @@ export const ConfigRef = { return message; }, fromJSON(object: any): ConfigRef { - return { - name: isSet(object.name) ? String(object.name) : "" - }; + const obj = createBaseConfigRef(); + if (isSet(object.name)) obj.name = String(object.name); + return obj; }, toJSON(message: ConfigRef): JsonSafe { const obj: any = {}; @@ -1499,9 +1445,9 @@ export const ChangeReport = { return message; }, fromJSON(object: any): ChangeReport { - return { - configChanges: Array.isArray(object?.configChanges) ? object.configChanges.map((e: any) => ConfigChange.fromJSON(e)) : [] - }; + const obj = createBaseChangeReport(); + if (Array.isArray(object?.configChanges)) obj.configChanges = object.configChanges.map((e: any) => ConfigChange.fromJSON(e)); + return obj; }, toJSON(message: ChangeReport): JsonSafe { const obj: any = {}; @@ -1580,13 +1526,13 @@ function createBaseRollout(): Rollout { export const Rollout = { typeUrl: "/google.api.servicemanagement.v1.Rollout", encode(message: Rollout, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.rolloutId !== "") { + if (message.rolloutId !== undefined) { writer.uint32(10).string(message.rolloutId); } if (message.createTime !== undefined) { Timestamp.encode(toTimestamp(message.createTime), writer.uint32(18).fork()).ldelim(); } - if (message.createdBy !== "") { + if (message.createdBy !== undefined) { writer.uint32(26).string(message.createdBy); } if (message.status !== 0) { @@ -1598,7 +1544,7 @@ export const Rollout = { if (message.deleteServiceStrategy !== undefined) { Rollout_DeleteServiceStrategy.encode(message.deleteServiceStrategy, writer.uint32(1602).fork()).ldelim(); } - if (message.serviceName !== "") { + if (message.serviceName !== undefined) { writer.uint32(66).string(message.serviceName); } return writer; @@ -1639,15 +1585,15 @@ export const Rollout = { return message; }, fromJSON(object: any): Rollout { - return { - rolloutId: isSet(object.rolloutId) ? String(object.rolloutId) : "", - createTime: isSet(object.createTime) ? new Date(object.createTime) : undefined, - createdBy: isSet(object.createdBy) ? String(object.createdBy) : "", - status: isSet(object.status) ? rollout_RolloutStatusFromJSON(object.status) : -1, - trafficPercentStrategy: isSet(object.trafficPercentStrategy) ? Rollout_TrafficPercentStrategy.fromJSON(object.trafficPercentStrategy) : undefined, - deleteServiceStrategy: isSet(object.deleteServiceStrategy) ? Rollout_DeleteServiceStrategy.fromJSON(object.deleteServiceStrategy) : undefined, - serviceName: isSet(object.serviceName) ? String(object.serviceName) : "" - }; + const obj = createBaseRollout(); + if (isSet(object.rolloutId)) obj.rolloutId = String(object.rolloutId); + if (isSet(object.createTime)) obj.createTime = new Date(object.createTime); + if (isSet(object.createdBy)) obj.createdBy = String(object.createdBy); + if (isSet(object.status)) obj.status = rollout_RolloutStatusFromJSON(object.status); + if (isSet(object.trafficPercentStrategy)) obj.trafficPercentStrategy = Rollout_TrafficPercentStrategy.fromJSON(object.trafficPercentStrategy); + if (isSet(object.deleteServiceStrategy)) obj.deleteServiceStrategy = Rollout_DeleteServiceStrategy.fromJSON(object.deleteServiceStrategy); + if (isSet(object.serviceName)) obj.serviceName = String(object.serviceName); + return obj; }, toJSON(message: Rollout): JsonSafe { const obj: any = {}; @@ -1666,8 +1612,12 @@ export const Rollout = { message.createTime = object.createTime ?? undefined; message.createdBy = object.createdBy ?? ""; message.status = object.status ?? 0; - message.trafficPercentStrategy = object.trafficPercentStrategy !== undefined && object.trafficPercentStrategy !== null ? Rollout_TrafficPercentStrategy.fromPartial(object.trafficPercentStrategy) : undefined; - message.deleteServiceStrategy = object.deleteServiceStrategy !== undefined && object.deleteServiceStrategy !== null ? Rollout_DeleteServiceStrategy.fromPartial(object.deleteServiceStrategy) : undefined; + if (object.trafficPercentStrategy !== undefined && object.trafficPercentStrategy !== null) { + message.trafficPercentStrategy = Rollout_TrafficPercentStrategy.fromPartial(object.trafficPercentStrategy); + } + if (object.deleteServiceStrategy !== undefined && object.deleteServiceStrategy !== null) { + message.deleteServiceStrategy = Rollout_DeleteServiceStrategy.fromPartial(object.deleteServiceStrategy); + } message.serviceName = object.serviceName ?? ""; return message; }, @@ -1764,10 +1714,10 @@ function createBaseRollout_TrafficPercentStrategy_PercentagesEntry(): Rollout_Tr } export const Rollout_TrafficPercentStrategy_PercentagesEntry = { encode(message: Rollout_TrafficPercentStrategy_PercentagesEntry, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.key !== "") { + if (message.key !== undefined) { writer.uint32(10).string(message.key); } - if (message.value !== 0) { + if (message.value !== undefined) { writer.uint32(17).double(message.value); } return writer; @@ -1793,10 +1743,10 @@ export const Rollout_TrafficPercentStrategy_PercentagesEntry = { return message; }, fromJSON(object: any): Rollout_TrafficPercentStrategy_PercentagesEntry { - return { - key: isSet(object.key) ? String(object.key) : "", - value: isSet(object.value) ? Number(object.value) : 0 - }; + const obj = createBaseRollout_TrafficPercentStrategy_PercentagesEntry(); + if (isSet(object.key)) obj.key = String(object.key); + if (isSet(object.value)) obj.value = Number(object.value); + return obj; }, toJSON(message: Rollout_TrafficPercentStrategy_PercentagesEntry): JsonSafe { const obj: any = {}; @@ -1891,14 +1841,14 @@ export const Rollout_TrafficPercentStrategy = { return message; }, fromJSON(object: any): Rollout_TrafficPercentStrategy { - return { - percentages: isObject(object.percentages) ? Object.entries(object.percentages).reduce<{ - [key: string]: double; - }>((acc, [key, value]) => { - acc[key] = double.fromJSON(value); - return acc; - }, {}) : {} - }; + const obj = createBaseRollout_TrafficPercentStrategy(); + if (isObject(object.percentages)) obj.percentages = Object.entries(object.percentages).reduce<{ + [key: string]: double; + }>((acc, [key, value]) => { + acc[key] = double.fromJSON(value); + return acc; + }, {}); + return obj; }, toJSON(message: Rollout_TrafficPercentStrategy): JsonSafe { const obj: any = {}; @@ -2013,7 +1963,8 @@ export const Rollout_DeleteServiceStrategy = { return message; }, fromJSON(_: any): Rollout_DeleteServiceStrategy { - return {}; + const obj = createBaseRollout_DeleteServiceStrategy(); + return obj; }, toJSON(_: Rollout_DeleteServiceStrategy): JsonSafe { const obj: any = {}; 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 eea858905a..357688baca 100644 --- a/__fixtures__/v-next/outputv4/google/api/servicemanagement/v1/servicemanager.ts +++ b/__fixtures__/v-next/outputv4/google/api/servicemanagement/v1/servicemanager.ts @@ -1,10 +1,9 @@ -import { ManagedService, ManagedServiceSDKType, ConfigSource, ConfigSourceSDKType, Rollout, RolloutSDKType, ChangeReport, ChangeReportSDKType, Diagnostic, DiagnosticSDKType } from "./resources"; -import { Service, ServiceSDKType } from "../../service"; -import { Any, AnySDKType } from "../../../protobuf/any"; -import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial } from "../../../../helpers"; -import { JsonSafe } from "../../../../json-safe"; -import { ComputedRef } from "vue"; +import { ManagedService, ManagedServiceSDKType, ConfigSource, ConfigSourceSDKType, Rollout, RolloutSDKType, ChangeReport, ChangeReportSDKType, Diagnostic, DiagnosticSDKType } from "./resources.js"; +import { Service, ServiceSDKType } from "../../service.js"; +import { Any, AnySDKType } from "../../../protobuf/any.js"; +import { BinaryReader, BinaryWriter } from "../../../../binary.js"; +import { isSet, DeepPartial } from "../../../../helpers.js"; +import { JsonSafe } from "../../../../json-safe.js"; export const protobufPackage = "google.api.servicemanagement.v1"; export enum GetServiceConfigRequest_ConfigView { /** BASIC - Server response includes all fields except SourceInfo. */ @@ -68,12 +67,6 @@ export interface ListServicesRequest { /** @deprecated */ consumerId: string; } -export interface ReactiveListServicesRequest { - producerProjectId: ComputedRef; - pageSize: ComputedRef; - pageToken: ComputedRef; - consumerId: ComputedRef; -} export interface ListServicesRequestProtoMsg { typeUrl: "/google.api.servicemanagement.v1.ListServicesRequest"; value: Uint8Array; @@ -93,10 +86,6 @@ export interface ListServicesResponse { /** Token that can be passed to `ListServices` to resume a paginated query. */ nextPageToken: string; } -export interface ReactiveListServicesResponse { - services: ComputedRef; - nextPageToken: ComputedRef; -} export interface ListServicesResponseProtoMsg { typeUrl: "/google.api.servicemanagement.v1.ListServicesResponse"; value: Uint8Array; @@ -114,9 +103,6 @@ export interface GetServiceRequest { */ serviceName: string; } -export interface ReactiveGetServiceRequest { - serviceName: ComputedRef; -} export interface GetServiceRequestProtoMsg { typeUrl: "/google.api.servicemanagement.v1.GetServiceRequest"; value: Uint8Array; @@ -130,9 +116,6 @@ export interface CreateServiceRequest { /** Required. Initial values for the service resource. */ service?: ManagedService; } -export interface ReactiveCreateServiceRequest { - service?: ComputedRef; -} export interface CreateServiceRequestProtoMsg { typeUrl: "/google.api.servicemanagement.v1.CreateServiceRequest"; value: Uint8Array; @@ -149,9 +132,6 @@ export interface DeleteServiceRequest { */ serviceName: string; } -export interface ReactiveDeleteServiceRequest { - serviceName: ComputedRef; -} export interface DeleteServiceRequestProtoMsg { typeUrl: "/google.api.servicemanagement.v1.DeleteServiceRequest"; value: Uint8Array; @@ -168,9 +148,6 @@ export interface UndeleteServiceRequest { */ serviceName: string; } -export interface ReactiveUndeleteServiceRequest { - serviceName: ComputedRef; -} export interface UndeleteServiceRequestProtoMsg { typeUrl: "/google.api.servicemanagement.v1.UndeleteServiceRequest"; value: Uint8Array; @@ -184,9 +161,6 @@ export interface UndeleteServiceResponse { /** Revived service resource. */ service?: ManagedService; } -export interface ReactiveUndeleteServiceResponse { - service?: ComputedRef; -} export interface UndeleteServiceResponseProtoMsg { typeUrl: "/google.api.servicemanagement.v1.UndeleteServiceResponse"; value: Uint8Array; @@ -215,11 +189,6 @@ export interface GetServiceConfigRequest { */ view: GetServiceConfigRequest_ConfigView; } -export interface ReactiveGetServiceConfigRequest { - serviceName: ComputedRef; - configId: ComputedRef; - view: ComputedRef; -} export interface GetServiceConfigRequestProtoMsg { typeUrl: "/google.api.servicemanagement.v1.GetServiceConfigRequest"; value: Uint8Array; @@ -245,11 +214,6 @@ export interface ListServiceConfigsRequest { */ pageSize: number; } -export interface ReactiveListServiceConfigsRequest { - serviceName: ComputedRef; - pageToken: ComputedRef; - pageSize: ComputedRef; -} export interface ListServiceConfigsRequestProtoMsg { typeUrl: "/google.api.servicemanagement.v1.ListServiceConfigsRequest"; value: Uint8Array; @@ -267,10 +231,6 @@ export interface ListServiceConfigsResponse { /** The token of the next page of results. */ nextPageToken: string; } -export interface ReactiveListServiceConfigsResponse { - serviceConfigs: ComputedRef; - nextPageToken: ComputedRef; -} export interface ListServiceConfigsResponseProtoMsg { typeUrl: "/google.api.servicemanagement.v1.ListServiceConfigsResponse"; value: Uint8Array; @@ -290,10 +250,6 @@ export interface CreateServiceConfigRequest { /** Required. The service configuration resource. */ serviceConfig?: Service; } -export interface ReactiveCreateServiceConfigRequest { - serviceName: ComputedRef; - serviceConfig?: ComputedRef; -} export interface CreateServiceConfigRequestProtoMsg { typeUrl: "/google.api.servicemanagement.v1.CreateServiceConfigRequest"; value: Uint8Array; @@ -319,11 +275,6 @@ export interface SubmitConfigSourceRequest { */ validateOnly: boolean; } -export interface ReactiveSubmitConfigSourceRequest { - serviceName: ComputedRef; - configSource?: ComputedRef; - validateOnly: ComputedRef; -} export interface SubmitConfigSourceRequestProtoMsg { typeUrl: "/google.api.servicemanagement.v1.SubmitConfigSourceRequest"; value: Uint8Array; @@ -339,9 +290,6 @@ export interface SubmitConfigSourceResponse { /** The generated service configuration. */ serviceConfig?: Service; } -export interface ReactiveSubmitConfigSourceResponse { - serviceConfig?: ComputedRef; -} export interface SubmitConfigSourceResponseProtoMsg { typeUrl: "/google.api.servicemanagement.v1.SubmitConfigSourceResponse"; value: Uint8Array; @@ -360,10 +308,6 @@ export interface CreateServiceRolloutRequest { /** Required. The rollout resource. The `service_name` field is output only. */ rollout?: Rollout; } -export interface ReactiveCreateServiceRolloutRequest { - serviceName: ComputedRef; - rollout?: ComputedRef; -} export interface CreateServiceRolloutRequestProtoMsg { typeUrl: "/google.api.servicemanagement.v1.CreateServiceRolloutRequest"; value: Uint8Array; @@ -399,12 +343,6 @@ export interface ListServiceRolloutsRequest { */ filter: string; } -export interface ReactiveListServiceRolloutsRequest { - serviceName: ComputedRef; - pageToken: ComputedRef; - pageSize: ComputedRef; - filter: ComputedRef; -} export interface ListServiceRolloutsRequestProtoMsg { typeUrl: "/google.api.servicemanagement.v1.ListServiceRolloutsRequest"; value: Uint8Array; @@ -423,10 +361,6 @@ export interface ListServiceRolloutsResponse { /** The token of the next page of results. */ nextPageToken: string; } -export interface ReactiveListServiceRolloutsResponse { - rollouts: ComputedRef; - nextPageToken: ComputedRef; -} export interface ListServiceRolloutsResponseProtoMsg { typeUrl: "/google.api.servicemanagement.v1.ListServiceRolloutsResponse"; value: Uint8Array; @@ -446,10 +380,6 @@ export interface GetServiceRolloutRequest { /** Required. The id of the rollout resource. */ rolloutId: string; } -export interface ReactiveGetServiceRolloutRequest { - serviceName: ComputedRef; - rolloutId: ComputedRef; -} export interface GetServiceRolloutRequestProtoMsg { typeUrl: "/google.api.servicemanagement.v1.GetServiceRolloutRequest"; value: Uint8Array; @@ -478,10 +408,6 @@ export interface GenerateConfigReportRequest { */ oldConfig?: Any; } -export interface ReactiveGenerateConfigReportRequest { - newConfig?: ComputedRef; - oldConfig?: ComputedRef; -} export interface GenerateConfigReportRequestProtoMsg { typeUrl: "/google.api.servicemanagement.v1.GenerateConfigReportRequest"; value: Uint8Array; @@ -509,12 +435,6 @@ export interface GenerateConfigReportResponse { */ diagnostics: Diagnostic[]; } -export interface ReactiveGenerateConfigReportResponse { - serviceName: ComputedRef; - id: ComputedRef; - changeReports: ComputedRef; - diagnostics: ComputedRef; -} export interface GenerateConfigReportResponseProtoMsg { typeUrl: "/google.api.servicemanagement.v1.GenerateConfigReportResponse"; value: Uint8Array; @@ -537,16 +457,16 @@ function createBaseListServicesRequest(): ListServicesRequest { export const ListServicesRequest = { typeUrl: "/google.api.servicemanagement.v1.ListServicesRequest", encode(message: ListServicesRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.producerProjectId !== "") { + if (message.producerProjectId !== undefined) { writer.uint32(10).string(message.producerProjectId); } - if (message.pageSize !== 0) { + if (message.pageSize !== undefined) { writer.uint32(40).int32(message.pageSize); } - if (message.pageToken !== "") { + if (message.pageToken !== undefined) { writer.uint32(50).string(message.pageToken); } - if (message.consumerId !== "") { + if (message.consumerId !== undefined) { writer.uint32(58).string(message.consumerId); } return writer; @@ -578,12 +498,12 @@ export const ListServicesRequest = { return message; }, fromJSON(object: any): ListServicesRequest { - return { - producerProjectId: isSet(object.producerProjectId) ? String(object.producerProjectId) : "", - pageSize: isSet(object.pageSize) ? Number(object.pageSize) : 0, - pageToken: isSet(object.pageToken) ? String(object.pageToken) : "", - consumerId: isSet(object.consumerId) ? String(object.consumerId) : "" - }; + const obj = createBaseListServicesRequest(); + if (isSet(object.producerProjectId)) obj.producerProjectId = String(object.producerProjectId); + if (isSet(object.pageSize)) obj.pageSize = Number(object.pageSize); + if (isSet(object.pageToken)) obj.pageToken = String(object.pageToken); + if (isSet(object.consumerId)) obj.consumerId = String(object.consumerId); + return obj; }, toJSON(message: ListServicesRequest): JsonSafe { const obj: any = {}; @@ -677,7 +597,7 @@ export const ListServicesResponse = { for (const v of message.services) { ManagedService.encode(v!, writer.uint32(10).fork()).ldelim(); } - if (message.nextPageToken !== "") { + if (message.nextPageToken !== undefined) { writer.uint32(18).string(message.nextPageToken); } return writer; @@ -703,10 +623,10 @@ export const ListServicesResponse = { return message; }, fromJSON(object: any): ListServicesResponse { - return { - services: Array.isArray(object?.services) ? object.services.map((e: any) => ManagedService.fromJSON(e)) : [], - nextPageToken: isSet(object.nextPageToken) ? String(object.nextPageToken) : "" - }; + const obj = createBaseListServicesResponse(); + if (Array.isArray(object?.services)) obj.services = object.services.map((e: any) => ManagedService.fromJSON(e)); + if (isSet(object.nextPageToken)) obj.nextPageToken = String(object.nextPageToken); + return obj; }, toJSON(message: ListServicesResponse): JsonSafe { const obj: any = {}; @@ -788,7 +708,7 @@ function createBaseGetServiceRequest(): GetServiceRequest { export const GetServiceRequest = { typeUrl: "/google.api.servicemanagement.v1.GetServiceRequest", encode(message: GetServiceRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.serviceName !== "") { + if (message.serviceName !== undefined) { writer.uint32(10).string(message.serviceName); } return writer; @@ -811,9 +731,9 @@ export const GetServiceRequest = { return message; }, fromJSON(object: any): GetServiceRequest { - return { - serviceName: isSet(object.serviceName) ? String(object.serviceName) : "" - }; + const obj = createBaseGetServiceRequest(); + if (isSet(object.serviceName)) obj.serviceName = String(object.serviceName); + return obj; }, toJSON(message: GetServiceRequest): JsonSafe { const obj: any = {}; @@ -899,9 +819,9 @@ export const CreateServiceRequest = { return message; }, fromJSON(object: any): CreateServiceRequest { - return { - service: isSet(object.service) ? ManagedService.fromJSON(object.service) : undefined - }; + const obj = createBaseCreateServiceRequest(); + if (isSet(object.service)) obj.service = ManagedService.fromJSON(object.service); + return obj; }, toJSON(message: CreateServiceRequest): JsonSafe { const obj: any = {}; @@ -910,7 +830,9 @@ export const CreateServiceRequest = { }, fromPartial(object: DeepPartial): CreateServiceRequest { const message = createBaseCreateServiceRequest(); - message.service = object.service !== undefined && object.service !== null ? ManagedService.fromPartial(object.service) : undefined; + if (object.service !== undefined && object.service !== null) { + message.service = ManagedService.fromPartial(object.service); + } return message; }, fromSDK(object: CreateServiceRequestSDKType): CreateServiceRequest { @@ -964,7 +886,7 @@ function createBaseDeleteServiceRequest(): DeleteServiceRequest { export const DeleteServiceRequest = { typeUrl: "/google.api.servicemanagement.v1.DeleteServiceRequest", encode(message: DeleteServiceRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.serviceName !== "") { + if (message.serviceName !== undefined) { writer.uint32(10).string(message.serviceName); } return writer; @@ -987,9 +909,9 @@ export const DeleteServiceRequest = { return message; }, fromJSON(object: any): DeleteServiceRequest { - return { - serviceName: isSet(object.serviceName) ? String(object.serviceName) : "" - }; + const obj = createBaseDeleteServiceRequest(); + if (isSet(object.serviceName)) obj.serviceName = String(object.serviceName); + return obj; }, toJSON(message: DeleteServiceRequest): JsonSafe { const obj: any = {}; @@ -1052,7 +974,7 @@ function createBaseUndeleteServiceRequest(): UndeleteServiceRequest { export const UndeleteServiceRequest = { typeUrl: "/google.api.servicemanagement.v1.UndeleteServiceRequest", encode(message: UndeleteServiceRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.serviceName !== "") { + if (message.serviceName !== undefined) { writer.uint32(10).string(message.serviceName); } return writer; @@ -1075,9 +997,9 @@ export const UndeleteServiceRequest = { return message; }, fromJSON(object: any): UndeleteServiceRequest { - return { - serviceName: isSet(object.serviceName) ? String(object.serviceName) : "" - }; + const obj = createBaseUndeleteServiceRequest(); + if (isSet(object.serviceName)) obj.serviceName = String(object.serviceName); + return obj; }, toJSON(message: UndeleteServiceRequest): JsonSafe { const obj: any = {}; @@ -1163,9 +1085,9 @@ export const UndeleteServiceResponse = { return message; }, fromJSON(object: any): UndeleteServiceResponse { - return { - service: isSet(object.service) ? ManagedService.fromJSON(object.service) : undefined - }; + const obj = createBaseUndeleteServiceResponse(); + if (isSet(object.service)) obj.service = ManagedService.fromJSON(object.service); + return obj; }, toJSON(message: UndeleteServiceResponse): JsonSafe { const obj: any = {}; @@ -1174,7 +1096,9 @@ export const UndeleteServiceResponse = { }, fromPartial(object: DeepPartial): UndeleteServiceResponse { const message = createBaseUndeleteServiceResponse(); - message.service = object.service !== undefined && object.service !== null ? ManagedService.fromPartial(object.service) : undefined; + if (object.service !== undefined && object.service !== null) { + message.service = ManagedService.fromPartial(object.service); + } return message; }, fromSDK(object: UndeleteServiceResponseSDKType): UndeleteServiceResponse { @@ -1230,10 +1154,10 @@ function createBaseGetServiceConfigRequest(): GetServiceConfigRequest { export const GetServiceConfigRequest = { typeUrl: "/google.api.servicemanagement.v1.GetServiceConfigRequest", encode(message: GetServiceConfigRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.serviceName !== "") { + if (message.serviceName !== undefined) { writer.uint32(10).string(message.serviceName); } - if (message.configId !== "") { + if (message.configId !== undefined) { writer.uint32(18).string(message.configId); } if (message.view !== 0) { @@ -1265,11 +1189,11 @@ export const GetServiceConfigRequest = { return message; }, fromJSON(object: any): GetServiceConfigRequest { - return { - serviceName: isSet(object.serviceName) ? String(object.serviceName) : "", - configId: isSet(object.configId) ? String(object.configId) : "", - view: isSet(object.view) ? getServiceConfigRequest_ConfigViewFromJSON(object.view) : -1 - }; + const obj = createBaseGetServiceConfigRequest(); + if (isSet(object.serviceName)) obj.serviceName = String(object.serviceName); + if (isSet(object.configId)) obj.configId = String(object.configId); + if (isSet(object.view)) obj.view = getServiceConfigRequest_ConfigViewFromJSON(object.view); + return obj; }, toJSON(message: GetServiceConfigRequest): JsonSafe { const obj: any = {}; @@ -1352,13 +1276,13 @@ function createBaseListServiceConfigsRequest(): ListServiceConfigsRequest { export const ListServiceConfigsRequest = { typeUrl: "/google.api.servicemanagement.v1.ListServiceConfigsRequest", encode(message: ListServiceConfigsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.serviceName !== "") { + if (message.serviceName !== undefined) { writer.uint32(10).string(message.serviceName); } - if (message.pageToken !== "") { + if (message.pageToken !== undefined) { writer.uint32(18).string(message.pageToken); } - if (message.pageSize !== 0) { + if (message.pageSize !== undefined) { writer.uint32(24).int32(message.pageSize); } return writer; @@ -1387,11 +1311,11 @@ export const ListServiceConfigsRequest = { return message; }, fromJSON(object: any): ListServiceConfigsRequest { - return { - serviceName: isSet(object.serviceName) ? String(object.serviceName) : "", - pageToken: isSet(object.pageToken) ? String(object.pageToken) : "", - pageSize: isSet(object.pageSize) ? Number(object.pageSize) : 0 - }; + const obj = createBaseListServiceConfigsRequest(); + if (isSet(object.serviceName)) obj.serviceName = String(object.serviceName); + if (isSet(object.pageToken)) obj.pageToken = String(object.pageToken); + if (isSet(object.pageSize)) obj.pageSize = Number(object.pageSize); + return obj; }, toJSON(message: ListServiceConfigsRequest): JsonSafe { const obj: any = {}; @@ -1476,7 +1400,7 @@ export const ListServiceConfigsResponse = { for (const v of message.serviceConfigs) { Service.encode(v!, writer.uint32(10).fork()).ldelim(); } - if (message.nextPageToken !== "") { + if (message.nextPageToken !== undefined) { writer.uint32(18).string(message.nextPageToken); } return writer; @@ -1502,10 +1426,10 @@ export const ListServiceConfigsResponse = { return message; }, fromJSON(object: any): ListServiceConfigsResponse { - return { - serviceConfigs: Array.isArray(object?.serviceConfigs) ? object.serviceConfigs.map((e: any) => Service.fromJSON(e)) : [], - nextPageToken: isSet(object.nextPageToken) ? String(object.nextPageToken) : "" - }; + const obj = createBaseListServiceConfigsResponse(); + if (Array.isArray(object?.serviceConfigs)) obj.serviceConfigs = object.serviceConfigs.map((e: any) => Service.fromJSON(e)); + if (isSet(object.nextPageToken)) obj.nextPageToken = String(object.nextPageToken); + return obj; }, toJSON(message: ListServiceConfigsResponse): JsonSafe { const obj: any = {}; @@ -1588,7 +1512,7 @@ function createBaseCreateServiceConfigRequest(): CreateServiceConfigRequest { export const CreateServiceConfigRequest = { typeUrl: "/google.api.servicemanagement.v1.CreateServiceConfigRequest", encode(message: CreateServiceConfigRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.serviceName !== "") { + if (message.serviceName !== undefined) { writer.uint32(10).string(message.serviceName); } if (message.serviceConfig !== undefined) { @@ -1617,10 +1541,10 @@ export const CreateServiceConfigRequest = { return message; }, fromJSON(object: any): CreateServiceConfigRequest { - return { - serviceName: isSet(object.serviceName) ? String(object.serviceName) : "", - serviceConfig: isSet(object.serviceConfig) ? Service.fromJSON(object.serviceConfig) : undefined - }; + const obj = createBaseCreateServiceConfigRequest(); + if (isSet(object.serviceName)) obj.serviceName = String(object.serviceName); + if (isSet(object.serviceConfig)) obj.serviceConfig = Service.fromJSON(object.serviceConfig); + return obj; }, toJSON(message: CreateServiceConfigRequest): JsonSafe { const obj: any = {}; @@ -1631,7 +1555,9 @@ export const CreateServiceConfigRequest = { fromPartial(object: DeepPartial): CreateServiceConfigRequest { const message = createBaseCreateServiceConfigRequest(); message.serviceName = object.serviceName ?? ""; - message.serviceConfig = object.serviceConfig !== undefined && object.serviceConfig !== null ? Service.fromPartial(object.serviceConfig) : undefined; + if (object.serviceConfig !== undefined && object.serviceConfig !== null) { + message.serviceConfig = Service.fromPartial(object.serviceConfig); + } return message; }, fromSDK(object: CreateServiceConfigRequestSDKType): CreateServiceConfigRequest { @@ -1694,13 +1620,13 @@ function createBaseSubmitConfigSourceRequest(): SubmitConfigSourceRequest { export const SubmitConfigSourceRequest = { typeUrl: "/google.api.servicemanagement.v1.SubmitConfigSourceRequest", encode(message: SubmitConfigSourceRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.serviceName !== "") { + if (message.serviceName !== undefined) { writer.uint32(10).string(message.serviceName); } if (message.configSource !== undefined) { ConfigSource.encode(message.configSource, writer.uint32(18).fork()).ldelim(); } - if (message.validateOnly === true) { + if (message.validateOnly !== undefined) { writer.uint32(24).bool(message.validateOnly); } return writer; @@ -1729,11 +1655,11 @@ export const SubmitConfigSourceRequest = { return message; }, fromJSON(object: any): SubmitConfigSourceRequest { - return { - serviceName: isSet(object.serviceName) ? String(object.serviceName) : "", - configSource: isSet(object.configSource) ? ConfigSource.fromJSON(object.configSource) : undefined, - validateOnly: isSet(object.validateOnly) ? Boolean(object.validateOnly) : false - }; + const obj = createBaseSubmitConfigSourceRequest(); + if (isSet(object.serviceName)) obj.serviceName = String(object.serviceName); + if (isSet(object.configSource)) obj.configSource = ConfigSource.fromJSON(object.configSource); + if (isSet(object.validateOnly)) obj.validateOnly = Boolean(object.validateOnly); + return obj; }, toJSON(message: SubmitConfigSourceRequest): JsonSafe { const obj: any = {}; @@ -1745,7 +1671,9 @@ export const SubmitConfigSourceRequest = { fromPartial(object: DeepPartial): SubmitConfigSourceRequest { const message = createBaseSubmitConfigSourceRequest(); message.serviceName = object.serviceName ?? ""; - message.configSource = object.configSource !== undefined && object.configSource !== null ? ConfigSource.fromPartial(object.configSource) : undefined; + if (object.configSource !== undefined && object.configSource !== null) { + message.configSource = ConfigSource.fromPartial(object.configSource); + } message.validateOnly = object.validateOnly ?? false; return message; }, @@ -1837,9 +1765,9 @@ export const SubmitConfigSourceResponse = { return message; }, fromJSON(object: any): SubmitConfigSourceResponse { - return { - serviceConfig: isSet(object.serviceConfig) ? Service.fromJSON(object.serviceConfig) : undefined - }; + const obj = createBaseSubmitConfigSourceResponse(); + if (isSet(object.serviceConfig)) obj.serviceConfig = Service.fromJSON(object.serviceConfig); + return obj; }, toJSON(message: SubmitConfigSourceResponse): JsonSafe { const obj: any = {}; @@ -1848,7 +1776,9 @@ export const SubmitConfigSourceResponse = { }, fromPartial(object: DeepPartial): SubmitConfigSourceResponse { const message = createBaseSubmitConfigSourceResponse(); - message.serviceConfig = object.serviceConfig !== undefined && object.serviceConfig !== null ? Service.fromPartial(object.serviceConfig) : undefined; + if (object.serviceConfig !== undefined && object.serviceConfig !== null) { + message.serviceConfig = Service.fromPartial(object.serviceConfig); + } return message; }, fromSDK(object: SubmitConfigSourceResponseSDKType): SubmitConfigSourceResponse { @@ -1903,7 +1833,7 @@ function createBaseCreateServiceRolloutRequest(): CreateServiceRolloutRequest { export const CreateServiceRolloutRequest = { typeUrl: "/google.api.servicemanagement.v1.CreateServiceRolloutRequest", encode(message: CreateServiceRolloutRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.serviceName !== "") { + if (message.serviceName !== undefined) { writer.uint32(10).string(message.serviceName); } if (message.rollout !== undefined) { @@ -1932,10 +1862,10 @@ export const CreateServiceRolloutRequest = { return message; }, fromJSON(object: any): CreateServiceRolloutRequest { - return { - serviceName: isSet(object.serviceName) ? String(object.serviceName) : "", - rollout: isSet(object.rollout) ? Rollout.fromJSON(object.rollout) : undefined - }; + const obj = createBaseCreateServiceRolloutRequest(); + if (isSet(object.serviceName)) obj.serviceName = String(object.serviceName); + if (isSet(object.rollout)) obj.rollout = Rollout.fromJSON(object.rollout); + return obj; }, toJSON(message: CreateServiceRolloutRequest): JsonSafe { const obj: any = {}; @@ -1946,7 +1876,9 @@ export const CreateServiceRolloutRequest = { fromPartial(object: DeepPartial): CreateServiceRolloutRequest { const message = createBaseCreateServiceRolloutRequest(); message.serviceName = object.serviceName ?? ""; - message.rollout = object.rollout !== undefined && object.rollout !== null ? Rollout.fromPartial(object.rollout) : undefined; + if (object.rollout !== undefined && object.rollout !== null) { + message.rollout = Rollout.fromPartial(object.rollout); + } return message; }, fromSDK(object: CreateServiceRolloutRequestSDKType): CreateServiceRolloutRequest { @@ -2010,16 +1942,16 @@ function createBaseListServiceRolloutsRequest(): ListServiceRolloutsRequest { export const ListServiceRolloutsRequest = { typeUrl: "/google.api.servicemanagement.v1.ListServiceRolloutsRequest", encode(message: ListServiceRolloutsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.serviceName !== "") { + if (message.serviceName !== undefined) { writer.uint32(10).string(message.serviceName); } - if (message.pageToken !== "") { + if (message.pageToken !== undefined) { writer.uint32(18).string(message.pageToken); } - if (message.pageSize !== 0) { + if (message.pageSize !== undefined) { writer.uint32(24).int32(message.pageSize); } - if (message.filter !== "") { + if (message.filter !== undefined) { writer.uint32(34).string(message.filter); } return writer; @@ -2051,12 +1983,12 @@ export const ListServiceRolloutsRequest = { return message; }, fromJSON(object: any): ListServiceRolloutsRequest { - return { - serviceName: isSet(object.serviceName) ? String(object.serviceName) : "", - pageToken: isSet(object.pageToken) ? String(object.pageToken) : "", - pageSize: isSet(object.pageSize) ? Number(object.pageSize) : 0, - filter: isSet(object.filter) ? String(object.filter) : "" - }; + const obj = createBaseListServiceRolloutsRequest(); + if (isSet(object.serviceName)) obj.serviceName = String(object.serviceName); + if (isSet(object.pageToken)) obj.pageToken = String(object.pageToken); + if (isSet(object.pageSize)) obj.pageSize = Number(object.pageSize); + if (isSet(object.filter)) obj.filter = String(object.filter); + return obj; }, toJSON(message: ListServiceRolloutsRequest): JsonSafe { const obj: any = {}; @@ -2150,7 +2082,7 @@ export const ListServiceRolloutsResponse = { for (const v of message.rollouts) { Rollout.encode(v!, writer.uint32(10).fork()).ldelim(); } - if (message.nextPageToken !== "") { + if (message.nextPageToken !== undefined) { writer.uint32(18).string(message.nextPageToken); } return writer; @@ -2176,10 +2108,10 @@ export const ListServiceRolloutsResponse = { return message; }, fromJSON(object: any): ListServiceRolloutsResponse { - return { - rollouts: Array.isArray(object?.rollouts) ? object.rollouts.map((e: any) => Rollout.fromJSON(e)) : [], - nextPageToken: isSet(object.nextPageToken) ? String(object.nextPageToken) : "" - }; + const obj = createBaseListServiceRolloutsResponse(); + if (Array.isArray(object?.rollouts)) obj.rollouts = object.rollouts.map((e: any) => Rollout.fromJSON(e)); + if (isSet(object.nextPageToken)) obj.nextPageToken = String(object.nextPageToken); + return obj; }, toJSON(message: ListServiceRolloutsResponse): JsonSafe { const obj: any = {}; @@ -2262,10 +2194,10 @@ function createBaseGetServiceRolloutRequest(): GetServiceRolloutRequest { export const GetServiceRolloutRequest = { typeUrl: "/google.api.servicemanagement.v1.GetServiceRolloutRequest", encode(message: GetServiceRolloutRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.serviceName !== "") { + if (message.serviceName !== undefined) { writer.uint32(10).string(message.serviceName); } - if (message.rolloutId !== "") { + if (message.rolloutId !== undefined) { writer.uint32(18).string(message.rolloutId); } return writer; @@ -2291,10 +2223,10 @@ export const GetServiceRolloutRequest = { return message; }, fromJSON(object: any): GetServiceRolloutRequest { - return { - serviceName: isSet(object.serviceName) ? String(object.serviceName) : "", - rolloutId: isSet(object.rolloutId) ? String(object.rolloutId) : "" - }; + const obj = createBaseGetServiceRolloutRequest(); + if (isSet(object.serviceName)) obj.serviceName = String(object.serviceName); + if (isSet(object.rolloutId)) obj.rolloutId = String(object.rolloutId); + return obj; }, toJSON(message: GetServiceRolloutRequest): JsonSafe { const obj: any = {}; @@ -2396,10 +2328,10 @@ export const GenerateConfigReportRequest = { return message; }, fromJSON(object: any): GenerateConfigReportRequest { - return { - newConfig: isSet(object.newConfig) ? Any.fromJSON(object.newConfig) : undefined, - oldConfig: isSet(object.oldConfig) ? Any.fromJSON(object.oldConfig) : undefined - }; + const obj = createBaseGenerateConfigReportRequest(); + if (isSet(object.newConfig)) obj.newConfig = Any.fromJSON(object.newConfig); + if (isSet(object.oldConfig)) obj.oldConfig = Any.fromJSON(object.oldConfig); + return obj; }, toJSON(message: GenerateConfigReportRequest): JsonSafe { const obj: any = {}; @@ -2409,8 +2341,12 @@ export const GenerateConfigReportRequest = { }, fromPartial(object: DeepPartial): GenerateConfigReportRequest { const message = createBaseGenerateConfigReportRequest(); - message.newConfig = object.newConfig !== undefined && object.newConfig !== null ? Any.fromPartial(object.newConfig) : undefined; - message.oldConfig = object.oldConfig !== undefined && object.oldConfig !== null ? Any.fromPartial(object.oldConfig) : undefined; + if (object.newConfig !== undefined && object.newConfig !== null) { + message.newConfig = Any.fromPartial(object.newConfig); + } + if (object.oldConfig !== undefined && object.oldConfig !== null) { + message.oldConfig = Any.fromPartial(object.oldConfig); + } return message; }, fromSDK(object: GenerateConfigReportRequestSDKType): GenerateConfigReportRequest { @@ -2474,10 +2410,10 @@ function createBaseGenerateConfigReportResponse(): GenerateConfigReportResponse export const GenerateConfigReportResponse = { typeUrl: "/google.api.servicemanagement.v1.GenerateConfigReportResponse", encode(message: GenerateConfigReportResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.serviceName !== "") { + if (message.serviceName !== undefined) { writer.uint32(10).string(message.serviceName); } - if (message.id !== "") { + if (message.id !== undefined) { writer.uint32(18).string(message.id); } for (const v of message.changeReports) { @@ -2515,12 +2451,12 @@ export const GenerateConfigReportResponse = { return message; }, fromJSON(object: any): GenerateConfigReportResponse { - return { - serviceName: isSet(object.serviceName) ? String(object.serviceName) : "", - id: isSet(object.id) ? String(object.id) : "", - changeReports: Array.isArray(object?.changeReports) ? object.changeReports.map((e: any) => ChangeReport.fromJSON(e)) : [], - diagnostics: Array.isArray(object?.diagnostics) ? object.diagnostics.map((e: any) => Diagnostic.fromJSON(e)) : [] - }; + const obj = createBaseGenerateConfigReportResponse(); + if (isSet(object.serviceName)) obj.serviceName = String(object.serviceName); + if (isSet(object.id)) obj.id = String(object.id); + if (Array.isArray(object?.changeReports)) obj.changeReports = object.changeReports.map((e: any) => ChangeReport.fromJSON(e)); + if (Array.isArray(object?.diagnostics)) obj.diagnostics = object.diagnostics.map((e: any) => Diagnostic.fromJSON(e)); + return obj; }, toJSON(message: GenerateConfigReportResponse): JsonSafe { const obj: any = {}; 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 34c3406f09..e6cdfb7531 100644 --- a/__fixtures__/v-next/outputv4/google/api/serviceusage/v1/resources.ts +++ b/__fixtures__/v-next/outputv4/google/api/serviceusage/v1/resources.ts @@ -1,15 +1,14 @@ -import { Api, ApiSDKType } from "../../../protobuf/api"; -import { Documentation, DocumentationSDKType } from "../../documentation"; -import { Quota, QuotaSDKType } from "../../quota"; -import { Authentication, AuthenticationSDKType } from "../../auth"; -import { Usage, UsageSDKType } from "../../usage"; -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 { JsonSafe } from "../../../../json-safe"; -import { ComputedRef } from "vue"; +import { Api, ApiSDKType } from "../../../protobuf/api.js"; +import { Documentation, DocumentationSDKType } from "../../documentation.js"; +import { Quota, QuotaSDKType } from "../../quota.js"; +import { Authentication, AuthenticationSDKType } from "../../auth.js"; +import { Usage, UsageSDKType } from "../../usage.js"; +import { Endpoint, EndpointSDKType } from "../../endpoint.js"; +import { MonitoredResourceDescriptor, MonitoredResourceDescriptorSDKType } from "../../monitored_resource.js"; +import { Monitoring, MonitoringSDKType } from "../../monitoring.js"; +import { BinaryReader, BinaryWriter } from "../../../../binary.js"; +import { isSet, DeepPartial } from "../../../../helpers.js"; +import { JsonSafe } from "../../../../json-safe.js"; export const protobufPackage = "google.api.serviceusage.v1"; /** Whether or not a service has been enabled for use by a consumer. */ export enum State { @@ -85,12 +84,6 @@ export interface Service { /** Whether or not the service has been enabled for use by the consumer. */ state: State; } -export interface ReactiveService { - name: ComputedRef; - parent: ComputedRef; - config?: ComputedRef; - state: ComputedRef; -} export interface ServiceProtoMsg { typeUrl: "/google.api.serviceusage.v1.Service"; value: Uint8Array; @@ -145,18 +138,6 @@ export interface ServiceConfig { */ monitoring?: Monitoring; } -export interface ReactiveServiceConfig { - name: ComputedRef; - title: ComputedRef; - apis: ComputedRef; - documentation?: ComputedRef; - quota?: ComputedRef; - authentication?: ComputedRef; - usage?: ComputedRef; - endpoints: ComputedRef; - monitoredResources: ComputedRef; - monitoring?: ComputedRef; -} export interface ServiceConfigProtoMsg { typeUrl: "/google.api.serviceusage.v1.ServiceConfig"; value: Uint8Array; @@ -182,9 +163,6 @@ export interface OperationMetadata { */ resourceNames: string[]; } -export interface ReactiveOperationMetadata { - resourceNames: ComputedRef; -} export interface OperationMetadataProtoMsg { typeUrl: "/google.api.serviceusage.v1.OperationMetadata"; value: Uint8Array; @@ -204,10 +182,10 @@ function createBaseService(): Service { export const Service = { typeUrl: "/google.api.serviceusage.v1.Service", encode(message: Service, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.name !== "") { + if (message.name !== undefined) { writer.uint32(10).string(message.name); } - if (message.parent !== "") { + if (message.parent !== undefined) { writer.uint32(42).string(message.parent); } if (message.config !== undefined) { @@ -245,12 +223,12 @@ export const Service = { return message; }, fromJSON(object: any): Service { - return { - name: isSet(object.name) ? String(object.name) : "", - parent: isSet(object.parent) ? String(object.parent) : "", - config: isSet(object.config) ? ServiceConfig.fromJSON(object.config) : undefined, - state: isSet(object.state) ? stateFromJSON(object.state) : -1 - }; + const obj = createBaseService(); + if (isSet(object.name)) obj.name = String(object.name); + if (isSet(object.parent)) obj.parent = String(object.parent); + if (isSet(object.config)) obj.config = ServiceConfig.fromJSON(object.config); + if (isSet(object.state)) obj.state = stateFromJSON(object.state); + return obj; }, toJSON(message: Service): JsonSafe { const obj: any = {}; @@ -264,7 +242,9 @@ export const Service = { const message = createBaseService(); message.name = object.name ?? ""; message.parent = object.parent ?? ""; - message.config = object.config !== undefined && object.config !== null ? ServiceConfig.fromPartial(object.config) : undefined; + if (object.config !== undefined && object.config !== null) { + message.config = ServiceConfig.fromPartial(object.config); + } message.state = object.state ?? 0; return message; }, @@ -349,10 +329,10 @@ function createBaseServiceConfig(): ServiceConfig { export const ServiceConfig = { typeUrl: "/google.api.serviceusage.v1.ServiceConfig", encode(message: ServiceConfig, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.name !== "") { + if (message.name !== undefined) { writer.uint32(10).string(message.name); } - if (message.title !== "") { + if (message.title !== undefined) { writer.uint32(18).string(message.title); } for (const v of message.apis) { @@ -426,18 +406,18 @@ export const ServiceConfig = { return message; }, fromJSON(object: any): ServiceConfig { - return { - name: isSet(object.name) ? String(object.name) : "", - title: isSet(object.title) ? String(object.title) : "", - apis: Array.isArray(object?.apis) ? object.apis.map((e: any) => Api.fromJSON(e)) : [], - documentation: isSet(object.documentation) ? Documentation.fromJSON(object.documentation) : undefined, - quota: isSet(object.quota) ? Quota.fromJSON(object.quota) : undefined, - authentication: isSet(object.authentication) ? Authentication.fromJSON(object.authentication) : undefined, - usage: isSet(object.usage) ? Usage.fromJSON(object.usage) : undefined, - endpoints: Array.isArray(object?.endpoints) ? object.endpoints.map((e: any) => Endpoint.fromJSON(e)) : [], - monitoredResources: Array.isArray(object?.monitoredResources) ? object.monitoredResources.map((e: any) => MonitoredResourceDescriptor.fromJSON(e)) : [], - monitoring: isSet(object.monitoring) ? Monitoring.fromJSON(object.monitoring) : undefined - }; + const obj = createBaseServiceConfig(); + if (isSet(object.name)) obj.name = String(object.name); + if (isSet(object.title)) obj.title = String(object.title); + if (Array.isArray(object?.apis)) obj.apis = object.apis.map((e: any) => Api.fromJSON(e)); + if (isSet(object.documentation)) obj.documentation = Documentation.fromJSON(object.documentation); + if (isSet(object.quota)) obj.quota = Quota.fromJSON(object.quota); + if (isSet(object.authentication)) obj.authentication = Authentication.fromJSON(object.authentication); + if (isSet(object.usage)) obj.usage = Usage.fromJSON(object.usage); + if (Array.isArray(object?.endpoints)) obj.endpoints = object.endpoints.map((e: any) => Endpoint.fromJSON(e)); + if (Array.isArray(object?.monitoredResources)) obj.monitoredResources = object.monitoredResources.map((e: any) => MonitoredResourceDescriptor.fromJSON(e)); + if (isSet(object.monitoring)) obj.monitoring = Monitoring.fromJSON(object.monitoring); + return obj; }, toJSON(message: ServiceConfig): JsonSafe { const obj: any = {}; @@ -470,13 +450,23 @@ export const ServiceConfig = { message.name = object.name ?? ""; message.title = object.title ?? ""; message.apis = object.apis?.map(e => Api.fromPartial(e)) || []; - message.documentation = object.documentation !== undefined && object.documentation !== null ? Documentation.fromPartial(object.documentation) : undefined; - message.quota = object.quota !== undefined && object.quota !== null ? Quota.fromPartial(object.quota) : undefined; - message.authentication = object.authentication !== undefined && object.authentication !== null ? Authentication.fromPartial(object.authentication) : undefined; - message.usage = object.usage !== undefined && object.usage !== null ? Usage.fromPartial(object.usage) : undefined; + if (object.documentation !== undefined && object.documentation !== null) { + message.documentation = Documentation.fromPartial(object.documentation); + } + if (object.quota !== undefined && object.quota !== null) { + message.quota = Quota.fromPartial(object.quota); + } + if (object.authentication !== undefined && object.authentication !== null) { + message.authentication = Authentication.fromPartial(object.authentication); + } + if (object.usage !== undefined && object.usage !== null) { + message.usage = Usage.fromPartial(object.usage); + } message.endpoints = object.endpoints?.map(e => Endpoint.fromPartial(e)) || []; message.monitoredResources = object.monitoredResources?.map(e => MonitoredResourceDescriptor.fromPartial(e)) || []; - message.monitoring = object.monitoring !== undefined && object.monitoring !== null ? Monitoring.fromPartial(object.monitoring) : undefined; + if (object.monitoring !== undefined && object.monitoring !== null) { + message.monitoring = Monitoring.fromPartial(object.monitoring); + } return message; }, fromSDK(object: ServiceConfigSDKType): ServiceConfig { @@ -634,9 +624,9 @@ export const OperationMetadata = { return message; }, fromJSON(object: any): OperationMetadata { - return { - resourceNames: Array.isArray(object?.resourceNames) ? object.resourceNames.map((e: any) => String(e)) : [] - }; + const obj = createBaseOperationMetadata(); + if (Array.isArray(object?.resourceNames)) obj.resourceNames = object.resourceNames.map((e: any) => String(e)); + return obj; }, toJSON(message: OperationMetadata): JsonSafe { const obj: any = {}; 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 d44bf39e64..cdc8a3d1da 100644 --- a/__fixtures__/v-next/outputv4/google/api/serviceusage/v1/serviceusage.ts +++ b/__fixtures__/v-next/outputv4/google/api/serviceusage/v1/serviceusage.ts @@ -1,8 +1,7 @@ -import { Service, ServiceSDKType } from "./resources"; -import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial } from "../../../../helpers"; -import { JsonSafe } from "../../../../json-safe"; -import { ComputedRef } from "vue"; +import { Service, ServiceSDKType } from "./resources.js"; +import { BinaryReader, BinaryWriter } from "../../../../binary.js"; +import { isSet, DeepPartial } from "../../../../helpers.js"; +import { JsonSafe } from "../../../../json-safe.js"; export const protobufPackage = "google.api.serviceusage.v1"; /** * Enum to determine if service usage should be checked when disabling a @@ -69,9 +68,6 @@ export interface EnableServiceRequest { */ name: string; } -export interface ReactiveEnableServiceRequest { - name: ComputedRef; -} export interface EnableServiceRequestProtoMsg { typeUrl: "/google.api.serviceusage.v1.EnableServiceRequest"; value: Uint8Array; @@ -89,9 +85,6 @@ export interface EnableServiceResponse { /** The new state of the service after enabling. */ service?: Service; } -export interface ReactiveEnableServiceResponse { - service?: ComputedRef; -} export interface EnableServiceResponseProtoMsg { typeUrl: "/google.api.serviceusage.v1.EnableServiceResponse"; value: Uint8Array; @@ -127,11 +120,6 @@ export interface DisableServiceRequest { /** Defines the behavior for checking service usage when disabling a service. */ checkIfServiceHasUsage: DisableServiceRequest_CheckIfServiceHasUsage; } -export interface ReactiveDisableServiceRequest { - name: ComputedRef; - disableDependentServices: ComputedRef; - checkIfServiceHasUsage: ComputedRef; -} export interface DisableServiceRequestProtoMsg { typeUrl: "/google.api.serviceusage.v1.DisableServiceRequest"; value: Uint8Array; @@ -151,9 +139,6 @@ export interface DisableServiceResponse { /** The new state of the service after disabling. */ service?: Service; } -export interface ReactiveDisableServiceResponse { - service?: ComputedRef; -} export interface DisableServiceResponseProtoMsg { typeUrl: "/google.api.serviceusage.v1.DisableServiceResponse"; value: Uint8Array; @@ -177,9 +162,6 @@ export interface GetServiceRequest { */ name: string; } -export interface ReactiveGetServiceRequest { - name: ComputedRef; -} export interface GetServiceRequestProtoMsg { typeUrl: "/google.api.serviceusage.v1.GetServiceRequest"; value: Uint8Array; @@ -214,12 +196,6 @@ export interface ListServicesRequest { */ filter: string; } -export interface ReactiveListServicesRequest { - parent: ComputedRef; - pageSize: ComputedRef; - pageToken: ComputedRef; - filter: ComputedRef; -} export interface ListServicesRequestProtoMsg { typeUrl: "/google.api.serviceusage.v1.ListServicesRequest"; value: Uint8Array; @@ -241,10 +217,6 @@ export interface ListServicesResponse { */ nextPageToken: string; } -export interface ReactiveListServicesResponse { - services: ComputedRef; - nextPageToken: ComputedRef; -} export interface ListServicesResponseProtoMsg { typeUrl: "/google.api.serviceusage.v1.ListServicesResponse"; value: Uint8Array; @@ -280,10 +252,6 @@ export interface BatchEnableServicesRequest { */ serviceIds: string[]; } -export interface ReactiveBatchEnableServicesRequest { - parent: ComputedRef; - serviceIds: ComputedRef; -} export interface BatchEnableServicesRequestProtoMsg { typeUrl: "/google.api.serviceusage.v1.BatchEnableServicesRequest"; value: Uint8Array; @@ -307,10 +275,6 @@ export interface BatchEnableServicesResponse { */ failures: BatchEnableServicesResponse_EnableFailure[]; } -export interface ReactiveBatchEnableServicesResponse { - services: ComputedRef; - failures: ComputedRef; -} export interface BatchEnableServicesResponseProtoMsg { typeUrl: "/google.api.serviceusage.v1.BatchEnableServicesResponse"; value: Uint8Array; @@ -331,10 +295,6 @@ export interface BatchEnableServicesResponse_EnableFailure { /** An error message describing why the service could not be enabled. */ errorMessage: string; } -export interface ReactiveBatchEnableServicesResponse_EnableFailure { - serviceId: ComputedRef; - errorMessage: ComputedRef; -} export interface BatchEnableServicesResponse_EnableFailureProtoMsg { typeUrl: "/google.api.serviceusage.v1.EnableFailure"; value: Uint8Array; @@ -364,10 +324,6 @@ export interface BatchGetServicesRequest { */ names: string[]; } -export interface ReactiveBatchGetServicesRequest { - parent: ComputedRef; - names: ComputedRef; -} export interface BatchGetServicesRequestProtoMsg { typeUrl: "/google.api.serviceusage.v1.BatchGetServicesRequest"; value: Uint8Array; @@ -382,9 +338,6 @@ export interface BatchGetServicesResponse { /** The requested Service states. */ services: Service[]; } -export interface ReactiveBatchGetServicesResponse { - services: ComputedRef; -} export interface BatchGetServicesResponseProtoMsg { typeUrl: "/google.api.serviceusage.v1.BatchGetServicesResponse"; value: Uint8Array; @@ -401,7 +354,7 @@ function createBaseEnableServiceRequest(): EnableServiceRequest { export const EnableServiceRequest = { typeUrl: "/google.api.serviceusage.v1.EnableServiceRequest", encode(message: EnableServiceRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.name !== "") { + if (message.name !== undefined) { writer.uint32(10).string(message.name); } return writer; @@ -424,9 +377,9 @@ export const EnableServiceRequest = { return message; }, fromJSON(object: any): EnableServiceRequest { - return { - name: isSet(object.name) ? String(object.name) : "" - }; + const obj = createBaseEnableServiceRequest(); + if (isSet(object.name)) obj.name = String(object.name); + return obj; }, toJSON(message: EnableServiceRequest): JsonSafe { const obj: any = {}; @@ -512,9 +465,9 @@ export const EnableServiceResponse = { return message; }, fromJSON(object: any): EnableServiceResponse { - return { - service: isSet(object.service) ? Service.fromJSON(object.service) : undefined - }; + const obj = createBaseEnableServiceResponse(); + if (isSet(object.service)) obj.service = Service.fromJSON(object.service); + return obj; }, toJSON(message: EnableServiceResponse): JsonSafe { const obj: any = {}; @@ -523,7 +476,9 @@ export const EnableServiceResponse = { }, fromPartial(object: DeepPartial): EnableServiceResponse { const message = createBaseEnableServiceResponse(); - message.service = object.service !== undefined && object.service !== null ? Service.fromPartial(object.service) : undefined; + if (object.service !== undefined && object.service !== null) { + message.service = Service.fromPartial(object.service); + } return message; }, fromSDK(object: EnableServiceResponseSDKType): EnableServiceResponse { @@ -579,10 +534,10 @@ function createBaseDisableServiceRequest(): DisableServiceRequest { export const DisableServiceRequest = { typeUrl: "/google.api.serviceusage.v1.DisableServiceRequest", encode(message: DisableServiceRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.name !== "") { + if (message.name !== undefined) { writer.uint32(10).string(message.name); } - if (message.disableDependentServices === true) { + if (message.disableDependentServices !== undefined) { writer.uint32(16).bool(message.disableDependentServices); } if (message.checkIfServiceHasUsage !== 0) { @@ -614,11 +569,11 @@ export const DisableServiceRequest = { return message; }, fromJSON(object: any): DisableServiceRequest { - return { - name: isSet(object.name) ? String(object.name) : "", - disableDependentServices: isSet(object.disableDependentServices) ? Boolean(object.disableDependentServices) : false, - checkIfServiceHasUsage: isSet(object.checkIfServiceHasUsage) ? disableServiceRequest_CheckIfServiceHasUsageFromJSON(object.checkIfServiceHasUsage) : -1 - }; + const obj = createBaseDisableServiceRequest(); + if (isSet(object.name)) obj.name = String(object.name); + if (isSet(object.disableDependentServices)) obj.disableDependentServices = Boolean(object.disableDependentServices); + if (isSet(object.checkIfServiceHasUsage)) obj.checkIfServiceHasUsage = disableServiceRequest_CheckIfServiceHasUsageFromJSON(object.checkIfServiceHasUsage); + return obj; }, toJSON(message: DisableServiceRequest): JsonSafe { const obj: any = {}; @@ -722,9 +677,9 @@ export const DisableServiceResponse = { return message; }, fromJSON(object: any): DisableServiceResponse { - return { - service: isSet(object.service) ? Service.fromJSON(object.service) : undefined - }; + const obj = createBaseDisableServiceResponse(); + if (isSet(object.service)) obj.service = Service.fromJSON(object.service); + return obj; }, toJSON(message: DisableServiceResponse): JsonSafe { const obj: any = {}; @@ -733,7 +688,9 @@ export const DisableServiceResponse = { }, fromPartial(object: DeepPartial): DisableServiceResponse { const message = createBaseDisableServiceResponse(); - message.service = object.service !== undefined && object.service !== null ? Service.fromPartial(object.service) : undefined; + if (object.service !== undefined && object.service !== null) { + message.service = Service.fromPartial(object.service); + } return message; }, fromSDK(object: DisableServiceResponseSDKType): DisableServiceResponse { @@ -787,7 +744,7 @@ function createBaseGetServiceRequest(): GetServiceRequest { export const GetServiceRequest = { typeUrl: "/google.api.serviceusage.v1.GetServiceRequest", encode(message: GetServiceRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.name !== "") { + if (message.name !== undefined) { writer.uint32(10).string(message.name); } return writer; @@ -810,9 +767,9 @@ export const GetServiceRequest = { return message; }, fromJSON(object: any): GetServiceRequest { - return { - name: isSet(object.name) ? String(object.name) : "" - }; + const obj = createBaseGetServiceRequest(); + if (isSet(object.name)) obj.name = String(object.name); + return obj; }, toJSON(message: GetServiceRequest): JsonSafe { const obj: any = {}; @@ -878,16 +835,16 @@ function createBaseListServicesRequest(): ListServicesRequest { export const ListServicesRequest = { typeUrl: "/google.api.serviceusage.v1.ListServicesRequest", encode(message: ListServicesRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.parent !== "") { + if (message.parent !== undefined) { writer.uint32(10).string(message.parent); } - if (message.pageSize !== 0) { + if (message.pageSize !== undefined) { writer.uint32(16).int32(message.pageSize); } - if (message.pageToken !== "") { + if (message.pageToken !== undefined) { writer.uint32(26).string(message.pageToken); } - if (message.filter !== "") { + if (message.filter !== undefined) { writer.uint32(34).string(message.filter); } return writer; @@ -919,12 +876,12 @@ export const ListServicesRequest = { return message; }, fromJSON(object: any): ListServicesRequest { - return { - parent: isSet(object.parent) ? String(object.parent) : "", - pageSize: isSet(object.pageSize) ? Number(object.pageSize) : 0, - pageToken: isSet(object.pageToken) ? String(object.pageToken) : "", - filter: isSet(object.filter) ? String(object.filter) : "" - }; + const obj = createBaseListServicesRequest(); + if (isSet(object.parent)) obj.parent = String(object.parent); + if (isSet(object.pageSize)) obj.pageSize = Number(object.pageSize); + if (isSet(object.pageToken)) obj.pageToken = String(object.pageToken); + if (isSet(object.filter)) obj.filter = String(object.filter); + return obj; }, toJSON(message: ListServicesRequest): JsonSafe { const obj: any = {}; @@ -1018,7 +975,7 @@ export const ListServicesResponse = { for (const v of message.services) { Service.encode(v!, writer.uint32(10).fork()).ldelim(); } - if (message.nextPageToken !== "") { + if (message.nextPageToken !== undefined) { writer.uint32(18).string(message.nextPageToken); } return writer; @@ -1044,10 +1001,10 @@ export const ListServicesResponse = { return message; }, fromJSON(object: any): ListServicesResponse { - return { - services: Array.isArray(object?.services) ? object.services.map((e: any) => Service.fromJSON(e)) : [], - nextPageToken: isSet(object.nextPageToken) ? String(object.nextPageToken) : "" - }; + const obj = createBaseListServicesResponse(); + if (Array.isArray(object?.services)) obj.services = object.services.map((e: any) => Service.fromJSON(e)); + if (isSet(object.nextPageToken)) obj.nextPageToken = String(object.nextPageToken); + return obj; }, toJSON(message: ListServicesResponse): JsonSafe { const obj: any = {}; @@ -1130,7 +1087,7 @@ function createBaseBatchEnableServicesRequest(): BatchEnableServicesRequest { export const BatchEnableServicesRequest = { typeUrl: "/google.api.serviceusage.v1.BatchEnableServicesRequest", encode(message: BatchEnableServicesRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.parent !== "") { + if (message.parent !== undefined) { writer.uint32(10).string(message.parent); } for (const v of message.serviceIds) { @@ -1159,10 +1116,10 @@ export const BatchEnableServicesRequest = { return message; }, fromJSON(object: any): BatchEnableServicesRequest { - return { - parent: isSet(object.parent) ? String(object.parent) : "", - serviceIds: Array.isArray(object?.serviceIds) ? object.serviceIds.map((e: any) => String(e)) : [] - }; + const obj = createBaseBatchEnableServicesRequest(); + if (isSet(object.parent)) obj.parent = String(object.parent); + if (Array.isArray(object?.serviceIds)) obj.serviceIds = object.serviceIds.map((e: any) => String(e)); + return obj; }, toJSON(message: BatchEnableServicesRequest): JsonSafe { const obj: any = {}; @@ -1274,10 +1231,10 @@ export const BatchEnableServicesResponse = { return message; }, fromJSON(object: any): BatchEnableServicesResponse { - return { - services: Array.isArray(object?.services) ? object.services.map((e: any) => Service.fromJSON(e)) : [], - failures: Array.isArray(object?.failures) ? object.failures.map((e: any) => BatchEnableServicesResponse_EnableFailure.fromJSON(e)) : [] - }; + const obj = createBaseBatchEnableServicesResponse(); + if (Array.isArray(object?.services)) obj.services = object.services.map((e: any) => Service.fromJSON(e)); + if (Array.isArray(object?.failures)) obj.failures = object.failures.map((e: any) => BatchEnableServicesResponse_EnableFailure.fromJSON(e)); + return obj; }, toJSON(message: BatchEnableServicesResponse): JsonSafe { const obj: any = {}; @@ -1370,10 +1327,10 @@ function createBaseBatchEnableServicesResponse_EnableFailure(): BatchEnableServi export const BatchEnableServicesResponse_EnableFailure = { typeUrl: "/google.api.serviceusage.v1.EnableFailure", encode(message: BatchEnableServicesResponse_EnableFailure, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.serviceId !== "") { + if (message.serviceId !== undefined) { writer.uint32(10).string(message.serviceId); } - if (message.errorMessage !== "") { + if (message.errorMessage !== undefined) { writer.uint32(18).string(message.errorMessage); } return writer; @@ -1399,10 +1356,10 @@ export const BatchEnableServicesResponse_EnableFailure = { return message; }, fromJSON(object: any): BatchEnableServicesResponse_EnableFailure { - return { - serviceId: isSet(object.serviceId) ? String(object.serviceId) : "", - errorMessage: isSet(object.errorMessage) ? String(object.errorMessage) : "" - }; + const obj = createBaseBatchEnableServicesResponse_EnableFailure(); + if (isSet(object.serviceId)) obj.serviceId = String(object.serviceId); + if (isSet(object.errorMessage)) obj.errorMessage = String(object.errorMessage); + return obj; }, toJSON(message: BatchEnableServicesResponse_EnableFailure): JsonSafe { const obj: any = {}; @@ -1475,7 +1432,7 @@ function createBaseBatchGetServicesRequest(): BatchGetServicesRequest { export const BatchGetServicesRequest = { typeUrl: "/google.api.serviceusage.v1.BatchGetServicesRequest", encode(message: BatchGetServicesRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.parent !== "") { + if (message.parent !== undefined) { writer.uint32(10).string(message.parent); } for (const v of message.names) { @@ -1504,10 +1461,10 @@ export const BatchGetServicesRequest = { return message; }, fromJSON(object: any): BatchGetServicesRequest { - return { - parent: isSet(object.parent) ? String(object.parent) : "", - names: Array.isArray(object?.names) ? object.names.map((e: any) => String(e)) : [] - }; + const obj = createBaseBatchGetServicesRequest(); + if (isSet(object.parent)) obj.parent = String(object.parent); + if (Array.isArray(object?.names)) obj.names = object.names.map((e: any) => String(e)); + return obj; }, toJSON(message: BatchGetServicesRequest): JsonSafe { const obj: any = {}; @@ -1612,9 +1569,9 @@ export const BatchGetServicesResponse = { return message; }, fromJSON(object: any): BatchGetServicesResponse { - return { - services: Array.isArray(object?.services) ? object.services.map((e: any) => Service.fromJSON(e)) : [] - }; + const obj = createBaseBatchGetServicesResponse(); + if (Array.isArray(object?.services)) obj.services = object.services.map((e: any) => Service.fromJSON(e)); + return obj; }, toJSON(message: BatchGetServicesResponse): JsonSafe { const obj: any = {}; 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 c4b8310752..165d71ab35 100644 --- a/__fixtures__/v-next/outputv4/google/api/serviceusage/v1beta1/resources.ts +++ b/__fixtures__/v-next/outputv4/google/api/serviceusage/v1beta1/resources.ts @@ -1,15 +1,14 @@ -import { Api, ApiSDKType } from "../../../protobuf/api"; -import { Documentation, DocumentationSDKType } from "../../documentation"; -import { Quota, QuotaSDKType } from "../../quota"; -import { Authentication, AuthenticationSDKType } from "../../auth"; -import { Usage, UsageSDKType } from "../../usage"; -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 { JsonSafe } from "../../../../json-safe"; -import { ComputedRef } from "vue"; +import { Api, ApiSDKType } from "../../../protobuf/api.js"; +import { Documentation, DocumentationSDKType } from "../../documentation.js"; +import { Quota, QuotaSDKType } from "../../quota.js"; +import { Authentication, AuthenticationSDKType } from "../../auth.js"; +import { Usage, UsageSDKType } from "../../usage.js"; +import { Endpoint, EndpointSDKType } from "../../endpoint.js"; +import { MonitoredResourceDescriptor, MonitoredResourceDescriptorSDKType } from "../../monitored_resource.js"; +import { Monitoring, MonitoringSDKType } from "../../monitoring.js"; +import { BinaryReader, BinaryWriter } from "../../../../binary.js"; +import { isSet, DeepPartial, isObject } from "../../../../helpers.js"; +import { JsonSafe } from "../../../../json-safe.js"; export const protobufPackage = "google.api.serviceusage.v1beta1"; /** Whether or not a service has been enabled for use by a consumer. */ export enum State { @@ -186,12 +185,6 @@ export interface Service { /** Whether or not the service has been enabled for use by the consumer. */ state: State; } -export interface ReactiveService { - name: ComputedRef; - parent: ComputedRef; - config?: ComputedRef; - state: ComputedRef; -} export interface ServiceProtoMsg { typeUrl: "/google.api.serviceusage.v1beta1.Service"; value: Uint8Array; @@ -246,18 +239,6 @@ export interface ServiceConfig { */ monitoring?: Monitoring; } -export interface ReactiveServiceConfig { - name: ComputedRef; - title: ComputedRef; - apis: ComputedRef; - documentation?: ComputedRef; - quota?: ComputedRef; - authentication?: ComputedRef; - usage?: ComputedRef; - endpoints: ComputedRef; - monitoredResources: ComputedRef; - monitoring?: ComputedRef; -} export interface ServiceConfigProtoMsg { typeUrl: "/google.api.serviceusage.v1beta1.ServiceConfig"; value: Uint8Array; @@ -283,9 +264,6 @@ export interface OperationMetadata { */ resourceNames: string[]; } -export interface ReactiveOperationMetadata { - resourceNames: ComputedRef; -} export interface OperationMetadataProtoMsg { typeUrl: "/google.api.serviceusage.v1beta1.OperationMetadata"; value: Uint8Array; @@ -337,14 +315,6 @@ export interface ConsumerQuotaMetric { /** The units in which the metric value is reported. */ unit: string; } -export interface ReactiveConsumerQuotaMetric { - name: ComputedRef; - metric: ComputedRef; - displayName: ComputedRef; - consumerQuotaLimits: ComputedRef; - descendantConsumerQuotaLimits: ComputedRef; - unit: ComputedRef; -} export interface ConsumerQuotaMetricProtoMsg { typeUrl: "/google.api.serviceusage.v1beta1.ConsumerQuotaMetric"; value: Uint8Array; @@ -397,14 +367,6 @@ export interface ConsumerQuotaLimit { */ quotaBuckets: QuotaBucket[]; } -export interface ReactiveConsumerQuotaLimit { - name: ComputedRef; - metric: ComputedRef; - unit: ComputedRef; - isPrecise: ComputedRef; - allowsAdminOverrides: ComputedRef; - quotaBuckets: ComputedRef; -} export interface ConsumerQuotaLimitProtoMsg { typeUrl: "/google.api.serviceusage.v1beta1.ConsumerQuotaLimit"; value: Uint8Array; @@ -422,10 +384,6 @@ export interface QuotaBucket_DimensionsEntry { key: string; value: string; } -export interface ReactiveQuotaBucket_DimensionsEntry { - key: ComputedRef; - value: ComputedRef; -} export interface QuotaBucket_DimensionsEntryProtoMsg { typeUrl: string; value: Uint8Array; @@ -469,16 +427,6 @@ export interface QuotaBucket { [key: string]: string; }; } -export interface ReactiveQuotaBucket { - effectiveLimit: ComputedRef; - defaultLimit: ComputedRef; - producerOverride?: ComputedRef; - consumerOverride?: ComputedRef; - adminOverride?: ComputedRef; - dimensions: ComputedRef<{ - [key: string]: string; - }>; -} export interface QuotaBucketProtoMsg { typeUrl: "/google.api.serviceusage.v1beta1.QuotaBucket"; value: Uint8Array; @@ -498,10 +446,6 @@ export interface QuotaOverride_DimensionsEntry { key: string; value: string; } -export interface ReactiveQuotaOverride_DimensionsEntry { - key: ComputedRef; - value: ComputedRef; -} export interface QuotaOverride_DimensionsEntryProtoMsg { typeUrl: string; value: Uint8Array; @@ -579,16 +523,6 @@ export interface QuotaOverride { */ adminOverrideAncestor: string; } -export interface ReactiveQuotaOverride { - name: ComputedRef; - overrideValue: ComputedRef; - dimensions: ComputedRef<{ - [key: string]: string; - }>; - metric: ComputedRef; - unit: ComputedRef; - adminOverrideAncestor: ComputedRef; -} export interface QuotaOverrideProtoMsg { typeUrl: "/google.api.serviceusage.v1beta1.QuotaOverride"; value: Uint8Array; @@ -614,9 +548,6 @@ export interface OverrideInlineSource { */ overrides: QuotaOverride[]; } -export interface ReactiveOverrideInlineSource { - overrides: ComputedRef; -} export interface OverrideInlineSourceProtoMsg { typeUrl: "/google.api.serviceusage.v1beta1.OverrideInlineSource"; value: Uint8Array; @@ -629,10 +560,6 @@ export interface AdminQuotaPolicy_DimensionsEntry { key: string; value: string; } -export interface ReactiveAdminQuotaPolicy_DimensionsEntry { - key: ComputedRef; - value: ComputedRef; -} export interface AdminQuotaPolicy_DimensionsEntryProtoMsg { typeUrl: string; value: Uint8Array; @@ -695,16 +622,6 @@ export interface AdminQuotaPolicy { */ container: string; } -export interface ReactiveAdminQuotaPolicy { - name: ComputedRef; - policyValue: ComputedRef; - dimensions: ComputedRef<{ - [key: string]: string; - }>; - metric: ComputedRef; - unit: ComputedRef; - container: ComputedRef; -} export interface AdminQuotaPolicyProtoMsg { typeUrl: "/google.api.serviceusage.v1beta1.AdminQuotaPolicy"; value: Uint8Array; @@ -736,10 +653,6 @@ export interface ServiceIdentity { */ uniqueId: string; } -export interface ReactiveServiceIdentity { - email: ComputedRef; - uniqueId: ComputedRef; -} export interface ServiceIdentityProtoMsg { typeUrl: "/google.api.serviceusage.v1beta1.ServiceIdentity"; value: Uint8Array; @@ -763,10 +676,10 @@ function createBaseService(): Service { export const Service = { typeUrl: "/google.api.serviceusage.v1beta1.Service", encode(message: Service, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.name !== "") { + if (message.name !== undefined) { writer.uint32(10).string(message.name); } - if (message.parent !== "") { + if (message.parent !== undefined) { writer.uint32(42).string(message.parent); } if (message.config !== undefined) { @@ -804,12 +717,12 @@ export const Service = { return message; }, fromJSON(object: any): Service { - return { - name: isSet(object.name) ? String(object.name) : "", - parent: isSet(object.parent) ? String(object.parent) : "", - config: isSet(object.config) ? ServiceConfig.fromJSON(object.config) : undefined, - state: isSet(object.state) ? stateFromJSON(object.state) : -1 - }; + const obj = createBaseService(); + if (isSet(object.name)) obj.name = String(object.name); + if (isSet(object.parent)) obj.parent = String(object.parent); + if (isSet(object.config)) obj.config = ServiceConfig.fromJSON(object.config); + if (isSet(object.state)) obj.state = stateFromJSON(object.state); + return obj; }, toJSON(message: Service): JsonSafe { const obj: any = {}; @@ -823,7 +736,9 @@ export const Service = { const message = createBaseService(); message.name = object.name ?? ""; message.parent = object.parent ?? ""; - message.config = object.config !== undefined && object.config !== null ? ServiceConfig.fromPartial(object.config) : undefined; + if (object.config !== undefined && object.config !== null) { + message.config = ServiceConfig.fromPartial(object.config); + } message.state = object.state ?? 0; return message; }, @@ -908,10 +823,10 @@ function createBaseServiceConfig(): ServiceConfig { export const ServiceConfig = { typeUrl: "/google.api.serviceusage.v1beta1.ServiceConfig", encode(message: ServiceConfig, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.name !== "") { + if (message.name !== undefined) { writer.uint32(10).string(message.name); } - if (message.title !== "") { + if (message.title !== undefined) { writer.uint32(18).string(message.title); } for (const v of message.apis) { @@ -985,18 +900,18 @@ export const ServiceConfig = { return message; }, fromJSON(object: any): ServiceConfig { - return { - name: isSet(object.name) ? String(object.name) : "", - title: isSet(object.title) ? String(object.title) : "", - apis: Array.isArray(object?.apis) ? object.apis.map((e: any) => Api.fromJSON(e)) : [], - documentation: isSet(object.documentation) ? Documentation.fromJSON(object.documentation) : undefined, - quota: isSet(object.quota) ? Quota.fromJSON(object.quota) : undefined, - authentication: isSet(object.authentication) ? Authentication.fromJSON(object.authentication) : undefined, - usage: isSet(object.usage) ? Usage.fromJSON(object.usage) : undefined, - endpoints: Array.isArray(object?.endpoints) ? object.endpoints.map((e: any) => Endpoint.fromJSON(e)) : [], - monitoredResources: Array.isArray(object?.monitoredResources) ? object.monitoredResources.map((e: any) => MonitoredResourceDescriptor.fromJSON(e)) : [], - monitoring: isSet(object.monitoring) ? Monitoring.fromJSON(object.monitoring) : undefined - }; + const obj = createBaseServiceConfig(); + if (isSet(object.name)) obj.name = String(object.name); + if (isSet(object.title)) obj.title = String(object.title); + if (Array.isArray(object?.apis)) obj.apis = object.apis.map((e: any) => Api.fromJSON(e)); + if (isSet(object.documentation)) obj.documentation = Documentation.fromJSON(object.documentation); + if (isSet(object.quota)) obj.quota = Quota.fromJSON(object.quota); + if (isSet(object.authentication)) obj.authentication = Authentication.fromJSON(object.authentication); + if (isSet(object.usage)) obj.usage = Usage.fromJSON(object.usage); + if (Array.isArray(object?.endpoints)) obj.endpoints = object.endpoints.map((e: any) => Endpoint.fromJSON(e)); + if (Array.isArray(object?.monitoredResources)) obj.monitoredResources = object.monitoredResources.map((e: any) => MonitoredResourceDescriptor.fromJSON(e)); + if (isSet(object.monitoring)) obj.monitoring = Monitoring.fromJSON(object.monitoring); + return obj; }, toJSON(message: ServiceConfig): JsonSafe { const obj: any = {}; @@ -1029,13 +944,23 @@ export const ServiceConfig = { message.name = object.name ?? ""; message.title = object.title ?? ""; message.apis = object.apis?.map(e => Api.fromPartial(e)) || []; - message.documentation = object.documentation !== undefined && object.documentation !== null ? Documentation.fromPartial(object.documentation) : undefined; - message.quota = object.quota !== undefined && object.quota !== null ? Quota.fromPartial(object.quota) : undefined; - message.authentication = object.authentication !== undefined && object.authentication !== null ? Authentication.fromPartial(object.authentication) : undefined; - message.usage = object.usage !== undefined && object.usage !== null ? Usage.fromPartial(object.usage) : undefined; + if (object.documentation !== undefined && object.documentation !== null) { + message.documentation = Documentation.fromPartial(object.documentation); + } + if (object.quota !== undefined && object.quota !== null) { + message.quota = Quota.fromPartial(object.quota); + } + if (object.authentication !== undefined && object.authentication !== null) { + message.authentication = Authentication.fromPartial(object.authentication); + } + if (object.usage !== undefined && object.usage !== null) { + message.usage = Usage.fromPartial(object.usage); + } message.endpoints = object.endpoints?.map(e => Endpoint.fromPartial(e)) || []; message.monitoredResources = object.monitoredResources?.map(e => MonitoredResourceDescriptor.fromPartial(e)) || []; - message.monitoring = object.monitoring !== undefined && object.monitoring !== null ? Monitoring.fromPartial(object.monitoring) : undefined; + if (object.monitoring !== undefined && object.monitoring !== null) { + message.monitoring = Monitoring.fromPartial(object.monitoring); + } return message; }, fromSDK(object: ServiceConfigSDKType): ServiceConfig { @@ -1193,9 +1118,9 @@ export const OperationMetadata = { return message; }, fromJSON(object: any): OperationMetadata { - return { - resourceNames: Array.isArray(object?.resourceNames) ? object.resourceNames.map((e: any) => String(e)) : [] - }; + const obj = createBaseOperationMetadata(); + if (Array.isArray(object?.resourceNames)) obj.resourceNames = object.resourceNames.map((e: any) => String(e)); + return obj; }, toJSON(message: OperationMetadata): JsonSafe { const obj: any = {}; @@ -1273,13 +1198,13 @@ function createBaseConsumerQuotaMetric(): ConsumerQuotaMetric { export const ConsumerQuotaMetric = { typeUrl: "/google.api.serviceusage.v1beta1.ConsumerQuotaMetric", encode(message: ConsumerQuotaMetric, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.name !== "") { + if (message.name !== undefined) { writer.uint32(10).string(message.name); } - if (message.metric !== "") { + if (message.metric !== undefined) { writer.uint32(34).string(message.metric); } - if (message.displayName !== "") { + if (message.displayName !== undefined) { writer.uint32(18).string(message.displayName); } for (const v of message.consumerQuotaLimits) { @@ -1288,7 +1213,7 @@ export const ConsumerQuotaMetric = { for (const v of message.descendantConsumerQuotaLimits) { ConsumerQuotaLimit.encode(v!, writer.uint32(50).fork()).ldelim(); } - if (message.unit !== "") { + if (message.unit !== undefined) { writer.uint32(42).string(message.unit); } return writer; @@ -1326,14 +1251,14 @@ export const ConsumerQuotaMetric = { return message; }, fromJSON(object: any): ConsumerQuotaMetric { - return { - name: isSet(object.name) ? String(object.name) : "", - metric: isSet(object.metric) ? String(object.metric) : "", - displayName: isSet(object.displayName) ? String(object.displayName) : "", - consumerQuotaLimits: Array.isArray(object?.consumerQuotaLimits) ? object.consumerQuotaLimits.map((e: any) => ConsumerQuotaLimit.fromJSON(e)) : [], - descendantConsumerQuotaLimits: Array.isArray(object?.descendantConsumerQuotaLimits) ? object.descendantConsumerQuotaLimits.map((e: any) => ConsumerQuotaLimit.fromJSON(e)) : [], - unit: isSet(object.unit) ? String(object.unit) : "" - }; + const obj = createBaseConsumerQuotaMetric(); + if (isSet(object.name)) obj.name = String(object.name); + if (isSet(object.metric)) obj.metric = String(object.metric); + if (isSet(object.displayName)) obj.displayName = String(object.displayName); + if (Array.isArray(object?.consumerQuotaLimits)) obj.consumerQuotaLimits = object.consumerQuotaLimits.map((e: any) => ConsumerQuotaLimit.fromJSON(e)); + if (Array.isArray(object?.descendantConsumerQuotaLimits)) obj.descendantConsumerQuotaLimits = object.descendantConsumerQuotaLimits.map((e: any) => ConsumerQuotaLimit.fromJSON(e)); + if (isSet(object.unit)) obj.unit = String(object.unit); + return obj; }, toJSON(message: ConsumerQuotaMetric): JsonSafe { const obj: any = {}; @@ -1466,19 +1391,19 @@ function createBaseConsumerQuotaLimit(): ConsumerQuotaLimit { export const ConsumerQuotaLimit = { typeUrl: "/google.api.serviceusage.v1beta1.ConsumerQuotaLimit", encode(message: ConsumerQuotaLimit, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.name !== "") { + if (message.name !== undefined) { writer.uint32(10).string(message.name); } - if (message.metric !== "") { + if (message.metric !== undefined) { writer.uint32(66).string(message.metric); } - if (message.unit !== "") { + if (message.unit !== undefined) { writer.uint32(18).string(message.unit); } - if (message.isPrecise === true) { + if (message.isPrecise !== undefined) { writer.uint32(24).bool(message.isPrecise); } - if (message.allowsAdminOverrides === true) { + if (message.allowsAdminOverrides !== undefined) { writer.uint32(56).bool(message.allowsAdminOverrides); } for (const v of message.quotaBuckets) { @@ -1519,14 +1444,14 @@ export const ConsumerQuotaLimit = { return message; }, fromJSON(object: any): ConsumerQuotaLimit { - return { - name: isSet(object.name) ? String(object.name) : "", - metric: isSet(object.metric) ? String(object.metric) : "", - unit: isSet(object.unit) ? String(object.unit) : "", - isPrecise: isSet(object.isPrecise) ? Boolean(object.isPrecise) : false, - allowsAdminOverrides: isSet(object.allowsAdminOverrides) ? Boolean(object.allowsAdminOverrides) : false, - quotaBuckets: Array.isArray(object?.quotaBuckets) ? object.quotaBuckets.map((e: any) => QuotaBucket.fromJSON(e)) : [] - }; + const obj = createBaseConsumerQuotaLimit(); + if (isSet(object.name)) obj.name = String(object.name); + if (isSet(object.metric)) obj.metric = String(object.metric); + if (isSet(object.unit)) obj.unit = String(object.unit); + if (isSet(object.isPrecise)) obj.isPrecise = Boolean(object.isPrecise); + if (isSet(object.allowsAdminOverrides)) obj.allowsAdminOverrides = Boolean(object.allowsAdminOverrides); + if (Array.isArray(object?.quotaBuckets)) obj.quotaBuckets = object.quotaBuckets.map((e: any) => QuotaBucket.fromJSON(e)); + return obj; }, toJSON(message: ConsumerQuotaLimit): JsonSafe { const obj: any = {}; @@ -1644,10 +1569,10 @@ function createBaseQuotaBucket_DimensionsEntry(): QuotaBucket_DimensionsEntry { } export const QuotaBucket_DimensionsEntry = { encode(message: QuotaBucket_DimensionsEntry, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.key !== "") { + if (message.key !== undefined) { writer.uint32(10).string(message.key); } - if (message.value !== "") { + if (message.value !== undefined) { writer.uint32(18).string(message.value); } return writer; @@ -1673,10 +1598,10 @@ export const QuotaBucket_DimensionsEntry = { return message; }, fromJSON(object: any): QuotaBucket_DimensionsEntry { - return { - key: isSet(object.key) ? String(object.key) : "", - value: isSet(object.value) ? String(object.value) : "" - }; + const obj = createBaseQuotaBucket_DimensionsEntry(); + if (isSet(object.key)) obj.key = String(object.key); + if (isSet(object.value)) obj.value = String(object.value); + return obj; }, toJSON(message: QuotaBucket_DimensionsEntry): JsonSafe { const obj: any = {}; @@ -1747,10 +1672,10 @@ function createBaseQuotaBucket(): QuotaBucket { export const QuotaBucket = { typeUrl: "/google.api.serviceusage.v1beta1.QuotaBucket", encode(message: QuotaBucket, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.effectiveLimit !== BigInt(0)) { + if (message.effectiveLimit !== undefined) { writer.uint32(8).int64(message.effectiveLimit); } - if (message.defaultLimit !== BigInt(0)) { + if (message.defaultLimit !== undefined) { writer.uint32(16).int64(message.defaultLimit); } if (message.producerOverride !== undefined) { @@ -1806,19 +1731,19 @@ export const QuotaBucket = { return message; }, fromJSON(object: any): QuotaBucket { - return { - effectiveLimit: isSet(object.effectiveLimit) ? BigInt(object.effectiveLimit.toString()) : BigInt(0), - defaultLimit: isSet(object.defaultLimit) ? BigInt(object.defaultLimit.toString()) : BigInt(0), - producerOverride: isSet(object.producerOverride) ? QuotaOverride.fromJSON(object.producerOverride) : undefined, - consumerOverride: isSet(object.consumerOverride) ? QuotaOverride.fromJSON(object.consumerOverride) : undefined, - adminOverride: isSet(object.adminOverride) ? QuotaOverride.fromJSON(object.adminOverride) : undefined, - dimensions: isObject(object.dimensions) ? Object.entries(object.dimensions).reduce<{ - [key: string]: string; - }>((acc, [key, value]) => { - acc[key] = String(value); - return acc; - }, {}) : {} - }; + const obj = createBaseQuotaBucket(); + if (isSet(object.effectiveLimit)) obj.effectiveLimit = BigInt(object.effectiveLimit.toString()); + if (isSet(object.defaultLimit)) obj.defaultLimit = BigInt(object.defaultLimit.toString()); + if (isSet(object.producerOverride)) obj.producerOverride = QuotaOverride.fromJSON(object.producerOverride); + if (isSet(object.consumerOverride)) obj.consumerOverride = QuotaOverride.fromJSON(object.consumerOverride); + if (isSet(object.adminOverride)) obj.adminOverride = QuotaOverride.fromJSON(object.adminOverride); + if (isObject(object.dimensions)) obj.dimensions = Object.entries(object.dimensions).reduce<{ + [key: string]: string; + }>((acc, [key, value]) => { + acc[key] = String(value); + return acc; + }, {}); + return obj; }, toJSON(message: QuotaBucket): JsonSafe { const obj: any = {}; @@ -1837,11 +1762,21 @@ export const QuotaBucket = { }, fromPartial(object: DeepPartial): QuotaBucket { const message = createBaseQuotaBucket(); - message.effectiveLimit = object.effectiveLimit !== undefined && object.effectiveLimit !== null ? BigInt(object.effectiveLimit.toString()) : BigInt(0); - message.defaultLimit = object.defaultLimit !== undefined && object.defaultLimit !== null ? BigInt(object.defaultLimit.toString()) : BigInt(0); - message.producerOverride = object.producerOverride !== undefined && object.producerOverride !== null ? QuotaOverride.fromPartial(object.producerOverride) : undefined; - message.consumerOverride = object.consumerOverride !== undefined && object.consumerOverride !== null ? QuotaOverride.fromPartial(object.consumerOverride) : undefined; - message.adminOverride = object.adminOverride !== undefined && object.adminOverride !== null ? QuotaOverride.fromPartial(object.adminOverride) : undefined; + if (object.effectiveLimit !== undefined && object.effectiveLimit !== null) { + message.effectiveLimit = BigInt(object.effectiveLimit.toString()); + } + if (object.defaultLimit !== undefined && object.defaultLimit !== null) { + message.defaultLimit = BigInt(object.defaultLimit.toString()); + } + if (object.producerOverride !== undefined && object.producerOverride !== null) { + message.producerOverride = QuotaOverride.fromPartial(object.producerOverride); + } + if (object.consumerOverride !== undefined && object.consumerOverride !== null) { + message.consumerOverride = QuotaOverride.fromPartial(object.consumerOverride); + } + if (object.adminOverride !== undefined && object.adminOverride !== null) { + message.adminOverride = QuotaOverride.fromPartial(object.adminOverride); + } message.dimensions = Object.entries(object.dimensions ?? {}).reduce<{ [key: string]: string; }>((acc, [key, value]) => { @@ -1963,10 +1898,10 @@ function createBaseQuotaOverride_DimensionsEntry(): QuotaOverride_DimensionsEntr } export const QuotaOverride_DimensionsEntry = { encode(message: QuotaOverride_DimensionsEntry, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.key !== "") { + if (message.key !== undefined) { writer.uint32(10).string(message.key); } - if (message.value !== "") { + if (message.value !== undefined) { writer.uint32(18).string(message.value); } return writer; @@ -1992,10 +1927,10 @@ export const QuotaOverride_DimensionsEntry = { return message; }, fromJSON(object: any): QuotaOverride_DimensionsEntry { - return { - key: isSet(object.key) ? String(object.key) : "", - value: isSet(object.value) ? String(object.value) : "" - }; + const obj = createBaseQuotaOverride_DimensionsEntry(); + if (isSet(object.key)) obj.key = String(object.key); + if (isSet(object.value)) obj.value = String(object.value); + return obj; }, toJSON(message: QuotaOverride_DimensionsEntry): JsonSafe { const obj: any = {}; @@ -2066,10 +2001,10 @@ function createBaseQuotaOverride(): QuotaOverride { export const QuotaOverride = { typeUrl: "/google.api.serviceusage.v1beta1.QuotaOverride", encode(message: QuotaOverride, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.name !== "") { + if (message.name !== undefined) { writer.uint32(10).string(message.name); } - if (message.overrideValue !== BigInt(0)) { + if (message.overrideValue !== undefined) { writer.uint32(16).int64(message.overrideValue); } Object.entries(message.dimensions).forEach(([key, value]) => { @@ -2078,13 +2013,13 @@ export const QuotaOverride = { value }, writer.uint32(26).fork()).ldelim(); }); - if (message.metric !== "") { + if (message.metric !== undefined) { writer.uint32(34).string(message.metric); } - if (message.unit !== "") { + if (message.unit !== undefined) { writer.uint32(42).string(message.unit); } - if (message.adminOverrideAncestor !== "") { + if (message.adminOverrideAncestor !== undefined) { writer.uint32(50).string(message.adminOverrideAncestor); } return writer; @@ -2125,19 +2060,19 @@ export const QuotaOverride = { return message; }, fromJSON(object: any): QuotaOverride { - return { - name: isSet(object.name) ? String(object.name) : "", - overrideValue: isSet(object.overrideValue) ? BigInt(object.overrideValue.toString()) : BigInt(0), - dimensions: isObject(object.dimensions) ? Object.entries(object.dimensions).reduce<{ - [key: string]: string; - }>((acc, [key, value]) => { - acc[key] = String(value); - return acc; - }, {}) : {}, - metric: isSet(object.metric) ? String(object.metric) : "", - unit: isSet(object.unit) ? String(object.unit) : "", - adminOverrideAncestor: isSet(object.adminOverrideAncestor) ? String(object.adminOverrideAncestor) : "" - }; + const obj = createBaseQuotaOverride(); + if (isSet(object.name)) obj.name = String(object.name); + if (isSet(object.overrideValue)) obj.overrideValue = BigInt(object.overrideValue.toString()); + if (isObject(object.dimensions)) obj.dimensions = Object.entries(object.dimensions).reduce<{ + [key: string]: string; + }>((acc, [key, value]) => { + acc[key] = String(value); + return acc; + }, {}); + if (isSet(object.metric)) obj.metric = String(object.metric); + if (isSet(object.unit)) obj.unit = String(object.unit); + if (isSet(object.adminOverrideAncestor)) obj.adminOverrideAncestor = String(object.adminOverrideAncestor); + return obj; }, toJSON(message: QuotaOverride): JsonSafe { const obj: any = {}; @@ -2157,7 +2092,9 @@ export const QuotaOverride = { fromPartial(object: DeepPartial): QuotaOverride { const message = createBaseQuotaOverride(); message.name = object.name ?? ""; - message.overrideValue = object.overrideValue !== undefined && object.overrideValue !== null ? BigInt(object.overrideValue.toString()) : BigInt(0); + if (object.overrideValue !== undefined && object.overrideValue !== null) { + message.overrideValue = BigInt(object.overrideValue.toString()); + } message.dimensions = Object.entries(object.dimensions ?? {}).reduce<{ [key: string]: string; }>((acc, [key, value]) => { @@ -2305,9 +2242,9 @@ export const OverrideInlineSource = { return message; }, fromJSON(object: any): OverrideInlineSource { - return { - overrides: Array.isArray(object?.overrides) ? object.overrides.map((e: any) => QuotaOverride.fromJSON(e)) : [] - }; + const obj = createBaseOverrideInlineSource(); + if (Array.isArray(object?.overrides)) obj.overrides = object.overrides.map((e: any) => QuotaOverride.fromJSON(e)); + return obj; }, toJSON(message: OverrideInlineSource): JsonSafe { const obj: any = {}; @@ -2380,10 +2317,10 @@ function createBaseAdminQuotaPolicy_DimensionsEntry(): AdminQuotaPolicy_Dimensio } export const AdminQuotaPolicy_DimensionsEntry = { encode(message: AdminQuotaPolicy_DimensionsEntry, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.key !== "") { + if (message.key !== undefined) { writer.uint32(10).string(message.key); } - if (message.value !== "") { + if (message.value !== undefined) { writer.uint32(18).string(message.value); } return writer; @@ -2409,10 +2346,10 @@ export const AdminQuotaPolicy_DimensionsEntry = { return message; }, fromJSON(object: any): AdminQuotaPolicy_DimensionsEntry { - return { - key: isSet(object.key) ? String(object.key) : "", - value: isSet(object.value) ? String(object.value) : "" - }; + const obj = createBaseAdminQuotaPolicy_DimensionsEntry(); + if (isSet(object.key)) obj.key = String(object.key); + if (isSet(object.value)) obj.value = String(object.value); + return obj; }, toJSON(message: AdminQuotaPolicy_DimensionsEntry): JsonSafe { const obj: any = {}; @@ -2483,10 +2420,10 @@ function createBaseAdminQuotaPolicy(): AdminQuotaPolicy { export const AdminQuotaPolicy = { typeUrl: "/google.api.serviceusage.v1beta1.AdminQuotaPolicy", encode(message: AdminQuotaPolicy, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.name !== "") { + if (message.name !== undefined) { writer.uint32(10).string(message.name); } - if (message.policyValue !== BigInt(0)) { + if (message.policyValue !== undefined) { writer.uint32(16).int64(message.policyValue); } Object.entries(message.dimensions).forEach(([key, value]) => { @@ -2495,13 +2432,13 @@ export const AdminQuotaPolicy = { value }, writer.uint32(26).fork()).ldelim(); }); - if (message.metric !== "") { + if (message.metric !== undefined) { writer.uint32(34).string(message.metric); } - if (message.unit !== "") { + if (message.unit !== undefined) { writer.uint32(42).string(message.unit); } - if (message.container !== "") { + if (message.container !== undefined) { writer.uint32(50).string(message.container); } return writer; @@ -2542,19 +2479,19 @@ export const AdminQuotaPolicy = { return message; }, fromJSON(object: any): AdminQuotaPolicy { - return { - name: isSet(object.name) ? String(object.name) : "", - policyValue: isSet(object.policyValue) ? BigInt(object.policyValue.toString()) : BigInt(0), - dimensions: isObject(object.dimensions) ? Object.entries(object.dimensions).reduce<{ - [key: string]: string; - }>((acc, [key, value]) => { - acc[key] = String(value); - return acc; - }, {}) : {}, - metric: isSet(object.metric) ? String(object.metric) : "", - unit: isSet(object.unit) ? String(object.unit) : "", - container: isSet(object.container) ? String(object.container) : "" - }; + const obj = createBaseAdminQuotaPolicy(); + if (isSet(object.name)) obj.name = String(object.name); + if (isSet(object.policyValue)) obj.policyValue = BigInt(object.policyValue.toString()); + if (isObject(object.dimensions)) obj.dimensions = Object.entries(object.dimensions).reduce<{ + [key: string]: string; + }>((acc, [key, value]) => { + acc[key] = String(value); + return acc; + }, {}); + if (isSet(object.metric)) obj.metric = String(object.metric); + if (isSet(object.unit)) obj.unit = String(object.unit); + if (isSet(object.container)) obj.container = String(object.container); + return obj; }, toJSON(message: AdminQuotaPolicy): JsonSafe { const obj: any = {}; @@ -2574,7 +2511,9 @@ export const AdminQuotaPolicy = { fromPartial(object: DeepPartial): AdminQuotaPolicy { const message = createBaseAdminQuotaPolicy(); message.name = object.name ?? ""; - message.policyValue = object.policyValue !== undefined && object.policyValue !== null ? BigInt(object.policyValue.toString()) : BigInt(0); + if (object.policyValue !== undefined && object.policyValue !== null) { + message.policyValue = BigInt(object.policyValue.toString()); + } message.dimensions = Object.entries(object.dimensions ?? {}).reduce<{ [key: string]: string; }>((acc, [key, value]) => { @@ -2700,10 +2639,10 @@ function createBaseServiceIdentity(): ServiceIdentity { export const ServiceIdentity = { typeUrl: "/google.api.serviceusage.v1beta1.ServiceIdentity", encode(message: ServiceIdentity, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.email !== "") { + if (message.email !== undefined) { writer.uint32(10).string(message.email); } - if (message.uniqueId !== "") { + if (message.uniqueId !== undefined) { writer.uint32(18).string(message.uniqueId); } return writer; @@ -2729,10 +2668,10 @@ export const ServiceIdentity = { return message; }, fromJSON(object: any): ServiceIdentity { - return { - email: isSet(object.email) ? String(object.email) : "", - uniqueId: isSet(object.uniqueId) ? String(object.uniqueId) : "" - }; + const obj = createBaseServiceIdentity(); + if (isSet(object.email)) obj.email = String(object.email); + if (isSet(object.uniqueId)) obj.uniqueId = String(object.uniqueId); + return obj; }, toJSON(message: ServiceIdentity): JsonSafe { const obj: any = {}; 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 3ba0cc75b7..6003cb233d 100644 --- a/__fixtures__/v-next/outputv4/google/api/serviceusage/v1beta1/serviceusage.ts +++ b/__fixtures__/v-next/outputv4/google/api/serviceusage/v1beta1/serviceusage.ts @@ -1,9 +1,8 @@ -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 { JsonSafe } from "../../../../json-safe"; -import { ComputedRef } from "vue"; +import { QuotaView, QuotaViewSDKType, QuotaOverride, QuotaOverrideSDKType, QuotaSafetyCheck, QuotaSafetyCheckSDKType, OverrideInlineSource, OverrideInlineSourceSDKType, Service, ServiceSDKType, ConsumerQuotaMetric, ConsumerQuotaMetricSDKType, AdminQuotaPolicy, AdminQuotaPolicySDKType, ServiceIdentity, ServiceIdentitySDKType, quotaViewFromJSON, quotaViewToJSON, quotaSafetyCheckFromJSON, quotaSafetyCheckToJSON } from "./resources.js"; +import { FieldMask, FieldMaskSDKType } from "../../../protobuf/field_mask.js"; +import { BinaryReader, BinaryWriter } from "../../../../binary.js"; +import { isSet, DeepPartial } from "../../../../helpers.js"; +import { JsonSafe } from "../../../../json-safe.js"; export const protobufPackage = "google.api.serviceusage.v1beta1"; /** Enum for service identity state. */ export enum GetServiceIdentityResponse_IdentityState { @@ -59,9 +58,6 @@ export interface EnableServiceRequest { */ name: string; } -export interface ReactiveEnableServiceRequest { - name: ComputedRef; -} export interface EnableServiceRequestProtoMsg { typeUrl: "/google.api.serviceusage.v1beta1.EnableServiceRequest"; value: Uint8Array; @@ -83,9 +79,6 @@ export interface DisableServiceRequest { */ name: string; } -export interface ReactiveDisableServiceRequest { - name: ComputedRef; -} export interface DisableServiceRequestProtoMsg { typeUrl: "/google.api.serviceusage.v1beta1.DisableServiceRequest"; value: Uint8Array; @@ -105,9 +98,6 @@ export interface GetServiceRequest { */ name: string; } -export interface ReactiveGetServiceRequest { - name: ComputedRef; -} export interface GetServiceRequestProtoMsg { typeUrl: "/google.api.serviceusage.v1beta1.GetServiceRequest"; value: Uint8Array; @@ -143,12 +133,6 @@ export interface ListServicesRequest { */ filter: string; } -export interface ReactiveListServicesRequest { - parent: ComputedRef; - pageSize: ComputedRef; - pageToken: ComputedRef; - filter: ComputedRef; -} export interface ListServicesRequestProtoMsg { typeUrl: "/google.api.serviceusage.v1beta1.ListServicesRequest"; value: Uint8Array; @@ -170,10 +154,6 @@ export interface ListServicesResponse { */ nextPageToken: string; } -export interface ReactiveListServicesResponse { - services: ComputedRef; - nextPageToken: ComputedRef; -} export interface ListServicesResponseProtoMsg { typeUrl: "/google.api.serviceusage.v1beta1.ListServicesResponse"; value: Uint8Array; @@ -213,10 +193,6 @@ export interface BatchEnableServicesRequest { */ serviceIds: string[]; } -export interface ReactiveBatchEnableServicesRequest { - parent: ComputedRef; - serviceIds: ComputedRef; -} export interface BatchEnableServicesRequestProtoMsg { typeUrl: "/google.api.serviceusage.v1beta1.BatchEnableServicesRequest"; value: Uint8Array; @@ -247,12 +223,6 @@ export interface ListConsumerQuotaMetricsRequest { /** Specifies the level of detail for quota information in the response. */ view: QuotaView; } -export interface ReactiveListConsumerQuotaMetricsRequest { - parent: ComputedRef; - pageSize: ComputedRef; - pageToken: ComputedRef; - view: ComputedRef; -} export interface ListConsumerQuotaMetricsRequestProtoMsg { typeUrl: "/google.api.serviceusage.v1beta1.ListConsumerQuotaMetricsRequest"; value: Uint8Array; @@ -274,10 +244,6 @@ export interface ListConsumerQuotaMetricsResponse { */ nextPageToken: string; } -export interface ReactiveListConsumerQuotaMetricsResponse { - metrics: ComputedRef; - nextPageToken: ComputedRef; -} export interface ListConsumerQuotaMetricsResponseProtoMsg { typeUrl: "/google.api.serviceusage.v1beta1.ListConsumerQuotaMetricsResponse"; value: Uint8Array; @@ -299,10 +265,6 @@ export interface GetConsumerQuotaMetricRequest { /** Specifies the level of detail for quota information in the response. */ view: QuotaView; } -export interface ReactiveGetConsumerQuotaMetricRequest { - name: ComputedRef; - view: ComputedRef; -} export interface GetConsumerQuotaMetricRequestProtoMsg { typeUrl: "/google.api.serviceusage.v1beta1.GetConsumerQuotaMetricRequest"; value: Uint8Array; @@ -324,10 +286,6 @@ export interface GetConsumerQuotaLimitRequest { /** Specifies the level of detail for quota information in the response. */ view: QuotaView; } -export interface ReactiveGetConsumerQuotaLimitRequest { - name: ComputedRef; - view: ComputedRef; -} export interface GetConsumerQuotaLimitRequestProtoMsg { typeUrl: "/google.api.serviceusage.v1beta1.GetConsumerQuotaLimitRequest"; value: Uint8Array; @@ -363,12 +321,6 @@ export interface CreateAdminOverrideRequest { */ forceOnly: QuotaSafetyCheck[]; } -export interface ReactiveCreateAdminOverrideRequest { - parent: ComputedRef; - override?: ComputedRef; - force: ComputedRef; - forceOnly: ComputedRef; -} export interface CreateAdminOverrideRequestProtoMsg { typeUrl: "/google.api.serviceusage.v1beta1.CreateAdminOverrideRequest"; value: Uint8Array; @@ -413,13 +365,6 @@ export interface UpdateAdminOverrideRequest { */ forceOnly: QuotaSafetyCheck[]; } -export interface ReactiveUpdateAdminOverrideRequest { - name: ComputedRef; - override?: ComputedRef; - force: ComputedRef; - updateMask?: ComputedRef; - forceOnly: ComputedRef; -} export interface UpdateAdminOverrideRequestProtoMsg { typeUrl: "/google.api.serviceusage.v1beta1.UpdateAdminOverrideRequest"; value: Uint8Array; @@ -455,11 +400,6 @@ export interface DeleteAdminOverrideRequest { */ forceOnly: QuotaSafetyCheck[]; } -export interface ReactiveDeleteAdminOverrideRequest { - name: ComputedRef; - force: ComputedRef; - forceOnly: ComputedRef; -} export interface DeleteAdminOverrideRequestProtoMsg { typeUrl: "/google.api.serviceusage.v1beta1.DeleteAdminOverrideRequest"; value: Uint8Array; @@ -488,11 +428,6 @@ export interface ListAdminOverridesRequest { */ pageToken: string; } -export interface ReactiveListAdminOverridesRequest { - parent: ComputedRef; - pageSize: ComputedRef; - pageToken: ComputedRef; -} export interface ListAdminOverridesRequestProtoMsg { typeUrl: "/google.api.serviceusage.v1beta1.ListAdminOverridesRequest"; value: Uint8Array; @@ -513,10 +448,6 @@ export interface ListAdminOverridesResponse { */ nextPageToken: string; } -export interface ReactiveListAdminOverridesResponse { - overrides: ComputedRef; - nextPageToken: ComputedRef; -} export interface ListAdminOverridesResponseProtoMsg { typeUrl: "/google.api.serviceusage.v1beta1.ListAdminOverridesResponse"; value: Uint8Array; @@ -531,9 +462,6 @@ export interface BatchCreateAdminOverridesResponse { /** The overrides that were created. */ overrides: QuotaOverride[]; } -export interface ReactiveBatchCreateAdminOverridesResponse { - overrides: ComputedRef; -} export interface BatchCreateAdminOverridesResponseProtoMsg { typeUrl: "/google.api.serviceusage.v1beta1.BatchCreateAdminOverridesResponse"; value: Uint8Array; @@ -567,12 +495,6 @@ export interface ImportAdminOverridesRequest { */ forceOnly: QuotaSafetyCheck[]; } -export interface ReactiveImportAdminOverridesRequest { - parent: ComputedRef; - inlineSource?: ComputedRef; - force: ComputedRef; - forceOnly: ComputedRef; -} export interface ImportAdminOverridesRequestProtoMsg { typeUrl: "/google.api.serviceusage.v1beta1.ImportAdminOverridesRequest"; value: Uint8Array; @@ -589,9 +511,6 @@ export interface ImportAdminOverridesResponse { /** The overrides that were created from the imported data. */ overrides: QuotaOverride[]; } -export interface ReactiveImportAdminOverridesResponse { - overrides: ComputedRef; -} export interface ImportAdminOverridesResponseProtoMsg { typeUrl: "/google.api.serviceusage.v1beta1.ImportAdminOverridesResponse"; value: Uint8Array; @@ -606,7 +525,6 @@ export interface ImportAdminOverridesResponseSDKType { * of LRO returned by ImportAdminOverrides. */ export interface ImportAdminOverridesMetadata {} -export interface ReactiveImportAdminOverridesMetadata {} export interface ImportAdminOverridesMetadataProtoMsg { typeUrl: "/google.api.serviceusage.v1beta1.ImportAdminOverridesMetadata"; value: Uint8Array; @@ -643,12 +561,6 @@ export interface CreateConsumerOverrideRequest { */ forceOnly: QuotaSafetyCheck[]; } -export interface ReactiveCreateConsumerOverrideRequest { - parent: ComputedRef; - override?: ComputedRef; - force: ComputedRef; - forceOnly: ComputedRef; -} export interface CreateConsumerOverrideRequestProtoMsg { typeUrl: "/google.api.serviceusage.v1beta1.CreateConsumerOverrideRequest"; value: Uint8Array; @@ -693,13 +605,6 @@ export interface UpdateConsumerOverrideRequest { */ forceOnly: QuotaSafetyCheck[]; } -export interface ReactiveUpdateConsumerOverrideRequest { - name: ComputedRef; - override?: ComputedRef; - force: ComputedRef; - updateMask?: ComputedRef; - forceOnly: ComputedRef; -} export interface UpdateConsumerOverrideRequestProtoMsg { typeUrl: "/google.api.serviceusage.v1beta1.UpdateConsumerOverrideRequest"; value: Uint8Array; @@ -735,11 +640,6 @@ export interface DeleteConsumerOverrideRequest { */ forceOnly: QuotaSafetyCheck[]; } -export interface ReactiveDeleteConsumerOverrideRequest { - name: ComputedRef; - force: ComputedRef; - forceOnly: ComputedRef; -} export interface DeleteConsumerOverrideRequestProtoMsg { typeUrl: "/google.api.serviceusage.v1beta1.DeleteConsumerOverrideRequest"; value: Uint8Array; @@ -768,11 +668,6 @@ export interface ListConsumerOverridesRequest { */ pageToken: string; } -export interface ReactiveListConsumerOverridesRequest { - parent: ComputedRef; - pageSize: ComputedRef; - pageToken: ComputedRef; -} export interface ListConsumerOverridesRequestProtoMsg { typeUrl: "/google.api.serviceusage.v1beta1.ListConsumerOverridesRequest"; value: Uint8Array; @@ -793,10 +688,6 @@ export interface ListConsumerOverridesResponse { */ nextPageToken: string; } -export interface ReactiveListConsumerOverridesResponse { - overrides: ComputedRef; - nextPageToken: ComputedRef; -} export interface ListConsumerOverridesResponseProtoMsg { typeUrl: "/google.api.serviceusage.v1beta1.ListConsumerOverridesResponse"; value: Uint8Array; @@ -811,9 +702,6 @@ export interface BatchCreateConsumerOverridesResponse { /** The overrides that were created. */ overrides: QuotaOverride[]; } -export interface ReactiveBatchCreateConsumerOverridesResponse { - overrides: ComputedRef; -} export interface BatchCreateConsumerOverridesResponseProtoMsg { typeUrl: "/google.api.serviceusage.v1beta1.BatchCreateConsumerOverridesResponse"; value: Uint8Array; @@ -847,12 +735,6 @@ export interface ImportConsumerOverridesRequest { */ forceOnly: QuotaSafetyCheck[]; } -export interface ReactiveImportConsumerOverridesRequest { - parent: ComputedRef; - inlineSource?: ComputedRef; - force: ComputedRef; - forceOnly: ComputedRef; -} export interface ImportConsumerOverridesRequestProtoMsg { typeUrl: "/google.api.serviceusage.v1beta1.ImportConsumerOverridesRequest"; value: Uint8Array; @@ -869,9 +751,6 @@ export interface ImportConsumerOverridesResponse { /** The overrides that were created from the imported data. */ overrides: QuotaOverride[]; } -export interface ReactiveImportConsumerOverridesResponse { - overrides: ComputedRef; -} export interface ImportConsumerOverridesResponseProtoMsg { typeUrl: "/google.api.serviceusage.v1beta1.ImportConsumerOverridesResponse"; value: Uint8Array; @@ -886,7 +765,6 @@ export interface ImportConsumerOverridesResponseSDKType { * of LRO returned by ImportConsumerOverrides. */ export interface ImportConsumerOverridesMetadata {} -export interface ReactiveImportConsumerOverridesMetadata {} export interface ImportConsumerOverridesMetadataProtoMsg { typeUrl: "/google.api.serviceusage.v1beta1.ImportConsumerOverridesMetadata"; value: Uint8Array; @@ -902,9 +780,6 @@ export interface ImportAdminQuotaPoliciesResponse { /** The policies that were created from the imported data. */ policies: AdminQuotaPolicy[]; } -export interface ReactiveImportAdminQuotaPoliciesResponse { - policies: ComputedRef; -} export interface ImportAdminQuotaPoliciesResponseProtoMsg { typeUrl: "/google.api.serviceusage.v1beta1.ImportAdminQuotaPoliciesResponse"; value: Uint8Array; @@ -919,7 +794,6 @@ export interface ImportAdminQuotaPoliciesResponseSDKType { * of LRO returned by ImportAdminQuotaPolicies. */ export interface ImportAdminQuotaPoliciesMetadata {} -export interface ReactiveImportAdminQuotaPoliciesMetadata {} export interface ImportAdminQuotaPoliciesMetadataProtoMsg { typeUrl: "/google.api.serviceusage.v1beta1.ImportAdminQuotaPoliciesMetadata"; value: Uint8Array; @@ -936,7 +810,6 @@ export interface ImportAdminQuotaPoliciesMetadataSDKType {} * of LRO returned by CreateAdminQuotaPolicy. */ export interface CreateAdminQuotaPolicyMetadata {} -export interface ReactiveCreateAdminQuotaPolicyMetadata {} export interface CreateAdminQuotaPolicyMetadataProtoMsg { typeUrl: "/google.api.serviceusage.v1beta1.CreateAdminQuotaPolicyMetadata"; value: Uint8Array; @@ -953,7 +826,6 @@ export interface CreateAdminQuotaPolicyMetadataSDKType {} * of LRO returned by UpdateAdminQuotaPolicy. */ export interface UpdateAdminQuotaPolicyMetadata {} -export interface ReactiveUpdateAdminQuotaPolicyMetadata {} export interface UpdateAdminQuotaPolicyMetadataProtoMsg { typeUrl: "/google.api.serviceusage.v1beta1.UpdateAdminQuotaPolicyMetadata"; value: Uint8Array; @@ -970,7 +842,6 @@ export interface UpdateAdminQuotaPolicyMetadataSDKType {} * of LRO returned by DeleteAdminQuotaPolicy. */ export interface DeleteAdminQuotaPolicyMetadata {} -export interface ReactiveDeleteAdminQuotaPolicyMetadata {} export interface DeleteAdminQuotaPolicyMetadataProtoMsg { typeUrl: "/google.api.serviceusage.v1beta1.DeleteAdminQuotaPolicyMetadata"; value: Uint8Array; @@ -994,9 +865,6 @@ export interface GenerateServiceIdentityRequest { */ parent: string; } -export interface ReactiveGenerateServiceIdentityRequest { - parent: ComputedRef; -} export interface GenerateServiceIdentityRequestProtoMsg { typeUrl: "/google.api.serviceusage.v1beta1.GenerateServiceIdentityRequest"; value: Uint8Array; @@ -1016,10 +884,6 @@ export interface GetServiceIdentityResponse { /** Service identity state. */ state: GetServiceIdentityResponse_IdentityState; } -export interface ReactiveGetServiceIdentityResponse { - identity?: ComputedRef; - state: ComputedRef; -} export interface GetServiceIdentityResponseProtoMsg { typeUrl: "/google.api.serviceusage.v1beta1.GetServiceIdentityResponse"; value: Uint8Array; @@ -1031,7 +895,6 @@ export interface GetServiceIdentityResponseSDKType { } /** Metadata for the `GetServiceIdentity` method. */ export interface GetServiceIdentityMetadata {} -export interface ReactiveGetServiceIdentityMetadata {} export interface GetServiceIdentityMetadataProtoMsg { typeUrl: "/google.api.serviceusage.v1beta1.GetServiceIdentityMetadata"; value: Uint8Array; @@ -1046,7 +909,7 @@ function createBaseEnableServiceRequest(): EnableServiceRequest { export const EnableServiceRequest = { typeUrl: "/google.api.serviceusage.v1beta1.EnableServiceRequest", encode(message: EnableServiceRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.name !== "") { + if (message.name !== undefined) { writer.uint32(10).string(message.name); } return writer; @@ -1069,9 +932,9 @@ export const EnableServiceRequest = { return message; }, fromJSON(object: any): EnableServiceRequest { - return { - name: isSet(object.name) ? String(object.name) : "" - }; + const obj = createBaseEnableServiceRequest(); + if (isSet(object.name)) obj.name = String(object.name); + return obj; }, toJSON(message: EnableServiceRequest): JsonSafe { const obj: any = {}; @@ -1134,7 +997,7 @@ function createBaseDisableServiceRequest(): DisableServiceRequest { export const DisableServiceRequest = { typeUrl: "/google.api.serviceusage.v1beta1.DisableServiceRequest", encode(message: DisableServiceRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.name !== "") { + if (message.name !== undefined) { writer.uint32(10).string(message.name); } return writer; @@ -1157,9 +1020,9 @@ export const DisableServiceRequest = { return message; }, fromJSON(object: any): DisableServiceRequest { - return { - name: isSet(object.name) ? String(object.name) : "" - }; + const obj = createBaseDisableServiceRequest(); + if (isSet(object.name)) obj.name = String(object.name); + return obj; }, toJSON(message: DisableServiceRequest): JsonSafe { const obj: any = {}; @@ -1222,7 +1085,7 @@ function createBaseGetServiceRequest(): GetServiceRequest { export const GetServiceRequest = { typeUrl: "/google.api.serviceusage.v1beta1.GetServiceRequest", encode(message: GetServiceRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.name !== "") { + if (message.name !== undefined) { writer.uint32(10).string(message.name); } return writer; @@ -1245,9 +1108,9 @@ export const GetServiceRequest = { return message; }, fromJSON(object: any): GetServiceRequest { - return { - name: isSet(object.name) ? String(object.name) : "" - }; + const obj = createBaseGetServiceRequest(); + if (isSet(object.name)) obj.name = String(object.name); + return obj; }, toJSON(message: GetServiceRequest): JsonSafe { const obj: any = {}; @@ -1313,16 +1176,16 @@ function createBaseListServicesRequest(): ListServicesRequest { export const ListServicesRequest = { typeUrl: "/google.api.serviceusage.v1beta1.ListServicesRequest", encode(message: ListServicesRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.parent !== "") { + if (message.parent !== undefined) { writer.uint32(10).string(message.parent); } - if (message.pageSize !== 0) { + if (message.pageSize !== undefined) { writer.uint32(16).int32(message.pageSize); } - if (message.pageToken !== "") { + if (message.pageToken !== undefined) { writer.uint32(26).string(message.pageToken); } - if (message.filter !== "") { + if (message.filter !== undefined) { writer.uint32(34).string(message.filter); } return writer; @@ -1354,12 +1217,12 @@ export const ListServicesRequest = { return message; }, fromJSON(object: any): ListServicesRequest { - return { - parent: isSet(object.parent) ? String(object.parent) : "", - pageSize: isSet(object.pageSize) ? Number(object.pageSize) : 0, - pageToken: isSet(object.pageToken) ? String(object.pageToken) : "", - filter: isSet(object.filter) ? String(object.filter) : "" - }; + const obj = createBaseListServicesRequest(); + if (isSet(object.parent)) obj.parent = String(object.parent); + if (isSet(object.pageSize)) obj.pageSize = Number(object.pageSize); + if (isSet(object.pageToken)) obj.pageToken = String(object.pageToken); + if (isSet(object.filter)) obj.filter = String(object.filter); + return obj; }, toJSON(message: ListServicesRequest): JsonSafe { const obj: any = {}; @@ -1453,7 +1316,7 @@ export const ListServicesResponse = { for (const v of message.services) { Service.encode(v!, writer.uint32(10).fork()).ldelim(); } - if (message.nextPageToken !== "") { + if (message.nextPageToken !== undefined) { writer.uint32(18).string(message.nextPageToken); } return writer; @@ -1479,10 +1342,10 @@ export const ListServicesResponse = { return message; }, fromJSON(object: any): ListServicesResponse { - return { - services: Array.isArray(object?.services) ? object.services.map((e: any) => Service.fromJSON(e)) : [], - nextPageToken: isSet(object.nextPageToken) ? String(object.nextPageToken) : "" - }; + const obj = createBaseListServicesResponse(); + if (Array.isArray(object?.services)) obj.services = object.services.map((e: any) => Service.fromJSON(e)); + if (isSet(object.nextPageToken)) obj.nextPageToken = String(object.nextPageToken); + return obj; }, toJSON(message: ListServicesResponse): JsonSafe { const obj: any = {}; @@ -1565,7 +1428,7 @@ function createBaseBatchEnableServicesRequest(): BatchEnableServicesRequest { export const BatchEnableServicesRequest = { typeUrl: "/google.api.serviceusage.v1beta1.BatchEnableServicesRequest", encode(message: BatchEnableServicesRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.parent !== "") { + if (message.parent !== undefined) { writer.uint32(10).string(message.parent); } for (const v of message.serviceIds) { @@ -1594,10 +1457,10 @@ export const BatchEnableServicesRequest = { return message; }, fromJSON(object: any): BatchEnableServicesRequest { - return { - parent: isSet(object.parent) ? String(object.parent) : "", - serviceIds: Array.isArray(object?.serviceIds) ? object.serviceIds.map((e: any) => String(e)) : [] - }; + const obj = createBaseBatchEnableServicesRequest(); + if (isSet(object.parent)) obj.parent = String(object.parent); + if (Array.isArray(object?.serviceIds)) obj.serviceIds = object.serviceIds.map((e: any) => String(e)); + return obj; }, toJSON(message: BatchEnableServicesRequest): JsonSafe { const obj: any = {}; @@ -1682,13 +1545,13 @@ function createBaseListConsumerQuotaMetricsRequest(): ListConsumerQuotaMetricsRe export const ListConsumerQuotaMetricsRequest = { typeUrl: "/google.api.serviceusage.v1beta1.ListConsumerQuotaMetricsRequest", encode(message: ListConsumerQuotaMetricsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.parent !== "") { + if (message.parent !== undefined) { writer.uint32(10).string(message.parent); } - if (message.pageSize !== 0) { + if (message.pageSize !== undefined) { writer.uint32(16).int32(message.pageSize); } - if (message.pageToken !== "") { + if (message.pageToken !== undefined) { writer.uint32(26).string(message.pageToken); } if (message.view !== 0) { @@ -1723,12 +1586,12 @@ export const ListConsumerQuotaMetricsRequest = { return message; }, fromJSON(object: any): ListConsumerQuotaMetricsRequest { - return { - parent: isSet(object.parent) ? String(object.parent) : "", - pageSize: isSet(object.pageSize) ? Number(object.pageSize) : 0, - pageToken: isSet(object.pageToken) ? String(object.pageToken) : "", - view: isSet(object.view) ? quotaViewFromJSON(object.view) : -1 - }; + const obj = createBaseListConsumerQuotaMetricsRequest(); + if (isSet(object.parent)) obj.parent = String(object.parent); + if (isSet(object.pageSize)) obj.pageSize = Number(object.pageSize); + if (isSet(object.pageToken)) obj.pageToken = String(object.pageToken); + if (isSet(object.view)) obj.view = quotaViewFromJSON(object.view); + return obj; }, toJSON(message: ListConsumerQuotaMetricsRequest): JsonSafe { const obj: any = {}; @@ -1822,7 +1685,7 @@ export const ListConsumerQuotaMetricsResponse = { for (const v of message.metrics) { ConsumerQuotaMetric.encode(v!, writer.uint32(10).fork()).ldelim(); } - if (message.nextPageToken !== "") { + if (message.nextPageToken !== undefined) { writer.uint32(18).string(message.nextPageToken); } return writer; @@ -1848,10 +1711,10 @@ export const ListConsumerQuotaMetricsResponse = { return message; }, fromJSON(object: any): ListConsumerQuotaMetricsResponse { - return { - metrics: Array.isArray(object?.metrics) ? object.metrics.map((e: any) => ConsumerQuotaMetric.fromJSON(e)) : [], - nextPageToken: isSet(object.nextPageToken) ? String(object.nextPageToken) : "" - }; + const obj = createBaseListConsumerQuotaMetricsResponse(); + if (Array.isArray(object?.metrics)) obj.metrics = object.metrics.map((e: any) => ConsumerQuotaMetric.fromJSON(e)); + if (isSet(object.nextPageToken)) obj.nextPageToken = String(object.nextPageToken); + return obj; }, toJSON(message: ListConsumerQuotaMetricsResponse): JsonSafe { const obj: any = {}; @@ -1934,7 +1797,7 @@ function createBaseGetConsumerQuotaMetricRequest(): GetConsumerQuotaMetricReques export const GetConsumerQuotaMetricRequest = { typeUrl: "/google.api.serviceusage.v1beta1.GetConsumerQuotaMetricRequest", encode(message: GetConsumerQuotaMetricRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.name !== "") { + if (message.name !== undefined) { writer.uint32(10).string(message.name); } if (message.view !== 0) { @@ -1963,10 +1826,10 @@ export const GetConsumerQuotaMetricRequest = { return message; }, fromJSON(object: any): GetConsumerQuotaMetricRequest { - return { - name: isSet(object.name) ? String(object.name) : "", - view: isSet(object.view) ? quotaViewFromJSON(object.view) : -1 - }; + const obj = createBaseGetConsumerQuotaMetricRequest(); + if (isSet(object.name)) obj.name = String(object.name); + if (isSet(object.view)) obj.view = quotaViewFromJSON(object.view); + return obj; }, toJSON(message: GetConsumerQuotaMetricRequest): JsonSafe { const obj: any = {}; @@ -2039,7 +1902,7 @@ function createBaseGetConsumerQuotaLimitRequest(): GetConsumerQuotaLimitRequest export const GetConsumerQuotaLimitRequest = { typeUrl: "/google.api.serviceusage.v1beta1.GetConsumerQuotaLimitRequest", encode(message: GetConsumerQuotaLimitRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.name !== "") { + if (message.name !== undefined) { writer.uint32(10).string(message.name); } if (message.view !== 0) { @@ -2068,10 +1931,10 @@ export const GetConsumerQuotaLimitRequest = { return message; }, fromJSON(object: any): GetConsumerQuotaLimitRequest { - return { - name: isSet(object.name) ? String(object.name) : "", - view: isSet(object.view) ? quotaViewFromJSON(object.view) : -1 - }; + const obj = createBaseGetConsumerQuotaLimitRequest(); + if (isSet(object.name)) obj.name = String(object.name); + if (isSet(object.view)) obj.view = quotaViewFromJSON(object.view); + return obj; }, toJSON(message: GetConsumerQuotaLimitRequest): JsonSafe { const obj: any = {}; @@ -2146,13 +2009,13 @@ function createBaseCreateAdminOverrideRequest(): CreateAdminOverrideRequest { export const CreateAdminOverrideRequest = { typeUrl: "/google.api.serviceusage.v1beta1.CreateAdminOverrideRequest", encode(message: CreateAdminOverrideRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.parent !== "") { + if (message.parent !== undefined) { writer.uint32(10).string(message.parent); } if (message.override !== undefined) { QuotaOverride.encode(message.override, writer.uint32(18).fork()).ldelim(); } - if (message.force === true) { + if (message.force !== undefined) { writer.uint32(24).bool(message.force); } writer.uint32(34).fork(); @@ -2196,12 +2059,12 @@ export const CreateAdminOverrideRequest = { return message; }, fromJSON(object: any): CreateAdminOverrideRequest { - return { - parent: isSet(object.parent) ? String(object.parent) : "", - override: isSet(object.override) ? QuotaOverride.fromJSON(object.override) : undefined, - force: isSet(object.force) ? Boolean(object.force) : false, - forceOnly: Array.isArray(object?.forceOnly) ? object.forceOnly.map((e: any) => quotaSafetyCheckFromJSON(e)) : [] - }; + const obj = createBaseCreateAdminOverrideRequest(); + if (isSet(object.parent)) obj.parent = String(object.parent); + if (isSet(object.override)) obj.override = QuotaOverride.fromJSON(object.override); + if (isSet(object.force)) obj.force = Boolean(object.force); + if (Array.isArray(object?.forceOnly)) obj.forceOnly = object.forceOnly.map((e: any) => quotaSafetyCheckFromJSON(e)); + return obj; }, toJSON(message: CreateAdminOverrideRequest): JsonSafe { const obj: any = {}; @@ -2218,7 +2081,9 @@ export const CreateAdminOverrideRequest = { fromPartial(object: DeepPartial): CreateAdminOverrideRequest { const message = createBaseCreateAdminOverrideRequest(); message.parent = object.parent ?? ""; - message.override = object.override !== undefined && object.override !== null ? QuotaOverride.fromPartial(object.override) : undefined; + if (object.override !== undefined && object.override !== null) { + message.override = QuotaOverride.fromPartial(object.override); + } message.force = object.force ?? false; message.forceOnly = object.forceOnly?.map(e => e) || []; return message; @@ -2305,13 +2170,13 @@ function createBaseUpdateAdminOverrideRequest(): UpdateAdminOverrideRequest { export const UpdateAdminOverrideRequest = { typeUrl: "/google.api.serviceusage.v1beta1.UpdateAdminOverrideRequest", encode(message: UpdateAdminOverrideRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.name !== "") { + if (message.name !== undefined) { writer.uint32(10).string(message.name); } if (message.override !== undefined) { QuotaOverride.encode(message.override, writer.uint32(18).fork()).ldelim(); } - if (message.force === true) { + if (message.force !== undefined) { writer.uint32(24).bool(message.force); } if (message.updateMask !== undefined) { @@ -2361,13 +2226,13 @@ export const UpdateAdminOverrideRequest = { return message; }, fromJSON(object: any): UpdateAdminOverrideRequest { - return { - name: isSet(object.name) ? String(object.name) : "", - override: isSet(object.override) ? QuotaOverride.fromJSON(object.override) : undefined, - force: isSet(object.force) ? Boolean(object.force) : false, - updateMask: isSet(object.updateMask) ? FieldMask.fromJSON(object.updateMask) : undefined, - forceOnly: Array.isArray(object?.forceOnly) ? object.forceOnly.map((e: any) => quotaSafetyCheckFromJSON(e)) : [] - }; + const obj = createBaseUpdateAdminOverrideRequest(); + if (isSet(object.name)) obj.name = String(object.name); + if (isSet(object.override)) obj.override = QuotaOverride.fromJSON(object.override); + if (isSet(object.force)) obj.force = Boolean(object.force); + if (isSet(object.updateMask)) obj.updateMask = FieldMask.fromJSON(object.updateMask); + if (Array.isArray(object?.forceOnly)) obj.forceOnly = object.forceOnly.map((e: any) => quotaSafetyCheckFromJSON(e)); + return obj; }, toJSON(message: UpdateAdminOverrideRequest): JsonSafe { const obj: any = {}; @@ -2385,9 +2250,13 @@ export const UpdateAdminOverrideRequest = { fromPartial(object: DeepPartial): UpdateAdminOverrideRequest { const message = createBaseUpdateAdminOverrideRequest(); message.name = object.name ?? ""; - message.override = object.override !== undefined && object.override !== null ? QuotaOverride.fromPartial(object.override) : undefined; + if (object.override !== undefined && object.override !== null) { + message.override = QuotaOverride.fromPartial(object.override); + } message.force = object.force ?? false; - message.updateMask = object.updateMask !== undefined && object.updateMask !== null ? FieldMask.fromPartial(object.updateMask) : undefined; + if (object.updateMask !== undefined && object.updateMask !== null) { + message.updateMask = FieldMask.fromPartial(object.updateMask); + } message.forceOnly = object.forceOnly?.map(e => e) || []; return message; }, @@ -2478,10 +2347,10 @@ function createBaseDeleteAdminOverrideRequest(): DeleteAdminOverrideRequest { export const DeleteAdminOverrideRequest = { typeUrl: "/google.api.serviceusage.v1beta1.DeleteAdminOverrideRequest", encode(message: DeleteAdminOverrideRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.name !== "") { + if (message.name !== undefined) { writer.uint32(10).string(message.name); } - if (message.force === true) { + if (message.force !== undefined) { writer.uint32(16).bool(message.force); } writer.uint32(26).fork(); @@ -2522,11 +2391,11 @@ export const DeleteAdminOverrideRequest = { return message; }, fromJSON(object: any): DeleteAdminOverrideRequest { - return { - name: isSet(object.name) ? String(object.name) : "", - force: isSet(object.force) ? Boolean(object.force) : false, - forceOnly: Array.isArray(object?.forceOnly) ? object.forceOnly.map((e: any) => quotaSafetyCheckFromJSON(e)) : [] - }; + const obj = createBaseDeleteAdminOverrideRequest(); + if (isSet(object.name)) obj.name = String(object.name); + if (isSet(object.force)) obj.force = Boolean(object.force); + if (Array.isArray(object?.forceOnly)) obj.forceOnly = object.forceOnly.map((e: any) => quotaSafetyCheckFromJSON(e)); + return obj; }, toJSON(message: DeleteAdminOverrideRequest): JsonSafe { const obj: any = {}; @@ -2619,13 +2488,13 @@ function createBaseListAdminOverridesRequest(): ListAdminOverridesRequest { export const ListAdminOverridesRequest = { typeUrl: "/google.api.serviceusage.v1beta1.ListAdminOverridesRequest", encode(message: ListAdminOverridesRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.parent !== "") { + if (message.parent !== undefined) { writer.uint32(10).string(message.parent); } - if (message.pageSize !== 0) { + if (message.pageSize !== undefined) { writer.uint32(16).int32(message.pageSize); } - if (message.pageToken !== "") { + if (message.pageToken !== undefined) { writer.uint32(26).string(message.pageToken); } return writer; @@ -2654,11 +2523,11 @@ export const ListAdminOverridesRequest = { return message; }, fromJSON(object: any): ListAdminOverridesRequest { - return { - parent: isSet(object.parent) ? String(object.parent) : "", - pageSize: isSet(object.pageSize) ? Number(object.pageSize) : 0, - pageToken: isSet(object.pageToken) ? String(object.pageToken) : "" - }; + const obj = createBaseListAdminOverridesRequest(); + if (isSet(object.parent)) obj.parent = String(object.parent); + if (isSet(object.pageSize)) obj.pageSize = Number(object.pageSize); + if (isSet(object.pageToken)) obj.pageToken = String(object.pageToken); + return obj; }, toJSON(message: ListAdminOverridesRequest): JsonSafe { const obj: any = {}; @@ -2743,7 +2612,7 @@ export const ListAdminOverridesResponse = { for (const v of message.overrides) { QuotaOverride.encode(v!, writer.uint32(10).fork()).ldelim(); } - if (message.nextPageToken !== "") { + if (message.nextPageToken !== undefined) { writer.uint32(18).string(message.nextPageToken); } return writer; @@ -2769,10 +2638,10 @@ export const ListAdminOverridesResponse = { return message; }, fromJSON(object: any): ListAdminOverridesResponse { - return { - overrides: Array.isArray(object?.overrides) ? object.overrides.map((e: any) => QuotaOverride.fromJSON(e)) : [], - nextPageToken: isSet(object.nextPageToken) ? String(object.nextPageToken) : "" - }; + const obj = createBaseListAdminOverridesResponse(); + if (Array.isArray(object?.overrides)) obj.overrides = object.overrides.map((e: any) => QuotaOverride.fromJSON(e)); + if (isSet(object.nextPageToken)) obj.nextPageToken = String(object.nextPageToken); + return obj; }, toJSON(message: ListAdminOverridesResponse): JsonSafe { const obj: any = {}; @@ -2877,9 +2746,9 @@ export const BatchCreateAdminOverridesResponse = { return message; }, fromJSON(object: any): BatchCreateAdminOverridesResponse { - return { - overrides: Array.isArray(object?.overrides) ? object.overrides.map((e: any) => QuotaOverride.fromJSON(e)) : [] - }; + const obj = createBaseBatchCreateAdminOverridesResponse(); + if (Array.isArray(object?.overrides)) obj.overrides = object.overrides.map((e: any) => QuotaOverride.fromJSON(e)); + return obj; }, toJSON(message: BatchCreateAdminOverridesResponse): JsonSafe { const obj: any = {}; @@ -2955,13 +2824,13 @@ function createBaseImportAdminOverridesRequest(): ImportAdminOverridesRequest { export const ImportAdminOverridesRequest = { typeUrl: "/google.api.serviceusage.v1beta1.ImportAdminOverridesRequest", encode(message: ImportAdminOverridesRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.parent !== "") { + if (message.parent !== undefined) { writer.uint32(10).string(message.parent); } if (message.inlineSource !== undefined) { OverrideInlineSource.encode(message.inlineSource, writer.uint32(18).fork()).ldelim(); } - if (message.force === true) { + if (message.force !== undefined) { writer.uint32(24).bool(message.force); } writer.uint32(34).fork(); @@ -3005,12 +2874,12 @@ export const ImportAdminOverridesRequest = { return message; }, fromJSON(object: any): ImportAdminOverridesRequest { - return { - parent: isSet(object.parent) ? String(object.parent) : "", - inlineSource: isSet(object.inlineSource) ? OverrideInlineSource.fromJSON(object.inlineSource) : undefined, - force: isSet(object.force) ? Boolean(object.force) : false, - forceOnly: Array.isArray(object?.forceOnly) ? object.forceOnly.map((e: any) => quotaSafetyCheckFromJSON(e)) : [] - }; + const obj = createBaseImportAdminOverridesRequest(); + if (isSet(object.parent)) obj.parent = String(object.parent); + if (isSet(object.inlineSource)) obj.inlineSource = OverrideInlineSource.fromJSON(object.inlineSource); + if (isSet(object.force)) obj.force = Boolean(object.force); + if (Array.isArray(object?.forceOnly)) obj.forceOnly = object.forceOnly.map((e: any) => quotaSafetyCheckFromJSON(e)); + return obj; }, toJSON(message: ImportAdminOverridesRequest): JsonSafe { const obj: any = {}; @@ -3027,7 +2896,9 @@ export const ImportAdminOverridesRequest = { fromPartial(object: DeepPartial): ImportAdminOverridesRequest { const message = createBaseImportAdminOverridesRequest(); message.parent = object.parent ?? ""; - message.inlineSource = object.inlineSource !== undefined && object.inlineSource !== null ? OverrideInlineSource.fromPartial(object.inlineSource) : undefined; + if (object.inlineSource !== undefined && object.inlineSource !== null) { + message.inlineSource = OverrideInlineSource.fromPartial(object.inlineSource); + } message.force = object.force ?? false; message.forceOnly = object.forceOnly?.map(e => e) || []; return message; @@ -3133,9 +3004,9 @@ export const ImportAdminOverridesResponse = { return message; }, fromJSON(object: any): ImportAdminOverridesResponse { - return { - overrides: Array.isArray(object?.overrides) ? object.overrides.map((e: any) => QuotaOverride.fromJSON(e)) : [] - }; + const obj = createBaseImportAdminOverridesResponse(); + if (Array.isArray(object?.overrides)) obj.overrides = object.overrides.map((e: any) => QuotaOverride.fromJSON(e)); + return obj; }, toJSON(message: ImportAdminOverridesResponse): JsonSafe { const obj: any = {}; @@ -3223,7 +3094,8 @@ export const ImportAdminOverridesMetadata = { return message; }, fromJSON(_: any): ImportAdminOverridesMetadata { - return {}; + const obj = createBaseImportAdminOverridesMetadata(); + return obj; }, toJSON(_: ImportAdminOverridesMetadata): JsonSafe { const obj: any = {}; @@ -3278,13 +3150,13 @@ function createBaseCreateConsumerOverrideRequest(): CreateConsumerOverrideReques export const CreateConsumerOverrideRequest = { typeUrl: "/google.api.serviceusage.v1beta1.CreateConsumerOverrideRequest", encode(message: CreateConsumerOverrideRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.parent !== "") { + if (message.parent !== undefined) { writer.uint32(10).string(message.parent); } if (message.override !== undefined) { QuotaOverride.encode(message.override, writer.uint32(18).fork()).ldelim(); } - if (message.force === true) { + if (message.force !== undefined) { writer.uint32(24).bool(message.force); } writer.uint32(34).fork(); @@ -3328,12 +3200,12 @@ export const CreateConsumerOverrideRequest = { return message; }, fromJSON(object: any): CreateConsumerOverrideRequest { - return { - parent: isSet(object.parent) ? String(object.parent) : "", - override: isSet(object.override) ? QuotaOverride.fromJSON(object.override) : undefined, - force: isSet(object.force) ? Boolean(object.force) : false, - forceOnly: Array.isArray(object?.forceOnly) ? object.forceOnly.map((e: any) => quotaSafetyCheckFromJSON(e)) : [] - }; + const obj = createBaseCreateConsumerOverrideRequest(); + if (isSet(object.parent)) obj.parent = String(object.parent); + if (isSet(object.override)) obj.override = QuotaOverride.fromJSON(object.override); + if (isSet(object.force)) obj.force = Boolean(object.force); + if (Array.isArray(object?.forceOnly)) obj.forceOnly = object.forceOnly.map((e: any) => quotaSafetyCheckFromJSON(e)); + return obj; }, toJSON(message: CreateConsumerOverrideRequest): JsonSafe { const obj: any = {}; @@ -3350,7 +3222,9 @@ export const CreateConsumerOverrideRequest = { fromPartial(object: DeepPartial): CreateConsumerOverrideRequest { const message = createBaseCreateConsumerOverrideRequest(); message.parent = object.parent ?? ""; - message.override = object.override !== undefined && object.override !== null ? QuotaOverride.fromPartial(object.override) : undefined; + if (object.override !== undefined && object.override !== null) { + message.override = QuotaOverride.fromPartial(object.override); + } message.force = object.force ?? false; message.forceOnly = object.forceOnly?.map(e => e) || []; return message; @@ -3437,13 +3311,13 @@ function createBaseUpdateConsumerOverrideRequest(): UpdateConsumerOverrideReques export const UpdateConsumerOverrideRequest = { typeUrl: "/google.api.serviceusage.v1beta1.UpdateConsumerOverrideRequest", encode(message: UpdateConsumerOverrideRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.name !== "") { + if (message.name !== undefined) { writer.uint32(10).string(message.name); } if (message.override !== undefined) { QuotaOverride.encode(message.override, writer.uint32(18).fork()).ldelim(); } - if (message.force === true) { + if (message.force !== undefined) { writer.uint32(24).bool(message.force); } if (message.updateMask !== undefined) { @@ -3493,13 +3367,13 @@ export const UpdateConsumerOverrideRequest = { return message; }, fromJSON(object: any): UpdateConsumerOverrideRequest { - return { - name: isSet(object.name) ? String(object.name) : "", - override: isSet(object.override) ? QuotaOverride.fromJSON(object.override) : undefined, - force: isSet(object.force) ? Boolean(object.force) : false, - updateMask: isSet(object.updateMask) ? FieldMask.fromJSON(object.updateMask) : undefined, - forceOnly: Array.isArray(object?.forceOnly) ? object.forceOnly.map((e: any) => quotaSafetyCheckFromJSON(e)) : [] - }; + const obj = createBaseUpdateConsumerOverrideRequest(); + if (isSet(object.name)) obj.name = String(object.name); + if (isSet(object.override)) obj.override = QuotaOverride.fromJSON(object.override); + if (isSet(object.force)) obj.force = Boolean(object.force); + if (isSet(object.updateMask)) obj.updateMask = FieldMask.fromJSON(object.updateMask); + if (Array.isArray(object?.forceOnly)) obj.forceOnly = object.forceOnly.map((e: any) => quotaSafetyCheckFromJSON(e)); + return obj; }, toJSON(message: UpdateConsumerOverrideRequest): JsonSafe { const obj: any = {}; @@ -3517,9 +3391,13 @@ export const UpdateConsumerOverrideRequest = { fromPartial(object: DeepPartial): UpdateConsumerOverrideRequest { const message = createBaseUpdateConsumerOverrideRequest(); message.name = object.name ?? ""; - message.override = object.override !== undefined && object.override !== null ? QuotaOverride.fromPartial(object.override) : undefined; + if (object.override !== undefined && object.override !== null) { + message.override = QuotaOverride.fromPartial(object.override); + } message.force = object.force ?? false; - message.updateMask = object.updateMask !== undefined && object.updateMask !== null ? FieldMask.fromPartial(object.updateMask) : undefined; + if (object.updateMask !== undefined && object.updateMask !== null) { + message.updateMask = FieldMask.fromPartial(object.updateMask); + } message.forceOnly = object.forceOnly?.map(e => e) || []; return message; }, @@ -3610,10 +3488,10 @@ function createBaseDeleteConsumerOverrideRequest(): DeleteConsumerOverrideReques export const DeleteConsumerOverrideRequest = { typeUrl: "/google.api.serviceusage.v1beta1.DeleteConsumerOverrideRequest", encode(message: DeleteConsumerOverrideRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.name !== "") { + if (message.name !== undefined) { writer.uint32(10).string(message.name); } - if (message.force === true) { + if (message.force !== undefined) { writer.uint32(16).bool(message.force); } writer.uint32(26).fork(); @@ -3654,11 +3532,11 @@ export const DeleteConsumerOverrideRequest = { return message; }, fromJSON(object: any): DeleteConsumerOverrideRequest { - return { - name: isSet(object.name) ? String(object.name) : "", - force: isSet(object.force) ? Boolean(object.force) : false, - forceOnly: Array.isArray(object?.forceOnly) ? object.forceOnly.map((e: any) => quotaSafetyCheckFromJSON(e)) : [] - }; + const obj = createBaseDeleteConsumerOverrideRequest(); + if (isSet(object.name)) obj.name = String(object.name); + if (isSet(object.force)) obj.force = Boolean(object.force); + if (Array.isArray(object?.forceOnly)) obj.forceOnly = object.forceOnly.map((e: any) => quotaSafetyCheckFromJSON(e)); + return obj; }, toJSON(message: DeleteConsumerOverrideRequest): JsonSafe { const obj: any = {}; @@ -3751,13 +3629,13 @@ function createBaseListConsumerOverridesRequest(): ListConsumerOverridesRequest export const ListConsumerOverridesRequest = { typeUrl: "/google.api.serviceusage.v1beta1.ListConsumerOverridesRequest", encode(message: ListConsumerOverridesRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.parent !== "") { + if (message.parent !== undefined) { writer.uint32(10).string(message.parent); } - if (message.pageSize !== 0) { + if (message.pageSize !== undefined) { writer.uint32(16).int32(message.pageSize); } - if (message.pageToken !== "") { + if (message.pageToken !== undefined) { writer.uint32(26).string(message.pageToken); } return writer; @@ -3786,11 +3664,11 @@ export const ListConsumerOverridesRequest = { return message; }, fromJSON(object: any): ListConsumerOverridesRequest { - return { - parent: isSet(object.parent) ? String(object.parent) : "", - pageSize: isSet(object.pageSize) ? Number(object.pageSize) : 0, - pageToken: isSet(object.pageToken) ? String(object.pageToken) : "" - }; + const obj = createBaseListConsumerOverridesRequest(); + if (isSet(object.parent)) obj.parent = String(object.parent); + if (isSet(object.pageSize)) obj.pageSize = Number(object.pageSize); + if (isSet(object.pageToken)) obj.pageToken = String(object.pageToken); + return obj; }, toJSON(message: ListConsumerOverridesRequest): JsonSafe { const obj: any = {}; @@ -3875,7 +3753,7 @@ export const ListConsumerOverridesResponse = { for (const v of message.overrides) { QuotaOverride.encode(v!, writer.uint32(10).fork()).ldelim(); } - if (message.nextPageToken !== "") { + if (message.nextPageToken !== undefined) { writer.uint32(18).string(message.nextPageToken); } return writer; @@ -3901,10 +3779,10 @@ export const ListConsumerOverridesResponse = { return message; }, fromJSON(object: any): ListConsumerOverridesResponse { - return { - overrides: Array.isArray(object?.overrides) ? object.overrides.map((e: any) => QuotaOverride.fromJSON(e)) : [], - nextPageToken: isSet(object.nextPageToken) ? String(object.nextPageToken) : "" - }; + const obj = createBaseListConsumerOverridesResponse(); + if (Array.isArray(object?.overrides)) obj.overrides = object.overrides.map((e: any) => QuotaOverride.fromJSON(e)); + if (isSet(object.nextPageToken)) obj.nextPageToken = String(object.nextPageToken); + return obj; }, toJSON(message: ListConsumerOverridesResponse): JsonSafe { const obj: any = {}; @@ -4009,9 +3887,9 @@ export const BatchCreateConsumerOverridesResponse = { return message; }, fromJSON(object: any): BatchCreateConsumerOverridesResponse { - return { - overrides: Array.isArray(object?.overrides) ? object.overrides.map((e: any) => QuotaOverride.fromJSON(e)) : [] - }; + const obj = createBaseBatchCreateConsumerOverridesResponse(); + if (Array.isArray(object?.overrides)) obj.overrides = object.overrides.map((e: any) => QuotaOverride.fromJSON(e)); + return obj; }, toJSON(message: BatchCreateConsumerOverridesResponse): JsonSafe { const obj: any = {}; @@ -4087,13 +3965,13 @@ function createBaseImportConsumerOverridesRequest(): ImportConsumerOverridesRequ export const ImportConsumerOverridesRequest = { typeUrl: "/google.api.serviceusage.v1beta1.ImportConsumerOverridesRequest", encode(message: ImportConsumerOverridesRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.parent !== "") { + if (message.parent !== undefined) { writer.uint32(10).string(message.parent); } if (message.inlineSource !== undefined) { OverrideInlineSource.encode(message.inlineSource, writer.uint32(18).fork()).ldelim(); } - if (message.force === true) { + if (message.force !== undefined) { writer.uint32(24).bool(message.force); } writer.uint32(34).fork(); @@ -4137,12 +4015,12 @@ export const ImportConsumerOverridesRequest = { return message; }, fromJSON(object: any): ImportConsumerOverridesRequest { - return { - parent: isSet(object.parent) ? String(object.parent) : "", - inlineSource: isSet(object.inlineSource) ? OverrideInlineSource.fromJSON(object.inlineSource) : undefined, - force: isSet(object.force) ? Boolean(object.force) : false, - forceOnly: Array.isArray(object?.forceOnly) ? object.forceOnly.map((e: any) => quotaSafetyCheckFromJSON(e)) : [] - }; + const obj = createBaseImportConsumerOverridesRequest(); + if (isSet(object.parent)) obj.parent = String(object.parent); + if (isSet(object.inlineSource)) obj.inlineSource = OverrideInlineSource.fromJSON(object.inlineSource); + if (isSet(object.force)) obj.force = Boolean(object.force); + if (Array.isArray(object?.forceOnly)) obj.forceOnly = object.forceOnly.map((e: any) => quotaSafetyCheckFromJSON(e)); + return obj; }, toJSON(message: ImportConsumerOverridesRequest): JsonSafe { const obj: any = {}; @@ -4159,7 +4037,9 @@ export const ImportConsumerOverridesRequest = { fromPartial(object: DeepPartial): ImportConsumerOverridesRequest { const message = createBaseImportConsumerOverridesRequest(); message.parent = object.parent ?? ""; - message.inlineSource = object.inlineSource !== undefined && object.inlineSource !== null ? OverrideInlineSource.fromPartial(object.inlineSource) : undefined; + if (object.inlineSource !== undefined && object.inlineSource !== null) { + message.inlineSource = OverrideInlineSource.fromPartial(object.inlineSource); + } message.force = object.force ?? false; message.forceOnly = object.forceOnly?.map(e => e) || []; return message; @@ -4265,9 +4145,9 @@ export const ImportConsumerOverridesResponse = { return message; }, fromJSON(object: any): ImportConsumerOverridesResponse { - return { - overrides: Array.isArray(object?.overrides) ? object.overrides.map((e: any) => QuotaOverride.fromJSON(e)) : [] - }; + const obj = createBaseImportConsumerOverridesResponse(); + if (Array.isArray(object?.overrides)) obj.overrides = object.overrides.map((e: any) => QuotaOverride.fromJSON(e)); + return obj; }, toJSON(message: ImportConsumerOverridesResponse): JsonSafe { const obj: any = {}; @@ -4355,7 +4235,8 @@ export const ImportConsumerOverridesMetadata = { return message; }, fromJSON(_: any): ImportConsumerOverridesMetadata { - return {}; + const obj = createBaseImportConsumerOverridesMetadata(); + return obj; }, toJSON(_: ImportConsumerOverridesMetadata): JsonSafe { const obj: any = {}; @@ -4430,9 +4311,9 @@ export const ImportAdminQuotaPoliciesResponse = { return message; }, fromJSON(object: any): ImportAdminQuotaPoliciesResponse { - return { - policies: Array.isArray(object?.policies) ? object.policies.map((e: any) => AdminQuotaPolicy.fromJSON(e)) : [] - }; + const obj = createBaseImportAdminQuotaPoliciesResponse(); + if (Array.isArray(object?.policies)) obj.policies = object.policies.map((e: any) => AdminQuotaPolicy.fromJSON(e)); + return obj; }, toJSON(message: ImportAdminQuotaPoliciesResponse): JsonSafe { const obj: any = {}; @@ -4520,7 +4401,8 @@ export const ImportAdminQuotaPoliciesMetadata = { return message; }, fromJSON(_: any): ImportAdminQuotaPoliciesMetadata { - return {}; + const obj = createBaseImportAdminQuotaPoliciesMetadata(); + return obj; }, toJSON(_: ImportAdminQuotaPoliciesMetadata): JsonSafe { const obj: any = {}; @@ -4587,7 +4469,8 @@ export const CreateAdminQuotaPolicyMetadata = { return message; }, fromJSON(_: any): CreateAdminQuotaPolicyMetadata { - return {}; + const obj = createBaseCreateAdminQuotaPolicyMetadata(); + return obj; }, toJSON(_: CreateAdminQuotaPolicyMetadata): JsonSafe { const obj: any = {}; @@ -4654,7 +4537,8 @@ export const UpdateAdminQuotaPolicyMetadata = { return message; }, fromJSON(_: any): UpdateAdminQuotaPolicyMetadata { - return {}; + const obj = createBaseUpdateAdminQuotaPolicyMetadata(); + return obj; }, toJSON(_: UpdateAdminQuotaPolicyMetadata): JsonSafe { const obj: any = {}; @@ -4721,7 +4605,8 @@ export const DeleteAdminQuotaPolicyMetadata = { return message; }, fromJSON(_: any): DeleteAdminQuotaPolicyMetadata { - return {}; + const obj = createBaseDeleteAdminQuotaPolicyMetadata(); + return obj; }, toJSON(_: DeleteAdminQuotaPolicyMetadata): JsonSafe { const obj: any = {}; @@ -4773,7 +4658,7 @@ function createBaseGenerateServiceIdentityRequest(): GenerateServiceIdentityRequ export const GenerateServiceIdentityRequest = { typeUrl: "/google.api.serviceusage.v1beta1.GenerateServiceIdentityRequest", encode(message: GenerateServiceIdentityRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.parent !== "") { + if (message.parent !== undefined) { writer.uint32(10).string(message.parent); } return writer; @@ -4796,9 +4681,9 @@ export const GenerateServiceIdentityRequest = { return message; }, fromJSON(object: any): GenerateServiceIdentityRequest { - return { - parent: isSet(object.parent) ? String(object.parent) : "" - }; + const obj = createBaseGenerateServiceIdentityRequest(); + if (isSet(object.parent)) obj.parent = String(object.parent); + return obj; }, toJSON(message: GenerateServiceIdentityRequest): JsonSafe { const obj: any = {}; @@ -4891,10 +4776,10 @@ export const GetServiceIdentityResponse = { return message; }, fromJSON(object: any): GetServiceIdentityResponse { - return { - identity: isSet(object.identity) ? ServiceIdentity.fromJSON(object.identity) : undefined, - state: isSet(object.state) ? getServiceIdentityResponse_IdentityStateFromJSON(object.state) : -1 - }; + const obj = createBaseGetServiceIdentityResponse(); + if (isSet(object.identity)) obj.identity = ServiceIdentity.fromJSON(object.identity); + if (isSet(object.state)) obj.state = getServiceIdentityResponse_IdentityStateFromJSON(object.state); + return obj; }, toJSON(message: GetServiceIdentityResponse): JsonSafe { const obj: any = {}; @@ -4904,7 +4789,9 @@ export const GetServiceIdentityResponse = { }, fromPartial(object: DeepPartial): GetServiceIdentityResponse { const message = createBaseGetServiceIdentityResponse(); - message.identity = object.identity !== undefined && object.identity !== null ? ServiceIdentity.fromPartial(object.identity) : undefined; + if (object.identity !== undefined && object.identity !== null) { + message.identity = ServiceIdentity.fromPartial(object.identity); + } message.state = object.state ?? 0; return message; }, @@ -4981,7 +4868,8 @@ export const GetServiceIdentityMetadata = { return message; }, fromJSON(_: any): GetServiceIdentityMetadata { - return {}; + const obj = createBaseGetServiceIdentityMetadata(); + return obj; }, toJSON(_: GetServiceIdentityMetadata): JsonSafe { const obj: any = {}; diff --git a/__fixtures__/v-next/outputv4/google/api/source_info.ts b/__fixtures__/v-next/outputv4/google/api/source_info.ts index 26c05da9a6..9e80f57567 100644 --- a/__fixtures__/v-next/outputv4/google/api/source_info.ts +++ b/__fixtures__/v-next/outputv4/google/api/source_info.ts @@ -1,17 +1,13 @@ -import { Any, AnySDKType } from "../protobuf/any"; -import { BinaryReader, BinaryWriter } from "../../binary"; -import { JsonSafe } from "../../json-safe"; -import { DeepPartial } from "../../helpers"; -import { ComputedRef } from "vue"; +import { Any, AnySDKType } from "../protobuf/any.js"; +import { BinaryReader, BinaryWriter } from "../../binary.js"; +import { JsonSafe } from "../../json-safe.js"; +import { DeepPartial } from "../../helpers.js"; export const protobufPackage = "google.api"; /** Source information used to create a Service Config */ export interface SourceInfo { /** All files used during config generation. */ sourceFiles: Any[]; } -export interface ReactiveSourceInfo { - sourceFiles: ComputedRef; -} export interface SourceInfoProtoMsg { typeUrl: "/google.api.SourceInfo"; value: Uint8Array; @@ -51,9 +47,9 @@ export const SourceInfo = { return message; }, fromJSON(object: any): SourceInfo { - return { - sourceFiles: Array.isArray(object?.sourceFiles) ? object.sourceFiles.map((e: any) => Any.fromJSON(e)) : [] - }; + const obj = createBaseSourceInfo(); + if (Array.isArray(object?.sourceFiles)) obj.sourceFiles = object.sourceFiles.map((e: any) => Any.fromJSON(e)); + return obj; }, toJSON(message: SourceInfo): JsonSafe { const obj: any = {}; diff --git a/__fixtures__/v-next/outputv4/google/api/system_parameter.ts b/__fixtures__/v-next/outputv4/google/api/system_parameter.ts index b71ac4fae1..230e353d3b 100644 --- a/__fixtures__/v-next/outputv4/google/api/system_parameter.ts +++ b/__fixtures__/v-next/outputv4/google/api/system_parameter.ts @@ -1,7 +1,6 @@ -import { BinaryReader, BinaryWriter } from "../../binary"; -import { JsonSafe } from "../../json-safe"; -import { DeepPartial, isSet } from "../../helpers"; -import { ComputedRef } from "vue"; +import { BinaryReader, BinaryWriter } from "../../binary.js"; +import { JsonSafe } from "../../json-safe.js"; +import { DeepPartial, isSet } from "../../helpers.js"; export const protobufPackage = "google.api"; /** * ### System parameter configuration @@ -45,9 +44,6 @@ export interface SystemParameters { */ rules: SystemParameterRule[]; } -export interface ReactiveSystemParameters { - rules: ComputedRef; -} export interface SystemParametersProtoMsg { typeUrl: "/google.api.SystemParameters"; value: Uint8Array; @@ -84,10 +80,6 @@ export interface SystemParameterRule { */ parameters: SystemParameter[]; } -export interface ReactiveSystemParameterRule { - selector: ComputedRef; - parameters: ComputedRef; -} export interface SystemParameterRuleProtoMsg { typeUrl: "/google.api.SystemParameterRule"; value: Uint8Array; @@ -119,11 +111,6 @@ export interface SystemParameter { */ urlQueryParameter: string; } -export interface ReactiveSystemParameter { - name: ComputedRef; - httpHeader: ComputedRef; - urlQueryParameter: ComputedRef; -} export interface SystemParameterProtoMsg { typeUrl: "/google.api.SystemParameter"; value: Uint8Array; @@ -169,9 +156,9 @@ export const SystemParameters = { return message; }, fromJSON(object: any): SystemParameters { - return { - rules: Array.isArray(object?.rules) ? object.rules.map((e: any) => SystemParameterRule.fromJSON(e)) : [] - }; + const obj = createBaseSystemParameters(); + if (Array.isArray(object?.rules)) obj.rules = object.rules.map((e: any) => SystemParameterRule.fromJSON(e)); + return obj; }, toJSON(message: SystemParameters): JsonSafe { const obj: any = {}; @@ -245,7 +232,7 @@ function createBaseSystemParameterRule(): SystemParameterRule { export const SystemParameterRule = { typeUrl: "/google.api.SystemParameterRule", encode(message: SystemParameterRule, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.selector !== "") { + if (message.selector !== undefined) { writer.uint32(10).string(message.selector); } for (const v of message.parameters) { @@ -274,10 +261,10 @@ export const SystemParameterRule = { return message; }, fromJSON(object: any): SystemParameterRule { - return { - selector: isSet(object.selector) ? String(object.selector) : "", - parameters: Array.isArray(object?.parameters) ? object.parameters.map((e: any) => SystemParameter.fromJSON(e)) : [] - }; + const obj = createBaseSystemParameterRule(); + if (isSet(object.selector)) obj.selector = String(object.selector); + if (Array.isArray(object?.parameters)) obj.parameters = object.parameters.map((e: any) => SystemParameter.fromJSON(e)); + return obj; }, toJSON(message: SystemParameterRule): JsonSafe { const obj: any = {}; @@ -361,13 +348,13 @@ function createBaseSystemParameter(): SystemParameter { export const SystemParameter = { typeUrl: "/google.api.SystemParameter", encode(message: SystemParameter, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.name !== "") { + if (message.name !== undefined) { writer.uint32(10).string(message.name); } - if (message.httpHeader !== "") { + if (message.httpHeader !== undefined) { writer.uint32(18).string(message.httpHeader); } - if (message.urlQueryParameter !== "") { + if (message.urlQueryParameter !== undefined) { writer.uint32(26).string(message.urlQueryParameter); } return writer; @@ -396,11 +383,11 @@ export const SystemParameter = { return message; }, fromJSON(object: any): SystemParameter { - return { - name: isSet(object.name) ? String(object.name) : "", - httpHeader: isSet(object.httpHeader) ? String(object.httpHeader) : "", - urlQueryParameter: isSet(object.urlQueryParameter) ? String(object.urlQueryParameter) : "" - }; + const obj = createBaseSystemParameter(); + if (isSet(object.name)) obj.name = String(object.name); + if (isSet(object.httpHeader)) obj.httpHeader = String(object.httpHeader); + if (isSet(object.urlQueryParameter)) obj.urlQueryParameter = String(object.urlQueryParameter); + return obj; }, toJSON(message: SystemParameter): JsonSafe { const obj: any = {}; diff --git a/__fixtures__/v-next/outputv4/google/api/usage.ts b/__fixtures__/v-next/outputv4/google/api/usage.ts index 56706cd194..b4a9d63a75 100644 --- a/__fixtures__/v-next/outputv4/google/api/usage.ts +++ b/__fixtures__/v-next/outputv4/google/api/usage.ts @@ -1,7 +1,6 @@ -import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial } from "../../helpers"; -import { JsonSafe } from "../../json-safe"; -import { ComputedRef } from "vue"; +import { BinaryReader, BinaryWriter } from "../../binary.js"; +import { isSet, DeepPartial } from "../../helpers.js"; +import { JsonSafe } from "../../json-safe.js"; export const protobufPackage = "google.api"; /** Configuration controlling usage of a service. */ export interface Usage { @@ -35,11 +34,6 @@ export interface Usage { */ producerNotificationChannel: string; } -export interface ReactiveUsage { - requirements: ComputedRef; - rules: ComputedRef; - producerNotificationChannel: ComputedRef; -} export interface UsageProtoMsg { typeUrl: "/google.api.Usage"; value: Uint8Array; @@ -98,11 +92,6 @@ export interface UsageRule { */ skipServiceControl: boolean; } -export interface ReactiveUsageRule { - selector: ComputedRef; - allowUnregisteredCalls: ComputedRef; - skipServiceControl: ComputedRef; -} export interface UsageRuleProtoMsg { typeUrl: "/google.api.UsageRule"; value: Uint8Array; @@ -155,7 +144,7 @@ export const Usage = { for (const v of message.rules) { UsageRule.encode(v!, writer.uint32(50).fork()).ldelim(); } - if (message.producerNotificationChannel !== "") { + if (message.producerNotificationChannel !== undefined) { writer.uint32(58).string(message.producerNotificationChannel); } return writer; @@ -184,11 +173,11 @@ export const Usage = { return message; }, fromJSON(object: any): Usage { - return { - requirements: Array.isArray(object?.requirements) ? object.requirements.map((e: any) => String(e)) : [], - rules: Array.isArray(object?.rules) ? object.rules.map((e: any) => UsageRule.fromJSON(e)) : [], - producerNotificationChannel: isSet(object.producerNotificationChannel) ? String(object.producerNotificationChannel) : "" - }; + const obj = createBaseUsage(); + if (Array.isArray(object?.requirements)) obj.requirements = object.requirements.map((e: any) => String(e)); + if (Array.isArray(object?.rules)) obj.rules = object.rules.map((e: any) => UsageRule.fromJSON(e)); + if (isSet(object.producerNotificationChannel)) obj.producerNotificationChannel = String(object.producerNotificationChannel); + return obj; }, toJSON(message: Usage): JsonSafe { const obj: any = {}; @@ -291,13 +280,13 @@ function createBaseUsageRule(): UsageRule { export const UsageRule = { typeUrl: "/google.api.UsageRule", encode(message: UsageRule, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.selector !== "") { + if (message.selector !== undefined) { writer.uint32(10).string(message.selector); } - if (message.allowUnregisteredCalls === true) { + if (message.allowUnregisteredCalls !== undefined) { writer.uint32(16).bool(message.allowUnregisteredCalls); } - if (message.skipServiceControl === true) { + if (message.skipServiceControl !== undefined) { writer.uint32(24).bool(message.skipServiceControl); } return writer; @@ -326,11 +315,11 @@ export const UsageRule = { return message; }, fromJSON(object: any): UsageRule { - return { - selector: isSet(object.selector) ? String(object.selector) : "", - allowUnregisteredCalls: isSet(object.allowUnregisteredCalls) ? Boolean(object.allowUnregisteredCalls) : false, - skipServiceControl: isSet(object.skipServiceControl) ? Boolean(object.skipServiceControl) : false - }; + const obj = createBaseUsageRule(); + if (isSet(object.selector)) obj.selector = String(object.selector); + if (isSet(object.allowUnregisteredCalls)) obj.allowUnregisteredCalls = Boolean(object.allowUnregisteredCalls); + if (isSet(object.skipServiceControl)) obj.skipServiceControl = Boolean(object.skipServiceControl); + return obj; }, toJSON(message: UsageRule): JsonSafe { const obj: any = {}; diff --git a/__fixtures__/v-next/outputv4/google/api/visibility.ts b/__fixtures__/v-next/outputv4/google/api/visibility.ts index 342c9fe01c..10ddd8230b 100644 --- a/__fixtures__/v-next/outputv4/google/api/visibility.ts +++ b/__fixtures__/v-next/outputv4/google/api/visibility.ts @@ -1,7 +1,6 @@ -import { BinaryReader, BinaryWriter } from "../../binary"; -import { JsonSafe } from "../../json-safe"; -import { DeepPartial, isSet } from "../../helpers"; -import { ComputedRef } from "vue"; +import { BinaryReader, BinaryWriter } from "../../binary.js"; +import { JsonSafe } from "../../json-safe.js"; +import { DeepPartial, isSet } from "../../helpers.js"; export const protobufPackage = "google.api"; /** * `Visibility` defines restrictions for the visibility of service @@ -35,9 +34,6 @@ export interface Visibility { */ rules: VisibilityRule[]; } -export interface ReactiveVisibility { - rules: ComputedRef; -} export interface VisibilityProtoMsg { typeUrl: "/google.api.Visibility"; value: Uint8Array; @@ -99,10 +95,6 @@ export interface VisibilityRule { */ restriction: string; } -export interface ReactiveVisibilityRule { - selector: ComputedRef; - restriction: ComputedRef; -} export interface VisibilityRuleProtoMsg { typeUrl: "/google.api.VisibilityRule"; value: Uint8Array; @@ -146,9 +138,9 @@ export const Visibility = { return message; }, fromJSON(object: any): Visibility { - return { - rules: Array.isArray(object?.rules) ? object.rules.map((e: any) => VisibilityRule.fromJSON(e)) : [] - }; + const obj = createBaseVisibility(); + if (Array.isArray(object?.rules)) obj.rules = object.rules.map((e: any) => VisibilityRule.fromJSON(e)); + return obj; }, toJSON(message: Visibility): JsonSafe { const obj: any = {}; @@ -222,10 +214,10 @@ function createBaseVisibilityRule(): VisibilityRule { export const VisibilityRule = { typeUrl: "/google.api.VisibilityRule", encode(message: VisibilityRule, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.selector !== "") { + if (message.selector !== undefined) { writer.uint32(10).string(message.selector); } - if (message.restriction !== "") { + if (message.restriction !== undefined) { writer.uint32(18).string(message.restriction); } return writer; @@ -251,10 +243,10 @@ export const VisibilityRule = { return message; }, fromJSON(object: any): VisibilityRule { - return { - selector: isSet(object.selector) ? String(object.selector) : "", - restriction: isSet(object.restriction) ? String(object.restriction) : "" - }; + const obj = createBaseVisibilityRule(); + if (isSet(object.selector)) obj.selector = String(object.selector); + if (isSet(object.restriction)) obj.restriction = String(object.restriction); + return obj; }, toJSON(message: VisibilityRule): JsonSafe { const obj: any = {}; diff --git a/__fixtures__/v-next/outputv4/google/bundle.ts b/__fixtures__/v-next/outputv4/google/bundle.ts index f3e68e2fcd..1d59dbeed3 100644 --- a/__fixtures__/v-next/outputv4/google/bundle.ts +++ b/__fixtures__/v-next/outputv4/google/bundle.ts @@ -1,57 +1,60 @@ -import * as _181 from "./api/annotations"; -import * as _182 from "./api/auth"; -import * as _183 from "./api/backend"; -import * as _184 from "./api/billing"; -import * as _185 from "./api/client"; -import * as _186 from "./api/config_change"; -import * as _187 from "./api/consumer"; -import * as _188 from "./api/context"; -import * as _189 from "./api/control"; -import * as _190 from "./api/distribution"; -import * as _191 from "./api/documentation"; -import * as _192 from "./api/endpoint"; -import * as _193 from "./api/error_reason"; -import * as _194 from "./api/field_behavior"; -import * as _195 from "./api/http"; -import * as _196 from "./api/httpbody"; -import * as _197 from "./api/label"; -import * as _198 from "./api/launch_stage"; -import * as _199 from "./api/log"; -import * as _200 from "./api/logging"; -import * as _201 from "./api/metric"; -import * as _202 from "./api/monitored_resource"; -import * as _203 from "./api/monitoring"; -import * as _204 from "./api/quota"; -import * as _205 from "./api/resource"; -import * as _206 from "./api/routing"; -import * as _207 from "./api/service"; -import * as _208 from "./api/source_info"; -import * as _209 from "./api/system_parameter"; -import * as _210 from "./api/usage"; -import * as _211 from "./api/visibility"; -import * as _212 from "./logging/type/http_request"; -import * as _213 from "./logging/type/log_severity"; -import * as _214 from "./logging/v2/log_entry"; -import * as _215 from "./logging/v2/logging_config"; -import * as _216 from "./logging/v2/logging_metrics"; -import * as _217 from "./logging/v2/logging"; -import * as _218 from "./longrunning/operations"; -import * as _219 from "./protobuf/any"; -import * as _220 from "./protobuf/api"; -import * as _221 from "./protobuf/descriptor"; -import * as _222 from "./protobuf/duration"; -import * as _223 from "./protobuf/empty"; -import * as _224 from "./protobuf/field_mask"; -import * as _225 from "./protobuf/source_context"; -import * as _226 from "./protobuf/struct"; -import * as _227 from "./protobuf/timestamp"; -import * as _228 from "./protobuf/type"; -import * as _229 from "./protobuf/wrappers"; -import * as _230 from "./rpc/code"; -import * as _231 from "./rpc/error_details"; -import * as _232 from "./rpc/status"; +import * as _178 from "./api/annotations.js"; +import * as _179 from "./api/auth.js"; +import * as _180 from "./api/backend.js"; +import * as _181 from "./api/billing.js"; +import * as _182 from "./api/client.js"; +import * as _183 from "./api/config_change.js"; +import * as _184 from "./api/consumer.js"; +import * as _185 from "./api/context.js"; +import * as _186 from "./api/control.js"; +import * as _187 from "./api/distribution.js"; +import * as _188 from "./api/documentation.js"; +import * as _189 from "./api/endpoint.js"; +import * as _190 from "./api/error_reason.js"; +import * as _191 from "./api/field_behavior.js"; +import * as _192 from "./api/http.js"; +import * as _193 from "./api/httpbody.js"; +import * as _194 from "./api/label.js"; +import * as _195 from "./api/launch_stage.js"; +import * as _196 from "./api/log.js"; +import * as _197 from "./api/logging.js"; +import * as _198 from "./api/metric.js"; +import * as _199 from "./api/monitored_resource.js"; +import * as _200 from "./api/monitoring.js"; +import * as _201 from "./api/quota.js"; +import * as _202 from "./api/resource.js"; +import * as _203 from "./api/routing.js"; +import * as _204 from "./api/service.js"; +import * as _205 from "./api/source_info.js"; +import * as _206 from "./api/system_parameter.js"; +import * as _207 from "./api/usage.js"; +import * as _208 from "./api/visibility.js"; +import * as _209 from "./logging/type/http_request.js"; +import * as _210 from "./logging/type/log_severity.js"; +import * as _211 from "./logging/v2/log_entry.js"; +import * as _212 from "./logging/v2/logging_config.js"; +import * as _213 from "./logging/v2/logging_metrics.js"; +import * as _214 from "./logging/v2/logging.js"; +import * as _215 from "./longrunning/operations.js"; +import * as _216 from "./protobuf/any.js"; +import * as _217 from "./protobuf/api.js"; +import * as _218 from "./protobuf/descriptor.js"; +import * as _219 from "./protobuf/duration.js"; +import * as _220 from "./protobuf/empty.js"; +import * as _221 from "./protobuf/field_mask.js"; +import * as _222 from "./protobuf/source_context.js"; +import * as _223 from "./protobuf/struct.js"; +import * as _224 from "./protobuf/timestamp.js"; +import * as _225 from "./protobuf/type.js"; +import * as _226 from "./protobuf/wrappers.js"; +import * as _227 from "./rpc/code.js"; +import * as _228 from "./rpc/error_details.js"; +import * as _229 from "./rpc/status.js"; export namespace google { export const api = { + ..._178, + ..._179, + ..._180, ..._181, ..._182, ..._183, @@ -79,27 +82,27 @@ export namespace google { ..._205, ..._206, ..._207, - ..._208, - ..._209, - ..._210, - ..._211 + ..._208 }; export namespace logging { export const type = { - ..._212, - ..._213 + ..._209, + ..._210 }; export const v2 = { - ..._214, - ..._215, - ..._216, - ..._217 + ..._211, + ..._212, + ..._213, + ..._214 }; } export const longrunning = { - ..._218 + ..._215 }; export const protobuf = { + ..._216, + ..._217, + ..._218, ..._219, ..._220, ..._221, @@ -107,14 +110,11 @@ export namespace google { ..._223, ..._224, ..._225, - ..._226, + ..._226 + }; + export const rpc = { ..._227, ..._228, ..._229 }; - export const rpc = { - ..._230, - ..._231, - ..._232 - }; } \ No newline at end of file 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 4347351c2e..7e80dedf30 100644 --- a/__fixtures__/v-next/outputv4/google/logging/type/http_request.ts +++ b/__fixtures__/v-next/outputv4/google/logging/type/http_request.ts @@ -1,8 +1,7 @@ -import { Duration, DurationSDKType } from "../../protobuf/duration"; -import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; -import { JsonSafe } from "../../../json-safe"; -import { ComputedRef } from "vue"; +import { Duration, DurationSDKType } from "../../protobuf/duration.js"; +import { BinaryReader, BinaryWriter } from "../../../binary.js"; +import { isSet, DeepPartial } from "../../../helpers.js"; +import { JsonSafe } from "../../../json-safe.js"; export const protobufPackage = "google.logging.type"; /** * A common proto for logging HTTP requests. Only contains semantics @@ -83,23 +82,6 @@ export interface HttpRequest { /** Protocol used for the request. Examples: "HTTP/1.1", "HTTP/2", "websocket" */ protocol: string; } -export interface ReactiveHttpRequest { - requestMethod: ComputedRef; - requestUrl: ComputedRef; - requestSize: ComputedRef; - status: ComputedRef; - responseSize: ComputedRef; - userAgent: ComputedRef; - remoteIp: ComputedRef; - serverIp: ComputedRef; - referer: ComputedRef; - latency?: ComputedRef; - cacheLookup: ComputedRef; - cacheHit: ComputedRef; - cacheValidatedWithOriginServer: ComputedRef; - cacheFillBytes: ComputedRef; - protocol: ComputedRef; -} export interface HttpRequestProtoMsg { typeUrl: "/google.logging.type.HttpRequest"; value: Uint8Array; @@ -148,49 +130,49 @@ function createBaseHttpRequest(): HttpRequest { export const HttpRequest = { typeUrl: "/google.logging.type.HttpRequest", encode(message: HttpRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.requestMethod !== "") { + if (message.requestMethod !== undefined) { writer.uint32(10).string(message.requestMethod); } - if (message.requestUrl !== "") { + if (message.requestUrl !== undefined) { writer.uint32(18).string(message.requestUrl); } - if (message.requestSize !== BigInt(0)) { + if (message.requestSize !== undefined) { writer.uint32(24).int64(message.requestSize); } - if (message.status !== 0) { + if (message.status !== undefined) { writer.uint32(32).int32(message.status); } - if (message.responseSize !== BigInt(0)) { + if (message.responseSize !== undefined) { writer.uint32(40).int64(message.responseSize); } - if (message.userAgent !== "") { + if (message.userAgent !== undefined) { writer.uint32(50).string(message.userAgent); } - if (message.remoteIp !== "") { + if (message.remoteIp !== undefined) { writer.uint32(58).string(message.remoteIp); } - if (message.serverIp !== "") { + if (message.serverIp !== undefined) { writer.uint32(106).string(message.serverIp); } - if (message.referer !== "") { + if (message.referer !== undefined) { writer.uint32(66).string(message.referer); } if (message.latency !== undefined) { Duration.encode(message.latency, writer.uint32(114).fork()).ldelim(); } - if (message.cacheLookup === true) { + if (message.cacheLookup !== undefined) { writer.uint32(88).bool(message.cacheLookup); } - if (message.cacheHit === true) { + if (message.cacheHit !== undefined) { writer.uint32(72).bool(message.cacheHit); } - if (message.cacheValidatedWithOriginServer === true) { + if (message.cacheValidatedWithOriginServer !== undefined) { writer.uint32(80).bool(message.cacheValidatedWithOriginServer); } - if (message.cacheFillBytes !== BigInt(0)) { + if (message.cacheFillBytes !== undefined) { writer.uint32(96).int64(message.cacheFillBytes); } - if (message.protocol !== "") { + if (message.protocol !== undefined) { writer.uint32(122).string(message.protocol); } return writer; @@ -255,23 +237,23 @@ export const HttpRequest = { return message; }, fromJSON(object: any): HttpRequest { - return { - requestMethod: isSet(object.requestMethod) ? String(object.requestMethod) : "", - requestUrl: isSet(object.requestUrl) ? String(object.requestUrl) : "", - requestSize: isSet(object.requestSize) ? BigInt(object.requestSize.toString()) : BigInt(0), - status: isSet(object.status) ? Number(object.status) : 0, - responseSize: isSet(object.responseSize) ? BigInt(object.responseSize.toString()) : BigInt(0), - userAgent: isSet(object.userAgent) ? String(object.userAgent) : "", - remoteIp: isSet(object.remoteIp) ? String(object.remoteIp) : "", - serverIp: isSet(object.serverIp) ? String(object.serverIp) : "", - referer: isSet(object.referer) ? String(object.referer) : "", - latency: isSet(object.latency) ? Duration.fromJSON(object.latency) : undefined, - cacheLookup: isSet(object.cacheLookup) ? Boolean(object.cacheLookup) : false, - cacheHit: isSet(object.cacheHit) ? Boolean(object.cacheHit) : false, - cacheValidatedWithOriginServer: isSet(object.cacheValidatedWithOriginServer) ? Boolean(object.cacheValidatedWithOriginServer) : false, - cacheFillBytes: isSet(object.cacheFillBytes) ? BigInt(object.cacheFillBytes.toString()) : BigInt(0), - protocol: isSet(object.protocol) ? String(object.protocol) : "" - }; + const obj = createBaseHttpRequest(); + if (isSet(object.requestMethod)) obj.requestMethod = String(object.requestMethod); + if (isSet(object.requestUrl)) obj.requestUrl = String(object.requestUrl); + if (isSet(object.requestSize)) obj.requestSize = BigInt(object.requestSize.toString()); + if (isSet(object.status)) obj.status = Number(object.status); + if (isSet(object.responseSize)) obj.responseSize = BigInt(object.responseSize.toString()); + if (isSet(object.userAgent)) obj.userAgent = String(object.userAgent); + if (isSet(object.remoteIp)) obj.remoteIp = String(object.remoteIp); + if (isSet(object.serverIp)) obj.serverIp = String(object.serverIp); + if (isSet(object.referer)) obj.referer = String(object.referer); + if (isSet(object.latency)) obj.latency = Duration.fromJSON(object.latency); + if (isSet(object.cacheLookup)) obj.cacheLookup = Boolean(object.cacheLookup); + if (isSet(object.cacheHit)) obj.cacheHit = Boolean(object.cacheHit); + if (isSet(object.cacheValidatedWithOriginServer)) obj.cacheValidatedWithOriginServer = Boolean(object.cacheValidatedWithOriginServer); + if (isSet(object.cacheFillBytes)) obj.cacheFillBytes = BigInt(object.cacheFillBytes.toString()); + if (isSet(object.protocol)) obj.protocol = String(object.protocol); + return obj; }, toJSON(message: HttpRequest): JsonSafe { const obj: any = {}; @@ -296,18 +278,26 @@ export const HttpRequest = { const message = createBaseHttpRequest(); message.requestMethod = object.requestMethod ?? ""; message.requestUrl = object.requestUrl ?? ""; - message.requestSize = object.requestSize !== undefined && object.requestSize !== null ? BigInt(object.requestSize.toString()) : BigInt(0); + if (object.requestSize !== undefined && object.requestSize !== null) { + message.requestSize = BigInt(object.requestSize.toString()); + } message.status = object.status ?? 0; - message.responseSize = object.responseSize !== undefined && object.responseSize !== null ? BigInt(object.responseSize.toString()) : BigInt(0); + if (object.responseSize !== undefined && object.responseSize !== null) { + message.responseSize = BigInt(object.responseSize.toString()); + } message.userAgent = object.userAgent ?? ""; message.remoteIp = object.remoteIp ?? ""; message.serverIp = object.serverIp ?? ""; message.referer = object.referer ?? ""; - message.latency = object.latency !== undefined && object.latency !== null ? Duration.fromPartial(object.latency) : undefined; + if (object.latency !== undefined && object.latency !== null) { + message.latency = Duration.fromPartial(object.latency); + } message.cacheLookup = object.cacheLookup ?? false; message.cacheHit = object.cacheHit ?? false; message.cacheValidatedWithOriginServer = object.cacheValidatedWithOriginServer ?? false; - message.cacheFillBytes = object.cacheFillBytes !== undefined && object.cacheFillBytes !== null ? BigInt(object.cacheFillBytes.toString()) : BigInt(0); + if (object.cacheFillBytes !== undefined && object.cacheFillBytes !== null) { + message.cacheFillBytes = BigInt(object.cacheFillBytes.toString()); + } message.protocol = object.protocol ?? ""; return message; }, diff --git a/__fixtures__/v-next/outputv4/google/logging/type/log_severity.ts b/__fixtures__/v-next/outputv4/google/logging/type/log_severity.ts index 5f13285523..17fae166c6 100644 --- a/__fixtures__/v-next/outputv4/google/logging/type/log_severity.ts +++ b/__fixtures__/v-next/outputv4/google/logging/type/log_severity.ts @@ -1,4 +1,3 @@ -import { ComputedRef } from "vue"; export const protobufPackage = "google.logging.type"; /** * The severity of the event described in a log entry, expressed as one of the 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 d62c348a8a..ce7a3a0f3d 100644 --- a/__fixtures__/v-next/outputv4/google/logging/v2/log_entry.ts +++ b/__fixtures__/v-next/outputv4/google/logging/v2/log_entry.ts @@ -1,22 +1,17 @@ -import { MonitoredResource, MonitoredResourceSDKType } from "../../api/monitored_resource"; -import { Any, AnySDKType } from "../../protobuf/any"; -import { Struct, StructSDKType } from "../../protobuf/struct"; -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 { JsonSafe } from "../../../json-safe"; -import { ComputedRef } from "vue"; +import { MonitoredResource, MonitoredResourceSDKType } from "../../api/monitored_resource.js"; +import { Any, AnySDKType } from "../../protobuf/any.js"; +import { Struct, StructSDKType } from "../../protobuf/struct.js"; +import { Timestamp, TimestampSDKType } from "../../protobuf/timestamp.js"; +import { LogSeverity, LogSeveritySDKType, logSeverityFromJSON, logSeverityToJSON } from "../type/log_severity.js"; +import { HttpRequest, HttpRequestSDKType } from "../type/http_request.js"; +import { BinaryReader, BinaryWriter } from "../../../binary.js"; +import { isSet, DeepPartial, toTimestamp, fromTimestamp, isObject } from "../../../helpers.js"; +import { JsonSafe } from "../../../json-safe.js"; export const protobufPackage = "google.logging.v2"; export interface LogEntry_LabelsEntry { key: string; value: string; } -export interface ReactiveLogEntry_LabelsEntry { - key: ComputedRef; - value: ComputedRef; -} export interface LogEntry_LabelsEntryProtoMsg { typeUrl: string; value: Uint8Array; @@ -173,27 +168,6 @@ export interface LogEntry { */ split?: LogSplit; } -export interface ReactiveLogEntry { - logName: ComputedRef; - resource?: ComputedRef; - protoPayload?: ComputedRef; - textPayload?: ComputedRef; - jsonPayload?: ComputedRef; - timestamp?: ComputedRef; - receiveTimestamp?: ComputedRef; - severity: ComputedRef; - insertId: ComputedRef; - httpRequest?: ComputedRef; - labels: ComputedRef<{ - [key: string]: string; - }>; - operation?: ComputedRef; - trace: ComputedRef; - spanId: ComputedRef; - traceSampled: ComputedRef; - sourceLocation?: ComputedRef; - split?: ComputedRef; -} export interface LogEntryProtoMsg { typeUrl: "/google.logging.v2.LogEntry"; value: Uint8Array; @@ -241,12 +215,6 @@ export interface LogEntryOperation { /** Optional. Set this to True if this is the last log entry in the operation. */ last: boolean; } -export interface ReactiveLogEntryOperation { - id: ComputedRef; - producer: ComputedRef; - first: ComputedRef; - last: ComputedRef; -} export interface LogEntryOperationProtoMsg { typeUrl: "/google.logging.v2.LogEntryOperation"; value: Uint8Array; @@ -286,11 +254,6 @@ export interface LogEntrySourceLocation { */ function: string; } -export interface ReactiveLogEntrySourceLocation { - file: ComputedRef; - line: ComputedRef; - function: ComputedRef; -} export interface LogEntrySourceLocationProtoMsg { typeUrl: "/google.logging.v2.LogEntrySourceLocation"; value: Uint8Array; @@ -325,11 +288,6 @@ export interface LogSplit { /** The total number of log entries that the original LogEntry was split into. */ totalSplits: number; } -export interface ReactiveLogSplit { - uid: ComputedRef; - index: ComputedRef; - totalSplits: ComputedRef; -} export interface LogSplitProtoMsg { typeUrl: "/google.logging.v2.LogSplit"; value: Uint8Array; @@ -352,10 +310,10 @@ function createBaseLogEntry_LabelsEntry(): LogEntry_LabelsEntry { } export const LogEntry_LabelsEntry = { encode(message: LogEntry_LabelsEntry, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.key !== "") { + if (message.key !== undefined) { writer.uint32(10).string(message.key); } - if (message.value !== "") { + if (message.value !== undefined) { writer.uint32(18).string(message.value); } return writer; @@ -381,10 +339,10 @@ export const LogEntry_LabelsEntry = { return message; }, fromJSON(object: any): LogEntry_LabelsEntry { - return { - key: isSet(object.key) ? String(object.key) : "", - value: isSet(object.value) ? String(object.value) : "" - }; + const obj = createBaseLogEntry_LabelsEntry(); + if (isSet(object.key)) obj.key = String(object.key); + if (isSet(object.value)) obj.value = String(object.value); + return obj; }, toJSON(message: LogEntry_LabelsEntry): JsonSafe { const obj: any = {}; @@ -466,7 +424,7 @@ function createBaseLogEntry(): LogEntry { export const LogEntry = { typeUrl: "/google.logging.v2.LogEntry", encode(message: LogEntry, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.logName !== "") { + if (message.logName !== undefined) { writer.uint32(98).string(message.logName); } if (message.resource !== undefined) { @@ -490,7 +448,7 @@ export const LogEntry = { if (message.severity !== 0) { writer.uint32(80).int32(message.severity); } - if (message.insertId !== "") { + if (message.insertId !== undefined) { writer.uint32(34).string(message.insertId); } if (message.httpRequest !== undefined) { @@ -505,13 +463,13 @@ export const LogEntry = { if (message.operation !== undefined) { LogEntryOperation.encode(message.operation, writer.uint32(122).fork()).ldelim(); } - if (message.trace !== "") { + if (message.trace !== undefined) { writer.uint32(178).string(message.trace); } - if (message.spanId !== "") { + if (message.spanId !== undefined) { writer.uint32(218).string(message.spanId); } - if (message.traceSampled === true) { + if (message.traceSampled !== undefined) { writer.uint32(240).bool(message.traceSampled); } if (message.sourceLocation !== undefined) { @@ -591,30 +549,30 @@ export const LogEntry = { return message; }, fromJSON(object: any): LogEntry { - return { - logName: isSet(object.logName) ? String(object.logName) : "", - resource: isSet(object.resource) ? MonitoredResource.fromJSON(object.resource) : undefined, - protoPayload: isSet(object.protoPayload) ? Any.fromJSON(object.protoPayload) : undefined, - textPayload: isSet(object.textPayload) ? String(object.textPayload) : undefined, - jsonPayload: isSet(object.jsonPayload) ? Struct.fromJSON(object.jsonPayload) : undefined, - timestamp: isSet(object.timestamp) ? new Date(object.timestamp) : undefined, - receiveTimestamp: isSet(object.receiveTimestamp) ? new Date(object.receiveTimestamp) : undefined, - severity: isSet(object.severity) ? logSeverityFromJSON(object.severity) : -1, - insertId: isSet(object.insertId) ? String(object.insertId) : "", - httpRequest: isSet(object.httpRequest) ? HttpRequest.fromJSON(object.httpRequest) : undefined, - labels: isObject(object.labels) ? Object.entries(object.labels).reduce<{ - [key: string]: string; - }>((acc, [key, value]) => { - acc[key] = String(value); - return acc; - }, {}) : {}, - operation: isSet(object.operation) ? LogEntryOperation.fromJSON(object.operation) : undefined, - trace: isSet(object.trace) ? String(object.trace) : "", - spanId: isSet(object.spanId) ? String(object.spanId) : "", - traceSampled: isSet(object.traceSampled) ? Boolean(object.traceSampled) : false, - sourceLocation: isSet(object.sourceLocation) ? LogEntrySourceLocation.fromJSON(object.sourceLocation) : undefined, - split: isSet(object.split) ? LogSplit.fromJSON(object.split) : undefined - }; + const obj = createBaseLogEntry(); + if (isSet(object.logName)) obj.logName = String(object.logName); + if (isSet(object.resource)) obj.resource = MonitoredResource.fromJSON(object.resource); + if (isSet(object.protoPayload)) obj.protoPayload = Any.fromJSON(object.protoPayload); + if (isSet(object.textPayload)) obj.textPayload = String(object.textPayload); + if (isSet(object.jsonPayload)) obj.jsonPayload = Struct.fromJSON(object.jsonPayload); + if (isSet(object.timestamp)) obj.timestamp = new Date(object.timestamp); + if (isSet(object.receiveTimestamp)) obj.receiveTimestamp = new Date(object.receiveTimestamp); + if (isSet(object.severity)) obj.severity = logSeverityFromJSON(object.severity); + if (isSet(object.insertId)) obj.insertId = String(object.insertId); + if (isSet(object.httpRequest)) obj.httpRequest = HttpRequest.fromJSON(object.httpRequest); + if (isObject(object.labels)) obj.labels = Object.entries(object.labels).reduce<{ + [key: string]: string; + }>((acc, [key, value]) => { + acc[key] = String(value); + return acc; + }, {}); + if (isSet(object.operation)) obj.operation = LogEntryOperation.fromJSON(object.operation); + if (isSet(object.trace)) obj.trace = String(object.trace); + if (isSet(object.spanId)) obj.spanId = String(object.spanId); + if (isSet(object.traceSampled)) obj.traceSampled = Boolean(object.traceSampled); + if (isSet(object.sourceLocation)) obj.sourceLocation = LogEntrySourceLocation.fromJSON(object.sourceLocation); + if (isSet(object.split)) obj.split = LogSplit.fromJSON(object.split); + return obj; }, toJSON(message: LogEntry): JsonSafe { const obj: any = {}; @@ -645,15 +603,23 @@ export const LogEntry = { fromPartial(object: DeepPartial): LogEntry { const message = createBaseLogEntry(); message.logName = object.logName ?? ""; - message.resource = object.resource !== undefined && object.resource !== null ? MonitoredResource.fromPartial(object.resource) : undefined; - message.protoPayload = object.protoPayload !== undefined && object.protoPayload !== null ? Any.fromPartial(object.protoPayload) : undefined; + if (object.resource !== undefined && object.resource !== null) { + message.resource = MonitoredResource.fromPartial(object.resource); + } + if (object.protoPayload !== undefined && object.protoPayload !== null) { + message.protoPayload = Any.fromPartial(object.protoPayload); + } message.textPayload = object.textPayload ?? undefined; - message.jsonPayload = object.jsonPayload !== undefined && object.jsonPayload !== null ? Struct.fromPartial(object.jsonPayload) : undefined; + if (object.jsonPayload !== undefined && object.jsonPayload !== null) { + message.jsonPayload = Struct.fromPartial(object.jsonPayload); + } message.timestamp = object.timestamp ?? undefined; message.receiveTimestamp = object.receiveTimestamp ?? undefined; message.severity = object.severity ?? 0; message.insertId = object.insertId ?? ""; - message.httpRequest = object.httpRequest !== undefined && object.httpRequest !== null ? HttpRequest.fromPartial(object.httpRequest) : undefined; + if (object.httpRequest !== undefined && object.httpRequest !== null) { + message.httpRequest = HttpRequest.fromPartial(object.httpRequest); + } message.labels = Object.entries(object.labels ?? {}).reduce<{ [key: string]: string; }>((acc, [key, value]) => { @@ -662,12 +628,18 @@ export const LogEntry = { } return acc; }, {}); - message.operation = object.operation !== undefined && object.operation !== null ? LogEntryOperation.fromPartial(object.operation) : undefined; + if (object.operation !== undefined && object.operation !== null) { + message.operation = LogEntryOperation.fromPartial(object.operation); + } message.trace = object.trace ?? ""; message.spanId = object.spanId ?? ""; message.traceSampled = object.traceSampled ?? false; - message.sourceLocation = object.sourceLocation !== undefined && object.sourceLocation !== null ? LogEntrySourceLocation.fromPartial(object.sourceLocation) : undefined; - message.split = object.split !== undefined && object.split !== null ? LogSplit.fromPartial(object.split) : undefined; + if (object.sourceLocation !== undefined && object.sourceLocation !== null) { + message.sourceLocation = LogEntrySourceLocation.fromPartial(object.sourceLocation); + } + if (object.split !== undefined && object.split !== null) { + message.split = LogSplit.fromPartial(object.split); + } return message; }, fromSDK(object: LogEntrySDKType): LogEntry { @@ -861,16 +833,16 @@ function createBaseLogEntryOperation(): LogEntryOperation { export const LogEntryOperation = { typeUrl: "/google.logging.v2.LogEntryOperation", encode(message: LogEntryOperation, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.id !== "") { + if (message.id !== undefined) { writer.uint32(10).string(message.id); } - if (message.producer !== "") { + if (message.producer !== undefined) { writer.uint32(18).string(message.producer); } - if (message.first === true) { + if (message.first !== undefined) { writer.uint32(24).bool(message.first); } - if (message.last === true) { + if (message.last !== undefined) { writer.uint32(32).bool(message.last); } return writer; @@ -902,12 +874,12 @@ export const LogEntryOperation = { return message; }, fromJSON(object: any): LogEntryOperation { - return { - id: isSet(object.id) ? String(object.id) : "", - producer: isSet(object.producer) ? String(object.producer) : "", - first: isSet(object.first) ? Boolean(object.first) : false, - last: isSet(object.last) ? Boolean(object.last) : false - }; + const obj = createBaseLogEntryOperation(); + if (isSet(object.id)) obj.id = String(object.id); + if (isSet(object.producer)) obj.producer = String(object.producer); + if (isSet(object.first)) obj.first = Boolean(object.first); + if (isSet(object.last)) obj.last = Boolean(object.last); + return obj; }, toJSON(message: LogEntryOperation): JsonSafe { const obj: any = {}; @@ -999,13 +971,13 @@ function createBaseLogEntrySourceLocation(): LogEntrySourceLocation { export const LogEntrySourceLocation = { typeUrl: "/google.logging.v2.LogEntrySourceLocation", encode(message: LogEntrySourceLocation, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.file !== "") { + if (message.file !== undefined) { writer.uint32(10).string(message.file); } - if (message.line !== BigInt(0)) { + if (message.line !== undefined) { writer.uint32(16).int64(message.line); } - if (message.function !== "") { + if (message.function !== undefined) { writer.uint32(26).string(message.function); } return writer; @@ -1034,11 +1006,11 @@ export const LogEntrySourceLocation = { return message; }, fromJSON(object: any): LogEntrySourceLocation { - return { - file: isSet(object.file) ? String(object.file) : "", - line: isSet(object.line) ? BigInt(object.line.toString()) : BigInt(0), - function: isSet(object.function) ? String(object.function) : "" - }; + const obj = createBaseLogEntrySourceLocation(); + if (isSet(object.file)) obj.file = String(object.file); + if (isSet(object.line)) obj.line = BigInt(object.line.toString()); + if (isSet(object.function)) obj.function = String(object.function); + return obj; }, toJSON(message: LogEntrySourceLocation): JsonSafe { const obj: any = {}; @@ -1050,7 +1022,9 @@ export const LogEntrySourceLocation = { fromPartial(object: DeepPartial): LogEntrySourceLocation { const message = createBaseLogEntrySourceLocation(); message.file = object.file ?? ""; - message.line = object.line !== undefined && object.line !== null ? BigInt(object.line.toString()) : BigInt(0); + if (object.line !== undefined && object.line !== null) { + message.line = BigInt(object.line.toString()); + } message.function = object.function ?? ""; return message; }, @@ -1121,13 +1095,13 @@ function createBaseLogSplit(): LogSplit { export const LogSplit = { typeUrl: "/google.logging.v2.LogSplit", encode(message: LogSplit, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.uid !== "") { + if (message.uid !== undefined) { writer.uint32(10).string(message.uid); } - if (message.index !== 0) { + if (message.index !== undefined) { writer.uint32(16).int32(message.index); } - if (message.totalSplits !== 0) { + if (message.totalSplits !== undefined) { writer.uint32(24).int32(message.totalSplits); } return writer; @@ -1156,11 +1130,11 @@ export const LogSplit = { return message; }, fromJSON(object: any): LogSplit { - return { - uid: isSet(object.uid) ? String(object.uid) : "", - index: isSet(object.index) ? Number(object.index) : 0, - totalSplits: isSet(object.totalSplits) ? Number(object.totalSplits) : 0 - }; + const obj = createBaseLogSplit(); + if (isSet(object.uid)) obj.uid = String(object.uid); + if (isSet(object.index)) obj.index = Number(object.index); + if (isSet(object.totalSplits)) obj.totalSplits = Number(object.totalSplits); + return obj; }, toJSON(message: LogSplit): JsonSafe { const obj: any = {}; diff --git a/__fixtures__/v-next/outputv4/google/logging/v2/logging.ts b/__fixtures__/v-next/outputv4/google/logging/v2/logging.ts index 40de250463..6d1a6be44d 100644 --- a/__fixtures__/v-next/outputv4/google/logging/v2/logging.ts +++ b/__fixtures__/v-next/outputv4/google/logging/v2/logging.ts @@ -1,11 +1,10 @@ -import { MonitoredResource, MonitoredResourceSDKType, MonitoredResourceDescriptor, MonitoredResourceDescriptorSDKType } from "../../api/monitored_resource"; -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 { JsonSafe } from "../../../json-safe"; -import { ComputedRef } from "vue"; +import { MonitoredResource, MonitoredResourceSDKType, MonitoredResourceDescriptor, MonitoredResourceDescriptorSDKType } from "../../api/monitored_resource.js"; +import { LogEntry, LogEntrySDKType } from "./log_entry.js"; +import { Duration, DurationSDKType } from "../../protobuf/duration.js"; +import { Status, StatusSDKType } from "../../rpc/status.js"; +import { BinaryReader, BinaryWriter } from "../../../binary.js"; +import { isSet, DeepPartial, isObject } from "../../../helpers.js"; +import { JsonSafe } from "../../../json-safe.js"; export const protobufPackage = "google.logging.v2"; /** An indicator of why entries were omitted. */ export enum TailLogEntriesResponse_SuppressionInfo_Reason { @@ -75,9 +74,6 @@ export interface DeleteLogRequest { */ logName: string; } -export interface ReactiveDeleteLogRequest { - logName: ComputedRef; -} export interface DeleteLogRequestProtoMsg { typeUrl: "/google.logging.v2.DeleteLogRequest"; value: Uint8Array; @@ -90,10 +86,6 @@ export interface WriteLogEntriesRequest_LabelsEntry { key: string; value: string; } -export interface ReactiveWriteLogEntriesRequest_LabelsEntry { - key: ComputedRef; - value: ComputedRef; -} export interface WriteLogEntriesRequest_LabelsEntryProtoMsg { typeUrl: string; value: Uint8Array; @@ -186,16 +178,6 @@ export interface WriteLogEntriesRequest { */ dryRun: boolean; } -export interface ReactiveWriteLogEntriesRequest { - logName: ComputedRef; - resource?: ComputedRef; - labels: ComputedRef<{ - [key: string]: string; - }>; - entries: ComputedRef; - partialSuccess: ComputedRef; - dryRun: ComputedRef; -} export interface WriteLogEntriesRequestProtoMsg { typeUrl: "/google.logging.v2.WriteLogEntriesRequest"; value: Uint8Array; @@ -213,7 +195,6 @@ export interface WriteLogEntriesRequestSDKType { } /** Result returned from WriteLogEntries. */ export interface WriteLogEntriesResponse {} -export interface ReactiveWriteLogEntriesResponse {} export interface WriteLogEntriesResponseProtoMsg { typeUrl: "/google.logging.v2.WriteLogEntriesResponse"; value: Uint8Array; @@ -224,10 +205,6 @@ export interface WriteLogEntriesPartialErrors_LogEntryErrorsEntry { key: number; value?: Status; } -export interface ReactiveWriteLogEntriesPartialErrors_LogEntryErrorsEntry { - key: ComputedRef; - value?: ComputedRef; -} export interface WriteLogEntriesPartialErrors_LogEntryErrorsEntryProtoMsg { typeUrl: string; value: Uint8Array; @@ -250,11 +227,6 @@ export interface WriteLogEntriesPartialErrors { [key: number]: Status; }; } -export interface ReactiveWriteLogEntriesPartialErrors { - logEntryErrors: ComputedRef<{ - [key: number]: Status; - }>; -} export interface WriteLogEntriesPartialErrorsProtoMsg { typeUrl: "/google.logging.v2.WriteLogEntriesPartialErrors"; value: Uint8Array; @@ -320,13 +292,6 @@ export interface ListLogEntriesRequest { */ pageToken: string; } -export interface ReactiveListLogEntriesRequest { - resourceNames: ComputedRef; - filter: ComputedRef; - orderBy: ComputedRef; - pageSize: ComputedRef; - pageToken: ComputedRef; -} export interface ListLogEntriesRequestProtoMsg { typeUrl: "/google.logging.v2.ListLogEntriesRequest"; value: Uint8Array; @@ -361,10 +326,6 @@ export interface ListLogEntriesResponse { */ nextPageToken: string; } -export interface ReactiveListLogEntriesResponse { - entries: ComputedRef; - nextPageToken: ComputedRef; -} export interface ListLogEntriesResponseProtoMsg { typeUrl: "/google.logging.v2.ListLogEntriesResponse"; value: Uint8Array; @@ -390,10 +351,6 @@ export interface ListMonitoredResourceDescriptorsRequest { */ pageToken: string; } -export interface ReactiveListMonitoredResourceDescriptorsRequest { - pageSize: ComputedRef; - pageToken: ComputedRef; -} export interface ListMonitoredResourceDescriptorsRequestProtoMsg { typeUrl: "/google.logging.v2.ListMonitoredResourceDescriptorsRequest"; value: Uint8Array; @@ -414,10 +371,6 @@ export interface ListMonitoredResourceDescriptorsResponse { */ nextPageToken: string; } -export interface ReactiveListMonitoredResourceDescriptorsResponse { - resourceDescriptors: ComputedRef; - nextPageToken: ComputedRef; -} export interface ListMonitoredResourceDescriptorsResponseProtoMsg { typeUrl: "/google.logging.v2.ListMonitoredResourceDescriptorsResponse"; value: Uint8Array; @@ -468,12 +421,6 @@ export interface ListLogsRequest { */ resourceNames: string[]; } -export interface ReactiveListLogsRequest { - parent: ComputedRef; - pageSize: ComputedRef; - pageToken: ComputedRef; - resourceNames: ComputedRef; -} export interface ListLogsRequestProtoMsg { typeUrl: "/google.logging.v2.ListLogsRequest"; value: Uint8Array; @@ -500,10 +447,6 @@ export interface ListLogsResponse { */ nextPageToken: string; } -export interface ReactiveListLogsResponse { - logNames: ComputedRef; - nextPageToken: ComputedRef; -} export interface ListLogsResponseProtoMsg { typeUrl: "/google.logging.v2.ListLogsResponse"; value: Uint8Array; @@ -549,11 +492,6 @@ export interface TailLogEntriesRequest { */ bufferWindow?: Duration; } -export interface ReactiveTailLogEntriesRequest { - resourceNames: ComputedRef; - filter: ComputedRef; - bufferWindow?: ComputedRef; -} export interface TailLogEntriesRequestProtoMsg { typeUrl: "/google.logging.v2.TailLogEntriesRequest"; value: Uint8Array; @@ -581,10 +519,6 @@ export interface TailLogEntriesResponse { */ suppressionInfo: TailLogEntriesResponse_SuppressionInfo[]; } -export interface ReactiveTailLogEntriesResponse { - entries: ComputedRef; - suppressionInfo: ComputedRef; -} export interface TailLogEntriesResponseProtoMsg { typeUrl: "/google.logging.v2.TailLogEntriesResponse"; value: Uint8Array; @@ -601,10 +535,6 @@ export interface TailLogEntriesResponse_SuppressionInfo { /** A lower bound on the count of entries omitted due to `reason`. */ suppressedCount: number; } -export interface ReactiveTailLogEntriesResponse_SuppressionInfo { - reason: ComputedRef; - suppressedCount: ComputedRef; -} export interface TailLogEntriesResponse_SuppressionInfoProtoMsg { typeUrl: "/google.logging.v2.SuppressionInfo"; value: Uint8Array; @@ -622,7 +552,7 @@ function createBaseDeleteLogRequest(): DeleteLogRequest { export const DeleteLogRequest = { typeUrl: "/google.logging.v2.DeleteLogRequest", encode(message: DeleteLogRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.logName !== "") { + if (message.logName !== undefined) { writer.uint32(10).string(message.logName); } return writer; @@ -645,9 +575,9 @@ export const DeleteLogRequest = { return message; }, fromJSON(object: any): DeleteLogRequest { - return { - logName: isSet(object.logName) ? String(object.logName) : "" - }; + const obj = createBaseDeleteLogRequest(); + if (isSet(object.logName)) obj.logName = String(object.logName); + return obj; }, toJSON(message: DeleteLogRequest): JsonSafe { const obj: any = {}; @@ -710,10 +640,10 @@ function createBaseWriteLogEntriesRequest_LabelsEntry(): WriteLogEntriesRequest_ } export const WriteLogEntriesRequest_LabelsEntry = { encode(message: WriteLogEntriesRequest_LabelsEntry, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.key !== "") { + if (message.key !== undefined) { writer.uint32(10).string(message.key); } - if (message.value !== "") { + if (message.value !== undefined) { writer.uint32(18).string(message.value); } return writer; @@ -739,10 +669,10 @@ export const WriteLogEntriesRequest_LabelsEntry = { return message; }, fromJSON(object: any): WriteLogEntriesRequest_LabelsEntry { - return { - key: isSet(object.key) ? String(object.key) : "", - value: isSet(object.value) ? String(object.value) : "" - }; + const obj = createBaseWriteLogEntriesRequest_LabelsEntry(); + if (isSet(object.key)) obj.key = String(object.key); + if (isSet(object.value)) obj.value = String(object.value); + return obj; }, toJSON(message: WriteLogEntriesRequest_LabelsEntry): JsonSafe { const obj: any = {}; @@ -813,7 +743,7 @@ function createBaseWriteLogEntriesRequest(): WriteLogEntriesRequest { export const WriteLogEntriesRequest = { typeUrl: "/google.logging.v2.WriteLogEntriesRequest", encode(message: WriteLogEntriesRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.logName !== "") { + if (message.logName !== undefined) { writer.uint32(10).string(message.logName); } if (message.resource !== undefined) { @@ -828,10 +758,10 @@ export const WriteLogEntriesRequest = { for (const v of message.entries) { LogEntry.encode(v!, writer.uint32(34).fork()).ldelim(); } - if (message.partialSuccess === true) { + if (message.partialSuccess !== undefined) { writer.uint32(40).bool(message.partialSuccess); } - if (message.dryRun === true) { + if (message.dryRun !== undefined) { writer.uint32(48).bool(message.dryRun); } return writer; @@ -872,19 +802,19 @@ export const WriteLogEntriesRequest = { return message; }, fromJSON(object: any): WriteLogEntriesRequest { - return { - logName: isSet(object.logName) ? String(object.logName) : "", - resource: isSet(object.resource) ? MonitoredResource.fromJSON(object.resource) : undefined, - labels: isObject(object.labels) ? Object.entries(object.labels).reduce<{ - [key: string]: string; - }>((acc, [key, value]) => { - acc[key] = String(value); - return acc; - }, {}) : {}, - entries: Array.isArray(object?.entries) ? object.entries.map((e: any) => LogEntry.fromJSON(e)) : [], - partialSuccess: isSet(object.partialSuccess) ? Boolean(object.partialSuccess) : false, - dryRun: isSet(object.dryRun) ? Boolean(object.dryRun) : false - }; + const obj = createBaseWriteLogEntriesRequest(); + if (isSet(object.logName)) obj.logName = String(object.logName); + if (isSet(object.resource)) obj.resource = MonitoredResource.fromJSON(object.resource); + if (isObject(object.labels)) obj.labels = Object.entries(object.labels).reduce<{ + [key: string]: string; + }>((acc, [key, value]) => { + acc[key] = String(value); + return acc; + }, {}); + if (Array.isArray(object?.entries)) obj.entries = object.entries.map((e: any) => LogEntry.fromJSON(e)); + if (isSet(object.partialSuccess)) obj.partialSuccess = Boolean(object.partialSuccess); + if (isSet(object.dryRun)) obj.dryRun = Boolean(object.dryRun); + return obj; }, toJSON(message: WriteLogEntriesRequest): JsonSafe { const obj: any = {}; @@ -908,7 +838,9 @@ export const WriteLogEntriesRequest = { fromPartial(object: DeepPartial): WriteLogEntriesRequest { const message = createBaseWriteLogEntriesRequest(); message.logName = object.logName ?? ""; - message.resource = object.resource !== undefined && object.resource !== null ? MonitoredResource.fromPartial(object.resource) : undefined; + if (object.resource !== undefined && object.resource !== null) { + message.resource = MonitoredResource.fromPartial(object.resource); + } message.labels = Object.entries(object.labels ?? {}).reduce<{ [key: string]: string; }>((acc, [key, value]) => { @@ -1054,7 +986,8 @@ export const WriteLogEntriesResponse = { return message; }, fromJSON(_: any): WriteLogEntriesResponse { - return {}; + const obj = createBaseWriteLogEntriesResponse(); + return obj; }, toJSON(_: WriteLogEntriesResponse): JsonSafe { const obj: any = {}; @@ -1106,7 +1039,7 @@ function createBaseWriteLogEntriesPartialErrors_LogEntryErrorsEntry(): WriteLogE } export const WriteLogEntriesPartialErrors_LogEntryErrorsEntry = { encode(message: WriteLogEntriesPartialErrors_LogEntryErrorsEntry, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.key !== 0) { + if (message.key !== undefined) { writer.uint32(8).int32(message.key); } if (message.value !== undefined) { @@ -1135,10 +1068,10 @@ export const WriteLogEntriesPartialErrors_LogEntryErrorsEntry = { return message; }, fromJSON(object: any): WriteLogEntriesPartialErrors_LogEntryErrorsEntry { - return { - key: isSet(object.key) ? Number(object.key) : 0, - value: isSet(object.value) ? Status.fromJSON(object.value) : undefined - }; + const obj = createBaseWriteLogEntriesPartialErrors_LogEntryErrorsEntry(); + if (isSet(object.key)) obj.key = Number(object.key); + if (isSet(object.value)) obj.value = Status.fromJSON(object.value); + return obj; }, toJSON(message: WriteLogEntriesPartialErrors_LogEntryErrorsEntry): JsonSafe { const obj: any = {}; @@ -1149,7 +1082,9 @@ export const WriteLogEntriesPartialErrors_LogEntryErrorsEntry = { fromPartial(object: DeepPartial): WriteLogEntriesPartialErrors_LogEntryErrorsEntry { const message = createBaseWriteLogEntriesPartialErrors_LogEntryErrorsEntry(); message.key = object.key ?? 0; - message.value = object.value !== undefined && object.value !== null ? Status.fromPartial(object.value) : undefined; + if (object.value !== undefined && object.value !== null) { + message.value = Status.fromPartial(object.value); + } return message; }, fromSDK(object: WriteLogEntriesPartialErrors_LogEntryErrorsEntrySDKType): WriteLogEntriesPartialErrors_LogEntryErrorsEntry { @@ -1233,14 +1168,14 @@ export const WriteLogEntriesPartialErrors = { return message; }, fromJSON(object: any): WriteLogEntriesPartialErrors { - return { - logEntryErrors: isObject(object.logEntryErrors) ? Object.entries(object.logEntryErrors).reduce<{ - [key: number]: Status; - }>((acc, [key, value]) => { - acc[Number(key)] = Status.fromJSON(value); - return acc; - }, {}) : {} - }; + const obj = createBaseWriteLogEntriesPartialErrors(); + if (isObject(object.logEntryErrors)) obj.logEntryErrors = Object.entries(object.logEntryErrors).reduce<{ + [key: number]: Status; + }>((acc, [key, value]) => { + acc[Number(key)] = Status.fromJSON(value); + return acc; + }, {}); + return obj; }, toJSON(message: WriteLogEntriesPartialErrors): JsonSafe { const obj: any = {}; @@ -1347,16 +1282,16 @@ export const ListLogEntriesRequest = { for (const v of message.resourceNames) { writer.uint32(66).string(v!); } - if (message.filter !== "") { + if (message.filter !== undefined) { writer.uint32(18).string(message.filter); } - if (message.orderBy !== "") { + if (message.orderBy !== undefined) { writer.uint32(26).string(message.orderBy); } - if (message.pageSize !== 0) { + if (message.pageSize !== undefined) { writer.uint32(32).int32(message.pageSize); } - if (message.pageToken !== "") { + if (message.pageToken !== undefined) { writer.uint32(42).string(message.pageToken); } return writer; @@ -1391,13 +1326,13 @@ export const ListLogEntriesRequest = { return message; }, fromJSON(object: any): ListLogEntriesRequest { - return { - resourceNames: Array.isArray(object?.resourceNames) ? object.resourceNames.map((e: any) => String(e)) : [], - filter: isSet(object.filter) ? String(object.filter) : "", - orderBy: isSet(object.orderBy) ? String(object.orderBy) : "", - pageSize: isSet(object.pageSize) ? Number(object.pageSize) : 0, - pageToken: isSet(object.pageToken) ? String(object.pageToken) : "" - }; + const obj = createBaseListLogEntriesRequest(); + if (Array.isArray(object?.resourceNames)) obj.resourceNames = object.resourceNames.map((e: any) => String(e)); + if (isSet(object.filter)) obj.filter = String(object.filter); + if (isSet(object.orderBy)) obj.orderBy = String(object.orderBy); + if (isSet(object.pageSize)) obj.pageSize = Number(object.pageSize); + if (isSet(object.pageToken)) obj.pageToken = String(object.pageToken); + return obj; }, toJSON(message: ListLogEntriesRequest): JsonSafe { const obj: any = {}; @@ -1510,7 +1445,7 @@ export const ListLogEntriesResponse = { for (const v of message.entries) { LogEntry.encode(v!, writer.uint32(10).fork()).ldelim(); } - if (message.nextPageToken !== "") { + if (message.nextPageToken !== undefined) { writer.uint32(18).string(message.nextPageToken); } return writer; @@ -1536,10 +1471,10 @@ export const ListLogEntriesResponse = { return message; }, fromJSON(object: any): ListLogEntriesResponse { - return { - entries: Array.isArray(object?.entries) ? object.entries.map((e: any) => LogEntry.fromJSON(e)) : [], - nextPageToken: isSet(object.nextPageToken) ? String(object.nextPageToken) : "" - }; + const obj = createBaseListLogEntriesResponse(); + if (Array.isArray(object?.entries)) obj.entries = object.entries.map((e: any) => LogEntry.fromJSON(e)); + if (isSet(object.nextPageToken)) obj.nextPageToken = String(object.nextPageToken); + return obj; }, toJSON(message: ListLogEntriesResponse): JsonSafe { const obj: any = {}; @@ -1622,10 +1557,10 @@ function createBaseListMonitoredResourceDescriptorsRequest(): ListMonitoredResou export const ListMonitoredResourceDescriptorsRequest = { typeUrl: "/google.logging.v2.ListMonitoredResourceDescriptorsRequest", encode(message: ListMonitoredResourceDescriptorsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.pageSize !== 0) { + if (message.pageSize !== undefined) { writer.uint32(8).int32(message.pageSize); } - if (message.pageToken !== "") { + if (message.pageToken !== undefined) { writer.uint32(18).string(message.pageToken); } return writer; @@ -1651,10 +1586,10 @@ export const ListMonitoredResourceDescriptorsRequest = { return message; }, fromJSON(object: any): ListMonitoredResourceDescriptorsRequest { - return { - pageSize: isSet(object.pageSize) ? Number(object.pageSize) : 0, - pageToken: isSet(object.pageToken) ? String(object.pageToken) : "" - }; + const obj = createBaseListMonitoredResourceDescriptorsRequest(); + if (isSet(object.pageSize)) obj.pageSize = Number(object.pageSize); + if (isSet(object.pageToken)) obj.pageToken = String(object.pageToken); + return obj; }, toJSON(message: ListMonitoredResourceDescriptorsRequest): JsonSafe { const obj: any = {}; @@ -1730,7 +1665,7 @@ export const ListMonitoredResourceDescriptorsResponse = { for (const v of message.resourceDescriptors) { MonitoredResourceDescriptor.encode(v!, writer.uint32(10).fork()).ldelim(); } - if (message.nextPageToken !== "") { + if (message.nextPageToken !== undefined) { writer.uint32(18).string(message.nextPageToken); } return writer; @@ -1756,10 +1691,10 @@ export const ListMonitoredResourceDescriptorsResponse = { return message; }, fromJSON(object: any): ListMonitoredResourceDescriptorsResponse { - return { - resourceDescriptors: Array.isArray(object?.resourceDescriptors) ? object.resourceDescriptors.map((e: any) => MonitoredResourceDescriptor.fromJSON(e)) : [], - nextPageToken: isSet(object.nextPageToken) ? String(object.nextPageToken) : "" - }; + const obj = createBaseListMonitoredResourceDescriptorsResponse(); + if (Array.isArray(object?.resourceDescriptors)) obj.resourceDescriptors = object.resourceDescriptors.map((e: any) => MonitoredResourceDescriptor.fromJSON(e)); + if (isSet(object.nextPageToken)) obj.nextPageToken = String(object.nextPageToken); + return obj; }, toJSON(message: ListMonitoredResourceDescriptorsResponse): JsonSafe { const obj: any = {}; @@ -1844,13 +1779,13 @@ function createBaseListLogsRequest(): ListLogsRequest { export const ListLogsRequest = { typeUrl: "/google.logging.v2.ListLogsRequest", encode(message: ListLogsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.parent !== "") { + if (message.parent !== undefined) { writer.uint32(10).string(message.parent); } - if (message.pageSize !== 0) { + if (message.pageSize !== undefined) { writer.uint32(16).int32(message.pageSize); } - if (message.pageToken !== "") { + if (message.pageToken !== undefined) { writer.uint32(26).string(message.pageToken); } for (const v of message.resourceNames) { @@ -1885,12 +1820,12 @@ export const ListLogsRequest = { return message; }, fromJSON(object: any): ListLogsRequest { - return { - parent: isSet(object.parent) ? String(object.parent) : "", - pageSize: isSet(object.pageSize) ? Number(object.pageSize) : 0, - pageToken: isSet(object.pageToken) ? String(object.pageToken) : "", - resourceNames: Array.isArray(object?.resourceNames) ? object.resourceNames.map((e: any) => String(e)) : [] - }; + const obj = createBaseListLogsRequest(); + if (isSet(object.parent)) obj.parent = String(object.parent); + if (isSet(object.pageSize)) obj.pageSize = Number(object.pageSize); + if (isSet(object.pageToken)) obj.pageToken = String(object.pageToken); + if (Array.isArray(object?.resourceNames)) obj.resourceNames = object.resourceNames.map((e: any) => String(e)); + return obj; }, toJSON(message: ListLogsRequest): JsonSafe { const obj: any = {}; @@ -1994,7 +1929,7 @@ export const ListLogsResponse = { for (const v of message.logNames) { writer.uint32(26).string(v!); } - if (message.nextPageToken !== "") { + if (message.nextPageToken !== undefined) { writer.uint32(18).string(message.nextPageToken); } return writer; @@ -2020,10 +1955,10 @@ export const ListLogsResponse = { return message; }, fromJSON(object: any): ListLogsResponse { - return { - logNames: Array.isArray(object?.logNames) ? object.logNames.map((e: any) => String(e)) : [], - nextPageToken: isSet(object.nextPageToken) ? String(object.nextPageToken) : "" - }; + const obj = createBaseListLogsResponse(); + if (Array.isArray(object?.logNames)) obj.logNames = object.logNames.map((e: any) => String(e)); + if (isSet(object.nextPageToken)) obj.nextPageToken = String(object.nextPageToken); + return obj; }, toJSON(message: ListLogsResponse): JsonSafe { const obj: any = {}; @@ -2110,7 +2045,7 @@ export const TailLogEntriesRequest = { for (const v of message.resourceNames) { writer.uint32(10).string(v!); } - if (message.filter !== "") { + if (message.filter !== undefined) { writer.uint32(18).string(message.filter); } if (message.bufferWindow !== undefined) { @@ -2142,11 +2077,11 @@ export const TailLogEntriesRequest = { return message; }, fromJSON(object: any): TailLogEntriesRequest { - return { - resourceNames: Array.isArray(object?.resourceNames) ? object.resourceNames.map((e: any) => String(e)) : [], - filter: isSet(object.filter) ? String(object.filter) : "", - bufferWindow: isSet(object.bufferWindow) ? Duration.fromJSON(object.bufferWindow) : undefined - }; + const obj = createBaseTailLogEntriesRequest(); + if (Array.isArray(object?.resourceNames)) obj.resourceNames = object.resourceNames.map((e: any) => String(e)); + if (isSet(object.filter)) obj.filter = String(object.filter); + if (isSet(object.bufferWindow)) obj.bufferWindow = Duration.fromJSON(object.bufferWindow); + return obj; }, toJSON(message: TailLogEntriesRequest): JsonSafe { const obj: any = {}; @@ -2163,7 +2098,9 @@ export const TailLogEntriesRequest = { const message = createBaseTailLogEntriesRequest(); message.resourceNames = object.resourceNames?.map(e => e) || []; message.filter = object.filter ?? ""; - message.bufferWindow = object.bufferWindow !== undefined && object.bufferWindow !== null ? Duration.fromPartial(object.bufferWindow) : undefined; + if (object.bufferWindow !== undefined && object.bufferWindow !== null) { + message.bufferWindow = Duration.fromPartial(object.bufferWindow); + } return message; }, fromSDK(object: TailLogEntriesRequestSDKType): TailLogEntriesRequest { @@ -2267,10 +2204,10 @@ export const TailLogEntriesResponse = { return message; }, fromJSON(object: any): TailLogEntriesResponse { - return { - entries: Array.isArray(object?.entries) ? object.entries.map((e: any) => LogEntry.fromJSON(e)) : [], - suppressionInfo: Array.isArray(object?.suppressionInfo) ? object.suppressionInfo.map((e: any) => TailLogEntriesResponse_SuppressionInfo.fromJSON(e)) : [] - }; + const obj = createBaseTailLogEntriesResponse(); + if (Array.isArray(object?.entries)) obj.entries = object.entries.map((e: any) => LogEntry.fromJSON(e)); + if (Array.isArray(object?.suppressionInfo)) obj.suppressionInfo = object.suppressionInfo.map((e: any) => TailLogEntriesResponse_SuppressionInfo.fromJSON(e)); + return obj; }, toJSON(message: TailLogEntriesResponse): JsonSafe { const obj: any = {}; @@ -2366,7 +2303,7 @@ export const TailLogEntriesResponse_SuppressionInfo = { if (message.reason !== 0) { writer.uint32(8).int32(message.reason); } - if (message.suppressedCount !== 0) { + if (message.suppressedCount !== undefined) { writer.uint32(16).int32(message.suppressedCount); } return writer; @@ -2392,10 +2329,10 @@ export const TailLogEntriesResponse_SuppressionInfo = { return message; }, fromJSON(object: any): TailLogEntriesResponse_SuppressionInfo { - return { - reason: isSet(object.reason) ? tailLogEntriesResponse_SuppressionInfo_ReasonFromJSON(object.reason) : -1, - suppressedCount: isSet(object.suppressedCount) ? Number(object.suppressedCount) : 0 - }; + const obj = createBaseTailLogEntriesResponse_SuppressionInfo(); + if (isSet(object.reason)) obj.reason = tailLogEntriesResponse_SuppressionInfo_ReasonFromJSON(object.reason); + if (isSet(object.suppressedCount)) obj.suppressedCount = Number(object.suppressedCount); + return obj; }, toJSON(message: TailLogEntriesResponse_SuppressionInfo): JsonSafe { const obj: any = {}; 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 43c10823d5..99b27c9942 100644 --- a/__fixtures__/v-next/outputv4/google/logging/v2/logging_config.ts +++ b/__fixtures__/v-next/outputv4/google/logging/v2/logging_config.ts @@ -1,9 +1,8 @@ -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 { JsonSafe } from "../../../json-safe"; -import { ComputedRef } from "vue"; +import { FieldMask, FieldMaskSDKType } from "../../protobuf/field_mask.js"; +import { Timestamp, TimestampSDKType } from "../../protobuf/timestamp.js"; +import { BinaryReader, BinaryWriter } from "../../../binary.js"; +import { toTimestamp, fromTimestamp, isSet, DeepPartial } from "../../../helpers.js"; +import { JsonSafe } from "../../../json-safe.js"; export const protobufPackage = "google.logging.v2"; /** Deprecated. This is unused. */ export enum LogSink_VersionFormat { @@ -230,17 +229,6 @@ export interface LogBucket { */ cmekSettings?: CmekSettings; } -export interface ReactiveLogBucket { - name: ComputedRef; - description: ComputedRef; - createTime?: ComputedRef; - updateTime?: ComputedRef; - retentionDays: ComputedRef; - locked: ComputedRef; - lifecycleState: ComputedRef; - restrictedFields: ComputedRef; - cmekSettings?: ComputedRef; -} export interface LogBucketProtoMsg { typeUrl: "/google.logging.v2.LogBucket"; value: Uint8Array; @@ -291,13 +279,6 @@ export interface LogView { */ filter: string; } -export interface ReactiveLogView { - name: ComputedRef; - description: ComputedRef; - createTime?: ComputedRef; - updateTime?: ComputedRef; - filter: ComputedRef; -} export interface LogViewProtoMsg { typeUrl: "/google.logging.v2.LogView"; value: Uint8Array; @@ -428,20 +409,6 @@ export interface LogSink { */ updateTime?: Date; } -export interface ReactiveLogSink { - name: ComputedRef; - destination: ComputedRef; - filter: ComputedRef; - description: ComputedRef; - disabled: ComputedRef; - exclusions: ComputedRef; - outputVersionFormat: ComputedRef; - writerIdentity: ComputedRef; - includeChildren: ComputedRef; - bigqueryOptions?: ComputedRef; - createTime?: ComputedRef; - updateTime?: ComputedRef; -} export interface LogSinkProtoMsg { typeUrl: "/google.logging.v2.LogSink"; value: Uint8Array; @@ -492,10 +459,6 @@ export interface BigQueryOptions { */ usesTimestampColumnPartitioning: boolean; } -export interface ReactiveBigQueryOptions { - usePartitionedTables: ComputedRef; - usesTimestampColumnPartitioning: ComputedRef; -} export interface BigQueryOptionsProtoMsg { typeUrl: "/google.logging.v2.BigQueryOptions"; value: Uint8Array; @@ -534,11 +497,6 @@ export interface ListBucketsRequest { */ pageSize: number; } -export interface ReactiveListBucketsRequest { - parent: ComputedRef; - pageToken: ComputedRef; - pageSize: ComputedRef; -} export interface ListBucketsRequestProtoMsg { typeUrl: "/google.logging.v2.ListBucketsRequest"; value: Uint8Array; @@ -560,10 +518,6 @@ export interface ListBucketsResponse { */ nextPageToken: string; } -export interface ReactiveListBucketsResponse { - buckets: ComputedRef; - nextPageToken: ComputedRef; -} export interface ListBucketsResponseProtoMsg { typeUrl: "/google.logging.v2.ListBucketsResponse"; value: Uint8Array; @@ -598,11 +552,6 @@ export interface CreateBucketRequest { */ bucket?: LogBucket; } -export interface ReactiveCreateBucketRequest { - parent: ComputedRef; - bucketId: ComputedRef; - bucket?: ComputedRef; -} export interface CreateBucketRequestProtoMsg { typeUrl: "/google.logging.v2.CreateBucketRequest"; value: Uint8Array; @@ -642,11 +591,6 @@ export interface UpdateBucketRequest { */ updateMask?: FieldMask; } -export interface ReactiveUpdateBucketRequest { - name: ComputedRef; - bucket?: ComputedRef; - updateMask?: ComputedRef; -} export interface UpdateBucketRequestProtoMsg { typeUrl: "/google.logging.v2.UpdateBucketRequest"; value: Uint8Array; @@ -673,9 +617,6 @@ export interface GetBucketRequest { */ name: string; } -export interface ReactiveGetBucketRequest { - name: ComputedRef; -} export interface GetBucketRequestProtoMsg { typeUrl: "/google.logging.v2.GetBucketRequest"; value: Uint8Array; @@ -700,9 +641,6 @@ export interface DeleteBucketRequest { */ name: string; } -export interface ReactiveDeleteBucketRequest { - name: ComputedRef; -} export interface DeleteBucketRequestProtoMsg { typeUrl: "/google.logging.v2.DeleteBucketRequest"; value: Uint8Array; @@ -727,9 +665,6 @@ export interface UndeleteBucketRequest { */ name: string; } -export interface ReactiveUndeleteBucketRequest { - name: ComputedRef; -} export interface UndeleteBucketRequestProtoMsg { typeUrl: "/google.logging.v2.UndeleteBucketRequest"; value: Uint8Array; @@ -761,11 +696,6 @@ export interface ListViewsRequest { */ pageSize: number; } -export interface ReactiveListViewsRequest { - parent: ComputedRef; - pageToken: ComputedRef; - pageSize: ComputedRef; -} export interface ListViewsRequestProtoMsg { typeUrl: "/google.logging.v2.ListViewsRequest"; value: Uint8Array; @@ -787,10 +717,6 @@ export interface ListViewsResponse { */ nextPageToken: string; } -export interface ReactiveListViewsResponse { - views: ComputedRef; - nextPageToken: ComputedRef; -} export interface ListViewsResponseProtoMsg { typeUrl: "/google.logging.v2.ListViewsResponse"; value: Uint8Array; @@ -817,11 +743,6 @@ export interface CreateViewRequest { /** Required. The new view. */ view?: LogView; } -export interface ReactiveCreateViewRequest { - parent: ComputedRef; - viewId: ComputedRef; - view?: ComputedRef; -} export interface CreateViewRequestProtoMsg { typeUrl: "/google.logging.v2.CreateViewRequest"; value: Uint8Array; @@ -858,11 +779,6 @@ export interface UpdateViewRequest { */ updateMask?: FieldMask; } -export interface ReactiveUpdateViewRequest { - name: ComputedRef; - view?: ComputedRef; - updateMask?: ComputedRef; -} export interface UpdateViewRequestProtoMsg { typeUrl: "/google.logging.v2.UpdateViewRequest"; value: Uint8Array; @@ -886,9 +802,6 @@ export interface GetViewRequest { */ name: string; } -export interface ReactiveGetViewRequest { - name: ComputedRef; -} export interface GetViewRequestProtoMsg { typeUrl: "/google.logging.v2.GetViewRequest"; value: Uint8Array; @@ -910,9 +823,6 @@ export interface DeleteViewRequest { */ name: string; } -export interface ReactiveDeleteViewRequest { - name: ComputedRef; -} export interface DeleteViewRequestProtoMsg { typeUrl: "/google.logging.v2.DeleteViewRequest"; value: Uint8Array; @@ -946,11 +856,6 @@ export interface ListSinksRequest { */ pageSize: number; } -export interface ReactiveListSinksRequest { - parent: ComputedRef; - pageToken: ComputedRef; - pageSize: ComputedRef; -} export interface ListSinksRequestProtoMsg { typeUrl: "/google.logging.v2.ListSinksRequest"; value: Uint8Array; @@ -972,10 +877,6 @@ export interface ListSinksResponse { */ nextPageToken: string; } -export interface ReactiveListSinksResponse { - sinks: ComputedRef; - nextPageToken: ComputedRef; -} export interface ListSinksResponseProtoMsg { typeUrl: "/google.logging.v2.ListSinksResponse"; value: Uint8Array; @@ -1001,9 +902,6 @@ export interface GetSinkRequest { */ sinkName: string; } -export interface ReactiveGetSinkRequest { - sinkName: ComputedRef; -} export interface GetSinkRequestProtoMsg { typeUrl: "/google.logging.v2.GetSinkRequest"; value: Uint8Array; @@ -1048,11 +946,6 @@ export interface CreateSinkRequest { */ uniqueWriterIdentity: boolean; } -export interface ReactiveCreateSinkRequest { - parent: ComputedRef; - sink?: ComputedRef; - uniqueWriterIdentity: ComputedRef; -} export interface CreateSinkRequestProtoMsg { typeUrl: "/google.logging.v2.CreateSinkRequest"; value: Uint8Array; @@ -1118,12 +1011,6 @@ export interface UpdateSinkRequest { */ updateMask?: FieldMask; } -export interface ReactiveUpdateSinkRequest { - sinkName: ComputedRef; - sink?: ComputedRef; - uniqueWriterIdentity: ComputedRef; - updateMask?: ComputedRef; -} export interface UpdateSinkRequestProtoMsg { typeUrl: "/google.logging.v2.UpdateSinkRequest"; value: Uint8Array; @@ -1152,9 +1039,6 @@ export interface DeleteSinkRequest { */ sinkName: string; } -export interface ReactiveDeleteSinkRequest { - sinkName: ComputedRef; -} export interface DeleteSinkRequestProtoMsg { typeUrl: "/google.logging.v2.DeleteSinkRequest"; value: Uint8Array; @@ -1213,14 +1097,6 @@ export interface LogExclusion { */ updateTime?: Date; } -export interface ReactiveLogExclusion { - name: ComputedRef; - description: ComputedRef; - filter: ComputedRef; - disabled: ComputedRef; - createTime?: ComputedRef; - updateTime?: ComputedRef; -} export interface LogExclusionProtoMsg { typeUrl: "/google.logging.v2.LogExclusion"; value: Uint8Array; @@ -1265,11 +1141,6 @@ export interface ListExclusionsRequest { */ pageSize: number; } -export interface ReactiveListExclusionsRequest { - parent: ComputedRef; - pageToken: ComputedRef; - pageSize: ComputedRef; -} export interface ListExclusionsRequestProtoMsg { typeUrl: "/google.logging.v2.ListExclusionsRequest"; value: Uint8Array; @@ -1291,10 +1162,6 @@ export interface ListExclusionsResponse { */ nextPageToken: string; } -export interface ReactiveListExclusionsResponse { - exclusions: ComputedRef; - nextPageToken: ComputedRef; -} export interface ListExclusionsResponseProtoMsg { typeUrl: "/google.logging.v2.ListExclusionsResponse"; value: Uint8Array; @@ -1320,9 +1187,6 @@ export interface GetExclusionRequest { */ name: string; } -export interface ReactiveGetExclusionRequest { - name: ComputedRef; -} export interface GetExclusionRequestProtoMsg { typeUrl: "/google.logging.v2.GetExclusionRequest"; value: Uint8Array; @@ -1353,10 +1217,6 @@ export interface CreateExclusionRequest { */ exclusion?: LogExclusion; } -export interface ReactiveCreateExclusionRequest { - parent: ComputedRef; - exclusion?: ComputedRef; -} export interface CreateExclusionRequestProtoMsg { typeUrl: "/google.logging.v2.CreateExclusionRequest"; value: Uint8Array; @@ -1397,11 +1257,6 @@ export interface UpdateExclusionRequest { */ updateMask?: FieldMask; } -export interface ReactiveUpdateExclusionRequest { - name: ComputedRef; - exclusion?: ComputedRef; - updateMask?: ComputedRef; -} export interface UpdateExclusionRequestProtoMsg { typeUrl: "/google.logging.v2.UpdateExclusionRequest"; value: Uint8Array; @@ -1428,9 +1283,6 @@ export interface DeleteExclusionRequest { */ name: string; } -export interface ReactiveDeleteExclusionRequest { - name: ComputedRef; -} export interface DeleteExclusionRequestProtoMsg { typeUrl: "/google.logging.v2.DeleteExclusionRequest"; value: Uint8Array; @@ -1467,9 +1319,6 @@ export interface GetCmekSettingsRequest { */ name: string; } -export interface ReactiveGetCmekSettingsRequest { - name: ComputedRef; -} export interface GetCmekSettingsRequestProtoMsg { typeUrl: "/google.logging.v2.GetCmekSettingsRequest"; value: Uint8Array; @@ -1530,11 +1379,6 @@ export interface UpdateCmekSettingsRequest { */ updateMask?: FieldMask; } -export interface ReactiveUpdateCmekSettingsRequest { - name: ComputedRef; - cmekSettings?: ComputedRef; - updateMask?: ComputedRef; -} export interface UpdateCmekSettingsRequestProtoMsg { typeUrl: "/google.logging.v2.UpdateCmekSettingsRequest"; value: Uint8Array; @@ -1614,11 +1458,6 @@ export interface CmekSettings { */ serviceAccountId: string; } -export interface ReactiveCmekSettings { - name: ComputedRef; - kmsKeyName: ComputedRef; - serviceAccountId: ComputedRef; -} export interface CmekSettingsProtoMsg { typeUrl: "/google.logging.v2.CmekSettings"; value: Uint8Array; @@ -1668,9 +1507,6 @@ export interface GetSettingsRequest { */ name: string; } -export interface ReactiveGetSettingsRequest { - name: ComputedRef; -} export interface GetSettingsRequestProtoMsg { typeUrl: "/google.logging.v2.GetSettingsRequest"; value: Uint8Array; @@ -1728,11 +1564,6 @@ export interface UpdateSettingsRequest { */ updateMask?: FieldMask; } -export interface ReactiveUpdateSettingsRequest { - name: ComputedRef; - settings?: ComputedRef; - updateMask?: ComputedRef; -} export interface UpdateSettingsRequestProtoMsg { typeUrl: "/google.logging.v2.UpdateSettingsRequest"; value: Uint8Array; @@ -1816,13 +1647,6 @@ export interface Settings { */ disableDefaultSink: boolean; } -export interface ReactiveSettings { - name: ComputedRef; - kmsKeyName: ComputedRef; - kmsServiceAccountId: ComputedRef; - storageLocation: ComputedRef; - disableDefaultSink: ComputedRef; -} export interface SettingsProtoMsg { typeUrl: "/google.logging.v2.Settings"; value: Uint8Array; @@ -1856,11 +1680,6 @@ export interface CopyLogEntriesRequest { /** Required. Destination to which to copy log entries. */ destination: string; } -export interface ReactiveCopyLogEntriesRequest { - name: ComputedRef; - filter: ComputedRef; - destination: ComputedRef; -} export interface CopyLogEntriesRequestProtoMsg { typeUrl: "/google.logging.v2.CopyLogEntriesRequest"; value: Uint8Array; @@ -1896,15 +1715,6 @@ export interface CopyLogEntriesMetadata { */ writerIdentity: string; } -export interface ReactiveCopyLogEntriesMetadata { - startTime?: ComputedRef; - endTime?: ComputedRef; - state: ComputedRef; - cancellationRequested: ComputedRef; - request?: ComputedRef; - progress: ComputedRef; - writerIdentity: ComputedRef; -} export interface CopyLogEntriesMetadataProtoMsg { typeUrl: "/google.logging.v2.CopyLogEntriesMetadata"; value: Uint8Array; @@ -1924,9 +1734,6 @@ export interface CopyLogEntriesResponse { /** Number of log entries copied. */ logEntriesCopiedCount: bigint; } -export interface ReactiveCopyLogEntriesResponse { - logEntriesCopiedCount: ComputedRef; -} export interface CopyLogEntriesResponseProtoMsg { typeUrl: "/google.logging.v2.CopyLogEntriesResponse"; value: Uint8Array; @@ -1951,10 +1758,10 @@ function createBaseLogBucket(): LogBucket { export const LogBucket = { typeUrl: "/google.logging.v2.LogBucket", encode(message: LogBucket, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.name !== "") { + if (message.name !== undefined) { writer.uint32(10).string(message.name); } - if (message.description !== "") { + if (message.description !== undefined) { writer.uint32(26).string(message.description); } if (message.createTime !== undefined) { @@ -1963,10 +1770,10 @@ export const LogBucket = { if (message.updateTime !== undefined) { Timestamp.encode(toTimestamp(message.updateTime), writer.uint32(42).fork()).ldelim(); } - if (message.retentionDays !== 0) { + if (message.retentionDays !== undefined) { writer.uint32(88).int32(message.retentionDays); } - if (message.locked === true) { + if (message.locked !== undefined) { writer.uint32(72).bool(message.locked); } if (message.lifecycleState !== 0) { @@ -2022,17 +1829,17 @@ export const LogBucket = { return message; }, fromJSON(object: any): LogBucket { - return { - name: isSet(object.name) ? String(object.name) : "", - description: isSet(object.description) ? String(object.description) : "", - createTime: isSet(object.createTime) ? new Date(object.createTime) : undefined, - updateTime: isSet(object.updateTime) ? new Date(object.updateTime) : undefined, - retentionDays: isSet(object.retentionDays) ? Number(object.retentionDays) : 0, - locked: isSet(object.locked) ? Boolean(object.locked) : false, - lifecycleState: isSet(object.lifecycleState) ? lifecycleStateFromJSON(object.lifecycleState) : -1, - restrictedFields: Array.isArray(object?.restrictedFields) ? object.restrictedFields.map((e: any) => String(e)) : [], - cmekSettings: isSet(object.cmekSettings) ? CmekSettings.fromJSON(object.cmekSettings) : undefined - }; + const obj = createBaseLogBucket(); + if (isSet(object.name)) obj.name = String(object.name); + if (isSet(object.description)) obj.description = String(object.description); + if (isSet(object.createTime)) obj.createTime = new Date(object.createTime); + if (isSet(object.updateTime)) obj.updateTime = new Date(object.updateTime); + if (isSet(object.retentionDays)) obj.retentionDays = Number(object.retentionDays); + if (isSet(object.locked)) obj.locked = Boolean(object.locked); + if (isSet(object.lifecycleState)) obj.lifecycleState = lifecycleStateFromJSON(object.lifecycleState); + if (Array.isArray(object?.restrictedFields)) obj.restrictedFields = object.restrictedFields.map((e: any) => String(e)); + if (isSet(object.cmekSettings)) obj.cmekSettings = CmekSettings.fromJSON(object.cmekSettings); + return obj; }, toJSON(message: LogBucket): JsonSafe { const obj: any = {}; @@ -2061,7 +1868,9 @@ export const LogBucket = { message.locked = object.locked ?? false; message.lifecycleState = object.lifecycleState ?? 0; message.restrictedFields = object.restrictedFields?.map(e => e) || []; - message.cmekSettings = object.cmekSettings !== undefined && object.cmekSettings !== null ? CmekSettings.fromPartial(object.cmekSettings) : undefined; + if (object.cmekSettings !== undefined && object.cmekSettings !== null) { + message.cmekSettings = CmekSettings.fromPartial(object.cmekSettings); + } return message; }, fromSDK(object: LogBucketSDKType): LogBucket { @@ -2181,10 +1990,10 @@ function createBaseLogView(): LogView { export const LogView = { typeUrl: "/google.logging.v2.LogView", encode(message: LogView, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.name !== "") { + if (message.name !== undefined) { writer.uint32(10).string(message.name); } - if (message.description !== "") { + if (message.description !== undefined) { writer.uint32(26).string(message.description); } if (message.createTime !== undefined) { @@ -2193,7 +2002,7 @@ export const LogView = { if (message.updateTime !== undefined) { Timestamp.encode(toTimestamp(message.updateTime), writer.uint32(42).fork()).ldelim(); } - if (message.filter !== "") { + if (message.filter !== undefined) { writer.uint32(58).string(message.filter); } return writer; @@ -2228,13 +2037,13 @@ export const LogView = { return message; }, fromJSON(object: any): LogView { - return { - name: isSet(object.name) ? String(object.name) : "", - description: isSet(object.description) ? String(object.description) : "", - createTime: isSet(object.createTime) ? new Date(object.createTime) : undefined, - updateTime: isSet(object.updateTime) ? new Date(object.updateTime) : undefined, - filter: isSet(object.filter) ? String(object.filter) : "" - }; + const obj = createBaseLogView(); + if (isSet(object.name)) obj.name = String(object.name); + if (isSet(object.description)) obj.description = String(object.description); + if (isSet(object.createTime)) obj.createTime = new Date(object.createTime); + if (isSet(object.updateTime)) obj.updateTime = new Date(object.updateTime); + if (isSet(object.filter)) obj.filter = String(object.filter); + return obj; }, toJSON(message: LogView): JsonSafe { const obj: any = {}; @@ -2344,19 +2153,19 @@ function createBaseLogSink(): LogSink { export const LogSink = { typeUrl: "/google.logging.v2.LogSink", encode(message: LogSink, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.name !== "") { + if (message.name !== undefined) { writer.uint32(10).string(message.name); } - if (message.destination !== "") { + if (message.destination !== undefined) { writer.uint32(26).string(message.destination); } - if (message.filter !== "") { + if (message.filter !== undefined) { writer.uint32(42).string(message.filter); } - if (message.description !== "") { + if (message.description !== undefined) { writer.uint32(146).string(message.description); } - if (message.disabled === true) { + if (message.disabled !== undefined) { writer.uint32(152).bool(message.disabled); } for (const v of message.exclusions) { @@ -2365,10 +2174,10 @@ export const LogSink = { if (message.outputVersionFormat !== 0) { writer.uint32(48).int32(message.outputVersionFormat); } - if (message.writerIdentity !== "") { + if (message.writerIdentity !== undefined) { writer.uint32(66).string(message.writerIdentity); } - if (message.includeChildren === true) { + if (message.includeChildren !== undefined) { writer.uint32(72).bool(message.includeChildren); } if (message.bigqueryOptions !== undefined) { @@ -2433,20 +2242,20 @@ export const LogSink = { return message; }, fromJSON(object: any): LogSink { - return { - name: isSet(object.name) ? String(object.name) : "", - destination: isSet(object.destination) ? String(object.destination) : "", - filter: isSet(object.filter) ? String(object.filter) : "", - description: isSet(object.description) ? String(object.description) : "", - disabled: isSet(object.disabled) ? Boolean(object.disabled) : false, - exclusions: Array.isArray(object?.exclusions) ? object.exclusions.map((e: any) => LogExclusion.fromJSON(e)) : [], - outputVersionFormat: isSet(object.outputVersionFormat) ? logSink_VersionFormatFromJSON(object.outputVersionFormat) : -1, - writerIdentity: isSet(object.writerIdentity) ? String(object.writerIdentity) : "", - includeChildren: isSet(object.includeChildren) ? Boolean(object.includeChildren) : false, - bigqueryOptions: isSet(object.bigqueryOptions) ? BigQueryOptions.fromJSON(object.bigqueryOptions) : undefined, - createTime: isSet(object.createTime) ? new Date(object.createTime) : undefined, - updateTime: isSet(object.updateTime) ? new Date(object.updateTime) : undefined - }; + const obj = createBaseLogSink(); + if (isSet(object.name)) obj.name = String(object.name); + if (isSet(object.destination)) obj.destination = String(object.destination); + if (isSet(object.filter)) obj.filter = String(object.filter); + if (isSet(object.description)) obj.description = String(object.description); + if (isSet(object.disabled)) obj.disabled = Boolean(object.disabled); + if (Array.isArray(object?.exclusions)) obj.exclusions = object.exclusions.map((e: any) => LogExclusion.fromJSON(e)); + if (isSet(object.outputVersionFormat)) obj.outputVersionFormat = logSink_VersionFormatFromJSON(object.outputVersionFormat); + if (isSet(object.writerIdentity)) obj.writerIdentity = String(object.writerIdentity); + if (isSet(object.includeChildren)) obj.includeChildren = Boolean(object.includeChildren); + if (isSet(object.bigqueryOptions)) obj.bigqueryOptions = BigQueryOptions.fromJSON(object.bigqueryOptions); + if (isSet(object.createTime)) obj.createTime = new Date(object.createTime); + if (isSet(object.updateTime)) obj.updateTime = new Date(object.updateTime); + return obj; }, toJSON(message: LogSink): JsonSafe { const obj: any = {}; @@ -2479,7 +2288,9 @@ export const LogSink = { message.outputVersionFormat = object.outputVersionFormat ?? 0; message.writerIdentity = object.writerIdentity ?? ""; message.includeChildren = object.includeChildren ?? false; - message.bigqueryOptions = object.bigqueryOptions !== undefined && object.bigqueryOptions !== null ? BigQueryOptions.fromPartial(object.bigqueryOptions) : undefined; + if (object.bigqueryOptions !== undefined && object.bigqueryOptions !== null) { + message.bigqueryOptions = BigQueryOptions.fromPartial(object.bigqueryOptions); + } message.createTime = object.createTime ?? undefined; message.updateTime = object.updateTime ?? undefined; return message; @@ -2619,10 +2430,10 @@ function createBaseBigQueryOptions(): BigQueryOptions { export const BigQueryOptions = { typeUrl: "/google.logging.v2.BigQueryOptions", encode(message: BigQueryOptions, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.usePartitionedTables === true) { + if (message.usePartitionedTables !== undefined) { writer.uint32(8).bool(message.usePartitionedTables); } - if (message.usesTimestampColumnPartitioning === true) { + if (message.usesTimestampColumnPartitioning !== undefined) { writer.uint32(24).bool(message.usesTimestampColumnPartitioning); } return writer; @@ -2648,10 +2459,10 @@ export const BigQueryOptions = { return message; }, fromJSON(object: any): BigQueryOptions { - return { - usePartitionedTables: isSet(object.usePartitionedTables) ? Boolean(object.usePartitionedTables) : false, - usesTimestampColumnPartitioning: isSet(object.usesTimestampColumnPartitioning) ? Boolean(object.usesTimestampColumnPartitioning) : false - }; + const obj = createBaseBigQueryOptions(); + if (isSet(object.usePartitionedTables)) obj.usePartitionedTables = Boolean(object.usePartitionedTables); + if (isSet(object.usesTimestampColumnPartitioning)) obj.usesTimestampColumnPartitioning = Boolean(object.usesTimestampColumnPartitioning); + return obj; }, toJSON(message: BigQueryOptions): JsonSafe { const obj: any = {}; @@ -2725,13 +2536,13 @@ function createBaseListBucketsRequest(): ListBucketsRequest { export const ListBucketsRequest = { typeUrl: "/google.logging.v2.ListBucketsRequest", encode(message: ListBucketsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.parent !== "") { + if (message.parent !== undefined) { writer.uint32(10).string(message.parent); } - if (message.pageToken !== "") { + if (message.pageToken !== undefined) { writer.uint32(18).string(message.pageToken); } - if (message.pageSize !== 0) { + if (message.pageSize !== undefined) { writer.uint32(24).int32(message.pageSize); } return writer; @@ -2760,11 +2571,11 @@ export const ListBucketsRequest = { return message; }, fromJSON(object: any): ListBucketsRequest { - return { - parent: isSet(object.parent) ? String(object.parent) : "", - pageToken: isSet(object.pageToken) ? String(object.pageToken) : "", - pageSize: isSet(object.pageSize) ? Number(object.pageSize) : 0 - }; + const obj = createBaseListBucketsRequest(); + if (isSet(object.parent)) obj.parent = String(object.parent); + if (isSet(object.pageToken)) obj.pageToken = String(object.pageToken); + if (isSet(object.pageSize)) obj.pageSize = Number(object.pageSize); + return obj; }, toJSON(message: ListBucketsRequest): JsonSafe { const obj: any = {}; @@ -2849,7 +2660,7 @@ export const ListBucketsResponse = { for (const v of message.buckets) { LogBucket.encode(v!, writer.uint32(10).fork()).ldelim(); } - if (message.nextPageToken !== "") { + if (message.nextPageToken !== undefined) { writer.uint32(18).string(message.nextPageToken); } return writer; @@ -2875,10 +2686,10 @@ export const ListBucketsResponse = { return message; }, fromJSON(object: any): ListBucketsResponse { - return { - buckets: Array.isArray(object?.buckets) ? object.buckets.map((e: any) => LogBucket.fromJSON(e)) : [], - nextPageToken: isSet(object.nextPageToken) ? String(object.nextPageToken) : "" - }; + const obj = createBaseListBucketsResponse(); + if (Array.isArray(object?.buckets)) obj.buckets = object.buckets.map((e: any) => LogBucket.fromJSON(e)); + if (isSet(object.nextPageToken)) obj.nextPageToken = String(object.nextPageToken); + return obj; }, toJSON(message: ListBucketsResponse): JsonSafe { const obj: any = {}; @@ -2962,10 +2773,10 @@ function createBaseCreateBucketRequest(): CreateBucketRequest { export const CreateBucketRequest = { typeUrl: "/google.logging.v2.CreateBucketRequest", encode(message: CreateBucketRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.parent !== "") { + if (message.parent !== undefined) { writer.uint32(10).string(message.parent); } - if (message.bucketId !== "") { + if (message.bucketId !== undefined) { writer.uint32(18).string(message.bucketId); } if (message.bucket !== undefined) { @@ -2997,11 +2808,11 @@ export const CreateBucketRequest = { return message; }, fromJSON(object: any): CreateBucketRequest { - return { - parent: isSet(object.parent) ? String(object.parent) : "", - bucketId: isSet(object.bucketId) ? String(object.bucketId) : "", - bucket: isSet(object.bucket) ? LogBucket.fromJSON(object.bucket) : undefined - }; + const obj = createBaseCreateBucketRequest(); + if (isSet(object.parent)) obj.parent = String(object.parent); + if (isSet(object.bucketId)) obj.bucketId = String(object.bucketId); + if (isSet(object.bucket)) obj.bucket = LogBucket.fromJSON(object.bucket); + return obj; }, toJSON(message: CreateBucketRequest): JsonSafe { const obj: any = {}; @@ -3014,7 +2825,9 @@ export const CreateBucketRequest = { const message = createBaseCreateBucketRequest(); message.parent = object.parent ?? ""; message.bucketId = object.bucketId ?? ""; - message.bucket = object.bucket !== undefined && object.bucket !== null ? LogBucket.fromPartial(object.bucket) : undefined; + if (object.bucket !== undefined && object.bucket !== null) { + message.bucket = LogBucket.fromPartial(object.bucket); + } return message; }, fromSDK(object: CreateBucketRequestSDKType): CreateBucketRequest { @@ -3084,7 +2897,7 @@ function createBaseUpdateBucketRequest(): UpdateBucketRequest { export const UpdateBucketRequest = { typeUrl: "/google.logging.v2.UpdateBucketRequest", encode(message: UpdateBucketRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.name !== "") { + if (message.name !== undefined) { writer.uint32(10).string(message.name); } if (message.bucket !== undefined) { @@ -3119,11 +2932,11 @@ export const UpdateBucketRequest = { return message; }, fromJSON(object: any): UpdateBucketRequest { - return { - name: isSet(object.name) ? String(object.name) : "", - bucket: isSet(object.bucket) ? LogBucket.fromJSON(object.bucket) : undefined, - updateMask: isSet(object.updateMask) ? FieldMask.fromJSON(object.updateMask) : undefined - }; + const obj = createBaseUpdateBucketRequest(); + if (isSet(object.name)) obj.name = String(object.name); + if (isSet(object.bucket)) obj.bucket = LogBucket.fromJSON(object.bucket); + if (isSet(object.updateMask)) obj.updateMask = FieldMask.fromJSON(object.updateMask); + return obj; }, toJSON(message: UpdateBucketRequest): JsonSafe { const obj: any = {}; @@ -3135,8 +2948,12 @@ export const UpdateBucketRequest = { fromPartial(object: DeepPartial): UpdateBucketRequest { const message = createBaseUpdateBucketRequest(); message.name = object.name ?? ""; - message.bucket = object.bucket !== undefined && object.bucket !== null ? LogBucket.fromPartial(object.bucket) : undefined; - message.updateMask = object.updateMask !== undefined && object.updateMask !== null ? FieldMask.fromPartial(object.updateMask) : undefined; + if (object.bucket !== undefined && object.bucket !== null) { + message.bucket = LogBucket.fromPartial(object.bucket); + } + if (object.updateMask !== undefined && object.updateMask !== null) { + message.updateMask = FieldMask.fromPartial(object.updateMask); + } return message; }, fromSDK(object: UpdateBucketRequestSDKType): UpdateBucketRequest { @@ -3204,7 +3021,7 @@ function createBaseGetBucketRequest(): GetBucketRequest { export const GetBucketRequest = { typeUrl: "/google.logging.v2.GetBucketRequest", encode(message: GetBucketRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.name !== "") { + if (message.name !== undefined) { writer.uint32(10).string(message.name); } return writer; @@ -3227,9 +3044,9 @@ export const GetBucketRequest = { return message; }, fromJSON(object: any): GetBucketRequest { - return { - name: isSet(object.name) ? String(object.name) : "" - }; + const obj = createBaseGetBucketRequest(); + if (isSet(object.name)) obj.name = String(object.name); + return obj; }, toJSON(message: GetBucketRequest): JsonSafe { const obj: any = {}; @@ -3292,7 +3109,7 @@ function createBaseDeleteBucketRequest(): DeleteBucketRequest { export const DeleteBucketRequest = { typeUrl: "/google.logging.v2.DeleteBucketRequest", encode(message: DeleteBucketRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.name !== "") { + if (message.name !== undefined) { writer.uint32(10).string(message.name); } return writer; @@ -3315,9 +3132,9 @@ export const DeleteBucketRequest = { return message; }, fromJSON(object: any): DeleteBucketRequest { - return { - name: isSet(object.name) ? String(object.name) : "" - }; + const obj = createBaseDeleteBucketRequest(); + if (isSet(object.name)) obj.name = String(object.name); + return obj; }, toJSON(message: DeleteBucketRequest): JsonSafe { const obj: any = {}; @@ -3380,7 +3197,7 @@ function createBaseUndeleteBucketRequest(): UndeleteBucketRequest { export const UndeleteBucketRequest = { typeUrl: "/google.logging.v2.UndeleteBucketRequest", encode(message: UndeleteBucketRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.name !== "") { + if (message.name !== undefined) { writer.uint32(10).string(message.name); } return writer; @@ -3403,9 +3220,9 @@ export const UndeleteBucketRequest = { return message; }, fromJSON(object: any): UndeleteBucketRequest { - return { - name: isSet(object.name) ? String(object.name) : "" - }; + const obj = createBaseUndeleteBucketRequest(); + if (isSet(object.name)) obj.name = String(object.name); + return obj; }, toJSON(message: UndeleteBucketRequest): JsonSafe { const obj: any = {}; @@ -3470,13 +3287,13 @@ function createBaseListViewsRequest(): ListViewsRequest { export const ListViewsRequest = { typeUrl: "/google.logging.v2.ListViewsRequest", encode(message: ListViewsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.parent !== "") { + if (message.parent !== undefined) { writer.uint32(10).string(message.parent); } - if (message.pageToken !== "") { + if (message.pageToken !== undefined) { writer.uint32(18).string(message.pageToken); } - if (message.pageSize !== 0) { + if (message.pageSize !== undefined) { writer.uint32(24).int32(message.pageSize); } return writer; @@ -3505,11 +3322,11 @@ export const ListViewsRequest = { return message; }, fromJSON(object: any): ListViewsRequest { - return { - parent: isSet(object.parent) ? String(object.parent) : "", - pageToken: isSet(object.pageToken) ? String(object.pageToken) : "", - pageSize: isSet(object.pageSize) ? Number(object.pageSize) : 0 - }; + const obj = createBaseListViewsRequest(); + if (isSet(object.parent)) obj.parent = String(object.parent); + if (isSet(object.pageToken)) obj.pageToken = String(object.pageToken); + if (isSet(object.pageSize)) obj.pageSize = Number(object.pageSize); + return obj; }, toJSON(message: ListViewsRequest): JsonSafe { const obj: any = {}; @@ -3594,7 +3411,7 @@ export const ListViewsResponse = { for (const v of message.views) { LogView.encode(v!, writer.uint32(10).fork()).ldelim(); } - if (message.nextPageToken !== "") { + if (message.nextPageToken !== undefined) { writer.uint32(18).string(message.nextPageToken); } return writer; @@ -3620,10 +3437,10 @@ export const ListViewsResponse = { return message; }, fromJSON(object: any): ListViewsResponse { - return { - views: Array.isArray(object?.views) ? object.views.map((e: any) => LogView.fromJSON(e)) : [], - nextPageToken: isSet(object.nextPageToken) ? String(object.nextPageToken) : "" - }; + const obj = createBaseListViewsResponse(); + if (Array.isArray(object?.views)) obj.views = object.views.map((e: any) => LogView.fromJSON(e)); + if (isSet(object.nextPageToken)) obj.nextPageToken = String(object.nextPageToken); + return obj; }, toJSON(message: ListViewsResponse): JsonSafe { const obj: any = {}; @@ -3707,10 +3524,10 @@ function createBaseCreateViewRequest(): CreateViewRequest { export const CreateViewRequest = { typeUrl: "/google.logging.v2.CreateViewRequest", encode(message: CreateViewRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.parent !== "") { + if (message.parent !== undefined) { writer.uint32(10).string(message.parent); } - if (message.viewId !== "") { + if (message.viewId !== undefined) { writer.uint32(18).string(message.viewId); } if (message.view !== undefined) { @@ -3742,11 +3559,11 @@ export const CreateViewRequest = { return message; }, fromJSON(object: any): CreateViewRequest { - return { - parent: isSet(object.parent) ? String(object.parent) : "", - viewId: isSet(object.viewId) ? String(object.viewId) : "", - view: isSet(object.view) ? LogView.fromJSON(object.view) : undefined - }; + const obj = createBaseCreateViewRequest(); + if (isSet(object.parent)) obj.parent = String(object.parent); + if (isSet(object.viewId)) obj.viewId = String(object.viewId); + if (isSet(object.view)) obj.view = LogView.fromJSON(object.view); + return obj; }, toJSON(message: CreateViewRequest): JsonSafe { const obj: any = {}; @@ -3759,7 +3576,9 @@ export const CreateViewRequest = { const message = createBaseCreateViewRequest(); message.parent = object.parent ?? ""; message.viewId = object.viewId ?? ""; - message.view = object.view !== undefined && object.view !== null ? LogView.fromPartial(object.view) : undefined; + if (object.view !== undefined && object.view !== null) { + message.view = LogView.fromPartial(object.view); + } return message; }, fromSDK(object: CreateViewRequestSDKType): CreateViewRequest { @@ -3829,7 +3648,7 @@ function createBaseUpdateViewRequest(): UpdateViewRequest { export const UpdateViewRequest = { typeUrl: "/google.logging.v2.UpdateViewRequest", encode(message: UpdateViewRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.name !== "") { + if (message.name !== undefined) { writer.uint32(10).string(message.name); } if (message.view !== undefined) { @@ -3864,11 +3683,11 @@ export const UpdateViewRequest = { return message; }, fromJSON(object: any): UpdateViewRequest { - return { - name: isSet(object.name) ? String(object.name) : "", - view: isSet(object.view) ? LogView.fromJSON(object.view) : undefined, - updateMask: isSet(object.updateMask) ? FieldMask.fromJSON(object.updateMask) : undefined - }; + const obj = createBaseUpdateViewRequest(); + if (isSet(object.name)) obj.name = String(object.name); + if (isSet(object.view)) obj.view = LogView.fromJSON(object.view); + if (isSet(object.updateMask)) obj.updateMask = FieldMask.fromJSON(object.updateMask); + return obj; }, toJSON(message: UpdateViewRequest): JsonSafe { const obj: any = {}; @@ -3880,8 +3699,12 @@ export const UpdateViewRequest = { fromPartial(object: DeepPartial): UpdateViewRequest { const message = createBaseUpdateViewRequest(); message.name = object.name ?? ""; - message.view = object.view !== undefined && object.view !== null ? LogView.fromPartial(object.view) : undefined; - message.updateMask = object.updateMask !== undefined && object.updateMask !== null ? FieldMask.fromPartial(object.updateMask) : undefined; + if (object.view !== undefined && object.view !== null) { + message.view = LogView.fromPartial(object.view); + } + if (object.updateMask !== undefined && object.updateMask !== null) { + message.updateMask = FieldMask.fromPartial(object.updateMask); + } return message; }, fromSDK(object: UpdateViewRequestSDKType): UpdateViewRequest { @@ -3949,7 +3772,7 @@ function createBaseGetViewRequest(): GetViewRequest { export const GetViewRequest = { typeUrl: "/google.logging.v2.GetViewRequest", encode(message: GetViewRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.name !== "") { + if (message.name !== undefined) { writer.uint32(10).string(message.name); } return writer; @@ -3972,9 +3795,9 @@ export const GetViewRequest = { return message; }, fromJSON(object: any): GetViewRequest { - return { - name: isSet(object.name) ? String(object.name) : "" - }; + const obj = createBaseGetViewRequest(); + if (isSet(object.name)) obj.name = String(object.name); + return obj; }, toJSON(message: GetViewRequest): JsonSafe { const obj: any = {}; @@ -4037,7 +3860,7 @@ function createBaseDeleteViewRequest(): DeleteViewRequest { export const DeleteViewRequest = { typeUrl: "/google.logging.v2.DeleteViewRequest", encode(message: DeleteViewRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.name !== "") { + if (message.name !== undefined) { writer.uint32(10).string(message.name); } return writer; @@ -4060,9 +3883,9 @@ export const DeleteViewRequest = { return message; }, fromJSON(object: any): DeleteViewRequest { - return { - name: isSet(object.name) ? String(object.name) : "" - }; + const obj = createBaseDeleteViewRequest(); + if (isSet(object.name)) obj.name = String(object.name); + return obj; }, toJSON(message: DeleteViewRequest): JsonSafe { const obj: any = {}; @@ -4127,13 +3950,13 @@ function createBaseListSinksRequest(): ListSinksRequest { export const ListSinksRequest = { typeUrl: "/google.logging.v2.ListSinksRequest", encode(message: ListSinksRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.parent !== "") { + if (message.parent !== undefined) { writer.uint32(10).string(message.parent); } - if (message.pageToken !== "") { + if (message.pageToken !== undefined) { writer.uint32(18).string(message.pageToken); } - if (message.pageSize !== 0) { + if (message.pageSize !== undefined) { writer.uint32(24).int32(message.pageSize); } return writer; @@ -4162,11 +3985,11 @@ export const ListSinksRequest = { return message; }, fromJSON(object: any): ListSinksRequest { - return { - parent: isSet(object.parent) ? String(object.parent) : "", - pageToken: isSet(object.pageToken) ? String(object.pageToken) : "", - pageSize: isSet(object.pageSize) ? Number(object.pageSize) : 0 - }; + const obj = createBaseListSinksRequest(); + if (isSet(object.parent)) obj.parent = String(object.parent); + if (isSet(object.pageToken)) obj.pageToken = String(object.pageToken); + if (isSet(object.pageSize)) obj.pageSize = Number(object.pageSize); + return obj; }, toJSON(message: ListSinksRequest): JsonSafe { const obj: any = {}; @@ -4251,7 +4074,7 @@ export const ListSinksResponse = { for (const v of message.sinks) { LogSink.encode(v!, writer.uint32(10).fork()).ldelim(); } - if (message.nextPageToken !== "") { + if (message.nextPageToken !== undefined) { writer.uint32(18).string(message.nextPageToken); } return writer; @@ -4277,10 +4100,10 @@ export const ListSinksResponse = { return message; }, fromJSON(object: any): ListSinksResponse { - return { - sinks: Array.isArray(object?.sinks) ? object.sinks.map((e: any) => LogSink.fromJSON(e)) : [], - nextPageToken: isSet(object.nextPageToken) ? String(object.nextPageToken) : "" - }; + const obj = createBaseListSinksResponse(); + if (Array.isArray(object?.sinks)) obj.sinks = object.sinks.map((e: any) => LogSink.fromJSON(e)); + if (isSet(object.nextPageToken)) obj.nextPageToken = String(object.nextPageToken); + return obj; }, toJSON(message: ListSinksResponse): JsonSafe { const obj: any = {}; @@ -4362,7 +4185,7 @@ function createBaseGetSinkRequest(): GetSinkRequest { export const GetSinkRequest = { typeUrl: "/google.logging.v2.GetSinkRequest", encode(message: GetSinkRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.sinkName !== "") { + if (message.sinkName !== undefined) { writer.uint32(10).string(message.sinkName); } return writer; @@ -4385,9 +4208,9 @@ export const GetSinkRequest = { return message; }, fromJSON(object: any): GetSinkRequest { - return { - sinkName: isSet(object.sinkName) ? String(object.sinkName) : "" - }; + const obj = createBaseGetSinkRequest(); + if (isSet(object.sinkName)) obj.sinkName = String(object.sinkName); + return obj; }, toJSON(message: GetSinkRequest): JsonSafe { const obj: any = {}; @@ -4452,13 +4275,13 @@ function createBaseCreateSinkRequest(): CreateSinkRequest { export const CreateSinkRequest = { typeUrl: "/google.logging.v2.CreateSinkRequest", encode(message: CreateSinkRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.parent !== "") { + if (message.parent !== undefined) { writer.uint32(10).string(message.parent); } if (message.sink !== undefined) { LogSink.encode(message.sink, writer.uint32(18).fork()).ldelim(); } - if (message.uniqueWriterIdentity === true) { + if (message.uniqueWriterIdentity !== undefined) { writer.uint32(24).bool(message.uniqueWriterIdentity); } return writer; @@ -4487,11 +4310,11 @@ export const CreateSinkRequest = { return message; }, fromJSON(object: any): CreateSinkRequest { - return { - parent: isSet(object.parent) ? String(object.parent) : "", - sink: isSet(object.sink) ? LogSink.fromJSON(object.sink) : undefined, - uniqueWriterIdentity: isSet(object.uniqueWriterIdentity) ? Boolean(object.uniqueWriterIdentity) : false - }; + const obj = createBaseCreateSinkRequest(); + if (isSet(object.parent)) obj.parent = String(object.parent); + if (isSet(object.sink)) obj.sink = LogSink.fromJSON(object.sink); + if (isSet(object.uniqueWriterIdentity)) obj.uniqueWriterIdentity = Boolean(object.uniqueWriterIdentity); + return obj; }, toJSON(message: CreateSinkRequest): JsonSafe { const obj: any = {}; @@ -4503,7 +4326,9 @@ export const CreateSinkRequest = { fromPartial(object: DeepPartial): CreateSinkRequest { const message = createBaseCreateSinkRequest(); message.parent = object.parent ?? ""; - message.sink = object.sink !== undefined && object.sink !== null ? LogSink.fromPartial(object.sink) : undefined; + if (object.sink !== undefined && object.sink !== null) { + message.sink = LogSink.fromPartial(object.sink); + } message.uniqueWriterIdentity = object.uniqueWriterIdentity ?? false; return message; }, @@ -4575,13 +4400,13 @@ function createBaseUpdateSinkRequest(): UpdateSinkRequest { export const UpdateSinkRequest = { typeUrl: "/google.logging.v2.UpdateSinkRequest", encode(message: UpdateSinkRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.sinkName !== "") { + if (message.sinkName !== undefined) { writer.uint32(10).string(message.sinkName); } if (message.sink !== undefined) { LogSink.encode(message.sink, writer.uint32(18).fork()).ldelim(); } - if (message.uniqueWriterIdentity === true) { + if (message.uniqueWriterIdentity !== undefined) { writer.uint32(24).bool(message.uniqueWriterIdentity); } if (message.updateMask !== undefined) { @@ -4616,12 +4441,12 @@ export const UpdateSinkRequest = { return message; }, fromJSON(object: any): UpdateSinkRequest { - return { - sinkName: isSet(object.sinkName) ? String(object.sinkName) : "", - sink: isSet(object.sink) ? LogSink.fromJSON(object.sink) : undefined, - uniqueWriterIdentity: isSet(object.uniqueWriterIdentity) ? Boolean(object.uniqueWriterIdentity) : false, - updateMask: isSet(object.updateMask) ? FieldMask.fromJSON(object.updateMask) : undefined - }; + const obj = createBaseUpdateSinkRequest(); + if (isSet(object.sinkName)) obj.sinkName = String(object.sinkName); + if (isSet(object.sink)) obj.sink = LogSink.fromJSON(object.sink); + if (isSet(object.uniqueWriterIdentity)) obj.uniqueWriterIdentity = Boolean(object.uniqueWriterIdentity); + if (isSet(object.updateMask)) obj.updateMask = FieldMask.fromJSON(object.updateMask); + return obj; }, toJSON(message: UpdateSinkRequest): JsonSafe { const obj: any = {}; @@ -4634,9 +4459,13 @@ export const UpdateSinkRequest = { fromPartial(object: DeepPartial): UpdateSinkRequest { const message = createBaseUpdateSinkRequest(); message.sinkName = object.sinkName ?? ""; - message.sink = object.sink !== undefined && object.sink !== null ? LogSink.fromPartial(object.sink) : undefined; + if (object.sink !== undefined && object.sink !== null) { + message.sink = LogSink.fromPartial(object.sink); + } message.uniqueWriterIdentity = object.uniqueWriterIdentity ?? false; - message.updateMask = object.updateMask !== undefined && object.updateMask !== null ? FieldMask.fromPartial(object.updateMask) : undefined; + if (object.updateMask !== undefined && object.updateMask !== null) { + message.updateMask = FieldMask.fromPartial(object.updateMask); + } return message; }, fromSDK(object: UpdateSinkRequestSDKType): UpdateSinkRequest { @@ -4711,7 +4540,7 @@ function createBaseDeleteSinkRequest(): DeleteSinkRequest { export const DeleteSinkRequest = { typeUrl: "/google.logging.v2.DeleteSinkRequest", encode(message: DeleteSinkRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.sinkName !== "") { + if (message.sinkName !== undefined) { writer.uint32(10).string(message.sinkName); } return writer; @@ -4734,9 +4563,9 @@ export const DeleteSinkRequest = { return message; }, fromJSON(object: any): DeleteSinkRequest { - return { - sinkName: isSet(object.sinkName) ? String(object.sinkName) : "" - }; + const obj = createBaseDeleteSinkRequest(); + if (isSet(object.sinkName)) obj.sinkName = String(object.sinkName); + return obj; }, toJSON(message: DeleteSinkRequest): JsonSafe { const obj: any = {}; @@ -4804,16 +4633,16 @@ function createBaseLogExclusion(): LogExclusion { export const LogExclusion = { typeUrl: "/google.logging.v2.LogExclusion", encode(message: LogExclusion, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.name !== "") { + if (message.name !== undefined) { writer.uint32(10).string(message.name); } - if (message.description !== "") { + if (message.description !== undefined) { writer.uint32(18).string(message.description); } - if (message.filter !== "") { + if (message.filter !== undefined) { writer.uint32(26).string(message.filter); } - if (message.disabled === true) { + if (message.disabled !== undefined) { writer.uint32(32).bool(message.disabled); } if (message.createTime !== undefined) { @@ -4857,14 +4686,14 @@ export const LogExclusion = { return message; }, fromJSON(object: any): LogExclusion { - return { - name: isSet(object.name) ? String(object.name) : "", - description: isSet(object.description) ? String(object.description) : "", - filter: isSet(object.filter) ? String(object.filter) : "", - disabled: isSet(object.disabled) ? Boolean(object.disabled) : false, - createTime: isSet(object.createTime) ? new Date(object.createTime) : undefined, - updateTime: isSet(object.updateTime) ? new Date(object.updateTime) : undefined - }; + const obj = createBaseLogExclusion(); + if (isSet(object.name)) obj.name = String(object.name); + if (isSet(object.description)) obj.description = String(object.description); + if (isSet(object.filter)) obj.filter = String(object.filter); + if (isSet(object.disabled)) obj.disabled = Boolean(object.disabled); + if (isSet(object.createTime)) obj.createTime = new Date(object.createTime); + if (isSet(object.updateTime)) obj.updateTime = new Date(object.updateTime); + return obj; }, toJSON(message: LogExclusion): JsonSafe { const obj: any = {}; @@ -4974,13 +4803,13 @@ function createBaseListExclusionsRequest(): ListExclusionsRequest { export const ListExclusionsRequest = { typeUrl: "/google.logging.v2.ListExclusionsRequest", encode(message: ListExclusionsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.parent !== "") { + if (message.parent !== undefined) { writer.uint32(10).string(message.parent); } - if (message.pageToken !== "") { + if (message.pageToken !== undefined) { writer.uint32(18).string(message.pageToken); } - if (message.pageSize !== 0) { + if (message.pageSize !== undefined) { writer.uint32(24).int32(message.pageSize); } return writer; @@ -5009,11 +4838,11 @@ export const ListExclusionsRequest = { return message; }, fromJSON(object: any): ListExclusionsRequest { - return { - parent: isSet(object.parent) ? String(object.parent) : "", - pageToken: isSet(object.pageToken) ? String(object.pageToken) : "", - pageSize: isSet(object.pageSize) ? Number(object.pageSize) : 0 - }; + const obj = createBaseListExclusionsRequest(); + if (isSet(object.parent)) obj.parent = String(object.parent); + if (isSet(object.pageToken)) obj.pageToken = String(object.pageToken); + if (isSet(object.pageSize)) obj.pageSize = Number(object.pageSize); + return obj; }, toJSON(message: ListExclusionsRequest): JsonSafe { const obj: any = {}; @@ -5098,7 +4927,7 @@ export const ListExclusionsResponse = { for (const v of message.exclusions) { LogExclusion.encode(v!, writer.uint32(10).fork()).ldelim(); } - if (message.nextPageToken !== "") { + if (message.nextPageToken !== undefined) { writer.uint32(18).string(message.nextPageToken); } return writer; @@ -5124,10 +4953,10 @@ export const ListExclusionsResponse = { return message; }, fromJSON(object: any): ListExclusionsResponse { - return { - exclusions: Array.isArray(object?.exclusions) ? object.exclusions.map((e: any) => LogExclusion.fromJSON(e)) : [], - nextPageToken: isSet(object.nextPageToken) ? String(object.nextPageToken) : "" - }; + const obj = createBaseListExclusionsResponse(); + if (Array.isArray(object?.exclusions)) obj.exclusions = object.exclusions.map((e: any) => LogExclusion.fromJSON(e)); + if (isSet(object.nextPageToken)) obj.nextPageToken = String(object.nextPageToken); + return obj; }, toJSON(message: ListExclusionsResponse): JsonSafe { const obj: any = {}; @@ -5209,7 +5038,7 @@ function createBaseGetExclusionRequest(): GetExclusionRequest { export const GetExclusionRequest = { typeUrl: "/google.logging.v2.GetExclusionRequest", encode(message: GetExclusionRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.name !== "") { + if (message.name !== undefined) { writer.uint32(10).string(message.name); } return writer; @@ -5232,9 +5061,9 @@ export const GetExclusionRequest = { return message; }, fromJSON(object: any): GetExclusionRequest { - return { - name: isSet(object.name) ? String(object.name) : "" - }; + const obj = createBaseGetExclusionRequest(); + if (isSet(object.name)) obj.name = String(object.name); + return obj; }, toJSON(message: GetExclusionRequest): JsonSafe { const obj: any = {}; @@ -5298,7 +5127,7 @@ function createBaseCreateExclusionRequest(): CreateExclusionRequest { export const CreateExclusionRequest = { typeUrl: "/google.logging.v2.CreateExclusionRequest", encode(message: CreateExclusionRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.parent !== "") { + if (message.parent !== undefined) { writer.uint32(10).string(message.parent); } if (message.exclusion !== undefined) { @@ -5327,10 +5156,10 @@ export const CreateExclusionRequest = { return message; }, fromJSON(object: any): CreateExclusionRequest { - return { - parent: isSet(object.parent) ? String(object.parent) : "", - exclusion: isSet(object.exclusion) ? LogExclusion.fromJSON(object.exclusion) : undefined - }; + const obj = createBaseCreateExclusionRequest(); + if (isSet(object.parent)) obj.parent = String(object.parent); + if (isSet(object.exclusion)) obj.exclusion = LogExclusion.fromJSON(object.exclusion); + return obj; }, toJSON(message: CreateExclusionRequest): JsonSafe { const obj: any = {}; @@ -5341,7 +5170,9 @@ export const CreateExclusionRequest = { fromPartial(object: DeepPartial): CreateExclusionRequest { const message = createBaseCreateExclusionRequest(); message.parent = object.parent ?? ""; - message.exclusion = object.exclusion !== undefined && object.exclusion !== null ? LogExclusion.fromPartial(object.exclusion) : undefined; + if (object.exclusion !== undefined && object.exclusion !== null) { + message.exclusion = LogExclusion.fromPartial(object.exclusion); + } return message; }, fromSDK(object: CreateExclusionRequestSDKType): CreateExclusionRequest { @@ -5404,7 +5235,7 @@ function createBaseUpdateExclusionRequest(): UpdateExclusionRequest { export const UpdateExclusionRequest = { typeUrl: "/google.logging.v2.UpdateExclusionRequest", encode(message: UpdateExclusionRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.name !== "") { + if (message.name !== undefined) { writer.uint32(10).string(message.name); } if (message.exclusion !== undefined) { @@ -5439,11 +5270,11 @@ export const UpdateExclusionRequest = { return message; }, fromJSON(object: any): UpdateExclusionRequest { - return { - name: isSet(object.name) ? String(object.name) : "", - exclusion: isSet(object.exclusion) ? LogExclusion.fromJSON(object.exclusion) : undefined, - updateMask: isSet(object.updateMask) ? FieldMask.fromJSON(object.updateMask) : undefined - }; + const obj = createBaseUpdateExclusionRequest(); + if (isSet(object.name)) obj.name = String(object.name); + if (isSet(object.exclusion)) obj.exclusion = LogExclusion.fromJSON(object.exclusion); + if (isSet(object.updateMask)) obj.updateMask = FieldMask.fromJSON(object.updateMask); + return obj; }, toJSON(message: UpdateExclusionRequest): JsonSafe { const obj: any = {}; @@ -5455,8 +5286,12 @@ export const UpdateExclusionRequest = { fromPartial(object: DeepPartial): UpdateExclusionRequest { const message = createBaseUpdateExclusionRequest(); message.name = object.name ?? ""; - message.exclusion = object.exclusion !== undefined && object.exclusion !== null ? LogExclusion.fromPartial(object.exclusion) : undefined; - message.updateMask = object.updateMask !== undefined && object.updateMask !== null ? FieldMask.fromPartial(object.updateMask) : undefined; + if (object.exclusion !== undefined && object.exclusion !== null) { + message.exclusion = LogExclusion.fromPartial(object.exclusion); + } + if (object.updateMask !== undefined && object.updateMask !== null) { + message.updateMask = FieldMask.fromPartial(object.updateMask); + } return message; }, fromSDK(object: UpdateExclusionRequestSDKType): UpdateExclusionRequest { @@ -5524,7 +5359,7 @@ function createBaseDeleteExclusionRequest(): DeleteExclusionRequest { export const DeleteExclusionRequest = { typeUrl: "/google.logging.v2.DeleteExclusionRequest", encode(message: DeleteExclusionRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.name !== "") { + if (message.name !== undefined) { writer.uint32(10).string(message.name); } return writer; @@ -5547,9 +5382,9 @@ export const DeleteExclusionRequest = { return message; }, fromJSON(object: any): DeleteExclusionRequest { - return { - name: isSet(object.name) ? String(object.name) : "" - }; + const obj = createBaseDeleteExclusionRequest(); + if (isSet(object.name)) obj.name = String(object.name); + return obj; }, toJSON(message: DeleteExclusionRequest): JsonSafe { const obj: any = {}; @@ -5612,7 +5447,7 @@ function createBaseGetCmekSettingsRequest(): GetCmekSettingsRequest { export const GetCmekSettingsRequest = { typeUrl: "/google.logging.v2.GetCmekSettingsRequest", encode(message: GetCmekSettingsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.name !== "") { + if (message.name !== undefined) { writer.uint32(10).string(message.name); } return writer; @@ -5635,9 +5470,9 @@ export const GetCmekSettingsRequest = { return message; }, fromJSON(object: any): GetCmekSettingsRequest { - return { - name: isSet(object.name) ? String(object.name) : "" - }; + const obj = createBaseGetCmekSettingsRequest(); + if (isSet(object.name)) obj.name = String(object.name); + return obj; }, toJSON(message: GetCmekSettingsRequest): JsonSafe { const obj: any = {}; @@ -5702,7 +5537,7 @@ function createBaseUpdateCmekSettingsRequest(): UpdateCmekSettingsRequest { export const UpdateCmekSettingsRequest = { typeUrl: "/google.logging.v2.UpdateCmekSettingsRequest", encode(message: UpdateCmekSettingsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.name !== "") { + if (message.name !== undefined) { writer.uint32(10).string(message.name); } if (message.cmekSettings !== undefined) { @@ -5737,11 +5572,11 @@ export const UpdateCmekSettingsRequest = { return message; }, fromJSON(object: any): UpdateCmekSettingsRequest { - return { - name: isSet(object.name) ? String(object.name) : "", - cmekSettings: isSet(object.cmekSettings) ? CmekSettings.fromJSON(object.cmekSettings) : undefined, - updateMask: isSet(object.updateMask) ? FieldMask.fromJSON(object.updateMask) : undefined - }; + const obj = createBaseUpdateCmekSettingsRequest(); + if (isSet(object.name)) obj.name = String(object.name); + if (isSet(object.cmekSettings)) obj.cmekSettings = CmekSettings.fromJSON(object.cmekSettings); + if (isSet(object.updateMask)) obj.updateMask = FieldMask.fromJSON(object.updateMask); + return obj; }, toJSON(message: UpdateCmekSettingsRequest): JsonSafe { const obj: any = {}; @@ -5753,8 +5588,12 @@ export const UpdateCmekSettingsRequest = { fromPartial(object: DeepPartial): UpdateCmekSettingsRequest { const message = createBaseUpdateCmekSettingsRequest(); message.name = object.name ?? ""; - message.cmekSettings = object.cmekSettings !== undefined && object.cmekSettings !== null ? CmekSettings.fromPartial(object.cmekSettings) : undefined; - message.updateMask = object.updateMask !== undefined && object.updateMask !== null ? FieldMask.fromPartial(object.updateMask) : undefined; + if (object.cmekSettings !== undefined && object.cmekSettings !== null) { + message.cmekSettings = CmekSettings.fromPartial(object.cmekSettings); + } + if (object.updateMask !== undefined && object.updateMask !== null) { + message.updateMask = FieldMask.fromPartial(object.updateMask); + } return message; }, fromSDK(object: UpdateCmekSettingsRequestSDKType): UpdateCmekSettingsRequest { @@ -5824,13 +5663,13 @@ function createBaseCmekSettings(): CmekSettings { export const CmekSettings = { typeUrl: "/google.logging.v2.CmekSettings", encode(message: CmekSettings, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.name !== "") { + if (message.name !== undefined) { writer.uint32(10).string(message.name); } - if (message.kmsKeyName !== "") { + if (message.kmsKeyName !== undefined) { writer.uint32(18).string(message.kmsKeyName); } - if (message.serviceAccountId !== "") { + if (message.serviceAccountId !== undefined) { writer.uint32(26).string(message.serviceAccountId); } return writer; @@ -5859,11 +5698,11 @@ export const CmekSettings = { return message; }, fromJSON(object: any): CmekSettings { - return { - name: isSet(object.name) ? String(object.name) : "", - kmsKeyName: isSet(object.kmsKeyName) ? String(object.kmsKeyName) : "", - serviceAccountId: isSet(object.serviceAccountId) ? String(object.serviceAccountId) : "" - }; + const obj = createBaseCmekSettings(); + if (isSet(object.name)) obj.name = String(object.name); + if (isSet(object.kmsKeyName)) obj.kmsKeyName = String(object.kmsKeyName); + if (isSet(object.serviceAccountId)) obj.serviceAccountId = String(object.serviceAccountId); + return obj; }, toJSON(message: CmekSettings): JsonSafe { const obj: any = {}; @@ -5944,7 +5783,7 @@ function createBaseGetSettingsRequest(): GetSettingsRequest { export const GetSettingsRequest = { typeUrl: "/google.logging.v2.GetSettingsRequest", encode(message: GetSettingsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.name !== "") { + if (message.name !== undefined) { writer.uint32(10).string(message.name); } return writer; @@ -5967,9 +5806,9 @@ export const GetSettingsRequest = { return message; }, fromJSON(object: any): GetSettingsRequest { - return { - name: isSet(object.name) ? String(object.name) : "" - }; + const obj = createBaseGetSettingsRequest(); + if (isSet(object.name)) obj.name = String(object.name); + return obj; }, toJSON(message: GetSettingsRequest): JsonSafe { const obj: any = {}; @@ -6034,7 +5873,7 @@ function createBaseUpdateSettingsRequest(): UpdateSettingsRequest { export const UpdateSettingsRequest = { typeUrl: "/google.logging.v2.UpdateSettingsRequest", encode(message: UpdateSettingsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.name !== "") { + if (message.name !== undefined) { writer.uint32(10).string(message.name); } if (message.settings !== undefined) { @@ -6069,11 +5908,11 @@ export const UpdateSettingsRequest = { return message; }, fromJSON(object: any): UpdateSettingsRequest { - return { - name: isSet(object.name) ? String(object.name) : "", - settings: isSet(object.settings) ? Settings.fromJSON(object.settings) : undefined, - updateMask: isSet(object.updateMask) ? FieldMask.fromJSON(object.updateMask) : undefined - }; + const obj = createBaseUpdateSettingsRequest(); + if (isSet(object.name)) obj.name = String(object.name); + if (isSet(object.settings)) obj.settings = Settings.fromJSON(object.settings); + if (isSet(object.updateMask)) obj.updateMask = FieldMask.fromJSON(object.updateMask); + return obj; }, toJSON(message: UpdateSettingsRequest): JsonSafe { const obj: any = {}; @@ -6085,8 +5924,12 @@ export const UpdateSettingsRequest = { fromPartial(object: DeepPartial): UpdateSettingsRequest { const message = createBaseUpdateSettingsRequest(); message.name = object.name ?? ""; - message.settings = object.settings !== undefined && object.settings !== null ? Settings.fromPartial(object.settings) : undefined; - message.updateMask = object.updateMask !== undefined && object.updateMask !== null ? FieldMask.fromPartial(object.updateMask) : undefined; + if (object.settings !== undefined && object.settings !== null) { + message.settings = Settings.fromPartial(object.settings); + } + if (object.updateMask !== undefined && object.updateMask !== null) { + message.updateMask = FieldMask.fromPartial(object.updateMask); + } return message; }, fromSDK(object: UpdateSettingsRequestSDKType): UpdateSettingsRequest { @@ -6158,19 +6001,19 @@ function createBaseSettings(): Settings { export const Settings = { typeUrl: "/google.logging.v2.Settings", encode(message: Settings, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.name !== "") { + if (message.name !== undefined) { writer.uint32(10).string(message.name); } - if (message.kmsKeyName !== "") { + if (message.kmsKeyName !== undefined) { writer.uint32(18).string(message.kmsKeyName); } - if (message.kmsServiceAccountId !== "") { + if (message.kmsServiceAccountId !== undefined) { writer.uint32(26).string(message.kmsServiceAccountId); } - if (message.storageLocation !== "") { + if (message.storageLocation !== undefined) { writer.uint32(34).string(message.storageLocation); } - if (message.disableDefaultSink === true) { + if (message.disableDefaultSink !== undefined) { writer.uint32(40).bool(message.disableDefaultSink); } return writer; @@ -6205,13 +6048,13 @@ export const Settings = { return message; }, fromJSON(object: any): Settings { - return { - name: isSet(object.name) ? String(object.name) : "", - kmsKeyName: isSet(object.kmsKeyName) ? String(object.kmsKeyName) : "", - kmsServiceAccountId: isSet(object.kmsServiceAccountId) ? String(object.kmsServiceAccountId) : "", - storageLocation: isSet(object.storageLocation) ? String(object.storageLocation) : "", - disableDefaultSink: isSet(object.disableDefaultSink) ? Boolean(object.disableDefaultSink) : false - }; + const obj = createBaseSettings(); + if (isSet(object.name)) obj.name = String(object.name); + if (isSet(object.kmsKeyName)) obj.kmsKeyName = String(object.kmsKeyName); + if (isSet(object.kmsServiceAccountId)) obj.kmsServiceAccountId = String(object.kmsServiceAccountId); + if (isSet(object.storageLocation)) obj.storageLocation = String(object.storageLocation); + if (isSet(object.disableDefaultSink)) obj.disableDefaultSink = Boolean(object.disableDefaultSink); + return obj; }, toJSON(message: Settings): JsonSafe { const obj: any = {}; @@ -6312,13 +6155,13 @@ function createBaseCopyLogEntriesRequest(): CopyLogEntriesRequest { export const CopyLogEntriesRequest = { typeUrl: "/google.logging.v2.CopyLogEntriesRequest", encode(message: CopyLogEntriesRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.name !== "") { + if (message.name !== undefined) { writer.uint32(10).string(message.name); } - if (message.filter !== "") { + if (message.filter !== undefined) { writer.uint32(26).string(message.filter); } - if (message.destination !== "") { + if (message.destination !== undefined) { writer.uint32(34).string(message.destination); } return writer; @@ -6347,11 +6190,11 @@ export const CopyLogEntriesRequest = { return message; }, fromJSON(object: any): CopyLogEntriesRequest { - return { - name: isSet(object.name) ? String(object.name) : "", - filter: isSet(object.filter) ? String(object.filter) : "", - destination: isSet(object.destination) ? String(object.destination) : "" - }; + const obj = createBaseCopyLogEntriesRequest(); + if (isSet(object.name)) obj.name = String(object.name); + if (isSet(object.filter)) obj.filter = String(object.filter); + if (isSet(object.destination)) obj.destination = String(object.destination); + return obj; }, toJSON(message: CopyLogEntriesRequest): JsonSafe { const obj: any = {}; @@ -6447,16 +6290,16 @@ export const CopyLogEntriesMetadata = { if (message.state !== 0) { writer.uint32(24).int32(message.state); } - if (message.cancellationRequested === true) { + if (message.cancellationRequested !== undefined) { writer.uint32(32).bool(message.cancellationRequested); } if (message.request !== undefined) { CopyLogEntriesRequest.encode(message.request, writer.uint32(42).fork()).ldelim(); } - if (message.progress !== 0) { + if (message.progress !== undefined) { writer.uint32(48).int32(message.progress); } - if (message.writerIdentity !== "") { + if (message.writerIdentity !== undefined) { writer.uint32(58).string(message.writerIdentity); } return writer; @@ -6497,15 +6340,15 @@ export const CopyLogEntriesMetadata = { return message; }, fromJSON(object: any): CopyLogEntriesMetadata { - return { - startTime: isSet(object.startTime) ? new Date(object.startTime) : undefined, - endTime: isSet(object.endTime) ? new Date(object.endTime) : undefined, - state: isSet(object.state) ? operationStateFromJSON(object.state) : -1, - cancellationRequested: isSet(object.cancellationRequested) ? Boolean(object.cancellationRequested) : false, - request: isSet(object.request) ? CopyLogEntriesRequest.fromJSON(object.request) : undefined, - progress: isSet(object.progress) ? Number(object.progress) : 0, - writerIdentity: isSet(object.writerIdentity) ? String(object.writerIdentity) : "" - }; + const obj = createBaseCopyLogEntriesMetadata(); + if (isSet(object.startTime)) obj.startTime = new Date(object.startTime); + if (isSet(object.endTime)) obj.endTime = new Date(object.endTime); + if (isSet(object.state)) obj.state = operationStateFromJSON(object.state); + if (isSet(object.cancellationRequested)) obj.cancellationRequested = Boolean(object.cancellationRequested); + if (isSet(object.request)) obj.request = CopyLogEntriesRequest.fromJSON(object.request); + if (isSet(object.progress)) obj.progress = Number(object.progress); + if (isSet(object.writerIdentity)) obj.writerIdentity = String(object.writerIdentity); + return obj; }, toJSON(message: CopyLogEntriesMetadata): JsonSafe { const obj: any = {}; @@ -6524,7 +6367,9 @@ export const CopyLogEntriesMetadata = { message.endTime = object.endTime ?? undefined; message.state = object.state ?? 0; message.cancellationRequested = object.cancellationRequested ?? false; - message.request = object.request !== undefined && object.request !== null ? CopyLogEntriesRequest.fromPartial(object.request) : undefined; + if (object.request !== undefined && object.request !== null) { + message.request = CopyLogEntriesRequest.fromPartial(object.request); + } message.progress = object.progress ?? 0; message.writerIdentity = object.writerIdentity ?? ""; return message; @@ -6622,7 +6467,7 @@ function createBaseCopyLogEntriesResponse(): CopyLogEntriesResponse { export const CopyLogEntriesResponse = { typeUrl: "/google.logging.v2.CopyLogEntriesResponse", encode(message: CopyLogEntriesResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.logEntriesCopiedCount !== BigInt(0)) { + if (message.logEntriesCopiedCount !== undefined) { writer.uint32(8).int64(message.logEntriesCopiedCount); } return writer; @@ -6645,9 +6490,9 @@ export const CopyLogEntriesResponse = { return message; }, fromJSON(object: any): CopyLogEntriesResponse { - return { - logEntriesCopiedCount: isSet(object.logEntriesCopiedCount) ? BigInt(object.logEntriesCopiedCount.toString()) : BigInt(0) - }; + const obj = createBaseCopyLogEntriesResponse(); + if (isSet(object.logEntriesCopiedCount)) obj.logEntriesCopiedCount = BigInt(object.logEntriesCopiedCount.toString()); + return obj; }, toJSON(message: CopyLogEntriesResponse): JsonSafe { const obj: any = {}; @@ -6656,7 +6501,9 @@ export const CopyLogEntriesResponse = { }, fromPartial(object: DeepPartial): CopyLogEntriesResponse { const message = createBaseCopyLogEntriesResponse(); - message.logEntriesCopiedCount = object.logEntriesCopiedCount !== undefined && object.logEntriesCopiedCount !== null ? BigInt(object.logEntriesCopiedCount.toString()) : BigInt(0); + if (object.logEntriesCopiedCount !== undefined && object.logEntriesCopiedCount !== null) { + message.logEntriesCopiedCount = BigInt(object.logEntriesCopiedCount.toString()); + } return message; }, fromSDK(object: CopyLogEntriesResponseSDKType): 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 5b9a4c6b08..d963191aba 100644 --- a/__fixtures__/v-next/outputv4/google/logging/v2/logging_metrics.ts +++ b/__fixtures__/v-next/outputv4/google/logging/v2/logging_metrics.ts @@ -1,10 +1,9 @@ -import { MetricDescriptor, MetricDescriptorSDKType } from "../../api/metric"; -import { Distribution_BucketOptions, Distribution_BucketOptionsSDKType } from "../../api/distribution"; -import { Timestamp, TimestampSDKType } from "../../protobuf/timestamp"; -import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, toTimestamp, fromTimestamp, isObject } from "../../../helpers"; -import { JsonSafe } from "../../../json-safe"; -import { ComputedRef } from "vue"; +import { MetricDescriptor, MetricDescriptorSDKType } from "../../api/metric.js"; +import { Distribution_BucketOptions, Distribution_BucketOptionsSDKType } from "../../api/distribution.js"; +import { Timestamp, TimestampSDKType } from "../../protobuf/timestamp.js"; +import { BinaryReader, BinaryWriter } from "../../../binary.js"; +import { isSet, DeepPartial, toTimestamp, fromTimestamp, isObject } from "../../../helpers.js"; +import { JsonSafe } from "../../../json-safe.js"; export const protobufPackage = "google.logging.v2"; /** Logging API version. */ export enum LogMetric_ApiVersion { @@ -44,10 +43,6 @@ export interface LogMetric_LabelExtractorsEntry { key: string; value: string; } -export interface ReactiveLogMetric_LabelExtractorsEntry { - key: ComputedRef; - value: ComputedRef; -} export interface LogMetric_LabelExtractorsEntryProtoMsg { typeUrl: string; value: Uint8Array; @@ -192,21 +187,6 @@ export interface LogMetric { /** @deprecated */ version: LogMetric_ApiVersion; } -export interface ReactiveLogMetric { - name: ComputedRef; - description: ComputedRef; - filter: ComputedRef; - disabled: ComputedRef; - metricDescriptor?: ComputedRef; - valueExtractor: ComputedRef; - labelExtractors: ComputedRef<{ - [key: string]: string; - }>; - bucketOptions?: ComputedRef; - createTime?: ComputedRef; - updateTime?: ComputedRef; - version: ComputedRef; -} export interface LogMetricProtoMsg { typeUrl: "/google.logging.v2.LogMetric"; value: Uint8Array; @@ -258,11 +238,6 @@ export interface ListLogMetricsRequest { */ pageSize: number; } -export interface ReactiveListLogMetricsRequest { - parent: ComputedRef; - pageToken: ComputedRef; - pageSize: ComputedRef; -} export interface ListLogMetricsRequestProtoMsg { typeUrl: "/google.logging.v2.ListLogMetricsRequest"; value: Uint8Array; @@ -284,10 +259,6 @@ export interface ListLogMetricsResponse { */ nextPageToken: string; } -export interface ReactiveListLogMetricsResponse { - metrics: ComputedRef; - nextPageToken: ComputedRef; -} export interface ListLogMetricsResponseProtoMsg { typeUrl: "/google.logging.v2.ListLogMetricsResponse"; value: Uint8Array; @@ -306,9 +277,6 @@ export interface GetLogMetricRequest { */ metricName: string; } -export interface ReactiveGetLogMetricRequest { - metricName: ComputedRef; -} export interface GetLogMetricRequestProtoMsg { typeUrl: "/google.logging.v2.GetLogMetricRequest"; value: Uint8Array; @@ -333,10 +301,6 @@ export interface CreateLogMetricRequest { */ metric?: LogMetric; } -export interface ReactiveCreateLogMetricRequest { - parent: ComputedRef; - metric?: ComputedRef; -} export interface CreateLogMetricRequestProtoMsg { typeUrl: "/google.logging.v2.CreateLogMetricRequest"; value: Uint8Array; @@ -361,10 +325,6 @@ export interface UpdateLogMetricRequest { /** Required. The updated metric. */ metric?: LogMetric; } -export interface ReactiveUpdateLogMetricRequest { - metricName: ComputedRef; - metric?: ComputedRef; -} export interface UpdateLogMetricRequestProtoMsg { typeUrl: "/google.logging.v2.UpdateLogMetricRequest"; value: Uint8Array; @@ -383,9 +343,6 @@ export interface DeleteLogMetricRequest { */ metricName: string; } -export interface ReactiveDeleteLogMetricRequest { - metricName: ComputedRef; -} export interface DeleteLogMetricRequestProtoMsg { typeUrl: "/google.logging.v2.DeleteLogMetricRequest"; value: Uint8Array; @@ -402,10 +359,10 @@ function createBaseLogMetric_LabelExtractorsEntry(): LogMetric_LabelExtractorsEn } export const LogMetric_LabelExtractorsEntry = { encode(message: LogMetric_LabelExtractorsEntry, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.key !== "") { + if (message.key !== undefined) { writer.uint32(10).string(message.key); } - if (message.value !== "") { + if (message.value !== undefined) { writer.uint32(18).string(message.value); } return writer; @@ -431,10 +388,10 @@ export const LogMetric_LabelExtractorsEntry = { return message; }, fromJSON(object: any): LogMetric_LabelExtractorsEntry { - return { - key: isSet(object.key) ? String(object.key) : "", - value: isSet(object.value) ? String(object.value) : "" - }; + const obj = createBaseLogMetric_LabelExtractorsEntry(); + if (isSet(object.key)) obj.key = String(object.key); + if (isSet(object.value)) obj.value = String(object.value); + return obj; }, toJSON(message: LogMetric_LabelExtractorsEntry): JsonSafe { const obj: any = {}; @@ -510,22 +467,22 @@ function createBaseLogMetric(): LogMetric { export const LogMetric = { typeUrl: "/google.logging.v2.LogMetric", encode(message: LogMetric, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.name !== "") { + if (message.name !== undefined) { writer.uint32(10).string(message.name); } - if (message.description !== "") { + if (message.description !== undefined) { writer.uint32(18).string(message.description); } - if (message.filter !== "") { + if (message.filter !== undefined) { writer.uint32(26).string(message.filter); } - if (message.disabled === true) { + if (message.disabled !== undefined) { writer.uint32(96).bool(message.disabled); } if (message.metricDescriptor !== undefined) { MetricDescriptor.encode(message.metricDescriptor, writer.uint32(42).fork()).ldelim(); } - if (message.valueExtractor !== "") { + if (message.valueExtractor !== undefined) { writer.uint32(50).string(message.valueExtractor); } Object.entries(message.labelExtractors).forEach(([key, value]) => { @@ -599,24 +556,24 @@ export const LogMetric = { return message; }, fromJSON(object: any): LogMetric { - return { - name: isSet(object.name) ? String(object.name) : "", - description: isSet(object.description) ? String(object.description) : "", - filter: isSet(object.filter) ? String(object.filter) : "", - disabled: isSet(object.disabled) ? Boolean(object.disabled) : false, - metricDescriptor: isSet(object.metricDescriptor) ? MetricDescriptor.fromJSON(object.metricDescriptor) : undefined, - valueExtractor: isSet(object.valueExtractor) ? String(object.valueExtractor) : "", - labelExtractors: isObject(object.labelExtractors) ? Object.entries(object.labelExtractors).reduce<{ - [key: string]: string; - }>((acc, [key, value]) => { - acc[key] = String(value); - return acc; - }, {}) : {}, - bucketOptions: isSet(object.bucketOptions) ? Distribution_BucketOptions.fromJSON(object.bucketOptions) : undefined, - createTime: isSet(object.createTime) ? new Date(object.createTime) : undefined, - updateTime: isSet(object.updateTime) ? new Date(object.updateTime) : undefined, - version: isSet(object.version) ? logMetric_ApiVersionFromJSON(object.version) : -1 - }; + const obj = createBaseLogMetric(); + if (isSet(object.name)) obj.name = String(object.name); + if (isSet(object.description)) obj.description = String(object.description); + if (isSet(object.filter)) obj.filter = String(object.filter); + if (isSet(object.disabled)) obj.disabled = Boolean(object.disabled); + if (isSet(object.metricDescriptor)) obj.metricDescriptor = MetricDescriptor.fromJSON(object.metricDescriptor); + if (isSet(object.valueExtractor)) obj.valueExtractor = String(object.valueExtractor); + if (isObject(object.labelExtractors)) obj.labelExtractors = Object.entries(object.labelExtractors).reduce<{ + [key: string]: string; + }>((acc, [key, value]) => { + acc[key] = String(value); + return acc; + }, {}); + if (isSet(object.bucketOptions)) obj.bucketOptions = Distribution_BucketOptions.fromJSON(object.bucketOptions); + if (isSet(object.createTime)) obj.createTime = new Date(object.createTime); + if (isSet(object.updateTime)) obj.updateTime = new Date(object.updateTime); + if (isSet(object.version)) obj.version = logMetric_ApiVersionFromJSON(object.version); + return obj; }, toJSON(message: LogMetric): JsonSafe { const obj: any = {}; @@ -644,7 +601,9 @@ export const LogMetric = { message.description = object.description ?? ""; message.filter = object.filter ?? ""; message.disabled = object.disabled ?? false; - message.metricDescriptor = object.metricDescriptor !== undefined && object.metricDescriptor !== null ? MetricDescriptor.fromPartial(object.metricDescriptor) : undefined; + if (object.metricDescriptor !== undefined && object.metricDescriptor !== null) { + message.metricDescriptor = MetricDescriptor.fromPartial(object.metricDescriptor); + } message.valueExtractor = object.valueExtractor ?? ""; message.labelExtractors = Object.entries(object.labelExtractors ?? {}).reduce<{ [key: string]: string; @@ -654,7 +613,9 @@ export const LogMetric = { } return acc; }, {}); - message.bucketOptions = object.bucketOptions !== undefined && object.bucketOptions !== null ? Distribution_BucketOptions.fromPartial(object.bucketOptions) : undefined; + if (object.bucketOptions !== undefined && object.bucketOptions !== null) { + message.bucketOptions = Distribution_BucketOptions.fromPartial(object.bucketOptions); + } message.createTime = object.createTime ?? undefined; message.updateTime = object.updateTime ?? undefined; message.version = object.version ?? 0; @@ -808,13 +769,13 @@ function createBaseListLogMetricsRequest(): ListLogMetricsRequest { export const ListLogMetricsRequest = { typeUrl: "/google.logging.v2.ListLogMetricsRequest", encode(message: ListLogMetricsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.parent !== "") { + if (message.parent !== undefined) { writer.uint32(10).string(message.parent); } - if (message.pageToken !== "") { + if (message.pageToken !== undefined) { writer.uint32(18).string(message.pageToken); } - if (message.pageSize !== 0) { + if (message.pageSize !== undefined) { writer.uint32(24).int32(message.pageSize); } return writer; @@ -843,11 +804,11 @@ export const ListLogMetricsRequest = { return message; }, fromJSON(object: any): ListLogMetricsRequest { - return { - parent: isSet(object.parent) ? String(object.parent) : "", - pageToken: isSet(object.pageToken) ? String(object.pageToken) : "", - pageSize: isSet(object.pageSize) ? Number(object.pageSize) : 0 - }; + const obj = createBaseListLogMetricsRequest(); + if (isSet(object.parent)) obj.parent = String(object.parent); + if (isSet(object.pageToken)) obj.pageToken = String(object.pageToken); + if (isSet(object.pageSize)) obj.pageSize = Number(object.pageSize); + return obj; }, toJSON(message: ListLogMetricsRequest): JsonSafe { const obj: any = {}; @@ -932,7 +893,7 @@ export const ListLogMetricsResponse = { for (const v of message.metrics) { LogMetric.encode(v!, writer.uint32(10).fork()).ldelim(); } - if (message.nextPageToken !== "") { + if (message.nextPageToken !== undefined) { writer.uint32(18).string(message.nextPageToken); } return writer; @@ -958,10 +919,10 @@ export const ListLogMetricsResponse = { return message; }, fromJSON(object: any): ListLogMetricsResponse { - return { - metrics: Array.isArray(object?.metrics) ? object.metrics.map((e: any) => LogMetric.fromJSON(e)) : [], - nextPageToken: isSet(object.nextPageToken) ? String(object.nextPageToken) : "" - }; + const obj = createBaseListLogMetricsResponse(); + if (Array.isArray(object?.metrics)) obj.metrics = object.metrics.map((e: any) => LogMetric.fromJSON(e)); + if (isSet(object.nextPageToken)) obj.nextPageToken = String(object.nextPageToken); + return obj; }, toJSON(message: ListLogMetricsResponse): JsonSafe { const obj: any = {}; @@ -1043,7 +1004,7 @@ function createBaseGetLogMetricRequest(): GetLogMetricRequest { export const GetLogMetricRequest = { typeUrl: "/google.logging.v2.GetLogMetricRequest", encode(message: GetLogMetricRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.metricName !== "") { + if (message.metricName !== undefined) { writer.uint32(10).string(message.metricName); } return writer; @@ -1066,9 +1027,9 @@ export const GetLogMetricRequest = { return message; }, fromJSON(object: any): GetLogMetricRequest { - return { - metricName: isSet(object.metricName) ? String(object.metricName) : "" - }; + const obj = createBaseGetLogMetricRequest(); + if (isSet(object.metricName)) obj.metricName = String(object.metricName); + return obj; }, toJSON(message: GetLogMetricRequest): JsonSafe { const obj: any = {}; @@ -1132,7 +1093,7 @@ function createBaseCreateLogMetricRequest(): CreateLogMetricRequest { export const CreateLogMetricRequest = { typeUrl: "/google.logging.v2.CreateLogMetricRequest", encode(message: CreateLogMetricRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.parent !== "") { + if (message.parent !== undefined) { writer.uint32(10).string(message.parent); } if (message.metric !== undefined) { @@ -1161,10 +1122,10 @@ export const CreateLogMetricRequest = { return message; }, fromJSON(object: any): CreateLogMetricRequest { - return { - parent: isSet(object.parent) ? String(object.parent) : "", - metric: isSet(object.metric) ? LogMetric.fromJSON(object.metric) : undefined - }; + const obj = createBaseCreateLogMetricRequest(); + if (isSet(object.parent)) obj.parent = String(object.parent); + if (isSet(object.metric)) obj.metric = LogMetric.fromJSON(object.metric); + return obj; }, toJSON(message: CreateLogMetricRequest): JsonSafe { const obj: any = {}; @@ -1175,7 +1136,9 @@ export const CreateLogMetricRequest = { fromPartial(object: DeepPartial): CreateLogMetricRequest { const message = createBaseCreateLogMetricRequest(); message.parent = object.parent ?? ""; - message.metric = object.metric !== undefined && object.metric !== null ? LogMetric.fromPartial(object.metric) : undefined; + if (object.metric !== undefined && object.metric !== null) { + message.metric = LogMetric.fromPartial(object.metric); + } return message; }, fromSDK(object: CreateLogMetricRequestSDKType): CreateLogMetricRequest { @@ -1237,7 +1200,7 @@ function createBaseUpdateLogMetricRequest(): UpdateLogMetricRequest { export const UpdateLogMetricRequest = { typeUrl: "/google.logging.v2.UpdateLogMetricRequest", encode(message: UpdateLogMetricRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.metricName !== "") { + if (message.metricName !== undefined) { writer.uint32(10).string(message.metricName); } if (message.metric !== undefined) { @@ -1266,10 +1229,10 @@ export const UpdateLogMetricRequest = { return message; }, fromJSON(object: any): UpdateLogMetricRequest { - return { - metricName: isSet(object.metricName) ? String(object.metricName) : "", - metric: isSet(object.metric) ? LogMetric.fromJSON(object.metric) : undefined - }; + const obj = createBaseUpdateLogMetricRequest(); + if (isSet(object.metricName)) obj.metricName = String(object.metricName); + if (isSet(object.metric)) obj.metric = LogMetric.fromJSON(object.metric); + return obj; }, toJSON(message: UpdateLogMetricRequest): JsonSafe { const obj: any = {}; @@ -1280,7 +1243,9 @@ export const UpdateLogMetricRequest = { fromPartial(object: DeepPartial): UpdateLogMetricRequest { const message = createBaseUpdateLogMetricRequest(); message.metricName = object.metricName ?? ""; - message.metric = object.metric !== undefined && object.metric !== null ? LogMetric.fromPartial(object.metric) : undefined; + if (object.metric !== undefined && object.metric !== null) { + message.metric = LogMetric.fromPartial(object.metric); + } return message; }, fromSDK(object: UpdateLogMetricRequestSDKType): UpdateLogMetricRequest { @@ -1341,7 +1306,7 @@ function createBaseDeleteLogMetricRequest(): DeleteLogMetricRequest { export const DeleteLogMetricRequest = { typeUrl: "/google.logging.v2.DeleteLogMetricRequest", encode(message: DeleteLogMetricRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.metricName !== "") { + if (message.metricName !== undefined) { writer.uint32(10).string(message.metricName); } return writer; @@ -1364,9 +1329,9 @@ export const DeleteLogMetricRequest = { return message; }, fromJSON(object: any): DeleteLogMetricRequest { - return { - metricName: isSet(object.metricName) ? String(object.metricName) : "" - }; + const obj = createBaseDeleteLogMetricRequest(); + if (isSet(object.metricName)) obj.metricName = String(object.metricName); + return obj; }, toJSON(message: DeleteLogMetricRequest): JsonSafe { const obj: any = {}; diff --git a/__fixtures__/v-next/outputv4/google/longrunning/operations.ts b/__fixtures__/v-next/outputv4/google/longrunning/operations.ts index 21cea55899..a096efd145 100644 --- a/__fixtures__/v-next/outputv4/google/longrunning/operations.ts +++ b/__fixtures__/v-next/outputv4/google/longrunning/operations.ts @@ -1,10 +1,9 @@ -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 { JsonSafe } from "../../json-safe"; -import { ComputedRef } from "vue"; +import { Duration, DurationSDKType } from "../protobuf/duration.js"; +import { Any, AnySDKType } from "../protobuf/any.js"; +import { Status, StatusSDKType } from "../rpc/status.js"; +import { BinaryReader, BinaryWriter } from "../../binary.js"; +import { isSet, DeepPartial } from "../../helpers.js"; +import { JsonSafe } from "../../json-safe.js"; export const protobufPackage = "google.longrunning"; /** * This resource represents a long-running operation that is the result of a @@ -44,13 +43,6 @@ export interface Operation { */ response?: Any; } -export interface ReactiveOperation { - name: ComputedRef; - metadata?: ComputedRef; - done: ComputedRef; - error?: ComputedRef; - response?: ComputedRef; -} export interface OperationProtoMsg { typeUrl: "/google.longrunning.Operation"; value: Uint8Array; @@ -71,9 +63,6 @@ export interface GetOperationRequest { /** The name of the operation resource. */ name: string; } -export interface ReactiveGetOperationRequest { - name: ComputedRef; -} export interface GetOperationRequestProtoMsg { typeUrl: "/google.longrunning.GetOperationRequest"; value: Uint8Array; @@ -93,12 +82,6 @@ export interface ListOperationsRequest { /** The standard list page token. */ pageToken: string; } -export interface ReactiveListOperationsRequest { - name: ComputedRef; - filter: ComputedRef; - pageSize: ComputedRef; - pageToken: ComputedRef; -} export interface ListOperationsRequestProtoMsg { typeUrl: "/google.longrunning.ListOperationsRequest"; value: Uint8Array; @@ -117,10 +100,6 @@ export interface ListOperationsResponse { /** The standard List next-page token. */ nextPageToken: string; } -export interface ReactiveListOperationsResponse { - operations: ComputedRef; - nextPageToken: ComputedRef; -} export interface ListOperationsResponseProtoMsg { typeUrl: "/google.longrunning.ListOperationsResponse"; value: Uint8Array; @@ -135,9 +114,6 @@ export interface CancelOperationRequest { /** The name of the operation resource to be cancelled. */ name: string; } -export interface ReactiveCancelOperationRequest { - name: ComputedRef; -} export interface CancelOperationRequestProtoMsg { typeUrl: "/google.longrunning.CancelOperationRequest"; value: Uint8Array; @@ -151,9 +127,6 @@ export interface DeleteOperationRequest { /** The name of the operation resource to be deleted. */ name: string; } -export interface ReactiveDeleteOperationRequest { - name: ComputedRef; -} export interface DeleteOperationRequestProtoMsg { typeUrl: "/google.longrunning.DeleteOperationRequest"; value: Uint8Array; @@ -173,10 +146,6 @@ export interface WaitOperationRequest { */ timeout?: Duration; } -export interface ReactiveWaitOperationRequest { - name: ComputedRef; - timeout?: ComputedRef; -} export interface WaitOperationRequestProtoMsg { typeUrl: "/google.longrunning.WaitOperationRequest"; value: Uint8Array; @@ -222,10 +191,6 @@ export interface OperationInfo { */ metadataType: string; } -export interface ReactiveOperationInfo { - responseType: ComputedRef; - metadataType: ComputedRef; -} export interface OperationInfoProtoMsg { typeUrl: "/google.longrunning.OperationInfo"; value: Uint8Array; @@ -259,13 +224,13 @@ function createBaseOperation(): Operation { export const Operation = { typeUrl: "/google.longrunning.Operation", encode(message: Operation, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.name !== "") { + if (message.name !== undefined) { writer.uint32(10).string(message.name); } if (message.metadata !== undefined) { Any.encode(message.metadata, writer.uint32(18).fork()).ldelim(); } - if (message.done === true) { + if (message.done !== undefined) { writer.uint32(24).bool(message.done); } if (message.error !== undefined) { @@ -306,13 +271,13 @@ export const Operation = { return message; }, fromJSON(object: any): Operation { - return { - name: isSet(object.name) ? String(object.name) : "", - metadata: isSet(object.metadata) ? Any.fromJSON(object.metadata) : undefined, - done: isSet(object.done) ? Boolean(object.done) : false, - error: isSet(object.error) ? Status.fromJSON(object.error) : undefined, - response: isSet(object.response) ? Any.fromJSON(object.response) : undefined - }; + const obj = createBaseOperation(); + if (isSet(object.name)) obj.name = String(object.name); + if (isSet(object.metadata)) obj.metadata = Any.fromJSON(object.metadata); + if (isSet(object.done)) obj.done = Boolean(object.done); + if (isSet(object.error)) obj.error = Status.fromJSON(object.error); + if (isSet(object.response)) obj.response = Any.fromJSON(object.response); + return obj; }, toJSON(message: Operation): JsonSafe { const obj: any = {}; @@ -326,10 +291,16 @@ export const Operation = { fromPartial(object: DeepPartial): Operation { const message = createBaseOperation(); message.name = object.name ?? ""; - message.metadata = object.metadata !== undefined && object.metadata !== null ? Any.fromPartial(object.metadata) : undefined; + if (object.metadata !== undefined && object.metadata !== null) { + message.metadata = Any.fromPartial(object.metadata); + } message.done = object.done ?? false; - message.error = object.error !== undefined && object.error !== null ? Status.fromPartial(object.error) : undefined; - message.response = object.response !== undefined && object.response !== null ? Any.fromPartial(object.response) : undefined; + if (object.error !== undefined && object.error !== null) { + message.error = Status.fromPartial(object.error); + } + if (object.response !== undefined && object.response !== null) { + message.response = Any.fromPartial(object.response); + } return message; }, fromSDK(object: OperationSDKType): Operation { @@ -411,7 +382,7 @@ function createBaseGetOperationRequest(): GetOperationRequest { export const GetOperationRequest = { typeUrl: "/google.longrunning.GetOperationRequest", encode(message: GetOperationRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.name !== "") { + if (message.name !== undefined) { writer.uint32(10).string(message.name); } return writer; @@ -434,9 +405,9 @@ export const GetOperationRequest = { return message; }, fromJSON(object: any): GetOperationRequest { - return { - name: isSet(object.name) ? String(object.name) : "" - }; + const obj = createBaseGetOperationRequest(); + if (isSet(object.name)) obj.name = String(object.name); + return obj; }, toJSON(message: GetOperationRequest): JsonSafe { const obj: any = {}; @@ -502,16 +473,16 @@ function createBaseListOperationsRequest(): ListOperationsRequest { export const ListOperationsRequest = { typeUrl: "/google.longrunning.ListOperationsRequest", encode(message: ListOperationsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.name !== "") { + if (message.name !== undefined) { writer.uint32(34).string(message.name); } - if (message.filter !== "") { + if (message.filter !== undefined) { writer.uint32(10).string(message.filter); } - if (message.pageSize !== 0) { + if (message.pageSize !== undefined) { writer.uint32(16).int32(message.pageSize); } - if (message.pageToken !== "") { + if (message.pageToken !== undefined) { writer.uint32(26).string(message.pageToken); } return writer; @@ -543,12 +514,12 @@ export const ListOperationsRequest = { return message; }, fromJSON(object: any): ListOperationsRequest { - return { - name: isSet(object.name) ? String(object.name) : "", - filter: isSet(object.filter) ? String(object.filter) : "", - pageSize: isSet(object.pageSize) ? Number(object.pageSize) : 0, - pageToken: isSet(object.pageToken) ? String(object.pageToken) : "" - }; + const obj = createBaseListOperationsRequest(); + if (isSet(object.name)) obj.name = String(object.name); + if (isSet(object.filter)) obj.filter = String(object.filter); + if (isSet(object.pageSize)) obj.pageSize = Number(object.pageSize); + if (isSet(object.pageToken)) obj.pageToken = String(object.pageToken); + return obj; }, toJSON(message: ListOperationsRequest): JsonSafe { const obj: any = {}; @@ -642,7 +613,7 @@ export const ListOperationsResponse = { for (const v of message.operations) { Operation.encode(v!, writer.uint32(10).fork()).ldelim(); } - if (message.nextPageToken !== "") { + if (message.nextPageToken !== undefined) { writer.uint32(18).string(message.nextPageToken); } return writer; @@ -668,10 +639,10 @@ export const ListOperationsResponse = { return message; }, fromJSON(object: any): ListOperationsResponse { - return { - operations: Array.isArray(object?.operations) ? object.operations.map((e: any) => Operation.fromJSON(e)) : [], - nextPageToken: isSet(object.nextPageToken) ? String(object.nextPageToken) : "" - }; + const obj = createBaseListOperationsResponse(); + if (Array.isArray(object?.operations)) obj.operations = object.operations.map((e: any) => Operation.fromJSON(e)); + if (isSet(object.nextPageToken)) obj.nextPageToken = String(object.nextPageToken); + return obj; }, toJSON(message: ListOperationsResponse): JsonSafe { const obj: any = {}; @@ -753,7 +724,7 @@ function createBaseCancelOperationRequest(): CancelOperationRequest { export const CancelOperationRequest = { typeUrl: "/google.longrunning.CancelOperationRequest", encode(message: CancelOperationRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.name !== "") { + if (message.name !== undefined) { writer.uint32(10).string(message.name); } return writer; @@ -776,9 +747,9 @@ export const CancelOperationRequest = { return message; }, fromJSON(object: any): CancelOperationRequest { - return { - name: isSet(object.name) ? String(object.name) : "" - }; + const obj = createBaseCancelOperationRequest(); + if (isSet(object.name)) obj.name = String(object.name); + return obj; }, toJSON(message: CancelOperationRequest): JsonSafe { const obj: any = {}; @@ -841,7 +812,7 @@ function createBaseDeleteOperationRequest(): DeleteOperationRequest { export const DeleteOperationRequest = { typeUrl: "/google.longrunning.DeleteOperationRequest", encode(message: DeleteOperationRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.name !== "") { + if (message.name !== undefined) { writer.uint32(10).string(message.name); } return writer; @@ -864,9 +835,9 @@ export const DeleteOperationRequest = { return message; }, fromJSON(object: any): DeleteOperationRequest { - return { - name: isSet(object.name) ? String(object.name) : "" - }; + const obj = createBaseDeleteOperationRequest(); + if (isSet(object.name)) obj.name = String(object.name); + return obj; }, toJSON(message: DeleteOperationRequest): JsonSafe { const obj: any = {}; @@ -930,7 +901,7 @@ function createBaseWaitOperationRequest(): WaitOperationRequest { export const WaitOperationRequest = { typeUrl: "/google.longrunning.WaitOperationRequest", encode(message: WaitOperationRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.name !== "") { + if (message.name !== undefined) { writer.uint32(10).string(message.name); } if (message.timeout !== undefined) { @@ -959,10 +930,10 @@ export const WaitOperationRequest = { return message; }, fromJSON(object: any): WaitOperationRequest { - return { - name: isSet(object.name) ? String(object.name) : "", - timeout: isSet(object.timeout) ? Duration.fromJSON(object.timeout) : undefined - }; + const obj = createBaseWaitOperationRequest(); + if (isSet(object.name)) obj.name = String(object.name); + if (isSet(object.timeout)) obj.timeout = Duration.fromJSON(object.timeout); + return obj; }, toJSON(message: WaitOperationRequest): JsonSafe { const obj: any = {}; @@ -973,7 +944,9 @@ export const WaitOperationRequest = { fromPartial(object: DeepPartial): WaitOperationRequest { const message = createBaseWaitOperationRequest(); message.name = object.name ?? ""; - message.timeout = object.timeout !== undefined && object.timeout !== null ? Duration.fromPartial(object.timeout) : undefined; + if (object.timeout !== undefined && object.timeout !== null) { + message.timeout = Duration.fromPartial(object.timeout); + } return message; }, fromSDK(object: WaitOperationRequestSDKType): WaitOperationRequest { @@ -1035,10 +1008,10 @@ function createBaseOperationInfo(): OperationInfo { export const OperationInfo = { typeUrl: "/google.longrunning.OperationInfo", encode(message: OperationInfo, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.responseType !== "") { + if (message.responseType !== undefined) { writer.uint32(10).string(message.responseType); } - if (message.metadataType !== "") { + if (message.metadataType !== undefined) { writer.uint32(18).string(message.metadataType); } return writer; @@ -1064,10 +1037,10 @@ export const OperationInfo = { return message; }, fromJSON(object: any): OperationInfo { - return { - responseType: isSet(object.responseType) ? String(object.responseType) : "", - metadataType: isSet(object.metadataType) ? String(object.metadataType) : "" - }; + const obj = createBaseOperationInfo(); + if (isSet(object.responseType)) obj.responseType = String(object.responseType); + if (isSet(object.metadataType)) obj.metadataType = String(object.metadataType); + return obj; }, toJSON(message: OperationInfo): JsonSafe { const obj: any = {}; diff --git a/__fixtures__/v-next/outputv4/google/protobuf/any.ts b/__fixtures__/v-next/outputv4/google/protobuf/any.ts index f96c95f94e..1a705eea55 100644 --- a/__fixtures__/v-next/outputv4/google/protobuf/any.ts +++ b/__fixtures__/v-next/outputv4/google/protobuf/any.ts @@ -1,7 +1,6 @@ -import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, bytesFromBase64, base64FromBytes, DeepPartial } from "../../helpers"; -import { JsonSafe } from "../../json-safe"; -import { ComputedRef } from "vue"; +import { BinaryReader, BinaryWriter } from "../../binary.js"; +import { isSet, bytesFromBase64, base64FromBytes, DeepPartial } from "../../helpers.js"; +import { JsonSafe } from "../../json-safe.js"; export const protobufPackage = "google.protobuf"; /** * `Any` contains an arbitrary serialized protocol buffer message along with a @@ -119,11 +118,6 @@ export interface Any { /** Must be a valid serialized protocol buffer of the above specified type. */ value: Uint8Array; } -export interface ReactiveAny { - $typeUrl?: ComputedRef<"/google.protobuf.Any" | string>; - typeUrl: ComputedRef; - value: ComputedRef; -} export interface AnyProtoMsg { typeUrl: "/google.protobuf.Any"; value: Uint8Array; @@ -224,7 +218,7 @@ function createBaseAny(): Any { export const Any = { typeUrl: "/google.protobuf.Any", encode(message: Any, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.typeUrl !== "") { + if (message.typeUrl !== undefined) { writer.uint32(10).string(message.typeUrl); } if (message.value.length !== 0) { @@ -253,10 +247,10 @@ export const Any = { return message; }, fromJSON(object: any): Any { - return { - typeUrl: isSet(object.typeUrl) ? String(object.typeUrl) : "", - value: isSet(object.value) ? bytesFromBase64(object.value) : new Uint8Array() - }; + 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): JsonSafe { const obj: any = {}; diff --git a/__fixtures__/v-next/outputv4/google/protobuf/api.ts b/__fixtures__/v-next/outputv4/google/protobuf/api.ts index 8aa053c18d..359d83e8cc 100644 --- a/__fixtures__/v-next/outputv4/google/protobuf/api.ts +++ b/__fixtures__/v-next/outputv4/google/protobuf/api.ts @@ -1,9 +1,8 @@ -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 { JsonSafe } from "../../json-safe"; -import { ComputedRef } from "vue"; +import { Option, OptionSDKType, Syntax, SyntaxSDKType, syntaxFromJSON, syntaxToJSON } from "./type.js"; +import { SourceContext, SourceContextSDKType } from "./source_context.js"; +import { BinaryReader, BinaryWriter } from "../../binary.js"; +import { isSet, DeepPartial } from "../../helpers.js"; +import { JsonSafe } from "../../json-safe.js"; export const protobufPackage = "google.protobuf"; /** * Api is a light-weight descriptor for an API Interface. @@ -58,15 +57,6 @@ export interface Api { /** The source syntax of the service. */ syntax: Syntax; } -export interface ReactiveApi { - name: ComputedRef; - methods: ComputedRef; - options: ComputedRef; - version: ComputedRef; - sourceContext?: ComputedRef; - mixins: ComputedRef; - syntax: ComputedRef; -} export interface ApiProtoMsg { typeUrl: "/google.protobuf.Api"; value: Uint8Array; @@ -108,15 +98,6 @@ export interface Method { /** The source syntax of this method. */ syntax: Syntax; } -export interface ReactiveMethod { - name: ComputedRef; - requestTypeUrl: ComputedRef; - requestStreaming: ComputedRef; - responseTypeUrl: ComputedRef; - responseStreaming: ComputedRef; - options: ComputedRef; - syntax: ComputedRef; -} export interface MethodProtoMsg { typeUrl: "/google.protobuf.Method"; value: Uint8Array; @@ -220,10 +201,6 @@ export interface Mixin { */ root: string; } -export interface ReactiveMixin { - name: ComputedRef; - root: ComputedRef; -} export interface MixinProtoMsg { typeUrl: "/google.protobuf.Mixin"; value: Uint8Array; @@ -326,7 +303,7 @@ function createBaseApi(): Api { export const Api = { typeUrl: "/google.protobuf.Api", encode(message: Api, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.name !== "") { + if (message.name !== undefined) { writer.uint32(10).string(message.name); } for (const v of message.methods) { @@ -335,7 +312,7 @@ export const Api = { for (const v of message.options) { Option.encode(v!, writer.uint32(26).fork()).ldelim(); } - if (message.version !== "") { + if (message.version !== undefined) { writer.uint32(34).string(message.version); } if (message.sourceContext !== undefined) { @@ -385,15 +362,15 @@ export const Api = { return message; }, fromJSON(object: any): Api { - return { - name: isSet(object.name) ? String(object.name) : "", - methods: Array.isArray(object?.methods) ? object.methods.map((e: any) => Method.fromJSON(e)) : [], - options: Array.isArray(object?.options) ? object.options.map((e: any) => Option.fromJSON(e)) : [], - version: isSet(object.version) ? String(object.version) : "", - sourceContext: isSet(object.sourceContext) ? SourceContext.fromJSON(object.sourceContext) : undefined, - mixins: Array.isArray(object?.mixins) ? object.mixins.map((e: any) => Mixin.fromJSON(e)) : [], - syntax: isSet(object.syntax) ? syntaxFromJSON(object.syntax) : -1 - }; + const obj = createBaseApi(); + if (isSet(object.name)) obj.name = String(object.name); + if (Array.isArray(object?.methods)) obj.methods = object.methods.map((e: any) => Method.fromJSON(e)); + if (Array.isArray(object?.options)) obj.options = object.options.map((e: any) => Option.fromJSON(e)); + if (isSet(object.version)) obj.version = String(object.version); + if (isSet(object.sourceContext)) obj.sourceContext = SourceContext.fromJSON(object.sourceContext); + if (Array.isArray(object?.mixins)) obj.mixins = object.mixins.map((e: any) => Mixin.fromJSON(e)); + if (isSet(object.syntax)) obj.syntax = syntaxFromJSON(object.syntax); + return obj; }, toJSON(message: Api): JsonSafe { const obj: any = {}; @@ -424,7 +401,9 @@ export const Api = { message.methods = object.methods?.map(e => Method.fromPartial(e)) || []; message.options = object.options?.map(e => Option.fromPartial(e)) || []; message.version = object.version ?? ""; - message.sourceContext = object.sourceContext !== undefined && object.sourceContext !== null ? SourceContext.fromPartial(object.sourceContext) : undefined; + if (object.sourceContext !== undefined && object.sourceContext !== null) { + message.sourceContext = SourceContext.fromPartial(object.sourceContext); + } message.mixins = object.mixins?.map(e => Mixin.fromPartial(e)) || []; message.syntax = object.syntax ?? 0; return message; @@ -546,19 +525,19 @@ function createBaseMethod(): Method { export const Method = { typeUrl: "/google.protobuf.Method", encode(message: Method, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.name !== "") { + if (message.name !== undefined) { writer.uint32(10).string(message.name); } - if (message.requestTypeUrl !== "") { + if (message.requestTypeUrl !== undefined) { writer.uint32(18).string(message.requestTypeUrl); } - if (message.requestStreaming === true) { + if (message.requestStreaming !== undefined) { writer.uint32(24).bool(message.requestStreaming); } - if (message.responseTypeUrl !== "") { + if (message.responseTypeUrl !== undefined) { writer.uint32(34).string(message.responseTypeUrl); } - if (message.responseStreaming === true) { + if (message.responseStreaming !== undefined) { writer.uint32(40).bool(message.responseStreaming); } for (const v of message.options) { @@ -605,15 +584,15 @@ export const Method = { return message; }, fromJSON(object: any): Method { - return { - name: isSet(object.name) ? String(object.name) : "", - requestTypeUrl: isSet(object.requestTypeUrl) ? String(object.requestTypeUrl) : "", - requestStreaming: isSet(object.requestStreaming) ? Boolean(object.requestStreaming) : false, - responseTypeUrl: isSet(object.responseTypeUrl) ? String(object.responseTypeUrl) : "", - responseStreaming: isSet(object.responseStreaming) ? Boolean(object.responseStreaming) : false, - options: Array.isArray(object?.options) ? object.options.map((e: any) => Option.fromJSON(e)) : [], - syntax: isSet(object.syntax) ? syntaxFromJSON(object.syntax) : -1 - }; + const obj = createBaseMethod(); + if (isSet(object.name)) obj.name = String(object.name); + if (isSet(object.requestTypeUrl)) obj.requestTypeUrl = String(object.requestTypeUrl); + if (isSet(object.requestStreaming)) obj.requestStreaming = Boolean(object.requestStreaming); + if (isSet(object.responseTypeUrl)) obj.responseTypeUrl = String(object.responseTypeUrl); + if (isSet(object.responseStreaming)) obj.responseStreaming = Boolean(object.responseStreaming); + if (Array.isArray(object?.options)) obj.options = object.options.map((e: any) => Option.fromJSON(e)); + if (isSet(object.syntax)) obj.syntax = syntaxFromJSON(object.syntax); + return obj; }, toJSON(message: Method): JsonSafe { const obj: any = {}; @@ -741,10 +720,10 @@ function createBaseMixin(): Mixin { export const Mixin = { typeUrl: "/google.protobuf.Mixin", encode(message: Mixin, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.name !== "") { + if (message.name !== undefined) { writer.uint32(10).string(message.name); } - if (message.root !== "") { + if (message.root !== undefined) { writer.uint32(18).string(message.root); } return writer; @@ -770,10 +749,10 @@ export const Mixin = { return message; }, fromJSON(object: any): Mixin { - return { - name: isSet(object.name) ? String(object.name) : "", - root: isSet(object.root) ? String(object.root) : "" - }; + const obj = createBaseMixin(); + if (isSet(object.name)) obj.name = String(object.name); + if (isSet(object.root)) obj.root = String(object.root); + return obj; }, toJSON(message: Mixin): JsonSafe { const obj: any = {}; diff --git a/__fixtures__/v-next/outputv4/google/protobuf/compiler/plugin.ts b/__fixtures__/v-next/outputv4/google/protobuf/compiler/plugin.ts index 0d7ab4710e..d057e41456 100644 --- a/__fixtures__/v-next/outputv4/google/protobuf/compiler/plugin.ts +++ b/__fixtures__/v-next/outputv4/google/protobuf/compiler/plugin.ts @@ -1,8 +1,7 @@ -import { FileDescriptorProto, FileDescriptorProtoSDKType } from "../descriptor"; -import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; -import { JsonSafe } from "../../../json-safe"; -import { ComputedRef } from "vue"; +import { FileDescriptorProto, FileDescriptorProtoSDKType } from "../descriptor.js"; +import { BinaryReader, BinaryWriter } from "../../../binary.js"; +import { isSet, DeepPartial } from "../../../helpers.js"; +import { JsonSafe } from "../../../json-safe.js"; export const protobufPackage = "google.protobuf.compiler"; /** The version number of protocol compiler. */ export interface Version { @@ -15,12 +14,6 @@ export interface Version { */ suffix: string; } -export interface ReactiveVersion { - major: ComputedRef; - minor: ComputedRef; - patch: ComputedRef; - suffix: ComputedRef; -} export interface VersionProtoMsg { typeUrl: "/google.protobuf.compiler.Version"; value: Uint8Array; @@ -62,12 +55,6 @@ export interface CodeGeneratorRequest { /** The version number of protocol compiler. */ compilerVersion?: Version; } -export interface ReactiveCodeGeneratorRequest { - fileToGenerate: ComputedRef; - parameter: ComputedRef; - protoFile: ComputedRef; - compilerVersion?: ComputedRef; -} export interface CodeGeneratorRequestProtoMsg { typeUrl: "/google.protobuf.compiler.CodeGeneratorRequest"; value: Uint8Array; @@ -94,10 +81,6 @@ export interface CodeGeneratorResponse { error: string; file: CodeGeneratorResponse_File[]; } -export interface ReactiveCodeGeneratorResponse { - error: ComputedRef; - file: ComputedRef; -} export interface CodeGeneratorResponseProtoMsg { typeUrl: "/google.protobuf.compiler.CodeGeneratorResponse"; value: Uint8Array; @@ -166,11 +149,6 @@ export interface CodeGeneratorResponse_File { /** The file contents. */ content: string; } -export interface ReactiveCodeGeneratorResponse_File { - name: ComputedRef; - insertionPoint: ComputedRef; - content: ComputedRef; -} export interface CodeGeneratorResponse_FileProtoMsg { typeUrl: "/google.protobuf.compiler.File"; value: Uint8Array; @@ -192,16 +170,16 @@ function createBaseVersion(): Version { export const Version = { typeUrl: "/google.protobuf.compiler.Version", encode(message: Version, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.major !== 0) { + if (message.major !== undefined) { writer.uint32(8).int32(message.major); } - if (message.minor !== 0) { + if (message.minor !== undefined) { writer.uint32(16).int32(message.minor); } - if (message.patch !== 0) { + if (message.patch !== undefined) { writer.uint32(24).int32(message.patch); } - if (message.suffix !== "") { + if (message.suffix !== undefined) { writer.uint32(34).string(message.suffix); } return writer; @@ -233,12 +211,12 @@ export const Version = { return message; }, fromJSON(object: any): Version { - return { - major: isSet(object.major) ? Number(object.major) : 0, - minor: isSet(object.minor) ? Number(object.minor) : 0, - patch: isSet(object.patch) ? Number(object.patch) : 0, - suffix: isSet(object.suffix) ? String(object.suffix) : "" - }; + const obj = createBaseVersion(); + if (isSet(object.major)) obj.major = Number(object.major); + if (isSet(object.minor)) obj.minor = Number(object.minor); + if (isSet(object.patch)) obj.patch = Number(object.patch); + if (isSet(object.suffix)) obj.suffix = String(object.suffix); + return obj; }, toJSON(message: Version): JsonSafe { const obj: any = {}; @@ -334,7 +312,7 @@ export const CodeGeneratorRequest = { for (const v of message.fileToGenerate) { writer.uint32(10).string(v!); } - if (message.parameter !== "") { + if (message.parameter !== undefined) { writer.uint32(18).string(message.parameter); } for (const v of message.protoFile) { @@ -372,12 +350,12 @@ export const CodeGeneratorRequest = { return message; }, fromJSON(object: any): CodeGeneratorRequest { - return { - fileToGenerate: Array.isArray(object?.fileToGenerate) ? object.fileToGenerate.map((e: any) => String(e)) : [], - parameter: isSet(object.parameter) ? String(object.parameter) : "", - protoFile: Array.isArray(object?.protoFile) ? object.protoFile.map((e: any) => FileDescriptorProto.fromJSON(e)) : [], - compilerVersion: isSet(object.compilerVersion) ? Version.fromJSON(object.compilerVersion) : undefined - }; + const obj = createBaseCodeGeneratorRequest(); + if (Array.isArray(object?.fileToGenerate)) obj.fileToGenerate = object.fileToGenerate.map((e: any) => String(e)); + if (isSet(object.parameter)) obj.parameter = String(object.parameter); + if (Array.isArray(object?.protoFile)) obj.protoFile = object.protoFile.map((e: any) => FileDescriptorProto.fromJSON(e)); + if (isSet(object.compilerVersion)) obj.compilerVersion = Version.fromJSON(object.compilerVersion); + return obj; }, toJSON(message: CodeGeneratorRequest): JsonSafe { const obj: any = {}; @@ -400,7 +378,9 @@ export const CodeGeneratorRequest = { message.fileToGenerate = object.fileToGenerate?.map(e => e) || []; message.parameter = object.parameter ?? ""; message.protoFile = object.protoFile?.map(e => FileDescriptorProto.fromPartial(e)) || []; - message.compilerVersion = object.compilerVersion !== undefined && object.compilerVersion !== null ? Version.fromPartial(object.compilerVersion) : undefined; + if (object.compilerVersion !== undefined && object.compilerVersion !== null) { + message.compilerVersion = Version.fromPartial(object.compilerVersion); + } return message; }, fromSDK(object: CodeGeneratorRequestSDKType): CodeGeneratorRequest { @@ -488,7 +468,7 @@ function createBaseCodeGeneratorResponse(): CodeGeneratorResponse { export const CodeGeneratorResponse = { typeUrl: "/google.protobuf.compiler.CodeGeneratorResponse", encode(message: CodeGeneratorResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.error !== "") { + if (message.error !== undefined) { writer.uint32(10).string(message.error); } for (const v of message.file) { @@ -517,10 +497,10 @@ export const CodeGeneratorResponse = { return message; }, fromJSON(object: any): CodeGeneratorResponse { - return { - error: isSet(object.error) ? String(object.error) : "", - file: Array.isArray(object?.file) ? object.file.map((e: any) => CodeGeneratorResponse_File.fromJSON(e)) : [] - }; + const obj = createBaseCodeGeneratorResponse(); + if (isSet(object.error)) obj.error = String(object.error); + if (Array.isArray(object?.file)) obj.file = object.file.map((e: any) => CodeGeneratorResponse_File.fromJSON(e)); + return obj; }, toJSON(message: CodeGeneratorResponse): JsonSafe { const obj: any = {}; @@ -604,13 +584,13 @@ function createBaseCodeGeneratorResponse_File(): CodeGeneratorResponse_File { export const CodeGeneratorResponse_File = { typeUrl: "/google.protobuf.compiler.File", encode(message: CodeGeneratorResponse_File, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.name !== "") { + if (message.name !== undefined) { writer.uint32(10).string(message.name); } - if (message.insertionPoint !== "") { + if (message.insertionPoint !== undefined) { writer.uint32(18).string(message.insertionPoint); } - if (message.content !== "") { + if (message.content !== undefined) { writer.uint32(122).string(message.content); } return writer; @@ -639,11 +619,11 @@ export const CodeGeneratorResponse_File = { return message; }, fromJSON(object: any): CodeGeneratorResponse_File { - return { - name: isSet(object.name) ? String(object.name) : "", - insertionPoint: isSet(object.insertionPoint) ? String(object.insertionPoint) : "", - content: isSet(object.content) ? String(object.content) : "" - }; + const obj = createBaseCodeGeneratorResponse_File(); + if (isSet(object.name)) obj.name = String(object.name); + if (isSet(object.insertionPoint)) obj.insertionPoint = String(object.insertionPoint); + if (isSet(object.content)) obj.content = String(object.content); + return obj; }, toJSON(message: CodeGeneratorResponse_File): JsonSafe { const obj: any = {}; diff --git a/__fixtures__/v-next/outputv4/google/protobuf/descriptor.ts b/__fixtures__/v-next/outputv4/google/protobuf/descriptor.ts index 5ee1a23e75..91fbd835f5 100644 --- a/__fixtures__/v-next/outputv4/google/protobuf/descriptor.ts +++ b/__fixtures__/v-next/outputv4/google/protobuf/descriptor.ts @@ -1,7 +1,6 @@ -import { BinaryReader, BinaryWriter } from "../../binary"; -import { JsonSafe } from "../../json-safe"; -import { DeepPartial, isSet, bytesFromBase64, base64FromBytes } from "../../helpers"; -import { ComputedRef } from "vue"; +import { BinaryReader, BinaryWriter } from "../../binary.js"; +import { JsonSafe } from "../../json-safe.js"; +import { DeepPartial, isSet, bytesFromBase64, base64FromBytes } from "../../helpers.js"; export const protobufPackage = "google.protobuf"; export enum FieldDescriptorProto_Type { /** @@ -360,9 +359,6 @@ export function methodOptions_IdempotencyLevelToJSON(object: MethodOptions_Idemp export interface FileDescriptorSet { file: FileDescriptorProto[]; } -export interface ReactiveFileDescriptorSet { - file: ComputedRef; -} export interface FileDescriptorSetProtoMsg { typeUrl: "/google.protobuf.FileDescriptorSet"; value: Uint8Array; @@ -408,20 +404,6 @@ export interface FileDescriptorProto { */ syntax: string; } -export interface ReactiveFileDescriptorProto { - name: ComputedRef; - package: ComputedRef; - dependency: ComputedRef; - publicDependency: ComputedRef; - weakDependency: ComputedRef; - messageType: ComputedRef; - enumType: ComputedRef; - service: ComputedRef; - extension: ComputedRef; - options?: ComputedRef; - sourceCodeInfo?: ComputedRef; - syntax: ComputedRef; -} export interface FileDescriptorProtoProtoMsg { typeUrl: "/google.protobuf.FileDescriptorProto"; value: Uint8Array; @@ -458,18 +440,6 @@ export interface DescriptorProto { */ reservedName: string[]; } -export interface ReactiveDescriptorProto { - name: ComputedRef; - field: ComputedRef; - extension: ComputedRef; - nestedType: ComputedRef; - enumType: ComputedRef; - extensionRange: ComputedRef; - oneofDecl: ComputedRef; - options?: ComputedRef; - reservedRange: ComputedRef; - reservedName: ComputedRef; -} export interface DescriptorProtoProtoMsg { typeUrl: "/google.protobuf.DescriptorProto"; value: Uint8Array; @@ -494,11 +464,6 @@ export interface DescriptorProto_ExtensionRange { end: number; options?: ExtensionRangeOptions; } -export interface ReactiveDescriptorProto_ExtensionRange { - start: ComputedRef; - end: ComputedRef; - options?: ComputedRef; -} export interface DescriptorProto_ExtensionRangeProtoMsg { typeUrl: "/google.protobuf.ExtensionRange"; value: Uint8Array; @@ -519,10 +484,6 @@ export interface DescriptorProto_ReservedRange { /** Exclusive. */ end: number; } -export interface ReactiveDescriptorProto_ReservedRange { - start: ComputedRef; - end: ComputedRef; -} export interface DescriptorProto_ReservedRangeProtoMsg { typeUrl: "/google.protobuf.ReservedRange"; value: Uint8Array; @@ -540,9 +501,6 @@ export interface ExtensionRangeOptions { /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } -export interface ReactiveExtensionRangeOptions { - uninterpretedOption: ComputedRef; -} export interface ExtensionRangeOptionsProtoMsg { typeUrl: "/google.protobuf.ExtensionRangeOptions"; value: Uint8Array; @@ -595,18 +553,6 @@ export interface FieldDescriptorProto { jsonName: string; options?: FieldOptions; } -export interface ReactiveFieldDescriptorProto { - name: ComputedRef; - number: ComputedRef; - label: ComputedRef; - type: ComputedRef; - typeName: ComputedRef; - extendee: ComputedRef; - defaultValue: ComputedRef; - oneofIndex: ComputedRef; - jsonName: ComputedRef; - options?: ComputedRef; -} export interface FieldDescriptorProtoProtoMsg { typeUrl: "/google.protobuf.FieldDescriptorProto"; value: Uint8Array; @@ -629,10 +575,6 @@ export interface OneofDescriptorProto { name: string; options?: OneofOptions; } -export interface ReactiveOneofDescriptorProto { - name: ComputedRef; - options?: ComputedRef; -} export interface OneofDescriptorProtoProtoMsg { typeUrl: "/google.protobuf.OneofDescriptorProto"; value: Uint8Array; @@ -659,13 +601,6 @@ export interface EnumDescriptorProto { */ reservedName: string[]; } -export interface ReactiveEnumDescriptorProto { - name: ComputedRef; - value: ComputedRef; - options?: ComputedRef; - reservedRange: ComputedRef; - reservedName: ComputedRef; -} export interface EnumDescriptorProtoProtoMsg { typeUrl: "/google.protobuf.EnumDescriptorProto"; value: Uint8Array; @@ -692,10 +627,6 @@ export interface EnumDescriptorProto_EnumReservedRange { /** Inclusive. */ end: number; } -export interface ReactiveEnumDescriptorProto_EnumReservedRange { - start: ComputedRef; - end: ComputedRef; -} export interface EnumDescriptorProto_EnumReservedRangeProtoMsg { typeUrl: "/google.protobuf.EnumReservedRange"; value: Uint8Array; @@ -718,11 +649,6 @@ export interface EnumValueDescriptorProto { number: number; options?: EnumValueOptions; } -export interface ReactiveEnumValueDescriptorProto { - name: ComputedRef; - number: ComputedRef; - options?: ComputedRef; -} export interface EnumValueDescriptorProtoProtoMsg { typeUrl: "/google.protobuf.EnumValueDescriptorProto"; value: Uint8Array; @@ -739,11 +665,6 @@ export interface ServiceDescriptorProto { method: MethodDescriptorProto[]; options?: ServiceOptions; } -export interface ReactiveServiceDescriptorProto { - name: ComputedRef; - method: ComputedRef; - options?: ComputedRef; -} export interface ServiceDescriptorProtoProtoMsg { typeUrl: "/google.protobuf.ServiceDescriptorProto"; value: Uint8Array; @@ -769,14 +690,6 @@ export interface MethodDescriptorProto { /** Identifies if server streams multiple server messages */ serverStreaming: boolean; } -export interface ReactiveMethodDescriptorProto { - name: ComputedRef; - inputType: ComputedRef; - outputType: ComputedRef; - options?: ComputedRef; - clientStreaming: ComputedRef; - serverStreaming: ComputedRef; -} export interface MethodDescriptorProtoProtoMsg { typeUrl: "/google.protobuf.MethodDescriptorProto"; value: Uint8Array; @@ -907,29 +820,6 @@ export interface FileOptions { */ uninterpretedOption: UninterpretedOption[]; } -export interface ReactiveFileOptions { - javaPackage: ComputedRef; - javaOuterClassname: ComputedRef; - javaMultipleFiles: ComputedRef; - javaGenerateEqualsAndHash: ComputedRef; - javaStringCheckUtf8: ComputedRef; - optimizeFor: ComputedRef; - goPackage: ComputedRef; - ccGenericServices: ComputedRef; - javaGenericServices: ComputedRef; - pyGenericServices: ComputedRef; - phpGenericServices: ComputedRef; - deprecated: ComputedRef; - ccEnableArenas: ComputedRef; - objcClassPrefix: ComputedRef; - csharpNamespace: ComputedRef; - swiftPrefix: ComputedRef; - phpClassPrefix: ComputedRef; - phpNamespace: ComputedRef; - phpMetadataNamespace: ComputedRef; - rubyPackage: ComputedRef; - uninterpretedOption: ComputedRef; -} export interface FileOptionsProtoMsg { typeUrl: "/google.protobuf.FileOptions"; value: Uint8Array; @@ -1020,13 +910,6 @@ export interface MessageOptions { /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } -export interface ReactiveMessageOptions { - messageSetWireFormat: ComputedRef; - noStandardDescriptorAccessor: ComputedRef; - deprecated: ComputedRef; - mapEntry: ComputedRef; - uninterpretedOption: ComputedRef; -} export interface MessageOptionsProtoMsg { typeUrl: "/google.protobuf.MessageOptions"; value: Uint8Array; @@ -1111,15 +994,6 @@ export interface FieldOptions { /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } -export interface ReactiveFieldOptions { - ctype: ComputedRef; - packed: ComputedRef; - jstype: ComputedRef; - lazy: ComputedRef; - deprecated: ComputedRef; - weak: ComputedRef; - uninterpretedOption: ComputedRef; -} export interface FieldOptionsProtoMsg { typeUrl: "/google.protobuf.FieldOptions"; value: Uint8Array; @@ -1137,9 +1011,6 @@ export interface OneofOptions { /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } -export interface ReactiveOneofOptions { - uninterpretedOption: ComputedRef; -} export interface OneofOptionsProtoMsg { typeUrl: "/google.protobuf.OneofOptions"; value: Uint8Array; @@ -1163,11 +1034,6 @@ export interface EnumOptions { /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } -export interface ReactiveEnumOptions { - allowAlias: ComputedRef; - deprecated: ComputedRef; - uninterpretedOption: ComputedRef; -} export interface EnumOptionsProtoMsg { typeUrl: "/google.protobuf.EnumOptions"; value: Uint8Array; @@ -1188,10 +1054,6 @@ export interface EnumValueOptions { /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } -export interface ReactiveEnumValueOptions { - deprecated: ComputedRef; - uninterpretedOption: ComputedRef; -} export interface EnumValueOptionsProtoMsg { typeUrl: "/google.protobuf.EnumValueOptions"; value: Uint8Array; @@ -1211,10 +1073,6 @@ export interface ServiceOptions { /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } -export interface ReactiveServiceOptions { - deprecated: ComputedRef; - uninterpretedOption: ComputedRef; -} export interface ServiceOptionsProtoMsg { typeUrl: "/google.protobuf.ServiceOptions"; value: Uint8Array; @@ -1235,11 +1093,6 @@ export interface MethodOptions { /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } -export interface ReactiveMethodOptions { - deprecated: ComputedRef; - idempotencyLevel: ComputedRef; - uninterpretedOption: ComputedRef; -} export interface MethodOptionsProtoMsg { typeUrl: "/google.protobuf.MethodOptions"; value: Uint8Array; @@ -1270,15 +1123,6 @@ export interface UninterpretedOption { stringValue: Uint8Array; aggregateValue: string; } -export interface ReactiveUninterpretedOption { - name: ComputedRef; - identifierValue: ComputedRef; - positiveIntValue: ComputedRef; - negativeIntValue: ComputedRef; - doubleValue: ComputedRef; - stringValue: ComputedRef; - aggregateValue: ComputedRef; -} export interface UninterpretedOptionProtoMsg { typeUrl: "/google.protobuf.UninterpretedOption"; value: Uint8Array; @@ -1311,10 +1155,6 @@ export interface UninterpretedOption_NamePart { namePart: string; isExtension: boolean; } -export interface ReactiveUninterpretedOption_NamePart { - namePart: ComputedRef; - isExtension: ComputedRef; -} export interface UninterpretedOption_NamePartProtoMsg { typeUrl: "/google.protobuf.NamePart"; value: Uint8Array; @@ -1382,9 +1222,6 @@ export interface SourceCodeInfo { */ location: SourceCodeInfo_Location[]; } -export interface ReactiveSourceCodeInfo { - location: ComputedRef; -} export interface SourceCodeInfoProtoMsg { typeUrl: "/google.protobuf.SourceCodeInfo"; value: Uint8Array; @@ -1484,13 +1321,6 @@ export interface SourceCodeInfo_Location { trailingComments: string; leadingDetachedComments: string[]; } -export interface ReactiveSourceCodeInfo_Location { - path: ComputedRef; - span: ComputedRef; - leadingComments: ComputedRef; - trailingComments: ComputedRef; - leadingDetachedComments: ComputedRef; -} export interface SourceCodeInfo_LocationProtoMsg { typeUrl: "/google.protobuf.Location"; value: Uint8Array; @@ -1514,9 +1344,6 @@ export interface GeneratedCodeInfo { */ annotation: GeneratedCodeInfo_Annotation[]; } -export interface ReactiveGeneratedCodeInfo { - annotation: ComputedRef; -} export interface GeneratedCodeInfoProtoMsg { typeUrl: "/google.protobuf.GeneratedCodeInfo"; value: Uint8Array; @@ -1549,12 +1376,6 @@ export interface GeneratedCodeInfo_Annotation { */ end: number; } -export interface ReactiveGeneratedCodeInfo_Annotation { - path: ComputedRef; - sourceFile: ComputedRef; - begin: ComputedRef; - end: ComputedRef; -} export interface GeneratedCodeInfo_AnnotationProtoMsg { typeUrl: "/google.protobuf.Annotation"; value: Uint8Array; @@ -1596,9 +1417,9 @@ export const FileDescriptorSet = { return message; }, fromJSON(object: any): FileDescriptorSet { - return { - file: Array.isArray(object?.file) ? object.file.map((e: any) => FileDescriptorProto.fromJSON(e)) : [] - }; + const obj = createBaseFileDescriptorSet(); + if (Array.isArray(object?.file)) obj.file = object.file.map((e: any) => FileDescriptorProto.fromJSON(e)); + return obj; }, toJSON(message: FileDescriptorSet): JsonSafe { const obj: any = {}; @@ -1682,10 +1503,10 @@ function createBaseFileDescriptorProto(): FileDescriptorProto { export const FileDescriptorProto = { typeUrl: "/google.protobuf.FileDescriptorProto", encode(message: FileDescriptorProto, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.name !== "") { + if (message.name !== undefined) { writer.uint32(10).string(message.name); } - if (message.package !== "") { + if (message.package !== undefined) { writer.uint32(18).string(message.package); } for (const v of message.dependency) { @@ -1719,7 +1540,7 @@ export const FileDescriptorProto = { if (message.sourceCodeInfo !== undefined) { SourceCodeInfo.encode(message.sourceCodeInfo, writer.uint32(74).fork()).ldelim(); } - if (message.syntax !== "") { + if (message.syntax !== undefined) { writer.uint32(98).string(message.syntax); } return writer; @@ -1789,20 +1610,20 @@ export const FileDescriptorProto = { return message; }, fromJSON(object: any): FileDescriptorProto { - 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)) : [], - publicDependency: Array.isArray(object?.publicDependency) ? object.publicDependency.map((e: any) => Number(e)) : [], - weakDependency: Array.isArray(object?.weakDependency) ? object.weakDependency.map((e: any) => Number(e)) : [], - messageType: Array.isArray(object?.messageType) ? object.messageType.map((e: any) => DescriptorProto.fromJSON(e)) : [], - enumType: Array.isArray(object?.enumType) ? object.enumType.map((e: any) => EnumDescriptorProto.fromJSON(e)) : [], - service: Array.isArray(object?.service) ? object.service.map((e: any) => ServiceDescriptorProto.fromJSON(e)) : [], - extension: Array.isArray(object?.extension) ? object.extension.map((e: any) => FieldDescriptorProto.fromJSON(e)) : [], - options: isSet(object.options) ? FileOptions.fromJSON(object.options) : undefined, - sourceCodeInfo: isSet(object.sourceCodeInfo) ? SourceCodeInfo.fromJSON(object.sourceCodeInfo) : undefined, - syntax: isSet(object.syntax) ? String(object.syntax) : "" - }; + 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): JsonSafe { const obj: any = {}; @@ -1859,8 +1680,12 @@ export const FileDescriptorProto = { 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)) || []; - message.options = object.options !== undefined && object.options !== null ? FileOptions.fromPartial(object.options) : undefined; - message.sourceCodeInfo = object.sourceCodeInfo !== undefined && object.sourceCodeInfo !== null ? SourceCodeInfo.fromPartial(object.sourceCodeInfo) : undefined; + 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; }, @@ -2043,7 +1868,7 @@ function createBaseDescriptorProto(): DescriptorProto { export const DescriptorProto = { typeUrl: "/google.protobuf.DescriptorProto", encode(message: DescriptorProto, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.name !== "") { + if (message.name !== undefined) { writer.uint32(10).string(message.name); } for (const v of message.field) { @@ -2120,18 +1945,18 @@ export const DescriptorProto = { return message; }, fromJSON(object: any): DescriptorProto { - return { - name: isSet(object.name) ? String(object.name) : "", - field: Array.isArray(object?.field) ? object.field.map((e: any) => FieldDescriptorProto.fromJSON(e)) : [], - extension: Array.isArray(object?.extension) ? object.extension.map((e: any) => FieldDescriptorProto.fromJSON(e)) : [], - nestedType: Array.isArray(object?.nestedType) ? object.nestedType.map((e: any) => DescriptorProto.fromJSON(e)) : [], - enumType: Array.isArray(object?.enumType) ? object.enumType.map((e: any) => EnumDescriptorProto.fromJSON(e)) : [], - extensionRange: Array.isArray(object?.extensionRange) ? object.extensionRange.map((e: any) => DescriptorProto_ExtensionRange.fromJSON(e)) : [], - oneofDecl: Array.isArray(object?.oneofDecl) ? object.oneofDecl.map((e: any) => OneofDescriptorProto.fromJSON(e)) : [], - options: isSet(object.options) ? MessageOptions.fromJSON(object.options) : undefined, - reservedRange: Array.isArray(object?.reservedRange) ? object.reservedRange.map((e: any) => DescriptorProto_ReservedRange.fromJSON(e)) : [], - reservedName: Array.isArray(object?.reservedName) ? object.reservedName.map((e: any) => String(e)) : [] - }; + 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): JsonSafe { const obj: any = {}; @@ -2188,7 +2013,9 @@ export const DescriptorProto = { 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)) || []; - message.options = object.options !== undefined && object.options !== null ? MessageOptions.fromPartial(object.options) : undefined; + 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; @@ -2357,10 +2184,10 @@ function createBaseDescriptorProto_ExtensionRange(): DescriptorProto_ExtensionRa export const DescriptorProto_ExtensionRange = { typeUrl: "/google.protobuf.ExtensionRange", encode(message: DescriptorProto_ExtensionRange, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.start !== 0) { + if (message.start !== undefined) { writer.uint32(8).int32(message.start); } - if (message.end !== 0) { + if (message.end !== undefined) { writer.uint32(16).int32(message.end); } if (message.options !== undefined) { @@ -2392,11 +2219,11 @@ export const DescriptorProto_ExtensionRange = { return message; }, fromJSON(object: any): DescriptorProto_ExtensionRange { - return { - start: isSet(object.start) ? Number(object.start) : 0, - end: isSet(object.end) ? Number(object.end) : 0, - options: isSet(object.options) ? ExtensionRangeOptions.fromJSON(object.options) : undefined - }; + 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): JsonSafe { const obj: any = {}; @@ -2409,7 +2236,9 @@ export const DescriptorProto_ExtensionRange = { const message = createBaseDescriptorProto_ExtensionRange(); message.start = object.start ?? 0; message.end = object.end ?? 0; - message.options = object.options !== undefined && object.options !== null ? ExtensionRangeOptions.fromPartial(object.options) : undefined; + if (object.options !== undefined && object.options !== null) { + message.options = ExtensionRangeOptions.fromPartial(object.options); + } return message; }, fromSDK(object: DescriptorProto_ExtensionRangeSDKType): DescriptorProto_ExtensionRange { @@ -2478,10 +2307,10 @@ function createBaseDescriptorProto_ReservedRange(): DescriptorProto_ReservedRang export const DescriptorProto_ReservedRange = { typeUrl: "/google.protobuf.ReservedRange", encode(message: DescriptorProto_ReservedRange, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.start !== 0) { + if (message.start !== undefined) { writer.uint32(8).int32(message.start); } - if (message.end !== 0) { + if (message.end !== undefined) { writer.uint32(16).int32(message.end); } return writer; @@ -2507,10 +2336,10 @@ export const DescriptorProto_ReservedRange = { return message; }, fromJSON(object: any): DescriptorProto_ReservedRange { - return { - start: isSet(object.start) ? Number(object.start) : 0, - end: isSet(object.end) ? Number(object.end) : 0 - }; + 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): JsonSafe { const obj: any = {}; @@ -2605,9 +2434,9 @@ export const ExtensionRangeOptions = { return message; }, fromJSON(object: any): ExtensionRangeOptions { - return { - uninterpretedOption: Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [] - }; + const obj = createBaseExtensionRangeOptions(); + if (Array.isArray(object?.uninterpretedOption)) obj.uninterpretedOption = object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)); + return obj; }, toJSON(message: ExtensionRangeOptions): JsonSafe { const obj: any = {}; @@ -2689,10 +2518,10 @@ function createBaseFieldDescriptorProto(): FieldDescriptorProto { export const FieldDescriptorProto = { typeUrl: "/google.protobuf.FieldDescriptorProto", encode(message: FieldDescriptorProto, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.name !== "") { + if (message.name !== undefined) { writer.uint32(10).string(message.name); } - if (message.number !== 0) { + if (message.number !== undefined) { writer.uint32(24).int32(message.number); } if (message.label !== 1) { @@ -2701,19 +2530,19 @@ export const FieldDescriptorProto = { if (message.type !== 1) { writer.uint32(40).int32(message.type); } - if (message.typeName !== "") { + if (message.typeName !== undefined) { writer.uint32(50).string(message.typeName); } - if (message.extendee !== "") { + if (message.extendee !== undefined) { writer.uint32(18).string(message.extendee); } - if (message.defaultValue !== "") { + if (message.defaultValue !== undefined) { writer.uint32(58).string(message.defaultValue); } - if (message.oneofIndex !== 0) { + if (message.oneofIndex !== undefined) { writer.uint32(72).int32(message.oneofIndex); } - if (message.jsonName !== "") { + if (message.jsonName !== undefined) { writer.uint32(82).string(message.jsonName); } if (message.options !== undefined) { @@ -2766,18 +2595,18 @@ export const FieldDescriptorProto = { return message; }, fromJSON(object: any): FieldDescriptorProto { - 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, - typeName: isSet(object.typeName) ? String(object.typeName) : "", - extendee: isSet(object.extendee) ? String(object.extendee) : "", - defaultValue: isSet(object.defaultValue) ? String(object.defaultValue) : "", - oneofIndex: isSet(object.oneofIndex) ? Number(object.oneofIndex) : 0, - jsonName: isSet(object.jsonName) ? String(object.jsonName) : "", - options: isSet(object.options) ? FieldOptions.fromJSON(object.options) : undefined - }; + 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): JsonSafe { const obj: any = {}; @@ -2804,7 +2633,9 @@ export const FieldDescriptorProto = { message.defaultValue = object.defaultValue ?? ""; message.oneofIndex = object.oneofIndex ?? 0; message.jsonName = object.jsonName ?? ""; - message.options = object.options !== undefined && object.options !== null ? FieldOptions.fromPartial(object.options) : undefined; + if (object.options !== undefined && object.options !== null) { + message.options = FieldOptions.fromPartial(object.options); + } return message; }, fromSDK(object: FieldDescriptorProtoSDKType): FieldDescriptorProto { @@ -2922,7 +2753,7 @@ function createBaseOneofDescriptorProto(): OneofDescriptorProto { export const OneofDescriptorProto = { typeUrl: "/google.protobuf.OneofDescriptorProto", encode(message: OneofDescriptorProto, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.name !== "") { + if (message.name !== undefined) { writer.uint32(10).string(message.name); } if (message.options !== undefined) { @@ -2951,10 +2782,10 @@ export const OneofDescriptorProto = { return message; }, fromJSON(object: any): OneofDescriptorProto { - return { - name: isSet(object.name) ? String(object.name) : "", - options: isSet(object.options) ? OneofOptions.fromJSON(object.options) : undefined - }; + 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): JsonSafe { const obj: any = {}; @@ -2965,7 +2796,9 @@ export const OneofDescriptorProto = { fromPartial(object: DeepPartial): OneofDescriptorProto { const message = createBaseOneofDescriptorProto(); message.name = object.name ?? ""; - message.options = object.options !== undefined && object.options !== null ? OneofOptions.fromPartial(object.options) : undefined; + if (object.options !== undefined && object.options !== null) { + message.options = OneofOptions.fromPartial(object.options); + } return message; }, fromSDK(object: OneofDescriptorProtoSDKType): OneofDescriptorProto { @@ -3030,7 +2863,7 @@ function createBaseEnumDescriptorProto(): EnumDescriptorProto { export const EnumDescriptorProto = { typeUrl: "/google.protobuf.EnumDescriptorProto", encode(message: EnumDescriptorProto, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.name !== "") { + if (message.name !== undefined) { writer.uint32(10).string(message.name); } for (const v of message.value) { @@ -3077,13 +2910,13 @@ export const EnumDescriptorProto = { return message; }, fromJSON(object: any): EnumDescriptorProto { - return { - name: isSet(object.name) ? String(object.name) : "", - value: Array.isArray(object?.value) ? object.value.map((e: any) => EnumValueDescriptorProto.fromJSON(e)) : [], - options: isSet(object.options) ? EnumOptions.fromJSON(object.options) : undefined, - reservedRange: Array.isArray(object?.reservedRange) ? object.reservedRange.map((e: any) => EnumDescriptorProto_EnumReservedRange.fromJSON(e)) : [], - reservedName: Array.isArray(object?.reservedName) ? object.reservedName.map((e: any) => String(e)) : [] - }; + 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): JsonSafe { const obj: any = {}; @@ -3110,7 +2943,9 @@ export const EnumDescriptorProto = { const message = createBaseEnumDescriptorProto(); message.name = object.name ?? ""; message.value = object.value?.map(e => EnumValueDescriptorProto.fromPartial(e)) || []; - message.options = object.options !== undefined && object.options !== null ? EnumOptions.fromPartial(object.options) : undefined; + 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; @@ -3213,10 +3048,10 @@ function createBaseEnumDescriptorProto_EnumReservedRange(): EnumDescriptorProto_ export const EnumDescriptorProto_EnumReservedRange = { typeUrl: "/google.protobuf.EnumReservedRange", encode(message: EnumDescriptorProto_EnumReservedRange, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.start !== 0) { + if (message.start !== undefined) { writer.uint32(8).int32(message.start); } - if (message.end !== 0) { + if (message.end !== undefined) { writer.uint32(16).int32(message.end); } return writer; @@ -3242,10 +3077,10 @@ export const EnumDescriptorProto_EnumReservedRange = { return message; }, fromJSON(object: any): EnumDescriptorProto_EnumReservedRange { - return { - start: isSet(object.start) ? Number(object.start) : 0, - end: isSet(object.end) ? Number(object.end) : 0 - }; + 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): JsonSafe { const obj: any = {}; @@ -3319,10 +3154,10 @@ function createBaseEnumValueDescriptorProto(): EnumValueDescriptorProto { export const EnumValueDescriptorProto = { typeUrl: "/google.protobuf.EnumValueDescriptorProto", encode(message: EnumValueDescriptorProto, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.name !== "") { + if (message.name !== undefined) { writer.uint32(10).string(message.name); } - if (message.number !== 0) { + if (message.number !== undefined) { writer.uint32(16).int32(message.number); } if (message.options !== undefined) { @@ -3354,11 +3189,11 @@ export const EnumValueDescriptorProto = { return message; }, fromJSON(object: any): EnumValueDescriptorProto { - return { - name: isSet(object.name) ? String(object.name) : "", - number: isSet(object.number) ? Number(object.number) : 0, - options: isSet(object.options) ? EnumValueOptions.fromJSON(object.options) : undefined - }; + 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): JsonSafe { const obj: any = {}; @@ -3371,7 +3206,9 @@ export const EnumValueDescriptorProto = { const message = createBaseEnumValueDescriptorProto(); message.name = object.name ?? ""; message.number = object.number ?? 0; - message.options = object.options !== undefined && object.options !== null ? EnumValueOptions.fromPartial(object.options) : undefined; + if (object.options !== undefined && object.options !== null) { + message.options = EnumValueOptions.fromPartial(object.options); + } return message; }, fromSDK(object: EnumValueDescriptorProtoSDKType): EnumValueDescriptorProto { @@ -3441,7 +3278,7 @@ function createBaseServiceDescriptorProto(): ServiceDescriptorProto { export const ServiceDescriptorProto = { typeUrl: "/google.protobuf.ServiceDescriptorProto", encode(message: ServiceDescriptorProto, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.name !== "") { + if (message.name !== undefined) { writer.uint32(10).string(message.name); } for (const v of message.method) { @@ -3476,11 +3313,11 @@ export const ServiceDescriptorProto = { return message; }, fromJSON(object: any): ServiceDescriptorProto { - return { - name: isSet(object.name) ? String(object.name) : "", - method: Array.isArray(object?.method) ? object.method.map((e: any) => MethodDescriptorProto.fromJSON(e)) : [], - options: isSet(object.options) ? ServiceOptions.fromJSON(object.options) : undefined - }; + 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): JsonSafe { const obj: any = {}; @@ -3497,7 +3334,9 @@ export const ServiceDescriptorProto = { const message = createBaseServiceDescriptorProto(); message.name = object.name ?? ""; message.method = object.method?.map(e => MethodDescriptorProto.fromPartial(e)) || []; - message.options = object.options !== undefined && object.options !== null ? ServiceOptions.fromPartial(object.options) : undefined; + if (object.options !== undefined && object.options !== null) { + message.options = ServiceOptions.fromPartial(object.options); + } return message; }, fromSDK(object: ServiceDescriptorProtoSDKType): ServiceDescriptorProto { @@ -3576,22 +3415,22 @@ function createBaseMethodDescriptorProto(): MethodDescriptorProto { export const MethodDescriptorProto = { typeUrl: "/google.protobuf.MethodDescriptorProto", encode(message: MethodDescriptorProto, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.name !== "") { + if (message.name !== undefined) { writer.uint32(10).string(message.name); } - if (message.inputType !== "") { + if (message.inputType !== undefined) { writer.uint32(18).string(message.inputType); } - if (message.outputType !== "") { + if (message.outputType !== undefined) { writer.uint32(26).string(message.outputType); } if (message.options !== undefined) { MethodOptions.encode(message.options, writer.uint32(34).fork()).ldelim(); } - if (message.clientStreaming === true) { + if (message.clientStreaming !== undefined) { writer.uint32(40).bool(message.clientStreaming); } - if (message.serverStreaming === true) { + if (message.serverStreaming !== undefined) { writer.uint32(48).bool(message.serverStreaming); } return writer; @@ -3629,14 +3468,14 @@ export const MethodDescriptorProto = { return message; }, fromJSON(object: any): MethodDescriptorProto { - return { - name: isSet(object.name) ? String(object.name) : "", - inputType: isSet(object.inputType) ? String(object.inputType) : "", - outputType: isSet(object.outputType) ? String(object.outputType) : "", - options: isSet(object.options) ? MethodOptions.fromJSON(object.options) : undefined, - clientStreaming: isSet(object.clientStreaming) ? Boolean(object.clientStreaming) : false, - serverStreaming: isSet(object.serverStreaming) ? Boolean(object.serverStreaming) : false - }; + 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): JsonSafe { const obj: any = {}; @@ -3653,7 +3492,9 @@ export const MethodDescriptorProto = { message.name = object.name ?? ""; message.inputType = object.inputType ?? ""; message.outputType = object.outputType ?? ""; - message.options = object.options !== undefined && object.options !== null ? MethodOptions.fromPartial(object.options) : undefined; + 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; @@ -3764,64 +3605,64 @@ function createBaseFileOptions(): FileOptions { export const FileOptions = { typeUrl: "/google.protobuf.FileOptions", encode(message: FileOptions, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.javaPackage !== "") { + if (message.javaPackage !== undefined) { writer.uint32(10).string(message.javaPackage); } - if (message.javaOuterClassname !== "") { + if (message.javaOuterClassname !== undefined) { writer.uint32(66).string(message.javaOuterClassname); } - if (message.javaMultipleFiles === true) { + if (message.javaMultipleFiles !== undefined) { writer.uint32(80).bool(message.javaMultipleFiles); } - if (message.javaGenerateEqualsAndHash === true) { + if (message.javaGenerateEqualsAndHash !== undefined) { writer.uint32(160).bool(message.javaGenerateEqualsAndHash); } - if (message.javaStringCheckUtf8 === true) { + if (message.javaStringCheckUtf8 !== undefined) { writer.uint32(216).bool(message.javaStringCheckUtf8); } if (message.optimizeFor !== 1) { writer.uint32(72).int32(message.optimizeFor); } - if (message.goPackage !== "") { + if (message.goPackage !== undefined) { writer.uint32(90).string(message.goPackage); } - if (message.ccGenericServices === true) { + if (message.ccGenericServices !== undefined) { writer.uint32(128).bool(message.ccGenericServices); } - if (message.javaGenericServices === true) { + if (message.javaGenericServices !== undefined) { writer.uint32(136).bool(message.javaGenericServices); } - if (message.pyGenericServices === true) { + if (message.pyGenericServices !== undefined) { writer.uint32(144).bool(message.pyGenericServices); } - if (message.phpGenericServices === true) { + if (message.phpGenericServices !== undefined) { writer.uint32(336).bool(message.phpGenericServices); } - if (message.deprecated === true) { + if (message.deprecated !== undefined) { writer.uint32(184).bool(message.deprecated); } - if (message.ccEnableArenas === true) { + if (message.ccEnableArenas !== undefined) { writer.uint32(248).bool(message.ccEnableArenas); } - if (message.objcClassPrefix !== "") { + if (message.objcClassPrefix !== undefined) { writer.uint32(290).string(message.objcClassPrefix); } - if (message.csharpNamespace !== "") { + if (message.csharpNamespace !== undefined) { writer.uint32(298).string(message.csharpNamespace); } - if (message.swiftPrefix !== "") { + if (message.swiftPrefix !== undefined) { writer.uint32(314).string(message.swiftPrefix); } - if (message.phpClassPrefix !== "") { + if (message.phpClassPrefix !== undefined) { writer.uint32(322).string(message.phpClassPrefix); } - if (message.phpNamespace !== "") { + if (message.phpNamespace !== undefined) { writer.uint32(330).string(message.phpNamespace); } - if (message.phpMetadataNamespace !== "") { + if (message.phpMetadataNamespace !== undefined) { writer.uint32(354).string(message.phpMetadataNamespace); } - if (message.rubyPackage !== "") { + if (message.rubyPackage !== undefined) { writer.uint32(362).string(message.rubyPackage); } for (const v of message.uninterpretedOption) { @@ -3907,29 +3748,29 @@ export const FileOptions = { return message; }, fromJSON(object: any): FileOptions { - return { - javaPackage: isSet(object.javaPackage) ? String(object.javaPackage) : "", - javaOuterClassname: isSet(object.javaOuterClassname) ? String(object.javaOuterClassname) : "", - javaMultipleFiles: isSet(object.javaMultipleFiles) ? Boolean(object.javaMultipleFiles) : false, - javaGenerateEqualsAndHash: isSet(object.javaGenerateEqualsAndHash) ? Boolean(object.javaGenerateEqualsAndHash) : false, - javaStringCheckUtf8: isSet(object.javaStringCheckUtf8) ? Boolean(object.javaStringCheckUtf8) : false, - optimizeFor: isSet(object.optimizeFor) ? fileOptions_OptimizeModeFromJSON(object.optimizeFor) : -1, - goPackage: isSet(object.goPackage) ? String(object.goPackage) : "", - ccGenericServices: isSet(object.ccGenericServices) ? Boolean(object.ccGenericServices) : false, - javaGenericServices: isSet(object.javaGenericServices) ? Boolean(object.javaGenericServices) : false, - pyGenericServices: isSet(object.pyGenericServices) ? Boolean(object.pyGenericServices) : false, - phpGenericServices: isSet(object.phpGenericServices) ? Boolean(object.phpGenericServices) : false, - deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, - ccEnableArenas: isSet(object.ccEnableArenas) ? Boolean(object.ccEnableArenas) : false, - objcClassPrefix: isSet(object.objcClassPrefix) ? String(object.objcClassPrefix) : "", - csharpNamespace: isSet(object.csharpNamespace) ? String(object.csharpNamespace) : "", - swiftPrefix: isSet(object.swiftPrefix) ? String(object.swiftPrefix) : "", - phpClassPrefix: isSet(object.phpClassPrefix) ? String(object.phpClassPrefix) : "", - phpNamespace: isSet(object.phpNamespace) ? String(object.phpNamespace) : "", - phpMetadataNamespace: isSet(object.phpMetadataNamespace) ? String(object.phpMetadataNamespace) : "", - rubyPackage: isSet(object.rubyPackage) ? String(object.rubyPackage) : "", - uninterpretedOption: Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [] - }; + 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): JsonSafe { const obj: any = {}; @@ -4186,16 +4027,16 @@ function createBaseMessageOptions(): MessageOptions { export const MessageOptions = { typeUrl: "/google.protobuf.MessageOptions", encode(message: MessageOptions, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.messageSetWireFormat === true) { + if (message.messageSetWireFormat !== undefined) { writer.uint32(8).bool(message.messageSetWireFormat); } - if (message.noStandardDescriptorAccessor === true) { + if (message.noStandardDescriptorAccessor !== undefined) { writer.uint32(16).bool(message.noStandardDescriptorAccessor); } - if (message.deprecated === true) { + if (message.deprecated !== undefined) { writer.uint32(24).bool(message.deprecated); } - if (message.mapEntry === true) { + if (message.mapEntry !== undefined) { writer.uint32(56).bool(message.mapEntry); } for (const v of message.uninterpretedOption) { @@ -4233,13 +4074,13 @@ export const MessageOptions = { return message; }, fromJSON(object: any): MessageOptions { - return { - messageSetWireFormat: isSet(object.messageSetWireFormat) ? Boolean(object.messageSetWireFormat) : false, - noStandardDescriptorAccessor: isSet(object.noStandardDescriptorAccessor) ? Boolean(object.noStandardDescriptorAccessor) : false, - deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, - mapEntry: isSet(object.mapEntry) ? Boolean(object.mapEntry) : false, - uninterpretedOption: Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [] - }; + 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): JsonSafe { const obj: any = {}; @@ -4357,19 +4198,19 @@ export const FieldOptions = { if (message.ctype !== 1) { writer.uint32(8).int32(message.ctype); } - if (message.packed === true) { + if (message.packed !== undefined) { writer.uint32(16).bool(message.packed); } if (message.jstype !== 1) { writer.uint32(48).int32(message.jstype); } - if (message.lazy === true) { + if (message.lazy !== undefined) { writer.uint32(40).bool(message.lazy); } - if (message.deprecated === true) { + if (message.deprecated !== undefined) { writer.uint32(24).bool(message.deprecated); } - if (message.weak === true) { + if (message.weak !== undefined) { writer.uint32(80).bool(message.weak); } for (const v of message.uninterpretedOption) { @@ -4413,15 +4254,15 @@ export const FieldOptions = { return message; }, fromJSON(object: any): FieldOptions { - 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, - uninterpretedOption: Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [] - }; + 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): JsonSafe { const obj: any = {}; @@ -4571,9 +4412,9 @@ export const OneofOptions = { return message; }, fromJSON(object: any): OneofOptions { - return { - uninterpretedOption: Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [] - }; + const obj = createBaseOneofOptions(); + if (Array.isArray(object?.uninterpretedOption)) obj.uninterpretedOption = object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)); + return obj; }, toJSON(message: OneofOptions): JsonSafe { const obj: any = {}; @@ -4648,10 +4489,10 @@ function createBaseEnumOptions(): EnumOptions { export const EnumOptions = { typeUrl: "/google.protobuf.EnumOptions", encode(message: EnumOptions, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.allowAlias === true) { + if (message.allowAlias !== undefined) { writer.uint32(16).bool(message.allowAlias); } - if (message.deprecated === true) { + if (message.deprecated !== undefined) { writer.uint32(24).bool(message.deprecated); } for (const v of message.uninterpretedOption) { @@ -4683,11 +4524,11 @@ export const EnumOptions = { return message; }, fromJSON(object: any): EnumOptions { - return { - allowAlias: isSet(object.allowAlias) ? Boolean(object.allowAlias) : false, - deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, - uninterpretedOption: Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [] - }; + 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): JsonSafe { const obj: any = {}; @@ -4779,7 +4620,7 @@ function createBaseEnumValueOptions(): EnumValueOptions { export const EnumValueOptions = { typeUrl: "/google.protobuf.EnumValueOptions", encode(message: EnumValueOptions, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.deprecated === true) { + if (message.deprecated !== undefined) { writer.uint32(8).bool(message.deprecated); } for (const v of message.uninterpretedOption) { @@ -4808,10 +4649,10 @@ export const EnumValueOptions = { return message; }, fromJSON(object: any): EnumValueOptions { - return { - deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, - uninterpretedOption: Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [] - }; + 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): JsonSafe { const obj: any = {}; @@ -4894,7 +4735,7 @@ function createBaseServiceOptions(): ServiceOptions { export const ServiceOptions = { typeUrl: "/google.protobuf.ServiceOptions", encode(message: ServiceOptions, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.deprecated === true) { + if (message.deprecated !== undefined) { writer.uint32(264).bool(message.deprecated); } for (const v of message.uninterpretedOption) { @@ -4923,10 +4764,10 @@ export const ServiceOptions = { return message; }, fromJSON(object: any): ServiceOptions { - return { - deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, - uninterpretedOption: Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [] - }; + 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): JsonSafe { const obj: any = {}; @@ -5010,7 +4851,7 @@ function createBaseMethodOptions(): MethodOptions { export const MethodOptions = { typeUrl: "/google.protobuf.MethodOptions", encode(message: MethodOptions, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.deprecated === true) { + if (message.deprecated !== undefined) { writer.uint32(264).bool(message.deprecated); } if (message.idempotencyLevel !== 1) { @@ -5045,11 +4886,11 @@ export const MethodOptions = { return message; }, fromJSON(object: any): MethodOptions { - return { - deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, - idempotencyLevel: isSet(object.idempotencyLevel) ? methodOptions_IdempotencyLevelFromJSON(object.idempotencyLevel) : -1, - uninterpretedOption: Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [] - }; + 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): JsonSafe { const obj: any = {}; @@ -5149,22 +4990,22 @@ export const UninterpretedOption = { for (const v of message.name) { UninterpretedOption_NamePart.encode(v!, writer.uint32(18).fork()).ldelim(); } - if (message.identifierValue !== "") { + if (message.identifierValue !== undefined) { writer.uint32(26).string(message.identifierValue); } - if (message.positiveIntValue !== BigInt(0)) { + if (message.positiveIntValue !== undefined) { writer.uint32(32).uint64(message.positiveIntValue); } - if (message.negativeIntValue !== BigInt(0)) { + if (message.negativeIntValue !== undefined) { writer.uint32(40).int64(message.negativeIntValue); } - if (message.doubleValue !== 0) { + if (message.doubleValue !== undefined) { writer.uint32(49).double(message.doubleValue); } if (message.stringValue.length !== 0) { writer.uint32(58).bytes(message.stringValue); } - if (message.aggregateValue !== "") { + if (message.aggregateValue !== undefined) { writer.uint32(66).string(message.aggregateValue); } return writer; @@ -5205,15 +5046,15 @@ export const UninterpretedOption = { return message; }, fromJSON(object: any): UninterpretedOption { - return { - name: Array.isArray(object?.name) ? object.name.map((e: any) => UninterpretedOption_NamePart.fromJSON(e)) : [], - identifierValue: isSet(object.identifierValue) ? String(object.identifierValue) : "", - positiveIntValue: isSet(object.positiveIntValue) ? BigInt(object.positiveIntValue.toString()) : BigInt(0), - negativeIntValue: isSet(object.negativeIntValue) ? BigInt(object.negativeIntValue.toString()) : BigInt(0), - doubleValue: isSet(object.doubleValue) ? Number(object.doubleValue) : 0, - stringValue: isSet(object.stringValue) ? bytesFromBase64(object.stringValue) : new Uint8Array(), - aggregateValue: isSet(object.aggregateValue) ? String(object.aggregateValue) : "" - }; + 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): JsonSafe { const obj: any = {}; @@ -5234,8 +5075,12 @@ export const UninterpretedOption = { const message = createBaseUninterpretedOption(); message.name = object.name?.map(e => UninterpretedOption_NamePart.fromPartial(e)) || []; message.identifierValue = object.identifierValue ?? ""; - message.positiveIntValue = object.positiveIntValue !== undefined && object.positiveIntValue !== null ? BigInt(object.positiveIntValue.toString()) : BigInt(0); - message.negativeIntValue = object.negativeIntValue !== undefined && object.negativeIntValue !== null ? BigInt(object.negativeIntValue.toString()) : BigInt(0); + 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 ?? ""; @@ -5341,10 +5186,10 @@ function createBaseUninterpretedOption_NamePart(): UninterpretedOption_NamePart export const UninterpretedOption_NamePart = { typeUrl: "/google.protobuf.NamePart", encode(message: UninterpretedOption_NamePart, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.namePart !== "") { + if (message.namePart !== undefined) { writer.uint32(10).string(message.namePart); } - if (message.isExtension === true) { + if (message.isExtension !== undefined) { writer.uint32(16).bool(message.isExtension); } return writer; @@ -5370,10 +5215,10 @@ export const UninterpretedOption_NamePart = { return message; }, fromJSON(object: any): UninterpretedOption_NamePart { - return { - namePart: isSet(object.namePart) ? String(object.namePart) : "", - isExtension: isSet(object.isExtension) ? Boolean(object.isExtension) : false - }; + 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): JsonSafe { const obj: any = {}; @@ -5468,9 +5313,9 @@ export const SourceCodeInfo = { return message; }, fromJSON(object: any): SourceCodeInfo { - return { - location: Array.isArray(object?.location) ? object.location.map((e: any) => SourceCodeInfo_Location.fromJSON(e)) : [] - }; + const obj = createBaseSourceCodeInfo(); + if (Array.isArray(object?.location)) obj.location = object.location.map((e: any) => SourceCodeInfo_Location.fromJSON(e)); + return obj; }, toJSON(message: SourceCodeInfo): JsonSafe { const obj: any = {}; @@ -5557,10 +5402,10 @@ export const SourceCodeInfo_Location = { writer.int32(v); } writer.ldelim(); - if (message.leadingComments !== "") { + if (message.leadingComments !== undefined) { writer.uint32(26).string(message.leadingComments); } - if (message.trailingComments !== "") { + if (message.trailingComments !== undefined) { writer.uint32(34).string(message.trailingComments); } for (const v of message.leadingDetachedComments) { @@ -5612,13 +5457,13 @@ export const SourceCodeInfo_Location = { return message; }, fromJSON(object: any): SourceCodeInfo_Location { - 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)) : [], - leadingComments: isSet(object.leadingComments) ? String(object.leadingComments) : "", - trailingComments: isSet(object.trailingComments) ? String(object.trailingComments) : "", - leadingDetachedComments: Array.isArray(object?.leadingDetachedComments) ? object.leadingDetachedComments.map((e: any) => String(e)) : [] - }; + 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): JsonSafe { const obj: any = {}; @@ -5770,9 +5615,9 @@ export const GeneratedCodeInfo = { return message; }, fromJSON(object: any): GeneratedCodeInfo { - return { - annotation: Array.isArray(object?.annotation) ? object.annotation.map((e: any) => GeneratedCodeInfo_Annotation.fromJSON(e)) : [] - }; + const obj = createBaseGeneratedCodeInfo(); + if (Array.isArray(object?.annotation)) obj.annotation = object.annotation.map((e: any) => GeneratedCodeInfo_Annotation.fromJSON(e)); + return obj; }, toJSON(message: GeneratedCodeInfo): JsonSafe { const obj: any = {}; @@ -5853,13 +5698,13 @@ export const GeneratedCodeInfo_Annotation = { writer.int32(v); } writer.ldelim(); - if (message.sourceFile !== "") { + if (message.sourceFile !== undefined) { writer.uint32(18).string(message.sourceFile); } - if (message.begin !== 0) { + if (message.begin !== undefined) { writer.uint32(24).int32(message.begin); } - if (message.end !== 0) { + if (message.end !== undefined) { writer.uint32(32).int32(message.end); } return writer; @@ -5898,12 +5743,12 @@ export const GeneratedCodeInfo_Annotation = { return message; }, fromJSON(object: any): GeneratedCodeInfo_Annotation { - return { - path: Array.isArray(object?.path) ? object.path.map((e: any) => Number(e)) : [], - sourceFile: isSet(object.sourceFile) ? String(object.sourceFile) : "", - begin: isSet(object.begin) ? Number(object.begin) : 0, - end: isSet(object.end) ? Number(object.end) : 0 - }; + 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): JsonSafe { const obj: any = {}; diff --git a/__fixtures__/v-next/outputv4/google/protobuf/duration.ts b/__fixtures__/v-next/outputv4/google/protobuf/duration.ts index 6634159cfe..2fa45e4f46 100644 --- a/__fixtures__/v-next/outputv4/google/protobuf/duration.ts +++ b/__fixtures__/v-next/outputv4/google/protobuf/duration.ts @@ -1,7 +1,6 @@ -import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial } from "../../helpers"; -import { JsonSafe } from "../../json-safe"; -import { ComputedRef } from "vue"; +import { BinaryReader, BinaryWriter } from "../../binary.js"; +import { isSet, DeepPartial } from "../../helpers.js"; +import { JsonSafe } from "../../json-safe.js"; export const protobufPackage = "google.protobuf"; /** * A Duration represents a signed, fixed-length span of time represented @@ -80,10 +79,6 @@ export interface Duration { */ nanos: number; } -export interface ReactiveDuration { - seconds: ComputedRef; - nanos: ComputedRef; -} export interface DurationProtoMsg { typeUrl: "/google.protobuf.Duration"; value: Uint8Array; @@ -161,10 +156,10 @@ function createBaseDuration(): Duration { export const Duration = { typeUrl: "/google.protobuf.Duration", encode(message: Duration, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.seconds !== BigInt(0)) { + if (message.seconds !== undefined) { writer.uint32(8).int64(message.seconds); } - if (message.nanos !== 0) { + if (message.nanos !== undefined) { writer.uint32(16).int32(message.nanos); } return writer; @@ -190,10 +185,10 @@ export const Duration = { return message; }, fromJSON(object: any): Duration { - return { - seconds: isSet(object.seconds) ? BigInt(object.seconds.toString()) : BigInt(0), - nanos: isSet(object.nanos) ? Number(object.nanos) : 0 - }; + 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): JsonSafe { const obj: any = {}; @@ -203,7 +198,9 @@ export const Duration = { }, fromPartial(object: DeepPartial): Duration { const message = createBaseDuration(); - message.seconds = object.seconds !== undefined && object.seconds !== null ? BigInt(object.seconds.toString()) : BigInt(0); + if (object.seconds !== undefined && object.seconds !== null) { + message.seconds = BigInt(object.seconds.toString()); + } message.nanos = object.nanos ?? 0; return message; }, diff --git a/__fixtures__/v-next/outputv4/google/protobuf/empty.ts b/__fixtures__/v-next/outputv4/google/protobuf/empty.ts index 0a1f0441e0..a7e3fcd23c 100644 --- a/__fixtures__/v-next/outputv4/google/protobuf/empty.ts +++ b/__fixtures__/v-next/outputv4/google/protobuf/empty.ts @@ -1,7 +1,6 @@ -import { BinaryReader, BinaryWriter } from "../../binary"; -import { JsonSafe } from "../../json-safe"; -import { DeepPartial } from "../../helpers"; -import { ComputedRef } from "vue"; +import { BinaryReader, BinaryWriter } from "../../binary.js"; +import { JsonSafe } from "../../json-safe.js"; +import { DeepPartial } from "../../helpers.js"; export const protobufPackage = "google.protobuf"; /** * A generic empty message that you can re-use to avoid defining duplicated @@ -15,7 +14,6 @@ export const protobufPackage = "google.protobuf"; * The JSON representation for `Empty` is empty JSON object `{}`. */ export interface Empty {} -export interface ReactiveEmpty {} export interface EmptyProtoMsg { typeUrl: "/google.protobuf.Empty"; value: Uint8Array; @@ -55,7 +53,8 @@ export const Empty = { return message; }, fromJSON(_: any): Empty { - return {}; + const obj = createBaseEmpty(); + return obj; }, toJSON(_: Empty): JsonSafe { const obj: any = {}; diff --git a/__fixtures__/v-next/outputv4/google/protobuf/field_mask.ts b/__fixtures__/v-next/outputv4/google/protobuf/field_mask.ts index 934e420b01..f0247add07 100644 --- a/__fixtures__/v-next/outputv4/google/protobuf/field_mask.ts +++ b/__fixtures__/v-next/outputv4/google/protobuf/field_mask.ts @@ -1,7 +1,6 @@ -import { BinaryReader, BinaryWriter } from "../../binary"; -import { JsonSafe } from "../../json-safe"; -import { DeepPartial } from "../../helpers"; -import { ComputedRef } from "vue"; +import { BinaryReader, BinaryWriter } from "../../binary.js"; +import { JsonSafe } from "../../json-safe.js"; +import { DeepPartial } from "../../helpers.js"; export const protobufPackage = "google.protobuf"; /** * `FieldMask` represents a set of symbolic field paths, for example: @@ -208,9 +207,6 @@ export interface FieldMask { /** The set of field mask paths. */ paths: string[]; } -export interface ReactiveFieldMask { - paths: ComputedRef; -} export interface FieldMaskProtoMsg { typeUrl: "/google.protobuf.FieldMask"; value: Uint8Array; @@ -450,9 +446,9 @@ export const FieldMask = { return message; }, fromJSON(object: any): FieldMask { - return { - paths: Array.isArray(object?.paths) ? object.paths.map((e: any) => String(e)) : [] - }; + const obj = createBaseFieldMask(); + if (Array.isArray(object?.paths)) obj.paths = object.paths.map((e: any) => String(e)); + return obj; }, toJSON(message: FieldMask): JsonSafe { const obj: any = {}; diff --git a/__fixtures__/v-next/outputv4/google/protobuf/source_context.ts b/__fixtures__/v-next/outputv4/google/protobuf/source_context.ts index e7eba72e22..b30ee947bd 100644 --- a/__fixtures__/v-next/outputv4/google/protobuf/source_context.ts +++ b/__fixtures__/v-next/outputv4/google/protobuf/source_context.ts @@ -1,7 +1,6 @@ -import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial } from "../../helpers"; -import { JsonSafe } from "../../json-safe"; -import { ComputedRef } from "vue"; +import { BinaryReader, BinaryWriter } from "../../binary.js"; +import { isSet, DeepPartial } from "../../helpers.js"; +import { JsonSafe } from "../../json-safe.js"; export const protobufPackage = "google.protobuf"; /** * `SourceContext` represents information about the source of a @@ -14,9 +13,6 @@ export interface SourceContext { */ fileName: string; } -export interface ReactiveSourceContext { - fileName: ComputedRef; -} export interface SourceContextProtoMsg { typeUrl: "/google.protobuf.SourceContext"; value: Uint8Array; @@ -36,7 +32,7 @@ function createBaseSourceContext(): SourceContext { export const SourceContext = { typeUrl: "/google.protobuf.SourceContext", encode(message: SourceContext, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.fileName !== "") { + if (message.fileName !== undefined) { writer.uint32(10).string(message.fileName); } return writer; @@ -59,9 +55,9 @@ export const SourceContext = { return message; }, fromJSON(object: any): SourceContext { - return { - fileName: isSet(object.fileName) ? String(object.fileName) : "" - }; + const obj = createBaseSourceContext(); + if (isSet(object.fileName)) obj.fileName = String(object.fileName); + return obj; }, toJSON(message: SourceContext): JsonSafe { const obj: any = {}; diff --git a/__fixtures__/v-next/outputv4/google/protobuf/struct.ts b/__fixtures__/v-next/outputv4/google/protobuf/struct.ts index 0af6d60ff1..930dab6e07 100644 --- a/__fixtures__/v-next/outputv4/google/protobuf/struct.ts +++ b/__fixtures__/v-next/outputv4/google/protobuf/struct.ts @@ -1,7 +1,6 @@ -import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial, isObject } from "../../helpers"; -import { JsonSafe } from "../../json-safe"; -import { ComputedRef } from "vue"; +import { BinaryReader, BinaryWriter } from "../../binary.js"; +import { isSet, DeepPartial, isObject } from "../../helpers.js"; +import { JsonSafe } from "../../json-safe.js"; export const protobufPackage = "google.protobuf"; /** * `NullValue` is a singleton enumeration to represent the null value for the @@ -39,10 +38,6 @@ export interface Struct_FieldsEntry { key: string; value?: Value; } -export interface ReactiveStruct_FieldsEntry { - key: ComputedRef; - value?: ComputedRef; -} export interface Struct_FieldsEntryProtoMsg { typeUrl: string; value: Uint8Array; @@ -67,11 +62,6 @@ export interface Struct { [key: string]: Value; }; } -export interface ReactiveStruct { - fields: ComputedRef<{ - [key: string]: Value; - }>; -} export interface StructProtoMsg { typeUrl: "/google.protobuf.Struct"; value: Uint8Array; @@ -113,14 +103,6 @@ export interface Value { /** Represents a repeated `Value`. */ listValue?: ListValue; } -export interface ReactiveValue { - nullValue?: ComputedRef; - numberValue?: ComputedRef; - stringValue?: ComputedRef; - boolValue?: ComputedRef; - structValue?: ComputedRef; - listValue?: ComputedRef; -} export interface ValueProtoMsg { typeUrl: "/google.protobuf.Value"; value: Uint8Array; @@ -150,9 +132,6 @@ export interface ListValue { /** Repeated field of dynamically typed values. */ values: Value[]; } -export interface ReactiveListValue { - values: ComputedRef; -} export interface ListValueProtoMsg { typeUrl: "/google.protobuf.ListValue"; value: Uint8Array; @@ -173,7 +152,7 @@ function createBaseStruct_FieldsEntry(): Struct_FieldsEntry { } export const Struct_FieldsEntry = { encode(message: Struct_FieldsEntry, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.key !== "") { + if (message.key !== undefined) { writer.uint32(10).string(message.key); } if (message.value !== undefined) { @@ -202,10 +181,10 @@ export const Struct_FieldsEntry = { return message; }, fromJSON(object: any): Struct_FieldsEntry { - return { - key: isSet(object.key) ? String(object.key) : "", - value: isSet(object.value) ? Value.fromJSON(object.value) : undefined - }; + const obj = createBaseStruct_FieldsEntry(); + if (isSet(object.key)) obj.key = String(object.key); + if (isSet(object.value)) obj.value = Value.fromJSON(object.value); + return obj; }, toJSON(message: Struct_FieldsEntry): JsonSafe { const obj: any = {}; @@ -216,7 +195,9 @@ export const Struct_FieldsEntry = { fromPartial(object: DeepPartial): Struct_FieldsEntry { const message = createBaseStruct_FieldsEntry(); message.key = object.key ?? ""; - message.value = object.value !== undefined && object.value !== null ? Value.fromPartial(object.value) : undefined; + if (object.value !== undefined && object.value !== null) { + message.value = Value.fromPartial(object.value); + } return message; }, fromSDK(object: Struct_FieldsEntrySDKType): Struct_FieldsEntry { @@ -300,14 +281,14 @@ export const Struct = { return message; }, fromJSON(object: any): Struct { - return { - fields: isObject(object.fields) ? Object.entries(object.fields).reduce<{ - [key: string]: Value; - }>((acc, [key, value]) => { - acc[key] = Value.fromJSON(value); - return acc; - }, {}) : {} - }; + const obj = createBaseStruct(); + if (isObject(object.fields)) obj.fields = Object.entries(object.fields).reduce<{ + [key: string]: Value; + }>((acc, [key, value]) => { + acc[key] = Value.fromJSON(value); + return acc; + }, {}); + return obj; }, toJSON(message: Struct): JsonSafe { const obj: any = {}; @@ -465,14 +446,14 @@ export const Value = { return message; }, fromJSON(object: any): Value { - return { - nullValue: isSet(object.nullValue) ? nullValueFromJSON(object.nullValue) : undefined, - numberValue: isSet(object.numberValue) ? Number(object.numberValue) : undefined, - stringValue: isSet(object.stringValue) ? String(object.stringValue) : undefined, - boolValue: isSet(object.boolValue) ? Boolean(object.boolValue) : undefined, - structValue: isSet(object.structValue) ? Struct.fromJSON(object.structValue) : undefined, - listValue: isSet(object.listValue) ? ListValue.fromJSON(object.listValue) : undefined - }; + const obj = createBaseValue(); + if (isSet(object.nullValue)) obj.nullValue = nullValueFromJSON(object.nullValue); + if (isSet(object.numberValue)) obj.numberValue = Number(object.numberValue); + if (isSet(object.stringValue)) obj.stringValue = String(object.stringValue); + if (isSet(object.boolValue)) obj.boolValue = Boolean(object.boolValue); + if (isSet(object.structValue)) obj.structValue = Struct.fromJSON(object.structValue); + if (isSet(object.listValue)) obj.listValue = ListValue.fromJSON(object.listValue); + return obj; }, toJSON(message: Value): JsonSafe { const obj: any = {}; @@ -490,8 +471,12 @@ export const Value = { message.numberValue = object.numberValue ?? undefined; message.stringValue = object.stringValue ?? undefined; message.boolValue = object.boolValue ?? undefined; - message.structValue = object.structValue !== undefined && object.structValue !== null ? Struct.fromPartial(object.structValue) : undefined; - message.listValue = object.listValue !== undefined && object.listValue !== null ? ListValue.fromPartial(object.listValue) : undefined; + if (object.structValue !== undefined && object.structValue !== null) { + message.structValue = Struct.fromPartial(object.structValue); + } + if (object.listValue !== undefined && object.listValue !== null) { + message.listValue = ListValue.fromPartial(object.listValue); + } return message; }, fromSDK(object: ValueSDKType): Value { @@ -603,9 +588,9 @@ export const ListValue = { return message; }, fromJSON(object: any): ListValue { - return { - values: Array.isArray(object?.values) ? object.values.map((e: any) => Value.fromJSON(e)) : [] - }; + const obj = createBaseListValue(); + if (Array.isArray(object?.values)) obj.values = object.values.map((e: any) => Value.fromJSON(e)); + return obj; }, toJSON(message: ListValue): JsonSafe { const obj: any = {}; diff --git a/__fixtures__/v-next/outputv4/google/protobuf/timestamp.ts b/__fixtures__/v-next/outputv4/google/protobuf/timestamp.ts index 6a68fca801..9b0ae07ea7 100644 --- a/__fixtures__/v-next/outputv4/google/protobuf/timestamp.ts +++ b/__fixtures__/v-next/outputv4/google/protobuf/timestamp.ts @@ -1,7 +1,6 @@ -import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial, fromJsonTimestamp, fromTimestamp } from "../../helpers"; -import { JsonSafe } from "../../json-safe"; -import { ComputedRef } from "vue"; +import { BinaryReader, BinaryWriter } from "../../binary.js"; +import { isSet, DeepPartial, fromJsonTimestamp, fromTimestamp } from "../../helpers.js"; +import { JsonSafe } from "../../json-safe.js"; export const protobufPackage = "google.protobuf"; /** * A Timestamp represents a point in time independent of any time zone or local @@ -102,10 +101,6 @@ export interface Timestamp { */ nanos: number; } -export interface ReactiveTimestamp { - seconds: ComputedRef; - nanos: ComputedRef; -} export interface TimestampProtoMsg { typeUrl: "/google.protobuf.Timestamp"; value: Uint8Array; @@ -207,10 +202,10 @@ function createBaseTimestamp(): Timestamp { export const Timestamp = { typeUrl: "/google.protobuf.Timestamp", encode(message: Timestamp, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.seconds !== BigInt(0)) { + if (message.seconds !== undefined) { writer.uint32(8).int64(message.seconds); } - if (message.nanos !== 0) { + if (message.nanos !== undefined) { writer.uint32(16).int32(message.nanos); } return writer; @@ -236,10 +231,10 @@ export const Timestamp = { return message; }, fromJSON(object: any): Timestamp { - return { - seconds: isSet(object.seconds) ? BigInt(object.seconds.toString()) : BigInt(0), - nanos: isSet(object.nanos) ? Number(object.nanos) : 0 - }; + 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): JsonSafe { const obj: any = {}; @@ -249,7 +244,9 @@ export const Timestamp = { }, fromPartial(object: DeepPartial): Timestamp { const message = createBaseTimestamp(); - message.seconds = object.seconds !== undefined && object.seconds !== null ? BigInt(object.seconds.toString()) : BigInt(0); + if (object.seconds !== undefined && object.seconds !== null) { + message.seconds = BigInt(object.seconds.toString()); + } message.nanos = object.nanos ?? 0; return message; }, diff --git a/__fixtures__/v-next/outputv4/google/protobuf/type.ts b/__fixtures__/v-next/outputv4/google/protobuf/type.ts index cad2ebf48f..74eef8b121 100644 --- a/__fixtures__/v-next/outputv4/google/protobuf/type.ts +++ b/__fixtures__/v-next/outputv4/google/protobuf/type.ts @@ -1,9 +1,8 @@ -import { SourceContext, SourceContextSDKType } from "./source_context"; -import { Any, AnySDKType } from "./any"; -import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial } from "../../helpers"; -import { JsonSafe } from "../../json-safe"; -import { ComputedRef } from "vue"; +import { SourceContext, SourceContextSDKType } from "./source_context.js"; +import { Any, AnySDKType } from "./any.js"; +import { BinaryReader, BinaryWriter } from "../../binary.js"; +import { isSet, DeepPartial } from "../../helpers.js"; +import { JsonSafe } from "../../json-safe.js"; export const protobufPackage = "google.protobuf"; /** Basic field types. */ export enum Field_Kind { @@ -255,14 +254,6 @@ export interface Type { /** The source syntax. */ syntax: Syntax; } -export interface ReactiveType { - name: ComputedRef; - fields: ComputedRef; - oneofs: ComputedRef; - options: ComputedRef; - sourceContext?: ComputedRef; - syntax: ComputedRef; -} export interface TypeProtoMsg { typeUrl: "/google.protobuf.Type"; value: Uint8Array; @@ -305,18 +296,6 @@ export interface Field { /** The string value of the default value of this field. Proto2 syntax only. */ defaultValue: string; } -export interface ReactiveField { - kind: ComputedRef; - cardinality: ComputedRef; - number: ComputedRef; - name: ComputedRef; - typeUrl: ComputedRef; - oneofIndex: ComputedRef; - packed: ComputedRef; - options: ComputedRef; - jsonName: ComputedRef; - defaultValue: ComputedRef; -} export interface FieldProtoMsg { typeUrl: "/google.protobuf.Field"; value: Uint8Array; @@ -347,13 +326,6 @@ export interface Enum { /** The source syntax. */ syntax: Syntax; } -export interface ReactiveEnum { - name: ComputedRef; - enumvalue: ComputedRef; - options: ComputedRef; - sourceContext?: ComputedRef; - syntax: ComputedRef; -} export interface EnumProtoMsg { typeUrl: "/google.protobuf.Enum"; value: Uint8Array; @@ -375,11 +347,6 @@ export interface EnumValue { /** Protocol buffer options. */ options: Option[]; } -export interface ReactiveEnumValue { - name: ComputedRef; - number: ComputedRef; - options: ComputedRef; -} export interface EnumValueProtoMsg { typeUrl: "/google.protobuf.EnumValue"; value: Uint8Array; @@ -410,10 +377,6 @@ export interface Option { */ value?: Any; } -export interface ReactiveOption { - name: ComputedRef; - value?: ComputedRef; -} export interface OptionProtoMsg { typeUrl: "/google.protobuf.Option"; value: Uint8Array; @@ -439,7 +402,7 @@ function createBaseType(): Type { export const Type = { typeUrl: "/google.protobuf.Type", encode(message: Type, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.name !== "") { + if (message.name !== undefined) { writer.uint32(10).string(message.name); } for (const v of message.fields) { @@ -492,14 +455,14 @@ export const Type = { return message; }, fromJSON(object: any): Type { - return { - name: isSet(object.name) ? String(object.name) : "", - fields: Array.isArray(object?.fields) ? object.fields.map((e: any) => Field.fromJSON(e)) : [], - oneofs: Array.isArray(object?.oneofs) ? object.oneofs.map((e: any) => String(e)) : [], - options: Array.isArray(object?.options) ? object.options.map((e: any) => Option.fromJSON(e)) : [], - sourceContext: isSet(object.sourceContext) ? SourceContext.fromJSON(object.sourceContext) : undefined, - syntax: isSet(object.syntax) ? syntaxFromJSON(object.syntax) : -1 - }; + const obj = createBaseType(); + if (isSet(object.name)) obj.name = String(object.name); + if (Array.isArray(object?.fields)) obj.fields = object.fields.map((e: any) => Field.fromJSON(e)); + if (Array.isArray(object?.oneofs)) obj.oneofs = object.oneofs.map((e: any) => String(e)); + if (Array.isArray(object?.options)) obj.options = object.options.map((e: any) => Option.fromJSON(e)); + if (isSet(object.sourceContext)) obj.sourceContext = SourceContext.fromJSON(object.sourceContext); + if (isSet(object.syntax)) obj.syntax = syntaxFromJSON(object.syntax); + return obj; }, toJSON(message: Type): JsonSafe { const obj: any = {}; @@ -529,7 +492,9 @@ export const Type = { message.fields = object.fields?.map(e => Field.fromPartial(e)) || []; message.oneofs = object.oneofs?.map(e => e) || []; message.options = object.options?.map(e => Option.fromPartial(e)) || []; - message.sourceContext = object.sourceContext !== undefined && object.sourceContext !== null ? SourceContext.fromPartial(object.sourceContext) : undefined; + if (object.sourceContext !== undefined && object.sourceContext !== null) { + message.sourceContext = SourceContext.fromPartial(object.sourceContext); + } message.syntax = object.syntax ?? 0; return message; }, @@ -652,28 +617,28 @@ export const Field = { if (message.cardinality !== 0) { writer.uint32(16).int32(message.cardinality); } - if (message.number !== 0) { + if (message.number !== undefined) { writer.uint32(24).int32(message.number); } - if (message.name !== "") { + if (message.name !== undefined) { writer.uint32(34).string(message.name); } - if (message.typeUrl !== "") { + if (message.typeUrl !== undefined) { writer.uint32(50).string(message.typeUrl); } - if (message.oneofIndex !== 0) { + if (message.oneofIndex !== undefined) { writer.uint32(56).int32(message.oneofIndex); } - if (message.packed === true) { + if (message.packed !== undefined) { writer.uint32(64).bool(message.packed); } for (const v of message.options) { Option.encode(v!, writer.uint32(74).fork()).ldelim(); } - if (message.jsonName !== "") { + if (message.jsonName !== undefined) { writer.uint32(82).string(message.jsonName); } - if (message.defaultValue !== "") { + if (message.defaultValue !== undefined) { writer.uint32(90).string(message.defaultValue); } return writer; @@ -723,18 +688,18 @@ export const Field = { return message; }, fromJSON(object: any): Field { - return { - kind: isSet(object.kind) ? field_KindFromJSON(object.kind) : -1, - cardinality: isSet(object.cardinality) ? field_CardinalityFromJSON(object.cardinality) : -1, - number: isSet(object.number) ? Number(object.number) : 0, - name: isSet(object.name) ? String(object.name) : "", - typeUrl: isSet(object.typeUrl) ? String(object.typeUrl) : "", - oneofIndex: isSet(object.oneofIndex) ? Number(object.oneofIndex) : 0, - packed: isSet(object.packed) ? Boolean(object.packed) : false, - options: Array.isArray(object?.options) ? object.options.map((e: any) => Option.fromJSON(e)) : [], - jsonName: isSet(object.jsonName) ? String(object.jsonName) : "", - defaultValue: isSet(object.defaultValue) ? String(object.defaultValue) : "" - }; + const obj = createBaseField(); + if (isSet(object.kind)) obj.kind = field_KindFromJSON(object.kind); + if (isSet(object.cardinality)) obj.cardinality = field_CardinalityFromJSON(object.cardinality); + if (isSet(object.number)) obj.number = Number(object.number); + if (isSet(object.name)) obj.name = String(object.name); + if (isSet(object.typeUrl)) obj.typeUrl = String(object.typeUrl); + if (isSet(object.oneofIndex)) obj.oneofIndex = Number(object.oneofIndex); + if (isSet(object.packed)) obj.packed = Boolean(object.packed); + if (Array.isArray(object?.options)) obj.options = object.options.map((e: any) => Option.fromJSON(e)); + if (isSet(object.jsonName)) obj.jsonName = String(object.jsonName); + if (isSet(object.defaultValue)) obj.defaultValue = String(object.defaultValue); + return obj; }, toJSON(message: Field): JsonSafe { const obj: any = {}; @@ -892,7 +857,7 @@ function createBaseEnum(): Enum { export const Enum = { typeUrl: "/google.protobuf.Enum", encode(message: Enum, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.name !== "") { + if (message.name !== undefined) { writer.uint32(10).string(message.name); } for (const v of message.enumvalue) { @@ -939,13 +904,13 @@ export const Enum = { return message; }, fromJSON(object: any): Enum { - return { - name: isSet(object.name) ? String(object.name) : "", - enumvalue: Array.isArray(object?.enumvalue) ? object.enumvalue.map((e: any) => EnumValue.fromJSON(e)) : [], - options: Array.isArray(object?.options) ? object.options.map((e: any) => Option.fromJSON(e)) : [], - sourceContext: isSet(object.sourceContext) ? SourceContext.fromJSON(object.sourceContext) : undefined, - syntax: isSet(object.syntax) ? syntaxFromJSON(object.syntax) : -1 - }; + const obj = createBaseEnum(); + if (isSet(object.name)) obj.name = String(object.name); + if (Array.isArray(object?.enumvalue)) obj.enumvalue = object.enumvalue.map((e: any) => EnumValue.fromJSON(e)); + if (Array.isArray(object?.options)) obj.options = object.options.map((e: any) => Option.fromJSON(e)); + if (isSet(object.sourceContext)) obj.sourceContext = SourceContext.fromJSON(object.sourceContext); + if (isSet(object.syntax)) obj.syntax = syntaxFromJSON(object.syntax); + return obj; }, toJSON(message: Enum): JsonSafe { const obj: any = {}; @@ -969,7 +934,9 @@ export const Enum = { message.name = object.name ?? ""; message.enumvalue = object.enumvalue?.map(e => EnumValue.fromPartial(e)) || []; message.options = object.options?.map(e => Option.fromPartial(e)) || []; - message.sourceContext = object.sourceContext !== undefined && object.sourceContext !== null ? SourceContext.fromPartial(object.sourceContext) : undefined; + if (object.sourceContext !== undefined && object.sourceContext !== null) { + message.sourceContext = SourceContext.fromPartial(object.sourceContext); + } message.syntax = object.syntax ?? 0; return message; }, @@ -1066,10 +1033,10 @@ function createBaseEnumValue(): EnumValue { export const EnumValue = { typeUrl: "/google.protobuf.EnumValue", encode(message: EnumValue, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.name !== "") { + if (message.name !== undefined) { writer.uint32(10).string(message.name); } - if (message.number !== 0) { + if (message.number !== undefined) { writer.uint32(16).int32(message.number); } for (const v of message.options) { @@ -1101,11 +1068,11 @@ export const EnumValue = { return message; }, fromJSON(object: any): EnumValue { - return { - name: isSet(object.name) ? String(object.name) : "", - number: isSet(object.number) ? Number(object.number) : 0, - options: Array.isArray(object?.options) ? object.options.map((e: any) => Option.fromJSON(e)) : [] - }; + const obj = createBaseEnumValue(); + if (isSet(object.name)) obj.name = String(object.name); + if (isSet(object.number)) obj.number = Number(object.number); + if (Array.isArray(object?.options)) obj.options = object.options.map((e: any) => Option.fromJSON(e)); + return obj; }, toJSON(message: EnumValue): JsonSafe { const obj: any = {}; @@ -1197,7 +1164,7 @@ function createBaseOption(): Option { export const Option = { typeUrl: "/google.protobuf.Option", encode(message: Option, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.name !== "") { + if (message.name !== undefined) { writer.uint32(10).string(message.name); } if (message.value !== undefined) { @@ -1226,10 +1193,10 @@ export const Option = { return message; }, fromJSON(object: any): Option { - return { - name: isSet(object.name) ? String(object.name) : "", - value: isSet(object.value) ? Any.fromJSON(object.value) : undefined - }; + const obj = createBaseOption(); + if (isSet(object.name)) obj.name = String(object.name); + if (isSet(object.value)) obj.value = Any.fromJSON(object.value); + return obj; }, toJSON(message: Option): JsonSafe