From 21bc63dd56691f658ec118e299172314f48977e5 Mon Sep 17 00:00:00 2001 From: Zetazzz <zetazz@163.com> Date: Wed, 25 Dec 2024 09:45:57 +0800 Subject: [PATCH] fix registry flies flag --- .../akash/audit/v1beta1/audit.registry.ts | 3 + .../akash/audit/v1beta2/audit.registry.ts | 3 + .../akash/cert/v1beta2/cert.registry.ts | 3 + .../v-next/outputicjs/akash/client.ts | 51 + .../deployment/v1beta1/deployment.registry.ts | 4 + .../deployment/v1beta2/service.registry.ts | 4 + .../akash/market/v1beta2/service.registry.ts | 4 + .../provider/v1beta1/provider.registry.ts | 3 + .../provider/v1beta2/provider.registry.ts | 3 + .../cosmos/authz/v1beta1/tx.registry.ts | 3 + .../cosmos/bank/v1beta1/tx.registry.ts | 3 + .../v-next/outputicjs/cosmos/client.ts | 49 + .../cosmos/crisis/v1beta1/tx.registry.ts | 3 + .../distribution/v1beta1/tx.registry.ts | 3 + .../cosmos/evidence/v1beta1/tx.registry.ts | 3 + .../cosmos/feegrant/v1beta1/tx.registry.ts | 3 + .../outputicjs/cosmos/gov/v1/tx.registry.ts | 3 + .../cosmos/gov/v1beta1/tx.registry.ts | 3 + .../outputicjs/cosmos/group/v1/tx.registry.ts | 3 + .../cosmos/nft/v1beta1/tx.registry.ts | 3 + .../cosmos/slashing/v1beta1/tx.registry.ts | 3 + .../cosmos/staking/v1beta1/tx.registry.ts | 3 + .../cosmos/upgrade/v1beta1/tx.registry.ts | 3 + .../cosmos/vesting/v1beta1/tx.registry.ts | 3 + .../v-next/outputicjs/cosmwasm/client.ts | 44 + .../cosmwasm/wasm/v1/tx.registry.ts | 3 + .../v-next/outputicjs/evmos/client.ts | 46 + .../outputicjs/evmos/erc20/v1/tx.registry.ts | 3 + .../outputicjs/evmos/fees/v1/tx.registry.ts | 3 + .../evmos/vesting/v1/tx.registry.ts | 3 + .../applications/transfer/v1/tx.registry.ts | 3 + __fixtures__/v-next/outputicjs/ibc/client.ts | 47 + .../ibc/core/channel/v1/tx.registry.ts | 3 + .../ibc/core/client/v1/tx.registry.ts | 3 + .../ibc/core/connection/v1/tx.registry.ts | 3 + .../v-next/outputicjs/osmosis/client.ts | 50 + .../pool-models/balancer/tx/tx.registry.ts | 3 + .../pool-models/stableswap/tx.registry.ts | 3 + .../osmosis/gamm/v1beta1/tx.registry.ts | 3 + .../osmosis/incentives/tx.registry.ts | 3 + .../outputicjs/osmosis/lockup/tx.registry.ts | 3 + .../osmosis/superfluid/tx.registry.ts | 3 + .../tokenfactory/v1beta1/tx.registry.ts | 3 + __fixtures__/v-next/outputv4/akash/bundle.ts | 264 ++-- __fixtures__/v-next/outputv4/akash/lcd.ts | 5 + .../v-next/outputv4/akash/rpc.query.ts | 63 +- __fixtures__/v-next/outputv4/akash/rpc.tx.ts | 44 +- __fixtures__/v-next/outputv4/binary.ts | 4 +- .../cosmos/app/v1alpha1/query.rpc.Query.ts | 8 +- .../outputv4/cosmos/auth/v1beta1/query.lcd.ts | 12 +- .../cosmos/auth/v1beta1/query.rpc.Query.ts | 129 +- .../cosmos/authz/v1beta1/query.lcd.ts | 8 +- .../cosmos/authz/v1beta1/query.rpc.Query.ts | 10 +- .../outputv4/cosmos/authz/v1beta1/tx.amino.ts | 6 +- .../cosmos/authz/v1beta1/tx.registry.ts | 6 +- .../cosmos/authz/v1beta1/tx.rpc.msg.ts | 10 +- .../outputv4/cosmos/bank/v1beta1/query.lcd.ts | 14 +- .../cosmos/bank/v1beta1/query.rpc.Query.ts | 298 +++-- .../outputv4/cosmos/bank/v1beta1/tx.amino.ts | 6 +- .../cosmos/bank/v1beta1/tx.registry.ts | 6 +- .../cosmos/bank/v1beta1/tx.rpc.msg.ts | 10 +- .../base/reflection/v1beta1/reflection.lcd.ts | 2 +- .../reflection.rpc.ReflectionService.ts | 6 +- .../reflection/v2alpha1/reflection.lcd.ts | 2 +- .../reflection.rpc.ReflectionService.ts | 6 +- .../base/tendermint/v1beta1/query.lcd.ts | 16 +- .../tendermint/v1beta1/query.rpc.Service.ts | 18 +- __fixtures__/v-next/outputv4/cosmos/bundle.ts | 598 ++++----- __fixtures__/v-next/outputv4/cosmos/client.ts | 56 +- .../cosmos/cosmos-rpc-client.query.ts | 10 +- .../outputv4/cosmos/cosmos-rpc-client.tx.ts | 6 +- .../cosmos/crisis/v1beta1/tx.amino.ts | 2 +- .../cosmos/crisis/v1beta1/tx.registry.ts | 2 +- .../cosmos/crisis/v1beta1/tx.rpc.msg.ts | 6 +- .../cosmos/distribution/v1beta1/query.lcd.ts | 10 +- .../distribution/v1beta1/query.rpc.Query.ts | 12 +- .../cosmos/distribution/v1beta1/tx.amino.ts | 4 +- .../distribution/v1beta1/tx.registry.ts | 4 +- .../cosmos/distribution/v1beta1/tx.rpc.msg.ts | 8 +- .../cosmos/evidence/v1beta1/query.lcd.ts | 10 +- .../evidence/v1beta1/query.rpc.Query.ts | 12 +- .../cosmos/evidence/v1beta1/tx.amino.ts | 4 +- .../cosmos/evidence/v1beta1/tx.registry.ts | 4 +- .../cosmos/evidence/v1beta1/tx.rpc.msg.ts | 8 +- .../cosmos/feegrant/v1beta1/query.lcd.ts | 8 +- .../feegrant/v1beta1/query.rpc.Query.ts | 10 +- .../cosmos/feegrant/v1beta1/tx.amino.ts | 4 +- .../cosmos/feegrant/v1beta1/tx.registry.ts | 4 +- .../cosmos/feegrant/v1beta1/tx.rpc.msg.ts | 8 +- .../outputv4/cosmos/gov/v1/query.lcd.ts | 8 +- .../outputv4/cosmos/gov/v1/query.rpc.Query.ts | 265 +++- .../v-next/outputv4/cosmos/gov/v1/tx.amino.ts | 8 +- .../outputv4/cosmos/gov/v1/tx.registry.ts | 8 +- .../outputv4/cosmos/gov/v1/tx.rpc.msg.ts | 12 +- .../outputv4/cosmos/gov/v1beta1/query.lcd.ts | 8 +- .../cosmos/gov/v1beta1/query.rpc.Query.ts | 85 +- .../outputv4/cosmos/gov/v1beta1/tx.amino.ts | 8 +- .../cosmos/gov/v1beta1/tx.registry.ts | 8 +- .../outputv4/cosmos/gov/v1beta1/tx.rpc.msg.ts | 12 +- .../outputv4/cosmos/group/v1/query.lcd.ts | 8 +- .../cosmos/group/v1/query.rpc.Query.ts | 10 +- .../outputv4/cosmos/group/v1/tx.amino.ts | 6 +- .../outputv4/cosmos/group/v1/tx.registry.ts | 6 +- .../outputv4/cosmos/group/v1/tx.rpc.msg.ts | 10 +- .../v-next/outputv4/cosmos/group/v1/tx.ts | 453 ++++--- .../v-next/outputv4/cosmos/group/v1/types.ts | 343 ++--- __fixtures__/v-next/outputv4/cosmos/lcd.ts | 5 + .../outputv4/cosmos/mint/v1beta1/genesis.ts | 29 +- .../outputv4/cosmos/mint/v1beta1/mint.ts | 63 +- .../outputv4/cosmos/mint/v1beta1/query.lcd.ts | 4 +- .../cosmos/mint/v1beta1/query.rpc.Query.ts | 8 +- .../outputv4/cosmos/mint/v1beta1/query.ts | 52 +- .../outputv4/cosmos/nft/v1beta1/event.ts | 75 +- .../outputv4/cosmos/nft/v1beta1/genesis.ts | 35 +- .../v-next/outputv4/cosmos/nft/v1beta1/nft.ts | 85 +- .../outputv4/cosmos/nft/v1beta1/query.lcd.ts | 10 +- .../cosmos/nft/v1beta1/query.rpc.Query.ts | 126 +- .../outputv4/cosmos/nft/v1beta1/query.ts | 216 ++-- .../outputv4/cosmos/nft/v1beta1/tx.amino.ts | 2 +- .../cosmos/nft/v1beta1/tx.registry.ts | 2 +- .../outputv4/cosmos/nft/v1beta1/tx.rpc.msg.ts | 6 +- .../v-next/outputv4/cosmos/nft/v1beta1/tx.ts | 37 +- .../cosmos/orm/module/v1alpha1/module.ts | 11 +- .../v-next/outputv4/cosmos/orm/v1/orm.ts | 76 +- .../outputv4/cosmos/orm/v1alpha1/schema.ts | 38 +- .../outputv4/cosmos/params/v1beta1/params.ts | 47 +- .../cosmos/params/v1beta1/query.lcd.ts | 4 +- .../cosmos/params/v1beta1/query.rpc.Query.ts | 8 +- .../outputv4/cosmos/params/v1beta1/query.ts | 65 +- .../v-next/outputv4/cosmos/rpc.query.ts | 49 +- __fixtures__/v-next/outputv4/cosmos/rpc.tx.ts | 30 +- .../cosmos/slashing/v1beta1/genesis.ts | 80 +- .../cosmos/slashing/v1beta1/query.lcd.ts | 10 +- .../slashing/v1beta1/query.rpc.Query.ts | 12 +- .../outputv4/cosmos/slashing/v1beta1/query.ts | 81 +- .../cosmos/slashing/v1beta1/slashing.ts | 88 +- .../cosmos/slashing/v1beta1/tx.amino.ts | 2 +- .../cosmos/slashing/v1beta1/tx.registry.ts | 2 +- .../cosmos/slashing/v1beta1/tx.rpc.msg.ts | 6 +- .../outputv4/cosmos/slashing/v1beta1/tx.ts | 22 +- .../outputv4/cosmos/staking/v1beta1/authz.ts | 48 +- .../cosmos/staking/v1beta1/genesis.ts | 65 +- .../cosmos/staking/v1beta1/query.lcd.ts | 8 +- .../cosmos/staking/v1beta1/query.rpc.Query.ts | 455 ++++++- .../outputv4/cosmos/staking/v1beta1/query.ts | 432 ++++--- .../cosmos/staking/v1beta1/staking.ts | 460 ++++--- .../cosmos/staking/v1beta1/tx.amino.ts | 10 +- .../cosmos/staking/v1beta1/tx.registry.ts | 10 +- .../cosmos/staking/v1beta1/tx.rpc.msg.ts | 14 +- .../outputv4/cosmos/staking/v1beta1/tx.ts | 196 +-- .../cosmos/tx/signing/v1beta1/signing.ts | 97 +- .../outputv4/cosmos/tx/v1beta1/service.lcd.ts | 14 +- .../cosmos/tx/v1beta1/service.rpc.Service.ts | 16 +- .../outputv4/cosmos/tx/v1beta1/service.ts | 199 +-- .../v-next/outputv4/cosmos/tx/v1beta1/tx.ts | 317 ++--- .../cosmos/upgrade/v1beta1/query.lcd.ts | 4 +- .../cosmos/upgrade/v1beta1/query.rpc.Query.ts | 8 +- .../outputv4/cosmos/upgrade/v1beta1/query.ts | 111 +- .../cosmos/upgrade/v1beta1/tx.amino.ts | 6 +- .../cosmos/upgrade/v1beta1/tx.registry.ts | 4 +- .../cosmos/upgrade/v1beta1/tx.rpc.msg.ts | 8 +- .../outputv4/cosmos/upgrade/v1beta1/tx.ts | 46 +- .../cosmos/upgrade/v1beta1/upgrade.ts | 105 +- .../cosmos/vesting/v1beta1/tx.amino.ts | 6 +- .../cosmos/vesting/v1beta1/tx.registry.ts | 6 +- .../cosmos/vesting/v1beta1/tx.rpc.msg.ts | 10 +- .../outputv4/cosmos/vesting/v1beta1/tx.ts | 103 +- .../cosmos/vesting/v1beta1/vesting.ts | 133 +- .../v-next/outputv4/cosmos_proto/bundle.ts | 2 +- .../v-next/outputv4/cosmwasm/bundle.ts | 50 +- .../v-next/outputv4/cosmwasm/client.ts | 4 +- __fixtures__/v-next/outputv4/cosmwasm/lcd.ts | 5 + .../v-next/outputv4/cosmwasm/rpc.query.ts | 51 +- .../v-next/outputv4/cosmwasm/rpc.tx.ts | 32 +- .../outputv4/cosmwasm/wasm/v1/genesis.ts | 132 +- .../v-next/outputv4/cosmwasm/wasm/v1/ibc.ts | 50 +- .../outputv4/cosmwasm/wasm/v1/proposal.ts | 262 ++-- .../outputv4/cosmwasm/wasm/v1/query.lcd.ts | 12 +- .../cosmwasm/wasm/v1/query.rpc.Query.ts | 14 +- .../v-next/outputv4/cosmwasm/wasm/v1/query.ts | 304 +++-- .../outputv4/cosmwasm/wasm/v1/tx.amino.ts | 6 +- .../outputv4/cosmwasm/wasm/v1/tx.registry.ts | 6 +- .../outputv4/cosmwasm/wasm/v1/tx.rpc.msg.ts | 10 +- .../v-next/outputv4/cosmwasm/wasm/v1/tx.ts | 210 ++-- .../v-next/outputv4/cosmwasm/wasm/v1/types.ts | 191 +-- __fixtures__/v-next/outputv4/evmos/bundle.ts | 208 ++-- .../v-next/outputv4/evmos/claims/v1/claims.ts | 59 +- .../outputv4/evmos/claims/v1/genesis.ts | 68 +- .../outputv4/evmos/claims/v1/query.lcd.ts | 14 +- .../evmos/claims/v1/query.rpc.Query.ts | 16 +- .../v-next/outputv4/evmos/claims/v1/query.ts | 99 +- __fixtures__/v-next/outputv4/evmos/client.ts | 12 +- .../outputv4/evmos/epochs/v1/genesis.ts | 67 +- .../outputv4/evmos/epochs/v1/query.lcd.ts | 10 +- .../evmos/epochs/v1/query.rpc.Query.ts | 12 +- .../v-next/outputv4/evmos/epochs/v1/query.ts | 66 +- .../v-next/outputv4/evmos/erc20/v1/erc20.ts | 98 +- .../v-next/outputv4/evmos/erc20/v1/genesis.ts | 41 +- .../outputv4/evmos/erc20/v1/query.lcd.ts | 12 +- .../evmos/erc20/v1/query.rpc.Query.ts | 14 +- .../v-next/outputv4/evmos/erc20/v1/query.ts | 83 +- .../outputv4/evmos/erc20/v1/tx.amino.ts | 4 +- .../outputv4/evmos/erc20/v1/tx.registry.ts | 4 +- .../outputv4/evmos/erc20/v1/tx.rpc.msg.ts | 8 +- .../v-next/outputv4/evmos/erc20/v1/tx.ts | 66 +- .../outputv4/evmos/evmos-rpc-client.query.ts | 12 +- .../outputv4/evmos/evmos-rpc-client.tx.ts | 8 +- .../v-next/outputv4/evmos/fees/v1/fees.ts | 28 +- .../v-next/outputv4/evmos/fees/v1/genesis.ts | 60 +- .../outputv4/evmos/fees/v1/query.lcd.ts | 12 +- .../outputv4/evmos/fees/v1/query.rpc.Query.ts | 14 +- .../v-next/outputv4/evmos/fees/v1/query.ts | 117 +- .../v-next/outputv4/evmos/fees/v1/tx.amino.ts | 2 +- .../outputv4/evmos/fees/v1/tx.registry.ts | 2 +- .../outputv4/evmos/fees/v1/tx.rpc.msg.ts | 6 +- .../v-next/outputv4/evmos/fees/v1/tx.ts | 80 +- .../outputv4/evmos/incentives/v1/genesis.ts | 54 +- .../evmos/incentives/v1/incentives.ts | 117 +- .../outputv4/evmos/incentives/v1/query.lcd.ts | 16 +- .../evmos/incentives/v1/query.rpc.Query.ts | 18 +- .../outputv4/evmos/incentives/v1/query.ts | 203 +-- .../outputv4/evmos/inflation/v1/genesis.ts | 84 +- .../outputv4/evmos/inflation/v1/inflation.ts | 59 +- .../outputv4/evmos/inflation/v1/query.lcd.ts | 6 +- .../evmos/inflation/v1/query.rpc.Query.ts | 10 +- .../outputv4/evmos/inflation/v1/query.ts | 115 +- __fixtures__/v-next/outputv4/evmos/lcd.ts | 5 + .../outputv4/evmos/recovery/v1/genesis.ts | 40 +- .../outputv4/evmos/recovery/v1/query.lcd.ts | 4 +- .../evmos/recovery/v1/query.rpc.Query.ts | 8 +- .../outputv4/evmos/recovery/v1/query.ts | 26 +- .../v-next/outputv4/evmos/rpc.query.ts | 65 +- __fixtures__/v-next/outputv4/evmos/rpc.tx.ts | 36 +- .../outputv4/evmos/vesting/v1/query.lcd.ts | 4 +- .../evmos/vesting/v1/query.rpc.Query.ts | 8 +- .../v-next/outputv4/evmos/vesting/v1/query.ts | 35 +- .../outputv4/evmos/vesting/v1/tx.amino.ts | 8 +- .../outputv4/evmos/vesting/v1/tx.registry.ts | 6 +- .../outputv4/evmos/vesting/v1/tx.rpc.msg.ts | 10 +- .../v-next/outputv4/evmos/vesting/v1/tx.ts | 70 +- .../outputv4/evmos/vesting/v1/vesting.ts | 38 +- __fixtures__/v-next/outputv4/extern.ts | 15 +- .../v-next/outputv4/gogoproto/bundle.ts | 4 +- .../v-next/outputv4/google/api/auth.ts | 123 +- .../v-next/outputv4/google/api/backend.ts | 61 +- .../v-next/outputv4/google/api/billing.ts | 30 +- .../outputv4/google/api/config_change.ts | 45 +- .../v-next/outputv4/google/api/consumer.ts | 35 +- .../v-next/outputv4/google/api/context.ts | 39 +- .../v-next/outputv4/google/api/control.ts | 18 +- .../outputv4/google/api/distribution.ts | 167 +-- .../outputv4/google/api/documentation.ts | 79 +- .../v-next/outputv4/google/api/endpoint.ts | 31 +- .../outputv4/google/api/error_reason.ts | 1 + .../v1alpha1/conformance_service.ts | 198 +-- .../google/api/expr/v1alpha1/checked.ts | 362 +++--- .../outputv4/google/api/expr/v1alpha1/eval.ts | 92 +- .../google/api/expr/v1alpha1/explain.ts | 41 +- .../google/api/expr/v1alpha1/syntax.ts | 420 ++++--- .../google/api/expr/v1alpha1/value.ts | 131 +- .../outputv4/google/api/expr/v1beta1/decl.ts | 104 +- .../outputv4/google/api/expr/v1beta1/eval.ts | 97 +- .../outputv4/google/api/expr/v1beta1/expr.ts | 288 +++-- .../google/api/expr/v1beta1/source.ts | 78 +- .../outputv4/google/api/expr/v1beta1/value.ts | 131 +- .../outputv4/google/api/field_behavior.ts | 1 + .../v-next/outputv4/google/api/http.ts | 83 +- .../v-next/outputv4/google/api/httpbody.ts | 26 +- .../v-next/outputv4/google/api/label.ts | 26 +- .../outputv4/google/api/launch_stage.ts | 1 + .../v-next/outputv4/google/api/log.ts | 33 +- .../v-next/outputv4/google/api/logging.ts | 33 +- .../v-next/outputv4/google/api/metric.ts | 131 +- .../outputv4/google/api/monitored_resource.ts | 131 +- .../v-next/outputv4/google/api/monitoring.ts | 33 +- .../v-next/outputv4/google/api/quota.ts | 163 +-- .../v-next/outputv4/google/api/resource.ts | 58 +- .../v-next/outputv4/google/api/routing.ts | 32 +- .../v-next/outputv4/google/api/service.ts | 192 +-- .../api/servicecontrol/v1/check_error.ts | 35 +- .../api/servicecontrol/v1/distribution.ts | 122 +- .../api/servicecontrol/v1/http_request.ts | 104 +- .../google/api/servicecontrol/v1/log_entry.ts | 164 +-- .../api/servicecontrol/v1/metric_value.ts | 91 +- .../google/api/servicecontrol/v1/operation.ts | 85 +- .../api/servicecontrol/v1/quota_controller.ts | 140 ++- .../servicecontrol/v1/service_controller.ts | 166 +-- .../servicecontrol/v2/service_controller.ts | 140 ++- .../api/servicemanagement/v1/resources.ts | 213 ++-- .../servicemanagement/v1/servicemanager.ts | 336 +++-- .../google/api/serviceusage/v1/resources.ts | 118 +- .../api/serviceusage/v1/serviceusage.ts | 181 ++- .../api/serviceusage/v1beta1/resources.ts | 417 ++++--- .../api/serviceusage/v1beta1/serviceusage.ts | 542 ++++---- .../v-next/outputv4/google/api/source_info.ts | 18 +- .../outputv4/google/api/system_parameter.ts | 51 +- .../v-next/outputv4/google/api/usage.ts | 45 +- .../v-next/outputv4/google/api/visibility.ts | 32 +- __fixtures__/v-next/outputv4/google/bundle.ts | 138 +- .../google/logging/type/http_request.ts | 104 +- .../google/logging/type/log_severity.ts | 1 + .../outputv4/google/logging/v2/log_entry.ts | 214 ++-- .../outputv4/google/logging/v2/logging.ts | 289 +++-- .../google/logging/v2/logging_config.ts | 819 +++++++----- .../google/logging/v2/logging_metrics.ts | 191 +-- .../outputv4/google/longrunning/operations.ts | 157 ++- .../v-next/outputv4/google/protobuf/any.ts | 22 +- .../v-next/outputv4/google/protobuf/api.ts | 99 +- .../google/protobuf/compiler/plugin.ts | 94 +- .../outputv4/google/protobuf/descriptor.ts | 731 ++++++----- .../outputv4/google/protobuf/duration.ts | 27 +- .../v-next/outputv4/google/protobuf/empty.ts | 11 +- .../outputv4/google/protobuf/field_mask.ts | 16 +- .../google/protobuf/source_context.ts | 18 +- .../v-next/outputv4/google/protobuf/struct.ts | 87 +- .../outputv4/google/protobuf/timestamp.ts | 27 +- .../v-next/outputv4/google/protobuf/type.ts | 155 ++- .../outputv4/google/protobuf/wrappers.ts | 112 +- .../v-next/outputv4/google/rpc/code.ts | 1 + .../google/rpc/context/attribute_context.ts | 462 ++++--- .../outputv4/google/rpc/error_details.ts | 246 ++-- .../v-next/outputv4/google/rpc/status.ts | 28 +- .../ibc/applications/transfer/v1/genesis.ts | 30 +- .../ibc/applications/transfer/v1/query.lcd.ts | 10 +- .../transfer/v1/query.rpc.Query.ts | 12 +- .../ibc/applications/transfer/v1/query.ts | 81 +- .../ibc/applications/transfer/v1/transfer.ts | 39 +- .../ibc/applications/transfer/v1/tx.amino.ts | 8 +- .../applications/transfer/v1/tx.registry.ts | 6 +- .../applications/transfer/v1/tx.rpc.msg.ts | 10 +- .../ibc/applications/transfer/v1/tx.ts | 64 +- .../ibc/applications/transfer/v2/packet.ts | 33 +- __fixtures__/v-next/outputv4/ibc/bundle.ts | 274 ++-- __fixtures__/v-next/outputv4/ibc/client.ts | 26 +- .../outputv4/ibc/core/channel/v1/channel.ts | 183 +-- .../outputv4/ibc/core/channel/v1/genesis.ts | 70 +- .../outputv4/ibc/core/channel/v1/query.lcd.ts | 14 +- .../ibc/core/channel/v1/query.rpc.Query.ts | 16 +- .../outputv4/ibc/core/channel/v1/query.ts | 572 +++++---- .../outputv4/ibc/core/channel/v1/tx.amino.ts | 8 +- .../ibc/core/channel/v1/tx.registry.ts | 6 +- .../ibc/core/channel/v1/tx.rpc.msg.ts | 10 +- .../v-next/outputv4/ibc/core/channel/v1/tx.ts | 377 +++--- .../outputv4/ibc/core/client/v1/client.ts | 152 ++- .../outputv4/ibc/core/client/v1/genesis.ts | 71 +- .../outputv4/ibc/core/client/v1/query.lcd.ts | 12 +- .../ibc/core/client/v1/query.rpc.Query.ts | 14 +- .../outputv4/ibc/core/client/v1/query.ts | 240 ++-- .../outputv4/ibc/core/client/v1/tx.amino.ts | 4 +- .../ibc/core/client/v1/tx.registry.ts | 4 +- .../outputv4/ibc/core/client/v1/tx.rpc.msg.ts | 8 +- .../v-next/outputv4/ibc/core/client/v1/tx.ts | 132 +- .../ibc/core/commitment/v1/commitment.ts | 45 +- .../ibc/core/connection/v1/connection.ts | 155 ++- .../ibc/core/connection/v1/genesis.ts | 37 +- .../ibc/core/connection/v1/query.lcd.ts | 14 +- .../ibc/core/connection/v1/query.rpc.Query.ts | 16 +- .../outputv4/ibc/core/connection/v1/query.ts | 206 +-- .../ibc/core/connection/v1/tx.amino.ts | 12 +- .../ibc/core/connection/v1/tx.registry.ts | 8 +- .../ibc/core/connection/v1/tx.rpc.msg.ts | 12 +- .../outputv4/ibc/core/connection/v1/tx.ts | 222 ++-- .../ibc/core/port/v1/query.rpc.Query.ts | 8 +- .../v-next/outputv4/ibc/core/port/v1/query.ts | 56 +- .../outputv4/ibc/core/types/v1/genesis.ts | 46 +- __fixtures__/v-next/outputv4/ibc/lcd.ts | 22 + .../lightclients/localhost/v1/localhost.ts | 27 +- .../solomachine/v1/solomachine.ts | 359 +++--- .../solomachine/v2/solomachine.ts | 355 +++--- .../lightclients/tendermint/v1/tendermint.ts | 192 +-- __fixtures__/v-next/outputv4/ibc/rpc.query.ts | 70 +- __fixtures__/v-next/outputv4/ibc/rpc.tx.ts | 46 +- __fixtures__/v-next/outputv4/ics23/bundle.ts | 2 +- __fixtures__/v-next/outputv4/index.ts | 53 +- .../v-next/outputv4/osmosis/agg-lcd.ts | 22 +- .../v-next/outputv4/osmosis/bundle.ts | 540 ++++---- .../outputv4/osmosis/claim/v1beta1/claim.ts | 26 +- .../outputv4/osmosis/claim/v1beta1/genesis.ts | 36 +- .../outputv4/osmosis/claim/v1beta1/params.ts | 39 +- .../osmosis/claim/v1beta1/query.lcd.ts | 8 +- .../osmosis/claim/v1beta1/query.rpc.Query.ts | 12 +- .../outputv4/osmosis/claim/v1beta1/query.ts | 110 +- .../v-next/outputv4/osmosis/client.ts | 44 +- .../v-next/outputv4/osmosis/epochs/genesis.ts | 67 +- .../outputv4/osmosis/epochs/query.lcd.ts | 4 +- .../osmosis/epochs/query.rpc.Query.ts | 8 +- .../v-next/outputv4/osmosis/epochs/query.ts | 48 +- .../gamm/pool-models/balancer/balancerPool.ts | 123 +- .../gamm/pool-models/balancer/tx/tx.amino.ts | 8 +- .../pool-models/balancer/tx/tx.registry.ts | 4 +- .../pool-models/balancer/tx/tx.rpc.msg.ts | 8 +- .../gamm/pool-models/balancer/tx/tx.ts | 50 +- .../pool-models/stableswap/stableswap_pool.ts | 75 +- .../gamm/pool-models/stableswap/tx.amino.ts | 6 +- .../pool-models/stableswap/tx.registry.ts | 6 +- .../gamm/pool-models/stableswap/tx.rpc.msg.ts | 10 +- .../osmosis/gamm/pool-models/stableswap/tx.ts | 87 +- .../outputv4/osmosis/gamm/v1beta1/genesis.ts | 45 +- .../osmosis/gamm/v1beta1/query.lcd.ts | 14 +- .../osmosis/gamm/v1beta1/query.rpc.Query.ts | 595 +++++---- .../outputv4/osmosis/gamm/v1beta1/query.ts | 454 ++++--- .../outputv4/osmosis/gamm/v1beta1/tx.amino.ts | 4 +- .../osmosis/gamm/v1beta1/tx.registry.ts | 4 +- .../osmosis/gamm/v1beta1/tx.rpc.msg.ts | 8 +- .../outputv4/osmosis/gamm/v1beta1/tx.ts | 380 +++--- .../outputv4/osmosis/gamm/v2/query.lcd.ts | 2 +- .../osmosis/gamm/v2/query.rpc.Query.ts | 82 +- .../v-next/outputv4/osmosis/gamm/v2/query.ts | 43 +- .../osmosis/ibc-rate-limit/v1beta1/params.ts | 18 +- .../ibc-rate-limit/v1beta1/query.lcd.ts | 4 +- .../ibc-rate-limit/v1beta1/query.rpc.Query.ts | 8 +- .../osmosis/ibc-rate-limit/v1beta1/query.ts | 26 +- .../outputv4/osmosis/incentives/gauge.ts | 78 +- .../outputv4/osmosis/incentives/genesis.ts | 41 +- .../outputv4/osmosis/incentives/params.ts | 18 +- .../outputv4/osmosis/incentives/query.lcd.ts | 18 +- .../osmosis/incentives/query.rpc.Query.ts | 20 +- .../outputv4/osmosis/incentives/query.ts | 256 ++-- .../outputv4/osmosis/incentives/tx.amino.ts | 10 +- .../osmosis/incentives/tx.registry.ts | 8 +- .../outputv4/osmosis/incentives/tx.rpc.msg.ts | 12 +- .../v-next/outputv4/osmosis/incentives/tx.ts | 82 +- __fixtures__/v-next/outputv4/osmosis/lcd.ts | 35 + .../v-next/outputv4/osmosis/lockup/genesis.ts | 30 +- .../v-next/outputv4/osmosis/lockup/lock.ts | 100 +- .../v-next/outputv4/osmosis/lockup/params.ts | 16 +- .../outputv4/osmosis/lockup/query.lcd.ts | 12 +- .../osmosis/lockup/query.rpc.Query.ts | 16 +- .../v-next/outputv4/osmosis/lockup/query.ts | 411 +++--- .../outputv4/osmosis/lockup/tx.amino.ts | 8 +- .../outputv4/osmosis/lockup/tx.registry.ts | 8 +- .../outputv4/osmosis/lockup/tx.rpc.msg.ts | 12 +- .../v-next/outputv4/osmosis/lockup/tx.ts | 175 +-- .../outputv4/osmosis/mint/v1beta1/genesis.ts | 38 +- .../outputv4/osmosis/mint/v1beta1/mint.ts | 114 +- .../osmosis/mint/v1beta1/query.lcd.ts | 4 +- .../osmosis/mint/v1beta1/query.rpc.Query.ts | 8 +- .../outputv4/osmosis/mint/v1beta1/query.ts | 39 +- .../pool-incentives/v1beta1/genesis.ts | 41 +- .../osmosis/pool-incentives/v1beta1/gov.ts | 47 +- .../pool-incentives/v1beta1/incentives.ts | 103 +- .../pool-incentives/v1beta1/query.lcd.ts | 8 +- .../v1beta1/query.rpc.Query.ts | 12 +- .../osmosis/pool-incentives/v1beta1/query.ts | 168 +-- .../v-next/outputv4/osmosis/rpc.query.ts | 93 +- .../v-next/outputv4/osmosis/rpc.tx.ts | 56 +- .../outputv4/osmosis/sumtree/v1beta1/tree.ts | 43 +- .../outputv4/osmosis/superfluid/genesis.ts | 36 +- .../outputv4/osmosis/superfluid/params.ts | 18 +- .../outputv4/osmosis/superfluid/query.lcd.ts | 18 +- .../osmosis/superfluid/query.rpc.Query.ts | 20 +- .../outputv4/osmosis/superfluid/query.ts | 423 ++++--- .../outputv4/osmosis/superfluid/superfluid.ts | 132 +- .../outputv4/osmosis/superfluid/tx.amino.ts | 4 +- .../osmosis/superfluid/tx.registry.ts | 4 +- .../outputv4/osmosis/superfluid/tx.rpc.msg.ts | 8 +- .../v-next/outputv4/osmosis/superfluid/tx.ts | 149 ++- .../osmosis/superfluid/v1beta1/gov.ts | 71 +- .../tokenfactory/v1beta1/authorityMetadata.ts | 18 +- .../osmosis/tokenfactory/v1beta1/genesis.ts | 45 +- .../osmosis/tokenfactory/v1beta1/params.ts | 18 +- .../osmosis/tokenfactory/v1beta1/query.lcd.ts | 6 +- .../tokenfactory/v1beta1/query.rpc.Query.ts | 10 +- .../osmosis/tokenfactory/v1beta1/query.ts | 72 +- .../osmosis/tokenfactory/v1beta1/tx.amino.ts | 6 +- .../tokenfactory/v1beta1/tx.registry.ts | 6 +- .../tokenfactory/v1beta1/tx.rpc.msg.ts | 10 +- .../osmosis/tokenfactory/v1beta1/tx.ts | 129 +- .../outputv4/osmosis/twap/v1beta1/genesis.ts | 45 +- .../osmosis/twap/v1beta1/query.lcd.ts | 6 +- .../osmosis/twap/v1beta1/query.rpc.Query.ts | 10 +- .../outputv4/osmosis/twap/v1beta1/query.ts | 109 +- .../osmosis/twap/v1beta1/twap_record.ts | 69 +- .../osmosis/txfees/v1beta1/feetoken.ts | 27 +- .../osmosis/txfees/v1beta1/genesis.ts | 23 +- .../outputv4/osmosis/txfees/v1beta1/gov.ts | 32 +- .../osmosis/txfees/v1beta1/query.lcd.ts | 4 +- .../osmosis/txfees/v1beta1/query.rpc.Query.ts | 8 +- .../outputv4/osmosis/txfees/v1beta1/query.ts | 94 +- .../abci/types.rpc.ABCIApplication.ts | 16 +- .../v-next/outputv4/tendermint/abci/types.ts | 1107 +++++++++-------- .../v-next/outputv4/tendermint/bundle.ts | 56 +- .../v-next/outputv4/tendermint/crypto/keys.ts | 19 +- .../outputv4/tendermint/crypto/proof.ts | 100 +- .../v-next/outputv4/tendermint/lcd.ts | 5 + .../outputv4/tendermint/libs/bits/types.ts | 25 +- .../v-next/outputv4/tendermint/p2p/types.ts | 145 ++- .../v-next/outputv4/tendermint/rpc.query.ts | 51 +- .../v-next/outputv4/tendermint/types/block.ts | 45 +- .../outputv4/tendermint/types/evidence.ts | 120 +- .../outputv4/tendermint/types/params.ts | 155 +-- .../v-next/outputv4/tendermint/types/types.ts | 369 +++--- .../outputv4/tendermint/types/validator.ts | 90 +- .../outputv4/tendermint/version/types.ts | 51 +- .../src/generators/create-registries.ts | 2 +- 495 files changed, 20552 insertions(+), 15000 deletions(-) create mode 100644 __fixtures__/v-next/outputicjs/akash/audit/v1beta1/audit.registry.ts create mode 100644 __fixtures__/v-next/outputicjs/akash/audit/v1beta2/audit.registry.ts create mode 100644 __fixtures__/v-next/outputicjs/akash/cert/v1beta2/cert.registry.ts create mode 100644 __fixtures__/v-next/outputicjs/akash/client.ts create mode 100644 __fixtures__/v-next/outputicjs/akash/deployment/v1beta1/deployment.registry.ts create mode 100644 __fixtures__/v-next/outputicjs/akash/deployment/v1beta2/service.registry.ts create mode 100644 __fixtures__/v-next/outputicjs/akash/market/v1beta2/service.registry.ts create mode 100644 __fixtures__/v-next/outputicjs/akash/provider/v1beta1/provider.registry.ts create mode 100644 __fixtures__/v-next/outputicjs/akash/provider/v1beta2/provider.registry.ts create mode 100644 __fixtures__/v-next/outputicjs/cosmos/authz/v1beta1/tx.registry.ts create mode 100644 __fixtures__/v-next/outputicjs/cosmos/bank/v1beta1/tx.registry.ts create mode 100644 __fixtures__/v-next/outputicjs/cosmos/client.ts create mode 100644 __fixtures__/v-next/outputicjs/cosmos/crisis/v1beta1/tx.registry.ts create mode 100644 __fixtures__/v-next/outputicjs/cosmos/distribution/v1beta1/tx.registry.ts create mode 100644 __fixtures__/v-next/outputicjs/cosmos/evidence/v1beta1/tx.registry.ts create mode 100644 __fixtures__/v-next/outputicjs/cosmos/feegrant/v1beta1/tx.registry.ts create mode 100644 __fixtures__/v-next/outputicjs/cosmos/gov/v1/tx.registry.ts create mode 100644 __fixtures__/v-next/outputicjs/cosmos/gov/v1beta1/tx.registry.ts create mode 100644 __fixtures__/v-next/outputicjs/cosmos/group/v1/tx.registry.ts create mode 100644 __fixtures__/v-next/outputicjs/cosmos/nft/v1beta1/tx.registry.ts create mode 100644 __fixtures__/v-next/outputicjs/cosmos/slashing/v1beta1/tx.registry.ts create mode 100644 __fixtures__/v-next/outputicjs/cosmos/staking/v1beta1/tx.registry.ts create mode 100644 __fixtures__/v-next/outputicjs/cosmos/upgrade/v1beta1/tx.registry.ts create mode 100644 __fixtures__/v-next/outputicjs/cosmos/vesting/v1beta1/tx.registry.ts create mode 100644 __fixtures__/v-next/outputicjs/cosmwasm/client.ts create mode 100644 __fixtures__/v-next/outputicjs/cosmwasm/wasm/v1/tx.registry.ts create mode 100644 __fixtures__/v-next/outputicjs/evmos/client.ts create mode 100644 __fixtures__/v-next/outputicjs/evmos/erc20/v1/tx.registry.ts create mode 100644 __fixtures__/v-next/outputicjs/evmos/fees/v1/tx.registry.ts create mode 100644 __fixtures__/v-next/outputicjs/evmos/vesting/v1/tx.registry.ts create mode 100644 __fixtures__/v-next/outputicjs/ibc/applications/transfer/v1/tx.registry.ts create mode 100644 __fixtures__/v-next/outputicjs/ibc/client.ts create mode 100644 __fixtures__/v-next/outputicjs/ibc/core/channel/v1/tx.registry.ts create mode 100644 __fixtures__/v-next/outputicjs/ibc/core/client/v1/tx.registry.ts create mode 100644 __fixtures__/v-next/outputicjs/ibc/core/connection/v1/tx.registry.ts create mode 100644 __fixtures__/v-next/outputicjs/osmosis/client.ts create mode 100644 __fixtures__/v-next/outputicjs/osmosis/gamm/pool-models/balancer/tx/tx.registry.ts create mode 100644 __fixtures__/v-next/outputicjs/osmosis/gamm/pool-models/stableswap/tx.registry.ts create mode 100644 __fixtures__/v-next/outputicjs/osmosis/gamm/v1beta1/tx.registry.ts create mode 100644 __fixtures__/v-next/outputicjs/osmosis/incentives/tx.registry.ts create mode 100644 __fixtures__/v-next/outputicjs/osmosis/lockup/tx.registry.ts create mode 100644 __fixtures__/v-next/outputicjs/osmosis/superfluid/tx.registry.ts create mode 100644 __fixtures__/v-next/outputicjs/osmosis/tokenfactory/v1beta1/tx.registry.ts diff --git a/__fixtures__/v-next/outputicjs/akash/audit/v1beta1/audit.registry.ts b/__fixtures__/v-next/outputicjs/akash/audit/v1beta1/audit.registry.ts new file mode 100644 index 0000000000..a4889fea10 --- /dev/null +++ b/__fixtures__/v-next/outputicjs/akash/audit/v1beta1/audit.registry.ts @@ -0,0 +1,3 @@ +import { TelescopeGeneratedType } from "../../../types"; +import { MsgSignProviderAttributes, MsgDeleteProviderAttributes } from "./audit"; +export const registry: ReadonlyArray<[string, TelescopeGeneratedType<any, any, any>]> = [["/akash.audit.v1beta1.MsgSignProviderAttributes", MsgSignProviderAttributes], ["/akash.audit.v1beta1.MsgDeleteProviderAttributes", MsgDeleteProviderAttributes]]; \ No newline at end of file diff --git a/__fixtures__/v-next/outputicjs/akash/audit/v1beta2/audit.registry.ts b/__fixtures__/v-next/outputicjs/akash/audit/v1beta2/audit.registry.ts new file mode 100644 index 0000000000..2cc634c027 --- /dev/null +++ b/__fixtures__/v-next/outputicjs/akash/audit/v1beta2/audit.registry.ts @@ -0,0 +1,3 @@ +import { TelescopeGeneratedType } from "../../../types"; +import { MsgSignProviderAttributes, MsgDeleteProviderAttributes } from "./audit"; +export const registry: ReadonlyArray<[string, TelescopeGeneratedType<any, any, any>]> = [["/akash.audit.v1beta2.MsgSignProviderAttributes", MsgSignProviderAttributes], ["/akash.audit.v1beta2.MsgDeleteProviderAttributes", MsgDeleteProviderAttributes]]; \ No newline at end of file diff --git a/__fixtures__/v-next/outputicjs/akash/cert/v1beta2/cert.registry.ts b/__fixtures__/v-next/outputicjs/akash/cert/v1beta2/cert.registry.ts new file mode 100644 index 0000000000..4be4a8909d --- /dev/null +++ b/__fixtures__/v-next/outputicjs/akash/cert/v1beta2/cert.registry.ts @@ -0,0 +1,3 @@ +import { TelescopeGeneratedType } from "../../../types"; +import { MsgCreateCertificate, MsgRevokeCertificate } from "./cert"; +export const registry: ReadonlyArray<[string, TelescopeGeneratedType<any, any, any>]> = [["/akash.cert.v1beta2.MsgCreateCertificate", MsgCreateCertificate], ["/akash.cert.v1beta2.MsgRevokeCertificate", MsgRevokeCertificate]]; \ No newline at end of file diff --git a/__fixtures__/v-next/outputicjs/akash/client.ts b/__fixtures__/v-next/outputicjs/akash/client.ts new file mode 100644 index 0000000000..aa7b97c030 --- /dev/null +++ b/__fixtures__/v-next/outputicjs/akash/client.ts @@ -0,0 +1,51 @@ +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/akash/deployment/v1beta1/deployment.registry.ts b/__fixtures__/v-next/outputicjs/akash/deployment/v1beta1/deployment.registry.ts new file mode 100644 index 0000000000..d9da314fd0 --- /dev/null +++ b/__fixtures__/v-next/outputicjs/akash/deployment/v1beta1/deployment.registry.ts @@ -0,0 +1,4 @@ +import { MsgCloseGroup, MsgPauseGroup, MsgStartGroup } from "./group"; +import { TelescopeGeneratedType } from "../../../types"; +import { MsgCreateDeployment, MsgDepositDeployment, MsgUpdateDeployment, MsgCloseDeployment } from "./deployment"; +export const registry: ReadonlyArray<[string, TelescopeGeneratedType<any, any, any>]> = [["/akash.deployment.v1beta1.MsgCreateDeployment", MsgCreateDeployment], ["/akash.deployment.v1beta1.MsgDepositDeployment", MsgDepositDeployment], ["/akash.deployment.v1beta1.MsgUpdateDeployment", MsgUpdateDeployment], ["/akash.deployment.v1beta1.MsgCloseDeployment", MsgCloseDeployment], ["/akash.deployment.v1beta1.MsgCloseGroup", MsgCloseGroup], ["/akash.deployment.v1beta1.MsgPauseGroup", MsgPauseGroup], ["/akash.deployment.v1beta1.MsgStartGroup", MsgStartGroup]]; \ No newline at end of file diff --git a/__fixtures__/v-next/outputicjs/akash/deployment/v1beta2/service.registry.ts b/__fixtures__/v-next/outputicjs/akash/deployment/v1beta2/service.registry.ts new file mode 100644 index 0000000000..94b27a88a0 --- /dev/null +++ b/__fixtures__/v-next/outputicjs/akash/deployment/v1beta2/service.registry.ts @@ -0,0 +1,4 @@ +import { TelescopeGeneratedType } from "../../../types"; +import { MsgCreateDeployment, MsgDepositDeployment, MsgUpdateDeployment, MsgCloseDeployment } from "./deploymentmsg"; +import { MsgCloseGroup, MsgPauseGroup, MsgStartGroup } from "./groupmsg"; +export const registry: ReadonlyArray<[string, TelescopeGeneratedType<any, any, any>]> = [["/akash.deployment.v1beta2.MsgCreateDeployment", MsgCreateDeployment], ["/akash.deployment.v1beta2.MsgDepositDeployment", MsgDepositDeployment], ["/akash.deployment.v1beta2.MsgUpdateDeployment", MsgUpdateDeployment], ["/akash.deployment.v1beta2.MsgCloseDeployment", MsgCloseDeployment], ["/akash.deployment.v1beta2.MsgCloseGroup", MsgCloseGroup], ["/akash.deployment.v1beta2.MsgPauseGroup", MsgPauseGroup], ["/akash.deployment.v1beta2.MsgStartGroup", MsgStartGroup]]; \ No newline at end of file diff --git a/__fixtures__/v-next/outputicjs/akash/market/v1beta2/service.registry.ts b/__fixtures__/v-next/outputicjs/akash/market/v1beta2/service.registry.ts new file mode 100644 index 0000000000..faecc3fe2d --- /dev/null +++ b/__fixtures__/v-next/outputicjs/akash/market/v1beta2/service.registry.ts @@ -0,0 +1,4 @@ +import { MsgCreateBid, MsgCloseBid } from "./bid"; +import { MsgWithdrawLease, MsgCreateLease, MsgCloseLease } from "./lease"; +import { TelescopeGeneratedType } from "../../../types"; +export const registry: ReadonlyArray<[string, TelescopeGeneratedType<any, any, any>]> = [["/akash.market.v1beta2.MsgCreateBid", MsgCreateBid], ["/akash.market.v1beta2.MsgCloseBid", MsgCloseBid], ["/akash.market.v1beta2.MsgWithdrawLease", MsgWithdrawLease], ["/akash.market.v1beta2.MsgCreateLease", MsgCreateLease], ["/akash.market.v1beta2.MsgCloseLease", MsgCloseLease]]; \ No newline at end of file diff --git a/__fixtures__/v-next/outputicjs/akash/provider/v1beta1/provider.registry.ts b/__fixtures__/v-next/outputicjs/akash/provider/v1beta1/provider.registry.ts new file mode 100644 index 0000000000..b6009dbd79 --- /dev/null +++ b/__fixtures__/v-next/outputicjs/akash/provider/v1beta1/provider.registry.ts @@ -0,0 +1,3 @@ +import { TelescopeGeneratedType } from "../../../types"; +import { MsgCreateProvider, MsgUpdateProvider, MsgDeleteProvider } from "./provider"; +export const registry: ReadonlyArray<[string, TelescopeGeneratedType<any, any, any>]> = [["/akash.provider.v1beta1.MsgCreateProvider", MsgCreateProvider], ["/akash.provider.v1beta1.MsgUpdateProvider", MsgUpdateProvider], ["/akash.provider.v1beta1.MsgDeleteProvider", MsgDeleteProvider]]; \ No newline at end of file diff --git a/__fixtures__/v-next/outputicjs/akash/provider/v1beta2/provider.registry.ts b/__fixtures__/v-next/outputicjs/akash/provider/v1beta2/provider.registry.ts new file mode 100644 index 0000000000..bb2f5a9ded --- /dev/null +++ b/__fixtures__/v-next/outputicjs/akash/provider/v1beta2/provider.registry.ts @@ -0,0 +1,3 @@ +import { TelescopeGeneratedType } from "../../../types"; +import { MsgCreateProvider, MsgUpdateProvider, MsgDeleteProvider } from "./provider"; +export const registry: ReadonlyArray<[string, TelescopeGeneratedType<any, any, any>]> = [["/akash.provider.v1beta2.MsgCreateProvider", MsgCreateProvider], ["/akash.provider.v1beta2.MsgUpdateProvider", MsgUpdateProvider], ["/akash.provider.v1beta2.MsgDeleteProvider", MsgDeleteProvider]]; \ No newline at end of file diff --git a/__fixtures__/v-next/outputicjs/cosmos/authz/v1beta1/tx.registry.ts b/__fixtures__/v-next/outputicjs/cosmos/authz/v1beta1/tx.registry.ts new file mode 100644 index 0000000000..3538d57f68 --- /dev/null +++ b/__fixtures__/v-next/outputicjs/cosmos/authz/v1beta1/tx.registry.ts @@ -0,0 +1,3 @@ +import { TelescopeGeneratedType } from "../../../types"; +import { MsgGrant, MsgExec, MsgRevoke } from "./tx"; +export const registry: ReadonlyArray<[string, TelescopeGeneratedType<any, any, any>]> = [["/cosmos.authz.v1beta1.MsgGrant", MsgGrant], ["/cosmos.authz.v1beta1.MsgExec", MsgExec], ["/cosmos.authz.v1beta1.MsgRevoke", MsgRevoke]]; \ No newline at end of file diff --git a/__fixtures__/v-next/outputicjs/cosmos/bank/v1beta1/tx.registry.ts b/__fixtures__/v-next/outputicjs/cosmos/bank/v1beta1/tx.registry.ts new file mode 100644 index 0000000000..4e74e7c308 --- /dev/null +++ b/__fixtures__/v-next/outputicjs/cosmos/bank/v1beta1/tx.registry.ts @@ -0,0 +1,3 @@ +import { TelescopeGeneratedType } from "../../../types"; +import { MsgSend, MsgMultiSend } from "./tx"; +export const registry: ReadonlyArray<[string, TelescopeGeneratedType<any, any, any>]> = [["/cosmos.bank.v1beta1.MsgSend", MsgSend], ["/cosmos.bank.v1beta1.MsgMultiSend", MsgMultiSend]]; \ No newline at end of file diff --git a/__fixtures__/v-next/outputicjs/cosmos/client.ts b/__fixtures__/v-next/outputicjs/cosmos/client.ts new file mode 100644 index 0000000000..74aebadaa1 --- /dev/null +++ b/__fixtures__/v-next/outputicjs/cosmos/client.ts @@ -0,0 +1,49 @@ +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"; +export const cosmosAminoConverters = {}; +export const cosmosProtoRegistry: ReadonlyArray<[string, GeneratedType]> = [...cosmosAuthzV1beta1TxRegistry.registry, ...cosmosBankV1beta1TxRegistry.registry, ...cosmosCrisisV1beta1TxRegistry.registry, ...cosmosDistributionV1beta1TxRegistry.registry, ...cosmosEvidenceV1beta1TxRegistry.registry, ...cosmosFeegrantV1beta1TxRegistry.registry, ...cosmosGovV1TxRegistry.registry, ...cosmosGovV1beta1TxRegistry.registry, ...cosmosGroupV1TxRegistry.registry, ...cosmosNftV1beta1TxRegistry.registry, ...cosmosSlashingV1beta1TxRegistry.registry, ...cosmosStakingV1beta1TxRegistry.registry, ...cosmosUpgradeV1beta1TxRegistry.registry, ...cosmosVestingV1beta1TxRegistry.registry]; +export const getSigningCosmosClientOptions = (): { + registry: Registry; + aminoTypes: AminoTypes; +} => { + const registry = new Registry([...cosmosProtoRegistry]); + const aminoTypes = new AminoTypes({ + ...cosmosAminoConverters + }); + return { + registry, + aminoTypes + }; +}; +export const getSigningCosmosClient = async ({ + rpcEndpoint, + signer +}: { + rpcEndpoint: string | HttpEndpoint; + signer: OfflineSigner; +}) => { + const { + registry, + aminoTypes + } = getSigningCosmosClientOptions(); + const client = await SigningStargateClient.connectWithSigner(rpcEndpoint, signer, { + registry: (registry as any), + aminoTypes + }); + return client; +}; \ No newline at end of file diff --git a/__fixtures__/v-next/outputicjs/cosmos/crisis/v1beta1/tx.registry.ts b/__fixtures__/v-next/outputicjs/cosmos/crisis/v1beta1/tx.registry.ts new file mode 100644 index 0000000000..71bf360245 --- /dev/null +++ b/__fixtures__/v-next/outputicjs/cosmos/crisis/v1beta1/tx.registry.ts @@ -0,0 +1,3 @@ +import { TelescopeGeneratedType } from "../../../types"; +import { MsgVerifyInvariant } from "./tx"; +export const registry: ReadonlyArray<[string, TelescopeGeneratedType<any, any, any>]> = [["/cosmos.crisis.v1beta1.MsgVerifyInvariant", MsgVerifyInvariant]]; \ No newline at end of file diff --git a/__fixtures__/v-next/outputicjs/cosmos/distribution/v1beta1/tx.registry.ts b/__fixtures__/v-next/outputicjs/cosmos/distribution/v1beta1/tx.registry.ts new file mode 100644 index 0000000000..8b11b82a37 --- /dev/null +++ b/__fixtures__/v-next/outputicjs/cosmos/distribution/v1beta1/tx.registry.ts @@ -0,0 +1,3 @@ +import { TelescopeGeneratedType } from "../../../types"; +import { MsgSetWithdrawAddress, MsgWithdrawDelegatorReward, MsgWithdrawValidatorCommission, MsgFundCommunityPool } from "./tx"; +export const registry: ReadonlyArray<[string, TelescopeGeneratedType<any, any, any>]> = [["/cosmos.distribution.v1beta1.MsgSetWithdrawAddress", MsgSetWithdrawAddress], ["/cosmos.distribution.v1beta1.MsgWithdrawDelegatorReward", MsgWithdrawDelegatorReward], ["/cosmos.distribution.v1beta1.MsgWithdrawValidatorCommission", MsgWithdrawValidatorCommission], ["/cosmos.distribution.v1beta1.MsgFundCommunityPool", MsgFundCommunityPool]]; \ No newline at end of file diff --git a/__fixtures__/v-next/outputicjs/cosmos/evidence/v1beta1/tx.registry.ts b/__fixtures__/v-next/outputicjs/cosmos/evidence/v1beta1/tx.registry.ts new file mode 100644 index 0000000000..097edb529f --- /dev/null +++ b/__fixtures__/v-next/outputicjs/cosmos/evidence/v1beta1/tx.registry.ts @@ -0,0 +1,3 @@ +import { TelescopeGeneratedType } from "../../../types"; +import { MsgSubmitEvidence } from "./tx"; +export const registry: ReadonlyArray<[string, TelescopeGeneratedType<any, any, any>]> = [["/cosmos.evidence.v1beta1.MsgSubmitEvidence", MsgSubmitEvidence]]; \ No newline at end of file diff --git a/__fixtures__/v-next/outputicjs/cosmos/feegrant/v1beta1/tx.registry.ts b/__fixtures__/v-next/outputicjs/cosmos/feegrant/v1beta1/tx.registry.ts new file mode 100644 index 0000000000..eaec9540df --- /dev/null +++ b/__fixtures__/v-next/outputicjs/cosmos/feegrant/v1beta1/tx.registry.ts @@ -0,0 +1,3 @@ +import { TelescopeGeneratedType } from "../../../types"; +import { MsgGrantAllowance, MsgRevokeAllowance } from "./tx"; +export const registry: ReadonlyArray<[string, TelescopeGeneratedType<any, any, any>]> = [["/cosmos.feegrant.v1beta1.MsgGrantAllowance", MsgGrantAllowance], ["/cosmos.feegrant.v1beta1.MsgRevokeAllowance", MsgRevokeAllowance]]; \ No newline at end of file diff --git a/__fixtures__/v-next/outputicjs/cosmos/gov/v1/tx.registry.ts b/__fixtures__/v-next/outputicjs/cosmos/gov/v1/tx.registry.ts new file mode 100644 index 0000000000..4e884a86a4 --- /dev/null +++ b/__fixtures__/v-next/outputicjs/cosmos/gov/v1/tx.registry.ts @@ -0,0 +1,3 @@ +import { TelescopeGeneratedType } from "../../../types"; +import { MsgSubmitProposal, MsgExecLegacyContent, MsgVote, MsgVoteWeighted, MsgDeposit } from "./tx"; +export const registry: ReadonlyArray<[string, TelescopeGeneratedType<any, any, any>]> = [["/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]]; \ No newline at end of file diff --git a/__fixtures__/v-next/outputicjs/cosmos/gov/v1beta1/tx.registry.ts b/__fixtures__/v-next/outputicjs/cosmos/gov/v1beta1/tx.registry.ts new file mode 100644 index 0000000000..6de50b07c3 --- /dev/null +++ b/__fixtures__/v-next/outputicjs/cosmos/gov/v1beta1/tx.registry.ts @@ -0,0 +1,3 @@ +import { TelescopeGeneratedType } from "../../../types"; +import { MsgSubmitProposal, MsgVote, MsgVoteWeighted, MsgDeposit } from "./tx"; +export const registry: ReadonlyArray<[string, TelescopeGeneratedType<any, any, any>]> = [["/cosmos.gov.v1beta1.MsgSubmitProposal", MsgSubmitProposal], ["/cosmos.gov.v1beta1.MsgVote", MsgVote], ["/cosmos.gov.v1beta1.MsgVoteWeighted", MsgVoteWeighted], ["/cosmos.gov.v1beta1.MsgDeposit", MsgDeposit]]; \ No newline at end of file diff --git a/__fixtures__/v-next/outputicjs/cosmos/group/v1/tx.registry.ts b/__fixtures__/v-next/outputicjs/cosmos/group/v1/tx.registry.ts new file mode 100644 index 0000000000..5950643920 --- /dev/null +++ b/__fixtures__/v-next/outputicjs/cosmos/group/v1/tx.registry.ts @@ -0,0 +1,3 @@ +import { TelescopeGeneratedType } from "../../../types"; +import { MsgCreateGroup, MsgUpdateGroupMembers, MsgUpdateGroupAdmin, MsgUpdateGroupMetadata, MsgCreateGroupPolicy, MsgCreateGroupWithPolicy, MsgUpdateGroupPolicyAdmin, MsgUpdateGroupPolicyDecisionPolicy, MsgUpdateGroupPolicyMetadata, MsgSubmitProposal, MsgWithdrawProposal, MsgVote, MsgExec, MsgLeaveGroup } from "./tx"; +export const registry: ReadonlyArray<[string, TelescopeGeneratedType<any, any, any>]> = [["/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]]; \ No newline at end of file diff --git a/__fixtures__/v-next/outputicjs/cosmos/nft/v1beta1/tx.registry.ts b/__fixtures__/v-next/outputicjs/cosmos/nft/v1beta1/tx.registry.ts new file mode 100644 index 0000000000..a3423d8e42 --- /dev/null +++ b/__fixtures__/v-next/outputicjs/cosmos/nft/v1beta1/tx.registry.ts @@ -0,0 +1,3 @@ +import { TelescopeGeneratedType } from "../../../types"; +import { MsgSend } from "./tx"; +export const registry: ReadonlyArray<[string, TelescopeGeneratedType<any, any, any>]> = [["/cosmos.nft.v1beta1.MsgSend", MsgSend]]; \ No newline at end of file diff --git a/__fixtures__/v-next/outputicjs/cosmos/slashing/v1beta1/tx.registry.ts b/__fixtures__/v-next/outputicjs/cosmos/slashing/v1beta1/tx.registry.ts new file mode 100644 index 0000000000..f11bbdcb12 --- /dev/null +++ b/__fixtures__/v-next/outputicjs/cosmos/slashing/v1beta1/tx.registry.ts @@ -0,0 +1,3 @@ +import { TelescopeGeneratedType } from "../../../types"; +import { MsgUnjail } from "./tx"; +export const registry: ReadonlyArray<[string, TelescopeGeneratedType<any, any, any>]> = [["/cosmos.slashing.v1beta1.MsgUnjail", MsgUnjail]]; \ No newline at end of file diff --git a/__fixtures__/v-next/outputicjs/cosmos/staking/v1beta1/tx.registry.ts b/__fixtures__/v-next/outputicjs/cosmos/staking/v1beta1/tx.registry.ts new file mode 100644 index 0000000000..0c290f16c6 --- /dev/null +++ b/__fixtures__/v-next/outputicjs/cosmos/staking/v1beta1/tx.registry.ts @@ -0,0 +1,3 @@ +import { TelescopeGeneratedType } from "../../../types"; +import { MsgCreateValidator, MsgEditValidator, MsgDelegate, MsgBeginRedelegate, MsgUndelegate } from "./tx"; +export const registry: ReadonlyArray<[string, TelescopeGeneratedType<any, any, any>]> = [["/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]]; \ No newline at end of file diff --git a/__fixtures__/v-next/outputicjs/cosmos/upgrade/v1beta1/tx.registry.ts b/__fixtures__/v-next/outputicjs/cosmos/upgrade/v1beta1/tx.registry.ts new file mode 100644 index 0000000000..900e4044dc --- /dev/null +++ b/__fixtures__/v-next/outputicjs/cosmos/upgrade/v1beta1/tx.registry.ts @@ -0,0 +1,3 @@ +import { TelescopeGeneratedType } from "../../../types"; +import { MsgSoftwareUpgrade, MsgCancelUpgrade } from "./tx"; +export const registry: ReadonlyArray<[string, TelescopeGeneratedType<any, any, any>]> = [["/cosmos.upgrade.v1beta1.MsgSoftwareUpgrade", MsgSoftwareUpgrade], ["/cosmos.upgrade.v1beta1.MsgCancelUpgrade", MsgCancelUpgrade]]; \ No newline at end of file diff --git a/__fixtures__/v-next/outputicjs/cosmos/vesting/v1beta1/tx.registry.ts b/__fixtures__/v-next/outputicjs/cosmos/vesting/v1beta1/tx.registry.ts new file mode 100644 index 0000000000..c5259cf292 --- /dev/null +++ b/__fixtures__/v-next/outputicjs/cosmos/vesting/v1beta1/tx.registry.ts @@ -0,0 +1,3 @@ +import { TelescopeGeneratedType } from "../../../types"; +import { MsgCreateVestingAccount, MsgCreatePermanentLockedAccount, MsgCreatePeriodicVestingAccount } from "./tx"; +export const registry: ReadonlyArray<[string, TelescopeGeneratedType<any, any, any>]> = [["/cosmos.vesting.v1beta1.MsgCreateVestingAccount", MsgCreateVestingAccount], ["/cosmos.vesting.v1beta1.MsgCreatePermanentLockedAccount", MsgCreatePermanentLockedAccount], ["/cosmos.vesting.v1beta1.MsgCreatePeriodicVestingAccount", MsgCreatePeriodicVestingAccount]]; \ No newline at end of file diff --git a/__fixtures__/v-next/outputicjs/cosmwasm/client.ts b/__fixtures__/v-next/outputicjs/cosmwasm/client.ts new file mode 100644 index 0000000000..b5c061a813 --- /dev/null +++ b/__fixtures__/v-next/outputicjs/cosmwasm/client.ts @@ -0,0 +1,44 @@ +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/cosmwasm/wasm/v1/tx.registry.ts b/__fixtures__/v-next/outputicjs/cosmwasm/wasm/v1/tx.registry.ts new file mode 100644 index 0000000000..d09ab04886 --- /dev/null +++ b/__fixtures__/v-next/outputicjs/cosmwasm/wasm/v1/tx.registry.ts @@ -0,0 +1,3 @@ +import { TelescopeGeneratedType } from "../../../types"; +import { MsgStoreCode, MsgInstantiateContract, MsgExecuteContract, MsgMigrateContract, MsgUpdateAdmin, MsgClearAdmin } from "./tx"; +export const registry: ReadonlyArray<[string, TelescopeGeneratedType<any, any, any>]> = [["/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]]; \ No newline at end of file diff --git a/__fixtures__/v-next/outputicjs/evmos/client.ts b/__fixtures__/v-next/outputicjs/evmos/client.ts new file mode 100644 index 0000000000..7ad652c77f --- /dev/null +++ b/__fixtures__/v-next/outputicjs/evmos/client.ts @@ -0,0 +1,46 @@ +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/evmos/erc20/v1/tx.registry.ts b/__fixtures__/v-next/outputicjs/evmos/erc20/v1/tx.registry.ts new file mode 100644 index 0000000000..609f6b952f --- /dev/null +++ b/__fixtures__/v-next/outputicjs/evmos/erc20/v1/tx.registry.ts @@ -0,0 +1,3 @@ +import { TelescopeGeneratedType } from "../../../types"; +import { MsgConvertCoin, MsgConvertERC20 } from "./tx"; +export const registry: ReadonlyArray<[string, TelescopeGeneratedType<any, any, any>]> = [["/evmos.erc20.v1.MsgConvertCoin", MsgConvertCoin], ["/evmos.erc20.v1.MsgConvertERC20", MsgConvertERC20]]; \ No newline at end of file diff --git a/__fixtures__/v-next/outputicjs/evmos/fees/v1/tx.registry.ts b/__fixtures__/v-next/outputicjs/evmos/fees/v1/tx.registry.ts new file mode 100644 index 0000000000..3876311424 --- /dev/null +++ b/__fixtures__/v-next/outputicjs/evmos/fees/v1/tx.registry.ts @@ -0,0 +1,3 @@ +import { TelescopeGeneratedType } from "../../../types"; +import { MsgRegisterDevFeeInfo, MsgCancelDevFeeInfo, MsgUpdateDevFeeInfo } from "./tx"; +export const registry: ReadonlyArray<[string, TelescopeGeneratedType<any, any, any>]> = [["/evmos.fees.v1.MsgRegisterDevFeeInfo", MsgRegisterDevFeeInfo], ["/evmos.fees.v1.MsgCancelDevFeeInfo", MsgCancelDevFeeInfo], ["/evmos.fees.v1.MsgUpdateDevFeeInfo", MsgUpdateDevFeeInfo]]; \ No newline at end of file diff --git a/__fixtures__/v-next/outputicjs/evmos/vesting/v1/tx.registry.ts b/__fixtures__/v-next/outputicjs/evmos/vesting/v1/tx.registry.ts new file mode 100644 index 0000000000..2445230ca6 --- /dev/null +++ b/__fixtures__/v-next/outputicjs/evmos/vesting/v1/tx.registry.ts @@ -0,0 +1,3 @@ +import { TelescopeGeneratedType } from "../../../types"; +import { MsgCreateClawbackVestingAccount, MsgClawback } from "./tx"; +export const registry: ReadonlyArray<[string, TelescopeGeneratedType<any, any, any>]> = [["/evmos.vesting.v1.MsgCreateClawbackVestingAccount", MsgCreateClawbackVestingAccount], ["/evmos.vesting.v1.MsgClawback", MsgClawback]]; \ No newline at end of file diff --git a/__fixtures__/v-next/outputicjs/ibc/applications/transfer/v1/tx.registry.ts b/__fixtures__/v-next/outputicjs/ibc/applications/transfer/v1/tx.registry.ts new file mode 100644 index 0000000000..49deeddd10 --- /dev/null +++ b/__fixtures__/v-next/outputicjs/ibc/applications/transfer/v1/tx.registry.ts @@ -0,0 +1,3 @@ +import { TelescopeGeneratedType } from "../../../../types"; +import { MsgTransfer } from "./tx"; +export const registry: ReadonlyArray<[string, TelescopeGeneratedType<any, any, any>]> = [["/ibc.applications.transfer.v1.MsgTransfer", MsgTransfer]]; \ No newline at end of file diff --git a/__fixtures__/v-next/outputicjs/ibc/client.ts b/__fixtures__/v-next/outputicjs/ibc/client.ts new file mode 100644 index 0000000000..fe59d969f4 --- /dev/null +++ b/__fixtures__/v-next/outputicjs/ibc/client.ts @@ -0,0 +1,47 @@ +import { GeneratedType, Registry, OfflineSigner } from "@cosmjs/proto-signing"; +import { defaultRegistryTypes, AminoTypes, SigningStargateClient } from "@cosmjs/stargate"; +import { HttpEndpoint } from "@cosmjs/tendermint-rpc"; +import * as 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/ibc/core/channel/v1/tx.registry.ts b/__fixtures__/v-next/outputicjs/ibc/core/channel/v1/tx.registry.ts new file mode 100644 index 0000000000..746e5f227f --- /dev/null +++ b/__fixtures__/v-next/outputicjs/ibc/core/channel/v1/tx.registry.ts @@ -0,0 +1,3 @@ +import { TelescopeGeneratedType } from "../../../../types"; +import { MsgChannelOpenInit, MsgChannelOpenTry, MsgChannelOpenAck, MsgChannelOpenConfirm, MsgChannelCloseInit, MsgChannelCloseConfirm, MsgRecvPacket, MsgTimeout, MsgTimeoutOnClose, MsgAcknowledgement } from "./tx"; +export const registry: ReadonlyArray<[string, TelescopeGeneratedType<any, any, any>]> = [["/ibc.core.channel.v1.MsgChannelOpenInit", MsgChannelOpenInit], ["/ibc.core.channel.v1.MsgChannelOpenTry", MsgChannelOpenTry], ["/ibc.core.channel.v1.MsgChannelOpenAck", MsgChannelOpenAck], ["/ibc.core.channel.v1.MsgChannelOpenConfirm", MsgChannelOpenConfirm], ["/ibc.core.channel.v1.MsgChannelCloseInit", MsgChannelCloseInit], ["/ibc.core.channel.v1.MsgChannelCloseConfirm", MsgChannelCloseConfirm], ["/ibc.core.channel.v1.MsgRecvPacket", MsgRecvPacket], ["/ibc.core.channel.v1.MsgTimeout", MsgTimeout], ["/ibc.core.channel.v1.MsgTimeoutOnClose", MsgTimeoutOnClose], ["/ibc.core.channel.v1.MsgAcknowledgement", MsgAcknowledgement]]; \ No newline at end of file diff --git a/__fixtures__/v-next/outputicjs/ibc/core/client/v1/tx.registry.ts b/__fixtures__/v-next/outputicjs/ibc/core/client/v1/tx.registry.ts new file mode 100644 index 0000000000..2dcbaa1f8f --- /dev/null +++ b/__fixtures__/v-next/outputicjs/ibc/core/client/v1/tx.registry.ts @@ -0,0 +1,3 @@ +import { TelescopeGeneratedType } from "../../../../types"; +import { MsgCreateClient, MsgUpdateClient, MsgUpgradeClient, MsgSubmitMisbehaviour } from "./tx"; +export const registry: ReadonlyArray<[string, TelescopeGeneratedType<any, any, any>]> = [["/ibc.core.client.v1.MsgCreateClient", MsgCreateClient], ["/ibc.core.client.v1.MsgUpdateClient", MsgUpdateClient], ["/ibc.core.client.v1.MsgUpgradeClient", MsgUpgradeClient], ["/ibc.core.client.v1.MsgSubmitMisbehaviour", MsgSubmitMisbehaviour]]; \ No newline at end of file diff --git a/__fixtures__/v-next/outputicjs/ibc/core/connection/v1/tx.registry.ts b/__fixtures__/v-next/outputicjs/ibc/core/connection/v1/tx.registry.ts new file mode 100644 index 0000000000..39aeca7696 --- /dev/null +++ b/__fixtures__/v-next/outputicjs/ibc/core/connection/v1/tx.registry.ts @@ -0,0 +1,3 @@ +import { TelescopeGeneratedType } from "../../../../types"; +import { MsgConnectionOpenInit, MsgConnectionOpenTry, MsgConnectionOpenAck, MsgConnectionOpenConfirm } from "./tx"; +export const registry: ReadonlyArray<[string, TelescopeGeneratedType<any, any, any>]> = [["/ibc.core.connection.v1.MsgConnectionOpenInit", MsgConnectionOpenInit], ["/ibc.core.connection.v1.MsgConnectionOpenTry", MsgConnectionOpenTry], ["/ibc.core.connection.v1.MsgConnectionOpenAck", MsgConnectionOpenAck], ["/ibc.core.connection.v1.MsgConnectionOpenConfirm", MsgConnectionOpenConfirm]]; \ No newline at end of file diff --git a/__fixtures__/v-next/outputicjs/osmosis/client.ts b/__fixtures__/v-next/outputicjs/osmosis/client.ts new file mode 100644 index 0000000000..87a5302af2 --- /dev/null +++ b/__fixtures__/v-next/outputicjs/osmosis/client.ts @@ -0,0 +1,50 @@ +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/outputicjs/osmosis/gamm/pool-models/balancer/tx/tx.registry.ts b/__fixtures__/v-next/outputicjs/osmosis/gamm/pool-models/balancer/tx/tx.registry.ts new file mode 100644 index 0000000000..16921f5e7b --- /dev/null +++ b/__fixtures__/v-next/outputicjs/osmosis/gamm/pool-models/balancer/tx/tx.registry.ts @@ -0,0 +1,3 @@ +import { TelescopeGeneratedType } from "../../../../../types"; +import { MsgCreateBalancerPool } from "./tx"; +export const registry: ReadonlyArray<[string, TelescopeGeneratedType<any, any, any>]> = [["/osmosis.gamm.poolmodels.balancer.v1beta1.MsgCreateBalancerPool", MsgCreateBalancerPool]]; \ No newline at end of file diff --git a/__fixtures__/v-next/outputicjs/osmosis/gamm/pool-models/stableswap/tx.registry.ts b/__fixtures__/v-next/outputicjs/osmosis/gamm/pool-models/stableswap/tx.registry.ts new file mode 100644 index 0000000000..d53988e756 --- /dev/null +++ b/__fixtures__/v-next/outputicjs/osmosis/gamm/pool-models/stableswap/tx.registry.ts @@ -0,0 +1,3 @@ +import { TelescopeGeneratedType } from "../../../../types"; +import { MsgCreateStableswapPool, MsgStableSwapAdjustScalingFactors } from "./tx"; +export const registry: ReadonlyArray<[string, TelescopeGeneratedType<any, any, any>]> = [["/osmosis.gamm.poolmodels.stableswap.v1beta1.MsgCreateStableswapPool", MsgCreateStableswapPool], ["/osmosis.gamm.poolmodels.stableswap.v1beta1.MsgStableSwapAdjustScalingFactors", MsgStableSwapAdjustScalingFactors]]; \ No newline at end of file diff --git a/__fixtures__/v-next/outputicjs/osmosis/gamm/v1beta1/tx.registry.ts b/__fixtures__/v-next/outputicjs/osmosis/gamm/v1beta1/tx.registry.ts new file mode 100644 index 0000000000..be8841fdc0 --- /dev/null +++ b/__fixtures__/v-next/outputicjs/osmosis/gamm/v1beta1/tx.registry.ts @@ -0,0 +1,3 @@ +import { TelescopeGeneratedType } from "../../../types"; +import { MsgJoinPool, MsgExitPool, MsgSwapExactAmountIn, MsgSwapExactAmountOut, MsgJoinSwapExternAmountIn, MsgJoinSwapShareAmountOut, MsgExitSwapExternAmountOut, MsgExitSwapShareAmountIn } from "./tx"; +export const registry: ReadonlyArray<[string, TelescopeGeneratedType<any, any, any>]> = [["/osmosis.gamm.v1beta1.MsgJoinPool", MsgJoinPool], ["/osmosis.gamm.v1beta1.MsgExitPool", MsgExitPool], ["/osmosis.gamm.v1beta1.MsgSwapExactAmountIn", MsgSwapExactAmountIn], ["/osmosis.gamm.v1beta1.MsgSwapExactAmountOut", MsgSwapExactAmountOut], ["/osmosis.gamm.v1beta1.MsgJoinSwapExternAmountIn", MsgJoinSwapExternAmountIn], ["/osmosis.gamm.v1beta1.MsgJoinSwapShareAmountOut", MsgJoinSwapShareAmountOut], ["/osmosis.gamm.v1beta1.MsgExitSwapExternAmountOut", MsgExitSwapExternAmountOut], ["/osmosis.gamm.v1beta1.MsgExitSwapShareAmountIn", MsgExitSwapShareAmountIn]]; \ No newline at end of file diff --git a/__fixtures__/v-next/outputicjs/osmosis/incentives/tx.registry.ts b/__fixtures__/v-next/outputicjs/osmosis/incentives/tx.registry.ts new file mode 100644 index 0000000000..77d43751cc --- /dev/null +++ b/__fixtures__/v-next/outputicjs/osmosis/incentives/tx.registry.ts @@ -0,0 +1,3 @@ +import { TelescopeGeneratedType } from "../../types"; +import { MsgCreateGauge, MsgAddToGauge } from "./tx"; +export const registry: ReadonlyArray<[string, TelescopeGeneratedType<any, any, any>]> = [["/osmosis.incentives.MsgCreateGauge", MsgCreateGauge], ["/osmosis.incentives.MsgAddToGauge", MsgAddToGauge]]; \ No newline at end of file diff --git a/__fixtures__/v-next/outputicjs/osmosis/lockup/tx.registry.ts b/__fixtures__/v-next/outputicjs/osmosis/lockup/tx.registry.ts new file mode 100644 index 0000000000..a84dfee61a --- /dev/null +++ b/__fixtures__/v-next/outputicjs/osmosis/lockup/tx.registry.ts @@ -0,0 +1,3 @@ +import { TelescopeGeneratedType } from "../../types"; +import { MsgLockTokens, MsgBeginUnlockingAll, MsgBeginUnlocking, MsgExtendLockup, MsgForceUnlock } from "./tx"; +export const registry: ReadonlyArray<[string, TelescopeGeneratedType<any, any, any>]> = [["/osmosis.lockup.MsgLockTokens", MsgLockTokens], ["/osmosis.lockup.MsgBeginUnlockingAll", MsgBeginUnlockingAll], ["/osmosis.lockup.MsgBeginUnlocking", MsgBeginUnlocking], ["/osmosis.lockup.MsgExtendLockup", MsgExtendLockup], ["/osmosis.lockup.MsgForceUnlock", MsgForceUnlock]]; \ No newline at end of file diff --git a/__fixtures__/v-next/outputicjs/osmosis/superfluid/tx.registry.ts b/__fixtures__/v-next/outputicjs/osmosis/superfluid/tx.registry.ts new file mode 100644 index 0000000000..8959381fb2 --- /dev/null +++ b/__fixtures__/v-next/outputicjs/osmosis/superfluid/tx.registry.ts @@ -0,0 +1,3 @@ +import { TelescopeGeneratedType } from "../../types"; +import { MsgSuperfluidDelegate, MsgSuperfluidUndelegate, MsgSuperfluidUnbondLock, MsgLockAndSuperfluidDelegate, MsgUnPoolWhitelistedPool } from "./tx"; +export const registry: ReadonlyArray<[string, TelescopeGeneratedType<any, any, any>]> = [["/osmosis.superfluid.MsgSuperfluidDelegate", MsgSuperfluidDelegate], ["/osmosis.superfluid.MsgSuperfluidUndelegate", MsgSuperfluidUndelegate], ["/osmosis.superfluid.MsgSuperfluidUnbondLock", MsgSuperfluidUnbondLock], ["/osmosis.superfluid.MsgLockAndSuperfluidDelegate", MsgLockAndSuperfluidDelegate], ["/osmosis.superfluid.MsgUnPoolWhitelistedPool", MsgUnPoolWhitelistedPool]]; \ No newline at end of file diff --git a/__fixtures__/v-next/outputicjs/osmosis/tokenfactory/v1beta1/tx.registry.ts b/__fixtures__/v-next/outputicjs/osmosis/tokenfactory/v1beta1/tx.registry.ts new file mode 100644 index 0000000000..8ec6a3843b --- /dev/null +++ b/__fixtures__/v-next/outputicjs/osmosis/tokenfactory/v1beta1/tx.registry.ts @@ -0,0 +1,3 @@ +import { TelescopeGeneratedType } from "../../../types"; +import { MsgCreateDenom, MsgMint, MsgBurn, MsgChangeAdmin, MsgSetDenomMetadata } from "./tx"; +export const registry: ReadonlyArray<[string, TelescopeGeneratedType<any, any, any>]> = [["/osmosis.tokenfactory.v1beta1.MsgCreateDenom", MsgCreateDenom], ["/osmosis.tokenfactory.v1beta1.MsgMint", MsgMint], ["/osmosis.tokenfactory.v1beta1.MsgBurn", MsgBurn], ["/osmosis.tokenfactory.v1beta1.MsgChangeAdmin", MsgChangeAdmin], ["/osmosis.tokenfactory.v1beta1.MsgSetDenomMetadata", MsgSetDenomMetadata]]; \ 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 e5eece9d00..845b92822e 100644 --- a/__fixtures__/v-next/outputv4/akash/bundle.ts +++ b/__fixtures__/v-next/outputv4/akash/bundle.ts @@ -1,113 +1,112 @@ -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"; +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"; export namespace akash { export namespace audit { export const v1beta1 = { ..._0, - ..._316, - ..._323, - ..._345 + ..._366, + ..._373, + ..._395 }; export const v1beta2 = { ..._1, ..._2, ..._3, - ..._317, - ..._324, - ..._330, - ..._338, - ..._346 + ..._367, + ..._374, + ..._380, + ..._388, + ..._396 }; } export namespace base { @@ -130,12 +129,11 @@ export namespace akash { ..._13, ..._14, ..._15, - ..._318, - ..._325, - ..._331, - ..._339, - ..._347, - ..._352 + ..._368, + ..._375, + ..._381, + ..._389, + ..._397 }; } export namespace deployment { @@ -146,7 +144,7 @@ export namespace akash { ..._19, ..._20, ..._21, - ..._332 + ..._382 }; export const v1beta2 = { ..._22, @@ -161,11 +159,11 @@ export namespace akash { ..._31, ..._32, ..._33, - ..._319, - ..._326, - ..._333, - ..._340, - ..._348 + ..._369, + ..._376, + ..._383, + ..._390, + ..._398 }; } export namespace escrow { @@ -173,15 +171,15 @@ export namespace akash { ..._34, ..._35, ..._36, - ..._334, - ..._341 + ..._384, + ..._391 }; export const v1beta2 = { ..._37, ..._38, ..._39, - ..._335, - ..._342 + ..._385, + ..._392 }; } export namespace inflation { @@ -199,34 +197,34 @@ export namespace akash { ..._46, ..._47, ..._48, - ..._320, - ..._327, - ..._336, - ..._343, - ..._349 + ..._370, + ..._377, + ..._386, + ..._393, + ..._399 }; } export namespace provider { export const v1beta1 = { ..._49, - ..._321, - ..._328, - ..._350 + ..._371, + ..._378, + ..._400 }; export const v1beta2 = { ..._50, ..._51, ..._52, - ..._322, - ..._329, - ..._337, - ..._344, - ..._351 + ..._372, + ..._379, + ..._387, + ..._394, + ..._401 }; } export const ClientFactory = { - ..._536, - ..._537, - ..._538 + ..._620, + ..._621, + ..._622 }; } \ 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 00e538ff1b..66a438a113 100644 --- a/__fixtures__/v-next/outputv4/akash/lcd.ts +++ b/__fixtures__/v-next/outputv4/akash/lcd.ts @@ -75,6 +75,11 @@ 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 a55e40d7f3..6fc8c9cfec 100644 --- a/__fixtures__/v-next/outputv4/akash/rpc.query.ts +++ b/__fixtures__/v-next/outputv4/akash/rpc.query.ts @@ -1,93 +1,96 @@ -import { Rpc } from "../helpers.js"; -import { connectComet, HttpEndpoint } from "@cosmjs/tendermint-rpc"; +import { Rpc } from "../helpers"; +import { Tendermint34Client, HttpEndpoint } from "@cosmjs/tendermint-rpc"; import { QueryClient } from "@cosmjs/stargate"; export const createRPCQueryClient = async ({ rpcEndpoint }: { rpcEndpoint: string | HttpEndpoint; }) => { - const tmClient = await connectComet(rpcEndpoint); + const tmClient = await Tendermint34Client.connect(rpcEndpoint); const client = new QueryClient(tmClient); return { akash: { audit: { - v1beta2: (await import("./audit/v1beta2/query.rpc.Query.js")).createRpcQueryExtension(client) + v1beta2: (await import("./audit/v1beta2/query.rpc.Query")).createRpcQueryExtension(client) }, cert: { - v1beta2: (await import("./cert/v1beta2/query.rpc.Query.js")).createRpcQueryExtension(client) + v1beta2: (await import("./cert/v1beta2/query.rpc.Query")).createRpcQueryExtension(client) }, deployment: { - v1beta2: (await import("./deployment/v1beta2/query.rpc.Query.js")).createRpcQueryExtension(client) + v1beta2: (await import("./deployment/v1beta2/query.rpc.Query")).createRpcQueryExtension(client) }, escrow: { - v1beta1: (await import("./escrow/v1beta1/query.rpc.Query.js")).createRpcQueryExtension(client), - v1beta2: (await import("./escrow/v1beta2/query.rpc.Query.js")).createRpcQueryExtension(client) + v1beta1: (await import("./escrow/v1beta1/query.rpc.Query")).createRpcQueryExtension(client), + v1beta2: (await import("./escrow/v1beta2/query.rpc.Query")).createRpcQueryExtension(client) }, market: { - v1beta2: (await import("./market/v1beta2/query.rpc.Query.js")).createRpcQueryExtension(client) + v1beta2: (await import("./market/v1beta2/query.rpc.Query")).createRpcQueryExtension(client) }, provider: { - v1beta2: (await import("./provider/v1beta2/query.rpc.Query.js")).createRpcQueryExtension(client) + v1beta2: (await import("./provider/v1beta2/query.rpc.Query")).createRpcQueryExtension(client) } }, cosmos: { app: { - v1alpha1: (await import("../cosmos/app/v1alpha1/query.rpc.Query.js")).createRpcQueryExtension(client) + v1alpha1: (await import("../cosmos/app/v1alpha1/query.rpc.Query")).createRpcQueryExtension(client) }, auth: { - v1beta1: (await import("../cosmos/auth/v1beta1/query.rpc.Query.js")).createRpcQueryExtension(client) + v1beta1: (await import("../cosmos/auth/v1beta1/query.rpc.Query")).createRpcQueryExtension(client) }, authz: { - v1beta1: (await import("../cosmos/authz/v1beta1/query.rpc.Query.js")).createRpcQueryExtension(client) + v1beta1: (await import("../cosmos/authz/v1beta1/query.rpc.Query")).createRpcQueryExtension(client) }, bank: { - v1beta1: (await import("../cosmos/bank/v1beta1/query.rpc.Query.js")).createRpcQueryExtension(client) + v1beta1: (await import("../cosmos/bank/v1beta1/query.rpc.Query")).createRpcQueryExtension(client) }, base: { reflection: { - 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) + v1beta1: (await import("../cosmos/base/reflection/v1beta1/reflection.rpc.ReflectionService")).createRpcQueryExtension(client), + v2alpha1: (await import("../cosmos/base/reflection/v2alpha1/reflection.rpc.ReflectionService")).createRpcQueryExtension(client) }, tendermint: { - v1beta1: (await import("../cosmos/base/tendermint/v1beta1/query.rpc.Service.js")).createRpcQueryExtension(client) + 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) } }, distribution: { - v1beta1: (await import("../cosmos/distribution/v1beta1/query.rpc.Query.js")).createRpcQueryExtension(client) + v1beta1: (await import("../cosmos/distribution/v1beta1/query.rpc.Query")).createRpcQueryExtension(client) }, evidence: { - v1beta1: (await import("../cosmos/evidence/v1beta1/query.rpc.Query.js")).createRpcQueryExtension(client) + v1beta1: (await import("../cosmos/evidence/v1beta1/query.rpc.Query")).createRpcQueryExtension(client) }, feegrant: { - v1beta1: (await import("../cosmos/feegrant/v1beta1/query.rpc.Query.js")).createRpcQueryExtension(client) + v1beta1: (await import("../cosmos/feegrant/v1beta1/query.rpc.Query")).createRpcQueryExtension(client) }, gov: { - v1: (await import("../cosmos/gov/v1/query.rpc.Query.js")).createRpcQueryExtension(client), - v1beta1: (await import("../cosmos/gov/v1beta1/query.rpc.Query.js")).createRpcQueryExtension(client) + v1: (await import("../cosmos/gov/v1/query.rpc.Query")).createRpcQueryExtension(client), + v1beta1: (await import("../cosmos/gov/v1beta1/query.rpc.Query")).createRpcQueryExtension(client) }, group: { - v1: (await import("../cosmos/group/v1/query.rpc.Query.js")).createRpcQueryExtension(client) + v1: (await import("../cosmos/group/v1/query.rpc.Query")).createRpcQueryExtension(client) }, mint: { - v1beta1: (await import("../cosmos/mint/v1beta1/query.rpc.Query.js")).createRpcQueryExtension(client) + v1beta1: (await import("../cosmos/mint/v1beta1/query.rpc.Query")).createRpcQueryExtension(client) }, nft: { - v1beta1: (await import("../cosmos/nft/v1beta1/query.rpc.Query.js")).createRpcQueryExtension(client) + v1beta1: (await import("../cosmos/nft/v1beta1/query.rpc.Query")).createRpcQueryExtension(client) }, params: { - v1beta1: (await import("../cosmos/params/v1beta1/query.rpc.Query.js")).createRpcQueryExtension(client) + v1beta1: (await import("../cosmos/params/v1beta1/query.rpc.Query")).createRpcQueryExtension(client) }, slashing: { - v1beta1: (await import("../cosmos/slashing/v1beta1/query.rpc.Query.js")).createRpcQueryExtension(client) + v1beta1: (await import("../cosmos/slashing/v1beta1/query.rpc.Query")).createRpcQueryExtension(client) }, staking: { - v1beta1: (await import("../cosmos/staking/v1beta1/query.rpc.Query.js")).createRpcQueryExtension(client) + v1beta1: (await import("../cosmos/staking/v1beta1/query.rpc.Query")).createRpcQueryExtension(client) }, tx: { - v1beta1: (await import("../cosmos/tx/v1beta1/service.rpc.Service.js")).createRpcQueryExtension(client) + v1beta1: (await import("../cosmos/tx/v1beta1/service.rpc.Service")).createRpcQueryExtension(client) }, upgrade: { - v1beta1: (await import("../cosmos/upgrade/v1beta1/query.rpc.Query.js")).createRpcQueryExtension(client) + v1beta1: (await import("../cosmos/upgrade/v1beta1/query.rpc.Query")).createRpcQueryExtension(client) } } }; diff --git a/__fixtures__/v-next/outputv4/akash/rpc.tx.ts b/__fixtures__/v-next/outputv4/akash/rpc.tx.ts index 2295931723..3e11aa81ec 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.js"; +import { Rpc } from "../helpers"; export const createRPCMsgClient = async ({ rpc }: { @@ -6,63 +6,63 @@ export const createRPCMsgClient = async ({ }) => ({ akash: { audit: { - v1beta1: new (await import("./audit/v1beta1/audit.rpc.msg.js")).MsgClientImpl(rpc), - v1beta2: new (await import("./audit/v1beta2/audit.rpc.msg.js")).MsgClientImpl(rpc) + v1beta1: new (await import("./audit/v1beta1/audit.rpc.msg")).MsgClientImpl(rpc), + v1beta2: new (await import("./audit/v1beta2/audit.rpc.msg")).MsgClientImpl(rpc) }, cert: { - v1beta2: new (await import("./cert/v1beta2/cert.rpc.msg.js")).MsgClientImpl(rpc) + v1beta2: new (await import("./cert/v1beta2/cert.rpc.msg")).MsgClientImpl(rpc) }, deployment: { - v1beta2: new (await import("./deployment/v1beta2/service.rpc.msg.js")).MsgClientImpl(rpc) + v1beta2: new (await import("./deployment/v1beta2/service.rpc.msg")).MsgClientImpl(rpc) }, market: { - v1beta2: new (await import("./market/v1beta2/service.rpc.msg.js")).MsgClientImpl(rpc) + v1beta2: new (await import("./market/v1beta2/service.rpc.msg")).MsgClientImpl(rpc) }, provider: { - v1beta1: new (await import("./provider/v1beta1/provider.rpc.msg.js")).MsgClientImpl(rpc), - v1beta2: new (await import("./provider/v1beta2/provider.rpc.msg.js")).MsgClientImpl(rpc) + v1beta1: new (await import("./provider/v1beta1/provider.rpc.msg")).MsgClientImpl(rpc), + v1beta2: new (await import("./provider/v1beta2/provider.rpc.msg")).MsgClientImpl(rpc) } }, cosmos: { authz: { - v1beta1: new (await import("../cosmos/authz/v1beta1/tx.rpc.msg.js")).MsgClientImpl(rpc) + v1beta1: new (await import("../cosmos/authz/v1beta1/tx.rpc.msg")).MsgClientImpl(rpc) }, bank: { - v1beta1: new (await import("../cosmos/bank/v1beta1/tx.rpc.msg.js")).MsgClientImpl(rpc) + v1beta1: new (await import("../cosmos/bank/v1beta1/tx.rpc.msg")).MsgClientImpl(rpc) }, crisis: { - v1beta1: new (await import("../cosmos/crisis/v1beta1/tx.rpc.msg.js")).MsgClientImpl(rpc) + v1beta1: new (await import("../cosmos/crisis/v1beta1/tx.rpc.msg")).MsgClientImpl(rpc) }, distribution: { - v1beta1: new (await import("../cosmos/distribution/v1beta1/tx.rpc.msg.js")).MsgClientImpl(rpc) + v1beta1: new (await import("../cosmos/distribution/v1beta1/tx.rpc.msg")).MsgClientImpl(rpc) }, evidence: { - v1beta1: new (await import("../cosmos/evidence/v1beta1/tx.rpc.msg.js")).MsgClientImpl(rpc) + v1beta1: new (await import("../cosmos/evidence/v1beta1/tx.rpc.msg")).MsgClientImpl(rpc) }, feegrant: { - v1beta1: new (await import("../cosmos/feegrant/v1beta1/tx.rpc.msg.js")).MsgClientImpl(rpc) + v1beta1: new (await import("../cosmos/feegrant/v1beta1/tx.rpc.msg")).MsgClientImpl(rpc) }, gov: { - 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) + v1: new (await import("../cosmos/gov/v1/tx.rpc.msg")).MsgClientImpl(rpc), + v1beta1: new (await import("../cosmos/gov/v1beta1/tx.rpc.msg")).MsgClientImpl(rpc) }, group: { - v1: new (await import("../cosmos/group/v1/tx.rpc.msg.js")).MsgClientImpl(rpc) + v1: new (await import("../cosmos/group/v1/tx.rpc.msg")).MsgClientImpl(rpc) }, nft: { - v1beta1: new (await import("../cosmos/nft/v1beta1/tx.rpc.msg.js")).MsgClientImpl(rpc) + v1beta1: new (await import("../cosmos/nft/v1beta1/tx.rpc.msg")).MsgClientImpl(rpc) }, slashing: { - v1beta1: new (await import("../cosmos/slashing/v1beta1/tx.rpc.msg.js")).MsgClientImpl(rpc) + v1beta1: new (await import("../cosmos/slashing/v1beta1/tx.rpc.msg")).MsgClientImpl(rpc) }, staking: { - v1beta1: new (await import("../cosmos/staking/v1beta1/tx.rpc.msg.js")).MsgClientImpl(rpc) + v1beta1: new (await import("../cosmos/staking/v1beta1/tx.rpc.msg")).MsgClientImpl(rpc) }, upgrade: { - v1beta1: new (await import("../cosmos/upgrade/v1beta1/tx.rpc.msg.js")).MsgClientImpl(rpc) + v1beta1: new (await import("../cosmos/upgrade/v1beta1/tx.rpc.msg")).MsgClientImpl(rpc) }, vesting: { - v1beta1: new (await import("../cosmos/vesting/v1beta1/tx.rpc.msg.js")).MsgClientImpl(rpc) + v1beta1: new (await import("../cosmos/vesting/v1beta1/tx.rpc.msg")).MsgClientImpl(rpc) } } }); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv4/binary.ts b/__fixtures__/v-next/outputv4/binary.ts index fbcdd5dade..85549bde0e 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.js"; +import { utf8Length, utf8Read, utf8Write } from "./utf8"; import { int64ToString, readInt32, @@ -55,7 +55,7 @@ import { writeByte, zzDecode, zzEncode, -} from "./varint.js"; +} from "./varint"; export enum WireType { Varint = 0, 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 ac71cea766..71de75b770 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.js"; -import { Rpc } from "../../../helpers.js"; -import { BinaryReader } from "../../../binary.js"; +import { Config, ConfigSDKType } from "./config"; +import { Rpc } from "../../../helpers"; +import { BinaryReader } from "../../../binary"; import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; -import { QueryConfigRequest, QueryConfigRequestSDKType, QueryConfigResponse, QueryConfigResponseSDKType } from "./query.js"; +import { QueryConfigRequest, QueryConfigRequestSDKType, QueryConfigResponse, QueryConfigResponseSDKType, ReactiveQueryConfigRequest } from "./query"; /** 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 743d501447..129b885eee 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.js"; -import { Any, AnySDKType } from "../../../google/protobuf/any.js"; -import { Params, ParamsSDKType } from "./auth.js"; -import { setPaginationParams } from "../../../helpers.js"; +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 { 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.js"; +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"; export class LCDQueryClient { req: LCDClient; constructor({ @@ -24,7 +24,7 @@ export class LCDQueryClient { Since: cosmos-sdk 0.43 */ async accounts(params: QueryAccountsRequest = { - pagination: PageRequest.fromPartial({}) + pagination: undefined }): Promise<QueryAccountsResponseSDKType> { 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 828662a3b0..45f5e6ccbe 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,12 +1,10 @@ -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"; +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"; /** Query defines the gRPC querier service. */ export interface Query { /** @@ -41,7 +39,7 @@ export class QueryClientImpl implements Query { this.addressStringToBytes = this.addressStringToBytes.bind(this); } accounts(request: QueryAccountsRequest = { - pagination: PageRequest.fromPartial({}) + pagination: undefined }): Promise<QueryAccountsResponse> { const data = QueryAccountsRequest.encode(request).finish(); const promise = this.rpc.request("cosmos.auth.v1beta1.Query", "Accounts", data); @@ -104,115 +102,4 @@ export const createRpcQueryExtension = (base: QueryClient) => { return queryService.addressStringToBytes(request); } }; -}; -export interface UseAccountsQuery<TData> extends ReactQueryParams<QueryAccountsResponse, TData> { - request?: QueryAccountsRequest; -} -export interface UseAccountQuery<TData> extends ReactQueryParams<QueryAccountResponse, TData> { - request: QueryAccountRequest; -} -export interface UseParamsQuery<TData> extends ReactQueryParams<QueryParamsResponse, TData> { - request?: QueryParamsRequest; -} -export interface UseModuleAccountsQuery<TData> extends ReactQueryParams<QueryModuleAccountsResponse, TData> { - request?: QueryModuleAccountsRequest; -} -export interface UseBech32PrefixQuery<TData> extends ReactQueryParams<Bech32PrefixResponse, TData> { - request?: Bech32PrefixRequest; -} -export interface UseAddressBytesToStringQuery<TData> extends ReactQueryParams<AddressBytesToStringResponse, TData> { - request: AddressBytesToStringRequest; -} -export interface UseAddressStringToBytesQuery<TData> extends ReactQueryParams<AddressStringToBytesResponse, TData> { - request: AddressStringToBytesRequest; -} -const _queryClients: WeakMap<ProtobufRpcClient, QueryClientImpl> = 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 = <TData = QueryAccountsResponse,>({ - request, - options - }: UseAccountsQuery<TData>) => { - return useQuery<QueryAccountsResponse, Error, TData>(["accountsQuery", request], () => { - if (!queryService) throw new Error("Query Service not initialized"); - return queryService.accounts(request); - }, options); - }; - const useAccount = <TData = QueryAccountResponse,>({ - request, - options - }: UseAccountQuery<TData>) => { - return useQuery<QueryAccountResponse, Error, TData>(["accountQuery", request], () => { - if (!queryService) throw new Error("Query Service not initialized"); - return queryService.account(request); - }, options); - }; - const useParams = <TData = QueryParamsResponse,>({ - request, - options - }: UseParamsQuery<TData>) => { - return useQuery<QueryParamsResponse, Error, TData>(["paramsQuery", request], () => { - if (!queryService) throw new Error("Query Service not initialized"); - return queryService.params(request); - }, options); - }; - const useModuleAccounts = <TData = QueryModuleAccountsResponse,>({ - request, - options - }: UseModuleAccountsQuery<TData>) => { - return useQuery<QueryModuleAccountsResponse, Error, TData>(["moduleAccountsQuery", request], () => { - if (!queryService) throw new Error("Query Service not initialized"); - return queryService.moduleAccounts(request); - }, options); - }; - const useBech32Prefix = <TData = Bech32PrefixResponse,>({ - request, - options - }: UseBech32PrefixQuery<TData>) => { - return useQuery<Bech32PrefixResponse, Error, TData>(["bech32PrefixQuery", request], () => { - if (!queryService) throw new Error("Query Service not initialized"); - return queryService.bech32Prefix(request); - }, options); - }; - const useAddressBytesToString = <TData = AddressBytesToStringResponse,>({ - request, - options - }: UseAddressBytesToStringQuery<TData>) => { - return useQuery<AddressBytesToStringResponse, Error, TData>(["addressBytesToStringQuery", request], () => { - if (!queryService) throw new Error("Query Service not initialized"); - return queryService.addressBytesToString(request); - }, options); - }; - const useAddressStringToBytes = <TData = AddressStringToBytesResponse,>({ - request, - options - }: UseAddressStringToBytesQuery<TData>) => { - return useQuery<AddressStringToBytesResponse, Error, TData>(["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 97f6258383..ccc4bcaed1 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.js"; -import { Grant, GrantSDKType, GrantAuthorization, GrantAuthorizationSDKType } from "./authz.js"; -import { setPaginationParams } from "../../../helpers.js"; +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../base/query/v1beta1/pagination"; +import { Grant, GrantSDKType, GrantAuthorization, GrantAuthorizationSDKType } from "./authz"; +import { setPaginationParams } from "../../../helpers"; import { LCDClient } from "@cosmology/lcd"; -import { QueryGrantsRequest, QueryGrantsRequestSDKType, QueryGrantsResponse, QueryGrantsResponseSDKType, QueryGranterGrantsRequest, QueryGranterGrantsRequestSDKType, QueryGranterGrantsResponse, QueryGranterGrantsResponseSDKType, QueryGranteeGrantsRequest, QueryGranteeGrantsRequestSDKType, QueryGranteeGrantsResponse, QueryGranteeGrantsResponseSDKType } from "./query.js"; +import { QueryGrantsRequest, QueryGrantsRequestSDKType, QueryGrantsResponse, QueryGrantsResponseSDKType, QueryGranterGrantsRequest, QueryGranterGrantsRequestSDKType, QueryGranterGrantsResponse, QueryGranterGrantsResponseSDKType, QueryGranteeGrantsRequest, QueryGranteeGrantsRequestSDKType, QueryGranteeGrantsResponse, QueryGranteeGrantsResponseSDKType } from "./query"; 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 e22e435eb1..dd8edf0345 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.js"; -import { Grant, GrantSDKType, GrantAuthorization, GrantAuthorizationSDKType } from "./authz.js"; -import { Rpc } from "../../../helpers.js"; -import { BinaryReader } from "../../../binary.js"; +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 { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; -import { QueryGrantsRequest, QueryGrantsRequestSDKType, QueryGrantsResponse, QueryGrantsResponseSDKType, QueryGranterGrantsRequest, QueryGranterGrantsRequestSDKType, QueryGranterGrantsResponse, QueryGranterGrantsResponseSDKType, QueryGranteeGrantsRequest, QueryGranteeGrantsRequestSDKType, QueryGranteeGrantsResponse, QueryGranteeGrantsResponseSDKType } from "./query.js"; +import { QueryGrantsRequest, QueryGrantsRequestSDKType, QueryGrantsResponse, QueryGrantsResponseSDKType, QueryGranterGrantsRequest, QueryGranterGrantsRequestSDKType, QueryGranterGrantsResponse, QueryGranterGrantsResponseSDKType, QueryGranteeGrantsRequest, QueryGranteeGrantsRequestSDKType, QueryGranteeGrantsResponse, QueryGranteeGrantsResponseSDKType, ReactiveQueryGrantsRequest, ReactiveQueryGranterGrantsRequest, ReactiveQueryGranteeGrantsRequest } from "./query"; /** 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 fbb03d7f8e..b035d8f4ff 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.js"; -import { Any, AnySDKType } from "../../../google/protobuf/any.js"; +import { Grant, GrantSDKType } from "./authz"; +import { Any, AnySDKType } from "../../../google/protobuf/any"; import { AminoMsg } from "@cosmjs/amino"; -import { MsgGrant, MsgGrantSDKType, MsgExec, MsgExecSDKType, MsgRevoke, MsgRevokeSDKType } from "./tx.js"; +import { MsgGrant, MsgGrantSDKType, MsgExec, MsgExecSDKType, MsgRevoke, MsgRevokeSDKType } from "./tx"; 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 2aaa8a5465..273cecc9e3 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.js"; -import { Any, AnySDKType } from "../../../google/protobuf/any.js"; +import { Grant, GrantSDKType } from "./authz"; +import { Any, AnySDKType } from "../../../google/protobuf/any"; import { GeneratedType, Registry } from "@cosmjs/proto-signing"; -import { MsgGrant, MsgGrantSDKType, MsgExec, MsgExecSDKType, MsgRevoke, MsgRevokeSDKType } from "./tx.js"; +import { MsgGrant, MsgGrantSDKType, MsgExec, MsgExecSDKType, MsgRevoke, MsgRevokeSDKType } from "./tx"; export const registry: ReadonlyArray<[string, GeneratedType]> = [["/cosmos.authz.v1beta1.MsgGrant", MsgGrant], ["/cosmos.authz.v1beta1.MsgExec", MsgExec], ["/cosmos.authz.v1beta1.MsgRevoke", MsgRevoke]]; export const load = (protoRegistry: Registry) => { registry.forEach(([typeUrl, mod]) => { 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 3dc11bc1c9..9f6a262bfb 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.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"; +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"; /** 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 b79ca342a1..d0de75cfdb 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.js"; -import { Coin, CoinSDKType } from "../../base/v1beta1/coin.js"; -import { Params, ParamsSDKType, Metadata, MetadataSDKType } from "./bank.js"; -import { setPaginationParams } from "../../../helpers.js"; +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 { 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.js"; +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"; 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: PageRequest.fromPartial({}) + pagination: undefined }): Promise<QueryTotalSupplyResponseSDKType> { 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: PageRequest.fromPartial({}) + pagination: undefined }): Promise<QueryDenomsMetadataResponseSDKType> { 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 a89321c1bb..e1afd61410 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,12 +1,13 @@ -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 { 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 { QueryClient, createProtobufRpcClient, ProtobufRpcClient } from "@cosmjs/stargate"; -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"; +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"; /** Query defines the gRPC querier service. */ export interface Query { /** Balance queries the balance of a single coin for a single account. */ @@ -67,7 +68,7 @@ export class QueryClientImpl implements Query { return promise.then(data => QuerySpendableBalancesResponse.decode(new BinaryReader(data))); } totalSupply(request: QueryTotalSupplyRequest = { - pagination: PageRequest.fromPartial({}) + pagination: undefined }): Promise<QueryTotalSupplyResponse> { const data = QueryTotalSupplyRequest.encode(request).finish(); const promise = this.rpc.request("cosmos.bank.v1beta1.Query", "TotalSupply", data); @@ -89,7 +90,7 @@ export class QueryClientImpl implements Query { return promise.then(data => QueryDenomMetadataResponse.decode(new BinaryReader(data))); } denomsMetadata(request: QueryDenomsMetadataRequest = { - pagination: PageRequest.fromPartial({}) + pagination: undefined }): Promise<QueryDenomsMetadataResponse> { const data = QueryDenomsMetadataRequest.encode(request).finish(); const promise = this.rpc.request("cosmos.bank.v1beta1.Query", "DenomsMetadata", data); @@ -134,125 +135,272 @@ export const createRpcQueryExtension = (base: QueryClient) => { } }; }; -export interface UseBalanceQuery<TData> extends ReactQueryParams<QueryBalanceResponse, TData> { - request: QueryBalanceRequest; +export interface UseBalanceQuery<TData> extends VueQueryParams<QueryBalanceResponse, TData> { + request: ReactiveQueryBalanceRequest; } -export interface UseAllBalancesQuery<TData> extends ReactQueryParams<QueryAllBalancesResponse, TData> { - request: QueryAllBalancesRequest; +export interface UseAllBalancesQuery<TData> extends VueQueryParams<QueryAllBalancesResponse, TData> { + request: ReactiveQueryAllBalancesRequest; } -export interface UseSpendableBalancesQuery<TData> extends ReactQueryParams<QuerySpendableBalancesResponse, TData> { - request: QuerySpendableBalancesRequest; +export interface UseSpendableBalancesQuery<TData> extends VueQueryParams<QuerySpendableBalancesResponse, TData> { + request: ReactiveQuerySpendableBalancesRequest; } -export interface UseTotalSupplyQuery<TData> extends ReactQueryParams<QueryTotalSupplyResponse, TData> { - request?: QueryTotalSupplyRequest; +export interface UseTotalSupplyQuery<TData> extends VueQueryParams<QueryTotalSupplyResponse, TData> { + request?: ReactiveQueryTotalSupplyRequest; } -export interface UseSupplyOfQuery<TData> extends ReactQueryParams<QuerySupplyOfResponse, TData> { - request: QuerySupplyOfRequest; +export interface UseSupplyOfQuery<TData> extends VueQueryParams<QuerySupplyOfResponse, TData> { + request: ReactiveQuerySupplyOfRequest; } -export interface UseParamsQuery<TData> extends ReactQueryParams<QueryParamsResponse, TData> { - request?: QueryParamsRequest; +export interface UseParamsQuery<TData> extends VueQueryParams<QueryParamsResponse, TData> { + request?: ReactiveQueryParamsRequest; } -export interface UseDenomMetadataQuery<TData> extends ReactQueryParams<QueryDenomMetadataResponse, TData> { - request: QueryDenomMetadataRequest; +export interface UseDenomMetadataQuery<TData> extends VueQueryParams<QueryDenomMetadataResponse, TData> { + request: ReactiveQueryDenomMetadataRequest; } -export interface UseDenomsMetadataQuery<TData> extends ReactQueryParams<QueryDenomsMetadataResponse, TData> { - request?: QueryDenomsMetadataRequest; +export interface UseDenomsMetadataQuery<TData> extends VueQueryParams<QueryDenomsMetadataResponse, TData> { + request?: ReactiveQueryDenomsMetadataRequest; } -export interface UseDenomOwnersQuery<TData> extends ReactQueryParams<QueryDenomOwnersResponse, TData> { - request: QueryDenomOwnersRequest; +export interface UseDenomOwnersQuery<TData> extends VueQueryParams<QueryDenomOwnersResponse, TData> { + request: ReactiveQueryDenomOwnersRequest; } -const _queryClients: WeakMap<ProtobufRpcClient, QueryClientImpl> = 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 useQueryService = (rpc: Ref<ProtobufRpcClient | undefined>): ComputedRef<QueryClientImpl | undefined> => { + 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: ProtobufRpcClient | undefined) => { - const queryService = getQueryService(rpc); +export const createRpcQueryHooks = (rpc: Ref<ProtobufRpcClient | undefined>) => { + const queryService = useQueryService(rpc); const useBalance = <TData = QueryBalanceResponse,>({ request, options }: UseBalanceQuery<TData>) => { - return useQuery<QueryBalanceResponse, Error, TData>(["balanceQuery", request], () => { - if (!queryService) throw new Error("Query Service not initialized"); - return queryService.balance(request); - }, options); + const queryKey = ["balanceQuery", queryService]; + if (request) { + Object.values(request).forEach((val: any) => { + queryKey.push(val); + }); + } + return useQuery<QueryBalanceResponse, Error, TData>({ + 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 + }); }; const useAllBalances = <TData = QueryAllBalancesResponse,>({ request, options }: UseAllBalancesQuery<TData>) => { - return useQuery<QueryAllBalancesResponse, Error, TData>(["allBalancesQuery", request], () => { - if (!queryService) throw new Error("Query Service not initialized"); - return queryService.allBalances(request); - }, options); + const queryKey = ["allBalancesQuery", queryService]; + if (request) { + Object.values(request).forEach((val: any) => { + queryKey.push(val); + }); + } + return useQuery<QueryAllBalancesResponse, Error, TData>({ + 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 + }); }; const useSpendableBalances = <TData = QuerySpendableBalancesResponse,>({ request, options }: UseSpendableBalancesQuery<TData>) => { - return useQuery<QuerySpendableBalancesResponse, Error, TData>(["spendableBalancesQuery", request], () => { - if (!queryService) throw new Error("Query Service not initialized"); - return queryService.spendableBalances(request); - }, options); + const queryKey = ["spendableBalancesQuery", queryService]; + if (request) { + Object.values(request).forEach((val: any) => { + queryKey.push(val); + }); + } + return useQuery<QuerySpendableBalancesResponse, Error, TData>({ + 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 + }); }; const useTotalSupply = <TData = QueryTotalSupplyResponse,>({ request, options }: UseTotalSupplyQuery<TData>) => { - return useQuery<QueryTotalSupplyResponse, Error, TData>(["totalSupplyQuery", request], () => { - if (!queryService) throw new Error("Query Service not initialized"); - return queryService.totalSupply(request); - }, options); + const queryKey = ["totalSupplyQuery", queryService]; + if (request) { + Object.values(request).forEach((val: any) => { + queryKey.push(val); + }); + } + return useQuery<QueryTotalSupplyResponse, Error, TData>({ + 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 + }); }; const useSupplyOf = <TData = QuerySupplyOfResponse,>({ request, options }: UseSupplyOfQuery<TData>) => { - return useQuery<QuerySupplyOfResponse, Error, TData>(["supplyOfQuery", request], () => { - if (!queryService) throw new Error("Query Service not initialized"); - return queryService.supplyOf(request); - }, options); + const queryKey = ["supplyOfQuery", queryService]; + if (request) { + Object.values(request).forEach((val: any) => { + queryKey.push(val); + }); + } + return useQuery<QuerySupplyOfResponse, Error, TData>({ + 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 + }); }; const useParams = <TData = QueryParamsResponse,>({ request, options }: UseParamsQuery<TData>) => { - return useQuery<QueryParamsResponse, Error, TData>(["paramsQuery", request], () => { - if (!queryService) throw new Error("Query Service not initialized"); - return queryService.params(request); - }, options); + const queryKey = ["paramsQuery", queryService]; + if (request) { + Object.values(request).forEach((val: any) => { + queryKey.push(val); + }); + } + return useQuery<QueryParamsResponse, Error, TData>({ + 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 useDenomMetadata = <TData = QueryDenomMetadataResponse,>({ request, options }: UseDenomMetadataQuery<TData>) => { - return useQuery<QueryDenomMetadataResponse, Error, TData>(["denomMetadataQuery", request], () => { - if (!queryService) throw new Error("Query Service not initialized"); - return queryService.denomMetadata(request); - }, options); + const queryKey = ["denomMetadataQuery", queryService]; + if (request) { + Object.values(request).forEach((val: any) => { + queryKey.push(val); + }); + } + return useQuery<QueryDenomMetadataResponse, Error, TData>({ + 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 + }); }; const useDenomsMetadata = <TData = QueryDenomsMetadataResponse,>({ request, options }: UseDenomsMetadataQuery<TData>) => { - return useQuery<QueryDenomsMetadataResponse, Error, TData>(["denomsMetadataQuery", request], () => { - if (!queryService) throw new Error("Query Service not initialized"); - return queryService.denomsMetadata(request); - }, options); + const queryKey = ["denomsMetadataQuery", queryService]; + if (request) { + Object.values(request).forEach((val: any) => { + queryKey.push(val); + }); + } + return useQuery<QueryDenomsMetadataResponse, Error, TData>({ + 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 + }); }; const useDenomOwners = <TData = QueryDenomOwnersResponse,>({ request, options }: UseDenomOwnersQuery<TData>) => { - return useQuery<QueryDenomOwnersResponse, Error, TData>(["denomOwnersQuery", request], () => { - if (!queryService) throw new Error("Query Service not initialized"); - return queryService.denomOwners(request); - }, options); + const queryKey = ["denomOwnersQuery", queryService]; + if (request) { + Object.values(request).forEach((val: any) => { + queryKey.push(val); + }); + } + return useQuery<QueryDenomOwnersResponse, Error, TData>({ + 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 { /** 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 7a90fe04a8..5352659e14 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.js"; -import { Input, InputSDKType, Output, OutputSDKType } from "./bank.js"; +import { Coin, CoinSDKType } from "../../base/v1beta1/coin"; +import { Input, InputSDKType, Output, OutputSDKType } from "./bank"; import { AminoMsg } from "@cosmjs/amino"; -import { MsgSend, MsgSendSDKType, MsgMultiSend, MsgMultiSendSDKType } from "./tx.js"; +import { MsgSend, MsgSendSDKType, MsgMultiSend, MsgMultiSendSDKType } from "./tx"; 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 6ac4d5f72b..0bd58f9efc 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.js"; -import { Input, InputSDKType, Output, OutputSDKType } from "./bank.js"; +import { Coin, CoinSDKType } from "../../base/v1beta1/coin"; +import { Input, InputSDKType, Output, OutputSDKType } from "./bank"; import { GeneratedType, Registry } from "@cosmjs/proto-signing"; -import { MsgSend, MsgSendSDKType, MsgMultiSend, MsgMultiSendSDKType } from "./tx.js"; +import { MsgSend, MsgSendSDKType, MsgMultiSend, MsgMultiSendSDKType } from "./tx"; 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 50076e3fcb..252d95dc7d 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.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"; +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"; /** 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/reflection/v1beta1/reflection.lcd.ts b/__fixtures__/v-next/outputv4/cosmos/base/reflection/v1beta1/reflection.lcd.ts index b8c9756f28..fc9dc97286 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.js"; +import { ListAllInterfacesRequest, ListAllInterfacesRequestSDKType, ListAllInterfacesResponse, ListAllInterfacesResponseSDKType, ListImplementationsRequest, ListImplementationsRequestSDKType, ListImplementationsResponse, ListImplementationsResponseSDKType } from "./reflection"; 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 6bdcf494ff..0a2876d475 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.js"; -import { BinaryReader } from "../../../../binary.js"; +import { Rpc } from "../../../../helpers"; +import { BinaryReader } from "../../../../binary"; import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; -import { ListAllInterfacesRequest, ListAllInterfacesRequestSDKType, ListAllInterfacesResponse, ListAllInterfacesResponseSDKType, ListImplementationsRequest, ListImplementationsRequestSDKType, ListImplementationsResponse, ListImplementationsResponseSDKType } from "./reflection.js"; +import { ListAllInterfacesRequest, ListAllInterfacesRequestSDKType, ListAllInterfacesResponse, ListAllInterfacesResponseSDKType, ListImplementationsRequest, ListImplementationsRequestSDKType, ListImplementationsResponse, ListImplementationsResponseSDKType } from "./reflection"; /** 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 3277110496..b1aff05930 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.js"; +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"; 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 84542cc6ea..51a2e52526 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.js"; -import { BinaryReader } from "../../../../binary.js"; +import { Rpc } from "../../../../helpers"; +import { BinaryReader } from "../../../../binary"; 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.js"; +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"; /** 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 71ebde02c2..8344be264e 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.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 { 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 { 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.js"; +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"; export class LCDQueryClient { req: LCDClient; constructor({ @@ -43,7 +43,7 @@ export class LCDQueryClient { } /* GetLatestValidatorSet queries latest validator-set. */ async getLatestValidatorSet(params: GetLatestValidatorSetRequest = { - pagination: PageRequest.fromPartial({}) + pagination: undefined }): Promise<GetLatestValidatorSetResponseSDKType> { 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 cdfeebe4e2..2d426d3d4c 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.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 { 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 { 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.js"; +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"; /** 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: PageRequest.fromPartial({}) + pagination: undefined }): Promise<GetLatestValidatorSetResponse> { 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 99a745f8a0..5444a4c00a 100644 --- a/__fixtures__/v-next/outputv4/cosmos/bundle.ts +++ b/__fixtures__/v-next/outputv4/cosmos/bundle.ts @@ -1,188 +1,192 @@ -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"; +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"; export namespace cosmos { export namespace app { export const v1alpha1 = { ..._55, ..._56, ..._57, - ..._400 + ..._450 }; } export namespace auth { @@ -190,8 +194,8 @@ export namespace cosmos { ..._58, ..._59, ..._60, - ..._381, - ..._401 + ..._430, + ..._451 }; } export namespace authz { @@ -200,11 +204,11 @@ export namespace cosmos { ..._62, ..._63, ..._64, - ..._353, - ..._367, - ..._382, ..._402, - ..._420 + ..._416, + ..._431, + ..._452, + ..._471 }; } export namespace bank { @@ -214,11 +218,11 @@ export namespace cosmos { ..._67, ..._68, ..._69, - ..._354, - ..._368, - ..._383, ..._403, - ..._421 + ..._417, + ..._432, + ..._453, + ..._472 }; } export namespace base { @@ -240,13 +244,13 @@ export namespace cosmos { export namespace reflection { export const v1beta1 = { ..._73, - ..._384, - ..._404 + ..._433, + ..._454 }; export const v2alpha1 = { ..._74, - ..._385, - ..._405 + ..._434, + ..._455 }; } export namespace snapshots { @@ -263,250 +267,262 @@ export namespace cosmos { export namespace tendermint { export const v1beta1 = { ..._78, - ..._386, - ..._406 + ..._435, + ..._456 }; } export const v1beta1 = { ..._79 }; + export namespace node { + export const v1beta1 = { + ..._80, + ..._449, + ..._470 + }; + } } export namespace capability { export const v1beta1 = { - ..._80, - ..._81 + ..._81, + ..._82 }; } export namespace crisis { export const v1beta1 = { - ..._82, ..._83, - ..._355, - ..._369, - ..._422 + ..._84, + ..._404, + ..._418, + ..._473 }; } export namespace crypto { export const ed25519 = { - ..._84 + ..._85 }; export namespace hd { export const v1 = { - ..._85 + ..._86 }; } export namespace keyring { export const v1 = { - ..._86 + ..._87 }; } export const multisig = { - ..._87 + ..._88 }; export const secp256k1 = { - ..._88 + ..._89 }; export const secp256r1 = { - ..._89 + ..._90 }; } export namespace distribution { export const v1beta1 = { - ..._90, ..._91, ..._92, ..._93, - ..._356, - ..._370, - ..._387, - ..._407, - ..._423 + ..._94, + ..._405, + ..._419, + ..._436, + ..._457, + ..._474 }; } export namespace evidence { export const v1beta1 = { - ..._94, ..._95, ..._96, ..._97, - ..._357, - ..._371, - ..._388, - ..._408, - ..._424 + ..._98, + ..._406, + ..._420, + ..._437, + ..._458, + ..._475 }; } export namespace feegrant { export const v1beta1 = { - ..._98, ..._99, ..._100, ..._101, - ..._358, - ..._372, - ..._389, - ..._409, - ..._425 + ..._102, + ..._407, + ..._421, + ..._438, + ..._459, + ..._476 }; } export namespace genutil { export const v1beta1 = { - ..._102 + ..._103 }; } export namespace gov { export const v1 = { - ..._103, ..._104, ..._105, ..._106, - ..._359, - ..._373, - ..._390, - ..._410, - ..._426 + ..._107, + ..._408, + ..._422, + ..._439, + ..._460, + ..._477 }; export const v1beta1 = { - ..._107, ..._108, ..._109, ..._110, - ..._360, - ..._374, - ..._391, - ..._411, - ..._427 + ..._111, + ..._409, + ..._423, + ..._440, + ..._461, + ..._478 }; } export namespace group { export const v1 = { - ..._111, ..._112, ..._113, ..._114, ..._115, - ..._361, - ..._375, - ..._392, - ..._412, - ..._428 + ..._116, + ..._410, + ..._424, + ..._441, + ..._462, + ..._479 }; } export namespace mint { export const v1beta1 = { - ..._116, ..._117, ..._118, - ..._393, - ..._413 + ..._119, + ..._442, + ..._463 }; } export namespace msg { export const v1 = { - ..._119 + ..._120 }; } export namespace nft { export const v1beta1 = { - ..._120, ..._121, ..._122, ..._123, ..._124, - ..._362, - ..._376, - ..._394, - ..._414, - ..._429 + ..._125, + ..._411, + ..._425, + ..._443, + ..._464, + ..._480 }; } export namespace orm { export namespace module { export const v1alpha1 = { - ..._125 + ..._126 }; } export const v1 = { - ..._126 + ..._127 }; export const v1alpha1 = { - ..._127 + ..._128 }; } export namespace params { export const v1beta1 = { - ..._128, ..._129, - ..._395, - ..._415 + ..._130, + ..._444, + ..._465 }; } export namespace slashing { export const v1beta1 = { - ..._130, ..._131, ..._132, ..._133, - ..._363, - ..._377, - ..._396, - ..._416, - ..._430 + ..._134, + ..._412, + ..._426, + ..._445, + ..._466, + ..._481 }; } export namespace staking { export const v1beta1 = { - ..._134, ..._135, ..._136, ..._137, ..._138, - ..._364, - ..._378, - ..._397, - ..._417, - ..._431 + ..._139, + ..._413, + ..._427, + ..._446, + ..._467, + ..._482 }; } export namespace tx { export namespace signing { export const v1beta1 = { - ..._139 + ..._140 }; } export const v1beta1 = { - ..._140, ..._141, - ..._398, - ..._418 + ..._142, + ..._447, + ..._468 }; } export namespace upgrade { export const v1beta1 = { - ..._142, ..._143, ..._144, - ..._365, - ..._379, - ..._399, - ..._419, - ..._432 + ..._145, + ..._414, + ..._428, + ..._448, + ..._469, + ..._483 }; } export namespace vesting { export const v1beta1 = { - ..._145, ..._146, - ..._366, - ..._380, - ..._433 + ..._147, + ..._415, + ..._429, + ..._484 + }; + } + export namespace ics23 { + export const v1 = { + ..._148 }; } export const ClientFactory = { - ..._539, - ..._540, - ..._541, - ..._542, - ..._543 + ..._623, + ..._624, + ..._625, + ..._626, + ..._627 }; } \ 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 d0d7602d75..d71646865f 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.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"; +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"; 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 bc37ce0db3..2928925a4a 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.js"; -import { connectComet, HttpEndpoint } from "@cosmjs/tendermint-rpc"; +import { Rpc } from "../helpers"; +import { Tendermint34Client, HttpEndpoint } from "@cosmjs/tendermint-rpc"; import { QueryClient } from "@cosmjs/stargate"; export const createCosmicRPCQueryClient = async ({ rpcEndpoint }: { rpcEndpoint: string | HttpEndpoint; }) => { - const tmClient = await connectComet(rpcEndpoint); + const tmClient = await Tendermint34Client.connect(rpcEndpoint); const client = new QueryClient(tmClient); return { cosmos: { bank: { - v1beta1: (await import("./bank/v1beta1/query.rpc.Query.js")).createRpcQueryExtension(client) + v1beta1: (await import("./bank/v1beta1/query.rpc.Query")).createRpcQueryExtension(client) }, gov: { - v1beta1: (await import("./gov/v1beta1/query.rpc.Query.js")).createRpcQueryExtension(client) + v1beta1: (await import("./gov/v1beta1/query.rpc.Query")).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 c0ba0ed327..796bd656a8 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.js"; +import { Rpc } from "../helpers"; export const createCosmicRPCTxClient = async ({ rpc }: { @@ -6,10 +6,10 @@ export const createCosmicRPCTxClient = async ({ }) => ({ cosmos: { bank: { - v1beta1: new (await import("./bank/v1beta1/tx.rpc.msg.js")).MsgClientImpl(rpc) + v1beta1: new (await import("./bank/v1beta1/tx.rpc.msg")).MsgClientImpl(rpc) }, gov: { - v1beta1: new (await import("./gov/v1beta1/tx.rpc.msg.js")).MsgClientImpl(rpc) + v1beta1: new (await import("./gov/v1beta1/tx.rpc.msg")).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 aff0ab7b6c..dfa3c954cc 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.js"; +import { MsgVerifyInvariant, MsgVerifyInvariantSDKType } from "./tx"; 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 19c8d0c9d5..77f206ab58 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.js"; +import { MsgVerifyInvariant, MsgVerifyInvariantSDKType } from "./tx"; 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 a0d77e7f67..0c0a897cff 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.js"; -import { BinaryReader } from "../../../binary.js"; -import { MsgVerifyInvariant, MsgVerifyInvariantSDKType, MsgVerifyInvariantResponse, MsgVerifyInvariantResponseSDKType } from "./tx.js"; +import { Rpc } from "../../../helpers"; +import { BinaryReader } from "../../../binary"; +import { MsgVerifyInvariant, MsgVerifyInvariantSDKType, MsgVerifyInvariantResponse, MsgVerifyInvariantResponseSDKType } from "./tx"; /** 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 671459f85d..0637971dae 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.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 { 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 { 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.js"; +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"; 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 5226a4c28c..2948d63594 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.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 { 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 { 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 } from "./query.js"; +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"; /** 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 6bf3e36a32..c7d34e047d 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.js"; +import { Coin, CoinSDKType } from "../../base/v1beta1/coin"; import { AminoMsg } from "@cosmjs/amino"; -import { MsgSetWithdrawAddress, MsgSetWithdrawAddressSDKType, MsgWithdrawDelegatorReward, MsgWithdrawDelegatorRewardSDKType, MsgWithdrawValidatorCommission, MsgWithdrawValidatorCommissionSDKType, MsgFundCommunityPool, MsgFundCommunityPoolSDKType } from "./tx.js"; +import { MsgSetWithdrawAddress, MsgSetWithdrawAddressSDKType, MsgWithdrawDelegatorReward, MsgWithdrawDelegatorRewardSDKType, MsgWithdrawValidatorCommission, MsgWithdrawValidatorCommissionSDKType, MsgFundCommunityPool, MsgFundCommunityPoolSDKType } from "./tx"; 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 bba6fce4eb..6241519ba0 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.js"; +import { Coin, CoinSDKType } from "../../base/v1beta1/coin"; import { GeneratedType, Registry } from "@cosmjs/proto-signing"; -import { MsgSetWithdrawAddress, MsgSetWithdrawAddressSDKType, MsgWithdrawDelegatorReward, MsgWithdrawDelegatorRewardSDKType, MsgWithdrawValidatorCommission, MsgWithdrawValidatorCommissionSDKType, MsgFundCommunityPool, MsgFundCommunityPoolSDKType } from "./tx.js"; +import { MsgSetWithdrawAddress, MsgSetWithdrawAddressSDKType, MsgWithdrawDelegatorReward, MsgWithdrawDelegatorRewardSDKType, MsgWithdrawValidatorCommission, MsgWithdrawValidatorCommissionSDKType, MsgFundCommunityPool, MsgFundCommunityPoolSDKType } from "./tx"; 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 0701f88ef2..4a6132c737 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.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"; +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"; /** 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 bb742ee30e..1ce1230060 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.js"; -import { Any, AnySDKType } from "../../../google/protobuf/any.js"; -import { setPaginationParams } from "../../../helpers.js"; +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../base/query/v1beta1/pagination"; +import { Any, AnySDKType } from "../../../google/protobuf/any"; +import { setPaginationParams } from "../../../helpers"; import { LCDClient } from "@cosmology/lcd"; -import { QueryEvidenceRequest, QueryEvidenceRequestSDKType, QueryEvidenceResponse, QueryEvidenceResponseSDKType, QueryAllEvidenceRequest, QueryAllEvidenceRequestSDKType, QueryAllEvidenceResponse, QueryAllEvidenceResponseSDKType } from "./query.js"; +import { QueryEvidenceRequest, QueryEvidenceRequestSDKType, QueryEvidenceResponse, QueryEvidenceResponseSDKType, QueryAllEvidenceRequest, QueryAllEvidenceRequestSDKType, QueryAllEvidenceResponse, QueryAllEvidenceResponseSDKType } from "./query"; export class LCDQueryClient { req: LCDClient; constructor({ @@ -21,7 +21,7 @@ export class LCDQueryClient { } /* AllEvidence queries all evidence. */ async allEvidence(params: QueryAllEvidenceRequest = { - pagination: PageRequest.fromPartial({}) + pagination: undefined }): Promise<QueryAllEvidenceResponseSDKType> { 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 92090f9b74..3c48a14072 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.js"; -import { Any, AnySDKType } from "../../../google/protobuf/any.js"; -import { Rpc } from "../../../helpers.js"; -import { BinaryReader } from "../../../binary.js"; +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 { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; -import { QueryEvidenceRequest, QueryEvidenceRequestSDKType, QueryEvidenceResponse, QueryEvidenceResponseSDKType, QueryAllEvidenceRequest, QueryAllEvidenceRequestSDKType, QueryAllEvidenceResponse, QueryAllEvidenceResponseSDKType } from "./query.js"; +import { QueryEvidenceRequest, QueryEvidenceRequestSDKType, QueryEvidenceResponse, QueryEvidenceResponseSDKType, QueryAllEvidenceRequest, QueryAllEvidenceRequestSDKType, QueryAllEvidenceResponse, QueryAllEvidenceResponseSDKType, ReactiveQueryEvidenceRequest, ReactiveQueryAllEvidenceRequest } from "./query"; /** 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: PageRequest.fromPartial({}) + pagination: undefined }): Promise<QueryAllEvidenceResponse> { 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 7446a3fd88..8cf0ca70d6 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.js"; +import { Any, AnySDKType } from "../../../google/protobuf/any"; import { AminoMsg } from "@cosmjs/amino"; -import { MsgSubmitEvidence, MsgSubmitEvidenceSDKType } from "./tx.js"; +import { MsgSubmitEvidence, MsgSubmitEvidenceSDKType } from "./tx"; 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 6085b1e689..d48dba61f0 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.js"; +import { Any, AnySDKType } from "../../../google/protobuf/any"; import { GeneratedType, Registry } from "@cosmjs/proto-signing"; -import { MsgSubmitEvidence, MsgSubmitEvidenceSDKType } from "./tx.js"; +import { MsgSubmitEvidence, MsgSubmitEvidenceSDKType } from "./tx"; 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 b4f8d1e215..0b661ab18f 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.js"; -import { Rpc } from "../../../helpers.js"; -import { BinaryReader } from "../../../binary.js"; -import { MsgSubmitEvidence, MsgSubmitEvidenceSDKType, MsgSubmitEvidenceResponse, MsgSubmitEvidenceResponseSDKType } from "./tx.js"; +import { Any, AnySDKType } from "../../../google/protobuf/any"; +import { Rpc } from "../../../helpers"; +import { BinaryReader } from "../../../binary"; +import { MsgSubmitEvidence, MsgSubmitEvidenceSDKType, MsgSubmitEvidenceResponse, MsgSubmitEvidenceResponseSDKType } from "./tx"; /** 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 0a922871b4..6c712121a4 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.js"; -import { Grant, GrantSDKType } from "./feegrant.js"; -import { setPaginationParams } from "../../../helpers.js"; +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../base/query/v1beta1/pagination"; +import { Grant, GrantSDKType } from "./feegrant"; +import { setPaginationParams } from "../../../helpers"; import { LCDClient } from "@cosmology/lcd"; -import { QueryAllowanceRequest, QueryAllowanceRequestSDKType, QueryAllowanceResponse, QueryAllowanceResponseSDKType, QueryAllowancesRequest, QueryAllowancesRequestSDKType, QueryAllowancesResponse, QueryAllowancesResponseSDKType, QueryAllowancesByGranterRequest, QueryAllowancesByGranterRequestSDKType, QueryAllowancesByGranterResponse, QueryAllowancesByGranterResponseSDKType } from "./query.js"; +import { QueryAllowanceRequest, QueryAllowanceRequestSDKType, QueryAllowanceResponse, QueryAllowanceResponseSDKType, QueryAllowancesRequest, QueryAllowancesRequestSDKType, QueryAllowancesResponse, QueryAllowancesResponseSDKType, QueryAllowancesByGranterRequest, QueryAllowancesByGranterRequestSDKType, QueryAllowancesByGranterResponse, QueryAllowancesByGranterResponseSDKType } from "./query"; 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 ce3428cbd6..7070e7779a 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.js"; -import { Grant, GrantSDKType } from "./feegrant.js"; -import { Rpc } from "../../../helpers.js"; -import { BinaryReader } from "../../../binary.js"; +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../base/query/v1beta1/pagination"; +import { Grant, GrantSDKType } from "./feegrant"; +import { Rpc } from "../../../helpers"; +import { BinaryReader } from "../../../binary"; import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; -import { QueryAllowanceRequest, QueryAllowanceRequestSDKType, QueryAllowanceResponse, QueryAllowanceResponseSDKType, QueryAllowancesRequest, QueryAllowancesRequestSDKType, QueryAllowancesResponse, QueryAllowancesResponseSDKType, QueryAllowancesByGranterRequest, QueryAllowancesByGranterRequestSDKType, QueryAllowancesByGranterResponse, QueryAllowancesByGranterResponseSDKType } from "./query.js"; +import { QueryAllowanceRequest, QueryAllowanceRequestSDKType, QueryAllowanceResponse, QueryAllowanceResponseSDKType, QueryAllowancesRequest, QueryAllowancesRequestSDKType, QueryAllowancesResponse, QueryAllowancesResponseSDKType, QueryAllowancesByGranterRequest, QueryAllowancesByGranterRequestSDKType, QueryAllowancesByGranterResponse, QueryAllowancesByGranterResponseSDKType, ReactiveQueryAllowanceRequest, ReactiveQueryAllowancesRequest, ReactiveQueryAllowancesByGranterRequest } from "./query"; /** 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 81a24f8cb1..c376a3917b 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.js"; +import { Any, AnySDKType } from "../../../google/protobuf/any"; import { AminoMsg } from "@cosmjs/amino"; -import { MsgGrantAllowance, MsgGrantAllowanceSDKType, MsgRevokeAllowance, MsgRevokeAllowanceSDKType } from "./tx.js"; +import { MsgGrantAllowance, MsgGrantAllowanceSDKType, MsgRevokeAllowance, MsgRevokeAllowanceSDKType } from "./tx"; 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 0dc7e2d320..071630f5c9 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.js"; +import { Any, AnySDKType } from "../../../google/protobuf/any"; import { GeneratedType, Registry } from "@cosmjs/proto-signing"; -import { MsgGrantAllowance, MsgGrantAllowanceSDKType, MsgRevokeAllowance, MsgRevokeAllowanceSDKType } from "./tx.js"; +import { MsgGrantAllowance, MsgGrantAllowanceSDKType, MsgRevokeAllowance, MsgRevokeAllowanceSDKType } from "./tx"; 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 44ebe5cae3..26ad0c4e9d 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.js"; -import { Rpc } from "../../../helpers.js"; -import { BinaryReader } from "../../../binary.js"; -import { MsgGrantAllowance, MsgGrantAllowanceSDKType, MsgGrantAllowanceResponse, MsgGrantAllowanceResponseSDKType, MsgRevokeAllowance, MsgRevokeAllowanceSDKType, MsgRevokeAllowanceResponse, MsgRevokeAllowanceResponseSDKType } from "./tx.js"; +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"; /** 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 6050fa1f4d..0ce2ded595 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.js"; -import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../base/query/v1beta1/pagination.js"; -import { setPaginationParams } from "../../../helpers.js"; +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 { 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.js"; +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"; 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 a2c2f959ff..c9a6ad6e6a 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,9 +1,12 @@ -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"; +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"; /** Query defines the gRPC querier service for gov module */ export interface Query { /** Proposal queries proposal details based on ProposalID. */ @@ -106,4 +109,254 @@ export const createRpcQueryExtension = (base: QueryClient) => { return queryService.tallyResult(request); } }; +}; +export interface UseProposalQuery<TData> extends VueQueryParams<QueryProposalResponse, TData> { + request: ReactiveQueryProposalRequest; +} +export interface UseProposalsQuery<TData> extends VueQueryParams<QueryProposalsResponse, TData> { + request: ReactiveQueryProposalsRequest; +} +export interface UseVoteQuery<TData> extends VueQueryParams<QueryVoteResponse, TData> { + request: ReactiveQueryVoteRequest; +} +export interface UseVotesQuery<TData> extends VueQueryParams<QueryVotesResponse, TData> { + request: ReactiveQueryVotesRequest; +} +export interface UseParamsQuery<TData> extends VueQueryParams<QueryParamsResponse, TData> { + request: ReactiveQueryParamsRequest; +} +export interface UseDepositQuery<TData> extends VueQueryParams<QueryDepositResponse, TData> { + request: ReactiveQueryDepositRequest; +} +export interface UseDepositsQuery<TData> extends VueQueryParams<QueryDepositsResponse, TData> { + request: ReactiveQueryDepositsRequest; +} +export interface UseTallyResultQuery<TData> extends VueQueryParams<QueryTallyResultResponse, TData> { + request: ReactiveQueryTallyResultRequest; +} +export const useQueryService = (rpc: Ref<ProtobufRpcClient | undefined>): ComputedRef<QueryClientImpl | undefined> => { + 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<ProtobufRpcClient | undefined>) => { + const queryService = useQueryService(rpc); + const useProposal = <TData = QueryProposalResponse,>({ + request, + options + }: UseProposalQuery<TData>) => { + const queryKey = ["proposalQuery", queryService]; + if (request) { + Object.values(request).forEach((val: any) => { + queryKey.push(val); + }); + } + return useQuery<QueryProposalResponse, Error, TData>({ + 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 = <TData = QueryProposalsResponse,>({ + request, + options + }: UseProposalsQuery<TData>) => { + const queryKey = ["proposalsQuery", queryService]; + if (request) { + Object.values(request).forEach((val: any) => { + queryKey.push(val); + }); + } + return useQuery<QueryProposalsResponse, Error, TData>({ + 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 = <TData = QueryVoteResponse,>({ + request, + options + }: UseVoteQuery<TData>) => { + const queryKey = ["voteQuery", queryService]; + if (request) { + Object.values(request).forEach((val: any) => { + queryKey.push(val); + }); + } + return useQuery<QueryVoteResponse, Error, TData>({ + 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 = <TData = QueryVotesResponse,>({ + request, + options + }: UseVotesQuery<TData>) => { + const queryKey = ["votesQuery", queryService]; + if (request) { + Object.values(request).forEach((val: any) => { + queryKey.push(val); + }); + } + return useQuery<QueryVotesResponse, Error, TData>({ + 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 = <TData = QueryParamsResponse,>({ + request, + options + }: UseParamsQuery<TData>) => { + const queryKey = ["paramsQuery", queryService]; + if (request) { + Object.values(request).forEach((val: any) => { + queryKey.push(val); + }); + } + return useQuery<QueryParamsResponse, Error, TData>({ + 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 = <TData = QueryDepositResponse,>({ + request, + options + }: UseDepositQuery<TData>) => { + const queryKey = ["depositQuery", queryService]; + if (request) { + Object.values(request).forEach((val: any) => { + queryKey.push(val); + }); + } + return useQuery<QueryDepositResponse, Error, TData>({ + 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 = <TData = QueryDepositsResponse,>({ + request, + options + }: UseDepositsQuery<TData>) => { + const queryKey = ["depositsQuery", queryService]; + if (request) { + Object.values(request).forEach((val: any) => { + queryKey.push(val); + }); + } + return useQuery<QueryDepositsResponse, Error, TData>({ + 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 = <TData = QueryTallyResultResponse,>({ + request, + options + }: UseTallyResultQuery<TData>) => { + const queryKey = ["tallyResultQuery", queryService]; + if (request) { + Object.values(request).forEach((val: any) => { + queryKey.push(val); + }); + } + return useQuery<QueryTallyResultResponse, Error, TData>({ + 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 9b40c6b182..7c0115740a 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.js"; -import { Coin, CoinSDKType } from "../../base/v1beta1/coin.js"; -import { VoteOption, VoteOptionSDKType, WeightedVoteOption, WeightedVoteOptionSDKType, voteOptionFromJSON } from "./gov.js"; +import { Any, AnySDKType } from "../../../google/protobuf/any"; +import { Coin, CoinSDKType } from "../../base/v1beta1/coin"; +import { VoteOption, VoteOptionSDKType, WeightedVoteOption, WeightedVoteOptionSDKType, voteOptionFromJSON } from "./gov"; import { AminoMsg } from "@cosmjs/amino"; -import { MsgSubmitProposal, MsgSubmitProposalSDKType, MsgExecLegacyContent, MsgExecLegacyContentSDKType, MsgVote, MsgVoteSDKType, MsgVoteWeighted, MsgVoteWeightedSDKType, MsgDeposit, MsgDepositSDKType } from "./tx.js"; +import { MsgSubmitProposal, MsgSubmitProposalSDKType, MsgExecLegacyContent, MsgExecLegacyContentSDKType, MsgVote, MsgVoteSDKType, MsgVoteWeighted, MsgVoteWeightedSDKType, MsgDeposit, MsgDepositSDKType } from "./tx"; 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 95857b5b68..eeb73d2528 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.js"; -import { Coin, CoinSDKType } from "../../base/v1beta1/coin.js"; -import { VoteOption, VoteOptionSDKType, WeightedVoteOption, WeightedVoteOptionSDKType } from "./gov.js"; +import { Any, AnySDKType } from "../../../google/protobuf/any"; +import { Coin, CoinSDKType } from "../../base/v1beta1/coin"; +import { VoteOption, VoteOptionSDKType, WeightedVoteOption, WeightedVoteOptionSDKType } from "./gov"; import { GeneratedType, Registry } from "@cosmjs/proto-signing"; -import { MsgSubmitProposal, MsgSubmitProposalSDKType, MsgExecLegacyContent, MsgExecLegacyContentSDKType, MsgVote, MsgVoteSDKType, MsgVoteWeighted, MsgVoteWeightedSDKType, MsgDeposit, MsgDepositSDKType } from "./tx.js"; +import { MsgSubmitProposal, MsgSubmitProposalSDKType, MsgExecLegacyContent, MsgExecLegacyContentSDKType, MsgVote, MsgVoteSDKType, MsgVoteWeighted, MsgVoteWeightedSDKType, MsgDeposit, MsgDepositSDKType } from "./tx"; 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 e12346b1ea..fe1fce32e3 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.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"; +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"; /** 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 7eb6b46465..97d81716e3 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.js"; -import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../base/query/v1beta1/pagination.js"; -import { setPaginationParams } from "../../../helpers.js"; +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 { 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.js"; +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"; 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 636bddd19b..04d80971b2 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,11 +1,9 @@ -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"; +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"; /** Query defines the gRPC querier service for gov module */ export interface Query { /** Proposal queries proposal details based on ProposalID. */ @@ -108,75 +106,4 @@ export const createRpcQueryExtension = (base: QueryClient) => { return queryService.tallyResult(request); } }; -}; -const _queryClients: WeakMap<ProtobufRpcClient, QueryClientImpl> = 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<QueryProposalRequest, QueryProposalResponse>(queryService?.proposal); - proposal(request: QueryProposalRequest) { - return this.store.getData(request); - } - } - class QueryProposalsStore { - store = new QueryStore<QueryProposalsRequest, QueryProposalsResponse>(queryService?.proposals); - proposals(request: QueryProposalsRequest) { - return this.store.getData(request); - } - } - class QueryVoteStore { - store = new QueryStore<QueryVoteRequest, QueryVoteResponse>(queryService?.vote); - vote(request: QueryVoteRequest) { - return this.store.getData(request); - } - } - class QueryVotesStore { - store = new QueryStore<QueryVotesRequest, QueryVotesResponse>(queryService?.votes); - votes(request: QueryVotesRequest) { - return this.store.getData(request); - } - } - class QueryParamsStore { - store = new QueryStore<QueryParamsRequest, QueryParamsResponse>(queryService?.params); - params(request: QueryParamsRequest) { - return this.store.getData(request); - } - } - class QueryDepositStore { - store = new QueryStore<QueryDepositRequest, QueryDepositResponse>(queryService?.deposit); - deposit(request: QueryDepositRequest) { - return this.store.getData(request); - } - } - class QueryDepositsStore { - store = new QueryStore<QueryDepositsRequest, QueryDepositsResponse>(queryService?.deposits); - deposits(request: QueryDepositsRequest) { - return this.store.getData(request); - } - } - class QueryTallyResultStore { - store = new QueryStore<QueryTallyResultRequest, QueryTallyResultResponse>(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 000404777d..fad45eaf42 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.js"; -import { Coin, CoinSDKType } from "../../base/v1beta1/coin.js"; -import { VoteOption, VoteOptionSDKType, WeightedVoteOption, WeightedVoteOptionSDKType, voteOptionFromJSON } from "./gov.js"; +import { Any, AnySDKType } from "../../../google/protobuf/any"; +import { Coin, CoinSDKType } from "../../base/v1beta1/coin"; +import { VoteOption, VoteOptionSDKType, WeightedVoteOption, WeightedVoteOptionSDKType, voteOptionFromJSON } from "./gov"; import { AminoMsg } from "@cosmjs/amino"; -import { MsgSubmitProposal, MsgSubmitProposalSDKType, MsgVote, MsgVoteSDKType, MsgVoteWeighted, MsgVoteWeightedSDKType, MsgDeposit, MsgDepositSDKType } from "./tx.js"; +import { MsgSubmitProposal, MsgSubmitProposalSDKType, MsgVote, MsgVoteSDKType, MsgVoteWeighted, MsgVoteWeightedSDKType, MsgDeposit, MsgDepositSDKType } from "./tx"; 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 ed11331d36..0b7996cb4f 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.js"; -import { Coin, CoinSDKType } from "../../base/v1beta1/coin.js"; -import { VoteOption, VoteOptionSDKType, WeightedVoteOption, WeightedVoteOptionSDKType } from "./gov.js"; +import { Any, AnySDKType } from "../../../google/protobuf/any"; +import { Coin, CoinSDKType } from "../../base/v1beta1/coin"; +import { VoteOption, VoteOptionSDKType, WeightedVoteOption, WeightedVoteOptionSDKType } from "./gov"; import { GeneratedType, Registry } from "@cosmjs/proto-signing"; -import { MsgSubmitProposal, MsgSubmitProposalSDKType, MsgVote, MsgVoteSDKType, MsgVoteWeighted, MsgVoteWeightedSDKType, MsgDeposit, MsgDepositSDKType } from "./tx.js"; +import { MsgSubmitProposal, MsgSubmitProposalSDKType, MsgVote, MsgVoteSDKType, MsgVoteWeighted, MsgVoteWeightedSDKType, MsgDeposit, MsgDepositSDKType } from "./tx"; 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 604dbe4e16..1d377e2fcd 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.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"; +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"; /** 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 edf01079c2..3e6ed1019c 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.js"; -import { GroupInfo, GroupInfoSDKType, GroupPolicyInfo, GroupPolicyInfoSDKType, GroupMember, GroupMemberSDKType, Proposal, ProposalSDKType, Vote, VoteSDKType, TallyResult, TallyResultSDKType } from "./types.js"; -import { setPaginationParams } from "../../../helpers.js"; +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 { 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.js"; +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"; 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 9c11b2042f..4640176a79 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.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 { 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 { 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 } from "./query.js"; +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"; /** 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 50a9650a46..e44a0f0c10 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.js"; -import { Any, AnySDKType } from "../../../google/protobuf/any.js"; +import { Member, MemberSDKType, VoteOption, VoteOptionSDKType, voteOptionFromJSON } from "./types"; +import { Any, AnySDKType } from "../../../google/protobuf/any"; 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.js"; +import { execFromJSON, MsgCreateGroup, MsgCreateGroupSDKType, MsgUpdateGroupMembers, MsgUpdateGroupMembersSDKType, MsgUpdateGroupAdmin, MsgUpdateGroupAdminSDKType, MsgUpdateGroupMetadata, MsgUpdateGroupMetadataSDKType, MsgCreateGroupPolicy, MsgCreateGroupPolicySDKType, MsgCreateGroupWithPolicy, MsgCreateGroupWithPolicySDKType, MsgUpdateGroupPolicyAdmin, MsgUpdateGroupPolicyAdminSDKType, MsgUpdateGroupPolicyDecisionPolicy, MsgUpdateGroupPolicyDecisionPolicySDKType, MsgUpdateGroupPolicyMetadata, MsgUpdateGroupPolicyMetadataSDKType, MsgSubmitProposal, MsgSubmitProposalSDKType, MsgWithdrawProposal, MsgWithdrawProposalSDKType, MsgVote, MsgVoteSDKType, MsgExec, MsgExecSDKType, MsgLeaveGroup, MsgLeaveGroupSDKType } from "./tx"; export interface MsgCreateGroupAminoType extends AminoMsg { type: "cosmos-sdk/MsgCreateGroup"; 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 b821652035..acd413bd4d 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.js"; -import { Any, AnySDKType } from "../../../google/protobuf/any.js"; +import { Member, MemberSDKType, VoteOption, VoteOptionSDKType } from "./types"; +import { Any, AnySDKType } from "../../../google/protobuf/any"; 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.js"; +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"; 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 fb494e3543..67b6593653 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.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"; +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"; /** 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 781a3a119b..1fe400de41 100644 --- a/__fixtures__/v-next/outputv4/cosmos/group/v1/tx.ts +++ b/__fixtures__/v-next/outputv4/cosmos/group/v1/tx.ts @@ -1,8 +1,9 @@ -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"; +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"; export const protobufPackage = "cosmos.group.v1"; /** Exec defines modes of execution of a proposal on creation or on new vote. */ export enum Exec { @@ -55,6 +56,11 @@ export interface MsgCreateGroup { /** metadata is any arbitrary metadata to attached to the group. */ metadata: string; } +export interface ReactiveMsgCreateGroup { + admin: ComputedRef<string>; + members: ComputedRef<Member[]>; + metadata: ComputedRef<string>; +} export interface MsgCreateGroupProtoMsg { typeUrl: "/cosmos.group.v1.MsgCreateGroup"; value: Uint8Array; @@ -70,6 +76,9 @@ export interface MsgCreateGroupResponse { /** group_id is the unique ID of the newly created group. */ groupId: bigint; } +export interface ReactiveMsgCreateGroupResponse { + groupId: ComputedRef<bigint>; +} export interface MsgCreateGroupResponseProtoMsg { typeUrl: "/cosmos.group.v1.MsgCreateGroupResponse"; value: Uint8Array; @@ -90,6 +99,11 @@ export interface MsgUpdateGroupMembers { */ memberUpdates: Member[]; } +export interface ReactiveMsgUpdateGroupMembers { + admin: ComputedRef<string>; + groupId: ComputedRef<bigint>; + memberUpdates: ComputedRef<Member[]>; +} export interface MsgUpdateGroupMembersProtoMsg { typeUrl: "/cosmos.group.v1.MsgUpdateGroupMembers"; value: Uint8Array; @@ -102,6 +116,7 @@ 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; @@ -117,6 +132,11 @@ export interface MsgUpdateGroupAdmin { /** new_admin is the group new admin account address. */ newAdmin: string; } +export interface ReactiveMsgUpdateGroupAdmin { + admin: ComputedRef<string>; + groupId: ComputedRef<bigint>; + newAdmin: ComputedRef<string>; +} export interface MsgUpdateGroupAdminProtoMsg { typeUrl: "/cosmos.group.v1.MsgUpdateGroupAdmin"; value: Uint8Array; @@ -129,6 +149,7 @@ 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; @@ -144,6 +165,11 @@ export interface MsgUpdateGroupMetadata { /** metadata is the updated group's metadata. */ metadata: string; } +export interface ReactiveMsgUpdateGroupMetadata { + admin: ComputedRef<string>; + groupId: ComputedRef<bigint>; + metadata: ComputedRef<string>; +} export interface MsgUpdateGroupMetadataProtoMsg { typeUrl: "/cosmos.group.v1.MsgUpdateGroupMetadata"; value: Uint8Array; @@ -156,6 +182,7 @@ 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; @@ -173,6 +200,12 @@ export interface MsgCreateGroupPolicy { /** decision_policy specifies the group policy's decision policy. */ decisionPolicy?: Any; } +export interface ReactiveMsgCreateGroupPolicy { + admin: ComputedRef<string>; + groupId: ComputedRef<bigint>; + metadata: ComputedRef<string>; + decisionPolicy?: ComputedRef<Any>; +} export interface MsgCreateGroupPolicyProtoMsg { typeUrl: "/cosmos.group.v1.MsgCreateGroupPolicy"; value: Uint8Array; @@ -189,6 +222,9 @@ export interface MsgCreateGroupPolicyResponse { /** address is the account address of the newly created group policy. */ address: string; } +export interface ReactiveMsgCreateGroupPolicyResponse { + address: ComputedRef<string>; +} export interface MsgCreateGroupPolicyResponseProtoMsg { typeUrl: "/cosmos.group.v1.MsgCreateGroupPolicyResponse"; value: Uint8Array; @@ -206,6 +242,11 @@ export interface MsgUpdateGroupPolicyAdmin { /** new_admin is the new group policy admin. */ newAdmin: string; } +export interface ReactiveMsgUpdateGroupPolicyAdmin { + admin: ComputedRef<string>; + address: ComputedRef<string>; + newAdmin: ComputedRef<string>; +} export interface MsgUpdateGroupPolicyAdminProtoMsg { typeUrl: "/cosmos.group.v1.MsgUpdateGroupPolicyAdmin"; value: Uint8Array; @@ -231,6 +272,14 @@ export interface MsgCreateGroupWithPolicy { /** decision_policy specifies the group policy's decision policy. */ decisionPolicy?: Any; } +export interface ReactiveMsgCreateGroupWithPolicy { + admin: ComputedRef<string>; + members: ComputedRef<Member[]>; + groupMetadata: ComputedRef<string>; + groupPolicyMetadata: ComputedRef<string>; + groupPolicyAsAdmin: ComputedRef<boolean>; + decisionPolicy?: ComputedRef<Any>; +} export interface MsgCreateGroupWithPolicyProtoMsg { typeUrl: "/cosmos.group.v1.MsgCreateGroupWithPolicy"; value: Uint8Array; @@ -251,6 +300,10 @@ export interface MsgCreateGroupWithPolicyResponse { /** group_policy_address is the account address of the newly created group policy. */ groupPolicyAddress: string; } +export interface ReactiveMsgCreateGroupWithPolicyResponse { + groupId: ComputedRef<bigint>; + groupPolicyAddress: ComputedRef<string>; +} export interface MsgCreateGroupWithPolicyResponseProtoMsg { typeUrl: "/cosmos.group.v1.MsgCreateGroupWithPolicyResponse"; value: Uint8Array; @@ -262,6 +315,7 @@ 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; @@ -277,6 +331,11 @@ export interface MsgUpdateGroupPolicyDecisionPolicy { /** decision_policy is the updated group policy's decision policy. */ decisionPolicy?: Any; } +export interface ReactiveMsgUpdateGroupPolicyDecisionPolicy { + admin: ComputedRef<string>; + address: ComputedRef<string>; + decisionPolicy?: ComputedRef<Any>; +} export interface MsgUpdateGroupPolicyDecisionPolicyProtoMsg { typeUrl: "/cosmos.group.v1.MsgUpdateGroupPolicyDecisionPolicy"; value: Uint8Array; @@ -289,6 +348,7 @@ 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; @@ -304,6 +364,11 @@ export interface MsgUpdateGroupPolicyMetadata { /** metadata is the updated group policy metadata. */ metadata: string; } +export interface ReactiveMsgUpdateGroupPolicyMetadata { + admin: ComputedRef<string>; + address: ComputedRef<string>; + metadata: ComputedRef<string>; +} export interface MsgUpdateGroupPolicyMetadataProtoMsg { typeUrl: "/cosmos.group.v1.MsgUpdateGroupPolicyMetadata"; value: Uint8Array; @@ -316,6 +381,7 @@ 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; @@ -342,6 +408,13 @@ export interface MsgSubmitProposal { */ exec: Exec; } +export interface ReactiveMsgSubmitProposal { + address: ComputedRef<string>; + proposers: ComputedRef<string[]>; + metadata: ComputedRef<string>; + messages: ComputedRef<Any[]>; + exec: ComputedRef<Exec>; +} export interface MsgSubmitProposalProtoMsg { typeUrl: "/cosmos.group.v1.MsgSubmitProposal"; value: Uint8Array; @@ -359,6 +432,9 @@ export interface MsgSubmitProposalResponse { /** proposal is the unique ID of the proposal. */ proposalId: bigint; } +export interface ReactiveMsgSubmitProposalResponse { + proposalId: ComputedRef<bigint>; +} export interface MsgSubmitProposalResponseProtoMsg { typeUrl: "/cosmos.group.v1.MsgSubmitProposalResponse"; value: Uint8Array; @@ -374,6 +450,10 @@ 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<bigint>; + address: ComputedRef<string>; +} export interface MsgWithdrawProposalProtoMsg { typeUrl: "/cosmos.group.v1.MsgWithdrawProposal"; value: Uint8Array; @@ -385,6 +465,7 @@ 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; @@ -407,6 +488,13 @@ export interface MsgVote { */ exec: Exec; } +export interface ReactiveMsgVote { + proposalId: ComputedRef<bigint>; + voter: ComputedRef<string>; + option: ComputedRef<VoteOption>; + metadata: ComputedRef<string>; + exec: ComputedRef<Exec>; +} export interface MsgVoteProtoMsg { typeUrl: "/cosmos.group.v1.MsgVote"; value: Uint8Array; @@ -421,6 +509,7 @@ 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; @@ -434,6 +523,10 @@ export interface MsgExec { /** signer is the account address used to execute the proposal. */ signer: string; } +export interface ReactiveMsgExec { + proposalId: ComputedRef<bigint>; + signer: ComputedRef<string>; +} export interface MsgExecProtoMsg { typeUrl: "/cosmos.group.v1.MsgExec"; value: Uint8Array; @@ -445,6 +538,7 @@ 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; @@ -458,6 +552,10 @@ export interface MsgLeaveGroup { /** group_id is the unique ID of the group. */ groupId: bigint; } +export interface ReactiveMsgLeaveGroup { + address: ComputedRef<string>; + groupId: ComputedRef<bigint>; +} export interface MsgLeaveGroupProtoMsg { typeUrl: "/cosmos.group.v1.MsgLeaveGroup"; value: Uint8Array; @@ -469,6 +567,7 @@ 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; @@ -485,13 +584,13 @@ function createBaseMsgCreateGroup(): MsgCreateGroup { export const MsgCreateGroup = { typeUrl: "/cosmos.group.v1.MsgCreateGroup", encode(message: MsgCreateGroup, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.admin !== undefined) { + if (message.admin !== "") { writer.uint32(10).string(message.admin); } for (const v of message.members) { Member.encode(v!, writer.uint32(18).fork()).ldelim(); } - if (message.metadata !== undefined) { + if (message.metadata !== "") { writer.uint32(26).string(message.metadata); } return writer; @@ -520,11 +619,11 @@ export const MsgCreateGroup = { return message; }, fromJSON(object: any): MsgCreateGroup { - 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; + 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) : "" + }; }, toJSON(message: MsgCreateGroup): JsonSafe<MsgCreateGroup> { const obj: any = {}; @@ -621,7 +720,7 @@ function createBaseMsgCreateGroupResponse(): MsgCreateGroupResponse { export const MsgCreateGroupResponse = { typeUrl: "/cosmos.group.v1.MsgCreateGroupResponse", encode(message: MsgCreateGroupResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.groupId !== undefined) { + if (message.groupId !== BigInt(0)) { writer.uint32(8).uint64(message.groupId); } return writer; @@ -644,9 +743,9 @@ export const MsgCreateGroupResponse = { return message; }, fromJSON(object: any): MsgCreateGroupResponse { - const obj = createBaseMsgCreateGroupResponse(); - if (isSet(object.groupId)) obj.groupId = BigInt(object.groupId.toString()); - return obj; + return { + groupId: isSet(object.groupId) ? BigInt(object.groupId.toString()) : BigInt(0) + }; }, toJSON(message: MsgCreateGroupResponse): JsonSafe<MsgCreateGroupResponse> { const obj: any = {}; @@ -655,9 +754,7 @@ export const MsgCreateGroupResponse = { }, fromPartial(object: DeepPartial<MsgCreateGroupResponse>): MsgCreateGroupResponse { const message = createBaseMsgCreateGroupResponse(); - if (object.groupId !== undefined && object.groupId !== null) { - message.groupId = BigInt(object.groupId.toString()); - } + message.groupId = object.groupId !== undefined && object.groupId !== null ? BigInt(object.groupId.toString()) : BigInt(0); return message; }, fromSDK(object: MsgCreateGroupResponseSDKType): MsgCreateGroupResponse { @@ -719,10 +816,10 @@ function createBaseMsgUpdateGroupMembers(): MsgUpdateGroupMembers { export const MsgUpdateGroupMembers = { typeUrl: "/cosmos.group.v1.MsgUpdateGroupMembers", encode(message: MsgUpdateGroupMembers, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.admin !== undefined) { + if (message.admin !== "") { writer.uint32(10).string(message.admin); } - if (message.groupId !== undefined) { + if (message.groupId !== BigInt(0)) { writer.uint32(16).uint64(message.groupId); } for (const v of message.memberUpdates) { @@ -754,11 +851,11 @@ export const MsgUpdateGroupMembers = { return message; }, fromJSON(object: any): MsgUpdateGroupMembers { - 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; + 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)) : [] + }; }, toJSON(message: MsgUpdateGroupMembers): JsonSafe<MsgUpdateGroupMembers> { const obj: any = {}; @@ -774,9 +871,7 @@ export const MsgUpdateGroupMembers = { fromPartial(object: DeepPartial<MsgUpdateGroupMembers>): MsgUpdateGroupMembers { const message = createBaseMsgUpdateGroupMembers(); message.admin = object.admin ?? ""; - if (object.groupId !== undefined && object.groupId !== null) { - message.groupId = BigInt(object.groupId.toString()); - } + message.groupId = object.groupId !== undefined && object.groupId !== null ? BigInt(object.groupId.toString()) : BigInt(0); message.memberUpdates = object.memberUpdates?.map(e => Member.fromPartial(e)) || []; return message; }, @@ -872,8 +967,7 @@ export const MsgUpdateGroupMembersResponse = { return message; }, fromJSON(_: any): MsgUpdateGroupMembersResponse { - const obj = createBaseMsgUpdateGroupMembersResponse(); - return obj; + return {}; }, toJSON(_: MsgUpdateGroupMembersResponse): JsonSafe<MsgUpdateGroupMembersResponse> { const obj: any = {}; @@ -933,13 +1027,13 @@ function createBaseMsgUpdateGroupAdmin(): MsgUpdateGroupAdmin { export const MsgUpdateGroupAdmin = { typeUrl: "/cosmos.group.v1.MsgUpdateGroupAdmin", encode(message: MsgUpdateGroupAdmin, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.admin !== undefined) { + if (message.admin !== "") { writer.uint32(10).string(message.admin); } - if (message.groupId !== undefined) { + if (message.groupId !== BigInt(0)) { writer.uint32(16).uint64(message.groupId); } - if (message.newAdmin !== undefined) { + if (message.newAdmin !== "") { writer.uint32(26).string(message.newAdmin); } return writer; @@ -968,11 +1062,11 @@ export const MsgUpdateGroupAdmin = { return message; }, fromJSON(object: any): MsgUpdateGroupAdmin { - 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; + 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) : "" + }; }, toJSON(message: MsgUpdateGroupAdmin): JsonSafe<MsgUpdateGroupAdmin> { const obj: any = {}; @@ -984,9 +1078,7 @@ export const MsgUpdateGroupAdmin = { fromPartial(object: DeepPartial<MsgUpdateGroupAdmin>): MsgUpdateGroupAdmin { const message = createBaseMsgUpdateGroupAdmin(); message.admin = object.admin ?? ""; - if (object.groupId !== undefined && object.groupId !== null) { - message.groupId = BigInt(object.groupId.toString()); - } + message.groupId = object.groupId !== undefined && object.groupId !== null ? BigInt(object.groupId.toString()) : BigInt(0); message.newAdmin = object.newAdmin ?? ""; return message; }, @@ -1076,8 +1168,7 @@ export const MsgUpdateGroupAdminResponse = { return message; }, fromJSON(_: any): MsgUpdateGroupAdminResponse { - const obj = createBaseMsgUpdateGroupAdminResponse(); - return obj; + return {}; }, toJSON(_: MsgUpdateGroupAdminResponse): JsonSafe<MsgUpdateGroupAdminResponse> { const obj: any = {}; @@ -1137,13 +1228,13 @@ function createBaseMsgUpdateGroupMetadata(): MsgUpdateGroupMetadata { export const MsgUpdateGroupMetadata = { typeUrl: "/cosmos.group.v1.MsgUpdateGroupMetadata", encode(message: MsgUpdateGroupMetadata, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.admin !== undefined) { + if (message.admin !== "") { writer.uint32(10).string(message.admin); } - if (message.groupId !== undefined) { + if (message.groupId !== BigInt(0)) { writer.uint32(16).uint64(message.groupId); } - if (message.metadata !== undefined) { + if (message.metadata !== "") { writer.uint32(26).string(message.metadata); } return writer; @@ -1172,11 +1263,11 @@ export const MsgUpdateGroupMetadata = { return message; }, fromJSON(object: any): MsgUpdateGroupMetadata { - 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; + 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) : "" + }; }, toJSON(message: MsgUpdateGroupMetadata): JsonSafe<MsgUpdateGroupMetadata> { const obj: any = {}; @@ -1188,9 +1279,7 @@ export const MsgUpdateGroupMetadata = { fromPartial(object: DeepPartial<MsgUpdateGroupMetadata>): MsgUpdateGroupMetadata { const message = createBaseMsgUpdateGroupMetadata(); message.admin = object.admin ?? ""; - if (object.groupId !== undefined && object.groupId !== null) { - message.groupId = BigInt(object.groupId.toString()); - } + message.groupId = object.groupId !== undefined && object.groupId !== null ? BigInt(object.groupId.toString()) : BigInt(0); message.metadata = object.metadata ?? ""; return message; }, @@ -1280,8 +1369,7 @@ export const MsgUpdateGroupMetadataResponse = { return message; }, fromJSON(_: any): MsgUpdateGroupMetadataResponse { - const obj = createBaseMsgUpdateGroupMetadataResponse(); - return obj; + return {}; }, toJSON(_: MsgUpdateGroupMetadataResponse): JsonSafe<MsgUpdateGroupMetadataResponse> { const obj: any = {}; @@ -1342,13 +1430,13 @@ function createBaseMsgCreateGroupPolicy(): MsgCreateGroupPolicy { export const MsgCreateGroupPolicy = { typeUrl: "/cosmos.group.v1.MsgCreateGroupPolicy", encode(message: MsgCreateGroupPolicy, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.admin !== undefined) { + if (message.admin !== "") { writer.uint32(10).string(message.admin); } - if (message.groupId !== undefined) { + if (message.groupId !== BigInt(0)) { writer.uint32(16).uint64(message.groupId); } - if (message.metadata !== undefined) { + if (message.metadata !== "") { writer.uint32(26).string(message.metadata); } if (message.decisionPolicy !== undefined) { @@ -1383,12 +1471,12 @@ export const MsgCreateGroupPolicy = { return message; }, fromJSON(object: any): MsgCreateGroupPolicy { - 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; + 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 + }; }, toJSON(message: MsgCreateGroupPolicy): JsonSafe<MsgCreateGroupPolicy> { const obj: any = {}; @@ -1401,13 +1489,9 @@ export const MsgCreateGroupPolicy = { fromPartial(object: DeepPartial<MsgCreateGroupPolicy>): MsgCreateGroupPolicy { const message = createBaseMsgCreateGroupPolicy(); message.admin = object.admin ?? ""; - if (object.groupId !== undefined && object.groupId !== null) { - message.groupId = BigInt(object.groupId.toString()); - } + message.groupId = object.groupId !== undefined && object.groupId !== null ? BigInt(object.groupId.toString()) : BigInt(0); message.metadata = object.metadata ?? ""; - if (object.decisionPolicy !== undefined && object.decisionPolicy !== null) { - message.decisionPolicy = Any.fromPartial(object.decisionPolicy); - } + message.decisionPolicy = object.decisionPolicy !== undefined && object.decisionPolicy !== null ? Any.fromPartial(object.decisionPolicy) : undefined; return message; }, fromSDK(object: MsgCreateGroupPolicySDKType): MsgCreateGroupPolicy { @@ -1488,7 +1572,7 @@ function createBaseMsgCreateGroupPolicyResponse(): MsgCreateGroupPolicyResponse export const MsgCreateGroupPolicyResponse = { typeUrl: "/cosmos.group.v1.MsgCreateGroupPolicyResponse", encode(message: MsgCreateGroupPolicyResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.address !== undefined) { + if (message.address !== "") { writer.uint32(10).string(message.address); } return writer; @@ -1511,9 +1595,9 @@ export const MsgCreateGroupPolicyResponse = { return message; }, fromJSON(object: any): MsgCreateGroupPolicyResponse { - const obj = createBaseMsgCreateGroupPolicyResponse(); - if (isSet(object.address)) obj.address = String(object.address); - return obj; + return { + address: isSet(object.address) ? String(object.address) : "" + }; }, toJSON(message: MsgCreateGroupPolicyResponse): JsonSafe<MsgCreateGroupPolicyResponse> { const obj: any = {}; @@ -1584,13 +1668,13 @@ function createBaseMsgUpdateGroupPolicyAdmin(): MsgUpdateGroupPolicyAdmin { export const MsgUpdateGroupPolicyAdmin = { typeUrl: "/cosmos.group.v1.MsgUpdateGroupPolicyAdmin", encode(message: MsgUpdateGroupPolicyAdmin, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.admin !== undefined) { + if (message.admin !== "") { writer.uint32(10).string(message.admin); } - if (message.address !== undefined) { + if (message.address !== "") { writer.uint32(18).string(message.address); } - if (message.newAdmin !== undefined) { + if (message.newAdmin !== "") { writer.uint32(26).string(message.newAdmin); } return writer; @@ -1619,11 +1703,11 @@ export const MsgUpdateGroupPolicyAdmin = { return message; }, fromJSON(object: any): MsgUpdateGroupPolicyAdmin { - 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; + return { + admin: isSet(object.admin) ? String(object.admin) : "", + address: isSet(object.address) ? String(object.address) : "", + newAdmin: isSet(object.newAdmin) ? String(object.newAdmin) : "" + }; }, toJSON(message: MsgUpdateGroupPolicyAdmin): JsonSafe<MsgUpdateGroupPolicyAdmin> { const obj: any = {}; @@ -1715,19 +1799,19 @@ function createBaseMsgCreateGroupWithPolicy(): MsgCreateGroupWithPolicy { export const MsgCreateGroupWithPolicy = { typeUrl: "/cosmos.group.v1.MsgCreateGroupWithPolicy", encode(message: MsgCreateGroupWithPolicy, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.admin !== undefined) { + if (message.admin !== "") { writer.uint32(10).string(message.admin); } for (const v of message.members) { Member.encode(v!, writer.uint32(18).fork()).ldelim(); } - if (message.groupMetadata !== undefined) { + if (message.groupMetadata !== "") { writer.uint32(26).string(message.groupMetadata); } - if (message.groupPolicyMetadata !== undefined) { + if (message.groupPolicyMetadata !== "") { writer.uint32(34).string(message.groupPolicyMetadata); } - if (message.groupPolicyAsAdmin !== undefined) { + if (message.groupPolicyAsAdmin === true) { writer.uint32(40).bool(message.groupPolicyAsAdmin); } if (message.decisionPolicy !== undefined) { @@ -1768,14 +1852,14 @@ export const MsgCreateGroupWithPolicy = { return message; }, fromJSON(object: any): MsgCreateGroupWithPolicy { - 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; + 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 + }; }, toJSON(message: MsgCreateGroupWithPolicy): JsonSafe<MsgCreateGroupWithPolicy> { const obj: any = {}; @@ -1798,9 +1882,7 @@ export const MsgCreateGroupWithPolicy = { message.groupMetadata = object.groupMetadata ?? ""; message.groupPolicyMetadata = object.groupPolicyMetadata ?? ""; message.groupPolicyAsAdmin = object.groupPolicyAsAdmin ?? false; - if (object.decisionPolicy !== undefined && object.decisionPolicy !== null) { - message.decisionPolicy = Any.fromPartial(object.decisionPolicy); - } + message.decisionPolicy = object.decisionPolicy !== undefined && object.decisionPolicy !== null ? Any.fromPartial(object.decisionPolicy) : undefined; return message; }, fromSDK(object: MsgCreateGroupWithPolicySDKType): MsgCreateGroupWithPolicy { @@ -1902,10 +1984,10 @@ function createBaseMsgCreateGroupWithPolicyResponse(): MsgCreateGroupWithPolicyR export const MsgCreateGroupWithPolicyResponse = { typeUrl: "/cosmos.group.v1.MsgCreateGroupWithPolicyResponse", encode(message: MsgCreateGroupWithPolicyResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.groupId !== undefined) { + if (message.groupId !== BigInt(0)) { writer.uint32(8).uint64(message.groupId); } - if (message.groupPolicyAddress !== undefined) { + if (message.groupPolicyAddress !== "") { writer.uint32(18).string(message.groupPolicyAddress); } return writer; @@ -1931,10 +2013,10 @@ export const MsgCreateGroupWithPolicyResponse = { return message; }, fromJSON(object: any): MsgCreateGroupWithPolicyResponse { - const obj = createBaseMsgCreateGroupWithPolicyResponse(); - if (isSet(object.groupId)) obj.groupId = BigInt(object.groupId.toString()); - if (isSet(object.groupPolicyAddress)) obj.groupPolicyAddress = String(object.groupPolicyAddress); - return obj; + return { + groupId: isSet(object.groupId) ? BigInt(object.groupId.toString()) : BigInt(0), + groupPolicyAddress: isSet(object.groupPolicyAddress) ? String(object.groupPolicyAddress) : "" + }; }, toJSON(message: MsgCreateGroupWithPolicyResponse): JsonSafe<MsgCreateGroupWithPolicyResponse> { const obj: any = {}; @@ -1944,9 +2026,7 @@ export const MsgCreateGroupWithPolicyResponse = { }, fromPartial(object: DeepPartial<MsgCreateGroupWithPolicyResponse>): MsgCreateGroupWithPolicyResponse { const message = createBaseMsgCreateGroupWithPolicyResponse(); - if (object.groupId !== undefined && object.groupId !== null) { - message.groupId = BigInt(object.groupId.toString()); - } + message.groupId = object.groupId !== undefined && object.groupId !== null ? BigInt(object.groupId.toString()) : BigInt(0); message.groupPolicyAddress = object.groupPolicyAddress ?? ""; return message; }, @@ -2029,8 +2109,7 @@ export const MsgUpdateGroupPolicyAdminResponse = { return message; }, fromJSON(_: any): MsgUpdateGroupPolicyAdminResponse { - const obj = createBaseMsgUpdateGroupPolicyAdminResponse(); - return obj; + return {}; }, toJSON(_: MsgUpdateGroupPolicyAdminResponse): JsonSafe<MsgUpdateGroupPolicyAdminResponse> { const obj: any = {}; @@ -2090,10 +2169,10 @@ function createBaseMsgUpdateGroupPolicyDecisionPolicy(): MsgUpdateGroupPolicyDec export const MsgUpdateGroupPolicyDecisionPolicy = { typeUrl: "/cosmos.group.v1.MsgUpdateGroupPolicyDecisionPolicy", encode(message: MsgUpdateGroupPolicyDecisionPolicy, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.admin !== undefined) { + if (message.admin !== "") { writer.uint32(10).string(message.admin); } - if (message.address !== undefined) { + if (message.address !== "") { writer.uint32(18).string(message.address); } if (message.decisionPolicy !== undefined) { @@ -2125,11 +2204,11 @@ export const MsgUpdateGroupPolicyDecisionPolicy = { return message; }, fromJSON(object: any): MsgUpdateGroupPolicyDecisionPolicy { - 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; + return { + admin: isSet(object.admin) ? String(object.admin) : "", + address: isSet(object.address) ? String(object.address) : "", + decisionPolicy: isSet(object.decisionPolicy) ? Any.fromJSON(object.decisionPolicy) : undefined + }; }, toJSON(message: MsgUpdateGroupPolicyDecisionPolicy): JsonSafe<MsgUpdateGroupPolicyDecisionPolicy> { const obj: any = {}; @@ -2142,9 +2221,7 @@ export const MsgUpdateGroupPolicyDecisionPolicy = { const message = createBaseMsgUpdateGroupPolicyDecisionPolicy(); message.admin = object.admin ?? ""; message.address = object.address ?? ""; - if (object.decisionPolicy !== undefined && object.decisionPolicy !== null) { - message.decisionPolicy = Any.fromPartial(object.decisionPolicy); - } + message.decisionPolicy = object.decisionPolicy !== undefined && object.decisionPolicy !== null ? Any.fromPartial(object.decisionPolicy) : undefined; return message; }, fromSDK(object: MsgUpdateGroupPolicyDecisionPolicySDKType): MsgUpdateGroupPolicyDecisionPolicy { @@ -2233,8 +2310,7 @@ export const MsgUpdateGroupPolicyDecisionPolicyResponse = { return message; }, fromJSON(_: any): MsgUpdateGroupPolicyDecisionPolicyResponse { - const obj = createBaseMsgUpdateGroupPolicyDecisionPolicyResponse(); - return obj; + return {}; }, toJSON(_: MsgUpdateGroupPolicyDecisionPolicyResponse): JsonSafe<MsgUpdateGroupPolicyDecisionPolicyResponse> { const obj: any = {}; @@ -2294,13 +2370,13 @@ function createBaseMsgUpdateGroupPolicyMetadata(): MsgUpdateGroupPolicyMetadata export const MsgUpdateGroupPolicyMetadata = { typeUrl: "/cosmos.group.v1.MsgUpdateGroupPolicyMetadata", encode(message: MsgUpdateGroupPolicyMetadata, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.admin !== undefined) { + if (message.admin !== "") { writer.uint32(10).string(message.admin); } - if (message.address !== undefined) { + if (message.address !== "") { writer.uint32(18).string(message.address); } - if (message.metadata !== undefined) { + if (message.metadata !== "") { writer.uint32(26).string(message.metadata); } return writer; @@ -2329,11 +2405,11 @@ export const MsgUpdateGroupPolicyMetadata = { return message; }, fromJSON(object: any): MsgUpdateGroupPolicyMetadata { - 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; + return { + admin: isSet(object.admin) ? String(object.admin) : "", + address: isSet(object.address) ? String(object.address) : "", + metadata: isSet(object.metadata) ? String(object.metadata) : "" + }; }, toJSON(message: MsgUpdateGroupPolicyMetadata): JsonSafe<MsgUpdateGroupPolicyMetadata> { const obj: any = {}; @@ -2435,8 +2511,7 @@ export const MsgUpdateGroupPolicyMetadataResponse = { return message; }, fromJSON(_: any): MsgUpdateGroupPolicyMetadataResponse { - const obj = createBaseMsgUpdateGroupPolicyMetadataResponse(); - return obj; + return {}; }, toJSON(_: MsgUpdateGroupPolicyMetadataResponse): JsonSafe<MsgUpdateGroupPolicyMetadataResponse> { const obj: any = {}; @@ -2498,13 +2573,13 @@ function createBaseMsgSubmitProposal(): MsgSubmitProposal { export const MsgSubmitProposal = { typeUrl: "/cosmos.group.v1.MsgSubmitProposal", encode(message: MsgSubmitProposal, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.address !== undefined) { + if (message.address !== "") { writer.uint32(10).string(message.address); } for (const v of message.proposers) { writer.uint32(18).string(v!); } - if (message.metadata !== undefined) { + if (message.metadata !== "") { writer.uint32(26).string(message.metadata); } for (const v of message.messages) { @@ -2545,13 +2620,13 @@ export const MsgSubmitProposal = { return message; }, fromJSON(object: any): MsgSubmitProposal { - 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; + 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 + }; }, toJSON(message: MsgSubmitProposal): JsonSafe<MsgSubmitProposal> { const obj: any = {}; @@ -2676,7 +2751,7 @@ function createBaseMsgSubmitProposalResponse(): MsgSubmitProposalResponse { export const MsgSubmitProposalResponse = { typeUrl: "/cosmos.group.v1.MsgSubmitProposalResponse", encode(message: MsgSubmitProposalResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.proposalId !== undefined) { + if (message.proposalId !== BigInt(0)) { writer.uint32(8).uint64(message.proposalId); } return writer; @@ -2699,9 +2774,9 @@ export const MsgSubmitProposalResponse = { return message; }, fromJSON(object: any): MsgSubmitProposalResponse { - const obj = createBaseMsgSubmitProposalResponse(); - if (isSet(object.proposalId)) obj.proposalId = BigInt(object.proposalId.toString()); - return obj; + return { + proposalId: isSet(object.proposalId) ? BigInt(object.proposalId.toString()) : BigInt(0) + }; }, toJSON(message: MsgSubmitProposalResponse): JsonSafe<MsgSubmitProposalResponse> { const obj: any = {}; @@ -2710,9 +2785,7 @@ export const MsgSubmitProposalResponse = { }, fromPartial(object: DeepPartial<MsgSubmitProposalResponse>): MsgSubmitProposalResponse { const message = createBaseMsgSubmitProposalResponse(); - if (object.proposalId !== undefined && object.proposalId !== null) { - message.proposalId = BigInt(object.proposalId.toString()); - } + message.proposalId = object.proposalId !== undefined && object.proposalId !== null ? BigInt(object.proposalId.toString()) : BigInt(0); return message; }, fromSDK(object: MsgSubmitProposalResponseSDKType): MsgSubmitProposalResponse { @@ -2773,10 +2846,10 @@ function createBaseMsgWithdrawProposal(): MsgWithdrawProposal { export const MsgWithdrawProposal = { typeUrl: "/cosmos.group.v1.MsgWithdrawProposal", encode(message: MsgWithdrawProposal, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.proposalId !== undefined) { + if (message.proposalId !== BigInt(0)) { writer.uint32(8).uint64(message.proposalId); } - if (message.address !== undefined) { + if (message.address !== "") { writer.uint32(18).string(message.address); } return writer; @@ -2802,10 +2875,10 @@ export const MsgWithdrawProposal = { return message; }, fromJSON(object: any): MsgWithdrawProposal { - const obj = createBaseMsgWithdrawProposal(); - if (isSet(object.proposalId)) obj.proposalId = BigInt(object.proposalId.toString()); - if (isSet(object.address)) obj.address = String(object.address); - return obj; + return { + proposalId: isSet(object.proposalId) ? BigInt(object.proposalId.toString()) : BigInt(0), + address: isSet(object.address) ? String(object.address) : "" + }; }, toJSON(message: MsgWithdrawProposal): JsonSafe<MsgWithdrawProposal> { const obj: any = {}; @@ -2815,9 +2888,7 @@ export const MsgWithdrawProposal = { }, fromPartial(object: DeepPartial<MsgWithdrawProposal>): MsgWithdrawProposal { const message = createBaseMsgWithdrawProposal(); - if (object.proposalId !== undefined && object.proposalId !== null) { - message.proposalId = BigInt(object.proposalId.toString()); - } + message.proposalId = object.proposalId !== undefined && object.proposalId !== null ? BigInt(object.proposalId.toString()) : BigInt(0); message.address = object.address ?? ""; return message; }, @@ -2900,8 +2971,7 @@ export const MsgWithdrawProposalResponse = { return message; }, fromJSON(_: any): MsgWithdrawProposalResponse { - const obj = createBaseMsgWithdrawProposalResponse(); - return obj; + return {}; }, toJSON(_: MsgWithdrawProposalResponse): JsonSafe<MsgWithdrawProposalResponse> { const obj: any = {}; @@ -2963,16 +3033,16 @@ function createBaseMsgVote(): MsgVote { export const MsgVote = { typeUrl: "/cosmos.group.v1.MsgVote", encode(message: MsgVote, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.proposalId !== undefined) { + if (message.proposalId !== BigInt(0)) { writer.uint32(8).uint64(message.proposalId); } - if (message.voter !== undefined) { + if (message.voter !== "") { writer.uint32(18).string(message.voter); } if (message.option !== 0) { writer.uint32(24).int32(message.option); } - if (message.metadata !== undefined) { + if (message.metadata !== "") { writer.uint32(34).string(message.metadata); } if (message.exec !== 0) { @@ -3010,13 +3080,13 @@ export const MsgVote = { return message; }, fromJSON(object: any): MsgVote { - 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; + 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 + }; }, toJSON(message: MsgVote): JsonSafe<MsgVote> { const obj: any = {}; @@ -3029,9 +3099,7 @@ export const MsgVote = { }, fromPartial(object: DeepPartial<MsgVote>): MsgVote { const message = createBaseMsgVote(); - if (object.proposalId !== undefined && object.proposalId !== null) { - message.proposalId = BigInt(object.proposalId.toString()); - } + message.proposalId = object.proposalId !== undefined && object.proposalId !== null ? BigInt(object.proposalId.toString()) : BigInt(0); message.voter = object.voter ?? ""; message.option = object.option ?? 0; message.metadata = object.metadata ?? ""; @@ -3138,8 +3206,7 @@ export const MsgVoteResponse = { return message; }, fromJSON(_: any): MsgVoteResponse { - const obj = createBaseMsgVoteResponse(); - return obj; + return {}; }, toJSON(_: MsgVoteResponse): JsonSafe<MsgVoteResponse> { const obj: any = {}; @@ -3198,10 +3265,10 @@ function createBaseMsgExec(): MsgExec { export const MsgExec = { typeUrl: "/cosmos.group.v1.MsgExec", encode(message: MsgExec, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.proposalId !== undefined) { + if (message.proposalId !== BigInt(0)) { writer.uint32(8).uint64(message.proposalId); } - if (message.signer !== undefined) { + if (message.signer !== "") { writer.uint32(18).string(message.signer); } return writer; @@ -3227,10 +3294,10 @@ export const MsgExec = { return message; }, fromJSON(object: any): MsgExec { - const obj = createBaseMsgExec(); - if (isSet(object.proposalId)) obj.proposalId = BigInt(object.proposalId.toString()); - if (isSet(object.signer)) obj.signer = String(object.signer); - return obj; + return { + proposalId: isSet(object.proposalId) ? BigInt(object.proposalId.toString()) : BigInt(0), + signer: isSet(object.signer) ? String(object.signer) : "" + }; }, toJSON(message: MsgExec): JsonSafe<MsgExec> { const obj: any = {}; @@ -3240,9 +3307,7 @@ export const MsgExec = { }, fromPartial(object: DeepPartial<MsgExec>): MsgExec { const message = createBaseMsgExec(); - if (object.proposalId !== undefined && object.proposalId !== null) { - message.proposalId = BigInt(object.proposalId.toString()); - } + message.proposalId = object.proposalId !== undefined && object.proposalId !== null ? BigInt(object.proposalId.toString()) : BigInt(0); message.signer = object.signer ?? ""; return message; }, @@ -3325,8 +3390,7 @@ export const MsgExecResponse = { return message; }, fromJSON(_: any): MsgExecResponse { - const obj = createBaseMsgExecResponse(); - return obj; + return {}; }, toJSON(_: MsgExecResponse): JsonSafe<MsgExecResponse> { const obj: any = {}; @@ -3385,10 +3449,10 @@ function createBaseMsgLeaveGroup(): MsgLeaveGroup { export const MsgLeaveGroup = { typeUrl: "/cosmos.group.v1.MsgLeaveGroup", encode(message: MsgLeaveGroup, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.address !== undefined) { + if (message.address !== "") { writer.uint32(10).string(message.address); } - if (message.groupId !== undefined) { + if (message.groupId !== BigInt(0)) { writer.uint32(16).uint64(message.groupId); } return writer; @@ -3414,10 +3478,10 @@ export const MsgLeaveGroup = { return message; }, fromJSON(object: any): MsgLeaveGroup { - const obj = createBaseMsgLeaveGroup(); - if (isSet(object.address)) obj.address = String(object.address); - if (isSet(object.groupId)) obj.groupId = BigInt(object.groupId.toString()); - return obj; + return { + address: isSet(object.address) ? String(object.address) : "", + groupId: isSet(object.groupId) ? BigInt(object.groupId.toString()) : BigInt(0) + }; }, toJSON(message: MsgLeaveGroup): JsonSafe<MsgLeaveGroup> { const obj: any = {}; @@ -3428,9 +3492,7 @@ export const MsgLeaveGroup = { fromPartial(object: DeepPartial<MsgLeaveGroup>): MsgLeaveGroup { const message = createBaseMsgLeaveGroup(); message.address = object.address ?? ""; - if (object.groupId !== undefined && object.groupId !== null) { - message.groupId = BigInt(object.groupId.toString()); - } + message.groupId = object.groupId !== undefined && object.groupId !== null ? BigInt(object.groupId.toString()) : BigInt(0); return message; }, fromSDK(object: MsgLeaveGroupSDKType): MsgLeaveGroup { @@ -3512,8 +3574,7 @@ export const MsgLeaveGroupResponse = { return message; }, fromJSON(_: any): MsgLeaveGroupResponse { - const obj = createBaseMsgLeaveGroupResponse(); - return obj; + return {}; }, toJSON(_: MsgLeaveGroupResponse): JsonSafe<MsgLeaveGroupResponse> { 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 c4caae9c4f..29c6d464a1 100644 --- a/__fixtures__/v-next/outputv4/cosmos/group/v1/types.ts +++ b/__fixtures__/v-next/outputv4/cosmos/group/v1/types.ts @@ -1,9 +1,10 @@ -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"; +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"; export const protobufPackage = "cosmos.group.v1"; /** VoteOption enumerates the valid vote options for a given proposal. */ export enum VoteOption { @@ -228,6 +229,12 @@ export interface Member { /** added_at is a timestamp specifying when a member was added. */ addedAt: Date; } +export interface ReactiveMember { + address: ComputedRef<string>; + weight: ComputedRef<string>; + metadata: ComputedRef<string>; + addedAt: ComputedRef<Date>; +} export interface MemberProtoMsg { typeUrl: "/cosmos.group.v1.Member"; value: Uint8Array; @@ -247,6 +254,9 @@ export interface Members { /** members is the list of members. */ members: Member[]; } +export interface ReactiveMembers { + members: ComputedRef<Member[]>; +} export interface MembersProtoMsg { typeUrl: "/cosmos.group.v1.Members"; value: Uint8Array; @@ -262,6 +272,10 @@ export interface ThresholdDecisionPolicy { /** windows defines the different windows for voting and execution. */ windows?: DecisionPolicyWindows; } +export interface ReactiveThresholdDecisionPolicy { + threshold: ComputedRef<string>; + windows?: ComputedRef<DecisionPolicyWindows>; +} export interface ThresholdDecisionPolicyProtoMsg { typeUrl: "/cosmos.group.v1.ThresholdDecisionPolicy"; value: Uint8Array; @@ -278,6 +292,10 @@ export interface PercentageDecisionPolicy { /** windows defines the different windows for voting and execution. */ windows?: DecisionPolicyWindows; } +export interface ReactivePercentageDecisionPolicy { + percentage: ComputedRef<string>; + windows?: ComputedRef<DecisionPolicyWindows>; +} export interface PercentageDecisionPolicyProtoMsg { typeUrl: "/cosmos.group.v1.PercentageDecisionPolicy"; value: Uint8Array; @@ -309,6 +327,10 @@ export interface DecisionPolicyWindows { */ minExecutionPeriod: Duration; } +export interface ReactiveDecisionPolicyWindows { + votingPeriod: ComputedRef<Duration>; + minExecutionPeriod: ComputedRef<Duration>; +} export interface DecisionPolicyWindowsProtoMsg { typeUrl: "/cosmos.group.v1.DecisionPolicyWindows"; value: Uint8Array; @@ -338,6 +360,14 @@ export interface GroupInfo { /** created_at is a timestamp specifying when a group was created. */ createdAt: Date; } +export interface ReactiveGroupInfo { + id: ComputedRef<bigint>; + admin: ComputedRef<string>; + metadata: ComputedRef<string>; + version: ComputedRef<bigint>; + totalWeight: ComputedRef<string>; + createdAt: ComputedRef<Date>; +} export interface GroupInfoProtoMsg { typeUrl: "/cosmos.group.v1.GroupInfo"; value: Uint8Array; @@ -358,6 +388,10 @@ export interface GroupMember { /** member is the member data. */ member?: Member; } +export interface ReactiveGroupMember { + groupId: ComputedRef<bigint>; + member?: ComputedRef<Member>; +} export interface GroupMemberProtoMsg { typeUrl: "/cosmos.group.v1.GroupMember"; value: Uint8Array; @@ -387,6 +421,15 @@ export interface GroupPolicyInfo { /** created_at is a timestamp specifying when a group policy was created. */ createdAt: Date; } +export interface ReactiveGroupPolicyInfo { + address: ComputedRef<string>; + groupId: ComputedRef<bigint>; + admin: ComputedRef<string>; + metadata: ComputedRef<string>; + version: ComputedRef<bigint>; + decisionPolicy?: ComputedRef<Any>; + createdAt: ComputedRef<Date>; +} export interface GroupPolicyInfoProtoMsg { typeUrl: "/cosmos.group.v1.GroupPolicyInfo"; value: Uint8Array; @@ -455,6 +498,21 @@ export interface Proposal { /** messages is a list of Msgs that will be executed if the proposal passes. */ messages: Any[]; } +export interface ReactiveProposal { + id: ComputedRef<bigint>; + address: ComputedRef<string>; + metadata: ComputedRef<string>; + proposers: ComputedRef<string[]>; + submitTime: ComputedRef<Date>; + groupVersion: ComputedRef<bigint>; + groupPolicyVersion: ComputedRef<bigint>; + status: ComputedRef<ProposalStatus>; + result: ComputedRef<ProposalResult>; + finalTallyResult: ComputedRef<TallyResult>; + votingPeriodEnd: ComputedRef<Date>; + executorResult: ComputedRef<ProposalExecutorResult>; + messages: ComputedRef<Any[]>; +} export interface ProposalProtoMsg { typeUrl: "/cosmos.group.v1.Proposal"; value: Uint8Array; @@ -491,6 +549,12 @@ export interface TallyResult { /** no_with_veto_count is the weighted sum of veto. */ noWithVetoCount: string; } +export interface ReactiveTallyResult { + yesCount: ComputedRef<string>; + abstainCount: ComputedRef<string>; + noCount: ComputedRef<string>; + noWithVetoCount: ComputedRef<string>; +} export interface TallyResultProtoMsg { typeUrl: "/cosmos.group.v1.TallyResult"; value: Uint8Array; @@ -515,6 +579,13 @@ export interface Vote { /** submit_time is the timestamp when the vote was submitted. */ submitTime: Date; } +export interface ReactiveVote { + proposalId: ComputedRef<bigint>; + voter: ComputedRef<string>; + option: ComputedRef<VoteOption>; + metadata: ComputedRef<string>; + submitTime: ComputedRef<Date>; +} export interface VoteProtoMsg { typeUrl: "/cosmos.group.v1.Vote"; value: Uint8Array; @@ -538,13 +609,13 @@ function createBaseMember(): Member { export const Member = { typeUrl: "/cosmos.group.v1.Member", encode(message: Member, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.address !== undefined) { + if (message.address !== "") { writer.uint32(10).string(message.address); } - if (message.weight !== undefined) { + if (message.weight !== "") { writer.uint32(18).string(message.weight); } - if (message.metadata !== undefined) { + if (message.metadata !== "") { writer.uint32(26).string(message.metadata); } if (message.addedAt !== undefined) { @@ -579,12 +650,12 @@ export const Member = { return message; }, fromJSON(object: any): Member { - 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; + 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 + }; }, toJSON(message: Member): JsonSafe<Member> { const obj: any = {}; @@ -703,9 +774,9 @@ export const Members = { return message; }, fromJSON(object: any): Members { - const obj = createBaseMembers(); - if (Array.isArray(object?.members)) obj.members = object.members.map((e: any) => Member.fromJSON(e)); - return obj; + return { + members: Array.isArray(object?.members) ? object.members.map((e: any) => Member.fromJSON(e)) : [] + }; }, toJSON(message: Members): JsonSafe<Members> { const obj: any = {}; @@ -785,7 +856,7 @@ function createBaseThresholdDecisionPolicy(): ThresholdDecisionPolicy { export const ThresholdDecisionPolicy = { typeUrl: "/cosmos.group.v1.ThresholdDecisionPolicy", encode(message: ThresholdDecisionPolicy, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.threshold !== undefined) { + if (message.threshold !== "") { writer.uint32(10).string(message.threshold); } if (message.windows !== undefined) { @@ -814,10 +885,10 @@ export const ThresholdDecisionPolicy = { return message; }, fromJSON(object: any): ThresholdDecisionPolicy { - const obj = createBaseThresholdDecisionPolicy(); - if (isSet(object.threshold)) obj.threshold = String(object.threshold); - if (isSet(object.windows)) obj.windows = DecisionPolicyWindows.fromJSON(object.windows); - return obj; + return { + threshold: isSet(object.threshold) ? String(object.threshold) : "", + windows: isSet(object.windows) ? DecisionPolicyWindows.fromJSON(object.windows) : undefined + }; }, toJSON(message: ThresholdDecisionPolicy): JsonSafe<ThresholdDecisionPolicy> { const obj: any = {}; @@ -828,9 +899,7 @@ export const ThresholdDecisionPolicy = { fromPartial(object: DeepPartial<ThresholdDecisionPolicy>): ThresholdDecisionPolicy { const message = createBaseThresholdDecisionPolicy(); message.threshold = object.threshold ?? ""; - if (object.windows !== undefined && object.windows !== null) { - message.windows = DecisionPolicyWindows.fromPartial(object.windows); - } + message.windows = object.windows !== undefined && object.windows !== null ? DecisionPolicyWindows.fromPartial(object.windows) : undefined; return message; }, fromSDK(object: ThresholdDecisionPolicySDKType): ThresholdDecisionPolicy { @@ -898,7 +967,7 @@ function createBasePercentageDecisionPolicy(): PercentageDecisionPolicy { export const PercentageDecisionPolicy = { typeUrl: "/cosmos.group.v1.PercentageDecisionPolicy", encode(message: PercentageDecisionPolicy, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.percentage !== undefined) { + if (message.percentage !== "") { writer.uint32(10).string(message.percentage); } if (message.windows !== undefined) { @@ -927,10 +996,10 @@ export const PercentageDecisionPolicy = { return message; }, fromJSON(object: any): PercentageDecisionPolicy { - const obj = createBasePercentageDecisionPolicy(); - if (isSet(object.percentage)) obj.percentage = String(object.percentage); - if (isSet(object.windows)) obj.windows = DecisionPolicyWindows.fromJSON(object.windows); - return obj; + return { + percentage: isSet(object.percentage) ? String(object.percentage) : "", + windows: isSet(object.windows) ? DecisionPolicyWindows.fromJSON(object.windows) : undefined + }; }, toJSON(message: PercentageDecisionPolicy): JsonSafe<PercentageDecisionPolicy> { const obj: any = {}; @@ -941,9 +1010,7 @@ export const PercentageDecisionPolicy = { fromPartial(object: DeepPartial<PercentageDecisionPolicy>): PercentageDecisionPolicy { const message = createBasePercentageDecisionPolicy(); message.percentage = object.percentage ?? ""; - if (object.windows !== undefined && object.windows !== null) { - message.windows = DecisionPolicyWindows.fromPartial(object.windows); - } + message.windows = object.windows !== undefined && object.windows !== null ? DecisionPolicyWindows.fromPartial(object.windows) : undefined; return message; }, fromSDK(object: PercentageDecisionPolicySDKType): PercentageDecisionPolicy { @@ -1040,10 +1107,10 @@ export const DecisionPolicyWindows = { return message; }, fromJSON(object: any): DecisionPolicyWindows { - 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; + return { + votingPeriod: isSet(object.votingPeriod) ? Duration.fromJSON(object.votingPeriod) : undefined, + minExecutionPeriod: isSet(object.minExecutionPeriod) ? Duration.fromJSON(object.minExecutionPeriod) : undefined + }; }, toJSON(message: DecisionPolicyWindows): JsonSafe<DecisionPolicyWindows> { const obj: any = {}; @@ -1053,12 +1120,8 @@ export const DecisionPolicyWindows = { }, fromPartial(object: DeepPartial<DecisionPolicyWindows>): DecisionPolicyWindows { const message = createBaseDecisionPolicyWindows(); - 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); - } + 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; return message; }, fromSDK(object: DecisionPolicyWindowsSDKType): DecisionPolicyWindows { @@ -1130,19 +1193,19 @@ function createBaseGroupInfo(): GroupInfo { export const GroupInfo = { typeUrl: "/cosmos.group.v1.GroupInfo", encode(message: GroupInfo, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.id !== undefined) { + if (message.id !== BigInt(0)) { writer.uint32(8).uint64(message.id); } - if (message.admin !== undefined) { + if (message.admin !== "") { writer.uint32(18).string(message.admin); } - if (message.metadata !== undefined) { + if (message.metadata !== "") { writer.uint32(26).string(message.metadata); } - if (message.version !== undefined) { + if (message.version !== BigInt(0)) { writer.uint32(32).uint64(message.version); } - if (message.totalWeight !== undefined) { + if (message.totalWeight !== "") { writer.uint32(42).string(message.totalWeight); } if (message.createdAt !== undefined) { @@ -1183,14 +1246,14 @@ export const GroupInfo = { return message; }, fromJSON(object: any): GroupInfo { - 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; + 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 + }; }, toJSON(message: GroupInfo): JsonSafe<GroupInfo> { const obj: any = {}; @@ -1204,14 +1267,10 @@ export const GroupInfo = { }, fromPartial(object: DeepPartial<GroupInfo>): GroupInfo { const message = createBaseGroupInfo(); - if (object.id !== undefined && object.id !== null) { - message.id = BigInt(object.id.toString()); - } + message.id = object.id !== undefined && object.id !== null ? BigInt(object.id.toString()) : BigInt(0); message.admin = object.admin ?? ""; message.metadata = object.metadata ?? ""; - if (object.version !== undefined && object.version !== null) { - message.version = BigInt(object.version.toString()); - } + message.version = object.version !== undefined && object.version !== null ? BigInt(object.version.toString()) : BigInt(0); message.totalWeight = object.totalWeight ?? ""; message.createdAt = object.createdAt ?? undefined; return message; @@ -1309,7 +1368,7 @@ function createBaseGroupMember(): GroupMember { export const GroupMember = { typeUrl: "/cosmos.group.v1.GroupMember", encode(message: GroupMember, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.groupId !== undefined) { + if (message.groupId !== BigInt(0)) { writer.uint32(8).uint64(message.groupId); } if (message.member !== undefined) { @@ -1338,10 +1397,10 @@ export const GroupMember = { return message; }, fromJSON(object: any): GroupMember { - 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; + return { + groupId: isSet(object.groupId) ? BigInt(object.groupId.toString()) : BigInt(0), + member: isSet(object.member) ? Member.fromJSON(object.member) : undefined + }; }, toJSON(message: GroupMember): JsonSafe<GroupMember> { const obj: any = {}; @@ -1351,12 +1410,8 @@ export const GroupMember = { }, fromPartial(object: DeepPartial<GroupMember>): GroupMember { const message = createBaseGroupMember(); - 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); - } + 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; return message; }, fromSDK(object: GroupMemberSDKType): GroupMember { @@ -1429,19 +1484,19 @@ function createBaseGroupPolicyInfo(): GroupPolicyInfo { export const GroupPolicyInfo = { typeUrl: "/cosmos.group.v1.GroupPolicyInfo", encode(message: GroupPolicyInfo, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.address !== undefined) { + if (message.address !== "") { writer.uint32(10).string(message.address); } - if (message.groupId !== undefined) { + if (message.groupId !== BigInt(0)) { writer.uint32(16).uint64(message.groupId); } - if (message.admin !== undefined) { + if (message.admin !== "") { writer.uint32(26).string(message.admin); } - if (message.metadata !== undefined) { + if (message.metadata !== "") { writer.uint32(34).string(message.metadata); } - if (message.version !== undefined) { + if (message.version !== BigInt(0)) { writer.uint32(40).uint64(message.version); } if (message.decisionPolicy !== undefined) { @@ -1488,15 +1543,15 @@ export const GroupPolicyInfo = { return message; }, fromJSON(object: any): GroupPolicyInfo { - 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; + 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 + }; }, toJSON(message: GroupPolicyInfo): JsonSafe<GroupPolicyInfo> { const obj: any = {}; @@ -1512,17 +1567,11 @@ export const GroupPolicyInfo = { fromPartial(object: DeepPartial<GroupPolicyInfo>): GroupPolicyInfo { const message = createBaseGroupPolicyInfo(); message.address = object.address ?? ""; - if (object.groupId !== undefined && object.groupId !== null) { - message.groupId = BigInt(object.groupId.toString()); - } + message.groupId = object.groupId !== undefined && object.groupId !== null ? BigInt(object.groupId.toString()) : BigInt(0); message.admin = object.admin ?? ""; message.metadata = object.metadata ?? ""; - 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.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; message.createdAt = object.createdAt ?? undefined; return message; }, @@ -1637,13 +1686,13 @@ function createBaseProposal(): Proposal { export const Proposal = { typeUrl: "/cosmos.group.v1.Proposal", encode(message: Proposal, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.id !== undefined) { + if (message.id !== BigInt(0)) { writer.uint32(8).uint64(message.id); } - if (message.address !== undefined) { + if (message.address !== "") { writer.uint32(18).string(message.address); } - if (message.metadata !== undefined) { + if (message.metadata !== "") { writer.uint32(26).string(message.metadata); } for (const v of message.proposers) { @@ -1652,10 +1701,10 @@ export const Proposal = { if (message.submitTime !== undefined) { Timestamp.encode(toTimestamp(message.submitTime), writer.uint32(42).fork()).ldelim(); } - if (message.groupVersion !== undefined) { + if (message.groupVersion !== BigInt(0)) { writer.uint32(48).uint64(message.groupVersion); } - if (message.groupPolicyVersion !== undefined) { + if (message.groupPolicyVersion !== BigInt(0)) { writer.uint32(56).uint64(message.groupPolicyVersion); } if (message.status !== 0) { @@ -1732,21 +1781,21 @@ export const Proposal = { return message; }, fromJSON(object: any): Proposal { - 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; + 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)) : [] + }; }, toJSON(message: Proposal): JsonSafe<Proposal> { const obj: any = {}; @@ -1775,24 +1824,16 @@ export const Proposal = { }, fromPartial(object: DeepPartial<Proposal>): Proposal { const message = createBaseProposal(); - if (object.id !== undefined && object.id !== null) { - message.id = BigInt(object.id.toString()); - } + message.id = object.id !== undefined && object.id !== null ? BigInt(object.id.toString()) : BigInt(0); message.address = object.address ?? ""; message.metadata = object.metadata ?? ""; message.proposers = object.proposers?.map(e => e) || []; message.submitTime = object.submitTime ?? undefined; - 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.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); message.status = object.status ?? 0; message.result = object.result ?? 0; - if (object.finalTallyResult !== undefined && object.finalTallyResult !== null) { - message.finalTallyResult = TallyResult.fromPartial(object.finalTallyResult); - } + message.finalTallyResult = object.finalTallyResult !== undefined && object.finalTallyResult !== null ? TallyResult.fromPartial(object.finalTallyResult) : undefined; message.votingPeriodEnd = object.votingPeriodEnd ?? undefined; message.executorResult = object.executorResult ?? 0; message.messages = object.messages?.map(e => Any.fromPartial(e)) || []; @@ -1954,16 +1995,16 @@ function createBaseTallyResult(): TallyResult { export const TallyResult = { typeUrl: "/cosmos.group.v1.TallyResult", encode(message: TallyResult, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.yesCount !== undefined) { + if (message.yesCount !== "") { writer.uint32(10).string(message.yesCount); } - if (message.abstainCount !== undefined) { + if (message.abstainCount !== "") { writer.uint32(18).string(message.abstainCount); } - if (message.noCount !== undefined) { + if (message.noCount !== "") { writer.uint32(26).string(message.noCount); } - if (message.noWithVetoCount !== undefined) { + if (message.noWithVetoCount !== "") { writer.uint32(34).string(message.noWithVetoCount); } return writer; @@ -1995,12 +2036,12 @@ export const TallyResult = { return message; }, fromJSON(object: any): TallyResult { - 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; + 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) : "" + }; }, toJSON(message: TallyResult): JsonSafe<TallyResult> { const obj: any = {}; @@ -2100,16 +2141,16 @@ function createBaseVote(): Vote { export const Vote = { typeUrl: "/cosmos.group.v1.Vote", encode(message: Vote, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.proposalId !== undefined) { + if (message.proposalId !== BigInt(0)) { writer.uint32(8).uint64(message.proposalId); } - if (message.voter !== undefined) { + if (message.voter !== "") { writer.uint32(18).string(message.voter); } if (message.option !== 0) { writer.uint32(24).int32(message.option); } - if (message.metadata !== undefined) { + if (message.metadata !== "") { writer.uint32(34).string(message.metadata); } if (message.submitTime !== undefined) { @@ -2147,13 +2188,13 @@ export const Vote = { return message; }, fromJSON(object: any): Vote { - 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; + 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 + }; }, toJSON(message: Vote): JsonSafe<Vote> { const obj: any = {}; @@ -2166,9 +2207,7 @@ export const Vote = { }, fromPartial(object: DeepPartial<Vote>): Vote { const message = createBaseVote(); - if (object.proposalId !== undefined && object.proposalId !== null) { - message.proposalId = BigInt(object.proposalId.toString()); - } + message.proposalId = object.proposalId !== undefined && object.proposalId !== null ? BigInt(object.proposalId.toString()) : BigInt(0); message.voter = object.voter ?? ""; message.option = object.option ?? 0; message.metadata = object.metadata ?? ""; diff --git a/__fixtures__/v-next/outputv4/cosmos/lcd.ts b/__fixtures__/v-next/outputv4/cosmos/lcd.ts index 8623b1e3f9..99ccbfad85 100644 --- a/__fixtures__/v-next/outputv4/cosmos/lcd.ts +++ b/__fixtures__/v-next/outputv4/cosmos/lcd.ts @@ -37,6 +37,11 @@ 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 0e2ff61b68..6bae293df0 100644 --- a/__fixtures__/v-next/outputv4/cosmos/mint/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputv4/cosmos/mint/v1beta1/genesis.ts @@ -1,7 +1,8 @@ -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"; +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"; export const protobufPackage = "cosmos.mint.v1beta1"; /** GenesisState defines the mint module's genesis state. */ export interface GenesisState { @@ -10,6 +11,10 @@ export interface GenesisState { /** params defines all the paramaters of the module. */ params: Params; } +export interface ReactiveGenesisState { + minter: ComputedRef<Minter>; + params: ComputedRef<Params>; +} export interface GenesisStateProtoMsg { typeUrl: "/cosmos.mint.v1beta1.GenesisState"; value: Uint8Array; @@ -57,10 +62,10 @@ export const GenesisState = { return message; }, fromJSON(object: any): GenesisState { - 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; + return { + minter: isSet(object.minter) ? Minter.fromJSON(object.minter) : undefined, + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined + }; }, toJSON(message: GenesisState): JsonSafe<GenesisState> { const obj: any = {}; @@ -70,12 +75,8 @@ export const GenesisState = { }, fromPartial(object: DeepPartial<GenesisState>): GenesisState { const message = createBaseGenesisState(); - 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); - } + 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; 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 313d2b1a56..7c33a5f8ee 100644 --- a/__fixtures__/v-next/outputv4/cosmos/mint/v1beta1/mint.ts +++ b/__fixtures__/v-next/outputv4/cosmos/mint/v1beta1/mint.ts @@ -1,7 +1,8 @@ -import { BinaryReader, BinaryWriter } from "../../../binary.js"; +import { BinaryReader, BinaryWriter } from "../../../binary"; import { Decimal } from "@cosmjs/math"; -import { isSet, DeepPartial } from "../../../helpers.js"; -import { JsonSafe } from "../../../json-safe.js"; +import { isSet, DeepPartial } from "../../../helpers"; +import { JsonSafe } from "../../../json-safe"; +import { ComputedRef } from "vue"; export const protobufPackage = "cosmos.mint.v1beta1"; /** Minter represents the minting state. */ export interface Minter { @@ -10,6 +11,10 @@ export interface Minter { /** current annual expected provisions */ annualProvisions: string; } +export interface ReactiveMinter { + inflation: ComputedRef<string>; + annualProvisions: ComputedRef<string>; +} export interface MinterProtoMsg { typeUrl: "/cosmos.mint.v1beta1.Minter"; value: Uint8Array; @@ -34,6 +39,14 @@ export interface Params { /** expected blocks per year */ blocksPerYear: bigint; } +export interface ReactiveParams { + mintDenom: ComputedRef<string>; + inflationRateChange: ComputedRef<string>; + inflationMax: ComputedRef<string>; + inflationMin: ComputedRef<string>; + goalBonded: ComputedRef<string>; + blocksPerYear: ComputedRef<bigint>; +} export interface ParamsProtoMsg { typeUrl: "/cosmos.mint.v1beta1.Params"; value: Uint8Array; @@ -56,10 +69,10 @@ function createBaseMinter(): Minter { export const Minter = { typeUrl: "/cosmos.mint.v1beta1.Minter", encode(message: Minter, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.inflation !== undefined) { + if (message.inflation !== "") { writer.uint32(10).string(Decimal.fromUserInput(message.inflation, 18).atomics); } - if (message.annualProvisions !== undefined) { + if (message.annualProvisions !== "") { writer.uint32(18).string(Decimal.fromUserInput(message.annualProvisions, 18).atomics); } return writer; @@ -85,10 +98,10 @@ export const Minter = { return message; }, fromJSON(object: any): Minter { - const obj = createBaseMinter(); - if (isSet(object.inflation)) obj.inflation = String(object.inflation); - if (isSet(object.annualProvisions)) obj.annualProvisions = String(object.annualProvisions); - return obj; + return { + inflation: isSet(object.inflation) ? String(object.inflation) : "", + annualProvisions: isSet(object.annualProvisions) ? String(object.annualProvisions) : "" + }; }, toJSON(message: Minter): JsonSafe<Minter> { const obj: any = {}; @@ -171,22 +184,22 @@ function createBaseParams(): Params { export const Params = { typeUrl: "/cosmos.mint.v1beta1.Params", encode(message: Params, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.mintDenom !== undefined) { + if (message.mintDenom !== "") { writer.uint32(10).string(message.mintDenom); } - if (message.inflationRateChange !== undefined) { + if (message.inflationRateChange !== "") { writer.uint32(18).string(Decimal.fromUserInput(message.inflationRateChange, 18).atomics); } - if (message.inflationMax !== undefined) { + if (message.inflationMax !== "") { writer.uint32(26).string(Decimal.fromUserInput(message.inflationMax, 18).atomics); } - if (message.inflationMin !== undefined) { + if (message.inflationMin !== "") { writer.uint32(34).string(Decimal.fromUserInput(message.inflationMin, 18).atomics); } - if (message.goalBonded !== undefined) { + if (message.goalBonded !== "") { writer.uint32(42).string(Decimal.fromUserInput(message.goalBonded, 18).atomics); } - if (message.blocksPerYear !== undefined) { + if (message.blocksPerYear !== BigInt(0)) { writer.uint32(48).uint64(message.blocksPerYear); } return writer; @@ -224,14 +237,14 @@ export const Params = { return message; }, fromJSON(object: any): Params { - 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; + 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) + }; }, toJSON(message: Params): JsonSafe<Params> { const obj: any = {}; @@ -250,9 +263,7 @@ export const Params = { message.inflationMax = object.inflationMax ?? ""; message.inflationMin = object.inflationMin ?? ""; message.goalBonded = object.goalBonded ?? ""; - if (object.blocksPerYear !== undefined && object.blocksPerYear !== null) { - message.blocksPerYear = BigInt(object.blocksPerYear.toString()); - } + message.blocksPerYear = object.blocksPerYear !== undefined && object.blocksPerYear !== null ? BigInt(object.blocksPerYear.toString()) : BigInt(0); 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 7e3077001b..258bd02e3e 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.js"; +import { Params, ParamsSDKType } from "./mint"; import { LCDClient } from "@cosmology/lcd"; -import { QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType, QueryInflationRequest, QueryInflationRequestSDKType, QueryInflationResponse, QueryInflationResponseSDKType, QueryAnnualProvisionsRequest, QueryAnnualProvisionsRequestSDKType, QueryAnnualProvisionsResponse, QueryAnnualProvisionsResponseSDKType } from "./query.js"; +import { QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType, QueryInflationRequest, QueryInflationRequestSDKType, QueryInflationResponse, QueryInflationResponseSDKType, QueryAnnualProvisionsRequest, QueryAnnualProvisionsRequestSDKType, QueryAnnualProvisionsResponse, QueryAnnualProvisionsResponseSDKType } from "./query"; 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 60a24be7ad..4c9ea1ba77 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.js"; -import { Rpc } from "../../../helpers.js"; -import { BinaryReader } from "../../../binary.js"; +import { Params, ParamsSDKType } from "./mint"; +import { Rpc } from "../../../helpers"; +import { BinaryReader } from "../../../binary"; import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; -import { QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType, QueryInflationRequest, QueryInflationRequestSDKType, QueryInflationResponse, QueryInflationResponseSDKType, QueryAnnualProvisionsRequest, QueryAnnualProvisionsRequestSDKType, QueryAnnualProvisionsResponse, QueryAnnualProvisionsResponseSDKType } from "./query.js"; +import { QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType, QueryInflationRequest, QueryInflationRequestSDKType, QueryInflationResponse, QueryInflationResponseSDKType, QueryAnnualProvisionsRequest, QueryAnnualProvisionsRequestSDKType, QueryAnnualProvisionsResponse, QueryAnnualProvisionsResponseSDKType, ReactiveQueryParamsRequest, ReactiveQueryInflationRequest, ReactiveQueryAnnualProvisionsRequest } from "./query"; /** 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 bedcf3f214..7bbb78b885 100644 --- a/__fixtures__/v-next/outputv4/cosmos/mint/v1beta1/query.ts +++ b/__fixtures__/v-next/outputv4/cosmos/mint/v1beta1/query.ts @@ -1,10 +1,12 @@ -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"; +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"; 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; @@ -16,6 +18,9 @@ export interface QueryParamsResponse { /** params defines the parameters of the module. */ params: Params; } +export interface ReactiveQueryParamsResponse { + params: ComputedRef<Params>; +} export interface QueryParamsResponseProtoMsg { typeUrl: "/cosmos.mint.v1beta1.QueryParamsResponse"; value: Uint8Array; @@ -26,6 +31,7 @@ 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; @@ -40,6 +46,9 @@ export interface QueryInflationResponse { /** inflation is the current minting inflation value. */ inflation: Uint8Array; } +export interface ReactiveQueryInflationResponse { + inflation: ComputedRef<Uint8Array>; +} export interface QueryInflationResponseProtoMsg { typeUrl: "/cosmos.mint.v1beta1.QueryInflationResponse"; value: Uint8Array; @@ -56,6 +65,7 @@ export interface QueryInflationResponseSDKType { * Query/AnnualProvisions RPC method. */ export interface QueryAnnualProvisionsRequest {} +export interface ReactiveQueryAnnualProvisionsRequest {} export interface QueryAnnualProvisionsRequestProtoMsg { typeUrl: "/cosmos.mint.v1beta1.QueryAnnualProvisionsRequest"; value: Uint8Array; @@ -73,6 +83,9 @@ export interface QueryAnnualProvisionsResponse { /** annual_provisions is the current minting annual provisions value. */ annualProvisions: Uint8Array; } +export interface ReactiveQueryAnnualProvisionsResponse { + annualProvisions: ComputedRef<Uint8Array>; +} export interface QueryAnnualProvisionsResponseProtoMsg { typeUrl: "/cosmos.mint.v1beta1.QueryAnnualProvisionsResponse"; value: Uint8Array; @@ -107,8 +120,7 @@ export const QueryParamsRequest = { return message; }, fromJSON(_: any): QueryParamsRequest { - const obj = createBaseQueryParamsRequest(); - return obj; + return {}; }, toJSON(_: QueryParamsRequest): JsonSafe<QueryParamsRequest> { const obj: any = {}; @@ -189,9 +201,9 @@ export const QueryParamsResponse = { return message; }, fromJSON(object: any): QueryParamsResponse { - const obj = createBaseQueryParamsResponse(); - if (isSet(object.params)) obj.params = Params.fromJSON(object.params); - return obj; + return { + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined + }; }, toJSON(message: QueryParamsResponse): JsonSafe<QueryParamsResponse> { const obj: any = {}; @@ -200,9 +212,7 @@ export const QueryParamsResponse = { }, fromPartial(object: DeepPartial<QueryParamsResponse>): QueryParamsResponse { const message = createBaseQueryParamsResponse(); - if (object.params !== undefined && object.params !== null) { - message.params = Params.fromPartial(object.params); - } + message.params = object.params !== undefined && object.params !== null ? Params.fromPartial(object.params) : undefined; return message; }, fromSDK(object: QueryParamsResponseSDKType): QueryParamsResponse { @@ -277,8 +287,7 @@ export const QueryInflationRequest = { return message; }, fromJSON(_: any): QueryInflationRequest { - const obj = createBaseQueryInflationRequest(); - return obj; + return {}; }, toJSON(_: QueryInflationRequest): JsonSafe<QueryInflationRequest> { const obj: any = {}; @@ -359,9 +368,9 @@ export const QueryInflationResponse = { return message; }, fromJSON(object: any): QueryInflationResponse { - const obj = createBaseQueryInflationResponse(); - if (isSet(object.inflation)) obj.inflation = bytesFromBase64(object.inflation); - return obj; + return { + inflation: isSet(object.inflation) ? bytesFromBase64(object.inflation) : new Uint8Array() + }; }, toJSON(message: QueryInflationResponse): JsonSafe<QueryInflationResponse> { const obj: any = {}; @@ -445,8 +454,7 @@ export const QueryAnnualProvisionsRequest = { return message; }, fromJSON(_: any): QueryAnnualProvisionsRequest { - const obj = createBaseQueryAnnualProvisionsRequest(); - return obj; + return {}; }, toJSON(_: QueryAnnualProvisionsRequest): JsonSafe<QueryAnnualProvisionsRequest> { const obj: any = {}; @@ -527,9 +535,9 @@ export const QueryAnnualProvisionsResponse = { return message; }, fromJSON(object: any): QueryAnnualProvisionsResponse { - const obj = createBaseQueryAnnualProvisionsResponse(); - if (isSet(object.annualProvisions)) obj.annualProvisions = bytesFromBase64(object.annualProvisions); - return obj; + return { + annualProvisions: isSet(object.annualProvisions) ? bytesFromBase64(object.annualProvisions) : new Uint8Array() + }; }, toJSON(message: QueryAnnualProvisionsResponse): JsonSafe<QueryAnnualProvisionsResponse> { 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 4acae30a1d..e0e0012615 100644 --- a/__fixtures__/v-next/outputv4/cosmos/nft/v1beta1/event.ts +++ b/__fixtures__/v-next/outputv4/cosmos/nft/v1beta1/event.ts @@ -1,6 +1,7 @@ -import { BinaryReader, BinaryWriter } from "../../../binary.js"; -import { isSet, DeepPartial } from "../../../helpers.js"; -import { JsonSafe } from "../../../json-safe.js"; +import { BinaryReader, BinaryWriter } from "../../../binary"; +import { isSet, DeepPartial } from "../../../helpers"; +import { JsonSafe } from "../../../json-safe"; +import { ComputedRef } from "vue"; export const protobufPackage = "cosmos.nft.v1beta1"; /** EventSend is emitted on Msg/Send */ export interface EventSend { @@ -9,6 +10,12 @@ export interface EventSend { sender: string; receiver: string; } +export interface ReactiveEventSend { + classId: ComputedRef<string>; + id: ComputedRef<string>; + sender: ComputedRef<string>; + receiver: ComputedRef<string>; +} export interface EventSendProtoMsg { typeUrl: "/cosmos.nft.v1beta1.EventSend"; value: Uint8Array; @@ -26,6 +33,11 @@ export interface EventMint { id: string; owner: string; } +export interface ReactiveEventMint { + classId: ComputedRef<string>; + id: ComputedRef<string>; + owner: ComputedRef<string>; +} export interface EventMintProtoMsg { typeUrl: "/cosmos.nft.v1beta1.EventMint"; value: Uint8Array; @@ -42,6 +54,11 @@ export interface EventBurn { id: string; owner: string; } +export interface ReactiveEventBurn { + classId: ComputedRef<string>; + id: ComputedRef<string>; + owner: ComputedRef<string>; +} export interface EventBurnProtoMsg { typeUrl: "/cosmos.nft.v1beta1.EventBurn"; value: Uint8Array; @@ -63,16 +80,16 @@ function createBaseEventSend(): EventSend { export const EventSend = { typeUrl: "/cosmos.nft.v1beta1.EventSend", encode(message: EventSend, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.classId !== undefined) { + if (message.classId !== "") { writer.uint32(10).string(message.classId); } - if (message.id !== undefined) { + if (message.id !== "") { writer.uint32(18).string(message.id); } - if (message.sender !== undefined) { + if (message.sender !== "") { writer.uint32(26).string(message.sender); } - if (message.receiver !== undefined) { + if (message.receiver !== "") { writer.uint32(34).string(message.receiver); } return writer; @@ -104,12 +121,12 @@ export const EventSend = { return message; }, fromJSON(object: any): EventSend { - 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; + 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) : "" + }; }, toJSON(message: EventSend): JsonSafe<EventSend> { const obj: any = {}; @@ -207,13 +224,13 @@ function createBaseEventMint(): EventMint { export const EventMint = { typeUrl: "/cosmos.nft.v1beta1.EventMint", encode(message: EventMint, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.classId !== undefined) { + if (message.classId !== "") { writer.uint32(10).string(message.classId); } - if (message.id !== undefined) { + if (message.id !== "") { writer.uint32(18).string(message.id); } - if (message.owner !== undefined) { + if (message.owner !== "") { writer.uint32(26).string(message.owner); } return writer; @@ -242,11 +259,11 @@ export const EventMint = { return message; }, fromJSON(object: any): EventMint { - 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; + return { + classId: isSet(object.classId) ? String(object.classId) : "", + id: isSet(object.id) ? String(object.id) : "", + owner: isSet(object.owner) ? String(object.owner) : "" + }; }, toJSON(message: EventMint): JsonSafe<EventMint> { const obj: any = {}; @@ -335,13 +352,13 @@ function createBaseEventBurn(): EventBurn { export const EventBurn = { typeUrl: "/cosmos.nft.v1beta1.EventBurn", encode(message: EventBurn, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.classId !== undefined) { + if (message.classId !== "") { writer.uint32(10).string(message.classId); } - if (message.id !== undefined) { + if (message.id !== "") { writer.uint32(18).string(message.id); } - if (message.owner !== undefined) { + if (message.owner !== "") { writer.uint32(26).string(message.owner); } return writer; @@ -370,11 +387,11 @@ export const EventBurn = { return message; }, fromJSON(object: any): EventBurn { - 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; + return { + classId: isSet(object.classId) ? String(object.classId) : "", + id: isSet(object.id) ? String(object.id) : "", + owner: isSet(object.owner) ? String(object.owner) : "" + }; }, toJSON(message: EventBurn): JsonSafe<EventBurn> { 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 ee5576545b..f0feeb04de 100644 --- a/__fixtures__/v-next/outputv4/cosmos/nft/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputv4/cosmos/nft/v1beta1/genesis.ts @@ -1,7 +1,8 @@ -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"; +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"; export const protobufPackage = "cosmos.nft.v1beta1"; /** GenesisState defines the nft module's genesis state. */ export interface GenesisState { @@ -9,6 +10,10 @@ export interface GenesisState { classes: Class[]; entries: Entry[]; } +export interface ReactiveGenesisState { + classes: ComputedRef<Class[]>; + entries: ComputedRef<Entry[]>; +} export interface GenesisStateProtoMsg { typeUrl: "/cosmos.nft.v1beta1.GenesisState"; value: Uint8Array; @@ -25,6 +30,10 @@ export interface Entry { /** nfts is a group of nfts of the same owner */ nfts: NFT[]; } +export interface ReactiveEntry { + owner: ComputedRef<string>; + nfts: ComputedRef<NFT[]>; +} export interface EntryProtoMsg { typeUrl: "/cosmos.nft.v1beta1.Entry"; value: Uint8Array; @@ -72,10 +81,10 @@ export const GenesisState = { return message; }, fromJSON(object: any): GenesisState { - 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; + 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)) : [] + }; }, toJSON(message: GenesisState): JsonSafe<GenesisState> { const obj: any = {}; @@ -174,7 +183,7 @@ function createBaseEntry(): Entry { export const Entry = { typeUrl: "/cosmos.nft.v1beta1.Entry", encode(message: Entry, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.owner !== undefined) { + if (message.owner !== "") { writer.uint32(10).string(message.owner); } for (const v of message.nfts) { @@ -203,10 +212,10 @@ export const Entry = { return message; }, fromJSON(object: any): Entry { - 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; + return { + owner: isSet(object.owner) ? String(object.owner) : "", + nfts: Array.isArray(object?.nfts) ? object.nfts.map((e: any) => NFT.fromJSON(e)) : [] + }; }, toJSON(message: Entry): JsonSafe<Entry> { 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 9ae4741ebd..a79417626d 100644 --- a/__fixtures__/v-next/outputv4/cosmos/nft/v1beta1/nft.ts +++ b/__fixtures__/v-next/outputv4/cosmos/nft/v1beta1/nft.ts @@ -1,7 +1,8 @@ -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"; +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"; export const protobufPackage = "cosmos.nft.v1beta1"; /** Class defines the class of the nft type. */ export interface Class { @@ -20,6 +21,15 @@ export interface Class { /** data is the app specific metadata of the NFT class. Optional */ data?: Any; } +export interface ReactiveClass { + id: ComputedRef<string>; + name: ComputedRef<string>; + symbol: ComputedRef<string>; + description: ComputedRef<string>; + uri: ComputedRef<string>; + uriHash: ComputedRef<string>; + data?: ComputedRef<Any>; +} export interface ClassProtoMsg { typeUrl: "/cosmos.nft.v1beta1.Class"; value: Uint8Array; @@ -47,6 +57,13 @@ export interface NFT { /** data is an app specific data of the NFT. Optional */ data?: Any; } +export interface ReactiveNFT { + classId: ComputedRef<string>; + id: ComputedRef<string>; + uri: ComputedRef<string>; + uriHash: ComputedRef<string>; + data?: ComputedRef<Any>; +} export interface NFTProtoMsg { typeUrl: "/cosmos.nft.v1beta1.NFT"; value: Uint8Array; @@ -73,22 +90,22 @@ function createBaseClass(): Class { export const Class = { typeUrl: "/cosmos.nft.v1beta1.Class", encode(message: Class, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.id !== undefined) { + if (message.id !== "") { writer.uint32(10).string(message.id); } - if (message.name !== undefined) { + if (message.name !== "") { writer.uint32(18).string(message.name); } - if (message.symbol !== undefined) { + if (message.symbol !== "") { writer.uint32(26).string(message.symbol); } - if (message.description !== undefined) { + if (message.description !== "") { writer.uint32(34).string(message.description); } - if (message.uri !== undefined) { + if (message.uri !== "") { writer.uint32(42).string(message.uri); } - if (message.uriHash !== undefined) { + if (message.uriHash !== "") { writer.uint32(50).string(message.uriHash); } if (message.data !== undefined) { @@ -132,15 +149,15 @@ export const Class = { return message; }, fromJSON(object: any): Class { - 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; + 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 + }; }, toJSON(message: Class): JsonSafe<Class> { const obj: any = {}; @@ -161,9 +178,7 @@ export const Class = { message.description = object.description ?? ""; message.uri = object.uri ?? ""; message.uriHash = object.uriHash ?? ""; - if (object.data !== undefined && object.data !== null) { - message.data = Any.fromPartial(object.data); - } + message.data = object.data !== undefined && object.data !== null ? Any.fromPartial(object.data) : undefined; return message; }, fromSDK(object: ClassSDKType): Class { @@ -269,16 +284,16 @@ function createBaseNFT(): NFT { export const NFT = { typeUrl: "/cosmos.nft.v1beta1.NFT", encode(message: NFT, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.classId !== undefined) { + if (message.classId !== "") { writer.uint32(10).string(message.classId); } - if (message.id !== undefined) { + if (message.id !== "") { writer.uint32(18).string(message.id); } - if (message.uri !== undefined) { + if (message.uri !== "") { writer.uint32(26).string(message.uri); } - if (message.uriHash !== undefined) { + if (message.uriHash !== "") { writer.uint32(34).string(message.uriHash); } if (message.data !== undefined) { @@ -316,13 +331,13 @@ export const NFT = { return message; }, fromJSON(object: any): NFT { - 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; + 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 + }; }, toJSON(message: NFT): JsonSafe<NFT> { const obj: any = {}; @@ -339,9 +354,7 @@ export const NFT = { message.id = object.id ?? ""; message.uri = object.uri ?? ""; message.uriHash = object.uriHash ?? ""; - if (object.data !== undefined && object.data !== null) { - message.data = Any.fromPartial(object.data); - } + message.data = object.data !== undefined && object.data !== null ? Any.fromPartial(object.data) : undefined; 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 046df45272..f75cb05451 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.js"; -import { NFT, NFTSDKType, Class, ClassSDKType } from "./nft.js"; -import { setPaginationParams } from "../../../helpers.js"; +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../base/query/v1beta1/pagination"; +import { NFT, NFTSDKType, Class, ClassSDKType } from "./nft"; +import { setPaginationParams } from "../../../helpers"; 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.js"; +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"; export class LCDQueryClient { req: LCDClient; constructor({ @@ -64,7 +64,7 @@ export class LCDQueryClient { } /* Classes queries all NFT classes */ async classes(params: QueryClassesRequest = { - pagination: PageRequest.fromPartial({}) + pagination: undefined }): Promise<QueryClassesResponseSDKType> { 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 abe44f5797..d4a07ff1aa 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,11 +1,9 @@ -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"; +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"; /** 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 */ @@ -69,7 +67,7 @@ export class QueryClientImpl implements Query { return promise.then(data => QueryClassResponse.decode(new BinaryReader(data))); } classes(request: QueryClassesRequest = { - pagination: PageRequest.fromPartial({}) + pagination: undefined }): Promise<QueryClassesResponse> { const data = QueryClassesRequest.encode(request).finish(); const promise = this.rpc.request("cosmos.nft.v1beta1.Query", "Classes", data); @@ -102,114 +100,4 @@ export const createRpcQueryExtension = (base: QueryClient) => { return queryService.classes(request); } }; -}; -export interface UseBalanceQuery<TData> extends ReactQueryParams<QueryBalanceResponse, TData> { - request: QueryBalanceRequest; -} -export interface UseOwnerQuery<TData> extends ReactQueryParams<QueryOwnerResponse, TData> { - request: QueryOwnerRequest; -} -export interface UseSupplyQuery<TData> extends ReactQueryParams<QuerySupplyResponse, TData> { - request: QuerySupplyRequest; -} -export interface UseNFTsQuery<TData> extends ReactQueryParams<QueryNFTsResponse, TData> { - request: QueryNFTsRequest; -} -export interface UseNFTQuery<TData> extends ReactQueryParams<QueryNFTResponse, TData> { - request: QueryNFTRequest; -} -export interface UseClassQuery<TData> extends ReactQueryParams<QueryClassResponse, TData> { - request: QueryClassRequest; -} -export interface UseClassesQuery<TData> extends ReactQueryParams<QueryClassesResponse, TData> { - request?: QueryClassesRequest; -} -const _queryClients: WeakMap<ProtobufRpcClient, QueryClientImpl> = 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 = <TData = QueryBalanceResponse,>({ - request, - options - }: UseBalanceQuery<TData>) => { - return useQuery<QueryBalanceResponse, Error, TData>(["balanceQuery", request], () => { - if (!queryService) throw new Error("Query Service not initialized"); - return queryService.balance(request); - }, options); - }; - const useOwner = <TData = QueryOwnerResponse,>({ - request, - options - }: UseOwnerQuery<TData>) => { - return useQuery<QueryOwnerResponse, Error, TData>(["ownerQuery", request], () => { - if (!queryService) throw new Error("Query Service not initialized"); - return queryService.owner(request); - }, options); - }; - const useSupply = <TData = QuerySupplyResponse,>({ - request, - options - }: UseSupplyQuery<TData>) => { - return useQuery<QuerySupplyResponse, Error, TData>(["supplyQuery", request], () => { - if (!queryService) throw new Error("Query Service not initialized"); - return queryService.supply(request); - }, options); - }; - const useNFTs = <TData = QueryNFTsResponse,>({ - request, - options - }: UseNFTsQuery<TData>) => { - return useQuery<QueryNFTsResponse, Error, TData>(["nFTsQuery", request], () => { - if (!queryService) throw new Error("Query Service not initialized"); - return queryService.nFTs(request); - }, options); - }; - const useNFT = <TData = QueryNFTResponse,>({ - request, - options - }: UseNFTQuery<TData>) => { - return useQuery<QueryNFTResponse, Error, TData>(["nFTQuery", request], () => { - if (!queryService) throw new Error("Query Service not initialized"); - return queryService.nFT(request); - }, options); - }; - const useClass = <TData = QueryClassResponse,>({ - request, - options - }: UseClassQuery<TData>) => { - return useQuery<QueryClassResponse, Error, TData>(["classQuery", request], () => { - if (!queryService) throw new Error("Query Service not initialized"); - return queryService.class(request); - }, options); - }; - const useClasses = <TData = QueryClassesResponse,>({ - request, - options - }: UseClassesQuery<TData>) => { - return useQuery<QueryClassesResponse, Error, TData>(["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 625bac32e8..f38f8ff0bf 100644 --- a/__fixtures__/v-next/outputv4/cosmos/nft/v1beta1/query.ts +++ b/__fixtures__/v-next/outputv4/cosmos/nft/v1beta1/query.ts @@ -1,14 +1,19 @@ -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"; +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"; 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<string>; + owner: ComputedRef<string>; +} export interface QueryBalanceRequestProtoMsg { typeUrl: "/cosmos.nft.v1beta1.QueryBalanceRequest"; value: Uint8Array; @@ -22,6 +27,9 @@ export interface QueryBalanceRequestSDKType { export interface QueryBalanceResponse { amount: bigint; } +export interface ReactiveQueryBalanceResponse { + amount: ComputedRef<bigint>; +} export interface QueryBalanceResponseProtoMsg { typeUrl: "/cosmos.nft.v1beta1.QueryBalanceResponse"; value: Uint8Array; @@ -35,6 +43,10 @@ export interface QueryOwnerRequest { classId: string; id: string; } +export interface ReactiveQueryOwnerRequest { + classId: ComputedRef<string>; + id: ComputedRef<string>; +} export interface QueryOwnerRequestProtoMsg { typeUrl: "/cosmos.nft.v1beta1.QueryOwnerRequest"; value: Uint8Array; @@ -48,6 +60,9 @@ export interface QueryOwnerRequestSDKType { export interface QueryOwnerResponse { owner: string; } +export interface ReactiveQueryOwnerResponse { + owner: ComputedRef<string>; +} export interface QueryOwnerResponseProtoMsg { typeUrl: "/cosmos.nft.v1beta1.QueryOwnerResponse"; value: Uint8Array; @@ -60,6 +75,9 @@ export interface QueryOwnerResponseSDKType { export interface QuerySupplyRequest { classId: string; } +export interface ReactiveQuerySupplyRequest { + classId: ComputedRef<string>; +} export interface QuerySupplyRequestProtoMsg { typeUrl: "/cosmos.nft.v1beta1.QuerySupplyRequest"; value: Uint8Array; @@ -72,6 +90,9 @@ export interface QuerySupplyRequestSDKType { export interface QuerySupplyResponse { amount: bigint; } +export interface ReactiveQuerySupplyResponse { + amount: ComputedRef<bigint>; +} export interface QuerySupplyResponseProtoMsg { typeUrl: "/cosmos.nft.v1beta1.QuerySupplyResponse"; value: Uint8Array; @@ -86,6 +107,11 @@ export interface QueryNFTsRequest { owner: string; pagination?: PageRequest; } +export interface ReactiveQueryNFTsRequest { + classId: ComputedRef<string>; + owner: ComputedRef<string>; + pagination?: ComputedRef<PageRequest>; +} export interface QueryNFTsRequestProtoMsg { typeUrl: "/cosmos.nft.v1beta1.QueryNFTsRequest"; value: Uint8Array; @@ -101,6 +127,10 @@ export interface QueryNFTsResponse { nfts: NFT[]; pagination?: PageResponse; } +export interface ReactiveQueryNFTsResponse { + nfts: ComputedRef<NFT[]>; + pagination?: ComputedRef<PageResponse>; +} export interface QueryNFTsResponseProtoMsg { typeUrl: "/cosmos.nft.v1beta1.QueryNFTsResponse"; value: Uint8Array; @@ -115,6 +145,10 @@ export interface QueryNFTRequest { classId: string; id: string; } +export interface ReactiveQueryNFTRequest { + classId: ComputedRef<string>; + id: ComputedRef<string>; +} export interface QueryNFTRequestProtoMsg { typeUrl: "/cosmos.nft.v1beta1.QueryNFTRequest"; value: Uint8Array; @@ -128,6 +162,9 @@ export interface QueryNFTRequestSDKType { export interface QueryNFTResponse { nft?: NFT; } +export interface ReactiveQueryNFTResponse { + nft?: ComputedRef<NFT>; +} export interface QueryNFTResponseProtoMsg { typeUrl: "/cosmos.nft.v1beta1.QueryNFTResponse"; value: Uint8Array; @@ -140,6 +177,9 @@ export interface QueryNFTResponseSDKType { export interface QueryClassRequest { classId: string; } +export interface ReactiveQueryClassRequest { + classId: ComputedRef<string>; +} export interface QueryClassRequestProtoMsg { typeUrl: "/cosmos.nft.v1beta1.QueryClassRequest"; value: Uint8Array; @@ -152,6 +192,9 @@ export interface QueryClassRequestSDKType { export interface QueryClassResponse { class?: Class; } +export interface ReactiveQueryClassResponse { + class?: ComputedRef<Class>; +} export interface QueryClassResponseProtoMsg { typeUrl: "/cosmos.nft.v1beta1.QueryClassResponse"; value: Uint8Array; @@ -165,6 +208,9 @@ export interface QueryClassesRequest { /** pagination defines an optional pagination for the request. */ pagination?: PageRequest; } +export interface ReactiveQueryClassesRequest { + pagination?: ComputedRef<PageRequest>; +} export interface QueryClassesRequestProtoMsg { typeUrl: "/cosmos.nft.v1beta1.QueryClassesRequest"; value: Uint8Array; @@ -178,6 +224,10 @@ export interface QueryClassesResponse { classes: Class[]; pagination?: PageResponse; } +export interface ReactiveQueryClassesResponse { + classes: ComputedRef<Class[]>; + pagination?: ComputedRef<PageResponse>; +} export interface QueryClassesResponseProtoMsg { typeUrl: "/cosmos.nft.v1beta1.QueryClassesResponse"; value: Uint8Array; @@ -196,10 +246,10 @@ function createBaseQueryBalanceRequest(): QueryBalanceRequest { export const QueryBalanceRequest = { typeUrl: "/cosmos.nft.v1beta1.QueryBalanceRequest", encode(message: QueryBalanceRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.classId !== undefined) { + if (message.classId !== "") { writer.uint32(10).string(message.classId); } - if (message.owner !== undefined) { + if (message.owner !== "") { writer.uint32(18).string(message.owner); } return writer; @@ -225,10 +275,10 @@ export const QueryBalanceRequest = { return message; }, fromJSON(object: any): QueryBalanceRequest { - const obj = createBaseQueryBalanceRequest(); - if (isSet(object.classId)) obj.classId = String(object.classId); - if (isSet(object.owner)) obj.owner = String(object.owner); - return obj; + return { + classId: isSet(object.classId) ? String(object.classId) : "", + owner: isSet(object.owner) ? String(object.owner) : "" + }; }, toJSON(message: QueryBalanceRequest): JsonSafe<QueryBalanceRequest> { const obj: any = {}; @@ -306,7 +356,7 @@ function createBaseQueryBalanceResponse(): QueryBalanceResponse { export const QueryBalanceResponse = { typeUrl: "/cosmos.nft.v1beta1.QueryBalanceResponse", encode(message: QueryBalanceResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.amount !== undefined) { + if (message.amount !== BigInt(0)) { writer.uint32(8).uint64(message.amount); } return writer; @@ -329,9 +379,9 @@ export const QueryBalanceResponse = { return message; }, fromJSON(object: any): QueryBalanceResponse { - const obj = createBaseQueryBalanceResponse(); - if (isSet(object.amount)) obj.amount = BigInt(object.amount.toString()); - return obj; + return { + amount: isSet(object.amount) ? BigInt(object.amount.toString()) : BigInt(0) + }; }, toJSON(message: QueryBalanceResponse): JsonSafe<QueryBalanceResponse> { const obj: any = {}; @@ -340,9 +390,7 @@ export const QueryBalanceResponse = { }, fromPartial(object: DeepPartial<QueryBalanceResponse>): QueryBalanceResponse { const message = createBaseQueryBalanceResponse(); - if (object.amount !== undefined && object.amount !== null) { - message.amount = BigInt(object.amount.toString()); - } + message.amount = object.amount !== undefined && object.amount !== null ? BigInt(object.amount.toString()) : BigInt(0); return message; }, fromSDK(object: QueryBalanceResponseSDKType): QueryBalanceResponse { @@ -403,10 +451,10 @@ function createBaseQueryOwnerRequest(): QueryOwnerRequest { export const QueryOwnerRequest = { typeUrl: "/cosmos.nft.v1beta1.QueryOwnerRequest", encode(message: QueryOwnerRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.classId !== undefined) { + if (message.classId !== "") { writer.uint32(10).string(message.classId); } - if (message.id !== undefined) { + if (message.id !== "") { writer.uint32(18).string(message.id); } return writer; @@ -432,10 +480,10 @@ export const QueryOwnerRequest = { return message; }, fromJSON(object: any): QueryOwnerRequest { - const obj = createBaseQueryOwnerRequest(); - if (isSet(object.classId)) obj.classId = String(object.classId); - if (isSet(object.id)) obj.id = String(object.id); - return obj; + return { + classId: isSet(object.classId) ? String(object.classId) : "", + id: isSet(object.id) ? String(object.id) : "" + }; }, toJSON(message: QueryOwnerRequest): JsonSafe<QueryOwnerRequest> { const obj: any = {}; @@ -513,7 +561,7 @@ function createBaseQueryOwnerResponse(): QueryOwnerResponse { export const QueryOwnerResponse = { typeUrl: "/cosmos.nft.v1beta1.QueryOwnerResponse", encode(message: QueryOwnerResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.owner !== undefined) { + if (message.owner !== "") { writer.uint32(10).string(message.owner); } return writer; @@ -536,9 +584,9 @@ export const QueryOwnerResponse = { return message; }, fromJSON(object: any): QueryOwnerResponse { - const obj = createBaseQueryOwnerResponse(); - if (isSet(object.owner)) obj.owner = String(object.owner); - return obj; + return { + owner: isSet(object.owner) ? String(object.owner) : "" + }; }, toJSON(message: QueryOwnerResponse): JsonSafe<QueryOwnerResponse> { const obj: any = {}; @@ -607,7 +655,7 @@ function createBaseQuerySupplyRequest(): QuerySupplyRequest { export const QuerySupplyRequest = { typeUrl: "/cosmos.nft.v1beta1.QuerySupplyRequest", encode(message: QuerySupplyRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.classId !== undefined) { + if (message.classId !== "") { writer.uint32(10).string(message.classId); } return writer; @@ -630,9 +678,9 @@ export const QuerySupplyRequest = { return message; }, fromJSON(object: any): QuerySupplyRequest { - const obj = createBaseQuerySupplyRequest(); - if (isSet(object.classId)) obj.classId = String(object.classId); - return obj; + return { + classId: isSet(object.classId) ? String(object.classId) : "" + }; }, toJSON(message: QuerySupplyRequest): JsonSafe<QuerySupplyRequest> { const obj: any = {}; @@ -701,7 +749,7 @@ function createBaseQuerySupplyResponse(): QuerySupplyResponse { export const QuerySupplyResponse = { typeUrl: "/cosmos.nft.v1beta1.QuerySupplyResponse", encode(message: QuerySupplyResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.amount !== undefined) { + if (message.amount !== BigInt(0)) { writer.uint32(8).uint64(message.amount); } return writer; @@ -724,9 +772,9 @@ export const QuerySupplyResponse = { return message; }, fromJSON(object: any): QuerySupplyResponse { - const obj = createBaseQuerySupplyResponse(); - if (isSet(object.amount)) obj.amount = BigInt(object.amount.toString()); - return obj; + return { + amount: isSet(object.amount) ? BigInt(object.amount.toString()) : BigInt(0) + }; }, toJSON(message: QuerySupplyResponse): JsonSafe<QuerySupplyResponse> { const obj: any = {}; @@ -735,9 +783,7 @@ export const QuerySupplyResponse = { }, fromPartial(object: DeepPartial<QuerySupplyResponse>): QuerySupplyResponse { const message = createBaseQuerySupplyResponse(); - if (object.amount !== undefined && object.amount !== null) { - message.amount = BigInt(object.amount.toString()); - } + message.amount = object.amount !== undefined && object.amount !== null ? BigInt(object.amount.toString()) : BigInt(0); return message; }, fromSDK(object: QuerySupplyResponseSDKType): QuerySupplyResponse { @@ -799,10 +845,10 @@ function createBaseQueryNFTsRequest(): QueryNFTsRequest { export const QueryNFTsRequest = { typeUrl: "/cosmos.nft.v1beta1.QueryNFTsRequest", encode(message: QueryNFTsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.classId !== undefined) { + if (message.classId !== "") { writer.uint32(10).string(message.classId); } - if (message.owner !== undefined) { + if (message.owner !== "") { writer.uint32(18).string(message.owner); } if (message.pagination !== undefined) { @@ -834,11 +880,11 @@ export const QueryNFTsRequest = { return message; }, fromJSON(object: any): QueryNFTsRequest { - 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; + return { + classId: isSet(object.classId) ? String(object.classId) : "", + owner: isSet(object.owner) ? String(object.owner) : "", + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined + }; }, toJSON(message: QueryNFTsRequest): JsonSafe<QueryNFTsRequest> { const obj: any = {}; @@ -851,9 +897,7 @@ export const QueryNFTsRequest = { const message = createBaseQueryNFTsRequest(); message.classId = object.classId ?? ""; message.owner = object.owner ?? ""; - if (object.pagination !== undefined && object.pagination !== null) { - message.pagination = PageRequest.fromPartial(object.pagination); - } + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageRequest.fromPartial(object.pagination) : undefined; return message; }, fromSDK(object: QueryNFTsRequestSDKType): QueryNFTsRequest { @@ -957,10 +1001,10 @@ export const QueryNFTsResponse = { return message; }, fromJSON(object: any): QueryNFTsResponse { - 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; + return { + nfts: Array.isArray(object?.nfts) ? object.nfts.map((e: any) => NFT.fromJSON(e)) : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined + }; }, toJSON(message: QueryNFTsResponse): JsonSafe<QueryNFTsResponse> { const obj: any = {}; @@ -975,9 +1019,7 @@ export const QueryNFTsResponse = { fromPartial(object: DeepPartial<QueryNFTsResponse>): QueryNFTsResponse { const message = createBaseQueryNFTsResponse(); message.nfts = object.nfts?.map(e => NFT.fromPartial(e)) || []; - if (object.pagination !== undefined && object.pagination !== null) { - message.pagination = PageResponse.fromPartial(object.pagination); - } + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageResponse.fromPartial(object.pagination) : undefined; return message; }, fromSDK(object: QueryNFTsResponseSDKType): QueryNFTsResponse { @@ -1051,10 +1093,10 @@ function createBaseQueryNFTRequest(): QueryNFTRequest { export const QueryNFTRequest = { typeUrl: "/cosmos.nft.v1beta1.QueryNFTRequest", encode(message: QueryNFTRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.classId !== undefined) { + if (message.classId !== "") { writer.uint32(10).string(message.classId); } - if (message.id !== undefined) { + if (message.id !== "") { writer.uint32(18).string(message.id); } return writer; @@ -1080,10 +1122,10 @@ export const QueryNFTRequest = { return message; }, fromJSON(object: any): QueryNFTRequest { - const obj = createBaseQueryNFTRequest(); - if (isSet(object.classId)) obj.classId = String(object.classId); - if (isSet(object.id)) obj.id = String(object.id); - return obj; + return { + classId: isSet(object.classId) ? String(object.classId) : "", + id: isSet(object.id) ? String(object.id) : "" + }; }, toJSON(message: QueryNFTRequest): JsonSafe<QueryNFTRequest> { const obj: any = {}; @@ -1184,9 +1226,9 @@ export const QueryNFTResponse = { return message; }, fromJSON(object: any): QueryNFTResponse { - const obj = createBaseQueryNFTResponse(); - if (isSet(object.nft)) obj.nft = NFT.fromJSON(object.nft); - return obj; + return { + nft: isSet(object.nft) ? NFT.fromJSON(object.nft) : undefined + }; }, toJSON(message: QueryNFTResponse): JsonSafe<QueryNFTResponse> { const obj: any = {}; @@ -1195,9 +1237,7 @@ export const QueryNFTResponse = { }, fromPartial(object: DeepPartial<QueryNFTResponse>): QueryNFTResponse { const message = createBaseQueryNFTResponse(); - if (object.nft !== undefined && object.nft !== null) { - message.nft = NFT.fromPartial(object.nft); - } + message.nft = object.nft !== undefined && object.nft !== null ? NFT.fromPartial(object.nft) : undefined; return message; }, fromSDK(object: QueryNFTResponseSDKType): QueryNFTResponse { @@ -1257,7 +1297,7 @@ function createBaseQueryClassRequest(): QueryClassRequest { export const QueryClassRequest = { typeUrl: "/cosmos.nft.v1beta1.QueryClassRequest", encode(message: QueryClassRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.classId !== undefined) { + if (message.classId !== "") { writer.uint32(10).string(message.classId); } return writer; @@ -1280,9 +1320,9 @@ export const QueryClassRequest = { return message; }, fromJSON(object: any): QueryClassRequest { - const obj = createBaseQueryClassRequest(); - if (isSet(object.classId)) obj.classId = String(object.classId); - return obj; + return { + classId: isSet(object.classId) ? String(object.classId) : "" + }; }, toJSON(message: QueryClassRequest): JsonSafe<QueryClassRequest> { const obj: any = {}; @@ -1374,9 +1414,9 @@ export const QueryClassResponse = { return message; }, fromJSON(object: any): QueryClassResponse { - const obj = createBaseQueryClassResponse(); - if (isSet(object.class)) obj.class = Class.fromJSON(object.class); - return obj; + return { + class: isSet(object.class) ? Class.fromJSON(object.class) : undefined + }; }, toJSON(message: QueryClassResponse): JsonSafe<QueryClassResponse> { const obj: any = {}; @@ -1385,9 +1425,7 @@ export const QueryClassResponse = { }, fromPartial(object: DeepPartial<QueryClassResponse>): QueryClassResponse { const message = createBaseQueryClassResponse(); - if (object.class !== undefined && object.class !== null) { - message.class = Class.fromPartial(object.class); - } + message.class = object.class !== undefined && object.class !== null ? Class.fromPartial(object.class) : undefined; return message; }, fromSDK(object: QueryClassResponseSDKType): QueryClassResponse { @@ -1470,9 +1508,9 @@ export const QueryClassesRequest = { return message; }, fromJSON(object: any): QueryClassesRequest { - const obj = createBaseQueryClassesRequest(); - if (isSet(object.pagination)) obj.pagination = PageRequest.fromJSON(object.pagination); - return obj; + return { + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined + }; }, toJSON(message: QueryClassesRequest): JsonSafe<QueryClassesRequest> { const obj: any = {}; @@ -1481,9 +1519,7 @@ export const QueryClassesRequest = { }, fromPartial(object: DeepPartial<QueryClassesRequest>): QueryClassesRequest { const message = createBaseQueryClassesRequest(); - if (object.pagination !== undefined && object.pagination !== null) { - message.pagination = PageRequest.fromPartial(object.pagination); - } + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageRequest.fromPartial(object.pagination) : undefined; return message; }, fromSDK(object: QueryClassesRequestSDKType): QueryClassesRequest { @@ -1573,10 +1609,10 @@ export const QueryClassesResponse = { return message; }, fromJSON(object: any): QueryClassesResponse { - 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; + return { + classes: Array.isArray(object?.classes) ? object.classes.map((e: any) => Class.fromJSON(e)) : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined + }; }, toJSON(message: QueryClassesResponse): JsonSafe<QueryClassesResponse> { const obj: any = {}; @@ -1591,9 +1627,7 @@ export const QueryClassesResponse = { fromPartial(object: DeepPartial<QueryClassesResponse>): QueryClassesResponse { const message = createBaseQueryClassesResponse(); message.classes = object.classes?.map(e => Class.fromPartial(e)) || []; - if (object.pagination !== undefined && object.pagination !== null) { - message.pagination = PageResponse.fromPartial(object.pagination); - } + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageResponse.fromPartial(object.pagination) : undefined; 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 1e948f6c30..c244a7789d 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.js"; +import { MsgSend, MsgSendSDKType } from "./tx"; 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 e56ae140f0..49958a4bc4 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.js"; +import { MsgSend, MsgSendSDKType } from "./tx"; 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 4b5be7dfb5..8913d37649 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.js"; -import { BinaryReader } from "../../../binary.js"; -import { MsgSend, MsgSendSDKType, MsgSendResponse, MsgSendResponseSDKType } from "./tx.js"; +import { Rpc } from "../../../helpers"; +import { BinaryReader } from "../../../binary"; +import { MsgSend, MsgSendSDKType, MsgSendResponse, MsgSendResponseSDKType } from "./tx"; /** 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 1406834d09..b9da052c32 100644 --- a/__fixtures__/v-next/outputv4/cosmos/nft/v1beta1/tx.ts +++ b/__fixtures__/v-next/outputv4/cosmos/nft/v1beta1/tx.ts @@ -1,6 +1,7 @@ -import { BinaryReader, BinaryWriter } from "../../../binary.js"; -import { isSet, DeepPartial } from "../../../helpers.js"; -import { JsonSafe } from "../../../json-safe.js"; +import { BinaryReader, BinaryWriter } from "../../../binary"; +import { isSet, DeepPartial } from "../../../helpers"; +import { JsonSafe } from "../../../json-safe"; +import { ComputedRef } from "vue"; export const protobufPackage = "cosmos.nft.v1beta1"; /** MsgSend represents a message to send a nft from one account to another account. */ export interface MsgSend { @@ -13,6 +14,12 @@ export interface MsgSend { /** receiver is the receiver address of nft */ receiver: string; } +export interface ReactiveMsgSend { + classId: ComputedRef<string>; + id: ComputedRef<string>; + sender: ComputedRef<string>; + receiver: ComputedRef<string>; +} export interface MsgSendProtoMsg { typeUrl: "/cosmos.nft.v1beta1.MsgSend"; value: Uint8Array; @@ -26,6 +33,7 @@ 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; @@ -43,16 +51,16 @@ function createBaseMsgSend(): MsgSend { export const MsgSend = { typeUrl: "/cosmos.nft.v1beta1.MsgSend", encode(message: MsgSend, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.classId !== undefined) { + if (message.classId !== "") { writer.uint32(10).string(message.classId); } - if (message.id !== undefined) { + if (message.id !== "") { writer.uint32(18).string(message.id); } - if (message.sender !== undefined) { + if (message.sender !== "") { writer.uint32(26).string(message.sender); } - if (message.receiver !== undefined) { + if (message.receiver !== "") { writer.uint32(34).string(message.receiver); } return writer; @@ -84,12 +92,12 @@ export const MsgSend = { return message; }, fromJSON(object: any): MsgSend { - 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; + 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) : "" + }; }, toJSON(message: MsgSend): JsonSafe<MsgSend> { const obj: any = {}; @@ -200,8 +208,7 @@ export const MsgSendResponse = { return message; }, fromJSON(_: any): MsgSendResponse { - const obj = createBaseMsgSendResponse(); - return obj; + return {}; }, toJSON(_: MsgSendResponse): JsonSafe<MsgSendResponse> { 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 0ddd6499a8..a886721ac4 100644 --- a/__fixtures__/v-next/outputv4/cosmos/orm/module/v1alpha1/module.ts +++ b/__fixtures__/v-next/outputv4/cosmos/orm/module/v1alpha1/module.ts @@ -1,6 +1,7 @@ -import { BinaryReader, BinaryWriter } from "../../../../binary.js"; -import { JsonSafe } from "../../../../json-safe.js"; -import { DeepPartial } from "../../../../helpers.js"; +import { BinaryReader, BinaryWriter } from "../../../../binary"; +import { JsonSafe } from "../../../../json-safe"; +import { DeepPartial } from "../../../../helpers"; +import { ComputedRef } from "vue"; export const protobufPackage = "cosmos.orm.module.v1alpha1"; /** * Module defines the ORM module which adds providers to the app container for @@ -8,6 +9,7 @@ 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; @@ -41,8 +43,7 @@ export const Module = { return message; }, fromJSON(_: any): Module { - const obj = createBaseModule(); - return obj; + return {}; }, toJSON(_: Module): JsonSafe<Module> { 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 2210cff480..5bc7aaa458 100644 --- a/__fixtures__/v-next/outputv4/cosmos/orm/v1/orm.ts +++ b/__fixtures__/v-next/outputv4/cosmos/orm/v1/orm.ts @@ -1,6 +1,7 @@ -import { BinaryReader, BinaryWriter } from "../../../binary.js"; -import { isSet, DeepPartial } from "../../../helpers.js"; -import { JsonSafe } from "../../../json-safe.js"; +import { BinaryReader, BinaryWriter } from "../../../binary"; +import { isSet, DeepPartial } from "../../../helpers"; +import { JsonSafe } from "../../../json-safe"; +import { ComputedRef } from "vue"; export const protobufPackage = "cosmos.orm.v1"; /** TableDescriptor describes an ORM table. */ export interface TableDescriptor { @@ -15,6 +16,11 @@ export interface TableDescriptor { */ id: number; } +export interface ReactiveTableDescriptor { + primaryKey?: ComputedRef<PrimaryKeyDescriptor>; + index: ComputedRef<SecondaryIndexDescriptor[]>; + id: ComputedRef<number>; +} export interface TableDescriptorProtoMsg { typeUrl: "/cosmos.orm.v1.TableDescriptor"; value: Uint8Array; @@ -67,6 +73,10 @@ export interface PrimaryKeyDescriptor { */ autoIncrement: boolean; } +export interface ReactivePrimaryKeyDescriptor { + fields: ComputedRef<string>; + autoIncrement: ComputedRef<boolean>; +} export interface PrimaryKeyDescriptorProtoMsg { typeUrl: "/cosmos.orm.v1.PrimaryKeyDescriptor"; value: Uint8Array; @@ -99,6 +109,11 @@ export interface SecondaryIndexDescriptor { /** unique specifies that this an unique index. */ unique: boolean; } +export interface ReactiveSecondaryIndexDescriptor { + fields: ComputedRef<string>; + id: ComputedRef<number>; + unique: ComputedRef<boolean>; +} export interface SecondaryIndexDescriptorProtoMsg { typeUrl: "/cosmos.orm.v1.SecondaryIndexDescriptor"; value: Uint8Array; @@ -118,6 +133,9 @@ export interface SingletonDescriptor { */ id: number; } +export interface ReactiveSingletonDescriptor { + id: ComputedRef<number>; +} export interface SingletonDescriptorProtoMsg { typeUrl: "/cosmos.orm.v1.SingletonDescriptor"; value: Uint8Array; @@ -142,7 +160,7 @@ export const TableDescriptor = { for (const v of message.index) { SecondaryIndexDescriptor.encode(v!, writer.uint32(18).fork()).ldelim(); } - if (message.id !== undefined) { + if (message.id !== 0) { writer.uint32(24).uint32(message.id); } return writer; @@ -171,11 +189,11 @@ export const TableDescriptor = { return message; }, fromJSON(object: any): TableDescriptor { - 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; + 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 + }; }, toJSON(message: TableDescriptor): JsonSafe<TableDescriptor> { const obj: any = {}; @@ -190,9 +208,7 @@ export const TableDescriptor = { }, fromPartial(object: DeepPartial<TableDescriptor>): TableDescriptor { const message = createBaseTableDescriptor(); - if (object.primaryKey !== undefined && object.primaryKey !== null) { - message.primaryKey = PrimaryKeyDescriptor.fromPartial(object.primaryKey); - } + message.primaryKey = object.primaryKey !== undefined && object.primaryKey !== null ? PrimaryKeyDescriptor.fromPartial(object.primaryKey) : undefined; message.index = object.index?.map(e => SecondaryIndexDescriptor.fromPartial(e)) || []; message.id = object.id ?? 0; return message; @@ -275,10 +291,10 @@ function createBasePrimaryKeyDescriptor(): PrimaryKeyDescriptor { export const PrimaryKeyDescriptor = { typeUrl: "/cosmos.orm.v1.PrimaryKeyDescriptor", encode(message: PrimaryKeyDescriptor, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.fields !== undefined) { + if (message.fields !== "") { writer.uint32(10).string(message.fields); } - if (message.autoIncrement !== undefined) { + if (message.autoIncrement === true) { writer.uint32(16).bool(message.autoIncrement); } return writer; @@ -304,10 +320,10 @@ export const PrimaryKeyDescriptor = { return message; }, fromJSON(object: any): PrimaryKeyDescriptor { - const obj = createBasePrimaryKeyDescriptor(); - if (isSet(object.fields)) obj.fields = String(object.fields); - if (isSet(object.autoIncrement)) obj.autoIncrement = Boolean(object.autoIncrement); - return obj; + return { + fields: isSet(object.fields) ? String(object.fields) : "", + autoIncrement: isSet(object.autoIncrement) ? Boolean(object.autoIncrement) : false + }; }, toJSON(message: PrimaryKeyDescriptor): JsonSafe<PrimaryKeyDescriptor> { const obj: any = {}; @@ -387,13 +403,13 @@ function createBaseSecondaryIndexDescriptor(): SecondaryIndexDescriptor { export const SecondaryIndexDescriptor = { typeUrl: "/cosmos.orm.v1.SecondaryIndexDescriptor", encode(message: SecondaryIndexDescriptor, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.fields !== undefined) { + if (message.fields !== "") { writer.uint32(10).string(message.fields); } - if (message.id !== undefined) { + if (message.id !== 0) { writer.uint32(16).uint32(message.id); } - if (message.unique !== undefined) { + if (message.unique === true) { writer.uint32(24).bool(message.unique); } return writer; @@ -422,11 +438,11 @@ export const SecondaryIndexDescriptor = { return message; }, fromJSON(object: any): SecondaryIndexDescriptor { - 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; + return { + fields: isSet(object.fields) ? String(object.fields) : "", + id: isSet(object.id) ? Number(object.id) : 0, + unique: isSet(object.unique) ? Boolean(object.unique) : false + }; }, toJSON(message: SecondaryIndexDescriptor): JsonSafe<SecondaryIndexDescriptor> { const obj: any = {}; @@ -513,7 +529,7 @@ function createBaseSingletonDescriptor(): SingletonDescriptor { export const SingletonDescriptor = { typeUrl: "/cosmos.orm.v1.SingletonDescriptor", encode(message: SingletonDescriptor, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.id !== undefined) { + if (message.id !== 0) { writer.uint32(8).uint32(message.id); } return writer; @@ -536,9 +552,9 @@ export const SingletonDescriptor = { return message; }, fromJSON(object: any): SingletonDescriptor { - const obj = createBaseSingletonDescriptor(); - if (isSet(object.id)) obj.id = Number(object.id); - return obj; + return { + id: isSet(object.id) ? Number(object.id) : 0 + }; }, toJSON(message: SingletonDescriptor): JsonSafe<SingletonDescriptor> { 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 cc5c217cf8..e1df4f34c2 100644 --- a/__fixtures__/v-next/outputv4/cosmos/orm/v1alpha1/schema.ts +++ b/__fixtures__/v-next/outputv4/cosmos/orm/v1alpha1/schema.ts @@ -1,6 +1,7 @@ -import { BinaryReader, BinaryWriter } from "../../../binary.js"; -import { isSet, bytesFromBase64, base64FromBytes, DeepPartial } from "../../../helpers.js"; -import { JsonSafe } from "../../../json-safe.js"; +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.orm.v1alpha1"; /** StorageType */ export enum StorageType { @@ -95,6 +96,10 @@ export interface ModuleSchemaDescriptor { */ prefix: Uint8Array; } +export interface ReactiveModuleSchemaDescriptor { + schemaFile: ComputedRef<ModuleSchemaDescriptor_FileEntry[]>; + prefix: ComputedRef<Uint8Array>; +} export interface ModuleSchemaDescriptorProtoMsg { typeUrl: "/cosmos.orm.v1alpha1.ModuleSchemaDescriptor"; value: Uint8Array; @@ -124,6 +129,11 @@ export interface ModuleSchemaDescriptor_FileEntry { */ storageType: StorageType; } +export interface ReactiveModuleSchemaDescriptor_FileEntry { + id: ComputedRef<number>; + protoFileName: ComputedRef<string>; + storageType: ComputedRef<StorageType>; +} export interface ModuleSchemaDescriptor_FileEntryProtoMsg { typeUrl: "/cosmos.orm.v1alpha1.FileEntry"; value: Uint8Array; @@ -172,10 +182,10 @@ export const ModuleSchemaDescriptor = { return message; }, fromJSON(object: any): ModuleSchemaDescriptor { - 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; + return { + schemaFile: Array.isArray(object?.schemaFile) ? object.schemaFile.map((e: any) => ModuleSchemaDescriptor_FileEntry.fromJSON(e)) : [], + prefix: isSet(object.prefix) ? bytesFromBase64(object.prefix) : new Uint8Array() + }; }, toJSON(message: ModuleSchemaDescriptor): JsonSafe<ModuleSchemaDescriptor> { const obj: any = {}; @@ -265,10 +275,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 !== undefined) { + if (message.id !== 0) { writer.uint32(8).uint32(message.id); } - if (message.protoFileName !== undefined) { + if (message.protoFileName !== "") { writer.uint32(18).string(message.protoFileName); } if (message.storageType !== 0) { @@ -300,11 +310,11 @@ export const ModuleSchemaDescriptor_FileEntry = { return message; }, fromJSON(object: any): ModuleSchemaDescriptor_FileEntry { - 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; + return { + id: isSet(object.id) ? Number(object.id) : 0, + protoFileName: isSet(object.protoFileName) ? String(object.protoFileName) : "", + storageType: isSet(object.storageType) ? storageTypeFromJSON(object.storageType) : -1 + }; }, toJSON(message: ModuleSchemaDescriptor_FileEntry): JsonSafe<ModuleSchemaDescriptor_FileEntry> { 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 2253d97aac..e99e88f269 100644 --- a/__fixtures__/v-next/outputv4/cosmos/params/v1beta1/params.ts +++ b/__fixtures__/v-next/outputv4/cosmos/params/v1beta1/params.ts @@ -1,6 +1,7 @@ -import { BinaryReader, BinaryWriter } from "../../../binary.js"; -import { isSet, DeepPartial } from "../../../helpers.js"; -import { JsonSafe } from "../../../json-safe.js"; +import { BinaryReader, BinaryWriter } from "../../../binary"; +import { isSet, DeepPartial } from "../../../helpers"; +import { JsonSafe } from "../../../json-safe"; +import { ComputedRef } from "vue"; export const protobufPackage = "cosmos.params.v1beta1"; /** ParameterChangeProposal defines a proposal to change one or more parameters. */ export interface ParameterChangeProposal { @@ -8,6 +9,11 @@ export interface ParameterChangeProposal { description: string; changes: ParamChange[]; } +export interface ReactiveParameterChangeProposal { + title: ComputedRef<string>; + description: ComputedRef<string>; + changes: ComputedRef<ParamChange[]>; +} export interface ParameterChangeProposalProtoMsg { typeUrl: "/cosmos.params.v1beta1.ParameterChangeProposal"; value: Uint8Array; @@ -27,6 +33,11 @@ export interface ParamChange { key: string; value: string; } +export interface ReactiveParamChange { + subspace: ComputedRef<string>; + key: ComputedRef<string>; + value: ComputedRef<string>; +} export interface ParamChangeProtoMsg { typeUrl: "/cosmos.params.v1beta1.ParamChange"; value: Uint8Array; @@ -50,10 +61,10 @@ function createBaseParameterChangeProposal(): ParameterChangeProposal { export const ParameterChangeProposal = { typeUrl: "/cosmos.params.v1beta1.ParameterChangeProposal", encode(message: ParameterChangeProposal, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.title !== undefined) { + if (message.title !== "") { writer.uint32(10).string(message.title); } - if (message.description !== undefined) { + if (message.description !== "") { writer.uint32(18).string(message.description); } for (const v of message.changes) { @@ -85,11 +96,11 @@ export const ParameterChangeProposal = { return message; }, fromJSON(object: any): ParameterChangeProposal { - 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; + 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)) : [] + }; }, toJSON(message: ParameterChangeProposal): JsonSafe<ParameterChangeProposal> { const obj: any = {}; @@ -188,13 +199,13 @@ function createBaseParamChange(): ParamChange { export const ParamChange = { typeUrl: "/cosmos.params.v1beta1.ParamChange", encode(message: ParamChange, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.subspace !== undefined) { + if (message.subspace !== "") { writer.uint32(10).string(message.subspace); } - if (message.key !== undefined) { + if (message.key !== "") { writer.uint32(18).string(message.key); } - if (message.value !== undefined) { + if (message.value !== "") { writer.uint32(26).string(message.value); } return writer; @@ -223,11 +234,11 @@ export const ParamChange = { return message; }, fromJSON(object: any): ParamChange { - 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; + return { + subspace: isSet(object.subspace) ? String(object.subspace) : "", + key: isSet(object.key) ? String(object.key) : "", + value: isSet(object.value) ? String(object.value) : "" + }; }, toJSON(message: ParamChange): JsonSafe<ParamChange> { 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 737ed229cf..05a89fd5a9 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.js"; +import { ParamChange, ParamChangeSDKType } from "./params"; import { LCDClient } from "@cosmology/lcd"; -import { QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType, QuerySubspacesRequest, QuerySubspacesRequestSDKType, QuerySubspacesResponse, QuerySubspacesResponseSDKType } from "./query.js"; +import { QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType, QuerySubspacesRequest, QuerySubspacesRequestSDKType, QuerySubspacesResponse, QuerySubspacesResponseSDKType } from "./query"; 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 79b76656f2..aee096f907 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.js"; -import { Rpc } from "../../../helpers.js"; -import { BinaryReader } from "../../../binary.js"; +import { ParamChange, ParamChangeSDKType } from "./params"; +import { Rpc } from "../../../helpers"; +import { BinaryReader } from "../../../binary"; import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; -import { QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType, QuerySubspacesRequest, QuerySubspacesRequestSDKType, QuerySubspacesResponse, QuerySubspacesResponseSDKType } from "./query.js"; +import { QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType, QuerySubspacesRequest, QuerySubspacesRequestSDKType, QuerySubspacesResponse, QuerySubspacesResponseSDKType, ReactiveQueryParamsRequest, ReactiveQuerySubspacesRequest } from "./query"; /** 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 206aeb146a..5c871bb282 100644 --- a/__fixtures__/v-next/outputv4/cosmos/params/v1beta1/query.ts +++ b/__fixtures__/v-next/outputv4/cosmos/params/v1beta1/query.ts @@ -1,7 +1,8 @@ -import { ParamChange, ParamChangeSDKType } from "./params.js"; -import { BinaryReader, BinaryWriter } from "../../../binary.js"; -import { isSet, DeepPartial } from "../../../helpers.js"; -import { JsonSafe } from "../../../json-safe.js"; +import { ParamChange, ParamChangeSDKType } from "./params"; +import { BinaryReader, BinaryWriter } from "../../../binary"; +import { isSet, DeepPartial } from "../../../helpers"; +import { JsonSafe } from "../../../json-safe"; +import { ComputedRef } from "vue"; export const protobufPackage = "cosmos.params.v1beta1"; /** QueryParamsRequest is request type for the Query/Params RPC method. */ export interface QueryParamsRequest { @@ -10,6 +11,10 @@ export interface QueryParamsRequest { /** key defines the key of the parameter in the subspace. */ key: string; } +export interface ReactiveQueryParamsRequest { + subspace: ComputedRef<string>; + key: ComputedRef<string>; +} export interface QueryParamsRequestProtoMsg { typeUrl: "/cosmos.params.v1beta1.QueryParamsRequest"; value: Uint8Array; @@ -24,6 +29,9 @@ export interface QueryParamsResponse { /** param defines the queried parameter. */ param: ParamChange; } +export interface ReactiveQueryParamsResponse { + param: ComputedRef<ParamChange>; +} export interface QueryParamsResponseProtoMsg { typeUrl: "/cosmos.params.v1beta1.QueryParamsResponse"; value: Uint8Array; @@ -37,6 +45,7 @@ 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; @@ -53,6 +62,9 @@ export interface QuerySubspacesRequestSDKType {} export interface QuerySubspacesResponse { subspaces: Subspace[]; } +export interface ReactiveQuerySubspacesResponse { + subspaces: ComputedRef<Subspace[]>; +} export interface QuerySubspacesResponseProtoMsg { typeUrl: "/cosmos.params.v1beta1.QuerySubspacesResponse"; value: Uint8Array; @@ -72,6 +84,10 @@ export interface Subspace { subspace: string; keys: string[]; } +export interface ReactiveSubspace { + subspace: ComputedRef<string>; + keys: ComputedRef<string[]>; +} export interface SubspaceProtoMsg { typeUrl: "/cosmos.params.v1beta1.Subspace"; value: Uint8Array; @@ -93,10 +109,10 @@ function createBaseQueryParamsRequest(): QueryParamsRequest { export const QueryParamsRequest = { typeUrl: "/cosmos.params.v1beta1.QueryParamsRequest", encode(message: QueryParamsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.subspace !== undefined) { + if (message.subspace !== "") { writer.uint32(10).string(message.subspace); } - if (message.key !== undefined) { + if (message.key !== "") { writer.uint32(18).string(message.key); } return writer; @@ -122,10 +138,10 @@ export const QueryParamsRequest = { return message; }, fromJSON(object: any): QueryParamsRequest { - const obj = createBaseQueryParamsRequest(); - if (isSet(object.subspace)) obj.subspace = String(object.subspace); - if (isSet(object.key)) obj.key = String(object.key); - return obj; + return { + subspace: isSet(object.subspace) ? String(object.subspace) : "", + key: isSet(object.key) ? String(object.key) : "" + }; }, toJSON(message: QueryParamsRequest): JsonSafe<QueryParamsRequest> { const obj: any = {}; @@ -226,9 +242,9 @@ export const QueryParamsResponse = { return message; }, fromJSON(object: any): QueryParamsResponse { - const obj = createBaseQueryParamsResponse(); - if (isSet(object.param)) obj.param = ParamChange.fromJSON(object.param); - return obj; + return { + param: isSet(object.param) ? ParamChange.fromJSON(object.param) : undefined + }; }, toJSON(message: QueryParamsResponse): JsonSafe<QueryParamsResponse> { const obj: any = {}; @@ -237,9 +253,7 @@ export const QueryParamsResponse = { }, fromPartial(object: DeepPartial<QueryParamsResponse>): QueryParamsResponse { const message = createBaseQueryParamsResponse(); - if (object.param !== undefined && object.param !== null) { - message.param = ParamChange.fromPartial(object.param); - } + message.param = object.param !== undefined && object.param !== null ? ParamChange.fromPartial(object.param) : undefined; return message; }, fromSDK(object: QueryParamsResponseSDKType): QueryParamsResponse { @@ -314,8 +328,7 @@ export const QuerySubspacesRequest = { return message; }, fromJSON(_: any): QuerySubspacesRequest { - const obj = createBaseQuerySubspacesRequest(); - return obj; + return {}; }, toJSON(_: QuerySubspacesRequest): JsonSafe<QuerySubspacesRequest> { const obj: any = {}; @@ -396,9 +409,9 @@ export const QuerySubspacesResponse = { return message; }, fromJSON(object: any): QuerySubspacesResponse { - const obj = createBaseQuerySubspacesResponse(); - if (Array.isArray(object?.subspaces)) obj.subspaces = object.subspaces.map((e: any) => Subspace.fromJSON(e)); - return obj; + return { + subspaces: Array.isArray(object?.subspaces) ? object.subspaces.map((e: any) => Subspace.fromJSON(e)) : [] + }; }, toJSON(message: QuerySubspacesResponse): JsonSafe<QuerySubspacesResponse> { const obj: any = {}; @@ -478,7 +491,7 @@ function createBaseSubspace(): Subspace { export const Subspace = { typeUrl: "/cosmos.params.v1beta1.Subspace", encode(message: Subspace, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.subspace !== undefined) { + if (message.subspace !== "") { writer.uint32(10).string(message.subspace); } for (const v of message.keys) { @@ -507,10 +520,10 @@ export const Subspace = { return message; }, fromJSON(object: any): Subspace { - 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; + return { + subspace: isSet(object.subspace) ? String(object.subspace) : "", + keys: Array.isArray(object?.keys) ? object.keys.map((e: any) => String(e)) : [] + }; }, toJSON(message: Subspace): JsonSafe<Subspace> { const obj: any = {}; diff --git a/__fixtures__/v-next/outputv4/cosmos/rpc.query.ts b/__fixtures__/v-next/outputv4/cosmos/rpc.query.ts index 7a583ff3e2..0de82d5268 100644 --- a/__fixtures__/v-next/outputv4/cosmos/rpc.query.ts +++ b/__fixtures__/v-next/outputv4/cosmos/rpc.query.ts @@ -1,72 +1,75 @@ -import { Rpc } from "../helpers.js"; -import { connectComet, HttpEndpoint } from "@cosmjs/tendermint-rpc"; +import { Rpc } from "../helpers"; +import { Tendermint34Client, HttpEndpoint } from "@cosmjs/tendermint-rpc"; import { QueryClient } from "@cosmjs/stargate"; export const createRPCQueryClient = async ({ rpcEndpoint }: { rpcEndpoint: string | HttpEndpoint; }) => { - const tmClient = await connectComet(rpcEndpoint); + const tmClient = await Tendermint34Client.connect(rpcEndpoint); const client = new QueryClient(tmClient); return { cosmos: { app: { - v1alpha1: (await import("./app/v1alpha1/query.rpc.Query.js")).createRpcQueryExtension(client) + v1alpha1: (await import("./app/v1alpha1/query.rpc.Query")).createRpcQueryExtension(client) }, auth: { - v1beta1: (await import("./auth/v1beta1/query.rpc.Query.js")).createRpcQueryExtension(client) + v1beta1: (await import("./auth/v1beta1/query.rpc.Query")).createRpcQueryExtension(client) }, authz: { - v1beta1: (await import("./authz/v1beta1/query.rpc.Query.js")).createRpcQueryExtension(client) + v1beta1: (await import("./authz/v1beta1/query.rpc.Query")).createRpcQueryExtension(client) }, bank: { - v1beta1: (await import("./bank/v1beta1/query.rpc.Query.js")).createRpcQueryExtension(client) + v1beta1: (await import("./bank/v1beta1/query.rpc.Query")).createRpcQueryExtension(client) }, base: { reflection: { - v1beta1: (await import("./base/reflection/v1beta1/reflection.rpc.ReflectionService.js")).createRpcQueryExtension(client), - v2alpha1: (await import("./base/reflection/v2alpha1/reflection.rpc.ReflectionService.js")).createRpcQueryExtension(client) + v1beta1: (await import("./base/reflection/v1beta1/reflection.rpc.ReflectionService")).createRpcQueryExtension(client), + v2alpha1: (await import("./base/reflection/v2alpha1/reflection.rpc.ReflectionService")).createRpcQueryExtension(client) }, tendermint: { - v1beta1: (await import("./base/tendermint/v1beta1/query.rpc.Service.js")).createRpcQueryExtension(client) + v1beta1: (await import("./base/tendermint/v1beta1/query.rpc.Service")).createRpcQueryExtension(client) + }, + node: { + v1beta1: (await import("./base/node/v1beta1/query.rpc.Service")).createRpcQueryExtension(client) } }, distribution: { - v1beta1: (await import("./distribution/v1beta1/query.rpc.Query.js")).createRpcQueryExtension(client) + v1beta1: (await import("./distribution/v1beta1/query.rpc.Query")).createRpcQueryExtension(client) }, evidence: { - v1beta1: (await import("./evidence/v1beta1/query.rpc.Query.js")).createRpcQueryExtension(client) + v1beta1: (await import("./evidence/v1beta1/query.rpc.Query")).createRpcQueryExtension(client) }, feegrant: { - v1beta1: (await import("./feegrant/v1beta1/query.rpc.Query.js")).createRpcQueryExtension(client) + v1beta1: (await import("./feegrant/v1beta1/query.rpc.Query")).createRpcQueryExtension(client) }, gov: { - v1: (await import("./gov/v1/query.rpc.Query.js")).createRpcQueryExtension(client), - v1beta1: (await import("./gov/v1beta1/query.rpc.Query.js")).createRpcQueryExtension(client) + v1: (await import("./gov/v1/query.rpc.Query")).createRpcQueryExtension(client), + v1beta1: (await import("./gov/v1beta1/query.rpc.Query")).createRpcQueryExtension(client) }, group: { - v1: (await import("./group/v1/query.rpc.Query.js")).createRpcQueryExtension(client) + v1: (await import("./group/v1/query.rpc.Query")).createRpcQueryExtension(client) }, mint: { - v1beta1: (await import("./mint/v1beta1/query.rpc.Query.js")).createRpcQueryExtension(client) + v1beta1: (await import("./mint/v1beta1/query.rpc.Query")).createRpcQueryExtension(client) }, nft: { - v1beta1: (await import("./nft/v1beta1/query.rpc.Query.js")).createRpcQueryExtension(client) + v1beta1: (await import("./nft/v1beta1/query.rpc.Query")).createRpcQueryExtension(client) }, params: { - v1beta1: (await import("./params/v1beta1/query.rpc.Query.js")).createRpcQueryExtension(client) + v1beta1: (await import("./params/v1beta1/query.rpc.Query")).createRpcQueryExtension(client) }, slashing: { - v1beta1: (await import("./slashing/v1beta1/query.rpc.Query.js")).createRpcQueryExtension(client) + v1beta1: (await import("./slashing/v1beta1/query.rpc.Query")).createRpcQueryExtension(client) }, staking: { - v1beta1: (await import("./staking/v1beta1/query.rpc.Query.js")).createRpcQueryExtension(client) + v1beta1: (await import("./staking/v1beta1/query.rpc.Query")).createRpcQueryExtension(client) }, tx: { - v1beta1: (await import("./tx/v1beta1/service.rpc.Service.js")).createRpcQueryExtension(client) + v1beta1: (await import("./tx/v1beta1/service.rpc.Service")).createRpcQueryExtension(client) }, upgrade: { - v1beta1: (await import("./upgrade/v1beta1/query.rpc.Query.js")).createRpcQueryExtension(client) + v1beta1: (await import("./upgrade/v1beta1/query.rpc.Query")).createRpcQueryExtension(client) } } }; diff --git a/__fixtures__/v-next/outputv4/cosmos/rpc.tx.ts b/__fixtures__/v-next/outputv4/cosmos/rpc.tx.ts index ee7fdfff0a..3a4dbf9b6f 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.js"; +import { Rpc } from "../helpers"; export const createRPCMsgClient = async ({ rpc }: { @@ -6,44 +6,44 @@ export const createRPCMsgClient = async ({ }) => ({ cosmos: { authz: { - v1beta1: new (await import("./authz/v1beta1/tx.rpc.msg.js")).MsgClientImpl(rpc) + v1beta1: new (await import("./authz/v1beta1/tx.rpc.msg")).MsgClientImpl(rpc) }, bank: { - v1beta1: new (await import("./bank/v1beta1/tx.rpc.msg.js")).MsgClientImpl(rpc) + v1beta1: new (await import("./bank/v1beta1/tx.rpc.msg")).MsgClientImpl(rpc) }, crisis: { - v1beta1: new (await import("./crisis/v1beta1/tx.rpc.msg.js")).MsgClientImpl(rpc) + v1beta1: new (await import("./crisis/v1beta1/tx.rpc.msg")).MsgClientImpl(rpc) }, distribution: { - v1beta1: new (await import("./distribution/v1beta1/tx.rpc.msg.js")).MsgClientImpl(rpc) + v1beta1: new (await import("./distribution/v1beta1/tx.rpc.msg")).MsgClientImpl(rpc) }, evidence: { - v1beta1: new (await import("./evidence/v1beta1/tx.rpc.msg.js")).MsgClientImpl(rpc) + v1beta1: new (await import("./evidence/v1beta1/tx.rpc.msg")).MsgClientImpl(rpc) }, feegrant: { - v1beta1: new (await import("./feegrant/v1beta1/tx.rpc.msg.js")).MsgClientImpl(rpc) + v1beta1: new (await import("./feegrant/v1beta1/tx.rpc.msg")).MsgClientImpl(rpc) }, gov: { - v1: new (await import("./gov/v1/tx.rpc.msg.js")).MsgClientImpl(rpc), - v1beta1: new (await import("./gov/v1beta1/tx.rpc.msg.js")).MsgClientImpl(rpc) + v1: new (await import("./gov/v1/tx.rpc.msg")).MsgClientImpl(rpc), + v1beta1: new (await import("./gov/v1beta1/tx.rpc.msg")).MsgClientImpl(rpc) }, group: { - v1: new (await import("./group/v1/tx.rpc.msg.js")).MsgClientImpl(rpc) + v1: new (await import("./group/v1/tx.rpc.msg")).MsgClientImpl(rpc) }, nft: { - v1beta1: new (await import("./nft/v1beta1/tx.rpc.msg.js")).MsgClientImpl(rpc) + v1beta1: new (await import("./nft/v1beta1/tx.rpc.msg")).MsgClientImpl(rpc) }, slashing: { - v1beta1: new (await import("./slashing/v1beta1/tx.rpc.msg.js")).MsgClientImpl(rpc) + v1beta1: new (await import("./slashing/v1beta1/tx.rpc.msg")).MsgClientImpl(rpc) }, staking: { - v1beta1: new (await import("./staking/v1beta1/tx.rpc.msg.js")).MsgClientImpl(rpc) + v1beta1: new (await import("./staking/v1beta1/tx.rpc.msg")).MsgClientImpl(rpc) }, upgrade: { - v1beta1: new (await import("./upgrade/v1beta1/tx.rpc.msg.js")).MsgClientImpl(rpc) + v1beta1: new (await import("./upgrade/v1beta1/tx.rpc.msg")).MsgClientImpl(rpc) }, vesting: { - v1beta1: new (await import("./vesting/v1beta1/tx.rpc.msg.js")).MsgClientImpl(rpc) + v1beta1: new (await import("./vesting/v1beta1/tx.rpc.msg")).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 d99b4d75ce..f38dfd47bb 100644 --- a/__fixtures__/v-next/outputv4/cosmos/slashing/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputv4/cosmos/slashing/v1beta1/genesis.ts @@ -1,7 +1,8 @@ -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"; +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"; export const protobufPackage = "cosmos.slashing.v1beta1"; /** GenesisState defines the slashing module's genesis state. */ export interface GenesisState { @@ -18,6 +19,11 @@ export interface GenesisState { */ missedBlocks: ValidatorMissedBlocks[]; } +export interface ReactiveGenesisState { + params: ComputedRef<Params>; + signingInfos: ComputedRef<SigningInfo[]>; + missedBlocks: ComputedRef<ValidatorMissedBlocks[]>; +} export interface GenesisStateProtoMsg { typeUrl: "/cosmos.slashing.v1beta1.GenesisState"; value: Uint8Array; @@ -35,6 +41,10 @@ export interface SigningInfo { /** validator_signing_info represents the signing info of this validator. */ validatorSigningInfo: ValidatorSigningInfo; } +export interface ReactiveSigningInfo { + address: ComputedRef<string>; + validatorSigningInfo: ComputedRef<ValidatorSigningInfo>; +} export interface SigningInfoProtoMsg { typeUrl: "/cosmos.slashing.v1beta1.SigningInfo"; value: Uint8Array; @@ -54,6 +64,10 @@ export interface ValidatorMissedBlocks { /** missed_blocks is an array of missed blocks by the validator. */ missedBlocks: MissedBlock[]; } +export interface ReactiveValidatorMissedBlocks { + address: ComputedRef<string>; + missedBlocks: ComputedRef<MissedBlock[]>; +} export interface ValidatorMissedBlocksProtoMsg { typeUrl: "/cosmos.slashing.v1beta1.ValidatorMissedBlocks"; value: Uint8Array; @@ -73,6 +87,10 @@ export interface MissedBlock { /** missed is the missed status. */ missed: boolean; } +export interface ReactiveMissedBlock { + index: ComputedRef<bigint>; + missed: ComputedRef<boolean>; +} export interface MissedBlockProtoMsg { typeUrl: "/cosmos.slashing.v1beta1.MissedBlock"; value: Uint8Array; @@ -127,11 +145,11 @@ export const GenesisState = { return message; }, fromJSON(object: any): GenesisState { - 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; + 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)) : [] + }; }, toJSON(message: GenesisState): JsonSafe<GenesisState> { const obj: any = {}; @@ -150,9 +168,7 @@ export const GenesisState = { }, fromPartial(object: DeepPartial<GenesisState>): GenesisState { const message = createBaseGenesisState(); - if (object.params !== undefined && object.params !== null) { - message.params = Params.fromPartial(object.params); - } + message.params = object.params !== undefined && object.params !== null ? Params.fromPartial(object.params) : undefined; message.signingInfos = object.signingInfos?.map(e => SigningInfo.fromPartial(e)) || []; message.missedBlocks = object.missedBlocks?.map(e => ValidatorMissedBlocks.fromPartial(e)) || []; return message; @@ -241,7 +257,7 @@ function createBaseSigningInfo(): SigningInfo { export const SigningInfo = { typeUrl: "/cosmos.slashing.v1beta1.SigningInfo", encode(message: SigningInfo, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.address !== undefined) { + if (message.address !== "") { writer.uint32(10).string(message.address); } if (message.validatorSigningInfo !== undefined) { @@ -270,10 +286,10 @@ export const SigningInfo = { return message; }, fromJSON(object: any): SigningInfo { - const obj = createBaseSigningInfo(); - if (isSet(object.address)) obj.address = String(object.address); - if (isSet(object.validatorSigningInfo)) obj.validatorSigningInfo = ValidatorSigningInfo.fromJSON(object.validatorSigningInfo); - return obj; + return { + address: isSet(object.address) ? String(object.address) : "", + validatorSigningInfo: isSet(object.validatorSigningInfo) ? ValidatorSigningInfo.fromJSON(object.validatorSigningInfo) : undefined + }; }, toJSON(message: SigningInfo): JsonSafe<SigningInfo> { const obj: any = {}; @@ -284,9 +300,7 @@ export const SigningInfo = { fromPartial(object: DeepPartial<SigningInfo>): SigningInfo { const message = createBaseSigningInfo(); message.address = object.address ?? ""; - if (object.validatorSigningInfo !== undefined && object.validatorSigningInfo !== null) { - message.validatorSigningInfo = ValidatorSigningInfo.fromPartial(object.validatorSigningInfo); - } + message.validatorSigningInfo = object.validatorSigningInfo !== undefined && object.validatorSigningInfo !== null ? ValidatorSigningInfo.fromPartial(object.validatorSigningInfo) : undefined; return message; }, fromSDK(object: SigningInfoSDKType): SigningInfo { @@ -354,7 +368,7 @@ function createBaseValidatorMissedBlocks(): ValidatorMissedBlocks { export const ValidatorMissedBlocks = { typeUrl: "/cosmos.slashing.v1beta1.ValidatorMissedBlocks", encode(message: ValidatorMissedBlocks, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.address !== undefined) { + if (message.address !== "") { writer.uint32(10).string(message.address); } for (const v of message.missedBlocks) { @@ -383,10 +397,10 @@ export const ValidatorMissedBlocks = { return message; }, fromJSON(object: any): ValidatorMissedBlocks { - 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; + return { + address: isSet(object.address) ? String(object.address) : "", + missedBlocks: Array.isArray(object?.missedBlocks) ? object.missedBlocks.map((e: any) => MissedBlock.fromJSON(e)) : [] + }; }, toJSON(message: ValidatorMissedBlocks): JsonSafe<ValidatorMissedBlocks> { const obj: any = {}; @@ -475,10 +489,10 @@ function createBaseMissedBlock(): MissedBlock { export const MissedBlock = { typeUrl: "/cosmos.slashing.v1beta1.MissedBlock", encode(message: MissedBlock, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.index !== undefined) { + if (message.index !== BigInt(0)) { writer.uint32(8).int64(message.index); } - if (message.missed !== undefined) { + if (message.missed === true) { writer.uint32(16).bool(message.missed); } return writer; @@ -504,10 +518,10 @@ export const MissedBlock = { return message; }, fromJSON(object: any): MissedBlock { - const obj = createBaseMissedBlock(); - if (isSet(object.index)) obj.index = BigInt(object.index.toString()); - if (isSet(object.missed)) obj.missed = Boolean(object.missed); - return obj; + return { + index: isSet(object.index) ? BigInt(object.index.toString()) : BigInt(0), + missed: isSet(object.missed) ? Boolean(object.missed) : false + }; }, toJSON(message: MissedBlock): JsonSafe<MissedBlock> { const obj: any = {}; @@ -517,9 +531,7 @@ export const MissedBlock = { }, fromPartial(object: DeepPartial<MissedBlock>): MissedBlock { const message = createBaseMissedBlock(); - if (object.index !== undefined && object.index !== null) { - message.index = BigInt(object.index.toString()); - } + message.index = object.index !== undefined && object.index !== null ? BigInt(object.index.toString()) : BigInt(0); 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 7a1d6bbc68..71213b4975 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.js"; -import { Params, ParamsSDKType, ValidatorSigningInfo, ValidatorSigningInfoSDKType } from "./slashing.js"; -import { setPaginationParams } from "../../../helpers.js"; +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../base/query/v1beta1/pagination"; +import { Params, ParamsSDKType, ValidatorSigningInfo, ValidatorSigningInfoSDKType } from "./slashing"; +import { setPaginationParams } from "../../../helpers"; import { LCDClient } from "@cosmology/lcd"; -import { QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType, QuerySigningInfoRequest, QuerySigningInfoRequestSDKType, QuerySigningInfoResponse, QuerySigningInfoResponseSDKType, QuerySigningInfosRequest, QuerySigningInfosRequestSDKType, QuerySigningInfosResponse, QuerySigningInfosResponseSDKType } from "./query.js"; +import { QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType, QuerySigningInfoRequest, QuerySigningInfoRequestSDKType, QuerySigningInfoResponse, QuerySigningInfoResponseSDKType, QuerySigningInfosRequest, QuerySigningInfosRequestSDKType, QuerySigningInfosResponse, QuerySigningInfosResponseSDKType } from "./query"; 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: PageRequest.fromPartial({}) + pagination: undefined }): Promise<QuerySigningInfosResponseSDKType> { 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 0808cf79b5..72d7ff102d 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.js"; -import { Params, ParamsSDKType, ValidatorSigningInfo, ValidatorSigningInfoSDKType } from "./slashing.js"; -import { Rpc } from "../../../helpers.js"; -import { BinaryReader } from "../../../binary.js"; +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 { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; -import { QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType, QuerySigningInfoRequest, QuerySigningInfoRequestSDKType, QuerySigningInfoResponse, QuerySigningInfoResponseSDKType, QuerySigningInfosRequest, QuerySigningInfosRequestSDKType, QuerySigningInfosResponse, QuerySigningInfosResponseSDKType } from "./query.js"; +import { QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType, QuerySigningInfoRequest, QuerySigningInfoRequestSDKType, QuerySigningInfoResponse, QuerySigningInfoResponseSDKType, QuerySigningInfosRequest, QuerySigningInfosRequestSDKType, QuerySigningInfosResponse, QuerySigningInfosResponseSDKType, ReactiveQueryParamsRequest, ReactiveQuerySigningInfoRequest, ReactiveQuerySigningInfosRequest } from "./query"; /** 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: PageRequest.fromPartial({}) + pagination: undefined }): Promise<QuerySigningInfosResponse> { 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 2156c1bcbb..de8a4457b1 100644 --- a/__fixtures__/v-next/outputv4/cosmos/slashing/v1beta1/query.ts +++ b/__fixtures__/v-next/outputv4/cosmos/slashing/v1beta1/query.ts @@ -1,11 +1,13 @@ -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"; +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"; 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; @@ -16,6 +18,9 @@ export interface QueryParamsRequestSDKType {} export interface QueryParamsResponse { params: Params; } +export interface ReactiveQueryParamsResponse { + params: ComputedRef<Params>; +} export interface QueryParamsResponseProtoMsg { typeUrl: "/cosmos.slashing.v1beta1.QueryParamsResponse"; value: Uint8Array; @@ -32,6 +37,9 @@ export interface QuerySigningInfoRequest { /** cons_address is the address to query signing info of */ consAddress: string; } +export interface ReactiveQuerySigningInfoRequest { + consAddress: ComputedRef<string>; +} export interface QuerySigningInfoRequestProtoMsg { typeUrl: "/cosmos.slashing.v1beta1.QuerySigningInfoRequest"; value: Uint8Array; @@ -51,6 +59,9 @@ export interface QuerySigningInfoResponse { /** val_signing_info is the signing info of requested val cons address */ valSigningInfo: ValidatorSigningInfo; } +export interface ReactiveQuerySigningInfoResponse { + valSigningInfo: ComputedRef<ValidatorSigningInfo>; +} export interface QuerySigningInfoResponseProtoMsg { typeUrl: "/cosmos.slashing.v1beta1.QuerySigningInfoResponse"; value: Uint8Array; @@ -69,6 +80,9 @@ export interface QuerySigningInfoResponseSDKType { export interface QuerySigningInfosRequest { pagination?: PageRequest; } +export interface ReactiveQuerySigningInfosRequest { + pagination?: ComputedRef<PageRequest>; +} export interface QuerySigningInfosRequestProtoMsg { typeUrl: "/cosmos.slashing.v1beta1.QuerySigningInfosRequest"; value: Uint8Array; @@ -89,6 +103,10 @@ export interface QuerySigningInfosResponse { info: ValidatorSigningInfo[]; pagination?: PageResponse; } +export interface ReactiveQuerySigningInfosResponse { + info: ComputedRef<ValidatorSigningInfo[]>; + pagination?: ComputedRef<PageResponse>; +} export interface QuerySigningInfosResponseProtoMsg { typeUrl: "/cosmos.slashing.v1beta1.QuerySigningInfosResponse"; value: Uint8Array; @@ -124,8 +142,7 @@ export const QueryParamsRequest = { return message; }, fromJSON(_: any): QueryParamsRequest { - const obj = createBaseQueryParamsRequest(); - return obj; + return {}; }, toJSON(_: QueryParamsRequest): JsonSafe<QueryParamsRequest> { const obj: any = {}; @@ -206,9 +223,9 @@ export const QueryParamsResponse = { return message; }, fromJSON(object: any): QueryParamsResponse { - const obj = createBaseQueryParamsResponse(); - if (isSet(object.params)) obj.params = Params.fromJSON(object.params); - return obj; + return { + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined + }; }, toJSON(message: QueryParamsResponse): JsonSafe<QueryParamsResponse> { const obj: any = {}; @@ -217,9 +234,7 @@ export const QueryParamsResponse = { }, fromPartial(object: DeepPartial<QueryParamsResponse>): QueryParamsResponse { const message = createBaseQueryParamsResponse(); - if (object.params !== undefined && object.params !== null) { - message.params = Params.fromPartial(object.params); - } + message.params = object.params !== undefined && object.params !== null ? Params.fromPartial(object.params) : undefined; return message; }, fromSDK(object: QueryParamsResponseSDKType): QueryParamsResponse { @@ -279,7 +294,7 @@ function createBaseQuerySigningInfoRequest(): QuerySigningInfoRequest { export const QuerySigningInfoRequest = { typeUrl: "/cosmos.slashing.v1beta1.QuerySigningInfoRequest", encode(message: QuerySigningInfoRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.consAddress !== undefined) { + if (message.consAddress !== "") { writer.uint32(10).string(message.consAddress); } return writer; @@ -302,9 +317,9 @@ export const QuerySigningInfoRequest = { return message; }, fromJSON(object: any): QuerySigningInfoRequest { - const obj = createBaseQuerySigningInfoRequest(); - if (isSet(object.consAddress)) obj.consAddress = String(object.consAddress); - return obj; + return { + consAddress: isSet(object.consAddress) ? String(object.consAddress) : "" + }; }, toJSON(message: QuerySigningInfoRequest): JsonSafe<QuerySigningInfoRequest> { const obj: any = {}; @@ -396,9 +411,9 @@ export const QuerySigningInfoResponse = { return message; }, fromJSON(object: any): QuerySigningInfoResponse { - const obj = createBaseQuerySigningInfoResponse(); - if (isSet(object.valSigningInfo)) obj.valSigningInfo = ValidatorSigningInfo.fromJSON(object.valSigningInfo); - return obj; + return { + valSigningInfo: isSet(object.valSigningInfo) ? ValidatorSigningInfo.fromJSON(object.valSigningInfo) : undefined + }; }, toJSON(message: QuerySigningInfoResponse): JsonSafe<QuerySigningInfoResponse> { const obj: any = {}; @@ -407,9 +422,7 @@ export const QuerySigningInfoResponse = { }, fromPartial(object: DeepPartial<QuerySigningInfoResponse>): QuerySigningInfoResponse { const message = createBaseQuerySigningInfoResponse(); - if (object.valSigningInfo !== undefined && object.valSigningInfo !== null) { - message.valSigningInfo = ValidatorSigningInfo.fromPartial(object.valSigningInfo); - } + message.valSigningInfo = object.valSigningInfo !== undefined && object.valSigningInfo !== null ? ValidatorSigningInfo.fromPartial(object.valSigningInfo) : undefined; return message; }, fromSDK(object: QuerySigningInfoResponseSDKType): QuerySigningInfoResponse { @@ -492,9 +505,9 @@ export const QuerySigningInfosRequest = { return message; }, fromJSON(object: any): QuerySigningInfosRequest { - const obj = createBaseQuerySigningInfosRequest(); - if (isSet(object.pagination)) obj.pagination = PageRequest.fromJSON(object.pagination); - return obj; + return { + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined + }; }, toJSON(message: QuerySigningInfosRequest): JsonSafe<QuerySigningInfosRequest> { const obj: any = {}; @@ -503,9 +516,7 @@ export const QuerySigningInfosRequest = { }, fromPartial(object: DeepPartial<QuerySigningInfosRequest>): QuerySigningInfosRequest { const message = createBaseQuerySigningInfosRequest(); - if (object.pagination !== undefined && object.pagination !== null) { - message.pagination = PageRequest.fromPartial(object.pagination); - } + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageRequest.fromPartial(object.pagination) : undefined; return message; }, fromSDK(object: QuerySigningInfosRequestSDKType): QuerySigningInfosRequest { @@ -595,10 +606,10 @@ export const QuerySigningInfosResponse = { return message; }, fromJSON(object: any): QuerySigningInfosResponse { - 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; + return { + info: Array.isArray(object?.info) ? object.info.map((e: any) => ValidatorSigningInfo.fromJSON(e)) : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined + }; }, toJSON(message: QuerySigningInfosResponse): JsonSafe<QuerySigningInfosResponse> { const obj: any = {}; @@ -613,9 +624,7 @@ export const QuerySigningInfosResponse = { fromPartial(object: DeepPartial<QuerySigningInfosResponse>): QuerySigningInfosResponse { const message = createBaseQuerySigningInfosResponse(); message.info = object.info?.map(e => ValidatorSigningInfo.fromPartial(e)) || []; - if (object.pagination !== undefined && object.pagination !== null) { - message.pagination = PageResponse.fromPartial(object.pagination); - } + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageResponse.fromPartial(object.pagination) : undefined; 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 288dc3e078..892a374e3a 100644 --- a/__fixtures__/v-next/outputv4/cosmos/slashing/v1beta1/slashing.ts +++ b/__fixtures__/v-next/outputv4/cosmos/slashing/v1beta1/slashing.ts @@ -1,8 +1,9 @@ -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"; +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"; export const protobufPackage = "cosmos.slashing.v1beta1"; /** * ValidatorSigningInfo defines a validator's signing info for monitoring their @@ -31,6 +32,14 @@ export interface ValidatorSigningInfo { */ missedBlocksCounter: bigint; } +export interface ReactiveValidatorSigningInfo { + address: ComputedRef<string>; + startHeight: ComputedRef<bigint>; + indexOffset: ComputedRef<bigint>; + jailedUntil: ComputedRef<Date>; + tombstoned: ComputedRef<boolean>; + missedBlocksCounter: ComputedRef<bigint>; +} export interface ValidatorSigningInfoProtoMsg { typeUrl: "/cosmos.slashing.v1beta1.ValidatorSigningInfo"; value: Uint8Array; @@ -55,6 +64,13 @@ export interface Params { slashFractionDoubleSign: Uint8Array; slashFractionDowntime: Uint8Array; } +export interface ReactiveParams { + signedBlocksWindow: ComputedRef<bigint>; + minSignedPerWindow: ComputedRef<Uint8Array>; + downtimeJailDuration: ComputedRef<Duration>; + slashFractionDoubleSign: ComputedRef<Uint8Array>; + slashFractionDowntime: ComputedRef<Uint8Array>; +} export interface ParamsProtoMsg { typeUrl: "/cosmos.slashing.v1beta1.Params"; value: Uint8Array; @@ -80,22 +96,22 @@ function createBaseValidatorSigningInfo(): ValidatorSigningInfo { export const ValidatorSigningInfo = { typeUrl: "/cosmos.slashing.v1beta1.ValidatorSigningInfo", encode(message: ValidatorSigningInfo, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.address !== undefined) { + if (message.address !== "") { writer.uint32(10).string(message.address); } - if (message.startHeight !== undefined) { + if (message.startHeight !== BigInt(0)) { writer.uint32(16).int64(message.startHeight); } - if (message.indexOffset !== undefined) { + if (message.indexOffset !== BigInt(0)) { writer.uint32(24).int64(message.indexOffset); } if (message.jailedUntil !== undefined) { Timestamp.encode(toTimestamp(message.jailedUntil), writer.uint32(34).fork()).ldelim(); } - if (message.tombstoned !== undefined) { + if (message.tombstoned === true) { writer.uint32(40).bool(message.tombstoned); } - if (message.missedBlocksCounter !== undefined) { + if (message.missedBlocksCounter !== BigInt(0)) { writer.uint32(48).int64(message.missedBlocksCounter); } return writer; @@ -133,14 +149,14 @@ export const ValidatorSigningInfo = { return message; }, fromJSON(object: any): ValidatorSigningInfo { - 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; + 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) + }; }, toJSON(message: ValidatorSigningInfo): JsonSafe<ValidatorSigningInfo> { const obj: any = {}; @@ -155,17 +171,11 @@ export const ValidatorSigningInfo = { fromPartial(object: DeepPartial<ValidatorSigningInfo>): ValidatorSigningInfo { const message = createBaseValidatorSigningInfo(); message.address = object.address ?? ""; - 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.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); message.jailedUntil = object.jailedUntil ?? undefined; message.tombstoned = object.tombstoned ?? false; - if (object.missedBlocksCounter !== undefined && object.missedBlocksCounter !== null) { - message.missedBlocksCounter = BigInt(object.missedBlocksCounter.toString()); - } + message.missedBlocksCounter = object.missedBlocksCounter !== undefined && object.missedBlocksCounter !== null ? BigInt(object.missedBlocksCounter.toString()) : BigInt(0); return message; }, fromSDK(object: ValidatorSigningInfoSDKType): ValidatorSigningInfo { @@ -264,7 +274,7 @@ function createBaseParams(): Params { export const Params = { typeUrl: "/cosmos.slashing.v1beta1.Params", encode(message: Params, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.signedBlocksWindow !== undefined) { + if (message.signedBlocksWindow !== BigInt(0)) { writer.uint32(8).int64(message.signedBlocksWindow); } if (message.minSignedPerWindow.length !== 0) { @@ -311,13 +321,13 @@ export const Params = { return message; }, fromJSON(object: any): Params { - 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; + 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() + }; }, toJSON(message: Params): JsonSafe<Params> { const obj: any = {}; @@ -330,13 +340,9 @@ export const Params = { }, fromPartial(object: DeepPartial<Params>): Params { const message = createBaseParams(); - if (object.signedBlocksWindow !== undefined && object.signedBlocksWindow !== null) { - message.signedBlocksWindow = BigInt(object.signedBlocksWindow.toString()); - } + message.signedBlocksWindow = object.signedBlocksWindow !== undefined && object.signedBlocksWindow !== null ? BigInt(object.signedBlocksWindow.toString()) : BigInt(0); message.minSignedPerWindow = object.minSignedPerWindow ?? new Uint8Array(); - if (object.downtimeJailDuration !== undefined && object.downtimeJailDuration !== null) { - message.downtimeJailDuration = Duration.fromPartial(object.downtimeJailDuration); - } + message.downtimeJailDuration = object.downtimeJailDuration !== undefined && object.downtimeJailDuration !== null ? Duration.fromPartial(object.downtimeJailDuration) : undefined; 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 78ca510244..9a3e9b11e4 100644 --- a/__fixtures__/v-next/outputv4/cosmos/slashing/v1beta1/tx.amino.ts +++ b/__fixtures__/v-next/outputv4/cosmos/slashing/v1beta1/tx.amino.ts @@ -1,5 +1,5 @@ import { AminoMsg } from "@cosmjs/amino"; -import { MsgUnjail, MsgUnjailSDKType } from "./tx.js"; +import { MsgUnjail, MsgUnjailSDKType } from "./tx"; 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 c7c212537b..cbbf990ff1 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.js"; +import { MsgUnjail, MsgUnjailSDKType } from "./tx"; 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 81e397e161..7003cb7909 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.js"; -import { BinaryReader } from "../../../binary.js"; -import { MsgUnjail, MsgUnjailSDKType, MsgUnjailResponse, MsgUnjailResponseSDKType } from "./tx.js"; +import { Rpc } from "../../../helpers"; +import { BinaryReader } from "../../../binary"; +import { MsgUnjail, MsgUnjailSDKType, MsgUnjailResponse, MsgUnjailResponseSDKType } from "./tx"; /** 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 e46a2ba6f1..384cc925a2 100644 --- a/__fixtures__/v-next/outputv4/cosmos/slashing/v1beta1/tx.ts +++ b/__fixtures__/v-next/outputv4/cosmos/slashing/v1beta1/tx.ts @@ -1,11 +1,15 @@ -import { BinaryReader, BinaryWriter } from "../../../binary.js"; -import { isSet, DeepPartial } from "../../../helpers.js"; -import { JsonSafe } from "../../../json-safe.js"; +import { BinaryReader, BinaryWriter } from "../../../binary"; +import { isSet, DeepPartial } from "../../../helpers"; +import { JsonSafe } from "../../../json-safe"; +import { ComputedRef } from "vue"; export const protobufPackage = "cosmos.slashing.v1beta1"; /** MsgUnjail defines the Msg/Unjail request type */ export interface MsgUnjail { validatorAddr: string; } +export interface ReactiveMsgUnjail { + validatorAddr: ComputedRef<string>; +} export interface MsgUnjailProtoMsg { typeUrl: "/cosmos.slashing.v1beta1.MsgUnjail"; value: Uint8Array; @@ -16,6 +20,7 @@ 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; @@ -30,7 +35,7 @@ function createBaseMsgUnjail(): MsgUnjail { export const MsgUnjail = { typeUrl: "/cosmos.slashing.v1beta1.MsgUnjail", encode(message: MsgUnjail, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.validatorAddr !== undefined) { + if (message.validatorAddr !== "") { writer.uint32(10).string(message.validatorAddr); } return writer; @@ -53,9 +58,9 @@ export const MsgUnjail = { return message; }, fromJSON(object: any): MsgUnjail { - const obj = createBaseMsgUnjail(); - if (isSet(object.validatorAddr)) obj.validatorAddr = String(object.validatorAddr); - return obj; + return { + validatorAddr: isSet(object.validatorAddr) ? String(object.validatorAddr) : "" + }; }, toJSON(message: MsgUnjail): JsonSafe<MsgUnjail> { const obj: any = {}; @@ -139,8 +144,7 @@ export const MsgUnjailResponse = { return message; }, fromJSON(_: any): MsgUnjailResponse { - const obj = createBaseMsgUnjailResponse(); - return obj; + return {}; }, toJSON(_: MsgUnjailResponse): JsonSafe<MsgUnjailResponse> { 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 eb1307bbe3..700e850e7b 100644 --- a/__fixtures__/v-next/outputv4/cosmos/staking/v1beta1/authz.ts +++ b/__fixtures__/v-next/outputv4/cosmos/staking/v1beta1/authz.ts @@ -1,7 +1,8 @@ -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"; +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"; export const protobufPackage = "cosmos.staking.v1beta1"; /** * AuthorizationType defines the type of staking module authorization type @@ -76,6 +77,12 @@ export interface StakeAuthorization { /** authorization_type defines one of AuthorizationType. */ authorizationType: AuthorizationType; } +export interface ReactiveStakeAuthorization { + maxTokens?: ComputedRef<Coin>; + allowList?: ComputedRef<StakeAuthorization_Validators>; + denyList?: ComputedRef<StakeAuthorization_Validators>; + authorizationType: ComputedRef<AuthorizationType>; +} export interface StakeAuthorizationProtoMsg { typeUrl: "/cosmos.staking.v1beta1.StakeAuthorization"; value: Uint8Array; @@ -95,6 +102,9 @@ export interface StakeAuthorizationSDKType { export interface StakeAuthorization_Validators { address: string[]; } +export interface ReactiveStakeAuthorization_Validators { + address: ComputedRef<string[]>; +} export interface StakeAuthorization_ValidatorsProtoMsg { typeUrl: "/cosmos.staking.v1beta1.Validators"; value: Uint8Array; @@ -155,12 +165,12 @@ export const StakeAuthorization = { return message; }, fromJSON(object: any): StakeAuthorization { - 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; + 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 + }; }, toJSON(message: StakeAuthorization): JsonSafe<StakeAuthorization> { const obj: any = {}; @@ -172,15 +182,9 @@ export const StakeAuthorization = { }, fromPartial(object: DeepPartial<StakeAuthorization>): StakeAuthorization { const message = createBaseStakeAuthorization(); - 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.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; message.authorizationType = object.authorizationType ?? 0; return message; }, @@ -285,9 +289,9 @@ export const StakeAuthorization_Validators = { return message; }, fromJSON(object: any): StakeAuthorization_Validators { - const obj = createBaseStakeAuthorization_Validators(); - if (Array.isArray(object?.address)) obj.address = object.address.map((e: any) => String(e)); - return obj; + return { + address: Array.isArray(object?.address) ? object.address.map((e: any) => String(e)) : [] + }; }, toJSON(message: StakeAuthorization_Validators): JsonSafe<StakeAuthorization_Validators> { 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 17b0b3094d..42a32bbf93 100644 --- a/__fixtures__/v-next/outputv4/cosmos/staking/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputv4/cosmos/staking/v1beta1/genesis.ts @@ -1,7 +1,8 @@ -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"; +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"; export const protobufPackage = "cosmos.staking.v1beta1"; /** GenesisState defines the staking module's genesis state. */ export interface GenesisState { @@ -27,6 +28,16 @@ export interface GenesisState { redelegations: Redelegation[]; exported: boolean; } +export interface ReactiveGenesisState { + params: ComputedRef<Params>; + lastTotalPower: ComputedRef<Uint8Array>; + lastValidatorPowers: ComputedRef<LastValidatorPower[]>; + validators: ComputedRef<Validator[]>; + delegations: ComputedRef<Delegation[]>; + unbondingDelegations: ComputedRef<UnbondingDelegation[]>; + redelegations: ComputedRef<Redelegation[]>; + exported: ComputedRef<boolean>; +} export interface GenesisStateProtoMsg { typeUrl: "/cosmos.staking.v1beta1.GenesisState"; value: Uint8Array; @@ -49,6 +60,10 @@ export interface LastValidatorPower { /** power defines the power of the validator. */ power: bigint; } +export interface ReactiveLastValidatorPower { + address: ComputedRef<string>; + power: ComputedRef<bigint>; +} export interface LastValidatorPowerProtoMsg { typeUrl: "/cosmos.staking.v1beta1.LastValidatorPower"; value: Uint8Array; @@ -94,7 +109,7 @@ export const GenesisState = { for (const v of message.redelegations) { Redelegation.encode(v!, writer.uint32(58).fork()).ldelim(); } - if (message.exported !== undefined) { + if (message.exported === true) { writer.uint32(64).bool(message.exported); } return writer; @@ -138,16 +153,16 @@ export const GenesisState = { return message; }, fromJSON(object: any): GenesisState { - 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; + 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 + }; }, toJSON(message: GenesisState): JsonSafe<GenesisState> { const obj: any = {}; @@ -183,9 +198,7 @@ export const GenesisState = { }, fromPartial(object: DeepPartial<GenesisState>): GenesisState { const message = createBaseGenesisState(); - if (object.params !== undefined && object.params !== null) { - message.params = Params.fromPartial(object.params); - } + message.params = object.params !== undefined && object.params !== null ? Params.fromPartial(object.params) : undefined; message.lastTotalPower = object.lastTotalPower ?? new Uint8Array(); message.lastValidatorPowers = object.lastValidatorPowers?.map(e => LastValidatorPower.fromPartial(e)) || []; message.validators = object.validators?.map(e => Validator.fromPartial(e)) || []; @@ -332,10 +345,10 @@ function createBaseLastValidatorPower(): LastValidatorPower { export const LastValidatorPower = { typeUrl: "/cosmos.staking.v1beta1.LastValidatorPower", encode(message: LastValidatorPower, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.address !== undefined) { + if (message.address !== "") { writer.uint32(10).string(message.address); } - if (message.power !== undefined) { + if (message.power !== BigInt(0)) { writer.uint32(16).int64(message.power); } return writer; @@ -361,10 +374,10 @@ export const LastValidatorPower = { return message; }, fromJSON(object: any): LastValidatorPower { - const obj = createBaseLastValidatorPower(); - if (isSet(object.address)) obj.address = String(object.address); - if (isSet(object.power)) obj.power = BigInt(object.power.toString()); - return obj; + return { + address: isSet(object.address) ? String(object.address) : "", + power: isSet(object.power) ? BigInt(object.power.toString()) : BigInt(0) + }; }, toJSON(message: LastValidatorPower): JsonSafe<LastValidatorPower> { const obj: any = {}; @@ -375,9 +388,7 @@ export const LastValidatorPower = { fromPartial(object: DeepPartial<LastValidatorPower>): LastValidatorPower { const message = createBaseLastValidatorPower(); message.address = object.address ?? ""; - if (object.power !== undefined && object.power !== null) { - message.power = BigInt(object.power.toString()); - } + message.power = object.power !== undefined && object.power !== null ? BigInt(object.power.toString()) : BigInt(0); 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 385240543e..056cbdc1d3 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.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 { 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 { 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.js"; +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"; 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 6cb4037052..8d9ca64a2b 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,9 +1,12 @@ -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"; +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"; /** Query defines the gRPC querier service. */ export interface Query { /** Validators queries all validators that match the given status. */ @@ -184,4 +187,444 @@ export const createRpcQueryExtension = (base: QueryClient) => { return queryService.params(request); } }; +}; +export interface UseValidatorsQuery<TData> extends VueQueryParams<QueryValidatorsResponse, TData> { + request: ReactiveQueryValidatorsRequest; +} +export interface UseValidatorQuery<TData> extends VueQueryParams<QueryValidatorResponse, TData> { + request: ReactiveQueryValidatorRequest; +} +export interface UseValidatorDelegationsQuery<TData> extends VueQueryParams<QueryValidatorDelegationsResponse, TData> { + request: ReactiveQueryValidatorDelegationsRequest; +} +export interface UseValidatorUnbondingDelegationsQuery<TData> extends VueQueryParams<QueryValidatorUnbondingDelegationsResponse, TData> { + request: ReactiveQueryValidatorUnbondingDelegationsRequest; +} +export interface UseDelegationQuery<TData> extends VueQueryParams<QueryDelegationResponse, TData> { + request: ReactiveQueryDelegationRequest; +} +export interface UseUnbondingDelegationQuery<TData> extends VueQueryParams<QueryUnbondingDelegationResponse, TData> { + request: ReactiveQueryUnbondingDelegationRequest; +} +export interface UseDelegatorDelegationsQuery<TData> extends VueQueryParams<QueryDelegatorDelegationsResponse, TData> { + request: ReactiveQueryDelegatorDelegationsRequest; +} +export interface UseDelegatorUnbondingDelegationsQuery<TData> extends VueQueryParams<QueryDelegatorUnbondingDelegationsResponse, TData> { + request: ReactiveQueryDelegatorUnbondingDelegationsRequest; +} +export interface UseRedelegationsQuery<TData> extends VueQueryParams<QueryRedelegationsResponse, TData> { + request: ReactiveQueryRedelegationsRequest; +} +export interface UseDelegatorValidatorsQuery<TData> extends VueQueryParams<QueryDelegatorValidatorsResponse, TData> { + request: ReactiveQueryDelegatorValidatorsRequest; +} +export interface UseDelegatorValidatorQuery<TData> extends VueQueryParams<QueryDelegatorValidatorResponse, TData> { + request: ReactiveQueryDelegatorValidatorRequest; +} +export interface UseHistoricalInfoQuery<TData> extends VueQueryParams<QueryHistoricalInfoResponse, TData> { + request: ReactiveQueryHistoricalInfoRequest; +} +export interface UsePoolQuery<TData> extends VueQueryParams<QueryPoolResponse, TData> { + request?: ReactiveQueryPoolRequest; +} +export interface UseParamsQuery<TData> extends VueQueryParams<QueryParamsResponse, TData> { + request?: ReactiveQueryParamsRequest; +} +export const useQueryService = (rpc: Ref<ProtobufRpcClient | undefined>): ComputedRef<QueryClientImpl | undefined> => { + 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<ProtobufRpcClient | undefined>) => { + const queryService = useQueryService(rpc); + const useValidators = <TData = QueryValidatorsResponse,>({ + request, + options + }: UseValidatorsQuery<TData>) => { + const queryKey = ["validatorsQuery", queryService]; + if (request) { + Object.values(request).forEach((val: any) => { + queryKey.push(val); + }); + } + return useQuery<QueryValidatorsResponse, Error, TData>({ + 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 = <TData = QueryValidatorResponse,>({ + request, + options + }: UseValidatorQuery<TData>) => { + const queryKey = ["validatorQuery", queryService]; + if (request) { + Object.values(request).forEach((val: any) => { + queryKey.push(val); + }); + } + return useQuery<QueryValidatorResponse, Error, TData>({ + 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 = <TData = QueryValidatorDelegationsResponse,>({ + request, + options + }: UseValidatorDelegationsQuery<TData>) => { + const queryKey = ["validatorDelegationsQuery", queryService]; + if (request) { + Object.values(request).forEach((val: any) => { + queryKey.push(val); + }); + } + return useQuery<QueryValidatorDelegationsResponse, Error, TData>({ + 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 = <TData = QueryValidatorUnbondingDelegationsResponse,>({ + request, + options + }: UseValidatorUnbondingDelegationsQuery<TData>) => { + const queryKey = ["validatorUnbondingDelegationsQuery", queryService]; + if (request) { + Object.values(request).forEach((val: any) => { + queryKey.push(val); + }); + } + return useQuery<QueryValidatorUnbondingDelegationsResponse, Error, TData>({ + 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 = <TData = QueryDelegationResponse,>({ + request, + options + }: UseDelegationQuery<TData>) => { + const queryKey = ["delegationQuery", queryService]; + if (request) { + Object.values(request).forEach((val: any) => { + queryKey.push(val); + }); + } + return useQuery<QueryDelegationResponse, Error, TData>({ + 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 = <TData = QueryUnbondingDelegationResponse,>({ + request, + options + }: UseUnbondingDelegationQuery<TData>) => { + const queryKey = ["unbondingDelegationQuery", queryService]; + if (request) { + Object.values(request).forEach((val: any) => { + queryKey.push(val); + }); + } + return useQuery<QueryUnbondingDelegationResponse, Error, TData>({ + 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 = <TData = QueryDelegatorDelegationsResponse,>({ + request, + options + }: UseDelegatorDelegationsQuery<TData>) => { + const queryKey = ["delegatorDelegationsQuery", queryService]; + if (request) { + Object.values(request).forEach((val: any) => { + queryKey.push(val); + }); + } + return useQuery<QueryDelegatorDelegationsResponse, Error, TData>({ + 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 = <TData = QueryDelegatorUnbondingDelegationsResponse,>({ + request, + options + }: UseDelegatorUnbondingDelegationsQuery<TData>) => { + const queryKey = ["delegatorUnbondingDelegationsQuery", queryService]; + if (request) { + Object.values(request).forEach((val: any) => { + queryKey.push(val); + }); + } + return useQuery<QueryDelegatorUnbondingDelegationsResponse, Error, TData>({ + 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 = <TData = QueryRedelegationsResponse,>({ + request, + options + }: UseRedelegationsQuery<TData>) => { + const queryKey = ["redelegationsQuery", queryService]; + if (request) { + Object.values(request).forEach((val: any) => { + queryKey.push(val); + }); + } + return useQuery<QueryRedelegationsResponse, Error, TData>({ + 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 = <TData = QueryDelegatorValidatorsResponse,>({ + request, + options + }: UseDelegatorValidatorsQuery<TData>) => { + const queryKey = ["delegatorValidatorsQuery", queryService]; + if (request) { + Object.values(request).forEach((val: any) => { + queryKey.push(val); + }); + } + return useQuery<QueryDelegatorValidatorsResponse, Error, TData>({ + 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 = <TData = QueryDelegatorValidatorResponse,>({ + request, + options + }: UseDelegatorValidatorQuery<TData>) => { + const queryKey = ["delegatorValidatorQuery", queryService]; + if (request) { + Object.values(request).forEach((val: any) => { + queryKey.push(val); + }); + } + return useQuery<QueryDelegatorValidatorResponse, Error, TData>({ + 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 = <TData = QueryHistoricalInfoResponse,>({ + request, + options + }: UseHistoricalInfoQuery<TData>) => { + const queryKey = ["historicalInfoQuery", queryService]; + if (request) { + Object.values(request).forEach((val: any) => { + queryKey.push(val); + }); + } + return useQuery<QueryHistoricalInfoResponse, Error, TData>({ + 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 = <TData = QueryPoolResponse,>({ + request, + options + }: UsePoolQuery<TData>) => { + const queryKey = ["poolQuery", queryService]; + if (request) { + Object.values(request).forEach((val: any) => { + queryKey.push(val); + }); + } + return useQuery<QueryPoolResponse, Error, TData>({ + 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 = <TData = QueryParamsResponse,>({ + request, + options + }: UseParamsQuery<TData>) => { + const queryKey = ["paramsQuery", queryService]; + if (request) { + Object.values(request).forEach((val: any) => { + queryKey.push(val); + }); + } + return useQuery<QueryParamsResponse, Error, TData>({ + 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 a89bebd5d4..8665874275 100644 --- a/__fixtures__/v-next/outputv4/cosmos/staking/v1beta1/query.ts +++ b/__fixtures__/v-next/outputv4/cosmos/staking/v1beta1/query.ts @@ -1,8 +1,9 @@ -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"; +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"; export const protobufPackage = "cosmos.staking.v1beta1"; /** QueryValidatorsRequest is request type for Query/Validators RPC method. */ export interface QueryValidatorsRequest { @@ -11,6 +12,10 @@ export interface QueryValidatorsRequest { /** pagination defines an optional pagination for the request. */ pagination?: PageRequest; } +export interface ReactiveQueryValidatorsRequest { + status: ComputedRef<string>; + pagination?: ComputedRef<PageRequest>; +} export interface QueryValidatorsRequestProtoMsg { typeUrl: "/cosmos.staking.v1beta1.QueryValidatorsRequest"; value: Uint8Array; @@ -27,6 +32,10 @@ export interface QueryValidatorsResponse { /** pagination defines the pagination in the response. */ pagination?: PageResponse; } +export interface ReactiveQueryValidatorsResponse { + validators: ComputedRef<Validator[]>; + pagination?: ComputedRef<PageResponse>; +} export interface QueryValidatorsResponseProtoMsg { typeUrl: "/cosmos.staking.v1beta1.QueryValidatorsResponse"; value: Uint8Array; @@ -41,6 +50,9 @@ export interface QueryValidatorRequest { /** validator_addr defines the validator address to query for. */ validatorAddr: string; } +export interface ReactiveQueryValidatorRequest { + validatorAddr: ComputedRef<string>; +} export interface QueryValidatorRequestProtoMsg { typeUrl: "/cosmos.staking.v1beta1.QueryValidatorRequest"; value: Uint8Array; @@ -54,6 +66,9 @@ export interface QueryValidatorResponse { /** validator defines the the validator info. */ validator: Validator; } +export interface ReactiveQueryValidatorResponse { + validator: ComputedRef<Validator>; +} export interface QueryValidatorResponseProtoMsg { typeUrl: "/cosmos.staking.v1beta1.QueryValidatorResponse"; value: Uint8Array; @@ -72,6 +87,10 @@ export interface QueryValidatorDelegationsRequest { /** pagination defines an optional pagination for the request. */ pagination?: PageRequest; } +export interface ReactiveQueryValidatorDelegationsRequest { + validatorAddr: ComputedRef<string>; + pagination?: ComputedRef<PageRequest>; +} export interface QueryValidatorDelegationsRequestProtoMsg { typeUrl: "/cosmos.staking.v1beta1.QueryValidatorDelegationsRequest"; value: Uint8Array; @@ -93,6 +112,10 @@ export interface QueryValidatorDelegationsResponse { /** pagination defines the pagination in the response. */ pagination?: PageResponse; } +export interface ReactiveQueryValidatorDelegationsResponse { + delegationResponses: ComputedRef<DelegationResponse[]>; + pagination?: ComputedRef<PageResponse>; +} export interface QueryValidatorDelegationsResponseProtoMsg { typeUrl: "/cosmos.staking.v1beta1.QueryValidatorDelegationsResponse"; value: Uint8Array; @@ -115,6 +138,10 @@ export interface QueryValidatorUnbondingDelegationsRequest { /** pagination defines an optional pagination for the request. */ pagination?: PageRequest; } +export interface ReactiveQueryValidatorUnbondingDelegationsRequest { + validatorAddr: ComputedRef<string>; + pagination?: ComputedRef<PageRequest>; +} export interface QueryValidatorUnbondingDelegationsRequestProtoMsg { typeUrl: "/cosmos.staking.v1beta1.QueryValidatorUnbondingDelegationsRequest"; value: Uint8Array; @@ -136,6 +163,10 @@ export interface QueryValidatorUnbondingDelegationsResponse { /** pagination defines the pagination in the response. */ pagination?: PageResponse; } +export interface ReactiveQueryValidatorUnbondingDelegationsResponse { + unbondingResponses: ComputedRef<UnbondingDelegation[]>; + pagination?: ComputedRef<PageResponse>; +} export interface QueryValidatorUnbondingDelegationsResponseProtoMsg { typeUrl: "/cosmos.staking.v1beta1.QueryValidatorUnbondingDelegationsResponse"; value: Uint8Array; @@ -155,6 +186,10 @@ export interface QueryDelegationRequest { /** validator_addr defines the validator address to query for. */ validatorAddr: string; } +export interface ReactiveQueryDelegationRequest { + delegatorAddr: ComputedRef<string>; + validatorAddr: ComputedRef<string>; +} export interface QueryDelegationRequestProtoMsg { typeUrl: "/cosmos.staking.v1beta1.QueryDelegationRequest"; value: Uint8Array; @@ -169,6 +204,9 @@ export interface QueryDelegationResponse { /** delegation_responses defines the delegation info of a delegation. */ delegationResponse?: DelegationResponse; } +export interface ReactiveQueryDelegationResponse { + delegationResponse?: ComputedRef<DelegationResponse>; +} export interface QueryDelegationResponseProtoMsg { typeUrl: "/cosmos.staking.v1beta1.QueryDelegationResponse"; value: Uint8Array; @@ -187,6 +225,10 @@ export interface QueryUnbondingDelegationRequest { /** validator_addr defines the validator address to query for. */ validatorAddr: string; } +export interface ReactiveQueryUnbondingDelegationRequest { + delegatorAddr: ComputedRef<string>; + validatorAddr: ComputedRef<string>; +} export interface QueryUnbondingDelegationRequestProtoMsg { typeUrl: "/cosmos.staking.v1beta1.QueryUnbondingDelegationRequest"; value: Uint8Array; @@ -207,6 +249,9 @@ export interface QueryUnbondingDelegationResponse { /** unbond defines the unbonding information of a delegation. */ unbond: UnbondingDelegation; } +export interface ReactiveQueryUnbondingDelegationResponse { + unbond: ComputedRef<UnbondingDelegation>; +} export interface QueryUnbondingDelegationResponseProtoMsg { typeUrl: "/cosmos.staking.v1beta1.QueryUnbondingDelegationResponse"; value: Uint8Array; @@ -228,6 +273,10 @@ export interface QueryDelegatorDelegationsRequest { /** pagination defines an optional pagination for the request. */ pagination?: PageRequest; } +export interface ReactiveQueryDelegatorDelegationsRequest { + delegatorAddr: ComputedRef<string>; + pagination?: ComputedRef<PageRequest>; +} export interface QueryDelegatorDelegationsRequestProtoMsg { typeUrl: "/cosmos.staking.v1beta1.QueryDelegatorDelegationsRequest"; value: Uint8Array; @@ -250,6 +299,10 @@ export interface QueryDelegatorDelegationsResponse { /** pagination defines the pagination in the response. */ pagination?: PageResponse; } +export interface ReactiveQueryDelegatorDelegationsResponse { + delegationResponses: ComputedRef<DelegationResponse[]>; + pagination?: ComputedRef<PageResponse>; +} export interface QueryDelegatorDelegationsResponseProtoMsg { typeUrl: "/cosmos.staking.v1beta1.QueryDelegatorDelegationsResponse"; value: Uint8Array; @@ -272,6 +325,10 @@ export interface QueryDelegatorUnbondingDelegationsRequest { /** pagination defines an optional pagination for the request. */ pagination?: PageRequest; } +export interface ReactiveQueryDelegatorUnbondingDelegationsRequest { + delegatorAddr: ComputedRef<string>; + pagination?: ComputedRef<PageRequest>; +} export interface QueryDelegatorUnbondingDelegationsRequestProtoMsg { typeUrl: "/cosmos.staking.v1beta1.QueryDelegatorUnbondingDelegationsRequest"; value: Uint8Array; @@ -293,6 +350,10 @@ export interface QueryDelegatorUnbondingDelegationsResponse { /** pagination defines the pagination in the response. */ pagination?: PageResponse; } +export interface ReactiveQueryDelegatorUnbondingDelegationsResponse { + unbondingResponses: ComputedRef<UnbondingDelegation[]>; + pagination?: ComputedRef<PageResponse>; +} export interface QueryDelegatorUnbondingDelegationsResponseProtoMsg { typeUrl: "/cosmos.staking.v1beta1.QueryDelegatorUnbondingDelegationsResponse"; value: Uint8Array; @@ -319,6 +380,12 @@ export interface QueryRedelegationsRequest { /** pagination defines an optional pagination for the request. */ pagination?: PageRequest; } +export interface ReactiveQueryRedelegationsRequest { + delegatorAddr: ComputedRef<string>; + srcValidatorAddr: ComputedRef<string>; + dstValidatorAddr: ComputedRef<string>; + pagination?: ComputedRef<PageRequest>; +} export interface QueryRedelegationsRequestProtoMsg { typeUrl: "/cosmos.staking.v1beta1.QueryRedelegationsRequest"; value: Uint8Array; @@ -342,6 +409,10 @@ export interface QueryRedelegationsResponse { /** pagination defines the pagination in the response. */ pagination?: PageResponse; } +export interface ReactiveQueryRedelegationsResponse { + redelegationResponses: ComputedRef<RedelegationResponse[]>; + pagination?: ComputedRef<PageResponse>; +} export interface QueryRedelegationsResponseProtoMsg { typeUrl: "/cosmos.staking.v1beta1.QueryRedelegationsResponse"; value: Uint8Array; @@ -364,6 +435,10 @@ export interface QueryDelegatorValidatorsRequest { /** pagination defines an optional pagination for the request. */ pagination?: PageRequest; } +export interface ReactiveQueryDelegatorValidatorsRequest { + delegatorAddr: ComputedRef<string>; + pagination?: ComputedRef<PageRequest>; +} export interface QueryDelegatorValidatorsRequestProtoMsg { typeUrl: "/cosmos.staking.v1beta1.QueryDelegatorValidatorsRequest"; value: Uint8Array; @@ -386,6 +461,10 @@ export interface QueryDelegatorValidatorsResponse { /** pagination defines the pagination in the response. */ pagination?: PageResponse; } +export interface ReactiveQueryDelegatorValidatorsResponse { + validators: ComputedRef<Validator[]>; + pagination?: ComputedRef<PageResponse>; +} export interface QueryDelegatorValidatorsResponseProtoMsg { typeUrl: "/cosmos.staking.v1beta1.QueryDelegatorValidatorsResponse"; value: Uint8Array; @@ -408,6 +487,10 @@ export interface QueryDelegatorValidatorRequest { /** validator_addr defines the validator address to query for. */ validatorAddr: string; } +export interface ReactiveQueryDelegatorValidatorRequest { + delegatorAddr: ComputedRef<string>; + validatorAddr: ComputedRef<string>; +} export interface QueryDelegatorValidatorRequestProtoMsg { typeUrl: "/cosmos.staking.v1beta1.QueryDelegatorValidatorRequest"; value: Uint8Array; @@ -428,6 +511,9 @@ export interface QueryDelegatorValidatorResponse { /** validator defines the the validator info. */ validator: Validator; } +export interface ReactiveQueryDelegatorValidatorResponse { + validator: ComputedRef<Validator>; +} export interface QueryDelegatorValidatorResponseProtoMsg { typeUrl: "/cosmos.staking.v1beta1.QueryDelegatorValidatorResponse"; value: Uint8Array; @@ -447,6 +533,9 @@ export interface QueryHistoricalInfoRequest { /** height defines at which height to query the historical info. */ height: bigint; } +export interface ReactiveQueryHistoricalInfoRequest { + height: ComputedRef<bigint>; +} export interface QueryHistoricalInfoRequestProtoMsg { typeUrl: "/cosmos.staking.v1beta1.QueryHistoricalInfoRequest"; value: Uint8Array; @@ -466,6 +555,9 @@ export interface QueryHistoricalInfoResponse { /** hist defines the historical info at the given height. */ hist?: HistoricalInfo; } +export interface ReactiveQueryHistoricalInfoResponse { + hist?: ComputedRef<HistoricalInfo>; +} export interface QueryHistoricalInfoResponseProtoMsg { typeUrl: "/cosmos.staking.v1beta1.QueryHistoricalInfoResponse"; value: Uint8Array; @@ -479,6 +571,7 @@ 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; @@ -490,6 +583,9 @@ export interface QueryPoolResponse { /** pool defines the pool info. */ pool: Pool; } +export interface ReactiveQueryPoolResponse { + pool: ComputedRef<Pool>; +} export interface QueryPoolResponseProtoMsg { typeUrl: "/cosmos.staking.v1beta1.QueryPoolResponse"; value: Uint8Array; @@ -500,6 +596,7 @@ 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; @@ -511,6 +608,9 @@ export interface QueryParamsResponse { /** params holds all the parameters of this module. */ params: Params; } +export interface ReactiveQueryParamsResponse { + params: ComputedRef<Params>; +} export interface QueryParamsResponseProtoMsg { typeUrl: "/cosmos.staking.v1beta1.QueryParamsResponse"; value: Uint8Array; @@ -528,7 +628,7 @@ function createBaseQueryValidatorsRequest(): QueryValidatorsRequest { export const QueryValidatorsRequest = { typeUrl: "/cosmos.staking.v1beta1.QueryValidatorsRequest", encode(message: QueryValidatorsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.status !== undefined) { + if (message.status !== "") { writer.uint32(10).string(message.status); } if (message.pagination !== undefined) { @@ -557,10 +657,10 @@ export const QueryValidatorsRequest = { return message; }, fromJSON(object: any): QueryValidatorsRequest { - const obj = createBaseQueryValidatorsRequest(); - if (isSet(object.status)) obj.status = String(object.status); - if (isSet(object.pagination)) obj.pagination = PageRequest.fromJSON(object.pagination); - return obj; + return { + status: isSet(object.status) ? String(object.status) : "", + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined + }; }, toJSON(message: QueryValidatorsRequest): JsonSafe<QueryValidatorsRequest> { const obj: any = {}; @@ -571,9 +671,7 @@ export const QueryValidatorsRequest = { fromPartial(object: DeepPartial<QueryValidatorsRequest>): QueryValidatorsRequest { const message = createBaseQueryValidatorsRequest(); message.status = object.status ?? ""; - if (object.pagination !== undefined && object.pagination !== null) { - message.pagination = PageRequest.fromPartial(object.pagination); - } + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageRequest.fromPartial(object.pagination) : undefined; return message; }, fromSDK(object: QueryValidatorsRequestSDKType): QueryValidatorsRequest { @@ -670,10 +768,10 @@ export const QueryValidatorsResponse = { return message; }, fromJSON(object: any): QueryValidatorsResponse { - 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; + return { + validators: Array.isArray(object?.validators) ? object.validators.map((e: any) => Validator.fromJSON(e)) : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined + }; }, toJSON(message: QueryValidatorsResponse): JsonSafe<QueryValidatorsResponse> { const obj: any = {}; @@ -688,9 +786,7 @@ export const QueryValidatorsResponse = { fromPartial(object: DeepPartial<QueryValidatorsResponse>): QueryValidatorsResponse { const message = createBaseQueryValidatorsResponse(); message.validators = object.validators?.map(e => Validator.fromPartial(e)) || []; - if (object.pagination !== undefined && object.pagination !== null) { - message.pagination = PageResponse.fromPartial(object.pagination); - } + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageResponse.fromPartial(object.pagination) : undefined; return message; }, fromSDK(object: QueryValidatorsResponseSDKType): QueryValidatorsResponse { @@ -763,7 +859,7 @@ function createBaseQueryValidatorRequest(): QueryValidatorRequest { export const QueryValidatorRequest = { typeUrl: "/cosmos.staking.v1beta1.QueryValidatorRequest", encode(message: QueryValidatorRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.validatorAddr !== undefined) { + if (message.validatorAddr !== "") { writer.uint32(10).string(message.validatorAddr); } return writer; @@ -786,9 +882,9 @@ export const QueryValidatorRequest = { return message; }, fromJSON(object: any): QueryValidatorRequest { - const obj = createBaseQueryValidatorRequest(); - if (isSet(object.validatorAddr)) obj.validatorAddr = String(object.validatorAddr); - return obj; + return { + validatorAddr: isSet(object.validatorAddr) ? String(object.validatorAddr) : "" + }; }, toJSON(message: QueryValidatorRequest): JsonSafe<QueryValidatorRequest> { const obj: any = {}; @@ -880,9 +976,9 @@ export const QueryValidatorResponse = { return message; }, fromJSON(object: any): QueryValidatorResponse { - const obj = createBaseQueryValidatorResponse(); - if (isSet(object.validator)) obj.validator = Validator.fromJSON(object.validator); - return obj; + return { + validator: isSet(object.validator) ? Validator.fromJSON(object.validator) : undefined + }; }, toJSON(message: QueryValidatorResponse): JsonSafe<QueryValidatorResponse> { const obj: any = {}; @@ -891,9 +987,7 @@ export const QueryValidatorResponse = { }, fromPartial(object: DeepPartial<QueryValidatorResponse>): QueryValidatorResponse { const message = createBaseQueryValidatorResponse(); - if (object.validator !== undefined && object.validator !== null) { - message.validator = Validator.fromPartial(object.validator); - } + message.validator = object.validator !== undefined && object.validator !== null ? Validator.fromPartial(object.validator) : undefined; return message; }, fromSDK(object: QueryValidatorResponseSDKType): QueryValidatorResponse { @@ -954,7 +1048,7 @@ function createBaseQueryValidatorDelegationsRequest(): QueryValidatorDelegations export const QueryValidatorDelegationsRequest = { typeUrl: "/cosmos.staking.v1beta1.QueryValidatorDelegationsRequest", encode(message: QueryValidatorDelegationsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.validatorAddr !== undefined) { + if (message.validatorAddr !== "") { writer.uint32(10).string(message.validatorAddr); } if (message.pagination !== undefined) { @@ -983,10 +1077,10 @@ export const QueryValidatorDelegationsRequest = { return message; }, fromJSON(object: any): QueryValidatorDelegationsRequest { - const obj = createBaseQueryValidatorDelegationsRequest(); - if (isSet(object.validatorAddr)) obj.validatorAddr = String(object.validatorAddr); - if (isSet(object.pagination)) obj.pagination = PageRequest.fromJSON(object.pagination); - return obj; + return { + validatorAddr: isSet(object.validatorAddr) ? String(object.validatorAddr) : "", + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined + }; }, toJSON(message: QueryValidatorDelegationsRequest): JsonSafe<QueryValidatorDelegationsRequest> { const obj: any = {}; @@ -997,9 +1091,7 @@ export const QueryValidatorDelegationsRequest = { fromPartial(object: DeepPartial<QueryValidatorDelegationsRequest>): QueryValidatorDelegationsRequest { const message = createBaseQueryValidatorDelegationsRequest(); message.validatorAddr = object.validatorAddr ?? ""; - if (object.pagination !== undefined && object.pagination !== null) { - message.pagination = PageRequest.fromPartial(object.pagination); - } + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageRequest.fromPartial(object.pagination) : undefined; return message; }, fromSDK(object: QueryValidatorDelegationsRequestSDKType): QueryValidatorDelegationsRequest { @@ -1096,10 +1188,10 @@ export const QueryValidatorDelegationsResponse = { return message; }, fromJSON(object: any): QueryValidatorDelegationsResponse { - 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; + return { + delegationResponses: Array.isArray(object?.delegationResponses) ? object.delegationResponses.map((e: any) => DelegationResponse.fromJSON(e)) : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined + }; }, toJSON(message: QueryValidatorDelegationsResponse): JsonSafe<QueryValidatorDelegationsResponse> { const obj: any = {}; @@ -1114,9 +1206,7 @@ export const QueryValidatorDelegationsResponse = { fromPartial(object: DeepPartial<QueryValidatorDelegationsResponse>): QueryValidatorDelegationsResponse { const message = createBaseQueryValidatorDelegationsResponse(); message.delegationResponses = object.delegationResponses?.map(e => DelegationResponse.fromPartial(e)) || []; - if (object.pagination !== undefined && object.pagination !== null) { - message.pagination = PageResponse.fromPartial(object.pagination); - } + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageResponse.fromPartial(object.pagination) : undefined; return message; }, fromSDK(object: QueryValidatorDelegationsResponseSDKType): QueryValidatorDelegationsResponse { @@ -1190,7 +1280,7 @@ function createBaseQueryValidatorUnbondingDelegationsRequest(): QueryValidatorUn export const QueryValidatorUnbondingDelegationsRequest = { typeUrl: "/cosmos.staking.v1beta1.QueryValidatorUnbondingDelegationsRequest", encode(message: QueryValidatorUnbondingDelegationsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.validatorAddr !== undefined) { + if (message.validatorAddr !== "") { writer.uint32(10).string(message.validatorAddr); } if (message.pagination !== undefined) { @@ -1219,10 +1309,10 @@ export const QueryValidatorUnbondingDelegationsRequest = { return message; }, fromJSON(object: any): QueryValidatorUnbondingDelegationsRequest { - const obj = createBaseQueryValidatorUnbondingDelegationsRequest(); - if (isSet(object.validatorAddr)) obj.validatorAddr = String(object.validatorAddr); - if (isSet(object.pagination)) obj.pagination = PageRequest.fromJSON(object.pagination); - return obj; + return { + validatorAddr: isSet(object.validatorAddr) ? String(object.validatorAddr) : "", + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined + }; }, toJSON(message: QueryValidatorUnbondingDelegationsRequest): JsonSafe<QueryValidatorUnbondingDelegationsRequest> { const obj: any = {}; @@ -1233,9 +1323,7 @@ export const QueryValidatorUnbondingDelegationsRequest = { fromPartial(object: DeepPartial<QueryValidatorUnbondingDelegationsRequest>): QueryValidatorUnbondingDelegationsRequest { const message = createBaseQueryValidatorUnbondingDelegationsRequest(); message.validatorAddr = object.validatorAddr ?? ""; - if (object.pagination !== undefined && object.pagination !== null) { - message.pagination = PageRequest.fromPartial(object.pagination); - } + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageRequest.fromPartial(object.pagination) : undefined; return message; }, fromSDK(object: QueryValidatorUnbondingDelegationsRequestSDKType): QueryValidatorUnbondingDelegationsRequest { @@ -1332,10 +1420,10 @@ export const QueryValidatorUnbondingDelegationsResponse = { return message; }, fromJSON(object: any): QueryValidatorUnbondingDelegationsResponse { - 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; + return { + unbondingResponses: Array.isArray(object?.unbondingResponses) ? object.unbondingResponses.map((e: any) => UnbondingDelegation.fromJSON(e)) : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined + }; }, toJSON(message: QueryValidatorUnbondingDelegationsResponse): JsonSafe<QueryValidatorUnbondingDelegationsResponse> { const obj: any = {}; @@ -1350,9 +1438,7 @@ export const QueryValidatorUnbondingDelegationsResponse = { fromPartial(object: DeepPartial<QueryValidatorUnbondingDelegationsResponse>): QueryValidatorUnbondingDelegationsResponse { const message = createBaseQueryValidatorUnbondingDelegationsResponse(); message.unbondingResponses = object.unbondingResponses?.map(e => UnbondingDelegation.fromPartial(e)) || []; - if (object.pagination !== undefined && object.pagination !== null) { - message.pagination = PageResponse.fromPartial(object.pagination); - } + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageResponse.fromPartial(object.pagination) : undefined; return message; }, fromSDK(object: QueryValidatorUnbondingDelegationsResponseSDKType): QueryValidatorUnbondingDelegationsResponse { @@ -1426,10 +1512,10 @@ function createBaseQueryDelegationRequest(): QueryDelegationRequest { export const QueryDelegationRequest = { typeUrl: "/cosmos.staking.v1beta1.QueryDelegationRequest", encode(message: QueryDelegationRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.delegatorAddr !== undefined) { + if (message.delegatorAddr !== "") { writer.uint32(10).string(message.delegatorAddr); } - if (message.validatorAddr !== undefined) { + if (message.validatorAddr !== "") { writer.uint32(18).string(message.validatorAddr); } return writer; @@ -1455,10 +1541,10 @@ export const QueryDelegationRequest = { return message; }, fromJSON(object: any): QueryDelegationRequest { - const obj = createBaseQueryDelegationRequest(); - if (isSet(object.delegatorAddr)) obj.delegatorAddr = String(object.delegatorAddr); - if (isSet(object.validatorAddr)) obj.validatorAddr = String(object.validatorAddr); - return obj; + return { + delegatorAddr: isSet(object.delegatorAddr) ? String(object.delegatorAddr) : "", + validatorAddr: isSet(object.validatorAddr) ? String(object.validatorAddr) : "" + }; }, toJSON(message: QueryDelegationRequest): JsonSafe<QueryDelegationRequest> { const obj: any = {}; @@ -1559,9 +1645,9 @@ export const QueryDelegationResponse = { return message; }, fromJSON(object: any): QueryDelegationResponse { - const obj = createBaseQueryDelegationResponse(); - if (isSet(object.delegationResponse)) obj.delegationResponse = DelegationResponse.fromJSON(object.delegationResponse); - return obj; + return { + delegationResponse: isSet(object.delegationResponse) ? DelegationResponse.fromJSON(object.delegationResponse) : undefined + }; }, toJSON(message: QueryDelegationResponse): JsonSafe<QueryDelegationResponse> { const obj: any = {}; @@ -1570,9 +1656,7 @@ export const QueryDelegationResponse = { }, fromPartial(object: DeepPartial<QueryDelegationResponse>): QueryDelegationResponse { const message = createBaseQueryDelegationResponse(); - if (object.delegationResponse !== undefined && object.delegationResponse !== null) { - message.delegationResponse = DelegationResponse.fromPartial(object.delegationResponse); - } + message.delegationResponse = object.delegationResponse !== undefined && object.delegationResponse !== null ? DelegationResponse.fromPartial(object.delegationResponse) : undefined; return message; }, fromSDK(object: QueryDelegationResponseSDKType): QueryDelegationResponse { @@ -1633,10 +1717,10 @@ function createBaseQueryUnbondingDelegationRequest(): QueryUnbondingDelegationRe export const QueryUnbondingDelegationRequest = { typeUrl: "/cosmos.staking.v1beta1.QueryUnbondingDelegationRequest", encode(message: QueryUnbondingDelegationRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.delegatorAddr !== undefined) { + if (message.delegatorAddr !== "") { writer.uint32(10).string(message.delegatorAddr); } - if (message.validatorAddr !== undefined) { + if (message.validatorAddr !== "") { writer.uint32(18).string(message.validatorAddr); } return writer; @@ -1662,10 +1746,10 @@ export const QueryUnbondingDelegationRequest = { return message; }, fromJSON(object: any): QueryUnbondingDelegationRequest { - const obj = createBaseQueryUnbondingDelegationRequest(); - if (isSet(object.delegatorAddr)) obj.delegatorAddr = String(object.delegatorAddr); - if (isSet(object.validatorAddr)) obj.validatorAddr = String(object.validatorAddr); - return obj; + return { + delegatorAddr: isSet(object.delegatorAddr) ? String(object.delegatorAddr) : "", + validatorAddr: isSet(object.validatorAddr) ? String(object.validatorAddr) : "" + }; }, toJSON(message: QueryUnbondingDelegationRequest): JsonSafe<QueryUnbondingDelegationRequest> { const obj: any = {}; @@ -1766,9 +1850,9 @@ export const QueryUnbondingDelegationResponse = { return message; }, fromJSON(object: any): QueryUnbondingDelegationResponse { - const obj = createBaseQueryUnbondingDelegationResponse(); - if (isSet(object.unbond)) obj.unbond = UnbondingDelegation.fromJSON(object.unbond); - return obj; + return { + unbond: isSet(object.unbond) ? UnbondingDelegation.fromJSON(object.unbond) : undefined + }; }, toJSON(message: QueryUnbondingDelegationResponse): JsonSafe<QueryUnbondingDelegationResponse> { const obj: any = {}; @@ -1777,9 +1861,7 @@ export const QueryUnbondingDelegationResponse = { }, fromPartial(object: DeepPartial<QueryUnbondingDelegationResponse>): QueryUnbondingDelegationResponse { const message = createBaseQueryUnbondingDelegationResponse(); - if (object.unbond !== undefined && object.unbond !== null) { - message.unbond = UnbondingDelegation.fromPartial(object.unbond); - } + message.unbond = object.unbond !== undefined && object.unbond !== null ? UnbondingDelegation.fromPartial(object.unbond) : undefined; return message; }, fromSDK(object: QueryUnbondingDelegationResponseSDKType): QueryUnbondingDelegationResponse { @@ -1840,7 +1922,7 @@ function createBaseQueryDelegatorDelegationsRequest(): QueryDelegatorDelegations export const QueryDelegatorDelegationsRequest = { typeUrl: "/cosmos.staking.v1beta1.QueryDelegatorDelegationsRequest", encode(message: QueryDelegatorDelegationsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.delegatorAddr !== undefined) { + if (message.delegatorAddr !== "") { writer.uint32(10).string(message.delegatorAddr); } if (message.pagination !== undefined) { @@ -1869,10 +1951,10 @@ export const QueryDelegatorDelegationsRequest = { return message; }, fromJSON(object: any): QueryDelegatorDelegationsRequest { - const obj = createBaseQueryDelegatorDelegationsRequest(); - if (isSet(object.delegatorAddr)) obj.delegatorAddr = String(object.delegatorAddr); - if (isSet(object.pagination)) obj.pagination = PageRequest.fromJSON(object.pagination); - return obj; + return { + delegatorAddr: isSet(object.delegatorAddr) ? String(object.delegatorAddr) : "", + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined + }; }, toJSON(message: QueryDelegatorDelegationsRequest): JsonSafe<QueryDelegatorDelegationsRequest> { const obj: any = {}; @@ -1883,9 +1965,7 @@ export const QueryDelegatorDelegationsRequest = { fromPartial(object: DeepPartial<QueryDelegatorDelegationsRequest>): QueryDelegatorDelegationsRequest { const message = createBaseQueryDelegatorDelegationsRequest(); message.delegatorAddr = object.delegatorAddr ?? ""; - if (object.pagination !== undefined && object.pagination !== null) { - message.pagination = PageRequest.fromPartial(object.pagination); - } + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageRequest.fromPartial(object.pagination) : undefined; return message; }, fromSDK(object: QueryDelegatorDelegationsRequestSDKType): QueryDelegatorDelegationsRequest { @@ -1982,10 +2062,10 @@ export const QueryDelegatorDelegationsResponse = { return message; }, fromJSON(object: any): QueryDelegatorDelegationsResponse { - 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; + return { + delegationResponses: Array.isArray(object?.delegationResponses) ? object.delegationResponses.map((e: any) => DelegationResponse.fromJSON(e)) : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined + }; }, toJSON(message: QueryDelegatorDelegationsResponse): JsonSafe<QueryDelegatorDelegationsResponse> { const obj: any = {}; @@ -2000,9 +2080,7 @@ export const QueryDelegatorDelegationsResponse = { fromPartial(object: DeepPartial<QueryDelegatorDelegationsResponse>): QueryDelegatorDelegationsResponse { const message = createBaseQueryDelegatorDelegationsResponse(); message.delegationResponses = object.delegationResponses?.map(e => DelegationResponse.fromPartial(e)) || []; - if (object.pagination !== undefined && object.pagination !== null) { - message.pagination = PageResponse.fromPartial(object.pagination); - } + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageResponse.fromPartial(object.pagination) : undefined; return message; }, fromSDK(object: QueryDelegatorDelegationsResponseSDKType): QueryDelegatorDelegationsResponse { @@ -2076,7 +2154,7 @@ function createBaseQueryDelegatorUnbondingDelegationsRequest(): QueryDelegatorUn export const QueryDelegatorUnbondingDelegationsRequest = { typeUrl: "/cosmos.staking.v1beta1.QueryDelegatorUnbondingDelegationsRequest", encode(message: QueryDelegatorUnbondingDelegationsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.delegatorAddr !== undefined) { + if (message.delegatorAddr !== "") { writer.uint32(10).string(message.delegatorAddr); } if (message.pagination !== undefined) { @@ -2105,10 +2183,10 @@ export const QueryDelegatorUnbondingDelegationsRequest = { return message; }, fromJSON(object: any): QueryDelegatorUnbondingDelegationsRequest { - const obj = createBaseQueryDelegatorUnbondingDelegationsRequest(); - if (isSet(object.delegatorAddr)) obj.delegatorAddr = String(object.delegatorAddr); - if (isSet(object.pagination)) obj.pagination = PageRequest.fromJSON(object.pagination); - return obj; + return { + delegatorAddr: isSet(object.delegatorAddr) ? String(object.delegatorAddr) : "", + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined + }; }, toJSON(message: QueryDelegatorUnbondingDelegationsRequest): JsonSafe<QueryDelegatorUnbondingDelegationsRequest> { const obj: any = {}; @@ -2119,9 +2197,7 @@ export const QueryDelegatorUnbondingDelegationsRequest = { fromPartial(object: DeepPartial<QueryDelegatorUnbondingDelegationsRequest>): QueryDelegatorUnbondingDelegationsRequest { const message = createBaseQueryDelegatorUnbondingDelegationsRequest(); message.delegatorAddr = object.delegatorAddr ?? ""; - if (object.pagination !== undefined && object.pagination !== null) { - message.pagination = PageRequest.fromPartial(object.pagination); - } + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageRequest.fromPartial(object.pagination) : undefined; return message; }, fromSDK(object: QueryDelegatorUnbondingDelegationsRequestSDKType): QueryDelegatorUnbondingDelegationsRequest { @@ -2218,10 +2294,10 @@ export const QueryDelegatorUnbondingDelegationsResponse = { return message; }, fromJSON(object: any): QueryDelegatorUnbondingDelegationsResponse { - 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; + return { + unbondingResponses: Array.isArray(object?.unbondingResponses) ? object.unbondingResponses.map((e: any) => UnbondingDelegation.fromJSON(e)) : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined + }; }, toJSON(message: QueryDelegatorUnbondingDelegationsResponse): JsonSafe<QueryDelegatorUnbondingDelegationsResponse> { const obj: any = {}; @@ -2236,9 +2312,7 @@ export const QueryDelegatorUnbondingDelegationsResponse = { fromPartial(object: DeepPartial<QueryDelegatorUnbondingDelegationsResponse>): QueryDelegatorUnbondingDelegationsResponse { const message = createBaseQueryDelegatorUnbondingDelegationsResponse(); message.unbondingResponses = object.unbondingResponses?.map(e => UnbondingDelegation.fromPartial(e)) || []; - if (object.pagination !== undefined && object.pagination !== null) { - message.pagination = PageResponse.fromPartial(object.pagination); - } + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageResponse.fromPartial(object.pagination) : undefined; return message; }, fromSDK(object: QueryDelegatorUnbondingDelegationsResponseSDKType): QueryDelegatorUnbondingDelegationsResponse { @@ -2314,13 +2388,13 @@ function createBaseQueryRedelegationsRequest(): QueryRedelegationsRequest { export const QueryRedelegationsRequest = { typeUrl: "/cosmos.staking.v1beta1.QueryRedelegationsRequest", encode(message: QueryRedelegationsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.delegatorAddr !== undefined) { + if (message.delegatorAddr !== "") { writer.uint32(10).string(message.delegatorAddr); } - if (message.srcValidatorAddr !== undefined) { + if (message.srcValidatorAddr !== "") { writer.uint32(18).string(message.srcValidatorAddr); } - if (message.dstValidatorAddr !== undefined) { + if (message.dstValidatorAddr !== "") { writer.uint32(26).string(message.dstValidatorAddr); } if (message.pagination !== undefined) { @@ -2355,12 +2429,12 @@ export const QueryRedelegationsRequest = { return message; }, fromJSON(object: any): QueryRedelegationsRequest { - 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; + return { + delegatorAddr: isSet(object.delegatorAddr) ? String(object.delegatorAddr) : "", + srcValidatorAddr: isSet(object.srcValidatorAddr) ? String(object.srcValidatorAddr) : "", + dstValidatorAddr: isSet(object.dstValidatorAddr) ? String(object.dstValidatorAddr) : "", + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined + }; }, toJSON(message: QueryRedelegationsRequest): JsonSafe<QueryRedelegationsRequest> { const obj: any = {}; @@ -2375,9 +2449,7 @@ export const QueryRedelegationsRequest = { message.delegatorAddr = object.delegatorAddr ?? ""; message.srcValidatorAddr = object.srcValidatorAddr ?? ""; message.dstValidatorAddr = object.dstValidatorAddr ?? ""; - if (object.pagination !== undefined && object.pagination !== null) { - message.pagination = PageRequest.fromPartial(object.pagination); - } + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageRequest.fromPartial(object.pagination) : undefined; return message; }, fromSDK(object: QueryRedelegationsRequestSDKType): QueryRedelegationsRequest { @@ -2488,10 +2560,10 @@ export const QueryRedelegationsResponse = { return message; }, fromJSON(object: any): QueryRedelegationsResponse { - 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; + return { + redelegationResponses: Array.isArray(object?.redelegationResponses) ? object.redelegationResponses.map((e: any) => RedelegationResponse.fromJSON(e)) : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined + }; }, toJSON(message: QueryRedelegationsResponse): JsonSafe<QueryRedelegationsResponse> { const obj: any = {}; @@ -2506,9 +2578,7 @@ export const QueryRedelegationsResponse = { fromPartial(object: DeepPartial<QueryRedelegationsResponse>): QueryRedelegationsResponse { const message = createBaseQueryRedelegationsResponse(); message.redelegationResponses = object.redelegationResponses?.map(e => RedelegationResponse.fromPartial(e)) || []; - if (object.pagination !== undefined && object.pagination !== null) { - message.pagination = PageResponse.fromPartial(object.pagination); - } + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageResponse.fromPartial(object.pagination) : undefined; return message; }, fromSDK(object: QueryRedelegationsResponseSDKType): QueryRedelegationsResponse { @@ -2582,7 +2652,7 @@ function createBaseQueryDelegatorValidatorsRequest(): QueryDelegatorValidatorsRe export const QueryDelegatorValidatorsRequest = { typeUrl: "/cosmos.staking.v1beta1.QueryDelegatorValidatorsRequest", encode(message: QueryDelegatorValidatorsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.delegatorAddr !== undefined) { + if (message.delegatorAddr !== "") { writer.uint32(10).string(message.delegatorAddr); } if (message.pagination !== undefined) { @@ -2611,10 +2681,10 @@ export const QueryDelegatorValidatorsRequest = { return message; }, fromJSON(object: any): QueryDelegatorValidatorsRequest { - const obj = createBaseQueryDelegatorValidatorsRequest(); - if (isSet(object.delegatorAddr)) obj.delegatorAddr = String(object.delegatorAddr); - if (isSet(object.pagination)) obj.pagination = PageRequest.fromJSON(object.pagination); - return obj; + return { + delegatorAddr: isSet(object.delegatorAddr) ? String(object.delegatorAddr) : "", + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined + }; }, toJSON(message: QueryDelegatorValidatorsRequest): JsonSafe<QueryDelegatorValidatorsRequest> { const obj: any = {}; @@ -2625,9 +2695,7 @@ export const QueryDelegatorValidatorsRequest = { fromPartial(object: DeepPartial<QueryDelegatorValidatorsRequest>): QueryDelegatorValidatorsRequest { const message = createBaseQueryDelegatorValidatorsRequest(); message.delegatorAddr = object.delegatorAddr ?? ""; - if (object.pagination !== undefined && object.pagination !== null) { - message.pagination = PageRequest.fromPartial(object.pagination); - } + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageRequest.fromPartial(object.pagination) : undefined; return message; }, fromSDK(object: QueryDelegatorValidatorsRequestSDKType): QueryDelegatorValidatorsRequest { @@ -2724,10 +2792,10 @@ export const QueryDelegatorValidatorsResponse = { return message; }, fromJSON(object: any): QueryDelegatorValidatorsResponse { - 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; + return { + validators: Array.isArray(object?.validators) ? object.validators.map((e: any) => Validator.fromJSON(e)) : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined + }; }, toJSON(message: QueryDelegatorValidatorsResponse): JsonSafe<QueryDelegatorValidatorsResponse> { const obj: any = {}; @@ -2742,9 +2810,7 @@ export const QueryDelegatorValidatorsResponse = { fromPartial(object: DeepPartial<QueryDelegatorValidatorsResponse>): QueryDelegatorValidatorsResponse { const message = createBaseQueryDelegatorValidatorsResponse(); message.validators = object.validators?.map(e => Validator.fromPartial(e)) || []; - if (object.pagination !== undefined && object.pagination !== null) { - message.pagination = PageResponse.fromPartial(object.pagination); - } + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageResponse.fromPartial(object.pagination) : undefined; return message; }, fromSDK(object: QueryDelegatorValidatorsResponseSDKType): QueryDelegatorValidatorsResponse { @@ -2818,10 +2884,10 @@ function createBaseQueryDelegatorValidatorRequest(): QueryDelegatorValidatorRequ export const QueryDelegatorValidatorRequest = { typeUrl: "/cosmos.staking.v1beta1.QueryDelegatorValidatorRequest", encode(message: QueryDelegatorValidatorRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.delegatorAddr !== undefined) { + if (message.delegatorAddr !== "") { writer.uint32(10).string(message.delegatorAddr); } - if (message.validatorAddr !== undefined) { + if (message.validatorAddr !== "") { writer.uint32(18).string(message.validatorAddr); } return writer; @@ -2847,10 +2913,10 @@ export const QueryDelegatorValidatorRequest = { return message; }, fromJSON(object: any): QueryDelegatorValidatorRequest { - const obj = createBaseQueryDelegatorValidatorRequest(); - if (isSet(object.delegatorAddr)) obj.delegatorAddr = String(object.delegatorAddr); - if (isSet(object.validatorAddr)) obj.validatorAddr = String(object.validatorAddr); - return obj; + return { + delegatorAddr: isSet(object.delegatorAddr) ? String(object.delegatorAddr) : "", + validatorAddr: isSet(object.validatorAddr) ? String(object.validatorAddr) : "" + }; }, toJSON(message: QueryDelegatorValidatorRequest): JsonSafe<QueryDelegatorValidatorRequest> { const obj: any = {}; @@ -2951,9 +3017,9 @@ export const QueryDelegatorValidatorResponse = { return message; }, fromJSON(object: any): QueryDelegatorValidatorResponse { - const obj = createBaseQueryDelegatorValidatorResponse(); - if (isSet(object.validator)) obj.validator = Validator.fromJSON(object.validator); - return obj; + return { + validator: isSet(object.validator) ? Validator.fromJSON(object.validator) : undefined + }; }, toJSON(message: QueryDelegatorValidatorResponse): JsonSafe<QueryDelegatorValidatorResponse> { const obj: any = {}; @@ -2962,9 +3028,7 @@ export const QueryDelegatorValidatorResponse = { }, fromPartial(object: DeepPartial<QueryDelegatorValidatorResponse>): QueryDelegatorValidatorResponse { const message = createBaseQueryDelegatorValidatorResponse(); - if (object.validator !== undefined && object.validator !== null) { - message.validator = Validator.fromPartial(object.validator); - } + message.validator = object.validator !== undefined && object.validator !== null ? Validator.fromPartial(object.validator) : undefined; return message; }, fromSDK(object: QueryDelegatorValidatorResponseSDKType): QueryDelegatorValidatorResponse { @@ -3024,7 +3088,7 @@ function createBaseQueryHistoricalInfoRequest(): QueryHistoricalInfoRequest { export const QueryHistoricalInfoRequest = { typeUrl: "/cosmos.staking.v1beta1.QueryHistoricalInfoRequest", encode(message: QueryHistoricalInfoRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.height !== undefined) { + if (message.height !== BigInt(0)) { writer.uint32(8).int64(message.height); } return writer; @@ -3047,9 +3111,9 @@ export const QueryHistoricalInfoRequest = { return message; }, fromJSON(object: any): QueryHistoricalInfoRequest { - const obj = createBaseQueryHistoricalInfoRequest(); - if (isSet(object.height)) obj.height = BigInt(object.height.toString()); - return obj; + return { + height: isSet(object.height) ? BigInt(object.height.toString()) : BigInt(0) + }; }, toJSON(message: QueryHistoricalInfoRequest): JsonSafe<QueryHistoricalInfoRequest> { const obj: any = {}; @@ -3058,9 +3122,7 @@ export const QueryHistoricalInfoRequest = { }, fromPartial(object: DeepPartial<QueryHistoricalInfoRequest>): QueryHistoricalInfoRequest { const message = createBaseQueryHistoricalInfoRequest(); - if (object.height !== undefined && object.height !== null) { - message.height = BigInt(object.height.toString()); - } + message.height = object.height !== undefined && object.height !== null ? BigInt(object.height.toString()) : BigInt(0); return message; }, fromSDK(object: QueryHistoricalInfoRequestSDKType): QueryHistoricalInfoRequest { @@ -3143,9 +3205,9 @@ export const QueryHistoricalInfoResponse = { return message; }, fromJSON(object: any): QueryHistoricalInfoResponse { - const obj = createBaseQueryHistoricalInfoResponse(); - if (isSet(object.hist)) obj.hist = HistoricalInfo.fromJSON(object.hist); - return obj; + return { + hist: isSet(object.hist) ? HistoricalInfo.fromJSON(object.hist) : undefined + }; }, toJSON(message: QueryHistoricalInfoResponse): JsonSafe<QueryHistoricalInfoResponse> { const obj: any = {}; @@ -3154,9 +3216,7 @@ export const QueryHistoricalInfoResponse = { }, fromPartial(object: DeepPartial<QueryHistoricalInfoResponse>): QueryHistoricalInfoResponse { const message = createBaseQueryHistoricalInfoResponse(); - if (object.hist !== undefined && object.hist !== null) { - message.hist = HistoricalInfo.fromPartial(object.hist); - } + message.hist = object.hist !== undefined && object.hist !== null ? HistoricalInfo.fromPartial(object.hist) : undefined; return message; }, fromSDK(object: QueryHistoricalInfoResponseSDKType): QueryHistoricalInfoResponse { @@ -3231,8 +3291,7 @@ export const QueryPoolRequest = { return message; }, fromJSON(_: any): QueryPoolRequest { - const obj = createBaseQueryPoolRequest(); - return obj; + return {}; }, toJSON(_: QueryPoolRequest): JsonSafe<QueryPoolRequest> { const obj: any = {}; @@ -3313,9 +3372,9 @@ export const QueryPoolResponse = { return message; }, fromJSON(object: any): QueryPoolResponse { - const obj = createBaseQueryPoolResponse(); - if (isSet(object.pool)) obj.pool = Pool.fromJSON(object.pool); - return obj; + return { + pool: isSet(object.pool) ? Pool.fromJSON(object.pool) : undefined + }; }, toJSON(message: QueryPoolResponse): JsonSafe<QueryPoolResponse> { const obj: any = {}; @@ -3324,9 +3383,7 @@ export const QueryPoolResponse = { }, fromPartial(object: DeepPartial<QueryPoolResponse>): QueryPoolResponse { const message = createBaseQueryPoolResponse(); - if (object.pool !== undefined && object.pool !== null) { - message.pool = Pool.fromPartial(object.pool); - } + message.pool = object.pool !== undefined && object.pool !== null ? Pool.fromPartial(object.pool) : undefined; return message; }, fromSDK(object: QueryPoolResponseSDKType): QueryPoolResponse { @@ -3401,8 +3458,7 @@ export const QueryParamsRequest = { return message; }, fromJSON(_: any): QueryParamsRequest { - const obj = createBaseQueryParamsRequest(); - return obj; + return {}; }, toJSON(_: QueryParamsRequest): JsonSafe<QueryParamsRequest> { const obj: any = {}; @@ -3483,9 +3539,9 @@ export const QueryParamsResponse = { return message; }, fromJSON(object: any): QueryParamsResponse { - const obj = createBaseQueryParamsResponse(); - if (isSet(object.params)) obj.params = Params.fromJSON(object.params); - return obj; + return { + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined + }; }, toJSON(message: QueryParamsResponse): JsonSafe<QueryParamsResponse> { const obj: any = {}; @@ -3494,9 +3550,7 @@ export const QueryParamsResponse = { }, fromPartial(object: DeepPartial<QueryParamsResponse>): QueryParamsResponse { const message = createBaseQueryParamsResponse(); - if (object.params !== undefined && object.params !== null) { - message.params = Params.fromPartial(object.params); - } + message.params = object.params !== undefined && object.params !== null ? Params.fromPartial(object.params) : undefined; 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 2ed6ddbcbd..e3cb2aeaf1 100644 --- a/__fixtures__/v-next/outputv4/cosmos/staking/v1beta1/staking.ts +++ b/__fixtures__/v-next/outputv4/cosmos/staking/v1beta1/staking.ts @@ -1,13 +1,14 @@ -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 { 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 { 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 { @@ -67,6 +68,10 @@ export interface HistoricalInfo { header: Header; valset: Validator[]; } +export interface ReactiveHistoricalInfo { + header: ComputedRef<Header>; + valset: ComputedRef<Validator[]>; +} export interface HistoricalInfoProtoMsg { typeUrl: "/cosmos.staking.v1beta1.HistoricalInfo"; value: Uint8Array; @@ -93,6 +98,11 @@ 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<string>; + maxRate: ComputedRef<string>; + maxChangeRate: ComputedRef<string>; +} export interface CommissionRatesProtoMsg { typeUrl: "/cosmos.staking.v1beta1.CommissionRates"; value: Uint8Array; @@ -113,6 +123,10 @@ export interface Commission { /** update_time is the last time the commission rate was changed. */ updateTime: Date; } +export interface ReactiveCommission { + commissionRates: ComputedRef<CommissionRates>; + updateTime: ComputedRef<Date>; +} export interface CommissionProtoMsg { typeUrl: "/cosmos.staking.v1beta1.Commission"; value: Uint8Array; @@ -135,6 +149,13 @@ export interface Description { /** details define other optional details. */ details: string; } +export interface ReactiveDescription { + moniker: ComputedRef<string>; + identity: ComputedRef<string>; + website: ComputedRef<string>; + securityContact: ComputedRef<string>; + details: ComputedRef<string>; +} export interface DescriptionProtoMsg { typeUrl: "/cosmos.staking.v1beta1.Description"; value: Uint8Array; @@ -181,6 +202,19 @@ export interface Validator { /** min_self_delegation is the validator's self declared minimum self delegation. */ minSelfDelegation: string; } +export interface ReactiveValidator { + operatorAddress: ComputedRef<string>; + consensusPubkey?: ComputedRef<Any>; + jailed: ComputedRef<boolean>; + status: ComputedRef<BondStatus>; + tokens: ComputedRef<string>; + delegatorShares: ComputedRef<string>; + description: ComputedRef<Description>; + unbondingHeight: ComputedRef<bigint>; + unbondingTime: ComputedRef<Date>; + commission: ComputedRef<Commission>; + minSelfDelegation: ComputedRef<string>; +} export interface ValidatorProtoMsg { typeUrl: "/cosmos.staking.v1beta1.Validator"; value: Uint8Array; @@ -212,6 +246,9 @@ export interface ValidatorSDKType { export interface ValAddresses { addresses: string[]; } +export interface ReactiveValAddresses { + addresses: ComputedRef<string[]>; +} export interface ValAddressesProtoMsg { typeUrl: "/cosmos.staking.v1beta1.ValAddresses"; value: Uint8Array; @@ -229,6 +266,10 @@ export interface DVPair { delegatorAddress: string; validatorAddress: string; } +export interface ReactiveDVPair { + delegatorAddress: ComputedRef<string>; + validatorAddress: ComputedRef<string>; +} export interface DVPairProtoMsg { typeUrl: "/cosmos.staking.v1beta1.DVPair"; value: Uint8Array; @@ -246,6 +287,9 @@ export interface DVPairSDKType { export interface DVPairs { pairs: DVPair[]; } +export interface ReactiveDVPairs { + pairs: ComputedRef<DVPair[]>; +} export interface DVPairsProtoMsg { typeUrl: "/cosmos.staking.v1beta1.DVPairs"; value: Uint8Array; @@ -265,6 +309,11 @@ export interface DVVTriplet { validatorSrcAddress: string; validatorDstAddress: string; } +export interface ReactiveDVVTriplet { + delegatorAddress: ComputedRef<string>; + validatorSrcAddress: ComputedRef<string>; + validatorDstAddress: ComputedRef<string>; +} export interface DVVTripletProtoMsg { typeUrl: "/cosmos.staking.v1beta1.DVVTriplet"; value: Uint8Array; @@ -284,6 +333,9 @@ export interface DVVTripletSDKType { export interface DVVTriplets { triplets: DVVTriplet[]; } +export interface ReactiveDVVTriplets { + triplets: ComputedRef<DVVTriplet[]>; +} export interface DVVTripletsProtoMsg { typeUrl: "/cosmos.staking.v1beta1.DVVTriplets"; value: Uint8Array; @@ -305,6 +357,11 @@ export interface Delegation { /** shares define the delegation shares received. */ shares: string; } +export interface ReactiveDelegation { + delegatorAddress: ComputedRef<string>; + validatorAddress: ComputedRef<string>; + shares: ComputedRef<string>; +} export interface DelegationProtoMsg { typeUrl: "/cosmos.staking.v1beta1.Delegation"; value: Uint8Array; @@ -331,6 +388,11 @@ export interface UnbondingDelegation { /** entries are the unbonding delegation entries. */ entries: UnbondingDelegationEntry[]; } +export interface ReactiveUnbondingDelegation { + delegatorAddress: ComputedRef<string>; + validatorAddress: ComputedRef<string>; + entries: ComputedRef<UnbondingDelegationEntry[]>; +} export interface UnbondingDelegationProtoMsg { typeUrl: "/cosmos.staking.v1beta1.UnbondingDelegation"; value: Uint8Array; @@ -355,6 +417,12 @@ export interface UnbondingDelegationEntry { /** balance defines the tokens to receive at completion. */ balance: string; } +export interface ReactiveUnbondingDelegationEntry { + creationHeight: ComputedRef<bigint>; + completionTime: ComputedRef<Date>; + initialBalance: ComputedRef<string>; + balance: ComputedRef<string>; +} export interface UnbondingDelegationEntryProtoMsg { typeUrl: "/cosmos.staking.v1beta1.UnbondingDelegationEntry"; value: Uint8Array; @@ -377,6 +445,12 @@ export interface RedelegationEntry { /** shares_dst is the amount of destination-validator shares created by redelegation. */ sharesDst: string; } +export interface ReactiveRedelegationEntry { + creationHeight: ComputedRef<bigint>; + completionTime: ComputedRef<Date>; + initialBalance: ComputedRef<string>; + sharesDst: ComputedRef<string>; +} export interface RedelegationEntryProtoMsg { typeUrl: "/cosmos.staking.v1beta1.RedelegationEntry"; value: Uint8Array; @@ -402,6 +476,12 @@ export interface Redelegation { /** entries are the redelegation entries. */ entries: RedelegationEntry[]; } +export interface ReactiveRedelegation { + delegatorAddress: ComputedRef<string>; + validatorSrcAddress: ComputedRef<string>; + validatorDstAddress: ComputedRef<string>; + entries: ComputedRef<RedelegationEntry[]>; +} export interface RedelegationProtoMsg { typeUrl: "/cosmos.staking.v1beta1.Redelegation"; value: Uint8Array; @@ -431,6 +511,14 @@ 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<Duration>; + maxValidators: ComputedRef<number>; + maxEntries: ComputedRef<number>; + historicalEntries: ComputedRef<number>; + bondDenom: ComputedRef<string>; + minCommissionRate: ComputedRef<string>; +} export interface ParamsProtoMsg { typeUrl: "/cosmos.staking.v1beta1.Params"; value: Uint8Array; @@ -452,6 +540,10 @@ export interface DelegationResponse { delegation: Delegation; balance: Coin; } +export interface ReactiveDelegationResponse { + delegation: ComputedRef<Delegation>; + balance: ComputedRef<Coin>; +} export interface DelegationResponseProtoMsg { typeUrl: "/cosmos.staking.v1beta1.DelegationResponse"; value: Uint8Array; @@ -473,6 +565,10 @@ export interface RedelegationEntryResponse { redelegationEntry: RedelegationEntry; balance: string; } +export interface ReactiveRedelegationEntryResponse { + redelegationEntry: ComputedRef<RedelegationEntry>; + balance: ComputedRef<string>; +} export interface RedelegationEntryResponseProtoMsg { typeUrl: "/cosmos.staking.v1beta1.RedelegationEntryResponse"; value: Uint8Array; @@ -495,6 +591,10 @@ export interface RedelegationResponse { redelegation: Redelegation; entries: RedelegationEntryResponse[]; } +export interface ReactiveRedelegationResponse { + redelegation: ComputedRef<Redelegation>; + entries: ComputedRef<RedelegationEntryResponse[]>; +} export interface RedelegationResponseProtoMsg { typeUrl: "/cosmos.staking.v1beta1.RedelegationResponse"; value: Uint8Array; @@ -516,6 +616,10 @@ export interface Pool { notBondedTokens: string; bondedTokens: string; } +export interface ReactivePool { + notBondedTokens: ComputedRef<string>; + bondedTokens: ComputedRef<string>; +} export interface PoolProtoMsg { typeUrl: "/cosmos.staking.v1beta1.Pool"; value: Uint8Array; @@ -566,10 +670,10 @@ export const HistoricalInfo = { return message; }, fromJSON(object: any): HistoricalInfo { - 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; + return { + header: isSet(object.header) ? Header.fromJSON(object.header) : undefined, + valset: Array.isArray(object?.valset) ? object.valset.map((e: any) => Validator.fromJSON(e)) : [] + }; }, toJSON(message: HistoricalInfo): JsonSafe<HistoricalInfo> { const obj: any = {}; @@ -583,9 +687,7 @@ export const HistoricalInfo = { }, fromPartial(object: DeepPartial<HistoricalInfo>): HistoricalInfo { const message = createBaseHistoricalInfo(); - if (object.header !== undefined && object.header !== null) { - message.header = Header.fromPartial(object.header); - } + message.header = object.header !== undefined && object.header !== null ? Header.fromPartial(object.header) : undefined; message.valset = object.valset?.map(e => Validator.fromPartial(e)) || []; return message; }, @@ -661,13 +763,13 @@ function createBaseCommissionRates(): CommissionRates { export const CommissionRates = { typeUrl: "/cosmos.staking.v1beta1.CommissionRates", encode(message: CommissionRates, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.rate !== undefined) { + if (message.rate !== "") { writer.uint32(10).string(Decimal.fromUserInput(message.rate, 18).atomics); } - if (message.maxRate !== undefined) { + if (message.maxRate !== "") { writer.uint32(18).string(Decimal.fromUserInput(message.maxRate, 18).atomics); } - if (message.maxChangeRate !== undefined) { + if (message.maxChangeRate !== "") { writer.uint32(26).string(Decimal.fromUserInput(message.maxChangeRate, 18).atomics); } return writer; @@ -696,11 +798,11 @@ export const CommissionRates = { return message; }, fromJSON(object: any): CommissionRates { - 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; + return { + rate: isSet(object.rate) ? String(object.rate) : "", + maxRate: isSet(object.maxRate) ? String(object.maxRate) : "", + maxChangeRate: isSet(object.maxChangeRate) ? String(object.maxChangeRate) : "" + }; }, toJSON(message: CommissionRates): JsonSafe<CommissionRates> { const obj: any = {}; @@ -817,10 +919,10 @@ export const Commission = { return message; }, fromJSON(object: any): Commission { - 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; + return { + commissionRates: isSet(object.commissionRates) ? CommissionRates.fromJSON(object.commissionRates) : undefined, + updateTime: isSet(object.updateTime) ? new Date(object.updateTime) : undefined + }; }, toJSON(message: Commission): JsonSafe<Commission> { const obj: any = {}; @@ -830,9 +932,7 @@ export const Commission = { }, fromPartial(object: DeepPartial<Commission>): Commission { const message = createBaseCommission(); - if (object.commissionRates !== undefined && object.commissionRates !== null) { - message.commissionRates = CommissionRates.fromPartial(object.commissionRates); - } + message.commissionRates = object.commissionRates !== undefined && object.commissionRates !== null ? CommissionRates.fromPartial(object.commissionRates) : undefined; message.updateTime = object.updateTime ?? undefined; return message; }, @@ -904,19 +1004,19 @@ function createBaseDescription(): Description { export const Description = { typeUrl: "/cosmos.staking.v1beta1.Description", encode(message: Description, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.moniker !== undefined) { + if (message.moniker !== "") { writer.uint32(10).string(message.moniker); } - if (message.identity !== undefined) { + if (message.identity !== "") { writer.uint32(18).string(message.identity); } - if (message.website !== undefined) { + if (message.website !== "") { writer.uint32(26).string(message.website); } - if (message.securityContact !== undefined) { + if (message.securityContact !== "") { writer.uint32(34).string(message.securityContact); } - if (message.details !== undefined) { + if (message.details !== "") { writer.uint32(42).string(message.details); } return writer; @@ -951,13 +1051,13 @@ export const Description = { return message; }, fromJSON(object: any): Description { - 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; + return { + moniker: isSet(object.moniker) ? String(object.moniker) : "", + identity: isSet(object.identity) ? String(object.identity) : "", + website: isSet(object.website) ? String(object.website) : "", + securityContact: isSet(object.securityContact) ? String(object.securityContact) : "", + details: isSet(object.details) ? String(object.details) : "" + }; }, toJSON(message: Description): JsonSafe<Description> { const obj: any = {}; @@ -1072,28 +1172,28 @@ function createBaseValidator(): Validator { export const Validator = { typeUrl: "/cosmos.staking.v1beta1.Validator", encode(message: Validator, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.operatorAddress !== undefined) { + if (message.operatorAddress !== "") { writer.uint32(10).string(message.operatorAddress); } if (message.consensusPubkey !== undefined) { Any.encode(message.consensusPubkey, writer.uint32(18).fork()).ldelim(); } - if (message.jailed !== undefined) { + if (message.jailed === true) { writer.uint32(24).bool(message.jailed); } if (message.status !== 0) { writer.uint32(32).int32(message.status); } - if (message.tokens !== undefined) { + if (message.tokens !== "") { writer.uint32(42).string(message.tokens); } - if (message.delegatorShares !== undefined) { + if (message.delegatorShares !== "") { 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 !== undefined) { + if (message.unbondingHeight !== BigInt(0)) { writer.uint32(64).int64(message.unbondingHeight); } if (message.unbondingTime !== undefined) { @@ -1102,7 +1202,7 @@ export const Validator = { if (message.commission !== undefined) { Commission.encode(message.commission, writer.uint32(82).fork()).ldelim(); } - if (message.minSelfDelegation !== undefined) { + if (message.minSelfDelegation !== "") { writer.uint32(90).string(message.minSelfDelegation); } return writer; @@ -1155,19 +1255,19 @@ export const Validator = { return message; }, fromJSON(object: any): Validator { - 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; + 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) : "" + }; }, toJSON(message: Validator): JsonSafe<Validator> { const obj: any = {}; @@ -1187,23 +1287,15 @@ export const Validator = { fromPartial(object: DeepPartial<Validator>): Validator { const message = createBaseValidator(); message.operatorAddress = object.operatorAddress ?? ""; - if (object.consensusPubkey !== undefined && object.consensusPubkey !== null) { - message.consensusPubkey = Any.fromPartial(object.consensusPubkey); - } + message.consensusPubkey = object.consensusPubkey !== undefined && object.consensusPubkey !== null ? Any.fromPartial(object.consensusPubkey) : undefined; message.jailed = object.jailed ?? false; message.status = object.status ?? 0; message.tokens = object.tokens ?? ""; message.delegatorShares = object.delegatorShares ?? ""; - if (object.description !== undefined && object.description !== null) { - message.description = Description.fromPartial(object.description); - } - if (object.unbondingHeight !== undefined && object.unbondingHeight !== null) { - message.unbondingHeight = BigInt(object.unbondingHeight.toString()); - } + 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); message.unbondingTime = object.unbondingTime ?? undefined; - if (object.commission !== undefined && object.commission !== null) { - message.commission = Commission.fromPartial(object.commission); - } + message.commission = object.commission !== undefined && object.commission !== null ? Commission.fromPartial(object.commission) : undefined; message.minSelfDelegation = object.minSelfDelegation ?? ""; return message; }, @@ -1357,9 +1449,9 @@ export const ValAddresses = { return message; }, fromJSON(object: any): ValAddresses { - const obj = createBaseValAddresses(); - if (Array.isArray(object?.addresses)) obj.addresses = object.addresses.map((e: any) => String(e)); - return obj; + return { + addresses: Array.isArray(object?.addresses) ? object.addresses.map((e: any) => String(e)) : [] + }; }, toJSON(message: ValAddresses): JsonSafe<ValAddresses> { const obj: any = {}; @@ -1439,10 +1531,10 @@ function createBaseDVPair(): DVPair { export const DVPair = { typeUrl: "/cosmos.staking.v1beta1.DVPair", encode(message: DVPair, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.delegatorAddress !== undefined) { + if (message.delegatorAddress !== "") { writer.uint32(10).string(message.delegatorAddress); } - if (message.validatorAddress !== undefined) { + if (message.validatorAddress !== "") { writer.uint32(18).string(message.validatorAddress); } return writer; @@ -1468,10 +1560,10 @@ export const DVPair = { return message; }, fromJSON(object: any): DVPair { - const obj = createBaseDVPair(); - if (isSet(object.delegatorAddress)) obj.delegatorAddress = String(object.delegatorAddress); - if (isSet(object.validatorAddress)) obj.validatorAddress = String(object.validatorAddress); - return obj; + return { + delegatorAddress: isSet(object.delegatorAddress) ? String(object.delegatorAddress) : "", + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "" + }; }, toJSON(message: DVPair): JsonSafe<DVPair> { const obj: any = {}; @@ -1572,9 +1664,9 @@ export const DVPairs = { return message; }, fromJSON(object: any): DVPairs { - const obj = createBaseDVPairs(); - if (Array.isArray(object?.pairs)) obj.pairs = object.pairs.map((e: any) => DVPair.fromJSON(e)); - return obj; + return { + pairs: Array.isArray(object?.pairs) ? object.pairs.map((e: any) => DVPair.fromJSON(e)) : [] + }; }, toJSON(message: DVPairs): JsonSafe<DVPairs> { const obj: any = {}; @@ -1655,13 +1747,13 @@ function createBaseDVVTriplet(): DVVTriplet { export const DVVTriplet = { typeUrl: "/cosmos.staking.v1beta1.DVVTriplet", encode(message: DVVTriplet, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.delegatorAddress !== undefined) { + if (message.delegatorAddress !== "") { writer.uint32(10).string(message.delegatorAddress); } - if (message.validatorSrcAddress !== undefined) { + if (message.validatorSrcAddress !== "") { writer.uint32(18).string(message.validatorSrcAddress); } - if (message.validatorDstAddress !== undefined) { + if (message.validatorDstAddress !== "") { writer.uint32(26).string(message.validatorDstAddress); } return writer; @@ -1690,11 +1782,11 @@ export const DVVTriplet = { return message; }, fromJSON(object: any): DVVTriplet { - 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; + return { + delegatorAddress: isSet(object.delegatorAddress) ? String(object.delegatorAddress) : "", + validatorSrcAddress: isSet(object.validatorSrcAddress) ? String(object.validatorSrcAddress) : "", + validatorDstAddress: isSet(object.validatorDstAddress) ? String(object.validatorDstAddress) : "" + }; }, toJSON(message: DVVTriplet): JsonSafe<DVVTriplet> { const obj: any = {}; @@ -1804,9 +1896,9 @@ export const DVVTriplets = { return message; }, fromJSON(object: any): DVVTriplets { - const obj = createBaseDVVTriplets(); - if (Array.isArray(object?.triplets)) obj.triplets = object.triplets.map((e: any) => DVVTriplet.fromJSON(e)); - return obj; + return { + triplets: Array.isArray(object?.triplets) ? object.triplets.map((e: any) => DVVTriplet.fromJSON(e)) : [] + }; }, toJSON(message: DVVTriplets): JsonSafe<DVVTriplets> { const obj: any = {}; @@ -1887,13 +1979,13 @@ function createBaseDelegation(): Delegation { export const Delegation = { typeUrl: "/cosmos.staking.v1beta1.Delegation", encode(message: Delegation, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.delegatorAddress !== undefined) { + if (message.delegatorAddress !== "") { writer.uint32(10).string(message.delegatorAddress); } - if (message.validatorAddress !== undefined) { + if (message.validatorAddress !== "") { writer.uint32(18).string(message.validatorAddress); } - if (message.shares !== undefined) { + if (message.shares !== "") { writer.uint32(26).string(Decimal.fromUserInput(message.shares, 18).atomics); } return writer; @@ -1922,11 +2014,11 @@ export const Delegation = { return message; }, fromJSON(object: any): Delegation { - 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; + return { + delegatorAddress: isSet(object.delegatorAddress) ? String(object.delegatorAddress) : "", + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + shares: isSet(object.shares) ? String(object.shares) : "" + }; }, toJSON(message: Delegation): JsonSafe<Delegation> { const obj: any = {}; @@ -2015,10 +2107,10 @@ function createBaseUnbondingDelegation(): UnbondingDelegation { export const UnbondingDelegation = { typeUrl: "/cosmos.staking.v1beta1.UnbondingDelegation", encode(message: UnbondingDelegation, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.delegatorAddress !== undefined) { + if (message.delegatorAddress !== "") { writer.uint32(10).string(message.delegatorAddress); } - if (message.validatorAddress !== undefined) { + if (message.validatorAddress !== "") { writer.uint32(18).string(message.validatorAddress); } for (const v of message.entries) { @@ -2050,11 +2142,11 @@ export const UnbondingDelegation = { return message; }, fromJSON(object: any): UnbondingDelegation { - 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; + return { + delegatorAddress: isSet(object.delegatorAddress) ? String(object.delegatorAddress) : "", + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + entries: Array.isArray(object?.entries) ? object.entries.map((e: any) => UnbondingDelegationEntry.fromJSON(e)) : [] + }; }, toJSON(message: UnbondingDelegation): JsonSafe<UnbondingDelegation> { const obj: any = {}; @@ -2154,16 +2246,16 @@ function createBaseUnbondingDelegationEntry(): UnbondingDelegationEntry { export const UnbondingDelegationEntry = { typeUrl: "/cosmos.staking.v1beta1.UnbondingDelegationEntry", encode(message: UnbondingDelegationEntry, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.creationHeight !== undefined) { + if (message.creationHeight !== BigInt(0)) { writer.uint32(8).int64(message.creationHeight); } if (message.completionTime !== undefined) { Timestamp.encode(toTimestamp(message.completionTime), writer.uint32(18).fork()).ldelim(); } - if (message.initialBalance !== undefined) { + if (message.initialBalance !== "") { writer.uint32(26).string(message.initialBalance); } - if (message.balance !== undefined) { + if (message.balance !== "") { writer.uint32(34).string(message.balance); } return writer; @@ -2195,12 +2287,12 @@ export const UnbondingDelegationEntry = { return message; }, fromJSON(object: any): UnbondingDelegationEntry { - 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; + 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) : "" + }; }, toJSON(message: UnbondingDelegationEntry): JsonSafe<UnbondingDelegationEntry> { const obj: any = {}; @@ -2212,9 +2304,7 @@ export const UnbondingDelegationEntry = { }, fromPartial(object: DeepPartial<UnbondingDelegationEntry>): UnbondingDelegationEntry { const message = createBaseUnbondingDelegationEntry(); - if (object.creationHeight !== undefined && object.creationHeight !== null) { - message.creationHeight = BigInt(object.creationHeight.toString()); - } + message.creationHeight = object.creationHeight !== undefined && object.creationHeight !== null ? BigInt(object.creationHeight.toString()) : BigInt(0); message.completionTime = object.completionTime ?? undefined; message.initialBalance = object.initialBalance ?? ""; message.balance = object.balance ?? ""; @@ -2301,16 +2391,16 @@ function createBaseRedelegationEntry(): RedelegationEntry { export const RedelegationEntry = { typeUrl: "/cosmos.staking.v1beta1.RedelegationEntry", encode(message: RedelegationEntry, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.creationHeight !== undefined) { + if (message.creationHeight !== BigInt(0)) { writer.uint32(8).int64(message.creationHeight); } if (message.completionTime !== undefined) { Timestamp.encode(toTimestamp(message.completionTime), writer.uint32(18).fork()).ldelim(); } - if (message.initialBalance !== undefined) { + if (message.initialBalance !== "") { writer.uint32(26).string(message.initialBalance); } - if (message.sharesDst !== undefined) { + if (message.sharesDst !== "") { writer.uint32(34).string(Decimal.fromUserInput(message.sharesDst, 18).atomics); } return writer; @@ -2342,12 +2432,12 @@ export const RedelegationEntry = { return message; }, fromJSON(object: any): RedelegationEntry { - 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; + 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) : "" + }; }, toJSON(message: RedelegationEntry): JsonSafe<RedelegationEntry> { const obj: any = {}; @@ -2359,9 +2449,7 @@ export const RedelegationEntry = { }, fromPartial(object: DeepPartial<RedelegationEntry>): RedelegationEntry { const message = createBaseRedelegationEntry(); - if (object.creationHeight !== undefined && object.creationHeight !== null) { - message.creationHeight = BigInt(object.creationHeight.toString()); - } + message.creationHeight = object.creationHeight !== undefined && object.creationHeight !== null ? BigInt(object.creationHeight.toString()) : BigInt(0); message.completionTime = object.completionTime ?? undefined; message.initialBalance = object.initialBalance ?? ""; message.sharesDst = object.sharesDst ?? ""; @@ -2448,13 +2536,13 @@ function createBaseRedelegation(): Redelegation { export const Redelegation = { typeUrl: "/cosmos.staking.v1beta1.Redelegation", encode(message: Redelegation, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.delegatorAddress !== undefined) { + if (message.delegatorAddress !== "") { writer.uint32(10).string(message.delegatorAddress); } - if (message.validatorSrcAddress !== undefined) { + if (message.validatorSrcAddress !== "") { writer.uint32(18).string(message.validatorSrcAddress); } - if (message.validatorDstAddress !== undefined) { + if (message.validatorDstAddress !== "") { writer.uint32(26).string(message.validatorDstAddress); } for (const v of message.entries) { @@ -2489,12 +2577,12 @@ export const Redelegation = { return message; }, fromJSON(object: any): Redelegation { - 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; + return { + delegatorAddress: isSet(object.delegatorAddress) ? String(object.delegatorAddress) : "", + validatorSrcAddress: isSet(object.validatorSrcAddress) ? String(object.validatorSrcAddress) : "", + validatorDstAddress: isSet(object.validatorDstAddress) ? String(object.validatorDstAddress) : "", + entries: Array.isArray(object?.entries) ? object.entries.map((e: any) => RedelegationEntry.fromJSON(e)) : [] + }; }, toJSON(message: Redelegation): JsonSafe<Redelegation> { const obj: any = {}; @@ -2608,19 +2696,19 @@ export const Params = { if (message.unbondingTime !== undefined) { Duration.encode(message.unbondingTime, writer.uint32(10).fork()).ldelim(); } - if (message.maxValidators !== undefined) { + if (message.maxValidators !== 0) { writer.uint32(16).uint32(message.maxValidators); } - if (message.maxEntries !== undefined) { + if (message.maxEntries !== 0) { writer.uint32(24).uint32(message.maxEntries); } - if (message.historicalEntries !== undefined) { + if (message.historicalEntries !== 0) { writer.uint32(32).uint32(message.historicalEntries); } - if (message.bondDenom !== undefined) { + if (message.bondDenom !== "") { writer.uint32(42).string(message.bondDenom); } - if (message.minCommissionRate !== undefined) { + if (message.minCommissionRate !== "") { writer.uint32(50).string(Decimal.fromUserInput(message.minCommissionRate, 18).atomics); } return writer; @@ -2658,14 +2746,14 @@ export const Params = { return message; }, fromJSON(object: any): Params { - 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; + 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) : "" + }; }, toJSON(message: Params): JsonSafe<Params> { const obj: any = {}; @@ -2679,9 +2767,7 @@ export const Params = { }, fromPartial(object: DeepPartial<Params>): Params { const message = createBaseParams(); - if (object.unbondingTime !== undefined && object.unbondingTime !== null) { - message.unbondingTime = Duration.fromPartial(object.unbondingTime); - } + message.unbondingTime = object.unbondingTime !== undefined && object.unbondingTime !== null ? Duration.fromPartial(object.unbondingTime) : undefined; message.maxValidators = object.maxValidators ?? 0; message.maxEntries = object.maxEntries ?? 0; message.historicalEntries = object.historicalEntries ?? 0; @@ -2811,10 +2897,10 @@ export const DelegationResponse = { return message; }, fromJSON(object: any): DelegationResponse { - 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; + return { + delegation: isSet(object.delegation) ? Delegation.fromJSON(object.delegation) : undefined, + balance: isSet(object.balance) ? Coin.fromJSON(object.balance) : undefined + }; }, toJSON(message: DelegationResponse): JsonSafe<DelegationResponse> { const obj: any = {}; @@ -2824,12 +2910,8 @@ export const DelegationResponse = { }, fromPartial(object: DeepPartial<DelegationResponse>): DelegationResponse { const message = createBaseDelegationResponse(); - 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); - } + message.delegation = object.delegation !== undefined && object.delegation !== null ? Delegation.fromPartial(object.delegation) : undefined; + message.balance = object.balance !== undefined && object.balance !== null ? Coin.fromPartial(object.balance) : undefined; return message; }, fromSDK(object: DelegationResponseSDKType): DelegationResponse { @@ -2900,7 +2982,7 @@ export const RedelegationEntryResponse = { if (message.redelegationEntry !== undefined) { RedelegationEntry.encode(message.redelegationEntry, writer.uint32(10).fork()).ldelim(); } - if (message.balance !== undefined) { + if (message.balance !== "") { writer.uint32(34).string(message.balance); } return writer; @@ -2926,10 +3008,10 @@ export const RedelegationEntryResponse = { return message; }, fromJSON(object: any): RedelegationEntryResponse { - const obj = createBaseRedelegationEntryResponse(); - if (isSet(object.redelegationEntry)) obj.redelegationEntry = RedelegationEntry.fromJSON(object.redelegationEntry); - if (isSet(object.balance)) obj.balance = String(object.balance); - return obj; + return { + redelegationEntry: isSet(object.redelegationEntry) ? RedelegationEntry.fromJSON(object.redelegationEntry) : undefined, + balance: isSet(object.balance) ? String(object.balance) : "" + }; }, toJSON(message: RedelegationEntryResponse): JsonSafe<RedelegationEntryResponse> { const obj: any = {}; @@ -2939,9 +3021,7 @@ export const RedelegationEntryResponse = { }, fromPartial(object: DeepPartial<RedelegationEntryResponse>): RedelegationEntryResponse { const message = createBaseRedelegationEntryResponse(); - if (object.redelegationEntry !== undefined && object.redelegationEntry !== null) { - message.redelegationEntry = RedelegationEntry.fromPartial(object.redelegationEntry); - } + message.redelegationEntry = object.redelegationEntry !== undefined && object.redelegationEntry !== null ? RedelegationEntry.fromPartial(object.redelegationEntry) : undefined; message.balance = object.balance ?? ""; return message; }, @@ -3039,10 +3119,10 @@ export const RedelegationResponse = { return message; }, fromJSON(object: any): RedelegationResponse { - 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; + return { + redelegation: isSet(object.redelegation) ? Redelegation.fromJSON(object.redelegation) : undefined, + entries: Array.isArray(object?.entries) ? object.entries.map((e: any) => RedelegationEntryResponse.fromJSON(e)) : [] + }; }, toJSON(message: RedelegationResponse): JsonSafe<RedelegationResponse> { const obj: any = {}; @@ -3056,9 +3136,7 @@ export const RedelegationResponse = { }, fromPartial(object: DeepPartial<RedelegationResponse>): RedelegationResponse { const message = createBaseRedelegationResponse(); - if (object.redelegation !== undefined && object.redelegation !== null) { - message.redelegation = Redelegation.fromPartial(object.redelegation); - } + message.redelegation = object.redelegation !== undefined && object.redelegation !== null ? Redelegation.fromPartial(object.redelegation) : undefined; message.entries = object.entries?.map(e => RedelegationEntryResponse.fromPartial(e)) || []; return message; }, @@ -3133,10 +3211,10 @@ function createBasePool(): Pool { export const Pool = { typeUrl: "/cosmos.staking.v1beta1.Pool", encode(message: Pool, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.notBondedTokens !== undefined) { + if (message.notBondedTokens !== "") { writer.uint32(10).string(message.notBondedTokens); } - if (message.bondedTokens !== undefined) { + if (message.bondedTokens !== "") { writer.uint32(18).string(message.bondedTokens); } return writer; @@ -3162,10 +3240,10 @@ export const Pool = { return message; }, fromJSON(object: any): Pool { - const obj = createBasePool(); - if (isSet(object.notBondedTokens)) obj.notBondedTokens = String(object.notBondedTokens); - if (isSet(object.bondedTokens)) obj.bondedTokens = String(object.bondedTokens); - return obj; + return { + notBondedTokens: isSet(object.notBondedTokens) ? String(object.notBondedTokens) : "", + bondedTokens: isSet(object.bondedTokens) ? String(object.bondedTokens) : "" + }; }, toJSON(message: Pool): JsonSafe<Pool> { 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 7007045acd..86e67cabcd 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.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 { 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 { 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.js"; +import { MsgCreateValidator, MsgCreateValidatorSDKType, MsgEditValidator, MsgEditValidatorSDKType, MsgDelegate, MsgDelegateSDKType, MsgBeginRedelegate, MsgBeginRedelegateSDKType, MsgUndelegate, MsgUndelegateSDKType } from "./tx"; 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 bf55cd2deb..e93cb84370 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.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 { 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 { GeneratedType, Registry } from "@cosmjs/proto-signing"; -import { MsgCreateValidator, MsgCreateValidatorSDKType, MsgEditValidator, MsgEditValidatorSDKType, MsgDelegate, MsgDelegateSDKType, MsgBeginRedelegate, MsgBeginRedelegateSDKType, MsgUndelegate, MsgUndelegateSDKType } from "./tx.js"; +import { MsgCreateValidator, MsgCreateValidatorSDKType, MsgEditValidator, MsgEditValidatorSDKType, MsgDelegate, MsgDelegateSDKType, MsgBeginRedelegate, MsgBeginRedelegateSDKType, MsgUndelegate, MsgUndelegateSDKType } from "./tx"; 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 f807da072f..c50d6c8f28 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.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"; +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"; /** 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 2fc07ea2b2..ffe5f2b70e 100644 --- a/__fixtures__/v-next/outputv4/cosmos/staking/v1beta1/tx.ts +++ b/__fixtures__/v-next/outputv4/cosmos/staking/v1beta1/tx.ts @@ -1,12 +1,13 @@ -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 { 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 { 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 { @@ -18,6 +19,15 @@ export interface MsgCreateValidator { pubkey?: Any; value: Coin; } +export interface ReactiveMsgCreateValidator { + description: ComputedRef<Description>; + commission: ComputedRef<CommissionRates>; + minSelfDelegation: ComputedRef<string>; + delegatorAddress: ComputedRef<string>; + validatorAddress: ComputedRef<string>; + pubkey?: ComputedRef<Any>; + value: ComputedRef<Coin>; +} export interface MsgCreateValidatorProtoMsg { typeUrl: "/cosmos.staking.v1beta1.MsgCreateValidator"; value: Uint8Array; @@ -34,6 +44,7 @@ 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; @@ -53,6 +64,12 @@ export interface MsgEditValidator { commissionRate: string; minSelfDelegation: string; } +export interface ReactiveMsgEditValidator { + description: ComputedRef<Description>; + validatorAddress: ComputedRef<string>; + commissionRate: ComputedRef<string>; + minSelfDelegation: ComputedRef<string>; +} export interface MsgEditValidatorProtoMsg { typeUrl: "/cosmos.staking.v1beta1.MsgEditValidator"; value: Uint8Array; @@ -66,6 +83,7 @@ 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; @@ -81,6 +99,11 @@ export interface MsgDelegate { validatorAddress: string; amount: Coin; } +export interface ReactiveMsgDelegate { + delegatorAddress: ComputedRef<string>; + validatorAddress: ComputedRef<string>; + amount: ComputedRef<Coin>; +} export interface MsgDelegateProtoMsg { typeUrl: "/cosmos.staking.v1beta1.MsgDelegate"; value: Uint8Array; @@ -96,6 +119,7 @@ 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; @@ -112,6 +136,12 @@ export interface MsgBeginRedelegate { validatorDstAddress: string; amount: Coin; } +export interface ReactiveMsgBeginRedelegate { + delegatorAddress: ComputedRef<string>; + validatorSrcAddress: ComputedRef<string>; + validatorDstAddress: ComputedRef<string>; + amount: ComputedRef<Coin>; +} export interface MsgBeginRedelegateProtoMsg { typeUrl: "/cosmos.staking.v1beta1.MsgBeginRedelegate"; value: Uint8Array; @@ -130,6 +160,9 @@ export interface MsgBeginRedelegateSDKType { export interface MsgBeginRedelegateResponse { completionTime: Date; } +export interface ReactiveMsgBeginRedelegateResponse { + completionTime: ComputedRef<Date>; +} export interface MsgBeginRedelegateResponseProtoMsg { typeUrl: "/cosmos.staking.v1beta1.MsgBeginRedelegateResponse"; value: Uint8Array; @@ -147,6 +180,11 @@ export interface MsgUndelegate { validatorAddress: string; amount: Coin; } +export interface ReactiveMsgUndelegate { + delegatorAddress: ComputedRef<string>; + validatorAddress: ComputedRef<string>; + amount: ComputedRef<Coin>; +} export interface MsgUndelegateProtoMsg { typeUrl: "/cosmos.staking.v1beta1.MsgUndelegate"; value: Uint8Array; @@ -164,6 +202,9 @@ export interface MsgUndelegateSDKType { export interface MsgUndelegateResponse { completionTime: Date; } +export interface ReactiveMsgUndelegateResponse { + completionTime: ComputedRef<Date>; +} export interface MsgUndelegateResponseProtoMsg { typeUrl: "/cosmos.staking.v1beta1.MsgUndelegateResponse"; value: Uint8Array; @@ -192,13 +233,13 @@ export const MsgCreateValidator = { if (message.commission !== undefined) { CommissionRates.encode(message.commission, writer.uint32(18).fork()).ldelim(); } - if (message.minSelfDelegation !== undefined) { + if (message.minSelfDelegation !== "") { writer.uint32(26).string(message.minSelfDelegation); } - if (message.delegatorAddress !== undefined) { + if (message.delegatorAddress !== "") { writer.uint32(34).string(message.delegatorAddress); } - if (message.validatorAddress !== undefined) { + if (message.validatorAddress !== "") { writer.uint32(42).string(message.validatorAddress); } if (message.pubkey !== undefined) { @@ -245,15 +286,15 @@ export const MsgCreateValidator = { return message; }, fromJSON(object: any): MsgCreateValidator { - 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; + 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 + }; }, toJSON(message: MsgCreateValidator): JsonSafe<MsgCreateValidator> { const obj: any = {}; @@ -268,21 +309,13 @@ export const MsgCreateValidator = { }, fromPartial(object: DeepPartial<MsgCreateValidator>): MsgCreateValidator { const message = createBaseMsgCreateValidator(); - 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.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; message.minSelfDelegation = object.minSelfDelegation ?? ""; message.delegatorAddress = object.delegatorAddress ?? ""; message.validatorAddress = object.validatorAddress ?? ""; - 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); - } + 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; return message; }, fromSDK(object: MsgCreateValidatorSDKType): MsgCreateValidator { @@ -399,8 +432,7 @@ export const MsgCreateValidatorResponse = { return message; }, fromJSON(_: any): MsgCreateValidatorResponse { - const obj = createBaseMsgCreateValidatorResponse(); - return obj; + return {}; }, toJSON(_: MsgCreateValidatorResponse): JsonSafe<MsgCreateValidatorResponse> { const obj: any = {}; @@ -464,13 +496,13 @@ export const MsgEditValidator = { if (message.description !== undefined) { Description.encode(message.description, writer.uint32(10).fork()).ldelim(); } - if (message.validatorAddress !== undefined) { + if (message.validatorAddress !== "") { writer.uint32(18).string(message.validatorAddress); } - if (message.commissionRate !== undefined) { + if (message.commissionRate !== "") { writer.uint32(26).string(Decimal.fromUserInput(message.commissionRate, 18).atomics); } - if (message.minSelfDelegation !== undefined) { + if (message.minSelfDelegation !== "") { writer.uint32(34).string(message.minSelfDelegation); } return writer; @@ -502,12 +534,12 @@ export const MsgEditValidator = { return message; }, fromJSON(object: any): MsgEditValidator { - 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; + 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) : "" + }; }, toJSON(message: MsgEditValidator): JsonSafe<MsgEditValidator> { const obj: any = {}; @@ -519,9 +551,7 @@ export const MsgEditValidator = { }, fromPartial(object: DeepPartial<MsgEditValidator>): MsgEditValidator { const message = createBaseMsgEditValidator(); - if (object.description !== undefined && object.description !== null) { - message.description = Description.fromPartial(object.description); - } + message.description = object.description !== undefined && object.description !== null ? Description.fromPartial(object.description) : undefined; message.validatorAddress = object.validatorAddress ?? ""; message.commissionRate = object.commissionRate ?? ""; message.minSelfDelegation = object.minSelfDelegation ?? ""; @@ -620,8 +650,7 @@ export const MsgEditValidatorResponse = { return message; }, fromJSON(_: any): MsgEditValidatorResponse { - const obj = createBaseMsgEditValidatorResponse(); - return obj; + return {}; }, toJSON(_: MsgEditValidatorResponse): JsonSafe<MsgEditValidatorResponse> { const obj: any = {}; @@ -681,10 +710,10 @@ function createBaseMsgDelegate(): MsgDelegate { export const MsgDelegate = { typeUrl: "/cosmos.staking.v1beta1.MsgDelegate", encode(message: MsgDelegate, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.delegatorAddress !== undefined) { + if (message.delegatorAddress !== "") { writer.uint32(10).string(message.delegatorAddress); } - if (message.validatorAddress !== undefined) { + if (message.validatorAddress !== "") { writer.uint32(18).string(message.validatorAddress); } if (message.amount !== undefined) { @@ -716,11 +745,11 @@ export const MsgDelegate = { return message; }, fromJSON(object: any): MsgDelegate { - 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; + return { + delegatorAddress: isSet(object.delegatorAddress) ? String(object.delegatorAddress) : "", + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + amount: isSet(object.amount) ? Coin.fromJSON(object.amount) : undefined + }; }, toJSON(message: MsgDelegate): JsonSafe<MsgDelegate> { const obj: any = {}; @@ -733,9 +762,7 @@ export const MsgDelegate = { const message = createBaseMsgDelegate(); message.delegatorAddress = object.delegatorAddress ?? ""; message.validatorAddress = object.validatorAddress ?? ""; - if (object.amount !== undefined && object.amount !== null) { - message.amount = Coin.fromPartial(object.amount); - } + message.amount = object.amount !== undefined && object.amount !== null ? Coin.fromPartial(object.amount) : undefined; return message; }, fromSDK(object: MsgDelegateSDKType): MsgDelegate { @@ -824,8 +851,7 @@ export const MsgDelegateResponse = { return message; }, fromJSON(_: any): MsgDelegateResponse { - const obj = createBaseMsgDelegateResponse(); - return obj; + return {}; }, toJSON(_: MsgDelegateResponse): JsonSafe<MsgDelegateResponse> { const obj: any = {}; @@ -886,13 +912,13 @@ function createBaseMsgBeginRedelegate(): MsgBeginRedelegate { export const MsgBeginRedelegate = { typeUrl: "/cosmos.staking.v1beta1.MsgBeginRedelegate", encode(message: MsgBeginRedelegate, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.delegatorAddress !== undefined) { + if (message.delegatorAddress !== "") { writer.uint32(10).string(message.delegatorAddress); } - if (message.validatorSrcAddress !== undefined) { + if (message.validatorSrcAddress !== "") { writer.uint32(18).string(message.validatorSrcAddress); } - if (message.validatorDstAddress !== undefined) { + if (message.validatorDstAddress !== "") { writer.uint32(26).string(message.validatorDstAddress); } if (message.amount !== undefined) { @@ -927,12 +953,12 @@ export const MsgBeginRedelegate = { return message; }, fromJSON(object: any): MsgBeginRedelegate { - 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; + 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 + }; }, toJSON(message: MsgBeginRedelegate): JsonSafe<MsgBeginRedelegate> { const obj: any = {}; @@ -947,9 +973,7 @@ export const MsgBeginRedelegate = { message.delegatorAddress = object.delegatorAddress ?? ""; message.validatorSrcAddress = object.validatorSrcAddress ?? ""; message.validatorDstAddress = object.validatorDstAddress ?? ""; - if (object.amount !== undefined && object.amount !== null) { - message.amount = Coin.fromPartial(object.amount); - } + message.amount = object.amount !== undefined && object.amount !== null ? Coin.fromPartial(object.amount) : undefined; return message; }, fromSDK(object: MsgBeginRedelegateSDKType): MsgBeginRedelegate { @@ -1053,9 +1077,9 @@ export const MsgBeginRedelegateResponse = { return message; }, fromJSON(object: any): MsgBeginRedelegateResponse { - const obj = createBaseMsgBeginRedelegateResponse(); - if (isSet(object.completionTime)) obj.completionTime = new Date(object.completionTime); - return obj; + return { + completionTime: isSet(object.completionTime) ? new Date(object.completionTime) : undefined + }; }, toJSON(message: MsgBeginRedelegateResponse): JsonSafe<MsgBeginRedelegateResponse> { const obj: any = {}; @@ -1126,10 +1150,10 @@ function createBaseMsgUndelegate(): MsgUndelegate { export const MsgUndelegate = { typeUrl: "/cosmos.staking.v1beta1.MsgUndelegate", encode(message: MsgUndelegate, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.delegatorAddress !== undefined) { + if (message.delegatorAddress !== "") { writer.uint32(10).string(message.delegatorAddress); } - if (message.validatorAddress !== undefined) { + if (message.validatorAddress !== "") { writer.uint32(18).string(message.validatorAddress); } if (message.amount !== undefined) { @@ -1161,11 +1185,11 @@ export const MsgUndelegate = { return message; }, fromJSON(object: any): MsgUndelegate { - 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; + return { + delegatorAddress: isSet(object.delegatorAddress) ? String(object.delegatorAddress) : "", + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + amount: isSet(object.amount) ? Coin.fromJSON(object.amount) : undefined + }; }, toJSON(message: MsgUndelegate): JsonSafe<MsgUndelegate> { const obj: any = {}; @@ -1178,9 +1202,7 @@ export const MsgUndelegate = { const message = createBaseMsgUndelegate(); message.delegatorAddress = object.delegatorAddress ?? ""; message.validatorAddress = object.validatorAddress ?? ""; - if (object.amount !== undefined && object.amount !== null) { - message.amount = Coin.fromPartial(object.amount); - } + message.amount = object.amount !== undefined && object.amount !== null ? Coin.fromPartial(object.amount) : undefined; return message; }, fromSDK(object: MsgUndelegateSDKType): MsgUndelegate { @@ -1277,9 +1299,9 @@ export const MsgUndelegateResponse = { return message; }, fromJSON(object: any): MsgUndelegateResponse { - const obj = createBaseMsgUndelegateResponse(); - if (isSet(object.completionTime)) obj.completionTime = new Date(object.completionTime); - return obj; + return { + completionTime: isSet(object.completionTime) ? new Date(object.completionTime) : undefined + }; }, toJSON(message: MsgUndelegateResponse): JsonSafe<MsgUndelegateResponse> { 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 5e627b7fc1..a8e84e7a6b 100644 --- a/__fixtures__/v-next/outputv4/cosmos/tx/signing/v1beta1/signing.ts +++ b/__fixtures__/v-next/outputv4/cosmos/tx/signing/v1beta1/signing.ts @@ -1,8 +1,9 @@ -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"; +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"; export const protobufPackage = "cosmos.tx.signing.v1beta1"; /** * SignMode represents a signing mode with its own security guarantees. @@ -93,6 +94,9 @@ export interface SignatureDescriptors { /** signatures are the signature descriptors */ signatures: SignatureDescriptor[]; } +export interface ReactiveSignatureDescriptors { + signatures: ComputedRef<SignatureDescriptor[]>; +} export interface SignatureDescriptorsProtoMsg { typeUrl: "/cosmos.tx.signing.v1beta1.SignatureDescriptors"; value: Uint8Array; @@ -118,6 +122,11 @@ export interface SignatureDescriptor { */ sequence: bigint; } +export interface ReactiveSignatureDescriptor { + publicKey?: ComputedRef<Any>; + data?: ComputedRef<SignatureDescriptor_Data>; + sequence: ComputedRef<bigint>; +} export interface SignatureDescriptorProtoMsg { typeUrl: "/cosmos.tx.signing.v1beta1.SignatureDescriptor"; value: Uint8Array; @@ -140,6 +149,10 @@ export interface SignatureDescriptor_Data { /** multi represents a multisig signer */ multi?: SignatureDescriptor_Data_Multi; } +export interface ReactiveSignatureDescriptor_Data { + single?: ComputedRef<SignatureDescriptor_Data_Single>; + multi?: ComputedRef<SignatureDescriptor_Data_Multi>; +} export interface SignatureDescriptor_DataProtoMsg { typeUrl: "/cosmos.tx.signing.v1beta1.Data"; value: Uint8Array; @@ -156,6 +169,10 @@ export interface SignatureDescriptor_Data_Single { /** signature is the raw signature bytes */ signature: Uint8Array; } +export interface ReactiveSignatureDescriptor_Data_Single { + mode: ComputedRef<SignMode>; + signature: ComputedRef<Uint8Array>; +} export interface SignatureDescriptor_Data_SingleProtoMsg { typeUrl: "/cosmos.tx.signing.v1beta1.Single"; value: Uint8Array; @@ -172,6 +189,10 @@ export interface SignatureDescriptor_Data_Multi { /** signatures is the signatures of the multi-signature */ signatures: SignatureDescriptor_Data[]; } +export interface ReactiveSignatureDescriptor_Data_Multi { + bitarray?: ComputedRef<CompactBitArray>; + signatures: ComputedRef<SignatureDescriptor_Data[]>; +} export interface SignatureDescriptor_Data_MultiProtoMsg { typeUrl: "/cosmos.tx.signing.v1beta1.Multi"; value: Uint8Array; @@ -212,9 +233,9 @@ export const SignatureDescriptors = { return message; }, fromJSON(object: any): SignatureDescriptors { - const obj = createBaseSignatureDescriptors(); - if (Array.isArray(object?.signatures)) obj.signatures = object.signatures.map((e: any) => SignatureDescriptor.fromJSON(e)); - return obj; + return { + signatures: Array.isArray(object?.signatures) ? object.signatures.map((e: any) => SignatureDescriptor.fromJSON(e)) : [] + }; }, toJSON(message: SignatureDescriptors): JsonSafe<SignatureDescriptors> { const obj: any = {}; @@ -301,7 +322,7 @@ export const SignatureDescriptor = { if (message.data !== undefined) { SignatureDescriptor_Data.encode(message.data, writer.uint32(18).fork()).ldelim(); } - if (message.sequence !== undefined) { + if (message.sequence !== BigInt(0)) { writer.uint32(24).uint64(message.sequence); } return writer; @@ -330,11 +351,11 @@ export const SignatureDescriptor = { return message; }, fromJSON(object: any): SignatureDescriptor { - 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; + 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) + }; }, toJSON(message: SignatureDescriptor): JsonSafe<SignatureDescriptor> { const obj: any = {}; @@ -345,15 +366,9 @@ export const SignatureDescriptor = { }, fromPartial(object: DeepPartial<SignatureDescriptor>): SignatureDescriptor { const message = createBaseSignatureDescriptor(); - 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()); - } + 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); return message; }, fromSDK(object: SignatureDescriptorSDKType): SignatureDescriptor { @@ -457,10 +472,10 @@ export const SignatureDescriptor_Data = { return message; }, fromJSON(object: any): SignatureDescriptor_Data { - 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; + return { + single: isSet(object.single) ? SignatureDescriptor_Data_Single.fromJSON(object.single) : undefined, + multi: isSet(object.multi) ? SignatureDescriptor_Data_Multi.fromJSON(object.multi) : undefined + }; }, toJSON(message: SignatureDescriptor_Data): JsonSafe<SignatureDescriptor_Data> { const obj: any = {}; @@ -470,12 +485,8 @@ export const SignatureDescriptor_Data = { }, fromPartial(object: DeepPartial<SignatureDescriptor_Data>): SignatureDescriptor_Data { const message = createBaseSignatureDescriptor_Data(); - 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); - } + 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; return message; }, fromSDK(object: SignatureDescriptor_DataSDKType): SignatureDescriptor_Data { @@ -572,10 +583,10 @@ export const SignatureDescriptor_Data_Single = { return message; }, fromJSON(object: any): SignatureDescriptor_Data_Single { - 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; + return { + mode: isSet(object.mode) ? signModeFromJSON(object.mode) : -1, + signature: isSet(object.signature) ? bytesFromBase64(object.signature) : new Uint8Array() + }; }, toJSON(message: SignatureDescriptor_Data_Single): JsonSafe<SignatureDescriptor_Data_Single> { const obj: any = {}; @@ -683,10 +694,10 @@ export const SignatureDescriptor_Data_Multi = { return message; }, fromJSON(object: any): SignatureDescriptor_Data_Multi { - 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; + return { + bitarray: isSet(object.bitarray) ? CompactBitArray.fromJSON(object.bitarray) : undefined, + signatures: Array.isArray(object?.signatures) ? object.signatures.map((e: any) => SignatureDescriptor_Data.fromJSON(e)) : [] + }; }, toJSON(message: SignatureDescriptor_Data_Multi): JsonSafe<SignatureDescriptor_Data_Multi> { const obj: any = {}; @@ -700,9 +711,7 @@ export const SignatureDescriptor_Data_Multi = { }, fromPartial(object: DeepPartial<SignatureDescriptor_Data_Multi>): SignatureDescriptor_Data_Multi { const message = createBaseSignatureDescriptor_Data_Multi(); - if (object.bitarray !== undefined && object.bitarray !== null) { - message.bitarray = CompactBitArray.fromPartial(object.bitarray); - } + message.bitarray = object.bitarray !== undefined && object.bitarray !== null ? CompactBitArray.fromPartial(object.bitarray) : undefined; 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 d2d8f63cd5..fa75aeddef 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.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 { 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 { 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.js"; +import { SimulateRequest, SimulateRequestSDKType, SimulateResponse, SimulateResponseSDKType, GetTxRequest, GetTxRequestSDKType, GetTxResponse, GetTxResponseSDKType, BroadcastTxRequest, BroadcastTxRequestSDKType, BroadcastTxResponse, BroadcastTxResponseSDKType, GetTxsEventRequest, GetTxsEventRequestSDKType, GetTxsEventResponse, GetTxsEventResponseSDKType, GetBlockWithTxsRequest, GetBlockWithTxsRequestSDKType, GetBlockWithTxsResponse, GetBlockWithTxsResponseSDKType } from "./service"; 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 4dd76261b6..bbc924eb0f 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.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 { 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 { 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.js"; +import { SimulateRequest, SimulateRequestSDKType, SimulateResponse, SimulateResponseSDKType, GetTxRequest, GetTxRequestSDKType, GetTxResponse, GetTxResponseSDKType, BroadcastTxRequest, BroadcastTxRequestSDKType, BroadcastTxResponse, BroadcastTxResponseSDKType, GetTxsEventRequest, GetTxsEventRequestSDKType, GetTxsEventResponse, GetTxsEventResponseSDKType, GetBlockWithTxsRequest, GetBlockWithTxsRequestSDKType, GetBlockWithTxsResponse, GetBlockWithTxsResponseSDKType } from "./service"; /** 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 b0919e5265..aebe038375 100644 --- a/__fixtures__/v-next/outputv4/cosmos/tx/v1beta1/service.ts +++ b/__fixtures__/v-next/outputv4/cosmos/tx/v1beta1/service.ts @@ -1,11 +1,12 @@ -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"; +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"; export const protobufPackage = "cosmos.tx.v1beta1"; /** OrderBy defines the sorting order */ export enum OrderBy { @@ -116,6 +117,11 @@ export interface GetTxsEventRequest { pagination?: PageRequest; orderBy: OrderBy; } +export interface ReactiveGetTxsEventRequest { + events: ComputedRef<string[]>; + pagination?: ComputedRef<PageRequest>; + orderBy: ComputedRef<OrderBy>; +} export interface GetTxsEventRequestProtoMsg { typeUrl: "/cosmos.tx.v1beta1.GetTxsEventRequest"; value: Uint8Array; @@ -141,6 +147,11 @@ export interface GetTxsEventResponse { /** pagination defines a pagination for the response. */ pagination?: PageResponse; } +export interface ReactiveGetTxsEventResponse { + txs: ComputedRef<Tx[]>; + txResponses: ComputedRef<TxResponse[]>; + pagination?: ComputedRef<PageResponse>; +} export interface GetTxsEventResponseProtoMsg { typeUrl: "/cosmos.tx.v1beta1.GetTxsEventResponse"; value: Uint8Array; @@ -163,6 +174,10 @@ export interface BroadcastTxRequest { txBytes: Uint8Array; mode: BroadcastMode; } +export interface ReactiveBroadcastTxRequest { + txBytes: ComputedRef<Uint8Array>; + mode: ComputedRef<BroadcastMode>; +} export interface BroadcastTxRequestProtoMsg { typeUrl: "/cosmos.tx.v1beta1.BroadcastTxRequest"; value: Uint8Array; @@ -183,6 +198,9 @@ export interface BroadcastTxResponse { /** tx_response is the queried TxResponses. */ txResponse?: TxResponse; } +export interface ReactiveBroadcastTxResponse { + txResponse?: ComputedRef<TxResponse>; +} export interface BroadcastTxResponseProtoMsg { typeUrl: "/cosmos.tx.v1beta1.BroadcastTxResponse"; value: Uint8Array; @@ -212,6 +230,10 @@ export interface SimulateRequest { */ txBytes: Uint8Array; } +export interface ReactiveSimulateRequest { + tx?: ComputedRef<Tx>; + txBytes: ComputedRef<Uint8Array>; +} export interface SimulateRequestProtoMsg { typeUrl: "/cosmos.tx.v1beta1.SimulateRequest"; value: Uint8Array; @@ -235,6 +257,10 @@ export interface SimulateResponse { /** result is the result of the simulation. */ result?: Result; } +export interface ReactiveSimulateResponse { + gasInfo?: ComputedRef<GasInfo>; + result?: ComputedRef<Result>; +} export interface SimulateResponseProtoMsg { typeUrl: "/cosmos.tx.v1beta1.SimulateResponse"; value: Uint8Array; @@ -255,6 +281,9 @@ export interface GetTxRequest { /** hash is the tx hash to query, encoded as a hex string. */ hash: string; } +export interface ReactiveGetTxRequest { + hash: ComputedRef<string>; +} export interface GetTxRequestProtoMsg { typeUrl: "/cosmos.tx.v1beta1.GetTxRequest"; value: Uint8Array; @@ -273,6 +302,10 @@ export interface GetTxResponse { /** tx_response is the queried TxResponses. */ txResponse?: TxResponse; } +export interface ReactiveGetTxResponse { + tx?: ComputedRef<Tx>; + txResponse?: ComputedRef<TxResponse>; +} export interface GetTxResponseProtoMsg { typeUrl: "/cosmos.tx.v1beta1.GetTxResponse"; value: Uint8Array; @@ -294,6 +327,10 @@ export interface GetBlockWithTxsRequest { /** pagination defines a pagination for the request. */ pagination?: PageRequest; } +export interface ReactiveGetBlockWithTxsRequest { + height: ComputedRef<bigint>; + pagination?: ComputedRef<PageRequest>; +} export interface GetBlockWithTxsRequestProtoMsg { typeUrl: "/cosmos.tx.v1beta1.GetBlockWithTxsRequest"; value: Uint8Array; @@ -321,6 +358,12 @@ export interface GetBlockWithTxsResponse { /** pagination defines a pagination for the response. */ pagination?: PageResponse; } +export interface ReactiveGetBlockWithTxsResponse { + txs: ComputedRef<Tx[]>; + blockId?: ComputedRef<BlockID>; + block?: ComputedRef<Block>; + pagination?: ComputedRef<PageResponse>; +} export interface GetBlockWithTxsResponseProtoMsg { typeUrl: "/cosmos.tx.v1beta1.GetBlockWithTxsResponse"; value: Uint8Array; @@ -381,11 +424,11 @@ export const GetTxsEventRequest = { return message; }, fromJSON(object: any): GetTxsEventRequest { - 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; + 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 + }; }, toJSON(message: GetTxsEventRequest): JsonSafe<GetTxsEventRequest> { const obj: any = {}; @@ -401,9 +444,7 @@ export const GetTxsEventRequest = { fromPartial(object: DeepPartial<GetTxsEventRequest>): GetTxsEventRequest { const message = createBaseGetTxsEventRequest(); message.events = object.events?.map(e => e) || []; - if (object.pagination !== undefined && object.pagination !== null) { - message.pagination = PageRequest.fromPartial(object.pagination); - } + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageRequest.fromPartial(object.pagination) : undefined; message.orderBy = object.orderBy ?? 0; return message; }, @@ -521,11 +562,11 @@ export const GetTxsEventResponse = { return message; }, fromJSON(object: any): GetTxsEventResponse { - 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; + 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 + }; }, toJSON(message: GetTxsEventResponse): JsonSafe<GetTxsEventResponse> { const obj: any = {}; @@ -546,9 +587,7 @@ export const GetTxsEventResponse = { const message = createBaseGetTxsEventResponse(); message.txs = object.txs?.map(e => Tx.fromPartial(e)) || []; message.txResponses = object.txResponses?.map(e => TxResponse.fromPartial(e)) || []; - if (object.pagination !== undefined && object.pagination !== null) { - message.pagination = PageResponse.fromPartial(object.pagination); - } + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageResponse.fromPartial(object.pagination) : undefined; return message; }, fromSDK(object: GetTxsEventResponseSDKType): GetTxsEventResponse { @@ -664,10 +703,10 @@ export const BroadcastTxRequest = { return message; }, fromJSON(object: any): BroadcastTxRequest { - const obj = createBaseBroadcastTxRequest(); - if (isSet(object.txBytes)) obj.txBytes = bytesFromBase64(object.txBytes); - if (isSet(object.mode)) obj.mode = broadcastModeFromJSON(object.mode); - return obj; + return { + txBytes: isSet(object.txBytes) ? bytesFromBase64(object.txBytes) : new Uint8Array(), + mode: isSet(object.mode) ? broadcastModeFromJSON(object.mode) : -1 + }; }, toJSON(message: BroadcastTxRequest): JsonSafe<BroadcastTxRequest> { const obj: any = {}; @@ -768,9 +807,9 @@ export const BroadcastTxResponse = { return message; }, fromJSON(object: any): BroadcastTxResponse { - const obj = createBaseBroadcastTxResponse(); - if (isSet(object.txResponse)) obj.txResponse = TxResponse.fromJSON(object.txResponse); - return obj; + return { + txResponse: isSet(object.txResponse) ? TxResponse.fromJSON(object.txResponse) : undefined + }; }, toJSON(message: BroadcastTxResponse): JsonSafe<BroadcastTxResponse> { const obj: any = {}; @@ -779,9 +818,7 @@ export const BroadcastTxResponse = { }, fromPartial(object: DeepPartial<BroadcastTxResponse>): BroadcastTxResponse { const message = createBaseBroadcastTxResponse(); - if (object.txResponse !== undefined && object.txResponse !== null) { - message.txResponse = TxResponse.fromPartial(object.txResponse); - } + message.txResponse = object.txResponse !== undefined && object.txResponse !== null ? TxResponse.fromPartial(object.txResponse) : undefined; return message; }, fromSDK(object: BroadcastTxResponseSDKType): BroadcastTxResponse { @@ -871,10 +908,10 @@ export const SimulateRequest = { return message; }, fromJSON(object: any): SimulateRequest { - const obj = createBaseSimulateRequest(); - if (isSet(object.tx)) obj.tx = Tx.fromJSON(object.tx); - if (isSet(object.txBytes)) obj.txBytes = bytesFromBase64(object.txBytes); - return obj; + return { + tx: isSet(object.tx) ? Tx.fromJSON(object.tx) : undefined, + txBytes: isSet(object.txBytes) ? bytesFromBase64(object.txBytes) : new Uint8Array() + }; }, toJSON(message: SimulateRequest): JsonSafe<SimulateRequest> { const obj: any = {}; @@ -884,9 +921,7 @@ export const SimulateRequest = { }, fromPartial(object: DeepPartial<SimulateRequest>): SimulateRequest { const message = createBaseSimulateRequest(); - if (object.tx !== undefined && object.tx !== null) { - message.tx = Tx.fromPartial(object.tx); - } + message.tx = object.tx !== undefined && object.tx !== null ? Tx.fromPartial(object.tx) : undefined; message.txBytes = object.txBytes ?? new Uint8Array(); return message; }, @@ -984,10 +1019,10 @@ export const SimulateResponse = { return message; }, fromJSON(object: any): SimulateResponse { - 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; + return { + gasInfo: isSet(object.gasInfo) ? GasInfo.fromJSON(object.gasInfo) : undefined, + result: isSet(object.result) ? Result.fromJSON(object.result) : undefined + }; }, toJSON(message: SimulateResponse): JsonSafe<SimulateResponse> { const obj: any = {}; @@ -997,12 +1032,8 @@ export const SimulateResponse = { }, fromPartial(object: DeepPartial<SimulateResponse>): SimulateResponse { const message = createBaseSimulateResponse(); - 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); - } + 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; return message; }, fromSDK(object: SimulateResponseSDKType): SimulateResponse { @@ -1069,7 +1100,7 @@ function createBaseGetTxRequest(): GetTxRequest { export const GetTxRequest = { typeUrl: "/cosmos.tx.v1beta1.GetTxRequest", encode(message: GetTxRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.hash !== undefined) { + if (message.hash !== "") { writer.uint32(10).string(message.hash); } return writer; @@ -1092,9 +1123,9 @@ export const GetTxRequest = { return message; }, fromJSON(object: any): GetTxRequest { - const obj = createBaseGetTxRequest(); - if (isSet(object.hash)) obj.hash = String(object.hash); - return obj; + return { + hash: isSet(object.hash) ? String(object.hash) : "" + }; }, toJSON(message: GetTxRequest): JsonSafe<GetTxRequest> { const obj: any = {}; @@ -1193,10 +1224,10 @@ export const GetTxResponse = { return message; }, fromJSON(object: any): GetTxResponse { - 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; + return { + tx: isSet(object.tx) ? Tx.fromJSON(object.tx) : undefined, + txResponse: isSet(object.txResponse) ? TxResponse.fromJSON(object.txResponse) : undefined + }; }, toJSON(message: GetTxResponse): JsonSafe<GetTxResponse> { const obj: any = {}; @@ -1206,12 +1237,8 @@ export const GetTxResponse = { }, fromPartial(object: DeepPartial<GetTxResponse>): GetTxResponse { const message = createBaseGetTxResponse(); - 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); - } + 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; return message; }, fromSDK(object: GetTxResponseSDKType): GetTxResponse { @@ -1279,7 +1306,7 @@ function createBaseGetBlockWithTxsRequest(): GetBlockWithTxsRequest { export const GetBlockWithTxsRequest = { typeUrl: "/cosmos.tx.v1beta1.GetBlockWithTxsRequest", encode(message: GetBlockWithTxsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.height !== undefined) { + if (message.height !== BigInt(0)) { writer.uint32(8).int64(message.height); } if (message.pagination !== undefined) { @@ -1308,10 +1335,10 @@ export const GetBlockWithTxsRequest = { return message; }, fromJSON(object: any): GetBlockWithTxsRequest { - 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; + return { + height: isSet(object.height) ? BigInt(object.height.toString()) : BigInt(0), + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined + }; }, toJSON(message: GetBlockWithTxsRequest): JsonSafe<GetBlockWithTxsRequest> { const obj: any = {}; @@ -1321,12 +1348,8 @@ export const GetBlockWithTxsRequest = { }, fromPartial(object: DeepPartial<GetBlockWithTxsRequest>): GetBlockWithTxsRequest { const message = createBaseGetBlockWithTxsRequest(); - 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); - } + 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; return message; }, fromSDK(object: GetBlockWithTxsRequestSDKType): GetBlockWithTxsRequest { @@ -1437,12 +1460,12 @@ export const GetBlockWithTxsResponse = { return message; }, fromJSON(object: any): GetBlockWithTxsResponse { - 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; + 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 + }; }, toJSON(message: GetBlockWithTxsResponse): JsonSafe<GetBlockWithTxsResponse> { const obj: any = {}; @@ -1459,15 +1482,9 @@ export const GetBlockWithTxsResponse = { fromPartial(object: DeepPartial<GetBlockWithTxsResponse>): GetBlockWithTxsResponse { const message = createBaseGetBlockWithTxsResponse(); message.txs = object.txs?.map(e => Tx.fromPartial(e)) || []; - 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); - } + 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; 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 13eadffee6..29dd69c5f1 100644 --- a/__fixtures__/v-next/outputv4/cosmos/tx/v1beta1/tx.ts +++ b/__fixtures__/v-next/outputv4/cosmos/tx/v1beta1/tx.ts @@ -1,10 +1,11 @@ -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"; +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"; export const protobufPackage = "cosmos.tx.v1beta1"; /** Tx is the standard type used for broadcasting transactions. */ export interface Tx { @@ -22,6 +23,11 @@ export interface Tx { */ signatures: Uint8Array[]; } +export interface ReactiveTx { + body?: ComputedRef<TxBody>; + authInfo?: ComputedRef<AuthInfo>; + signatures: ComputedRef<Uint8Array[]>; +} export interface TxProtoMsg { typeUrl: "/cosmos.tx.v1beta1.Tx"; value: Uint8Array; @@ -57,6 +63,11 @@ export interface TxRaw { */ signatures: Uint8Array[]; } +export interface ReactiveTxRaw { + bodyBytes: ComputedRef<Uint8Array>; + authInfoBytes: ComputedRef<Uint8Array>; + signatures: ComputedRef<Uint8Array[]>; +} export interface TxRawProtoMsg { typeUrl: "/cosmos.tx.v1beta1.TxRaw"; value: Uint8Array; @@ -94,6 +105,12 @@ export interface SignDoc { /** account_number is the account number of the account in state */ accountNumber: bigint; } +export interface ReactiveSignDoc { + bodyBytes: ComputedRef<Uint8Array>; + authInfoBytes: ComputedRef<Uint8Array>; + chainId: ComputedRef<string>; + accountNumber: ComputedRef<bigint>; +} export interface SignDocProtoMsg { typeUrl: "/cosmos.tx.v1beta1.SignDoc"; value: Uint8Array; @@ -135,6 +152,14 @@ export interface SignDocDirectAux { */ tip?: Tip; } +export interface ReactiveSignDocDirectAux { + bodyBytes: ComputedRef<Uint8Array>; + publicKey?: ComputedRef<Any>; + chainId: ComputedRef<string>; + accountNumber: ComputedRef<bigint>; + sequence: ComputedRef<bigint>; + tip?: ComputedRef<Tip>; +} export interface SignDocDirectAuxProtoMsg { typeUrl: "/cosmos.tx.v1beta1.SignDocDirectAux"; value: Uint8Array; @@ -189,6 +214,13 @@ export interface TxBody { */ nonCriticalExtensionOptions: Any[]; } +export interface ReactiveTxBody { + messages: ComputedRef<Any[]>; + memo: ComputedRef<string>; + timeoutHeight: ComputedRef<bigint>; + extensionOptions: ComputedRef<Any[]>; + nonCriticalExtensionOptions: ComputedRef<Any[]>; +} export interface TxBodyProtoMsg { typeUrl: "/cosmos.tx.v1beta1.TxBody"; value: Uint8Array; @@ -227,6 +259,11 @@ export interface AuthInfo { */ tip?: Tip; } +export interface ReactiveAuthInfo { + signerInfos: ComputedRef<SignerInfo[]>; + fee?: ComputedRef<Fee>; + tip?: ComputedRef<Tip>; +} export interface AuthInfoProtoMsg { typeUrl: "/cosmos.tx.v1beta1.AuthInfo"; value: Uint8Array; @@ -263,6 +300,11 @@ export interface SignerInfo { */ sequence: bigint; } +export interface ReactiveSignerInfo { + publicKey?: ComputedRef<Any>; + modeInfo?: ComputedRef<ModeInfo>; + sequence: ComputedRef<bigint>; +} export interface SignerInfoProtoMsg { typeUrl: "/cosmos.tx.v1beta1.SignerInfo"; value: Uint8Array; @@ -283,6 +325,10 @@ export interface ModeInfo { /** multi represents a nested multisig signer */ multi?: ModeInfo_Multi; } +export interface ReactiveModeInfo { + single?: ComputedRef<ModeInfo_Single>; + multi?: ComputedRef<ModeInfo_Multi>; +} export interface ModeInfoProtoMsg { typeUrl: "/cosmos.tx.v1beta1.ModeInfo"; value: Uint8Array; @@ -301,6 +347,9 @@ export interface ModeInfo_Single { /** mode is the signing mode of the single signer */ mode: SignMode; } +export interface ReactiveModeInfo_Single { + mode: ComputedRef<SignMode>; +} export interface ModeInfo_SingleProtoMsg { typeUrl: "/cosmos.tx.v1beta1.Single"; value: Uint8Array; @@ -323,6 +372,10 @@ export interface ModeInfo_Multi { */ modeInfos: ModeInfo[]; } +export interface ReactiveModeInfo_Multi { + bitarray?: ComputedRef<CompactBitArray>; + modeInfos: ComputedRef<ModeInfo[]>; +} export interface ModeInfo_MultiProtoMsg { typeUrl: "/cosmos.tx.v1beta1.Multi"; value: Uint8Array; @@ -358,6 +411,12 @@ export interface Fee { */ granter: string; } +export interface ReactiveFee { + amount: ComputedRef<Coin[]>; + gasLimit: ComputedRef<bigint>; + payer: ComputedRef<string>; + granter: ComputedRef<string>; +} export interface FeeProtoMsg { typeUrl: "/cosmos.tx.v1beta1.Fee"; value: Uint8Array; @@ -384,6 +443,10 @@ export interface Tip { /** tipper is the address of the account paying for the tip */ tipper: string; } +export interface ReactiveTip { + amount: ComputedRef<Coin[]>; + tipper: ComputedRef<string>; +} export interface TipProtoMsg { typeUrl: "/cosmos.tx.v1beta1.Tip"; value: Uint8Array; @@ -423,6 +486,12 @@ export interface AuxSignerData { /** sig is the signature of the sign doc. */ sig: Uint8Array; } +export interface ReactiveAuxSignerData { + address: ComputedRef<string>; + signDoc?: ComputedRef<SignDocDirectAux>; + mode: ComputedRef<SignMode>; + sig: ComputedRef<Uint8Array>; +} export interface AuxSignerDataProtoMsg { typeUrl: "/cosmos.tx.v1beta1.AuxSignerData"; value: Uint8Array; @@ -486,11 +555,11 @@ export const Tx = { return message; }, fromJSON(object: any): Tx { - 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; + 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)) : [] + }; }, toJSON(message: Tx): JsonSafe<Tx> { const obj: any = {}; @@ -505,12 +574,8 @@ export const Tx = { }, fromPartial(object: DeepPartial<Tx>): Tx { const message = createBaseTx(); - 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.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; message.signatures = object.signatures?.map(e => e) || []; return message; }, @@ -628,11 +693,11 @@ export const TxRaw = { return message; }, fromJSON(object: any): TxRaw { - 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; + 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)) : [] + }; }, toJSON(message: TxRaw): JsonSafe<TxRaw> { const obj: any = {}; @@ -738,10 +803,10 @@ export const SignDoc = { if (message.authInfoBytes.length !== 0) { writer.uint32(18).bytes(message.authInfoBytes); } - if (message.chainId !== undefined) { + if (message.chainId !== "") { writer.uint32(26).string(message.chainId); } - if (message.accountNumber !== undefined) { + if (message.accountNumber !== BigInt(0)) { writer.uint32(32).uint64(message.accountNumber); } return writer; @@ -773,12 +838,12 @@ export const SignDoc = { return message; }, fromJSON(object: any): SignDoc { - 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; + 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) + }; }, toJSON(message: SignDoc): JsonSafe<SignDoc> { const obj: any = {}; @@ -793,9 +858,7 @@ export const SignDoc = { message.bodyBytes = object.bodyBytes ?? new Uint8Array(); message.authInfoBytes = object.authInfoBytes ?? new Uint8Array(); message.chainId = object.chainId ?? ""; - if (object.accountNumber !== undefined && object.accountNumber !== null) { - message.accountNumber = BigInt(object.accountNumber.toString()); - } + message.accountNumber = object.accountNumber !== undefined && object.accountNumber !== null ? BigInt(object.accountNumber.toString()) : BigInt(0); return message; }, fromSDK(object: SignDocSDKType): SignDoc { @@ -887,13 +950,13 @@ export const SignDocDirectAux = { if (message.publicKey !== undefined) { Any.encode(message.publicKey, writer.uint32(18).fork()).ldelim(); } - if (message.chainId !== undefined) { + if (message.chainId !== "") { writer.uint32(26).string(message.chainId); } - if (message.accountNumber !== undefined) { + if (message.accountNumber !== BigInt(0)) { writer.uint32(32).uint64(message.accountNumber); } - if (message.sequence !== undefined) { + if (message.sequence !== BigInt(0)) { writer.uint32(40).uint64(message.sequence); } if (message.tip !== undefined) { @@ -934,14 +997,14 @@ export const SignDocDirectAux = { return message; }, fromJSON(object: any): SignDocDirectAux { - 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; + 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 + }; }, toJSON(message: SignDocDirectAux): JsonSafe<SignDocDirectAux> { const obj: any = {}; @@ -956,19 +1019,11 @@ export const SignDocDirectAux = { fromPartial(object: DeepPartial<SignDocDirectAux>): SignDocDirectAux { const message = createBaseSignDocDirectAux(); message.bodyBytes = object.bodyBytes ?? new Uint8Array(); - if (object.publicKey !== undefined && object.publicKey !== null) { - message.publicKey = Any.fromPartial(object.publicKey); - } + message.publicKey = object.publicKey !== undefined && object.publicKey !== null ? Any.fromPartial(object.publicKey) : undefined; message.chainId = object.chainId ?? ""; - 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); - } + 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; return message; }, fromSDK(object: SignDocDirectAuxSDKType): SignDocDirectAux { @@ -1070,10 +1125,10 @@ export const TxBody = { for (const v of message.messages) { Any.encode(v!, writer.uint32(10).fork()).ldelim(); } - if (message.memo !== undefined) { + if (message.memo !== "") { writer.uint32(18).string(message.memo); } - if (message.timeoutHeight !== undefined) { + if (message.timeoutHeight !== BigInt(0)) { writer.uint32(24).uint64(message.timeoutHeight); } for (const v of message.extensionOptions) { @@ -1114,13 +1169,13 @@ export const TxBody = { return message; }, fromJSON(object: any): TxBody { - 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; + 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)) : [] + }; }, toJSON(message: TxBody): JsonSafe<TxBody> { const obj: any = {}; @@ -1147,9 +1202,7 @@ export const TxBody = { const message = createBaseTxBody(); message.messages = object.messages?.map(e => Any.fromPartial(e)) || []; message.memo = object.memo ?? ""; - if (object.timeoutHeight !== undefined && object.timeoutHeight !== null) { - message.timeoutHeight = BigInt(object.timeoutHeight.toString()); - } + message.timeoutHeight = object.timeoutHeight !== undefined && object.timeoutHeight !== null ? BigInt(object.timeoutHeight.toString()) : BigInt(0); message.extensionOptions = object.extensionOptions?.map(e => Any.fromPartial(e)) || []; message.nonCriticalExtensionOptions = object.nonCriticalExtensionOptions?.map(e => Any.fromPartial(e)) || []; return message; @@ -1294,11 +1347,11 @@ export const AuthInfo = { return message; }, fromJSON(object: any): AuthInfo { - 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; + 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 + }; }, toJSON(message: AuthInfo): JsonSafe<AuthInfo> { const obj: any = {}; @@ -1314,12 +1367,8 @@ export const AuthInfo = { fromPartial(object: DeepPartial<AuthInfo>): AuthInfo { const message = createBaseAuthInfo(); message.signerInfos = object.signerInfos?.map(e => SignerInfo.fromPartial(e)) || []; - 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); - } + 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; return message; }, fromSDK(object: AuthInfoSDKType): AuthInfo { @@ -1407,7 +1456,7 @@ export const SignerInfo = { if (message.modeInfo !== undefined) { ModeInfo.encode(message.modeInfo, writer.uint32(18).fork()).ldelim(); } - if (message.sequence !== undefined) { + if (message.sequence !== BigInt(0)) { writer.uint32(24).uint64(message.sequence); } return writer; @@ -1436,11 +1485,11 @@ export const SignerInfo = { return message; }, fromJSON(object: any): SignerInfo { - 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; + 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) + }; }, toJSON(message: SignerInfo): JsonSafe<SignerInfo> { const obj: any = {}; @@ -1451,15 +1500,9 @@ export const SignerInfo = { }, fromPartial(object: DeepPartial<SignerInfo>): SignerInfo { const message = createBaseSignerInfo(); - 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()); - } + 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); return message; }, fromSDK(object: SignerInfoSDKType): SignerInfo { @@ -1563,10 +1606,10 @@ export const ModeInfo = { return message; }, fromJSON(object: any): ModeInfo { - 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; + return { + single: isSet(object.single) ? ModeInfo_Single.fromJSON(object.single) : undefined, + multi: isSet(object.multi) ? ModeInfo_Multi.fromJSON(object.multi) : undefined + }; }, toJSON(message: ModeInfo): JsonSafe<ModeInfo> { const obj: any = {}; @@ -1576,12 +1619,8 @@ export const ModeInfo = { }, fromPartial(object: DeepPartial<ModeInfo>): ModeInfo { const message = createBaseModeInfo(); - 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); - } + 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; return message; }, fromSDK(object: ModeInfoSDKType): ModeInfo { @@ -1671,9 +1710,9 @@ export const ModeInfo_Single = { return message; }, fromJSON(object: any): ModeInfo_Single { - const obj = createBaseModeInfo_Single(); - if (isSet(object.mode)) obj.mode = signModeFromJSON(object.mode); - return obj; + return { + mode: isSet(object.mode) ? signModeFromJSON(object.mode) : -1 + }; }, toJSON(message: ModeInfo_Single): JsonSafe<ModeInfo_Single> { const obj: any = {}; @@ -1772,10 +1811,10 @@ export const ModeInfo_Multi = { return message; }, fromJSON(object: any): ModeInfo_Multi { - 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; + return { + bitarray: isSet(object.bitarray) ? CompactBitArray.fromJSON(object.bitarray) : undefined, + modeInfos: Array.isArray(object?.modeInfos) ? object.modeInfos.map((e: any) => ModeInfo.fromJSON(e)) : [] + }; }, toJSON(message: ModeInfo_Multi): JsonSafe<ModeInfo_Multi> { const obj: any = {}; @@ -1789,9 +1828,7 @@ export const ModeInfo_Multi = { }, fromPartial(object: DeepPartial<ModeInfo_Multi>): ModeInfo_Multi { const message = createBaseModeInfo_Multi(); - if (object.bitarray !== undefined && object.bitarray !== null) { - message.bitarray = CompactBitArray.fromPartial(object.bitarray); - } + message.bitarray = object.bitarray !== undefined && object.bitarray !== null ? CompactBitArray.fromPartial(object.bitarray) : undefined; message.modeInfos = object.modeInfos?.map(e => ModeInfo.fromPartial(e)) || []; return message; }, @@ -1871,13 +1908,13 @@ export const Fee = { for (const v of message.amount) { Coin.encode(v!, writer.uint32(10).fork()).ldelim(); } - if (message.gasLimit !== undefined) { + if (message.gasLimit !== BigInt(0)) { writer.uint32(16).uint64(message.gasLimit); } - if (message.payer !== undefined) { + if (message.payer !== "") { writer.uint32(26).string(message.payer); } - if (message.granter !== undefined) { + if (message.granter !== "") { writer.uint32(34).string(message.granter); } return writer; @@ -1909,12 +1946,12 @@ export const Fee = { return message; }, fromJSON(object: any): Fee { - 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; + 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) : "" + }; }, toJSON(message: Fee): JsonSafe<Fee> { const obj: any = {}; @@ -1931,9 +1968,7 @@ export const Fee = { fromPartial(object: DeepPartial<Fee>): Fee { const message = createBaseFee(); message.amount = object.amount?.map(e => Coin.fromPartial(e)) || []; - if (object.gasLimit !== undefined && object.gasLimit !== null) { - message.gasLimit = BigInt(object.gasLimit.toString()); - } + message.gasLimit = object.gasLimit !== undefined && object.gasLimit !== null ? BigInt(object.gasLimit.toString()) : BigInt(0); message.payer = object.payer ?? ""; message.granter = object.granter ?? ""; return message; @@ -2026,7 +2061,7 @@ export const Tip = { for (const v of message.amount) { Coin.encode(v!, writer.uint32(10).fork()).ldelim(); } - if (message.tipper !== undefined) { + if (message.tipper !== "") { writer.uint32(18).string(message.tipper); } return writer; @@ -2052,10 +2087,10 @@ export const Tip = { return message; }, fromJSON(object: any): Tip { - 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; + return { + amount: Array.isArray(object?.amount) ? object.amount.map((e: any) => Coin.fromJSON(e)) : [], + tipper: isSet(object.tipper) ? String(object.tipper) : "" + }; }, toJSON(message: Tip): JsonSafe<Tip> { const obj: any = {}; @@ -2146,7 +2181,7 @@ function createBaseAuxSignerData(): AuxSignerData { export const AuxSignerData = { typeUrl: "/cosmos.tx.v1beta1.AuxSignerData", encode(message: AuxSignerData, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.address !== undefined) { + if (message.address !== "") { writer.uint32(10).string(message.address); } if (message.signDoc !== undefined) { @@ -2187,12 +2222,12 @@ export const AuxSignerData = { return message; }, fromJSON(object: any): AuxSignerData { - 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; + 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() + }; }, toJSON(message: AuxSignerData): JsonSafe<AuxSignerData> { const obj: any = {}; @@ -2205,9 +2240,7 @@ export const AuxSignerData = { fromPartial(object: DeepPartial<AuxSignerData>): AuxSignerData { const message = createBaseAuxSignerData(); message.address = object.address ?? ""; - if (object.signDoc !== undefined && object.signDoc !== null) { - message.signDoc = SignDocDirectAux.fromPartial(object.signDoc); - } + message.signDoc = object.signDoc !== undefined && object.signDoc !== null ? SignDocDirectAux.fromPartial(object.signDoc) : undefined; 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 e2a48e1e67..70cb3779a6 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.js"; +import { Plan, PlanSDKType, ModuleVersion, ModuleVersionSDKType } from "./upgrade"; 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.js"; +import { QueryCurrentPlanRequest, QueryCurrentPlanRequestSDKType, QueryCurrentPlanResponse, QueryCurrentPlanResponseSDKType, QueryAppliedPlanRequest, QueryAppliedPlanRequestSDKType, QueryAppliedPlanResponse, QueryAppliedPlanResponseSDKType, QueryUpgradedConsensusStateRequest, QueryUpgradedConsensusStateRequestSDKType, QueryUpgradedConsensusStateResponse, QueryUpgradedConsensusStateResponseSDKType, QueryModuleVersionsRequest, QueryModuleVersionsRequestSDKType, QueryModuleVersionsResponse, QueryModuleVersionsResponseSDKType, QueryAuthorityRequest, QueryAuthorityRequestSDKType, QueryAuthorityResponse, QueryAuthorityResponseSDKType } from "./query"; 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 80d127d58d..80484b6d9d 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.js"; -import { Rpc } from "../../../helpers.js"; -import { BinaryReader } from "../../../binary.js"; +import { Plan, PlanSDKType, ModuleVersion, ModuleVersionSDKType } from "./upgrade"; +import { Rpc } from "../../../helpers"; +import { BinaryReader } from "../../../binary"; 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 } from "./query.js"; +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"; /** 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 65e3031521..eaf8cdbf62 100644 --- a/__fixtures__/v-next/outputv4/cosmos/upgrade/v1beta1/query.ts +++ b/__fixtures__/v-next/outputv4/cosmos/upgrade/v1beta1/query.ts @@ -1,13 +1,15 @@ -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"; +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"; 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; @@ -25,6 +27,9 @@ export interface QueryCurrentPlanResponse { /** plan is the current upgrade plan. */ plan?: Plan; } +export interface ReactiveQueryCurrentPlanResponse { + plan?: ComputedRef<Plan>; +} export interface QueryCurrentPlanResponseProtoMsg { typeUrl: "/cosmos.upgrade.v1beta1.QueryCurrentPlanResponse"; value: Uint8Array; @@ -44,6 +49,9 @@ export interface QueryAppliedPlanRequest { /** name is the name of the applied plan to query for. */ name: string; } +export interface ReactiveQueryAppliedPlanRequest { + name: ComputedRef<string>; +} export interface QueryAppliedPlanRequestProtoMsg { typeUrl: "/cosmos.upgrade.v1beta1.QueryAppliedPlanRequest"; value: Uint8Array; @@ -63,6 +71,9 @@ export interface QueryAppliedPlanResponse { /** height is the block height at which the plan was applied. */ height: bigint; } +export interface ReactiveQueryAppliedPlanResponse { + height: ComputedRef<bigint>; +} export interface QueryAppliedPlanResponseProtoMsg { typeUrl: "/cosmos.upgrade.v1beta1.QueryAppliedPlanResponse"; value: Uint8Array; @@ -86,6 +97,9 @@ export interface QueryUpgradedConsensusStateRequest { */ lastHeight: bigint; } +export interface ReactiveQueryUpgradedConsensusStateRequest { + lastHeight: ComputedRef<bigint>; +} export interface QueryUpgradedConsensusStateRequestProtoMsg { typeUrl: "/cosmos.upgrade.v1beta1.QueryUpgradedConsensusStateRequest"; value: Uint8Array; @@ -107,6 +121,9 @@ export interface QueryUpgradedConsensusStateResponse { /** Since: cosmos-sdk 0.43 */ upgradedConsensusState: Uint8Array; } +export interface ReactiveQueryUpgradedConsensusStateResponse { + upgradedConsensusState: ComputedRef<Uint8Array>; +} export interface QueryUpgradedConsensusStateResponseProtoMsg { typeUrl: "/cosmos.upgrade.v1beta1.QueryUpgradedConsensusStateResponse"; value: Uint8Array; @@ -133,6 +150,9 @@ export interface QueryModuleVersionsRequest { */ moduleName: string; } +export interface ReactiveQueryModuleVersionsRequest { + moduleName: ComputedRef<string>; +} export interface QueryModuleVersionsRequestProtoMsg { typeUrl: "/cosmos.upgrade.v1beta1.QueryModuleVersionsRequest"; value: Uint8Array; @@ -156,6 +176,9 @@ export interface QueryModuleVersionsResponse { /** module_versions is a list of module names with their consensus versions. */ moduleVersions: ModuleVersion[]; } +export interface ReactiveQueryModuleVersionsResponse { + moduleVersions: ComputedRef<ModuleVersion[]>; +} export interface QueryModuleVersionsResponseProtoMsg { typeUrl: "/cosmos.upgrade.v1beta1.QueryModuleVersionsResponse"; value: Uint8Array; @@ -175,6 +198,7 @@ export interface QueryModuleVersionsResponseSDKType { * Since: cosmos-sdk 0.46 */ export interface QueryAuthorityRequest {} +export interface ReactiveQueryAuthorityRequest {} export interface QueryAuthorityRequestProtoMsg { typeUrl: "/cosmos.upgrade.v1beta1.QueryAuthorityRequest"; value: Uint8Array; @@ -193,6 +217,9 @@ export interface QueryAuthorityRequestSDKType {} export interface QueryAuthorityResponse { address: string; } +export interface ReactiveQueryAuthorityResponse { + address: ComputedRef<string>; +} export interface QueryAuthorityResponseProtoMsg { typeUrl: "/cosmos.upgrade.v1beta1.QueryAuthorityResponse"; value: Uint8Array; @@ -228,8 +255,7 @@ export const QueryCurrentPlanRequest = { return message; }, fromJSON(_: any): QueryCurrentPlanRequest { - const obj = createBaseQueryCurrentPlanRequest(); - return obj; + return {}; }, toJSON(_: QueryCurrentPlanRequest): JsonSafe<QueryCurrentPlanRequest> { const obj: any = {}; @@ -310,9 +336,9 @@ export const QueryCurrentPlanResponse = { return message; }, fromJSON(object: any): QueryCurrentPlanResponse { - const obj = createBaseQueryCurrentPlanResponse(); - if (isSet(object.plan)) obj.plan = Plan.fromJSON(object.plan); - return obj; + return { + plan: isSet(object.plan) ? Plan.fromJSON(object.plan) : undefined + }; }, toJSON(message: QueryCurrentPlanResponse): JsonSafe<QueryCurrentPlanResponse> { const obj: any = {}; @@ -321,9 +347,7 @@ export const QueryCurrentPlanResponse = { }, fromPartial(object: DeepPartial<QueryCurrentPlanResponse>): QueryCurrentPlanResponse { const message = createBaseQueryCurrentPlanResponse(); - if (object.plan !== undefined && object.plan !== null) { - message.plan = Plan.fromPartial(object.plan); - } + message.plan = object.plan !== undefined && object.plan !== null ? Plan.fromPartial(object.plan) : undefined; return message; }, fromSDK(object: QueryCurrentPlanResponseSDKType): QueryCurrentPlanResponse { @@ -383,7 +407,7 @@ function createBaseQueryAppliedPlanRequest(): QueryAppliedPlanRequest { export const QueryAppliedPlanRequest = { typeUrl: "/cosmos.upgrade.v1beta1.QueryAppliedPlanRequest", encode(message: QueryAppliedPlanRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.name !== undefined) { + if (message.name !== "") { writer.uint32(10).string(message.name); } return writer; @@ -406,9 +430,9 @@ export const QueryAppliedPlanRequest = { return message; }, fromJSON(object: any): QueryAppliedPlanRequest { - const obj = createBaseQueryAppliedPlanRequest(); - if (isSet(object.name)) obj.name = String(object.name); - return obj; + return { + name: isSet(object.name) ? String(object.name) : "" + }; }, toJSON(message: QueryAppliedPlanRequest): JsonSafe<QueryAppliedPlanRequest> { const obj: any = {}; @@ -477,7 +501,7 @@ function createBaseQueryAppliedPlanResponse(): QueryAppliedPlanResponse { export const QueryAppliedPlanResponse = { typeUrl: "/cosmos.upgrade.v1beta1.QueryAppliedPlanResponse", encode(message: QueryAppliedPlanResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.height !== undefined) { + if (message.height !== BigInt(0)) { writer.uint32(8).int64(message.height); } return writer; @@ -500,9 +524,9 @@ export const QueryAppliedPlanResponse = { return message; }, fromJSON(object: any): QueryAppliedPlanResponse { - const obj = createBaseQueryAppliedPlanResponse(); - if (isSet(object.height)) obj.height = BigInt(object.height.toString()); - return obj; + return { + height: isSet(object.height) ? BigInt(object.height.toString()) : BigInt(0) + }; }, toJSON(message: QueryAppliedPlanResponse): JsonSafe<QueryAppliedPlanResponse> { const obj: any = {}; @@ -511,9 +535,7 @@ export const QueryAppliedPlanResponse = { }, fromPartial(object: DeepPartial<QueryAppliedPlanResponse>): QueryAppliedPlanResponse { const message = createBaseQueryAppliedPlanResponse(); - if (object.height !== undefined && object.height !== null) { - message.height = BigInt(object.height.toString()); - } + message.height = object.height !== undefined && object.height !== null ? BigInt(object.height.toString()) : BigInt(0); return message; }, fromSDK(object: QueryAppliedPlanResponseSDKType): QueryAppliedPlanResponse { @@ -573,7 +595,7 @@ function createBaseQueryUpgradedConsensusStateRequest(): QueryUpgradedConsensusS export const QueryUpgradedConsensusStateRequest = { typeUrl: "/cosmos.upgrade.v1beta1.QueryUpgradedConsensusStateRequest", encode(message: QueryUpgradedConsensusStateRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.lastHeight !== undefined) { + if (message.lastHeight !== BigInt(0)) { writer.uint32(8).int64(message.lastHeight); } return writer; @@ -596,9 +618,9 @@ export const QueryUpgradedConsensusStateRequest = { return message; }, fromJSON(object: any): QueryUpgradedConsensusStateRequest { - const obj = createBaseQueryUpgradedConsensusStateRequest(); - if (isSet(object.lastHeight)) obj.lastHeight = BigInt(object.lastHeight.toString()); - return obj; + return { + lastHeight: isSet(object.lastHeight) ? BigInt(object.lastHeight.toString()) : BigInt(0) + }; }, toJSON(message: QueryUpgradedConsensusStateRequest): JsonSafe<QueryUpgradedConsensusStateRequest> { const obj: any = {}; @@ -607,9 +629,7 @@ export const QueryUpgradedConsensusStateRequest = { }, fromPartial(object: DeepPartial<QueryUpgradedConsensusStateRequest>): QueryUpgradedConsensusStateRequest { const message = createBaseQueryUpgradedConsensusStateRequest(); - if (object.lastHeight !== undefined && object.lastHeight !== null) { - message.lastHeight = BigInt(object.lastHeight.toString()); - } + message.lastHeight = object.lastHeight !== undefined && object.lastHeight !== null ? BigInt(object.lastHeight.toString()) : BigInt(0); return message; }, fromSDK(object: QueryUpgradedConsensusStateRequestSDKType): QueryUpgradedConsensusStateRequest { @@ -692,9 +712,9 @@ export const QueryUpgradedConsensusStateResponse = { return message; }, fromJSON(object: any): QueryUpgradedConsensusStateResponse { - const obj = createBaseQueryUpgradedConsensusStateResponse(); - if (isSet(object.upgradedConsensusState)) obj.upgradedConsensusState = bytesFromBase64(object.upgradedConsensusState); - return obj; + return { + upgradedConsensusState: isSet(object.upgradedConsensusState) ? bytesFromBase64(object.upgradedConsensusState) : new Uint8Array() + }; }, toJSON(message: QueryUpgradedConsensusStateResponse): JsonSafe<QueryUpgradedConsensusStateResponse> { const obj: any = {}; @@ -763,7 +783,7 @@ function createBaseQueryModuleVersionsRequest(): QueryModuleVersionsRequest { export const QueryModuleVersionsRequest = { typeUrl: "/cosmos.upgrade.v1beta1.QueryModuleVersionsRequest", encode(message: QueryModuleVersionsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.moduleName !== undefined) { + if (message.moduleName !== "") { writer.uint32(10).string(message.moduleName); } return writer; @@ -786,9 +806,9 @@ export const QueryModuleVersionsRequest = { return message; }, fromJSON(object: any): QueryModuleVersionsRequest { - const obj = createBaseQueryModuleVersionsRequest(); - if (isSet(object.moduleName)) obj.moduleName = String(object.moduleName); - return obj; + return { + moduleName: isSet(object.moduleName) ? String(object.moduleName) : "" + }; }, toJSON(message: QueryModuleVersionsRequest): JsonSafe<QueryModuleVersionsRequest> { const obj: any = {}; @@ -880,9 +900,9 @@ export const QueryModuleVersionsResponse = { return message; }, fromJSON(object: any): QueryModuleVersionsResponse { - const obj = createBaseQueryModuleVersionsResponse(); - if (Array.isArray(object?.moduleVersions)) obj.moduleVersions = object.moduleVersions.map((e: any) => ModuleVersion.fromJSON(e)); - return obj; + return { + moduleVersions: Array.isArray(object?.moduleVersions) ? object.moduleVersions.map((e: any) => ModuleVersion.fromJSON(e)) : [] + }; }, toJSON(message: QueryModuleVersionsResponse): JsonSafe<QueryModuleVersionsResponse> { const obj: any = {}; @@ -976,8 +996,7 @@ export const QueryAuthorityRequest = { return message; }, fromJSON(_: any): QueryAuthorityRequest { - const obj = createBaseQueryAuthorityRequest(); - return obj; + return {}; }, toJSON(_: QueryAuthorityRequest): JsonSafe<QueryAuthorityRequest> { const obj: any = {}; @@ -1035,7 +1054,7 @@ function createBaseQueryAuthorityResponse(): QueryAuthorityResponse { export const QueryAuthorityResponse = { typeUrl: "/cosmos.upgrade.v1beta1.QueryAuthorityResponse", encode(message: QueryAuthorityResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.address !== undefined) { + if (message.address !== "") { writer.uint32(10).string(message.address); } return writer; @@ -1058,9 +1077,9 @@ export const QueryAuthorityResponse = { return message; }, fromJSON(object: any): QueryAuthorityResponse { - const obj = createBaseQueryAuthorityResponse(); - if (isSet(object.address)) obj.address = String(object.address); - return obj; + return { + address: isSet(object.address) ? String(object.address) : "" + }; }, toJSON(message: QueryAuthorityResponse): JsonSafe<QueryAuthorityResponse> { 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 1a5ed48b86..92673592c2 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.js"; +import { Plan, PlanSDKType } from "./upgrade"; import { AminoMsg } from "@cosmjs/amino"; -import { Any, AnySDKType } from "../../../google/protobuf/any.js"; -import { MsgSoftwareUpgrade, MsgSoftwareUpgradeSDKType, MsgCancelUpgrade, MsgCancelUpgradeSDKType } from "./tx.js"; +import { Any, AnySDKType } from "../../../google/protobuf/any"; +import { MsgSoftwareUpgrade, MsgSoftwareUpgradeSDKType, MsgCancelUpgrade, MsgCancelUpgradeSDKType } from "./tx"; 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 e3fae09441..57f220dec3 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.js"; +import { Plan, PlanSDKType } from "./upgrade"; import { GeneratedType, Registry } from "@cosmjs/proto-signing"; -import { MsgSoftwareUpgrade, MsgSoftwareUpgradeSDKType, MsgCancelUpgrade, MsgCancelUpgradeSDKType } from "./tx.js"; +import { MsgSoftwareUpgrade, MsgSoftwareUpgradeSDKType, MsgCancelUpgrade, MsgCancelUpgradeSDKType } from "./tx"; 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 adeae6342a..7700a4b9b3 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.js"; -import { Rpc } from "../../../helpers.js"; -import { BinaryReader } from "../../../binary.js"; -import { MsgSoftwareUpgrade, MsgSoftwareUpgradeSDKType, MsgSoftwareUpgradeResponse, MsgSoftwareUpgradeResponseSDKType, MsgCancelUpgrade, MsgCancelUpgradeSDKType, MsgCancelUpgradeResponse, MsgCancelUpgradeResponseSDKType } from "./tx.js"; +import { Plan, PlanSDKType } from "./upgrade"; +import { Rpc } from "../../../helpers"; +import { BinaryReader } from "../../../binary"; +import { MsgSoftwareUpgrade, MsgSoftwareUpgradeSDKType, MsgSoftwareUpgradeResponse, MsgSoftwareUpgradeResponseSDKType, MsgCancelUpgrade, MsgCancelUpgradeSDKType, MsgCancelUpgradeResponse, MsgCancelUpgradeResponseSDKType } from "./tx"; /** 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 e1e807d4af..5756f0a53f 100644 --- a/__fixtures__/v-next/outputv4/cosmos/upgrade/v1beta1/tx.ts +++ b/__fixtures__/v-next/outputv4/cosmos/upgrade/v1beta1/tx.ts @@ -1,7 +1,8 @@ -import { Plan, PlanSDKType } from "./upgrade.js"; -import { BinaryReader, BinaryWriter } from "../../../binary.js"; -import { isSet, DeepPartial } from "../../../helpers.js"; -import { JsonSafe } from "../../../json-safe.js"; +import { Plan, PlanSDKType } from "./upgrade"; +import { BinaryReader, BinaryWriter } from "../../../binary"; +import { isSet, DeepPartial } from "../../../helpers"; +import { JsonSafe } from "../../../json-safe"; +import { ComputedRef } from "vue"; export const protobufPackage = "cosmos.upgrade.v1beta1"; /** * MsgSoftwareUpgrade is the Msg/SoftwareUpgrade request type. @@ -14,6 +15,10 @@ export interface MsgSoftwareUpgrade { /** plan is the upgrade plan. */ plan: Plan; } +export interface ReactiveMsgSoftwareUpgrade { + authority: ComputedRef<string>; + plan: ComputedRef<Plan>; +} export interface MsgSoftwareUpgradeProtoMsg { typeUrl: "/cosmos.upgrade.v1beta1.MsgSoftwareUpgrade"; value: Uint8Array; @@ -33,6 +38,7 @@ export interface MsgSoftwareUpgradeSDKType { * Since: cosmos-sdk 0.46 */ export interface MsgSoftwareUpgradeResponse {} +export interface ReactiveMsgSoftwareUpgradeResponse {} export interface MsgSoftwareUpgradeResponseProtoMsg { typeUrl: "/cosmos.upgrade.v1beta1.MsgSoftwareUpgradeResponse"; value: Uint8Array; @@ -52,6 +58,9 @@ export interface MsgCancelUpgrade { /** authority is the address of the governance account. */ authority: string; } +export interface ReactiveMsgCancelUpgrade { + authority: ComputedRef<string>; +} export interface MsgCancelUpgradeProtoMsg { typeUrl: "/cosmos.upgrade.v1beta1.MsgCancelUpgrade"; value: Uint8Array; @@ -70,6 +79,7 @@ export interface MsgCancelUpgradeSDKType { * Since: cosmos-sdk 0.46 */ export interface MsgCancelUpgradeResponse {} +export interface ReactiveMsgCancelUpgradeResponse {} export interface MsgCancelUpgradeResponseProtoMsg { typeUrl: "/cosmos.upgrade.v1beta1.MsgCancelUpgradeResponse"; value: Uint8Array; @@ -89,7 +99,7 @@ function createBaseMsgSoftwareUpgrade(): MsgSoftwareUpgrade { export const MsgSoftwareUpgrade = { typeUrl: "/cosmos.upgrade.v1beta1.MsgSoftwareUpgrade", encode(message: MsgSoftwareUpgrade, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.authority !== undefined) { + if (message.authority !== "") { writer.uint32(10).string(message.authority); } if (message.plan !== undefined) { @@ -118,10 +128,10 @@ export const MsgSoftwareUpgrade = { return message; }, fromJSON(object: any): MsgSoftwareUpgrade { - const obj = createBaseMsgSoftwareUpgrade(); - if (isSet(object.authority)) obj.authority = String(object.authority); - if (isSet(object.plan)) obj.plan = Plan.fromJSON(object.plan); - return obj; + return { + authority: isSet(object.authority) ? String(object.authority) : "", + plan: isSet(object.plan) ? Plan.fromJSON(object.plan) : undefined + }; }, toJSON(message: MsgSoftwareUpgrade): JsonSafe<MsgSoftwareUpgrade> { const obj: any = {}; @@ -132,9 +142,7 @@ export const MsgSoftwareUpgrade = { fromPartial(object: DeepPartial<MsgSoftwareUpgrade>): MsgSoftwareUpgrade { const message = createBaseMsgSoftwareUpgrade(); message.authority = object.authority ?? ""; - if (object.plan !== undefined && object.plan !== null) { - message.plan = Plan.fromPartial(object.plan); - } + message.plan = object.plan !== undefined && object.plan !== null ? Plan.fromPartial(object.plan) : undefined; return message; }, fromSDK(object: MsgSoftwareUpgradeSDKType): MsgSoftwareUpgrade { @@ -216,8 +224,7 @@ export const MsgSoftwareUpgradeResponse = { return message; }, fromJSON(_: any): MsgSoftwareUpgradeResponse { - const obj = createBaseMsgSoftwareUpgradeResponse(); - return obj; + return {}; }, toJSON(_: MsgSoftwareUpgradeResponse): JsonSafe<MsgSoftwareUpgradeResponse> { const obj: any = {}; @@ -275,7 +282,7 @@ function createBaseMsgCancelUpgrade(): MsgCancelUpgrade { export const MsgCancelUpgrade = { typeUrl: "/cosmos.upgrade.v1beta1.MsgCancelUpgrade", encode(message: MsgCancelUpgrade, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.authority !== undefined) { + if (message.authority !== "") { writer.uint32(10).string(message.authority); } return writer; @@ -298,9 +305,9 @@ export const MsgCancelUpgrade = { return message; }, fromJSON(object: any): MsgCancelUpgrade { - const obj = createBaseMsgCancelUpgrade(); - if (isSet(object.authority)) obj.authority = String(object.authority); - return obj; + return { + authority: isSet(object.authority) ? String(object.authority) : "" + }; }, toJSON(message: MsgCancelUpgrade): JsonSafe<MsgCancelUpgrade> { const obj: any = {}; @@ -384,8 +391,7 @@ export const MsgCancelUpgradeResponse = { return message; }, fromJSON(_: any): MsgCancelUpgradeResponse { - const obj = createBaseMsgCancelUpgradeResponse(); - return obj; + return {}; }, toJSON(_: MsgCancelUpgradeResponse): JsonSafe<MsgCancelUpgradeResponse> { 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 0c594529ac..16155331b1 100644 --- a/__fixtures__/v-next/outputv4/cosmos/upgrade/v1beta1/upgrade.ts +++ b/__fixtures__/v-next/outputv4/cosmos/upgrade/v1beta1/upgrade.ts @@ -1,8 +1,9 @@ -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"; +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"; export const protobufPackage = "cosmos.upgrade.v1beta1"; /** Plan specifies information about a planned upgrade and when it should occur. */ export interface Plan { @@ -41,6 +42,13 @@ export interface Plan { /** @deprecated */ upgradedClientState?: Any; } +export interface ReactivePlan { + name: ComputedRef<string>; + time: ComputedRef<Date>; + height: ComputedRef<bigint>; + info: ComputedRef<string>; + upgradedClientState?: ComputedRef<Any>; +} export interface PlanProtoMsg { typeUrl: "/cosmos.upgrade.v1beta1.Plan"; value: Uint8Array; @@ -67,6 +75,11 @@ export interface SoftwareUpgradeProposal { description: string; plan: Plan; } +export interface ReactiveSoftwareUpgradeProposal { + title: ComputedRef<string>; + description: ComputedRef<string>; + plan: ComputedRef<Plan>; +} export interface SoftwareUpgradeProposalProtoMsg { typeUrl: "/cosmos.upgrade.v1beta1.SoftwareUpgradeProposal"; value: Uint8Array; @@ -94,6 +107,10 @@ export interface CancelSoftwareUpgradeProposal { title: string; description: string; } +export interface ReactiveCancelSoftwareUpgradeProposal { + title: ComputedRef<string>; + description: ComputedRef<string>; +} export interface CancelSoftwareUpgradeProposalProtoMsg { typeUrl: "/cosmos.upgrade.v1beta1.CancelSoftwareUpgradeProposal"; value: Uint8Array; @@ -120,6 +137,10 @@ export interface ModuleVersion { /** consensus version of the app module */ version: bigint; } +export interface ReactiveModuleVersion { + name: ComputedRef<string>; + version: ComputedRef<bigint>; +} export interface ModuleVersionProtoMsg { typeUrl: "/cosmos.upgrade.v1beta1.ModuleVersion"; value: Uint8Array; @@ -145,16 +166,16 @@ function createBasePlan(): Plan { export const Plan = { typeUrl: "/cosmos.upgrade.v1beta1.Plan", encode(message: Plan, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.name !== undefined) { + if (message.name !== "") { writer.uint32(10).string(message.name); } if (message.time !== undefined) { Timestamp.encode(toTimestamp(message.time), writer.uint32(18).fork()).ldelim(); } - if (message.height !== undefined) { + if (message.height !== BigInt(0)) { writer.uint32(24).int64(message.height); } - if (message.info !== undefined) { + if (message.info !== "") { writer.uint32(34).string(message.info); } if (message.upgradedClientState !== undefined) { @@ -192,13 +213,13 @@ export const Plan = { return message; }, fromJSON(object: any): Plan { - 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; + 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 + }; }, toJSON(message: Plan): JsonSafe<Plan> { const obj: any = {}; @@ -213,13 +234,9 @@ export const Plan = { const message = createBasePlan(); message.name = object.name ?? ""; message.time = object.time ?? undefined; - if (object.height !== undefined && object.height !== null) { - message.height = BigInt(object.height.toString()); - } + message.height = object.height !== undefined && object.height !== null ? BigInt(object.height.toString()) : BigInt(0); message.info = object.info ?? ""; - if (object.upgradedClientState !== undefined && object.upgradedClientState !== null) { - message.upgradedClientState = Any.fromPartial(object.upgradedClientState); - } + message.upgradedClientState = object.upgradedClientState !== undefined && object.upgradedClientState !== null ? Any.fromPartial(object.upgradedClientState) : undefined; return message; }, fromSDK(object: PlanSDKType): Plan { @@ -309,10 +326,10 @@ function createBaseSoftwareUpgradeProposal(): SoftwareUpgradeProposal { export const SoftwareUpgradeProposal = { typeUrl: "/cosmos.upgrade.v1beta1.SoftwareUpgradeProposal", encode(message: SoftwareUpgradeProposal, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.title !== undefined) { + if (message.title !== "") { writer.uint32(10).string(message.title); } - if (message.description !== undefined) { + if (message.description !== "") { writer.uint32(18).string(message.description); } if (message.plan !== undefined) { @@ -344,11 +361,11 @@ export const SoftwareUpgradeProposal = { return message; }, fromJSON(object: any): SoftwareUpgradeProposal { - 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; + return { + title: isSet(object.title) ? String(object.title) : "", + description: isSet(object.description) ? String(object.description) : "", + plan: isSet(object.plan) ? Plan.fromJSON(object.plan) : undefined + }; }, toJSON(message: SoftwareUpgradeProposal): JsonSafe<SoftwareUpgradeProposal> { const obj: any = {}; @@ -361,9 +378,7 @@ export const SoftwareUpgradeProposal = { const message = createBaseSoftwareUpgradeProposal(); message.title = object.title ?? ""; message.description = object.description ?? ""; - if (object.plan !== undefined && object.plan !== null) { - message.plan = Plan.fromPartial(object.plan); - } + message.plan = object.plan !== undefined && object.plan !== null ? Plan.fromPartial(object.plan) : undefined; return message; }, fromSDK(object: SoftwareUpgradeProposalSDKType): SoftwareUpgradeProposal { @@ -438,10 +453,10 @@ function createBaseCancelSoftwareUpgradeProposal(): CancelSoftwareUpgradeProposa export const CancelSoftwareUpgradeProposal = { typeUrl: "/cosmos.upgrade.v1beta1.CancelSoftwareUpgradeProposal", encode(message: CancelSoftwareUpgradeProposal, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.title !== undefined) { + if (message.title !== "") { writer.uint32(10).string(message.title); } - if (message.description !== undefined) { + if (message.description !== "") { writer.uint32(18).string(message.description); } return writer; @@ -467,10 +482,10 @@ export const CancelSoftwareUpgradeProposal = { return message; }, fromJSON(object: any): CancelSoftwareUpgradeProposal { - const obj = createBaseCancelSoftwareUpgradeProposal(); - if (isSet(object.title)) obj.title = String(object.title); - if (isSet(object.description)) obj.description = String(object.description); - return obj; + return { + title: isSet(object.title) ? String(object.title) : "", + description: isSet(object.description) ? String(object.description) : "" + }; }, toJSON(message: CancelSoftwareUpgradeProposal): JsonSafe<CancelSoftwareUpgradeProposal> { const obj: any = {}; @@ -549,10 +564,10 @@ function createBaseModuleVersion(): ModuleVersion { export const ModuleVersion = { typeUrl: "/cosmos.upgrade.v1beta1.ModuleVersion", encode(message: ModuleVersion, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.name !== undefined) { + if (message.name !== "") { writer.uint32(10).string(message.name); } - if (message.version !== undefined) { + if (message.version !== BigInt(0)) { writer.uint32(16).uint64(message.version); } return writer; @@ -578,10 +593,10 @@ export const ModuleVersion = { return message; }, fromJSON(object: any): ModuleVersion { - const obj = createBaseModuleVersion(); - if (isSet(object.name)) obj.name = String(object.name); - if (isSet(object.version)) obj.version = BigInt(object.version.toString()); - return obj; + return { + name: isSet(object.name) ? String(object.name) : "", + version: isSet(object.version) ? BigInt(object.version.toString()) : BigInt(0) + }; }, toJSON(message: ModuleVersion): JsonSafe<ModuleVersion> { const obj: any = {}; @@ -592,9 +607,7 @@ export const ModuleVersion = { fromPartial(object: DeepPartial<ModuleVersion>): ModuleVersion { const message = createBaseModuleVersion(); message.name = object.name ?? ""; - if (object.version !== undefined && object.version !== null) { - message.version = BigInt(object.version.toString()); - } + message.version = object.version !== undefined && object.version !== null ? BigInt(object.version.toString()) : BigInt(0); 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 2688fc531c..b1829bb2bc 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.js"; -import { Period, PeriodSDKType } from "./vesting.js"; +import { Coin, CoinSDKType } from "../../base/v1beta1/coin"; +import { Period, PeriodSDKType } from "./vesting"; import { AminoMsg } from "@cosmjs/amino"; -import { MsgCreateVestingAccount, MsgCreateVestingAccountSDKType, MsgCreatePermanentLockedAccount, MsgCreatePermanentLockedAccountSDKType, MsgCreatePeriodicVestingAccount, MsgCreatePeriodicVestingAccountSDKType } from "./tx.js"; +import { MsgCreateVestingAccount, MsgCreateVestingAccountSDKType, MsgCreatePermanentLockedAccount, MsgCreatePermanentLockedAccountSDKType, MsgCreatePeriodicVestingAccount, MsgCreatePeriodicVestingAccountSDKType } from "./tx"; 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 6351c655d7..2add4a8dc6 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.js"; -import { Period, PeriodSDKType } from "./vesting.js"; +import { Coin, CoinSDKType } from "../../base/v1beta1/coin"; +import { Period, PeriodSDKType } from "./vesting"; import { GeneratedType, Registry } from "@cosmjs/proto-signing"; -import { MsgCreateVestingAccount, MsgCreateVestingAccountSDKType, MsgCreatePermanentLockedAccount, MsgCreatePermanentLockedAccountSDKType, MsgCreatePeriodicVestingAccount, MsgCreatePeriodicVestingAccountSDKType } from "./tx.js"; +import { MsgCreateVestingAccount, MsgCreateVestingAccountSDKType, MsgCreatePermanentLockedAccount, MsgCreatePermanentLockedAccountSDKType, MsgCreatePeriodicVestingAccount, MsgCreatePeriodicVestingAccountSDKType } from "./tx"; 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 50da665cce..dc8d141651 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.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"; +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"; /** 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 89f9703250..45aeac1ca2 100644 --- a/__fixtures__/v-next/outputv4/cosmos/vesting/v1beta1/tx.ts +++ b/__fixtures__/v-next/outputv4/cosmos/vesting/v1beta1/tx.ts @@ -1,8 +1,9 @@ -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"; +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"; export const protobufPackage = "cosmos.vesting.v1beta1"; /** * MsgCreateVestingAccount defines a message that enables creating a vesting @@ -15,6 +16,13 @@ export interface MsgCreateVestingAccount { endTime: bigint; delayed: boolean; } +export interface ReactiveMsgCreateVestingAccount { + fromAddress: ComputedRef<string>; + toAddress: ComputedRef<string>; + amount: ComputedRef<Coin[]>; + endTime: ComputedRef<bigint>; + delayed: ComputedRef<boolean>; +} export interface MsgCreateVestingAccountProtoMsg { typeUrl: "/cosmos.vesting.v1beta1.MsgCreateVestingAccount"; value: Uint8Array; @@ -32,6 +40,7 @@ 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; @@ -47,6 +56,11 @@ export interface MsgCreatePermanentLockedAccount { toAddress: string; amount: Coin[]; } +export interface ReactiveMsgCreatePermanentLockedAccount { + fromAddress: ComputedRef<string>; + toAddress: ComputedRef<string>; + amount: ComputedRef<Coin[]>; +} export interface MsgCreatePermanentLockedAccountProtoMsg { typeUrl: "/cosmos.vesting.v1beta1.MsgCreatePermanentLockedAccount"; value: Uint8Array; @@ -62,6 +76,7 @@ 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; @@ -78,6 +93,12 @@ export interface MsgCreatePeriodicVestingAccount { startTime: bigint; vestingPeriods: Period[]; } +export interface ReactiveMsgCreatePeriodicVestingAccount { + fromAddress: ComputedRef<string>; + toAddress: ComputedRef<string>; + startTime: ComputedRef<bigint>; + vestingPeriods: ComputedRef<Period[]>; +} export interface MsgCreatePeriodicVestingAccountProtoMsg { typeUrl: "/cosmos.vesting.v1beta1.MsgCreatePeriodicVestingAccount"; value: Uint8Array; @@ -97,6 +118,7 @@ export interface MsgCreatePeriodicVestingAccountSDKType { * response type. */ export interface MsgCreatePeriodicVestingAccountResponse {} +export interface ReactiveMsgCreatePeriodicVestingAccountResponse {} export interface MsgCreatePeriodicVestingAccountResponseProtoMsg { typeUrl: "/cosmos.vesting.v1beta1.MsgCreatePeriodicVestingAccountResponse"; value: Uint8Array; @@ -118,19 +140,19 @@ function createBaseMsgCreateVestingAccount(): MsgCreateVestingAccount { export const MsgCreateVestingAccount = { typeUrl: "/cosmos.vesting.v1beta1.MsgCreateVestingAccount", encode(message: MsgCreateVestingAccount, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.fromAddress !== undefined) { + if (message.fromAddress !== "") { writer.uint32(10).string(message.fromAddress); } - if (message.toAddress !== undefined) { + if (message.toAddress !== "") { writer.uint32(18).string(message.toAddress); } for (const v of message.amount) { Coin.encode(v!, writer.uint32(26).fork()).ldelim(); } - if (message.endTime !== undefined) { + if (message.endTime !== BigInt(0)) { writer.uint32(32).int64(message.endTime); } - if (message.delayed !== undefined) { + if (message.delayed === true) { writer.uint32(40).bool(message.delayed); } return writer; @@ -165,13 +187,13 @@ export const MsgCreateVestingAccount = { return message; }, fromJSON(object: any): MsgCreateVestingAccount { - 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; + 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 + }; }, toJSON(message: MsgCreateVestingAccount): JsonSafe<MsgCreateVestingAccount> { const obj: any = {}; @@ -191,9 +213,7 @@ export const MsgCreateVestingAccount = { message.fromAddress = object.fromAddress ?? ""; message.toAddress = object.toAddress ?? ""; message.amount = object.amount?.map(e => Coin.fromPartial(e)) || []; - if (object.endTime !== undefined && object.endTime !== null) { - message.endTime = BigInt(object.endTime.toString()); - } + message.endTime = object.endTime !== undefined && object.endTime !== null ? BigInt(object.endTime.toString()) : BigInt(0); message.delayed = object.delayed ?? false; return message; }, @@ -303,8 +323,7 @@ export const MsgCreateVestingAccountResponse = { return message; }, fromJSON(_: any): MsgCreateVestingAccountResponse { - const obj = createBaseMsgCreateVestingAccountResponse(); - return obj; + return {}; }, toJSON(_: MsgCreateVestingAccountResponse): JsonSafe<MsgCreateVestingAccountResponse> { const obj: any = {}; @@ -364,10 +383,10 @@ function createBaseMsgCreatePermanentLockedAccount(): MsgCreatePermanentLockedAc export const MsgCreatePermanentLockedAccount = { typeUrl: "/cosmos.vesting.v1beta1.MsgCreatePermanentLockedAccount", encode(message: MsgCreatePermanentLockedAccount, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.fromAddress !== undefined) { + if (message.fromAddress !== "") { writer.uint32(10).string(message.fromAddress); } - if (message.toAddress !== undefined) { + if (message.toAddress !== "") { writer.uint32(18).string(message.toAddress); } for (const v of message.amount) { @@ -399,11 +418,11 @@ export const MsgCreatePermanentLockedAccount = { return message; }, fromJSON(object: any): MsgCreatePermanentLockedAccount { - 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; + 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)) : [] + }; }, toJSON(message: MsgCreatePermanentLockedAccount): JsonSafe<MsgCreatePermanentLockedAccount> { const obj: any = {}; @@ -515,8 +534,7 @@ export const MsgCreatePermanentLockedAccountResponse = { return message; }, fromJSON(_: any): MsgCreatePermanentLockedAccountResponse { - const obj = createBaseMsgCreatePermanentLockedAccountResponse(); - return obj; + return {}; }, toJSON(_: MsgCreatePermanentLockedAccountResponse): JsonSafe<MsgCreatePermanentLockedAccountResponse> { const obj: any = {}; @@ -577,13 +595,13 @@ function createBaseMsgCreatePeriodicVestingAccount(): MsgCreatePeriodicVestingAc export const MsgCreatePeriodicVestingAccount = { typeUrl: "/cosmos.vesting.v1beta1.MsgCreatePeriodicVestingAccount", encode(message: MsgCreatePeriodicVestingAccount, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.fromAddress !== undefined) { + if (message.fromAddress !== "") { writer.uint32(10).string(message.fromAddress); } - if (message.toAddress !== undefined) { + if (message.toAddress !== "") { writer.uint32(18).string(message.toAddress); } - if (message.startTime !== undefined) { + if (message.startTime !== BigInt(0)) { writer.uint32(24).int64(message.startTime); } for (const v of message.vestingPeriods) { @@ -618,12 +636,12 @@ export const MsgCreatePeriodicVestingAccount = { return message; }, fromJSON(object: any): MsgCreatePeriodicVestingAccount { - 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; + 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)) : [] + }; }, toJSON(message: MsgCreatePeriodicVestingAccount): JsonSafe<MsgCreatePeriodicVestingAccount> { const obj: any = {}; @@ -641,9 +659,7 @@ export const MsgCreatePeriodicVestingAccount = { const message = createBaseMsgCreatePeriodicVestingAccount(); message.fromAddress = object.fromAddress ?? ""; message.toAddress = object.toAddress ?? ""; - if (object.startTime !== undefined && object.startTime !== null) { - message.startTime = BigInt(object.startTime.toString()); - } + message.startTime = object.startTime !== undefined && object.startTime !== null ? BigInt(object.startTime.toString()) : BigInt(0); message.vestingPeriods = object.vestingPeriods?.map(e => Period.fromPartial(e)) || []; return message; }, @@ -746,8 +762,7 @@ export const MsgCreatePeriodicVestingAccountResponse = { return message; }, fromJSON(_: any): MsgCreatePeriodicVestingAccountResponse { - const obj = createBaseMsgCreatePeriodicVestingAccountResponse(); - return obj; + return {}; }, toJSON(_: MsgCreatePeriodicVestingAccountResponse): JsonSafe<MsgCreatePeriodicVestingAccountResponse> { 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 cc55ab14df..73f8e7149f 100644 --- a/__fixtures__/v-next/outputv4/cosmos/vesting/v1beta1/vesting.ts +++ b/__fixtures__/v-next/outputv4/cosmos/vesting/v1beta1/vesting.ts @@ -1,8 +1,9 @@ -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"; +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"; export const protobufPackage = "cosmos.vesting.v1beta1"; /** * BaseVestingAccount implements the VestingAccount interface. It contains all @@ -15,6 +16,13 @@ export interface BaseVestingAccount { delegatedVesting: Coin[]; endTime: bigint; } +export interface ReactiveBaseVestingAccount { + baseAccount?: ComputedRef<BaseAccount>; + originalVesting: ComputedRef<Coin[]>; + delegatedFree: ComputedRef<Coin[]>; + delegatedVesting: ComputedRef<Coin[]>; + endTime: ComputedRef<bigint>; +} export interface BaseVestingAccountProtoMsg { typeUrl: "/cosmos.vesting.v1beta1.BaseVestingAccount"; value: Uint8Array; @@ -38,6 +46,10 @@ export interface ContinuousVestingAccount { baseVestingAccount?: BaseVestingAccount; startTime: bigint; } +export interface ReactiveContinuousVestingAccount { + baseVestingAccount?: ComputedRef<BaseVestingAccount>; + startTime: ComputedRef<bigint>; +} export interface ContinuousVestingAccountProtoMsg { typeUrl: "/cosmos.vesting.v1beta1.ContinuousVestingAccount"; value: Uint8Array; @@ -58,6 +70,9 @@ export interface ContinuousVestingAccountSDKType { export interface DelayedVestingAccount { baseVestingAccount?: BaseVestingAccount; } +export interface ReactiveDelayedVestingAccount { + baseVestingAccount?: ComputedRef<BaseVestingAccount>; +} export interface DelayedVestingAccountProtoMsg { typeUrl: "/cosmos.vesting.v1beta1.DelayedVestingAccount"; value: Uint8Array; @@ -75,6 +90,10 @@ export interface Period { length: bigint; amount: Coin[]; } +export interface ReactivePeriod { + length: ComputedRef<bigint>; + amount: ComputedRef<Coin[]>; +} export interface PeriodProtoMsg { typeUrl: "/cosmos.vesting.v1beta1.Period"; value: Uint8Array; @@ -93,6 +112,11 @@ export interface PeriodicVestingAccount { startTime: bigint; vestingPeriods: Period[]; } +export interface ReactivePeriodicVestingAccount { + baseVestingAccount?: ComputedRef<BaseVestingAccount>; + startTime: ComputedRef<bigint>; + vestingPeriods: ComputedRef<Period[]>; +} export interface PeriodicVestingAccountProtoMsg { typeUrl: "/cosmos.vesting.v1beta1.PeriodicVestingAccount"; value: Uint8Array; @@ -116,6 +140,9 @@ export interface PeriodicVestingAccountSDKType { export interface PermanentLockedAccount { baseVestingAccount?: BaseVestingAccount; } +export interface ReactivePermanentLockedAccount { + baseVestingAccount?: ComputedRef<BaseVestingAccount>; +} export interface PermanentLockedAccountProtoMsg { typeUrl: "/cosmos.vesting.v1beta1.PermanentLockedAccount"; value: Uint8Array; @@ -154,7 +181,7 @@ export const BaseVestingAccount = { for (const v of message.delegatedVesting) { Coin.encode(v!, writer.uint32(34).fork()).ldelim(); } - if (message.endTime !== undefined) { + if (message.endTime !== BigInt(0)) { writer.uint32(40).int64(message.endTime); } return writer; @@ -189,13 +216,13 @@ export const BaseVestingAccount = { return message; }, fromJSON(object: any): BaseVestingAccount { - 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; + 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) + }; }, toJSON(message: BaseVestingAccount): JsonSafe<BaseVestingAccount> { const obj: any = {}; @@ -220,15 +247,11 @@ export const BaseVestingAccount = { }, fromPartial(object: DeepPartial<BaseVestingAccount>): BaseVestingAccount { const message = createBaseBaseVestingAccount(); - if (object.baseAccount !== undefined && object.baseAccount !== null) { - message.baseAccount = BaseAccount.fromPartial(object.baseAccount); - } + message.baseAccount = object.baseAccount !== undefined && object.baseAccount !== null ? BaseAccount.fromPartial(object.baseAccount) : undefined; 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)) || []; - if (object.endTime !== undefined && object.endTime !== null) { - message.endTime = BigInt(object.endTime.toString()); - } + message.endTime = object.endTime !== undefined && object.endTime !== null ? BigInt(object.endTime.toString()) : BigInt(0); return message; }, fromSDK(object: BaseVestingAccountSDKType): BaseVestingAccount { @@ -338,7 +361,7 @@ export const ContinuousVestingAccount = { if (message.baseVestingAccount !== undefined) { BaseVestingAccount.encode(message.baseVestingAccount, writer.uint32(10).fork()).ldelim(); } - if (message.startTime !== undefined) { + if (message.startTime !== BigInt(0)) { writer.uint32(16).int64(message.startTime); } return writer; @@ -364,10 +387,10 @@ export const ContinuousVestingAccount = { return message; }, fromJSON(object: any): ContinuousVestingAccount { - 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; + return { + baseVestingAccount: isSet(object.baseVestingAccount) ? BaseVestingAccount.fromJSON(object.baseVestingAccount) : undefined, + startTime: isSet(object.startTime) ? BigInt(object.startTime.toString()) : BigInt(0) + }; }, toJSON(message: ContinuousVestingAccount): JsonSafe<ContinuousVestingAccount> { const obj: any = {}; @@ -377,12 +400,8 @@ export const ContinuousVestingAccount = { }, fromPartial(object: DeepPartial<ContinuousVestingAccount>): ContinuousVestingAccount { const message = createBaseContinuousVestingAccount(); - 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.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); return message; }, fromSDK(object: ContinuousVestingAccountSDKType): ContinuousVestingAccount { @@ -472,9 +491,9 @@ export const DelayedVestingAccount = { return message; }, fromJSON(object: any): DelayedVestingAccount { - const obj = createBaseDelayedVestingAccount(); - if (isSet(object.baseVestingAccount)) obj.baseVestingAccount = BaseVestingAccount.fromJSON(object.baseVestingAccount); - return obj; + return { + baseVestingAccount: isSet(object.baseVestingAccount) ? BaseVestingAccount.fromJSON(object.baseVestingAccount) : undefined + }; }, toJSON(message: DelayedVestingAccount): JsonSafe<DelayedVestingAccount> { const obj: any = {}; @@ -483,9 +502,7 @@ export const DelayedVestingAccount = { }, fromPartial(object: DeepPartial<DelayedVestingAccount>): DelayedVestingAccount { const message = createBaseDelayedVestingAccount(); - if (object.baseVestingAccount !== undefined && object.baseVestingAccount !== null) { - message.baseVestingAccount = BaseVestingAccount.fromPartial(object.baseVestingAccount); - } + message.baseVestingAccount = object.baseVestingAccount !== undefined && object.baseVestingAccount !== null ? BaseVestingAccount.fromPartial(object.baseVestingAccount) : undefined; return message; }, fromSDK(object: DelayedVestingAccountSDKType): DelayedVestingAccount { @@ -546,7 +563,7 @@ function createBasePeriod(): Period { export const Period = { typeUrl: "/cosmos.vesting.v1beta1.Period", encode(message: Period, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.length !== undefined) { + if (message.length !== BigInt(0)) { writer.uint32(8).int64(message.length); } for (const v of message.amount) { @@ -575,10 +592,10 @@ export const Period = { return message; }, fromJSON(object: any): Period { - 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; + return { + length: isSet(object.length) ? BigInt(object.length.toString()) : BigInt(0), + amount: Array.isArray(object?.amount) ? object.amount.map((e: any) => Coin.fromJSON(e)) : [] + }; }, toJSON(message: Period): JsonSafe<Period> { const obj: any = {}; @@ -592,9 +609,7 @@ export const Period = { }, fromPartial(object: DeepPartial<Period>): Period { const message = createBasePeriod(); - if (object.length !== undefined && object.length !== null) { - message.length = BigInt(object.length.toString()); - } + message.length = object.length !== undefined && object.length !== null ? BigInt(object.length.toString()) : BigInt(0); message.amount = object.amount?.map(e => Coin.fromPartial(e)) || []; return message; }, @@ -673,7 +688,7 @@ export const PeriodicVestingAccount = { if (message.baseVestingAccount !== undefined) { BaseVestingAccount.encode(message.baseVestingAccount, writer.uint32(10).fork()).ldelim(); } - if (message.startTime !== undefined) { + if (message.startTime !== BigInt(0)) { writer.uint32(16).int64(message.startTime); } for (const v of message.vestingPeriods) { @@ -705,11 +720,11 @@ export const PeriodicVestingAccount = { return message; }, fromJSON(object: any): PeriodicVestingAccount { - 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; + 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)) : [] + }; }, toJSON(message: PeriodicVestingAccount): JsonSafe<PeriodicVestingAccount> { const obj: any = {}; @@ -724,12 +739,8 @@ export const PeriodicVestingAccount = { }, fromPartial(object: DeepPartial<PeriodicVestingAccount>): PeriodicVestingAccount { const message = createBasePeriodicVestingAccount(); - 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.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); message.vestingPeriods = object.vestingPeriods?.map(e => Period.fromPartial(e)) || []; return message; }, @@ -833,9 +844,9 @@ export const PermanentLockedAccount = { return message; }, fromJSON(object: any): PermanentLockedAccount { - const obj = createBasePermanentLockedAccount(); - if (isSet(object.baseVestingAccount)) obj.baseVestingAccount = BaseVestingAccount.fromJSON(object.baseVestingAccount); - return obj; + return { + baseVestingAccount: isSet(object.baseVestingAccount) ? BaseVestingAccount.fromJSON(object.baseVestingAccount) : undefined + }; }, toJSON(message: PermanentLockedAccount): JsonSafe<PermanentLockedAccount> { const obj: any = {}; @@ -844,9 +855,7 @@ export const PermanentLockedAccount = { }, fromPartial(object: DeepPartial<PermanentLockedAccount>): PermanentLockedAccount { const message = createBasePermanentLockedAccount(); - if (object.baseVestingAccount !== undefined && object.baseVestingAccount !== null) { - message.baseVestingAccount = BaseVestingAccount.fromPartial(object.baseVestingAccount); - } + message.baseVestingAccount = object.baseVestingAccount !== undefined && object.baseVestingAccount !== null ? BaseVestingAccount.fromPartial(object.baseVestingAccount) : undefined; 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 6b937aef3a..59f98efc24 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.js"; +import * as _54 from "./cosmos"; 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 7509d6daa8..bd5613ccd2 100644 --- a/__fixtures__/v-next/outputv4/cosmwasm/bundle.ts +++ b/__fixtures__/v-next/outputv4/cosmwasm/bundle.ts @@ -1,36 +1,38 @@ -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"; +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"; export namespace cosmwasm { export namespace wasm { export const v1 = { - ..._147, - ..._148, ..._149, ..._150, ..._151, ..._152, - ..._434, - ..._435, - ..._436, - ..._437, - ..._438 + ..._153, + ..._154, + ..._155, + ..._485, + ..._486, + ..._487, + ..._488, + ..._489 }; } export const ClientFactory = { - ..._544, - ..._545, - ..._546 + ..._628, + ..._629, + ..._630 }; } \ 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 c9f2fa6696..1b6196fc7f 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.js"; -import * as cosmwasmWasmV1TxAmino from "./wasm/v1/tx.amino.js"; +import * as cosmwasmWasmV1TxRegistry from "./wasm/v1/tx.registry"; +import * as cosmwasmWasmV1TxAmino from "./wasm/v1/tx.amino"; export const cosmwasmAminoConverters = { ...cosmwasmWasmV1TxAmino.AminoConverter }; diff --git a/__fixtures__/v-next/outputv4/cosmwasm/lcd.ts b/__fixtures__/v-next/outputv4/cosmwasm/lcd.ts index 311dbf0829..94a334412c 100644 --- a/__fixtures__/v-next/outputv4/cosmwasm/lcd.ts +++ b/__fixtures__/v-next/outputv4/cosmwasm/lcd.ts @@ -37,6 +37,11 @@ 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 f1213e3fa7..616b2d1cfd 100644 --- a/__fixtures__/v-next/outputv4/cosmwasm/rpc.query.ts +++ b/__fixtures__/v-next/outputv4/cosmwasm/rpc.query.ts @@ -1,77 +1,80 @@ -import { Rpc } from "../helpers.js"; -import { connectComet, HttpEndpoint } from "@cosmjs/tendermint-rpc"; +import { Rpc } from "../helpers"; +import { Tendermint34Client, HttpEndpoint } from "@cosmjs/tendermint-rpc"; import { QueryClient } from "@cosmjs/stargate"; export const createRPCQueryClient = async ({ rpcEndpoint }: { rpcEndpoint: string | HttpEndpoint; }) => { - const tmClient = await connectComet(rpcEndpoint); + const tmClient = await Tendermint34Client.connect(rpcEndpoint); const client = new QueryClient(tmClient); return { cosmos: { app: { - v1alpha1: (await import("../cosmos/app/v1alpha1/query.rpc.Query.js")).createRpcQueryExtension(client) + v1alpha1: (await import("../cosmos/app/v1alpha1/query.rpc.Query")).createRpcQueryExtension(client) }, auth: { - v1beta1: (await import("../cosmos/auth/v1beta1/query.rpc.Query.js")).createRpcQueryExtension(client) + v1beta1: (await import("../cosmos/auth/v1beta1/query.rpc.Query")).createRpcQueryExtension(client) }, authz: { - v1beta1: (await import("../cosmos/authz/v1beta1/query.rpc.Query.js")).createRpcQueryExtension(client) + v1beta1: (await import("../cosmos/authz/v1beta1/query.rpc.Query")).createRpcQueryExtension(client) }, bank: { - v1beta1: (await import("../cosmos/bank/v1beta1/query.rpc.Query.js")).createRpcQueryExtension(client) + v1beta1: (await import("../cosmos/bank/v1beta1/query.rpc.Query")).createRpcQueryExtension(client) }, base: { reflection: { - 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) + v1beta1: (await import("../cosmos/base/reflection/v1beta1/reflection.rpc.ReflectionService")).createRpcQueryExtension(client), + v2alpha1: (await import("../cosmos/base/reflection/v2alpha1/reflection.rpc.ReflectionService")).createRpcQueryExtension(client) }, tendermint: { - v1beta1: (await import("../cosmos/base/tendermint/v1beta1/query.rpc.Service.js")).createRpcQueryExtension(client) + 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) } }, distribution: { - v1beta1: (await import("../cosmos/distribution/v1beta1/query.rpc.Query.js")).createRpcQueryExtension(client) + v1beta1: (await import("../cosmos/distribution/v1beta1/query.rpc.Query")).createRpcQueryExtension(client) }, evidence: { - v1beta1: (await import("../cosmos/evidence/v1beta1/query.rpc.Query.js")).createRpcQueryExtension(client) + v1beta1: (await import("../cosmos/evidence/v1beta1/query.rpc.Query")).createRpcQueryExtension(client) }, feegrant: { - v1beta1: (await import("../cosmos/feegrant/v1beta1/query.rpc.Query.js")).createRpcQueryExtension(client) + v1beta1: (await import("../cosmos/feegrant/v1beta1/query.rpc.Query")).createRpcQueryExtension(client) }, gov: { - v1: (await import("../cosmos/gov/v1/query.rpc.Query.js")).createRpcQueryExtension(client), - v1beta1: (await import("../cosmos/gov/v1beta1/query.rpc.Query.js")).createRpcQueryExtension(client) + v1: (await import("../cosmos/gov/v1/query.rpc.Query")).createRpcQueryExtension(client), + v1beta1: (await import("../cosmos/gov/v1beta1/query.rpc.Query")).createRpcQueryExtension(client) }, group: { - v1: (await import("../cosmos/group/v1/query.rpc.Query.js")).createRpcQueryExtension(client) + v1: (await import("../cosmos/group/v1/query.rpc.Query")).createRpcQueryExtension(client) }, mint: { - v1beta1: (await import("../cosmos/mint/v1beta1/query.rpc.Query.js")).createRpcQueryExtension(client) + v1beta1: (await import("../cosmos/mint/v1beta1/query.rpc.Query")).createRpcQueryExtension(client) }, nft: { - v1beta1: (await import("../cosmos/nft/v1beta1/query.rpc.Query.js")).createRpcQueryExtension(client) + v1beta1: (await import("../cosmos/nft/v1beta1/query.rpc.Query")).createRpcQueryExtension(client) }, params: { - v1beta1: (await import("../cosmos/params/v1beta1/query.rpc.Query.js")).createRpcQueryExtension(client) + v1beta1: (await import("../cosmos/params/v1beta1/query.rpc.Query")).createRpcQueryExtension(client) }, slashing: { - v1beta1: (await import("../cosmos/slashing/v1beta1/query.rpc.Query.js")).createRpcQueryExtension(client) + v1beta1: (await import("../cosmos/slashing/v1beta1/query.rpc.Query")).createRpcQueryExtension(client) }, staking: { - v1beta1: (await import("../cosmos/staking/v1beta1/query.rpc.Query.js")).createRpcQueryExtension(client) + v1beta1: (await import("../cosmos/staking/v1beta1/query.rpc.Query")).createRpcQueryExtension(client) }, tx: { - v1beta1: (await import("../cosmos/tx/v1beta1/service.rpc.Service.js")).createRpcQueryExtension(client) + v1beta1: (await import("../cosmos/tx/v1beta1/service.rpc.Service")).createRpcQueryExtension(client) }, upgrade: { - v1beta1: (await import("../cosmos/upgrade/v1beta1/query.rpc.Query.js")).createRpcQueryExtension(client) + v1beta1: (await import("../cosmos/upgrade/v1beta1/query.rpc.Query")).createRpcQueryExtension(client) } }, cosmwasm: { wasm: { - v1: (await import("./wasm/v1/query.rpc.Query.js")).createRpcQueryExtension(client) + v1: (await import("./wasm/v1/query.rpc.Query")).createRpcQueryExtension(client) } } }; diff --git a/__fixtures__/v-next/outputv4/cosmwasm/rpc.tx.ts b/__fixtures__/v-next/outputv4/cosmwasm/rpc.tx.ts index 51d72af436..e0ff07d48f 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.js"; +import { Rpc } from "../helpers"; 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.js")).MsgClientImpl(rpc) + v1beta1: new (await import("../cosmos/authz/v1beta1/tx.rpc.msg")).MsgClientImpl(rpc) }, bank: { - v1beta1: new (await import("../cosmos/bank/v1beta1/tx.rpc.msg.js")).MsgClientImpl(rpc) + v1beta1: new (await import("../cosmos/bank/v1beta1/tx.rpc.msg")).MsgClientImpl(rpc) }, crisis: { - v1beta1: new (await import("../cosmos/crisis/v1beta1/tx.rpc.msg.js")).MsgClientImpl(rpc) + v1beta1: new (await import("../cosmos/crisis/v1beta1/tx.rpc.msg")).MsgClientImpl(rpc) }, distribution: { - v1beta1: new (await import("../cosmos/distribution/v1beta1/tx.rpc.msg.js")).MsgClientImpl(rpc) + v1beta1: new (await import("../cosmos/distribution/v1beta1/tx.rpc.msg")).MsgClientImpl(rpc) }, evidence: { - v1beta1: new (await import("../cosmos/evidence/v1beta1/tx.rpc.msg.js")).MsgClientImpl(rpc) + v1beta1: new (await import("../cosmos/evidence/v1beta1/tx.rpc.msg")).MsgClientImpl(rpc) }, feegrant: { - v1beta1: new (await import("../cosmos/feegrant/v1beta1/tx.rpc.msg.js")).MsgClientImpl(rpc) + v1beta1: new (await import("../cosmos/feegrant/v1beta1/tx.rpc.msg")).MsgClientImpl(rpc) }, gov: { - 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) + v1: new (await import("../cosmos/gov/v1/tx.rpc.msg")).MsgClientImpl(rpc), + v1beta1: new (await import("../cosmos/gov/v1beta1/tx.rpc.msg")).MsgClientImpl(rpc) }, group: { - v1: new (await import("../cosmos/group/v1/tx.rpc.msg.js")).MsgClientImpl(rpc) + v1: new (await import("../cosmos/group/v1/tx.rpc.msg")).MsgClientImpl(rpc) }, nft: { - v1beta1: new (await import("../cosmos/nft/v1beta1/tx.rpc.msg.js")).MsgClientImpl(rpc) + v1beta1: new (await import("../cosmos/nft/v1beta1/tx.rpc.msg")).MsgClientImpl(rpc) }, slashing: { - v1beta1: new (await import("../cosmos/slashing/v1beta1/tx.rpc.msg.js")).MsgClientImpl(rpc) + v1beta1: new (await import("../cosmos/slashing/v1beta1/tx.rpc.msg")).MsgClientImpl(rpc) }, staking: { - v1beta1: new (await import("../cosmos/staking/v1beta1/tx.rpc.msg.js")).MsgClientImpl(rpc) + v1beta1: new (await import("../cosmos/staking/v1beta1/tx.rpc.msg")).MsgClientImpl(rpc) }, upgrade: { - v1beta1: new (await import("../cosmos/upgrade/v1beta1/tx.rpc.msg.js")).MsgClientImpl(rpc) + v1beta1: new (await import("../cosmos/upgrade/v1beta1/tx.rpc.msg")).MsgClientImpl(rpc) }, vesting: { - v1beta1: new (await import("../cosmos/vesting/v1beta1/tx.rpc.msg.js")).MsgClientImpl(rpc) + v1beta1: new (await import("../cosmos/vesting/v1beta1/tx.rpc.msg")).MsgClientImpl(rpc) } }, cosmwasm: { wasm: { - v1: new (await import("./wasm/v1/tx.rpc.msg.js")).MsgClientImpl(rpc) + v1: new (await import("./wasm/v1/tx.rpc.msg")).MsgClientImpl(rpc) } } }); \ 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 2add1007dc..6bfc17d1ff 100644 --- a/__fixtures__/v-next/outputv4/cosmwasm/wasm/v1/genesis.ts +++ b/__fixtures__/v-next/outputv4/cosmwasm/wasm/v1/genesis.ts @@ -1,8 +1,9 @@ -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"; +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"; export const protobufPackage = "cosmwasm.wasm.v1"; /** GenesisState - genesis state of x/wasm */ export interface GenesisState { @@ -12,6 +13,13 @@ export interface GenesisState { sequences: Sequence[]; genMsgs: GenesisState_GenMsgs[]; } +export interface ReactiveGenesisState { + params: ComputedRef<Params>; + codes: ComputedRef<Code[]>; + contracts: ComputedRef<Contract[]>; + sequences: ComputedRef<Sequence[]>; + genMsgs: ComputedRef<GenesisState_GenMsgs[]>; +} export interface GenesisStateProtoMsg { typeUrl: "/cosmwasm.wasm.v1.GenesisState"; value: Uint8Array; @@ -33,6 +41,11 @@ export interface GenesisState_GenMsgs { instantiateContract?: MsgInstantiateContract; executeContract?: MsgExecuteContract; } +export interface ReactiveGenesisState_GenMsgs { + storeCode?: ComputedRef<MsgStoreCode>; + instantiateContract?: ComputedRef<MsgInstantiateContract>; + executeContract?: ComputedRef<MsgExecuteContract>; +} export interface GenesisState_GenMsgsProtoMsg { typeUrl: "/cosmwasm.wasm.v1.GenMsgs"; value: Uint8Array; @@ -54,6 +67,12 @@ export interface Code { /** Pinned to wasmvm cache */ pinned: boolean; } +export interface ReactiveCode { + codeId: ComputedRef<bigint>; + codeInfo: ComputedRef<CodeInfo>; + codeBytes: ComputedRef<Uint8Array>; + pinned: ComputedRef<boolean>; +} export interface CodeProtoMsg { typeUrl: "/cosmwasm.wasm.v1.Code"; value: Uint8Array; @@ -71,6 +90,11 @@ export interface Contract { contractInfo: ContractInfo; contractState: Model[]; } +export interface ReactiveContract { + contractAddress: ComputedRef<string>; + contractInfo: ComputedRef<ContractInfo>; + contractState: ComputedRef<Model[]>; +} export interface ContractProtoMsg { typeUrl: "/cosmwasm.wasm.v1.Contract"; value: Uint8Array; @@ -86,6 +110,10 @@ export interface Sequence { idKey: Uint8Array; value: bigint; } +export interface ReactiveSequence { + idKey: ComputedRef<Uint8Array>; + value: ComputedRef<bigint>; +} export interface SequenceProtoMsg { typeUrl: "/cosmwasm.wasm.v1.Sequence"; value: Uint8Array; @@ -154,13 +182,13 @@ export const GenesisState = { return message; }, fromJSON(object: any): GenesisState { - 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; + 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)) : [] + }; }, toJSON(message: GenesisState): JsonSafe<GenesisState> { const obj: any = {}; @@ -189,9 +217,7 @@ export const GenesisState = { }, fromPartial(object: DeepPartial<GenesisState>): GenesisState { const message = createBaseGenesisState(); - if (object.params !== undefined && object.params !== null) { - message.params = Params.fromPartial(object.params); - } + message.params = object.params !== undefined && object.params !== null ? Params.fromPartial(object.params) : undefined; 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)) || []; @@ -344,11 +370,11 @@ export const GenesisState_GenMsgs = { return message; }, fromJSON(object: any): GenesisState_GenMsgs { - 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; + 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 + }; }, toJSON(message: GenesisState_GenMsgs): JsonSafe<GenesisState_GenMsgs> { const obj: any = {}; @@ -359,15 +385,9 @@ export const GenesisState_GenMsgs = { }, fromPartial(object: DeepPartial<GenesisState_GenMsgs>): GenesisState_GenMsgs { const message = createBaseGenesisState_GenMsgs(); - 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); - } + 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; return message; }, fromSDK(object: GenesisState_GenMsgsSDKType): GenesisState_GenMsgs { @@ -444,7 +464,7 @@ function createBaseCode(): Code { export const Code = { typeUrl: "/cosmwasm.wasm.v1.Code", encode(message: Code, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.codeId !== undefined) { + if (message.codeId !== BigInt(0)) { writer.uint32(8).uint64(message.codeId); } if (message.codeInfo !== undefined) { @@ -453,7 +473,7 @@ export const Code = { if (message.codeBytes.length !== 0) { writer.uint32(26).bytes(message.codeBytes); } - if (message.pinned !== undefined) { + if (message.pinned === true) { writer.uint32(32).bool(message.pinned); } return writer; @@ -485,12 +505,12 @@ export const Code = { return message; }, fromJSON(object: any): Code { - 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; + 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 + }; }, toJSON(message: Code): JsonSafe<Code> { const obj: any = {}; @@ -502,12 +522,8 @@ export const Code = { }, fromPartial(object: DeepPartial<Code>): Code { const message = createBaseCode(); - 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.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; message.codeBytes = object.codeBytes ?? new Uint8Array(); message.pinned = object.pinned ?? false; return message; @@ -592,7 +608,7 @@ function createBaseContract(): Contract { export const Contract = { typeUrl: "/cosmwasm.wasm.v1.Contract", encode(message: Contract, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.contractAddress !== undefined) { + if (message.contractAddress !== "") { writer.uint32(10).string(message.contractAddress); } if (message.contractInfo !== undefined) { @@ -627,11 +643,11 @@ export const Contract = { return message; }, fromJSON(object: any): Contract { - 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; + 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)) : [] + }; }, toJSON(message: Contract): JsonSafe<Contract> { const obj: any = {}; @@ -647,9 +663,7 @@ export const Contract = { fromPartial(object: DeepPartial<Contract>): Contract { const message = createBaseContract(); message.contractAddress = object.contractAddress ?? ""; - if (object.contractInfo !== undefined && object.contractInfo !== null) { - message.contractInfo = ContractInfo.fromPartial(object.contractInfo); - } + message.contractInfo = object.contractInfo !== undefined && object.contractInfo !== null ? ContractInfo.fromPartial(object.contractInfo) : undefined; message.contractState = object.contractState?.map(e => Model.fromPartial(e)) || []; return message; }, @@ -734,7 +748,7 @@ export const Sequence = { if (message.idKey.length !== 0) { writer.uint32(10).bytes(message.idKey); } - if (message.value !== undefined) { + if (message.value !== BigInt(0)) { writer.uint32(16).uint64(message.value); } return writer; @@ -760,10 +774,10 @@ export const Sequence = { return message; }, fromJSON(object: any): Sequence { - const obj = createBaseSequence(); - if (isSet(object.idKey)) obj.idKey = bytesFromBase64(object.idKey); - if (isSet(object.value)) obj.value = BigInt(object.value.toString()); - return obj; + return { + idKey: isSet(object.idKey) ? bytesFromBase64(object.idKey) : new Uint8Array(), + value: isSet(object.value) ? BigInt(object.value.toString()) : BigInt(0) + }; }, toJSON(message: Sequence): JsonSafe<Sequence> { const obj: any = {}; @@ -774,9 +788,7 @@ export const Sequence = { fromPartial(object: DeepPartial<Sequence>): Sequence { const message = createBaseSequence(); message.idKey = object.idKey ?? new Uint8Array(); - if (object.value !== undefined && object.value !== null) { - message.value = BigInt(object.value.toString()); - } + message.value = object.value !== undefined && object.value !== null ? BigInt(object.value.toString()) : BigInt(0); 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 246a4c7a40..93ac4b0469 100644 --- a/__fixtures__/v-next/outputv4/cosmwasm/wasm/v1/ibc.ts +++ b/__fixtures__/v-next/outputv4/cosmwasm/wasm/v1/ibc.ts @@ -1,6 +1,7 @@ -import { BinaryReader, BinaryWriter } from "../../../binary.js"; -import { isSet, bytesFromBase64, base64FromBytes, DeepPartial } from "../../../helpers.js"; -import { JsonSafe } from "../../../json-safe.js"; +import { BinaryReader, BinaryWriter } from "../../../binary"; +import { isSet, bytesFromBase64, base64FromBytes, DeepPartial } from "../../../helpers"; +import { JsonSafe } from "../../../json-safe"; +import { ComputedRef } from "vue"; export const protobufPackage = "cosmwasm.wasm.v1"; /** MsgIBCSend */ export interface MsgIBCSend { @@ -22,6 +23,12 @@ export interface MsgIBCSend { */ data: Uint8Array; } +export interface ReactiveMsgIBCSend { + channel: ComputedRef<string>; + timeoutHeight: ComputedRef<bigint>; + timeoutTimestamp: ComputedRef<bigint>; + data: ComputedRef<Uint8Array>; +} export interface MsgIBCSendProtoMsg { typeUrl: "/cosmwasm.wasm.v1.MsgIBCSend"; value: Uint8Array; @@ -37,6 +44,9 @@ export interface MsgIBCSendSDKType { export interface MsgIBCCloseChannel { channel: string; } +export interface ReactiveMsgIBCCloseChannel { + channel: ComputedRef<string>; +} export interface MsgIBCCloseChannelProtoMsg { typeUrl: "/cosmwasm.wasm.v1.MsgIBCCloseChannel"; value: Uint8Array; @@ -56,13 +66,13 @@ function createBaseMsgIBCSend(): MsgIBCSend { export const MsgIBCSend = { typeUrl: "/cosmwasm.wasm.v1.MsgIBCSend", encode(message: MsgIBCSend, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.channel !== undefined) { + if (message.channel !== "") { writer.uint32(18).string(message.channel); } - if (message.timeoutHeight !== undefined) { + if (message.timeoutHeight !== BigInt(0)) { writer.uint32(32).uint64(message.timeoutHeight); } - if (message.timeoutTimestamp !== undefined) { + if (message.timeoutTimestamp !== BigInt(0)) { writer.uint32(40).uint64(message.timeoutTimestamp); } if (message.data.length !== 0) { @@ -97,12 +107,12 @@ export const MsgIBCSend = { return message; }, fromJSON(object: any): MsgIBCSend { - 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; + 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() + }; }, toJSON(message: MsgIBCSend): JsonSafe<MsgIBCSend> { const obj: any = {}; @@ -115,12 +125,8 @@ export const MsgIBCSend = { fromPartial(object: DeepPartial<MsgIBCSend>): MsgIBCSend { const message = createBaseMsgIBCSend(); message.channel = object.channel ?? ""; - 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.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); message.data = object.data ?? new Uint8Array(); return message; }, @@ -202,7 +208,7 @@ function createBaseMsgIBCCloseChannel(): MsgIBCCloseChannel { export const MsgIBCCloseChannel = { typeUrl: "/cosmwasm.wasm.v1.MsgIBCCloseChannel", encode(message: MsgIBCCloseChannel, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.channel !== undefined) { + if (message.channel !== "") { writer.uint32(18).string(message.channel); } return writer; @@ -225,9 +231,9 @@ export const MsgIBCCloseChannel = { return message; }, fromJSON(object: any): MsgIBCCloseChannel { - const obj = createBaseMsgIBCCloseChannel(); - if (isSet(object.channel)) obj.channel = String(object.channel); - return obj; + return { + channel: isSet(object.channel) ? String(object.channel) : "" + }; }, toJSON(message: MsgIBCCloseChannel): JsonSafe<MsgIBCCloseChannel> { 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 dd73766a61..0c8881c510 100644 --- a/__fixtures__/v-next/outputv4/cosmwasm/wasm/v1/proposal.ts +++ b/__fixtures__/v-next/outputv4/cosmwasm/wasm/v1/proposal.ts @@ -1,9 +1,10 @@ -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 { 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 { 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 { @@ -18,6 +19,13 @@ export interface StoreCodeProposal { /** InstantiatePermission to apply on contract creation, optional */ instantiatePermission?: AccessConfig; } +export interface ReactiveStoreCodeProposal { + title: ComputedRef<string>; + description: ComputedRef<string>; + runAs: ComputedRef<string>; + wasmByteCode: ComputedRef<Uint8Array>; + instantiatePermission?: ComputedRef<AccessConfig>; +} export interface StoreCodeProposalProtoMsg { typeUrl: "/cosmwasm.wasm.v1.StoreCodeProposal"; value: Uint8Array; @@ -52,6 +60,16 @@ export interface InstantiateContractProposal { /** Funds coins that are transferred to the contract on instantiation */ funds: Coin[]; } +export interface ReactiveInstantiateContractProposal { + title: ComputedRef<string>; + description: ComputedRef<string>; + runAs: ComputedRef<string>; + admin: ComputedRef<string>; + codeId: ComputedRef<bigint>; + label: ComputedRef<string>; + msg: ComputedRef<Uint8Array>; + funds: ComputedRef<Coin[]>; +} export interface InstantiateContractProposalProtoMsg { typeUrl: "/cosmwasm.wasm.v1.InstantiateContractProposal"; value: Uint8Array; @@ -83,6 +101,13 @@ export interface MigrateContractProposal { /** Msg json encoded message to be passed to the contract on migration */ msg: Uint8Array; } +export interface ReactiveMigrateContractProposal { + title: ComputedRef<string>; + description: ComputedRef<string>; + contract: ComputedRef<string>; + codeId: ComputedRef<bigint>; + msg: ComputedRef<Uint8Array>; +} export interface MigrateContractProposalProtoMsg { typeUrl: "/cosmwasm.wasm.v1.MigrateContractProposal"; value: Uint8Array; @@ -106,6 +131,12 @@ export interface SudoContractProposal { /** Msg json encoded message to be passed to the contract as sudo */ msg: Uint8Array; } +export interface ReactiveSudoContractProposal { + title: ComputedRef<string>; + description: ComputedRef<string>; + contract: ComputedRef<string>; + msg: ComputedRef<Uint8Array>; +} export interface SudoContractProposalProtoMsg { typeUrl: "/cosmwasm.wasm.v1.SudoContractProposal"; value: Uint8Array; @@ -135,6 +166,14 @@ export interface ExecuteContractProposal { /** Funds coins that are transferred to the contract on instantiation */ funds: Coin[]; } +export interface ReactiveExecuteContractProposal { + title: ComputedRef<string>; + description: ComputedRef<string>; + runAs: ComputedRef<string>; + contract: ComputedRef<string>; + msg: ComputedRef<Uint8Array>; + funds: ComputedRef<Coin[]>; +} export interface ExecuteContractProposalProtoMsg { typeUrl: "/cosmwasm.wasm.v1.ExecuteContractProposal"; value: Uint8Array; @@ -162,6 +201,12 @@ export interface UpdateAdminProposal { /** Contract is the address of the smart contract */ contract: string; } +export interface ReactiveUpdateAdminProposal { + title: ComputedRef<string>; + description: ComputedRef<string>; + newAdmin: ComputedRef<string>; + contract: ComputedRef<string>; +} export interface UpdateAdminProposalProtoMsg { typeUrl: "/cosmwasm.wasm.v1.UpdateAdminProposal"; value: Uint8Array; @@ -185,6 +230,11 @@ export interface ClearAdminProposal { /** Contract is the address of the smart contract */ contract: string; } +export interface ReactiveClearAdminProposal { + title: ComputedRef<string>; + description: ComputedRef<string>; + contract: ComputedRef<string>; +} export interface ClearAdminProposalProtoMsg { typeUrl: "/cosmwasm.wasm.v1.ClearAdminProposal"; value: Uint8Array; @@ -210,6 +260,11 @@ export interface PinCodesProposal { /** CodeIDs references the new WASM codes */ codeIds: bigint[]; } +export interface ReactivePinCodesProposal { + title: ComputedRef<string>; + description: ComputedRef<string>; + codeIds: ComputedRef<bigint[]>; +} export interface PinCodesProposalProtoMsg { typeUrl: "/cosmwasm.wasm.v1.PinCodesProposal"; value: Uint8Array; @@ -235,6 +290,11 @@ export interface UnpinCodesProposal { /** CodeIDs references the WASM codes */ codeIds: bigint[]; } +export interface ReactiveUnpinCodesProposal { + title: ComputedRef<string>; + description: ComputedRef<string>; + codeIds: ComputedRef<bigint[]>; +} export interface UnpinCodesProposalProtoMsg { typeUrl: "/cosmwasm.wasm.v1.UnpinCodesProposal"; value: Uint8Array; @@ -260,13 +320,13 @@ function createBaseStoreCodeProposal(): StoreCodeProposal { export const StoreCodeProposal = { typeUrl: "/cosmwasm.wasm.v1.StoreCodeProposal", encode(message: StoreCodeProposal, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.title !== undefined) { + if (message.title !== "") { writer.uint32(10).string(message.title); } - if (message.description !== undefined) { + if (message.description !== "") { writer.uint32(18).string(message.description); } - if (message.runAs !== undefined) { + if (message.runAs !== "") { writer.uint32(26).string(message.runAs); } if (message.wasmByteCode.length !== 0) { @@ -307,13 +367,13 @@ export const StoreCodeProposal = { return message; }, fromJSON(object: any): StoreCodeProposal { - 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; + 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 + }; }, toJSON(message: StoreCodeProposal): JsonSafe<StoreCodeProposal> { const obj: any = {}; @@ -330,9 +390,7 @@ export const StoreCodeProposal = { message.description = object.description ?? ""; message.runAs = object.runAs ?? ""; message.wasmByteCode = object.wasmByteCode ?? new Uint8Array(); - if (object.instantiatePermission !== undefined && object.instantiatePermission !== null) { - message.instantiatePermission = AccessConfig.fromPartial(object.instantiatePermission); - } + message.instantiatePermission = object.instantiatePermission !== undefined && object.instantiatePermission !== null ? AccessConfig.fromPartial(object.instantiatePermission) : undefined; return message; }, fromSDK(object: StoreCodeProposalSDKType): StoreCodeProposal { @@ -427,22 +485,22 @@ function createBaseInstantiateContractProposal(): InstantiateContractProposal { export const InstantiateContractProposal = { typeUrl: "/cosmwasm.wasm.v1.InstantiateContractProposal", encode(message: InstantiateContractProposal, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.title !== undefined) { + if (message.title !== "") { writer.uint32(10).string(message.title); } - if (message.description !== undefined) { + if (message.description !== "") { writer.uint32(18).string(message.description); } - if (message.runAs !== undefined) { + if (message.runAs !== "") { writer.uint32(26).string(message.runAs); } - if (message.admin !== undefined) { + if (message.admin !== "") { writer.uint32(34).string(message.admin); } - if (message.codeId !== undefined) { + if (message.codeId !== BigInt(0)) { writer.uint32(40).uint64(message.codeId); } - if (message.label !== undefined) { + if (message.label !== "") { writer.uint32(50).string(message.label); } if (message.msg.length !== 0) { @@ -492,16 +550,16 @@ export const InstantiateContractProposal = { return message; }, fromJSON(object: any): InstantiateContractProposal { - 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; + 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)) : [] + }; }, toJSON(message: InstantiateContractProposal): JsonSafe<InstantiateContractProposal> { const obj: any = {}; @@ -525,9 +583,7 @@ export const InstantiateContractProposal = { message.description = object.description ?? ""; message.runAs = object.runAs ?? ""; message.admin = object.admin ?? ""; - if (object.codeId !== undefined && object.codeId !== null) { - message.codeId = BigInt(object.codeId.toString()); - } + message.codeId = object.codeId !== undefined && object.codeId !== null ? BigInt(object.codeId.toString()) : BigInt(0); message.label = object.label ?? ""; message.msg = object.msg ?? new Uint8Array(); message.funds = object.funds?.map(e => Coin.fromPartial(e)) || []; @@ -649,16 +705,16 @@ function createBaseMigrateContractProposal(): MigrateContractProposal { export const MigrateContractProposal = { typeUrl: "/cosmwasm.wasm.v1.MigrateContractProposal", encode(message: MigrateContractProposal, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.title !== undefined) { + if (message.title !== "") { writer.uint32(10).string(message.title); } - if (message.description !== undefined) { + if (message.description !== "") { writer.uint32(18).string(message.description); } - if (message.contract !== undefined) { + if (message.contract !== "") { writer.uint32(34).string(message.contract); } - if (message.codeId !== undefined) { + if (message.codeId !== BigInt(0)) { writer.uint32(40).uint64(message.codeId); } if (message.msg.length !== 0) { @@ -696,13 +752,13 @@ export const MigrateContractProposal = { return message; }, fromJSON(object: any): MigrateContractProposal { - 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; + 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() + }; }, toJSON(message: MigrateContractProposal): JsonSafe<MigrateContractProposal> { const obj: any = {}; @@ -718,9 +774,7 @@ export const MigrateContractProposal = { message.title = object.title ?? ""; message.description = object.description ?? ""; message.contract = object.contract ?? ""; - if (object.codeId !== undefined && object.codeId !== null) { - message.codeId = BigInt(object.codeId.toString()); - } + message.codeId = object.codeId !== undefined && object.codeId !== null ? BigInt(object.codeId.toString()) : BigInt(0); message.msg = object.msg ?? new Uint8Array(); return message; }, @@ -812,13 +866,13 @@ function createBaseSudoContractProposal(): SudoContractProposal { export const SudoContractProposal = { typeUrl: "/cosmwasm.wasm.v1.SudoContractProposal", encode(message: SudoContractProposal, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.title !== undefined) { + if (message.title !== "") { writer.uint32(10).string(message.title); } - if (message.description !== undefined) { + if (message.description !== "") { writer.uint32(18).string(message.description); } - if (message.contract !== undefined) { + if (message.contract !== "") { writer.uint32(26).string(message.contract); } if (message.msg.length !== 0) { @@ -853,12 +907,12 @@ export const SudoContractProposal = { return message; }, fromJSON(object: any): SudoContractProposal { - 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; + 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() + }; }, toJSON(message: SudoContractProposal): JsonSafe<SudoContractProposal> { const obj: any = {}; @@ -959,16 +1013,16 @@ function createBaseExecuteContractProposal(): ExecuteContractProposal { export const ExecuteContractProposal = { typeUrl: "/cosmwasm.wasm.v1.ExecuteContractProposal", encode(message: ExecuteContractProposal, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.title !== undefined) { + if (message.title !== "") { writer.uint32(10).string(message.title); } - if (message.description !== undefined) { + if (message.description !== "") { writer.uint32(18).string(message.description); } - if (message.runAs !== undefined) { + if (message.runAs !== "") { writer.uint32(26).string(message.runAs); } - if (message.contract !== undefined) { + if (message.contract !== "") { writer.uint32(34).string(message.contract); } if (message.msg.length !== 0) { @@ -1012,14 +1066,14 @@ export const ExecuteContractProposal = { return message; }, fromJSON(object: any): ExecuteContractProposal { - 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; + 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)) : [] + }; }, toJSON(message: ExecuteContractProposal): JsonSafe<ExecuteContractProposal> { const obj: any = {}; @@ -1146,16 +1200,16 @@ function createBaseUpdateAdminProposal(): UpdateAdminProposal { export const UpdateAdminProposal = { typeUrl: "/cosmwasm.wasm.v1.UpdateAdminProposal", encode(message: UpdateAdminProposal, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.title !== undefined) { + if (message.title !== "") { writer.uint32(10).string(message.title); } - if (message.description !== undefined) { + if (message.description !== "") { writer.uint32(18).string(message.description); } - if (message.newAdmin !== undefined) { + if (message.newAdmin !== "") { writer.uint32(26).string(message.newAdmin); } - if (message.contract !== undefined) { + if (message.contract !== "") { writer.uint32(34).string(message.contract); } return writer; @@ -1187,12 +1241,12 @@ export const UpdateAdminProposal = { return message; }, fromJSON(object: any): UpdateAdminProposal { - 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; + 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) : "" + }; }, toJSON(message: UpdateAdminProposal): JsonSafe<UpdateAdminProposal> { const obj: any = {}; @@ -1290,13 +1344,13 @@ function createBaseClearAdminProposal(): ClearAdminProposal { export const ClearAdminProposal = { typeUrl: "/cosmwasm.wasm.v1.ClearAdminProposal", encode(message: ClearAdminProposal, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.title !== undefined) { + if (message.title !== "") { writer.uint32(10).string(message.title); } - if (message.description !== undefined) { + if (message.description !== "") { writer.uint32(18).string(message.description); } - if (message.contract !== undefined) { + if (message.contract !== "") { writer.uint32(26).string(message.contract); } return writer; @@ -1325,11 +1379,11 @@ export const ClearAdminProposal = { return message; }, fromJSON(object: any): ClearAdminProposal { - 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; + return { + title: isSet(object.title) ? String(object.title) : "", + description: isSet(object.description) ? String(object.description) : "", + contract: isSet(object.contract) ? String(object.contract) : "" + }; }, toJSON(message: ClearAdminProposal): JsonSafe<ClearAdminProposal> { const obj: any = {}; @@ -1418,10 +1472,10 @@ function createBasePinCodesProposal(): PinCodesProposal { export const PinCodesProposal = { typeUrl: "/cosmwasm.wasm.v1.PinCodesProposal", encode(message: PinCodesProposal, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.title !== undefined) { + if (message.title !== "") { writer.uint32(10).string(message.title); } - if (message.description !== undefined) { + if (message.description !== "") { writer.uint32(18).string(message.description); } writer.uint32(26).fork(); @@ -1462,11 +1516,11 @@ export const PinCodesProposal = { return message; }, fromJSON(object: any): PinCodesProposal { - 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; + 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())) : [] + }; }, toJSON(message: PinCodesProposal): JsonSafe<PinCodesProposal> { const obj: any = {}; @@ -1565,10 +1619,10 @@ function createBaseUnpinCodesProposal(): UnpinCodesProposal { export const UnpinCodesProposal = { typeUrl: "/cosmwasm.wasm.v1.UnpinCodesProposal", encode(message: UnpinCodesProposal, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.title !== undefined) { + if (message.title !== "") { writer.uint32(10).string(message.title); } - if (message.description !== undefined) { + if (message.description !== "") { writer.uint32(18).string(message.description); } writer.uint32(26).fork(); @@ -1609,11 +1663,11 @@ export const UnpinCodesProposal = { return message; }, fromJSON(object: any): UnpinCodesProposal { - 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; + 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())) : [] + }; }, toJSON(message: UnpinCodesProposal): JsonSafe<UnpinCodesProposal> { 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 1e785ed3fa..81951a23ff 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.js"; -import { ContractInfo, ContractInfoSDKType, ContractCodeHistoryEntry, ContractCodeHistoryEntrySDKType, Model, ModelSDKType } from "./types.js"; -import { setPaginationParams } from "../../../helpers.js"; +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 { 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.js"; +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"; 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: PageRequest.fromPartial({}) + pagination: undefined }): Promise<QueryCodesResponseSDKType> { const options: any = { params: {} @@ -89,7 +89,7 @@ export class LCDQueryClient { } /* PinnedCodes gets the pinned code ids */ async pinnedCodes(params: QueryPinnedCodesRequest = { - pagination: PageRequest.fromPartial({}) + pagination: undefined }): Promise<QueryPinnedCodesResponseSDKType> { 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 69dbaff5bd..5ab4db86c2 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.js"; -import { ContractInfo, ContractInfoSDKType, ContractCodeHistoryEntry, ContractCodeHistoryEntrySDKType, Model, ModelSDKType } from "./types.js"; -import { Rpc } from "../../../helpers.js"; -import { BinaryReader } from "../../../binary.js"; +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 { 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 } from "./query.js"; +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"; /** 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: PageRequest.fromPartial({}) + pagination: undefined }): Promise<QueryCodesResponse> { 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: PageRequest.fromPartial({}) + pagination: undefined }): Promise<QueryPinnedCodesResponse> { 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 262e35e445..7be5ed8169 100644 --- a/__fixtures__/v-next/outputv4/cosmwasm/wasm/v1/query.ts +++ b/__fixtures__/v-next/outputv4/cosmwasm/wasm/v1/query.ts @@ -1,9 +1,10 @@ -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 { 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 { 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 @@ -13,6 +14,9 @@ export interface QueryContractInfoRequest { /** address is the address of the contract to query */ address: string; } +export interface ReactiveQueryContractInfoRequest { + address: ComputedRef<string>; +} export interface QueryContractInfoRequestProtoMsg { typeUrl: "/cosmwasm.wasm.v1.QueryContractInfoRequest"; value: Uint8Array; @@ -33,6 +37,10 @@ export interface QueryContractInfoResponse { address: string; contractInfo: ContractInfo; } +export interface ReactiveQueryContractInfoResponse { + address: ComputedRef<string>; + contractInfo: ComputedRef<ContractInfo>; +} export interface QueryContractInfoResponseProtoMsg { typeUrl: "/cosmwasm.wasm.v1.QueryContractInfoResponse"; value: Uint8Array; @@ -55,6 +63,10 @@ export interface QueryContractHistoryRequest { /** pagination defines an optional pagination for the request. */ pagination?: PageRequest; } +export interface ReactiveQueryContractHistoryRequest { + address: ComputedRef<string>; + pagination?: ComputedRef<PageRequest>; +} export interface QueryContractHistoryRequestProtoMsg { typeUrl: "/cosmwasm.wasm.v1.QueryContractHistoryRequest"; value: Uint8Array; @@ -76,6 +88,10 @@ export interface QueryContractHistoryResponse { /** pagination defines the pagination in the response. */ pagination?: PageResponse; } +export interface ReactiveQueryContractHistoryResponse { + entries: ComputedRef<ContractCodeHistoryEntry[]>; + pagination?: ComputedRef<PageResponse>; +} export interface QueryContractHistoryResponseProtoMsg { typeUrl: "/cosmwasm.wasm.v1.QueryContractHistoryResponse"; value: Uint8Array; @@ -98,6 +114,10 @@ export interface QueryContractsByCodeRequest { /** pagination defines an optional pagination for the request. */ pagination?: PageRequest; } +export interface ReactiveQueryContractsByCodeRequest { + codeId: ComputedRef<bigint>; + pagination?: ComputedRef<PageRequest>; +} export interface QueryContractsByCodeRequestProtoMsg { typeUrl: "/cosmwasm.wasm.v1.QueryContractsByCodeRequest"; value: Uint8Array; @@ -120,6 +140,10 @@ export interface QueryContractsByCodeResponse { /** pagination defines the pagination in the response. */ pagination?: PageResponse; } +export interface ReactiveQueryContractsByCodeResponse { + contracts: ComputedRef<string[]>; + pagination?: ComputedRef<PageResponse>; +} export interface QueryContractsByCodeResponseProtoMsg { typeUrl: "/cosmwasm.wasm.v1.QueryContractsByCodeResponse"; value: Uint8Array; @@ -142,6 +166,10 @@ export interface QueryAllContractStateRequest { /** pagination defines an optional pagination for the request. */ pagination?: PageRequest; } +export interface ReactiveQueryAllContractStateRequest { + address: ComputedRef<string>; + pagination?: ComputedRef<PageRequest>; +} export interface QueryAllContractStateRequestProtoMsg { typeUrl: "/cosmwasm.wasm.v1.QueryAllContractStateRequest"; value: Uint8Array; @@ -163,6 +191,10 @@ export interface QueryAllContractStateResponse { /** pagination defines the pagination in the response. */ pagination?: PageResponse; } +export interface ReactiveQueryAllContractStateResponse { + models: ComputedRef<Model[]>; + pagination?: ComputedRef<PageResponse>; +} export interface QueryAllContractStateResponseProtoMsg { typeUrl: "/cosmwasm.wasm.v1.QueryAllContractStateResponse"; value: Uint8Array; @@ -184,6 +216,10 @@ export interface QueryRawContractStateRequest { address: string; queryData: Uint8Array; } +export interface ReactiveQueryRawContractStateRequest { + address: ComputedRef<string>; + queryData: ComputedRef<Uint8Array>; +} export interface QueryRawContractStateRequestProtoMsg { typeUrl: "/cosmwasm.wasm.v1.QueryRawContractStateRequest"; value: Uint8Array; @@ -204,6 +240,9 @@ export interface QueryRawContractStateResponse { /** Data contains the raw store data */ data: Uint8Array; } +export interface ReactiveQueryRawContractStateResponse { + data: ComputedRef<Uint8Array>; +} export interface QueryRawContractStateResponseProtoMsg { typeUrl: "/cosmwasm.wasm.v1.QueryRawContractStateResponse"; value: Uint8Array; @@ -225,6 +264,10 @@ export interface QuerySmartContractStateRequest { /** QueryData contains the query data passed to the contract */ queryData: Uint8Array; } +export interface ReactiveQuerySmartContractStateRequest { + address: ComputedRef<string>; + queryData: ComputedRef<Uint8Array>; +} export interface QuerySmartContractStateRequestProtoMsg { typeUrl: "/cosmwasm.wasm.v1.QuerySmartContractStateRequest"; value: Uint8Array; @@ -245,6 +288,9 @@ export interface QuerySmartContractStateResponse { /** Data contains the json data returned from the smart contract */ data: Uint8Array; } +export interface ReactiveQuerySmartContractStateResponse { + data: ComputedRef<Uint8Array>; +} export interface QuerySmartContractStateResponseProtoMsg { typeUrl: "/cosmwasm.wasm.v1.QuerySmartContractStateResponse"; value: Uint8Array; @@ -261,6 +307,9 @@ export interface QueryCodeRequest { /** grpc-gateway_out does not support Go style CodID */ codeId: bigint; } +export interface ReactiveQueryCodeRequest { + codeId: ComputedRef<bigint>; +} export interface QueryCodeRequestProtoMsg { typeUrl: "/cosmwasm.wasm.v1.QueryCodeRequest"; value: Uint8Array; @@ -275,6 +324,11 @@ export interface CodeInfoResponse { creator: string; dataHash: Uint8Array; } +export interface ReactiveCodeInfoResponse { + codeId: ComputedRef<bigint>; + creator: ComputedRef<string>; + dataHash: ComputedRef<Uint8Array>; +} export interface CodeInfoResponseProtoMsg { typeUrl: "/cosmwasm.wasm.v1.CodeInfoResponse"; value: Uint8Array; @@ -290,6 +344,10 @@ export interface QueryCodeResponse { codeInfo?: CodeInfoResponse; data: Uint8Array; } +export interface ReactiveQueryCodeResponse { + codeInfo?: ComputedRef<CodeInfoResponse>; + data: ComputedRef<Uint8Array>; +} export interface QueryCodeResponseProtoMsg { typeUrl: "/cosmwasm.wasm.v1.QueryCodeResponse"; value: Uint8Array; @@ -304,6 +362,9 @@ export interface QueryCodesRequest { /** pagination defines an optional pagination for the request. */ pagination?: PageRequest; } +export interface ReactiveQueryCodesRequest { + pagination?: ComputedRef<PageRequest>; +} export interface QueryCodesRequestProtoMsg { typeUrl: "/cosmwasm.wasm.v1.QueryCodesRequest"; value: Uint8Array; @@ -318,6 +379,10 @@ export interface QueryCodesResponse { /** pagination defines the pagination in the response. */ pagination?: PageResponse; } +export interface ReactiveQueryCodesResponse { + codeInfos: ComputedRef<CodeInfoResponse[]>; + pagination?: ComputedRef<PageResponse>; +} export interface QueryCodesResponseProtoMsg { typeUrl: "/cosmwasm.wasm.v1.QueryCodesResponse"; value: Uint8Array; @@ -335,6 +400,9 @@ export interface QueryPinnedCodesRequest { /** pagination defines an optional pagination for the request. */ pagination?: PageRequest; } +export interface ReactiveQueryPinnedCodesRequest { + pagination?: ComputedRef<PageRequest>; +} export interface QueryPinnedCodesRequestProtoMsg { typeUrl: "/cosmwasm.wasm.v1.QueryPinnedCodesRequest"; value: Uint8Array; @@ -355,6 +423,10 @@ export interface QueryPinnedCodesResponse { /** pagination defines the pagination in the response. */ pagination?: PageResponse; } +export interface ReactiveQueryPinnedCodesResponse { + codeIds: ComputedRef<bigint[]>; + pagination?: ComputedRef<PageResponse>; +} export interface QueryPinnedCodesResponseProtoMsg { typeUrl: "/cosmwasm.wasm.v1.QueryPinnedCodesResponse"; value: Uint8Array; @@ -375,7 +447,7 @@ function createBaseQueryContractInfoRequest(): QueryContractInfoRequest { export const QueryContractInfoRequest = { typeUrl: "/cosmwasm.wasm.v1.QueryContractInfoRequest", encode(message: QueryContractInfoRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.address !== undefined) { + if (message.address !== "") { writer.uint32(10).string(message.address); } return writer; @@ -398,9 +470,9 @@ export const QueryContractInfoRequest = { return message; }, fromJSON(object: any): QueryContractInfoRequest { - const obj = createBaseQueryContractInfoRequest(); - if (isSet(object.address)) obj.address = String(object.address); - return obj; + return { + address: isSet(object.address) ? String(object.address) : "" + }; }, toJSON(message: QueryContractInfoRequest): JsonSafe<QueryContractInfoRequest> { const obj: any = {}; @@ -470,7 +542,7 @@ function createBaseQueryContractInfoResponse(): QueryContractInfoResponse { export const QueryContractInfoResponse = { typeUrl: "/cosmwasm.wasm.v1.QueryContractInfoResponse", encode(message: QueryContractInfoResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.address !== undefined) { + if (message.address !== "") { writer.uint32(10).string(message.address); } if (message.contractInfo !== undefined) { @@ -499,10 +571,10 @@ export const QueryContractInfoResponse = { return message; }, fromJSON(object: any): QueryContractInfoResponse { - const obj = createBaseQueryContractInfoResponse(); - if (isSet(object.address)) obj.address = String(object.address); - if (isSet(object.contractInfo)) obj.contractInfo = ContractInfo.fromJSON(object.contractInfo); - return obj; + return { + address: isSet(object.address) ? String(object.address) : "", + contractInfo: isSet(object.contractInfo) ? ContractInfo.fromJSON(object.contractInfo) : undefined + }; }, toJSON(message: QueryContractInfoResponse): JsonSafe<QueryContractInfoResponse> { const obj: any = {}; @@ -513,9 +585,7 @@ export const QueryContractInfoResponse = { fromPartial(object: DeepPartial<QueryContractInfoResponse>): QueryContractInfoResponse { const message = createBaseQueryContractInfoResponse(); message.address = object.address ?? ""; - if (object.contractInfo !== undefined && object.contractInfo !== null) { - message.contractInfo = ContractInfo.fromPartial(object.contractInfo); - } + message.contractInfo = object.contractInfo !== undefined && object.contractInfo !== null ? ContractInfo.fromPartial(object.contractInfo) : undefined; return message; }, fromSDK(object: QueryContractInfoResponseSDKType): QueryContractInfoResponse { @@ -583,7 +653,7 @@ function createBaseQueryContractHistoryRequest(): QueryContractHistoryRequest { export const QueryContractHistoryRequest = { typeUrl: "/cosmwasm.wasm.v1.QueryContractHistoryRequest", encode(message: QueryContractHistoryRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.address !== undefined) { + if (message.address !== "") { writer.uint32(10).string(message.address); } if (message.pagination !== undefined) { @@ -612,10 +682,10 @@ export const QueryContractHistoryRequest = { return message; }, fromJSON(object: any): QueryContractHistoryRequest { - const obj = createBaseQueryContractHistoryRequest(); - if (isSet(object.address)) obj.address = String(object.address); - if (isSet(object.pagination)) obj.pagination = PageRequest.fromJSON(object.pagination); - return obj; + return { + address: isSet(object.address) ? String(object.address) : "", + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined + }; }, toJSON(message: QueryContractHistoryRequest): JsonSafe<QueryContractHistoryRequest> { const obj: any = {}; @@ -626,9 +696,7 @@ export const QueryContractHistoryRequest = { fromPartial(object: DeepPartial<QueryContractHistoryRequest>): QueryContractHistoryRequest { const message = createBaseQueryContractHistoryRequest(); message.address = object.address ?? ""; - if (object.pagination !== undefined && object.pagination !== null) { - message.pagination = PageRequest.fromPartial(object.pagination); - } + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageRequest.fromPartial(object.pagination) : undefined; return message; }, fromSDK(object: QueryContractHistoryRequestSDKType): QueryContractHistoryRequest { @@ -725,10 +793,10 @@ export const QueryContractHistoryResponse = { return message; }, fromJSON(object: any): QueryContractHistoryResponse { - 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; + return { + entries: Array.isArray(object?.entries) ? object.entries.map((e: any) => ContractCodeHistoryEntry.fromJSON(e)) : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined + }; }, toJSON(message: QueryContractHistoryResponse): JsonSafe<QueryContractHistoryResponse> { const obj: any = {}; @@ -743,9 +811,7 @@ export const QueryContractHistoryResponse = { fromPartial(object: DeepPartial<QueryContractHistoryResponse>): QueryContractHistoryResponse { const message = createBaseQueryContractHistoryResponse(); message.entries = object.entries?.map(e => ContractCodeHistoryEntry.fromPartial(e)) || []; - if (object.pagination !== undefined && object.pagination !== null) { - message.pagination = PageResponse.fromPartial(object.pagination); - } + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageResponse.fromPartial(object.pagination) : undefined; return message; }, fromSDK(object: QueryContractHistoryResponseSDKType): QueryContractHistoryResponse { @@ -819,7 +885,7 @@ function createBaseQueryContractsByCodeRequest(): QueryContractsByCodeRequest { export const QueryContractsByCodeRequest = { typeUrl: "/cosmwasm.wasm.v1.QueryContractsByCodeRequest", encode(message: QueryContractsByCodeRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.codeId !== undefined) { + if (message.codeId !== BigInt(0)) { writer.uint32(8).uint64(message.codeId); } if (message.pagination !== undefined) { @@ -848,10 +914,10 @@ export const QueryContractsByCodeRequest = { return message; }, fromJSON(object: any): QueryContractsByCodeRequest { - 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; + return { + codeId: isSet(object.codeId) ? BigInt(object.codeId.toString()) : BigInt(0), + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined + }; }, toJSON(message: QueryContractsByCodeRequest): JsonSafe<QueryContractsByCodeRequest> { const obj: any = {}; @@ -861,12 +927,8 @@ export const QueryContractsByCodeRequest = { }, fromPartial(object: DeepPartial<QueryContractsByCodeRequest>): QueryContractsByCodeRequest { const message = createBaseQueryContractsByCodeRequest(); - 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); - } + 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; return message; }, fromSDK(object: QueryContractsByCodeRequestSDKType): QueryContractsByCodeRequest { @@ -963,10 +1025,10 @@ export const QueryContractsByCodeResponse = { return message; }, fromJSON(object: any): QueryContractsByCodeResponse { - 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; + return { + contracts: Array.isArray(object?.contracts) ? object.contracts.map((e: any) => String(e)) : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined + }; }, toJSON(message: QueryContractsByCodeResponse): JsonSafe<QueryContractsByCodeResponse> { const obj: any = {}; @@ -981,9 +1043,7 @@ export const QueryContractsByCodeResponse = { fromPartial(object: DeepPartial<QueryContractsByCodeResponse>): QueryContractsByCodeResponse { const message = createBaseQueryContractsByCodeResponse(); message.contracts = object.contracts?.map(e => e) || []; - if (object.pagination !== undefined && object.pagination !== null) { - message.pagination = PageResponse.fromPartial(object.pagination); - } + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageResponse.fromPartial(object.pagination) : undefined; return message; }, fromSDK(object: QueryContractsByCodeResponseSDKType): QueryContractsByCodeResponse { @@ -1057,7 +1117,7 @@ function createBaseQueryAllContractStateRequest(): QueryAllContractStateRequest export const QueryAllContractStateRequest = { typeUrl: "/cosmwasm.wasm.v1.QueryAllContractStateRequest", encode(message: QueryAllContractStateRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.address !== undefined) { + if (message.address !== "") { writer.uint32(10).string(message.address); } if (message.pagination !== undefined) { @@ -1086,10 +1146,10 @@ export const QueryAllContractStateRequest = { return message; }, fromJSON(object: any): QueryAllContractStateRequest { - const obj = createBaseQueryAllContractStateRequest(); - if (isSet(object.address)) obj.address = String(object.address); - if (isSet(object.pagination)) obj.pagination = PageRequest.fromJSON(object.pagination); - return obj; + return { + address: isSet(object.address) ? String(object.address) : "", + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined + }; }, toJSON(message: QueryAllContractStateRequest): JsonSafe<QueryAllContractStateRequest> { const obj: any = {}; @@ -1100,9 +1160,7 @@ export const QueryAllContractStateRequest = { fromPartial(object: DeepPartial<QueryAllContractStateRequest>): QueryAllContractStateRequest { const message = createBaseQueryAllContractStateRequest(); message.address = object.address ?? ""; - if (object.pagination !== undefined && object.pagination !== null) { - message.pagination = PageRequest.fromPartial(object.pagination); - } + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageRequest.fromPartial(object.pagination) : undefined; return message; }, fromSDK(object: QueryAllContractStateRequestSDKType): QueryAllContractStateRequest { @@ -1199,10 +1257,10 @@ export const QueryAllContractStateResponse = { return message; }, fromJSON(object: any): QueryAllContractStateResponse { - 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; + return { + models: Array.isArray(object?.models) ? object.models.map((e: any) => Model.fromJSON(e)) : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined + }; }, toJSON(message: QueryAllContractStateResponse): JsonSafe<QueryAllContractStateResponse> { const obj: any = {}; @@ -1217,9 +1275,7 @@ export const QueryAllContractStateResponse = { fromPartial(object: DeepPartial<QueryAllContractStateResponse>): QueryAllContractStateResponse { const message = createBaseQueryAllContractStateResponse(); message.models = object.models?.map(e => Model.fromPartial(e)) || []; - if (object.pagination !== undefined && object.pagination !== null) { - message.pagination = PageResponse.fromPartial(object.pagination); - } + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageResponse.fromPartial(object.pagination) : undefined; return message; }, fromSDK(object: QueryAllContractStateResponseSDKType): QueryAllContractStateResponse { @@ -1293,7 +1349,7 @@ function createBaseQueryRawContractStateRequest(): QueryRawContractStateRequest export const QueryRawContractStateRequest = { typeUrl: "/cosmwasm.wasm.v1.QueryRawContractStateRequest", encode(message: QueryRawContractStateRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.address !== undefined) { + if (message.address !== "") { writer.uint32(10).string(message.address); } if (message.queryData.length !== 0) { @@ -1322,10 +1378,10 @@ export const QueryRawContractStateRequest = { return message; }, fromJSON(object: any): QueryRawContractStateRequest { - const obj = createBaseQueryRawContractStateRequest(); - if (isSet(object.address)) obj.address = String(object.address); - if (isSet(object.queryData)) obj.queryData = bytesFromBase64(object.queryData); - return obj; + return { + address: isSet(object.address) ? String(object.address) : "", + queryData: isSet(object.queryData) ? bytesFromBase64(object.queryData) : new Uint8Array() + }; }, toJSON(message: QueryRawContractStateRequest): JsonSafe<QueryRawContractStateRequest> { const obj: any = {}; @@ -1426,9 +1482,9 @@ export const QueryRawContractStateResponse = { return message; }, fromJSON(object: any): QueryRawContractStateResponse { - const obj = createBaseQueryRawContractStateResponse(); - if (isSet(object.data)) obj.data = bytesFromBase64(object.data); - return obj; + return { + data: isSet(object.data) ? bytesFromBase64(object.data) : new Uint8Array() + }; }, toJSON(message: QueryRawContractStateResponse): JsonSafe<QueryRawContractStateResponse> { const obj: any = {}; @@ -1498,7 +1554,7 @@ function createBaseQuerySmartContractStateRequest(): QuerySmartContractStateRequ export const QuerySmartContractStateRequest = { typeUrl: "/cosmwasm.wasm.v1.QuerySmartContractStateRequest", encode(message: QuerySmartContractStateRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.address !== undefined) { + if (message.address !== "") { writer.uint32(10).string(message.address); } if (message.queryData.length !== 0) { @@ -1527,10 +1583,10 @@ export const QuerySmartContractStateRequest = { return message; }, fromJSON(object: any): QuerySmartContractStateRequest { - const obj = createBaseQuerySmartContractStateRequest(); - if (isSet(object.address)) obj.address = String(object.address); - if (isSet(object.queryData)) obj.queryData = bytesFromBase64(object.queryData); - return obj; + return { + address: isSet(object.address) ? String(object.address) : "", + queryData: isSet(object.queryData) ? bytesFromBase64(object.queryData) : new Uint8Array() + }; }, toJSON(message: QuerySmartContractStateRequest): JsonSafe<QuerySmartContractStateRequest> { const obj: any = {}; @@ -1631,9 +1687,9 @@ export const QuerySmartContractStateResponse = { return message; }, fromJSON(object: any): QuerySmartContractStateResponse { - const obj = createBaseQuerySmartContractStateResponse(); - if (isSet(object.data)) obj.data = bytesFromBase64(object.data); - return obj; + return { + data: isSet(object.data) ? bytesFromBase64(object.data) : new Uint8Array() + }; }, toJSON(message: QuerySmartContractStateResponse): JsonSafe<QuerySmartContractStateResponse> { const obj: any = {}; @@ -1702,7 +1758,7 @@ function createBaseQueryCodeRequest(): QueryCodeRequest { export const QueryCodeRequest = { typeUrl: "/cosmwasm.wasm.v1.QueryCodeRequest", encode(message: QueryCodeRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.codeId !== undefined) { + if (message.codeId !== BigInt(0)) { writer.uint32(8).uint64(message.codeId); } return writer; @@ -1725,9 +1781,9 @@ export const QueryCodeRequest = { return message; }, fromJSON(object: any): QueryCodeRequest { - const obj = createBaseQueryCodeRequest(); - if (isSet(object.codeId)) obj.codeId = BigInt(object.codeId.toString()); - return obj; + return { + codeId: isSet(object.codeId) ? BigInt(object.codeId.toString()) : BigInt(0) + }; }, toJSON(message: QueryCodeRequest): JsonSafe<QueryCodeRequest> { const obj: any = {}; @@ -1736,9 +1792,7 @@ export const QueryCodeRequest = { }, fromPartial(object: DeepPartial<QueryCodeRequest>): QueryCodeRequest { const message = createBaseQueryCodeRequest(); - if (object.codeId !== undefined && object.codeId !== null) { - message.codeId = BigInt(object.codeId.toString()); - } + message.codeId = object.codeId !== undefined && object.codeId !== null ? BigInt(object.codeId.toString()) : BigInt(0); return message; }, fromSDK(object: QueryCodeRequestSDKType): QueryCodeRequest { @@ -1800,10 +1854,10 @@ function createBaseCodeInfoResponse(): CodeInfoResponse { export const CodeInfoResponse = { typeUrl: "/cosmwasm.wasm.v1.CodeInfoResponse", encode(message: CodeInfoResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.codeId !== undefined) { + if (message.codeId !== BigInt(0)) { writer.uint32(8).uint64(message.codeId); } - if (message.creator !== undefined) { + if (message.creator !== "") { writer.uint32(18).string(message.creator); } if (message.dataHash.length !== 0) { @@ -1835,11 +1889,11 @@ export const CodeInfoResponse = { return message; }, fromJSON(object: any): CodeInfoResponse { - 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; + 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() + }; }, toJSON(message: CodeInfoResponse): JsonSafe<CodeInfoResponse> { const obj: any = {}; @@ -1850,9 +1904,7 @@ export const CodeInfoResponse = { }, fromPartial(object: DeepPartial<CodeInfoResponse>): CodeInfoResponse { const message = createBaseCodeInfoResponse(); - if (object.codeId !== undefined && object.codeId !== null) { - message.codeId = BigInt(object.codeId.toString()); - } + message.codeId = object.codeId !== undefined && object.codeId !== null ? BigInt(object.codeId.toString()) : BigInt(0); message.creator = object.creator ?? ""; message.dataHash = object.dataHash ?? new Uint8Array(); return message; @@ -1958,10 +2010,10 @@ export const QueryCodeResponse = { return message; }, fromJSON(object: any): QueryCodeResponse { - const obj = createBaseQueryCodeResponse(); - if (isSet(object.codeInfo)) obj.codeInfo = CodeInfoResponse.fromJSON(object.codeInfo); - if (isSet(object.data)) obj.data = bytesFromBase64(object.data); - return obj; + return { + codeInfo: isSet(object.codeInfo) ? CodeInfoResponse.fromJSON(object.codeInfo) : undefined, + data: isSet(object.data) ? bytesFromBase64(object.data) : new Uint8Array() + }; }, toJSON(message: QueryCodeResponse): JsonSafe<QueryCodeResponse> { const obj: any = {}; @@ -1971,9 +2023,7 @@ export const QueryCodeResponse = { }, fromPartial(object: DeepPartial<QueryCodeResponse>): QueryCodeResponse { const message = createBaseQueryCodeResponse(); - if (object.codeInfo !== undefined && object.codeInfo !== null) { - message.codeInfo = CodeInfoResponse.fromPartial(object.codeInfo); - } + message.codeInfo = object.codeInfo !== undefined && object.codeInfo !== null ? CodeInfoResponse.fromPartial(object.codeInfo) : undefined; message.data = object.data ?? new Uint8Array(); return message; }, @@ -2064,9 +2114,9 @@ export const QueryCodesRequest = { return message; }, fromJSON(object: any): QueryCodesRequest { - const obj = createBaseQueryCodesRequest(); - if (isSet(object.pagination)) obj.pagination = PageRequest.fromJSON(object.pagination); - return obj; + return { + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined + }; }, toJSON(message: QueryCodesRequest): JsonSafe<QueryCodesRequest> { const obj: any = {}; @@ -2075,9 +2125,7 @@ export const QueryCodesRequest = { }, fromPartial(object: DeepPartial<QueryCodesRequest>): QueryCodesRequest { const message = createBaseQueryCodesRequest(); - if (object.pagination !== undefined && object.pagination !== null) { - message.pagination = PageRequest.fromPartial(object.pagination); - } + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageRequest.fromPartial(object.pagination) : undefined; return message; }, fromSDK(object: QueryCodesRequestSDKType): QueryCodesRequest { @@ -2167,10 +2215,10 @@ export const QueryCodesResponse = { return message; }, fromJSON(object: any): QueryCodesResponse { - 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; + return { + codeInfos: Array.isArray(object?.codeInfos) ? object.codeInfos.map((e: any) => CodeInfoResponse.fromJSON(e)) : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined + }; }, toJSON(message: QueryCodesResponse): JsonSafe<QueryCodesResponse> { const obj: any = {}; @@ -2185,9 +2233,7 @@ export const QueryCodesResponse = { fromPartial(object: DeepPartial<QueryCodesResponse>): QueryCodesResponse { const message = createBaseQueryCodesResponse(); message.codeInfos = object.codeInfos?.map(e => CodeInfoResponse.fromPartial(e)) || []; - if (object.pagination !== undefined && object.pagination !== null) { - message.pagination = PageResponse.fromPartial(object.pagination); - } + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageResponse.fromPartial(object.pagination) : undefined; return message; }, fromSDK(object: QueryCodesResponseSDKType): QueryCodesResponse { @@ -2283,9 +2329,9 @@ export const QueryPinnedCodesRequest = { return message; }, fromJSON(object: any): QueryPinnedCodesRequest { - const obj = createBaseQueryPinnedCodesRequest(); - if (isSet(object.pagination)) obj.pagination = PageRequest.fromJSON(object.pagination); - return obj; + return { + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined + }; }, toJSON(message: QueryPinnedCodesRequest): JsonSafe<QueryPinnedCodesRequest> { const obj: any = {}; @@ -2294,9 +2340,7 @@ export const QueryPinnedCodesRequest = { }, fromPartial(object: DeepPartial<QueryPinnedCodesRequest>): QueryPinnedCodesRequest { const message = createBaseQueryPinnedCodesRequest(); - if (object.pagination !== undefined && object.pagination !== null) { - message.pagination = PageRequest.fromPartial(object.pagination); - } + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageRequest.fromPartial(object.pagination) : undefined; return message; }, fromSDK(object: QueryPinnedCodesRequestSDKType): QueryPinnedCodesRequest { @@ -2395,10 +2439,10 @@ export const QueryPinnedCodesResponse = { return message; }, fromJSON(object: any): QueryPinnedCodesResponse { - 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; + return { + codeIds: Array.isArray(object?.codeIds) ? object.codeIds.map((e: any) => BigInt(e.toString())) : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined + }; }, toJSON(message: QueryPinnedCodesResponse): JsonSafe<QueryPinnedCodesResponse> { const obj: any = {}; @@ -2413,9 +2457,7 @@ export const QueryPinnedCodesResponse = { fromPartial(object: DeepPartial<QueryPinnedCodesResponse>): QueryPinnedCodesResponse { const message = createBaseQueryPinnedCodesResponse(); message.codeIds = object.codeIds?.map(e => BigInt(e.toString())) || []; - if (object.pagination !== undefined && object.pagination !== null) { - message.pagination = PageResponse.fromPartial(object.pagination); - } + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageResponse.fromPartial(object.pagination) : undefined; 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 0cde59f330..db3abbec45 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.js"; -import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin.js"; +import { AccessConfig, AccessConfigSDKType, accessTypeFromJSON } from "./types"; +import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { AminoMsg } from "@cosmjs/amino"; import { toBase64, fromBase64, fromUtf8, toUtf8 } from "@cosmjs/encoding"; -import { MsgStoreCode, MsgStoreCodeSDKType, MsgInstantiateContract, MsgInstantiateContractSDKType, MsgExecuteContract, MsgExecuteContractSDKType, MsgMigrateContract, MsgMigrateContractSDKType, MsgUpdateAdmin, MsgUpdateAdminSDKType, MsgClearAdmin, MsgClearAdminSDKType } from "./tx.js"; +import { MsgStoreCode, MsgStoreCodeSDKType, MsgInstantiateContract, MsgInstantiateContractSDKType, MsgExecuteContract, MsgExecuteContractSDKType, MsgMigrateContract, MsgMigrateContractSDKType, MsgUpdateAdmin, MsgUpdateAdminSDKType, MsgClearAdmin, MsgClearAdminSDKType } from "./tx"; 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 894e6816c5..f5f468179a 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.js"; -import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin.js"; +import { AccessConfig, AccessConfigSDKType } from "./types"; +import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { GeneratedType, Registry } from "@cosmjs/proto-signing"; -import { MsgStoreCode, MsgStoreCodeSDKType, MsgInstantiateContract, MsgInstantiateContractSDKType, MsgExecuteContract, MsgExecuteContractSDKType, MsgMigrateContract, MsgMigrateContractSDKType, MsgUpdateAdmin, MsgUpdateAdminSDKType, MsgClearAdmin, MsgClearAdminSDKType } from "./tx.js"; +import { MsgStoreCode, MsgStoreCodeSDKType, MsgInstantiateContract, MsgInstantiateContractSDKType, MsgExecuteContract, MsgExecuteContractSDKType, MsgMigrateContract, MsgMigrateContractSDKType, MsgUpdateAdmin, MsgUpdateAdminSDKType, MsgClearAdmin, MsgClearAdminSDKType } from "./tx"; 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 e38afee945..9ac6092cc2 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.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"; +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"; /** 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 6561ef6f9f..306b2a23fe 100644 --- a/__fixtures__/v-next/outputv4/cosmwasm/wasm/v1/tx.ts +++ b/__fixtures__/v-next/outputv4/cosmwasm/wasm/v1/tx.ts @@ -1,9 +1,10 @@ -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 { 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 { 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 { @@ -17,6 +18,11 @@ export interface MsgStoreCode { */ instantiatePermission?: AccessConfig; } +export interface ReactiveMsgStoreCode { + sender: ComputedRef<string>; + wasmByteCode: ComputedRef<Uint8Array>; + instantiatePermission?: ComputedRef<AccessConfig>; +} export interface MsgStoreCodeProtoMsg { typeUrl: "/cosmwasm.wasm.v1.MsgStoreCode"; value: Uint8Array; @@ -32,6 +38,9 @@ export interface MsgStoreCodeResponse { /** CodeID is the reference to the stored WASM code */ codeId: bigint; } +export interface ReactiveMsgStoreCodeResponse { + codeId: ComputedRef<bigint>; +} export interface MsgStoreCodeResponseProtoMsg { typeUrl: "/cosmwasm.wasm.v1.MsgStoreCodeResponse"; value: Uint8Array; @@ -58,6 +67,14 @@ export interface MsgInstantiateContract { /** Funds coins that are transferred to the contract on instantiation */ funds: Coin[]; } +export interface ReactiveMsgInstantiateContract { + sender: ComputedRef<string>; + admin: ComputedRef<string>; + codeId: ComputedRef<bigint>; + label: ComputedRef<string>; + msg: ComputedRef<Uint8Array>; + funds: ComputedRef<Coin[]>; +} export interface MsgInstantiateContractProtoMsg { typeUrl: "/cosmwasm.wasm.v1.MsgInstantiateContract"; value: Uint8Array; @@ -81,6 +98,10 @@ export interface MsgInstantiateContractResponse { /** Data contains base64-encoded bytes to returned from the contract */ data: Uint8Array; } +export interface ReactiveMsgInstantiateContractResponse { + address: ComputedRef<string>; + data: ComputedRef<Uint8Array>; +} export interface MsgInstantiateContractResponseProtoMsg { typeUrl: "/cosmwasm.wasm.v1.MsgInstantiateContractResponse"; value: Uint8Array; @@ -101,6 +122,12 @@ export interface MsgExecuteContract { /** Funds coins that are transferred to the contract on execution */ funds: Coin[]; } +export interface ReactiveMsgExecuteContract { + sender: ComputedRef<string>; + contract: ComputedRef<string>; + msg: ComputedRef<Uint8Array>; + funds: ComputedRef<Coin[]>; +} export interface MsgExecuteContractProtoMsg { typeUrl: "/cosmwasm.wasm.v1.MsgExecuteContract"; value: Uint8Array; @@ -117,6 +144,9 @@ export interface MsgExecuteContractResponse { /** Data contains base64-encoded bytes to returned from the contract */ data: Uint8Array; } +export interface ReactiveMsgExecuteContractResponse { + data: ComputedRef<Uint8Array>; +} export interface MsgExecuteContractResponseProtoMsg { typeUrl: "/cosmwasm.wasm.v1.MsgExecuteContractResponse"; value: Uint8Array; @@ -136,6 +166,12 @@ export interface MsgMigrateContract { /** Msg json encoded message to be passed to the contract on migration */ msg: Uint8Array; } +export interface ReactiveMsgMigrateContract { + sender: ComputedRef<string>; + contract: ComputedRef<string>; + codeId: ComputedRef<bigint>; + msg: ComputedRef<Uint8Array>; +} export interface MsgMigrateContractProtoMsg { typeUrl: "/cosmwasm.wasm.v1.MsgMigrateContract"; value: Uint8Array; @@ -155,6 +191,9 @@ export interface MsgMigrateContractResponse { */ data: Uint8Array; } +export interface ReactiveMsgMigrateContractResponse { + data: ComputedRef<Uint8Array>; +} export interface MsgMigrateContractResponseProtoMsg { typeUrl: "/cosmwasm.wasm.v1.MsgMigrateContractResponse"; value: Uint8Array; @@ -172,6 +211,11 @@ export interface MsgUpdateAdmin { /** Contract is the address of the smart contract */ contract: string; } +export interface ReactiveMsgUpdateAdmin { + sender: ComputedRef<string>; + newAdmin: ComputedRef<string>; + contract: ComputedRef<string>; +} export interface MsgUpdateAdminProtoMsg { typeUrl: "/cosmwasm.wasm.v1.MsgUpdateAdmin"; value: Uint8Array; @@ -184,6 +228,7 @@ export interface MsgUpdateAdminSDKType { } /** MsgUpdateAdminResponse returns empty data */ export interface MsgUpdateAdminResponse {} +export interface ReactiveMsgUpdateAdminResponse {} export interface MsgUpdateAdminResponseProtoMsg { typeUrl: "/cosmwasm.wasm.v1.MsgUpdateAdminResponse"; value: Uint8Array; @@ -197,6 +242,10 @@ export interface MsgClearAdmin { /** Contract is the address of the smart contract */ contract: string; } +export interface ReactiveMsgClearAdmin { + sender: ComputedRef<string>; + contract: ComputedRef<string>; +} export interface MsgClearAdminProtoMsg { typeUrl: "/cosmwasm.wasm.v1.MsgClearAdmin"; value: Uint8Array; @@ -208,6 +257,7 @@ export interface MsgClearAdminSDKType { } /** MsgClearAdminResponse returns empty data */ export interface MsgClearAdminResponse {} +export interface ReactiveMsgClearAdminResponse {} export interface MsgClearAdminResponseProtoMsg { typeUrl: "/cosmwasm.wasm.v1.MsgClearAdminResponse"; value: Uint8Array; @@ -224,7 +274,7 @@ function createBaseMsgStoreCode(): MsgStoreCode { export const MsgStoreCode = { typeUrl: "/cosmwasm.wasm.v1.MsgStoreCode", encode(message: MsgStoreCode, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.sender !== undefined) { + if (message.sender !== "") { writer.uint32(10).string(message.sender); } if (message.wasmByteCode.length !== 0) { @@ -259,11 +309,11 @@ export const MsgStoreCode = { return message; }, fromJSON(object: any): MsgStoreCode { - 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; + 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 + }; }, toJSON(message: MsgStoreCode): JsonSafe<MsgStoreCode> { const obj: any = {}; @@ -276,9 +326,7 @@ export const MsgStoreCode = { const message = createBaseMsgStoreCode(); message.sender = object.sender ?? ""; message.wasmByteCode = object.wasmByteCode ?? new Uint8Array(); - if (object.instantiatePermission !== undefined && object.instantiatePermission !== null) { - message.instantiatePermission = AccessConfig.fromPartial(object.instantiatePermission); - } + message.instantiatePermission = object.instantiatePermission !== undefined && object.instantiatePermission !== null ? AccessConfig.fromPartial(object.instantiatePermission) : undefined; return message; }, fromSDK(object: MsgStoreCodeSDKType): MsgStoreCode { @@ -352,7 +400,7 @@ function createBaseMsgStoreCodeResponse(): MsgStoreCodeResponse { export const MsgStoreCodeResponse = { typeUrl: "/cosmwasm.wasm.v1.MsgStoreCodeResponse", encode(message: MsgStoreCodeResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.codeId !== undefined) { + if (message.codeId !== BigInt(0)) { writer.uint32(8).uint64(message.codeId); } return writer; @@ -375,9 +423,9 @@ export const MsgStoreCodeResponse = { return message; }, fromJSON(object: any): MsgStoreCodeResponse { - const obj = createBaseMsgStoreCodeResponse(); - if (isSet(object.codeId)) obj.codeId = BigInt(object.codeId.toString()); - return obj; + return { + codeId: isSet(object.codeId) ? BigInt(object.codeId.toString()) : BigInt(0) + }; }, toJSON(message: MsgStoreCodeResponse): JsonSafe<MsgStoreCodeResponse> { const obj: any = {}; @@ -386,9 +434,7 @@ export const MsgStoreCodeResponse = { }, fromPartial(object: DeepPartial<MsgStoreCodeResponse>): MsgStoreCodeResponse { const message = createBaseMsgStoreCodeResponse(); - if (object.codeId !== undefined && object.codeId !== null) { - message.codeId = BigInt(object.codeId.toString()); - } + message.codeId = object.codeId !== undefined && object.codeId !== null ? BigInt(object.codeId.toString()) : BigInt(0); return message; }, fromSDK(object: MsgStoreCodeResponseSDKType): MsgStoreCodeResponse { @@ -453,16 +499,16 @@ function createBaseMsgInstantiateContract(): MsgInstantiateContract { export const MsgInstantiateContract = { typeUrl: "/cosmwasm.wasm.v1.MsgInstantiateContract", encode(message: MsgInstantiateContract, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.sender !== undefined) { + if (message.sender !== "") { writer.uint32(10).string(message.sender); } - if (message.admin !== undefined) { + if (message.admin !== "") { writer.uint32(18).string(message.admin); } - if (message.codeId !== undefined) { + if (message.codeId !== BigInt(0)) { writer.uint32(24).uint64(message.codeId); } - if (message.label !== undefined) { + if (message.label !== "") { writer.uint32(34).string(message.label); } if (message.msg.length !== 0) { @@ -506,14 +552,14 @@ export const MsgInstantiateContract = { return message; }, fromJSON(object: any): MsgInstantiateContract { - 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; + 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)) : [] + }; }, toJSON(message: MsgInstantiateContract): JsonSafe<MsgInstantiateContract> { const obj: any = {}; @@ -533,9 +579,7 @@ export const MsgInstantiateContract = { const message = createBaseMsgInstantiateContract(); message.sender = object.sender ?? ""; message.admin = object.admin ?? ""; - if (object.codeId !== undefined && object.codeId !== null) { - message.codeId = BigInt(object.codeId.toString()); - } + message.codeId = object.codeId !== undefined && object.codeId !== null ? BigInt(object.codeId.toString()) : BigInt(0); message.label = object.label ?? ""; message.msg = object.msg ?? new Uint8Array(); message.funds = object.funds?.map(e => Coin.fromPartial(e)) || []; @@ -640,7 +684,7 @@ function createBaseMsgInstantiateContractResponse(): MsgInstantiateContractRespo export const MsgInstantiateContractResponse = { typeUrl: "/cosmwasm.wasm.v1.MsgInstantiateContractResponse", encode(message: MsgInstantiateContractResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.address !== undefined) { + if (message.address !== "") { writer.uint32(10).string(message.address); } if (message.data.length !== 0) { @@ -669,10 +713,10 @@ export const MsgInstantiateContractResponse = { return message; }, fromJSON(object: any): MsgInstantiateContractResponse { - const obj = createBaseMsgInstantiateContractResponse(); - if (isSet(object.address)) obj.address = String(object.address); - if (isSet(object.data)) obj.data = bytesFromBase64(object.data); - return obj; + return { + address: isSet(object.address) ? String(object.address) : "", + data: isSet(object.data) ? bytesFromBase64(object.data) : new Uint8Array() + }; }, toJSON(message: MsgInstantiateContractResponse): JsonSafe<MsgInstantiateContractResponse> { const obj: any = {}; @@ -753,10 +797,10 @@ function createBaseMsgExecuteContract(): MsgExecuteContract { export const MsgExecuteContract = { typeUrl: "/cosmwasm.wasm.v1.MsgExecuteContract", encode(message: MsgExecuteContract, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.sender !== undefined) { + if (message.sender !== "") { writer.uint32(10).string(message.sender); } - if (message.contract !== undefined) { + if (message.contract !== "") { writer.uint32(18).string(message.contract); } if (message.msg.length !== 0) { @@ -794,12 +838,12 @@ export const MsgExecuteContract = { return message; }, fromJSON(object: any): MsgExecuteContract { - 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; + 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)) : [] + }; }, toJSON(message: MsgExecuteContract): JsonSafe<MsgExecuteContract> { const obj: any = {}; @@ -928,9 +972,9 @@ export const MsgExecuteContractResponse = { return message; }, fromJSON(object: any): MsgExecuteContractResponse { - const obj = createBaseMsgExecuteContractResponse(); - if (isSet(object.data)) obj.data = bytesFromBase64(object.data); - return obj; + return { + data: isSet(object.data) ? bytesFromBase64(object.data) : new Uint8Array() + }; }, toJSON(message: MsgExecuteContractResponse): JsonSafe<MsgExecuteContractResponse> { const obj: any = {}; @@ -1002,13 +1046,13 @@ function createBaseMsgMigrateContract(): MsgMigrateContract { export const MsgMigrateContract = { typeUrl: "/cosmwasm.wasm.v1.MsgMigrateContract", encode(message: MsgMigrateContract, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.sender !== undefined) { + if (message.sender !== "") { writer.uint32(10).string(message.sender); } - if (message.contract !== undefined) { + if (message.contract !== "") { writer.uint32(18).string(message.contract); } - if (message.codeId !== undefined) { + if (message.codeId !== BigInt(0)) { writer.uint32(24).uint64(message.codeId); } if (message.msg.length !== 0) { @@ -1043,12 +1087,12 @@ export const MsgMigrateContract = { return message; }, fromJSON(object: any): MsgMigrateContract { - 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; + 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() + }; }, toJSON(message: MsgMigrateContract): JsonSafe<MsgMigrateContract> { const obj: any = {}; @@ -1062,9 +1106,7 @@ export const MsgMigrateContract = { const message = createBaseMsgMigrateContract(); message.sender = object.sender ?? ""; message.contract = object.contract ?? ""; - if (object.codeId !== undefined && object.codeId !== null) { - message.codeId = BigInt(object.codeId.toString()); - } + message.codeId = object.codeId !== undefined && object.codeId !== null ? BigInt(object.codeId.toString()) : BigInt(0); message.msg = object.msg ?? new Uint8Array(); return message; }, @@ -1169,9 +1211,9 @@ export const MsgMigrateContractResponse = { return message; }, fromJSON(object: any): MsgMigrateContractResponse { - const obj = createBaseMsgMigrateContractResponse(); - if (isSet(object.data)) obj.data = bytesFromBase64(object.data); - return obj; + return { + data: isSet(object.data) ? bytesFromBase64(object.data) : new Uint8Array() + }; }, toJSON(message: MsgMigrateContractResponse): JsonSafe<MsgMigrateContractResponse> { const obj: any = {}; @@ -1242,13 +1284,13 @@ function createBaseMsgUpdateAdmin(): MsgUpdateAdmin { export const MsgUpdateAdmin = { typeUrl: "/cosmwasm.wasm.v1.MsgUpdateAdmin", encode(message: MsgUpdateAdmin, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.sender !== undefined) { + if (message.sender !== "") { writer.uint32(10).string(message.sender); } - if (message.newAdmin !== undefined) { + if (message.newAdmin !== "") { writer.uint32(18).string(message.newAdmin); } - if (message.contract !== undefined) { + if (message.contract !== "") { writer.uint32(26).string(message.contract); } return writer; @@ -1277,11 +1319,11 @@ export const MsgUpdateAdmin = { return message; }, fromJSON(object: any): MsgUpdateAdmin { - 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; + return { + sender: isSet(object.sender) ? String(object.sender) : "", + newAdmin: isSet(object.newAdmin) ? String(object.newAdmin) : "", + contract: isSet(object.contract) ? String(object.contract) : "" + }; }, toJSON(message: MsgUpdateAdmin): JsonSafe<MsgUpdateAdmin> { const obj: any = {}; @@ -1383,8 +1425,7 @@ export const MsgUpdateAdminResponse = { return message; }, fromJSON(_: any): MsgUpdateAdminResponse { - const obj = createBaseMsgUpdateAdminResponse(); - return obj; + return {}; }, toJSON(_: MsgUpdateAdminResponse): JsonSafe<MsgUpdateAdminResponse> { const obj: any = {}; @@ -1443,10 +1484,10 @@ function createBaseMsgClearAdmin(): MsgClearAdmin { export const MsgClearAdmin = { typeUrl: "/cosmwasm.wasm.v1.MsgClearAdmin", encode(message: MsgClearAdmin, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.sender !== undefined) { + if (message.sender !== "") { writer.uint32(10).string(message.sender); } - if (message.contract !== undefined) { + if (message.contract !== "") { writer.uint32(26).string(message.contract); } return writer; @@ -1472,10 +1513,10 @@ export const MsgClearAdmin = { return message; }, fromJSON(object: any): MsgClearAdmin { - const obj = createBaseMsgClearAdmin(); - if (isSet(object.sender)) obj.sender = String(object.sender); - if (isSet(object.contract)) obj.contract = String(object.contract); - return obj; + return { + sender: isSet(object.sender) ? String(object.sender) : "", + contract: isSet(object.contract) ? String(object.contract) : "" + }; }, toJSON(message: MsgClearAdmin): JsonSafe<MsgClearAdmin> { const obj: any = {}; @@ -1568,8 +1609,7 @@ export const MsgClearAdminResponse = { return message; }, fromJSON(_: any): MsgClearAdminResponse { - const obj = createBaseMsgClearAdminResponse(); - return obj; + return {}; }, toJSON(_: MsgClearAdminResponse): JsonSafe<MsgClearAdminResponse> { 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 2bc908fd64..28a9a8f3ec 100644 --- a/__fixtures__/v-next/outputv4/cosmwasm/wasm/v1/types.ts +++ b/__fixtures__/v-next/outputv4/cosmwasm/wasm/v1/types.ts @@ -1,8 +1,9 @@ -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 { Any, AnySDKType } from "../../../google/protobuf/any"; +import { BinaryReader, BinaryWriter } from "../../../binary"; +import { isSet, DeepPartial, bytesFromBase64, base64FromBytes } from "../../../helpers"; +import { JsonSafe } from "../../../json-safe"; import { toUtf8, fromUtf8 } from "@cosmjs/encoding"; +import { ComputedRef } from "vue"; export const protobufPackage = "cosmwasm.wasm.v1"; /** AccessType permission types */ export enum AccessType { @@ -104,6 +105,9 @@ export function contractCodeHistoryOperationTypeToJSON(object: ContractCodeHisto export interface AccessTypeParam { value: AccessType; } +export interface ReactiveAccessTypeParam { + value: ComputedRef<AccessType>; +} export interface AccessTypeParamProtoMsg { typeUrl: "/cosmwasm.wasm.v1.AccessTypeParam"; value: Uint8Array; @@ -117,6 +121,10 @@ export interface AccessConfig { permission: AccessType; address: string; } +export interface ReactiveAccessConfig { + permission: ComputedRef<AccessType>; + address: ComputedRef<string>; +} export interface AccessConfigProtoMsg { typeUrl: "/cosmwasm.wasm.v1.AccessConfig"; value: Uint8Array; @@ -132,6 +140,11 @@ export interface Params { instantiateDefaultPermission: AccessType; maxWasmCodeSize: bigint; } +export interface ReactiveParams { + codeUploadAccess: ComputedRef<AccessConfig>; + instantiateDefaultPermission: ComputedRef<AccessType>; + maxWasmCodeSize: ComputedRef<bigint>; +} export interface ParamsProtoMsg { typeUrl: "/cosmwasm.wasm.v1.Params"; value: Uint8Array; @@ -151,6 +164,11 @@ export interface CodeInfo { /** InstantiateConfig access control to apply on contract creation, optional */ instantiateConfig: AccessConfig; } +export interface ReactiveCodeInfo { + codeHash: ComputedRef<Uint8Array>; + creator: ComputedRef<string>; + instantiateConfig: ComputedRef<AccessConfig>; +} export interface CodeInfoProtoMsg { typeUrl: "/cosmwasm.wasm.v1.CodeInfo"; value: Uint8Array; @@ -184,6 +202,15 @@ export interface ContractInfo { */ extension?: Any; } +export interface ReactiveContractInfo { + codeId: ComputedRef<bigint>; + creator: ComputedRef<string>; + admin: ComputedRef<string>; + label: ComputedRef<string>; + created?: ComputedRef<AbsoluteTxPosition>; + ibcPortId: ComputedRef<string>; + extension?: ComputedRef<Any>; +} export interface ContractInfoProtoMsg { typeUrl: "/cosmwasm.wasm.v1.ContractInfo"; value: Uint8Array; @@ -207,6 +234,12 @@ export interface ContractCodeHistoryEntry { updated?: AbsoluteTxPosition; msg: Uint8Array; } +export interface ReactiveContractCodeHistoryEntry { + operation: ComputedRef<ContractCodeHistoryOperationType>; + codeId: ComputedRef<bigint>; + updated?: ComputedRef<AbsoluteTxPosition>; + msg: ComputedRef<Uint8Array>; +} export interface ContractCodeHistoryEntryProtoMsg { typeUrl: "/cosmwasm.wasm.v1.ContractCodeHistoryEntry"; value: Uint8Array; @@ -231,6 +264,10 @@ export interface AbsoluteTxPosition { */ txIndex: bigint; } +export interface ReactiveAbsoluteTxPosition { + blockHeight: ComputedRef<bigint>; + txIndex: ComputedRef<bigint>; +} export interface AbsoluteTxPositionProtoMsg { typeUrl: "/cosmwasm.wasm.v1.AbsoluteTxPosition"; value: Uint8Array; @@ -250,6 +287,10 @@ export interface Model { /** base64-encode raw value */ value: Uint8Array; } +export interface ReactiveModel { + key: ComputedRef<Uint8Array>; + value: ComputedRef<Uint8Array>; +} export interface ModelProtoMsg { typeUrl: "/cosmwasm.wasm.v1.Model"; value: Uint8Array; @@ -290,9 +331,9 @@ export const AccessTypeParam = { return message; }, fromJSON(object: any): AccessTypeParam { - const obj = createBaseAccessTypeParam(); - if (isSet(object.value)) obj.value = accessTypeFromJSON(object.value); - return obj; + return { + value: isSet(object.value) ? accessTypeFromJSON(object.value) : -1 + }; }, toJSON(message: AccessTypeParam): JsonSafe<AccessTypeParam> { const obj: any = {}; @@ -365,7 +406,7 @@ export const AccessConfig = { if (message.permission !== 0) { writer.uint32(8).int32(message.permission); } - if (message.address !== undefined) { + if (message.address !== "") { writer.uint32(18).string(message.address); } return writer; @@ -391,10 +432,10 @@ export const AccessConfig = { return message; }, fromJSON(object: any): AccessConfig { - const obj = createBaseAccessConfig(); - if (isSet(object.permission)) obj.permission = accessTypeFromJSON(object.permission); - if (isSet(object.address)) obj.address = String(object.address); - return obj; + return { + permission: isSet(object.permission) ? accessTypeFromJSON(object.permission) : -1, + address: isSet(object.address) ? String(object.address) : "" + }; }, toJSON(message: AccessConfig): JsonSafe<AccessConfig> { const obj: any = {}; @@ -480,7 +521,7 @@ export const Params = { if (message.instantiateDefaultPermission !== 0) { writer.uint32(16).int32(message.instantiateDefaultPermission); } - if (message.maxWasmCodeSize !== undefined) { + if (message.maxWasmCodeSize !== BigInt(0)) { writer.uint32(24).uint64(message.maxWasmCodeSize); } return writer; @@ -509,11 +550,11 @@ export const Params = { return message; }, fromJSON(object: any): Params { - 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; + 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) + }; }, toJSON(message: Params): JsonSafe<Params> { const obj: any = {}; @@ -524,13 +565,9 @@ export const Params = { }, fromPartial(object: DeepPartial<Params>): Params { const message = createBaseParams(); - if (object.codeUploadAccess !== undefined && object.codeUploadAccess !== null) { - message.codeUploadAccess = AccessConfig.fromPartial(object.codeUploadAccess); - } + message.codeUploadAccess = object.codeUploadAccess !== undefined && object.codeUploadAccess !== null ? AccessConfig.fromPartial(object.codeUploadAccess) : undefined; message.instantiateDefaultPermission = object.instantiateDefaultPermission ?? 0; - if (object.maxWasmCodeSize !== undefined && object.maxWasmCodeSize !== null) { - message.maxWasmCodeSize = BigInt(object.maxWasmCodeSize.toString()); - } + message.maxWasmCodeSize = object.maxWasmCodeSize !== undefined && object.maxWasmCodeSize !== null ? BigInt(object.maxWasmCodeSize.toString()) : BigInt(0); return message; }, fromSDK(object: ParamsSDKType): Params { @@ -609,7 +646,7 @@ export const CodeInfo = { if (message.codeHash.length !== 0) { writer.uint32(10).bytes(message.codeHash); } - if (message.creator !== undefined) { + if (message.creator !== "") { writer.uint32(18).string(message.creator); } if (message.instantiateConfig !== undefined) { @@ -641,11 +678,11 @@ export const CodeInfo = { return message; }, fromJSON(object: any): CodeInfo { - 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; + 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 + }; }, toJSON(message: CodeInfo): JsonSafe<CodeInfo> { const obj: any = {}; @@ -658,9 +695,7 @@ export const CodeInfo = { const message = createBaseCodeInfo(); message.codeHash = object.codeHash ?? new Uint8Array(); message.creator = object.creator ?? ""; - if (object.instantiateConfig !== undefined && object.instantiateConfig !== null) { - message.instantiateConfig = AccessConfig.fromPartial(object.instantiateConfig); - } + message.instantiateConfig = object.instantiateConfig !== undefined && object.instantiateConfig !== null ? AccessConfig.fromPartial(object.instantiateConfig) : undefined; return message; }, fromSDK(object: CodeInfoSDKType): CodeInfo { @@ -740,22 +775,22 @@ function createBaseContractInfo(): ContractInfo { export const ContractInfo = { typeUrl: "/cosmwasm.wasm.v1.ContractInfo", encode(message: ContractInfo, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.codeId !== undefined) { + if (message.codeId !== BigInt(0)) { writer.uint32(8).uint64(message.codeId); } - if (message.creator !== undefined) { + if (message.creator !== "") { writer.uint32(18).string(message.creator); } - if (message.admin !== undefined) { + if (message.admin !== "") { writer.uint32(26).string(message.admin); } - if (message.label !== undefined) { + if (message.label !== "") { writer.uint32(34).string(message.label); } if (message.created !== undefined) { AbsoluteTxPosition.encode(message.created, writer.uint32(42).fork()).ldelim(); } - if (message.ibcPortId !== undefined) { + if (message.ibcPortId !== "") { writer.uint32(50).string(message.ibcPortId); } if (message.extension !== undefined) { @@ -799,15 +834,15 @@ export const ContractInfo = { return message; }, fromJSON(object: any): ContractInfo { - 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; + 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 + }; }, toJSON(message: ContractInfo): JsonSafe<ContractInfo> { const obj: any = {}; @@ -822,19 +857,13 @@ export const ContractInfo = { }, fromPartial(object: DeepPartial<ContractInfo>): ContractInfo { const message = createBaseContractInfo(); - if (object.codeId !== undefined && object.codeId !== null) { - message.codeId = BigInt(object.codeId.toString()); - } + message.codeId = object.codeId !== undefined && object.codeId !== null ? BigInt(object.codeId.toString()) : BigInt(0); message.creator = object.creator ?? ""; message.admin = object.admin ?? ""; message.label = object.label ?? ""; - if (object.created !== undefined && object.created !== null) { - message.created = AbsoluteTxPosition.fromPartial(object.created); - } + message.created = object.created !== undefined && object.created !== null ? AbsoluteTxPosition.fromPartial(object.created) : undefined; message.ibcPortId = object.ibcPortId ?? ""; - if (object.extension !== undefined && object.extension !== null) { - message.extension = Any.fromPartial(object.extension); - } + message.extension = object.extension !== undefined && object.extension !== null ? Any.fromPartial(object.extension) : undefined; return message; }, fromSDK(object: ContractInfoSDKType): ContractInfo { @@ -942,7 +971,7 @@ export const ContractCodeHistoryEntry = { if (message.operation !== 0) { writer.uint32(8).int32(message.operation); } - if (message.codeId !== undefined) { + if (message.codeId !== BigInt(0)) { writer.uint32(16).uint64(message.codeId); } if (message.updated !== undefined) { @@ -980,12 +1009,12 @@ export const ContractCodeHistoryEntry = { return message; }, fromJSON(object: any): ContractCodeHistoryEntry { - 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; + 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() + }; }, toJSON(message: ContractCodeHistoryEntry): JsonSafe<ContractCodeHistoryEntry> { const obj: any = {}; @@ -998,12 +1027,8 @@ export const ContractCodeHistoryEntry = { fromPartial(object: DeepPartial<ContractCodeHistoryEntry>): ContractCodeHistoryEntry { const message = createBaseContractCodeHistoryEntry(); message.operation = object.operation ?? 0; - 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.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; message.msg = object.msg ?? new Uint8Array(); return message; }, @@ -1086,10 +1111,10 @@ function createBaseAbsoluteTxPosition(): AbsoluteTxPosition { export const AbsoluteTxPosition = { typeUrl: "/cosmwasm.wasm.v1.AbsoluteTxPosition", encode(message: AbsoluteTxPosition, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.blockHeight !== undefined) { + if (message.blockHeight !== BigInt(0)) { writer.uint32(8).uint64(message.blockHeight); } - if (message.txIndex !== undefined) { + if (message.txIndex !== BigInt(0)) { writer.uint32(16).uint64(message.txIndex); } return writer; @@ -1115,10 +1140,10 @@ export const AbsoluteTxPosition = { return message; }, fromJSON(object: any): AbsoluteTxPosition { - 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; + return { + blockHeight: isSet(object.blockHeight) ? BigInt(object.blockHeight.toString()) : BigInt(0), + txIndex: isSet(object.txIndex) ? BigInt(object.txIndex.toString()) : BigInt(0) + }; }, toJSON(message: AbsoluteTxPosition): JsonSafe<AbsoluteTxPosition> { const obj: any = {}; @@ -1128,12 +1153,8 @@ export const AbsoluteTxPosition = { }, fromPartial(object: DeepPartial<AbsoluteTxPosition>): AbsoluteTxPosition { const message = createBaseAbsoluteTxPosition(); - 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()); - } + 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); return message; }, fromSDK(object: AbsoluteTxPositionSDKType): AbsoluteTxPosition { @@ -1230,10 +1251,10 @@ export const Model = { return message; }, fromJSON(object: any): Model { - const obj = createBaseModel(); - if (isSet(object.key)) obj.key = bytesFromBase64(object.key); - if (isSet(object.value)) obj.value = bytesFromBase64(object.value); - return obj; + return { + key: isSet(object.key) ? bytesFromBase64(object.key) : new Uint8Array(), + value: isSet(object.value) ? bytesFromBase64(object.value) : new Uint8Array() + }; }, toJSON(message: Model): JsonSafe<Model> { const obj: any = {}; diff --git a/__fixtures__/v-next/outputv4/evmos/bundle.ts b/__fixtures__/v-next/outputv4/evmos/bundle.ts index a56ca08f5e..dcd9102122 100644 --- a/__fixtures__/v-next/outputv4/evmos/bundle.ts +++ b/__fixtures__/v-next/outputv4/evmos/bundle.ts @@ -1,148 +1,146 @@ -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"; +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"; export namespace evmos { export namespace claims { - export const v1 = { - ..._153, - ..._154, - ..._155, - ..._445, - ..._453 - }; - } - export namespace epochs { export const v1 = { ..._156, ..._157, - ..._446, - ..._454 + ..._158, + ..._496, + ..._504 }; } - export namespace erc20 { + export namespace epochs { export const v1 = { - ..._158, ..._159, ..._160, - ..._161, - ..._439, - ..._442, - ..._447, - ..._455, - ..._461, - ..._464 + ..._497, + ..._505 }; } - export namespace fees { + export namespace erc20 { export const v1 = { + ..._161, ..._162, ..._163, ..._164, - ..._165, - ..._440, - ..._443, - ..._448, - ..._456, - ..._462 + ..._490, + ..._493, + ..._498, + ..._506, + ..._512 }; } - export namespace incentives { + export namespace fees { export const v1 = { + ..._165, ..._166, ..._167, ..._168, - ..._449, - ..._457 + ..._491, + ..._494, + ..._499, + ..._507, + ..._513 }; } - export namespace inflation { + export namespace incentives { export const v1 = { ..._169, ..._170, ..._171, - ..._450, - ..._458 + ..._500, + ..._508 }; } - export namespace recovery { + export namespace inflation { export const v1 = { ..._172, ..._173, - ..._451, - ..._459 + ..._174, + ..._501, + ..._509 }; } - export namespace vesting { + export namespace recovery { export const v1 = { - ..._174, ..._175, ..._176, - ..._441, - ..._444, - ..._452, - ..._460, - ..._463 + ..._502, + ..._510 + }; + } + export namespace vesting { + export const v1 = { + ..._177, + ..._178, + ..._179, + ..._492, + ..._495, + ..._503, + ..._511, + ..._514 }; } export const ClientFactory = { - ..._547, - ..._548, - ..._549, - ..._550, - ..._551, - ..._552 + ..._631, + ..._632, + ..._633, + ..._634, + ..._635, + ..._636 }; } \ 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 4bc258e731..7fc598de5d 100644 --- a/__fixtures__/v-next/outputv4/evmos/claims/v1/claims.ts +++ b/__fixtures__/v-next/outputv4/evmos/claims/v1/claims.ts @@ -1,6 +1,7 @@ -import { BinaryReader, BinaryWriter } from "../../../binary.js"; -import { isSet, DeepPartial } from "../../../helpers.js"; -import { JsonSafe } from "../../../json-safe.js"; +import { BinaryReader, BinaryWriter } from "../../../binary"; +import { isSet, DeepPartial } from "../../../helpers"; +import { JsonSafe } from "../../../json-safe"; +import { ComputedRef } from "vue"; export const protobufPackage = "evmos.claims.v1"; /** Action defines the list of available actions to claim the airdrop tokens. */ export enum Action { @@ -69,6 +70,11 @@ export interface Claim { /** claimable token amount for the action. Zero if completed */ claimableAmount: string; } +export interface ReactiveClaim { + action: ComputedRef<Action>; + completed: ComputedRef<boolean>; + claimableAmount: ComputedRef<string>; +} export interface ClaimProtoMsg { typeUrl: "/evmos.claims.v1.Claim"; value: Uint8Array; @@ -91,6 +97,11 @@ export interface ClaimsRecordAddress { /** slice of the available actions completed */ actionsCompleted: boolean[]; } +export interface ReactiveClaimsRecordAddress { + address: ComputedRef<string>; + initialClaimableAmount: ComputedRef<string>; + actionsCompleted: ComputedRef<boolean[]>; +} export interface ClaimsRecordAddressProtoMsg { typeUrl: "/evmos.claims.v1.ClaimsRecordAddress"; value: Uint8Array; @@ -111,6 +122,10 @@ export interface ClaimsRecord { /** slice of the available actions completed */ actionsCompleted: boolean[]; } +export interface ReactiveClaimsRecord { + initialClaimableAmount: ComputedRef<string>; + actionsCompleted: ComputedRef<boolean[]>; +} export interface ClaimsRecordProtoMsg { typeUrl: "/evmos.claims.v1.ClaimsRecord"; value: Uint8Array; @@ -136,10 +151,10 @@ export const Claim = { if (message.action !== 0) { writer.uint32(8).int32(message.action); } - if (message.completed !== undefined) { + if (message.completed === true) { writer.uint32(16).bool(message.completed); } - if (message.claimableAmount !== undefined) { + if (message.claimableAmount !== "") { writer.uint32(26).string(message.claimableAmount); } return writer; @@ -168,11 +183,11 @@ export const Claim = { return message; }, fromJSON(object: any): Claim { - 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; + return { + action: isSet(object.action) ? actionFromJSON(object.action) : -1, + completed: isSet(object.completed) ? Boolean(object.completed) : false, + claimableAmount: isSet(object.claimableAmount) ? String(object.claimableAmount) : "" + }; }, toJSON(message: Claim): JsonSafe<Claim> { const obj: any = {}; @@ -255,10 +270,10 @@ function createBaseClaimsRecordAddress(): ClaimsRecordAddress { export const ClaimsRecordAddress = { typeUrl: "/evmos.claims.v1.ClaimsRecordAddress", encode(message: ClaimsRecordAddress, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.address !== undefined) { + if (message.address !== "") { writer.uint32(10).string(message.address); } - if (message.initialClaimableAmount !== undefined) { + if (message.initialClaimableAmount !== "") { writer.uint32(18).string(message.initialClaimableAmount); } writer.uint32(26).fork(); @@ -299,11 +314,11 @@ export const ClaimsRecordAddress = { return message; }, fromJSON(object: any): ClaimsRecordAddress { - 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; + 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)) : [] + }; }, toJSON(message: ClaimsRecordAddress): JsonSafe<ClaimsRecordAddress> { const obj: any = {}; @@ -395,7 +410,7 @@ function createBaseClaimsRecord(): ClaimsRecord { export const ClaimsRecord = { typeUrl: "/evmos.claims.v1.ClaimsRecord", encode(message: ClaimsRecord, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.initialClaimableAmount !== undefined) { + if (message.initialClaimableAmount !== "") { writer.uint32(10).string(message.initialClaimableAmount); } writer.uint32(18).fork(); @@ -433,10 +448,10 @@ export const ClaimsRecord = { return message; }, fromJSON(object: any): ClaimsRecord { - 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; + return { + initialClaimableAmount: isSet(object.initialClaimableAmount) ? String(object.initialClaimableAmount) : "", + actionsCompleted: Array.isArray(object?.actionsCompleted) ? object.actionsCompleted.map((e: any) => Boolean(e)) : [] + }; }, toJSON(message: ClaimsRecord): JsonSafe<ClaimsRecord> { 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 df1fc00863..e221dec7e5 100644 --- a/__fixtures__/v-next/outputv4/evmos/claims/v1/genesis.ts +++ b/__fixtures__/v-next/outputv4/evmos/claims/v1/genesis.ts @@ -1,9 +1,10 @@ -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"; +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"; export const protobufPackage = "evmos.claims.v1"; /** GenesisState define the claims module's genesis state. */ export interface GenesisState { @@ -12,6 +13,10 @@ export interface GenesisState { /** list of claim records with the corresponding airdrop recipient */ claimsRecords: ClaimsRecordAddress[]; } +export interface ReactiveGenesisState { + params: ComputedRef<Params>; + claimsRecords: ComputedRef<ClaimsRecordAddress[]>; +} export interface GenesisStateProtoMsg { typeUrl: "/evmos.claims.v1.GenesisState"; value: Uint8Array; @@ -41,6 +46,15 @@ export interface Params { /** list of channel identifiers from EVM compatible chains */ evmChannels: string[]; } +export interface ReactiveParams { + enableClaims: ComputedRef<boolean>; + airdropStartTime: ComputedRef<Date>; + durationUntilDecay: ComputedRef<Duration>; + durationOfDecay: ComputedRef<Duration>; + claimsDenom: ComputedRef<string>; + authorizedChannels: ComputedRef<string[]>; + evmChannels: ComputedRef<string[]>; +} export interface ParamsProtoMsg { typeUrl: "/evmos.claims.v1.Params"; value: Uint8Array; @@ -93,10 +107,10 @@ export const GenesisState = { return message; }, fromJSON(object: any): GenesisState { - 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; + return { + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + claimsRecords: Array.isArray(object?.claimsRecords) ? object.claimsRecords.map((e: any) => ClaimsRecordAddress.fromJSON(e)) : [] + }; }, toJSON(message: GenesisState): JsonSafe<GenesisState> { const obj: any = {}; @@ -110,9 +124,7 @@ export const GenesisState = { }, fromPartial(object: DeepPartial<GenesisState>): GenesisState { const message = createBaseGenesisState(); - if (object.params !== undefined && object.params !== null) { - message.params = Params.fromPartial(object.params); - } + message.params = object.params !== undefined && object.params !== null ? Params.fromPartial(object.params) : undefined; message.claimsRecords = object.claimsRecords?.map(e => ClaimsRecordAddress.fromPartial(e)) || []; return message; }, @@ -186,7 +198,7 @@ function createBaseParams(): Params { export const Params = { typeUrl: "/evmos.claims.v1.Params", encode(message: Params, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.enableClaims !== undefined) { + if (message.enableClaims === true) { writer.uint32(8).bool(message.enableClaims); } if (message.airdropStartTime !== undefined) { @@ -198,7 +210,7 @@ export const Params = { if (message.durationOfDecay !== undefined) { Duration.encode(message.durationOfDecay, writer.uint32(34).fork()).ldelim(); } - if (message.claimsDenom !== undefined) { + if (message.claimsDenom !== "") { writer.uint32(42).string(message.claimsDenom); } for (const v of message.authorizedChannels) { @@ -245,15 +257,15 @@ export const Params = { return message; }, fromJSON(object: any): Params { - 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; + 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)) : [] + }; }, toJSON(message: Params): JsonSafe<Params> { const obj: any = {}; @@ -278,12 +290,8 @@ export const Params = { const message = createBaseParams(); message.enableClaims = object.enableClaims ?? false; message.airdropStartTime = object.airdropStartTime ?? 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.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; 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 5fe187bd48..94fa0ada95 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.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 { 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 { LCDClient } from "@cosmology/lcd"; -import { QueryTotalUnclaimedRequest, QueryTotalUnclaimedRequestSDKType, QueryTotalUnclaimedResponse, QueryTotalUnclaimedResponseSDKType, QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType, QueryClaimsRecordsRequest, QueryClaimsRecordsRequestSDKType, QueryClaimsRecordsResponse, QueryClaimsRecordsResponseSDKType, QueryClaimsRecordRequest, QueryClaimsRecordRequestSDKType, QueryClaimsRecordResponse, QueryClaimsRecordResponseSDKType } from "./query.js"; +import { QueryTotalUnclaimedRequest, QueryTotalUnclaimedRequestSDKType, QueryTotalUnclaimedResponse, QueryTotalUnclaimedResponseSDKType, QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType, QueryClaimsRecordsRequest, QueryClaimsRecordsRequestSDKType, QueryClaimsRecordsResponse, QueryClaimsRecordsResponseSDKType, QueryClaimsRecordRequest, QueryClaimsRecordRequestSDKType, QueryClaimsRecordResponse, QueryClaimsRecordResponseSDKType } from "./query"; export class LCDQueryClient { req: LCDClient; constructor({ @@ -30,7 +30,7 @@ export class LCDQueryClient { } /* ClaimsRecords returns all claims records */ async claimsRecords(params: QueryClaimsRecordsRequest = { - pagination: PageRequest.fromPartial({}) + pagination: undefined }): Promise<QueryClaimsRecordsResponseSDKType> { 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 d477a713d7..9505ab0052 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.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 { 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 { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; -import { QueryTotalUnclaimedRequest, QueryTotalUnclaimedRequestSDKType, QueryTotalUnclaimedResponse, QueryTotalUnclaimedResponseSDKType, QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType, QueryClaimsRecordsRequest, QueryClaimsRecordsRequestSDKType, QueryClaimsRecordsResponse, QueryClaimsRecordsResponseSDKType, QueryClaimsRecordRequest, QueryClaimsRecordRequestSDKType, QueryClaimsRecordResponse, QueryClaimsRecordResponseSDKType } from "./query.js"; +import { QueryTotalUnclaimedRequest, QueryTotalUnclaimedRequestSDKType, QueryTotalUnclaimedResponse, QueryTotalUnclaimedResponseSDKType, QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType, QueryClaimsRecordsRequest, QueryClaimsRecordsRequestSDKType, QueryClaimsRecordsResponse, QueryClaimsRecordsResponseSDKType, QueryClaimsRecordRequest, QueryClaimsRecordRequestSDKType, QueryClaimsRecordResponse, QueryClaimsRecordResponseSDKType, ReactiveQueryTotalUnclaimedRequest, ReactiveQueryParamsRequest, ReactiveQueryClaimsRecordsRequest, ReactiveQueryClaimsRecordRequest } from "./query"; /** 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: PageRequest.fromPartial({}) + pagination: undefined }): Promise<QueryClaimsRecordsResponse> { 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 c79acec275..6b890f4142 100644 --- a/__fixtures__/v-next/outputv4/evmos/claims/v1/query.ts +++ b/__fixtures__/v-next/outputv4/evmos/claims/v1/query.ts @@ -1,16 +1,18 @@ -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"; +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"; 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; @@ -28,6 +30,9 @@ export interface QueryTotalUnclaimedResponse { /** coins defines the unclaimed coins */ coins: Coin[]; } +export interface ReactiveQueryTotalUnclaimedResponse { + coins: ComputedRef<Coin[]>; +} export interface QueryTotalUnclaimedResponseProtoMsg { typeUrl: "/evmos.claims.v1.QueryTotalUnclaimedResponse"; value: Uint8Array; @@ -41,6 +46,7 @@ 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; @@ -52,6 +58,9 @@ export interface QueryParamsResponse { /** params defines the parameters of the module. */ params: Params; } +export interface ReactiveQueryParamsResponse { + params: ComputedRef<Params>; +} export interface QueryParamsResponseProtoMsg { typeUrl: "/evmos.claims.v1.QueryParamsResponse"; value: Uint8Array; @@ -68,6 +77,9 @@ export interface QueryClaimsRecordsRequest { /** pagination defines an optional pagination for the request. */ pagination?: PageRequest; } +export interface ReactiveQueryClaimsRecordsRequest { + pagination?: ComputedRef<PageRequest>; +} export interface QueryClaimsRecordsRequestProtoMsg { typeUrl: "/evmos.claims.v1.QueryClaimsRecordsRequest"; value: Uint8Array; @@ -89,6 +101,10 @@ export interface QueryClaimsRecordsResponse { /** pagination defines the pagination in the response. */ pagination?: PageResponse; } +export interface ReactiveQueryClaimsRecordsResponse { + claims: ComputedRef<ClaimsRecordAddress[]>; + pagination?: ComputedRef<PageResponse>; +} export interface QueryClaimsRecordsResponseProtoMsg { typeUrl: "/evmos.claims.v1.QueryClaimsRecordsResponse"; value: Uint8Array; @@ -109,6 +125,9 @@ export interface QueryClaimsRecordRequest { /** address defines the user to query claims record for */ address: string; } +export interface ReactiveQueryClaimsRecordRequest { + address: ComputedRef<string>; +} export interface QueryClaimsRecordRequestProtoMsg { typeUrl: "/evmos.claims.v1.QueryClaimsRecordRequest"; value: Uint8Array; @@ -130,6 +149,10 @@ export interface QueryClaimsRecordResponse { /** the claims of the user */ claims: Claim[]; } +export interface ReactiveQueryClaimsRecordResponse { + initialClaimableAmount: ComputedRef<string>; + claims: ComputedRef<Claim[]>; +} export interface QueryClaimsRecordResponseProtoMsg { typeUrl: "/evmos.claims.v1.QueryClaimsRecordResponse"; value: Uint8Array; @@ -165,8 +188,7 @@ export const QueryTotalUnclaimedRequest = { return message; }, fromJSON(_: any): QueryTotalUnclaimedRequest { - const obj = createBaseQueryTotalUnclaimedRequest(); - return obj; + return {}; }, toJSON(_: QueryTotalUnclaimedRequest): JsonSafe<QueryTotalUnclaimedRequest> { const obj: any = {}; @@ -241,9 +263,9 @@ export const QueryTotalUnclaimedResponse = { return message; }, fromJSON(object: any): QueryTotalUnclaimedResponse { - const obj = createBaseQueryTotalUnclaimedResponse(); - if (Array.isArray(object?.coins)) obj.coins = object.coins.map((e: any) => Coin.fromJSON(e)); - return obj; + return { + coins: Array.isArray(object?.coins) ? object.coins.map((e: any) => Coin.fromJSON(e)) : [] + }; }, toJSON(message: QueryTotalUnclaimedResponse): JsonSafe<QueryTotalUnclaimedResponse> { const obj: any = {}; @@ -331,8 +353,7 @@ export const QueryParamsRequest = { return message; }, fromJSON(_: any): QueryParamsRequest { - const obj = createBaseQueryParamsRequest(); - return obj; + return {}; }, toJSON(_: QueryParamsRequest): JsonSafe<QueryParamsRequest> { const obj: any = {}; @@ -407,9 +428,9 @@ export const QueryParamsResponse = { return message; }, fromJSON(object: any): QueryParamsResponse { - const obj = createBaseQueryParamsResponse(); - if (isSet(object.params)) obj.params = Params.fromJSON(object.params); - return obj; + return { + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined + }; }, toJSON(message: QueryParamsResponse): JsonSafe<QueryParamsResponse> { const obj: any = {}; @@ -418,9 +439,7 @@ export const QueryParamsResponse = { }, fromPartial(object: DeepPartial<QueryParamsResponse>): QueryParamsResponse { const message = createBaseQueryParamsResponse(); - if (object.params !== undefined && object.params !== null) { - message.params = Params.fromPartial(object.params); - } + message.params = object.params !== undefined && object.params !== null ? Params.fromPartial(object.params) : undefined; return message; }, fromSDK(object: QueryParamsResponseSDKType): QueryParamsResponse { @@ -497,9 +516,9 @@ export const QueryClaimsRecordsRequest = { return message; }, fromJSON(object: any): QueryClaimsRecordsRequest { - const obj = createBaseQueryClaimsRecordsRequest(); - if (isSet(object.pagination)) obj.pagination = PageRequest.fromJSON(object.pagination); - return obj; + return { + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined + }; }, toJSON(message: QueryClaimsRecordsRequest): JsonSafe<QueryClaimsRecordsRequest> { const obj: any = {}; @@ -508,9 +527,7 @@ export const QueryClaimsRecordsRequest = { }, fromPartial(object: DeepPartial<QueryClaimsRecordsRequest>): QueryClaimsRecordsRequest { const message = createBaseQueryClaimsRecordsRequest(); - if (object.pagination !== undefined && object.pagination !== null) { - message.pagination = PageRequest.fromPartial(object.pagination); - } + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageRequest.fromPartial(object.pagination) : undefined; return message; }, fromSDK(object: QueryClaimsRecordsRequestSDKType): QueryClaimsRecordsRequest { @@ -594,10 +611,10 @@ export const QueryClaimsRecordsResponse = { return message; }, fromJSON(object: any): QueryClaimsRecordsResponse { - 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; + return { + claims: Array.isArray(object?.claims) ? object.claims.map((e: any) => ClaimsRecordAddress.fromJSON(e)) : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined + }; }, toJSON(message: QueryClaimsRecordsResponse): JsonSafe<QueryClaimsRecordsResponse> { const obj: any = {}; @@ -612,9 +629,7 @@ export const QueryClaimsRecordsResponse = { fromPartial(object: DeepPartial<QueryClaimsRecordsResponse>): QueryClaimsRecordsResponse { const message = createBaseQueryClaimsRecordsResponse(); message.claims = object.claims?.map(e => ClaimsRecordAddress.fromPartial(e)) || []; - if (object.pagination !== undefined && object.pagination !== null) { - message.pagination = PageResponse.fromPartial(object.pagination); - } + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageResponse.fromPartial(object.pagination) : undefined; return message; }, fromSDK(object: QueryClaimsRecordsResponseSDKType): QueryClaimsRecordsResponse { @@ -681,7 +696,7 @@ function createBaseQueryClaimsRecordRequest(): QueryClaimsRecordRequest { export const QueryClaimsRecordRequest = { typeUrl: "/evmos.claims.v1.QueryClaimsRecordRequest", encode(message: QueryClaimsRecordRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.address !== undefined) { + if (message.address !== "") { writer.uint32(10).string(message.address); } return writer; @@ -704,9 +719,9 @@ export const QueryClaimsRecordRequest = { return message; }, fromJSON(object: any): QueryClaimsRecordRequest { - const obj = createBaseQueryClaimsRecordRequest(); - if (isSet(object.address)) obj.address = String(object.address); - return obj; + return { + address: isSet(object.address) ? String(object.address) : "" + }; }, toJSON(message: QueryClaimsRecordRequest): JsonSafe<QueryClaimsRecordRequest> { const obj: any = {}; @@ -770,7 +785,7 @@ function createBaseQueryClaimsRecordResponse(): QueryClaimsRecordResponse { export const QueryClaimsRecordResponse = { typeUrl: "/evmos.claims.v1.QueryClaimsRecordResponse", encode(message: QueryClaimsRecordResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.initialClaimableAmount !== undefined) { + if (message.initialClaimableAmount !== "") { writer.uint32(10).string(message.initialClaimableAmount); } for (const v of message.claims) { @@ -799,10 +814,10 @@ export const QueryClaimsRecordResponse = { return message; }, fromJSON(object: any): QueryClaimsRecordResponse { - 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; + return { + initialClaimableAmount: isSet(object.initialClaimableAmount) ? String(object.initialClaimableAmount) : "", + claims: Array.isArray(object?.claims) ? object.claims.map((e: any) => Claim.fromJSON(e)) : [] + }; }, toJSON(message: QueryClaimsRecordResponse): JsonSafe<QueryClaimsRecordResponse> { const obj: any = {}; diff --git a/__fixtures__/v-next/outputv4/evmos/client.ts b/__fixtures__/v-next/outputv4/evmos/client.ts index f1a4c88c94..6b935a4a1d 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.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"; +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"; 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 7bb574f8bd..deabfccaf9 100644 --- a/__fixtures__/v-next/outputv4/evmos/epochs/v1/genesis.ts +++ b/__fixtures__/v-next/outputv4/evmos/epochs/v1/genesis.ts @@ -1,8 +1,9 @@ -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"; +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"; export const protobufPackage = "evmos.epochs.v1"; export interface EpochInfo { identifier: string; @@ -13,6 +14,15 @@ export interface EpochInfo { epochCountingStarted: boolean; currentEpochStartHeight: bigint; } +export interface ReactiveEpochInfo { + identifier: ComputedRef<string>; + startTime: ComputedRef<Date>; + duration: ComputedRef<Duration>; + currentEpoch: ComputedRef<bigint>; + currentEpochStartTime: ComputedRef<Date>; + epochCountingStarted: ComputedRef<boolean>; + currentEpochStartHeight: ComputedRef<bigint>; +} export interface EpochInfoProtoMsg { typeUrl: "/evmos.epochs.v1.EpochInfo"; value: Uint8Array; @@ -30,6 +40,9 @@ export interface EpochInfoSDKType { export interface GenesisState { epochs: EpochInfo[]; } +export interface ReactiveGenesisState { + epochs: ComputedRef<EpochInfo[]>; +} export interface GenesisStateProtoMsg { typeUrl: "/evmos.epochs.v1.GenesisState"; value: Uint8Array; @@ -52,7 +65,7 @@ function createBaseEpochInfo(): EpochInfo { export const EpochInfo = { typeUrl: "/evmos.epochs.v1.EpochInfo", encode(message: EpochInfo, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.identifier !== undefined) { + if (message.identifier !== "") { writer.uint32(10).string(message.identifier); } if (message.startTime !== undefined) { @@ -61,16 +74,16 @@ export const EpochInfo = { if (message.duration !== undefined) { Duration.encode(message.duration, writer.uint32(26).fork()).ldelim(); } - if (message.currentEpoch !== undefined) { + if (message.currentEpoch !== BigInt(0)) { writer.uint32(32).int64(message.currentEpoch); } if (message.currentEpochStartTime !== undefined) { Timestamp.encode(toTimestamp(message.currentEpochStartTime), writer.uint32(42).fork()).ldelim(); } - if (message.epochCountingStarted !== undefined) { + if (message.epochCountingStarted === true) { writer.uint32(48).bool(message.epochCountingStarted); } - if (message.currentEpochStartHeight !== undefined) { + if (message.currentEpochStartHeight !== BigInt(0)) { writer.uint32(56).int64(message.currentEpochStartHeight); } return writer; @@ -111,15 +124,15 @@ export const EpochInfo = { return message; }, fromJSON(object: any): EpochInfo { - 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; + 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) + }; }, toJSON(message: EpochInfo): JsonSafe<EpochInfo> { const obj: any = {}; @@ -136,17 +149,11 @@ export const EpochInfo = { const message = createBaseEpochInfo(); message.identifier = object.identifier ?? ""; message.startTime = object.startTime ?? undefined; - 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.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); message.currentEpochStartTime = object.currentEpochStartTime ?? undefined; message.epochCountingStarted = object.epochCountingStarted ?? false; - if (object.currentEpochStartHeight !== undefined && object.currentEpochStartHeight !== null) { - message.currentEpochStartHeight = BigInt(object.currentEpochStartHeight.toString()); - } + message.currentEpochStartHeight = object.currentEpochStartHeight !== undefined && object.currentEpochStartHeight !== null ? BigInt(object.currentEpochStartHeight.toString()) : BigInt(0); return message; }, fromSDK(object: EpochInfoSDKType): EpochInfo { @@ -265,9 +272,9 @@ export const GenesisState = { return message; }, fromJSON(object: any): GenesisState { - const obj = createBaseGenesisState(); - if (Array.isArray(object?.epochs)) obj.epochs = object.epochs.map((e: any) => EpochInfo.fromJSON(e)); - return obj; + return { + epochs: Array.isArray(object?.epochs) ? object.epochs.map((e: any) => EpochInfo.fromJSON(e)) : [] + }; }, toJSON(message: GenesisState): JsonSafe<GenesisState> { 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 adae7a040b..5f039c08b0 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.js"; -import { EpochInfo, EpochInfoSDKType } from "./genesis.js"; -import { setPaginationParams } from "../../../helpers.js"; +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../../cosmos/base/query/v1beta1/pagination"; +import { EpochInfo, EpochInfoSDKType } from "./genesis"; +import { setPaginationParams } from "../../../helpers"; import { LCDClient } from "@cosmology/lcd"; -import { QueryEpochsInfoRequest, QueryEpochsInfoRequestSDKType, QueryEpochsInfoResponse, QueryEpochsInfoResponseSDKType, QueryCurrentEpochRequest, QueryCurrentEpochRequestSDKType, QueryCurrentEpochResponse, QueryCurrentEpochResponseSDKType } from "./query.js"; +import { QueryEpochsInfoRequest, QueryEpochsInfoRequestSDKType, QueryEpochsInfoResponse, QueryEpochsInfoResponseSDKType, QueryCurrentEpochRequest, QueryCurrentEpochRequestSDKType, QueryCurrentEpochResponse, QueryCurrentEpochResponseSDKType } from "./query"; export class LCDQueryClient { req: LCDClient; constructor({ @@ -16,7 +16,7 @@ export class LCDQueryClient { } /* EpochInfos provide running epochInfos */ async epochInfos(params: QueryEpochsInfoRequest = { - pagination: PageRequest.fromPartial({}) + pagination: undefined }): Promise<QueryEpochsInfoResponseSDKType> { 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 fce4616b32..ff0ee5ddac 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.js"; -import { EpochInfo, EpochInfoSDKType } from "./genesis.js"; -import { Rpc } from "../../../helpers.js"; -import { BinaryReader } from "../../../binary.js"; +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 { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; -import { QueryEpochsInfoRequest, QueryEpochsInfoRequestSDKType, QueryEpochsInfoResponse, QueryEpochsInfoResponseSDKType, QueryCurrentEpochRequest, QueryCurrentEpochRequestSDKType, QueryCurrentEpochResponse, QueryCurrentEpochResponseSDKType } from "./query.js"; +import { QueryEpochsInfoRequest, QueryEpochsInfoRequestSDKType, QueryEpochsInfoResponse, QueryEpochsInfoResponseSDKType, QueryCurrentEpochRequest, QueryCurrentEpochRequestSDKType, QueryCurrentEpochResponse, QueryCurrentEpochResponseSDKType, ReactiveQueryEpochsInfoRequest, ReactiveQueryCurrentEpochRequest } from "./query"; /** 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: PageRequest.fromPartial({}) + pagination: undefined }): Promise<QueryEpochsInfoResponse> { 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 1c985d7ede..524bfe4a72 100644 --- a/__fixtures__/v-next/outputv4/evmos/epochs/v1/query.ts +++ b/__fixtures__/v-next/outputv4/evmos/epochs/v1/query.ts @@ -1,12 +1,16 @@ -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"; +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"; export const protobufPackage = "evmos.epochs.v1"; export interface QueryEpochsInfoRequest { pagination?: PageRequest; } +export interface ReactiveQueryEpochsInfoRequest { + pagination?: ComputedRef<PageRequest>; +} export interface QueryEpochsInfoRequestProtoMsg { typeUrl: "/evmos.epochs.v1.QueryEpochsInfoRequest"; value: Uint8Array; @@ -18,6 +22,10 @@ export interface QueryEpochsInfoResponse { epochs: EpochInfo[]; pagination?: PageResponse; } +export interface ReactiveQueryEpochsInfoResponse { + epochs: ComputedRef<EpochInfo[]>; + pagination?: ComputedRef<PageResponse>; +} export interface QueryEpochsInfoResponseProtoMsg { typeUrl: "/evmos.epochs.v1.QueryEpochsInfoResponse"; value: Uint8Array; @@ -29,6 +37,9 @@ export interface QueryEpochsInfoResponseSDKType { export interface QueryCurrentEpochRequest { identifier: string; } +export interface ReactiveQueryCurrentEpochRequest { + identifier: ComputedRef<string>; +} export interface QueryCurrentEpochRequestProtoMsg { typeUrl: "/evmos.epochs.v1.QueryCurrentEpochRequest"; value: Uint8Array; @@ -39,6 +50,9 @@ export interface QueryCurrentEpochRequestSDKType { export interface QueryCurrentEpochResponse { currentEpoch: bigint; } +export interface ReactiveQueryCurrentEpochResponse { + currentEpoch: ComputedRef<bigint>; +} export interface QueryCurrentEpochResponseProtoMsg { typeUrl: "/evmos.epochs.v1.QueryCurrentEpochResponse"; value: Uint8Array; @@ -77,9 +91,9 @@ export const QueryEpochsInfoRequest = { return message; }, fromJSON(object: any): QueryEpochsInfoRequest { - const obj = createBaseQueryEpochsInfoRequest(); - if (isSet(object.pagination)) obj.pagination = PageRequest.fromJSON(object.pagination); - return obj; + return { + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined + }; }, toJSON(message: QueryEpochsInfoRequest): JsonSafe<QueryEpochsInfoRequest> { const obj: any = {}; @@ -88,9 +102,7 @@ export const QueryEpochsInfoRequest = { }, fromPartial(object: DeepPartial<QueryEpochsInfoRequest>): QueryEpochsInfoRequest { const message = createBaseQueryEpochsInfoRequest(); - if (object.pagination !== undefined && object.pagination !== null) { - message.pagination = PageRequest.fromPartial(object.pagination); - } + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageRequest.fromPartial(object.pagination) : undefined; return message; }, fromSDK(object: QueryEpochsInfoRequestSDKType): QueryEpochsInfoRequest { @@ -174,10 +186,10 @@ export const QueryEpochsInfoResponse = { return message; }, fromJSON(object: any): QueryEpochsInfoResponse { - 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; + return { + epochs: Array.isArray(object?.epochs) ? object.epochs.map((e: any) => EpochInfo.fromJSON(e)) : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined + }; }, toJSON(message: QueryEpochsInfoResponse): JsonSafe<QueryEpochsInfoResponse> { const obj: any = {}; @@ -192,9 +204,7 @@ export const QueryEpochsInfoResponse = { fromPartial(object: DeepPartial<QueryEpochsInfoResponse>): QueryEpochsInfoResponse { const message = createBaseQueryEpochsInfoResponse(); message.epochs = object.epochs?.map(e => EpochInfo.fromPartial(e)) || []; - if (object.pagination !== undefined && object.pagination !== null) { - message.pagination = PageResponse.fromPartial(object.pagination); - } + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageResponse.fromPartial(object.pagination) : undefined; return message; }, fromSDK(object: QueryEpochsInfoResponseSDKType): QueryEpochsInfoResponse { @@ -261,7 +271,7 @@ function createBaseQueryCurrentEpochRequest(): QueryCurrentEpochRequest { export const QueryCurrentEpochRequest = { typeUrl: "/evmos.epochs.v1.QueryCurrentEpochRequest", encode(message: QueryCurrentEpochRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.identifier !== undefined) { + if (message.identifier !== "") { writer.uint32(10).string(message.identifier); } return writer; @@ -284,9 +294,9 @@ export const QueryCurrentEpochRequest = { return message; }, fromJSON(object: any): QueryCurrentEpochRequest { - const obj = createBaseQueryCurrentEpochRequest(); - if (isSet(object.identifier)) obj.identifier = String(object.identifier); - return obj; + return { + identifier: isSet(object.identifier) ? String(object.identifier) : "" + }; }, toJSON(message: QueryCurrentEpochRequest): JsonSafe<QueryCurrentEpochRequest> { const obj: any = {}; @@ -349,7 +359,7 @@ function createBaseQueryCurrentEpochResponse(): QueryCurrentEpochResponse { export const QueryCurrentEpochResponse = { typeUrl: "/evmos.epochs.v1.QueryCurrentEpochResponse", encode(message: QueryCurrentEpochResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.currentEpoch !== undefined) { + if (message.currentEpoch !== BigInt(0)) { writer.uint32(8).int64(message.currentEpoch); } return writer; @@ -372,9 +382,9 @@ export const QueryCurrentEpochResponse = { return message; }, fromJSON(object: any): QueryCurrentEpochResponse { - const obj = createBaseQueryCurrentEpochResponse(); - if (isSet(object.currentEpoch)) obj.currentEpoch = BigInt(object.currentEpoch.toString()); - return obj; + return { + currentEpoch: isSet(object.currentEpoch) ? BigInt(object.currentEpoch.toString()) : BigInt(0) + }; }, toJSON(message: QueryCurrentEpochResponse): JsonSafe<QueryCurrentEpochResponse> { const obj: any = {}; @@ -383,9 +393,7 @@ export const QueryCurrentEpochResponse = { }, fromPartial(object: DeepPartial<QueryCurrentEpochResponse>): QueryCurrentEpochResponse { const message = createBaseQueryCurrentEpochResponse(); - if (object.currentEpoch !== undefined && object.currentEpoch !== null) { - message.currentEpoch = BigInt(object.currentEpoch.toString()); - } + message.currentEpoch = object.currentEpoch !== undefined && object.currentEpoch !== null ? BigInt(object.currentEpoch.toString()) : BigInt(0); 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 0f907122ba..54f066e82c 100644 --- a/__fixtures__/v-next/outputv4/evmos/erc20/v1/erc20.ts +++ b/__fixtures__/v-next/outputv4/evmos/erc20/v1/erc20.ts @@ -1,7 +1,8 @@ -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"; +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"; export const protobufPackage = "evmos.erc20.v1"; /** Owner enumerates the ownership of a ERC20 contract. */ export enum Owner { @@ -58,6 +59,12 @@ export interface TokenPair { /** ERC20 owner address ENUM (0 invalid, 1 ModuleAccount, 2 external address) */ contractOwner: Owner; } +export interface ReactiveTokenPair { + erc20Address: ComputedRef<string>; + denom: ComputedRef<string>; + enabled: ComputedRef<boolean>; + contractOwner: ComputedRef<Owner>; +} export interface TokenPairProtoMsg { typeUrl: "/evmos.erc20.v1.TokenPair"; value: Uint8Array; @@ -84,6 +91,11 @@ export interface RegisterCoinProposal { /** metadata of the native Cosmos coin */ metadata: Metadata; } +export interface ReactiveRegisterCoinProposal { + title: ComputedRef<string>; + description: ComputedRef<string>; + metadata: ComputedRef<Metadata>; +} export interface RegisterCoinProposalProtoMsg { typeUrl: "/evmos.erc20.v1.RegisterCoinProposal"; value: Uint8Array; @@ -109,6 +121,11 @@ export interface RegisterERC20Proposal { /** contract address of ERC20 token */ erc20address: string; } +export interface ReactiveRegisterERC20Proposal { + title: ComputedRef<string>; + description: ComputedRef<string>; + erc20address: ComputedRef<string>; +} export interface RegisterERC20ProposalProtoMsg { typeUrl: "/evmos.erc20.v1.RegisterERC20Proposal"; value: Uint8Array; @@ -137,6 +154,11 @@ export interface ToggleTokenConversionProposal { */ token: string; } +export interface ReactiveToggleTokenConversionProposal { + title: ComputedRef<string>; + description: ComputedRef<string>; + token: ComputedRef<string>; +} export interface ToggleTokenConversionProposalProtoMsg { typeUrl: "/evmos.erc20.v1.ToggleTokenConversionProposal"; value: Uint8Array; @@ -161,13 +183,13 @@ function createBaseTokenPair(): TokenPair { export const TokenPair = { typeUrl: "/evmos.erc20.v1.TokenPair", encode(message: TokenPair, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.erc20Address !== undefined) { + if (message.erc20Address !== "") { writer.uint32(10).string(message.erc20Address); } - if (message.denom !== undefined) { + if (message.denom !== "") { writer.uint32(18).string(message.denom); } - if (message.enabled !== undefined) { + if (message.enabled === true) { writer.uint32(24).bool(message.enabled); } if (message.contractOwner !== 0) { @@ -202,12 +224,12 @@ export const TokenPair = { return message; }, fromJSON(object: any): TokenPair { - 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; + 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 + }; }, toJSON(message: TokenPair): JsonSafe<TokenPair> { const obj: any = {}; @@ -299,10 +321,10 @@ function createBaseRegisterCoinProposal(): RegisterCoinProposal { export const RegisterCoinProposal = { typeUrl: "/evmos.erc20.v1.RegisterCoinProposal", encode(message: RegisterCoinProposal, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.title !== undefined) { + if (message.title !== "") { writer.uint32(10).string(message.title); } - if (message.description !== undefined) { + if (message.description !== "") { writer.uint32(18).string(message.description); } if (message.metadata !== undefined) { @@ -334,11 +356,11 @@ export const RegisterCoinProposal = { return message; }, fromJSON(object: any): RegisterCoinProposal { - 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; + return { + title: isSet(object.title) ? String(object.title) : "", + description: isSet(object.description) ? String(object.description) : "", + metadata: isSet(object.metadata) ? Metadata.fromJSON(object.metadata) : undefined + }; }, toJSON(message: RegisterCoinProposal): JsonSafe<RegisterCoinProposal> { const obj: any = {}; @@ -351,9 +373,7 @@ export const RegisterCoinProposal = { const message = createBaseRegisterCoinProposal(); message.title = object.title ?? ""; message.description = object.description ?? ""; - if (object.metadata !== undefined && object.metadata !== null) { - message.metadata = Metadata.fromPartial(object.metadata); - } + message.metadata = object.metadata !== undefined && object.metadata !== null ? Metadata.fromPartial(object.metadata) : undefined; return message; }, fromSDK(object: RegisterCoinProposalSDKType): RegisterCoinProposal { @@ -423,13 +443,13 @@ function createBaseRegisterERC20Proposal(): RegisterERC20Proposal { export const RegisterERC20Proposal = { typeUrl: "/evmos.erc20.v1.RegisterERC20Proposal", encode(message: RegisterERC20Proposal, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.title !== undefined) { + if (message.title !== "") { writer.uint32(10).string(message.title); } - if (message.description !== undefined) { + if (message.description !== "") { writer.uint32(18).string(message.description); } - if (message.erc20address !== undefined) { + if (message.erc20address !== "") { writer.uint32(26).string(message.erc20address); } return writer; @@ -458,11 +478,11 @@ export const RegisterERC20Proposal = { return message; }, fromJSON(object: any): RegisterERC20Proposal { - 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; + return { + title: isSet(object.title) ? String(object.title) : "", + description: isSet(object.description) ? String(object.description) : "", + erc20address: isSet(object.erc20address) ? String(object.erc20address) : "" + }; }, toJSON(message: RegisterERC20Proposal): JsonSafe<RegisterERC20Proposal> { const obj: any = {}; @@ -545,13 +565,13 @@ function createBaseToggleTokenConversionProposal(): ToggleTokenConversionProposa export const ToggleTokenConversionProposal = { typeUrl: "/evmos.erc20.v1.ToggleTokenConversionProposal", encode(message: ToggleTokenConversionProposal, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.title !== undefined) { + if (message.title !== "") { writer.uint32(10).string(message.title); } - if (message.description !== undefined) { + if (message.description !== "") { writer.uint32(18).string(message.description); } - if (message.token !== undefined) { + if (message.token !== "") { writer.uint32(26).string(message.token); } return writer; @@ -580,11 +600,11 @@ export const ToggleTokenConversionProposal = { return message; }, fromJSON(object: any): ToggleTokenConversionProposal { - 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; + return { + title: isSet(object.title) ? String(object.title) : "", + description: isSet(object.description) ? String(object.description) : "", + token: isSet(object.token) ? String(object.token) : "" + }; }, toJSON(message: ToggleTokenConversionProposal): JsonSafe<ToggleTokenConversionProposal> { 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 ab01fa0129..6985b9fabf 100644 --- a/__fixtures__/v-next/outputv4/evmos/erc20/v1/genesis.ts +++ b/__fixtures__/v-next/outputv4/evmos/erc20/v1/genesis.ts @@ -1,7 +1,8 @@ -import { TokenPair, TokenPairSDKType } from "./erc20.js"; -import { BinaryReader, BinaryWriter } from "../../../binary.js"; -import { isSet, DeepPartial } from "../../../helpers.js"; -import { JsonSafe } from "../../../json-safe.js"; +import { TokenPair, TokenPairSDKType } from "./erc20"; +import { BinaryReader, BinaryWriter } from "../../../binary"; +import { isSet, DeepPartial } from "../../../helpers"; +import { JsonSafe } from "../../../json-safe"; +import { ComputedRef } from "vue"; export const protobufPackage = "evmos.erc20.v1"; /** GenesisState defines the module's genesis state. */ export interface GenesisState { @@ -10,6 +11,10 @@ export interface GenesisState { /** registered token pairs */ tokenPairs: TokenPair[]; } +export interface ReactiveGenesisState { + params: ComputedRef<Params>; + tokenPairs: ComputedRef<TokenPair[]>; +} export interface GenesisStateProtoMsg { typeUrl: "/evmos.erc20.v1.GenesisState"; value: Uint8Array; @@ -30,6 +35,10 @@ export interface Params { */ enableEvmHook: boolean; } +export interface ReactiveParams { + enableErc20: ComputedRef<boolean>; + enableEvmHook: ComputedRef<boolean>; +} export interface ParamsProtoMsg { typeUrl: "/evmos.erc20.v1.Params"; value: Uint8Array; @@ -77,10 +86,10 @@ export const GenesisState = { return message; }, fromJSON(object: any): GenesisState { - 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; + return { + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + tokenPairs: Array.isArray(object?.tokenPairs) ? object.tokenPairs.map((e: any) => TokenPair.fromJSON(e)) : [] + }; }, toJSON(message: GenesisState): JsonSafe<GenesisState> { const obj: any = {}; @@ -94,9 +103,7 @@ export const GenesisState = { }, fromPartial(object: DeepPartial<GenesisState>): GenesisState { const message = createBaseGenesisState(); - if (object.params !== undefined && object.params !== null) { - message.params = Params.fromPartial(object.params); - } + message.params = object.params !== undefined && object.params !== null ? Params.fromPartial(object.params) : undefined; message.tokenPairs = object.tokenPairs?.map(e => TokenPair.fromPartial(e)) || []; return message; }, @@ -165,10 +172,10 @@ function createBaseParams(): Params { export const Params = { typeUrl: "/evmos.erc20.v1.Params", encode(message: Params, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.enableErc20 !== undefined) { + if (message.enableErc20 === true) { writer.uint32(8).bool(message.enableErc20); } - if (message.enableEvmHook !== undefined) { + if (message.enableEvmHook === true) { writer.uint32(16).bool(message.enableEvmHook); } return writer; @@ -194,10 +201,10 @@ export const Params = { return message; }, fromJSON(object: any): Params { - const obj = createBaseParams(); - if (isSet(object.enableErc20)) obj.enableErc20 = Boolean(object.enableErc20); - if (isSet(object.enableEvmHook)) obj.enableEvmHook = Boolean(object.enableEvmHook); - return obj; + return { + enableErc20: isSet(object.enableErc20) ? Boolean(object.enableErc20) : false, + enableEvmHook: isSet(object.enableEvmHook) ? Boolean(object.enableEvmHook) : false + }; }, toJSON(message: Params): JsonSafe<Params> { 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 342838d766..5e87666b0e 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.js"; -import { TokenPair, TokenPairSDKType } from "./erc20.js"; -import { Params, ParamsSDKType } from "./genesis.js"; -import { setPaginationParams } from "../../../helpers.js"; +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 { LCDClient } from "@cosmology/lcd"; -import { QueryTokenPairsRequest, QueryTokenPairsRequestSDKType, QueryTokenPairsResponse, QueryTokenPairsResponseSDKType, QueryTokenPairRequest, QueryTokenPairRequestSDKType, QueryTokenPairResponse, QueryTokenPairResponseSDKType, QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType } from "./query.js"; +import { QueryTokenPairsRequest, QueryTokenPairsRequestSDKType, QueryTokenPairsResponse, QueryTokenPairsResponseSDKType, QueryTokenPairRequest, QueryTokenPairRequestSDKType, QueryTokenPairResponse, QueryTokenPairResponseSDKType, QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType } from "./query"; export class LCDQueryClient { req: LCDClient; constructor({ @@ -18,7 +18,7 @@ export class LCDQueryClient { } /* TokenPairs retrieves registered token pairs */ async tokenPairs(params: QueryTokenPairsRequest = { - pagination: PageRequest.fromPartial({}) + pagination: undefined }): Promise<QueryTokenPairsResponseSDKType> { 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 39cb552d59..b9bb36ea4b 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.js"; -import { TokenPair, TokenPairSDKType } from "./erc20.js"; -import { Params, ParamsSDKType } from "./genesis.js"; -import { Rpc } from "../../../helpers.js"; -import { BinaryReader } from "../../../binary.js"; +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 { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; -import { QueryTokenPairsRequest, QueryTokenPairsRequestSDKType, QueryTokenPairsResponse, QueryTokenPairsResponseSDKType, QueryTokenPairRequest, QueryTokenPairRequestSDKType, QueryTokenPairResponse, QueryTokenPairResponseSDKType, QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType } from "./query.js"; +import { QueryTokenPairsRequest, QueryTokenPairsRequestSDKType, QueryTokenPairsResponse, QueryTokenPairsResponseSDKType, QueryTokenPairRequest, QueryTokenPairRequestSDKType, QueryTokenPairResponse, QueryTokenPairResponseSDKType, QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType, ReactiveQueryTokenPairsRequest, ReactiveQueryTokenPairRequest, ReactiveQueryParamsRequest } from "./query"; /** 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: PageRequest.fromPartial({}) + pagination: undefined }): Promise<QueryTokenPairsResponse> { 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 f61037c59e..6d12247f9f 100644 --- a/__fixtures__/v-next/outputv4/evmos/erc20/v1/query.ts +++ b/__fixtures__/v-next/outputv4/evmos/erc20/v1/query.ts @@ -1,9 +1,10 @@ -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"; +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"; export const protobufPackage = "evmos.erc20.v1"; /** * QueryTokenPairsRequest is the request type for the Query/TokenPairs RPC @@ -13,6 +14,9 @@ export interface QueryTokenPairsRequest { /** pagination defines an optional pagination for the request. */ pagination?: PageRequest; } +export interface ReactiveQueryTokenPairsRequest { + pagination?: ComputedRef<PageRequest>; +} export interface QueryTokenPairsRequestProtoMsg { typeUrl: "/evmos.erc20.v1.QueryTokenPairsRequest"; value: Uint8Array; @@ -33,6 +37,10 @@ export interface QueryTokenPairsResponse { /** pagination defines the pagination in the response. */ pagination?: PageResponse; } +export interface ReactiveQueryTokenPairsResponse { + tokenPairs: ComputedRef<TokenPair[]>; + pagination?: ComputedRef<PageResponse>; +} export interface QueryTokenPairsResponseProtoMsg { typeUrl: "/evmos.erc20.v1.QueryTokenPairsResponse"; value: Uint8Array; @@ -53,6 +61,9 @@ export interface QueryTokenPairRequest { */ token: string; } +export interface ReactiveQueryTokenPairRequest { + token: ComputedRef<string>; +} export interface QueryTokenPairRequestProtoMsg { typeUrl: "/evmos.erc20.v1.QueryTokenPairRequest"; value: Uint8Array; @@ -68,6 +79,9 @@ export interface QueryTokenPairRequestSDKType { export interface QueryTokenPairResponse { tokenPair: TokenPair; } +export interface ReactiveQueryTokenPairResponse { + tokenPair: ComputedRef<TokenPair>; +} export interface QueryTokenPairResponseProtoMsg { typeUrl: "/evmos.erc20.v1.QueryTokenPairResponse"; value: Uint8Array; @@ -81,6 +95,7 @@ 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; @@ -94,6 +109,9 @@ export interface QueryParamsRequestSDKType {} export interface QueryParamsResponse { params: Params; } +export interface ReactiveQueryParamsResponse { + params: ComputedRef<Params>; +} export interface QueryParamsResponseProtoMsg { typeUrl: "/evmos.erc20.v1.QueryParamsResponse"; value: Uint8Array; @@ -136,9 +154,9 @@ export const QueryTokenPairsRequest = { return message; }, fromJSON(object: any): QueryTokenPairsRequest { - const obj = createBaseQueryTokenPairsRequest(); - if (isSet(object.pagination)) obj.pagination = PageRequest.fromJSON(object.pagination); - return obj; + return { + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined + }; }, toJSON(message: QueryTokenPairsRequest): JsonSafe<QueryTokenPairsRequest> { const obj: any = {}; @@ -147,9 +165,7 @@ export const QueryTokenPairsRequest = { }, fromPartial(object: DeepPartial<QueryTokenPairsRequest>): QueryTokenPairsRequest { const message = createBaseQueryTokenPairsRequest(); - if (object.pagination !== undefined && object.pagination !== null) { - message.pagination = PageRequest.fromPartial(object.pagination); - } + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageRequest.fromPartial(object.pagination) : undefined; return message; }, fromSDK(object: QueryTokenPairsRequestSDKType): QueryTokenPairsRequest { @@ -233,10 +249,10 @@ export const QueryTokenPairsResponse = { return message; }, fromJSON(object: any): QueryTokenPairsResponse { - 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; + return { + tokenPairs: Array.isArray(object?.tokenPairs) ? object.tokenPairs.map((e: any) => TokenPair.fromJSON(e)) : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined + }; }, toJSON(message: QueryTokenPairsResponse): JsonSafe<QueryTokenPairsResponse> { const obj: any = {}; @@ -251,9 +267,7 @@ export const QueryTokenPairsResponse = { fromPartial(object: DeepPartial<QueryTokenPairsResponse>): QueryTokenPairsResponse { const message = createBaseQueryTokenPairsResponse(); message.tokenPairs = object.tokenPairs?.map(e => TokenPair.fromPartial(e)) || []; - if (object.pagination !== undefined && object.pagination !== null) { - message.pagination = PageResponse.fromPartial(object.pagination); - } + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageResponse.fromPartial(object.pagination) : undefined; return message; }, fromSDK(object: QueryTokenPairsResponseSDKType): QueryTokenPairsResponse { @@ -320,7 +334,7 @@ function createBaseQueryTokenPairRequest(): QueryTokenPairRequest { export const QueryTokenPairRequest = { typeUrl: "/evmos.erc20.v1.QueryTokenPairRequest", encode(message: QueryTokenPairRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.token !== undefined) { + if (message.token !== "") { writer.uint32(10).string(message.token); } return writer; @@ -343,9 +357,9 @@ export const QueryTokenPairRequest = { return message; }, fromJSON(object: any): QueryTokenPairRequest { - const obj = createBaseQueryTokenPairRequest(); - if (isSet(object.token)) obj.token = String(object.token); - return obj; + return { + token: isSet(object.token) ? String(object.token) : "" + }; }, toJSON(message: QueryTokenPairRequest): JsonSafe<QueryTokenPairRequest> { const obj: any = {}; @@ -431,9 +445,9 @@ export const QueryTokenPairResponse = { return message; }, fromJSON(object: any): QueryTokenPairResponse { - const obj = createBaseQueryTokenPairResponse(); - if (isSet(object.tokenPair)) obj.tokenPair = TokenPair.fromJSON(object.tokenPair); - return obj; + return { + tokenPair: isSet(object.tokenPair) ? TokenPair.fromJSON(object.tokenPair) : undefined + }; }, toJSON(message: QueryTokenPairResponse): JsonSafe<QueryTokenPairResponse> { const obj: any = {}; @@ -442,9 +456,7 @@ export const QueryTokenPairResponse = { }, fromPartial(object: DeepPartial<QueryTokenPairResponse>): QueryTokenPairResponse { const message = createBaseQueryTokenPairResponse(); - if (object.tokenPair !== undefined && object.tokenPair !== null) { - message.tokenPair = TokenPair.fromPartial(object.tokenPair); - } + message.tokenPair = object.tokenPair !== undefined && object.tokenPair !== null ? TokenPair.fromPartial(object.tokenPair) : undefined; return message; }, fromSDK(object: QueryTokenPairResponseSDKType): QueryTokenPairResponse { @@ -513,8 +525,7 @@ export const QueryParamsRequest = { return message; }, fromJSON(_: any): QueryParamsRequest { - const obj = createBaseQueryParamsRequest(); - return obj; + return {}; }, toJSON(_: QueryParamsRequest): JsonSafe<QueryParamsRequest> { const obj: any = {}; @@ -589,9 +600,9 @@ export const QueryParamsResponse = { return message; }, fromJSON(object: any): QueryParamsResponse { - const obj = createBaseQueryParamsResponse(); - if (isSet(object.params)) obj.params = Params.fromJSON(object.params); - return obj; + return { + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined + }; }, toJSON(message: QueryParamsResponse): JsonSafe<QueryParamsResponse> { const obj: any = {}; @@ -600,9 +611,7 @@ export const QueryParamsResponse = { }, fromPartial(object: DeepPartial<QueryParamsResponse>): QueryParamsResponse { const message = createBaseQueryParamsResponse(); - if (object.params !== undefined && object.params !== null) { - message.params = Params.fromPartial(object.params); - } + message.params = object.params !== undefined && object.params !== null ? Params.fromPartial(object.params) : undefined; 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 2f1ca2a5d9..0be2123e86 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.js"; +import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { AminoMsg } from "@cosmjs/amino"; -import { MsgConvertCoin, MsgConvertCoinSDKType, MsgConvertERC20, MsgConvertERC20SDKType } from "./tx.js"; +import { MsgConvertCoin, MsgConvertCoinSDKType, MsgConvertERC20, MsgConvertERC20SDKType } from "./tx"; 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 a7fa2b4a32..bc1f20222b 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.js"; +import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { GeneratedType, Registry } from "@cosmjs/proto-signing"; -import { MsgConvertCoin, MsgConvertCoinSDKType, MsgConvertERC20, MsgConvertERC20SDKType } from "./tx.js"; +import { MsgConvertCoin, MsgConvertCoinSDKType, MsgConvertERC20, MsgConvertERC20SDKType } from "./tx"; 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 34d5454eff..63e3041b30 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.js"; -import { Rpc } from "../../../helpers.js"; -import { BinaryReader } from "../../../binary.js"; -import { MsgConvertCoin, MsgConvertCoinSDKType, MsgConvertCoinResponse, MsgConvertCoinResponseSDKType, MsgConvertERC20, MsgConvertERC20SDKType, MsgConvertERC20Response, MsgConvertERC20ResponseSDKType } from "./tx.js"; +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"; /** 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 1eceacd9a2..a3627f6f36 100644 --- a/__fixtures__/v-next/outputv4/evmos/erc20/v1/tx.ts +++ b/__fixtures__/v-next/outputv4/evmos/erc20/v1/tx.ts @@ -1,7 +1,8 @@ -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"; +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"; export const protobufPackage = "evmos.erc20.v1"; /** MsgConvertCoin defines a Msg to convert a native Cosmos coin to a ERC20 token */ export interface MsgConvertCoin { @@ -15,6 +16,11 @@ export interface MsgConvertCoin { /** cosmos bech32 address from the owner of the given Cosmos coins */ sender: string; } +export interface ReactiveMsgConvertCoin { + coin: ComputedRef<Coin>; + receiver: ComputedRef<string>; + sender: ComputedRef<string>; +} export interface MsgConvertCoinProtoMsg { typeUrl: "/evmos.erc20.v1.MsgConvertCoin"; value: Uint8Array; @@ -27,6 +33,7 @@ export interface MsgConvertCoinSDKType { } /** MsgConvertCoinResponse returns no fields */ export interface MsgConvertCoinResponse {} +export interface ReactiveMsgConvertCoinResponse {} export interface MsgConvertCoinResponseProtoMsg { typeUrl: "/evmos.erc20.v1.MsgConvertCoinResponse"; value: Uint8Array; @@ -47,6 +54,12 @@ export interface MsgConvertERC20 { /** sender hex address from the owner of the given ERC20 tokens */ sender: string; } +export interface ReactiveMsgConvertERC20 { + contractAddress: ComputedRef<string>; + amount: ComputedRef<string>; + receiver: ComputedRef<string>; + sender: ComputedRef<string>; +} export interface MsgConvertERC20ProtoMsg { typeUrl: "/evmos.erc20.v1.MsgConvertERC20"; value: Uint8Array; @@ -63,6 +76,7 @@ export interface MsgConvertERC20SDKType { } /** MsgConvertERC20Response returns no fields */ export interface MsgConvertERC20Response {} +export interface ReactiveMsgConvertERC20Response {} export interface MsgConvertERC20ResponseProtoMsg { typeUrl: "/evmos.erc20.v1.MsgConvertERC20Response"; value: Uint8Array; @@ -82,10 +96,10 @@ export const MsgConvertCoin = { if (message.coin !== undefined) { Coin.encode(message.coin, writer.uint32(10).fork()).ldelim(); } - if (message.receiver !== undefined) { + if (message.receiver !== "") { writer.uint32(18).string(message.receiver); } - if (message.sender !== undefined) { + if (message.sender !== "") { writer.uint32(26).string(message.sender); } return writer; @@ -114,11 +128,11 @@ export const MsgConvertCoin = { return message; }, fromJSON(object: any): MsgConvertCoin { - 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; + return { + coin: isSet(object.coin) ? Coin.fromJSON(object.coin) : undefined, + receiver: isSet(object.receiver) ? String(object.receiver) : "", + sender: isSet(object.sender) ? String(object.sender) : "" + }; }, toJSON(message: MsgConvertCoin): JsonSafe<MsgConvertCoin> { const obj: any = {}; @@ -129,9 +143,7 @@ export const MsgConvertCoin = { }, fromPartial(object: DeepPartial<MsgConvertCoin>): MsgConvertCoin { const message = createBaseMsgConvertCoin(); - if (object.coin !== undefined && object.coin !== null) { - message.coin = Coin.fromPartial(object.coin); - } + message.coin = object.coin !== undefined && object.coin !== null ? Coin.fromPartial(object.coin) : undefined; message.receiver = object.receiver ?? ""; message.sender = object.sender ?? ""; return message; @@ -216,8 +228,7 @@ export const MsgConvertCoinResponse = { return message; }, fromJSON(_: any): MsgConvertCoinResponse { - const obj = createBaseMsgConvertCoinResponse(); - return obj; + return {}; }, toJSON(_: MsgConvertCoinResponse): JsonSafe<MsgConvertCoinResponse> { const obj: any = {}; @@ -272,16 +283,16 @@ function createBaseMsgConvertERC20(): MsgConvertERC20 { export const MsgConvertERC20 = { typeUrl: "/evmos.erc20.v1.MsgConvertERC20", encode(message: MsgConvertERC20, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.contractAddress !== undefined) { + if (message.contractAddress !== "") { writer.uint32(10).string(message.contractAddress); } - if (message.amount !== undefined) { + if (message.amount !== "") { writer.uint32(18).string(message.amount); } - if (message.receiver !== undefined) { + if (message.receiver !== "") { writer.uint32(26).string(message.receiver); } - if (message.sender !== undefined) { + if (message.sender !== "") { writer.uint32(34).string(message.sender); } return writer; @@ -313,12 +324,12 @@ export const MsgConvertERC20 = { return message; }, fromJSON(object: any): MsgConvertERC20 { - 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; + 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) : "" + }; }, toJSON(message: MsgConvertERC20): JsonSafe<MsgConvertERC20> { const obj: any = {}; @@ -423,8 +434,7 @@ export const MsgConvertERC20Response = { return message; }, fromJSON(_: any): MsgConvertERC20Response { - const obj = createBaseMsgConvertERC20Response(); - return obj; + return {}; }, toJSON(_: MsgConvertERC20Response): JsonSafe<MsgConvertERC20Response> { 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 84977f0638..1adc9f91e5 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.js"; -import { connectComet, HttpEndpoint } from "@cosmjs/tendermint-rpc"; +import { Rpc } from "../helpers"; +import { Tendermint34Client, HttpEndpoint } from "@cosmjs/tendermint-rpc"; import { QueryClient } from "@cosmjs/stargate"; export const createEvmosRPCQueryClient = async ({ rpcEndpoint }: { rpcEndpoint: string | HttpEndpoint; }) => { - const tmClient = await connectComet(rpcEndpoint); + const tmClient = await Tendermint34Client.connect(rpcEndpoint); const client = new QueryClient(tmClient); return { cosmos: { bank: { - v1beta1: (await import("../cosmos/bank/v1beta1/query.rpc.Query.js")).createRpcQueryExtension(client) + v1beta1: (await import("../cosmos/bank/v1beta1/query.rpc.Query")).createRpcQueryExtension(client) }, gov: { - v1beta1: (await import("../cosmos/gov/v1beta1/query.rpc.Query.js")).createRpcQueryExtension(client) + v1beta1: (await import("../cosmos/gov/v1beta1/query.rpc.Query")).createRpcQueryExtension(client) } }, evmos: { erc20: { - v1: (await import("./erc20/v1/query.rpc.Query.js")).createRpcQueryExtension(client) + v1: (await import("./erc20/v1/query.rpc.Query")).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 4ca08e9373..764eca94b4 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.js"; +import { Rpc } from "../helpers"; 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.js")).MsgClientImpl(rpc) + v1beta1: new (await import("../cosmos/bank/v1beta1/tx.rpc.msg")).MsgClientImpl(rpc) }, gov: { - v1beta1: new (await import("../cosmos/gov/v1beta1/tx.rpc.msg.js")).MsgClientImpl(rpc) + v1beta1: new (await import("../cosmos/gov/v1beta1/tx.rpc.msg")).MsgClientImpl(rpc) } }, evmos: { erc20: { - v1: new (await import("./erc20/v1/tx.rpc.msg.js")).MsgClientImpl(rpc) + v1: new (await import("./erc20/v1/tx.rpc.msg")).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 f6dbec7d70..70a331024d 100644 --- a/__fixtures__/v-next/outputv4/evmos/fees/v1/fees.ts +++ b/__fixtures__/v-next/outputv4/evmos/fees/v1/fees.ts @@ -1,6 +1,7 @@ -import { BinaryReader, BinaryWriter } from "../../../binary.js"; -import { isSet, DeepPartial } from "../../../helpers.js"; -import { JsonSafe } from "../../../json-safe.js"; +import { BinaryReader, BinaryWriter } from "../../../binary"; +import { isSet, DeepPartial } from "../../../helpers"; +import { JsonSafe } from "../../../json-safe"; +import { ComputedRef } from "vue"; export const protobufPackage = "evmos.fees.v1"; /** * DevFeeInfo defines an instance that organizes fee distribution conditions @@ -17,6 +18,11 @@ export interface DevFeeInfo { */ withdrawAddress: string; } +export interface ReactiveDevFeeInfo { + contractAddress: ComputedRef<string>; + deployerAddress: ComputedRef<string>; + withdrawAddress: ComputedRef<string>; +} export interface DevFeeInfoProtoMsg { typeUrl: "/evmos.fees.v1.DevFeeInfo"; value: Uint8Array; @@ -40,13 +46,13 @@ function createBaseDevFeeInfo(): DevFeeInfo { export const DevFeeInfo = { typeUrl: "/evmos.fees.v1.DevFeeInfo", encode(message: DevFeeInfo, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.contractAddress !== undefined) { + if (message.contractAddress !== "") { writer.uint32(10).string(message.contractAddress); } - if (message.deployerAddress !== undefined) { + if (message.deployerAddress !== "") { writer.uint32(18).string(message.deployerAddress); } - if (message.withdrawAddress !== undefined) { + if (message.withdrawAddress !== "") { writer.uint32(26).string(message.withdrawAddress); } return writer; @@ -75,11 +81,11 @@ export const DevFeeInfo = { return message; }, fromJSON(object: any): DevFeeInfo { - 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; + return { + contractAddress: isSet(object.contractAddress) ? String(object.contractAddress) : "", + deployerAddress: isSet(object.deployerAddress) ? String(object.deployerAddress) : "", + withdrawAddress: isSet(object.withdrawAddress) ? String(object.withdrawAddress) : "" + }; }, toJSON(message: DevFeeInfo): JsonSafe<DevFeeInfo> { 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 28a14bc369..3104412da2 100644 --- a/__fixtures__/v-next/outputv4/evmos/fees/v1/genesis.ts +++ b/__fixtures__/v-next/outputv4/evmos/fees/v1/genesis.ts @@ -1,8 +1,9 @@ -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 { DevFeeInfo, DevFeeInfoSDKType } from "./fees"; +import { BinaryReader, BinaryWriter } from "../../../binary"; +import { isSet, DeepPartial } from "../../../helpers"; +import { JsonSafe } from "../../../json-safe"; 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 { @@ -11,6 +12,10 @@ export interface GenesisState { /** active registered contracts */ devFeeInfos: DevFeeInfo[]; } +export interface ReactiveGenesisState { + params: ComputedRef<Params>; + devFeeInfos: ComputedRef<DevFeeInfo[]>; +} export interface GenesisStateProtoMsg { typeUrl: "/evmos.fees.v1.GenesisState"; value: Uint8Array; @@ -42,6 +47,13 @@ export interface Params { /** min_gas_price defines the minimum gas price value for cosmos and eth transactions */ minGasPrice: string; } +export interface ReactiveParams { + enableFees: ComputedRef<boolean>; + developerShares: ComputedRef<string>; + validatorShares: ComputedRef<string>; + addrDerivationCostCreate: ComputedRef<bigint>; + minGasPrice: ComputedRef<string>; +} export interface ParamsProtoMsg { typeUrl: "/evmos.fees.v1.Params"; value: Uint8Array; @@ -92,10 +104,10 @@ export const GenesisState = { return message; }, fromJSON(object: any): GenesisState { - 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; + return { + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + devFeeInfos: Array.isArray(object?.devFeeInfos) ? object.devFeeInfos.map((e: any) => DevFeeInfo.fromJSON(e)) : [] + }; }, toJSON(message: GenesisState): JsonSafe<GenesisState> { const obj: any = {}; @@ -109,9 +121,7 @@ export const GenesisState = { }, fromPartial(object: DeepPartial<GenesisState>): GenesisState { const message = createBaseGenesisState(); - if (object.params !== undefined && object.params !== null) { - message.params = Params.fromPartial(object.params); - } + message.params = object.params !== undefined && object.params !== null ? Params.fromPartial(object.params) : undefined; message.devFeeInfos = object.devFeeInfos?.map(e => DevFeeInfo.fromPartial(e)) || []; return message; }, @@ -183,19 +193,19 @@ function createBaseParams(): Params { export const Params = { typeUrl: "/evmos.fees.v1.Params", encode(message: Params, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.enableFees !== undefined) { + if (message.enableFees === true) { writer.uint32(8).bool(message.enableFees); } - if (message.developerShares !== undefined) { + if (message.developerShares !== "") { writer.uint32(18).string(Decimal.fromUserInput(message.developerShares, 18).atomics); } - if (message.validatorShares !== undefined) { + if (message.validatorShares !== "") { writer.uint32(26).string(Decimal.fromUserInput(message.validatorShares, 18).atomics); } - if (message.addrDerivationCostCreate !== undefined) { + if (message.addrDerivationCostCreate !== BigInt(0)) { writer.uint32(32).uint64(message.addrDerivationCostCreate); } - if (message.minGasPrice !== undefined) { + if (message.minGasPrice !== "") { writer.uint32(42).string(Decimal.fromUserInput(message.minGasPrice, 18).atomics); } return writer; @@ -230,13 +240,13 @@ export const Params = { return message; }, fromJSON(object: any): Params { - 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; + 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) : "" + }; }, toJSON(message: Params): JsonSafe<Params> { const obj: any = {}; @@ -252,9 +262,7 @@ export const Params = { message.enableFees = object.enableFees ?? false; message.developerShares = object.developerShares ?? ""; message.validatorShares = object.validatorShares ?? ""; - if (object.addrDerivationCostCreate !== undefined && object.addrDerivationCostCreate !== null) { - message.addrDerivationCostCreate = BigInt(object.addrDerivationCostCreate.toString()); - } + message.addrDerivationCostCreate = object.addrDerivationCostCreate !== undefined && object.addrDerivationCostCreate !== null ? BigInt(object.addrDerivationCostCreate.toString()) : BigInt(0); 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 75046f4615..78ab103d5a 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.js"; -import { DevFeeInfo, DevFeeInfoSDKType } from "./fees.js"; -import { Params, ParamsSDKType } from "./genesis.js"; -import { setPaginationParams } from "../../../helpers.js"; +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 { LCDClient } from "@cosmology/lcd"; -import { QueryDevFeeInfosRequest, QueryDevFeeInfosRequestSDKType, QueryDevFeeInfosResponse, QueryDevFeeInfosResponseSDKType, QueryDevFeeInfoRequest, QueryDevFeeInfoRequestSDKType, QueryDevFeeInfoResponse, QueryDevFeeInfoResponseSDKType, QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType, QueryDevFeeInfosPerDeployerRequest, QueryDevFeeInfosPerDeployerRequestSDKType, QueryDevFeeInfosPerDeployerResponse, QueryDevFeeInfosPerDeployerResponseSDKType } from "./query.js"; +import { QueryDevFeeInfosRequest, QueryDevFeeInfosRequestSDKType, QueryDevFeeInfosResponse, QueryDevFeeInfosResponseSDKType, QueryDevFeeInfoRequest, QueryDevFeeInfoRequestSDKType, QueryDevFeeInfoResponse, QueryDevFeeInfoResponseSDKType, QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType, QueryDevFeeInfosPerDeployerRequest, QueryDevFeeInfosPerDeployerRequestSDKType, QueryDevFeeInfosPerDeployerResponse, QueryDevFeeInfosPerDeployerResponseSDKType } from "./query"; 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: PageRequest.fromPartial({}) + pagination: undefined }): Promise<QueryDevFeeInfosResponseSDKType> { 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 a7297b6f74..9dd9e1b745 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.js"; -import { DevFeeInfo, DevFeeInfoSDKType } from "./fees.js"; -import { Params, ParamsSDKType } from "./genesis.js"; -import { Rpc } from "../../../helpers.js"; -import { BinaryReader } from "../../../binary.js"; +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 { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; -import { QueryDevFeeInfosRequest, QueryDevFeeInfosRequestSDKType, QueryDevFeeInfosResponse, QueryDevFeeInfosResponseSDKType, QueryDevFeeInfoRequest, QueryDevFeeInfoRequestSDKType, QueryDevFeeInfoResponse, QueryDevFeeInfoResponseSDKType, QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType, QueryDevFeeInfosPerDeployerRequest, QueryDevFeeInfosPerDeployerRequestSDKType, QueryDevFeeInfosPerDeployerResponse, QueryDevFeeInfosPerDeployerResponseSDKType } from "./query.js"; +import { QueryDevFeeInfosRequest, QueryDevFeeInfosRequestSDKType, QueryDevFeeInfosResponse, QueryDevFeeInfosResponseSDKType, QueryDevFeeInfoRequest, QueryDevFeeInfoRequestSDKType, QueryDevFeeInfoResponse, QueryDevFeeInfoResponseSDKType, QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType, QueryDevFeeInfosPerDeployerRequest, QueryDevFeeInfosPerDeployerRequestSDKType, QueryDevFeeInfosPerDeployerResponse, QueryDevFeeInfosPerDeployerResponseSDKType, ReactiveQueryDevFeeInfosRequest, ReactiveQueryDevFeeInfoRequest, ReactiveQueryParamsRequest, ReactiveQueryDevFeeInfosPerDeployerRequest } from "./query"; /** 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: PageRequest.fromPartial({}) + pagination: undefined }): Promise<QueryDevFeeInfosResponse> { 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 3b1df4fbb6..8b6868c092 100644 --- a/__fixtures__/v-next/outputv4/evmos/fees/v1/query.ts +++ b/__fixtures__/v-next/outputv4/evmos/fees/v1/query.ts @@ -1,9 +1,10 @@ -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"; +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"; export const protobufPackage = "evmos.fees.v1"; /** * QueryDevFeeInfosRequest is the request type for the Query/DevFeeInfos RPC @@ -13,6 +14,9 @@ export interface QueryDevFeeInfosRequest { /** pagination defines an optional pagination for the request. */ pagination?: PageRequest; } +export interface ReactiveQueryDevFeeInfosRequest { + pagination?: ComputedRef<PageRequest>; +} export interface QueryDevFeeInfosRequestProtoMsg { typeUrl: "/evmos.fees.v1.QueryDevFeeInfosRequest"; value: Uint8Array; @@ -33,6 +37,10 @@ export interface QueryDevFeeInfosResponse { /** pagination defines the pagination in the response. */ pagination?: PageResponse; } +export interface ReactiveQueryDevFeeInfosResponse { + fees: ComputedRef<DevFeeInfo[]>; + pagination?: ComputedRef<PageResponse>; +} export interface QueryDevFeeInfosResponseProtoMsg { typeUrl: "/evmos.fees.v1.QueryDevFeeInfosResponse"; value: Uint8Array; @@ -53,6 +61,9 @@ export interface QueryDevFeeInfoRequest { /** contract identifier is the hex contract address of a contract */ contractAddress: string; } +export interface ReactiveQueryDevFeeInfoRequest { + contractAddress: ComputedRef<string>; +} export interface QueryDevFeeInfoRequestProtoMsg { typeUrl: "/evmos.fees.v1.QueryDevFeeInfoRequest"; value: Uint8Array; @@ -71,6 +82,9 @@ export interface QueryDevFeeInfoRequestSDKType { export interface QueryDevFeeInfoResponse { fee: DevFeeInfo; } +export interface ReactiveQueryDevFeeInfoResponse { + fee: ComputedRef<DevFeeInfo>; +} export interface QueryDevFeeInfoResponseProtoMsg { typeUrl: "/evmos.fees.v1.QueryDevFeeInfoResponse"; value: Uint8Array; @@ -84,6 +98,7 @@ 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; @@ -97,6 +112,9 @@ export interface QueryParamsRequestSDKType {} export interface QueryParamsResponse { params: Params; } +export interface ReactiveQueryParamsResponse { + params: ComputedRef<Params>; +} export interface QueryParamsResponseProtoMsg { typeUrl: "/evmos.fees.v1.QueryParamsResponse"; value: Uint8Array; @@ -118,6 +136,10 @@ export interface QueryDevFeeInfosPerDeployerRequest { /** pagination defines an optional pagination for the request. */ pagination?: PageRequest; } +export interface ReactiveQueryDevFeeInfosPerDeployerRequest { + deployerAddress: ComputedRef<string>; + pagination?: ComputedRef<PageRequest>; +} export interface QueryDevFeeInfosPerDeployerRequestProtoMsg { typeUrl: "/evmos.fees.v1.QueryDevFeeInfosPerDeployerRequest"; value: Uint8Array; @@ -139,6 +161,10 @@ export interface QueryDevFeeInfosPerDeployerResponse { /** pagination defines the pagination in the response. */ pagination?: PageResponse; } +export interface ReactiveQueryDevFeeInfosPerDeployerResponse { + fees: ComputedRef<DevFeeInfo[]>; + pagination?: ComputedRef<PageResponse>; +} export interface QueryDevFeeInfosPerDeployerResponseProtoMsg { typeUrl: "/evmos.fees.v1.QueryDevFeeInfosPerDeployerResponse"; value: Uint8Array; @@ -182,9 +208,9 @@ export const QueryDevFeeInfosRequest = { return message; }, fromJSON(object: any): QueryDevFeeInfosRequest { - const obj = createBaseQueryDevFeeInfosRequest(); - if (isSet(object.pagination)) obj.pagination = PageRequest.fromJSON(object.pagination); - return obj; + return { + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined + }; }, toJSON(message: QueryDevFeeInfosRequest): JsonSafe<QueryDevFeeInfosRequest> { const obj: any = {}; @@ -193,9 +219,7 @@ export const QueryDevFeeInfosRequest = { }, fromPartial(object: DeepPartial<QueryDevFeeInfosRequest>): QueryDevFeeInfosRequest { const message = createBaseQueryDevFeeInfosRequest(); - if (object.pagination !== undefined && object.pagination !== null) { - message.pagination = PageRequest.fromPartial(object.pagination); - } + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageRequest.fromPartial(object.pagination) : undefined; return message; }, fromSDK(object: QueryDevFeeInfosRequestSDKType): QueryDevFeeInfosRequest { @@ -279,10 +303,10 @@ export const QueryDevFeeInfosResponse = { return message; }, fromJSON(object: any): QueryDevFeeInfosResponse { - 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; + return { + fees: Array.isArray(object?.fees) ? object.fees.map((e: any) => DevFeeInfo.fromJSON(e)) : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined + }; }, toJSON(message: QueryDevFeeInfosResponse): JsonSafe<QueryDevFeeInfosResponse> { const obj: any = {}; @@ -297,9 +321,7 @@ export const QueryDevFeeInfosResponse = { fromPartial(object: DeepPartial<QueryDevFeeInfosResponse>): QueryDevFeeInfosResponse { const message = createBaseQueryDevFeeInfosResponse(); message.fees = object.fees?.map(e => DevFeeInfo.fromPartial(e)) || []; - if (object.pagination !== undefined && object.pagination !== null) { - message.pagination = PageResponse.fromPartial(object.pagination); - } + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageResponse.fromPartial(object.pagination) : undefined; return message; }, fromSDK(object: QueryDevFeeInfosResponseSDKType): QueryDevFeeInfosResponse { @@ -366,7 +388,7 @@ function createBaseQueryDevFeeInfoRequest(): QueryDevFeeInfoRequest { export const QueryDevFeeInfoRequest = { typeUrl: "/evmos.fees.v1.QueryDevFeeInfoRequest", encode(message: QueryDevFeeInfoRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.contractAddress !== undefined) { + if (message.contractAddress !== "") { writer.uint32(10).string(message.contractAddress); } return writer; @@ -389,9 +411,9 @@ export const QueryDevFeeInfoRequest = { return message; }, fromJSON(object: any): QueryDevFeeInfoRequest { - const obj = createBaseQueryDevFeeInfoRequest(); - if (isSet(object.contractAddress)) obj.contractAddress = String(object.contractAddress); - return obj; + return { + contractAddress: isSet(object.contractAddress) ? String(object.contractAddress) : "" + }; }, toJSON(message: QueryDevFeeInfoRequest): JsonSafe<QueryDevFeeInfoRequest> { const obj: any = {}; @@ -477,9 +499,9 @@ export const QueryDevFeeInfoResponse = { return message; }, fromJSON(object: any): QueryDevFeeInfoResponse { - const obj = createBaseQueryDevFeeInfoResponse(); - if (isSet(object.fee)) obj.fee = DevFeeInfo.fromJSON(object.fee); - return obj; + return { + fee: isSet(object.fee) ? DevFeeInfo.fromJSON(object.fee) : undefined + }; }, toJSON(message: QueryDevFeeInfoResponse): JsonSafe<QueryDevFeeInfoResponse> { const obj: any = {}; @@ -488,9 +510,7 @@ export const QueryDevFeeInfoResponse = { }, fromPartial(object: DeepPartial<QueryDevFeeInfoResponse>): QueryDevFeeInfoResponse { const message = createBaseQueryDevFeeInfoResponse(); - if (object.fee !== undefined && object.fee !== null) { - message.fee = DevFeeInfo.fromPartial(object.fee); - } + message.fee = object.fee !== undefined && object.fee !== null ? DevFeeInfo.fromPartial(object.fee) : undefined; return message; }, fromSDK(object: QueryDevFeeInfoResponseSDKType): QueryDevFeeInfoResponse { @@ -559,8 +579,7 @@ export const QueryParamsRequest = { return message; }, fromJSON(_: any): QueryParamsRequest { - const obj = createBaseQueryParamsRequest(); - return obj; + return {}; }, toJSON(_: QueryParamsRequest): JsonSafe<QueryParamsRequest> { const obj: any = {}; @@ -635,9 +654,9 @@ export const QueryParamsResponse = { return message; }, fromJSON(object: any): QueryParamsResponse { - const obj = createBaseQueryParamsResponse(); - if (isSet(object.params)) obj.params = Params.fromJSON(object.params); - return obj; + return { + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined + }; }, toJSON(message: QueryParamsResponse): JsonSafe<QueryParamsResponse> { const obj: any = {}; @@ -646,9 +665,7 @@ export const QueryParamsResponse = { }, fromPartial(object: DeepPartial<QueryParamsResponse>): QueryParamsResponse { const message = createBaseQueryParamsResponse(); - if (object.params !== undefined && object.params !== null) { - message.params = Params.fromPartial(object.params); - } + message.params = object.params !== undefined && object.params !== null ? Params.fromPartial(object.params) : undefined; return message; }, fromSDK(object: QueryParamsResponseSDKType): QueryParamsResponse { @@ -703,7 +720,7 @@ function createBaseQueryDevFeeInfosPerDeployerRequest(): QueryDevFeeInfosPerDepl export const QueryDevFeeInfosPerDeployerRequest = { typeUrl: "/evmos.fees.v1.QueryDevFeeInfosPerDeployerRequest", encode(message: QueryDevFeeInfosPerDeployerRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.deployerAddress !== undefined) { + if (message.deployerAddress !== "") { writer.uint32(10).string(message.deployerAddress); } if (message.pagination !== undefined) { @@ -732,10 +749,10 @@ export const QueryDevFeeInfosPerDeployerRequest = { return message; }, fromJSON(object: any): QueryDevFeeInfosPerDeployerRequest { - const obj = createBaseQueryDevFeeInfosPerDeployerRequest(); - if (isSet(object.deployerAddress)) obj.deployerAddress = String(object.deployerAddress); - if (isSet(object.pagination)) obj.pagination = PageRequest.fromJSON(object.pagination); - return obj; + return { + deployerAddress: isSet(object.deployerAddress) ? String(object.deployerAddress) : "", + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined + }; }, toJSON(message: QueryDevFeeInfosPerDeployerRequest): JsonSafe<QueryDevFeeInfosPerDeployerRequest> { const obj: any = {}; @@ -746,9 +763,7 @@ export const QueryDevFeeInfosPerDeployerRequest = { fromPartial(object: DeepPartial<QueryDevFeeInfosPerDeployerRequest>): QueryDevFeeInfosPerDeployerRequest { const message = createBaseQueryDevFeeInfosPerDeployerRequest(); message.deployerAddress = object.deployerAddress ?? ""; - if (object.pagination !== undefined && object.pagination !== null) { - message.pagination = PageRequest.fromPartial(object.pagination); - } + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageRequest.fromPartial(object.pagination) : undefined; return message; }, fromSDK(object: QueryDevFeeInfosPerDeployerRequestSDKType): QueryDevFeeInfosPerDeployerRequest { @@ -839,10 +854,10 @@ export const QueryDevFeeInfosPerDeployerResponse = { return message; }, fromJSON(object: any): QueryDevFeeInfosPerDeployerResponse { - 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; + return { + fees: Array.isArray(object?.fees) ? object.fees.map((e: any) => DevFeeInfo.fromJSON(e)) : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined + }; }, toJSON(message: QueryDevFeeInfosPerDeployerResponse): JsonSafe<QueryDevFeeInfosPerDeployerResponse> { const obj: any = {}; @@ -857,9 +872,7 @@ export const QueryDevFeeInfosPerDeployerResponse = { fromPartial(object: DeepPartial<QueryDevFeeInfosPerDeployerResponse>): QueryDevFeeInfosPerDeployerResponse { const message = createBaseQueryDevFeeInfosPerDeployerResponse(); message.fees = object.fees?.map(e => DevFeeInfo.fromPartial(e)) || []; - if (object.pagination !== undefined && object.pagination !== null) { - message.pagination = PageResponse.fromPartial(object.pagination); - } + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageResponse.fromPartial(object.pagination) : undefined; 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 95cd693f8a..c226ee6556 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.js"; +import { MsgRegisterDevFeeInfo, MsgRegisterDevFeeInfoSDKType, MsgCancelDevFeeInfo, MsgCancelDevFeeInfoSDKType, MsgUpdateDevFeeInfo, MsgUpdateDevFeeInfoSDKType } from "./tx"; 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 9b58158d72..fc2890b2d6 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.js"; +import { MsgRegisterDevFeeInfo, MsgRegisterDevFeeInfoSDKType, MsgCancelDevFeeInfo, MsgCancelDevFeeInfoSDKType, MsgUpdateDevFeeInfo, MsgUpdateDevFeeInfoSDKType } from "./tx"; 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 54e96de557..d5c4b6ff41 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.js"; -import { BinaryReader } from "../../../binary.js"; -import { MsgRegisterDevFeeInfo, MsgRegisterDevFeeInfoSDKType, MsgRegisterDevFeeInfoResponse, MsgRegisterDevFeeInfoResponseSDKType, MsgCancelDevFeeInfo, MsgCancelDevFeeInfoSDKType, MsgCancelDevFeeInfoResponse, MsgCancelDevFeeInfoResponseSDKType, MsgUpdateDevFeeInfo, MsgUpdateDevFeeInfoSDKType, MsgUpdateDevFeeInfoResponse, MsgUpdateDevFeeInfoResponseSDKType } from "./tx.js"; +import { Rpc } from "../../../helpers"; +import { BinaryReader } from "../../../binary"; +import { MsgRegisterDevFeeInfo, MsgRegisterDevFeeInfoSDKType, MsgRegisterDevFeeInfoResponse, MsgRegisterDevFeeInfoResponseSDKType, MsgCancelDevFeeInfo, MsgCancelDevFeeInfoSDKType, MsgCancelDevFeeInfoResponse, MsgCancelDevFeeInfoResponseSDKType, MsgUpdateDevFeeInfo, MsgUpdateDevFeeInfoSDKType, MsgUpdateDevFeeInfoResponse, MsgUpdateDevFeeInfoResponseSDKType } from "./tx"; /** 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 73c0171c9c..53a321b9f5 100644 --- a/__fixtures__/v-next/outputv4/evmos/fees/v1/tx.ts +++ b/__fixtures__/v-next/outputv4/evmos/fees/v1/tx.ts @@ -1,6 +1,7 @@ -import { BinaryReader, BinaryWriter } from "../../../binary.js"; -import { isSet, DeepPartial } from "../../../helpers.js"; -import { JsonSafe } from "../../../json-safe.js"; +import { BinaryReader, BinaryWriter } from "../../../binary"; +import { isSet, DeepPartial } from "../../../helpers"; +import { JsonSafe } from "../../../json-safe"; +import { ComputedRef } from "vue"; export const protobufPackage = "evmos.fees.v1"; /** MsgRegisterFeesContract defines a message that registers a DevFeeInfo */ export interface MsgRegisterDevFeeInfo { @@ -20,6 +21,12 @@ export interface MsgRegisterDevFeeInfo { */ nonces: bigint[]; } +export interface ReactiveMsgRegisterDevFeeInfo { + contractAddress: ComputedRef<string>; + deployerAddress: ComputedRef<string>; + withdrawAddress: ComputedRef<string>; + nonces: ComputedRef<bigint[]>; +} export interface MsgRegisterDevFeeInfoProtoMsg { typeUrl: "/evmos.fees.v1.MsgRegisterDevFeeInfo"; value: Uint8Array; @@ -36,6 +43,7 @@ export interface MsgRegisterDevFeeInfoSDKType { * type */ export interface MsgRegisterDevFeeInfoResponse {} +export interface ReactiveMsgRegisterDevFeeInfoResponse {} export interface MsgRegisterDevFeeInfoResponseProtoMsg { typeUrl: "/evmos.fees.v1.MsgRegisterDevFeeInfoResponse"; value: Uint8Array; @@ -55,6 +63,10 @@ export interface MsgCancelDevFeeInfo { /** deployer bech32 address */ deployerAddress: string; } +export interface ReactiveMsgCancelDevFeeInfo { + contractAddress: ComputedRef<string>; + deployerAddress: ComputedRef<string>; +} export interface MsgCancelDevFeeInfoProtoMsg { typeUrl: "/evmos.fees.v1.MsgCancelDevFeeInfo"; value: Uint8Array; @@ -69,6 +81,7 @@ 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; @@ -87,6 +100,11 @@ export interface MsgUpdateDevFeeInfo { /** new withdraw bech32 address for receiving the transaction fees */ withdrawAddress: string; } +export interface ReactiveMsgUpdateDevFeeInfo { + contractAddress: ComputedRef<string>; + deployerAddress: ComputedRef<string>; + withdrawAddress: ComputedRef<string>; +} export interface MsgUpdateDevFeeInfoProtoMsg { typeUrl: "/evmos.fees.v1.MsgUpdateDevFeeInfo"; value: Uint8Array; @@ -102,6 +120,7 @@ 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; @@ -119,13 +138,13 @@ function createBaseMsgRegisterDevFeeInfo(): MsgRegisterDevFeeInfo { export const MsgRegisterDevFeeInfo = { typeUrl: "/evmos.fees.v1.MsgRegisterDevFeeInfo", encode(message: MsgRegisterDevFeeInfo, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.contractAddress !== undefined) { + if (message.contractAddress !== "") { writer.uint32(10).string(message.contractAddress); } - if (message.deployerAddress !== undefined) { + if (message.deployerAddress !== "") { writer.uint32(18).string(message.deployerAddress); } - if (message.withdrawAddress !== undefined) { + if (message.withdrawAddress !== "") { writer.uint32(26).string(message.withdrawAddress); } writer.uint32(34).fork(); @@ -169,12 +188,12 @@ export const MsgRegisterDevFeeInfo = { return message; }, fromJSON(object: any): MsgRegisterDevFeeInfo { - 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; + 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())) : [] + }; }, toJSON(message: MsgRegisterDevFeeInfo): JsonSafe<MsgRegisterDevFeeInfo> { const obj: any = {}; @@ -289,8 +308,7 @@ export const MsgRegisterDevFeeInfoResponse = { return message; }, fromJSON(_: any): MsgRegisterDevFeeInfoResponse { - const obj = createBaseMsgRegisterDevFeeInfoResponse(); - return obj; + return {}; }, toJSON(_: MsgRegisterDevFeeInfoResponse): JsonSafe<MsgRegisterDevFeeInfoResponse> { const obj: any = {}; @@ -343,10 +361,10 @@ function createBaseMsgCancelDevFeeInfo(): MsgCancelDevFeeInfo { export const MsgCancelDevFeeInfo = { typeUrl: "/evmos.fees.v1.MsgCancelDevFeeInfo", encode(message: MsgCancelDevFeeInfo, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.contractAddress !== undefined) { + if (message.contractAddress !== "") { writer.uint32(10).string(message.contractAddress); } - if (message.deployerAddress !== undefined) { + if (message.deployerAddress !== "") { writer.uint32(18).string(message.deployerAddress); } return writer; @@ -372,10 +390,10 @@ export const MsgCancelDevFeeInfo = { return message; }, fromJSON(object: any): MsgCancelDevFeeInfo { - const obj = createBaseMsgCancelDevFeeInfo(); - if (isSet(object.contractAddress)) obj.contractAddress = String(object.contractAddress); - if (isSet(object.deployerAddress)) obj.deployerAddress = String(object.deployerAddress); - return obj; + return { + contractAddress: isSet(object.contractAddress) ? String(object.contractAddress) : "", + deployerAddress: isSet(object.deployerAddress) ? String(object.deployerAddress) : "" + }; }, toJSON(message: MsgCancelDevFeeInfo): JsonSafe<MsgCancelDevFeeInfo> { const obj: any = {}; @@ -462,8 +480,7 @@ export const MsgCancelDevFeeInfoResponse = { return message; }, fromJSON(_: any): MsgCancelDevFeeInfoResponse { - const obj = createBaseMsgCancelDevFeeInfoResponse(); - return obj; + return {}; }, toJSON(_: MsgCancelDevFeeInfoResponse): JsonSafe<MsgCancelDevFeeInfoResponse> { const obj: any = {}; @@ -517,13 +534,13 @@ function createBaseMsgUpdateDevFeeInfo(): MsgUpdateDevFeeInfo { export const MsgUpdateDevFeeInfo = { typeUrl: "/evmos.fees.v1.MsgUpdateDevFeeInfo", encode(message: MsgUpdateDevFeeInfo, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.contractAddress !== undefined) { + if (message.contractAddress !== "") { writer.uint32(10).string(message.contractAddress); } - if (message.deployerAddress !== undefined) { + if (message.deployerAddress !== "") { writer.uint32(18).string(message.deployerAddress); } - if (message.withdrawAddress !== undefined) { + if (message.withdrawAddress !== "") { writer.uint32(26).string(message.withdrawAddress); } return writer; @@ -552,11 +569,11 @@ export const MsgUpdateDevFeeInfo = { return message; }, fromJSON(object: any): MsgUpdateDevFeeInfo { - 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; + return { + contractAddress: isSet(object.contractAddress) ? String(object.contractAddress) : "", + deployerAddress: isSet(object.deployerAddress) ? String(object.deployerAddress) : "", + withdrawAddress: isSet(object.withdrawAddress) ? String(object.withdrawAddress) : "" + }; }, toJSON(message: MsgUpdateDevFeeInfo): JsonSafe<MsgUpdateDevFeeInfo> { const obj: any = {}; @@ -652,8 +669,7 @@ export const MsgUpdateDevFeeInfoResponse = { return message; }, fromJSON(_: any): MsgUpdateDevFeeInfoResponse { - const obj = createBaseMsgUpdateDevFeeInfoResponse(); - return obj; + return {}; }, toJSON(_: MsgUpdateDevFeeInfoResponse): JsonSafe<MsgUpdateDevFeeInfoResponse> { 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 de48b538ca..98cfc0c09f 100644 --- a/__fixtures__/v-next/outputv4/evmos/incentives/v1/genesis.ts +++ b/__fixtures__/v-next/outputv4/evmos/incentives/v1/genesis.ts @@ -1,8 +1,9 @@ -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 { Incentive, IncentiveSDKType, GasMeter, GasMeterSDKType } from "./incentives"; +import { BinaryReader, BinaryWriter } from "../../../binary"; +import { isSet, DeepPartial } from "../../../helpers"; +import { JsonSafe } from "../../../json-safe"; 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 { @@ -13,6 +14,11 @@ export interface GenesisState { /** active Gasmeters */ gasMeters: GasMeter[]; } +export interface ReactiveGenesisState { + params: ComputedRef<Params>; + incentives: ComputedRef<Incentive[]>; + gasMeters: ComputedRef<GasMeter[]>; +} export interface GenesisStateProtoMsg { typeUrl: "/evmos.incentives.v1.GenesisState"; value: Uint8Array; @@ -34,6 +40,12 @@ export interface Params { /** scaling factor for capping rewards */ rewardScaler: string; } +export interface ReactiveParams { + enableIncentives: ComputedRef<boolean>; + allocationLimit: ComputedRef<string>; + incentivesEpochIdentifier: ComputedRef<string>; + rewardScaler: ComputedRef<string>; +} export interface ParamsProtoMsg { typeUrl: "/evmos.incentives.v1.Params"; value: Uint8Array; @@ -90,11 +102,11 @@ export const GenesisState = { return message; }, fromJSON(object: any): GenesisState { - 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; + 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)) : [] + }; }, toJSON(message: GenesisState): JsonSafe<GenesisState> { const obj: any = {}; @@ -113,9 +125,7 @@ export const GenesisState = { }, fromPartial(object: DeepPartial<GenesisState>): GenesisState { const message = createBaseGenesisState(); - if (object.params !== undefined && object.params !== null) { - message.params = Params.fromPartial(object.params); - } + message.params = object.params !== undefined && object.params !== null ? Params.fromPartial(object.params) : undefined; message.incentives = object.incentives?.map(e => Incentive.fromPartial(e)) || []; message.gasMeters = object.gasMeters?.map(e => GasMeter.fromPartial(e)) || []; return message; @@ -200,16 +210,16 @@ function createBaseParams(): Params { export const Params = { typeUrl: "/evmos.incentives.v1.Params", encode(message: Params, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.enableIncentives !== undefined) { + if (message.enableIncentives === true) { writer.uint32(8).bool(message.enableIncentives); } - if (message.allocationLimit !== undefined) { + if (message.allocationLimit !== "") { writer.uint32(18).string(Decimal.fromUserInput(message.allocationLimit, 18).atomics); } - if (message.incentivesEpochIdentifier !== undefined) { + if (message.incentivesEpochIdentifier !== "") { writer.uint32(26).string(message.incentivesEpochIdentifier); } - if (message.rewardScaler !== undefined) { + if (message.rewardScaler !== "") { writer.uint32(34).string(Decimal.fromUserInput(message.rewardScaler, 18).atomics); } return writer; @@ -241,12 +251,12 @@ export const Params = { return message; }, fromJSON(object: any): Params { - 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; + 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) : "" + }; }, toJSON(message: Params): JsonSafe<Params> { 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 10773706f2..31a6a5d7f9 100644 --- a/__fixtures__/v-next/outputv4/evmos/incentives/v1/incentives.ts +++ b/__fixtures__/v-next/outputv4/evmos/incentives/v1/incentives.ts @@ -1,8 +1,9 @@ -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"; +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"; export const protobufPackage = "evmos.incentives.v1"; /** * Incentive defines an instance that organizes distribution conditions for a @@ -20,6 +21,13 @@ export interface Incentive { /** cumulative gas spent by all gasmeters of the incentive during the epoch */ totalGas: bigint; } +export interface ReactiveIncentive { + contract: ComputedRef<string>; + allocations: ComputedRef<DecCoin[]>; + epochs: ComputedRef<number>; + startTime: ComputedRef<Date>; + totalGas: ComputedRef<bigint>; +} export interface IncentiveProtoMsg { typeUrl: "/evmos.incentives.v1.Incentive"; value: Uint8Array; @@ -44,6 +52,11 @@ export interface GasMeter { /** cumulative gas spent during the epoch */ cumulativeGas: bigint; } +export interface ReactiveGasMeter { + contract: ComputedRef<string>; + participant: ComputedRef<string>; + cumulativeGas: ComputedRef<bigint>; +} export interface GasMeterProtoMsg { typeUrl: "/evmos.incentives.v1.GasMeter"; value: Uint8Array; @@ -67,6 +80,13 @@ export interface RegisterIncentiveProposal { /** number of remaining epochs */ epochs: number; } +export interface ReactiveRegisterIncentiveProposal { + title: ComputedRef<string>; + description: ComputedRef<string>; + contract: ComputedRef<string>; + allocations: ComputedRef<DecCoin[]>; + epochs: ComputedRef<number>; +} export interface RegisterIncentiveProposalProtoMsg { typeUrl: "/evmos.incentives.v1.RegisterIncentiveProposal"; value: Uint8Array; @@ -88,6 +108,11 @@ export interface CancelIncentiveProposal { /** contract address */ contract: string; } +export interface ReactiveCancelIncentiveProposal { + title: ComputedRef<string>; + description: ComputedRef<string>; + contract: ComputedRef<string>; +} export interface CancelIncentiveProposalProtoMsg { typeUrl: "/evmos.incentives.v1.CancelIncentiveProposal"; value: Uint8Array; @@ -110,19 +135,19 @@ function createBaseIncentive(): Incentive { export const Incentive = { typeUrl: "/evmos.incentives.v1.Incentive", encode(message: Incentive, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.contract !== undefined) { + if (message.contract !== "") { writer.uint32(10).string(message.contract); } for (const v of message.allocations) { DecCoin.encode(v!, writer.uint32(18).fork()).ldelim(); } - if (message.epochs !== undefined) { + if (message.epochs !== 0) { writer.uint32(24).uint32(message.epochs); } if (message.startTime !== undefined) { Timestamp.encode(toTimestamp(message.startTime), writer.uint32(34).fork()).ldelim(); } - if (message.totalGas !== undefined) { + if (message.totalGas !== BigInt(0)) { writer.uint32(40).uint64(message.totalGas); } return writer; @@ -157,13 +182,13 @@ export const Incentive = { return message; }, fromJSON(object: any): Incentive { - 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; + 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) + }; }, toJSON(message: Incentive): JsonSafe<Incentive> { const obj: any = {}; @@ -184,9 +209,7 @@ export const Incentive = { message.allocations = object.allocations?.map(e => DecCoin.fromPartial(e)) || []; message.epochs = object.epochs ?? 0; message.startTime = object.startTime ?? undefined; - if (object.totalGas !== undefined && object.totalGas !== null) { - message.totalGas = BigInt(object.totalGas.toString()); - } + message.totalGas = object.totalGas !== undefined && object.totalGas !== null ? BigInt(object.totalGas.toString()) : BigInt(0); return message; }, fromSDK(object: IncentiveSDKType): Incentive { @@ -276,13 +299,13 @@ function createBaseGasMeter(): GasMeter { export const GasMeter = { typeUrl: "/evmos.incentives.v1.GasMeter", encode(message: GasMeter, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.contract !== undefined) { + if (message.contract !== "") { writer.uint32(10).string(message.contract); } - if (message.participant !== undefined) { + if (message.participant !== "") { writer.uint32(18).string(message.participant); } - if (message.cumulativeGas !== undefined) { + if (message.cumulativeGas !== BigInt(0)) { writer.uint32(24).uint64(message.cumulativeGas); } return writer; @@ -311,11 +334,11 @@ export const GasMeter = { return message; }, fromJSON(object: any): GasMeter { - 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; + 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) + }; }, toJSON(message: GasMeter): JsonSafe<GasMeter> { const obj: any = {}; @@ -328,9 +351,7 @@ export const GasMeter = { const message = createBaseGasMeter(); message.contract = object.contract ?? ""; message.participant = object.participant ?? ""; - if (object.cumulativeGas !== undefined && object.cumulativeGas !== null) { - message.cumulativeGas = BigInt(object.cumulativeGas.toString()); - } + message.cumulativeGas = object.cumulativeGas !== undefined && object.cumulativeGas !== null ? BigInt(object.cumulativeGas.toString()) : BigInt(0); return message; }, fromSDK(object: GasMeterSDKType): GasMeter { @@ -402,19 +423,19 @@ function createBaseRegisterIncentiveProposal(): RegisterIncentiveProposal { export const RegisterIncentiveProposal = { typeUrl: "/evmos.incentives.v1.RegisterIncentiveProposal", encode(message: RegisterIncentiveProposal, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.title !== undefined) { + if (message.title !== "") { writer.uint32(10).string(message.title); } - if (message.description !== undefined) { + if (message.description !== "") { writer.uint32(18).string(message.description); } - if (message.contract !== undefined) { + if (message.contract !== "") { writer.uint32(26).string(message.contract); } for (const v of message.allocations) { DecCoin.encode(v!, writer.uint32(34).fork()).ldelim(); } - if (message.epochs !== undefined) { + if (message.epochs !== 0) { writer.uint32(40).uint32(message.epochs); } return writer; @@ -449,13 +470,13 @@ export const RegisterIncentiveProposal = { return message; }, fromJSON(object: any): RegisterIncentiveProposal { - 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; + 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 + }; }, toJSON(message: RegisterIncentiveProposal): JsonSafe<RegisterIncentiveProposal> { const obj: any = {}; @@ -566,13 +587,13 @@ function createBaseCancelIncentiveProposal(): CancelIncentiveProposal { export const CancelIncentiveProposal = { typeUrl: "/evmos.incentives.v1.CancelIncentiveProposal", encode(message: CancelIncentiveProposal, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.title !== undefined) { + if (message.title !== "") { writer.uint32(10).string(message.title); } - if (message.description !== undefined) { + if (message.description !== "") { writer.uint32(18).string(message.description); } - if (message.contract !== undefined) { + if (message.contract !== "") { writer.uint32(26).string(message.contract); } return writer; @@ -601,11 +622,11 @@ export const CancelIncentiveProposal = { return message; }, fromJSON(object: any): CancelIncentiveProposal { - 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; + return { + title: isSet(object.title) ? String(object.title) : "", + description: isSet(object.description) ? String(object.description) : "", + contract: isSet(object.contract) ? String(object.contract) : "" + }; }, toJSON(message: CancelIncentiveProposal): JsonSafe<CancelIncentiveProposal> { 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 db8fb0ef56..cd66d16083 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.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 { 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 { 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.js"; +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"; export class LCDQueryClient { req: LCDClient; constructor({ @@ -23,7 +23,7 @@ export class LCDQueryClient { } /* Incentives retrieves registered incentives */ async incentives(params: QueryIncentivesRequest = { - pagination: PageRequest.fromPartial({}) + pagination: undefined }): Promise<QueryIncentivesResponseSDKType> { 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: PageRequest.fromPartial({}) + pagination: undefined }): Promise<QueryAllocationMetersResponseSDKType> { 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 fbb2185e21..c10afcd909 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.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 { 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 { 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 } from "./query.js"; +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"; /** 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: PageRequest.fromPartial({}) + pagination: undefined }): Promise<QueryIncentivesResponse> { 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: PageRequest.fromPartial({}) + pagination: undefined }): Promise<QueryAllocationMetersResponse> { 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 269c2b95ea..e4f56c9f53 100644 --- a/__fixtures__/v-next/outputv4/evmos/incentives/v1/query.ts +++ b/__fixtures__/v-next/outputv4/evmos/incentives/v1/query.ts @@ -1,10 +1,11 @@ -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"; +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"; export const protobufPackage = "evmos.incentives.v1"; /** * QueryIncentivesRequest is the request type for the Query/Incentives RPC @@ -14,6 +15,9 @@ export interface QueryIncentivesRequest { /** pagination defines an optional pagination for the request. */ pagination?: PageRequest; } +export interface ReactiveQueryIncentivesRequest { + pagination?: ComputedRef<PageRequest>; +} export interface QueryIncentivesRequestProtoMsg { typeUrl: "/evmos.incentives.v1.QueryIncentivesRequest"; value: Uint8Array; @@ -34,6 +38,10 @@ export interface QueryIncentivesResponse { /** pagination defines the pagination in the response. */ pagination?: PageResponse; } +export interface ReactiveQueryIncentivesResponse { + incentives: ComputedRef<Incentive[]>; + pagination?: ComputedRef<PageResponse>; +} export interface QueryIncentivesResponseProtoMsg { typeUrl: "/evmos.incentives.v1.QueryIncentivesResponse"; value: Uint8Array; @@ -51,6 +59,9 @@ export interface QueryIncentiveRequest { /** contract identifier is the hex contract address of a contract */ contract: string; } +export interface ReactiveQueryIncentiveRequest { + contract: ComputedRef<string>; +} export interface QueryIncentiveRequestProtoMsg { typeUrl: "/evmos.incentives.v1.QueryIncentiveRequest"; value: Uint8Array; @@ -66,6 +77,9 @@ export interface QueryIncentiveRequestSDKType { export interface QueryIncentiveResponse { incentive: Incentive; } +export interface ReactiveQueryIncentiveResponse { + incentive: ComputedRef<Incentive>; +} export interface QueryIncentiveResponseProtoMsg { typeUrl: "/evmos.incentives.v1.QueryIncentiveResponse"; value: Uint8Array; @@ -87,6 +101,10 @@ export interface QueryGasMetersRequest { /** pagination defines an optional pagination for the request. */ pagination?: PageRequest; } +export interface ReactiveQueryGasMetersRequest { + contract: ComputedRef<string>; + pagination?: ComputedRef<PageRequest>; +} export interface QueryGasMetersRequestProtoMsg { typeUrl: "/evmos.incentives.v1.QueryGasMetersRequest"; value: Uint8Array; @@ -108,6 +126,10 @@ export interface QueryGasMetersResponse { /** pagination defines the pagination in the response. */ pagination?: PageResponse; } +export interface ReactiveQueryGasMetersResponse { + gasMeters: ComputedRef<GasMeter[]>; + pagination?: ComputedRef<PageResponse>; +} export interface QueryGasMetersResponseProtoMsg { typeUrl: "/evmos.incentives.v1.QueryGasMetersResponse"; value: Uint8Array; @@ -127,6 +149,10 @@ export interface QueryGasMeterRequest { /** participant identifier is the hex address of a user */ participant: string; } +export interface ReactiveQueryGasMeterRequest { + contract: ComputedRef<string>; + participant: ComputedRef<string>; +} export interface QueryGasMeterRequestProtoMsg { typeUrl: "/evmos.incentives.v1.QueryGasMeterRequest"; value: Uint8Array; @@ -143,6 +169,9 @@ export interface QueryGasMeterRequestSDKType { export interface QueryGasMeterResponse { gasMeter: bigint; } +export interface ReactiveQueryGasMeterResponse { + gasMeter: ComputedRef<bigint>; +} export interface QueryGasMeterResponseProtoMsg { typeUrl: "/evmos.incentives.v1.QueryGasMeterResponse"; value: Uint8Array; @@ -162,6 +191,9 @@ export interface QueryAllocationMetersRequest { /** pagination defines an optional pagination for the request. */ pagination?: PageRequest; } +export interface ReactiveQueryAllocationMetersRequest { + pagination?: ComputedRef<PageRequest>; +} export interface QueryAllocationMetersRequestProtoMsg { typeUrl: "/evmos.incentives.v1.QueryAllocationMetersRequest"; value: Uint8Array; @@ -182,6 +214,10 @@ export interface QueryAllocationMetersResponse { /** pagination defines the pagination in the response. */ pagination?: PageResponse; } +export interface ReactiveQueryAllocationMetersResponse { + allocationMeters: ComputedRef<DecCoin[]>; + pagination?: ComputedRef<PageResponse>; +} export interface QueryAllocationMetersResponseProtoMsg { typeUrl: "/evmos.incentives.v1.QueryAllocationMetersResponse"; value: Uint8Array; @@ -202,6 +238,9 @@ export interface QueryAllocationMeterRequest { /** denom is the coin denom to query an allocation meter for. */ denom: string; } +export interface ReactiveQueryAllocationMeterRequest { + denom: ComputedRef<string>; +} export interface QueryAllocationMeterRequestProtoMsg { typeUrl: "/evmos.incentives.v1.QueryAllocationMeterRequest"; value: Uint8Array; @@ -220,6 +259,9 @@ export interface QueryAllocationMeterRequestSDKType { export interface QueryAllocationMeterResponse { allocationMeter: DecCoin; } +export interface ReactiveQueryAllocationMeterResponse { + allocationMeter: ComputedRef<DecCoin>; +} export interface QueryAllocationMeterResponseProtoMsg { typeUrl: "/evmos.incentives.v1.QueryAllocationMeterResponse"; value: Uint8Array; @@ -233,6 +275,7 @@ 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; @@ -246,6 +289,9 @@ export interface QueryParamsRequestSDKType {} export interface QueryParamsResponse { params: Params; } +export interface ReactiveQueryParamsResponse { + params: ComputedRef<Params>; +} export interface QueryParamsResponseProtoMsg { typeUrl: "/evmos.incentives.v1.QueryParamsResponse"; value: Uint8Array; @@ -288,9 +334,9 @@ export const QueryIncentivesRequest = { return message; }, fromJSON(object: any): QueryIncentivesRequest { - const obj = createBaseQueryIncentivesRequest(); - if (isSet(object.pagination)) obj.pagination = PageRequest.fromJSON(object.pagination); - return obj; + return { + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined + }; }, toJSON(message: QueryIncentivesRequest): JsonSafe<QueryIncentivesRequest> { const obj: any = {}; @@ -299,9 +345,7 @@ export const QueryIncentivesRequest = { }, fromPartial(object: DeepPartial<QueryIncentivesRequest>): QueryIncentivesRequest { const message = createBaseQueryIncentivesRequest(); - if (object.pagination !== undefined && object.pagination !== null) { - message.pagination = PageRequest.fromPartial(object.pagination); - } + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageRequest.fromPartial(object.pagination) : undefined; return message; }, fromSDK(object: QueryIncentivesRequestSDKType): QueryIncentivesRequest { @@ -385,10 +429,10 @@ export const QueryIncentivesResponse = { return message; }, fromJSON(object: any): QueryIncentivesResponse { - 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; + return { + incentives: Array.isArray(object?.incentives) ? object.incentives.map((e: any) => Incentive.fromJSON(e)) : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined + }; }, toJSON(message: QueryIncentivesResponse): JsonSafe<QueryIncentivesResponse> { const obj: any = {}; @@ -403,9 +447,7 @@ export const QueryIncentivesResponse = { fromPartial(object: DeepPartial<QueryIncentivesResponse>): QueryIncentivesResponse { const message = createBaseQueryIncentivesResponse(); message.incentives = object.incentives?.map(e => Incentive.fromPartial(e)) || []; - if (object.pagination !== undefined && object.pagination !== null) { - message.pagination = PageResponse.fromPartial(object.pagination); - } + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageResponse.fromPartial(object.pagination) : undefined; return message; }, fromSDK(object: QueryIncentivesResponseSDKType): QueryIncentivesResponse { @@ -472,7 +514,7 @@ function createBaseQueryIncentiveRequest(): QueryIncentiveRequest { export const QueryIncentiveRequest = { typeUrl: "/evmos.incentives.v1.QueryIncentiveRequest", encode(message: QueryIncentiveRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.contract !== undefined) { + if (message.contract !== "") { writer.uint32(10).string(message.contract); } return writer; @@ -495,9 +537,9 @@ export const QueryIncentiveRequest = { return message; }, fromJSON(object: any): QueryIncentiveRequest { - const obj = createBaseQueryIncentiveRequest(); - if (isSet(object.contract)) obj.contract = String(object.contract); - return obj; + return { + contract: isSet(object.contract) ? String(object.contract) : "" + }; }, toJSON(message: QueryIncentiveRequest): JsonSafe<QueryIncentiveRequest> { const obj: any = {}; @@ -583,9 +625,9 @@ export const QueryIncentiveResponse = { return message; }, fromJSON(object: any): QueryIncentiveResponse { - const obj = createBaseQueryIncentiveResponse(); - if (isSet(object.incentive)) obj.incentive = Incentive.fromJSON(object.incentive); - return obj; + return { + incentive: isSet(object.incentive) ? Incentive.fromJSON(object.incentive) : undefined + }; }, toJSON(message: QueryIncentiveResponse): JsonSafe<QueryIncentiveResponse> { const obj: any = {}; @@ -594,9 +636,7 @@ export const QueryIncentiveResponse = { }, fromPartial(object: DeepPartial<QueryIncentiveResponse>): QueryIncentiveResponse { const message = createBaseQueryIncentiveResponse(); - if (object.incentive !== undefined && object.incentive !== null) { - message.incentive = Incentive.fromPartial(object.incentive); - } + message.incentive = object.incentive !== undefined && object.incentive !== null ? Incentive.fromPartial(object.incentive) : undefined; return message; }, fromSDK(object: QueryIncentiveResponseSDKType): QueryIncentiveResponse { @@ -651,7 +691,7 @@ function createBaseQueryGasMetersRequest(): QueryGasMetersRequest { export const QueryGasMetersRequest = { typeUrl: "/evmos.incentives.v1.QueryGasMetersRequest", encode(message: QueryGasMetersRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.contract !== undefined) { + if (message.contract !== "") { writer.uint32(10).string(message.contract); } if (message.pagination !== undefined) { @@ -680,10 +720,10 @@ export const QueryGasMetersRequest = { return message; }, fromJSON(object: any): QueryGasMetersRequest { - const obj = createBaseQueryGasMetersRequest(); - if (isSet(object.contract)) obj.contract = String(object.contract); - if (isSet(object.pagination)) obj.pagination = PageRequest.fromJSON(object.pagination); - return obj; + return { + contract: isSet(object.contract) ? String(object.contract) : "", + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined + }; }, toJSON(message: QueryGasMetersRequest): JsonSafe<QueryGasMetersRequest> { const obj: any = {}; @@ -694,9 +734,7 @@ export const QueryGasMetersRequest = { fromPartial(object: DeepPartial<QueryGasMetersRequest>): QueryGasMetersRequest { const message = createBaseQueryGasMetersRequest(); message.contract = object.contract ?? ""; - if (object.pagination !== undefined && object.pagination !== null) { - message.pagination = PageRequest.fromPartial(object.pagination); - } + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageRequest.fromPartial(object.pagination) : undefined; return message; }, fromSDK(object: QueryGasMetersRequestSDKType): QueryGasMetersRequest { @@ -787,10 +825,10 @@ export const QueryGasMetersResponse = { return message; }, fromJSON(object: any): QueryGasMetersResponse { - 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; + return { + gasMeters: Array.isArray(object?.gasMeters) ? object.gasMeters.map((e: any) => GasMeter.fromJSON(e)) : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined + }; }, toJSON(message: QueryGasMetersResponse): JsonSafe<QueryGasMetersResponse> { const obj: any = {}; @@ -805,9 +843,7 @@ export const QueryGasMetersResponse = { fromPartial(object: DeepPartial<QueryGasMetersResponse>): QueryGasMetersResponse { const message = createBaseQueryGasMetersResponse(); message.gasMeters = object.gasMeters?.map(e => GasMeter.fromPartial(e)) || []; - if (object.pagination !== undefined && object.pagination !== null) { - message.pagination = PageResponse.fromPartial(object.pagination); - } + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageResponse.fromPartial(object.pagination) : undefined; return message; }, fromSDK(object: QueryGasMetersResponseSDKType): QueryGasMetersResponse { @@ -875,10 +911,10 @@ function createBaseQueryGasMeterRequest(): QueryGasMeterRequest { export const QueryGasMeterRequest = { typeUrl: "/evmos.incentives.v1.QueryGasMeterRequest", encode(message: QueryGasMeterRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.contract !== undefined) { + if (message.contract !== "") { writer.uint32(10).string(message.contract); } - if (message.participant !== undefined) { + if (message.participant !== "") { writer.uint32(18).string(message.participant); } return writer; @@ -904,10 +940,10 @@ export const QueryGasMeterRequest = { return message; }, fromJSON(object: any): QueryGasMeterRequest { - const obj = createBaseQueryGasMeterRequest(); - if (isSet(object.contract)) obj.contract = String(object.contract); - if (isSet(object.participant)) obj.participant = String(object.participant); - return obj; + return { + contract: isSet(object.contract) ? String(object.contract) : "", + participant: isSet(object.participant) ? String(object.participant) : "" + }; }, toJSON(message: QueryGasMeterRequest): JsonSafe<QueryGasMeterRequest> { const obj: any = {}; @@ -979,7 +1015,7 @@ function createBaseQueryGasMeterResponse(): QueryGasMeterResponse { export const QueryGasMeterResponse = { typeUrl: "/evmos.incentives.v1.QueryGasMeterResponse", encode(message: QueryGasMeterResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.gasMeter !== undefined) { + if (message.gasMeter !== BigInt(0)) { writer.uint32(8).uint64(message.gasMeter); } return writer; @@ -1002,9 +1038,9 @@ export const QueryGasMeterResponse = { return message; }, fromJSON(object: any): QueryGasMeterResponse { - const obj = createBaseQueryGasMeterResponse(); - if (isSet(object.gasMeter)) obj.gasMeter = BigInt(object.gasMeter.toString()); - return obj; + return { + gasMeter: isSet(object.gasMeter) ? BigInt(object.gasMeter.toString()) : BigInt(0) + }; }, toJSON(message: QueryGasMeterResponse): JsonSafe<QueryGasMeterResponse> { const obj: any = {}; @@ -1013,9 +1049,7 @@ export const QueryGasMeterResponse = { }, fromPartial(object: DeepPartial<QueryGasMeterResponse>): QueryGasMeterResponse { const message = createBaseQueryGasMeterResponse(); - if (object.gasMeter !== undefined && object.gasMeter !== null) { - message.gasMeter = BigInt(object.gasMeter.toString()); - } + message.gasMeter = object.gasMeter !== undefined && object.gasMeter !== null ? BigInt(object.gasMeter.toString()) : BigInt(0); return message; }, fromSDK(object: QueryGasMeterResponseSDKType): QueryGasMeterResponse { @@ -1092,9 +1126,9 @@ export const QueryAllocationMetersRequest = { return message; }, fromJSON(object: any): QueryAllocationMetersRequest { - const obj = createBaseQueryAllocationMetersRequest(); - if (isSet(object.pagination)) obj.pagination = PageRequest.fromJSON(object.pagination); - return obj; + return { + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined + }; }, toJSON(message: QueryAllocationMetersRequest): JsonSafe<QueryAllocationMetersRequest> { const obj: any = {}; @@ -1103,9 +1137,7 @@ export const QueryAllocationMetersRequest = { }, fromPartial(object: DeepPartial<QueryAllocationMetersRequest>): QueryAllocationMetersRequest { const message = createBaseQueryAllocationMetersRequest(); - if (object.pagination !== undefined && object.pagination !== null) { - message.pagination = PageRequest.fromPartial(object.pagination); - } + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageRequest.fromPartial(object.pagination) : undefined; return message; }, fromSDK(object: QueryAllocationMetersRequestSDKType): QueryAllocationMetersRequest { @@ -1189,10 +1221,10 @@ export const QueryAllocationMetersResponse = { return message; }, fromJSON(object: any): QueryAllocationMetersResponse { - 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; + return { + allocationMeters: Array.isArray(object?.allocationMeters) ? object.allocationMeters.map((e: any) => DecCoin.fromJSON(e)) : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined + }; }, toJSON(message: QueryAllocationMetersResponse): JsonSafe<QueryAllocationMetersResponse> { const obj: any = {}; @@ -1207,9 +1239,7 @@ export const QueryAllocationMetersResponse = { fromPartial(object: DeepPartial<QueryAllocationMetersResponse>): QueryAllocationMetersResponse { const message = createBaseQueryAllocationMetersResponse(); message.allocationMeters = object.allocationMeters?.map(e => DecCoin.fromPartial(e)) || []; - if (object.pagination !== undefined && object.pagination !== null) { - message.pagination = PageResponse.fromPartial(object.pagination); - } + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageResponse.fromPartial(object.pagination) : undefined; return message; }, fromSDK(object: QueryAllocationMetersResponseSDKType): QueryAllocationMetersResponse { @@ -1276,7 +1306,7 @@ function createBaseQueryAllocationMeterRequest(): QueryAllocationMeterRequest { export const QueryAllocationMeterRequest = { typeUrl: "/evmos.incentives.v1.QueryAllocationMeterRequest", encode(message: QueryAllocationMeterRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.denom !== undefined) { + if (message.denom !== "") { writer.uint32(10).string(message.denom); } return writer; @@ -1299,9 +1329,9 @@ export const QueryAllocationMeterRequest = { return message; }, fromJSON(object: any): QueryAllocationMeterRequest { - const obj = createBaseQueryAllocationMeterRequest(); - if (isSet(object.denom)) obj.denom = String(object.denom); - return obj; + return { + denom: isSet(object.denom) ? String(object.denom) : "" + }; }, toJSON(message: QueryAllocationMeterRequest): JsonSafe<QueryAllocationMeterRequest> { const obj: any = {}; @@ -1387,9 +1417,9 @@ export const QueryAllocationMeterResponse = { return message; }, fromJSON(object: any): QueryAllocationMeterResponse { - const obj = createBaseQueryAllocationMeterResponse(); - if (isSet(object.allocationMeter)) obj.allocationMeter = DecCoin.fromJSON(object.allocationMeter); - return obj; + return { + allocationMeter: isSet(object.allocationMeter) ? DecCoin.fromJSON(object.allocationMeter) : undefined + }; }, toJSON(message: QueryAllocationMeterResponse): JsonSafe<QueryAllocationMeterResponse> { const obj: any = {}; @@ -1398,9 +1428,7 @@ export const QueryAllocationMeterResponse = { }, fromPartial(object: DeepPartial<QueryAllocationMeterResponse>): QueryAllocationMeterResponse { const message = createBaseQueryAllocationMeterResponse(); - if (object.allocationMeter !== undefined && object.allocationMeter !== null) { - message.allocationMeter = DecCoin.fromPartial(object.allocationMeter); - } + message.allocationMeter = object.allocationMeter !== undefined && object.allocationMeter !== null ? DecCoin.fromPartial(object.allocationMeter) : undefined; return message; }, fromSDK(object: QueryAllocationMeterResponseSDKType): QueryAllocationMeterResponse { @@ -1469,8 +1497,7 @@ export const QueryParamsRequest = { return message; }, fromJSON(_: any): QueryParamsRequest { - const obj = createBaseQueryParamsRequest(); - return obj; + return {}; }, toJSON(_: QueryParamsRequest): JsonSafe<QueryParamsRequest> { const obj: any = {}; @@ -1545,9 +1572,9 @@ export const QueryParamsResponse = { return message; }, fromJSON(object: any): QueryParamsResponse { - const obj = createBaseQueryParamsResponse(); - if (isSet(object.params)) obj.params = Params.fromJSON(object.params); - return obj; + return { + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined + }; }, toJSON(message: QueryParamsResponse): JsonSafe<QueryParamsResponse> { const obj: any = {}; @@ -1556,9 +1583,7 @@ export const QueryParamsResponse = { }, fromPartial(object: DeepPartial<QueryParamsResponse>): QueryParamsResponse { const message = createBaseQueryParamsResponse(); - if (object.params !== undefined && object.params !== null) { - message.params = Params.fromPartial(object.params); - } + message.params = object.params !== undefined && object.params !== null ? Params.fromPartial(object.params) : undefined; 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 afd1e2695b..437d9bc6ba 100644 --- a/__fixtures__/v-next/outputv4/evmos/inflation/v1/genesis.ts +++ b/__fixtures__/v-next/outputv4/evmos/inflation/v1/genesis.ts @@ -1,7 +1,8 @@ -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"; +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"; export const protobufPackage = "evmos.inflation.v1"; /** GenesisState defines the inflation module's genesis state. */ export interface GenesisState { @@ -16,6 +17,13 @@ export interface GenesisState { /** number of epochs that have passed while inflation is disabled */ skippedEpochs: bigint; } +export interface ReactiveGenesisState { + params: ComputedRef<Params>; + period: ComputedRef<bigint>; + epochIdentifier: ComputedRef<string>; + epochsPerPeriod: ComputedRef<bigint>; + skippedEpochs: ComputedRef<bigint>; +} export interface GenesisStateProtoMsg { typeUrl: "/evmos.inflation.v1.GenesisState"; value: Uint8Array; @@ -39,6 +47,12 @@ export interface Params { /** parameter to enable inflation and halt increasing the skipped_epochs */ enableInflation: boolean; } +export interface ReactiveParams { + mintDenom: ComputedRef<string>; + exponentialCalculation: ComputedRef<ExponentialCalculation>; + inflationDistribution: ComputedRef<InflationDistribution>; + enableInflation: ComputedRef<boolean>; +} export interface ParamsProtoMsg { typeUrl: "/evmos.inflation.v1.Params"; value: Uint8Array; @@ -65,16 +79,16 @@ export const GenesisState = { if (message.params !== undefined) { Params.encode(message.params, writer.uint32(10).fork()).ldelim(); } - if (message.period !== undefined) { + if (message.period !== BigInt(0)) { writer.uint32(16).uint64(message.period); } - if (message.epochIdentifier !== undefined) { + if (message.epochIdentifier !== "") { writer.uint32(26).string(message.epochIdentifier); } - if (message.epochsPerPeriod !== undefined) { + if (message.epochsPerPeriod !== BigInt(0)) { writer.uint32(32).int64(message.epochsPerPeriod); } - if (message.skippedEpochs !== undefined) { + if (message.skippedEpochs !== BigInt(0)) { writer.uint32(40).uint64(message.skippedEpochs); } return writer; @@ -109,13 +123,13 @@ export const GenesisState = { return message; }, fromJSON(object: any): GenesisState { - 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; + 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) + }; }, toJSON(message: GenesisState): JsonSafe<GenesisState> { const obj: any = {}; @@ -128,19 +142,11 @@ export const GenesisState = { }, fromPartial(object: DeepPartial<GenesisState>): GenesisState { const message = createBaseGenesisState(); - 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.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); message.epochIdentifier = object.epochIdentifier ?? ""; - 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()); - } + 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); return message; }, fromSDK(object: GenesisStateSDKType): GenesisState { @@ -225,7 +231,7 @@ function createBaseParams(): Params { export const Params = { typeUrl: "/evmos.inflation.v1.Params", encode(message: Params, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.mintDenom !== undefined) { + if (message.mintDenom !== "") { writer.uint32(10).string(message.mintDenom); } if (message.exponentialCalculation !== undefined) { @@ -234,7 +240,7 @@ export const Params = { if (message.inflationDistribution !== undefined) { InflationDistribution.encode(message.inflationDistribution, writer.uint32(26).fork()).ldelim(); } - if (message.enableInflation !== undefined) { + if (message.enableInflation === true) { writer.uint32(32).bool(message.enableInflation); } return writer; @@ -266,12 +272,12 @@ export const Params = { return message; }, fromJSON(object: any): Params { - 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; + 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 + }; }, toJSON(message: Params): JsonSafe<Params> { const obj: any = {}; @@ -284,12 +290,8 @@ export const Params = { fromPartial(object: DeepPartial<Params>): Params { const message = createBaseParams(); message.mintDenom = object.mintDenom ?? ""; - 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.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; 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 3e3e763054..5efa496911 100644 --- a/__fixtures__/v-next/outputv4/evmos/inflation/v1/inflation.ts +++ b/__fixtures__/v-next/outputv4/evmos/inflation/v1/inflation.ts @@ -1,7 +1,8 @@ -import { BinaryReader, BinaryWriter } from "../../../binary.js"; +import { BinaryReader, BinaryWriter } from "../../../binary"; import { Decimal } from "@cosmjs/math"; -import { isSet, DeepPartial } from "../../../helpers.js"; -import { JsonSafe } from "../../../json-safe.js"; +import { isSet, DeepPartial } from "../../../helpers"; +import { JsonSafe } from "../../../json-safe"; +import { ComputedRef } from "vue"; export const protobufPackage = "evmos.inflation.v1"; /** * InflationDistribution defines the distribution in which inflation is @@ -29,6 +30,11 @@ export interface InflationDistribution { */ communityPool: string; } +export interface ReactiveInflationDistribution { + stakingRewards: ComputedRef<string>; + usageIncentives: ComputedRef<string>; + communityPool: ComputedRef<string>; +} export interface InflationDistributionProtoMsg { typeUrl: "/evmos.inflation.v1.InflationDistribution"; value: Uint8Array; @@ -66,6 +72,13 @@ export interface ExponentialCalculation { /** max variance */ maxVariance: string; } +export interface ReactiveExponentialCalculation { + a: ComputedRef<string>; + r: ComputedRef<string>; + c: ComputedRef<string>; + bondingTarget: ComputedRef<string>; + maxVariance: ComputedRef<string>; +} export interface ExponentialCalculationProtoMsg { typeUrl: "/evmos.inflation.v1.ExponentialCalculation"; value: Uint8Array; @@ -94,13 +107,13 @@ function createBaseInflationDistribution(): InflationDistribution { export const InflationDistribution = { typeUrl: "/evmos.inflation.v1.InflationDistribution", encode(message: InflationDistribution, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.stakingRewards !== undefined) { + if (message.stakingRewards !== "") { writer.uint32(10).string(Decimal.fromUserInput(message.stakingRewards, 18).atomics); } - if (message.usageIncentives !== undefined) { + if (message.usageIncentives !== "") { writer.uint32(18).string(Decimal.fromUserInput(message.usageIncentives, 18).atomics); } - if (message.communityPool !== undefined) { + if (message.communityPool !== "") { writer.uint32(26).string(Decimal.fromUserInput(message.communityPool, 18).atomics); } return writer; @@ -129,11 +142,11 @@ export const InflationDistribution = { return message; }, fromJSON(object: any): InflationDistribution { - 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; + return { + stakingRewards: isSet(object.stakingRewards) ? String(object.stakingRewards) : "", + usageIncentives: isSet(object.usageIncentives) ? String(object.usageIncentives) : "", + communityPool: isSet(object.communityPool) ? String(object.communityPool) : "" + }; }, toJSON(message: InflationDistribution): JsonSafe<InflationDistribution> { const obj: any = {}; @@ -218,19 +231,19 @@ function createBaseExponentialCalculation(): ExponentialCalculation { export const ExponentialCalculation = { typeUrl: "/evmos.inflation.v1.ExponentialCalculation", encode(message: ExponentialCalculation, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.a !== undefined) { + if (message.a !== "") { writer.uint32(10).string(Decimal.fromUserInput(message.a, 18).atomics); } - if (message.r !== undefined) { + if (message.r !== "") { writer.uint32(18).string(Decimal.fromUserInput(message.r, 18).atomics); } - if (message.c !== undefined) { + if (message.c !== "") { writer.uint32(26).string(Decimal.fromUserInput(message.c, 18).atomics); } - if (message.bondingTarget !== undefined) { + if (message.bondingTarget !== "") { writer.uint32(34).string(Decimal.fromUserInput(message.bondingTarget, 18).atomics); } - if (message.maxVariance !== undefined) { + if (message.maxVariance !== "") { writer.uint32(42).string(Decimal.fromUserInput(message.maxVariance, 18).atomics); } return writer; @@ -265,13 +278,13 @@ export const ExponentialCalculation = { return message; }, fromJSON(object: any): ExponentialCalculation { - 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; + 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) : "" + }; }, toJSON(message: ExponentialCalculation): JsonSafe<ExponentialCalculation> { 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 c0003be8a7..a97ae8c1ed 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.js"; -import { Params, ParamsSDKType } from "./genesis.js"; +import { DecCoin, DecCoinSDKType } from "../../../cosmos/base/v1beta1/coin"; +import { Params, ParamsSDKType } from "./genesis"; 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.js"; +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"; 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 8fd4bb0327..64ac1847e1 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.js"; -import { Params, ParamsSDKType } from "./genesis.js"; -import { Rpc } from "../../../helpers.js"; -import { BinaryReader } from "../../../binary.js"; +import { DecCoin, DecCoinSDKType } from "../../../cosmos/base/v1beta1/coin"; +import { Params, ParamsSDKType } from "./genesis"; +import { Rpc } from "../../../helpers"; +import { BinaryReader } from "../../../binary"; 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 } from "./query.js"; +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"; /** 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 3baa5c0dde..84f1d230dc 100644 --- a/__fixtures__/v-next/outputv4/evmos/inflation/v1/query.ts +++ b/__fixtures__/v-next/outputv4/evmos/inflation/v1/query.ts @@ -1,12 +1,14 @@ -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 { 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 { 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; @@ -18,6 +20,9 @@ export interface QueryPeriodResponse { /** period is the current minting per epoch provision value. */ period: bigint; } +export interface ReactiveQueryPeriodResponse { + period: ComputedRef<bigint>; +} export interface QueryPeriodResponseProtoMsg { typeUrl: "/evmos.inflation.v1.QueryPeriodResponse"; value: Uint8Array; @@ -31,6 +36,7 @@ export interface QueryPeriodResponseSDKType { * Query/EpochMintProvision RPC method. */ export interface QueryEpochMintProvisionRequest {} +export interface ReactiveQueryEpochMintProvisionRequest {} export interface QueryEpochMintProvisionRequestProtoMsg { typeUrl: "/evmos.inflation.v1.QueryEpochMintProvisionRequest"; value: Uint8Array; @@ -48,6 +54,9 @@ export interface QueryEpochMintProvisionResponse { /** epoch_mint_provision is the current minting per epoch provision value. */ epochMintProvision: DecCoin; } +export interface ReactiveQueryEpochMintProvisionResponse { + epochMintProvision: ComputedRef<DecCoin>; +} export interface QueryEpochMintProvisionResponseProtoMsg { typeUrl: "/evmos.inflation.v1.QueryEpochMintProvisionResponse"; value: Uint8Array; @@ -64,6 +73,7 @@ export interface QueryEpochMintProvisionResponseSDKType { * method. */ export interface QuerySkippedEpochsRequest {} +export interface ReactiveQuerySkippedEpochsRequest {} export interface QuerySkippedEpochsRequestProtoMsg { typeUrl: "/evmos.inflation.v1.QuerySkippedEpochsRequest"; value: Uint8Array; @@ -81,6 +91,9 @@ export interface QuerySkippedEpochsResponse { /** number of epochs that the inflation module has been disabled. */ skippedEpochs: bigint; } +export interface ReactiveQuerySkippedEpochsResponse { + skippedEpochs: ComputedRef<bigint>; +} export interface QuerySkippedEpochsResponseProtoMsg { typeUrl: "/evmos.inflation.v1.QuerySkippedEpochsResponse"; value: Uint8Array; @@ -97,6 +110,7 @@ export interface QuerySkippedEpochsResponseSDKType { * Query/CirculatingSupply RPC method. */ export interface QueryCirculatingSupplyRequest {} +export interface ReactiveQueryCirculatingSupplyRequest {} export interface QueryCirculatingSupplyRequestProtoMsg { typeUrl: "/evmos.inflation.v1.QueryCirculatingSupplyRequest"; value: Uint8Array; @@ -114,6 +128,9 @@ export interface QueryCirculatingSupplyResponse { /** total amount of coins in circulation */ circulatingSupply: DecCoin; } +export interface ReactiveQueryCirculatingSupplyResponse { + circulatingSupply: ComputedRef<DecCoin>; +} export interface QueryCirculatingSupplyResponseProtoMsg { typeUrl: "/evmos.inflation.v1.QueryCirculatingSupplyResponse"; value: Uint8Array; @@ -130,6 +147,7 @@ export interface QueryCirculatingSupplyResponseSDKType { * method. */ export interface QueryInflationRateRequest {} +export interface ReactiveQueryInflationRateRequest {} export interface QueryInflationRateRequestProtoMsg { typeUrl: "/evmos.inflation.v1.QueryInflationRateRequest"; value: Uint8Array; @@ -147,6 +165,9 @@ export interface QueryInflationRateResponse { /** rate by which the total supply increases within one period */ inflationRate: string; } +export interface ReactiveQueryInflationRateResponse { + inflationRate: ComputedRef<string>; +} export interface QueryInflationRateResponseProtoMsg { typeUrl: "/evmos.inflation.v1.QueryInflationRateResponse"; value: Uint8Array; @@ -160,6 +181,7 @@ 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; @@ -171,6 +193,9 @@ export interface QueryParamsResponse { /** params defines the parameters of the module. */ params: Params; } +export interface ReactiveQueryParamsResponse { + params: ComputedRef<Params>; +} export interface QueryParamsResponseProtoMsg { typeUrl: "/evmos.inflation.v1.QueryParamsResponse"; value: Uint8Array; @@ -202,8 +227,7 @@ export const QueryPeriodRequest = { return message; }, fromJSON(_: any): QueryPeriodRequest { - const obj = createBaseQueryPeriodRequest(); - return obj; + return {}; }, toJSON(_: QueryPeriodRequest): JsonSafe<QueryPeriodRequest> { const obj: any = {}; @@ -255,7 +279,7 @@ function createBaseQueryPeriodResponse(): QueryPeriodResponse { export const QueryPeriodResponse = { typeUrl: "/evmos.inflation.v1.QueryPeriodResponse", encode(message: QueryPeriodResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.period !== undefined) { + if (message.period !== BigInt(0)) { writer.uint32(8).uint64(message.period); } return writer; @@ -278,9 +302,9 @@ export const QueryPeriodResponse = { return message; }, fromJSON(object: any): QueryPeriodResponse { - const obj = createBaseQueryPeriodResponse(); - if (isSet(object.period)) obj.period = BigInt(object.period.toString()); - return obj; + return { + period: isSet(object.period) ? BigInt(object.period.toString()) : BigInt(0) + }; }, toJSON(message: QueryPeriodResponse): JsonSafe<QueryPeriodResponse> { const obj: any = {}; @@ -289,9 +313,7 @@ export const QueryPeriodResponse = { }, fromPartial(object: DeepPartial<QueryPeriodResponse>): QueryPeriodResponse { const message = createBaseQueryPeriodResponse(); - if (object.period !== undefined && object.period !== null) { - message.period = BigInt(object.period.toString()); - } + message.period = object.period !== undefined && object.period !== null ? BigInt(object.period.toString()) : BigInt(0); return message; }, fromSDK(object: QueryPeriodResponseSDKType): QueryPeriodResponse { @@ -360,8 +382,7 @@ export const QueryEpochMintProvisionRequest = { return message; }, fromJSON(_: any): QueryEpochMintProvisionRequest { - const obj = createBaseQueryEpochMintProvisionRequest(); - return obj; + return {}; }, toJSON(_: QueryEpochMintProvisionRequest): JsonSafe<QueryEpochMintProvisionRequest> { const obj: any = {}; @@ -436,9 +457,9 @@ export const QueryEpochMintProvisionResponse = { return message; }, fromJSON(object: any): QueryEpochMintProvisionResponse { - const obj = createBaseQueryEpochMintProvisionResponse(); - if (isSet(object.epochMintProvision)) obj.epochMintProvision = DecCoin.fromJSON(object.epochMintProvision); - return obj; + return { + epochMintProvision: isSet(object.epochMintProvision) ? DecCoin.fromJSON(object.epochMintProvision) : undefined + }; }, toJSON(message: QueryEpochMintProvisionResponse): JsonSafe<QueryEpochMintProvisionResponse> { const obj: any = {}; @@ -447,9 +468,7 @@ export const QueryEpochMintProvisionResponse = { }, fromPartial(object: DeepPartial<QueryEpochMintProvisionResponse>): QueryEpochMintProvisionResponse { const message = createBaseQueryEpochMintProvisionResponse(); - if (object.epochMintProvision !== undefined && object.epochMintProvision !== null) { - message.epochMintProvision = DecCoin.fromPartial(object.epochMintProvision); - } + message.epochMintProvision = object.epochMintProvision !== undefined && object.epochMintProvision !== null ? DecCoin.fromPartial(object.epochMintProvision) : undefined; return message; }, fromSDK(object: QueryEpochMintProvisionResponseSDKType): QueryEpochMintProvisionResponse { @@ -518,8 +537,7 @@ export const QuerySkippedEpochsRequest = { return message; }, fromJSON(_: any): QuerySkippedEpochsRequest { - const obj = createBaseQuerySkippedEpochsRequest(); - return obj; + return {}; }, toJSON(_: QuerySkippedEpochsRequest): JsonSafe<QuerySkippedEpochsRequest> { const obj: any = {}; @@ -571,7 +589,7 @@ function createBaseQuerySkippedEpochsResponse(): QuerySkippedEpochsResponse { export const QuerySkippedEpochsResponse = { typeUrl: "/evmos.inflation.v1.QuerySkippedEpochsResponse", encode(message: QuerySkippedEpochsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.skippedEpochs !== undefined) { + if (message.skippedEpochs !== BigInt(0)) { writer.uint32(8).uint64(message.skippedEpochs); } return writer; @@ -594,9 +612,9 @@ export const QuerySkippedEpochsResponse = { return message; }, fromJSON(object: any): QuerySkippedEpochsResponse { - const obj = createBaseQuerySkippedEpochsResponse(); - if (isSet(object.skippedEpochs)) obj.skippedEpochs = BigInt(object.skippedEpochs.toString()); - return obj; + return { + skippedEpochs: isSet(object.skippedEpochs) ? BigInt(object.skippedEpochs.toString()) : BigInt(0) + }; }, toJSON(message: QuerySkippedEpochsResponse): JsonSafe<QuerySkippedEpochsResponse> { const obj: any = {}; @@ -605,9 +623,7 @@ export const QuerySkippedEpochsResponse = { }, fromPartial(object: DeepPartial<QuerySkippedEpochsResponse>): QuerySkippedEpochsResponse { const message = createBaseQuerySkippedEpochsResponse(); - if (object.skippedEpochs !== undefined && object.skippedEpochs !== null) { - message.skippedEpochs = BigInt(object.skippedEpochs.toString()); - } + message.skippedEpochs = object.skippedEpochs !== undefined && object.skippedEpochs !== null ? BigInt(object.skippedEpochs.toString()) : BigInt(0); return message; }, fromSDK(object: QuerySkippedEpochsResponseSDKType): QuerySkippedEpochsResponse { @@ -676,8 +692,7 @@ export const QueryCirculatingSupplyRequest = { return message; }, fromJSON(_: any): QueryCirculatingSupplyRequest { - const obj = createBaseQueryCirculatingSupplyRequest(); - return obj; + return {}; }, toJSON(_: QueryCirculatingSupplyRequest): JsonSafe<QueryCirculatingSupplyRequest> { const obj: any = {}; @@ -752,9 +767,9 @@ export const QueryCirculatingSupplyResponse = { return message; }, fromJSON(object: any): QueryCirculatingSupplyResponse { - const obj = createBaseQueryCirculatingSupplyResponse(); - if (isSet(object.circulatingSupply)) obj.circulatingSupply = DecCoin.fromJSON(object.circulatingSupply); - return obj; + return { + circulatingSupply: isSet(object.circulatingSupply) ? DecCoin.fromJSON(object.circulatingSupply) : undefined + }; }, toJSON(message: QueryCirculatingSupplyResponse): JsonSafe<QueryCirculatingSupplyResponse> { const obj: any = {}; @@ -763,9 +778,7 @@ export const QueryCirculatingSupplyResponse = { }, fromPartial(object: DeepPartial<QueryCirculatingSupplyResponse>): QueryCirculatingSupplyResponse { const message = createBaseQueryCirculatingSupplyResponse(); - if (object.circulatingSupply !== undefined && object.circulatingSupply !== null) { - message.circulatingSupply = DecCoin.fromPartial(object.circulatingSupply); - } + message.circulatingSupply = object.circulatingSupply !== undefined && object.circulatingSupply !== null ? DecCoin.fromPartial(object.circulatingSupply) : undefined; return message; }, fromSDK(object: QueryCirculatingSupplyResponseSDKType): QueryCirculatingSupplyResponse { @@ -834,8 +847,7 @@ export const QueryInflationRateRequest = { return message; }, fromJSON(_: any): QueryInflationRateRequest { - const obj = createBaseQueryInflationRateRequest(); - return obj; + return {}; }, toJSON(_: QueryInflationRateRequest): JsonSafe<QueryInflationRateRequest> { const obj: any = {}; @@ -887,7 +899,7 @@ function createBaseQueryInflationRateResponse(): QueryInflationRateResponse { export const QueryInflationRateResponse = { typeUrl: "/evmos.inflation.v1.QueryInflationRateResponse", encode(message: QueryInflationRateResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.inflationRate !== undefined) { + if (message.inflationRate !== "") { writer.uint32(10).string(Decimal.fromUserInput(message.inflationRate, 18).atomics); } return writer; @@ -910,9 +922,9 @@ export const QueryInflationRateResponse = { return message; }, fromJSON(object: any): QueryInflationRateResponse { - const obj = createBaseQueryInflationRateResponse(); - if (isSet(object.inflationRate)) obj.inflationRate = String(object.inflationRate); - return obj; + return { + inflationRate: isSet(object.inflationRate) ? String(object.inflationRate) : "" + }; }, toJSON(message: QueryInflationRateResponse): JsonSafe<QueryInflationRateResponse> { const obj: any = {}; @@ -990,8 +1002,7 @@ export const QueryParamsRequest = { return message; }, fromJSON(_: any): QueryParamsRequest { - const obj = createBaseQueryParamsRequest(); - return obj; + return {}; }, toJSON(_: QueryParamsRequest): JsonSafe<QueryParamsRequest> { const obj: any = {}; @@ -1066,9 +1077,9 @@ export const QueryParamsResponse = { return message; }, fromJSON(object: any): QueryParamsResponse { - const obj = createBaseQueryParamsResponse(); - if (isSet(object.params)) obj.params = Params.fromJSON(object.params); - return obj; + return { + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined + }; }, toJSON(message: QueryParamsResponse): JsonSafe<QueryParamsResponse> { const obj: any = {}; @@ -1077,9 +1088,7 @@ export const QueryParamsResponse = { }, fromPartial(object: DeepPartial<QueryParamsResponse>): QueryParamsResponse { const message = createBaseQueryParamsResponse(); - if (object.params !== undefined && object.params !== null) { - message.params = Params.fromPartial(object.params); - } + message.params = object.params !== undefined && object.params !== null ? Params.fromPartial(object.params) : undefined; 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 5656a9fe3f..3ff6bf7276 100644 --- a/__fixtures__/v-next/outputv4/evmos/lcd.ts +++ b/__fixtures__/v-next/outputv4/evmos/lcd.ts @@ -37,6 +37,11 @@ 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 846a95ccb1..8cf198f032 100644 --- a/__fixtures__/v-next/outputv4/evmos/recovery/v1/genesis.ts +++ b/__fixtures__/v-next/outputv4/evmos/recovery/v1/genesis.ts @@ -1,13 +1,17 @@ -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"; +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"; 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<Params>; +} export interface GenesisStateProtoMsg { typeUrl: "/evmos.recovery.v1.GenesisState"; value: Uint8Array; @@ -23,6 +27,10 @@ export interface Params { /** duration added to timeout timestamp for balances recovered via IBC packets */ packetTimeoutDuration: Duration; } +export interface ReactiveParams { + enableRecovery: ComputedRef<boolean>; + packetTimeoutDuration: ComputedRef<Duration>; +} export interface ParamsProtoMsg { typeUrl: "/evmos.recovery.v1.Params"; value: Uint8Array; @@ -63,9 +71,9 @@ export const GenesisState = { return message; }, fromJSON(object: any): GenesisState { - const obj = createBaseGenesisState(); - if (isSet(object.params)) obj.params = Params.fromJSON(object.params); - return obj; + return { + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined + }; }, toJSON(message: GenesisState): JsonSafe<GenesisState> { const obj: any = {}; @@ -74,9 +82,7 @@ export const GenesisState = { }, fromPartial(object: DeepPartial<GenesisState>): GenesisState { const message = createBaseGenesisState(); - if (object.params !== undefined && object.params !== null) { - message.params = Params.fromPartial(object.params); - } + message.params = object.params !== undefined && object.params !== null ? Params.fromPartial(object.params) : undefined; return message; }, fromSDK(object: GenesisStateSDKType): GenesisState { @@ -131,7 +137,7 @@ function createBaseParams(): Params { export const Params = { typeUrl: "/evmos.recovery.v1.Params", encode(message: Params, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.enableRecovery !== undefined) { + if (message.enableRecovery === true) { writer.uint32(8).bool(message.enableRecovery); } if (message.packetTimeoutDuration !== undefined) { @@ -160,10 +166,10 @@ export const Params = { return message; }, fromJSON(object: any): Params { - const obj = createBaseParams(); - if (isSet(object.enableRecovery)) obj.enableRecovery = Boolean(object.enableRecovery); - if (isSet(object.packetTimeoutDuration)) obj.packetTimeoutDuration = Duration.fromJSON(object.packetTimeoutDuration); - return obj; + return { + enableRecovery: isSet(object.enableRecovery) ? Boolean(object.enableRecovery) : false, + packetTimeoutDuration: isSet(object.packetTimeoutDuration) ? Duration.fromJSON(object.packetTimeoutDuration) : undefined + }; }, toJSON(message: Params): JsonSafe<Params> { const obj: any = {}; @@ -174,9 +180,7 @@ export const Params = { fromPartial(object: DeepPartial<Params>): Params { const message = createBaseParams(); message.enableRecovery = object.enableRecovery ?? false; - if (object.packetTimeoutDuration !== undefined && object.packetTimeoutDuration !== null) { - message.packetTimeoutDuration = Duration.fromPartial(object.packetTimeoutDuration); - } + message.packetTimeoutDuration = object.packetTimeoutDuration !== undefined && object.packetTimeoutDuration !== null ? Duration.fromPartial(object.packetTimeoutDuration) : undefined; 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 a0ca2d6f6a..6a74ba7a67 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.js"; +import { Params, ParamsSDKType } from "./genesis"; import { LCDClient } from "@cosmology/lcd"; -import { QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType } from "./query.js"; +import { QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType } from "./query"; 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 c04b6e4e94..a434c5c51c 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.js"; -import { Rpc } from "../../../helpers.js"; -import { BinaryReader } from "../../../binary.js"; +import { Params, ParamsSDKType } from "./genesis"; +import { Rpc } from "../../../helpers"; +import { BinaryReader } from "../../../binary"; import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; -import { QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType } from "./query.js"; +import { QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType, ReactiveQueryParamsRequest } from "./query"; /** 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 42c4a10bd4..9e4c8fc4be 100644 --- a/__fixtures__/v-next/outputv4/evmos/recovery/v1/query.ts +++ b/__fixtures__/v-next/outputv4/evmos/recovery/v1/query.ts @@ -1,10 +1,12 @@ -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 { Params, ParamsSDKType } from "./genesis"; +import { BinaryReader, BinaryWriter } from "../../../binary"; +import { JsonSafe } from "../../../json-safe"; +import { DeepPartial, isSet } from "../../../helpers"; +import { ComputedRef } from "vue"; 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; @@ -16,6 +18,9 @@ export interface QueryParamsResponse { /** params defines the parameters of the module. */ params: Params; } +export interface ReactiveQueryParamsResponse { + params: ComputedRef<Params>; +} export interface QueryParamsResponseProtoMsg { typeUrl: "/evmos.recovery.v1.QueryParamsResponse"; value: Uint8Array; @@ -47,8 +52,7 @@ export const QueryParamsRequest = { return message; }, fromJSON(_: any): QueryParamsRequest { - const obj = createBaseQueryParamsRequest(); - return obj; + return {}; }, toJSON(_: QueryParamsRequest): JsonSafe<QueryParamsRequest> { const obj: any = {}; @@ -123,9 +127,9 @@ export const QueryParamsResponse = { return message; }, fromJSON(object: any): QueryParamsResponse { - const obj = createBaseQueryParamsResponse(); - if (isSet(object.params)) obj.params = Params.fromJSON(object.params); - return obj; + return { + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined + }; }, toJSON(message: QueryParamsResponse): JsonSafe<QueryParamsResponse> { const obj: any = {}; @@ -134,9 +138,7 @@ export const QueryParamsResponse = { }, fromPartial(object: DeepPartial<QueryParamsResponse>): QueryParamsResponse { const message = createBaseQueryParamsResponse(); - if (object.params !== undefined && object.params !== null) { - message.params = Params.fromPartial(object.params); - } + message.params = object.params !== undefined && object.params !== null ? Params.fromPartial(object.params) : undefined; 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 9169126902..7bd88a0622 100644 --- a/__fixtures__/v-next/outputv4/evmos/rpc.query.ts +++ b/__fixtures__/v-next/outputv4/evmos/rpc.query.ts @@ -1,98 +1,101 @@ -import { Rpc } from "../helpers.js"; -import { connectComet, HttpEndpoint } from "@cosmjs/tendermint-rpc"; +import { Rpc } from "../helpers"; +import { Tendermint34Client, HttpEndpoint } from "@cosmjs/tendermint-rpc"; import { QueryClient } from "@cosmjs/stargate"; export const createRPCQueryClient = async ({ rpcEndpoint }: { rpcEndpoint: string | HttpEndpoint; }) => { - const tmClient = await connectComet(rpcEndpoint); + const tmClient = await Tendermint34Client.connect(rpcEndpoint); const client = new QueryClient(tmClient); return { cosmos: { app: { - v1alpha1: (await import("../cosmos/app/v1alpha1/query.rpc.Query.js")).createRpcQueryExtension(client) + v1alpha1: (await import("../cosmos/app/v1alpha1/query.rpc.Query")).createRpcQueryExtension(client) }, auth: { - v1beta1: (await import("../cosmos/auth/v1beta1/query.rpc.Query.js")).createRpcQueryExtension(client) + v1beta1: (await import("../cosmos/auth/v1beta1/query.rpc.Query")).createRpcQueryExtension(client) }, authz: { - v1beta1: (await import("../cosmos/authz/v1beta1/query.rpc.Query.js")).createRpcQueryExtension(client) + v1beta1: (await import("../cosmos/authz/v1beta1/query.rpc.Query")).createRpcQueryExtension(client) }, bank: { - v1beta1: (await import("../cosmos/bank/v1beta1/query.rpc.Query.js")).createRpcQueryExtension(client) + v1beta1: (await import("../cosmos/bank/v1beta1/query.rpc.Query")).createRpcQueryExtension(client) }, base: { reflection: { - 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) + v1beta1: (await import("../cosmos/base/reflection/v1beta1/reflection.rpc.ReflectionService")).createRpcQueryExtension(client), + v2alpha1: (await import("../cosmos/base/reflection/v2alpha1/reflection.rpc.ReflectionService")).createRpcQueryExtension(client) }, tendermint: { - v1beta1: (await import("../cosmos/base/tendermint/v1beta1/query.rpc.Service.js")).createRpcQueryExtension(client) + 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) } }, distribution: { - v1beta1: (await import("../cosmos/distribution/v1beta1/query.rpc.Query.js")).createRpcQueryExtension(client) + v1beta1: (await import("../cosmos/distribution/v1beta1/query.rpc.Query")).createRpcQueryExtension(client) }, evidence: { - v1beta1: (await import("../cosmos/evidence/v1beta1/query.rpc.Query.js")).createRpcQueryExtension(client) + v1beta1: (await import("../cosmos/evidence/v1beta1/query.rpc.Query")).createRpcQueryExtension(client) }, feegrant: { - v1beta1: (await import("../cosmos/feegrant/v1beta1/query.rpc.Query.js")).createRpcQueryExtension(client) + v1beta1: (await import("../cosmos/feegrant/v1beta1/query.rpc.Query")).createRpcQueryExtension(client) }, gov: { - v1: (await import("../cosmos/gov/v1/query.rpc.Query.js")).createRpcQueryExtension(client), - v1beta1: (await import("../cosmos/gov/v1beta1/query.rpc.Query.js")).createRpcQueryExtension(client) + v1: (await import("../cosmos/gov/v1/query.rpc.Query")).createRpcQueryExtension(client), + v1beta1: (await import("../cosmos/gov/v1beta1/query.rpc.Query")).createRpcQueryExtension(client) }, group: { - v1: (await import("../cosmos/group/v1/query.rpc.Query.js")).createRpcQueryExtension(client) + v1: (await import("../cosmos/group/v1/query.rpc.Query")).createRpcQueryExtension(client) }, mint: { - v1beta1: (await import("../cosmos/mint/v1beta1/query.rpc.Query.js")).createRpcQueryExtension(client) + v1beta1: (await import("../cosmos/mint/v1beta1/query.rpc.Query")).createRpcQueryExtension(client) }, nft: { - v1beta1: (await import("../cosmos/nft/v1beta1/query.rpc.Query.js")).createRpcQueryExtension(client) + v1beta1: (await import("../cosmos/nft/v1beta1/query.rpc.Query")).createRpcQueryExtension(client) }, params: { - v1beta1: (await import("../cosmos/params/v1beta1/query.rpc.Query.js")).createRpcQueryExtension(client) + v1beta1: (await import("../cosmos/params/v1beta1/query.rpc.Query")).createRpcQueryExtension(client) }, slashing: { - v1beta1: (await import("../cosmos/slashing/v1beta1/query.rpc.Query.js")).createRpcQueryExtension(client) + v1beta1: (await import("../cosmos/slashing/v1beta1/query.rpc.Query")).createRpcQueryExtension(client) }, staking: { - v1beta1: (await import("../cosmos/staking/v1beta1/query.rpc.Query.js")).createRpcQueryExtension(client) + v1beta1: (await import("../cosmos/staking/v1beta1/query.rpc.Query")).createRpcQueryExtension(client) }, tx: { - v1beta1: (await import("../cosmos/tx/v1beta1/service.rpc.Service.js")).createRpcQueryExtension(client) + v1beta1: (await import("../cosmos/tx/v1beta1/service.rpc.Service")).createRpcQueryExtension(client) }, upgrade: { - v1beta1: (await import("../cosmos/upgrade/v1beta1/query.rpc.Query.js")).createRpcQueryExtension(client) + v1beta1: (await import("../cosmos/upgrade/v1beta1/query.rpc.Query")).createRpcQueryExtension(client) } }, evmos: { claims: { - v1: (await import("./claims/v1/query.rpc.Query.js")).createRpcQueryExtension(client) + v1: (await import("./claims/v1/query.rpc.Query")).createRpcQueryExtension(client) }, epochs: { - v1: (await import("./epochs/v1/query.rpc.Query.js")).createRpcQueryExtension(client) + v1: (await import("./epochs/v1/query.rpc.Query")).createRpcQueryExtension(client) }, erc20: { - v1: (await import("./erc20/v1/query.rpc.Query.js")).createRpcQueryExtension(client) + v1: (await import("./erc20/v1/query.rpc.Query")).createRpcQueryExtension(client) }, fees: { - v1: (await import("./fees/v1/query.rpc.Query.js")).createRpcQueryExtension(client) + v1: (await import("./fees/v1/query.rpc.Query")).createRpcQueryExtension(client) }, incentives: { - v1: (await import("./incentives/v1/query.rpc.Query.js")).createRpcQueryExtension(client) + v1: (await import("./incentives/v1/query.rpc.Query")).createRpcQueryExtension(client) }, inflation: { - v1: (await import("./inflation/v1/query.rpc.Query.js")).createRpcQueryExtension(client) + v1: (await import("./inflation/v1/query.rpc.Query")).createRpcQueryExtension(client) }, recovery: { - v1: (await import("./recovery/v1/query.rpc.Query.js")).createRpcQueryExtension(client) + v1: (await import("./recovery/v1/query.rpc.Query")).createRpcQueryExtension(client) }, vesting: { - v1: (await import("./vesting/v1/query.rpc.Query.js")).createRpcQueryExtension(client) + v1: (await import("./vesting/v1/query.rpc.Query")).createRpcQueryExtension(client) } } }; diff --git a/__fixtures__/v-next/outputv4/evmos/rpc.tx.ts b/__fixtures__/v-next/outputv4/evmos/rpc.tx.ts index d5df45eb42..3d21b2d10d 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.js"; +import { Rpc } from "../helpers"; 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.js")).MsgClientImpl(rpc) + v1beta1: new (await import("../cosmos/authz/v1beta1/tx.rpc.msg")).MsgClientImpl(rpc) }, bank: { - v1beta1: new (await import("../cosmos/bank/v1beta1/tx.rpc.msg.js")).MsgClientImpl(rpc) + v1beta1: new (await import("../cosmos/bank/v1beta1/tx.rpc.msg")).MsgClientImpl(rpc) }, crisis: { - v1beta1: new (await import("../cosmos/crisis/v1beta1/tx.rpc.msg.js")).MsgClientImpl(rpc) + v1beta1: new (await import("../cosmos/crisis/v1beta1/tx.rpc.msg")).MsgClientImpl(rpc) }, distribution: { - v1beta1: new (await import("../cosmos/distribution/v1beta1/tx.rpc.msg.js")).MsgClientImpl(rpc) + v1beta1: new (await import("../cosmos/distribution/v1beta1/tx.rpc.msg")).MsgClientImpl(rpc) }, evidence: { - v1beta1: new (await import("../cosmos/evidence/v1beta1/tx.rpc.msg.js")).MsgClientImpl(rpc) + v1beta1: new (await import("../cosmos/evidence/v1beta1/tx.rpc.msg")).MsgClientImpl(rpc) }, feegrant: { - v1beta1: new (await import("../cosmos/feegrant/v1beta1/tx.rpc.msg.js")).MsgClientImpl(rpc) + v1beta1: new (await import("../cosmos/feegrant/v1beta1/tx.rpc.msg")).MsgClientImpl(rpc) }, gov: { - 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) + v1: new (await import("../cosmos/gov/v1/tx.rpc.msg")).MsgClientImpl(rpc), + v1beta1: new (await import("../cosmos/gov/v1beta1/tx.rpc.msg")).MsgClientImpl(rpc) }, group: { - v1: new (await import("../cosmos/group/v1/tx.rpc.msg.js")).MsgClientImpl(rpc) + v1: new (await import("../cosmos/group/v1/tx.rpc.msg")).MsgClientImpl(rpc) }, nft: { - v1beta1: new (await import("../cosmos/nft/v1beta1/tx.rpc.msg.js")).MsgClientImpl(rpc) + v1beta1: new (await import("../cosmos/nft/v1beta1/tx.rpc.msg")).MsgClientImpl(rpc) }, slashing: { - v1beta1: new (await import("../cosmos/slashing/v1beta1/tx.rpc.msg.js")).MsgClientImpl(rpc) + v1beta1: new (await import("../cosmos/slashing/v1beta1/tx.rpc.msg")).MsgClientImpl(rpc) }, staking: { - v1beta1: new (await import("../cosmos/staking/v1beta1/tx.rpc.msg.js")).MsgClientImpl(rpc) + v1beta1: new (await import("../cosmos/staking/v1beta1/tx.rpc.msg")).MsgClientImpl(rpc) }, upgrade: { - v1beta1: new (await import("../cosmos/upgrade/v1beta1/tx.rpc.msg.js")).MsgClientImpl(rpc) + v1beta1: new (await import("../cosmos/upgrade/v1beta1/tx.rpc.msg")).MsgClientImpl(rpc) }, vesting: { - v1beta1: new (await import("../cosmos/vesting/v1beta1/tx.rpc.msg.js")).MsgClientImpl(rpc) + v1beta1: new (await import("../cosmos/vesting/v1beta1/tx.rpc.msg")).MsgClientImpl(rpc) } }, evmos: { erc20: { - v1: new (await import("./erc20/v1/tx.rpc.msg.js")).MsgClientImpl(rpc) + v1: new (await import("./erc20/v1/tx.rpc.msg")).MsgClientImpl(rpc) }, fees: { - v1: new (await import("./fees/v1/tx.rpc.msg.js")).MsgClientImpl(rpc) + v1: new (await import("./fees/v1/tx.rpc.msg")).MsgClientImpl(rpc) }, vesting: { - v1: new (await import("./vesting/v1/tx.rpc.msg.js")).MsgClientImpl(rpc) + v1: new (await import("./vesting/v1/tx.rpc.msg")).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 74d8aa2f62..65fcd82713 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.js"; +import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { LCDClient } from "@cosmology/lcd"; -import { QueryBalancesRequest, QueryBalancesRequestSDKType, QueryBalancesResponse, QueryBalancesResponseSDKType } from "./query.js"; +import { QueryBalancesRequest, QueryBalancesRequestSDKType, QueryBalancesResponse, QueryBalancesResponseSDKType } from "./query"; 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 f74296c6ac..47bf474fcd 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.js"; -import { Rpc } from "../../../helpers.js"; -import { BinaryReader } from "../../../binary.js"; +import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; +import { Rpc } from "../../../helpers"; +import { BinaryReader } from "../../../binary"; import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; -import { QueryBalancesRequest, QueryBalancesRequestSDKType, QueryBalancesResponse, QueryBalancesResponseSDKType } from "./query.js"; +import { QueryBalancesRequest, QueryBalancesRequestSDKType, QueryBalancesResponse, QueryBalancesResponseSDKType, ReactiveQueryBalancesRequest } from "./query"; /** 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 9327e5db67..3a0f4fc141 100644 --- a/__fixtures__/v-next/outputv4/evmos/vesting/v1/query.ts +++ b/__fixtures__/v-next/outputv4/evmos/vesting/v1/query.ts @@ -1,13 +1,17 @@ -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"; +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"; 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<string>; +} export interface QueryBalancesRequestProtoMsg { typeUrl: "/evmos.vesting.v1.QueryBalancesRequest"; value: Uint8Array; @@ -28,6 +32,11 @@ export interface QueryBalancesResponse { /** current amount of vested tokens */ vested: Coin[]; } +export interface ReactiveQueryBalancesResponse { + locked: ComputedRef<Coin[]>; + unvested: ComputedRef<Coin[]>; + vested: ComputedRef<Coin[]>; +} export interface QueryBalancesResponseProtoMsg { typeUrl: "/evmos.vesting.v1.QueryBalancesResponse"; value: Uint8Array; @@ -49,7 +58,7 @@ function createBaseQueryBalancesRequest(): QueryBalancesRequest { export const QueryBalancesRequest = { typeUrl: "/evmos.vesting.v1.QueryBalancesRequest", encode(message: QueryBalancesRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.address !== undefined) { + if (message.address !== "") { writer.uint32(10).string(message.address); } return writer; @@ -72,9 +81,9 @@ export const QueryBalancesRequest = { return message; }, fromJSON(object: any): QueryBalancesRequest { - const obj = createBaseQueryBalancesRequest(); - if (isSet(object.address)) obj.address = String(object.address); - return obj; + return { + address: isSet(object.address) ? String(object.address) : "" + }; }, toJSON(message: QueryBalancesRequest): JsonSafe<QueryBalancesRequest> { const obj: any = {}; @@ -174,11 +183,11 @@ export const QueryBalancesResponse = { return message; }, fromJSON(object: any): QueryBalancesResponse { - 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; + 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)) : [] + }; }, toJSON(message: QueryBalancesResponse): JsonSafe<QueryBalancesResponse> { 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 c54d1c6a11..ef55f48dca 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.js"; -import { Period, PeriodSDKType } from "../../../cosmos/vesting/v1beta1/vesting.js"; +import { Timestamp, TimestampSDKType } from "../../../google/protobuf/timestamp"; +import { Period, PeriodSDKType } from "../../../cosmos/vesting/v1beta1/vesting"; import { AminoMsg } from "@cosmjs/amino"; -import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin.js"; -import { MsgCreateClawbackVestingAccount, MsgCreateClawbackVestingAccountSDKType, MsgClawback, MsgClawbackSDKType } from "./tx.js"; +import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; +import { MsgCreateClawbackVestingAccount, MsgCreateClawbackVestingAccountSDKType, MsgClawback, MsgClawbackSDKType } from "./tx"; 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 cc6a7ed7e2..2336f7dc27 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.js"; -import { Period, PeriodSDKType } from "../../../cosmos/vesting/v1beta1/vesting.js"; +import { Timestamp, TimestampSDKType } from "../../../google/protobuf/timestamp"; +import { Period, PeriodSDKType } from "../../../cosmos/vesting/v1beta1/vesting"; import { GeneratedType, Registry } from "@cosmjs/proto-signing"; -import { MsgCreateClawbackVestingAccount, MsgCreateClawbackVestingAccountSDKType, MsgClawback, MsgClawbackSDKType } from "./tx.js"; +import { MsgCreateClawbackVestingAccount, MsgCreateClawbackVestingAccountSDKType, MsgClawback, MsgClawbackSDKType } from "./tx"; 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 23323e5074..a49badd9d1 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.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"; +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"; /** 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 91e7084dbd..54bdc10559 100644 --- a/__fixtures__/v-next/outputv4/evmos/vesting/v1/tx.ts +++ b/__fixtures__/v-next/outputv4/evmos/vesting/v1/tx.ts @@ -1,8 +1,9 @@ -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"; +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"; export const protobufPackage = "evmos.vesting.v1"; /** MsgCreateClawbackVestingAccount defines a message that enables creating a ClawbackVestingAccount. */ export interface MsgCreateClawbackVestingAccount { @@ -28,6 +29,14 @@ export interface MsgCreateClawbackVestingAccount { */ merge: boolean; } +export interface ReactiveMsgCreateClawbackVestingAccount { + fromAddress: ComputedRef<string>; + toAddress: ComputedRef<string>; + startTime: ComputedRef<Date>; + lockupPeriods: ComputedRef<Period[]>; + vestingPeriods: ComputedRef<Period[]>; + merge: ComputedRef<boolean>; +} export interface MsgCreateClawbackVestingAccountProtoMsg { typeUrl: "/evmos.vesting.v1.MsgCreateClawbackVestingAccount"; value: Uint8Array; @@ -46,6 +55,7 @@ export interface MsgCreateClawbackVestingAccountSDKType { * MsgCreateClawbackVestingAccount response type. */ export interface MsgCreateClawbackVestingAccountResponse {} +export interface ReactiveMsgCreateClawbackVestingAccountResponse {} export interface MsgCreateClawbackVestingAccountResponseProtoMsg { typeUrl: "/evmos.vesting.v1.MsgCreateClawbackVestingAccountResponse"; value: Uint8Array; @@ -71,6 +81,11 @@ export interface MsgClawback { */ destAddress: string; } +export interface ReactiveMsgClawback { + funderAddress: ComputedRef<string>; + accountAddress: ComputedRef<string>; + destAddress: ComputedRef<string>; +} export interface MsgClawbackProtoMsg { typeUrl: "/evmos.vesting.v1.MsgClawback"; value: Uint8Array; @@ -86,6 +101,7 @@ 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; @@ -105,10 +121,10 @@ function createBaseMsgCreateClawbackVestingAccount(): MsgCreateClawbackVestingAc export const MsgCreateClawbackVestingAccount = { typeUrl: "/evmos.vesting.v1.MsgCreateClawbackVestingAccount", encode(message: MsgCreateClawbackVestingAccount, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.fromAddress !== undefined) { + if (message.fromAddress !== "") { writer.uint32(10).string(message.fromAddress); } - if (message.toAddress !== undefined) { + if (message.toAddress !== "") { writer.uint32(18).string(message.toAddress); } if (message.startTime !== undefined) { @@ -120,7 +136,7 @@ export const MsgCreateClawbackVestingAccount = { for (const v of message.vestingPeriods) { Period.encode(v!, writer.uint32(42).fork()).ldelim(); } - if (message.merge !== undefined) { + if (message.merge === true) { writer.uint32(48).bool(message.merge); } return writer; @@ -158,14 +174,14 @@ export const MsgCreateClawbackVestingAccount = { return message; }, fromJSON(object: any): MsgCreateClawbackVestingAccount { - 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; + 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 + }; }, toJSON(message: MsgCreateClawbackVestingAccount): JsonSafe<MsgCreateClawbackVestingAccount> { const obj: any = {}; @@ -308,8 +324,7 @@ export const MsgCreateClawbackVestingAccountResponse = { return message; }, fromJSON(_: any): MsgCreateClawbackVestingAccountResponse { - const obj = createBaseMsgCreateClawbackVestingAccountResponse(); - return obj; + return {}; }, toJSON(_: MsgCreateClawbackVestingAccountResponse): JsonSafe<MsgCreateClawbackVestingAccountResponse> { const obj: any = {}; @@ -363,13 +378,13 @@ function createBaseMsgClawback(): MsgClawback { export const MsgClawback = { typeUrl: "/evmos.vesting.v1.MsgClawback", encode(message: MsgClawback, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.funderAddress !== undefined) { + if (message.funderAddress !== "") { writer.uint32(10).string(message.funderAddress); } - if (message.accountAddress !== undefined) { + if (message.accountAddress !== "") { writer.uint32(18).string(message.accountAddress); } - if (message.destAddress !== undefined) { + if (message.destAddress !== "") { writer.uint32(26).string(message.destAddress); } return writer; @@ -398,11 +413,11 @@ export const MsgClawback = { return message; }, fromJSON(object: any): MsgClawback { - 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; + return { + funderAddress: isSet(object.funderAddress) ? String(object.funderAddress) : "", + accountAddress: isSet(object.accountAddress) ? String(object.accountAddress) : "", + destAddress: isSet(object.destAddress) ? String(object.destAddress) : "" + }; }, toJSON(message: MsgClawback): JsonSafe<MsgClawback> { const obj: any = {}; @@ -498,8 +513,7 @@ export const MsgClawbackResponse = { return message; }, fromJSON(_: any): MsgClawbackResponse { - const obj = createBaseMsgClawbackResponse(); - return obj; + return {}; }, toJSON(_: MsgClawbackResponse): JsonSafe<MsgClawbackResponse> { 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 1a5cddd31a..1d8bfd8fca 100644 --- a/__fixtures__/v-next/outputv4/evmos/vesting/v1/vesting.ts +++ b/__fixtures__/v-next/outputv4/evmos/vesting/v1/vesting.ts @@ -1,8 +1,9 @@ -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"; +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"; export const protobufPackage = "evmos.vesting.v1"; /** * ClawbackVestingAccount implements the VestingAccount interface. It provides @@ -25,6 +26,13 @@ export interface ClawbackVestingAccount { /** vesting_periods defines the vesting schedule relative to the start_time */ vestingPeriods: Period[]; } +export interface ReactiveClawbackVestingAccount { + baseVestingAccount?: ComputedRef<BaseVestingAccount>; + funderAddress: ComputedRef<string>; + startTime: ComputedRef<Date>; + lockupPeriods: ComputedRef<Period[]>; + vestingPeriods: ComputedRef<Period[]>; +} export interface ClawbackVestingAccountProtoMsg { typeUrl: "/evmos.vesting.v1.ClawbackVestingAccount"; value: Uint8Array; @@ -57,7 +65,7 @@ export const ClawbackVestingAccount = { if (message.baseVestingAccount !== undefined) { BaseVestingAccount.encode(message.baseVestingAccount, writer.uint32(10).fork()).ldelim(); } - if (message.funderAddress !== undefined) { + if (message.funderAddress !== "") { writer.uint32(18).string(message.funderAddress); } if (message.startTime !== undefined) { @@ -101,13 +109,13 @@ export const ClawbackVestingAccount = { return message; }, fromJSON(object: any): ClawbackVestingAccount { - 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; + 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)) : [] + }; }, toJSON(message: ClawbackVestingAccount): JsonSafe<ClawbackVestingAccount> { const obj: any = {}; @@ -128,9 +136,7 @@ export const ClawbackVestingAccount = { }, fromPartial(object: DeepPartial<ClawbackVestingAccount>): ClawbackVestingAccount { const message = createBaseClawbackVestingAccount(); - if (object.baseVestingAccount !== undefined && object.baseVestingAccount !== null) { - message.baseVestingAccount = BaseVestingAccount.fromPartial(object.baseVestingAccount); - } + message.baseVestingAccount = object.baseVestingAccount !== undefined && object.baseVestingAccount !== null ? BaseVestingAccount.fromPartial(object.baseVestingAccount) : undefined; 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 b56caf20e4..f60ecaf86f 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 { connectComet, HttpEndpoint } from "@cosmjs/tendermint-rpc"; +import { Tendermint34Client, HttpEndpoint } from "@cosmjs/tendermint-rpc"; const _rpcClients: Record<string, ProtobufRpcClient> = {}; @@ -24,19 +24,10 @@ export const getRpcClient = async (rpcEndpoint: string | HttpEndpoint) => { if (_rpcClients.hasOwnProperty(key)) { return _rpcClients[key]; } - const cometClient = await connectComet(rpcEndpoint); + const tmClient = await Tendermint34Client.connect(rpcEndpoint); //@ts-ignore - const client = new QueryClient(cometClient); + const client = new QueryClient(tmClient); 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 2ce1d53fa4..088726b0af 100644 --- a/__fixtures__/v-next/outputv4/gogoproto/bundle.ts +++ b/__fixtures__/v-next/outputv4/gogoproto/bundle.ts @@ -1,4 +1,4 @@ -import * as _177 from "./gogo.js"; +import * as _180 from "./gogo"; export const gogoproto = { - ..._177 + ..._180 }; \ 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 37ab1a6359..393dd0b8f3 100644 --- a/__fixtures__/v-next/outputv4/google/api/auth.ts +++ b/__fixtures__/v-next/outputv4/google/api/auth.ts @@ -1,6 +1,7 @@ -import { BinaryReader, BinaryWriter } from "../../binary.js"; -import { JsonSafe } from "../../json-safe.js"; -import { DeepPartial, isSet } from "../../helpers.js"; +import { BinaryReader, BinaryWriter } from "../../binary"; +import { JsonSafe } from "../../json-safe"; +import { DeepPartial, isSet } from "../../helpers"; +import { ComputedRef } from "vue"; export const protobufPackage = "google.api"; /** * `Authentication` defines the authentication configuration for API methods @@ -32,6 +33,10 @@ export interface Authentication { /** Defines a set of authentication providers that a service supports. */ providers: AuthProvider[]; } +export interface ReactiveAuthentication { + rules: ComputedRef<AuthenticationRule[]>; + providers: ComputedRef<AuthProvider[]>; +} export interface AuthenticationProtoMsg { typeUrl: "/google.api.Authentication"; value: Uint8Array; @@ -88,6 +93,12 @@ export interface AuthenticationRule { /** Requirements for additional authentication providers. */ requirements: AuthRequirement[]; } +export interface ReactiveAuthenticationRule { + selector: ComputedRef<string>; + oauth?: ComputedRef<OAuthRequirements>; + allowWithoutCredential: ComputedRef<boolean>; + requirements: ComputedRef<AuthRequirement[]>; +} export interface AuthenticationRuleProtoMsg { typeUrl: "/google.api.AuthenticationRule"; value: Uint8Array; @@ -127,6 +138,11 @@ export interface JwtLocation { */ valuePrefix: string; } +export interface ReactiveJwtLocation { + header?: ComputedRef<string>; + query?: ComputedRef<string>; + valuePrefix: ComputedRef<string>; +} export interface JwtLocationProtoMsg { typeUrl: "/google.api.JwtLocation"; value: Uint8Array; @@ -220,6 +236,14 @@ export interface AuthProvider { */ jwtLocations: JwtLocation[]; } +export interface ReactiveAuthProvider { + id: ComputedRef<string>; + issuer: ComputedRef<string>; + jwksUri: ComputedRef<string>; + audiences: ComputedRef<string>; + authorizationUrl: ComputedRef<string>; + jwtLocations: ComputedRef<JwtLocation[]>; +} export interface AuthProviderProtoMsg { typeUrl: "/google.api.AuthProvider"; value: Uint8Array; @@ -269,6 +293,9 @@ export interface OAuthRequirements { */ canonicalScopes: string; } +export interface ReactiveOAuthRequirements { + canonicalScopes: ComputedRef<string>; +} export interface OAuthRequirementsProtoMsg { typeUrl: "/google.api.OAuthRequirements"; value: Uint8Array; @@ -330,6 +357,10 @@ export interface AuthRequirement { */ audiences: string; } +export interface ReactiveAuthRequirement { + providerId: ComputedRef<string>; + audiences: ComputedRef<string>; +} export interface AuthRequirementProtoMsg { typeUrl: "/google.api.AuthRequirement"; value: Uint8Array; @@ -381,10 +412,10 @@ export const Authentication = { return message; }, fromJSON(object: any): Authentication { - 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; + 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)) : [] + }; }, toJSON(message: Authentication): JsonSafe<Authentication> { const obj: any = {}; @@ -479,13 +510,13 @@ function createBaseAuthenticationRule(): AuthenticationRule { export const AuthenticationRule = { typeUrl: "/google.api.AuthenticationRule", encode(message: AuthenticationRule, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.selector !== undefined) { + if (message.selector !== "") { writer.uint32(10).string(message.selector); } if (message.oauth !== undefined) { OAuthRequirements.encode(message.oauth, writer.uint32(18).fork()).ldelim(); } - if (message.allowWithoutCredential !== undefined) { + if (message.allowWithoutCredential === true) { writer.uint32(40).bool(message.allowWithoutCredential); } for (const v of message.requirements) { @@ -520,12 +551,12 @@ export const AuthenticationRule = { return message; }, fromJSON(object: any): AuthenticationRule { - 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; + 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)) : [] + }; }, toJSON(message: AuthenticationRule): JsonSafe<AuthenticationRule> { const obj: any = {}; @@ -542,9 +573,7 @@ export const AuthenticationRule = { fromPartial(object: DeepPartial<AuthenticationRule>): AuthenticationRule { const message = createBaseAuthenticationRule(); message.selector = object.selector ?? ""; - if (object.oauth !== undefined && object.oauth !== null) { - message.oauth = OAuthRequirements.fromPartial(object.oauth); - } + message.oauth = object.oauth !== undefined && object.oauth !== null ? OAuthRequirements.fromPartial(object.oauth) : undefined; message.allowWithoutCredential = object.allowWithoutCredential ?? false; message.requirements = object.requirements?.map(e => AuthRequirement.fromPartial(e)) || []; return message; @@ -635,7 +664,7 @@ export const JwtLocation = { if (message.query !== undefined) { writer.uint32(18).string(message.query); } - if (message.valuePrefix !== undefined) { + if (message.valuePrefix !== "") { writer.uint32(26).string(message.valuePrefix); } return writer; @@ -664,11 +693,11 @@ export const JwtLocation = { return message; }, fromJSON(object: any): JwtLocation { - 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; + return { + header: isSet(object.header) ? String(object.header) : undefined, + query: isSet(object.query) ? String(object.query) : undefined, + valuePrefix: isSet(object.valuePrefix) ? String(object.valuePrefix) : "" + }; }, toJSON(message: JwtLocation): JsonSafe<JwtLocation> { const obj: any = {}; @@ -754,19 +783,19 @@ function createBaseAuthProvider(): AuthProvider { export const AuthProvider = { typeUrl: "/google.api.AuthProvider", encode(message: AuthProvider, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.id !== undefined) { + if (message.id !== "") { writer.uint32(10).string(message.id); } - if (message.issuer !== undefined) { + if (message.issuer !== "") { writer.uint32(18).string(message.issuer); } - if (message.jwksUri !== undefined) { + if (message.jwksUri !== "") { writer.uint32(26).string(message.jwksUri); } - if (message.audiences !== undefined) { + if (message.audiences !== "") { writer.uint32(34).string(message.audiences); } - if (message.authorizationUrl !== undefined) { + if (message.authorizationUrl !== "") { writer.uint32(42).string(message.authorizationUrl); } for (const v of message.jwtLocations) { @@ -807,14 +836,14 @@ export const AuthProvider = { return message; }, fromJSON(object: any): AuthProvider { - 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; + 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)) : [] + }; }, toJSON(message: AuthProvider): JsonSafe<AuthProvider> { const obj: any = {}; @@ -932,7 +961,7 @@ function createBaseOAuthRequirements(): OAuthRequirements { export const OAuthRequirements = { typeUrl: "/google.api.OAuthRequirements", encode(message: OAuthRequirements, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.canonicalScopes !== undefined) { + if (message.canonicalScopes !== "") { writer.uint32(10).string(message.canonicalScopes); } return writer; @@ -955,9 +984,9 @@ export const OAuthRequirements = { return message; }, fromJSON(object: any): OAuthRequirements { - const obj = createBaseOAuthRequirements(); - if (isSet(object.canonicalScopes)) obj.canonicalScopes = String(object.canonicalScopes); - return obj; + return { + canonicalScopes: isSet(object.canonicalScopes) ? String(object.canonicalScopes) : "" + }; }, toJSON(message: OAuthRequirements): JsonSafe<OAuthRequirements> { const obj: any = {}; @@ -1021,10 +1050,10 @@ function createBaseAuthRequirement(): AuthRequirement { export const AuthRequirement = { typeUrl: "/google.api.AuthRequirement", encode(message: AuthRequirement, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.providerId !== undefined) { + if (message.providerId !== "") { writer.uint32(10).string(message.providerId); } - if (message.audiences !== undefined) { + if (message.audiences !== "") { writer.uint32(18).string(message.audiences); } return writer; @@ -1050,10 +1079,10 @@ export const AuthRequirement = { return message; }, fromJSON(object: any): AuthRequirement { - const obj = createBaseAuthRequirement(); - if (isSet(object.providerId)) obj.providerId = String(object.providerId); - if (isSet(object.audiences)) obj.audiences = String(object.audiences); - return obj; + return { + providerId: isSet(object.providerId) ? String(object.providerId) : "", + audiences: isSet(object.audiences) ? String(object.audiences) : "" + }; }, toJSON(message: AuthRequirement): JsonSafe<AuthRequirement> { const obj: any = {}; diff --git a/__fixtures__/v-next/outputv4/google/api/backend.ts b/__fixtures__/v-next/outputv4/google/api/backend.ts index 8a1cdc029e..959274a296 100644 --- a/__fixtures__/v-next/outputv4/google/api/backend.ts +++ b/__fixtures__/v-next/outputv4/google/api/backend.ts @@ -1,6 +1,7 @@ -import { BinaryReader, BinaryWriter } from "../../binary.js"; -import { JsonSafe } from "../../json-safe.js"; -import { DeepPartial, isSet } from "../../helpers.js"; +import { BinaryReader, BinaryWriter } from "../../binary"; +import { JsonSafe } from "../../json-safe"; +import { DeepPartial, isSet } from "../../helpers"; +import { ComputedRef } from "vue"; export const protobufPackage = "google.api"; /** * Path Translation specifies how to combine the backend address with the @@ -103,6 +104,9 @@ export interface Backend { */ rules: BackendRule[]; } +export interface ReactiveBackend { + rules: ComputedRef<BackendRule[]>; +} export interface BackendProtoMsg { typeUrl: "/google.api.Backend"; value: Uint8Array; @@ -196,6 +200,17 @@ export interface BackendRule { */ protocol: string; } +export interface ReactiveBackendRule { + selector: ComputedRef<string>; + address: ComputedRef<string>; + deadline: ComputedRef<number>; + minDeadline: ComputedRef<number>; + operationDeadline: ComputedRef<number>; + pathTranslation: ComputedRef<BackendRule_PathTranslation>; + jwtAudience?: ComputedRef<string>; + disableAuth?: ComputedRef<boolean>; + protocol: ComputedRef<string>; +} export interface BackendRuleProtoMsg { typeUrl: "/google.api.BackendRule"; value: Uint8Array; @@ -243,9 +258,9 @@ export const Backend = { return message; }, fromJSON(object: any): Backend { - const obj = createBaseBackend(); - if (Array.isArray(object?.rules)) obj.rules = object.rules.map((e: any) => BackendRule.fromJSON(e)); - return obj; + return { + rules: Array.isArray(object?.rules) ? object.rules.map((e: any) => BackendRule.fromJSON(e)) : [] + }; }, toJSON(message: Backend): JsonSafe<Backend> { const obj: any = {}; @@ -326,19 +341,19 @@ function createBaseBackendRule(): BackendRule { export const BackendRule = { typeUrl: "/google.api.BackendRule", encode(message: BackendRule, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.selector !== undefined) { + if (message.selector !== "") { writer.uint32(10).string(message.selector); } - if (message.address !== undefined) { + if (message.address !== "") { writer.uint32(18).string(message.address); } - if (message.deadline !== undefined) { + if (message.deadline !== 0) { writer.uint32(25).double(message.deadline); } - if (message.minDeadline !== undefined) { + if (message.minDeadline !== 0) { writer.uint32(33).double(message.minDeadline); } - if (message.operationDeadline !== undefined) { + if (message.operationDeadline !== 0) { writer.uint32(41).double(message.operationDeadline); } if (message.pathTranslation !== 0) { @@ -350,7 +365,7 @@ export const BackendRule = { if (message.disableAuth !== undefined) { writer.uint32(64).bool(message.disableAuth); } - if (message.protocol !== undefined) { + if (message.protocol !== "") { writer.uint32(74).string(message.protocol); } return writer; @@ -397,17 +412,17 @@ export const BackendRule = { return message; }, fromJSON(object: any): BackendRule { - 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; + 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) : "" + }; }, toJSON(message: BackendRule): JsonSafe<BackendRule> { const obj: any = {}; diff --git a/__fixtures__/v-next/outputv4/google/api/billing.ts b/__fixtures__/v-next/outputv4/google/api/billing.ts index 3767cd5423..bbb599b69e 100644 --- a/__fixtures__/v-next/outputv4/google/api/billing.ts +++ b/__fixtures__/v-next/outputv4/google/api/billing.ts @@ -1,6 +1,7 @@ -import { BinaryReader, BinaryWriter } from "../../binary.js"; -import { JsonSafe } from "../../json-safe.js"; -import { DeepPartial, isSet } from "../../helpers.js"; +import { BinaryReader, BinaryWriter } from "../../binary"; +import { JsonSafe } from "../../json-safe"; +import { DeepPartial, isSet } from "../../helpers"; +import { ComputedRef } from "vue"; export const protobufPackage = "google.api"; /** * Billing related configuration of the service. @@ -45,6 +46,9 @@ export interface Billing { */ consumerDestinations: Billing_BillingDestination[]; } +export interface ReactiveBilling { + consumerDestinations: ComputedRef<Billing_BillingDestination[]>; +} export interface BillingProtoMsg { typeUrl: "/google.api.Billing"; value: Uint8Array; @@ -102,6 +106,10 @@ export interface Billing_BillingDestination { */ metrics: string[]; } +export interface ReactiveBilling_BillingDestination { + monitoredResource: ComputedRef<string>; + metrics: ComputedRef<string[]>; +} export interface Billing_BillingDestinationProtoMsg { typeUrl: "/google.api.BillingDestination"; value: Uint8Array; @@ -145,9 +153,9 @@ export const Billing = { return message; }, fromJSON(object: any): Billing { - const obj = createBaseBilling(); - if (Array.isArray(object?.consumerDestinations)) obj.consumerDestinations = object.consumerDestinations.map((e: any) => Billing_BillingDestination.fromJSON(e)); - return obj; + return { + consumerDestinations: Array.isArray(object?.consumerDestinations) ? object.consumerDestinations.map((e: any) => Billing_BillingDestination.fromJSON(e)) : [] + }; }, toJSON(message: Billing): JsonSafe<Billing> { const obj: any = {}; @@ -221,7 +229,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 !== undefined) { + if (message.monitoredResource !== "") { writer.uint32(10).string(message.monitoredResource); } for (const v of message.metrics) { @@ -250,10 +258,10 @@ export const Billing_BillingDestination = { return message; }, fromJSON(object: any): Billing_BillingDestination { - 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; + return { + monitoredResource: isSet(object.monitoredResource) ? String(object.monitoredResource) : "", + metrics: Array.isArray(object?.metrics) ? object.metrics.map((e: any) => String(e)) : [] + }; }, toJSON(message: Billing_BillingDestination): JsonSafe<Billing_BillingDestination> { 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 6602d4b451..79fbaf0c87 100644 --- a/__fixtures__/v-next/outputv4/google/api/config_change.ts +++ b/__fixtures__/v-next/outputv4/google/api/config_change.ts @@ -1,6 +1,7 @@ -import { BinaryReader, BinaryWriter } from "../../binary.js"; -import { isSet, DeepPartial } from "../../helpers.js"; -import { JsonSafe } from "../../json-safe.js"; +import { BinaryReader, BinaryWriter } from "../../binary"; +import { isSet, DeepPartial } from "../../helpers"; +import { JsonSafe } from "../../json-safe"; +import { ComputedRef } from "vue"; export const protobufPackage = "google.api"; /** * Classifies set of possible modifications to an object in the service @@ -101,6 +102,13 @@ export interface ConfigChange { */ advices: Advice[]; } +export interface ReactiveConfigChange { + element: ComputedRef<string>; + oldValue: ComputedRef<string>; + newValue: ComputedRef<string>; + changeType: ComputedRef<ChangeType>; + advices: ComputedRef<Advice[]>; +} export interface ConfigChangeProtoMsg { typeUrl: "/google.api.ConfigChange"; value: Uint8Array; @@ -131,6 +139,9 @@ export interface Advice { */ description: string; } +export interface ReactiveAdvice { + description: ComputedRef<string>; +} export interface AdviceProtoMsg { typeUrl: "/google.api.Advice"; value: Uint8Array; @@ -154,13 +165,13 @@ function createBaseConfigChange(): ConfigChange { export const ConfigChange = { typeUrl: "/google.api.ConfigChange", encode(message: ConfigChange, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.element !== undefined) { + if (message.element !== "") { writer.uint32(10).string(message.element); } - if (message.oldValue !== undefined) { + if (message.oldValue !== "") { writer.uint32(18).string(message.oldValue); } - if (message.newValue !== undefined) { + if (message.newValue !== "") { writer.uint32(26).string(message.newValue); } if (message.changeType !== 0) { @@ -201,13 +212,13 @@ export const ConfigChange = { return message; }, fromJSON(object: any): ConfigChange { - 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; + 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)) : [] + }; }, toJSON(message: ConfigChange): JsonSafe<ConfigChange> { const obj: any = {}; @@ -316,7 +327,7 @@ function createBaseAdvice(): Advice { export const Advice = { typeUrl: "/google.api.Advice", encode(message: Advice, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.description !== undefined) { + if (message.description !== "") { writer.uint32(18).string(message.description); } return writer; @@ -339,9 +350,9 @@ export const Advice = { return message; }, fromJSON(object: any): Advice { - const obj = createBaseAdvice(); - if (isSet(object.description)) obj.description = String(object.description); - return obj; + return { + description: isSet(object.description) ? String(object.description) : "" + }; }, toJSON(message: Advice): JsonSafe<Advice> { const obj: any = {}; diff --git a/__fixtures__/v-next/outputv4/google/api/consumer.ts b/__fixtures__/v-next/outputv4/google/api/consumer.ts index f16c13dd81..d5a5f39625 100644 --- a/__fixtures__/v-next/outputv4/google/api/consumer.ts +++ b/__fixtures__/v-next/outputv4/google/api/consumer.ts @@ -1,6 +1,7 @@ -import { BinaryReader, BinaryWriter } from "../../binary.js"; -import { JsonSafe } from "../../json-safe.js"; -import { DeepPartial, isSet } from "../../helpers.js"; +import { BinaryReader, BinaryWriter } from "../../binary"; +import { JsonSafe } from "../../json-safe"; +import { DeepPartial, isSet } from "../../helpers"; +import { ComputedRef } from "vue"; export const protobufPackage = "google.api"; /** Supported data type of the property values */ export enum Property_PropertyType { @@ -79,6 +80,9 @@ export interface ProjectProperties { /** List of per consumer project-specific properties. */ properties: Property[]; } +export interface ReactiveProjectProperties { + properties: ComputedRef<Property[]>; +} export interface ProjectPropertiesProtoMsg { typeUrl: "/google.api.ProjectProperties"; value: Uint8Array; @@ -124,6 +128,11 @@ export interface Property { /** The description of the property */ description: string; } +export interface ReactiveProperty { + name: ComputedRef<string>; + type: ComputedRef<Property_PropertyType>; + description: ComputedRef<string>; +} export interface PropertyProtoMsg { typeUrl: "/google.api.Property"; value: Uint8Array; @@ -176,9 +185,9 @@ export const ProjectProperties = { return message; }, fromJSON(object: any): ProjectProperties { - const obj = createBaseProjectProperties(); - if (Array.isArray(object?.properties)) obj.properties = object.properties.map((e: any) => Property.fromJSON(e)); - return obj; + return { + properties: Array.isArray(object?.properties) ? object.properties.map((e: any) => Property.fromJSON(e)) : [] + }; }, toJSON(message: ProjectProperties): JsonSafe<ProjectProperties> { const obj: any = {}; @@ -253,13 +262,13 @@ function createBaseProperty(): Property { export const Property = { typeUrl: "/google.api.Property", encode(message: Property, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.name !== undefined) { + if (message.name !== "") { writer.uint32(10).string(message.name); } if (message.type !== 0) { writer.uint32(16).int32(message.type); } - if (message.description !== undefined) { + if (message.description !== "") { writer.uint32(26).string(message.description); } return writer; @@ -288,11 +297,11 @@ export const Property = { return message; }, fromJSON(object: any): Property { - 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; + return { + name: isSet(object.name) ? String(object.name) : "", + type: isSet(object.type) ? property_PropertyTypeFromJSON(object.type) : -1, + description: isSet(object.description) ? String(object.description) : "" + }; }, toJSON(message: Property): JsonSafe<Property> { const obj: any = {}; diff --git a/__fixtures__/v-next/outputv4/google/api/context.ts b/__fixtures__/v-next/outputv4/google/api/context.ts index 20634acf30..55cddaa6a1 100644 --- a/__fixtures__/v-next/outputv4/google/api/context.ts +++ b/__fixtures__/v-next/outputv4/google/api/context.ts @@ -1,6 +1,7 @@ -import { BinaryReader, BinaryWriter } from "../../binary.js"; -import { JsonSafe } from "../../json-safe.js"; -import { DeepPartial, isSet } from "../../helpers.js"; +import { BinaryReader, BinaryWriter } from "../../binary"; +import { JsonSafe } from "../../json-safe"; +import { DeepPartial, isSet } from "../../helpers"; +import { ComputedRef } from "vue"; export const protobufPackage = "google.api"; /** * `Context` defines which contexts an API requests. @@ -48,6 +49,9 @@ export interface Context { */ rules: ContextRule[]; } +export interface ReactiveContext { + rules: ComputedRef<ContextRule[]>; +} export interface ContextProtoMsg { typeUrl: "/google.api.Context"; value: Uint8Array; @@ -119,6 +123,13 @@ export interface ContextRule { */ allowedResponseExtensions: string[]; } +export interface ReactiveContextRule { + selector: ComputedRef<string>; + requested: ComputedRef<string[]>; + provided: ComputedRef<string[]>; + allowedRequestExtensions: ComputedRef<string[]>; + allowedResponseExtensions: ComputedRef<string[]>; +} export interface ContextRuleProtoMsg { typeUrl: "/google.api.ContextRule"; value: Uint8Array; @@ -165,9 +176,9 @@ export const Context = { return message; }, fromJSON(object: any): Context { - const obj = createBaseContext(); - if (Array.isArray(object?.rules)) obj.rules = object.rules.map((e: any) => ContextRule.fromJSON(e)); - return obj; + return { + rules: Array.isArray(object?.rules) ? object.rules.map((e: any) => ContextRule.fromJSON(e)) : [] + }; }, toJSON(message: Context): JsonSafe<Context> { const obj: any = {}; @@ -244,7 +255,7 @@ function createBaseContextRule(): ContextRule { export const ContextRule = { typeUrl: "/google.api.ContextRule", encode(message: ContextRule, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.selector !== undefined) { + if (message.selector !== "") { writer.uint32(10).string(message.selector); } for (const v of message.requested) { @@ -291,13 +302,13 @@ export const ContextRule = { return message; }, fromJSON(object: any): ContextRule { - 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; + 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)) : [] + }; }, toJSON(message: ContextRule): JsonSafe<ContextRule> { const obj: any = {}; diff --git a/__fixtures__/v-next/outputv4/google/api/control.ts b/__fixtures__/v-next/outputv4/google/api/control.ts index a021cfcb77..ef7caf9ed6 100644 --- a/__fixtures__/v-next/outputv4/google/api/control.ts +++ b/__fixtures__/v-next/outputv4/google/api/control.ts @@ -1,6 +1,7 @@ -import { BinaryReader, BinaryWriter } from "../../binary.js"; -import { isSet, DeepPartial } from "../../helpers.js"; -import { JsonSafe } from "../../json-safe.js"; +import { BinaryReader, BinaryWriter } from "../../binary"; +import { isSet, DeepPartial } from "../../helpers"; +import { JsonSafe } from "../../json-safe"; +import { ComputedRef } from "vue"; export const protobufPackage = "google.api"; /** * Selects and configures the service controller used by the service. The @@ -14,6 +15,9 @@ export interface Control { */ environment: string; } +export interface ReactiveControl { + environment: ComputedRef<string>; +} export interface ControlProtoMsg { typeUrl: "/google.api.Control"; value: Uint8Array; @@ -34,7 +38,7 @@ function createBaseControl(): Control { export const Control = { typeUrl: "/google.api.Control", encode(message: Control, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.environment !== undefined) { + if (message.environment !== "") { writer.uint32(10).string(message.environment); } return writer; @@ -57,9 +61,9 @@ export const Control = { return message; }, fromJSON(object: any): Control { - const obj = createBaseControl(); - if (isSet(object.environment)) obj.environment = String(object.environment); - return obj; + return { + environment: isSet(object.environment) ? String(object.environment) : "" + }; }, toJSON(message: Control): JsonSafe<Control> { const obj: any = {}; diff --git a/__fixtures__/v-next/outputv4/google/api/distribution.ts b/__fixtures__/v-next/outputv4/google/api/distribution.ts index 78227415e7..96fb396db9 100644 --- a/__fixtures__/v-next/outputv4/google/api/distribution.ts +++ b/__fixtures__/v-next/outputv4/google/api/distribution.ts @@ -1,8 +1,9 @@ -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"; +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"; export const protobufPackage = "google.api"; /** * `Distribution` contains summary statistics for a population of values. It @@ -75,6 +76,15 @@ export interface Distribution { /** Must be in increasing order of `value` field. */ exemplars: Distribution_Exemplar[]; } +export interface ReactiveDistribution { + count: ComputedRef<bigint>; + mean: ComputedRef<number>; + sumOfSquaredDeviation: ComputedRef<number>; + range?: ComputedRef<Distribution_Range>; + bucketOptions?: ComputedRef<Distribution_BucketOptions>; + bucketCounts: ComputedRef<bigint[]>; + exemplars: ComputedRef<Distribution_Exemplar[]>; +} export interface DistributionProtoMsg { typeUrl: "/google.api.Distribution"; value: Uint8Array; @@ -111,6 +121,10 @@ export interface Distribution_Range { /** The maximum of the population values. */ max: number; } +export interface ReactiveDistribution_Range { + min: ComputedRef<number>; + max: ComputedRef<number>; +} export interface Distribution_RangeProtoMsg { typeUrl: "/google.api.Range"; value: Uint8Array; @@ -145,6 +159,11 @@ export interface Distribution_BucketOptions { /** The explicit buckets. */ explicitBuckets?: Distribution_BucketOptions_Explicit; } +export interface ReactiveDistribution_BucketOptions { + linearBuckets?: ComputedRef<Distribution_BucketOptions_Linear>; + exponentialBuckets?: ComputedRef<Distribution_BucketOptions_Exponential>; + explicitBuckets?: ComputedRef<Distribution_BucketOptions_Explicit>; +} export interface Distribution_BucketOptionsProtoMsg { typeUrl: "/google.api.BucketOptions"; value: Uint8Array; @@ -190,6 +209,11 @@ export interface Distribution_BucketOptions_Linear { /** Lower bound of the first bucket. */ offset: number; } +export interface ReactiveDistribution_BucketOptions_Linear { + numFiniteBuckets: ComputedRef<number>; + width: ComputedRef<number>; + offset: ComputedRef<number>; +} export interface Distribution_BucketOptions_LinearProtoMsg { typeUrl: "/google.api.Linear"; value: Uint8Array; @@ -229,6 +253,11 @@ export interface Distribution_BucketOptions_Exponential { /** Must be greater than 0. */ scale: number; } +export interface ReactiveDistribution_BucketOptions_Exponential { + numFiniteBuckets: ComputedRef<number>; + growthFactor: ComputedRef<number>; + scale: ComputedRef<number>; +} export interface Distribution_BucketOptions_ExponentialProtoMsg { typeUrl: "/google.api.Exponential"; value: Uint8Array; @@ -266,6 +295,9 @@ export interface Distribution_BucketOptions_Explicit { /** The values must be monotonically increasing. */ bounds: number[]; } +export interface ReactiveDistribution_BucketOptions_Explicit { + bounds: ComputedRef<number[]>; +} export interface Distribution_BucketOptions_ExplicitProtoMsg { typeUrl: "/google.api.Explicit"; value: Uint8Array; @@ -316,6 +348,11 @@ export interface Distribution_Exemplar { */ attachments: Any[]; } +export interface ReactiveDistribution_Exemplar { + value: ComputedRef<number>; + timestamp?: ComputedRef<Date>; + attachments: ComputedRef<Any[]>; +} export interface Distribution_ExemplarProtoMsg { typeUrl: "/google.api.Exemplar"; value: Uint8Array; @@ -346,13 +383,13 @@ function createBaseDistribution(): Distribution { export const Distribution = { typeUrl: "/google.api.Distribution", encode(message: Distribution, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.count !== undefined) { + if (message.count !== BigInt(0)) { writer.uint32(8).int64(message.count); } - if (message.mean !== undefined) { + if (message.mean !== 0) { writer.uint32(17).double(message.mean); } - if (message.sumOfSquaredDeviation !== undefined) { + if (message.sumOfSquaredDeviation !== 0) { writer.uint32(25).double(message.sumOfSquaredDeviation); } if (message.range !== undefined) { @@ -414,15 +451,15 @@ export const Distribution = { return message; }, fromJSON(object: any): Distribution { - 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; + 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)) : [] + }; }, toJSON(message: Distribution): JsonSafe<Distribution> { const obj: any = {}; @@ -445,17 +482,11 @@ export const Distribution = { }, fromPartial(object: DeepPartial<Distribution>): Distribution { const message = createBaseDistribution(); - if (object.count !== undefined && object.count !== null) { - message.count = BigInt(object.count.toString()); - } + message.count = object.count !== undefined && object.count !== null ? BigInt(object.count.toString()) : BigInt(0); message.mean = object.mean ?? 0; message.sumOfSquaredDeviation = object.sumOfSquaredDeviation ?? 0; - 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.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; message.bucketCounts = object.bucketCounts?.map(e => BigInt(e.toString())) || []; message.exemplars = object.exemplars?.map(e => Distribution_Exemplar.fromPartial(e)) || []; return message; @@ -566,10 +597,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 !== undefined) { + if (message.min !== 0) { writer.uint32(9).double(message.min); } - if (message.max !== undefined) { + if (message.max !== 0) { writer.uint32(17).double(message.max); } return writer; @@ -595,10 +626,10 @@ export const Distribution_Range = { return message; }, fromJSON(object: any): Distribution_Range { - const obj = createBaseDistribution_Range(); - if (isSet(object.min)) obj.min = Number(object.min); - if (isSet(object.max)) obj.max = Number(object.max); - return obj; + return { + min: isSet(object.min) ? Number(object.min) : 0, + max: isSet(object.max) ? Number(object.max) : 0 + }; }, toJSON(message: Distribution_Range): JsonSafe<Distribution_Range> { const obj: any = {}; @@ -707,11 +738,11 @@ export const Distribution_BucketOptions = { return message; }, fromJSON(object: any): Distribution_BucketOptions { - 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; + 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 + }; }, toJSON(message: Distribution_BucketOptions): JsonSafe<Distribution_BucketOptions> { const obj: any = {}; @@ -722,15 +753,9 @@ export const Distribution_BucketOptions = { }, fromPartial(object: DeepPartial<Distribution_BucketOptions>): Distribution_BucketOptions { const message = createBaseDistribution_BucketOptions(); - 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); - } + 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; return message; }, fromSDK(object: Distribution_BucketOptionsSDKType): Distribution_BucketOptions { @@ -800,13 +825,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 !== undefined) { + if (message.numFiniteBuckets !== 0) { writer.uint32(8).int32(message.numFiniteBuckets); } - if (message.width !== undefined) { + if (message.width !== 0) { writer.uint32(17).double(message.width); } - if (message.offset !== undefined) { + if (message.offset !== 0) { writer.uint32(25).double(message.offset); } return writer; @@ -835,11 +860,11 @@ export const Distribution_BucketOptions_Linear = { return message; }, fromJSON(object: any): Distribution_BucketOptions_Linear { - 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; + 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 + }; }, toJSON(message: Distribution_BucketOptions_Linear): JsonSafe<Distribution_BucketOptions_Linear> { const obj: any = {}; @@ -922,13 +947,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 !== undefined) { + if (message.numFiniteBuckets !== 0) { writer.uint32(8).int32(message.numFiniteBuckets); } - if (message.growthFactor !== undefined) { + if (message.growthFactor !== 0) { writer.uint32(17).double(message.growthFactor); } - if (message.scale !== undefined) { + if (message.scale !== 0) { writer.uint32(25).double(message.scale); } return writer; @@ -957,11 +982,11 @@ export const Distribution_BucketOptions_Exponential = { return message; }, fromJSON(object: any): Distribution_BucketOptions_Exponential { - 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; + 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 + }; }, toJSON(message: Distribution_BucketOptions_Exponential): JsonSafe<Distribution_BucketOptions_Exponential> { const obj: any = {}; @@ -1074,9 +1099,9 @@ export const Distribution_BucketOptions_Explicit = { return message; }, fromJSON(object: any): Distribution_BucketOptions_Explicit { - const obj = createBaseDistribution_BucketOptions_Explicit(); - if (Array.isArray(object?.bounds)) obj.bounds = object.bounds.map((e: any) => Number(e)); - return obj; + return { + bounds: Array.isArray(object?.bounds) ? object.bounds.map((e: any) => Number(e)) : [] + }; }, toJSON(message: Distribution_BucketOptions_Explicit): JsonSafe<Distribution_BucketOptions_Explicit> { const obj: any = {}; @@ -1151,7 +1176,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 !== undefined) { + if (message.value !== 0) { writer.uint32(9).double(message.value); } if (message.timestamp !== undefined) { @@ -1186,11 +1211,11 @@ export const Distribution_Exemplar = { return message; }, fromJSON(object: any): Distribution_Exemplar { - 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; + 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)) : [] + }; }, toJSON(message: Distribution_Exemplar): JsonSafe<Distribution_Exemplar> { const obj: any = {}; diff --git a/__fixtures__/v-next/outputv4/google/api/documentation.ts b/__fixtures__/v-next/outputv4/google/api/documentation.ts index ac7891c63e..f1f16814b9 100644 --- a/__fixtures__/v-next/outputv4/google/api/documentation.ts +++ b/__fixtures__/v-next/outputv4/google/api/documentation.ts @@ -1,6 +1,7 @@ -import { BinaryReader, BinaryWriter } from "../../binary.js"; -import { isSet, DeepPartial } from "../../helpers.js"; -import { JsonSafe } from "../../json-safe.js"; +import { BinaryReader, BinaryWriter } from "../../binary"; +import { isSet, DeepPartial } from "../../helpers"; +import { JsonSafe } from "../../json-safe"; +import { ComputedRef } from "vue"; export const protobufPackage = "google.api"; /** * `Documentation` provides the information for describing a service. @@ -99,6 +100,14 @@ export interface Documentation { */ overview: string; } +export interface ReactiveDocumentation { + summary: ComputedRef<string>; + pages: ComputedRef<Page[]>; + rules: ComputedRef<DocumentationRule[]>; + documentationRootUrl: ComputedRef<string>; + serviceRootUrl: ComputedRef<string>; + overview: ComputedRef<string>; +} export interface DocumentationProtoMsg { typeUrl: "/google.api.Documentation"; value: Uint8Array; @@ -187,6 +196,11 @@ export interface DocumentationRule { */ deprecationDescription: string; } +export interface ReactiveDocumentationRule { + selector: ComputedRef<string>; + description: ComputedRef<string>; + deprecationDescription: ComputedRef<string>; +} export interface DocumentationRuleProtoMsg { typeUrl: "/google.api.DocumentationRule"; value: Uint8Array; @@ -230,6 +244,11 @@ export interface Page { */ subpages: Page[]; } +export interface ReactivePage { + name: ComputedRef<string>; + content: ComputedRef<string>; + subpages: ComputedRef<Page[]>; +} export interface PageProtoMsg { typeUrl: "/google.api.Page"; value: Uint8Array; @@ -256,7 +275,7 @@ function createBaseDocumentation(): Documentation { export const Documentation = { typeUrl: "/google.api.Documentation", encode(message: Documentation, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.summary !== undefined) { + if (message.summary !== "") { writer.uint32(10).string(message.summary); } for (const v of message.pages) { @@ -265,13 +284,13 @@ export const Documentation = { for (const v of message.rules) { DocumentationRule.encode(v!, writer.uint32(26).fork()).ldelim(); } - if (message.documentationRootUrl !== undefined) { + if (message.documentationRootUrl !== "") { writer.uint32(34).string(message.documentationRootUrl); } - if (message.serviceRootUrl !== undefined) { + if (message.serviceRootUrl !== "") { writer.uint32(50).string(message.serviceRootUrl); } - if (message.overview !== undefined) { + if (message.overview !== "") { writer.uint32(18).string(message.overview); } return writer; @@ -309,14 +328,14 @@ export const Documentation = { return message; }, fromJSON(object: any): Documentation { - 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; + 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) : "" + }; }, toJSON(message: Documentation): JsonSafe<Documentation> { const obj: any = {}; @@ -446,13 +465,13 @@ function createBaseDocumentationRule(): DocumentationRule { export const DocumentationRule = { typeUrl: "/google.api.DocumentationRule", encode(message: DocumentationRule, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.selector !== undefined) { + if (message.selector !== "") { writer.uint32(10).string(message.selector); } - if (message.description !== undefined) { + if (message.description !== "") { writer.uint32(18).string(message.description); } - if (message.deprecationDescription !== undefined) { + if (message.deprecationDescription !== "") { writer.uint32(26).string(message.deprecationDescription); } return writer; @@ -481,11 +500,11 @@ export const DocumentationRule = { return message; }, fromJSON(object: any): DocumentationRule { - 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; + return { + selector: isSet(object.selector) ? String(object.selector) : "", + description: isSet(object.description) ? String(object.description) : "", + deprecationDescription: isSet(object.deprecationDescription) ? String(object.deprecationDescription) : "" + }; }, toJSON(message: DocumentationRule): JsonSafe<DocumentationRule> { const obj: any = {}; @@ -568,10 +587,10 @@ function createBasePage(): Page { export const Page = { typeUrl: "/google.api.Page", encode(message: Page, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.name !== undefined) { + if (message.name !== "") { writer.uint32(10).string(message.name); } - if (message.content !== undefined) { + if (message.content !== "") { writer.uint32(18).string(message.content); } for (const v of message.subpages) { @@ -603,11 +622,11 @@ export const Page = { return message; }, fromJSON(object: any): Page { - 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; + 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)) : [] + }; }, toJSON(message: Page): JsonSafe<Page> { const obj: any = {}; diff --git a/__fixtures__/v-next/outputv4/google/api/endpoint.ts b/__fixtures__/v-next/outputv4/google/api/endpoint.ts index df0ef1e71e..1dbc68bce6 100644 --- a/__fixtures__/v-next/outputv4/google/api/endpoint.ts +++ b/__fixtures__/v-next/outputv4/google/api/endpoint.ts @@ -1,6 +1,7 @@ -import { BinaryReader, BinaryWriter } from "../../binary.js"; -import { isSet, DeepPartial } from "../../helpers.js"; -import { JsonSafe } from "../../json-safe.js"; +import { BinaryReader, BinaryWriter } from "../../binary"; +import { isSet, DeepPartial } from "../../helpers"; +import { JsonSafe } from "../../json-safe"; +import { ComputedRef } from "vue"; export const protobufPackage = "google.api"; /** * `Endpoint` describes a network endpoint of a service that serves a set of @@ -52,6 +53,12 @@ export interface Endpoint { */ allowCors: boolean; } +export interface ReactiveEndpoint { + name: ComputedRef<string>; + aliases: ComputedRef<string[]>; + target: ComputedRef<string>; + allowCors: ComputedRef<boolean>; +} export interface EndpointProtoMsg { typeUrl: "/google.api.Endpoint"; value: Uint8Array; @@ -92,16 +99,16 @@ function createBaseEndpoint(): Endpoint { export const Endpoint = { typeUrl: "/google.api.Endpoint", encode(message: Endpoint, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.name !== undefined) { + if (message.name !== "") { writer.uint32(10).string(message.name); } for (const v of message.aliases) { writer.uint32(18).string(v!); } - if (message.target !== undefined) { + if (message.target !== "") { writer.uint32(810).string(message.target); } - if (message.allowCors !== undefined) { + if (message.allowCors === true) { writer.uint32(40).bool(message.allowCors); } return writer; @@ -133,12 +140,12 @@ export const Endpoint = { return message; }, fromJSON(object: any): Endpoint { - 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; + 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 + }; }, toJSON(message: Endpoint): JsonSafe<Endpoint> { 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 1052f8145d..a30a484e8d 100644 --- a/__fixtures__/v-next/outputv4/google/api/error_reason.ts +++ b/__fixtures__/v-next/outputv4/google/api/error_reason.ts @@ -1,3 +1,4 @@ +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 501ba956ec..e1eaa38417 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,10 +1,11 @@ -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"; +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"; export const protobufPackage = "google.api.expr.conformance.v1alpha1"; /** Severities of issues. */ export enum IssueDetails_Severity { @@ -68,6 +69,12 @@ export interface ParseRequest { /** Prevent macro expansion. See "Macros" in Language Defiinition. */ disableMacros: boolean; } +export interface ReactiveParseRequest { + celSource: ComputedRef<string>; + syntaxVersion: ComputedRef<string>; + sourceLocation: ComputedRef<string>; + disableMacros: ComputedRef<boolean>; +} export interface ParseRequestProtoMsg { typeUrl: "/google.api.expr.conformance.v1alpha1.ParseRequest"; value: Uint8Array; @@ -86,6 +93,10 @@ export interface ParseResponse { /** Any number of issues with [StatusDetails][] as the details. */ issues: Status[]; } +export interface ReactiveParseResponse { + parsedExpr?: ComputedRef<ParsedExpr>; + issues: ComputedRef<Status[]>; +} export interface ParseResponseProtoMsg { typeUrl: "/google.api.expr.conformance.v1alpha1.ParseResponse"; value: Uint8Array; @@ -117,6 +128,12 @@ export interface CheckRequest { */ noStdEnv: boolean; } +export interface ReactiveCheckRequest { + parsedExpr?: ComputedRef<ParsedExpr>; + typeEnv: ComputedRef<Decl[]>; + container: ComputedRef<string>; + noStdEnv: ComputedRef<boolean>; +} export interface CheckRequestProtoMsg { typeUrl: "/google.api.expr.conformance.v1alpha1.CheckRequest"; value: Uint8Array; @@ -135,6 +152,10 @@ export interface CheckResponse { /** Any number of issues with [StatusDetails][] as the details. */ issues: Status[]; } +export interface ReactiveCheckResponse { + checkedExpr?: ComputedRef<CheckedExpr>; + issues: ComputedRef<Status[]>; +} export interface CheckResponseProtoMsg { typeUrl: "/google.api.expr.conformance.v1alpha1.CheckResponse"; value: Uint8Array; @@ -148,6 +169,10 @@ export interface EvalRequest_BindingsEntry { key: string; value?: ExprValue; } +export interface ReactiveEvalRequest_BindingsEntry { + key: ComputedRef<string>; + value?: ComputedRef<ExprValue>; +} export interface EvalRequest_BindingsEntryProtoMsg { typeUrl: string; value: Uint8Array; @@ -172,6 +197,14 @@ 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<ParsedExpr>; + checkedExpr?: ComputedRef<CheckedExpr>; + bindings: ComputedRef<{ + [key: string]: ExprValue; + }>; + container: ComputedRef<string>; +} export interface EvalRequestProtoMsg { typeUrl: "/google.api.expr.conformance.v1alpha1.EvalRequest"; value: Uint8Array; @@ -197,6 +230,10 @@ export interface EvalResponse { */ issues: Status[]; } +export interface ReactiveEvalResponse { + result?: ComputedRef<ExprValue>; + issues: ComputedRef<Status[]>; +} export interface EvalResponseProtoMsg { typeUrl: "/google.api.expr.conformance.v1alpha1.EvalResponse"; value: Uint8Array; @@ -219,6 +256,11 @@ export interface IssueDetails { /** Expression ID from [Expr][], 0 if unknown. */ id: bigint; } +export interface ReactiveIssueDetails { + severity: ComputedRef<IssueDetails_Severity>; + position?: ComputedRef<SourcePosition>; + id: ComputedRef<bigint>; +} export interface IssueDetailsProtoMsg { typeUrl: "/google.api.expr.conformance.v1alpha1.IssueDetails"; value: Uint8Array; @@ -244,16 +286,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 !== undefined) { + if (message.celSource !== "") { writer.uint32(10).string(message.celSource); } - if (message.syntaxVersion !== undefined) { + if (message.syntaxVersion !== "") { writer.uint32(18).string(message.syntaxVersion); } - if (message.sourceLocation !== undefined) { + if (message.sourceLocation !== "") { writer.uint32(26).string(message.sourceLocation); } - if (message.disableMacros !== undefined) { + if (message.disableMacros === true) { writer.uint32(32).bool(message.disableMacros); } return writer; @@ -285,12 +327,12 @@ export const ParseRequest = { return message; }, fromJSON(object: any): ParseRequest { - 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; + 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 + }; }, toJSON(message: ParseRequest): JsonSafe<ParseRequest> { const obj: any = {}; @@ -410,10 +452,10 @@ export const ParseResponse = { return message; }, fromJSON(object: any): ParseResponse { - 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; + return { + parsedExpr: isSet(object.parsedExpr) ? ParsedExpr.fromJSON(object.parsedExpr) : undefined, + issues: Array.isArray(object?.issues) ? object.issues.map((e: any) => Status.fromJSON(e)) : [] + }; }, toJSON(message: ParseResponse): JsonSafe<ParseResponse> { const obj: any = {}; @@ -427,9 +469,7 @@ export const ParseResponse = { }, fromPartial(object: DeepPartial<ParseResponse>): ParseResponse { const message = createBaseParseResponse(); - if (object.parsedExpr !== undefined && object.parsedExpr !== null) { - message.parsedExpr = ParsedExpr.fromPartial(object.parsedExpr); - } + message.parsedExpr = object.parsedExpr !== undefined && object.parsedExpr !== null ? ParsedExpr.fromPartial(object.parsedExpr) : undefined; message.issues = object.issues?.map(e => Status.fromPartial(e)) || []; return message; }, @@ -506,10 +546,10 @@ export const CheckRequest = { for (const v of message.typeEnv) { Decl.encode(v!, writer.uint32(18).fork()).ldelim(); } - if (message.container !== undefined) { + if (message.container !== "") { writer.uint32(26).string(message.container); } - if (message.noStdEnv !== undefined) { + if (message.noStdEnv === true) { writer.uint32(32).bool(message.noStdEnv); } return writer; @@ -541,12 +581,12 @@ export const CheckRequest = { return message; }, fromJSON(object: any): CheckRequest { - 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; + 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 + }; }, toJSON(message: CheckRequest): JsonSafe<CheckRequest> { const obj: any = {}; @@ -562,9 +602,7 @@ export const CheckRequest = { }, fromPartial(object: DeepPartial<CheckRequest>): CheckRequest { const message = createBaseCheckRequest(); - if (object.parsedExpr !== undefined && object.parsedExpr !== null) { - message.parsedExpr = ParsedExpr.fromPartial(object.parsedExpr); - } + message.parsedExpr = object.parsedExpr !== undefined && object.parsedExpr !== null ? ParsedExpr.fromPartial(object.parsedExpr) : undefined; message.typeEnv = object.typeEnv?.map(e => Decl.fromPartial(e)) || []; message.container = object.container ?? ""; message.noStdEnv = object.noStdEnv ?? false; @@ -678,10 +716,10 @@ export const CheckResponse = { return message; }, fromJSON(object: any): CheckResponse { - 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; + return { + checkedExpr: isSet(object.checkedExpr) ? CheckedExpr.fromJSON(object.checkedExpr) : undefined, + issues: Array.isArray(object?.issues) ? object.issues.map((e: any) => Status.fromJSON(e)) : [] + }; }, toJSON(message: CheckResponse): JsonSafe<CheckResponse> { const obj: any = {}; @@ -695,9 +733,7 @@ export const CheckResponse = { }, fromPartial(object: DeepPartial<CheckResponse>): CheckResponse { const message = createBaseCheckResponse(); - if (object.checkedExpr !== undefined && object.checkedExpr !== null) { - message.checkedExpr = CheckedExpr.fromPartial(object.checkedExpr); - } + message.checkedExpr = object.checkedExpr !== undefined && object.checkedExpr !== null ? CheckedExpr.fromPartial(object.checkedExpr) : undefined; message.issues = object.issues?.map(e => Status.fromPartial(e)) || []; return message; }, @@ -765,7 +801,7 @@ function createBaseEvalRequest_BindingsEntry(): EvalRequest_BindingsEntry { } export const EvalRequest_BindingsEntry = { encode(message: EvalRequest_BindingsEntry, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.key !== undefined) { + if (message.key !== "") { writer.uint32(10).string(message.key); } if (message.value !== undefined) { @@ -794,10 +830,10 @@ export const EvalRequest_BindingsEntry = { return message; }, fromJSON(object: any): EvalRequest_BindingsEntry { - const obj = createBaseEvalRequest_BindingsEntry(); - if (isSet(object.key)) obj.key = String(object.key); - if (isSet(object.value)) obj.value = ExprValue.fromJSON(object.value); - return obj; + return { + key: isSet(object.key) ? String(object.key) : "", + value: isSet(object.value) ? ExprValue.fromJSON(object.value) : undefined + }; }, toJSON(message: EvalRequest_BindingsEntry): JsonSafe<EvalRequest_BindingsEntry> { const obj: any = {}; @@ -808,9 +844,7 @@ export const EvalRequest_BindingsEntry = { fromPartial(object: DeepPartial<EvalRequest_BindingsEntry>): EvalRequest_BindingsEntry { const message = createBaseEvalRequest_BindingsEntry(); message.key = object.key ?? ""; - if (object.value !== undefined && object.value !== null) { - message.value = ExprValue.fromPartial(object.value); - } + message.value = object.value !== undefined && object.value !== null ? ExprValue.fromPartial(object.value) : undefined; return message; }, fromSDK(object: EvalRequest_BindingsEntrySDKType): EvalRequest_BindingsEntry { @@ -880,7 +914,7 @@ export const EvalRequest = { value }, writer.uint32(26).fork()).ldelim(); }); - if (message.container !== undefined) { + if (message.container !== "") { writer.uint32(34).string(message.container); } return writer; @@ -915,17 +949,17 @@ export const EvalRequest = { return message; }, fromJSON(object: any): EvalRequest { - 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; + 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) : "" + }; }, toJSON(message: EvalRequest): JsonSafe<EvalRequest> { const obj: any = {}; @@ -942,12 +976,8 @@ export const EvalRequest = { }, fromPartial(object: DeepPartial<EvalRequest>): EvalRequest { const message = createBaseEvalRequest(); - 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.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; message.bindings = Object.entries(object.bindings ?? {}).reduce<{ [key: string]: ExprValue; }>((acc, [key, value]) => { @@ -1086,10 +1116,10 @@ export const EvalResponse = { return message; }, fromJSON(object: any): EvalResponse { - 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; + return { + result: isSet(object.result) ? ExprValue.fromJSON(object.result) : undefined, + issues: Array.isArray(object?.issues) ? object.issues.map((e: any) => Status.fromJSON(e)) : [] + }; }, toJSON(message: EvalResponse): JsonSafe<EvalResponse> { const obj: any = {}; @@ -1103,9 +1133,7 @@ export const EvalResponse = { }, fromPartial(object: DeepPartial<EvalResponse>): EvalResponse { const message = createBaseEvalResponse(); - if (object.result !== undefined && object.result !== null) { - message.result = ExprValue.fromPartial(object.result); - } + message.result = object.result !== undefined && object.result !== null ? ExprValue.fromPartial(object.result) : undefined; message.issues = object.issues?.map(e => Status.fromPartial(e)) || []; return message; }, @@ -1181,7 +1209,7 @@ export const IssueDetails = { if (message.position !== undefined) { SourcePosition.encode(message.position, writer.uint32(18).fork()).ldelim(); } - if (message.id !== undefined) { + if (message.id !== BigInt(0)) { writer.uint32(24).int64(message.id); } return writer; @@ -1210,11 +1238,11 @@ export const IssueDetails = { return message; }, fromJSON(object: any): IssueDetails { - 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; + 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) + }; }, toJSON(message: IssueDetails): JsonSafe<IssueDetails> { const obj: any = {}; @@ -1226,12 +1254,8 @@ export const IssueDetails = { fromPartial(object: DeepPartial<IssueDetails>): IssueDetails { const message = createBaseIssueDetails(); message.severity = object.severity ?? 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()); - } + 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); 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 893f1e63f0..a9c14dfa4f 100644 --- a/__fixtures__/v-next/outputv4/google/api/expr/v1alpha1/checked.ts +++ b/__fixtures__/v-next/outputv4/google/api/expr/v1alpha1/checked.ts @@ -1,9 +1,10 @@ -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"; +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"; export const protobufPackage = "google.api.expr.v1alpha1"; /** CEL primitive types. */ export enum Type_PrimitiveType { @@ -144,6 +145,10 @@ export interface CheckedExpr_ReferenceMapEntry { key: bigint; value?: Reference; } +export interface ReactiveCheckedExpr_ReferenceMapEntry { + key: ComputedRef<bigint>; + value?: ComputedRef<Reference>; +} export interface CheckedExpr_ReferenceMapEntryProtoMsg { typeUrl: string; value: Uint8Array; @@ -156,6 +161,10 @@ export interface CheckedExpr_TypeMapEntry { key: bigint; value?: Type; } +export interface ReactiveCheckedExpr_TypeMapEntry { + key: ComputedRef<bigint>; + value?: ComputedRef<Type>; +} export interface CheckedExpr_TypeMapEntryProtoMsg { typeUrl: string; value: Uint8Array; @@ -217,6 +226,17 @@ export interface CheckedExpr { */ expr?: Expr; } +export interface ReactiveCheckedExpr { + referenceMap: ComputedRef<{ + [key: bigint]: Reference; + }>; + typeMap: ComputedRef<{ + [key: bigint]: Type; + }>; + sourceInfo?: ComputedRef<SourceInfo>; + exprVersion: ComputedRef<string>; + expr?: ComputedRef<Expr>; +} export interface CheckedExprProtoMsg { typeUrl: "/google.api.expr.v1alpha1.CheckedExpr"; value: Uint8Array; @@ -284,6 +304,21 @@ export interface Type { /** Abstract, application defined type. */ abstractType?: Type_AbstractType; } +export interface ReactiveType { + dyn?: ComputedRef<Empty>; + null?: ComputedRef<NullValue>; + primitive?: ComputedRef<Type_PrimitiveType>; + wrapper?: ComputedRef<Type_PrimitiveType>; + wellKnown?: ComputedRef<Type_WellKnownType>; + listType?: ComputedRef<Type_ListType>; + mapType?: ComputedRef<Type_MapType>; + function?: ComputedRef<Type_FunctionType>; + messageType?: ComputedRef<string>; + typeParam?: ComputedRef<string>; + type?: ComputedRef<Type>; + error?: ComputedRef<Empty>; + abstractType?: ComputedRef<Type_AbstractType>; +} export interface TypeProtoMsg { typeUrl: "/google.api.expr.v1alpha1.Type"; value: Uint8Array; @@ -309,6 +344,9 @@ export interface Type_ListType { /** The element type. */ elemType?: Type; } +export interface ReactiveType_ListType { + elemType?: ComputedRef<Type>; +} export interface Type_ListTypeProtoMsg { typeUrl: "/google.api.expr.v1alpha1.ListType"; value: Uint8Array; @@ -324,6 +362,10 @@ export interface Type_MapType { /** The type of the value. */ valueType?: Type; } +export interface ReactiveType_MapType { + keyType?: ComputedRef<Type>; + valueType?: ComputedRef<Type>; +} export interface Type_MapTypeProtoMsg { typeUrl: "/google.api.expr.v1alpha1.MapType"; value: Uint8Array; @@ -340,6 +382,10 @@ export interface Type_FunctionType { /** Argument types of the function. */ argTypes: Type[]; } +export interface ReactiveType_FunctionType { + resultType?: ComputedRef<Type>; + argTypes: ComputedRef<Type[]>; +} export interface Type_FunctionTypeProtoMsg { typeUrl: "/google.api.expr.v1alpha1.FunctionType"; value: Uint8Array; @@ -356,6 +402,10 @@ export interface Type_AbstractType { /** Parameter types for this abstract type. */ parameterTypes: Type[]; } +export interface ReactiveType_AbstractType { + name: ComputedRef<string>; + parameterTypes: ComputedRef<Type[]>; +} export interface Type_AbstractTypeProtoMsg { typeUrl: "/google.api.expr.v1alpha1.AbstractType"; value: Uint8Array; @@ -388,6 +438,11 @@ export interface Decl { /** Function declaration. */ function?: Decl_FunctionDecl; } +export interface ReactiveDecl { + name: ComputedRef<string>; + ident?: ComputedRef<Decl_IdentDecl>; + function?: ComputedRef<Decl_FunctionDecl>; +} export interface DeclProtoMsg { typeUrl: "/google.api.expr.v1alpha1.Decl"; value: Uint8Array; @@ -422,6 +477,11 @@ export interface Decl_IdentDecl { /** Documentation string for the identifier. */ doc: string; } +export interface ReactiveDecl_IdentDecl { + type?: ComputedRef<Type>; + value?: ComputedRef<Constant>; + doc: ComputedRef<string>; +} export interface Decl_IdentDeclProtoMsg { typeUrl: "/google.api.expr.v1alpha1.IdentDecl"; value: Uint8Array; @@ -450,6 +510,9 @@ 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<Decl_FunctionDecl_Overload[]>; +} export interface Decl_FunctionDeclProtoMsg { typeUrl: "/google.api.expr.v1alpha1.FunctionDecl"; value: Uint8Array; @@ -521,6 +584,14 @@ export interface Decl_FunctionDecl_Overload { /** Documentation string for the overload. */ doc: string; } +export interface ReactiveDecl_FunctionDecl_Overload { + overloadId: ComputedRef<string>; + params: ComputedRef<Type[]>; + typeParams: ComputedRef<string[]>; + resultType?: ComputedRef<Type>; + isInstanceFunction: ComputedRef<boolean>; + doc: ComputedRef<string>; +} export interface Decl_FunctionDecl_OverloadProtoMsg { typeUrl: "/google.api.expr.v1alpha1.Overload"; value: Uint8Array; @@ -566,6 +637,11 @@ export interface Reference { */ value?: Constant; } +export interface ReactiveReference { + name: ComputedRef<string>; + overloadId: ComputedRef<string[]>; + value?: ComputedRef<Constant>; +} export interface ReferenceProtoMsg { typeUrl: "/google.api.expr.v1alpha1.Reference"; value: Uint8Array; @@ -584,7 +660,7 @@ function createBaseCheckedExpr_ReferenceMapEntry(): CheckedExpr_ReferenceMapEntr } export const CheckedExpr_ReferenceMapEntry = { encode(message: CheckedExpr_ReferenceMapEntry, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.key !== undefined) { + if (message.key !== BigInt(0)) { writer.uint32(8).int64(message.key); } if (message.value !== undefined) { @@ -613,10 +689,10 @@ export const CheckedExpr_ReferenceMapEntry = { return message; }, fromJSON(object: any): CheckedExpr_ReferenceMapEntry { - 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; + return { + key: isSet(object.key) ? BigInt(object.key.toString()) : BigInt(0), + value: isSet(object.value) ? Reference.fromJSON(object.value) : undefined + }; }, toJSON(message: CheckedExpr_ReferenceMapEntry): JsonSafe<CheckedExpr_ReferenceMapEntry> { const obj: any = {}; @@ -626,12 +702,8 @@ export const CheckedExpr_ReferenceMapEntry = { }, fromPartial(object: DeepPartial<CheckedExpr_ReferenceMapEntry>): CheckedExpr_ReferenceMapEntry { const message = createBaseCheckedExpr_ReferenceMapEntry(); - 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); - } + 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; return message; }, fromSDK(object: CheckedExpr_ReferenceMapEntrySDKType): CheckedExpr_ReferenceMapEntry { @@ -686,7 +758,7 @@ function createBaseCheckedExpr_TypeMapEntry(): CheckedExpr_TypeMapEntry { } export const CheckedExpr_TypeMapEntry = { encode(message: CheckedExpr_TypeMapEntry, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.key !== undefined) { + if (message.key !== BigInt(0)) { writer.uint32(8).int64(message.key); } if (message.value !== undefined) { @@ -715,10 +787,10 @@ export const CheckedExpr_TypeMapEntry = { return message; }, fromJSON(object: any): CheckedExpr_TypeMapEntry { - 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; + return { + key: isSet(object.key) ? BigInt(object.key.toString()) : BigInt(0), + value: isSet(object.value) ? Type.fromJSON(object.value) : undefined + }; }, toJSON(message: CheckedExpr_TypeMapEntry): JsonSafe<CheckedExpr_TypeMapEntry> { const obj: any = {}; @@ -728,12 +800,8 @@ export const CheckedExpr_TypeMapEntry = { }, fromPartial(object: DeepPartial<CheckedExpr_TypeMapEntry>): CheckedExpr_TypeMapEntry { const message = createBaseCheckedExpr_TypeMapEntry(); - 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); - } + 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; return message; }, fromSDK(object: CheckedExpr_TypeMapEntrySDKType): CheckedExpr_TypeMapEntry { @@ -807,7 +875,7 @@ export const CheckedExpr = { if (message.sourceInfo !== undefined) { SourceInfo.encode(message.sourceInfo, writer.uint32(42).fork()).ldelim(); } - if (message.exprVersion !== undefined) { + if (message.exprVersion !== "") { writer.uint32(50).string(message.exprVersion); } if (message.expr !== undefined) { @@ -851,23 +919,23 @@ export const CheckedExpr = { return message; }, fromJSON(object: any): CheckedExpr { - 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; + 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 + }; }, toJSON(message: CheckedExpr): JsonSafe<CheckedExpr> { const obj: any = {}; @@ -906,13 +974,9 @@ export const CheckedExpr = { } return acc; }, {}); - if (object.sourceInfo !== undefined && object.sourceInfo !== null) { - message.sourceInfo = SourceInfo.fromPartial(object.sourceInfo); - } + message.sourceInfo = object.sourceInfo !== undefined && object.sourceInfo !== null ? SourceInfo.fromPartial(object.sourceInfo) : undefined; message.exprVersion = object.exprVersion ?? ""; - if (object.expr !== undefined && object.expr !== null) { - message.expr = Expr.fromPartial(object.expr); - } + message.expr = object.expr !== undefined && object.expr !== null ? Expr.fromPartial(object.expr) : undefined; return message; }, fromSDK(object: CheckedExprSDKType): CheckedExpr { @@ -1151,21 +1215,21 @@ export const Type = { return message; }, fromJSON(object: any): Type { - 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; + 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 + }; }, toJSON(message: Type): JsonSafe<Type> { const obj: any = {}; @@ -1186,33 +1250,19 @@ export const Type = { }, fromPartial(object: DeepPartial<Type>): Type { const message = createBaseType(); - if (object.dyn !== undefined && object.dyn !== null) { - message.dyn = Empty.fromPartial(object.dyn); - } + message.dyn = object.dyn !== undefined && object.dyn !== null ? Empty.fromPartial(object.dyn) : undefined; message.null = object.null ?? undefined; message.primitive = object.primitive ?? undefined; message.wrapper = object.wrapper ?? undefined; message.wellKnown = object.wellKnown ?? 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.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; message.messageType = object.messageType ?? undefined; message.typeParam = object.typeParam ?? 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); - } + 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; return message; }, fromSDK(object: TypeSDKType): Type { @@ -1373,9 +1423,9 @@ export const Type_ListType = { return message; }, fromJSON(object: any): Type_ListType { - const obj = createBaseType_ListType(); - if (isSet(object.elemType)) obj.elemType = Type.fromJSON(object.elemType); - return obj; + return { + elemType: isSet(object.elemType) ? Type.fromJSON(object.elemType) : undefined + }; }, toJSON(message: Type_ListType): JsonSafe<Type_ListType> { const obj: any = {}; @@ -1384,9 +1434,7 @@ export const Type_ListType = { }, fromPartial(object: DeepPartial<Type_ListType>): Type_ListType { const message = createBaseType_ListType(); - if (object.elemType !== undefined && object.elemType !== null) { - message.elemType = Type.fromPartial(object.elemType); - } + message.elemType = object.elemType !== undefined && object.elemType !== null ? Type.fromPartial(object.elemType) : undefined; return message; }, fromSDK(object: Type_ListTypeSDKType): Type_ListType { @@ -1470,10 +1518,10 @@ export const Type_MapType = { return message; }, fromJSON(object: any): Type_MapType { - 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; + return { + keyType: isSet(object.keyType) ? Type.fromJSON(object.keyType) : undefined, + valueType: isSet(object.valueType) ? Type.fromJSON(object.valueType) : undefined + }; }, toJSON(message: Type_MapType): JsonSafe<Type_MapType> { const obj: any = {}; @@ -1483,12 +1531,8 @@ export const Type_MapType = { }, fromPartial(object: DeepPartial<Type_MapType>): Type_MapType { const message = createBaseType_MapType(); - 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); - } + 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; return message; }, fromSDK(object: Type_MapTypeSDKType): Type_MapType { @@ -1579,10 +1623,10 @@ export const Type_FunctionType = { return message; }, fromJSON(object: any): Type_FunctionType { - 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; + return { + resultType: isSet(object.resultType) ? Type.fromJSON(object.resultType) : undefined, + argTypes: Array.isArray(object?.argTypes) ? object.argTypes.map((e: any) => Type.fromJSON(e)) : [] + }; }, toJSON(message: Type_FunctionType): JsonSafe<Type_FunctionType> { const obj: any = {}; @@ -1596,9 +1640,7 @@ export const Type_FunctionType = { }, fromPartial(object: DeepPartial<Type_FunctionType>): Type_FunctionType { const message = createBaseType_FunctionType(); - if (object.resultType !== undefined && object.resultType !== null) { - message.resultType = Type.fromPartial(object.resultType); - } + message.resultType = object.resultType !== undefined && object.resultType !== null ? Type.fromPartial(object.resultType) : undefined; message.argTypes = object.argTypes?.map(e => Type.fromPartial(e)) || []; return message; }, @@ -1667,7 +1709,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 !== undefined) { + if (message.name !== "") { writer.uint32(10).string(message.name); } for (const v of message.parameterTypes) { @@ -1696,10 +1738,10 @@ export const Type_AbstractType = { return message; }, fromJSON(object: any): Type_AbstractType { - 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; + return { + name: isSet(object.name) ? String(object.name) : "", + parameterTypes: Array.isArray(object?.parameterTypes) ? object.parameterTypes.map((e: any) => Type.fromJSON(e)) : [] + }; }, toJSON(message: Type_AbstractType): JsonSafe<Type_AbstractType> { const obj: any = {}; @@ -1783,7 +1825,7 @@ function createBaseDecl(): Decl { export const Decl = { typeUrl: "/google.api.expr.v1alpha1.Decl", encode(message: Decl, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.name !== undefined) { + if (message.name !== "") { writer.uint32(10).string(message.name); } if (message.ident !== undefined) { @@ -1818,11 +1860,11 @@ export const Decl = { return message; }, fromJSON(object: any): Decl { - 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; + 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 + }; }, toJSON(message: Decl): JsonSafe<Decl> { const obj: any = {}; @@ -1834,12 +1876,8 @@ export const Decl = { fromPartial(object: DeepPartial<Decl>): Decl { const message = createBaseDecl(); message.name = object.name ?? ""; - 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); - } + 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; return message; }, fromSDK(object: DeclSDKType): Decl { @@ -1915,7 +1953,7 @@ export const Decl_IdentDecl = { if (message.value !== undefined) { Constant.encode(message.value, writer.uint32(18).fork()).ldelim(); } - if (message.doc !== undefined) { + if (message.doc !== "") { writer.uint32(26).string(message.doc); } return writer; @@ -1944,11 +1982,11 @@ export const Decl_IdentDecl = { return message; }, fromJSON(object: any): Decl_IdentDecl { - 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; + 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) : "" + }; }, toJSON(message: Decl_IdentDecl): JsonSafe<Decl_IdentDecl> { const obj: any = {}; @@ -1959,12 +1997,8 @@ export const Decl_IdentDecl = { }, fromPartial(object: DeepPartial<Decl_IdentDecl>): Decl_IdentDecl { const message = createBaseDecl_IdentDecl(); - 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.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; message.doc = object.doc ?? ""; return message; }, @@ -2056,9 +2090,9 @@ export const Decl_FunctionDecl = { return message; }, fromJSON(object: any): Decl_FunctionDecl { - const obj = createBaseDecl_FunctionDecl(); - if (Array.isArray(object?.overloads)) obj.overloads = object.overloads.map((e: any) => Decl_FunctionDecl_Overload.fromJSON(e)); - return obj; + return { + overloads: Array.isArray(object?.overloads) ? object.overloads.map((e: any) => Decl_FunctionDecl_Overload.fromJSON(e)) : [] + }; }, toJSON(message: Decl_FunctionDecl): JsonSafe<Decl_FunctionDecl> { const obj: any = {}; @@ -2136,7 +2170,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 !== undefined) { + if (message.overloadId !== "") { writer.uint32(10).string(message.overloadId); } for (const v of message.params) { @@ -2148,10 +2182,10 @@ export const Decl_FunctionDecl_Overload = { if (message.resultType !== undefined) { Type.encode(message.resultType, writer.uint32(34).fork()).ldelim(); } - if (message.isInstanceFunction !== undefined) { + if (message.isInstanceFunction === true) { writer.uint32(40).bool(message.isInstanceFunction); } - if (message.doc !== undefined) { + if (message.doc !== "") { writer.uint32(50).string(message.doc); } return writer; @@ -2189,14 +2223,14 @@ export const Decl_FunctionDecl_Overload = { return message; }, fromJSON(object: any): Decl_FunctionDecl_Overload { - 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; + 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) : "" + }; }, toJSON(message: Decl_FunctionDecl_Overload): JsonSafe<Decl_FunctionDecl_Overload> { const obj: any = {}; @@ -2221,9 +2255,7 @@ 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) || []; - if (object.resultType !== undefined && object.resultType !== null) { - message.resultType = Type.fromPartial(object.resultType); - } + message.resultType = object.resultType !== undefined && object.resultType !== null ? Type.fromPartial(object.resultType) : undefined; message.isInstanceFunction = object.isInstanceFunction ?? false; message.doc = object.doc ?? ""; return message; @@ -2328,7 +2360,7 @@ function createBaseReference(): Reference { export const Reference = { typeUrl: "/google.api.expr.v1alpha1.Reference", encode(message: Reference, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.name !== undefined) { + if (message.name !== "") { writer.uint32(10).string(message.name); } for (const v of message.overloadId) { @@ -2363,11 +2395,11 @@ export const Reference = { return message; }, fromJSON(object: any): Reference { - 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; + 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 + }; }, toJSON(message: Reference): JsonSafe<Reference> { const obj: any = {}; @@ -2384,9 +2416,7 @@ export const Reference = { const message = createBaseReference(); message.name = object.name ?? ""; message.overloadId = object.overloadId?.map(e => e) || []; - if (object.value !== undefined && object.value !== null) { - message.value = Constant.fromPartial(object.value); - } + message.value = object.value !== undefined && object.value !== null ? Constant.fromPartial(object.value) : undefined; 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 3d622489c7..361e225fec 100644 --- a/__fixtures__/v-next/outputv4/google/api/expr/v1alpha1/eval.ts +++ b/__fixtures__/v-next/outputv4/google/api/expr/v1alpha1/eval.ts @@ -1,8 +1,9 @@ -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"; +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"; export const protobufPackage = "google.api.expr.v1alpha1"; /** * The state of an evaluation. @@ -20,6 +21,10 @@ export interface EvalState { */ results: EvalState_Result[]; } +export interface ReactiveEvalState { + values: ComputedRef<ExprValue[]>; + results: ComputedRef<EvalState_Result[]>; +} export interface EvalStateProtoMsg { typeUrl: "/google.api.expr.v1alpha1.EvalState"; value: Uint8Array; @@ -40,6 +45,10 @@ export interface EvalState_Result { /** The index in `values` of the resulting value. */ value: bigint; } +export interface ReactiveEvalState_Result { + expr: ComputedRef<bigint>; + value: ComputedRef<bigint>; +} export interface EvalState_ResultProtoMsg { typeUrl: "/google.api.expr.v1alpha1.Result"; value: Uint8Array; @@ -100,6 +109,11 @@ export interface ExprValue { */ unknown?: UnknownSet; } +export interface ReactiveExprValue { + value?: ComputedRef<Value>; + error?: ComputedRef<ErrorSet>; + unknown?: ComputedRef<UnknownSet>; +} export interface ExprValueProtoMsg { typeUrl: "/google.api.expr.v1alpha1.ExprValue"; value: Uint8Array; @@ -119,6 +133,9 @@ export interface ErrorSet { /** The errors in the set. */ errors: Status[]; } +export interface ReactiveErrorSet { + errors: ComputedRef<Status[]>; +} export interface ErrorSetProtoMsg { typeUrl: "/google.api.expr.v1alpha1.ErrorSet"; value: Uint8Array; @@ -140,6 +157,9 @@ export interface UnknownSet { /** The ids of the expressions with unknown values. */ exprs: bigint[]; } +export interface ReactiveUnknownSet { + exprs: ComputedRef<bigint[]>; +} export interface UnknownSetProtoMsg { typeUrl: "/google.api.expr.v1alpha1.UnknownSet"; value: Uint8Array; @@ -190,10 +210,10 @@ export const EvalState = { return message; }, fromJSON(object: any): EvalState { - 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; + 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)) : [] + }; }, toJSON(message: EvalState): JsonSafe<EvalState> { const obj: any = {}; @@ -286,10 +306,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 !== undefined) { + if (message.expr !== BigInt(0)) { writer.uint32(8).int64(message.expr); } - if (message.value !== undefined) { + if (message.value !== BigInt(0)) { writer.uint32(16).int64(message.value); } return writer; @@ -315,10 +335,10 @@ export const EvalState_Result = { return message; }, fromJSON(object: any): EvalState_Result { - 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; + return { + expr: isSet(object.expr) ? BigInt(object.expr.toString()) : BigInt(0), + value: isSet(object.value) ? BigInt(object.value.toString()) : BigInt(0) + }; }, toJSON(message: EvalState_Result): JsonSafe<EvalState_Result> { const obj: any = {}; @@ -328,12 +348,8 @@ export const EvalState_Result = { }, fromPartial(object: DeepPartial<EvalState_Result>): EvalState_Result { const message = createBaseEvalState_Result(); - 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()); - } + 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); return message; }, fromSDK(object: EvalState_ResultSDKType): EvalState_Result { @@ -431,11 +447,11 @@ export const ExprValue = { return message; }, fromJSON(object: any): ExprValue { - 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; + 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 + }; }, toJSON(message: ExprValue): JsonSafe<ExprValue> { const obj: any = {}; @@ -446,15 +462,9 @@ export const ExprValue = { }, fromPartial(object: DeepPartial<ExprValue>): ExprValue { const message = createBaseExprValue(); - 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); - } + 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; return message; }, fromSDK(object: ExprValueSDKType): ExprValue { @@ -545,9 +555,9 @@ export const ErrorSet = { return message; }, fromJSON(object: any): ErrorSet { - const obj = createBaseErrorSet(); - if (Array.isArray(object?.errors)) obj.errors = object.errors.map((e: any) => Status.fromJSON(e)); - return obj; + return { + errors: Array.isArray(object?.errors) ? object.errors.map((e: any) => Status.fromJSON(e)) : [] + }; }, toJSON(message: ErrorSet): JsonSafe<ErrorSet> { const obj: any = {}; @@ -652,9 +662,9 @@ export const UnknownSet = { return message; }, fromJSON(object: any): UnknownSet { - const obj = createBaseUnknownSet(); - if (Array.isArray(object?.exprs)) obj.exprs = object.exprs.map((e: any) => BigInt(e.toString())); - return obj; + return { + exprs: Array.isArray(object?.exprs) ? object.exprs.map((e: any) => BigInt(e.toString())) : [] + }; }, toJSON(message: UnknownSet): JsonSafe<UnknownSet> { 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 f24dd302f3..f606aba169 100644 --- a/__fixtures__/v-next/outputv4/google/api/expr/v1alpha1/explain.ts +++ b/__fixtures__/v-next/outputv4/google/api/expr/v1alpha1/explain.ts @@ -1,7 +1,8 @@ -import { Value, ValueSDKType } from "./value.js"; -import { BinaryReader, BinaryWriter } from "../../../../binary.js"; -import { JsonSafe } from "../../../../json-safe.js"; -import { DeepPartial, isSet } from "../../../../helpers.js"; +import { Value, ValueSDKType } from "./value"; +import { BinaryReader, BinaryWriter } from "../../../../binary"; +import { JsonSafe } from "../../../../json-safe"; +import { DeepPartial, isSet } from "../../../../helpers"; +import { ComputedRef } from "vue"; export const protobufPackage = "google.api.expr.v1alpha1"; /** * Values of intermediate expressions produced when evaluating expression. @@ -25,6 +26,10 @@ export interface Explain { */ exprSteps: Explain_ExprStep[]; } +export interface ReactiveExplain { + values: ComputedRef<Value[]>; + exprSteps: ComputedRef<Explain_ExprStep[]>; +} export interface ExplainProtoMsg { typeUrl: "/google.api.expr.v1alpha1.Explain"; value: Uint8Array; @@ -45,6 +50,10 @@ export interface Explain_ExprStep { /** Index of the value in the values list. */ valueIndex: number; } +export interface ReactiveExplain_ExprStep { + id: ComputedRef<bigint>; + valueIndex: ComputedRef<number>; +} export interface Explain_ExprStepProtoMsg { typeUrl: "/google.api.expr.v1alpha1.ExprStep"; value: Uint8Array; @@ -92,10 +101,10 @@ export const Explain = { return message; }, fromJSON(object: any): Explain { - 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; + 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)) : [] + }; }, toJSON(message: Explain): JsonSafe<Explain> { const obj: any = {}; @@ -188,10 +197,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 !== undefined) { + if (message.id !== BigInt(0)) { writer.uint32(8).int64(message.id); } - if (message.valueIndex !== undefined) { + if (message.valueIndex !== 0) { writer.uint32(16).int32(message.valueIndex); } return writer; @@ -217,10 +226,10 @@ export const Explain_ExprStep = { return message; }, fromJSON(object: any): Explain_ExprStep { - 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; + return { + id: isSet(object.id) ? BigInt(object.id.toString()) : BigInt(0), + valueIndex: isSet(object.valueIndex) ? Number(object.valueIndex) : 0 + }; }, toJSON(message: Explain_ExprStep): JsonSafe<Explain_ExprStep> { const obj: any = {}; @@ -230,9 +239,7 @@ export const Explain_ExprStep = { }, fromPartial(object: DeepPartial<Explain_ExprStep>): Explain_ExprStep { const message = createBaseExplain_ExprStep(); - if (object.id !== undefined && object.id !== null) { - message.id = BigInt(object.id.toString()); - } + message.id = object.id !== undefined && object.id !== null ? BigInt(object.id.toString()) : BigInt(0); 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 4d1fb151e3..361bc4f31f 100644 --- a/__fixtures__/v-next/outputv4/google/api/expr/v1alpha1/syntax.ts +++ b/__fixtures__/v-next/outputv4/google/api/expr/v1alpha1/syntax.ts @@ -1,9 +1,10 @@ -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"; +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"; export const protobufPackage = "google.api.expr.v1alpha1"; /** An expression together with source information as returned by the parser. */ export interface ParsedExpr { @@ -12,6 +13,10 @@ export interface ParsedExpr { /** The source info derived from input that generated the parsed `expr`. */ sourceInfo?: SourceInfo; } +export interface ReactiveParsedExpr { + expr?: ComputedRef<Expr>; + sourceInfo?: ComputedRef<SourceInfo>; +} export interface ParsedExprProtoMsg { typeUrl: "/google.api.expr.v1alpha1.ParsedExpr"; value: Uint8Array; @@ -60,6 +65,16 @@ export interface Expr { /** A comprehension expression. */ comprehensionExpr?: Expr_Comprehension; } +export interface ReactiveExpr { + id: ComputedRef<bigint>; + constExpr?: ComputedRef<Constant>; + identExpr?: ComputedRef<Expr_Ident>; + selectExpr?: ComputedRef<Expr_Select>; + callExpr?: ComputedRef<Expr_Call>; + listExpr?: ComputedRef<Expr_CreateList>; + structExpr?: ComputedRef<Expr_CreateStruct>; + comprehensionExpr?: ComputedRef<Expr_Comprehension>; +} export interface ExprProtoMsg { typeUrl: "/google.api.expr.v1alpha1.Expr"; value: Uint8Array; @@ -101,6 +116,9 @@ export interface Expr_Ident { */ name: string; } +export interface ReactiveExpr_Ident { + name: ComputedRef<string>; +} export interface Expr_IdentProtoMsg { typeUrl: "/google.api.expr.v1alpha1.Ident"; value: Uint8Array; @@ -132,6 +150,11 @@ export interface Expr_Select { */ testOnly: boolean; } +export interface ReactiveExpr_Select { + operand?: ComputedRef<Expr>; + field: ComputedRef<string>; + testOnly: ComputedRef<boolean>; +} export interface Expr_SelectProtoMsg { typeUrl: "/google.api.expr.v1alpha1.Select"; value: Uint8Array; @@ -158,6 +181,11 @@ export interface Expr_Call { /** The arguments. */ args: Expr[]; } +export interface ReactiveExpr_Call { + target?: ComputedRef<Expr>; + function: ComputedRef<string>; + args: ComputedRef<Expr[]>; +} export interface Expr_CallProtoMsg { typeUrl: "/google.api.expr.v1alpha1.Call"; value: Uint8Array; @@ -182,6 +210,9 @@ export interface Expr_CreateList { /** The elements part of the list. */ elements: Expr[]; } +export interface ReactiveExpr_CreateList { + elements: ComputedRef<Expr[]>; +} export interface Expr_CreateListProtoMsg { typeUrl: "/google.api.expr.v1alpha1.CreateList"; value: Uint8Array; @@ -211,6 +242,10 @@ export interface Expr_CreateStruct { /** The entries in the creation expression. */ entries: Expr_CreateStruct_Entry[]; } +export interface ReactiveExpr_CreateStruct { + messageName: ComputedRef<string>; + entries: ComputedRef<Expr_CreateStruct_Entry[]>; +} export interface Expr_CreateStructProtoMsg { typeUrl: "/google.api.expr.v1alpha1.CreateStruct"; value: Uint8Array; @@ -241,6 +276,12 @@ export interface Expr_CreateStruct_Entry { /** Required. The value assigned to the key. */ value?: Expr; } +export interface ReactiveExpr_CreateStruct_Entry { + id: ComputedRef<bigint>; + fieldKey?: ComputedRef<string>; + mapKey?: ComputedRef<Expr>; + value?: ComputedRef<Expr>; +} export interface Expr_CreateStruct_EntryProtoMsg { typeUrl: "/google.api.expr.v1alpha1.Entry"; value: Uint8Array; @@ -309,6 +350,15 @@ export interface Expr_Comprehension { */ result?: Expr; } +export interface ReactiveExpr_Comprehension { + iterVar: ComputedRef<string>; + iterRange?: ComputedRef<Expr>; + accuVar: ComputedRef<string>; + accuInit?: ComputedRef<Expr>; + loopCondition?: ComputedRef<Expr>; + loopStep?: ComputedRef<Expr>; + result?: ComputedRef<Expr>; +} export interface Expr_ComprehensionProtoMsg { typeUrl: "/google.api.expr.v1alpha1.Comprehension"; value: Uint8Array; @@ -395,6 +445,17 @@ export interface Constant { /** @deprecated */ timestampValue?: Date; } +export interface ReactiveConstant { + nullValue?: ComputedRef<NullValue>; + boolValue?: ComputedRef<boolean>; + int64Value?: ComputedRef<bigint>; + uint64Value?: ComputedRef<bigint>; + doubleValue?: ComputedRef<number>; + stringValue?: ComputedRef<string>; + bytesValue?: ComputedRef<Uint8Array>; + durationValue?: ComputedRef<Duration>; + timestampValue?: ComputedRef<Date>; +} export interface ConstantProtoMsg { typeUrl: "/google.api.expr.v1alpha1.Constant"; value: Uint8Array; @@ -431,6 +492,10 @@ export interface SourceInfo_PositionsEntry { key: bigint; value: number; } +export interface ReactiveSourceInfo_PositionsEntry { + key: ComputedRef<bigint>; + value: ComputedRef<number>; +} export interface SourceInfo_PositionsEntryProtoMsg { typeUrl: string; value: Uint8Array; @@ -443,6 +508,10 @@ export interface SourceInfo_MacroCallsEntry { key: bigint; value?: Expr; } +export interface ReactiveSourceInfo_MacroCallsEntry { + key: ComputedRef<bigint>; + value?: ComputedRef<Expr>; +} export interface SourceInfo_MacroCallsEntryProtoMsg { typeUrl: string; value: Uint8Array; @@ -493,6 +562,17 @@ export interface SourceInfo { [key: bigint]: Expr; }; } +export interface ReactiveSourceInfo { + syntaxVersion: ComputedRef<string>; + location: ComputedRef<string>; + lineOffsets: ComputedRef<number[]>; + positions: ComputedRef<{ + [key: bigint]: number; + }>; + macroCalls: ComputedRef<{ + [key: bigint]: Expr; + }>; +} export interface SourceInfoProtoMsg { typeUrl: "/google.api.expr.v1alpha1.SourceInfo"; value: Uint8Array; @@ -526,6 +606,12 @@ export interface SourcePosition { */ column: number; } +export interface ReactiveSourcePosition { + location: ComputedRef<string>; + offset: ComputedRef<number>; + line: ComputedRef<number>; + column: ComputedRef<number>; +} export interface SourcePositionProtoMsg { typeUrl: "/google.api.expr.v1alpha1.SourcePosition"; value: Uint8Array; @@ -575,10 +661,10 @@ export const ParsedExpr = { return message; }, fromJSON(object: any): ParsedExpr { - 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; + return { + expr: isSet(object.expr) ? Expr.fromJSON(object.expr) : undefined, + sourceInfo: isSet(object.sourceInfo) ? SourceInfo.fromJSON(object.sourceInfo) : undefined + }; }, toJSON(message: ParsedExpr): JsonSafe<ParsedExpr> { const obj: any = {}; @@ -588,12 +674,8 @@ export const ParsedExpr = { }, fromPartial(object: DeepPartial<ParsedExpr>): ParsedExpr { const message = createBaseParsedExpr(); - 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.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; return message; }, fromSDK(object: ParsedExprSDKType): ParsedExpr { @@ -661,7 +743,7 @@ function createBaseExpr(): Expr { export const Expr = { typeUrl: "/google.api.expr.v1alpha1.Expr", encode(message: Expr, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.id !== undefined) { + if (message.id !== BigInt(0)) { writer.uint32(16).int64(message.id); } if (message.constExpr !== undefined) { @@ -726,16 +808,16 @@ export const Expr = { return message; }, fromJSON(object: any): Expr { - 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; + 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 + }; }, toJSON(message: Expr): JsonSafe<Expr> { const obj: any = {}; @@ -751,30 +833,14 @@ export const Expr = { }, fromPartial(object: DeepPartial<Expr>): Expr { const message = createBaseExpr(); - 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); - } + 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; return message; }, fromSDK(object: ExprSDKType): Expr { @@ -877,7 +943,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 !== undefined) { + if (message.name !== "") { writer.uint32(10).string(message.name); } return writer; @@ -900,9 +966,9 @@ export const Expr_Ident = { return message; }, fromJSON(object: any): Expr_Ident { - const obj = createBaseExpr_Ident(); - if (isSet(object.name)) obj.name = String(object.name); - return obj; + return { + name: isSet(object.name) ? String(object.name) : "" + }; }, toJSON(message: Expr_Ident): JsonSafe<Expr_Ident> { const obj: any = {}; @@ -970,10 +1036,10 @@ export const Expr_Select = { if (message.operand !== undefined) { Expr.encode(message.operand, writer.uint32(10).fork()).ldelim(); } - if (message.field !== undefined) { + if (message.field !== "") { writer.uint32(18).string(message.field); } - if (message.testOnly !== undefined) { + if (message.testOnly === true) { writer.uint32(24).bool(message.testOnly); } return writer; @@ -1002,11 +1068,11 @@ export const Expr_Select = { return message; }, fromJSON(object: any): Expr_Select { - 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; + 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 + }; }, toJSON(message: Expr_Select): JsonSafe<Expr_Select> { const obj: any = {}; @@ -1017,9 +1083,7 @@ export const Expr_Select = { }, fromPartial(object: DeepPartial<Expr_Select>): Expr_Select { const message = createBaseExpr_Select(); - if (object.operand !== undefined && object.operand !== null) { - message.operand = Expr.fromPartial(object.operand); - } + message.operand = object.operand !== undefined && object.operand !== null ? Expr.fromPartial(object.operand) : undefined; message.field = object.field ?? ""; message.testOnly = object.testOnly ?? false; return message; @@ -1094,7 +1158,7 @@ export const Expr_Call = { if (message.target !== undefined) { Expr.encode(message.target, writer.uint32(10).fork()).ldelim(); } - if (message.function !== undefined) { + if (message.function !== "") { writer.uint32(18).string(message.function); } for (const v of message.args) { @@ -1126,11 +1190,11 @@ export const Expr_Call = { return message; }, fromJSON(object: any): Expr_Call { - 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; + 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)) : [] + }; }, toJSON(message: Expr_Call): JsonSafe<Expr_Call> { const obj: any = {}; @@ -1145,9 +1209,7 @@ export const Expr_Call = { }, fromPartial(object: DeepPartial<Expr_Call>): Expr_Call { const message = createBaseExpr_Call(); - if (object.target !== undefined && object.target !== null) { - message.target = Expr.fromPartial(object.target); - } + message.target = object.target !== undefined && object.target !== null ? Expr.fromPartial(object.target) : undefined; message.function = object.function ?? ""; message.args = object.args?.map(e => Expr.fromPartial(e)) || []; return message; @@ -1246,9 +1308,9 @@ export const Expr_CreateList = { return message; }, fromJSON(object: any): Expr_CreateList { - const obj = createBaseExpr_CreateList(); - if (Array.isArray(object?.elements)) obj.elements = object.elements.map((e: any) => Expr.fromJSON(e)); - return obj; + return { + elements: Array.isArray(object?.elements) ? object.elements.map((e: any) => Expr.fromJSON(e)) : [] + }; }, toJSON(message: Expr_CreateList): JsonSafe<Expr_CreateList> { const obj: any = {}; @@ -1322,7 +1384,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 !== undefined) { + if (message.messageName !== "") { writer.uint32(10).string(message.messageName); } for (const v of message.entries) { @@ -1351,10 +1413,10 @@ export const Expr_CreateStruct = { return message; }, fromJSON(object: any): Expr_CreateStruct { - 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; + return { + messageName: isSet(object.messageName) ? String(object.messageName) : "", + entries: Array.isArray(object?.entries) ? object.entries.map((e: any) => Expr_CreateStruct_Entry.fromJSON(e)) : [] + }; }, toJSON(message: Expr_CreateStruct): JsonSafe<Expr_CreateStruct> { const obj: any = {}; @@ -1439,7 +1501,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 !== undefined) { + if (message.id !== BigInt(0)) { writer.uint32(8).int64(message.id); } if (message.fieldKey !== undefined) { @@ -1480,12 +1542,12 @@ export const Expr_CreateStruct_Entry = { return message; }, fromJSON(object: any): Expr_CreateStruct_Entry { - 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; + 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 + }; }, toJSON(message: Expr_CreateStruct_Entry): JsonSafe<Expr_CreateStruct_Entry> { const obj: any = {}; @@ -1497,16 +1559,10 @@ export const Expr_CreateStruct_Entry = { }, fromPartial(object: DeepPartial<Expr_CreateStruct_Entry>): Expr_CreateStruct_Entry { const message = createBaseExpr_CreateStruct_Entry(); - if (object.id !== undefined && object.id !== null) { - message.id = BigInt(object.id.toString()); - } + message.id = object.id !== undefined && object.id !== null ? BigInt(object.id.toString()) : BigInt(0); message.fieldKey = object.fieldKey ?? 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); - } + 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; return message; }, fromSDK(object: Expr_CreateStruct_EntrySDKType): Expr_CreateStruct_Entry { @@ -1587,13 +1643,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 !== undefined) { + if (message.iterVar !== "") { writer.uint32(10).string(message.iterVar); } if (message.iterRange !== undefined) { Expr.encode(message.iterRange, writer.uint32(18).fork()).ldelim(); } - if (message.accuVar !== undefined) { + if (message.accuVar !== "") { writer.uint32(26).string(message.accuVar); } if (message.accuInit !== undefined) { @@ -1646,15 +1702,15 @@ export const Expr_Comprehension = { return message; }, fromJSON(object: any): Expr_Comprehension { - 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; + 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 + }; }, toJSON(message: Expr_Comprehension): JsonSafe<Expr_Comprehension> { const obj: any = {}; @@ -1670,22 +1726,12 @@ export const Expr_Comprehension = { fromPartial(object: DeepPartial<Expr_Comprehension>): Expr_Comprehension { const message = createBaseExpr_Comprehension(); message.iterVar = object.iterVar ?? ""; - if (object.iterRange !== undefined && object.iterRange !== null) { - message.iterRange = Expr.fromPartial(object.iterRange); - } + message.iterRange = object.iterRange !== undefined && object.iterRange !== null ? Expr.fromPartial(object.iterRange) : undefined; message.accuVar = object.accuVar ?? ""; - 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); - } + 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; return message; }, fromSDK(object: Expr_ComprehensionSDKType): Expr_Comprehension { @@ -1860,17 +1906,17 @@ export const Constant = { return message; }, fromJSON(object: any): Constant { - 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; + 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 + }; }, toJSON(message: Constant): JsonSafe<Constant> { const obj: any = {}; @@ -1893,18 +1939,12 @@ export const Constant = { const message = createBaseConstant(); message.nullValue = object.nullValue ?? undefined; message.boolValue = object.boolValue ?? 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.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; message.doubleValue = object.doubleValue ?? undefined; message.stringValue = object.stringValue ?? undefined; message.bytesValue = object.bytesValue ?? undefined; - if (object.durationValue !== undefined && object.durationValue !== null) { - message.durationValue = Duration.fromPartial(object.durationValue); - } + message.durationValue = object.durationValue !== undefined && object.durationValue !== null ? Duration.fromPartial(object.durationValue) : undefined; message.timestampValue = object.timestampValue ?? undefined; return message; }, @@ -2015,10 +2055,10 @@ function createBaseSourceInfo_PositionsEntry(): SourceInfo_PositionsEntry { } export const SourceInfo_PositionsEntry = { encode(message: SourceInfo_PositionsEntry, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.key !== undefined) { + if (message.key !== BigInt(0)) { writer.uint32(8).int64(message.key); } - if (message.value !== undefined) { + if (message.value !== 0) { writer.uint32(16).int32(message.value); } return writer; @@ -2044,10 +2084,10 @@ export const SourceInfo_PositionsEntry = { return message; }, fromJSON(object: any): SourceInfo_PositionsEntry { - 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; + return { + key: isSet(object.key) ? BigInt(object.key.toString()) : BigInt(0), + value: isSet(object.value) ? Number(object.value) : 0 + }; }, toJSON(message: SourceInfo_PositionsEntry): JsonSafe<SourceInfo_PositionsEntry> { const obj: any = {}; @@ -2057,9 +2097,7 @@ export const SourceInfo_PositionsEntry = { }, fromPartial(object: DeepPartial<SourceInfo_PositionsEntry>): SourceInfo_PositionsEntry { const message = createBaseSourceInfo_PositionsEntry(); - if (object.key !== undefined && object.key !== null) { - message.key = BigInt(object.key.toString()); - } + message.key = object.key !== undefined && object.key !== null ? BigInt(object.key.toString()) : BigInt(0); message.value = object.value ?? 0; return message; }, @@ -2115,7 +2153,7 @@ function createBaseSourceInfo_MacroCallsEntry(): SourceInfo_MacroCallsEntry { } export const SourceInfo_MacroCallsEntry = { encode(message: SourceInfo_MacroCallsEntry, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.key !== undefined) { + if (message.key !== BigInt(0)) { writer.uint32(8).int64(message.key); } if (message.value !== undefined) { @@ -2144,10 +2182,10 @@ export const SourceInfo_MacroCallsEntry = { return message; }, fromJSON(object: any): SourceInfo_MacroCallsEntry { - 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; + return { + key: isSet(object.key) ? BigInt(object.key.toString()) : BigInt(0), + value: isSet(object.value) ? Expr.fromJSON(object.value) : undefined + }; }, toJSON(message: SourceInfo_MacroCallsEntry): JsonSafe<SourceInfo_MacroCallsEntry> { const obj: any = {}; @@ -2157,12 +2195,8 @@ export const SourceInfo_MacroCallsEntry = { }, fromPartial(object: DeepPartial<SourceInfo_MacroCallsEntry>): SourceInfo_MacroCallsEntry { const message = createBaseSourceInfo_MacroCallsEntry(); - 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); - } + 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; return message; }, fromSDK(object: SourceInfo_MacroCallsEntrySDKType): SourceInfo_MacroCallsEntry { @@ -2221,10 +2255,10 @@ function createBaseSourceInfo(): SourceInfo { export const SourceInfo = { typeUrl: "/google.api.expr.v1alpha1.SourceInfo", encode(message: SourceInfo, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.syntaxVersion !== undefined) { + if (message.syntaxVersion !== "") { writer.uint32(10).string(message.syntaxVersion); } - if (message.location !== undefined) { + if (message.location !== "") { writer.uint32(18).string(message.location); } writer.uint32(26).fork(); @@ -2289,23 +2323,23 @@ export const SourceInfo = { return message; }, fromJSON(object: any): SourceInfo { - 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; + 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; + }, {}) : {} + }; }, toJSON(message: SourceInfo): JsonSafe<SourceInfo> { const obj: any = {}; @@ -2491,16 +2525,16 @@ function createBaseSourcePosition(): SourcePosition { export const SourcePosition = { typeUrl: "/google.api.expr.v1alpha1.SourcePosition", encode(message: SourcePosition, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.location !== undefined) { + if (message.location !== "") { writer.uint32(10).string(message.location); } - if (message.offset !== undefined) { + if (message.offset !== 0) { writer.uint32(16).int32(message.offset); } - if (message.line !== undefined) { + if (message.line !== 0) { writer.uint32(24).int32(message.line); } - if (message.column !== undefined) { + if (message.column !== 0) { writer.uint32(32).int32(message.column); } return writer; @@ -2532,12 +2566,12 @@ export const SourcePosition = { return message; }, fromJSON(object: any): SourcePosition { - 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; + 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 + }; }, toJSON(message: SourcePosition): JsonSafe<SourcePosition> { 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 f6a2b19c5c..f835ee499c 100644 --- a/__fixtures__/v-next/outputv4/google/api/expr/v1alpha1/value.ts +++ b/__fixtures__/v-next/outputv4/google/api/expr/v1alpha1/value.ts @@ -1,8 +1,9 @@ -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"; +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"; export const protobufPackage = "google.api.expr.v1alpha1"; /** * Represents a CEL value. @@ -36,6 +37,20 @@ export interface Value { /** Type value. */ typeValue?: string; } +export interface ReactiveValue { + nullValue?: ComputedRef<NullValue>; + boolValue?: ComputedRef<boolean>; + int64Value?: ComputedRef<bigint>; + uint64Value?: ComputedRef<bigint>; + doubleValue?: ComputedRef<number>; + stringValue?: ComputedRef<string>; + bytesValue?: ComputedRef<Uint8Array>; + enumValue?: ComputedRef<EnumValue>; + objectValue?: ComputedRef<Any>; + mapValue?: ComputedRef<MapValue>; + listValue?: ComputedRef<ListValue>; + typeValue?: ComputedRef<string>; +} export interface ValueProtoMsg { typeUrl: "/google.api.expr.v1alpha1.Value"; value: Uint8Array; @@ -67,6 +82,10 @@ export interface EnumValue { /** The value of the enum. */ value: number; } +export interface ReactiveEnumValue { + type: ComputedRef<string>; + value: ComputedRef<number>; +} export interface EnumValueProtoMsg { typeUrl: "/google.api.expr.v1alpha1.EnumValue"; value: Uint8Array; @@ -86,6 +105,9 @@ export interface ListValue { /** The ordered values in the list. */ values: Value[]; } +export interface ReactiveListValue { + values: ComputedRef<Value[]>; +} export interface ListValueProtoMsg { typeUrl: "/google.api.expr.v1alpha1.ListValue"; value: Uint8Array; @@ -114,6 +136,9 @@ export interface MapValue { */ entries: MapValue_Entry[]; } +export interface ReactiveMapValue { + entries: ComputedRef<MapValue_Entry[]>; +} export interface MapValueProtoMsg { typeUrl: "/google.api.expr.v1alpha1.MapValue"; value: Uint8Array; @@ -139,6 +164,10 @@ export interface MapValue_Entry { /** The value. */ value?: Value; } +export interface ReactiveMapValue_Entry { + key?: ComputedRef<Value>; + value?: ComputedRef<Value>; +} export interface MapValue_EntryProtoMsg { typeUrl: "/google.api.expr.v1alpha1.Entry"; value: Uint8Array; @@ -256,20 +285,20 @@ export const Value = { return message; }, fromJSON(object: any): Value { - 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; + 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 + }; }, toJSON(message: Value): JsonSafe<Value> { const obj: any = {}; @@ -295,27 +324,15 @@ export const Value = { const message = createBaseValue(); message.nullValue = object.nullValue ?? undefined; message.boolValue = object.boolValue ?? 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.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; message.doubleValue = object.doubleValue ?? undefined; message.stringValue = object.stringValue ?? undefined; message.bytesValue = object.bytesValue ?? 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.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; message.typeValue = object.typeValue ?? undefined; return message; }, @@ -448,10 +465,10 @@ function createBaseEnumValue(): EnumValue { export const EnumValue = { typeUrl: "/google.api.expr.v1alpha1.EnumValue", encode(message: EnumValue, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.type !== undefined) { + if (message.type !== "") { writer.uint32(10).string(message.type); } - if (message.value !== undefined) { + if (message.value !== 0) { writer.uint32(16).int32(message.value); } return writer; @@ -477,10 +494,10 @@ export const EnumValue = { return message; }, fromJSON(object: any): EnumValue { - const obj = createBaseEnumValue(); - if (isSet(object.type)) obj.type = String(object.type); - if (isSet(object.value)) obj.value = Number(object.value); - return obj; + return { + type: isSet(object.type) ? String(object.type) : "", + value: isSet(object.value) ? Number(object.value) : 0 + }; }, toJSON(message: EnumValue): JsonSafe<EnumValue> { const obj: any = {}; @@ -575,9 +592,9 @@ export const ListValue = { return message; }, fromJSON(object: any): ListValue { - const obj = createBaseListValue(); - if (Array.isArray(object?.values)) obj.values = object.values.map((e: any) => Value.fromJSON(e)); - return obj; + return { + values: Array.isArray(object?.values) ? object.values.map((e: any) => Value.fromJSON(e)) : [] + }; }, toJSON(message: ListValue): JsonSafe<ListValue> { const obj: any = {}; @@ -673,9 +690,9 @@ export const MapValue = { return message; }, fromJSON(object: any): MapValue { - const obj = createBaseMapValue(); - if (Array.isArray(object?.entries)) obj.entries = object.entries.map((e: any) => MapValue_Entry.fromJSON(e)); - return obj; + return { + entries: Array.isArray(object?.entries) ? object.entries.map((e: any) => MapValue_Entry.fromJSON(e)) : [] + }; }, toJSON(message: MapValue): JsonSafe<MapValue> { const obj: any = {}; @@ -778,10 +795,10 @@ export const MapValue_Entry = { return message; }, fromJSON(object: any): MapValue_Entry { - 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; + return { + key: isSet(object.key) ? Value.fromJSON(object.key) : undefined, + value: isSet(object.value) ? Value.fromJSON(object.value) : undefined + }; }, toJSON(message: MapValue_Entry): JsonSafe<MapValue_Entry> { const obj: any = {}; @@ -791,12 +808,8 @@ export const MapValue_Entry = { }, fromPartial(object: DeepPartial<MapValue_Entry>): MapValue_Entry { const message = createBaseMapValue_Entry(); - 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); - } + 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; 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 441dd94c7d..089e74b1db 100644 --- a/__fixtures__/v-next/outputv4/google/api/expr/v1beta1/decl.ts +++ b/__fixtures__/v-next/outputv4/google/api/expr/v1beta1/decl.ts @@ -1,7 +1,8 @@ -import { Expr, ExprSDKType } from "./expr.js"; -import { BinaryReader, BinaryWriter } from "../../../../binary.js"; -import { isSet, DeepPartial } from "../../../../helpers.js"; -import { JsonSafe } from "../../../../json-safe.js"; +import { Expr, ExprSDKType } from "./expr"; +import { BinaryReader, BinaryWriter } from "../../../../binary"; +import { isSet, DeepPartial } from "../../../../helpers"; +import { JsonSafe } from "../../../../json-safe"; +import { ComputedRef } from "vue"; export const protobufPackage = "google.api.expr.v1beta1"; /** A declaration. */ export interface Decl { @@ -16,6 +17,13 @@ export interface Decl { /** A function declaration. */ function?: FunctionDecl; } +export interface ReactiveDecl { + id: ComputedRef<number>; + name: ComputedRef<string>; + doc: ComputedRef<string>; + ident?: ComputedRef<IdentDecl>; + function?: ComputedRef<FunctionDecl>; +} export interface DeclProtoMsg { typeUrl: "/google.api.expr.v1beta1.Decl"; value: Uint8Array; @@ -45,6 +53,11 @@ export interface DeclType { */ typeParams: DeclType[]; } +export interface ReactiveDeclType { + id: ComputedRef<number>; + type: ComputedRef<string>; + typeParams: ComputedRef<DeclType[]>; +} export interface DeclTypeProtoMsg { typeUrl: "/google.api.expr.v1beta1.DeclType"; value: Uint8Array; @@ -67,6 +80,10 @@ export interface IdentDecl { /** Optional value of the identifier. */ value?: Expr; } +export interface ReactiveIdentDecl { + type?: ComputedRef<DeclType>; + value?: ComputedRef<Expr>; +} export interface IdentDeclProtoMsg { typeUrl: "/google.api.expr.v1beta1.IdentDecl"; value: Uint8Array; @@ -85,6 +102,11 @@ export interface FunctionDecl { /** If the first argument of the function is the receiver. */ receiverFunction: boolean; } +export interface ReactiveFunctionDecl { + args: ComputedRef<IdentDecl[]>; + returnType?: ComputedRef<DeclType>; + receiverFunction: ComputedRef<boolean>; +} export interface FunctionDeclProtoMsg { typeUrl: "/google.api.expr.v1beta1.FunctionDecl"; value: Uint8Array; @@ -107,13 +129,13 @@ function createBaseDecl(): Decl { export const Decl = { typeUrl: "/google.api.expr.v1beta1.Decl", encode(message: Decl, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.id !== undefined) { + if (message.id !== 0) { writer.uint32(8).int32(message.id); } - if (message.name !== undefined) { + if (message.name !== "") { writer.uint32(18).string(message.name); } - if (message.doc !== undefined) { + if (message.doc !== "") { writer.uint32(26).string(message.doc); } if (message.ident !== undefined) { @@ -154,13 +176,13 @@ export const Decl = { return message; }, fromJSON(object: any): Decl { - 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; + 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 + }; }, toJSON(message: Decl): JsonSafe<Decl> { const obj: any = {}; @@ -176,12 +198,8 @@ export const Decl = { message.id = object.id ?? 0; message.name = object.name ?? ""; message.doc = object.doc ?? ""; - 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); - } + 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; return message; }, fromSDK(object: DeclSDKType): Decl { @@ -265,10 +283,10 @@ function createBaseDeclType(): DeclType { export const DeclType = { typeUrl: "/google.api.expr.v1beta1.DeclType", encode(message: DeclType, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.id !== undefined) { + if (message.id !== 0) { writer.uint32(8).int32(message.id); } - if (message.type !== undefined) { + if (message.type !== "") { writer.uint32(18).string(message.type); } for (const v of message.typeParams) { @@ -300,11 +318,11 @@ export const DeclType = { return message; }, fromJSON(object: any): DeclType { - 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; + 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)) : [] + }; }, toJSON(message: DeclType): JsonSafe<DeclType> { const obj: any = {}; @@ -425,10 +443,10 @@ export const IdentDecl = { return message; }, fromJSON(object: any): IdentDecl { - 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; + return { + type: isSet(object.type) ? DeclType.fromJSON(object.type) : undefined, + value: isSet(object.value) ? Expr.fromJSON(object.value) : undefined + }; }, toJSON(message: IdentDecl): JsonSafe<IdentDecl> { const obj: any = {}; @@ -438,12 +456,8 @@ export const IdentDecl = { }, fromPartial(object: DeepPartial<IdentDecl>): IdentDecl { const message = createBaseIdentDecl(); - 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); - } + 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; return message; }, fromSDK(object: IdentDeclSDKType): IdentDecl { @@ -512,7 +526,7 @@ export const FunctionDecl = { if (message.returnType !== undefined) { DeclType.encode(message.returnType, writer.uint32(18).fork()).ldelim(); } - if (message.receiverFunction !== undefined) { + if (message.receiverFunction === true) { writer.uint32(24).bool(message.receiverFunction); } return writer; @@ -541,11 +555,11 @@ export const FunctionDecl = { return message; }, fromJSON(object: any): FunctionDecl { - 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; + 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 + }; }, toJSON(message: FunctionDecl): JsonSafe<FunctionDecl> { const obj: any = {}; @@ -561,9 +575,7 @@ export const FunctionDecl = { fromPartial(object: DeepPartial<FunctionDecl>): FunctionDecl { const message = createBaseFunctionDecl(); message.args = object.args?.map(e => IdentDecl.fromPartial(e)) || []; - if (object.returnType !== undefined && object.returnType !== null) { - message.returnType = DeclType.fromPartial(object.returnType); - } + message.returnType = object.returnType !== undefined && object.returnType !== null ? DeclType.fromPartial(object.returnType) : undefined; 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 f3d7fa3abf..582b66ff37 100644 --- a/__fixtures__/v-next/outputv4/google/api/expr/v1beta1/eval.ts +++ b/__fixtures__/v-next/outputv4/google/api/expr/v1beta1/eval.ts @@ -1,8 +1,9 @@ -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"; +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"; export const protobufPackage = "google.api.expr.v1beta1"; /** * The state of an evaluation. @@ -20,6 +21,10 @@ export interface EvalState { */ results: EvalState_Result[]; } +export interface ReactiveEvalState { + values: ComputedRef<ExprValue[]>; + results: ComputedRef<EvalState_Result[]>; +} export interface EvalStateProtoMsg { typeUrl: "/google.api.expr.v1beta1.EvalState"; value: Uint8Array; @@ -40,6 +45,10 @@ export interface EvalState_Result { /** The index in `values` of the resulting value. */ value: number; } +export interface ReactiveEvalState_Result { + expr?: ComputedRef<IdRef>; + value: ComputedRef<number>; +} export interface EvalState_ResultProtoMsg { typeUrl: "/google.api.expr.v1beta1.Result"; value: Uint8Array; @@ -100,6 +109,11 @@ export interface ExprValue { */ unknown?: UnknownSet; } +export interface ReactiveExprValue { + value?: ComputedRef<Value>; + error?: ComputedRef<ErrorSet>; + unknown?: ComputedRef<UnknownSet>; +} export interface ExprValueProtoMsg { typeUrl: "/google.api.expr.v1beta1.ExprValue"; value: Uint8Array; @@ -119,6 +133,9 @@ export interface ErrorSet { /** The errors in the set. */ errors: Status[]; } +export interface ReactiveErrorSet { + errors: ComputedRef<Status[]>; +} export interface ErrorSetProtoMsg { typeUrl: "/google.api.expr.v1beta1.ErrorSet"; value: Uint8Array; @@ -140,6 +157,9 @@ export interface UnknownSet { /** The ids of the expressions with unknown values. */ exprs: IdRef[]; } +export interface ReactiveUnknownSet { + exprs: ComputedRef<IdRef[]>; +} export interface UnknownSetProtoMsg { typeUrl: "/google.api.expr.v1beta1.UnknownSet"; value: Uint8Array; @@ -157,6 +177,9 @@ export interface IdRef { /** The expression id. */ id: number; } +export interface ReactiveIdRef { + id: ComputedRef<number>; +} export interface IdRefProtoMsg { typeUrl: "/google.api.expr.v1beta1.IdRef"; value: Uint8Array; @@ -203,10 +226,10 @@ export const EvalState = { return message; }, fromJSON(object: any): EvalState { - 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; + 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)) : [] + }; }, toJSON(message: EvalState): JsonSafe<EvalState> { const obj: any = {}; @@ -302,7 +325,7 @@ export const EvalState_Result = { if (message.expr !== undefined) { IdRef.encode(message.expr, writer.uint32(10).fork()).ldelim(); } - if (message.value !== undefined) { + if (message.value !== 0) { writer.uint32(16).int32(message.value); } return writer; @@ -328,10 +351,10 @@ export const EvalState_Result = { return message; }, fromJSON(object: any): EvalState_Result { - 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; + return { + expr: isSet(object.expr) ? IdRef.fromJSON(object.expr) : undefined, + value: isSet(object.value) ? Number(object.value) : 0 + }; }, toJSON(message: EvalState_Result): JsonSafe<EvalState_Result> { const obj: any = {}; @@ -341,9 +364,7 @@ export const EvalState_Result = { }, fromPartial(object: DeepPartial<EvalState_Result>): EvalState_Result { const message = createBaseEvalState_Result(); - if (object.expr !== undefined && object.expr !== null) { - message.expr = IdRef.fromPartial(object.expr); - } + message.expr = object.expr !== undefined && object.expr !== null ? IdRef.fromPartial(object.expr) : undefined; message.value = object.value ?? 0; return message; }, @@ -442,11 +463,11 @@ export const ExprValue = { return message; }, fromJSON(object: any): ExprValue { - 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; + 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 + }; }, toJSON(message: ExprValue): JsonSafe<ExprValue> { const obj: any = {}; @@ -457,15 +478,9 @@ export const ExprValue = { }, fromPartial(object: DeepPartial<ExprValue>): ExprValue { const message = createBaseExprValue(); - 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); - } + 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; return message; }, fromSDK(object: ExprValueSDKType): ExprValue { @@ -556,9 +571,9 @@ export const ErrorSet = { return message; }, fromJSON(object: any): ErrorSet { - const obj = createBaseErrorSet(); - if (Array.isArray(object?.errors)) obj.errors = object.errors.map((e: any) => Status.fromJSON(e)); - return obj; + return { + errors: Array.isArray(object?.errors) ? object.errors.map((e: any) => Status.fromJSON(e)) : [] + }; }, toJSON(message: ErrorSet): JsonSafe<ErrorSet> { const obj: any = {}; @@ -654,9 +669,9 @@ export const UnknownSet = { return message; }, fromJSON(object: any): UnknownSet { - const obj = createBaseUnknownSet(); - if (Array.isArray(object?.exprs)) obj.exprs = object.exprs.map((e: any) => IdRef.fromJSON(e)); - return obj; + return { + exprs: Array.isArray(object?.exprs) ? object.exprs.map((e: any) => IdRef.fromJSON(e)) : [] + }; }, toJSON(message: UnknownSet): JsonSafe<UnknownSet> { const obj: any = {}; @@ -729,7 +744,7 @@ function createBaseIdRef(): IdRef { export const IdRef = { typeUrl: "/google.api.expr.v1beta1.IdRef", encode(message: IdRef, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.id !== undefined) { + if (message.id !== 0) { writer.uint32(8).int32(message.id); } return writer; @@ -752,9 +767,9 @@ export const IdRef = { return message; }, fromJSON(object: any): IdRef { - const obj = createBaseIdRef(); - if (isSet(object.id)) obj.id = Number(object.id); - return obj; + return { + id: isSet(object.id) ? Number(object.id) : 0 + }; }, toJSON(message: IdRef): JsonSafe<IdRef> { 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 387732b235..c15ba44dd2 100644 --- a/__fixtures__/v-next/outputv4/google/api/expr/v1beta1/expr.ts +++ b/__fixtures__/v-next/outputv4/google/api/expr/v1beta1/expr.ts @@ -1,8 +1,9 @@ -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"; +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"; export const protobufPackage = "google.api.expr.v1beta1"; /** An expression together with source information as returned by the parser. */ export interface ParsedExpr { @@ -13,6 +14,11 @@ export interface ParsedExpr { /** The syntax version of the source, e.g. `cel1`. */ syntaxVersion: string; } +export interface ReactiveParsedExpr { + expr?: ComputedRef<Expr>; + sourceInfo?: ComputedRef<SourceInfo>; + syntaxVersion: ComputedRef<string>; +} export interface ParsedExprProtoMsg { typeUrl: "/google.api.expr.v1beta1.ParsedExpr"; value: Uint8Array; @@ -62,6 +68,16 @@ export interface Expr { /** A comprehension expression. */ comprehensionExpr?: Expr_Comprehension; } +export interface ReactiveExpr { + id: ComputedRef<number>; + literalExpr?: ComputedRef<Literal>; + identExpr?: ComputedRef<Expr_Ident>; + selectExpr?: ComputedRef<Expr_Select>; + callExpr?: ComputedRef<Expr_Call>; + listExpr?: ComputedRef<Expr_CreateList>; + structExpr?: ComputedRef<Expr_CreateStruct>; + comprehensionExpr?: ComputedRef<Expr_Comprehension>; +} export interface ExprProtoMsg { typeUrl: "/google.api.expr.v1beta1.Expr"; value: Uint8Array; @@ -103,6 +119,9 @@ export interface Expr_Ident { */ name: string; } +export interface ReactiveExpr_Ident { + name: ComputedRef<string>; +} export interface Expr_IdentProtoMsg { typeUrl: "/google.api.expr.v1beta1.Ident"; value: Uint8Array; @@ -134,6 +153,11 @@ export interface Expr_Select { */ testOnly: boolean; } +export interface ReactiveExpr_Select { + operand?: ComputedRef<Expr>; + field: ComputedRef<string>; + testOnly: ComputedRef<boolean>; +} export interface Expr_SelectProtoMsg { typeUrl: "/google.api.expr.v1beta1.Select"; value: Uint8Array; @@ -160,6 +184,11 @@ export interface Expr_Call { /** The arguments. */ args: Expr[]; } +export interface ReactiveExpr_Call { + target?: ComputedRef<Expr>; + function: ComputedRef<string>; + args: ComputedRef<Expr[]>; +} export interface Expr_CallProtoMsg { typeUrl: "/google.api.expr.v1beta1.Call"; value: Uint8Array; @@ -184,6 +213,9 @@ export interface Expr_CreateList { /** The elements part of the list. */ elements: Expr[]; } +export interface ReactiveExpr_CreateList { + elements: ComputedRef<Expr[]>; +} export interface Expr_CreateListProtoMsg { typeUrl: "/google.api.expr.v1beta1.CreateList"; value: Uint8Array; @@ -213,6 +245,10 @@ export interface Expr_CreateStruct { /** The entries in the creation expression. */ entries: Expr_CreateStruct_Entry[]; } +export interface ReactiveExpr_CreateStruct { + type: ComputedRef<string>; + entries: ComputedRef<Expr_CreateStruct_Entry[]>; +} export interface Expr_CreateStructProtoMsg { typeUrl: "/google.api.expr.v1beta1.CreateStruct"; value: Uint8Array; @@ -243,6 +279,12 @@ export interface Expr_CreateStruct_Entry { /** Required. The value assigned to the key. */ value?: Expr; } +export interface ReactiveExpr_CreateStruct_Entry { + id: ComputedRef<number>; + fieldKey?: ComputedRef<string>; + mapKey?: ComputedRef<Expr>; + value?: ComputedRef<Expr>; +} export interface Expr_CreateStruct_EntryProtoMsg { typeUrl: "/google.api.expr.v1beta1.Entry"; value: Uint8Array; @@ -311,6 +353,15 @@ export interface Expr_Comprehension { */ result?: Expr; } +export interface ReactiveExpr_Comprehension { + iterVar: ComputedRef<string>; + iterRange?: ComputedRef<Expr>; + accuVar: ComputedRef<string>; + accuInit?: ComputedRef<Expr>; + loopCondition?: ComputedRef<Expr>; + loopStep?: ComputedRef<Expr>; + result?: ComputedRef<Expr>; +} export interface Expr_ComprehensionProtoMsg { typeUrl: "/google.api.expr.v1beta1.Comprehension"; value: Uint8Array; @@ -381,6 +432,15 @@ export interface Literal { /** bytes value. */ bytesValue?: Uint8Array; } +export interface ReactiveLiteral { + nullValue?: ComputedRef<NullValue>; + boolValue?: ComputedRef<boolean>; + int64Value?: ComputedRef<bigint>; + uint64Value?: ComputedRef<bigint>; + doubleValue?: ComputedRef<number>; + stringValue?: ComputedRef<string>; + bytesValue?: ComputedRef<Uint8Array>; +} export interface LiteralProtoMsg { typeUrl: "/google.api.expr.v1beta1.Literal"; value: Uint8Array; @@ -423,7 +483,7 @@ export const ParsedExpr = { if (message.sourceInfo !== undefined) { SourceInfo.encode(message.sourceInfo, writer.uint32(26).fork()).ldelim(); } - if (message.syntaxVersion !== undefined) { + if (message.syntaxVersion !== "") { writer.uint32(34).string(message.syntaxVersion); } return writer; @@ -452,11 +512,11 @@ export const ParsedExpr = { return message; }, fromJSON(object: any): ParsedExpr { - 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; + 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) : "" + }; }, toJSON(message: ParsedExpr): JsonSafe<ParsedExpr> { const obj: any = {}; @@ -467,12 +527,8 @@ export const ParsedExpr = { }, fromPartial(object: DeepPartial<ParsedExpr>): ParsedExpr { const message = createBaseParsedExpr(); - 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.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; message.syntaxVersion = object.syntaxVersion ?? ""; return message; }, @@ -548,7 +604,7 @@ function createBaseExpr(): Expr { export const Expr = { typeUrl: "/google.api.expr.v1beta1.Expr", encode(message: Expr, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.id !== undefined) { + if (message.id !== 0) { writer.uint32(16).int32(message.id); } if (message.literalExpr !== undefined) { @@ -613,16 +669,16 @@ export const Expr = { return message; }, fromJSON(object: any): Expr { - 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; + 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 + }; }, toJSON(message: Expr): JsonSafe<Expr> { const obj: any = {}; @@ -639,27 +695,13 @@ export const Expr = { fromPartial(object: DeepPartial<Expr>): Expr { const message = createBaseExpr(); message.id = object.id ?? 0; - 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); - } + 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; return message; }, fromSDK(object: ExprSDKType): Expr { @@ -762,7 +804,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 !== undefined) { + if (message.name !== "") { writer.uint32(10).string(message.name); } return writer; @@ -785,9 +827,9 @@ export const Expr_Ident = { return message; }, fromJSON(object: any): Expr_Ident { - const obj = createBaseExpr_Ident(); - if (isSet(object.name)) obj.name = String(object.name); - return obj; + return { + name: isSet(object.name) ? String(object.name) : "" + }; }, toJSON(message: Expr_Ident): JsonSafe<Expr_Ident> { const obj: any = {}; @@ -855,10 +897,10 @@ export const Expr_Select = { if (message.operand !== undefined) { Expr.encode(message.operand, writer.uint32(10).fork()).ldelim(); } - if (message.field !== undefined) { + if (message.field !== "") { writer.uint32(18).string(message.field); } - if (message.testOnly !== undefined) { + if (message.testOnly === true) { writer.uint32(24).bool(message.testOnly); } return writer; @@ -887,11 +929,11 @@ export const Expr_Select = { return message; }, fromJSON(object: any): Expr_Select { - 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; + 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 + }; }, toJSON(message: Expr_Select): JsonSafe<Expr_Select> { const obj: any = {}; @@ -902,9 +944,7 @@ export const Expr_Select = { }, fromPartial(object: DeepPartial<Expr_Select>): Expr_Select { const message = createBaseExpr_Select(); - if (object.operand !== undefined && object.operand !== null) { - message.operand = Expr.fromPartial(object.operand); - } + message.operand = object.operand !== undefined && object.operand !== null ? Expr.fromPartial(object.operand) : undefined; message.field = object.field ?? ""; message.testOnly = object.testOnly ?? false; return message; @@ -979,7 +1019,7 @@ export const Expr_Call = { if (message.target !== undefined) { Expr.encode(message.target, writer.uint32(10).fork()).ldelim(); } - if (message.function !== undefined) { + if (message.function !== "") { writer.uint32(18).string(message.function); } for (const v of message.args) { @@ -1011,11 +1051,11 @@ export const Expr_Call = { return message; }, fromJSON(object: any): Expr_Call { - 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; + 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)) : [] + }; }, toJSON(message: Expr_Call): JsonSafe<Expr_Call> { const obj: any = {}; @@ -1030,9 +1070,7 @@ export const Expr_Call = { }, fromPartial(object: DeepPartial<Expr_Call>): Expr_Call { const message = createBaseExpr_Call(); - if (object.target !== undefined && object.target !== null) { - message.target = Expr.fromPartial(object.target); - } + message.target = object.target !== undefined && object.target !== null ? Expr.fromPartial(object.target) : undefined; message.function = object.function ?? ""; message.args = object.args?.map(e => Expr.fromPartial(e)) || []; return message; @@ -1131,9 +1169,9 @@ export const Expr_CreateList = { return message; }, fromJSON(object: any): Expr_CreateList { - const obj = createBaseExpr_CreateList(); - if (Array.isArray(object?.elements)) obj.elements = object.elements.map((e: any) => Expr.fromJSON(e)); - return obj; + return { + elements: Array.isArray(object?.elements) ? object.elements.map((e: any) => Expr.fromJSON(e)) : [] + }; }, toJSON(message: Expr_CreateList): JsonSafe<Expr_CreateList> { const obj: any = {}; @@ -1207,7 +1245,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 !== undefined) { + if (message.type !== "") { writer.uint32(10).string(message.type); } for (const v of message.entries) { @@ -1236,10 +1274,10 @@ export const Expr_CreateStruct = { return message; }, fromJSON(object: any): Expr_CreateStruct { - 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; + return { + type: isSet(object.type) ? String(object.type) : "", + entries: Array.isArray(object?.entries) ? object.entries.map((e: any) => Expr_CreateStruct_Entry.fromJSON(e)) : [] + }; }, toJSON(message: Expr_CreateStruct): JsonSafe<Expr_CreateStruct> { const obj: any = {}; @@ -1324,7 +1362,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 !== undefined) { + if (message.id !== 0) { writer.uint32(8).int32(message.id); } if (message.fieldKey !== undefined) { @@ -1365,12 +1403,12 @@ export const Expr_CreateStruct_Entry = { return message; }, fromJSON(object: any): Expr_CreateStruct_Entry { - 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; + 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 + }; }, toJSON(message: Expr_CreateStruct_Entry): JsonSafe<Expr_CreateStruct_Entry> { const obj: any = {}; @@ -1384,12 +1422,8 @@ export const Expr_CreateStruct_Entry = { const message = createBaseExpr_CreateStruct_Entry(); message.id = object.id ?? 0; message.fieldKey = object.fieldKey ?? 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); - } + 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; return message; }, fromSDK(object: Expr_CreateStruct_EntrySDKType): Expr_CreateStruct_Entry { @@ -1470,13 +1504,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 !== undefined) { + if (message.iterVar !== "") { writer.uint32(10).string(message.iterVar); } if (message.iterRange !== undefined) { Expr.encode(message.iterRange, writer.uint32(18).fork()).ldelim(); } - if (message.accuVar !== undefined) { + if (message.accuVar !== "") { writer.uint32(26).string(message.accuVar); } if (message.accuInit !== undefined) { @@ -1529,15 +1563,15 @@ export const Expr_Comprehension = { return message; }, fromJSON(object: any): Expr_Comprehension { - 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; + 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 + }; }, toJSON(message: Expr_Comprehension): JsonSafe<Expr_Comprehension> { const obj: any = {}; @@ -1553,22 +1587,12 @@ export const Expr_Comprehension = { fromPartial(object: DeepPartial<Expr_Comprehension>): Expr_Comprehension { const message = createBaseExpr_Comprehension(); message.iterVar = object.iterVar ?? ""; - if (object.iterRange !== undefined && object.iterRange !== null) { - message.iterRange = Expr.fromPartial(object.iterRange); - } + message.iterRange = object.iterRange !== undefined && object.iterRange !== null ? Expr.fromPartial(object.iterRange) : undefined; message.accuVar = object.accuVar ?? ""; - 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); - } + 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; return message; }, fromSDK(object: Expr_ComprehensionSDKType): Expr_Comprehension { @@ -1729,15 +1753,15 @@ export const Literal = { return message; }, fromJSON(object: any): Literal { - 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; + 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 + }; }, toJSON(message: Literal): JsonSafe<Literal> { const obj: any = {}; @@ -1758,12 +1782,8 @@ export const Literal = { const message = createBaseLiteral(); message.nullValue = object.nullValue ?? undefined; message.boolValue = object.boolValue ?? 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.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; 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 ec052b5a2f..fc892178d1 100644 --- a/__fixtures__/v-next/outputv4/google/api/expr/v1beta1/source.ts +++ b/__fixtures__/v-next/outputv4/google/api/expr/v1beta1/source.ts @@ -1,11 +1,16 @@ -import { BinaryReader, BinaryWriter } from "../../../../binary.js"; -import { isSet, DeepPartial, isObject } from "../../../../helpers.js"; -import { JsonSafe } from "../../../../json-safe.js"; +import { BinaryReader, BinaryWriter } from "../../../../binary"; +import { isSet, DeepPartial, isObject } from "../../../../helpers"; +import { JsonSafe } from "../../../../json-safe"; +import { ComputedRef } from "vue"; export const protobufPackage = "google.api.expr.v1beta1"; export interface SourceInfo_PositionsEntry { key: number; value: number; } +export interface ReactiveSourceInfo_PositionsEntry { + key: ComputedRef<number>; + value: ComputedRef<number>; +} export interface SourceInfo_PositionsEntryProtoMsg { typeUrl: string; value: Uint8Array; @@ -40,6 +45,13 @@ export interface SourceInfo { [key: number]: number; }; } +export interface ReactiveSourceInfo { + location: ComputedRef<string>; + lineOffsets: ComputedRef<number[]>; + positions: ComputedRef<{ + [key: number]: number; + }>; +} export interface SourceInfoProtoMsg { typeUrl: "/google.api.expr.v1beta1.SourceInfo"; value: Uint8Array; @@ -69,6 +81,12 @@ export interface SourcePosition { */ column: number; } +export interface ReactiveSourcePosition { + location: ComputedRef<string>; + offset: ComputedRef<number>; + line: ComputedRef<number>; + column: ComputedRef<number>; +} export interface SourcePositionProtoMsg { typeUrl: "/google.api.expr.v1beta1.SourcePosition"; value: Uint8Array; @@ -88,10 +106,10 @@ function createBaseSourceInfo_PositionsEntry(): SourceInfo_PositionsEntry { } export const SourceInfo_PositionsEntry = { encode(message: SourceInfo_PositionsEntry, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.key !== undefined) { + if (message.key !== 0) { writer.uint32(8).int32(message.key); } - if (message.value !== undefined) { + if (message.value !== 0) { writer.uint32(16).int32(message.value); } return writer; @@ -117,10 +135,10 @@ export const SourceInfo_PositionsEntry = { return message; }, fromJSON(object: any): SourceInfo_PositionsEntry { - const obj = createBaseSourceInfo_PositionsEntry(); - if (isSet(object.key)) obj.key = Number(object.key); - if (isSet(object.value)) obj.value = Number(object.value); - return obj; + return { + key: isSet(object.key) ? Number(object.key) : 0, + value: isSet(object.value) ? Number(object.value) : 0 + }; }, toJSON(message: SourceInfo_PositionsEntry): JsonSafe<SourceInfo_PositionsEntry> { const obj: any = {}; @@ -188,7 +206,7 @@ function createBaseSourceInfo(): SourceInfo { export const SourceInfo = { typeUrl: "/google.api.expr.v1beta1.SourceInfo", encode(message: SourceInfo, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.location !== undefined) { + if (message.location !== "") { writer.uint32(18).string(message.location); } writer.uint32(26).fork(); @@ -238,16 +256,16 @@ export const SourceInfo = { return message; }, fromJSON(object: any): SourceInfo { - 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; + 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; + }, {}) : {} + }; }, toJSON(message: SourceInfo): JsonSafe<SourceInfo> { const obj: any = {}; @@ -378,16 +396,16 @@ function createBaseSourcePosition(): SourcePosition { export const SourcePosition = { typeUrl: "/google.api.expr.v1beta1.SourcePosition", encode(message: SourcePosition, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.location !== undefined) { + if (message.location !== "") { writer.uint32(10).string(message.location); } - if (message.offset !== undefined) { + if (message.offset !== 0) { writer.uint32(16).int32(message.offset); } - if (message.line !== undefined) { + if (message.line !== 0) { writer.uint32(24).int32(message.line); } - if (message.column !== undefined) { + if (message.column !== 0) { writer.uint32(32).int32(message.column); } return writer; @@ -419,12 +437,12 @@ export const SourcePosition = { return message; }, fromJSON(object: any): SourcePosition { - 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; + 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 + }; }, toJSON(message: SourcePosition): JsonSafe<SourcePosition> { 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 4eaa31c41e..c325378152 100644 --- a/__fixtures__/v-next/outputv4/google/api/expr/v1beta1/value.ts +++ b/__fixtures__/v-next/outputv4/google/api/expr/v1beta1/value.ts @@ -1,8 +1,9 @@ -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"; +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"; export const protobufPackage = "google.api.expr.v1beta1"; /** * Represents a CEL value. @@ -36,6 +37,20 @@ export interface Value { /** A Type value represented by the fully qualified name of the type. */ typeValue?: string; } +export interface ReactiveValue { + nullValue?: ComputedRef<NullValue>; + boolValue?: ComputedRef<boolean>; + int64Value?: ComputedRef<bigint>; + uint64Value?: ComputedRef<bigint>; + doubleValue?: ComputedRef<number>; + stringValue?: ComputedRef<string>; + bytesValue?: ComputedRef<Uint8Array>; + enumValue?: ComputedRef<EnumValue>; + objectValue?: ComputedRef<Any>; + mapValue?: ComputedRef<MapValue>; + listValue?: ComputedRef<ListValue>; + typeValue?: ComputedRef<string>; +} export interface ValueProtoMsg { typeUrl: "/google.api.expr.v1beta1.Value"; value: Uint8Array; @@ -67,6 +82,10 @@ export interface EnumValue { /** The value of the enum. */ value: number; } +export interface ReactiveEnumValue { + type: ComputedRef<string>; + value: ComputedRef<number>; +} export interface EnumValueProtoMsg { typeUrl: "/google.api.expr.v1beta1.EnumValue"; value: Uint8Array; @@ -86,6 +105,9 @@ export interface ListValue { /** The ordered values in the list. */ values: Value[]; } +export interface ReactiveListValue { + values: ComputedRef<Value[]>; +} export interface ListValueProtoMsg { typeUrl: "/google.api.expr.v1beta1.ListValue"; value: Uint8Array; @@ -114,6 +136,9 @@ export interface MapValue { */ entries: MapValue_Entry[]; } +export interface ReactiveMapValue { + entries: ComputedRef<MapValue_Entry[]>; +} export interface MapValueProtoMsg { typeUrl: "/google.api.expr.v1beta1.MapValue"; value: Uint8Array; @@ -139,6 +164,10 @@ export interface MapValue_Entry { /** The value. */ value?: Value; } +export interface ReactiveMapValue_Entry { + key?: ComputedRef<Value>; + value?: ComputedRef<Value>; +} export interface MapValue_EntryProtoMsg { typeUrl: "/google.api.expr.v1beta1.Entry"; value: Uint8Array; @@ -256,20 +285,20 @@ export const Value = { return message; }, fromJSON(object: any): Value { - 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; + 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 + }; }, toJSON(message: Value): JsonSafe<Value> { const obj: any = {}; @@ -295,27 +324,15 @@ export const Value = { const message = createBaseValue(); message.nullValue = object.nullValue ?? undefined; message.boolValue = object.boolValue ?? 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.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; message.doubleValue = object.doubleValue ?? undefined; message.stringValue = object.stringValue ?? undefined; message.bytesValue = object.bytesValue ?? 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.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; message.typeValue = object.typeValue ?? undefined; return message; }, @@ -448,10 +465,10 @@ function createBaseEnumValue(): EnumValue { export const EnumValue = { typeUrl: "/google.api.expr.v1beta1.EnumValue", encode(message: EnumValue, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.type !== undefined) { + if (message.type !== "") { writer.uint32(10).string(message.type); } - if (message.value !== undefined) { + if (message.value !== 0) { writer.uint32(16).int32(message.value); } return writer; @@ -477,10 +494,10 @@ export const EnumValue = { return message; }, fromJSON(object: any): EnumValue { - const obj = createBaseEnumValue(); - if (isSet(object.type)) obj.type = String(object.type); - if (isSet(object.value)) obj.value = Number(object.value); - return obj; + return { + type: isSet(object.type) ? String(object.type) : "", + value: isSet(object.value) ? Number(object.value) : 0 + }; }, toJSON(message: EnumValue): JsonSafe<EnumValue> { const obj: any = {}; @@ -575,9 +592,9 @@ export const ListValue = { return message; }, fromJSON(object: any): ListValue { - const obj = createBaseListValue(); - if (Array.isArray(object?.values)) obj.values = object.values.map((e: any) => Value.fromJSON(e)); - return obj; + return { + values: Array.isArray(object?.values) ? object.values.map((e: any) => Value.fromJSON(e)) : [] + }; }, toJSON(message: ListValue): JsonSafe<ListValue> { const obj: any = {}; @@ -673,9 +690,9 @@ export const MapValue = { return message; }, fromJSON(object: any): MapValue { - const obj = createBaseMapValue(); - if (Array.isArray(object?.entries)) obj.entries = object.entries.map((e: any) => MapValue_Entry.fromJSON(e)); - return obj; + return { + entries: Array.isArray(object?.entries) ? object.entries.map((e: any) => MapValue_Entry.fromJSON(e)) : [] + }; }, toJSON(message: MapValue): JsonSafe<MapValue> { const obj: any = {}; @@ -778,10 +795,10 @@ export const MapValue_Entry = { return message; }, fromJSON(object: any): MapValue_Entry { - 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; + return { + key: isSet(object.key) ? Value.fromJSON(object.key) : undefined, + value: isSet(object.value) ? Value.fromJSON(object.value) : undefined + }; }, toJSON(message: MapValue_Entry): JsonSafe<MapValue_Entry> { const obj: any = {}; @@ -791,12 +808,8 @@ export const MapValue_Entry = { }, fromPartial(object: DeepPartial<MapValue_Entry>): MapValue_Entry { const message = createBaseMapValue_Entry(); - 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); - } + 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; 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 15b1a8e1b6..0dce0875aa 100644 --- a/__fixtures__/v-next/outputv4/google/api/field_behavior.ts +++ b/__fixtures__/v-next/outputv4/google/api/field_behavior.ts @@ -1,3 +1,4 @@ +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 f964e4d912..ff7434f372 100644 --- a/__fixtures__/v-next/outputv4/google/api/http.ts +++ b/__fixtures__/v-next/outputv4/google/api/http.ts @@ -1,6 +1,7 @@ -import { BinaryReader, BinaryWriter } from "../../binary.js"; -import { isSet, DeepPartial } from "../../helpers.js"; -import { JsonSafe } from "../../json-safe.js"; +import { BinaryReader, BinaryWriter } from "../../binary"; +import { isSet, DeepPartial } from "../../helpers"; +import { JsonSafe } from "../../json-safe"; +import { ComputedRef } from "vue"; export const protobufPackage = "google.api"; /** * Defines the HTTP configuration for an API service. It contains a list of @@ -24,6 +25,10 @@ export interface Http { */ fullyDecodeReservedExpansion: boolean; } +export interface ReactiveHttp { + rules: ComputedRef<HttpRule[]>; + fullyDecodeReservedExpansion: ComputedRef<boolean>; +} export interface HttpProtoMsg { typeUrl: "/google.api.Http"; value: Uint8Array; @@ -360,6 +365,18 @@ export interface HttpRule { */ additionalBindings: HttpRule[]; } +export interface ReactiveHttpRule { + selector: ComputedRef<string>; + get?: ComputedRef<string>; + put?: ComputedRef<string>; + post?: ComputedRef<string>; + delete?: ComputedRef<string>; + patch?: ComputedRef<string>; + custom?: ComputedRef<CustomHttpPattern>; + body: ComputedRef<string>; + responseBody: ComputedRef<string>; + additionalBindings: ComputedRef<HttpRule[]>; +} export interface HttpRuleProtoMsg { typeUrl: "/google.api.HttpRule"; value: Uint8Array; @@ -654,6 +671,10 @@ export interface CustomHttpPattern { /** The path matched by this custom verb. */ path: string; } +export interface ReactiveCustomHttpPattern { + kind: ComputedRef<string>; + path: ComputedRef<string>; +} export interface CustomHttpPatternProtoMsg { typeUrl: "/google.api.CustomHttpPattern"; value: Uint8Array; @@ -675,7 +696,7 @@ export const Http = { for (const v of message.rules) { HttpRule.encode(v!, writer.uint32(10).fork()).ldelim(); } - if (message.fullyDecodeReservedExpansion !== undefined) { + if (message.fullyDecodeReservedExpansion === true) { writer.uint32(16).bool(message.fullyDecodeReservedExpansion); } return writer; @@ -701,10 +722,10 @@ export const Http = { return message; }, fromJSON(object: any): Http { - 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; + return { + rules: Array.isArray(object?.rules) ? object.rules.map((e: any) => HttpRule.fromJSON(e)) : [], + fullyDecodeReservedExpansion: isSet(object.fullyDecodeReservedExpansion) ? Boolean(object.fullyDecodeReservedExpansion) : false + }; }, toJSON(message: Http): JsonSafe<Http> { const obj: any = {}; @@ -795,7 +816,7 @@ function createBaseHttpRule(): HttpRule { export const HttpRule = { typeUrl: "/google.api.HttpRule", encode(message: HttpRule, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.selector !== undefined) { + if (message.selector !== "") { writer.uint32(10).string(message.selector); } if (message.get !== undefined) { @@ -816,10 +837,10 @@ export const HttpRule = { if (message.custom !== undefined) { CustomHttpPattern.encode(message.custom, writer.uint32(66).fork()).ldelim(); } - if (message.body !== undefined) { + if (message.body !== "") { writer.uint32(58).string(message.body); } - if (message.responseBody !== undefined) { + if (message.responseBody !== "") { writer.uint32(98).string(message.responseBody); } for (const v of message.additionalBindings) { @@ -872,18 +893,18 @@ export const HttpRule = { return message; }, fromJSON(object: any): HttpRule { - 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; + return { + selector: isSet(object.selector) ? String(object.selector) : "", + get: isSet(object.get) ? String(object.get) : undefined, + put: isSet(object.put) ? String(object.put) : undefined, + post: isSet(object.post) ? String(object.post) : undefined, + delete: isSet(object.delete) ? String(object.delete) : undefined, + patch: isSet(object.patch) ? String(object.patch) : undefined, + custom: isSet(object.custom) ? CustomHttpPattern.fromJSON(object.custom) : undefined, + body: isSet(object.body) ? String(object.body) : "", + responseBody: isSet(object.responseBody) ? String(object.responseBody) : "", + additionalBindings: Array.isArray(object?.additionalBindings) ? object.additionalBindings.map((e: any) => HttpRule.fromJSON(e)) : [] + }; }, toJSON(message: HttpRule): JsonSafe<HttpRule> { const obj: any = {}; @@ -911,9 +932,7 @@ export const HttpRule = { message.post = object.post ?? undefined; message.delete = object.delete ?? undefined; message.patch = object.patch ?? undefined; - if (object.custom !== undefined && object.custom !== null) { - message.custom = CustomHttpPattern.fromPartial(object.custom); - } + message.custom = object.custom !== undefined && object.custom !== null ? CustomHttpPattern.fromPartial(object.custom) : undefined; message.body = object.body ?? ""; message.responseBody = object.responseBody ?? ""; message.additionalBindings = object.additionalBindings?.map(e => HttpRule.fromPartial(e)) || []; @@ -1040,10 +1059,10 @@ function createBaseCustomHttpPattern(): CustomHttpPattern { export const CustomHttpPattern = { typeUrl: "/google.api.CustomHttpPattern", encode(message: CustomHttpPattern, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.kind !== undefined) { + if (message.kind !== "") { writer.uint32(10).string(message.kind); } - if (message.path !== undefined) { + if (message.path !== "") { writer.uint32(18).string(message.path); } return writer; @@ -1069,10 +1088,10 @@ export const CustomHttpPattern = { return message; }, fromJSON(object: any): CustomHttpPattern { - const obj = createBaseCustomHttpPattern(); - if (isSet(object.kind)) obj.kind = String(object.kind); - if (isSet(object.path)) obj.path = String(object.path); - return obj; + return { + kind: isSet(object.kind) ? String(object.kind) : "", + path: isSet(object.path) ? String(object.path) : "" + }; }, toJSON(message: CustomHttpPattern): JsonSafe<CustomHttpPattern> { const obj: any = {}; diff --git a/__fixtures__/v-next/outputv4/google/api/httpbody.ts b/__fixtures__/v-next/outputv4/google/api/httpbody.ts index d0e10f302b..a0ef7ee833 100644 --- a/__fixtures__/v-next/outputv4/google/api/httpbody.ts +++ b/__fixtures__/v-next/outputv4/google/api/httpbody.ts @@ -1,7 +1,8 @@ -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"; +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"; export const protobufPackage = "google.api"; /** * Message that represents an arbitrary HTTP body. It should only be used for @@ -59,6 +60,11 @@ export interface HttpBody { */ extensions: Any[]; } +export interface ReactiveHttpBody { + contentType: ComputedRef<string>; + data: ComputedRef<Uint8Array>; + extensions: ComputedRef<Any[]>; +} export interface HttpBodyProtoMsg { typeUrl: "/google.api.HttpBody"; value: Uint8Array; @@ -123,7 +129,7 @@ function createBaseHttpBody(): HttpBody { export const HttpBody = { typeUrl: "/google.api.HttpBody", encode(message: HttpBody, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.contentType !== undefined) { + if (message.contentType !== "") { writer.uint32(10).string(message.contentType); } if (message.data.length !== 0) { @@ -158,11 +164,11 @@ export const HttpBody = { return message; }, fromJSON(object: any): HttpBody { - 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; + 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)) : [] + }; }, toJSON(message: HttpBody): JsonSafe<HttpBody> { const obj: any = {}; diff --git a/__fixtures__/v-next/outputv4/google/api/label.ts b/__fixtures__/v-next/outputv4/google/api/label.ts index 806911edc5..6f3c8de540 100644 --- a/__fixtures__/v-next/outputv4/google/api/label.ts +++ b/__fixtures__/v-next/outputv4/google/api/label.ts @@ -1,6 +1,7 @@ -import { BinaryReader, BinaryWriter } from "../../binary.js"; -import { isSet, DeepPartial } from "../../helpers.js"; -import { JsonSafe } from "../../json-safe.js"; +import { BinaryReader, BinaryWriter } from "../../binary"; +import { isSet, DeepPartial } from "../../helpers"; +import { JsonSafe } from "../../json-safe"; +import { ComputedRef } from "vue"; export const protobufPackage = "google.api"; /** Value types that can be used as label values. */ export enum LabelDescriptor_ValueType { @@ -52,6 +53,11 @@ export interface LabelDescriptor { /** A human-readable description for the label. */ description: string; } +export interface ReactiveLabelDescriptor { + key: ComputedRef<string>; + valueType: ComputedRef<LabelDescriptor_ValueType>; + description: ComputedRef<string>; +} export interface LabelDescriptorProtoMsg { typeUrl: "/google.api.LabelDescriptor"; value: Uint8Array; @@ -72,13 +78,13 @@ function createBaseLabelDescriptor(): LabelDescriptor { export const LabelDescriptor = { typeUrl: "/google.api.LabelDescriptor", encode(message: LabelDescriptor, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.key !== undefined) { + if (message.key !== "") { writer.uint32(10).string(message.key); } if (message.valueType !== 0) { writer.uint32(16).int32(message.valueType); } - if (message.description !== undefined) { + if (message.description !== "") { writer.uint32(26).string(message.description); } return writer; @@ -107,11 +113,11 @@ export const LabelDescriptor = { return message; }, fromJSON(object: any): LabelDescriptor { - 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; + return { + key: isSet(object.key) ? String(object.key) : "", + valueType: isSet(object.valueType) ? labelDescriptor_ValueTypeFromJSON(object.valueType) : -1, + description: isSet(object.description) ? String(object.description) : "" + }; }, toJSON(message: LabelDescriptor): JsonSafe<LabelDescriptor> { 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 6abb3525f3..94b721aaf0 100644 --- a/__fixtures__/v-next/outputv4/google/api/launch_stage.ts +++ b/__fixtures__/v-next/outputv4/google/api/launch_stage.ts @@ -1,3 +1,4 @@ +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 f96c626293..7dc0ed0e0d 100644 --- a/__fixtures__/v-next/outputv4/google/api/log.ts +++ b/__fixtures__/v-next/outputv4/google/api/log.ts @@ -1,7 +1,8 @@ -import { LabelDescriptor, LabelDescriptorSDKType } from "./label.js"; -import { BinaryReader, BinaryWriter } from "../../binary.js"; -import { isSet, DeepPartial } from "../../helpers.js"; -import { JsonSafe } from "../../json-safe.js"; +import { LabelDescriptor, LabelDescriptorSDKType } from "./label"; +import { BinaryReader, BinaryWriter } from "../../binary"; +import { isSet, DeepPartial } from "../../helpers"; +import { JsonSafe } from "../../json-safe"; +import { ComputedRef } from "vue"; export const protobufPackage = "google.api"; /** * A description of a log type. Example in YAML format: @@ -38,6 +39,12 @@ export interface LogDescriptor { */ displayName: string; } +export interface ReactiveLogDescriptor { + name: ComputedRef<string>; + labels: ComputedRef<LabelDescriptor[]>; + description: ComputedRef<string>; + displayName: ComputedRef<string>; +} export interface LogDescriptorProtoMsg { typeUrl: "/google.api.LogDescriptor"; value: Uint8Array; @@ -69,16 +76,16 @@ function createBaseLogDescriptor(): LogDescriptor { export const LogDescriptor = { typeUrl: "/google.api.LogDescriptor", encode(message: LogDescriptor, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.name !== undefined) { + if (message.name !== "") { writer.uint32(10).string(message.name); } for (const v of message.labels) { LabelDescriptor.encode(v!, writer.uint32(18).fork()).ldelim(); } - if (message.description !== undefined) { + if (message.description !== "") { writer.uint32(26).string(message.description); } - if (message.displayName !== undefined) { + if (message.displayName !== "") { writer.uint32(34).string(message.displayName); } return writer; @@ -110,12 +117,12 @@ export const LogDescriptor = { return message; }, fromJSON(object: any): LogDescriptor { - 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; + 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) : "" + }; }, toJSON(message: LogDescriptor): JsonSafe<LogDescriptor> { const obj: any = {}; diff --git a/__fixtures__/v-next/outputv4/google/api/logging.ts b/__fixtures__/v-next/outputv4/google/api/logging.ts index 52e42d32a6..d96ca86305 100644 --- a/__fixtures__/v-next/outputv4/google/api/logging.ts +++ b/__fixtures__/v-next/outputv4/google/api/logging.ts @@ -1,6 +1,7 @@ -import { BinaryReader, BinaryWriter } from "../../binary.js"; -import { JsonSafe } from "../../json-safe.js"; -import { DeepPartial, isSet } from "../../helpers.js"; +import { BinaryReader, BinaryWriter } from "../../binary"; +import { JsonSafe } from "../../json-safe"; +import { DeepPartial, isSet } from "../../helpers"; +import { ComputedRef } from "vue"; export const protobufPackage = "google.api"; /** * Logging configuration of the service. @@ -49,6 +50,10 @@ export interface Logging { */ consumerDestinations: Logging_LoggingDestination[]; } +export interface ReactiveLogging { + producerDestinations: ComputedRef<Logging_LoggingDestination[]>; + consumerDestinations: ComputedRef<Logging_LoggingDestination[]>; +} export interface LoggingProtoMsg { typeUrl: "/google.api.Logging"; value: Uint8Array; @@ -106,6 +111,10 @@ export interface Logging_LoggingDestination { */ logs: string[]; } +export interface ReactiveLogging_LoggingDestination { + monitoredResource: ComputedRef<string>; + logs: ComputedRef<string[]>; +} export interface Logging_LoggingDestinationProtoMsg { typeUrl: "/google.api.LoggingDestination"; value: Uint8Array; @@ -156,10 +165,10 @@ export const Logging = { return message; }, fromJSON(object: any): Logging { - 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; + 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)) : [] + }; }, toJSON(message: Logging): JsonSafe<Logging> { const obj: any = {}; @@ -252,7 +261,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 !== undefined) { + if (message.monitoredResource !== "") { writer.uint32(26).string(message.monitoredResource); } for (const v of message.logs) { @@ -281,10 +290,10 @@ export const Logging_LoggingDestination = { return message; }, fromJSON(object: any): Logging_LoggingDestination { - 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; + return { + monitoredResource: isSet(object.monitoredResource) ? String(object.monitoredResource) : "", + logs: Array.isArray(object?.logs) ? object.logs.map((e: any) => String(e)) : [] + }; }, toJSON(message: Logging_LoggingDestination): JsonSafe<Logging_LoggingDestination> { const obj: any = {}; diff --git a/__fixtures__/v-next/outputv4/google/api/metric.ts b/__fixtures__/v-next/outputv4/google/api/metric.ts index b146a9bd45..fdced099cf 100644 --- a/__fixtures__/v-next/outputv4/google/api/metric.ts +++ b/__fixtures__/v-next/outputv4/google/api/metric.ts @@ -1,9 +1,10 @@ -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"; +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"; export const protobufPackage = "google.api"; /** * The kind of measurement. It describes how the data is reported. @@ -303,6 +304,19 @@ export interface MetricDescriptor { */ monitoredResourceTypes: string[]; } +export interface ReactiveMetricDescriptor { + name: ComputedRef<string>; + type: ComputedRef<string>; + labels: ComputedRef<LabelDescriptor[]>; + metricKind: ComputedRef<MetricDescriptor_MetricKind>; + valueType: ComputedRef<MetricDescriptor_ValueType>; + unit: ComputedRef<string>; + description: ComputedRef<string>; + displayName: ComputedRef<string>; + metadata?: ComputedRef<MetricDescriptor_MetricDescriptorMetadata>; + launchStage: ComputedRef<LaunchStage>; + monitoredResourceTypes: ComputedRef<string[]>; +} export interface MetricDescriptorProtoMsg { typeUrl: "/google.api.MetricDescriptor"; value: Uint8Array; @@ -344,6 +358,11 @@ export interface MetricDescriptor_MetricDescriptorMetadata { */ ingestDelay?: Duration; } +export interface ReactiveMetricDescriptor_MetricDescriptorMetadata { + launchStage: ComputedRef<LaunchStage>; + samplePeriod?: ComputedRef<Duration>; + ingestDelay?: ComputedRef<Duration>; +} export interface MetricDescriptor_MetricDescriptorMetadataProtoMsg { typeUrl: "/google.api.MetricDescriptorMetadata"; value: Uint8Array; @@ -359,6 +378,10 @@ export interface Metric_LabelsEntry { key: string; value: string; } +export interface ReactiveMetric_LabelsEntry { + key: ComputedRef<string>; + value: ComputedRef<string>; +} export interface Metric_LabelsEntryProtoMsg { typeUrl: string; value: Uint8Array; @@ -385,6 +408,12 @@ export interface Metric { [key: string]: string; }; } +export interface ReactiveMetric { + type: ComputedRef<string>; + labels: ComputedRef<{ + [key: string]: string; + }>; +} export interface MetricProtoMsg { typeUrl: "/google.api.Metric"; value: Uint8Array; @@ -417,10 +446,10 @@ function createBaseMetricDescriptor(): MetricDescriptor { export const MetricDescriptor = { typeUrl: "/google.api.MetricDescriptor", encode(message: MetricDescriptor, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.name !== undefined) { + if (message.name !== "") { writer.uint32(10).string(message.name); } - if (message.type !== undefined) { + if (message.type !== "") { writer.uint32(66).string(message.type); } for (const v of message.labels) { @@ -432,13 +461,13 @@ export const MetricDescriptor = { if (message.valueType !== 0) { writer.uint32(32).int32(message.valueType); } - if (message.unit !== undefined) { + if (message.unit !== "") { writer.uint32(42).string(message.unit); } - if (message.description !== undefined) { + if (message.description !== "") { writer.uint32(50).string(message.description); } - if (message.displayName !== undefined) { + if (message.displayName !== "") { writer.uint32(58).string(message.displayName); } if (message.metadata !== undefined) { @@ -500,19 +529,19 @@ export const MetricDescriptor = { return message; }, fromJSON(object: any): MetricDescriptor { - 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; + 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)) : [] + }; }, toJSON(message: MetricDescriptor): JsonSafe<MetricDescriptor> { const obj: any = {}; @@ -547,9 +576,7 @@ export const MetricDescriptor = { message.unit = object.unit ?? ""; message.description = object.description ?? ""; message.displayName = object.displayName ?? ""; - if (object.metadata !== undefined && object.metadata !== null) { - message.metadata = MetricDescriptor_MetricDescriptorMetadata.fromPartial(object.metadata); - } + message.metadata = object.metadata !== undefined && object.metadata !== null ? MetricDescriptor_MetricDescriptorMetadata.fromPartial(object.metadata) : undefined; message.launchStage = object.launchStage ?? 0; message.monitoredResourceTypes = object.monitoredResourceTypes?.map(e => e) || []; return message; @@ -724,11 +751,11 @@ export const MetricDescriptor_MetricDescriptorMetadata = { return message; }, fromJSON(object: any): MetricDescriptor_MetricDescriptorMetadata { - 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; + 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 + }; }, toJSON(message: MetricDescriptor_MetricDescriptorMetadata): JsonSafe<MetricDescriptor_MetricDescriptorMetadata> { const obj: any = {}; @@ -740,12 +767,8 @@ export const MetricDescriptor_MetricDescriptorMetadata = { fromPartial(object: DeepPartial<MetricDescriptor_MetricDescriptorMetadata>): MetricDescriptor_MetricDescriptorMetadata { const message = createBaseMetricDescriptor_MetricDescriptorMetadata(); message.launchStage = object.launchStage ?? 0; - 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); - } + 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; return message; }, fromSDK(object: MetricDescriptor_MetricDescriptorMetadataSDKType): MetricDescriptor_MetricDescriptorMetadata { @@ -813,10 +836,10 @@ function createBaseMetric_LabelsEntry(): Metric_LabelsEntry { } export const Metric_LabelsEntry = { encode(message: Metric_LabelsEntry, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.key !== undefined) { + if (message.key !== "") { writer.uint32(10).string(message.key); } - if (message.value !== undefined) { + if (message.value !== "") { writer.uint32(18).string(message.value); } return writer; @@ -842,10 +865,10 @@ export const Metric_LabelsEntry = { return message; }, fromJSON(object: any): Metric_LabelsEntry { - const obj = createBaseMetric_LabelsEntry(); - if (isSet(object.key)) obj.key = String(object.key); - if (isSet(object.value)) obj.value = String(object.value); - return obj; + return { + key: isSet(object.key) ? String(object.key) : "", + value: isSet(object.value) ? String(object.value) : "" + }; }, toJSON(message: Metric_LabelsEntry): JsonSafe<Metric_LabelsEntry> { const obj: any = {}; @@ -912,7 +935,7 @@ function createBaseMetric(): Metric { export const Metric = { typeUrl: "/google.api.Metric", encode(message: Metric, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.type !== undefined) { + if (message.type !== "") { writer.uint32(26).string(message.type); } Object.entries(message.labels).forEach(([key, value]) => { @@ -947,15 +970,15 @@ export const Metric = { return message; }, fromJSON(object: any): Metric { - 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; + 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; + }, {}) : {} + }; }, toJSON(message: Metric): JsonSafe<Metric> { 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 145d16fdc8..710eba58ad 100644 --- a/__fixtures__/v-next/outputv4/google/api/monitored_resource.ts +++ b/__fixtures__/v-next/outputv4/google/api/monitored_resource.ts @@ -1,9 +1,10 @@ -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"; +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"; export const protobufPackage = "google.api"; /** * An object that describes the schema of a [MonitoredResource][google.api.MonitoredResource] object using a @@ -52,6 +53,14 @@ export interface MonitoredResourceDescriptor { /** Optional. The launch stage of the monitored resource definition. */ launchStage: LaunchStage; } +export interface ReactiveMonitoredResourceDescriptor { + name: ComputedRef<string>; + type: ComputedRef<string>; + displayName: ComputedRef<string>; + description: ComputedRef<string>; + labels: ComputedRef<LabelDescriptor[]>; + launchStage: ComputedRef<LaunchStage>; +} export interface MonitoredResourceDescriptorProtoMsg { typeUrl: "/google.api.MonitoredResourceDescriptor"; value: Uint8Array; @@ -79,6 +88,10 @@ export interface MonitoredResource_LabelsEntry { key: string; value: string; } +export interface ReactiveMonitoredResource_LabelsEntry { + key: ComputedRef<string>; + value: ComputedRef<string>; +} export interface MonitoredResource_LabelsEntryProtoMsg { typeUrl: string; value: Uint8Array; @@ -118,6 +131,12 @@ export interface MonitoredResource { [key: string]: string; }; } +export interface ReactiveMonitoredResource { + type: ComputedRef<string>; + labels: ComputedRef<{ + [key: string]: string; + }>; +} export interface MonitoredResourceProtoMsg { typeUrl: "/google.api.MonitoredResource"; value: Uint8Array; @@ -147,6 +166,10 @@ export interface MonitoredResourceMetadata_UserLabelsEntry { key: string; value: string; } +export interface ReactiveMonitoredResourceMetadata_UserLabelsEntry { + key: ComputedRef<string>; + value: ComputedRef<string>; +} export interface MonitoredResourceMetadata_UserLabelsEntryProtoMsg { typeUrl: string; value: Uint8Array; @@ -182,6 +205,12 @@ export interface MonitoredResourceMetadata { [key: string]: string; }; } +export interface ReactiveMonitoredResourceMetadata { + systemLabels?: ComputedRef<Struct>; + userLabels: ComputedRef<{ + [key: string]: string; + }>; +} export interface MonitoredResourceMetadataProtoMsg { typeUrl: "/google.api.MonitoredResourceMetadata"; value: Uint8Array; @@ -213,16 +242,16 @@ function createBaseMonitoredResourceDescriptor(): MonitoredResourceDescriptor { export const MonitoredResourceDescriptor = { typeUrl: "/google.api.MonitoredResourceDescriptor", encode(message: MonitoredResourceDescriptor, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.name !== undefined) { + if (message.name !== "") { writer.uint32(42).string(message.name); } - if (message.type !== undefined) { + if (message.type !== "") { writer.uint32(10).string(message.type); } - if (message.displayName !== undefined) { + if (message.displayName !== "") { writer.uint32(18).string(message.displayName); } - if (message.description !== undefined) { + if (message.description !== "") { writer.uint32(26).string(message.description); } for (const v of message.labels) { @@ -266,14 +295,14 @@ export const MonitoredResourceDescriptor = { return message; }, fromJSON(object: any): MonitoredResourceDescriptor { - 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; + 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 + }; }, toJSON(message: MonitoredResourceDescriptor): JsonSafe<MonitoredResourceDescriptor> { const obj: any = {}; @@ -391,10 +420,10 @@ function createBaseMonitoredResource_LabelsEntry(): MonitoredResource_LabelsEntr } export const MonitoredResource_LabelsEntry = { encode(message: MonitoredResource_LabelsEntry, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.key !== undefined) { + if (message.key !== "") { writer.uint32(10).string(message.key); } - if (message.value !== undefined) { + if (message.value !== "") { writer.uint32(18).string(message.value); } return writer; @@ -420,10 +449,10 @@ export const MonitoredResource_LabelsEntry = { return message; }, fromJSON(object: any): MonitoredResource_LabelsEntry { - const obj = createBaseMonitoredResource_LabelsEntry(); - if (isSet(object.key)) obj.key = String(object.key); - if (isSet(object.value)) obj.value = String(object.value); - return obj; + return { + key: isSet(object.key) ? String(object.key) : "", + value: isSet(object.value) ? String(object.value) : "" + }; }, toJSON(message: MonitoredResource_LabelsEntry): JsonSafe<MonitoredResource_LabelsEntry> { const obj: any = {}; @@ -490,7 +519,7 @@ function createBaseMonitoredResource(): MonitoredResource { export const MonitoredResource = { typeUrl: "/google.api.MonitoredResource", encode(message: MonitoredResource, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.type !== undefined) { + if (message.type !== "") { writer.uint32(10).string(message.type); } Object.entries(message.labels).forEach(([key, value]) => { @@ -525,15 +554,15 @@ export const MonitoredResource = { return message; }, fromJSON(object: any): MonitoredResource { - 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; + 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; + }, {}) : {} + }; }, toJSON(message: MonitoredResource): JsonSafe<MonitoredResource> { const obj: any = {}; @@ -642,10 +671,10 @@ function createBaseMonitoredResourceMetadata_UserLabelsEntry(): MonitoredResourc } export const MonitoredResourceMetadata_UserLabelsEntry = { encode(message: MonitoredResourceMetadata_UserLabelsEntry, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.key !== undefined) { + if (message.key !== "") { writer.uint32(10).string(message.key); } - if (message.value !== undefined) { + if (message.value !== "") { writer.uint32(18).string(message.value); } return writer; @@ -671,10 +700,10 @@ export const MonitoredResourceMetadata_UserLabelsEntry = { return message; }, fromJSON(object: any): MonitoredResourceMetadata_UserLabelsEntry { - const obj = createBaseMonitoredResourceMetadata_UserLabelsEntry(); - if (isSet(object.key)) obj.key = String(object.key); - if (isSet(object.value)) obj.value = String(object.value); - return obj; + return { + key: isSet(object.key) ? String(object.key) : "", + value: isSet(object.value) ? String(object.value) : "" + }; }, toJSON(message: MonitoredResourceMetadata_UserLabelsEntry): JsonSafe<MonitoredResourceMetadata_UserLabelsEntry> { const obj: any = {}; @@ -776,15 +805,15 @@ export const MonitoredResourceMetadata = { return message; }, fromJSON(object: any): MonitoredResourceMetadata { - 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; + 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; + }, {}) : {} + }; }, toJSON(message: MonitoredResourceMetadata): JsonSafe<MonitoredResourceMetadata> { const obj: any = {}; @@ -799,9 +828,7 @@ export const MonitoredResourceMetadata = { }, fromPartial(object: DeepPartial<MonitoredResourceMetadata>): MonitoredResourceMetadata { const message = createBaseMonitoredResourceMetadata(); - if (object.systemLabels !== undefined && object.systemLabels !== null) { - message.systemLabels = Struct.fromPartial(object.systemLabels); - } + message.systemLabels = object.systemLabels !== undefined && object.systemLabels !== null ? Struct.fromPartial(object.systemLabels) : undefined; 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 8c498f9aab..13e40875b6 100644 --- a/__fixtures__/v-next/outputv4/google/api/monitoring.ts +++ b/__fixtures__/v-next/outputv4/google/api/monitoring.ts @@ -1,6 +1,7 @@ -import { BinaryReader, BinaryWriter } from "../../binary.js"; -import { JsonSafe } from "../../json-safe.js"; -import { DeepPartial, isSet } from "../../helpers.js"; +import { BinaryReader, BinaryWriter } from "../../binary"; +import { JsonSafe } from "../../json-safe"; +import { DeepPartial, isSet } from "../../helpers"; +import { ComputedRef } from "vue"; export const protobufPackage = "google.api"; /** * Monitoring configuration of the service. @@ -76,6 +77,10 @@ export interface Monitoring { */ consumerDestinations: Monitoring_MonitoringDestination[]; } +export interface ReactiveMonitoring { + producerDestinations: ComputedRef<Monitoring_MonitoringDestination[]>; + consumerDestinations: ComputedRef<Monitoring_MonitoringDestination[]>; +} export interface MonitoringProtoMsg { typeUrl: "/google.api.Monitoring"; value: Uint8Array; @@ -154,6 +159,10 @@ export interface Monitoring_MonitoringDestination { */ metrics: string[]; } +export interface ReactiveMonitoring_MonitoringDestination { + monitoredResource: ComputedRef<string>; + metrics: ComputedRef<string[]>; +} export interface Monitoring_MonitoringDestinationProtoMsg { typeUrl: "/google.api.MonitoringDestination"; value: Uint8Array; @@ -204,10 +213,10 @@ export const Monitoring = { return message; }, fromJSON(object: any): Monitoring { - 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; + 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)) : [] + }; }, toJSON(message: Monitoring): JsonSafe<Monitoring> { const obj: any = {}; @@ -300,7 +309,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 !== undefined) { + if (message.monitoredResource !== "") { writer.uint32(10).string(message.monitoredResource); } for (const v of message.metrics) { @@ -329,10 +338,10 @@ export const Monitoring_MonitoringDestination = { return message; }, fromJSON(object: any): Monitoring_MonitoringDestination { - 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; + return { + monitoredResource: isSet(object.monitoredResource) ? String(object.monitoredResource) : "", + metrics: Array.isArray(object?.metrics) ? object.metrics.map((e: any) => String(e)) : [] + }; }, toJSON(message: Monitoring_MonitoringDestination): JsonSafe<Monitoring_MonitoringDestination> { const obj: any = {}; diff --git a/__fixtures__/v-next/outputv4/google/api/quota.ts b/__fixtures__/v-next/outputv4/google/api/quota.ts index fff33aa53e..0e930f65a3 100644 --- a/__fixtures__/v-next/outputv4/google/api/quota.ts +++ b/__fixtures__/v-next/outputv4/google/api/quota.ts @@ -1,6 +1,7 @@ -import { BinaryReader, BinaryWriter } from "../../binary.js"; -import { JsonSafe } from "../../json-safe.js"; -import { DeepPartial, isSet, isObject } from "../../helpers.js"; +import { BinaryReader, BinaryWriter } from "../../binary"; +import { JsonSafe } from "../../json-safe"; +import { DeepPartial, isSet, isObject } from "../../helpers"; +import { ComputedRef } from "vue"; export const protobufPackage = "google.api"; /** * Quota configuration helps to achieve fairness and budgeting in service @@ -62,6 +63,10 @@ export interface Quota { */ metricRules: MetricRule[]; } +export interface ReactiveQuota { + limits: ComputedRef<QuotaLimit[]>; + metricRules: ComputedRef<MetricRule[]>; +} export interface QuotaProtoMsg { typeUrl: "/google.api.Quota"; value: Uint8Array; @@ -125,6 +130,10 @@ export interface MetricRule_MetricCostsEntry { key: string; value: bigint; } +export interface ReactiveMetricRule_MetricCostsEntry { + key: ComputedRef<string>; + value: ComputedRef<bigint>; +} export interface MetricRule_MetricCostsEntryProtoMsg { typeUrl: string; value: Uint8Array; @@ -156,6 +165,12 @@ export interface MetricRule { [key: string]: bigint; }; } +export interface ReactiveMetricRule { + selector: ComputedRef<string>; + metricCosts: ComputedRef<{ + [key: string]: bigint; + }>; +} export interface MetricRuleProtoMsg { typeUrl: "/google.api.MetricRule"; value: Uint8Array; @@ -174,6 +189,10 @@ export interface QuotaLimit_ValuesEntry { key: string; value: bigint; } +export interface ReactiveQuotaLimit_ValuesEntry { + key: ComputedRef<string>; + value: ComputedRef<bigint>; +} export interface QuotaLimit_ValuesEntryProtoMsg { typeUrl: string; value: Uint8Array; @@ -279,6 +298,20 @@ export interface QuotaLimit { */ displayName: string; } +export interface ReactiveQuotaLimit { + name: ComputedRef<string>; + description: ComputedRef<string>; + defaultLimit: ComputedRef<bigint>; + maxLimit: ComputedRef<bigint>; + freeTier: ComputedRef<bigint>; + duration: ComputedRef<string>; + metric: ComputedRef<string>; + unit: ComputedRef<string>; + values: ComputedRef<{ + [key: string]: bigint; + }>; + displayName: ComputedRef<string>; +} export interface QuotaLimitProtoMsg { typeUrl: "/google.api.QuotaLimit"; value: Uint8Array; @@ -340,10 +373,10 @@ export const Quota = { return message; }, fromJSON(object: any): Quota { - 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; + 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)) : [] + }; }, toJSON(message: Quota): JsonSafe<Quota> { const obj: any = {}; @@ -435,10 +468,10 @@ function createBaseMetricRule_MetricCostsEntry(): MetricRule_MetricCostsEntry { } export const MetricRule_MetricCostsEntry = { encode(message: MetricRule_MetricCostsEntry, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.key !== undefined) { + if (message.key !== "") { writer.uint32(10).string(message.key); } - if (message.value !== undefined) { + if (message.value !== BigInt(0)) { writer.uint32(16).int64(message.value); } return writer; @@ -464,10 +497,10 @@ export const MetricRule_MetricCostsEntry = { return message; }, fromJSON(object: any): MetricRule_MetricCostsEntry { - 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; + return { + key: isSet(object.key) ? String(object.key) : "", + value: isSet(object.value) ? BigInt(object.value.toString()) : BigInt(0) + }; }, toJSON(message: MetricRule_MetricCostsEntry): JsonSafe<MetricRule_MetricCostsEntry> { const obj: any = {}; @@ -478,9 +511,7 @@ export const MetricRule_MetricCostsEntry = { fromPartial(object: DeepPartial<MetricRule_MetricCostsEntry>): MetricRule_MetricCostsEntry { const message = createBaseMetricRule_MetricCostsEntry(); message.key = object.key ?? ""; - if (object.value !== undefined && object.value !== null) { - message.value = BigInt(object.value.toString()); - } + message.value = object.value !== undefined && object.value !== null ? BigInt(object.value.toString()) : BigInt(0); return message; }, fromSDK(object: MetricRule_MetricCostsEntrySDKType): MetricRule_MetricCostsEntry { @@ -536,7 +567,7 @@ function createBaseMetricRule(): MetricRule { export const MetricRule = { typeUrl: "/google.api.MetricRule", encode(message: MetricRule, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.selector !== undefined) { + if (message.selector !== "") { writer.uint32(10).string(message.selector); } Object.entries(message.metricCosts).forEach(([key, value]) => { @@ -571,15 +602,15 @@ export const MetricRule = { return message; }, fromJSON(object: any): MetricRule { - 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; + 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; + }, {}) : {} + }; }, toJSON(message: MetricRule): JsonSafe<MetricRule> { const obj: any = {}; @@ -688,10 +719,10 @@ function createBaseQuotaLimit_ValuesEntry(): QuotaLimit_ValuesEntry { } export const QuotaLimit_ValuesEntry = { encode(message: QuotaLimit_ValuesEntry, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.key !== undefined) { + if (message.key !== "") { writer.uint32(10).string(message.key); } - if (message.value !== undefined) { + if (message.value !== BigInt(0)) { writer.uint32(16).int64(message.value); } return writer; @@ -717,10 +748,10 @@ export const QuotaLimit_ValuesEntry = { return message; }, fromJSON(object: any): QuotaLimit_ValuesEntry { - 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; + return { + key: isSet(object.key) ? String(object.key) : "", + value: isSet(object.value) ? BigInt(object.value.toString()) : BigInt(0) + }; }, toJSON(message: QuotaLimit_ValuesEntry): JsonSafe<QuotaLimit_ValuesEntry> { const obj: any = {}; @@ -731,9 +762,7 @@ export const QuotaLimit_ValuesEntry = { fromPartial(object: DeepPartial<QuotaLimit_ValuesEntry>): QuotaLimit_ValuesEntry { const message = createBaseQuotaLimit_ValuesEntry(); message.key = object.key ?? ""; - if (object.value !== undefined && object.value !== null) { - message.value = BigInt(object.value.toString()); - } + message.value = object.value !== undefined && object.value !== null ? BigInt(object.value.toString()) : BigInt(0); return message; }, fromSDK(object: QuotaLimit_ValuesEntrySDKType): QuotaLimit_ValuesEntry { @@ -797,28 +826,28 @@ function createBaseQuotaLimit(): QuotaLimit { export const QuotaLimit = { typeUrl: "/google.api.QuotaLimit", encode(message: QuotaLimit, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.name !== undefined) { + if (message.name !== "") { writer.uint32(50).string(message.name); } - if (message.description !== undefined) { + if (message.description !== "") { writer.uint32(18).string(message.description); } - if (message.defaultLimit !== undefined) { + if (message.defaultLimit !== BigInt(0)) { writer.uint32(24).int64(message.defaultLimit); } - if (message.maxLimit !== undefined) { + if (message.maxLimit !== BigInt(0)) { writer.uint32(32).int64(message.maxLimit); } - if (message.freeTier !== undefined) { + if (message.freeTier !== BigInt(0)) { writer.uint32(56).int64(message.freeTier); } - if (message.duration !== undefined) { + if (message.duration !== "") { writer.uint32(42).string(message.duration); } - if (message.metric !== undefined) { + if (message.metric !== "") { writer.uint32(66).string(message.metric); } - if (message.unit !== undefined) { + if (message.unit !== "") { writer.uint32(74).string(message.unit); } Object.entries(message.values).forEach(([key, value]) => { @@ -827,7 +856,7 @@ export const QuotaLimit = { value }, writer.uint32(80).fork()).ldelim(); }); - if (message.displayName !== undefined) { + if (message.displayName !== "") { writer.uint32(98).string(message.displayName); } return writer; @@ -880,23 +909,23 @@ export const QuotaLimit = { return message; }, fromJSON(object: any): QuotaLimit { - 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; + 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) : "" + }; }, toJSON(message: QuotaLimit): JsonSafe<QuotaLimit> { const obj: any = {}; @@ -921,15 +950,9 @@ export const QuotaLimit = { const message = createBaseQuotaLimit(); message.name = object.name ?? ""; message.description = object.description ?? ""; - 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.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); 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 81b8db510d..b288109691 100644 --- a/__fixtures__/v-next/outputv4/google/api/resource.ts +++ b/__fixtures__/v-next/outputv4/google/api/resource.ts @@ -1,6 +1,7 @@ -import { BinaryReader, BinaryWriter } from "../../binary.js"; -import { isSet, DeepPartial } from "../../helpers.js"; -import { JsonSafe } from "../../json-safe.js"; +import { BinaryReader, BinaryWriter } from "../../binary"; +import { isSet, DeepPartial } from "../../helpers"; +import { JsonSafe } from "../../json-safe"; +import { ComputedRef } from "vue"; export const protobufPackage = "google.api"; /** * A description of the historical or future-looking state of the @@ -228,6 +229,15 @@ export interface ResourceDescriptor { */ style: ResourceDescriptor_Style[]; } +export interface ReactiveResourceDescriptor { + type: ComputedRef<string>; + pattern: ComputedRef<string[]>; + nameField: ComputedRef<string>; + history: ComputedRef<ResourceDescriptor_History>; + plural: ComputedRef<string>; + singular: ComputedRef<string>; + style: ComputedRef<ResourceDescriptor_Style[]>; +} export interface ResourceDescriptorProtoMsg { typeUrl: "/google.api.ResourceDescriptor"; value: Uint8Array; @@ -333,6 +343,10 @@ export interface ResourceReference { */ childType: string; } +export interface ReactiveResourceReference { + type: ComputedRef<string>; + childType: ComputedRef<string>; +} export interface ResourceReferenceProtoMsg { typeUrl: "/google.api.ResourceReference"; value: Uint8Array; @@ -359,22 +373,22 @@ function createBaseResourceDescriptor(): ResourceDescriptor { export const ResourceDescriptor = { typeUrl: "/google.api.ResourceDescriptor", encode(message: ResourceDescriptor, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.type !== undefined) { + if (message.type !== "") { writer.uint32(10).string(message.type); } for (const v of message.pattern) { writer.uint32(18).string(v!); } - if (message.nameField !== undefined) { + if (message.nameField !== "") { writer.uint32(26).string(message.nameField); } if (message.history !== 0) { writer.uint32(32).int32(message.history); } - if (message.plural !== undefined) { + if (message.plural !== "") { writer.uint32(42).string(message.plural); } - if (message.singular !== undefined) { + if (message.singular !== "") { writer.uint32(50).string(message.singular); } writer.uint32(82).fork(); @@ -427,15 +441,15 @@ export const ResourceDescriptor = { return message; }, fromJSON(object: any): ResourceDescriptor { - 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; + 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)) : [] + }; }, toJSON(message: ResourceDescriptor): JsonSafe<ResourceDescriptor> { const obj: any = {}; @@ -573,10 +587,10 @@ function createBaseResourceReference(): ResourceReference { export const ResourceReference = { typeUrl: "/google.api.ResourceReference", encode(message: ResourceReference, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.type !== undefined) { + if (message.type !== "") { writer.uint32(10).string(message.type); } - if (message.childType !== undefined) { + if (message.childType !== "") { writer.uint32(18).string(message.childType); } return writer; @@ -602,10 +616,10 @@ export const ResourceReference = { return message; }, fromJSON(object: any): ResourceReference { - const obj = createBaseResourceReference(); - if (isSet(object.type)) obj.type = String(object.type); - if (isSet(object.childType)) obj.childType = String(object.childType); - return obj; + return { + type: isSet(object.type) ? String(object.type) : "", + childType: isSet(object.childType) ? String(object.childType) : "" + }; }, toJSON(message: ResourceReference): JsonSafe<ResourceReference> { const obj: any = {}; diff --git a/__fixtures__/v-next/outputv4/google/api/routing.ts b/__fixtures__/v-next/outputv4/google/api/routing.ts index d86d2e3190..2ec214fd7d 100644 --- a/__fixtures__/v-next/outputv4/google/api/routing.ts +++ b/__fixtures__/v-next/outputv4/google/api/routing.ts @@ -1,6 +1,7 @@ -import { BinaryReader, BinaryWriter } from "../../binary.js"; -import { JsonSafe } from "../../json-safe.js"; -import { DeepPartial, isSet } from "../../helpers.js"; +import { BinaryReader, BinaryWriter } from "../../binary"; +import { JsonSafe } from "../../json-safe"; +import { DeepPartial, isSet } from "../../helpers"; +import { ComputedRef } from "vue"; export const protobufPackage = "google.api"; /** * Specifies the routing information that should be sent along with the request @@ -374,6 +375,9 @@ export interface RoutingRule { */ routingParameters: RoutingParameter[]; } +export interface ReactiveRoutingRule { + routingParameters: ComputedRef<RoutingParameter[]>; +} export interface RoutingRuleProtoMsg { typeUrl: "/google.api.RoutingRule"; value: Uint8Array; @@ -804,6 +808,10 @@ export interface RoutingParameter { */ pathTemplate: string; } +export interface ReactiveRoutingParameter { + field: ComputedRef<string>; + pathTemplate: ComputedRef<string>; +} export interface RoutingParameterProtoMsg { typeUrl: "/google.api.RoutingParameter"; value: Uint8Array; @@ -844,9 +852,9 @@ export const RoutingRule = { return message; }, fromJSON(object: any): RoutingRule { - const obj = createBaseRoutingRule(); - if (Array.isArray(object?.routingParameters)) obj.routingParameters = object.routingParameters.map((e: any) => RoutingParameter.fromJSON(e)); - return obj; + return { + routingParameters: Array.isArray(object?.routingParameters) ? object.routingParameters.map((e: any) => RoutingParameter.fromJSON(e)) : [] + }; }, toJSON(message: RoutingRule): JsonSafe<RoutingRule> { const obj: any = {}; @@ -920,10 +928,10 @@ function createBaseRoutingParameter(): RoutingParameter { export const RoutingParameter = { typeUrl: "/google.api.RoutingParameter", encode(message: RoutingParameter, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.field !== undefined) { + if (message.field !== "") { writer.uint32(10).string(message.field); } - if (message.pathTemplate !== undefined) { + if (message.pathTemplate !== "") { writer.uint32(18).string(message.pathTemplate); } return writer; @@ -949,10 +957,10 @@ export const RoutingParameter = { return message; }, fromJSON(object: any): RoutingParameter { - const obj = createBaseRoutingParameter(); - if (isSet(object.field)) obj.field = String(object.field); - if (isSet(object.pathTemplate)) obj.pathTemplate = String(object.pathTemplate); - return obj; + return { + field: isSet(object.field) ? String(object.field) : "", + pathTemplate: isSet(object.pathTemplate) ? String(object.pathTemplate) : "" + }; }, toJSON(message: RoutingParameter): JsonSafe<RoutingParameter> { const obj: any = {}; diff --git a/__fixtures__/v-next/outputv4/google/api/service.ts b/__fixtures__/v-next/outputv4/google/api/service.ts index 61c5acb193..5b54012126 100644 --- a/__fixtures__/v-next/outputv4/google/api/service.ts +++ b/__fixtures__/v-next/outputv4/google/api/service.ts @@ -1,26 +1,27 @@ -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"; +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"; export const protobufPackage = "google.api"; /** * `Service` is the root object of Google service configuration schema. It @@ -144,6 +145,33 @@ export interface Service { /** @deprecated */ configVersion?: UInt32Value; } +export interface ReactiveService { + name: ComputedRef<string>; + title: ComputedRef<string>; + producerProjectId: ComputedRef<string>; + id: ComputedRef<string>; + apis: ComputedRef<Api[]>; + types: ComputedRef<Type[]>; + enums: ComputedRef<Enum[]>; + documentation?: ComputedRef<Documentation>; + backend?: ComputedRef<Backend>; + http?: ComputedRef<Http>; + quota?: ComputedRef<Quota>; + authentication?: ComputedRef<Authentication>; + context?: ComputedRef<Context>; + usage?: ComputedRef<Usage>; + endpoints: ComputedRef<Endpoint[]>; + control?: ComputedRef<Control>; + logs: ComputedRef<LogDescriptor[]>; + metrics: ComputedRef<MetricDescriptor[]>; + monitoredResources: ComputedRef<MonitoredResourceDescriptor[]>; + billing?: ComputedRef<Billing>; + logging?: ComputedRef<Logging>; + monitoring?: ComputedRef<Monitoring>; + systemParameters?: ComputedRef<SystemParameters>; + sourceInfo?: ComputedRef<SourceInfo>; + configVersion?: ComputedRef<UInt32Value>; +} export interface ServiceProtoMsg { typeUrl: "/google.api.Service"; value: Uint8Array; @@ -232,16 +260,16 @@ function createBaseService(): Service { export const Service = { typeUrl: "/google.api.Service", encode(message: Service, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.name !== undefined) { + if (message.name !== "") { writer.uint32(10).string(message.name); } - if (message.title !== undefined) { + if (message.title !== "") { writer.uint32(18).string(message.title); } - if (message.producerProjectId !== undefined) { + if (message.producerProjectId !== "") { writer.uint32(178).string(message.producerProjectId); } - if (message.id !== undefined) { + if (message.id !== "") { writer.uint32(266).string(message.id); } for (const v of message.apis) { @@ -399,33 +427,33 @@ export const Service = { return message; }, fromJSON(object: any): Service { - 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; + 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 + }; }, toJSON(message: Service): JsonSafe<Service> { const obj: any = {}; @@ -493,52 +521,24 @@ 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)) || []; - 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.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; message.endpoints = object.endpoints?.map(e => Endpoint.fromPartial(e)) || []; - if (object.control !== undefined && object.control !== null) { - message.control = Control.fromPartial(object.control); - } + message.control = object.control !== undefined && object.control !== null ? Control.fromPartial(object.control) : undefined; 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)) || []; - 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); - } + 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; 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 cb644474a6..34f9fdfb5d 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,7 +1,8 @@ -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"; +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"; export const protobufPackage = "google.api.servicecontrol.v1"; /** Error codes for Check responses. */ export enum CheckError_Code { @@ -216,6 +217,12 @@ export interface CheckError { */ status?: Status; } +export interface ReactiveCheckError { + code: ComputedRef<CheckError_Code>; + subject: ComputedRef<string>; + detail: ComputedRef<string>; + status?: ComputedRef<Status>; +} export interface CheckErrorProtoMsg { typeUrl: "/google.api.servicecontrol.v1.CheckError"; value: Uint8Array; @@ -244,10 +251,10 @@ export const CheckError = { if (message.code !== 0) { writer.uint32(8).int32(message.code); } - if (message.subject !== undefined) { + if (message.subject !== "") { writer.uint32(34).string(message.subject); } - if (message.detail !== undefined) { + if (message.detail !== "") { writer.uint32(18).string(message.detail); } if (message.status !== undefined) { @@ -282,12 +289,12 @@ export const CheckError = { return message; }, fromJSON(object: any): CheckError { - 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; + 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 + }; }, toJSON(message: CheckError): JsonSafe<CheckError> { const obj: any = {}; @@ -302,9 +309,7 @@ export const CheckError = { message.code = object.code ?? 0; message.subject = object.subject ?? ""; message.detail = object.detail ?? ""; - if (object.status !== undefined && object.status !== null) { - message.status = Status.fromPartial(object.status); - } + message.status = object.status !== undefined && object.status !== null ? Status.fromPartial(object.status) : undefined; 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 5e64cd199a..ec696f599b 100644 --- a/__fixtures__/v-next/outputv4/google/api/servicecontrol/v1/distribution.ts +++ b/__fixtures__/v-next/outputv4/google/api/servicecontrol/v1/distribution.ts @@ -1,7 +1,8 @@ -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"; +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"; export const protobufPackage = "google.api.servicecontrol.v1"; /** * Distribution represents a frequency distribution of double-valued sample @@ -55,6 +56,18 @@ export interface Distribution { /** Example points. Must be in increasing order of `value` field. */ exemplars: Distribution_Exemplar[]; } +export interface ReactiveDistribution { + count: ComputedRef<bigint>; + mean: ComputedRef<number>; + minimum: ComputedRef<number>; + maximum: ComputedRef<number>; + sumOfSquaredDeviation: ComputedRef<number>; + bucketCounts: ComputedRef<bigint[]>; + linearBuckets?: ComputedRef<Distribution_LinearBuckets>; + exponentialBuckets?: ComputedRef<Distribution_ExponentialBuckets>; + explicitBuckets?: ComputedRef<Distribution_ExplicitBuckets>; + exemplars: ComputedRef<Distribution_Exemplar[]>; +} export interface DistributionProtoMsg { typeUrl: "/google.api.servicecontrol.v1.Distribution"; value: Uint8Array; @@ -103,6 +116,11 @@ export interface Distribution_LinearBuckets { */ offset: number; } +export interface ReactiveDistribution_LinearBuckets { + numFiniteBuckets: ComputedRef<number>; + width: ComputedRef<number>; + offset: ComputedRef<number>; +} export interface Distribution_LinearBucketsProtoMsg { typeUrl: "/google.api.servicecontrol.v1.LinearBuckets"; value: Uint8Array; @@ -136,6 +154,11 @@ export interface Distribution_ExponentialBuckets { */ scale: number; } +export interface ReactiveDistribution_ExponentialBuckets { + numFiniteBuckets: ComputedRef<number>; + growthFactor: ComputedRef<number>; + scale: ComputedRef<number>; +} export interface Distribution_ExponentialBucketsProtoMsg { typeUrl: "/google.api.servicecontrol.v1.ExponentialBuckets"; value: Uint8Array; @@ -167,6 +190,9 @@ export interface Distribution_ExplicitBuckets { */ bounds: number[]; } +export interface ReactiveDistribution_ExplicitBuckets { + bounds: ComputedRef<number[]>; +} export interface Distribution_ExplicitBucketsProtoMsg { typeUrl: "/google.api.servicecontrol.v1.ExplicitBuckets"; value: Uint8Array; @@ -192,19 +218,19 @@ function createBaseDistribution(): Distribution { export const Distribution = { typeUrl: "/google.api.servicecontrol.v1.Distribution", encode(message: Distribution, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.count !== undefined) { + if (message.count !== BigInt(0)) { writer.uint32(8).int64(message.count); } - if (message.mean !== undefined) { + if (message.mean !== 0) { writer.uint32(17).double(message.mean); } - if (message.minimum !== undefined) { + if (message.minimum !== 0) { writer.uint32(25).double(message.minimum); } - if (message.maximum !== undefined) { + if (message.maximum !== 0) { writer.uint32(33).double(message.maximum); } - if (message.sumOfSquaredDeviation !== undefined) { + if (message.sumOfSquaredDeviation !== 0) { writer.uint32(41).double(message.sumOfSquaredDeviation); } writer.uint32(50).fork(); @@ -278,18 +304,18 @@ export const Distribution = { return message; }, fromJSON(object: any): Distribution { - 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; + 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)) : [] + }; }, toJSON(message: Distribution): JsonSafe<Distribution> { const obj: any = {}; @@ -315,23 +341,15 @@ export const Distribution = { }, fromPartial(object: DeepPartial<Distribution>): Distribution { const message = createBaseDistribution(); - if (object.count !== undefined && object.count !== null) { - message.count = BigInt(object.count.toString()); - } + message.count = object.count !== undefined && object.count !== null ? BigInt(object.count.toString()) : BigInt(0); 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())) || []; - 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.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; message.exemplars = object.exemplars?.map(e => Distribution_Exemplar.fromPartial(e)) || []; return message; }, @@ -463,13 +481,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 !== undefined) { + if (message.numFiniteBuckets !== 0) { writer.uint32(8).int32(message.numFiniteBuckets); } - if (message.width !== undefined) { + if (message.width !== 0) { writer.uint32(17).double(message.width); } - if (message.offset !== undefined) { + if (message.offset !== 0) { writer.uint32(25).double(message.offset); } return writer; @@ -498,11 +516,11 @@ export const Distribution_LinearBuckets = { return message; }, fromJSON(object: any): Distribution_LinearBuckets { - 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; + 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 + }; }, toJSON(message: Distribution_LinearBuckets): JsonSafe<Distribution_LinearBuckets> { const obj: any = {}; @@ -585,13 +603,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 !== undefined) { + if (message.numFiniteBuckets !== 0) { writer.uint32(8).int32(message.numFiniteBuckets); } - if (message.growthFactor !== undefined) { + if (message.growthFactor !== 0) { writer.uint32(17).double(message.growthFactor); } - if (message.scale !== undefined) { + if (message.scale !== 0) { writer.uint32(25).double(message.scale); } return writer; @@ -620,11 +638,11 @@ export const Distribution_ExponentialBuckets = { return message; }, fromJSON(object: any): Distribution_ExponentialBuckets { - 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; + 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 + }; }, toJSON(message: Distribution_ExponentialBuckets): JsonSafe<Distribution_ExponentialBuckets> { const obj: any = {}; @@ -737,9 +755,9 @@ export const Distribution_ExplicitBuckets = { return message; }, fromJSON(object: any): Distribution_ExplicitBuckets { - const obj = createBaseDistribution_ExplicitBuckets(); - if (Array.isArray(object?.bounds)) obj.bounds = object.bounds.map((e: any) => Number(e)); - return obj; + return { + bounds: Array.isArray(object?.bounds) ? object.bounds.map((e: any) => Number(e)) : [] + }; }, toJSON(message: Distribution_ExplicitBuckets): JsonSafe<Distribution_ExplicitBuckets> { 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 2c54f6b0db..c2a6e5612e 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,7 +1,8 @@ -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"; +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"; export const protobufPackage = "google.api.servicecontrol.v1"; /** * A common proto for logging HTTP requests. Only contains semantics @@ -80,6 +81,23 @@ export interface HttpRequest { /** Protocol used for the request. Examples: "HTTP/1.1", "HTTP/2", "websocket" */ protocol: string; } +export interface ReactiveHttpRequest { + requestMethod: ComputedRef<string>; + requestUrl: ComputedRef<string>; + requestSize: ComputedRef<bigint>; + status: ComputedRef<number>; + responseSize: ComputedRef<bigint>; + userAgent: ComputedRef<string>; + remoteIp: ComputedRef<string>; + serverIp: ComputedRef<string>; + referer: ComputedRef<string>; + latency?: ComputedRef<Duration>; + cacheLookup: ComputedRef<boolean>; + cacheHit: ComputedRef<boolean>; + cacheValidatedWithOriginServer: ComputedRef<boolean>; + cacheFillBytes: ComputedRef<bigint>; + protocol: ComputedRef<string>; +} export interface HttpRequestProtoMsg { typeUrl: "/google.api.servicecontrol.v1.HttpRequest"; value: Uint8Array; @@ -128,49 +146,49 @@ function createBaseHttpRequest(): HttpRequest { export const HttpRequest = { typeUrl: "/google.api.servicecontrol.v1.HttpRequest", encode(message: HttpRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.requestMethod !== undefined) { + if (message.requestMethod !== "") { writer.uint32(10).string(message.requestMethod); } - if (message.requestUrl !== undefined) { + if (message.requestUrl !== "") { writer.uint32(18).string(message.requestUrl); } - if (message.requestSize !== undefined) { + if (message.requestSize !== BigInt(0)) { writer.uint32(24).int64(message.requestSize); } - if (message.status !== undefined) { + if (message.status !== 0) { writer.uint32(32).int32(message.status); } - if (message.responseSize !== undefined) { + if (message.responseSize !== BigInt(0)) { writer.uint32(40).int64(message.responseSize); } - if (message.userAgent !== undefined) { + if (message.userAgent !== "") { writer.uint32(50).string(message.userAgent); } - if (message.remoteIp !== undefined) { + if (message.remoteIp !== "") { writer.uint32(58).string(message.remoteIp); } - if (message.serverIp !== undefined) { + if (message.serverIp !== "") { writer.uint32(106).string(message.serverIp); } - if (message.referer !== undefined) { + if (message.referer !== "") { writer.uint32(66).string(message.referer); } if (message.latency !== undefined) { Duration.encode(message.latency, writer.uint32(114).fork()).ldelim(); } - if (message.cacheLookup !== undefined) { + if (message.cacheLookup === true) { writer.uint32(88).bool(message.cacheLookup); } - if (message.cacheHit !== undefined) { + if (message.cacheHit === true) { writer.uint32(72).bool(message.cacheHit); } - if (message.cacheValidatedWithOriginServer !== undefined) { + if (message.cacheValidatedWithOriginServer === true) { writer.uint32(80).bool(message.cacheValidatedWithOriginServer); } - if (message.cacheFillBytes !== undefined) { + if (message.cacheFillBytes !== BigInt(0)) { writer.uint32(96).int64(message.cacheFillBytes); } - if (message.protocol !== undefined) { + if (message.protocol !== "") { writer.uint32(122).string(message.protocol); } return writer; @@ -235,23 +253,23 @@ export const HttpRequest = { return message; }, fromJSON(object: any): HttpRequest { - 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; + 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) : "" + }; }, toJSON(message: HttpRequest): JsonSafe<HttpRequest> { const obj: any = {}; @@ -276,26 +294,18 @@ export const HttpRequest = { const message = createBaseHttpRequest(); message.requestMethod = object.requestMethod ?? ""; message.requestUrl = object.requestUrl ?? ""; - if (object.requestSize !== undefined && object.requestSize !== null) { - message.requestSize = BigInt(object.requestSize.toString()); - } + message.requestSize = object.requestSize !== undefined && object.requestSize !== null ? BigInt(object.requestSize.toString()) : BigInt(0); message.status = object.status ?? 0; - if (object.responseSize !== undefined && object.responseSize !== null) { - message.responseSize = BigInt(object.responseSize.toString()); - } + message.responseSize = object.responseSize !== undefined && object.responseSize !== null ? BigInt(object.responseSize.toString()) : BigInt(0); message.userAgent = object.userAgent ?? ""; message.remoteIp = object.remoteIp ?? ""; message.serverIp = object.serverIp ?? ""; message.referer = object.referer ?? ""; - if (object.latency !== undefined && object.latency !== null) { - message.latency = Duration.fromPartial(object.latency); - } + message.latency = object.latency !== undefined && object.latency !== null ? Duration.fromPartial(object.latency) : undefined; message.cacheLookup = object.cacheLookup ?? false; message.cacheHit = object.cacheHit ?? false; message.cacheValidatedWithOriginServer = object.cacheValidatedWithOriginServer ?? false; - if (object.cacheFillBytes !== undefined && object.cacheFillBytes !== null) { - message.cacheFillBytes = BigInt(object.cacheFillBytes.toString()); - } + message.cacheFillBytes = object.cacheFillBytes !== undefined && object.cacheFillBytes !== null ? BigInt(object.cacheFillBytes.toString()) : BigInt(0); 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 8dfc555571..e2eb0527c5 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,16 +1,21 @@ -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"; +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"; export const protobufPackage = "google.api.servicecontrol.v1"; export interface LogEntry_LabelsEntry { key: string; value: string; } +export interface ReactiveLogEntry_LabelsEntry { + key: ComputedRef<string>; + value: ComputedRef<string>; +} export interface LogEntry_LabelsEntryProtoMsg { typeUrl: string; value: Uint8Array; @@ -84,6 +89,22 @@ export interface LogEntry { */ sourceLocation?: LogEntrySourceLocation; } +export interface ReactiveLogEntry { + name: ComputedRef<string>; + timestamp?: ComputedRef<Date>; + severity: ComputedRef<LogSeverity>; + httpRequest?: ComputedRef<HttpRequest>; + trace: ComputedRef<string>; + insertId: ComputedRef<string>; + labels: ComputedRef<{ + [key: string]: string; + }>; + protoPayload?: ComputedRef<Any>; + textPayload?: ComputedRef<string>; + structPayload?: ComputedRef<Struct>; + operation?: ComputedRef<LogEntryOperation>; + sourceLocation?: ComputedRef<LogEntrySourceLocation>; +} export interface LogEntryProtoMsg { typeUrl: "/google.api.servicecontrol.v1.LogEntry"; value: Uint8Array; @@ -126,6 +147,12 @@ 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<string>; + producer: ComputedRef<string>; + first: ComputedRef<boolean>; + last: ComputedRef<boolean>; +} export interface LogEntryOperationProtoMsg { typeUrl: "/google.api.servicecontrol.v1.LogEntryOperation"; value: Uint8Array; @@ -165,6 +192,11 @@ export interface LogEntrySourceLocation { */ function: string; } +export interface ReactiveLogEntrySourceLocation { + file: ComputedRef<string>; + line: ComputedRef<bigint>; + function: ComputedRef<string>; +} export interface LogEntrySourceLocationProtoMsg { typeUrl: "/google.api.servicecontrol.v1.LogEntrySourceLocation"; value: Uint8Array; @@ -186,10 +218,10 @@ function createBaseLogEntry_LabelsEntry(): LogEntry_LabelsEntry { } export const LogEntry_LabelsEntry = { encode(message: LogEntry_LabelsEntry, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.key !== undefined) { + if (message.key !== "") { writer.uint32(10).string(message.key); } - if (message.value !== undefined) { + if (message.value !== "") { writer.uint32(18).string(message.value); } return writer; @@ -215,10 +247,10 @@ export const LogEntry_LabelsEntry = { return message; }, fromJSON(object: any): LogEntry_LabelsEntry { - const obj = createBaseLogEntry_LabelsEntry(); - if (isSet(object.key)) obj.key = String(object.key); - if (isSet(object.value)) obj.value = String(object.value); - return obj; + return { + key: isSet(object.key) ? String(object.key) : "", + value: isSet(object.value) ? String(object.value) : "" + }; }, toJSON(message: LogEntry_LabelsEntry): JsonSafe<LogEntry_LabelsEntry> { const obj: any = {}; @@ -295,7 +327,7 @@ function createBaseLogEntry(): LogEntry { export const LogEntry = { typeUrl: "/google.api.servicecontrol.v1.LogEntry", encode(message: LogEntry, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.name !== undefined) { + if (message.name !== "") { writer.uint32(82).string(message.name); } if (message.timestamp !== undefined) { @@ -307,10 +339,10 @@ export const LogEntry = { if (message.httpRequest !== undefined) { HttpRequest.encode(message.httpRequest, writer.uint32(114).fork()).ldelim(); } - if (message.trace !== undefined) { + if (message.trace !== "") { writer.uint32(122).string(message.trace); } - if (message.insertId !== undefined) { + if (message.insertId !== "") { writer.uint32(34).string(message.insertId); } Object.entries(message.labels).forEach(([key, value]) => { @@ -390,25 +422,25 @@ export const LogEntry = { return message; }, fromJSON(object: any): LogEntry { - 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; + 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 + }; }, toJSON(message: LogEntry): JsonSafe<LogEntry> { const obj: any = {}; @@ -436,9 +468,7 @@ export const LogEntry = { message.name = object.name ?? ""; message.timestamp = object.timestamp ?? undefined; message.severity = object.severity ?? 0; - if (object.httpRequest !== undefined && object.httpRequest !== null) { - message.httpRequest = HttpRequest.fromPartial(object.httpRequest); - } + message.httpRequest = object.httpRequest !== undefined && object.httpRequest !== null ? HttpRequest.fromPartial(object.httpRequest) : undefined; message.trace = object.trace ?? ""; message.insertId = object.insertId ?? ""; message.labels = Object.entries(object.labels ?? {}).reduce<{ @@ -449,19 +479,11 @@ export const LogEntry = { } return acc; }, {}); - if (object.protoPayload !== undefined && object.protoPayload !== null) { - message.protoPayload = Any.fromPartial(object.protoPayload); - } + message.protoPayload = object.protoPayload !== undefined && object.protoPayload !== null ? Any.fromPartial(object.protoPayload) : undefined; message.textPayload = object.textPayload ?? 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); - } + 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; return message; }, fromSDK(object: LogEntrySDKType): LogEntry { @@ -620,16 +642,16 @@ function createBaseLogEntryOperation(): LogEntryOperation { export const LogEntryOperation = { typeUrl: "/google.api.servicecontrol.v1.LogEntryOperation", encode(message: LogEntryOperation, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.id !== undefined) { + if (message.id !== "") { writer.uint32(10).string(message.id); } - if (message.producer !== undefined) { + if (message.producer !== "") { writer.uint32(18).string(message.producer); } - if (message.first !== undefined) { + if (message.first === true) { writer.uint32(24).bool(message.first); } - if (message.last !== undefined) { + if (message.last === true) { writer.uint32(32).bool(message.last); } return writer; @@ -661,12 +683,12 @@ export const LogEntryOperation = { return message; }, fromJSON(object: any): LogEntryOperation { - 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; + 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 + }; }, toJSON(message: LogEntryOperation): JsonSafe<LogEntryOperation> { const obj: any = {}; @@ -758,13 +780,13 @@ function createBaseLogEntrySourceLocation(): LogEntrySourceLocation { export const LogEntrySourceLocation = { typeUrl: "/google.api.servicecontrol.v1.LogEntrySourceLocation", encode(message: LogEntrySourceLocation, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.file !== undefined) { + if (message.file !== "") { writer.uint32(10).string(message.file); } - if (message.line !== undefined) { + if (message.line !== BigInt(0)) { writer.uint32(16).int64(message.line); } - if (message.function !== undefined) { + if (message.function !== "") { writer.uint32(26).string(message.function); } return writer; @@ -793,11 +815,11 @@ export const LogEntrySourceLocation = { return message; }, fromJSON(object: any): LogEntrySourceLocation { - 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; + 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) : "" + }; }, toJSON(message: LogEntrySourceLocation): JsonSafe<LogEntrySourceLocation> { const obj: any = {}; @@ -809,9 +831,7 @@ export const LogEntrySourceLocation = { fromPartial(object: DeepPartial<LogEntrySourceLocation>): LogEntrySourceLocation { const message = createBaseLogEntrySourceLocation(); message.file = object.file ?? ""; - if (object.line !== undefined && object.line !== null) { - message.line = BigInt(object.line.toString()); - } + message.line = object.line !== undefined && object.line !== null ? BigInt(object.line.toString()) : BigInt(0); 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 46230777df..0a12b41491 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,13 +1,18 @@ -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"; +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"; export const protobufPackage = "google.api.servicecontrol.v1"; export interface MetricValue_LabelsEntry { key: string; value: string; } +export interface ReactiveMetricValue_LabelsEntry { + key: ComputedRef<string>; + value: ComputedRef<string>; +} export interface MetricValue_LabelsEntryProtoMsg { typeUrl: string; value: Uint8Array; @@ -52,6 +57,18 @@ export interface MetricValue { /** A distribution value. */ distributionValue?: Distribution; } +export interface ReactiveMetricValue { + labels: ComputedRef<{ + [key: string]: string; + }>; + startTime?: ComputedRef<Date>; + endTime?: ComputedRef<Date>; + boolValue?: ComputedRef<boolean>; + int64Value?: ComputedRef<bigint>; + doubleValue?: ComputedRef<number>; + stringValue?: ComputedRef<string>; + distributionValue?: ComputedRef<Distribution>; +} export interface MetricValueProtoMsg { typeUrl: "/google.api.servicecontrol.v1.MetricValue"; value: Uint8Array; @@ -80,6 +97,10 @@ export interface MetricValueSet { /** The values in this metric. */ metricValues: MetricValue[]; } +export interface ReactiveMetricValueSet { + metricName: ComputedRef<string>; + metricValues: ComputedRef<MetricValue[]>; +} export interface MetricValueSetProtoMsg { typeUrl: "/google.api.servicecontrol.v1.MetricValueSet"; value: Uint8Array; @@ -101,10 +122,10 @@ function createBaseMetricValue_LabelsEntry(): MetricValue_LabelsEntry { } export const MetricValue_LabelsEntry = { encode(message: MetricValue_LabelsEntry, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.key !== undefined) { + if (message.key !== "") { writer.uint32(10).string(message.key); } - if (message.value !== undefined) { + if (message.value !== "") { writer.uint32(18).string(message.value); } return writer; @@ -130,10 +151,10 @@ export const MetricValue_LabelsEntry = { return message; }, fromJSON(object: any): MetricValue_LabelsEntry { - const obj = createBaseMetricValue_LabelsEntry(); - if (isSet(object.key)) obj.key = String(object.key); - if (isSet(object.value)) obj.value = String(object.value); - return obj; + return { + key: isSet(object.key) ? String(object.key) : "", + value: isSet(object.value) ? String(object.value) : "" + }; }, toJSON(message: MetricValue_LabelsEntry): JsonSafe<MetricValue_LabelsEntry> { const obj: any = {}; @@ -277,21 +298,21 @@ export const MetricValue = { return message; }, fromJSON(object: any): MetricValue { - 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; + 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 + }; }, toJSON(message: MetricValue): JsonSafe<MetricValue> { const obj: any = {}; @@ -325,14 +346,10 @@ export const MetricValue = { message.startTime = object.startTime ?? undefined; message.endTime = object.endTime ?? undefined; message.boolValue = object.boolValue ?? undefined; - if (object.int64Value !== undefined && object.int64Value !== null) { - message.int64Value = BigInt(object.int64Value.toString()); - } + message.int64Value = object.int64Value !== undefined && object.int64Value !== null ? BigInt(object.int64Value.toString()) : undefined; message.doubleValue = object.doubleValue ?? undefined; message.stringValue = object.stringValue ?? undefined; - if (object.distributionValue !== undefined && object.distributionValue !== null) { - message.distributionValue = Distribution.fromPartial(object.distributionValue); - } + message.distributionValue = object.distributionValue !== undefined && object.distributionValue !== null ? Distribution.fromPartial(object.distributionValue) : undefined; return message; }, fromSDK(object: MetricValueSDKType): MetricValue { @@ -461,7 +478,7 @@ function createBaseMetricValueSet(): MetricValueSet { export const MetricValueSet = { typeUrl: "/google.api.servicecontrol.v1.MetricValueSet", encode(message: MetricValueSet, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.metricName !== undefined) { + if (message.metricName !== "") { writer.uint32(10).string(message.metricName); } for (const v of message.metricValues) { @@ -490,10 +507,10 @@ export const MetricValueSet = { return message; }, fromJSON(object: any): MetricValueSet { - 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; + return { + metricName: isSet(object.metricName) ? String(object.metricName) : "", + metricValues: Array.isArray(object?.metricValues) ? object.metricValues.map((e: any) => MetricValue.fromJSON(e)) : [] + }; }, toJSON(message: MetricValueSet): JsonSafe<MetricValueSet> { 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 717d7008f3..926ca16f27 100644 --- a/__fixtures__/v-next/outputv4/google/api/servicecontrol/v1/operation.ts +++ b/__fixtures__/v-next/outputv4/google/api/servicecontrol/v1/operation.ts @@ -1,10 +1,11 @@ -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"; +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"; export const protobufPackage = "google.api.servicecontrol.v1"; /** Defines the importance of the data contained in the operation. */ export enum Operation_Importance { @@ -51,6 +52,10 @@ export interface Operation_LabelsEntry { key: string; value: string; } +export interface ReactiveOperation_LabelsEntry { + key: ComputedRef<string>; + value: ComputedRef<string>; +} export interface Operation_LabelsEntryProtoMsg { typeUrl: string; value: Uint8Array; @@ -141,6 +146,20 @@ export interface Operation { /** Unimplemented. */ extensions: Any[]; } +export interface ReactiveOperation { + operationId: ComputedRef<string>; + operationName: ComputedRef<string>; + consumerId: ComputedRef<string>; + startTime?: ComputedRef<Date>; + endTime?: ComputedRef<Date>; + labels: ComputedRef<{ + [key: string]: string; + }>; + metricValueSets: ComputedRef<MetricValueSet[]>; + logEntries: ComputedRef<LogEntry[]>; + importance: ComputedRef<Operation_Importance>; + extensions: ComputedRef<Any[]>; +} export interface OperationProtoMsg { typeUrl: "/google.api.servicecontrol.v1.Operation"; value: Uint8Array; @@ -168,10 +187,10 @@ function createBaseOperation_LabelsEntry(): Operation_LabelsEntry { } export const Operation_LabelsEntry = { encode(message: Operation_LabelsEntry, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.key !== undefined) { + if (message.key !== "") { writer.uint32(10).string(message.key); } - if (message.value !== undefined) { + if (message.value !== "") { writer.uint32(18).string(message.value); } return writer; @@ -197,10 +216,10 @@ export const Operation_LabelsEntry = { return message; }, fromJSON(object: any): Operation_LabelsEntry { - const obj = createBaseOperation_LabelsEntry(); - if (isSet(object.key)) obj.key = String(object.key); - if (isSet(object.value)) obj.value = String(object.value); - return obj; + return { + key: isSet(object.key) ? String(object.key) : "", + value: isSet(object.value) ? String(object.value) : "" + }; }, toJSON(message: Operation_LabelsEntry): JsonSafe<Operation_LabelsEntry> { const obj: any = {}; @@ -275,13 +294,13 @@ function createBaseOperation(): Operation { export const Operation = { typeUrl: "/google.api.servicecontrol.v1.Operation", encode(message: Operation, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.operationId !== undefined) { + if (message.operationId !== "") { writer.uint32(10).string(message.operationId); } - if (message.operationName !== undefined) { + if (message.operationName !== "") { writer.uint32(18).string(message.operationName); } - if (message.consumerId !== undefined) { + if (message.consumerId !== "") { writer.uint32(26).string(message.consumerId); } if (message.startTime !== undefined) { @@ -358,23 +377,23 @@ export const Operation = { return message; }, fromJSON(object: any): Operation { - 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; + 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)) : [] + }; }, toJSON(message: Operation): JsonSafe<Operation> { 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 70b2364f03..166fe7fb9b 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,8 +1,9 @@ -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"; +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"; export const protobufPackage = "google.api.servicecontrol.v1"; /** Supported quota modes. */ export enum QuotaOperation_QuotaMode { @@ -190,6 +191,11 @@ export interface AllocateQuotaRequest { */ serviceConfigId: string; } +export interface ReactiveAllocateQuotaRequest { + serviceName: ComputedRef<string>; + allocateOperation?: ComputedRef<QuotaOperation>; + serviceConfigId: ComputedRef<string>; +} export interface AllocateQuotaRequestProtoMsg { typeUrl: "/google.api.servicecontrol.v1.AllocateQuotaRequest"; value: Uint8Array; @@ -204,6 +210,10 @@ export interface QuotaOperation_LabelsEntry { key: string; value: string; } +export interface ReactiveQuotaOperation_LabelsEntry { + key: ComputedRef<string>; + value: ComputedRef<string>; +} export interface QuotaOperation_LabelsEntryProtoMsg { typeUrl: string; value: Uint8Array; @@ -271,6 +281,16 @@ export interface QuotaOperation { /** Quota mode for this operation. */ quotaMode: QuotaOperation_QuotaMode; } +export interface ReactiveQuotaOperation { + operationId: ComputedRef<string>; + methodName: ComputedRef<string>; + consumerId: ComputedRef<string>; + labels: ComputedRef<{ + [key: string]: string; + }>; + quotaMetrics: ComputedRef<MetricValueSet[]>; + quotaMode: ComputedRef<QuotaOperation_QuotaMode>; +} export interface QuotaOperationProtoMsg { typeUrl: "/google.api.servicecontrol.v1.QuotaOperation"; value: Uint8Array; @@ -311,6 +331,12 @@ export interface AllocateQuotaResponse { /** ID of the actual config used to process the request. */ serviceConfigId: string; } +export interface ReactiveAllocateQuotaResponse { + operationId: ComputedRef<string>; + allocateErrors: ComputedRef<QuotaError[]>; + quotaMetrics: ComputedRef<MetricValueSet[]>; + serviceConfigId: ComputedRef<string>; +} export interface AllocateQuotaResponseProtoMsg { typeUrl: "/google.api.servicecontrol.v1.AllocateQuotaResponse"; value: Uint8Array; @@ -340,6 +366,12 @@ export interface QuotaError { */ status?: Status; } +export interface ReactiveQuotaError { + code: ComputedRef<QuotaError_Code>; + subject: ComputedRef<string>; + description: ComputedRef<string>; + status?: ComputedRef<Status>; +} export interface QuotaErrorProtoMsg { typeUrl: "/google.api.servicecontrol.v1.QuotaError"; value: Uint8Array; @@ -361,13 +393,13 @@ function createBaseAllocateQuotaRequest(): AllocateQuotaRequest { export const AllocateQuotaRequest = { typeUrl: "/google.api.servicecontrol.v1.AllocateQuotaRequest", encode(message: AllocateQuotaRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.serviceName !== undefined) { + if (message.serviceName !== "") { writer.uint32(10).string(message.serviceName); } if (message.allocateOperation !== undefined) { QuotaOperation.encode(message.allocateOperation, writer.uint32(18).fork()).ldelim(); } - if (message.serviceConfigId !== undefined) { + if (message.serviceConfigId !== "") { writer.uint32(34).string(message.serviceConfigId); } return writer; @@ -396,11 +428,11 @@ export const AllocateQuotaRequest = { return message; }, fromJSON(object: any): AllocateQuotaRequest { - 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; + return { + serviceName: isSet(object.serviceName) ? String(object.serviceName) : "", + allocateOperation: isSet(object.allocateOperation) ? QuotaOperation.fromJSON(object.allocateOperation) : undefined, + serviceConfigId: isSet(object.serviceConfigId) ? String(object.serviceConfigId) : "" + }; }, toJSON(message: AllocateQuotaRequest): JsonSafe<AllocateQuotaRequest> { const obj: any = {}; @@ -412,9 +444,7 @@ export const AllocateQuotaRequest = { fromPartial(object: DeepPartial<AllocateQuotaRequest>): AllocateQuotaRequest { const message = createBaseAllocateQuotaRequest(); message.serviceName = object.serviceName ?? ""; - if (object.allocateOperation !== undefined && object.allocateOperation !== null) { - message.allocateOperation = QuotaOperation.fromPartial(object.allocateOperation); - } + message.allocateOperation = object.allocateOperation !== undefined && object.allocateOperation !== null ? QuotaOperation.fromPartial(object.allocateOperation) : undefined; message.serviceConfigId = object.serviceConfigId ?? ""; return message; }, @@ -483,10 +513,10 @@ function createBaseQuotaOperation_LabelsEntry(): QuotaOperation_LabelsEntry { } export const QuotaOperation_LabelsEntry = { encode(message: QuotaOperation_LabelsEntry, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.key !== undefined) { + if (message.key !== "") { writer.uint32(10).string(message.key); } - if (message.value !== undefined) { + if (message.value !== "") { writer.uint32(18).string(message.value); } return writer; @@ -512,10 +542,10 @@ export const QuotaOperation_LabelsEntry = { return message; }, fromJSON(object: any): QuotaOperation_LabelsEntry { - const obj = createBaseQuotaOperation_LabelsEntry(); - if (isSet(object.key)) obj.key = String(object.key); - if (isSet(object.value)) obj.value = String(object.value); - return obj; + return { + key: isSet(object.key) ? String(object.key) : "", + value: isSet(object.value) ? String(object.value) : "" + }; }, toJSON(message: QuotaOperation_LabelsEntry): JsonSafe<QuotaOperation_LabelsEntry> { const obj: any = {}; @@ -586,13 +616,13 @@ function createBaseQuotaOperation(): QuotaOperation { export const QuotaOperation = { typeUrl: "/google.api.servicecontrol.v1.QuotaOperation", encode(message: QuotaOperation, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.operationId !== undefined) { + if (message.operationId !== "") { writer.uint32(10).string(message.operationId); } - if (message.methodName !== undefined) { + if (message.methodName !== "") { writer.uint32(18).string(message.methodName); } - if (message.consumerId !== undefined) { + if (message.consumerId !== "") { writer.uint32(26).string(message.consumerId); } Object.entries(message.labels).forEach(([key, value]) => { @@ -645,19 +675,19 @@ export const QuotaOperation = { return message; }, fromJSON(object: any): QuotaOperation { - 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; + 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 + }; }, toJSON(message: QuotaOperation): JsonSafe<QuotaOperation> { const obj: any = {}; @@ -815,7 +845,7 @@ function createBaseAllocateQuotaResponse(): AllocateQuotaResponse { export const AllocateQuotaResponse = { typeUrl: "/google.api.servicecontrol.v1.AllocateQuotaResponse", encode(message: AllocateQuotaResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.operationId !== undefined) { + if (message.operationId !== "") { writer.uint32(10).string(message.operationId); } for (const v of message.allocateErrors) { @@ -824,7 +854,7 @@ export const AllocateQuotaResponse = { for (const v of message.quotaMetrics) { MetricValueSet.encode(v!, writer.uint32(26).fork()).ldelim(); } - if (message.serviceConfigId !== undefined) { + if (message.serviceConfigId !== "") { writer.uint32(34).string(message.serviceConfigId); } return writer; @@ -856,12 +886,12 @@ export const AllocateQuotaResponse = { return message; }, fromJSON(object: any): AllocateQuotaResponse { - 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; + 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) : "" + }; }, toJSON(message: AllocateQuotaResponse): JsonSafe<AllocateQuotaResponse> { const obj: any = {}; @@ -977,10 +1007,10 @@ export const QuotaError = { if (message.code !== 0) { writer.uint32(8).int32(message.code); } - if (message.subject !== undefined) { + if (message.subject !== "") { writer.uint32(18).string(message.subject); } - if (message.description !== undefined) { + if (message.description !== "") { writer.uint32(26).string(message.description); } if (message.status !== undefined) { @@ -1015,12 +1045,12 @@ export const QuotaError = { return message; }, fromJSON(object: any): QuotaError { - 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; + 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 + }; }, toJSON(message: QuotaError): JsonSafe<QuotaError> { const obj: any = {}; @@ -1035,9 +1065,7 @@ export const QuotaError = { message.code = object.code ?? 0; message.subject = object.subject ?? ""; message.description = object.description ?? ""; - if (object.status !== undefined && object.status !== null) { - message.status = Status.fromPartial(object.status); - } + message.status = object.status !== undefined && object.status !== null ? Status.fromPartial(object.status) : undefined; 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 8acacf66a6..18038cd91f 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,9 +1,10 @@ -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"; +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"; export const protobufPackage = "google.api.servicecontrol.v1"; /** * The type of the consumer as defined in @@ -89,6 +90,11 @@ export interface CheckRequest { */ serviceConfigId: string; } +export interface ReactiveCheckRequest { + serviceName: ComputedRef<string>; + operation?: ComputedRef<Operation>; + serviceConfigId: ComputedRef<string>; +} export interface CheckRequestProtoMsg { typeUrl: "/google.api.servicecontrol.v1.CheckRequest"; value: Uint8Array; @@ -122,6 +128,13 @@ export interface CheckResponse { /** Feedback data returned from the server during processing a Check request. */ checkInfo?: CheckResponse_CheckInfo; } +export interface ReactiveCheckResponse { + operationId: ComputedRef<string>; + checkErrors: ComputedRef<CheckError[]>; + serviceConfigId: ComputedRef<string>; + serviceRolloutId: ComputedRef<string>; + checkInfo?: ComputedRef<CheckResponse_CheckInfo>; +} export interface CheckResponseProtoMsg { typeUrl: "/google.api.servicecontrol.v1.CheckResponse"; value: Uint8Array; @@ -145,6 +158,10 @@ export interface CheckResponse_CheckInfo { /** Consumer info of this check. */ consumerInfo?: CheckResponse_ConsumerInfo; } +export interface ReactiveCheckResponse_CheckInfo { + unusedArguments: ComputedRef<string[]>; + consumerInfo?: ComputedRef<CheckResponse_ConsumerInfo>; +} export interface CheckResponse_CheckInfoProtoMsg { typeUrl: "/google.api.servicecontrol.v1.CheckInfo"; value: Uint8Array; @@ -176,6 +193,11 @@ export interface CheckResponse_ConsumerInfo { */ consumerNumber: bigint; } +export interface ReactiveCheckResponse_ConsumerInfo { + projectNumber: ComputedRef<bigint>; + type: ComputedRef<CheckResponse_ConsumerInfo_ConsumerType>; + consumerNumber: ComputedRef<bigint>; +} export interface CheckResponse_ConsumerInfoProtoMsg { typeUrl: "/google.api.servicecontrol.v1.ConsumerInfo"; value: Uint8Array; @@ -220,6 +242,11 @@ export interface ReportRequest { */ serviceConfigId: string; } +export interface ReactiveReportRequest { + serviceName: ComputedRef<string>; + operations: ComputedRef<Operation[]>; + serviceConfigId: ComputedRef<string>; +} export interface ReportRequestProtoMsg { typeUrl: "/google.api.servicecontrol.v1.ReportRequest"; value: Uint8Array; @@ -254,6 +281,11 @@ export interface ReportResponse { /** The current service rollout id used to process the request. */ serviceRolloutId: string; } +export interface ReactiveReportResponse { + reportErrors: ComputedRef<ReportResponse_ReportError[]>; + serviceConfigId: ComputedRef<string>; + serviceRolloutId: ComputedRef<string>; +} export interface ReportResponseProtoMsg { typeUrl: "/google.api.servicecontrol.v1.ReportResponse"; value: Uint8Array; @@ -281,6 +313,10 @@ export interface ReportResponse_ReportError { */ status?: Status; } +export interface ReactiveReportResponse_ReportError { + operationId: ComputedRef<string>; + status?: ComputedRef<Status>; +} export interface ReportResponse_ReportErrorProtoMsg { typeUrl: "/google.api.servicecontrol.v1.ReportError"; value: Uint8Array; @@ -303,13 +339,13 @@ function createBaseCheckRequest(): CheckRequest { export const CheckRequest = { typeUrl: "/google.api.servicecontrol.v1.CheckRequest", encode(message: CheckRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.serviceName !== undefined) { + if (message.serviceName !== "") { writer.uint32(10).string(message.serviceName); } if (message.operation !== undefined) { Operation.encode(message.operation, writer.uint32(18).fork()).ldelim(); } - if (message.serviceConfigId !== undefined) { + if (message.serviceConfigId !== "") { writer.uint32(34).string(message.serviceConfigId); } return writer; @@ -338,11 +374,11 @@ export const CheckRequest = { return message; }, fromJSON(object: any): CheckRequest { - 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; + return { + serviceName: isSet(object.serviceName) ? String(object.serviceName) : "", + operation: isSet(object.operation) ? Operation.fromJSON(object.operation) : undefined, + serviceConfigId: isSet(object.serviceConfigId) ? String(object.serviceConfigId) : "" + }; }, toJSON(message: CheckRequest): JsonSafe<CheckRequest> { const obj: any = {}; @@ -354,9 +390,7 @@ export const CheckRequest = { fromPartial(object: DeepPartial<CheckRequest>): CheckRequest { const message = createBaseCheckRequest(); message.serviceName = object.serviceName ?? ""; - if (object.operation !== undefined && object.operation !== null) { - message.operation = Operation.fromPartial(object.operation); - } + message.operation = object.operation !== undefined && object.operation !== null ? Operation.fromPartial(object.operation) : undefined; message.serviceConfigId = object.serviceConfigId ?? ""; return message; }, @@ -429,16 +463,16 @@ function createBaseCheckResponse(): CheckResponse { export const CheckResponse = { typeUrl: "/google.api.servicecontrol.v1.CheckResponse", encode(message: CheckResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.operationId !== undefined) { + if (message.operationId !== "") { writer.uint32(10).string(message.operationId); } for (const v of message.checkErrors) { CheckError.encode(v!, writer.uint32(18).fork()).ldelim(); } - if (message.serviceConfigId !== undefined) { + if (message.serviceConfigId !== "") { writer.uint32(42).string(message.serviceConfigId); } - if (message.serviceRolloutId !== undefined) { + if (message.serviceRolloutId !== "") { writer.uint32(90).string(message.serviceRolloutId); } if (message.checkInfo !== undefined) { @@ -476,13 +510,13 @@ export const CheckResponse = { return message; }, fromJSON(object: any): CheckResponse { - 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; + 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 + }; }, toJSON(message: CheckResponse): JsonSafe<CheckResponse> { const obj: any = {}; @@ -503,9 +537,7 @@ export const CheckResponse = { message.checkErrors = object.checkErrors?.map(e => CheckError.fromPartial(e)) || []; message.serviceConfigId = object.serviceConfigId ?? ""; message.serviceRolloutId = object.serviceRolloutId ?? ""; - if (object.checkInfo !== undefined && object.checkInfo !== null) { - message.checkInfo = CheckResponse_CheckInfo.fromPartial(object.checkInfo); - } + message.checkInfo = object.checkInfo !== undefined && object.checkInfo !== null ? CheckResponse_CheckInfo.fromPartial(object.checkInfo) : undefined; return message; }, fromSDK(object: CheckResponseSDKType): CheckResponse { @@ -623,10 +655,10 @@ export const CheckResponse_CheckInfo = { return message; }, fromJSON(object: any): CheckResponse_CheckInfo { - 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; + return { + unusedArguments: Array.isArray(object?.unusedArguments) ? object.unusedArguments.map((e: any) => String(e)) : [], + consumerInfo: isSet(object.consumerInfo) ? CheckResponse_ConsumerInfo.fromJSON(object.consumerInfo) : undefined + }; }, toJSON(message: CheckResponse_CheckInfo): JsonSafe<CheckResponse_CheckInfo> { const obj: any = {}; @@ -641,9 +673,7 @@ export const CheckResponse_CheckInfo = { fromPartial(object: DeepPartial<CheckResponse_CheckInfo>): CheckResponse_CheckInfo { const message = createBaseCheckResponse_CheckInfo(); message.unusedArguments = object.unusedArguments?.map(e => e) || []; - if (object.consumerInfo !== undefined && object.consumerInfo !== null) { - message.consumerInfo = CheckResponse_ConsumerInfo.fromPartial(object.consumerInfo); - } + message.consumerInfo = object.consumerInfo !== undefined && object.consumerInfo !== null ? CheckResponse_ConsumerInfo.fromPartial(object.consumerInfo) : undefined; return message; }, fromSDK(object: CheckResponse_CheckInfoSDKType): CheckResponse_CheckInfo { @@ -712,13 +742,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 !== undefined) { + if (message.projectNumber !== BigInt(0)) { writer.uint32(8).int64(message.projectNumber); } if (message.type !== 0) { writer.uint32(16).int32(message.type); } - if (message.consumerNumber !== undefined) { + if (message.consumerNumber !== BigInt(0)) { writer.uint32(24).int64(message.consumerNumber); } return writer; @@ -747,11 +777,11 @@ export const CheckResponse_ConsumerInfo = { return message; }, fromJSON(object: any): CheckResponse_ConsumerInfo { - 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; + 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) + }; }, toJSON(message: CheckResponse_ConsumerInfo): JsonSafe<CheckResponse_ConsumerInfo> { const obj: any = {}; @@ -762,13 +792,9 @@ export const CheckResponse_ConsumerInfo = { }, fromPartial(object: DeepPartial<CheckResponse_ConsumerInfo>): CheckResponse_ConsumerInfo { const message = createBaseCheckResponse_ConsumerInfo(); - if (object.projectNumber !== undefined && object.projectNumber !== null) { - message.projectNumber = BigInt(object.projectNumber.toString()); - } + message.projectNumber = object.projectNumber !== undefined && object.projectNumber !== null ? BigInt(object.projectNumber.toString()) : BigInt(0); message.type = object.type ?? 0; - if (object.consumerNumber !== undefined && object.consumerNumber !== null) { - message.consumerNumber = BigInt(object.consumerNumber.toString()); - } + message.consumerNumber = object.consumerNumber !== undefined && object.consumerNumber !== null ? BigInt(object.consumerNumber.toString()) : BigInt(0); return message; }, fromSDK(object: CheckResponse_ConsumerInfoSDKType): CheckResponse_ConsumerInfo { @@ -838,13 +864,13 @@ function createBaseReportRequest(): ReportRequest { export const ReportRequest = { typeUrl: "/google.api.servicecontrol.v1.ReportRequest", encode(message: ReportRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.serviceName !== undefined) { + if (message.serviceName !== "") { writer.uint32(10).string(message.serviceName); } for (const v of message.operations) { Operation.encode(v!, writer.uint32(18).fork()).ldelim(); } - if (message.serviceConfigId !== undefined) { + if (message.serviceConfigId !== "") { writer.uint32(26).string(message.serviceConfigId); } return writer; @@ -873,11 +899,11 @@ export const ReportRequest = { return message; }, fromJSON(object: any): ReportRequest { - 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; + 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) : "" + }; }, toJSON(message: ReportRequest): JsonSafe<ReportRequest> { const obj: any = {}; @@ -973,10 +999,10 @@ export const ReportResponse = { for (const v of message.reportErrors) { ReportResponse_ReportError.encode(v!, writer.uint32(10).fork()).ldelim(); } - if (message.serviceConfigId !== undefined) { + if (message.serviceConfigId !== "") { writer.uint32(18).string(message.serviceConfigId); } - if (message.serviceRolloutId !== undefined) { + if (message.serviceRolloutId !== "") { writer.uint32(34).string(message.serviceRolloutId); } return writer; @@ -1005,11 +1031,11 @@ export const ReportResponse = { return message; }, fromJSON(object: any): ReportResponse { - 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; + 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) : "" + }; }, toJSON(message: ReportResponse): JsonSafe<ReportResponse> { const obj: any = {}; @@ -1101,7 +1127,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 !== undefined) { + if (message.operationId !== "") { writer.uint32(10).string(message.operationId); } if (message.status !== undefined) { @@ -1130,10 +1156,10 @@ export const ReportResponse_ReportError = { return message; }, fromJSON(object: any): ReportResponse_ReportError { - 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; + return { + operationId: isSet(object.operationId) ? String(object.operationId) : "", + status: isSet(object.status) ? Status.fromJSON(object.status) : undefined + }; }, toJSON(message: ReportResponse_ReportError): JsonSafe<ReportResponse_ReportError> { const obj: any = {}; @@ -1144,9 +1170,7 @@ export const ReportResponse_ReportError = { fromPartial(object: DeepPartial<ReportResponse_ReportError>): ReportResponse_ReportError { const message = createBaseReportResponse_ReportError(); message.operationId = object.operationId ?? ""; - if (object.status !== undefined && object.status !== null) { - message.status = Status.fromPartial(object.status); - } + message.status = object.status !== undefined && object.status !== null ? Status.fromPartial(object.status) : undefined; 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 b629773762..c0c26ef4d3 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,8 +1,9 @@ -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"; +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"; export const protobufPackage = "google.api.servicecontrol.v2"; /** Request message for the Check method. */ export interface CheckRequest { @@ -28,6 +29,13 @@ export interface CheckRequest { /** Optional. Contains a comma-separated list of flags. */ flags: string; } +export interface ReactiveCheckRequest { + serviceName: ComputedRef<string>; + serviceConfigId: ComputedRef<string>; + attributes?: ComputedRef<AttributeContext>; + resources: ComputedRef<ResourceInfo[]>; + flags: ComputedRef<string>; +} export interface CheckRequestProtoMsg { typeUrl: "/google.api.servicecontrol.v2.CheckRequest"; value: Uint8Array; @@ -69,6 +77,13 @@ export interface ResourceInfo { */ location: string; } +export interface ReactiveResourceInfo { + name: ComputedRef<string>; + type: ComputedRef<string>; + permission: ComputedRef<string>; + container: ComputedRef<string>; + location: ComputedRef<string>; +} export interface ResourceInfoProtoMsg { typeUrl: "/google.api.servicecontrol.v2.ResourceInfo"; value: Uint8Array; @@ -85,6 +100,10 @@ export interface CheckResponse_HeadersEntry { key: string; value: string; } +export interface ReactiveCheckResponse_HeadersEntry { + key: ComputedRef<string>; + value: ComputedRef<string>; +} export interface CheckResponse_HeadersEntryProtoMsg { typeUrl: string; value: Uint8Array; @@ -106,6 +125,12 @@ export interface CheckResponse { [key: string]: string; }; } +export interface ReactiveCheckResponse { + status?: ComputedRef<Status>; + headers: ComputedRef<{ + [key: string]: string; + }>; +} export interface CheckResponseProtoMsg { typeUrl: "/google.api.servicecontrol.v2.CheckResponse"; value: Uint8Array; @@ -141,6 +166,11 @@ export interface ReportRequest { */ operations: AttributeContext[]; } +export interface ReactiveReportRequest { + serviceName: ComputedRef<string>; + serviceConfigId: ComputedRef<string>; + operations: ComputedRef<AttributeContext[]>; +} export interface ReportRequestProtoMsg { typeUrl: "/google.api.servicecontrol.v2.ReportRequest"; value: Uint8Array; @@ -156,6 +186,7 @@ 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; @@ -177,10 +208,10 @@ function createBaseCheckRequest(): CheckRequest { export const CheckRequest = { typeUrl: "/google.api.servicecontrol.v2.CheckRequest", encode(message: CheckRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.serviceName !== undefined) { + if (message.serviceName !== "") { writer.uint32(10).string(message.serviceName); } - if (message.serviceConfigId !== undefined) { + if (message.serviceConfigId !== "") { writer.uint32(18).string(message.serviceConfigId); } if (message.attributes !== undefined) { @@ -189,7 +220,7 @@ export const CheckRequest = { for (const v of message.resources) { ResourceInfo.encode(v!, writer.uint32(34).fork()).ldelim(); } - if (message.flags !== undefined) { + if (message.flags !== "") { writer.uint32(42).string(message.flags); } return writer; @@ -224,13 +255,13 @@ export const CheckRequest = { return message; }, fromJSON(object: any): CheckRequest { - 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; + 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) : "" + }; }, toJSON(message: CheckRequest): JsonSafe<CheckRequest> { const obj: any = {}; @@ -249,9 +280,7 @@ export const CheckRequest = { const message = createBaseCheckRequest(); message.serviceName = object.serviceName ?? ""; message.serviceConfigId = object.serviceConfigId ?? ""; - if (object.attributes !== undefined && object.attributes !== null) { - message.attributes = AttributeContext.fromPartial(object.attributes); - } + message.attributes = object.attributes !== undefined && object.attributes !== null ? AttributeContext.fromPartial(object.attributes) : undefined; message.resources = object.resources?.map(e => ResourceInfo.fromPartial(e)) || []; message.flags = object.flags ?? ""; return message; @@ -345,19 +374,19 @@ function createBaseResourceInfo(): ResourceInfo { export const ResourceInfo = { typeUrl: "/google.api.servicecontrol.v2.ResourceInfo", encode(message: ResourceInfo, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.name !== undefined) { + if (message.name !== "") { writer.uint32(10).string(message.name); } - if (message.type !== undefined) { + if (message.type !== "") { writer.uint32(18).string(message.type); } - if (message.permission !== undefined) { + if (message.permission !== "") { writer.uint32(26).string(message.permission); } - if (message.container !== undefined) { + if (message.container !== "") { writer.uint32(34).string(message.container); } - if (message.location !== undefined) { + if (message.location !== "") { writer.uint32(42).string(message.location); } return writer; @@ -392,13 +421,13 @@ export const ResourceInfo = { return message; }, fromJSON(object: any): ResourceInfo { - 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; + 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) : "" + }; }, toJSON(message: ResourceInfo): JsonSafe<ResourceInfo> { const obj: any = {}; @@ -497,10 +526,10 @@ function createBaseCheckResponse_HeadersEntry(): CheckResponse_HeadersEntry { } export const CheckResponse_HeadersEntry = { encode(message: CheckResponse_HeadersEntry, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.key !== undefined) { + if (message.key !== "") { writer.uint32(10).string(message.key); } - if (message.value !== undefined) { + if (message.value !== "") { writer.uint32(18).string(message.value); } return writer; @@ -526,10 +555,10 @@ export const CheckResponse_HeadersEntry = { return message; }, fromJSON(object: any): CheckResponse_HeadersEntry { - const obj = createBaseCheckResponse_HeadersEntry(); - if (isSet(object.key)) obj.key = String(object.key); - if (isSet(object.value)) obj.value = String(object.value); - return obj; + return { + key: isSet(object.key) ? String(object.key) : "", + value: isSet(object.value) ? String(object.value) : "" + }; }, toJSON(message: CheckResponse_HeadersEntry): JsonSafe<CheckResponse_HeadersEntry> { const obj: any = {}; @@ -631,15 +660,15 @@ export const CheckResponse = { return message; }, fromJSON(object: any): CheckResponse { - 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; + 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; + }, {}) : {} + }; }, toJSON(message: CheckResponse): JsonSafe<CheckResponse> { const obj: any = {}; @@ -654,9 +683,7 @@ export const CheckResponse = { }, fromPartial(object: DeepPartial<CheckResponse>): CheckResponse { const message = createBaseCheckResponse(); - if (object.status !== undefined && object.status !== null) { - message.status = Status.fromPartial(object.status); - } + message.status = object.status !== undefined && object.status !== null ? Status.fromPartial(object.status) : undefined; message.headers = Object.entries(object.headers ?? {}).reduce<{ [key: string]: string; }>((acc, [key, value]) => { @@ -752,10 +779,10 @@ function createBaseReportRequest(): ReportRequest { export const ReportRequest = { typeUrl: "/google.api.servicecontrol.v2.ReportRequest", encode(message: ReportRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.serviceName !== undefined) { + if (message.serviceName !== "") { writer.uint32(10).string(message.serviceName); } - if (message.serviceConfigId !== undefined) { + if (message.serviceConfigId !== "") { writer.uint32(18).string(message.serviceConfigId); } for (const v of message.operations) { @@ -787,11 +814,11 @@ export const ReportRequest = { return message; }, fromJSON(object: any): ReportRequest { - 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; + 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)) : [] + }; }, toJSON(message: ReportRequest): JsonSafe<ReportRequest> { const obj: any = {}; @@ -897,8 +924,7 @@ export const ReportResponse = { return message; }, fromJSON(_: any): ReportResponse { - const obj = createBaseReportResponse(); - return obj; + return {}; }, toJSON(_: ReportResponse): JsonSafe<ReportResponse> { 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 17594c42ac..2d2f860e15 100644 --- a/__fixtures__/v-next/outputv4/google/api/servicemanagement/v1/resources.ts +++ b/__fixtures__/v-next/outputv4/google/api/servicemanagement/v1/resources.ts @@ -1,8 +1,9 @@ -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"; +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"; export const protobufPackage = "google.api.servicemanagement.v1"; /** Code describes the status of the operation (or one of its steps). */ export enum OperationMetadata_Status { @@ -266,6 +267,10 @@ export interface ManagedService { /** ID of the project that produces and owns this service. */ producerProjectId: string; } +export interface ReactiveManagedService { + serviceName: ComputedRef<string>; + producerProjectId: ComputedRef<string>; +} export interface ManagedServiceProtoMsg { typeUrl: "/google.api.servicemanagement.v1.ManagedService"; value: Uint8Array; @@ -292,6 +297,12 @@ export interface OperationMetadata { /** The start time of the operation. */ startTime?: Date; } +export interface ReactiveOperationMetadata { + resourceNames: ComputedRef<string[]>; + steps: ComputedRef<OperationMetadata_Step[]>; + progressPercentage: ComputedRef<number>; + startTime?: ComputedRef<Date>; +} export interface OperationMetadataProtoMsg { typeUrl: "/google.api.servicemanagement.v1.OperationMetadata"; value: Uint8Array; @@ -310,6 +321,10 @@ export interface OperationMetadata_Step { /** The status code. */ status: OperationMetadata_Status; } +export interface ReactiveOperationMetadata_Step { + description: ComputedRef<string>; + status: ComputedRef<OperationMetadata_Status>; +} export interface OperationMetadata_StepProtoMsg { typeUrl: "/google.api.servicemanagement.v1.Step"; value: Uint8Array; @@ -328,6 +343,11 @@ export interface Diagnostic { /** Message describing the error or warning. */ message: string; } +export interface ReactiveDiagnostic { + location: ComputedRef<string>; + kind: ComputedRef<Diagnostic_Kind>; + message: ComputedRef<string>; +} export interface DiagnosticProtoMsg { typeUrl: "/google.api.servicemanagement.v1.Diagnostic"; value: Uint8Array; @@ -355,6 +375,10 @@ export interface ConfigSource { */ files: ConfigFile[]; } +export interface ReactiveConfigSource { + id: ComputedRef<string>; + files: ComputedRef<ConfigFile[]>; +} export interface ConfigSourceProtoMsg { typeUrl: "/google.api.servicemanagement.v1.ConfigSource"; value: Uint8Array; @@ -376,6 +400,11 @@ export interface ConfigFile { /** The type of configuration file this represents. */ fileType: ConfigFile_FileType; } +export interface ReactiveConfigFile { + filePath: ComputedRef<string>; + fileContents: ComputedRef<Uint8Array>; + fileType: ComputedRef<ConfigFile_FileType>; +} export interface ConfigFileProtoMsg { typeUrl: "/google.api.servicemanagement.v1.ConfigFile"; value: Uint8Array; @@ -394,6 +423,9 @@ export interface ConfigRef { */ name: string; } +export interface ReactiveConfigRef { + name: ComputedRef<string>; +} export interface ConfigRefProtoMsg { typeUrl: "/google.api.servicemanagement.v1.ConfigRef"; value: Uint8Array; @@ -418,6 +450,9 @@ export interface ChangeReport { */ configChanges: ConfigChange[]; } +export interface ReactiveChangeReport { + configChanges: ComputedRef<ConfigChange[]>; +} export interface ChangeReportProtoMsg { typeUrl: "/google.api.servicemanagement.v1.ChangeReport"; value: Uint8Array; @@ -471,6 +506,15 @@ export interface Rollout { /** The name of the service associated with this Rollout. */ serviceName: string; } +export interface ReactiveRollout { + rolloutId: ComputedRef<string>; + createTime?: ComputedRef<Date>; + createdBy: ComputedRef<string>; + status: ComputedRef<Rollout_RolloutStatus>; + trafficPercentStrategy?: ComputedRef<Rollout_TrafficPercentStrategy>; + deleteServiceStrategy?: ComputedRef<Rollout_DeleteServiceStrategy>; + serviceName: ComputedRef<string>; +} export interface RolloutProtoMsg { typeUrl: "/google.api.servicemanagement.v1.Rollout"; value: Uint8Array; @@ -493,6 +537,10 @@ export interface Rollout_TrafficPercentStrategy_PercentagesEntry { key: string; value: number; } +export interface ReactiveRollout_TrafficPercentStrategy_PercentagesEntry { + key: ComputedRef<string>; + value: ComputedRef<number>; +} export interface Rollout_TrafficPercentStrategy_PercentagesEntryProtoMsg { typeUrl: string; value: Uint8Array; @@ -543,6 +591,11 @@ 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; @@ -589,6 +642,7 @@ 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; @@ -607,10 +661,10 @@ function createBaseManagedService(): ManagedService { export const ManagedService = { typeUrl: "/google.api.servicemanagement.v1.ManagedService", encode(message: ManagedService, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.serviceName !== undefined) { + if (message.serviceName !== "") { writer.uint32(18).string(message.serviceName); } - if (message.producerProjectId !== undefined) { + if (message.producerProjectId !== "") { writer.uint32(26).string(message.producerProjectId); } return writer; @@ -636,10 +690,10 @@ export const ManagedService = { return message; }, fromJSON(object: any): ManagedService { - const obj = createBaseManagedService(); - if (isSet(object.serviceName)) obj.serviceName = String(object.serviceName); - if (isSet(object.producerProjectId)) obj.producerProjectId = String(object.producerProjectId); - return obj; + return { + serviceName: isSet(object.serviceName) ? String(object.serviceName) : "", + producerProjectId: isSet(object.producerProjectId) ? String(object.producerProjectId) : "" + }; }, toJSON(message: ManagedService): JsonSafe<ManagedService> { const obj: any = {}; @@ -720,7 +774,7 @@ export const OperationMetadata = { for (const v of message.steps) { OperationMetadata_Step.encode(v!, writer.uint32(18).fork()).ldelim(); } - if (message.progressPercentage !== undefined) { + if (message.progressPercentage !== 0) { writer.uint32(24).int32(message.progressPercentage); } if (message.startTime !== undefined) { @@ -755,12 +809,12 @@ export const OperationMetadata = { return message; }, fromJSON(object: any): OperationMetadata { - 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; + 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 + }; }, toJSON(message: OperationMetadata): JsonSafe<OperationMetadata> { const obj: any = {}; @@ -871,7 +925,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 !== undefined) { + if (message.description !== "") { writer.uint32(18).string(message.description); } if (message.status !== 0) { @@ -900,10 +954,10 @@ export const OperationMetadata_Step = { return message; }, fromJSON(object: any): OperationMetadata_Step { - 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; + return { + description: isSet(object.description) ? String(object.description) : "", + status: isSet(object.status) ? operationMetadata_StatusFromJSON(object.status) : -1 + }; }, toJSON(message: OperationMetadata_Step): JsonSafe<OperationMetadata_Step> { const obj: any = {}; @@ -977,13 +1031,13 @@ function createBaseDiagnostic(): Diagnostic { export const Diagnostic = { typeUrl: "/google.api.servicemanagement.v1.Diagnostic", encode(message: Diagnostic, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.location !== undefined) { + if (message.location !== "") { writer.uint32(10).string(message.location); } if (message.kind !== 0) { writer.uint32(16).int32(message.kind); } - if (message.message !== undefined) { + if (message.message !== "") { writer.uint32(26).string(message.message); } return writer; @@ -1012,11 +1066,11 @@ export const Diagnostic = { return message; }, fromJSON(object: any): Diagnostic { - 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; + return { + location: isSet(object.location) ? String(object.location) : "", + kind: isSet(object.kind) ? diagnostic_KindFromJSON(object.kind) : -1, + message: isSet(object.message) ? String(object.message) : "" + }; }, toJSON(message: Diagnostic): JsonSafe<Diagnostic> { const obj: any = {}; @@ -1098,7 +1152,7 @@ function createBaseConfigSource(): ConfigSource { export const ConfigSource = { typeUrl: "/google.api.servicemanagement.v1.ConfigSource", encode(message: ConfigSource, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.id !== undefined) { + if (message.id !== "") { writer.uint32(42).string(message.id); } for (const v of message.files) { @@ -1127,10 +1181,10 @@ export const ConfigSource = { return message; }, fromJSON(object: any): ConfigSource { - 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; + return { + id: isSet(object.id) ? String(object.id) : "", + files: Array.isArray(object?.files) ? object.files.map((e: any) => ConfigFile.fromJSON(e)) : [] + }; }, toJSON(message: ConfigSource): JsonSafe<ConfigSource> { const obj: any = {}; @@ -1214,7 +1268,7 @@ function createBaseConfigFile(): ConfigFile { export const ConfigFile = { typeUrl: "/google.api.servicemanagement.v1.ConfigFile", encode(message: ConfigFile, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.filePath !== undefined) { + if (message.filePath !== "") { writer.uint32(10).string(message.filePath); } if (message.fileContents.length !== 0) { @@ -1249,11 +1303,11 @@ export const ConfigFile = { return message; }, fromJSON(object: any): ConfigFile { - 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; + 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 + }; }, toJSON(message: ConfigFile): JsonSafe<ConfigFile> { const obj: any = {}; @@ -1334,7 +1388,7 @@ function createBaseConfigRef(): ConfigRef { export const ConfigRef = { typeUrl: "/google.api.servicemanagement.v1.ConfigRef", encode(message: ConfigRef, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.name !== undefined) { + if (message.name !== "") { writer.uint32(10).string(message.name); } return writer; @@ -1357,9 +1411,9 @@ export const ConfigRef = { return message; }, fromJSON(object: any): ConfigRef { - const obj = createBaseConfigRef(); - if (isSet(object.name)) obj.name = String(object.name); - return obj; + return { + name: isSet(object.name) ? String(object.name) : "" + }; }, toJSON(message: ConfigRef): JsonSafe<ConfigRef> { const obj: any = {}; @@ -1445,9 +1499,9 @@ export const ChangeReport = { return message; }, fromJSON(object: any): ChangeReport { - const obj = createBaseChangeReport(); - if (Array.isArray(object?.configChanges)) obj.configChanges = object.configChanges.map((e: any) => ConfigChange.fromJSON(e)); - return obj; + return { + configChanges: Array.isArray(object?.configChanges) ? object.configChanges.map((e: any) => ConfigChange.fromJSON(e)) : [] + }; }, toJSON(message: ChangeReport): JsonSafe<ChangeReport> { const obj: any = {}; @@ -1526,13 +1580,13 @@ function createBaseRollout(): Rollout { export const Rollout = { typeUrl: "/google.api.servicemanagement.v1.Rollout", encode(message: Rollout, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.rolloutId !== undefined) { + if (message.rolloutId !== "") { writer.uint32(10).string(message.rolloutId); } if (message.createTime !== undefined) { Timestamp.encode(toTimestamp(message.createTime), writer.uint32(18).fork()).ldelim(); } - if (message.createdBy !== undefined) { + if (message.createdBy !== "") { writer.uint32(26).string(message.createdBy); } if (message.status !== 0) { @@ -1544,7 +1598,7 @@ export const Rollout = { if (message.deleteServiceStrategy !== undefined) { Rollout_DeleteServiceStrategy.encode(message.deleteServiceStrategy, writer.uint32(1602).fork()).ldelim(); } - if (message.serviceName !== undefined) { + if (message.serviceName !== "") { writer.uint32(66).string(message.serviceName); } return writer; @@ -1585,15 +1639,15 @@ export const Rollout = { return message; }, fromJSON(object: any): Rollout { - 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; + 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) : "" + }; }, toJSON(message: Rollout): JsonSafe<Rollout> { const obj: any = {}; @@ -1612,12 +1666,8 @@ export const Rollout = { message.createTime = object.createTime ?? undefined; message.createdBy = object.createdBy ?? ""; message.status = object.status ?? 0; - 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.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; message.serviceName = object.serviceName ?? ""; return message; }, @@ -1714,10 +1764,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 !== undefined) { + if (message.key !== "") { writer.uint32(10).string(message.key); } - if (message.value !== undefined) { + if (message.value !== 0) { writer.uint32(17).double(message.value); } return writer; @@ -1743,10 +1793,10 @@ export const Rollout_TrafficPercentStrategy_PercentagesEntry = { return message; }, fromJSON(object: any): Rollout_TrafficPercentStrategy_PercentagesEntry { - 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; + return { + key: isSet(object.key) ? String(object.key) : "", + value: isSet(object.value) ? Number(object.value) : 0 + }; }, toJSON(message: Rollout_TrafficPercentStrategy_PercentagesEntry): JsonSafe<Rollout_TrafficPercentStrategy_PercentagesEntry> { const obj: any = {}; @@ -1841,14 +1891,14 @@ export const Rollout_TrafficPercentStrategy = { return message; }, fromJSON(object: any): Rollout_TrafficPercentStrategy { - 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; + return { + percentages: isObject(object.percentages) ? Object.entries(object.percentages).reduce<{ + [key: string]: double; + }>((acc, [key, value]) => { + acc[key] = double.fromJSON(value); + return acc; + }, {}) : {} + }; }, toJSON(message: Rollout_TrafficPercentStrategy): JsonSafe<Rollout_TrafficPercentStrategy> { const obj: any = {}; @@ -1963,8 +2013,7 @@ export const Rollout_DeleteServiceStrategy = { return message; }, fromJSON(_: any): Rollout_DeleteServiceStrategy { - const obj = createBaseRollout_DeleteServiceStrategy(); - return obj; + return {}; }, toJSON(_: Rollout_DeleteServiceStrategy): JsonSafe<Rollout_DeleteServiceStrategy> { 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 357688baca..eea858905a 100644 --- a/__fixtures__/v-next/outputv4/google/api/servicemanagement/v1/servicemanager.ts +++ b/__fixtures__/v-next/outputv4/google/api/servicemanagement/v1/servicemanager.ts @@ -1,9 +1,10 @@ -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"; +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"; export const protobufPackage = "google.api.servicemanagement.v1"; export enum GetServiceConfigRequest_ConfigView { /** BASIC - Server response includes all fields except SourceInfo. */ @@ -67,6 +68,12 @@ export interface ListServicesRequest { /** @deprecated */ consumerId: string; } +export interface ReactiveListServicesRequest { + producerProjectId: ComputedRef<string>; + pageSize: ComputedRef<number>; + pageToken: ComputedRef<string>; + consumerId: ComputedRef<string>; +} export interface ListServicesRequestProtoMsg { typeUrl: "/google.api.servicemanagement.v1.ListServicesRequest"; value: Uint8Array; @@ -86,6 +93,10 @@ export interface ListServicesResponse { /** Token that can be passed to `ListServices` to resume a paginated query. */ nextPageToken: string; } +export interface ReactiveListServicesResponse { + services: ComputedRef<ManagedService[]>; + nextPageToken: ComputedRef<string>; +} export interface ListServicesResponseProtoMsg { typeUrl: "/google.api.servicemanagement.v1.ListServicesResponse"; value: Uint8Array; @@ -103,6 +114,9 @@ export interface GetServiceRequest { */ serviceName: string; } +export interface ReactiveGetServiceRequest { + serviceName: ComputedRef<string>; +} export interface GetServiceRequestProtoMsg { typeUrl: "/google.api.servicemanagement.v1.GetServiceRequest"; value: Uint8Array; @@ -116,6 +130,9 @@ export interface CreateServiceRequest { /** Required. Initial values for the service resource. */ service?: ManagedService; } +export interface ReactiveCreateServiceRequest { + service?: ComputedRef<ManagedService>; +} export interface CreateServiceRequestProtoMsg { typeUrl: "/google.api.servicemanagement.v1.CreateServiceRequest"; value: Uint8Array; @@ -132,6 +149,9 @@ export interface DeleteServiceRequest { */ serviceName: string; } +export interface ReactiveDeleteServiceRequest { + serviceName: ComputedRef<string>; +} export interface DeleteServiceRequestProtoMsg { typeUrl: "/google.api.servicemanagement.v1.DeleteServiceRequest"; value: Uint8Array; @@ -148,6 +168,9 @@ export interface UndeleteServiceRequest { */ serviceName: string; } +export interface ReactiveUndeleteServiceRequest { + serviceName: ComputedRef<string>; +} export interface UndeleteServiceRequestProtoMsg { typeUrl: "/google.api.servicemanagement.v1.UndeleteServiceRequest"; value: Uint8Array; @@ -161,6 +184,9 @@ export interface UndeleteServiceResponse { /** Revived service resource. */ service?: ManagedService; } +export interface ReactiveUndeleteServiceResponse { + service?: ComputedRef<ManagedService>; +} export interface UndeleteServiceResponseProtoMsg { typeUrl: "/google.api.servicemanagement.v1.UndeleteServiceResponse"; value: Uint8Array; @@ -189,6 +215,11 @@ export interface GetServiceConfigRequest { */ view: GetServiceConfigRequest_ConfigView; } +export interface ReactiveGetServiceConfigRequest { + serviceName: ComputedRef<string>; + configId: ComputedRef<string>; + view: ComputedRef<GetServiceConfigRequest_ConfigView>; +} export interface GetServiceConfigRequestProtoMsg { typeUrl: "/google.api.servicemanagement.v1.GetServiceConfigRequest"; value: Uint8Array; @@ -214,6 +245,11 @@ export interface ListServiceConfigsRequest { */ pageSize: number; } +export interface ReactiveListServiceConfigsRequest { + serviceName: ComputedRef<string>; + pageToken: ComputedRef<string>; + pageSize: ComputedRef<number>; +} export interface ListServiceConfigsRequestProtoMsg { typeUrl: "/google.api.servicemanagement.v1.ListServiceConfigsRequest"; value: Uint8Array; @@ -231,6 +267,10 @@ export interface ListServiceConfigsResponse { /** The token of the next page of results. */ nextPageToken: string; } +export interface ReactiveListServiceConfigsResponse { + serviceConfigs: ComputedRef<Service[]>; + nextPageToken: ComputedRef<string>; +} export interface ListServiceConfigsResponseProtoMsg { typeUrl: "/google.api.servicemanagement.v1.ListServiceConfigsResponse"; value: Uint8Array; @@ -250,6 +290,10 @@ export interface CreateServiceConfigRequest { /** Required. The service configuration resource. */ serviceConfig?: Service; } +export interface ReactiveCreateServiceConfigRequest { + serviceName: ComputedRef<string>; + serviceConfig?: ComputedRef<Service>; +} export interface CreateServiceConfigRequestProtoMsg { typeUrl: "/google.api.servicemanagement.v1.CreateServiceConfigRequest"; value: Uint8Array; @@ -275,6 +319,11 @@ export interface SubmitConfigSourceRequest { */ validateOnly: boolean; } +export interface ReactiveSubmitConfigSourceRequest { + serviceName: ComputedRef<string>; + configSource?: ComputedRef<ConfigSource>; + validateOnly: ComputedRef<boolean>; +} export interface SubmitConfigSourceRequestProtoMsg { typeUrl: "/google.api.servicemanagement.v1.SubmitConfigSourceRequest"; value: Uint8Array; @@ -290,6 +339,9 @@ export interface SubmitConfigSourceResponse { /** The generated service configuration. */ serviceConfig?: Service; } +export interface ReactiveSubmitConfigSourceResponse { + serviceConfig?: ComputedRef<Service>; +} export interface SubmitConfigSourceResponseProtoMsg { typeUrl: "/google.api.servicemanagement.v1.SubmitConfigSourceResponse"; value: Uint8Array; @@ -308,6 +360,10 @@ export interface CreateServiceRolloutRequest { /** Required. The rollout resource. The `service_name` field is output only. */ rollout?: Rollout; } +export interface ReactiveCreateServiceRolloutRequest { + serviceName: ComputedRef<string>; + rollout?: ComputedRef<Rollout>; +} export interface CreateServiceRolloutRequestProtoMsg { typeUrl: "/google.api.servicemanagement.v1.CreateServiceRolloutRequest"; value: Uint8Array; @@ -343,6 +399,12 @@ export interface ListServiceRolloutsRequest { */ filter: string; } +export interface ReactiveListServiceRolloutsRequest { + serviceName: ComputedRef<string>; + pageToken: ComputedRef<string>; + pageSize: ComputedRef<number>; + filter: ComputedRef<string>; +} export interface ListServiceRolloutsRequestProtoMsg { typeUrl: "/google.api.servicemanagement.v1.ListServiceRolloutsRequest"; value: Uint8Array; @@ -361,6 +423,10 @@ export interface ListServiceRolloutsResponse { /** The token of the next page of results. */ nextPageToken: string; } +export interface ReactiveListServiceRolloutsResponse { + rollouts: ComputedRef<Rollout[]>; + nextPageToken: ComputedRef<string>; +} export interface ListServiceRolloutsResponseProtoMsg { typeUrl: "/google.api.servicemanagement.v1.ListServiceRolloutsResponse"; value: Uint8Array; @@ -380,6 +446,10 @@ export interface GetServiceRolloutRequest { /** Required. The id of the rollout resource. */ rolloutId: string; } +export interface ReactiveGetServiceRolloutRequest { + serviceName: ComputedRef<string>; + rolloutId: ComputedRef<string>; +} export interface GetServiceRolloutRequestProtoMsg { typeUrl: "/google.api.servicemanagement.v1.GetServiceRolloutRequest"; value: Uint8Array; @@ -408,6 +478,10 @@ export interface GenerateConfigReportRequest { */ oldConfig?: Any; } +export interface ReactiveGenerateConfigReportRequest { + newConfig?: ComputedRef<Any>; + oldConfig?: ComputedRef<Any>; +} export interface GenerateConfigReportRequestProtoMsg { typeUrl: "/google.api.servicemanagement.v1.GenerateConfigReportRequest"; value: Uint8Array; @@ -435,6 +509,12 @@ export interface GenerateConfigReportResponse { */ diagnostics: Diagnostic[]; } +export interface ReactiveGenerateConfigReportResponse { + serviceName: ComputedRef<string>; + id: ComputedRef<string>; + changeReports: ComputedRef<ChangeReport[]>; + diagnostics: ComputedRef<Diagnostic[]>; +} export interface GenerateConfigReportResponseProtoMsg { typeUrl: "/google.api.servicemanagement.v1.GenerateConfigReportResponse"; value: Uint8Array; @@ -457,16 +537,16 @@ function createBaseListServicesRequest(): ListServicesRequest { export const ListServicesRequest = { typeUrl: "/google.api.servicemanagement.v1.ListServicesRequest", encode(message: ListServicesRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.producerProjectId !== undefined) { + if (message.producerProjectId !== "") { writer.uint32(10).string(message.producerProjectId); } - if (message.pageSize !== undefined) { + if (message.pageSize !== 0) { writer.uint32(40).int32(message.pageSize); } - if (message.pageToken !== undefined) { + if (message.pageToken !== "") { writer.uint32(50).string(message.pageToken); } - if (message.consumerId !== undefined) { + if (message.consumerId !== "") { writer.uint32(58).string(message.consumerId); } return writer; @@ -498,12 +578,12 @@ export const ListServicesRequest = { return message; }, fromJSON(object: any): ListServicesRequest { - 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; + 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) : "" + }; }, toJSON(message: ListServicesRequest): JsonSafe<ListServicesRequest> { const obj: any = {}; @@ -597,7 +677,7 @@ export const ListServicesResponse = { for (const v of message.services) { ManagedService.encode(v!, writer.uint32(10).fork()).ldelim(); } - if (message.nextPageToken !== undefined) { + if (message.nextPageToken !== "") { writer.uint32(18).string(message.nextPageToken); } return writer; @@ -623,10 +703,10 @@ export const ListServicesResponse = { return message; }, fromJSON(object: any): ListServicesResponse { - 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; + return { + services: Array.isArray(object?.services) ? object.services.map((e: any) => ManagedService.fromJSON(e)) : [], + nextPageToken: isSet(object.nextPageToken) ? String(object.nextPageToken) : "" + }; }, toJSON(message: ListServicesResponse): JsonSafe<ListServicesResponse> { const obj: any = {}; @@ -708,7 +788,7 @@ function createBaseGetServiceRequest(): GetServiceRequest { export const GetServiceRequest = { typeUrl: "/google.api.servicemanagement.v1.GetServiceRequest", encode(message: GetServiceRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.serviceName !== undefined) { + if (message.serviceName !== "") { writer.uint32(10).string(message.serviceName); } return writer; @@ -731,9 +811,9 @@ export const GetServiceRequest = { return message; }, fromJSON(object: any): GetServiceRequest { - const obj = createBaseGetServiceRequest(); - if (isSet(object.serviceName)) obj.serviceName = String(object.serviceName); - return obj; + return { + serviceName: isSet(object.serviceName) ? String(object.serviceName) : "" + }; }, toJSON(message: GetServiceRequest): JsonSafe<GetServiceRequest> { const obj: any = {}; @@ -819,9 +899,9 @@ export const CreateServiceRequest = { return message; }, fromJSON(object: any): CreateServiceRequest { - const obj = createBaseCreateServiceRequest(); - if (isSet(object.service)) obj.service = ManagedService.fromJSON(object.service); - return obj; + return { + service: isSet(object.service) ? ManagedService.fromJSON(object.service) : undefined + }; }, toJSON(message: CreateServiceRequest): JsonSafe<CreateServiceRequest> { const obj: any = {}; @@ -830,9 +910,7 @@ export const CreateServiceRequest = { }, fromPartial(object: DeepPartial<CreateServiceRequest>): CreateServiceRequest { const message = createBaseCreateServiceRequest(); - if (object.service !== undefined && object.service !== null) { - message.service = ManagedService.fromPartial(object.service); - } + message.service = object.service !== undefined && object.service !== null ? ManagedService.fromPartial(object.service) : undefined; return message; }, fromSDK(object: CreateServiceRequestSDKType): CreateServiceRequest { @@ -886,7 +964,7 @@ function createBaseDeleteServiceRequest(): DeleteServiceRequest { export const DeleteServiceRequest = { typeUrl: "/google.api.servicemanagement.v1.DeleteServiceRequest", encode(message: DeleteServiceRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.serviceName !== undefined) { + if (message.serviceName !== "") { writer.uint32(10).string(message.serviceName); } return writer; @@ -909,9 +987,9 @@ export const DeleteServiceRequest = { return message; }, fromJSON(object: any): DeleteServiceRequest { - const obj = createBaseDeleteServiceRequest(); - if (isSet(object.serviceName)) obj.serviceName = String(object.serviceName); - return obj; + return { + serviceName: isSet(object.serviceName) ? String(object.serviceName) : "" + }; }, toJSON(message: DeleteServiceRequest): JsonSafe<DeleteServiceRequest> { const obj: any = {}; @@ -974,7 +1052,7 @@ function createBaseUndeleteServiceRequest(): UndeleteServiceRequest { export const UndeleteServiceRequest = { typeUrl: "/google.api.servicemanagement.v1.UndeleteServiceRequest", encode(message: UndeleteServiceRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.serviceName !== undefined) { + if (message.serviceName !== "") { writer.uint32(10).string(message.serviceName); } return writer; @@ -997,9 +1075,9 @@ export const UndeleteServiceRequest = { return message; }, fromJSON(object: any): UndeleteServiceRequest { - const obj = createBaseUndeleteServiceRequest(); - if (isSet(object.serviceName)) obj.serviceName = String(object.serviceName); - return obj; + return { + serviceName: isSet(object.serviceName) ? String(object.serviceName) : "" + }; }, toJSON(message: UndeleteServiceRequest): JsonSafe<UndeleteServiceRequest> { const obj: any = {}; @@ -1085,9 +1163,9 @@ export const UndeleteServiceResponse = { return message; }, fromJSON(object: any): UndeleteServiceResponse { - const obj = createBaseUndeleteServiceResponse(); - if (isSet(object.service)) obj.service = ManagedService.fromJSON(object.service); - return obj; + return { + service: isSet(object.service) ? ManagedService.fromJSON(object.service) : undefined + }; }, toJSON(message: UndeleteServiceResponse): JsonSafe<UndeleteServiceResponse> { const obj: any = {}; @@ -1096,9 +1174,7 @@ export const UndeleteServiceResponse = { }, fromPartial(object: DeepPartial<UndeleteServiceResponse>): UndeleteServiceResponse { const message = createBaseUndeleteServiceResponse(); - if (object.service !== undefined && object.service !== null) { - message.service = ManagedService.fromPartial(object.service); - } + message.service = object.service !== undefined && object.service !== null ? ManagedService.fromPartial(object.service) : undefined; return message; }, fromSDK(object: UndeleteServiceResponseSDKType): UndeleteServiceResponse { @@ -1154,10 +1230,10 @@ function createBaseGetServiceConfigRequest(): GetServiceConfigRequest { export const GetServiceConfigRequest = { typeUrl: "/google.api.servicemanagement.v1.GetServiceConfigRequest", encode(message: GetServiceConfigRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.serviceName !== undefined) { + if (message.serviceName !== "") { writer.uint32(10).string(message.serviceName); } - if (message.configId !== undefined) { + if (message.configId !== "") { writer.uint32(18).string(message.configId); } if (message.view !== 0) { @@ -1189,11 +1265,11 @@ export const GetServiceConfigRequest = { return message; }, fromJSON(object: any): GetServiceConfigRequest { - 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; + return { + serviceName: isSet(object.serviceName) ? String(object.serviceName) : "", + configId: isSet(object.configId) ? String(object.configId) : "", + view: isSet(object.view) ? getServiceConfigRequest_ConfigViewFromJSON(object.view) : -1 + }; }, toJSON(message: GetServiceConfigRequest): JsonSafe<GetServiceConfigRequest> { const obj: any = {}; @@ -1276,13 +1352,13 @@ function createBaseListServiceConfigsRequest(): ListServiceConfigsRequest { export const ListServiceConfigsRequest = { typeUrl: "/google.api.servicemanagement.v1.ListServiceConfigsRequest", encode(message: ListServiceConfigsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.serviceName !== undefined) { + if (message.serviceName !== "") { writer.uint32(10).string(message.serviceName); } - if (message.pageToken !== undefined) { + if (message.pageToken !== "") { writer.uint32(18).string(message.pageToken); } - if (message.pageSize !== undefined) { + if (message.pageSize !== 0) { writer.uint32(24).int32(message.pageSize); } return writer; @@ -1311,11 +1387,11 @@ export const ListServiceConfigsRequest = { return message; }, fromJSON(object: any): ListServiceConfigsRequest { - 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; + return { + serviceName: isSet(object.serviceName) ? String(object.serviceName) : "", + pageToken: isSet(object.pageToken) ? String(object.pageToken) : "", + pageSize: isSet(object.pageSize) ? Number(object.pageSize) : 0 + }; }, toJSON(message: ListServiceConfigsRequest): JsonSafe<ListServiceConfigsRequest> { const obj: any = {}; @@ -1400,7 +1476,7 @@ export const ListServiceConfigsResponse = { for (const v of message.serviceConfigs) { Service.encode(v!, writer.uint32(10).fork()).ldelim(); } - if (message.nextPageToken !== undefined) { + if (message.nextPageToken !== "") { writer.uint32(18).string(message.nextPageToken); } return writer; @@ -1426,10 +1502,10 @@ export const ListServiceConfigsResponse = { return message; }, fromJSON(object: any): ListServiceConfigsResponse { - 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; + return { + serviceConfigs: Array.isArray(object?.serviceConfigs) ? object.serviceConfigs.map((e: any) => Service.fromJSON(e)) : [], + nextPageToken: isSet(object.nextPageToken) ? String(object.nextPageToken) : "" + }; }, toJSON(message: ListServiceConfigsResponse): JsonSafe<ListServiceConfigsResponse> { const obj: any = {}; @@ -1512,7 +1588,7 @@ function createBaseCreateServiceConfigRequest(): CreateServiceConfigRequest { export const CreateServiceConfigRequest = { typeUrl: "/google.api.servicemanagement.v1.CreateServiceConfigRequest", encode(message: CreateServiceConfigRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.serviceName !== undefined) { + if (message.serviceName !== "") { writer.uint32(10).string(message.serviceName); } if (message.serviceConfig !== undefined) { @@ -1541,10 +1617,10 @@ export const CreateServiceConfigRequest = { return message; }, fromJSON(object: any): CreateServiceConfigRequest { - const obj = createBaseCreateServiceConfigRequest(); - if (isSet(object.serviceName)) obj.serviceName = String(object.serviceName); - if (isSet(object.serviceConfig)) obj.serviceConfig = Service.fromJSON(object.serviceConfig); - return obj; + return { + serviceName: isSet(object.serviceName) ? String(object.serviceName) : "", + serviceConfig: isSet(object.serviceConfig) ? Service.fromJSON(object.serviceConfig) : undefined + }; }, toJSON(message: CreateServiceConfigRequest): JsonSafe<CreateServiceConfigRequest> { const obj: any = {}; @@ -1555,9 +1631,7 @@ export const CreateServiceConfigRequest = { fromPartial(object: DeepPartial<CreateServiceConfigRequest>): CreateServiceConfigRequest { const message = createBaseCreateServiceConfigRequest(); message.serviceName = object.serviceName ?? ""; - if (object.serviceConfig !== undefined && object.serviceConfig !== null) { - message.serviceConfig = Service.fromPartial(object.serviceConfig); - } + message.serviceConfig = object.serviceConfig !== undefined && object.serviceConfig !== null ? Service.fromPartial(object.serviceConfig) : undefined; return message; }, fromSDK(object: CreateServiceConfigRequestSDKType): CreateServiceConfigRequest { @@ -1620,13 +1694,13 @@ function createBaseSubmitConfigSourceRequest(): SubmitConfigSourceRequest { export const SubmitConfigSourceRequest = { typeUrl: "/google.api.servicemanagement.v1.SubmitConfigSourceRequest", encode(message: SubmitConfigSourceRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.serviceName !== undefined) { + if (message.serviceName !== "") { writer.uint32(10).string(message.serviceName); } if (message.configSource !== undefined) { ConfigSource.encode(message.configSource, writer.uint32(18).fork()).ldelim(); } - if (message.validateOnly !== undefined) { + if (message.validateOnly === true) { writer.uint32(24).bool(message.validateOnly); } return writer; @@ -1655,11 +1729,11 @@ export const SubmitConfigSourceRequest = { return message; }, fromJSON(object: any): SubmitConfigSourceRequest { - 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; + 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 + }; }, toJSON(message: SubmitConfigSourceRequest): JsonSafe<SubmitConfigSourceRequest> { const obj: any = {}; @@ -1671,9 +1745,7 @@ export const SubmitConfigSourceRequest = { fromPartial(object: DeepPartial<SubmitConfigSourceRequest>): SubmitConfigSourceRequest { const message = createBaseSubmitConfigSourceRequest(); message.serviceName = object.serviceName ?? ""; - if (object.configSource !== undefined && object.configSource !== null) { - message.configSource = ConfigSource.fromPartial(object.configSource); - } + message.configSource = object.configSource !== undefined && object.configSource !== null ? ConfigSource.fromPartial(object.configSource) : undefined; message.validateOnly = object.validateOnly ?? false; return message; }, @@ -1765,9 +1837,9 @@ export const SubmitConfigSourceResponse = { return message; }, fromJSON(object: any): SubmitConfigSourceResponse { - const obj = createBaseSubmitConfigSourceResponse(); - if (isSet(object.serviceConfig)) obj.serviceConfig = Service.fromJSON(object.serviceConfig); - return obj; + return { + serviceConfig: isSet(object.serviceConfig) ? Service.fromJSON(object.serviceConfig) : undefined + }; }, toJSON(message: SubmitConfigSourceResponse): JsonSafe<SubmitConfigSourceResponse> { const obj: any = {}; @@ -1776,9 +1848,7 @@ export const SubmitConfigSourceResponse = { }, fromPartial(object: DeepPartial<SubmitConfigSourceResponse>): SubmitConfigSourceResponse { const message = createBaseSubmitConfigSourceResponse(); - if (object.serviceConfig !== undefined && object.serviceConfig !== null) { - message.serviceConfig = Service.fromPartial(object.serviceConfig); - } + message.serviceConfig = object.serviceConfig !== undefined && object.serviceConfig !== null ? Service.fromPartial(object.serviceConfig) : undefined; return message; }, fromSDK(object: SubmitConfigSourceResponseSDKType): SubmitConfigSourceResponse { @@ -1833,7 +1903,7 @@ function createBaseCreateServiceRolloutRequest(): CreateServiceRolloutRequest { export const CreateServiceRolloutRequest = { typeUrl: "/google.api.servicemanagement.v1.CreateServiceRolloutRequest", encode(message: CreateServiceRolloutRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.serviceName !== undefined) { + if (message.serviceName !== "") { writer.uint32(10).string(message.serviceName); } if (message.rollout !== undefined) { @@ -1862,10 +1932,10 @@ export const CreateServiceRolloutRequest = { return message; }, fromJSON(object: any): CreateServiceRolloutRequest { - const obj = createBaseCreateServiceRolloutRequest(); - if (isSet(object.serviceName)) obj.serviceName = String(object.serviceName); - if (isSet(object.rollout)) obj.rollout = Rollout.fromJSON(object.rollout); - return obj; + return { + serviceName: isSet(object.serviceName) ? String(object.serviceName) : "", + rollout: isSet(object.rollout) ? Rollout.fromJSON(object.rollout) : undefined + }; }, toJSON(message: CreateServiceRolloutRequest): JsonSafe<CreateServiceRolloutRequest> { const obj: any = {}; @@ -1876,9 +1946,7 @@ export const CreateServiceRolloutRequest = { fromPartial(object: DeepPartial<CreateServiceRolloutRequest>): CreateServiceRolloutRequest { const message = createBaseCreateServiceRolloutRequest(); message.serviceName = object.serviceName ?? ""; - if (object.rollout !== undefined && object.rollout !== null) { - message.rollout = Rollout.fromPartial(object.rollout); - } + message.rollout = object.rollout !== undefined && object.rollout !== null ? Rollout.fromPartial(object.rollout) : undefined; return message; }, fromSDK(object: CreateServiceRolloutRequestSDKType): CreateServiceRolloutRequest { @@ -1942,16 +2010,16 @@ function createBaseListServiceRolloutsRequest(): ListServiceRolloutsRequest { export const ListServiceRolloutsRequest = { typeUrl: "/google.api.servicemanagement.v1.ListServiceRolloutsRequest", encode(message: ListServiceRolloutsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.serviceName !== undefined) { + if (message.serviceName !== "") { writer.uint32(10).string(message.serviceName); } - if (message.pageToken !== undefined) { + if (message.pageToken !== "") { writer.uint32(18).string(message.pageToken); } - if (message.pageSize !== undefined) { + if (message.pageSize !== 0) { writer.uint32(24).int32(message.pageSize); } - if (message.filter !== undefined) { + if (message.filter !== "") { writer.uint32(34).string(message.filter); } return writer; @@ -1983,12 +2051,12 @@ export const ListServiceRolloutsRequest = { return message; }, fromJSON(object: any): ListServiceRolloutsRequest { - 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; + 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) : "" + }; }, toJSON(message: ListServiceRolloutsRequest): JsonSafe<ListServiceRolloutsRequest> { const obj: any = {}; @@ -2082,7 +2150,7 @@ export const ListServiceRolloutsResponse = { for (const v of message.rollouts) { Rollout.encode(v!, writer.uint32(10).fork()).ldelim(); } - if (message.nextPageToken !== undefined) { + if (message.nextPageToken !== "") { writer.uint32(18).string(message.nextPageToken); } return writer; @@ -2108,10 +2176,10 @@ export const ListServiceRolloutsResponse = { return message; }, fromJSON(object: any): ListServiceRolloutsResponse { - 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; + return { + rollouts: Array.isArray(object?.rollouts) ? object.rollouts.map((e: any) => Rollout.fromJSON(e)) : [], + nextPageToken: isSet(object.nextPageToken) ? String(object.nextPageToken) : "" + }; }, toJSON(message: ListServiceRolloutsResponse): JsonSafe<ListServiceRolloutsResponse> { const obj: any = {}; @@ -2194,10 +2262,10 @@ function createBaseGetServiceRolloutRequest(): GetServiceRolloutRequest { export const GetServiceRolloutRequest = { typeUrl: "/google.api.servicemanagement.v1.GetServiceRolloutRequest", encode(message: GetServiceRolloutRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.serviceName !== undefined) { + if (message.serviceName !== "") { writer.uint32(10).string(message.serviceName); } - if (message.rolloutId !== undefined) { + if (message.rolloutId !== "") { writer.uint32(18).string(message.rolloutId); } return writer; @@ -2223,10 +2291,10 @@ export const GetServiceRolloutRequest = { return message; }, fromJSON(object: any): GetServiceRolloutRequest { - const obj = createBaseGetServiceRolloutRequest(); - if (isSet(object.serviceName)) obj.serviceName = String(object.serviceName); - if (isSet(object.rolloutId)) obj.rolloutId = String(object.rolloutId); - return obj; + return { + serviceName: isSet(object.serviceName) ? String(object.serviceName) : "", + rolloutId: isSet(object.rolloutId) ? String(object.rolloutId) : "" + }; }, toJSON(message: GetServiceRolloutRequest): JsonSafe<GetServiceRolloutRequest> { const obj: any = {}; @@ -2328,10 +2396,10 @@ export const GenerateConfigReportRequest = { return message; }, fromJSON(object: any): GenerateConfigReportRequest { - 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; + return { + newConfig: isSet(object.newConfig) ? Any.fromJSON(object.newConfig) : undefined, + oldConfig: isSet(object.oldConfig) ? Any.fromJSON(object.oldConfig) : undefined + }; }, toJSON(message: GenerateConfigReportRequest): JsonSafe<GenerateConfigReportRequest> { const obj: any = {}; @@ -2341,12 +2409,8 @@ export const GenerateConfigReportRequest = { }, fromPartial(object: DeepPartial<GenerateConfigReportRequest>): GenerateConfigReportRequest { const message = createBaseGenerateConfigReportRequest(); - 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); - } + 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; return message; }, fromSDK(object: GenerateConfigReportRequestSDKType): GenerateConfigReportRequest { @@ -2410,10 +2474,10 @@ function createBaseGenerateConfigReportResponse(): GenerateConfigReportResponse export const GenerateConfigReportResponse = { typeUrl: "/google.api.servicemanagement.v1.GenerateConfigReportResponse", encode(message: GenerateConfigReportResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.serviceName !== undefined) { + if (message.serviceName !== "") { writer.uint32(10).string(message.serviceName); } - if (message.id !== undefined) { + if (message.id !== "") { writer.uint32(18).string(message.id); } for (const v of message.changeReports) { @@ -2451,12 +2515,12 @@ export const GenerateConfigReportResponse = { return message; }, fromJSON(object: any): GenerateConfigReportResponse { - 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; + 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)) : [] + }; }, toJSON(message: GenerateConfigReportResponse): JsonSafe<GenerateConfigReportResponse> { 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 e6cdfb7531..34c3406f09 100644 --- a/__fixtures__/v-next/outputv4/google/api/serviceusage/v1/resources.ts +++ b/__fixtures__/v-next/outputv4/google/api/serviceusage/v1/resources.ts @@ -1,14 +1,15 @@ -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"; +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"; export const protobufPackage = "google.api.serviceusage.v1"; /** Whether or not a service has been enabled for use by a consumer. */ export enum State { @@ -84,6 +85,12 @@ export interface Service { /** Whether or not the service has been enabled for use by the consumer. */ state: State; } +export interface ReactiveService { + name: ComputedRef<string>; + parent: ComputedRef<string>; + config?: ComputedRef<ServiceConfig>; + state: ComputedRef<State>; +} export interface ServiceProtoMsg { typeUrl: "/google.api.serviceusage.v1.Service"; value: Uint8Array; @@ -138,6 +145,18 @@ export interface ServiceConfig { */ monitoring?: Monitoring; } +export interface ReactiveServiceConfig { + name: ComputedRef<string>; + title: ComputedRef<string>; + apis: ComputedRef<Api[]>; + documentation?: ComputedRef<Documentation>; + quota?: ComputedRef<Quota>; + authentication?: ComputedRef<Authentication>; + usage?: ComputedRef<Usage>; + endpoints: ComputedRef<Endpoint[]>; + monitoredResources: ComputedRef<MonitoredResourceDescriptor[]>; + monitoring?: ComputedRef<Monitoring>; +} export interface ServiceConfigProtoMsg { typeUrl: "/google.api.serviceusage.v1.ServiceConfig"; value: Uint8Array; @@ -163,6 +182,9 @@ export interface OperationMetadata { */ resourceNames: string[]; } +export interface ReactiveOperationMetadata { + resourceNames: ComputedRef<string[]>; +} export interface OperationMetadataProtoMsg { typeUrl: "/google.api.serviceusage.v1.OperationMetadata"; value: Uint8Array; @@ -182,10 +204,10 @@ function createBaseService(): Service { export const Service = { typeUrl: "/google.api.serviceusage.v1.Service", encode(message: Service, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.name !== undefined) { + if (message.name !== "") { writer.uint32(10).string(message.name); } - if (message.parent !== undefined) { + if (message.parent !== "") { writer.uint32(42).string(message.parent); } if (message.config !== undefined) { @@ -223,12 +245,12 @@ export const Service = { return message; }, fromJSON(object: any): Service { - 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; + 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 + }; }, toJSON(message: Service): JsonSafe<Service> { const obj: any = {}; @@ -242,9 +264,7 @@ export const Service = { const message = createBaseService(); message.name = object.name ?? ""; message.parent = object.parent ?? ""; - if (object.config !== undefined && object.config !== null) { - message.config = ServiceConfig.fromPartial(object.config); - } + message.config = object.config !== undefined && object.config !== null ? ServiceConfig.fromPartial(object.config) : undefined; message.state = object.state ?? 0; return message; }, @@ -329,10 +349,10 @@ function createBaseServiceConfig(): ServiceConfig { export const ServiceConfig = { typeUrl: "/google.api.serviceusage.v1.ServiceConfig", encode(message: ServiceConfig, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.name !== undefined) { + if (message.name !== "") { writer.uint32(10).string(message.name); } - if (message.title !== undefined) { + if (message.title !== "") { writer.uint32(18).string(message.title); } for (const v of message.apis) { @@ -406,18 +426,18 @@ export const ServiceConfig = { return message; }, fromJSON(object: any): ServiceConfig { - 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; + 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 + }; }, toJSON(message: ServiceConfig): JsonSafe<ServiceConfig> { const obj: any = {}; @@ -450,23 +470,13 @@ export const ServiceConfig = { message.name = object.name ?? ""; message.title = object.title ?? ""; message.apis = object.apis?.map(e => Api.fromPartial(e)) || []; - 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.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; message.endpoints = object.endpoints?.map(e => Endpoint.fromPartial(e)) || []; message.monitoredResources = object.monitoredResources?.map(e => MonitoredResourceDescriptor.fromPartial(e)) || []; - if (object.monitoring !== undefined && object.monitoring !== null) { - message.monitoring = Monitoring.fromPartial(object.monitoring); - } + message.monitoring = object.monitoring !== undefined && object.monitoring !== null ? Monitoring.fromPartial(object.monitoring) : undefined; return message; }, fromSDK(object: ServiceConfigSDKType): ServiceConfig { @@ -624,9 +634,9 @@ export const OperationMetadata = { return message; }, fromJSON(object: any): OperationMetadata { - const obj = createBaseOperationMetadata(); - if (Array.isArray(object?.resourceNames)) obj.resourceNames = object.resourceNames.map((e: any) => String(e)); - return obj; + return { + resourceNames: Array.isArray(object?.resourceNames) ? object.resourceNames.map((e: any) => String(e)) : [] + }; }, toJSON(message: OperationMetadata): JsonSafe<OperationMetadata> { 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 cdc8a3d1da..d44bf39e64 100644 --- a/__fixtures__/v-next/outputv4/google/api/serviceusage/v1/serviceusage.ts +++ b/__fixtures__/v-next/outputv4/google/api/serviceusage/v1/serviceusage.ts @@ -1,7 +1,8 @@ -import { Service, ServiceSDKType } from "./resources.js"; -import { BinaryReader, BinaryWriter } from "../../../../binary.js"; -import { isSet, DeepPartial } from "../../../../helpers.js"; -import { JsonSafe } from "../../../../json-safe.js"; +import { Service, ServiceSDKType } from "./resources"; +import { BinaryReader, BinaryWriter } from "../../../../binary"; +import { isSet, DeepPartial } from "../../../../helpers"; +import { JsonSafe } from "../../../../json-safe"; +import { ComputedRef } from "vue"; export const protobufPackage = "google.api.serviceusage.v1"; /** * Enum to determine if service usage should be checked when disabling a @@ -68,6 +69,9 @@ export interface EnableServiceRequest { */ name: string; } +export interface ReactiveEnableServiceRequest { + name: ComputedRef<string>; +} export interface EnableServiceRequestProtoMsg { typeUrl: "/google.api.serviceusage.v1.EnableServiceRequest"; value: Uint8Array; @@ -85,6 +89,9 @@ export interface EnableServiceResponse { /** The new state of the service after enabling. */ service?: Service; } +export interface ReactiveEnableServiceResponse { + service?: ComputedRef<Service>; +} export interface EnableServiceResponseProtoMsg { typeUrl: "/google.api.serviceusage.v1.EnableServiceResponse"; value: Uint8Array; @@ -120,6 +127,11 @@ export interface DisableServiceRequest { /** Defines the behavior for checking service usage when disabling a service. */ checkIfServiceHasUsage: DisableServiceRequest_CheckIfServiceHasUsage; } +export interface ReactiveDisableServiceRequest { + name: ComputedRef<string>; + disableDependentServices: ComputedRef<boolean>; + checkIfServiceHasUsage: ComputedRef<DisableServiceRequest_CheckIfServiceHasUsage>; +} export interface DisableServiceRequestProtoMsg { typeUrl: "/google.api.serviceusage.v1.DisableServiceRequest"; value: Uint8Array; @@ -139,6 +151,9 @@ export interface DisableServiceResponse { /** The new state of the service after disabling. */ service?: Service; } +export interface ReactiveDisableServiceResponse { + service?: ComputedRef<Service>; +} export interface DisableServiceResponseProtoMsg { typeUrl: "/google.api.serviceusage.v1.DisableServiceResponse"; value: Uint8Array; @@ -162,6 +177,9 @@ export interface GetServiceRequest { */ name: string; } +export interface ReactiveGetServiceRequest { + name: ComputedRef<string>; +} export interface GetServiceRequestProtoMsg { typeUrl: "/google.api.serviceusage.v1.GetServiceRequest"; value: Uint8Array; @@ -196,6 +214,12 @@ export interface ListServicesRequest { */ filter: string; } +export interface ReactiveListServicesRequest { + parent: ComputedRef<string>; + pageSize: ComputedRef<number>; + pageToken: ComputedRef<string>; + filter: ComputedRef<string>; +} export interface ListServicesRequestProtoMsg { typeUrl: "/google.api.serviceusage.v1.ListServicesRequest"; value: Uint8Array; @@ -217,6 +241,10 @@ export interface ListServicesResponse { */ nextPageToken: string; } +export interface ReactiveListServicesResponse { + services: ComputedRef<Service[]>; + nextPageToken: ComputedRef<string>; +} export interface ListServicesResponseProtoMsg { typeUrl: "/google.api.serviceusage.v1.ListServicesResponse"; value: Uint8Array; @@ -252,6 +280,10 @@ export interface BatchEnableServicesRequest { */ serviceIds: string[]; } +export interface ReactiveBatchEnableServicesRequest { + parent: ComputedRef<string>; + serviceIds: ComputedRef<string[]>; +} export interface BatchEnableServicesRequestProtoMsg { typeUrl: "/google.api.serviceusage.v1.BatchEnableServicesRequest"; value: Uint8Array; @@ -275,6 +307,10 @@ export interface BatchEnableServicesResponse { */ failures: BatchEnableServicesResponse_EnableFailure[]; } +export interface ReactiveBatchEnableServicesResponse { + services: ComputedRef<Service[]>; + failures: ComputedRef<BatchEnableServicesResponse_EnableFailure[]>; +} export interface BatchEnableServicesResponseProtoMsg { typeUrl: "/google.api.serviceusage.v1.BatchEnableServicesResponse"; value: Uint8Array; @@ -295,6 +331,10 @@ export interface BatchEnableServicesResponse_EnableFailure { /** An error message describing why the service could not be enabled. */ errorMessage: string; } +export interface ReactiveBatchEnableServicesResponse_EnableFailure { + serviceId: ComputedRef<string>; + errorMessage: ComputedRef<string>; +} export interface BatchEnableServicesResponse_EnableFailureProtoMsg { typeUrl: "/google.api.serviceusage.v1.EnableFailure"; value: Uint8Array; @@ -324,6 +364,10 @@ export interface BatchGetServicesRequest { */ names: string[]; } +export interface ReactiveBatchGetServicesRequest { + parent: ComputedRef<string>; + names: ComputedRef<string[]>; +} export interface BatchGetServicesRequestProtoMsg { typeUrl: "/google.api.serviceusage.v1.BatchGetServicesRequest"; value: Uint8Array; @@ -338,6 +382,9 @@ export interface BatchGetServicesResponse { /** The requested Service states. */ services: Service[]; } +export interface ReactiveBatchGetServicesResponse { + services: ComputedRef<Service[]>; +} export interface BatchGetServicesResponseProtoMsg { typeUrl: "/google.api.serviceusage.v1.BatchGetServicesResponse"; value: Uint8Array; @@ -354,7 +401,7 @@ function createBaseEnableServiceRequest(): EnableServiceRequest { export const EnableServiceRequest = { typeUrl: "/google.api.serviceusage.v1.EnableServiceRequest", encode(message: EnableServiceRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.name !== undefined) { + if (message.name !== "") { writer.uint32(10).string(message.name); } return writer; @@ -377,9 +424,9 @@ export const EnableServiceRequest = { return message; }, fromJSON(object: any): EnableServiceRequest { - const obj = createBaseEnableServiceRequest(); - if (isSet(object.name)) obj.name = String(object.name); - return obj; + return { + name: isSet(object.name) ? String(object.name) : "" + }; }, toJSON(message: EnableServiceRequest): JsonSafe<EnableServiceRequest> { const obj: any = {}; @@ -465,9 +512,9 @@ export const EnableServiceResponse = { return message; }, fromJSON(object: any): EnableServiceResponse { - const obj = createBaseEnableServiceResponse(); - if (isSet(object.service)) obj.service = Service.fromJSON(object.service); - return obj; + return { + service: isSet(object.service) ? Service.fromJSON(object.service) : undefined + }; }, toJSON(message: EnableServiceResponse): JsonSafe<EnableServiceResponse> { const obj: any = {}; @@ -476,9 +523,7 @@ export const EnableServiceResponse = { }, fromPartial(object: DeepPartial<EnableServiceResponse>): EnableServiceResponse { const message = createBaseEnableServiceResponse(); - if (object.service !== undefined && object.service !== null) { - message.service = Service.fromPartial(object.service); - } + message.service = object.service !== undefined && object.service !== null ? Service.fromPartial(object.service) : undefined; return message; }, fromSDK(object: EnableServiceResponseSDKType): EnableServiceResponse { @@ -534,10 +579,10 @@ function createBaseDisableServiceRequest(): DisableServiceRequest { export const DisableServiceRequest = { typeUrl: "/google.api.serviceusage.v1.DisableServiceRequest", encode(message: DisableServiceRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.name !== undefined) { + if (message.name !== "") { writer.uint32(10).string(message.name); } - if (message.disableDependentServices !== undefined) { + if (message.disableDependentServices === true) { writer.uint32(16).bool(message.disableDependentServices); } if (message.checkIfServiceHasUsage !== 0) { @@ -569,11 +614,11 @@ export const DisableServiceRequest = { return message; }, fromJSON(object: any): DisableServiceRequest { - 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; + 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 + }; }, toJSON(message: DisableServiceRequest): JsonSafe<DisableServiceRequest> { const obj: any = {}; @@ -677,9 +722,9 @@ export const DisableServiceResponse = { return message; }, fromJSON(object: any): DisableServiceResponse { - const obj = createBaseDisableServiceResponse(); - if (isSet(object.service)) obj.service = Service.fromJSON(object.service); - return obj; + return { + service: isSet(object.service) ? Service.fromJSON(object.service) : undefined + }; }, toJSON(message: DisableServiceResponse): JsonSafe<DisableServiceResponse> { const obj: any = {}; @@ -688,9 +733,7 @@ export const DisableServiceResponse = { }, fromPartial(object: DeepPartial<DisableServiceResponse>): DisableServiceResponse { const message = createBaseDisableServiceResponse(); - if (object.service !== undefined && object.service !== null) { - message.service = Service.fromPartial(object.service); - } + message.service = object.service !== undefined && object.service !== null ? Service.fromPartial(object.service) : undefined; return message; }, fromSDK(object: DisableServiceResponseSDKType): DisableServiceResponse { @@ -744,7 +787,7 @@ function createBaseGetServiceRequest(): GetServiceRequest { export const GetServiceRequest = { typeUrl: "/google.api.serviceusage.v1.GetServiceRequest", encode(message: GetServiceRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.name !== undefined) { + if (message.name !== "") { writer.uint32(10).string(message.name); } return writer; @@ -767,9 +810,9 @@ export const GetServiceRequest = { return message; }, fromJSON(object: any): GetServiceRequest { - const obj = createBaseGetServiceRequest(); - if (isSet(object.name)) obj.name = String(object.name); - return obj; + return { + name: isSet(object.name) ? String(object.name) : "" + }; }, toJSON(message: GetServiceRequest): JsonSafe<GetServiceRequest> { const obj: any = {}; @@ -835,16 +878,16 @@ function createBaseListServicesRequest(): ListServicesRequest { export const ListServicesRequest = { typeUrl: "/google.api.serviceusage.v1.ListServicesRequest", encode(message: ListServicesRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.parent !== undefined) { + if (message.parent !== "") { writer.uint32(10).string(message.parent); } - if (message.pageSize !== undefined) { + if (message.pageSize !== 0) { writer.uint32(16).int32(message.pageSize); } - if (message.pageToken !== undefined) { + if (message.pageToken !== "") { writer.uint32(26).string(message.pageToken); } - if (message.filter !== undefined) { + if (message.filter !== "") { writer.uint32(34).string(message.filter); } return writer; @@ -876,12 +919,12 @@ export const ListServicesRequest = { return message; }, fromJSON(object: any): ListServicesRequest { - 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; + 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) : "" + }; }, toJSON(message: ListServicesRequest): JsonSafe<ListServicesRequest> { const obj: any = {}; @@ -975,7 +1018,7 @@ export const ListServicesResponse = { for (const v of message.services) { Service.encode(v!, writer.uint32(10).fork()).ldelim(); } - if (message.nextPageToken !== undefined) { + if (message.nextPageToken !== "") { writer.uint32(18).string(message.nextPageToken); } return writer; @@ -1001,10 +1044,10 @@ export const ListServicesResponse = { return message; }, fromJSON(object: any): ListServicesResponse { - 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; + return { + services: Array.isArray(object?.services) ? object.services.map((e: any) => Service.fromJSON(e)) : [], + nextPageToken: isSet(object.nextPageToken) ? String(object.nextPageToken) : "" + }; }, toJSON(message: ListServicesResponse): JsonSafe<ListServicesResponse> { const obj: any = {}; @@ -1087,7 +1130,7 @@ function createBaseBatchEnableServicesRequest(): BatchEnableServicesRequest { export const BatchEnableServicesRequest = { typeUrl: "/google.api.serviceusage.v1.BatchEnableServicesRequest", encode(message: BatchEnableServicesRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.parent !== undefined) { + if (message.parent !== "") { writer.uint32(10).string(message.parent); } for (const v of message.serviceIds) { @@ -1116,10 +1159,10 @@ export const BatchEnableServicesRequest = { return message; }, fromJSON(object: any): BatchEnableServicesRequest { - 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; + return { + parent: isSet(object.parent) ? String(object.parent) : "", + serviceIds: Array.isArray(object?.serviceIds) ? object.serviceIds.map((e: any) => String(e)) : [] + }; }, toJSON(message: BatchEnableServicesRequest): JsonSafe<BatchEnableServicesRequest> { const obj: any = {}; @@ -1231,10 +1274,10 @@ export const BatchEnableServicesResponse = { return message; }, fromJSON(object: any): BatchEnableServicesResponse { - 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; + 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)) : [] + }; }, toJSON(message: BatchEnableServicesResponse): JsonSafe<BatchEnableServicesResponse> { const obj: any = {}; @@ -1327,10 +1370,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 !== undefined) { + if (message.serviceId !== "") { writer.uint32(10).string(message.serviceId); } - if (message.errorMessage !== undefined) { + if (message.errorMessage !== "") { writer.uint32(18).string(message.errorMessage); } return writer; @@ -1356,10 +1399,10 @@ export const BatchEnableServicesResponse_EnableFailure = { return message; }, fromJSON(object: any): BatchEnableServicesResponse_EnableFailure { - const obj = createBaseBatchEnableServicesResponse_EnableFailure(); - if (isSet(object.serviceId)) obj.serviceId = String(object.serviceId); - if (isSet(object.errorMessage)) obj.errorMessage = String(object.errorMessage); - return obj; + return { + serviceId: isSet(object.serviceId) ? String(object.serviceId) : "", + errorMessage: isSet(object.errorMessage) ? String(object.errorMessage) : "" + }; }, toJSON(message: BatchEnableServicesResponse_EnableFailure): JsonSafe<BatchEnableServicesResponse_EnableFailure> { const obj: any = {}; @@ -1432,7 +1475,7 @@ function createBaseBatchGetServicesRequest(): BatchGetServicesRequest { export const BatchGetServicesRequest = { typeUrl: "/google.api.serviceusage.v1.BatchGetServicesRequest", encode(message: BatchGetServicesRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.parent !== undefined) { + if (message.parent !== "") { writer.uint32(10).string(message.parent); } for (const v of message.names) { @@ -1461,10 +1504,10 @@ export const BatchGetServicesRequest = { return message; }, fromJSON(object: any): BatchGetServicesRequest { - 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; + return { + parent: isSet(object.parent) ? String(object.parent) : "", + names: Array.isArray(object?.names) ? object.names.map((e: any) => String(e)) : [] + }; }, toJSON(message: BatchGetServicesRequest): JsonSafe<BatchGetServicesRequest> { const obj: any = {}; @@ -1569,9 +1612,9 @@ export const BatchGetServicesResponse = { return message; }, fromJSON(object: any): BatchGetServicesResponse { - const obj = createBaseBatchGetServicesResponse(); - if (Array.isArray(object?.services)) obj.services = object.services.map((e: any) => Service.fromJSON(e)); - return obj; + return { + services: Array.isArray(object?.services) ? object.services.map((e: any) => Service.fromJSON(e)) : [] + }; }, toJSON(message: BatchGetServicesResponse): JsonSafe<BatchGetServicesResponse> { 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 165d71ab35..c4b8310752 100644 --- a/__fixtures__/v-next/outputv4/google/api/serviceusage/v1beta1/resources.ts +++ b/__fixtures__/v-next/outputv4/google/api/serviceusage/v1beta1/resources.ts @@ -1,14 +1,15 @@ -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"; +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"; export const protobufPackage = "google.api.serviceusage.v1beta1"; /** Whether or not a service has been enabled for use by a consumer. */ export enum State { @@ -185,6 +186,12 @@ export interface Service { /** Whether or not the service has been enabled for use by the consumer. */ state: State; } +export interface ReactiveService { + name: ComputedRef<string>; + parent: ComputedRef<string>; + config?: ComputedRef<ServiceConfig>; + state: ComputedRef<State>; +} export interface ServiceProtoMsg { typeUrl: "/google.api.serviceusage.v1beta1.Service"; value: Uint8Array; @@ -239,6 +246,18 @@ export interface ServiceConfig { */ monitoring?: Monitoring; } +export interface ReactiveServiceConfig { + name: ComputedRef<string>; + title: ComputedRef<string>; + apis: ComputedRef<Api[]>; + documentation?: ComputedRef<Documentation>; + quota?: ComputedRef<Quota>; + authentication?: ComputedRef<Authentication>; + usage?: ComputedRef<Usage>; + endpoints: ComputedRef<Endpoint[]>; + monitoredResources: ComputedRef<MonitoredResourceDescriptor[]>; + monitoring?: ComputedRef<Monitoring>; +} export interface ServiceConfigProtoMsg { typeUrl: "/google.api.serviceusage.v1beta1.ServiceConfig"; value: Uint8Array; @@ -264,6 +283,9 @@ export interface OperationMetadata { */ resourceNames: string[]; } +export interface ReactiveOperationMetadata { + resourceNames: ComputedRef<string[]>; +} export interface OperationMetadataProtoMsg { typeUrl: "/google.api.serviceusage.v1beta1.OperationMetadata"; value: Uint8Array; @@ -315,6 +337,14 @@ export interface ConsumerQuotaMetric { /** The units in which the metric value is reported. */ unit: string; } +export interface ReactiveConsumerQuotaMetric { + name: ComputedRef<string>; + metric: ComputedRef<string>; + displayName: ComputedRef<string>; + consumerQuotaLimits: ComputedRef<ConsumerQuotaLimit[]>; + descendantConsumerQuotaLimits: ComputedRef<ConsumerQuotaLimit[]>; + unit: ComputedRef<string>; +} export interface ConsumerQuotaMetricProtoMsg { typeUrl: "/google.api.serviceusage.v1beta1.ConsumerQuotaMetric"; value: Uint8Array; @@ -367,6 +397,14 @@ export interface ConsumerQuotaLimit { */ quotaBuckets: QuotaBucket[]; } +export interface ReactiveConsumerQuotaLimit { + name: ComputedRef<string>; + metric: ComputedRef<string>; + unit: ComputedRef<string>; + isPrecise: ComputedRef<boolean>; + allowsAdminOverrides: ComputedRef<boolean>; + quotaBuckets: ComputedRef<QuotaBucket[]>; +} export interface ConsumerQuotaLimitProtoMsg { typeUrl: "/google.api.serviceusage.v1beta1.ConsumerQuotaLimit"; value: Uint8Array; @@ -384,6 +422,10 @@ export interface QuotaBucket_DimensionsEntry { key: string; value: string; } +export interface ReactiveQuotaBucket_DimensionsEntry { + key: ComputedRef<string>; + value: ComputedRef<string>; +} export interface QuotaBucket_DimensionsEntryProtoMsg { typeUrl: string; value: Uint8Array; @@ -427,6 +469,16 @@ export interface QuotaBucket { [key: string]: string; }; } +export interface ReactiveQuotaBucket { + effectiveLimit: ComputedRef<bigint>; + defaultLimit: ComputedRef<bigint>; + producerOverride?: ComputedRef<QuotaOverride>; + consumerOverride?: ComputedRef<QuotaOverride>; + adminOverride?: ComputedRef<QuotaOverride>; + dimensions: ComputedRef<{ + [key: string]: string; + }>; +} export interface QuotaBucketProtoMsg { typeUrl: "/google.api.serviceusage.v1beta1.QuotaBucket"; value: Uint8Array; @@ -446,6 +498,10 @@ export interface QuotaOverride_DimensionsEntry { key: string; value: string; } +export interface ReactiveQuotaOverride_DimensionsEntry { + key: ComputedRef<string>; + value: ComputedRef<string>; +} export interface QuotaOverride_DimensionsEntryProtoMsg { typeUrl: string; value: Uint8Array; @@ -523,6 +579,16 @@ export interface QuotaOverride { */ adminOverrideAncestor: string; } +export interface ReactiveQuotaOverride { + name: ComputedRef<string>; + overrideValue: ComputedRef<bigint>; + dimensions: ComputedRef<{ + [key: string]: string; + }>; + metric: ComputedRef<string>; + unit: ComputedRef<string>; + adminOverrideAncestor: ComputedRef<string>; +} export interface QuotaOverrideProtoMsg { typeUrl: "/google.api.serviceusage.v1beta1.QuotaOverride"; value: Uint8Array; @@ -548,6 +614,9 @@ export interface OverrideInlineSource { */ overrides: QuotaOverride[]; } +export interface ReactiveOverrideInlineSource { + overrides: ComputedRef<QuotaOverride[]>; +} export interface OverrideInlineSourceProtoMsg { typeUrl: "/google.api.serviceusage.v1beta1.OverrideInlineSource"; value: Uint8Array; @@ -560,6 +629,10 @@ export interface AdminQuotaPolicy_DimensionsEntry { key: string; value: string; } +export interface ReactiveAdminQuotaPolicy_DimensionsEntry { + key: ComputedRef<string>; + value: ComputedRef<string>; +} export interface AdminQuotaPolicy_DimensionsEntryProtoMsg { typeUrl: string; value: Uint8Array; @@ -622,6 +695,16 @@ export interface AdminQuotaPolicy { */ container: string; } +export interface ReactiveAdminQuotaPolicy { + name: ComputedRef<string>; + policyValue: ComputedRef<bigint>; + dimensions: ComputedRef<{ + [key: string]: string; + }>; + metric: ComputedRef<string>; + unit: ComputedRef<string>; + container: ComputedRef<string>; +} export interface AdminQuotaPolicyProtoMsg { typeUrl: "/google.api.serviceusage.v1beta1.AdminQuotaPolicy"; value: Uint8Array; @@ -653,6 +736,10 @@ export interface ServiceIdentity { */ uniqueId: string; } +export interface ReactiveServiceIdentity { + email: ComputedRef<string>; + uniqueId: ComputedRef<string>; +} export interface ServiceIdentityProtoMsg { typeUrl: "/google.api.serviceusage.v1beta1.ServiceIdentity"; value: Uint8Array; @@ -676,10 +763,10 @@ function createBaseService(): Service { export const Service = { typeUrl: "/google.api.serviceusage.v1beta1.Service", encode(message: Service, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.name !== undefined) { + if (message.name !== "") { writer.uint32(10).string(message.name); } - if (message.parent !== undefined) { + if (message.parent !== "") { writer.uint32(42).string(message.parent); } if (message.config !== undefined) { @@ -717,12 +804,12 @@ export const Service = { return message; }, fromJSON(object: any): Service { - 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; + 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 + }; }, toJSON(message: Service): JsonSafe<Service> { const obj: any = {}; @@ -736,9 +823,7 @@ export const Service = { const message = createBaseService(); message.name = object.name ?? ""; message.parent = object.parent ?? ""; - if (object.config !== undefined && object.config !== null) { - message.config = ServiceConfig.fromPartial(object.config); - } + message.config = object.config !== undefined && object.config !== null ? ServiceConfig.fromPartial(object.config) : undefined; message.state = object.state ?? 0; return message; }, @@ -823,10 +908,10 @@ function createBaseServiceConfig(): ServiceConfig { export const ServiceConfig = { typeUrl: "/google.api.serviceusage.v1beta1.ServiceConfig", encode(message: ServiceConfig, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.name !== undefined) { + if (message.name !== "") { writer.uint32(10).string(message.name); } - if (message.title !== undefined) { + if (message.title !== "") { writer.uint32(18).string(message.title); } for (const v of message.apis) { @@ -900,18 +985,18 @@ export const ServiceConfig = { return message; }, fromJSON(object: any): ServiceConfig { - 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; + 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 + }; }, toJSON(message: ServiceConfig): JsonSafe<ServiceConfig> { const obj: any = {}; @@ -944,23 +1029,13 @@ export const ServiceConfig = { message.name = object.name ?? ""; message.title = object.title ?? ""; message.apis = object.apis?.map(e => Api.fromPartial(e)) || []; - 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.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; message.endpoints = object.endpoints?.map(e => Endpoint.fromPartial(e)) || []; message.monitoredResources = object.monitoredResources?.map(e => MonitoredResourceDescriptor.fromPartial(e)) || []; - if (object.monitoring !== undefined && object.monitoring !== null) { - message.monitoring = Monitoring.fromPartial(object.monitoring); - } + message.monitoring = object.monitoring !== undefined && object.monitoring !== null ? Monitoring.fromPartial(object.monitoring) : undefined; return message; }, fromSDK(object: ServiceConfigSDKType): ServiceConfig { @@ -1118,9 +1193,9 @@ export const OperationMetadata = { return message; }, fromJSON(object: any): OperationMetadata { - const obj = createBaseOperationMetadata(); - if (Array.isArray(object?.resourceNames)) obj.resourceNames = object.resourceNames.map((e: any) => String(e)); - return obj; + return { + resourceNames: Array.isArray(object?.resourceNames) ? object.resourceNames.map((e: any) => String(e)) : [] + }; }, toJSON(message: OperationMetadata): JsonSafe<OperationMetadata> { const obj: any = {}; @@ -1198,13 +1273,13 @@ function createBaseConsumerQuotaMetric(): ConsumerQuotaMetric { export const ConsumerQuotaMetric = { typeUrl: "/google.api.serviceusage.v1beta1.ConsumerQuotaMetric", encode(message: ConsumerQuotaMetric, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.name !== undefined) { + if (message.name !== "") { writer.uint32(10).string(message.name); } - if (message.metric !== undefined) { + if (message.metric !== "") { writer.uint32(34).string(message.metric); } - if (message.displayName !== undefined) { + if (message.displayName !== "") { writer.uint32(18).string(message.displayName); } for (const v of message.consumerQuotaLimits) { @@ -1213,7 +1288,7 @@ export const ConsumerQuotaMetric = { for (const v of message.descendantConsumerQuotaLimits) { ConsumerQuotaLimit.encode(v!, writer.uint32(50).fork()).ldelim(); } - if (message.unit !== undefined) { + if (message.unit !== "") { writer.uint32(42).string(message.unit); } return writer; @@ -1251,14 +1326,14 @@ export const ConsumerQuotaMetric = { return message; }, fromJSON(object: any): ConsumerQuotaMetric { - 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; + 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) : "" + }; }, toJSON(message: ConsumerQuotaMetric): JsonSafe<ConsumerQuotaMetric> { const obj: any = {}; @@ -1391,19 +1466,19 @@ function createBaseConsumerQuotaLimit(): ConsumerQuotaLimit { export const ConsumerQuotaLimit = { typeUrl: "/google.api.serviceusage.v1beta1.ConsumerQuotaLimit", encode(message: ConsumerQuotaLimit, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.name !== undefined) { + if (message.name !== "") { writer.uint32(10).string(message.name); } - if (message.metric !== undefined) { + if (message.metric !== "") { writer.uint32(66).string(message.metric); } - if (message.unit !== undefined) { + if (message.unit !== "") { writer.uint32(18).string(message.unit); } - if (message.isPrecise !== undefined) { + if (message.isPrecise === true) { writer.uint32(24).bool(message.isPrecise); } - if (message.allowsAdminOverrides !== undefined) { + if (message.allowsAdminOverrides === true) { writer.uint32(56).bool(message.allowsAdminOverrides); } for (const v of message.quotaBuckets) { @@ -1444,14 +1519,14 @@ export const ConsumerQuotaLimit = { return message; }, fromJSON(object: any): ConsumerQuotaLimit { - 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; + 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)) : [] + }; }, toJSON(message: ConsumerQuotaLimit): JsonSafe<ConsumerQuotaLimit> { const obj: any = {}; @@ -1569,10 +1644,10 @@ function createBaseQuotaBucket_DimensionsEntry(): QuotaBucket_DimensionsEntry { } export const QuotaBucket_DimensionsEntry = { encode(message: QuotaBucket_DimensionsEntry, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.key !== undefined) { + if (message.key !== "") { writer.uint32(10).string(message.key); } - if (message.value !== undefined) { + if (message.value !== "") { writer.uint32(18).string(message.value); } return writer; @@ -1598,10 +1673,10 @@ export const QuotaBucket_DimensionsEntry = { return message; }, fromJSON(object: any): QuotaBucket_DimensionsEntry { - const obj = createBaseQuotaBucket_DimensionsEntry(); - if (isSet(object.key)) obj.key = String(object.key); - if (isSet(object.value)) obj.value = String(object.value); - return obj; + return { + key: isSet(object.key) ? String(object.key) : "", + value: isSet(object.value) ? String(object.value) : "" + }; }, toJSON(message: QuotaBucket_DimensionsEntry): JsonSafe<QuotaBucket_DimensionsEntry> { const obj: any = {}; @@ -1672,10 +1747,10 @@ function createBaseQuotaBucket(): QuotaBucket { export const QuotaBucket = { typeUrl: "/google.api.serviceusage.v1beta1.QuotaBucket", encode(message: QuotaBucket, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.effectiveLimit !== undefined) { + if (message.effectiveLimit !== BigInt(0)) { writer.uint32(8).int64(message.effectiveLimit); } - if (message.defaultLimit !== undefined) { + if (message.defaultLimit !== BigInt(0)) { writer.uint32(16).int64(message.defaultLimit); } if (message.producerOverride !== undefined) { @@ -1731,19 +1806,19 @@ export const QuotaBucket = { return message; }, fromJSON(object: any): QuotaBucket { - 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; + 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; + }, {}) : {} + }; }, toJSON(message: QuotaBucket): JsonSafe<QuotaBucket> { const obj: any = {}; @@ -1762,21 +1837,11 @@ export const QuotaBucket = { }, fromPartial(object: DeepPartial<QuotaBucket>): QuotaBucket { const message = createBaseQuotaBucket(); - 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.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; message.dimensions = Object.entries(object.dimensions ?? {}).reduce<{ [key: string]: string; }>((acc, [key, value]) => { @@ -1898,10 +1963,10 @@ function createBaseQuotaOverride_DimensionsEntry(): QuotaOverride_DimensionsEntr } export const QuotaOverride_DimensionsEntry = { encode(message: QuotaOverride_DimensionsEntry, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.key !== undefined) { + if (message.key !== "") { writer.uint32(10).string(message.key); } - if (message.value !== undefined) { + if (message.value !== "") { writer.uint32(18).string(message.value); } return writer; @@ -1927,10 +1992,10 @@ export const QuotaOverride_DimensionsEntry = { return message; }, fromJSON(object: any): QuotaOverride_DimensionsEntry { - const obj = createBaseQuotaOverride_DimensionsEntry(); - if (isSet(object.key)) obj.key = String(object.key); - if (isSet(object.value)) obj.value = String(object.value); - return obj; + return { + key: isSet(object.key) ? String(object.key) : "", + value: isSet(object.value) ? String(object.value) : "" + }; }, toJSON(message: QuotaOverride_DimensionsEntry): JsonSafe<QuotaOverride_DimensionsEntry> { const obj: any = {}; @@ -2001,10 +2066,10 @@ function createBaseQuotaOverride(): QuotaOverride { export const QuotaOverride = { typeUrl: "/google.api.serviceusage.v1beta1.QuotaOverride", encode(message: QuotaOverride, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.name !== undefined) { + if (message.name !== "") { writer.uint32(10).string(message.name); } - if (message.overrideValue !== undefined) { + if (message.overrideValue !== BigInt(0)) { writer.uint32(16).int64(message.overrideValue); } Object.entries(message.dimensions).forEach(([key, value]) => { @@ -2013,13 +2078,13 @@ export const QuotaOverride = { value }, writer.uint32(26).fork()).ldelim(); }); - if (message.metric !== undefined) { + if (message.metric !== "") { writer.uint32(34).string(message.metric); } - if (message.unit !== undefined) { + if (message.unit !== "") { writer.uint32(42).string(message.unit); } - if (message.adminOverrideAncestor !== undefined) { + if (message.adminOverrideAncestor !== "") { writer.uint32(50).string(message.adminOverrideAncestor); } return writer; @@ -2060,19 +2125,19 @@ export const QuotaOverride = { return message; }, fromJSON(object: any): QuotaOverride { - 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; + 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) : "" + }; }, toJSON(message: QuotaOverride): JsonSafe<QuotaOverride> { const obj: any = {}; @@ -2092,9 +2157,7 @@ export const QuotaOverride = { fromPartial(object: DeepPartial<QuotaOverride>): QuotaOverride { const message = createBaseQuotaOverride(); message.name = object.name ?? ""; - if (object.overrideValue !== undefined && object.overrideValue !== null) { - message.overrideValue = BigInt(object.overrideValue.toString()); - } + message.overrideValue = object.overrideValue !== undefined && object.overrideValue !== null ? BigInt(object.overrideValue.toString()) : BigInt(0); message.dimensions = Object.entries(object.dimensions ?? {}).reduce<{ [key: string]: string; }>((acc, [key, value]) => { @@ -2242,9 +2305,9 @@ export const OverrideInlineSource = { return message; }, fromJSON(object: any): OverrideInlineSource { - const obj = createBaseOverrideInlineSource(); - if (Array.isArray(object?.overrides)) obj.overrides = object.overrides.map((e: any) => QuotaOverride.fromJSON(e)); - return obj; + return { + overrides: Array.isArray(object?.overrides) ? object.overrides.map((e: any) => QuotaOverride.fromJSON(e)) : [] + }; }, toJSON(message: OverrideInlineSource): JsonSafe<OverrideInlineSource> { const obj: any = {}; @@ -2317,10 +2380,10 @@ function createBaseAdminQuotaPolicy_DimensionsEntry(): AdminQuotaPolicy_Dimensio } export const AdminQuotaPolicy_DimensionsEntry = { encode(message: AdminQuotaPolicy_DimensionsEntry, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.key !== undefined) { + if (message.key !== "") { writer.uint32(10).string(message.key); } - if (message.value !== undefined) { + if (message.value !== "") { writer.uint32(18).string(message.value); } return writer; @@ -2346,10 +2409,10 @@ export const AdminQuotaPolicy_DimensionsEntry = { return message; }, fromJSON(object: any): AdminQuotaPolicy_DimensionsEntry { - const obj = createBaseAdminQuotaPolicy_DimensionsEntry(); - if (isSet(object.key)) obj.key = String(object.key); - if (isSet(object.value)) obj.value = String(object.value); - return obj; + return { + key: isSet(object.key) ? String(object.key) : "", + value: isSet(object.value) ? String(object.value) : "" + }; }, toJSON(message: AdminQuotaPolicy_DimensionsEntry): JsonSafe<AdminQuotaPolicy_DimensionsEntry> { const obj: any = {}; @@ -2420,10 +2483,10 @@ function createBaseAdminQuotaPolicy(): AdminQuotaPolicy { export const AdminQuotaPolicy = { typeUrl: "/google.api.serviceusage.v1beta1.AdminQuotaPolicy", encode(message: AdminQuotaPolicy, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.name !== undefined) { + if (message.name !== "") { writer.uint32(10).string(message.name); } - if (message.policyValue !== undefined) { + if (message.policyValue !== BigInt(0)) { writer.uint32(16).int64(message.policyValue); } Object.entries(message.dimensions).forEach(([key, value]) => { @@ -2432,13 +2495,13 @@ export const AdminQuotaPolicy = { value }, writer.uint32(26).fork()).ldelim(); }); - if (message.metric !== undefined) { + if (message.metric !== "") { writer.uint32(34).string(message.metric); } - if (message.unit !== undefined) { + if (message.unit !== "") { writer.uint32(42).string(message.unit); } - if (message.container !== undefined) { + if (message.container !== "") { writer.uint32(50).string(message.container); } return writer; @@ -2479,19 +2542,19 @@ export const AdminQuotaPolicy = { return message; }, fromJSON(object: any): AdminQuotaPolicy { - 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; + 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) : "" + }; }, toJSON(message: AdminQuotaPolicy): JsonSafe<AdminQuotaPolicy> { const obj: any = {}; @@ -2511,9 +2574,7 @@ export const AdminQuotaPolicy = { fromPartial(object: DeepPartial<AdminQuotaPolicy>): AdminQuotaPolicy { const message = createBaseAdminQuotaPolicy(); message.name = object.name ?? ""; - if (object.policyValue !== undefined && object.policyValue !== null) { - message.policyValue = BigInt(object.policyValue.toString()); - } + message.policyValue = object.policyValue !== undefined && object.policyValue !== null ? BigInt(object.policyValue.toString()) : BigInt(0); message.dimensions = Object.entries(object.dimensions ?? {}).reduce<{ [key: string]: string; }>((acc, [key, value]) => { @@ -2639,10 +2700,10 @@ function createBaseServiceIdentity(): ServiceIdentity { export const ServiceIdentity = { typeUrl: "/google.api.serviceusage.v1beta1.ServiceIdentity", encode(message: ServiceIdentity, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.email !== undefined) { + if (message.email !== "") { writer.uint32(10).string(message.email); } - if (message.uniqueId !== undefined) { + if (message.uniqueId !== "") { writer.uint32(18).string(message.uniqueId); } return writer; @@ -2668,10 +2729,10 @@ export const ServiceIdentity = { return message; }, fromJSON(object: any): ServiceIdentity { - const obj = createBaseServiceIdentity(); - if (isSet(object.email)) obj.email = String(object.email); - if (isSet(object.uniqueId)) obj.uniqueId = String(object.uniqueId); - return obj; + return { + email: isSet(object.email) ? String(object.email) : "", + uniqueId: isSet(object.uniqueId) ? String(object.uniqueId) : "" + }; }, toJSON(message: ServiceIdentity): JsonSafe<ServiceIdentity> { 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 6003cb233d..3ba0cc75b7 100644 --- a/__fixtures__/v-next/outputv4/google/api/serviceusage/v1beta1/serviceusage.ts +++ b/__fixtures__/v-next/outputv4/google/api/serviceusage/v1beta1/serviceusage.ts @@ -1,8 +1,9 @@ -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"; +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"; export const protobufPackage = "google.api.serviceusage.v1beta1"; /** Enum for service identity state. */ export enum GetServiceIdentityResponse_IdentityState { @@ -58,6 +59,9 @@ export interface EnableServiceRequest { */ name: string; } +export interface ReactiveEnableServiceRequest { + name: ComputedRef<string>; +} export interface EnableServiceRequestProtoMsg { typeUrl: "/google.api.serviceusage.v1beta1.EnableServiceRequest"; value: Uint8Array; @@ -79,6 +83,9 @@ export interface DisableServiceRequest { */ name: string; } +export interface ReactiveDisableServiceRequest { + name: ComputedRef<string>; +} export interface DisableServiceRequestProtoMsg { typeUrl: "/google.api.serviceusage.v1beta1.DisableServiceRequest"; value: Uint8Array; @@ -98,6 +105,9 @@ export interface GetServiceRequest { */ name: string; } +export interface ReactiveGetServiceRequest { + name: ComputedRef<string>; +} export interface GetServiceRequestProtoMsg { typeUrl: "/google.api.serviceusage.v1beta1.GetServiceRequest"; value: Uint8Array; @@ -133,6 +143,12 @@ export interface ListServicesRequest { */ filter: string; } +export interface ReactiveListServicesRequest { + parent: ComputedRef<string>; + pageSize: ComputedRef<number>; + pageToken: ComputedRef<string>; + filter: ComputedRef<string>; +} export interface ListServicesRequestProtoMsg { typeUrl: "/google.api.serviceusage.v1beta1.ListServicesRequest"; value: Uint8Array; @@ -154,6 +170,10 @@ export interface ListServicesResponse { */ nextPageToken: string; } +export interface ReactiveListServicesResponse { + services: ComputedRef<Service[]>; + nextPageToken: ComputedRef<string>; +} export interface ListServicesResponseProtoMsg { typeUrl: "/google.api.serviceusage.v1beta1.ListServicesResponse"; value: Uint8Array; @@ -193,6 +213,10 @@ export interface BatchEnableServicesRequest { */ serviceIds: string[]; } +export interface ReactiveBatchEnableServicesRequest { + parent: ComputedRef<string>; + serviceIds: ComputedRef<string[]>; +} export interface BatchEnableServicesRequestProtoMsg { typeUrl: "/google.api.serviceusage.v1beta1.BatchEnableServicesRequest"; value: Uint8Array; @@ -223,6 +247,12 @@ export interface ListConsumerQuotaMetricsRequest { /** Specifies the level of detail for quota information in the response. */ view: QuotaView; } +export interface ReactiveListConsumerQuotaMetricsRequest { + parent: ComputedRef<string>; + pageSize: ComputedRef<number>; + pageToken: ComputedRef<string>; + view: ComputedRef<QuotaView>; +} export interface ListConsumerQuotaMetricsRequestProtoMsg { typeUrl: "/google.api.serviceusage.v1beta1.ListConsumerQuotaMetricsRequest"; value: Uint8Array; @@ -244,6 +274,10 @@ export interface ListConsumerQuotaMetricsResponse { */ nextPageToken: string; } +export interface ReactiveListConsumerQuotaMetricsResponse { + metrics: ComputedRef<ConsumerQuotaMetric[]>; + nextPageToken: ComputedRef<string>; +} export interface ListConsumerQuotaMetricsResponseProtoMsg { typeUrl: "/google.api.serviceusage.v1beta1.ListConsumerQuotaMetricsResponse"; value: Uint8Array; @@ -265,6 +299,10 @@ export interface GetConsumerQuotaMetricRequest { /** Specifies the level of detail for quota information in the response. */ view: QuotaView; } +export interface ReactiveGetConsumerQuotaMetricRequest { + name: ComputedRef<string>; + view: ComputedRef<QuotaView>; +} export interface GetConsumerQuotaMetricRequestProtoMsg { typeUrl: "/google.api.serviceusage.v1beta1.GetConsumerQuotaMetricRequest"; value: Uint8Array; @@ -286,6 +324,10 @@ export interface GetConsumerQuotaLimitRequest { /** Specifies the level of detail for quota information in the response. */ view: QuotaView; } +export interface ReactiveGetConsumerQuotaLimitRequest { + name: ComputedRef<string>; + view: ComputedRef<QuotaView>; +} export interface GetConsumerQuotaLimitRequestProtoMsg { typeUrl: "/google.api.serviceusage.v1beta1.GetConsumerQuotaLimitRequest"; value: Uint8Array; @@ -321,6 +363,12 @@ export interface CreateAdminOverrideRequest { */ forceOnly: QuotaSafetyCheck[]; } +export interface ReactiveCreateAdminOverrideRequest { + parent: ComputedRef<string>; + override?: ComputedRef<QuotaOverride>; + force: ComputedRef<boolean>; + forceOnly: ComputedRef<QuotaSafetyCheck[]>; +} export interface CreateAdminOverrideRequestProtoMsg { typeUrl: "/google.api.serviceusage.v1beta1.CreateAdminOverrideRequest"; value: Uint8Array; @@ -365,6 +413,13 @@ export interface UpdateAdminOverrideRequest { */ forceOnly: QuotaSafetyCheck[]; } +export interface ReactiveUpdateAdminOverrideRequest { + name: ComputedRef<string>; + override?: ComputedRef<QuotaOverride>; + force: ComputedRef<boolean>; + updateMask?: ComputedRef<FieldMask>; + forceOnly: ComputedRef<QuotaSafetyCheck[]>; +} export interface UpdateAdminOverrideRequestProtoMsg { typeUrl: "/google.api.serviceusage.v1beta1.UpdateAdminOverrideRequest"; value: Uint8Array; @@ -400,6 +455,11 @@ export interface DeleteAdminOverrideRequest { */ forceOnly: QuotaSafetyCheck[]; } +export interface ReactiveDeleteAdminOverrideRequest { + name: ComputedRef<string>; + force: ComputedRef<boolean>; + forceOnly: ComputedRef<QuotaSafetyCheck[]>; +} export interface DeleteAdminOverrideRequestProtoMsg { typeUrl: "/google.api.serviceusage.v1beta1.DeleteAdminOverrideRequest"; value: Uint8Array; @@ -428,6 +488,11 @@ export interface ListAdminOverridesRequest { */ pageToken: string; } +export interface ReactiveListAdminOverridesRequest { + parent: ComputedRef<string>; + pageSize: ComputedRef<number>; + pageToken: ComputedRef<string>; +} export interface ListAdminOverridesRequestProtoMsg { typeUrl: "/google.api.serviceusage.v1beta1.ListAdminOverridesRequest"; value: Uint8Array; @@ -448,6 +513,10 @@ export interface ListAdminOverridesResponse { */ nextPageToken: string; } +export interface ReactiveListAdminOverridesResponse { + overrides: ComputedRef<QuotaOverride[]>; + nextPageToken: ComputedRef<string>; +} export interface ListAdminOverridesResponseProtoMsg { typeUrl: "/google.api.serviceusage.v1beta1.ListAdminOverridesResponse"; value: Uint8Array; @@ -462,6 +531,9 @@ export interface BatchCreateAdminOverridesResponse { /** The overrides that were created. */ overrides: QuotaOverride[]; } +export interface ReactiveBatchCreateAdminOverridesResponse { + overrides: ComputedRef<QuotaOverride[]>; +} export interface BatchCreateAdminOverridesResponseProtoMsg { typeUrl: "/google.api.serviceusage.v1beta1.BatchCreateAdminOverridesResponse"; value: Uint8Array; @@ -495,6 +567,12 @@ export interface ImportAdminOverridesRequest { */ forceOnly: QuotaSafetyCheck[]; } +export interface ReactiveImportAdminOverridesRequest { + parent: ComputedRef<string>; + inlineSource?: ComputedRef<OverrideInlineSource>; + force: ComputedRef<boolean>; + forceOnly: ComputedRef<QuotaSafetyCheck[]>; +} export interface ImportAdminOverridesRequestProtoMsg { typeUrl: "/google.api.serviceusage.v1beta1.ImportAdminOverridesRequest"; value: Uint8Array; @@ -511,6 +589,9 @@ export interface ImportAdminOverridesResponse { /** The overrides that were created from the imported data. */ overrides: QuotaOverride[]; } +export interface ReactiveImportAdminOverridesResponse { + overrides: ComputedRef<QuotaOverride[]>; +} export interface ImportAdminOverridesResponseProtoMsg { typeUrl: "/google.api.serviceusage.v1beta1.ImportAdminOverridesResponse"; value: Uint8Array; @@ -525,6 +606,7 @@ 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; @@ -561,6 +643,12 @@ export interface CreateConsumerOverrideRequest { */ forceOnly: QuotaSafetyCheck[]; } +export interface ReactiveCreateConsumerOverrideRequest { + parent: ComputedRef<string>; + override?: ComputedRef<QuotaOverride>; + force: ComputedRef<boolean>; + forceOnly: ComputedRef<QuotaSafetyCheck[]>; +} export interface CreateConsumerOverrideRequestProtoMsg { typeUrl: "/google.api.serviceusage.v1beta1.CreateConsumerOverrideRequest"; value: Uint8Array; @@ -605,6 +693,13 @@ export interface UpdateConsumerOverrideRequest { */ forceOnly: QuotaSafetyCheck[]; } +export interface ReactiveUpdateConsumerOverrideRequest { + name: ComputedRef<string>; + override?: ComputedRef<QuotaOverride>; + force: ComputedRef<boolean>; + updateMask?: ComputedRef<FieldMask>; + forceOnly: ComputedRef<QuotaSafetyCheck[]>; +} export interface UpdateConsumerOverrideRequestProtoMsg { typeUrl: "/google.api.serviceusage.v1beta1.UpdateConsumerOverrideRequest"; value: Uint8Array; @@ -640,6 +735,11 @@ export interface DeleteConsumerOverrideRequest { */ forceOnly: QuotaSafetyCheck[]; } +export interface ReactiveDeleteConsumerOverrideRequest { + name: ComputedRef<string>; + force: ComputedRef<boolean>; + forceOnly: ComputedRef<QuotaSafetyCheck[]>; +} export interface DeleteConsumerOverrideRequestProtoMsg { typeUrl: "/google.api.serviceusage.v1beta1.DeleteConsumerOverrideRequest"; value: Uint8Array; @@ -668,6 +768,11 @@ export interface ListConsumerOverridesRequest { */ pageToken: string; } +export interface ReactiveListConsumerOverridesRequest { + parent: ComputedRef<string>; + pageSize: ComputedRef<number>; + pageToken: ComputedRef<string>; +} export interface ListConsumerOverridesRequestProtoMsg { typeUrl: "/google.api.serviceusage.v1beta1.ListConsumerOverridesRequest"; value: Uint8Array; @@ -688,6 +793,10 @@ export interface ListConsumerOverridesResponse { */ nextPageToken: string; } +export interface ReactiveListConsumerOverridesResponse { + overrides: ComputedRef<QuotaOverride[]>; + nextPageToken: ComputedRef<string>; +} export interface ListConsumerOverridesResponseProtoMsg { typeUrl: "/google.api.serviceusage.v1beta1.ListConsumerOverridesResponse"; value: Uint8Array; @@ -702,6 +811,9 @@ export interface BatchCreateConsumerOverridesResponse { /** The overrides that were created. */ overrides: QuotaOverride[]; } +export interface ReactiveBatchCreateConsumerOverridesResponse { + overrides: ComputedRef<QuotaOverride[]>; +} export interface BatchCreateConsumerOverridesResponseProtoMsg { typeUrl: "/google.api.serviceusage.v1beta1.BatchCreateConsumerOverridesResponse"; value: Uint8Array; @@ -735,6 +847,12 @@ export interface ImportConsumerOverridesRequest { */ forceOnly: QuotaSafetyCheck[]; } +export interface ReactiveImportConsumerOverridesRequest { + parent: ComputedRef<string>; + inlineSource?: ComputedRef<OverrideInlineSource>; + force: ComputedRef<boolean>; + forceOnly: ComputedRef<QuotaSafetyCheck[]>; +} export interface ImportConsumerOverridesRequestProtoMsg { typeUrl: "/google.api.serviceusage.v1beta1.ImportConsumerOverridesRequest"; value: Uint8Array; @@ -751,6 +869,9 @@ export interface ImportConsumerOverridesResponse { /** The overrides that were created from the imported data. */ overrides: QuotaOverride[]; } +export interface ReactiveImportConsumerOverridesResponse { + overrides: ComputedRef<QuotaOverride[]>; +} export interface ImportConsumerOverridesResponseProtoMsg { typeUrl: "/google.api.serviceusage.v1beta1.ImportConsumerOverridesResponse"; value: Uint8Array; @@ -765,6 +886,7 @@ 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; @@ -780,6 +902,9 @@ export interface ImportAdminQuotaPoliciesResponse { /** The policies that were created from the imported data. */ policies: AdminQuotaPolicy[]; } +export interface ReactiveImportAdminQuotaPoliciesResponse { + policies: ComputedRef<AdminQuotaPolicy[]>; +} export interface ImportAdminQuotaPoliciesResponseProtoMsg { typeUrl: "/google.api.serviceusage.v1beta1.ImportAdminQuotaPoliciesResponse"; value: Uint8Array; @@ -794,6 +919,7 @@ 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; @@ -810,6 +936,7 @@ 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; @@ -826,6 +953,7 @@ 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; @@ -842,6 +970,7 @@ 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; @@ -865,6 +994,9 @@ export interface GenerateServiceIdentityRequest { */ parent: string; } +export interface ReactiveGenerateServiceIdentityRequest { + parent: ComputedRef<string>; +} export interface GenerateServiceIdentityRequestProtoMsg { typeUrl: "/google.api.serviceusage.v1beta1.GenerateServiceIdentityRequest"; value: Uint8Array; @@ -884,6 +1016,10 @@ export interface GetServiceIdentityResponse { /** Service identity state. */ state: GetServiceIdentityResponse_IdentityState; } +export interface ReactiveGetServiceIdentityResponse { + identity?: ComputedRef<ServiceIdentity>; + state: ComputedRef<GetServiceIdentityResponse_IdentityState>; +} export interface GetServiceIdentityResponseProtoMsg { typeUrl: "/google.api.serviceusage.v1beta1.GetServiceIdentityResponse"; value: Uint8Array; @@ -895,6 +1031,7 @@ 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; @@ -909,7 +1046,7 @@ function createBaseEnableServiceRequest(): EnableServiceRequest { export const EnableServiceRequest = { typeUrl: "/google.api.serviceusage.v1beta1.EnableServiceRequest", encode(message: EnableServiceRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.name !== undefined) { + if (message.name !== "") { writer.uint32(10).string(message.name); } return writer; @@ -932,9 +1069,9 @@ export const EnableServiceRequest = { return message; }, fromJSON(object: any): EnableServiceRequest { - const obj = createBaseEnableServiceRequest(); - if (isSet(object.name)) obj.name = String(object.name); - return obj; + return { + name: isSet(object.name) ? String(object.name) : "" + }; }, toJSON(message: EnableServiceRequest): JsonSafe<EnableServiceRequest> { const obj: any = {}; @@ -997,7 +1134,7 @@ function createBaseDisableServiceRequest(): DisableServiceRequest { export const DisableServiceRequest = { typeUrl: "/google.api.serviceusage.v1beta1.DisableServiceRequest", encode(message: DisableServiceRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.name !== undefined) { + if (message.name !== "") { writer.uint32(10).string(message.name); } return writer; @@ -1020,9 +1157,9 @@ export const DisableServiceRequest = { return message; }, fromJSON(object: any): DisableServiceRequest { - const obj = createBaseDisableServiceRequest(); - if (isSet(object.name)) obj.name = String(object.name); - return obj; + return { + name: isSet(object.name) ? String(object.name) : "" + }; }, toJSON(message: DisableServiceRequest): JsonSafe<DisableServiceRequest> { const obj: any = {}; @@ -1085,7 +1222,7 @@ function createBaseGetServiceRequest(): GetServiceRequest { export const GetServiceRequest = { typeUrl: "/google.api.serviceusage.v1beta1.GetServiceRequest", encode(message: GetServiceRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.name !== undefined) { + if (message.name !== "") { writer.uint32(10).string(message.name); } return writer; @@ -1108,9 +1245,9 @@ export const GetServiceRequest = { return message; }, fromJSON(object: any): GetServiceRequest { - const obj = createBaseGetServiceRequest(); - if (isSet(object.name)) obj.name = String(object.name); - return obj; + return { + name: isSet(object.name) ? String(object.name) : "" + }; }, toJSON(message: GetServiceRequest): JsonSafe<GetServiceRequest> { const obj: any = {}; @@ -1176,16 +1313,16 @@ function createBaseListServicesRequest(): ListServicesRequest { export const ListServicesRequest = { typeUrl: "/google.api.serviceusage.v1beta1.ListServicesRequest", encode(message: ListServicesRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.parent !== undefined) { + if (message.parent !== "") { writer.uint32(10).string(message.parent); } - if (message.pageSize !== undefined) { + if (message.pageSize !== 0) { writer.uint32(16).int32(message.pageSize); } - if (message.pageToken !== undefined) { + if (message.pageToken !== "") { writer.uint32(26).string(message.pageToken); } - if (message.filter !== undefined) { + if (message.filter !== "") { writer.uint32(34).string(message.filter); } return writer; @@ -1217,12 +1354,12 @@ export const ListServicesRequest = { return message; }, fromJSON(object: any): ListServicesRequest { - 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; + 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) : "" + }; }, toJSON(message: ListServicesRequest): JsonSafe<ListServicesRequest> { const obj: any = {}; @@ -1316,7 +1453,7 @@ export const ListServicesResponse = { for (const v of message.services) { Service.encode(v!, writer.uint32(10).fork()).ldelim(); } - if (message.nextPageToken !== undefined) { + if (message.nextPageToken !== "") { writer.uint32(18).string(message.nextPageToken); } return writer; @@ -1342,10 +1479,10 @@ export const ListServicesResponse = { return message; }, fromJSON(object: any): ListServicesResponse { - 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; + return { + services: Array.isArray(object?.services) ? object.services.map((e: any) => Service.fromJSON(e)) : [], + nextPageToken: isSet(object.nextPageToken) ? String(object.nextPageToken) : "" + }; }, toJSON(message: ListServicesResponse): JsonSafe<ListServicesResponse> { const obj: any = {}; @@ -1428,7 +1565,7 @@ function createBaseBatchEnableServicesRequest(): BatchEnableServicesRequest { export const BatchEnableServicesRequest = { typeUrl: "/google.api.serviceusage.v1beta1.BatchEnableServicesRequest", encode(message: BatchEnableServicesRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.parent !== undefined) { + if (message.parent !== "") { writer.uint32(10).string(message.parent); } for (const v of message.serviceIds) { @@ -1457,10 +1594,10 @@ export const BatchEnableServicesRequest = { return message; }, fromJSON(object: any): BatchEnableServicesRequest { - 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; + return { + parent: isSet(object.parent) ? String(object.parent) : "", + serviceIds: Array.isArray(object?.serviceIds) ? object.serviceIds.map((e: any) => String(e)) : [] + }; }, toJSON(message: BatchEnableServicesRequest): JsonSafe<BatchEnableServicesRequest> { const obj: any = {}; @@ -1545,13 +1682,13 @@ function createBaseListConsumerQuotaMetricsRequest(): ListConsumerQuotaMetricsRe export const ListConsumerQuotaMetricsRequest = { typeUrl: "/google.api.serviceusage.v1beta1.ListConsumerQuotaMetricsRequest", encode(message: ListConsumerQuotaMetricsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.parent !== undefined) { + if (message.parent !== "") { writer.uint32(10).string(message.parent); } - if (message.pageSize !== undefined) { + if (message.pageSize !== 0) { writer.uint32(16).int32(message.pageSize); } - if (message.pageToken !== undefined) { + if (message.pageToken !== "") { writer.uint32(26).string(message.pageToken); } if (message.view !== 0) { @@ -1586,12 +1723,12 @@ export const ListConsumerQuotaMetricsRequest = { return message; }, fromJSON(object: any): ListConsumerQuotaMetricsRequest { - 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; + 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 + }; }, toJSON(message: ListConsumerQuotaMetricsRequest): JsonSafe<ListConsumerQuotaMetricsRequest> { const obj: any = {}; @@ -1685,7 +1822,7 @@ export const ListConsumerQuotaMetricsResponse = { for (const v of message.metrics) { ConsumerQuotaMetric.encode(v!, writer.uint32(10).fork()).ldelim(); } - if (message.nextPageToken !== undefined) { + if (message.nextPageToken !== "") { writer.uint32(18).string(message.nextPageToken); } return writer; @@ -1711,10 +1848,10 @@ export const ListConsumerQuotaMetricsResponse = { return message; }, fromJSON(object: any): ListConsumerQuotaMetricsResponse { - 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; + return { + metrics: Array.isArray(object?.metrics) ? object.metrics.map((e: any) => ConsumerQuotaMetric.fromJSON(e)) : [], + nextPageToken: isSet(object.nextPageToken) ? String(object.nextPageToken) : "" + }; }, toJSON(message: ListConsumerQuotaMetricsResponse): JsonSafe<ListConsumerQuotaMetricsResponse> { const obj: any = {}; @@ -1797,7 +1934,7 @@ function createBaseGetConsumerQuotaMetricRequest(): GetConsumerQuotaMetricReques export const GetConsumerQuotaMetricRequest = { typeUrl: "/google.api.serviceusage.v1beta1.GetConsumerQuotaMetricRequest", encode(message: GetConsumerQuotaMetricRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.name !== undefined) { + if (message.name !== "") { writer.uint32(10).string(message.name); } if (message.view !== 0) { @@ -1826,10 +1963,10 @@ export const GetConsumerQuotaMetricRequest = { return message; }, fromJSON(object: any): GetConsumerQuotaMetricRequest { - const obj = createBaseGetConsumerQuotaMetricRequest(); - if (isSet(object.name)) obj.name = String(object.name); - if (isSet(object.view)) obj.view = quotaViewFromJSON(object.view); - return obj; + return { + name: isSet(object.name) ? String(object.name) : "", + view: isSet(object.view) ? quotaViewFromJSON(object.view) : -1 + }; }, toJSON(message: GetConsumerQuotaMetricRequest): JsonSafe<GetConsumerQuotaMetricRequest> { const obj: any = {}; @@ -1902,7 +2039,7 @@ function createBaseGetConsumerQuotaLimitRequest(): GetConsumerQuotaLimitRequest export const GetConsumerQuotaLimitRequest = { typeUrl: "/google.api.serviceusage.v1beta1.GetConsumerQuotaLimitRequest", encode(message: GetConsumerQuotaLimitRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.name !== undefined) { + if (message.name !== "") { writer.uint32(10).string(message.name); } if (message.view !== 0) { @@ -1931,10 +2068,10 @@ export const GetConsumerQuotaLimitRequest = { return message; }, fromJSON(object: any): GetConsumerQuotaLimitRequest { - const obj = createBaseGetConsumerQuotaLimitRequest(); - if (isSet(object.name)) obj.name = String(object.name); - if (isSet(object.view)) obj.view = quotaViewFromJSON(object.view); - return obj; + return { + name: isSet(object.name) ? String(object.name) : "", + view: isSet(object.view) ? quotaViewFromJSON(object.view) : -1 + }; }, toJSON(message: GetConsumerQuotaLimitRequest): JsonSafe<GetConsumerQuotaLimitRequest> { const obj: any = {}; @@ -2009,13 +2146,13 @@ function createBaseCreateAdminOverrideRequest(): CreateAdminOverrideRequest { export const CreateAdminOverrideRequest = { typeUrl: "/google.api.serviceusage.v1beta1.CreateAdminOverrideRequest", encode(message: CreateAdminOverrideRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.parent !== undefined) { + if (message.parent !== "") { writer.uint32(10).string(message.parent); } if (message.override !== undefined) { QuotaOverride.encode(message.override, writer.uint32(18).fork()).ldelim(); } - if (message.force !== undefined) { + if (message.force === true) { writer.uint32(24).bool(message.force); } writer.uint32(34).fork(); @@ -2059,12 +2196,12 @@ export const CreateAdminOverrideRequest = { return message; }, fromJSON(object: any): CreateAdminOverrideRequest { - 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; + 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)) : [] + }; }, toJSON(message: CreateAdminOverrideRequest): JsonSafe<CreateAdminOverrideRequest> { const obj: any = {}; @@ -2081,9 +2218,7 @@ export const CreateAdminOverrideRequest = { fromPartial(object: DeepPartial<CreateAdminOverrideRequest>): CreateAdminOverrideRequest { const message = createBaseCreateAdminOverrideRequest(); message.parent = object.parent ?? ""; - if (object.override !== undefined && object.override !== null) { - message.override = QuotaOverride.fromPartial(object.override); - } + message.override = object.override !== undefined && object.override !== null ? QuotaOverride.fromPartial(object.override) : undefined; message.force = object.force ?? false; message.forceOnly = object.forceOnly?.map(e => e) || []; return message; @@ -2170,13 +2305,13 @@ function createBaseUpdateAdminOverrideRequest(): UpdateAdminOverrideRequest { export const UpdateAdminOverrideRequest = { typeUrl: "/google.api.serviceusage.v1beta1.UpdateAdminOverrideRequest", encode(message: UpdateAdminOverrideRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.name !== undefined) { + if (message.name !== "") { writer.uint32(10).string(message.name); } if (message.override !== undefined) { QuotaOverride.encode(message.override, writer.uint32(18).fork()).ldelim(); } - if (message.force !== undefined) { + if (message.force === true) { writer.uint32(24).bool(message.force); } if (message.updateMask !== undefined) { @@ -2226,13 +2361,13 @@ export const UpdateAdminOverrideRequest = { return message; }, fromJSON(object: any): UpdateAdminOverrideRequest { - 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; + 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)) : [] + }; }, toJSON(message: UpdateAdminOverrideRequest): JsonSafe<UpdateAdminOverrideRequest> { const obj: any = {}; @@ -2250,13 +2385,9 @@ export const UpdateAdminOverrideRequest = { fromPartial(object: DeepPartial<UpdateAdminOverrideRequest>): UpdateAdminOverrideRequest { const message = createBaseUpdateAdminOverrideRequest(); message.name = object.name ?? ""; - if (object.override !== undefined && object.override !== null) { - message.override = QuotaOverride.fromPartial(object.override); - } + message.override = object.override !== undefined && object.override !== null ? QuotaOverride.fromPartial(object.override) : undefined; message.force = object.force ?? false; - if (object.updateMask !== undefined && object.updateMask !== null) { - message.updateMask = FieldMask.fromPartial(object.updateMask); - } + message.updateMask = object.updateMask !== undefined && object.updateMask !== null ? FieldMask.fromPartial(object.updateMask) : undefined; message.forceOnly = object.forceOnly?.map(e => e) || []; return message; }, @@ -2347,10 +2478,10 @@ function createBaseDeleteAdminOverrideRequest(): DeleteAdminOverrideRequest { export const DeleteAdminOverrideRequest = { typeUrl: "/google.api.serviceusage.v1beta1.DeleteAdminOverrideRequest", encode(message: DeleteAdminOverrideRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.name !== undefined) { + if (message.name !== "") { writer.uint32(10).string(message.name); } - if (message.force !== undefined) { + if (message.force === true) { writer.uint32(16).bool(message.force); } writer.uint32(26).fork(); @@ -2391,11 +2522,11 @@ export const DeleteAdminOverrideRequest = { return message; }, fromJSON(object: any): DeleteAdminOverrideRequest { - 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; + 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)) : [] + }; }, toJSON(message: DeleteAdminOverrideRequest): JsonSafe<DeleteAdminOverrideRequest> { const obj: any = {}; @@ -2488,13 +2619,13 @@ function createBaseListAdminOverridesRequest(): ListAdminOverridesRequest { export const ListAdminOverridesRequest = { typeUrl: "/google.api.serviceusage.v1beta1.ListAdminOverridesRequest", encode(message: ListAdminOverridesRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.parent !== undefined) { + if (message.parent !== "") { writer.uint32(10).string(message.parent); } - if (message.pageSize !== undefined) { + if (message.pageSize !== 0) { writer.uint32(16).int32(message.pageSize); } - if (message.pageToken !== undefined) { + if (message.pageToken !== "") { writer.uint32(26).string(message.pageToken); } return writer; @@ -2523,11 +2654,11 @@ export const ListAdminOverridesRequest = { return message; }, fromJSON(object: any): ListAdminOverridesRequest { - 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; + return { + parent: isSet(object.parent) ? String(object.parent) : "", + pageSize: isSet(object.pageSize) ? Number(object.pageSize) : 0, + pageToken: isSet(object.pageToken) ? String(object.pageToken) : "" + }; }, toJSON(message: ListAdminOverridesRequest): JsonSafe<ListAdminOverridesRequest> { const obj: any = {}; @@ -2612,7 +2743,7 @@ export const ListAdminOverridesResponse = { for (const v of message.overrides) { QuotaOverride.encode(v!, writer.uint32(10).fork()).ldelim(); } - if (message.nextPageToken !== undefined) { + if (message.nextPageToken !== "") { writer.uint32(18).string(message.nextPageToken); } return writer; @@ -2638,10 +2769,10 @@ export const ListAdminOverridesResponse = { return message; }, fromJSON(object: any): ListAdminOverridesResponse { - 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; + return { + overrides: Array.isArray(object?.overrides) ? object.overrides.map((e: any) => QuotaOverride.fromJSON(e)) : [], + nextPageToken: isSet(object.nextPageToken) ? String(object.nextPageToken) : "" + }; }, toJSON(message: ListAdminOverridesResponse): JsonSafe<ListAdminOverridesResponse> { const obj: any = {}; @@ -2746,9 +2877,9 @@ export const BatchCreateAdminOverridesResponse = { return message; }, fromJSON(object: any): BatchCreateAdminOverridesResponse { - const obj = createBaseBatchCreateAdminOverridesResponse(); - if (Array.isArray(object?.overrides)) obj.overrides = object.overrides.map((e: any) => QuotaOverride.fromJSON(e)); - return obj; + return { + overrides: Array.isArray(object?.overrides) ? object.overrides.map((e: any) => QuotaOverride.fromJSON(e)) : [] + }; }, toJSON(message: BatchCreateAdminOverridesResponse): JsonSafe<BatchCreateAdminOverridesResponse> { const obj: any = {}; @@ -2824,13 +2955,13 @@ function createBaseImportAdminOverridesRequest(): ImportAdminOverridesRequest { export const ImportAdminOverridesRequest = { typeUrl: "/google.api.serviceusage.v1beta1.ImportAdminOverridesRequest", encode(message: ImportAdminOverridesRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.parent !== undefined) { + if (message.parent !== "") { writer.uint32(10).string(message.parent); } if (message.inlineSource !== undefined) { OverrideInlineSource.encode(message.inlineSource, writer.uint32(18).fork()).ldelim(); } - if (message.force !== undefined) { + if (message.force === true) { writer.uint32(24).bool(message.force); } writer.uint32(34).fork(); @@ -2874,12 +3005,12 @@ export const ImportAdminOverridesRequest = { return message; }, fromJSON(object: any): ImportAdminOverridesRequest { - 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; + 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)) : [] + }; }, toJSON(message: ImportAdminOverridesRequest): JsonSafe<ImportAdminOverridesRequest> { const obj: any = {}; @@ -2896,9 +3027,7 @@ export const ImportAdminOverridesRequest = { fromPartial(object: DeepPartial<ImportAdminOverridesRequest>): ImportAdminOverridesRequest { const message = createBaseImportAdminOverridesRequest(); message.parent = object.parent ?? ""; - if (object.inlineSource !== undefined && object.inlineSource !== null) { - message.inlineSource = OverrideInlineSource.fromPartial(object.inlineSource); - } + message.inlineSource = object.inlineSource !== undefined && object.inlineSource !== null ? OverrideInlineSource.fromPartial(object.inlineSource) : undefined; message.force = object.force ?? false; message.forceOnly = object.forceOnly?.map(e => e) || []; return message; @@ -3004,9 +3133,9 @@ export const ImportAdminOverridesResponse = { return message; }, fromJSON(object: any): ImportAdminOverridesResponse { - const obj = createBaseImportAdminOverridesResponse(); - if (Array.isArray(object?.overrides)) obj.overrides = object.overrides.map((e: any) => QuotaOverride.fromJSON(e)); - return obj; + return { + overrides: Array.isArray(object?.overrides) ? object.overrides.map((e: any) => QuotaOverride.fromJSON(e)) : [] + }; }, toJSON(message: ImportAdminOverridesResponse): JsonSafe<ImportAdminOverridesResponse> { const obj: any = {}; @@ -3094,8 +3223,7 @@ export const ImportAdminOverridesMetadata = { return message; }, fromJSON(_: any): ImportAdminOverridesMetadata { - const obj = createBaseImportAdminOverridesMetadata(); - return obj; + return {}; }, toJSON(_: ImportAdminOverridesMetadata): JsonSafe<ImportAdminOverridesMetadata> { const obj: any = {}; @@ -3150,13 +3278,13 @@ function createBaseCreateConsumerOverrideRequest(): CreateConsumerOverrideReques export const CreateConsumerOverrideRequest = { typeUrl: "/google.api.serviceusage.v1beta1.CreateConsumerOverrideRequest", encode(message: CreateConsumerOverrideRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.parent !== undefined) { + if (message.parent !== "") { writer.uint32(10).string(message.parent); } if (message.override !== undefined) { QuotaOverride.encode(message.override, writer.uint32(18).fork()).ldelim(); } - if (message.force !== undefined) { + if (message.force === true) { writer.uint32(24).bool(message.force); } writer.uint32(34).fork(); @@ -3200,12 +3328,12 @@ export const CreateConsumerOverrideRequest = { return message; }, fromJSON(object: any): CreateConsumerOverrideRequest { - 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; + 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)) : [] + }; }, toJSON(message: CreateConsumerOverrideRequest): JsonSafe<CreateConsumerOverrideRequest> { const obj: any = {}; @@ -3222,9 +3350,7 @@ export const CreateConsumerOverrideRequest = { fromPartial(object: DeepPartial<CreateConsumerOverrideRequest>): CreateConsumerOverrideRequest { const message = createBaseCreateConsumerOverrideRequest(); message.parent = object.parent ?? ""; - if (object.override !== undefined && object.override !== null) { - message.override = QuotaOverride.fromPartial(object.override); - } + message.override = object.override !== undefined && object.override !== null ? QuotaOverride.fromPartial(object.override) : undefined; message.force = object.force ?? false; message.forceOnly = object.forceOnly?.map(e => e) || []; return message; @@ -3311,13 +3437,13 @@ function createBaseUpdateConsumerOverrideRequest(): UpdateConsumerOverrideReques export const UpdateConsumerOverrideRequest = { typeUrl: "/google.api.serviceusage.v1beta1.UpdateConsumerOverrideRequest", encode(message: UpdateConsumerOverrideRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.name !== undefined) { + if (message.name !== "") { writer.uint32(10).string(message.name); } if (message.override !== undefined) { QuotaOverride.encode(message.override, writer.uint32(18).fork()).ldelim(); } - if (message.force !== undefined) { + if (message.force === true) { writer.uint32(24).bool(message.force); } if (message.updateMask !== undefined) { @@ -3367,13 +3493,13 @@ export const UpdateConsumerOverrideRequest = { return message; }, fromJSON(object: any): UpdateConsumerOverrideRequest { - 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; + 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)) : [] + }; }, toJSON(message: UpdateConsumerOverrideRequest): JsonSafe<UpdateConsumerOverrideRequest> { const obj: any = {}; @@ -3391,13 +3517,9 @@ export const UpdateConsumerOverrideRequest = { fromPartial(object: DeepPartial<UpdateConsumerOverrideRequest>): UpdateConsumerOverrideRequest { const message = createBaseUpdateConsumerOverrideRequest(); message.name = object.name ?? ""; - if (object.override !== undefined && object.override !== null) { - message.override = QuotaOverride.fromPartial(object.override); - } + message.override = object.override !== undefined && object.override !== null ? QuotaOverride.fromPartial(object.override) : undefined; message.force = object.force ?? false; - if (object.updateMask !== undefined && object.updateMask !== null) { - message.updateMask = FieldMask.fromPartial(object.updateMask); - } + message.updateMask = object.updateMask !== undefined && object.updateMask !== null ? FieldMask.fromPartial(object.updateMask) : undefined; message.forceOnly = object.forceOnly?.map(e => e) || []; return message; }, @@ -3488,10 +3610,10 @@ function createBaseDeleteConsumerOverrideRequest(): DeleteConsumerOverrideReques export const DeleteConsumerOverrideRequest = { typeUrl: "/google.api.serviceusage.v1beta1.DeleteConsumerOverrideRequest", encode(message: DeleteConsumerOverrideRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.name !== undefined) { + if (message.name !== "") { writer.uint32(10).string(message.name); } - if (message.force !== undefined) { + if (message.force === true) { writer.uint32(16).bool(message.force); } writer.uint32(26).fork(); @@ -3532,11 +3654,11 @@ export const DeleteConsumerOverrideRequest = { return message; }, fromJSON(object: any): DeleteConsumerOverrideRequest { - 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; + 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)) : [] + }; }, toJSON(message: DeleteConsumerOverrideRequest): JsonSafe<DeleteConsumerOverrideRequest> { const obj: any = {}; @@ -3629,13 +3751,13 @@ function createBaseListConsumerOverridesRequest(): ListConsumerOverridesRequest export const ListConsumerOverridesRequest = { typeUrl: "/google.api.serviceusage.v1beta1.ListConsumerOverridesRequest", encode(message: ListConsumerOverridesRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.parent !== undefined) { + if (message.parent !== "") { writer.uint32(10).string(message.parent); } - if (message.pageSize !== undefined) { + if (message.pageSize !== 0) { writer.uint32(16).int32(message.pageSize); } - if (message.pageToken !== undefined) { + if (message.pageToken !== "") { writer.uint32(26).string(message.pageToken); } return writer; @@ -3664,11 +3786,11 @@ export const ListConsumerOverridesRequest = { return message; }, fromJSON(object: any): ListConsumerOverridesRequest { - 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; + return { + parent: isSet(object.parent) ? String(object.parent) : "", + pageSize: isSet(object.pageSize) ? Number(object.pageSize) : 0, + pageToken: isSet(object.pageToken) ? String(object.pageToken) : "" + }; }, toJSON(message: ListConsumerOverridesRequest): JsonSafe<ListConsumerOverridesRequest> { const obj: any = {}; @@ -3753,7 +3875,7 @@ export const ListConsumerOverridesResponse = { for (const v of message.overrides) { QuotaOverride.encode(v!, writer.uint32(10).fork()).ldelim(); } - if (message.nextPageToken !== undefined) { + if (message.nextPageToken !== "") { writer.uint32(18).string(message.nextPageToken); } return writer; @@ -3779,10 +3901,10 @@ export const ListConsumerOverridesResponse = { return message; }, fromJSON(object: any): ListConsumerOverridesResponse { - 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; + return { + overrides: Array.isArray(object?.overrides) ? object.overrides.map((e: any) => QuotaOverride.fromJSON(e)) : [], + nextPageToken: isSet(object.nextPageToken) ? String(object.nextPageToken) : "" + }; }, toJSON(message: ListConsumerOverridesResponse): JsonSafe<ListConsumerOverridesResponse> { const obj: any = {}; @@ -3887,9 +4009,9 @@ export const BatchCreateConsumerOverridesResponse = { return message; }, fromJSON(object: any): BatchCreateConsumerOverridesResponse { - const obj = createBaseBatchCreateConsumerOverridesResponse(); - if (Array.isArray(object?.overrides)) obj.overrides = object.overrides.map((e: any) => QuotaOverride.fromJSON(e)); - return obj; + return { + overrides: Array.isArray(object?.overrides) ? object.overrides.map((e: any) => QuotaOverride.fromJSON(e)) : [] + }; }, toJSON(message: BatchCreateConsumerOverridesResponse): JsonSafe<BatchCreateConsumerOverridesResponse> { const obj: any = {}; @@ -3965,13 +4087,13 @@ function createBaseImportConsumerOverridesRequest(): ImportConsumerOverridesRequ export const ImportConsumerOverridesRequest = { typeUrl: "/google.api.serviceusage.v1beta1.ImportConsumerOverridesRequest", encode(message: ImportConsumerOverridesRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.parent !== undefined) { + if (message.parent !== "") { writer.uint32(10).string(message.parent); } if (message.inlineSource !== undefined) { OverrideInlineSource.encode(message.inlineSource, writer.uint32(18).fork()).ldelim(); } - if (message.force !== undefined) { + if (message.force === true) { writer.uint32(24).bool(message.force); } writer.uint32(34).fork(); @@ -4015,12 +4137,12 @@ export const ImportConsumerOverridesRequest = { return message; }, fromJSON(object: any): ImportConsumerOverridesRequest { - 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; + 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)) : [] + }; }, toJSON(message: ImportConsumerOverridesRequest): JsonSafe<ImportConsumerOverridesRequest> { const obj: any = {}; @@ -4037,9 +4159,7 @@ export const ImportConsumerOverridesRequest = { fromPartial(object: DeepPartial<ImportConsumerOverridesRequest>): ImportConsumerOverridesRequest { const message = createBaseImportConsumerOverridesRequest(); message.parent = object.parent ?? ""; - if (object.inlineSource !== undefined && object.inlineSource !== null) { - message.inlineSource = OverrideInlineSource.fromPartial(object.inlineSource); - } + message.inlineSource = object.inlineSource !== undefined && object.inlineSource !== null ? OverrideInlineSource.fromPartial(object.inlineSource) : undefined; message.force = object.force ?? false; message.forceOnly = object.forceOnly?.map(e => e) || []; return message; @@ -4145,9 +4265,9 @@ export const ImportConsumerOverridesResponse = { return message; }, fromJSON(object: any): ImportConsumerOverridesResponse { - const obj = createBaseImportConsumerOverridesResponse(); - if (Array.isArray(object?.overrides)) obj.overrides = object.overrides.map((e: any) => QuotaOverride.fromJSON(e)); - return obj; + return { + overrides: Array.isArray(object?.overrides) ? object.overrides.map((e: any) => QuotaOverride.fromJSON(e)) : [] + }; }, toJSON(message: ImportConsumerOverridesResponse): JsonSafe<ImportConsumerOverridesResponse> { const obj: any = {}; @@ -4235,8 +4355,7 @@ export const ImportConsumerOverridesMetadata = { return message; }, fromJSON(_: any): ImportConsumerOverridesMetadata { - const obj = createBaseImportConsumerOverridesMetadata(); - return obj; + return {}; }, toJSON(_: ImportConsumerOverridesMetadata): JsonSafe<ImportConsumerOverridesMetadata> { const obj: any = {}; @@ -4311,9 +4430,9 @@ export const ImportAdminQuotaPoliciesResponse = { return message; }, fromJSON(object: any): ImportAdminQuotaPoliciesResponse { - const obj = createBaseImportAdminQuotaPoliciesResponse(); - if (Array.isArray(object?.policies)) obj.policies = object.policies.map((e: any) => AdminQuotaPolicy.fromJSON(e)); - return obj; + return { + policies: Array.isArray(object?.policies) ? object.policies.map((e: any) => AdminQuotaPolicy.fromJSON(e)) : [] + }; }, toJSON(message: ImportAdminQuotaPoliciesResponse): JsonSafe<ImportAdminQuotaPoliciesResponse> { const obj: any = {}; @@ -4401,8 +4520,7 @@ export const ImportAdminQuotaPoliciesMetadata = { return message; }, fromJSON(_: any): ImportAdminQuotaPoliciesMetadata { - const obj = createBaseImportAdminQuotaPoliciesMetadata(); - return obj; + return {}; }, toJSON(_: ImportAdminQuotaPoliciesMetadata): JsonSafe<ImportAdminQuotaPoliciesMetadata> { const obj: any = {}; @@ -4469,8 +4587,7 @@ export const CreateAdminQuotaPolicyMetadata = { return message; }, fromJSON(_: any): CreateAdminQuotaPolicyMetadata { - const obj = createBaseCreateAdminQuotaPolicyMetadata(); - return obj; + return {}; }, toJSON(_: CreateAdminQuotaPolicyMetadata): JsonSafe<CreateAdminQuotaPolicyMetadata> { const obj: any = {}; @@ -4537,8 +4654,7 @@ export const UpdateAdminQuotaPolicyMetadata = { return message; }, fromJSON(_: any): UpdateAdminQuotaPolicyMetadata { - const obj = createBaseUpdateAdminQuotaPolicyMetadata(); - return obj; + return {}; }, toJSON(_: UpdateAdminQuotaPolicyMetadata): JsonSafe<UpdateAdminQuotaPolicyMetadata> { const obj: any = {}; @@ -4605,8 +4721,7 @@ export const DeleteAdminQuotaPolicyMetadata = { return message; }, fromJSON(_: any): DeleteAdminQuotaPolicyMetadata { - const obj = createBaseDeleteAdminQuotaPolicyMetadata(); - return obj; + return {}; }, toJSON(_: DeleteAdminQuotaPolicyMetadata): JsonSafe<DeleteAdminQuotaPolicyMetadata> { const obj: any = {}; @@ -4658,7 +4773,7 @@ function createBaseGenerateServiceIdentityRequest(): GenerateServiceIdentityRequ export const GenerateServiceIdentityRequest = { typeUrl: "/google.api.serviceusage.v1beta1.GenerateServiceIdentityRequest", encode(message: GenerateServiceIdentityRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.parent !== undefined) { + if (message.parent !== "") { writer.uint32(10).string(message.parent); } return writer; @@ -4681,9 +4796,9 @@ export const GenerateServiceIdentityRequest = { return message; }, fromJSON(object: any): GenerateServiceIdentityRequest { - const obj = createBaseGenerateServiceIdentityRequest(); - if (isSet(object.parent)) obj.parent = String(object.parent); - return obj; + return { + parent: isSet(object.parent) ? String(object.parent) : "" + }; }, toJSON(message: GenerateServiceIdentityRequest): JsonSafe<GenerateServiceIdentityRequest> { const obj: any = {}; @@ -4776,10 +4891,10 @@ export const GetServiceIdentityResponse = { return message; }, fromJSON(object: any): GetServiceIdentityResponse { - 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; + return { + identity: isSet(object.identity) ? ServiceIdentity.fromJSON(object.identity) : undefined, + state: isSet(object.state) ? getServiceIdentityResponse_IdentityStateFromJSON(object.state) : -1 + }; }, toJSON(message: GetServiceIdentityResponse): JsonSafe<GetServiceIdentityResponse> { const obj: any = {}; @@ -4789,9 +4904,7 @@ export const GetServiceIdentityResponse = { }, fromPartial(object: DeepPartial<GetServiceIdentityResponse>): GetServiceIdentityResponse { const message = createBaseGetServiceIdentityResponse(); - if (object.identity !== undefined && object.identity !== null) { - message.identity = ServiceIdentity.fromPartial(object.identity); - } + message.identity = object.identity !== undefined && object.identity !== null ? ServiceIdentity.fromPartial(object.identity) : undefined; message.state = object.state ?? 0; return message; }, @@ -4868,8 +4981,7 @@ export const GetServiceIdentityMetadata = { return message; }, fromJSON(_: any): GetServiceIdentityMetadata { - const obj = createBaseGetServiceIdentityMetadata(); - return obj; + return {}; }, toJSON(_: GetServiceIdentityMetadata): JsonSafe<GetServiceIdentityMetadata> { 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 9e80f57567..26c05da9a6 100644 --- a/__fixtures__/v-next/outputv4/google/api/source_info.ts +++ b/__fixtures__/v-next/outputv4/google/api/source_info.ts @@ -1,13 +1,17 @@ -import { Any, AnySDKType } from "../protobuf/any.js"; -import { BinaryReader, BinaryWriter } from "../../binary.js"; -import { JsonSafe } from "../../json-safe.js"; -import { DeepPartial } from "../../helpers.js"; +import { Any, AnySDKType } from "../protobuf/any"; +import { BinaryReader, BinaryWriter } from "../../binary"; +import { JsonSafe } from "../../json-safe"; +import { DeepPartial } from "../../helpers"; +import { ComputedRef } from "vue"; 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<Any[]>; +} export interface SourceInfoProtoMsg { typeUrl: "/google.api.SourceInfo"; value: Uint8Array; @@ -47,9 +51,9 @@ export const SourceInfo = { return message; }, fromJSON(object: any): SourceInfo { - const obj = createBaseSourceInfo(); - if (Array.isArray(object?.sourceFiles)) obj.sourceFiles = object.sourceFiles.map((e: any) => Any.fromJSON(e)); - return obj; + return { + sourceFiles: Array.isArray(object?.sourceFiles) ? object.sourceFiles.map((e: any) => Any.fromJSON(e)) : [] + }; }, toJSON(message: SourceInfo): JsonSafe<SourceInfo> { 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 230e353d3b..b71ac4fae1 100644 --- a/__fixtures__/v-next/outputv4/google/api/system_parameter.ts +++ b/__fixtures__/v-next/outputv4/google/api/system_parameter.ts @@ -1,6 +1,7 @@ -import { BinaryReader, BinaryWriter } from "../../binary.js"; -import { JsonSafe } from "../../json-safe.js"; -import { DeepPartial, isSet } from "../../helpers.js"; +import { BinaryReader, BinaryWriter } from "../../binary"; +import { JsonSafe } from "../../json-safe"; +import { DeepPartial, isSet } from "../../helpers"; +import { ComputedRef } from "vue"; export const protobufPackage = "google.api"; /** * ### System parameter configuration @@ -44,6 +45,9 @@ export interface SystemParameters { */ rules: SystemParameterRule[]; } +export interface ReactiveSystemParameters { + rules: ComputedRef<SystemParameterRule[]>; +} export interface SystemParametersProtoMsg { typeUrl: "/google.api.SystemParameters"; value: Uint8Array; @@ -80,6 +84,10 @@ export interface SystemParameterRule { */ parameters: SystemParameter[]; } +export interface ReactiveSystemParameterRule { + selector: ComputedRef<string>; + parameters: ComputedRef<SystemParameter[]>; +} export interface SystemParameterRuleProtoMsg { typeUrl: "/google.api.SystemParameterRule"; value: Uint8Array; @@ -111,6 +119,11 @@ export interface SystemParameter { */ urlQueryParameter: string; } +export interface ReactiveSystemParameter { + name: ComputedRef<string>; + httpHeader: ComputedRef<string>; + urlQueryParameter: ComputedRef<string>; +} export interface SystemParameterProtoMsg { typeUrl: "/google.api.SystemParameter"; value: Uint8Array; @@ -156,9 +169,9 @@ export const SystemParameters = { return message; }, fromJSON(object: any): SystemParameters { - const obj = createBaseSystemParameters(); - if (Array.isArray(object?.rules)) obj.rules = object.rules.map((e: any) => SystemParameterRule.fromJSON(e)); - return obj; + return { + rules: Array.isArray(object?.rules) ? object.rules.map((e: any) => SystemParameterRule.fromJSON(e)) : [] + }; }, toJSON(message: SystemParameters): JsonSafe<SystemParameters> { const obj: any = {}; @@ -232,7 +245,7 @@ function createBaseSystemParameterRule(): SystemParameterRule { export const SystemParameterRule = { typeUrl: "/google.api.SystemParameterRule", encode(message: SystemParameterRule, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.selector !== undefined) { + if (message.selector !== "") { writer.uint32(10).string(message.selector); } for (const v of message.parameters) { @@ -261,10 +274,10 @@ export const SystemParameterRule = { return message; }, fromJSON(object: any): SystemParameterRule { - 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; + return { + selector: isSet(object.selector) ? String(object.selector) : "", + parameters: Array.isArray(object?.parameters) ? object.parameters.map((e: any) => SystemParameter.fromJSON(e)) : [] + }; }, toJSON(message: SystemParameterRule): JsonSafe<SystemParameterRule> { const obj: any = {}; @@ -348,13 +361,13 @@ function createBaseSystemParameter(): SystemParameter { export const SystemParameter = { typeUrl: "/google.api.SystemParameter", encode(message: SystemParameter, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.name !== undefined) { + if (message.name !== "") { writer.uint32(10).string(message.name); } - if (message.httpHeader !== undefined) { + if (message.httpHeader !== "") { writer.uint32(18).string(message.httpHeader); } - if (message.urlQueryParameter !== undefined) { + if (message.urlQueryParameter !== "") { writer.uint32(26).string(message.urlQueryParameter); } return writer; @@ -383,11 +396,11 @@ export const SystemParameter = { return message; }, fromJSON(object: any): SystemParameter { - 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; + return { + name: isSet(object.name) ? String(object.name) : "", + httpHeader: isSet(object.httpHeader) ? String(object.httpHeader) : "", + urlQueryParameter: isSet(object.urlQueryParameter) ? String(object.urlQueryParameter) : "" + }; }, toJSON(message: SystemParameter): JsonSafe<SystemParameter> { const obj: any = {}; diff --git a/__fixtures__/v-next/outputv4/google/api/usage.ts b/__fixtures__/v-next/outputv4/google/api/usage.ts index b4a9d63a75..56706cd194 100644 --- a/__fixtures__/v-next/outputv4/google/api/usage.ts +++ b/__fixtures__/v-next/outputv4/google/api/usage.ts @@ -1,6 +1,7 @@ -import { BinaryReader, BinaryWriter } from "../../binary.js"; -import { isSet, DeepPartial } from "../../helpers.js"; -import { JsonSafe } from "../../json-safe.js"; +import { BinaryReader, BinaryWriter } from "../../binary"; +import { isSet, DeepPartial } from "../../helpers"; +import { JsonSafe } from "../../json-safe"; +import { ComputedRef } from "vue"; export const protobufPackage = "google.api"; /** Configuration controlling usage of a service. */ export interface Usage { @@ -34,6 +35,11 @@ export interface Usage { */ producerNotificationChannel: string; } +export interface ReactiveUsage { + requirements: ComputedRef<string[]>; + rules: ComputedRef<UsageRule[]>; + producerNotificationChannel: ComputedRef<string>; +} export interface UsageProtoMsg { typeUrl: "/google.api.Usage"; value: Uint8Array; @@ -92,6 +98,11 @@ export interface UsageRule { */ skipServiceControl: boolean; } +export interface ReactiveUsageRule { + selector: ComputedRef<string>; + allowUnregisteredCalls: ComputedRef<boolean>; + skipServiceControl: ComputedRef<boolean>; +} export interface UsageRuleProtoMsg { typeUrl: "/google.api.UsageRule"; value: Uint8Array; @@ -144,7 +155,7 @@ export const Usage = { for (const v of message.rules) { UsageRule.encode(v!, writer.uint32(50).fork()).ldelim(); } - if (message.producerNotificationChannel !== undefined) { + if (message.producerNotificationChannel !== "") { writer.uint32(58).string(message.producerNotificationChannel); } return writer; @@ -173,11 +184,11 @@ export const Usage = { return message; }, fromJSON(object: any): Usage { - 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; + 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) : "" + }; }, toJSON(message: Usage): JsonSafe<Usage> { const obj: any = {}; @@ -280,13 +291,13 @@ function createBaseUsageRule(): UsageRule { export const UsageRule = { typeUrl: "/google.api.UsageRule", encode(message: UsageRule, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.selector !== undefined) { + if (message.selector !== "") { writer.uint32(10).string(message.selector); } - if (message.allowUnregisteredCalls !== undefined) { + if (message.allowUnregisteredCalls === true) { writer.uint32(16).bool(message.allowUnregisteredCalls); } - if (message.skipServiceControl !== undefined) { + if (message.skipServiceControl === true) { writer.uint32(24).bool(message.skipServiceControl); } return writer; @@ -315,11 +326,11 @@ export const UsageRule = { return message; }, fromJSON(object: any): UsageRule { - 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; + return { + selector: isSet(object.selector) ? String(object.selector) : "", + allowUnregisteredCalls: isSet(object.allowUnregisteredCalls) ? Boolean(object.allowUnregisteredCalls) : false, + skipServiceControl: isSet(object.skipServiceControl) ? Boolean(object.skipServiceControl) : false + }; }, toJSON(message: UsageRule): JsonSafe<UsageRule> { const obj: any = {}; diff --git a/__fixtures__/v-next/outputv4/google/api/visibility.ts b/__fixtures__/v-next/outputv4/google/api/visibility.ts index 10ddd8230b..342c9fe01c 100644 --- a/__fixtures__/v-next/outputv4/google/api/visibility.ts +++ b/__fixtures__/v-next/outputv4/google/api/visibility.ts @@ -1,6 +1,7 @@ -import { BinaryReader, BinaryWriter } from "../../binary.js"; -import { JsonSafe } from "../../json-safe.js"; -import { DeepPartial, isSet } from "../../helpers.js"; +import { BinaryReader, BinaryWriter } from "../../binary"; +import { JsonSafe } from "../../json-safe"; +import { DeepPartial, isSet } from "../../helpers"; +import { ComputedRef } from "vue"; export const protobufPackage = "google.api"; /** * `Visibility` defines restrictions for the visibility of service @@ -34,6 +35,9 @@ export interface Visibility { */ rules: VisibilityRule[]; } +export interface ReactiveVisibility { + rules: ComputedRef<VisibilityRule[]>; +} export interface VisibilityProtoMsg { typeUrl: "/google.api.Visibility"; value: Uint8Array; @@ -95,6 +99,10 @@ export interface VisibilityRule { */ restriction: string; } +export interface ReactiveVisibilityRule { + selector: ComputedRef<string>; + restriction: ComputedRef<string>; +} export interface VisibilityRuleProtoMsg { typeUrl: "/google.api.VisibilityRule"; value: Uint8Array; @@ -138,9 +146,9 @@ export const Visibility = { return message; }, fromJSON(object: any): Visibility { - const obj = createBaseVisibility(); - if (Array.isArray(object?.rules)) obj.rules = object.rules.map((e: any) => VisibilityRule.fromJSON(e)); - return obj; + return { + rules: Array.isArray(object?.rules) ? object.rules.map((e: any) => VisibilityRule.fromJSON(e)) : [] + }; }, toJSON(message: Visibility): JsonSafe<Visibility> { const obj: any = {}; @@ -214,10 +222,10 @@ function createBaseVisibilityRule(): VisibilityRule { export const VisibilityRule = { typeUrl: "/google.api.VisibilityRule", encode(message: VisibilityRule, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.selector !== undefined) { + if (message.selector !== "") { writer.uint32(10).string(message.selector); } - if (message.restriction !== undefined) { + if (message.restriction !== "") { writer.uint32(18).string(message.restriction); } return writer; @@ -243,10 +251,10 @@ export const VisibilityRule = { return message; }, fromJSON(object: any): VisibilityRule { - const obj = createBaseVisibilityRule(); - if (isSet(object.selector)) obj.selector = String(object.selector); - if (isSet(object.restriction)) obj.restriction = String(object.restriction); - return obj; + return { + selector: isSet(object.selector) ? String(object.selector) : "", + restriction: isSet(object.restriction) ? String(object.restriction) : "" + }; }, toJSON(message: VisibilityRule): JsonSafe<VisibilityRule> { const obj: any = {}; diff --git a/__fixtures__/v-next/outputv4/google/bundle.ts b/__fixtures__/v-next/outputv4/google/bundle.ts index 1d59dbeed3..f3e68e2fcd 100644 --- a/__fixtures__/v-next/outputv4/google/bundle.ts +++ b/__fixtures__/v-next/outputv4/google/bundle.ts @@ -1,60 +1,57 @@ -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"; +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"; export namespace google { export const api = { - ..._178, - ..._179, - ..._180, ..._181, ..._182, ..._183, @@ -82,27 +79,27 @@ export namespace google { ..._205, ..._206, ..._207, - ..._208 + ..._208, + ..._209, + ..._210, + ..._211 }; export namespace logging { export const type = { - ..._209, - ..._210 + ..._212, + ..._213 }; export const v2 = { - ..._211, - ..._212, - ..._213, - ..._214 + ..._214, + ..._215, + ..._216, + ..._217 }; } export const longrunning = { - ..._215 + ..._218 }; export const protobuf = { - ..._216, - ..._217, - ..._218, ..._219, ..._220, ..._221, @@ -110,11 +107,14 @@ export namespace google { ..._223, ..._224, ..._225, - ..._226 - }; - export const rpc = { + ..._226, ..._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 7e80dedf30..4347351c2e 100644 --- a/__fixtures__/v-next/outputv4/google/logging/type/http_request.ts +++ b/__fixtures__/v-next/outputv4/google/logging/type/http_request.ts @@ -1,7 +1,8 @@ -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"; +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"; export const protobufPackage = "google.logging.type"; /** * A common proto for logging HTTP requests. Only contains semantics @@ -82,6 +83,23 @@ export interface HttpRequest { /** Protocol used for the request. Examples: "HTTP/1.1", "HTTP/2", "websocket" */ protocol: string; } +export interface ReactiveHttpRequest { + requestMethod: ComputedRef<string>; + requestUrl: ComputedRef<string>; + requestSize: ComputedRef<bigint>; + status: ComputedRef<number>; + responseSize: ComputedRef<bigint>; + userAgent: ComputedRef<string>; + remoteIp: ComputedRef<string>; + serverIp: ComputedRef<string>; + referer: ComputedRef<string>; + latency?: ComputedRef<Duration>; + cacheLookup: ComputedRef<boolean>; + cacheHit: ComputedRef<boolean>; + cacheValidatedWithOriginServer: ComputedRef<boolean>; + cacheFillBytes: ComputedRef<bigint>; + protocol: ComputedRef<string>; +} export interface HttpRequestProtoMsg { typeUrl: "/google.logging.type.HttpRequest"; value: Uint8Array; @@ -130,49 +148,49 @@ function createBaseHttpRequest(): HttpRequest { export const HttpRequest = { typeUrl: "/google.logging.type.HttpRequest", encode(message: HttpRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.requestMethod !== undefined) { + if (message.requestMethod !== "") { writer.uint32(10).string(message.requestMethod); } - if (message.requestUrl !== undefined) { + if (message.requestUrl !== "") { writer.uint32(18).string(message.requestUrl); } - if (message.requestSize !== undefined) { + if (message.requestSize !== BigInt(0)) { writer.uint32(24).int64(message.requestSize); } - if (message.status !== undefined) { + if (message.status !== 0) { writer.uint32(32).int32(message.status); } - if (message.responseSize !== undefined) { + if (message.responseSize !== BigInt(0)) { writer.uint32(40).int64(message.responseSize); } - if (message.userAgent !== undefined) { + if (message.userAgent !== "") { writer.uint32(50).string(message.userAgent); } - if (message.remoteIp !== undefined) { + if (message.remoteIp !== "") { writer.uint32(58).string(message.remoteIp); } - if (message.serverIp !== undefined) { + if (message.serverIp !== "") { writer.uint32(106).string(message.serverIp); } - if (message.referer !== undefined) { + if (message.referer !== "") { writer.uint32(66).string(message.referer); } if (message.latency !== undefined) { Duration.encode(message.latency, writer.uint32(114).fork()).ldelim(); } - if (message.cacheLookup !== undefined) { + if (message.cacheLookup === true) { writer.uint32(88).bool(message.cacheLookup); } - if (message.cacheHit !== undefined) { + if (message.cacheHit === true) { writer.uint32(72).bool(message.cacheHit); } - if (message.cacheValidatedWithOriginServer !== undefined) { + if (message.cacheValidatedWithOriginServer === true) { writer.uint32(80).bool(message.cacheValidatedWithOriginServer); } - if (message.cacheFillBytes !== undefined) { + if (message.cacheFillBytes !== BigInt(0)) { writer.uint32(96).int64(message.cacheFillBytes); } - if (message.protocol !== undefined) { + if (message.protocol !== "") { writer.uint32(122).string(message.protocol); } return writer; @@ -237,23 +255,23 @@ export const HttpRequest = { return message; }, fromJSON(object: any): HttpRequest { - 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; + 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) : "" + }; }, toJSON(message: HttpRequest): JsonSafe<HttpRequest> { const obj: any = {}; @@ -278,26 +296,18 @@ export const HttpRequest = { const message = createBaseHttpRequest(); message.requestMethod = object.requestMethod ?? ""; message.requestUrl = object.requestUrl ?? ""; - if (object.requestSize !== undefined && object.requestSize !== null) { - message.requestSize = BigInt(object.requestSize.toString()); - } + message.requestSize = object.requestSize !== undefined && object.requestSize !== null ? BigInt(object.requestSize.toString()) : BigInt(0); message.status = object.status ?? 0; - if (object.responseSize !== undefined && object.responseSize !== null) { - message.responseSize = BigInt(object.responseSize.toString()); - } + message.responseSize = object.responseSize !== undefined && object.responseSize !== null ? BigInt(object.responseSize.toString()) : BigInt(0); message.userAgent = object.userAgent ?? ""; message.remoteIp = object.remoteIp ?? ""; message.serverIp = object.serverIp ?? ""; message.referer = object.referer ?? ""; - if (object.latency !== undefined && object.latency !== null) { - message.latency = Duration.fromPartial(object.latency); - } + message.latency = object.latency !== undefined && object.latency !== null ? Duration.fromPartial(object.latency) : undefined; message.cacheLookup = object.cacheLookup ?? false; message.cacheHit = object.cacheHit ?? false; message.cacheValidatedWithOriginServer = object.cacheValidatedWithOriginServer ?? false; - if (object.cacheFillBytes !== undefined && object.cacheFillBytes !== null) { - message.cacheFillBytes = BigInt(object.cacheFillBytes.toString()); - } + message.cacheFillBytes = object.cacheFillBytes !== undefined && object.cacheFillBytes !== null ? BigInt(object.cacheFillBytes.toString()) : BigInt(0); 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 17fae166c6..5f13285523 100644 --- a/__fixtures__/v-next/outputv4/google/logging/type/log_severity.ts +++ b/__fixtures__/v-next/outputv4/google/logging/type/log_severity.ts @@ -1,3 +1,4 @@ +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 ce7a3a0f3d..d62c348a8a 100644 --- a/__fixtures__/v-next/outputv4/google/logging/v2/log_entry.ts +++ b/__fixtures__/v-next/outputv4/google/logging/v2/log_entry.ts @@ -1,17 +1,22 @@ -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"; +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"; export const protobufPackage = "google.logging.v2"; export interface LogEntry_LabelsEntry { key: string; value: string; } +export interface ReactiveLogEntry_LabelsEntry { + key: ComputedRef<string>; + value: ComputedRef<string>; +} export interface LogEntry_LabelsEntryProtoMsg { typeUrl: string; value: Uint8Array; @@ -168,6 +173,27 @@ export interface LogEntry { */ split?: LogSplit; } +export interface ReactiveLogEntry { + logName: ComputedRef<string>; + resource?: ComputedRef<MonitoredResource>; + protoPayload?: ComputedRef<Any>; + textPayload?: ComputedRef<string>; + jsonPayload?: ComputedRef<Struct>; + timestamp?: ComputedRef<Date>; + receiveTimestamp?: ComputedRef<Date>; + severity: ComputedRef<LogSeverity>; + insertId: ComputedRef<string>; + httpRequest?: ComputedRef<HttpRequest>; + labels: ComputedRef<{ + [key: string]: string; + }>; + operation?: ComputedRef<LogEntryOperation>; + trace: ComputedRef<string>; + spanId: ComputedRef<string>; + traceSampled: ComputedRef<boolean>; + sourceLocation?: ComputedRef<LogEntrySourceLocation>; + split?: ComputedRef<LogSplit>; +} export interface LogEntryProtoMsg { typeUrl: "/google.logging.v2.LogEntry"; value: Uint8Array; @@ -215,6 +241,12 @@ 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<string>; + producer: ComputedRef<string>; + first: ComputedRef<boolean>; + last: ComputedRef<boolean>; +} export interface LogEntryOperationProtoMsg { typeUrl: "/google.logging.v2.LogEntryOperation"; value: Uint8Array; @@ -254,6 +286,11 @@ export interface LogEntrySourceLocation { */ function: string; } +export interface ReactiveLogEntrySourceLocation { + file: ComputedRef<string>; + line: ComputedRef<bigint>; + function: ComputedRef<string>; +} export interface LogEntrySourceLocationProtoMsg { typeUrl: "/google.logging.v2.LogEntrySourceLocation"; value: Uint8Array; @@ -288,6 +325,11 @@ export interface LogSplit { /** The total number of log entries that the original LogEntry was split into. */ totalSplits: number; } +export interface ReactiveLogSplit { + uid: ComputedRef<string>; + index: ComputedRef<number>; + totalSplits: ComputedRef<number>; +} export interface LogSplitProtoMsg { typeUrl: "/google.logging.v2.LogSplit"; value: Uint8Array; @@ -310,10 +352,10 @@ function createBaseLogEntry_LabelsEntry(): LogEntry_LabelsEntry { } export const LogEntry_LabelsEntry = { encode(message: LogEntry_LabelsEntry, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.key !== undefined) { + if (message.key !== "") { writer.uint32(10).string(message.key); } - if (message.value !== undefined) { + if (message.value !== "") { writer.uint32(18).string(message.value); } return writer; @@ -339,10 +381,10 @@ export const LogEntry_LabelsEntry = { return message; }, fromJSON(object: any): LogEntry_LabelsEntry { - const obj = createBaseLogEntry_LabelsEntry(); - if (isSet(object.key)) obj.key = String(object.key); - if (isSet(object.value)) obj.value = String(object.value); - return obj; + return { + key: isSet(object.key) ? String(object.key) : "", + value: isSet(object.value) ? String(object.value) : "" + }; }, toJSON(message: LogEntry_LabelsEntry): JsonSafe<LogEntry_LabelsEntry> { const obj: any = {}; @@ -424,7 +466,7 @@ function createBaseLogEntry(): LogEntry { export const LogEntry = { typeUrl: "/google.logging.v2.LogEntry", encode(message: LogEntry, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.logName !== undefined) { + if (message.logName !== "") { writer.uint32(98).string(message.logName); } if (message.resource !== undefined) { @@ -448,7 +490,7 @@ export const LogEntry = { if (message.severity !== 0) { writer.uint32(80).int32(message.severity); } - if (message.insertId !== undefined) { + if (message.insertId !== "") { writer.uint32(34).string(message.insertId); } if (message.httpRequest !== undefined) { @@ -463,13 +505,13 @@ export const LogEntry = { if (message.operation !== undefined) { LogEntryOperation.encode(message.operation, writer.uint32(122).fork()).ldelim(); } - if (message.trace !== undefined) { + if (message.trace !== "") { writer.uint32(178).string(message.trace); } - if (message.spanId !== undefined) { + if (message.spanId !== "") { writer.uint32(218).string(message.spanId); } - if (message.traceSampled !== undefined) { + if (message.traceSampled === true) { writer.uint32(240).bool(message.traceSampled); } if (message.sourceLocation !== undefined) { @@ -549,30 +591,30 @@ export const LogEntry = { return message; }, fromJSON(object: any): LogEntry { - 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; + 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 + }; }, toJSON(message: LogEntry): JsonSafe<LogEntry> { const obj: any = {}; @@ -603,23 +645,15 @@ export const LogEntry = { fromPartial(object: DeepPartial<LogEntry>): LogEntry { const message = createBaseLogEntry(); message.logName = object.logName ?? ""; - 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.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; message.textPayload = object.textPayload ?? undefined; - if (object.jsonPayload !== undefined && object.jsonPayload !== null) { - message.jsonPayload = Struct.fromPartial(object.jsonPayload); - } + message.jsonPayload = object.jsonPayload !== undefined && object.jsonPayload !== null ? Struct.fromPartial(object.jsonPayload) : undefined; message.timestamp = object.timestamp ?? undefined; message.receiveTimestamp = object.receiveTimestamp ?? undefined; message.severity = object.severity ?? 0; message.insertId = object.insertId ?? ""; - if (object.httpRequest !== undefined && object.httpRequest !== null) { - message.httpRequest = HttpRequest.fromPartial(object.httpRequest); - } + message.httpRequest = object.httpRequest !== undefined && object.httpRequest !== null ? HttpRequest.fromPartial(object.httpRequest) : undefined; message.labels = Object.entries(object.labels ?? {}).reduce<{ [key: string]: string; }>((acc, [key, value]) => { @@ -628,18 +662,12 @@ export const LogEntry = { } return acc; }, {}); - if (object.operation !== undefined && object.operation !== null) { - message.operation = LogEntryOperation.fromPartial(object.operation); - } + message.operation = object.operation !== undefined && object.operation !== null ? LogEntryOperation.fromPartial(object.operation) : undefined; message.trace = object.trace ?? ""; message.spanId = object.spanId ?? ""; message.traceSampled = object.traceSampled ?? false; - 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); - } + 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; return message; }, fromSDK(object: LogEntrySDKType): LogEntry { @@ -833,16 +861,16 @@ function createBaseLogEntryOperation(): LogEntryOperation { export const LogEntryOperation = { typeUrl: "/google.logging.v2.LogEntryOperation", encode(message: LogEntryOperation, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.id !== undefined) { + if (message.id !== "") { writer.uint32(10).string(message.id); } - if (message.producer !== undefined) { + if (message.producer !== "") { writer.uint32(18).string(message.producer); } - if (message.first !== undefined) { + if (message.first === true) { writer.uint32(24).bool(message.first); } - if (message.last !== undefined) { + if (message.last === true) { writer.uint32(32).bool(message.last); } return writer; @@ -874,12 +902,12 @@ export const LogEntryOperation = { return message; }, fromJSON(object: any): LogEntryOperation { - 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; + 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 + }; }, toJSON(message: LogEntryOperation): JsonSafe<LogEntryOperation> { const obj: any = {}; @@ -971,13 +999,13 @@ function createBaseLogEntrySourceLocation(): LogEntrySourceLocation { export const LogEntrySourceLocation = { typeUrl: "/google.logging.v2.LogEntrySourceLocation", encode(message: LogEntrySourceLocation, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.file !== undefined) { + if (message.file !== "") { writer.uint32(10).string(message.file); } - if (message.line !== undefined) { + if (message.line !== BigInt(0)) { writer.uint32(16).int64(message.line); } - if (message.function !== undefined) { + if (message.function !== "") { writer.uint32(26).string(message.function); } return writer; @@ -1006,11 +1034,11 @@ export const LogEntrySourceLocation = { return message; }, fromJSON(object: any): LogEntrySourceLocation { - 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; + 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) : "" + }; }, toJSON(message: LogEntrySourceLocation): JsonSafe<LogEntrySourceLocation> { const obj: any = {}; @@ -1022,9 +1050,7 @@ export const LogEntrySourceLocation = { fromPartial(object: DeepPartial<LogEntrySourceLocation>): LogEntrySourceLocation { const message = createBaseLogEntrySourceLocation(); message.file = object.file ?? ""; - if (object.line !== undefined && object.line !== null) { - message.line = BigInt(object.line.toString()); - } + message.line = object.line !== undefined && object.line !== null ? BigInt(object.line.toString()) : BigInt(0); message.function = object.function ?? ""; return message; }, @@ -1095,13 +1121,13 @@ function createBaseLogSplit(): LogSplit { export const LogSplit = { typeUrl: "/google.logging.v2.LogSplit", encode(message: LogSplit, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.uid !== undefined) { + if (message.uid !== "") { writer.uint32(10).string(message.uid); } - if (message.index !== undefined) { + if (message.index !== 0) { writer.uint32(16).int32(message.index); } - if (message.totalSplits !== undefined) { + if (message.totalSplits !== 0) { writer.uint32(24).int32(message.totalSplits); } return writer; @@ -1130,11 +1156,11 @@ export const LogSplit = { return message; }, fromJSON(object: any): LogSplit { - 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; + return { + uid: isSet(object.uid) ? String(object.uid) : "", + index: isSet(object.index) ? Number(object.index) : 0, + totalSplits: isSet(object.totalSplits) ? Number(object.totalSplits) : 0 + }; }, toJSON(message: LogSplit): JsonSafe<LogSplit> { 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 6d1a6be44d..40de250463 100644 --- a/__fixtures__/v-next/outputv4/google/logging/v2/logging.ts +++ b/__fixtures__/v-next/outputv4/google/logging/v2/logging.ts @@ -1,10 +1,11 @@ -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"; +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"; export const protobufPackage = "google.logging.v2"; /** An indicator of why entries were omitted. */ export enum TailLogEntriesResponse_SuppressionInfo_Reason { @@ -74,6 +75,9 @@ export interface DeleteLogRequest { */ logName: string; } +export interface ReactiveDeleteLogRequest { + logName: ComputedRef<string>; +} export interface DeleteLogRequestProtoMsg { typeUrl: "/google.logging.v2.DeleteLogRequest"; value: Uint8Array; @@ -86,6 +90,10 @@ export interface WriteLogEntriesRequest_LabelsEntry { key: string; value: string; } +export interface ReactiveWriteLogEntriesRequest_LabelsEntry { + key: ComputedRef<string>; + value: ComputedRef<string>; +} export interface WriteLogEntriesRequest_LabelsEntryProtoMsg { typeUrl: string; value: Uint8Array; @@ -178,6 +186,16 @@ export interface WriteLogEntriesRequest { */ dryRun: boolean; } +export interface ReactiveWriteLogEntriesRequest { + logName: ComputedRef<string>; + resource?: ComputedRef<MonitoredResource>; + labels: ComputedRef<{ + [key: string]: string; + }>; + entries: ComputedRef<LogEntry[]>; + partialSuccess: ComputedRef<boolean>; + dryRun: ComputedRef<boolean>; +} export interface WriteLogEntriesRequestProtoMsg { typeUrl: "/google.logging.v2.WriteLogEntriesRequest"; value: Uint8Array; @@ -195,6 +213,7 @@ export interface WriteLogEntriesRequestSDKType { } /** Result returned from WriteLogEntries. */ export interface WriteLogEntriesResponse {} +export interface ReactiveWriteLogEntriesResponse {} export interface WriteLogEntriesResponseProtoMsg { typeUrl: "/google.logging.v2.WriteLogEntriesResponse"; value: Uint8Array; @@ -205,6 +224,10 @@ export interface WriteLogEntriesPartialErrors_LogEntryErrorsEntry { key: number; value?: Status; } +export interface ReactiveWriteLogEntriesPartialErrors_LogEntryErrorsEntry { + key: ComputedRef<number>; + value?: ComputedRef<Status>; +} export interface WriteLogEntriesPartialErrors_LogEntryErrorsEntryProtoMsg { typeUrl: string; value: Uint8Array; @@ -227,6 +250,11 @@ export interface WriteLogEntriesPartialErrors { [key: number]: Status; }; } +export interface ReactiveWriteLogEntriesPartialErrors { + logEntryErrors: ComputedRef<{ + [key: number]: Status; + }>; +} export interface WriteLogEntriesPartialErrorsProtoMsg { typeUrl: "/google.logging.v2.WriteLogEntriesPartialErrors"; value: Uint8Array; @@ -292,6 +320,13 @@ export interface ListLogEntriesRequest { */ pageToken: string; } +export interface ReactiveListLogEntriesRequest { + resourceNames: ComputedRef<string[]>; + filter: ComputedRef<string>; + orderBy: ComputedRef<string>; + pageSize: ComputedRef<number>; + pageToken: ComputedRef<string>; +} export interface ListLogEntriesRequestProtoMsg { typeUrl: "/google.logging.v2.ListLogEntriesRequest"; value: Uint8Array; @@ -326,6 +361,10 @@ export interface ListLogEntriesResponse { */ nextPageToken: string; } +export interface ReactiveListLogEntriesResponse { + entries: ComputedRef<LogEntry[]>; + nextPageToken: ComputedRef<string>; +} export interface ListLogEntriesResponseProtoMsg { typeUrl: "/google.logging.v2.ListLogEntriesResponse"; value: Uint8Array; @@ -351,6 +390,10 @@ export interface ListMonitoredResourceDescriptorsRequest { */ pageToken: string; } +export interface ReactiveListMonitoredResourceDescriptorsRequest { + pageSize: ComputedRef<number>; + pageToken: ComputedRef<string>; +} export interface ListMonitoredResourceDescriptorsRequestProtoMsg { typeUrl: "/google.logging.v2.ListMonitoredResourceDescriptorsRequest"; value: Uint8Array; @@ -371,6 +414,10 @@ export interface ListMonitoredResourceDescriptorsResponse { */ nextPageToken: string; } +export interface ReactiveListMonitoredResourceDescriptorsResponse { + resourceDescriptors: ComputedRef<MonitoredResourceDescriptor[]>; + nextPageToken: ComputedRef<string>; +} export interface ListMonitoredResourceDescriptorsResponseProtoMsg { typeUrl: "/google.logging.v2.ListMonitoredResourceDescriptorsResponse"; value: Uint8Array; @@ -421,6 +468,12 @@ export interface ListLogsRequest { */ resourceNames: string[]; } +export interface ReactiveListLogsRequest { + parent: ComputedRef<string>; + pageSize: ComputedRef<number>; + pageToken: ComputedRef<string>; + resourceNames: ComputedRef<string[]>; +} export interface ListLogsRequestProtoMsg { typeUrl: "/google.logging.v2.ListLogsRequest"; value: Uint8Array; @@ -447,6 +500,10 @@ export interface ListLogsResponse { */ nextPageToken: string; } +export interface ReactiveListLogsResponse { + logNames: ComputedRef<string[]>; + nextPageToken: ComputedRef<string>; +} export interface ListLogsResponseProtoMsg { typeUrl: "/google.logging.v2.ListLogsResponse"; value: Uint8Array; @@ -492,6 +549,11 @@ export interface TailLogEntriesRequest { */ bufferWindow?: Duration; } +export interface ReactiveTailLogEntriesRequest { + resourceNames: ComputedRef<string[]>; + filter: ComputedRef<string>; + bufferWindow?: ComputedRef<Duration>; +} export interface TailLogEntriesRequestProtoMsg { typeUrl: "/google.logging.v2.TailLogEntriesRequest"; value: Uint8Array; @@ -519,6 +581,10 @@ export interface TailLogEntriesResponse { */ suppressionInfo: TailLogEntriesResponse_SuppressionInfo[]; } +export interface ReactiveTailLogEntriesResponse { + entries: ComputedRef<LogEntry[]>; + suppressionInfo: ComputedRef<TailLogEntriesResponse_SuppressionInfo[]>; +} export interface TailLogEntriesResponseProtoMsg { typeUrl: "/google.logging.v2.TailLogEntriesResponse"; value: Uint8Array; @@ -535,6 +601,10 @@ export interface TailLogEntriesResponse_SuppressionInfo { /** A lower bound on the count of entries omitted due to `reason`. */ suppressedCount: number; } +export interface ReactiveTailLogEntriesResponse_SuppressionInfo { + reason: ComputedRef<TailLogEntriesResponse_SuppressionInfo_Reason>; + suppressedCount: ComputedRef<number>; +} export interface TailLogEntriesResponse_SuppressionInfoProtoMsg { typeUrl: "/google.logging.v2.SuppressionInfo"; value: Uint8Array; @@ -552,7 +622,7 @@ function createBaseDeleteLogRequest(): DeleteLogRequest { export const DeleteLogRequest = { typeUrl: "/google.logging.v2.DeleteLogRequest", encode(message: DeleteLogRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.logName !== undefined) { + if (message.logName !== "") { writer.uint32(10).string(message.logName); } return writer; @@ -575,9 +645,9 @@ export const DeleteLogRequest = { return message; }, fromJSON(object: any): DeleteLogRequest { - const obj = createBaseDeleteLogRequest(); - if (isSet(object.logName)) obj.logName = String(object.logName); - return obj; + return { + logName: isSet(object.logName) ? String(object.logName) : "" + }; }, toJSON(message: DeleteLogRequest): JsonSafe<DeleteLogRequest> { const obj: any = {}; @@ -640,10 +710,10 @@ function createBaseWriteLogEntriesRequest_LabelsEntry(): WriteLogEntriesRequest_ } export const WriteLogEntriesRequest_LabelsEntry = { encode(message: WriteLogEntriesRequest_LabelsEntry, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.key !== undefined) { + if (message.key !== "") { writer.uint32(10).string(message.key); } - if (message.value !== undefined) { + if (message.value !== "") { writer.uint32(18).string(message.value); } return writer; @@ -669,10 +739,10 @@ export const WriteLogEntriesRequest_LabelsEntry = { return message; }, fromJSON(object: any): WriteLogEntriesRequest_LabelsEntry { - const obj = createBaseWriteLogEntriesRequest_LabelsEntry(); - if (isSet(object.key)) obj.key = String(object.key); - if (isSet(object.value)) obj.value = String(object.value); - return obj; + return { + key: isSet(object.key) ? String(object.key) : "", + value: isSet(object.value) ? String(object.value) : "" + }; }, toJSON(message: WriteLogEntriesRequest_LabelsEntry): JsonSafe<WriteLogEntriesRequest_LabelsEntry> { const obj: any = {}; @@ -743,7 +813,7 @@ function createBaseWriteLogEntriesRequest(): WriteLogEntriesRequest { export const WriteLogEntriesRequest = { typeUrl: "/google.logging.v2.WriteLogEntriesRequest", encode(message: WriteLogEntriesRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.logName !== undefined) { + if (message.logName !== "") { writer.uint32(10).string(message.logName); } if (message.resource !== undefined) { @@ -758,10 +828,10 @@ export const WriteLogEntriesRequest = { for (const v of message.entries) { LogEntry.encode(v!, writer.uint32(34).fork()).ldelim(); } - if (message.partialSuccess !== undefined) { + if (message.partialSuccess === true) { writer.uint32(40).bool(message.partialSuccess); } - if (message.dryRun !== undefined) { + if (message.dryRun === true) { writer.uint32(48).bool(message.dryRun); } return writer; @@ -802,19 +872,19 @@ export const WriteLogEntriesRequest = { return message; }, fromJSON(object: any): WriteLogEntriesRequest { - 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; + 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 + }; }, toJSON(message: WriteLogEntriesRequest): JsonSafe<WriteLogEntriesRequest> { const obj: any = {}; @@ -838,9 +908,7 @@ export const WriteLogEntriesRequest = { fromPartial(object: DeepPartial<WriteLogEntriesRequest>): WriteLogEntriesRequest { const message = createBaseWriteLogEntriesRequest(); message.logName = object.logName ?? ""; - if (object.resource !== undefined && object.resource !== null) { - message.resource = MonitoredResource.fromPartial(object.resource); - } + message.resource = object.resource !== undefined && object.resource !== null ? MonitoredResource.fromPartial(object.resource) : undefined; message.labels = Object.entries(object.labels ?? {}).reduce<{ [key: string]: string; }>((acc, [key, value]) => { @@ -986,8 +1054,7 @@ export const WriteLogEntriesResponse = { return message; }, fromJSON(_: any): WriteLogEntriesResponse { - const obj = createBaseWriteLogEntriesResponse(); - return obj; + return {}; }, toJSON(_: WriteLogEntriesResponse): JsonSafe<WriteLogEntriesResponse> { const obj: any = {}; @@ -1039,7 +1106,7 @@ function createBaseWriteLogEntriesPartialErrors_LogEntryErrorsEntry(): WriteLogE } export const WriteLogEntriesPartialErrors_LogEntryErrorsEntry = { encode(message: WriteLogEntriesPartialErrors_LogEntryErrorsEntry, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.key !== undefined) { + if (message.key !== 0) { writer.uint32(8).int32(message.key); } if (message.value !== undefined) { @@ -1068,10 +1135,10 @@ export const WriteLogEntriesPartialErrors_LogEntryErrorsEntry = { return message; }, fromJSON(object: any): WriteLogEntriesPartialErrors_LogEntryErrorsEntry { - 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; + return { + key: isSet(object.key) ? Number(object.key) : 0, + value: isSet(object.value) ? Status.fromJSON(object.value) : undefined + }; }, toJSON(message: WriteLogEntriesPartialErrors_LogEntryErrorsEntry): JsonSafe<WriteLogEntriesPartialErrors_LogEntryErrorsEntry> { const obj: any = {}; @@ -1082,9 +1149,7 @@ export const WriteLogEntriesPartialErrors_LogEntryErrorsEntry = { fromPartial(object: DeepPartial<WriteLogEntriesPartialErrors_LogEntryErrorsEntry>): WriteLogEntriesPartialErrors_LogEntryErrorsEntry { const message = createBaseWriteLogEntriesPartialErrors_LogEntryErrorsEntry(); message.key = object.key ?? 0; - if (object.value !== undefined && object.value !== null) { - message.value = Status.fromPartial(object.value); - } + message.value = object.value !== undefined && object.value !== null ? Status.fromPartial(object.value) : undefined; return message; }, fromSDK(object: WriteLogEntriesPartialErrors_LogEntryErrorsEntrySDKType): WriteLogEntriesPartialErrors_LogEntryErrorsEntry { @@ -1168,14 +1233,14 @@ export const WriteLogEntriesPartialErrors = { return message; }, fromJSON(object: any): WriteLogEntriesPartialErrors { - 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; + return { + logEntryErrors: isObject(object.logEntryErrors) ? Object.entries(object.logEntryErrors).reduce<{ + [key: number]: Status; + }>((acc, [key, value]) => { + acc[Number(key)] = Status.fromJSON(value); + return acc; + }, {}) : {} + }; }, toJSON(message: WriteLogEntriesPartialErrors): JsonSafe<WriteLogEntriesPartialErrors> { const obj: any = {}; @@ -1282,16 +1347,16 @@ export const ListLogEntriesRequest = { for (const v of message.resourceNames) { writer.uint32(66).string(v!); } - if (message.filter !== undefined) { + if (message.filter !== "") { writer.uint32(18).string(message.filter); } - if (message.orderBy !== undefined) { + if (message.orderBy !== "") { writer.uint32(26).string(message.orderBy); } - if (message.pageSize !== undefined) { + if (message.pageSize !== 0) { writer.uint32(32).int32(message.pageSize); } - if (message.pageToken !== undefined) { + if (message.pageToken !== "") { writer.uint32(42).string(message.pageToken); } return writer; @@ -1326,13 +1391,13 @@ export const ListLogEntriesRequest = { return message; }, fromJSON(object: any): ListLogEntriesRequest { - 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; + 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) : "" + }; }, toJSON(message: ListLogEntriesRequest): JsonSafe<ListLogEntriesRequest> { const obj: any = {}; @@ -1445,7 +1510,7 @@ export const ListLogEntriesResponse = { for (const v of message.entries) { LogEntry.encode(v!, writer.uint32(10).fork()).ldelim(); } - if (message.nextPageToken !== undefined) { + if (message.nextPageToken !== "") { writer.uint32(18).string(message.nextPageToken); } return writer; @@ -1471,10 +1536,10 @@ export const ListLogEntriesResponse = { return message; }, fromJSON(object: any): ListLogEntriesResponse { - 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; + return { + entries: Array.isArray(object?.entries) ? object.entries.map((e: any) => LogEntry.fromJSON(e)) : [], + nextPageToken: isSet(object.nextPageToken) ? String(object.nextPageToken) : "" + }; }, toJSON(message: ListLogEntriesResponse): JsonSafe<ListLogEntriesResponse> { const obj: any = {}; @@ -1557,10 +1622,10 @@ function createBaseListMonitoredResourceDescriptorsRequest(): ListMonitoredResou export const ListMonitoredResourceDescriptorsRequest = { typeUrl: "/google.logging.v2.ListMonitoredResourceDescriptorsRequest", encode(message: ListMonitoredResourceDescriptorsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.pageSize !== undefined) { + if (message.pageSize !== 0) { writer.uint32(8).int32(message.pageSize); } - if (message.pageToken !== undefined) { + if (message.pageToken !== "") { writer.uint32(18).string(message.pageToken); } return writer; @@ -1586,10 +1651,10 @@ export const ListMonitoredResourceDescriptorsRequest = { return message; }, fromJSON(object: any): ListMonitoredResourceDescriptorsRequest { - const obj = createBaseListMonitoredResourceDescriptorsRequest(); - if (isSet(object.pageSize)) obj.pageSize = Number(object.pageSize); - if (isSet(object.pageToken)) obj.pageToken = String(object.pageToken); - return obj; + return { + pageSize: isSet(object.pageSize) ? Number(object.pageSize) : 0, + pageToken: isSet(object.pageToken) ? String(object.pageToken) : "" + }; }, toJSON(message: ListMonitoredResourceDescriptorsRequest): JsonSafe<ListMonitoredResourceDescriptorsRequest> { const obj: any = {}; @@ -1665,7 +1730,7 @@ export const ListMonitoredResourceDescriptorsResponse = { for (const v of message.resourceDescriptors) { MonitoredResourceDescriptor.encode(v!, writer.uint32(10).fork()).ldelim(); } - if (message.nextPageToken !== undefined) { + if (message.nextPageToken !== "") { writer.uint32(18).string(message.nextPageToken); } return writer; @@ -1691,10 +1756,10 @@ export const ListMonitoredResourceDescriptorsResponse = { return message; }, fromJSON(object: any): ListMonitoredResourceDescriptorsResponse { - 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; + return { + resourceDescriptors: Array.isArray(object?.resourceDescriptors) ? object.resourceDescriptors.map((e: any) => MonitoredResourceDescriptor.fromJSON(e)) : [], + nextPageToken: isSet(object.nextPageToken) ? String(object.nextPageToken) : "" + }; }, toJSON(message: ListMonitoredResourceDescriptorsResponse): JsonSafe<ListMonitoredResourceDescriptorsResponse> { const obj: any = {}; @@ -1779,13 +1844,13 @@ function createBaseListLogsRequest(): ListLogsRequest { export const ListLogsRequest = { typeUrl: "/google.logging.v2.ListLogsRequest", encode(message: ListLogsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.parent !== undefined) { + if (message.parent !== "") { writer.uint32(10).string(message.parent); } - if (message.pageSize !== undefined) { + if (message.pageSize !== 0) { writer.uint32(16).int32(message.pageSize); } - if (message.pageToken !== undefined) { + if (message.pageToken !== "") { writer.uint32(26).string(message.pageToken); } for (const v of message.resourceNames) { @@ -1820,12 +1885,12 @@ export const ListLogsRequest = { return message; }, fromJSON(object: any): ListLogsRequest { - 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; + 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)) : [] + }; }, toJSON(message: ListLogsRequest): JsonSafe<ListLogsRequest> { const obj: any = {}; @@ -1929,7 +1994,7 @@ export const ListLogsResponse = { for (const v of message.logNames) { writer.uint32(26).string(v!); } - if (message.nextPageToken !== undefined) { + if (message.nextPageToken !== "") { writer.uint32(18).string(message.nextPageToken); } return writer; @@ -1955,10 +2020,10 @@ export const ListLogsResponse = { return message; }, fromJSON(object: any): ListLogsResponse { - 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; + return { + logNames: Array.isArray(object?.logNames) ? object.logNames.map((e: any) => String(e)) : [], + nextPageToken: isSet(object.nextPageToken) ? String(object.nextPageToken) : "" + }; }, toJSON(message: ListLogsResponse): JsonSafe<ListLogsResponse> { const obj: any = {}; @@ -2045,7 +2110,7 @@ export const TailLogEntriesRequest = { for (const v of message.resourceNames) { writer.uint32(10).string(v!); } - if (message.filter !== undefined) { + if (message.filter !== "") { writer.uint32(18).string(message.filter); } if (message.bufferWindow !== undefined) { @@ -2077,11 +2142,11 @@ export const TailLogEntriesRequest = { return message; }, fromJSON(object: any): TailLogEntriesRequest { - 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; + 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 + }; }, toJSON(message: TailLogEntriesRequest): JsonSafe<TailLogEntriesRequest> { const obj: any = {}; @@ -2098,9 +2163,7 @@ export const TailLogEntriesRequest = { const message = createBaseTailLogEntriesRequest(); message.resourceNames = object.resourceNames?.map(e => e) || []; message.filter = object.filter ?? ""; - if (object.bufferWindow !== undefined && object.bufferWindow !== null) { - message.bufferWindow = Duration.fromPartial(object.bufferWindow); - } + message.bufferWindow = object.bufferWindow !== undefined && object.bufferWindow !== null ? Duration.fromPartial(object.bufferWindow) : undefined; return message; }, fromSDK(object: TailLogEntriesRequestSDKType): TailLogEntriesRequest { @@ -2204,10 +2267,10 @@ export const TailLogEntriesResponse = { return message; }, fromJSON(object: any): TailLogEntriesResponse { - 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; + 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)) : [] + }; }, toJSON(message: TailLogEntriesResponse): JsonSafe<TailLogEntriesResponse> { const obj: any = {}; @@ -2303,7 +2366,7 @@ export const TailLogEntriesResponse_SuppressionInfo = { if (message.reason !== 0) { writer.uint32(8).int32(message.reason); } - if (message.suppressedCount !== undefined) { + if (message.suppressedCount !== 0) { writer.uint32(16).int32(message.suppressedCount); } return writer; @@ -2329,10 +2392,10 @@ export const TailLogEntriesResponse_SuppressionInfo = { return message; }, fromJSON(object: any): TailLogEntriesResponse_SuppressionInfo { - 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; + return { + reason: isSet(object.reason) ? tailLogEntriesResponse_SuppressionInfo_ReasonFromJSON(object.reason) : -1, + suppressedCount: isSet(object.suppressedCount) ? Number(object.suppressedCount) : 0 + }; }, toJSON(message: TailLogEntriesResponse_SuppressionInfo): JsonSafe<TailLogEntriesResponse_SuppressionInfo> { 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 99b27c9942..43c10823d5 100644 --- a/__fixtures__/v-next/outputv4/google/logging/v2/logging_config.ts +++ b/__fixtures__/v-next/outputv4/google/logging/v2/logging_config.ts @@ -1,8 +1,9 @@ -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"; +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"; export const protobufPackage = "google.logging.v2"; /** Deprecated. This is unused. */ export enum LogSink_VersionFormat { @@ -229,6 +230,17 @@ export interface LogBucket { */ cmekSettings?: CmekSettings; } +export interface ReactiveLogBucket { + name: ComputedRef<string>; + description: ComputedRef<string>; + createTime?: ComputedRef<Date>; + updateTime?: ComputedRef<Date>; + retentionDays: ComputedRef<number>; + locked: ComputedRef<boolean>; + lifecycleState: ComputedRef<LifecycleState>; + restrictedFields: ComputedRef<string[]>; + cmekSettings?: ComputedRef<CmekSettings>; +} export interface LogBucketProtoMsg { typeUrl: "/google.logging.v2.LogBucket"; value: Uint8Array; @@ -279,6 +291,13 @@ export interface LogView { */ filter: string; } +export interface ReactiveLogView { + name: ComputedRef<string>; + description: ComputedRef<string>; + createTime?: ComputedRef<Date>; + updateTime?: ComputedRef<Date>; + filter: ComputedRef<string>; +} export interface LogViewProtoMsg { typeUrl: "/google.logging.v2.LogView"; value: Uint8Array; @@ -409,6 +428,20 @@ export interface LogSink { */ updateTime?: Date; } +export interface ReactiveLogSink { + name: ComputedRef<string>; + destination: ComputedRef<string>; + filter: ComputedRef<string>; + description: ComputedRef<string>; + disabled: ComputedRef<boolean>; + exclusions: ComputedRef<LogExclusion[]>; + outputVersionFormat: ComputedRef<LogSink_VersionFormat>; + writerIdentity: ComputedRef<string>; + includeChildren: ComputedRef<boolean>; + bigqueryOptions?: ComputedRef<BigQueryOptions>; + createTime?: ComputedRef<Date>; + updateTime?: ComputedRef<Date>; +} export interface LogSinkProtoMsg { typeUrl: "/google.logging.v2.LogSink"; value: Uint8Array; @@ -459,6 +492,10 @@ export interface BigQueryOptions { */ usesTimestampColumnPartitioning: boolean; } +export interface ReactiveBigQueryOptions { + usePartitionedTables: ComputedRef<boolean>; + usesTimestampColumnPartitioning: ComputedRef<boolean>; +} export interface BigQueryOptionsProtoMsg { typeUrl: "/google.logging.v2.BigQueryOptions"; value: Uint8Array; @@ -497,6 +534,11 @@ export interface ListBucketsRequest { */ pageSize: number; } +export interface ReactiveListBucketsRequest { + parent: ComputedRef<string>; + pageToken: ComputedRef<string>; + pageSize: ComputedRef<number>; +} export interface ListBucketsRequestProtoMsg { typeUrl: "/google.logging.v2.ListBucketsRequest"; value: Uint8Array; @@ -518,6 +560,10 @@ export interface ListBucketsResponse { */ nextPageToken: string; } +export interface ReactiveListBucketsResponse { + buckets: ComputedRef<LogBucket[]>; + nextPageToken: ComputedRef<string>; +} export interface ListBucketsResponseProtoMsg { typeUrl: "/google.logging.v2.ListBucketsResponse"; value: Uint8Array; @@ -552,6 +598,11 @@ export interface CreateBucketRequest { */ bucket?: LogBucket; } +export interface ReactiveCreateBucketRequest { + parent: ComputedRef<string>; + bucketId: ComputedRef<string>; + bucket?: ComputedRef<LogBucket>; +} export interface CreateBucketRequestProtoMsg { typeUrl: "/google.logging.v2.CreateBucketRequest"; value: Uint8Array; @@ -591,6 +642,11 @@ export interface UpdateBucketRequest { */ updateMask?: FieldMask; } +export interface ReactiveUpdateBucketRequest { + name: ComputedRef<string>; + bucket?: ComputedRef<LogBucket>; + updateMask?: ComputedRef<FieldMask>; +} export interface UpdateBucketRequestProtoMsg { typeUrl: "/google.logging.v2.UpdateBucketRequest"; value: Uint8Array; @@ -617,6 +673,9 @@ export interface GetBucketRequest { */ name: string; } +export interface ReactiveGetBucketRequest { + name: ComputedRef<string>; +} export interface GetBucketRequestProtoMsg { typeUrl: "/google.logging.v2.GetBucketRequest"; value: Uint8Array; @@ -641,6 +700,9 @@ export interface DeleteBucketRequest { */ name: string; } +export interface ReactiveDeleteBucketRequest { + name: ComputedRef<string>; +} export interface DeleteBucketRequestProtoMsg { typeUrl: "/google.logging.v2.DeleteBucketRequest"; value: Uint8Array; @@ -665,6 +727,9 @@ export interface UndeleteBucketRequest { */ name: string; } +export interface ReactiveUndeleteBucketRequest { + name: ComputedRef<string>; +} export interface UndeleteBucketRequestProtoMsg { typeUrl: "/google.logging.v2.UndeleteBucketRequest"; value: Uint8Array; @@ -696,6 +761,11 @@ export interface ListViewsRequest { */ pageSize: number; } +export interface ReactiveListViewsRequest { + parent: ComputedRef<string>; + pageToken: ComputedRef<string>; + pageSize: ComputedRef<number>; +} export interface ListViewsRequestProtoMsg { typeUrl: "/google.logging.v2.ListViewsRequest"; value: Uint8Array; @@ -717,6 +787,10 @@ export interface ListViewsResponse { */ nextPageToken: string; } +export interface ReactiveListViewsResponse { + views: ComputedRef<LogView[]>; + nextPageToken: ComputedRef<string>; +} export interface ListViewsResponseProtoMsg { typeUrl: "/google.logging.v2.ListViewsResponse"; value: Uint8Array; @@ -743,6 +817,11 @@ export interface CreateViewRequest { /** Required. The new view. */ view?: LogView; } +export interface ReactiveCreateViewRequest { + parent: ComputedRef<string>; + viewId: ComputedRef<string>; + view?: ComputedRef<LogView>; +} export interface CreateViewRequestProtoMsg { typeUrl: "/google.logging.v2.CreateViewRequest"; value: Uint8Array; @@ -779,6 +858,11 @@ export interface UpdateViewRequest { */ updateMask?: FieldMask; } +export interface ReactiveUpdateViewRequest { + name: ComputedRef<string>; + view?: ComputedRef<LogView>; + updateMask?: ComputedRef<FieldMask>; +} export interface UpdateViewRequestProtoMsg { typeUrl: "/google.logging.v2.UpdateViewRequest"; value: Uint8Array; @@ -802,6 +886,9 @@ export interface GetViewRequest { */ name: string; } +export interface ReactiveGetViewRequest { + name: ComputedRef<string>; +} export interface GetViewRequestProtoMsg { typeUrl: "/google.logging.v2.GetViewRequest"; value: Uint8Array; @@ -823,6 +910,9 @@ export interface DeleteViewRequest { */ name: string; } +export interface ReactiveDeleteViewRequest { + name: ComputedRef<string>; +} export interface DeleteViewRequestProtoMsg { typeUrl: "/google.logging.v2.DeleteViewRequest"; value: Uint8Array; @@ -856,6 +946,11 @@ export interface ListSinksRequest { */ pageSize: number; } +export interface ReactiveListSinksRequest { + parent: ComputedRef<string>; + pageToken: ComputedRef<string>; + pageSize: ComputedRef<number>; +} export interface ListSinksRequestProtoMsg { typeUrl: "/google.logging.v2.ListSinksRequest"; value: Uint8Array; @@ -877,6 +972,10 @@ export interface ListSinksResponse { */ nextPageToken: string; } +export interface ReactiveListSinksResponse { + sinks: ComputedRef<LogSink[]>; + nextPageToken: ComputedRef<string>; +} export interface ListSinksResponseProtoMsg { typeUrl: "/google.logging.v2.ListSinksResponse"; value: Uint8Array; @@ -902,6 +1001,9 @@ export interface GetSinkRequest { */ sinkName: string; } +export interface ReactiveGetSinkRequest { + sinkName: ComputedRef<string>; +} export interface GetSinkRequestProtoMsg { typeUrl: "/google.logging.v2.GetSinkRequest"; value: Uint8Array; @@ -946,6 +1048,11 @@ export interface CreateSinkRequest { */ uniqueWriterIdentity: boolean; } +export interface ReactiveCreateSinkRequest { + parent: ComputedRef<string>; + sink?: ComputedRef<LogSink>; + uniqueWriterIdentity: ComputedRef<boolean>; +} export interface CreateSinkRequestProtoMsg { typeUrl: "/google.logging.v2.CreateSinkRequest"; value: Uint8Array; @@ -1011,6 +1118,12 @@ export interface UpdateSinkRequest { */ updateMask?: FieldMask; } +export interface ReactiveUpdateSinkRequest { + sinkName: ComputedRef<string>; + sink?: ComputedRef<LogSink>; + uniqueWriterIdentity: ComputedRef<boolean>; + updateMask?: ComputedRef<FieldMask>; +} export interface UpdateSinkRequestProtoMsg { typeUrl: "/google.logging.v2.UpdateSinkRequest"; value: Uint8Array; @@ -1039,6 +1152,9 @@ export interface DeleteSinkRequest { */ sinkName: string; } +export interface ReactiveDeleteSinkRequest { + sinkName: ComputedRef<string>; +} export interface DeleteSinkRequestProtoMsg { typeUrl: "/google.logging.v2.DeleteSinkRequest"; value: Uint8Array; @@ -1097,6 +1213,14 @@ export interface LogExclusion { */ updateTime?: Date; } +export interface ReactiveLogExclusion { + name: ComputedRef<string>; + description: ComputedRef<string>; + filter: ComputedRef<string>; + disabled: ComputedRef<boolean>; + createTime?: ComputedRef<Date>; + updateTime?: ComputedRef<Date>; +} export interface LogExclusionProtoMsg { typeUrl: "/google.logging.v2.LogExclusion"; value: Uint8Array; @@ -1141,6 +1265,11 @@ export interface ListExclusionsRequest { */ pageSize: number; } +export interface ReactiveListExclusionsRequest { + parent: ComputedRef<string>; + pageToken: ComputedRef<string>; + pageSize: ComputedRef<number>; +} export interface ListExclusionsRequestProtoMsg { typeUrl: "/google.logging.v2.ListExclusionsRequest"; value: Uint8Array; @@ -1162,6 +1291,10 @@ export interface ListExclusionsResponse { */ nextPageToken: string; } +export interface ReactiveListExclusionsResponse { + exclusions: ComputedRef<LogExclusion[]>; + nextPageToken: ComputedRef<string>; +} export interface ListExclusionsResponseProtoMsg { typeUrl: "/google.logging.v2.ListExclusionsResponse"; value: Uint8Array; @@ -1187,6 +1320,9 @@ export interface GetExclusionRequest { */ name: string; } +export interface ReactiveGetExclusionRequest { + name: ComputedRef<string>; +} export interface GetExclusionRequestProtoMsg { typeUrl: "/google.logging.v2.GetExclusionRequest"; value: Uint8Array; @@ -1217,6 +1353,10 @@ export interface CreateExclusionRequest { */ exclusion?: LogExclusion; } +export interface ReactiveCreateExclusionRequest { + parent: ComputedRef<string>; + exclusion?: ComputedRef<LogExclusion>; +} export interface CreateExclusionRequestProtoMsg { typeUrl: "/google.logging.v2.CreateExclusionRequest"; value: Uint8Array; @@ -1257,6 +1397,11 @@ export interface UpdateExclusionRequest { */ updateMask?: FieldMask; } +export interface ReactiveUpdateExclusionRequest { + name: ComputedRef<string>; + exclusion?: ComputedRef<LogExclusion>; + updateMask?: ComputedRef<FieldMask>; +} export interface UpdateExclusionRequestProtoMsg { typeUrl: "/google.logging.v2.UpdateExclusionRequest"; value: Uint8Array; @@ -1283,6 +1428,9 @@ export interface DeleteExclusionRequest { */ name: string; } +export interface ReactiveDeleteExclusionRequest { + name: ComputedRef<string>; +} export interface DeleteExclusionRequestProtoMsg { typeUrl: "/google.logging.v2.DeleteExclusionRequest"; value: Uint8Array; @@ -1319,6 +1467,9 @@ export interface GetCmekSettingsRequest { */ name: string; } +export interface ReactiveGetCmekSettingsRequest { + name: ComputedRef<string>; +} export interface GetCmekSettingsRequestProtoMsg { typeUrl: "/google.logging.v2.GetCmekSettingsRequest"; value: Uint8Array; @@ -1379,6 +1530,11 @@ export interface UpdateCmekSettingsRequest { */ updateMask?: FieldMask; } +export interface ReactiveUpdateCmekSettingsRequest { + name: ComputedRef<string>; + cmekSettings?: ComputedRef<CmekSettings>; + updateMask?: ComputedRef<FieldMask>; +} export interface UpdateCmekSettingsRequestProtoMsg { typeUrl: "/google.logging.v2.UpdateCmekSettingsRequest"; value: Uint8Array; @@ -1458,6 +1614,11 @@ export interface CmekSettings { */ serviceAccountId: string; } +export interface ReactiveCmekSettings { + name: ComputedRef<string>; + kmsKeyName: ComputedRef<string>; + serviceAccountId: ComputedRef<string>; +} export interface CmekSettingsProtoMsg { typeUrl: "/google.logging.v2.CmekSettings"; value: Uint8Array; @@ -1507,6 +1668,9 @@ export interface GetSettingsRequest { */ name: string; } +export interface ReactiveGetSettingsRequest { + name: ComputedRef<string>; +} export interface GetSettingsRequestProtoMsg { typeUrl: "/google.logging.v2.GetSettingsRequest"; value: Uint8Array; @@ -1564,6 +1728,11 @@ export interface UpdateSettingsRequest { */ updateMask?: FieldMask; } +export interface ReactiveUpdateSettingsRequest { + name: ComputedRef<string>; + settings?: ComputedRef<Settings>; + updateMask?: ComputedRef<FieldMask>; +} export interface UpdateSettingsRequestProtoMsg { typeUrl: "/google.logging.v2.UpdateSettingsRequest"; value: Uint8Array; @@ -1647,6 +1816,13 @@ export interface Settings { */ disableDefaultSink: boolean; } +export interface ReactiveSettings { + name: ComputedRef<string>; + kmsKeyName: ComputedRef<string>; + kmsServiceAccountId: ComputedRef<string>; + storageLocation: ComputedRef<string>; + disableDefaultSink: ComputedRef<boolean>; +} export interface SettingsProtoMsg { typeUrl: "/google.logging.v2.Settings"; value: Uint8Array; @@ -1680,6 +1856,11 @@ export interface CopyLogEntriesRequest { /** Required. Destination to which to copy log entries. */ destination: string; } +export interface ReactiveCopyLogEntriesRequest { + name: ComputedRef<string>; + filter: ComputedRef<string>; + destination: ComputedRef<string>; +} export interface CopyLogEntriesRequestProtoMsg { typeUrl: "/google.logging.v2.CopyLogEntriesRequest"; value: Uint8Array; @@ -1715,6 +1896,15 @@ export interface CopyLogEntriesMetadata { */ writerIdentity: string; } +export interface ReactiveCopyLogEntriesMetadata { + startTime?: ComputedRef<Date>; + endTime?: ComputedRef<Date>; + state: ComputedRef<OperationState>; + cancellationRequested: ComputedRef<boolean>; + request?: ComputedRef<CopyLogEntriesRequest>; + progress: ComputedRef<number>; + writerIdentity: ComputedRef<string>; +} export interface CopyLogEntriesMetadataProtoMsg { typeUrl: "/google.logging.v2.CopyLogEntriesMetadata"; value: Uint8Array; @@ -1734,6 +1924,9 @@ export interface CopyLogEntriesResponse { /** Number of log entries copied. */ logEntriesCopiedCount: bigint; } +export interface ReactiveCopyLogEntriesResponse { + logEntriesCopiedCount: ComputedRef<bigint>; +} export interface CopyLogEntriesResponseProtoMsg { typeUrl: "/google.logging.v2.CopyLogEntriesResponse"; value: Uint8Array; @@ -1758,10 +1951,10 @@ function createBaseLogBucket(): LogBucket { export const LogBucket = { typeUrl: "/google.logging.v2.LogBucket", encode(message: LogBucket, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.name !== undefined) { + if (message.name !== "") { writer.uint32(10).string(message.name); } - if (message.description !== undefined) { + if (message.description !== "") { writer.uint32(26).string(message.description); } if (message.createTime !== undefined) { @@ -1770,10 +1963,10 @@ export const LogBucket = { if (message.updateTime !== undefined) { Timestamp.encode(toTimestamp(message.updateTime), writer.uint32(42).fork()).ldelim(); } - if (message.retentionDays !== undefined) { + if (message.retentionDays !== 0) { writer.uint32(88).int32(message.retentionDays); } - if (message.locked !== undefined) { + if (message.locked === true) { writer.uint32(72).bool(message.locked); } if (message.lifecycleState !== 0) { @@ -1829,17 +2022,17 @@ export const LogBucket = { return message; }, fromJSON(object: any): LogBucket { - 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; + 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 + }; }, toJSON(message: LogBucket): JsonSafe<LogBucket> { const obj: any = {}; @@ -1868,9 +2061,7 @@ export const LogBucket = { message.locked = object.locked ?? false; message.lifecycleState = object.lifecycleState ?? 0; message.restrictedFields = object.restrictedFields?.map(e => e) || []; - if (object.cmekSettings !== undefined && object.cmekSettings !== null) { - message.cmekSettings = CmekSettings.fromPartial(object.cmekSettings); - } + message.cmekSettings = object.cmekSettings !== undefined && object.cmekSettings !== null ? CmekSettings.fromPartial(object.cmekSettings) : undefined; return message; }, fromSDK(object: LogBucketSDKType): LogBucket { @@ -1990,10 +2181,10 @@ function createBaseLogView(): LogView { export const LogView = { typeUrl: "/google.logging.v2.LogView", encode(message: LogView, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.name !== undefined) { + if (message.name !== "") { writer.uint32(10).string(message.name); } - if (message.description !== undefined) { + if (message.description !== "") { writer.uint32(26).string(message.description); } if (message.createTime !== undefined) { @@ -2002,7 +2193,7 @@ export const LogView = { if (message.updateTime !== undefined) { Timestamp.encode(toTimestamp(message.updateTime), writer.uint32(42).fork()).ldelim(); } - if (message.filter !== undefined) { + if (message.filter !== "") { writer.uint32(58).string(message.filter); } return writer; @@ -2037,13 +2228,13 @@ export const LogView = { return message; }, fromJSON(object: any): LogView { - 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; + 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) : "" + }; }, toJSON(message: LogView): JsonSafe<LogView> { const obj: any = {}; @@ -2153,19 +2344,19 @@ function createBaseLogSink(): LogSink { export const LogSink = { typeUrl: "/google.logging.v2.LogSink", encode(message: LogSink, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.name !== undefined) { + if (message.name !== "") { writer.uint32(10).string(message.name); } - if (message.destination !== undefined) { + if (message.destination !== "") { writer.uint32(26).string(message.destination); } - if (message.filter !== undefined) { + if (message.filter !== "") { writer.uint32(42).string(message.filter); } - if (message.description !== undefined) { + if (message.description !== "") { writer.uint32(146).string(message.description); } - if (message.disabled !== undefined) { + if (message.disabled === true) { writer.uint32(152).bool(message.disabled); } for (const v of message.exclusions) { @@ -2174,10 +2365,10 @@ export const LogSink = { if (message.outputVersionFormat !== 0) { writer.uint32(48).int32(message.outputVersionFormat); } - if (message.writerIdentity !== undefined) { + if (message.writerIdentity !== "") { writer.uint32(66).string(message.writerIdentity); } - if (message.includeChildren !== undefined) { + if (message.includeChildren === true) { writer.uint32(72).bool(message.includeChildren); } if (message.bigqueryOptions !== undefined) { @@ -2242,20 +2433,20 @@ export const LogSink = { return message; }, fromJSON(object: any): LogSink { - 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; + 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 + }; }, toJSON(message: LogSink): JsonSafe<LogSink> { const obj: any = {}; @@ -2288,9 +2479,7 @@ export const LogSink = { message.outputVersionFormat = object.outputVersionFormat ?? 0; message.writerIdentity = object.writerIdentity ?? ""; message.includeChildren = object.includeChildren ?? false; - if (object.bigqueryOptions !== undefined && object.bigqueryOptions !== null) { - message.bigqueryOptions = BigQueryOptions.fromPartial(object.bigqueryOptions); - } + message.bigqueryOptions = object.bigqueryOptions !== undefined && object.bigqueryOptions !== null ? BigQueryOptions.fromPartial(object.bigqueryOptions) : undefined; message.createTime = object.createTime ?? undefined; message.updateTime = object.updateTime ?? undefined; return message; @@ -2430,10 +2619,10 @@ function createBaseBigQueryOptions(): BigQueryOptions { export const BigQueryOptions = { typeUrl: "/google.logging.v2.BigQueryOptions", encode(message: BigQueryOptions, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.usePartitionedTables !== undefined) { + if (message.usePartitionedTables === true) { writer.uint32(8).bool(message.usePartitionedTables); } - if (message.usesTimestampColumnPartitioning !== undefined) { + if (message.usesTimestampColumnPartitioning === true) { writer.uint32(24).bool(message.usesTimestampColumnPartitioning); } return writer; @@ -2459,10 +2648,10 @@ export const BigQueryOptions = { return message; }, fromJSON(object: any): BigQueryOptions { - const obj = createBaseBigQueryOptions(); - if (isSet(object.usePartitionedTables)) obj.usePartitionedTables = Boolean(object.usePartitionedTables); - if (isSet(object.usesTimestampColumnPartitioning)) obj.usesTimestampColumnPartitioning = Boolean(object.usesTimestampColumnPartitioning); - return obj; + return { + usePartitionedTables: isSet(object.usePartitionedTables) ? Boolean(object.usePartitionedTables) : false, + usesTimestampColumnPartitioning: isSet(object.usesTimestampColumnPartitioning) ? Boolean(object.usesTimestampColumnPartitioning) : false + }; }, toJSON(message: BigQueryOptions): JsonSafe<BigQueryOptions> { const obj: any = {}; @@ -2536,13 +2725,13 @@ function createBaseListBucketsRequest(): ListBucketsRequest { export const ListBucketsRequest = { typeUrl: "/google.logging.v2.ListBucketsRequest", encode(message: ListBucketsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.parent !== undefined) { + if (message.parent !== "") { writer.uint32(10).string(message.parent); } - if (message.pageToken !== undefined) { + if (message.pageToken !== "") { writer.uint32(18).string(message.pageToken); } - if (message.pageSize !== undefined) { + if (message.pageSize !== 0) { writer.uint32(24).int32(message.pageSize); } return writer; @@ -2571,11 +2760,11 @@ export const ListBucketsRequest = { return message; }, fromJSON(object: any): ListBucketsRequest { - 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; + return { + parent: isSet(object.parent) ? String(object.parent) : "", + pageToken: isSet(object.pageToken) ? String(object.pageToken) : "", + pageSize: isSet(object.pageSize) ? Number(object.pageSize) : 0 + }; }, toJSON(message: ListBucketsRequest): JsonSafe<ListBucketsRequest> { const obj: any = {}; @@ -2660,7 +2849,7 @@ export const ListBucketsResponse = { for (const v of message.buckets) { LogBucket.encode(v!, writer.uint32(10).fork()).ldelim(); } - if (message.nextPageToken !== undefined) { + if (message.nextPageToken !== "") { writer.uint32(18).string(message.nextPageToken); } return writer; @@ -2686,10 +2875,10 @@ export const ListBucketsResponse = { return message; }, fromJSON(object: any): ListBucketsResponse { - 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; + return { + buckets: Array.isArray(object?.buckets) ? object.buckets.map((e: any) => LogBucket.fromJSON(e)) : [], + nextPageToken: isSet(object.nextPageToken) ? String(object.nextPageToken) : "" + }; }, toJSON(message: ListBucketsResponse): JsonSafe<ListBucketsResponse> { const obj: any = {}; @@ -2773,10 +2962,10 @@ function createBaseCreateBucketRequest(): CreateBucketRequest { export const CreateBucketRequest = { typeUrl: "/google.logging.v2.CreateBucketRequest", encode(message: CreateBucketRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.parent !== undefined) { + if (message.parent !== "") { writer.uint32(10).string(message.parent); } - if (message.bucketId !== undefined) { + if (message.bucketId !== "") { writer.uint32(18).string(message.bucketId); } if (message.bucket !== undefined) { @@ -2808,11 +2997,11 @@ export const CreateBucketRequest = { return message; }, fromJSON(object: any): CreateBucketRequest { - 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; + return { + parent: isSet(object.parent) ? String(object.parent) : "", + bucketId: isSet(object.bucketId) ? String(object.bucketId) : "", + bucket: isSet(object.bucket) ? LogBucket.fromJSON(object.bucket) : undefined + }; }, toJSON(message: CreateBucketRequest): JsonSafe<CreateBucketRequest> { const obj: any = {}; @@ -2825,9 +3014,7 @@ export const CreateBucketRequest = { const message = createBaseCreateBucketRequest(); message.parent = object.parent ?? ""; message.bucketId = object.bucketId ?? ""; - if (object.bucket !== undefined && object.bucket !== null) { - message.bucket = LogBucket.fromPartial(object.bucket); - } + message.bucket = object.bucket !== undefined && object.bucket !== null ? LogBucket.fromPartial(object.bucket) : undefined; return message; }, fromSDK(object: CreateBucketRequestSDKType): CreateBucketRequest { @@ -2897,7 +3084,7 @@ function createBaseUpdateBucketRequest(): UpdateBucketRequest { export const UpdateBucketRequest = { typeUrl: "/google.logging.v2.UpdateBucketRequest", encode(message: UpdateBucketRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.name !== undefined) { + if (message.name !== "") { writer.uint32(10).string(message.name); } if (message.bucket !== undefined) { @@ -2932,11 +3119,11 @@ export const UpdateBucketRequest = { return message; }, fromJSON(object: any): UpdateBucketRequest { - 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; + 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 + }; }, toJSON(message: UpdateBucketRequest): JsonSafe<UpdateBucketRequest> { const obj: any = {}; @@ -2948,12 +3135,8 @@ export const UpdateBucketRequest = { fromPartial(object: DeepPartial<UpdateBucketRequest>): UpdateBucketRequest { const message = createBaseUpdateBucketRequest(); message.name = object.name ?? ""; - 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); - } + 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; return message; }, fromSDK(object: UpdateBucketRequestSDKType): UpdateBucketRequest { @@ -3021,7 +3204,7 @@ function createBaseGetBucketRequest(): GetBucketRequest { export const GetBucketRequest = { typeUrl: "/google.logging.v2.GetBucketRequest", encode(message: GetBucketRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.name !== undefined) { + if (message.name !== "") { writer.uint32(10).string(message.name); } return writer; @@ -3044,9 +3227,9 @@ export const GetBucketRequest = { return message; }, fromJSON(object: any): GetBucketRequest { - const obj = createBaseGetBucketRequest(); - if (isSet(object.name)) obj.name = String(object.name); - return obj; + return { + name: isSet(object.name) ? String(object.name) : "" + }; }, toJSON(message: GetBucketRequest): JsonSafe<GetBucketRequest> { const obj: any = {}; @@ -3109,7 +3292,7 @@ function createBaseDeleteBucketRequest(): DeleteBucketRequest { export const DeleteBucketRequest = { typeUrl: "/google.logging.v2.DeleteBucketRequest", encode(message: DeleteBucketRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.name !== undefined) { + if (message.name !== "") { writer.uint32(10).string(message.name); } return writer; @@ -3132,9 +3315,9 @@ export const DeleteBucketRequest = { return message; }, fromJSON(object: any): DeleteBucketRequest { - const obj = createBaseDeleteBucketRequest(); - if (isSet(object.name)) obj.name = String(object.name); - return obj; + return { + name: isSet(object.name) ? String(object.name) : "" + }; }, toJSON(message: DeleteBucketRequest): JsonSafe<DeleteBucketRequest> { const obj: any = {}; @@ -3197,7 +3380,7 @@ function createBaseUndeleteBucketRequest(): UndeleteBucketRequest { export const UndeleteBucketRequest = { typeUrl: "/google.logging.v2.UndeleteBucketRequest", encode(message: UndeleteBucketRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.name !== undefined) { + if (message.name !== "") { writer.uint32(10).string(message.name); } return writer; @@ -3220,9 +3403,9 @@ export const UndeleteBucketRequest = { return message; }, fromJSON(object: any): UndeleteBucketRequest { - const obj = createBaseUndeleteBucketRequest(); - if (isSet(object.name)) obj.name = String(object.name); - return obj; + return { + name: isSet(object.name) ? String(object.name) : "" + }; }, toJSON(message: UndeleteBucketRequest): JsonSafe<UndeleteBucketRequest> { const obj: any = {}; @@ -3287,13 +3470,13 @@ function createBaseListViewsRequest(): ListViewsRequest { export const ListViewsRequest = { typeUrl: "/google.logging.v2.ListViewsRequest", encode(message: ListViewsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.parent !== undefined) { + if (message.parent !== "") { writer.uint32(10).string(message.parent); } - if (message.pageToken !== undefined) { + if (message.pageToken !== "") { writer.uint32(18).string(message.pageToken); } - if (message.pageSize !== undefined) { + if (message.pageSize !== 0) { writer.uint32(24).int32(message.pageSize); } return writer; @@ -3322,11 +3505,11 @@ export const ListViewsRequest = { return message; }, fromJSON(object: any): ListViewsRequest { - 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; + return { + parent: isSet(object.parent) ? String(object.parent) : "", + pageToken: isSet(object.pageToken) ? String(object.pageToken) : "", + pageSize: isSet(object.pageSize) ? Number(object.pageSize) : 0 + }; }, toJSON(message: ListViewsRequest): JsonSafe<ListViewsRequest> { const obj: any = {}; @@ -3411,7 +3594,7 @@ export const ListViewsResponse = { for (const v of message.views) { LogView.encode(v!, writer.uint32(10).fork()).ldelim(); } - if (message.nextPageToken !== undefined) { + if (message.nextPageToken !== "") { writer.uint32(18).string(message.nextPageToken); } return writer; @@ -3437,10 +3620,10 @@ export const ListViewsResponse = { return message; }, fromJSON(object: any): ListViewsResponse { - 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; + return { + views: Array.isArray(object?.views) ? object.views.map((e: any) => LogView.fromJSON(e)) : [], + nextPageToken: isSet(object.nextPageToken) ? String(object.nextPageToken) : "" + }; }, toJSON(message: ListViewsResponse): JsonSafe<ListViewsResponse> { const obj: any = {}; @@ -3524,10 +3707,10 @@ function createBaseCreateViewRequest(): CreateViewRequest { export const CreateViewRequest = { typeUrl: "/google.logging.v2.CreateViewRequest", encode(message: CreateViewRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.parent !== undefined) { + if (message.parent !== "") { writer.uint32(10).string(message.parent); } - if (message.viewId !== undefined) { + if (message.viewId !== "") { writer.uint32(18).string(message.viewId); } if (message.view !== undefined) { @@ -3559,11 +3742,11 @@ export const CreateViewRequest = { return message; }, fromJSON(object: any): CreateViewRequest { - 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; + return { + parent: isSet(object.parent) ? String(object.parent) : "", + viewId: isSet(object.viewId) ? String(object.viewId) : "", + view: isSet(object.view) ? LogView.fromJSON(object.view) : undefined + }; }, toJSON(message: CreateViewRequest): JsonSafe<CreateViewRequest> { const obj: any = {}; @@ -3576,9 +3759,7 @@ export const CreateViewRequest = { const message = createBaseCreateViewRequest(); message.parent = object.parent ?? ""; message.viewId = object.viewId ?? ""; - if (object.view !== undefined && object.view !== null) { - message.view = LogView.fromPartial(object.view); - } + message.view = object.view !== undefined && object.view !== null ? LogView.fromPartial(object.view) : undefined; return message; }, fromSDK(object: CreateViewRequestSDKType): CreateViewRequest { @@ -3648,7 +3829,7 @@ function createBaseUpdateViewRequest(): UpdateViewRequest { export const UpdateViewRequest = { typeUrl: "/google.logging.v2.UpdateViewRequest", encode(message: UpdateViewRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.name !== undefined) { + if (message.name !== "") { writer.uint32(10).string(message.name); } if (message.view !== undefined) { @@ -3683,11 +3864,11 @@ export const UpdateViewRequest = { return message; }, fromJSON(object: any): UpdateViewRequest { - 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; + 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 + }; }, toJSON(message: UpdateViewRequest): JsonSafe<UpdateViewRequest> { const obj: any = {}; @@ -3699,12 +3880,8 @@ export const UpdateViewRequest = { fromPartial(object: DeepPartial<UpdateViewRequest>): UpdateViewRequest { const message = createBaseUpdateViewRequest(); message.name = object.name ?? ""; - 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); - } + 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; return message; }, fromSDK(object: UpdateViewRequestSDKType): UpdateViewRequest { @@ -3772,7 +3949,7 @@ function createBaseGetViewRequest(): GetViewRequest { export const GetViewRequest = { typeUrl: "/google.logging.v2.GetViewRequest", encode(message: GetViewRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.name !== undefined) { + if (message.name !== "") { writer.uint32(10).string(message.name); } return writer; @@ -3795,9 +3972,9 @@ export const GetViewRequest = { return message; }, fromJSON(object: any): GetViewRequest { - const obj = createBaseGetViewRequest(); - if (isSet(object.name)) obj.name = String(object.name); - return obj; + return { + name: isSet(object.name) ? String(object.name) : "" + }; }, toJSON(message: GetViewRequest): JsonSafe<GetViewRequest> { const obj: any = {}; @@ -3860,7 +4037,7 @@ function createBaseDeleteViewRequest(): DeleteViewRequest { export const DeleteViewRequest = { typeUrl: "/google.logging.v2.DeleteViewRequest", encode(message: DeleteViewRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.name !== undefined) { + if (message.name !== "") { writer.uint32(10).string(message.name); } return writer; @@ -3883,9 +4060,9 @@ export const DeleteViewRequest = { return message; }, fromJSON(object: any): DeleteViewRequest { - const obj = createBaseDeleteViewRequest(); - if (isSet(object.name)) obj.name = String(object.name); - return obj; + return { + name: isSet(object.name) ? String(object.name) : "" + }; }, toJSON(message: DeleteViewRequest): JsonSafe<DeleteViewRequest> { const obj: any = {}; @@ -3950,13 +4127,13 @@ function createBaseListSinksRequest(): ListSinksRequest { export const ListSinksRequest = { typeUrl: "/google.logging.v2.ListSinksRequest", encode(message: ListSinksRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.parent !== undefined) { + if (message.parent !== "") { writer.uint32(10).string(message.parent); } - if (message.pageToken !== undefined) { + if (message.pageToken !== "") { writer.uint32(18).string(message.pageToken); } - if (message.pageSize !== undefined) { + if (message.pageSize !== 0) { writer.uint32(24).int32(message.pageSize); } return writer; @@ -3985,11 +4162,11 @@ export const ListSinksRequest = { return message; }, fromJSON(object: any): ListSinksRequest { - 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; + return { + parent: isSet(object.parent) ? String(object.parent) : "", + pageToken: isSet(object.pageToken) ? String(object.pageToken) : "", + pageSize: isSet(object.pageSize) ? Number(object.pageSize) : 0 + }; }, toJSON(message: ListSinksRequest): JsonSafe<ListSinksRequest> { const obj: any = {}; @@ -4074,7 +4251,7 @@ export const ListSinksResponse = { for (const v of message.sinks) { LogSink.encode(v!, writer.uint32(10).fork()).ldelim(); } - if (message.nextPageToken !== undefined) { + if (message.nextPageToken !== "") { writer.uint32(18).string(message.nextPageToken); } return writer; @@ -4100,10 +4277,10 @@ export const ListSinksResponse = { return message; }, fromJSON(object: any): ListSinksResponse { - 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; + return { + sinks: Array.isArray(object?.sinks) ? object.sinks.map((e: any) => LogSink.fromJSON(e)) : [], + nextPageToken: isSet(object.nextPageToken) ? String(object.nextPageToken) : "" + }; }, toJSON(message: ListSinksResponse): JsonSafe<ListSinksResponse> { const obj: any = {}; @@ -4185,7 +4362,7 @@ function createBaseGetSinkRequest(): GetSinkRequest { export const GetSinkRequest = { typeUrl: "/google.logging.v2.GetSinkRequest", encode(message: GetSinkRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.sinkName !== undefined) { + if (message.sinkName !== "") { writer.uint32(10).string(message.sinkName); } return writer; @@ -4208,9 +4385,9 @@ export const GetSinkRequest = { return message; }, fromJSON(object: any): GetSinkRequest { - const obj = createBaseGetSinkRequest(); - if (isSet(object.sinkName)) obj.sinkName = String(object.sinkName); - return obj; + return { + sinkName: isSet(object.sinkName) ? String(object.sinkName) : "" + }; }, toJSON(message: GetSinkRequest): JsonSafe<GetSinkRequest> { const obj: any = {}; @@ -4275,13 +4452,13 @@ function createBaseCreateSinkRequest(): CreateSinkRequest { export const CreateSinkRequest = { typeUrl: "/google.logging.v2.CreateSinkRequest", encode(message: CreateSinkRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.parent !== undefined) { + if (message.parent !== "") { writer.uint32(10).string(message.parent); } if (message.sink !== undefined) { LogSink.encode(message.sink, writer.uint32(18).fork()).ldelim(); } - if (message.uniqueWriterIdentity !== undefined) { + if (message.uniqueWriterIdentity === true) { writer.uint32(24).bool(message.uniqueWriterIdentity); } return writer; @@ -4310,11 +4487,11 @@ export const CreateSinkRequest = { return message; }, fromJSON(object: any): CreateSinkRequest { - 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; + 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 + }; }, toJSON(message: CreateSinkRequest): JsonSafe<CreateSinkRequest> { const obj: any = {}; @@ -4326,9 +4503,7 @@ export const CreateSinkRequest = { fromPartial(object: DeepPartial<CreateSinkRequest>): CreateSinkRequest { const message = createBaseCreateSinkRequest(); message.parent = object.parent ?? ""; - if (object.sink !== undefined && object.sink !== null) { - message.sink = LogSink.fromPartial(object.sink); - } + message.sink = object.sink !== undefined && object.sink !== null ? LogSink.fromPartial(object.sink) : undefined; message.uniqueWriterIdentity = object.uniqueWriterIdentity ?? false; return message; }, @@ -4400,13 +4575,13 @@ function createBaseUpdateSinkRequest(): UpdateSinkRequest { export const UpdateSinkRequest = { typeUrl: "/google.logging.v2.UpdateSinkRequest", encode(message: UpdateSinkRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.sinkName !== undefined) { + if (message.sinkName !== "") { writer.uint32(10).string(message.sinkName); } if (message.sink !== undefined) { LogSink.encode(message.sink, writer.uint32(18).fork()).ldelim(); } - if (message.uniqueWriterIdentity !== undefined) { + if (message.uniqueWriterIdentity === true) { writer.uint32(24).bool(message.uniqueWriterIdentity); } if (message.updateMask !== undefined) { @@ -4441,12 +4616,12 @@ export const UpdateSinkRequest = { return message; }, fromJSON(object: any): UpdateSinkRequest { - 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; + 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 + }; }, toJSON(message: UpdateSinkRequest): JsonSafe<UpdateSinkRequest> { const obj: any = {}; @@ -4459,13 +4634,9 @@ export const UpdateSinkRequest = { fromPartial(object: DeepPartial<UpdateSinkRequest>): UpdateSinkRequest { const message = createBaseUpdateSinkRequest(); message.sinkName = object.sinkName ?? ""; - if (object.sink !== undefined && object.sink !== null) { - message.sink = LogSink.fromPartial(object.sink); - } + message.sink = object.sink !== undefined && object.sink !== null ? LogSink.fromPartial(object.sink) : undefined; message.uniqueWriterIdentity = object.uniqueWriterIdentity ?? false; - if (object.updateMask !== undefined && object.updateMask !== null) { - message.updateMask = FieldMask.fromPartial(object.updateMask); - } + message.updateMask = object.updateMask !== undefined && object.updateMask !== null ? FieldMask.fromPartial(object.updateMask) : undefined; return message; }, fromSDK(object: UpdateSinkRequestSDKType): UpdateSinkRequest { @@ -4540,7 +4711,7 @@ function createBaseDeleteSinkRequest(): DeleteSinkRequest { export const DeleteSinkRequest = { typeUrl: "/google.logging.v2.DeleteSinkRequest", encode(message: DeleteSinkRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.sinkName !== undefined) { + if (message.sinkName !== "") { writer.uint32(10).string(message.sinkName); } return writer; @@ -4563,9 +4734,9 @@ export const DeleteSinkRequest = { return message; }, fromJSON(object: any): DeleteSinkRequest { - const obj = createBaseDeleteSinkRequest(); - if (isSet(object.sinkName)) obj.sinkName = String(object.sinkName); - return obj; + return { + sinkName: isSet(object.sinkName) ? String(object.sinkName) : "" + }; }, toJSON(message: DeleteSinkRequest): JsonSafe<DeleteSinkRequest> { const obj: any = {}; @@ -4633,16 +4804,16 @@ function createBaseLogExclusion(): LogExclusion { export const LogExclusion = { typeUrl: "/google.logging.v2.LogExclusion", encode(message: LogExclusion, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.name !== undefined) { + if (message.name !== "") { writer.uint32(10).string(message.name); } - if (message.description !== undefined) { + if (message.description !== "") { writer.uint32(18).string(message.description); } - if (message.filter !== undefined) { + if (message.filter !== "") { writer.uint32(26).string(message.filter); } - if (message.disabled !== undefined) { + if (message.disabled === true) { writer.uint32(32).bool(message.disabled); } if (message.createTime !== undefined) { @@ -4686,14 +4857,14 @@ export const LogExclusion = { return message; }, fromJSON(object: any): LogExclusion { - 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; + 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 + }; }, toJSON(message: LogExclusion): JsonSafe<LogExclusion> { const obj: any = {}; @@ -4803,13 +4974,13 @@ function createBaseListExclusionsRequest(): ListExclusionsRequest { export const ListExclusionsRequest = { typeUrl: "/google.logging.v2.ListExclusionsRequest", encode(message: ListExclusionsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.parent !== undefined) { + if (message.parent !== "") { writer.uint32(10).string(message.parent); } - if (message.pageToken !== undefined) { + if (message.pageToken !== "") { writer.uint32(18).string(message.pageToken); } - if (message.pageSize !== undefined) { + if (message.pageSize !== 0) { writer.uint32(24).int32(message.pageSize); } return writer; @@ -4838,11 +5009,11 @@ export const ListExclusionsRequest = { return message; }, fromJSON(object: any): ListExclusionsRequest { - 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; + return { + parent: isSet(object.parent) ? String(object.parent) : "", + pageToken: isSet(object.pageToken) ? String(object.pageToken) : "", + pageSize: isSet(object.pageSize) ? Number(object.pageSize) : 0 + }; }, toJSON(message: ListExclusionsRequest): JsonSafe<ListExclusionsRequest> { const obj: any = {}; @@ -4927,7 +5098,7 @@ export const ListExclusionsResponse = { for (const v of message.exclusions) { LogExclusion.encode(v!, writer.uint32(10).fork()).ldelim(); } - if (message.nextPageToken !== undefined) { + if (message.nextPageToken !== "") { writer.uint32(18).string(message.nextPageToken); } return writer; @@ -4953,10 +5124,10 @@ export const ListExclusionsResponse = { return message; }, fromJSON(object: any): ListExclusionsResponse { - 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; + return { + exclusions: Array.isArray(object?.exclusions) ? object.exclusions.map((e: any) => LogExclusion.fromJSON(e)) : [], + nextPageToken: isSet(object.nextPageToken) ? String(object.nextPageToken) : "" + }; }, toJSON(message: ListExclusionsResponse): JsonSafe<ListExclusionsResponse> { const obj: any = {}; @@ -5038,7 +5209,7 @@ function createBaseGetExclusionRequest(): GetExclusionRequest { export const GetExclusionRequest = { typeUrl: "/google.logging.v2.GetExclusionRequest", encode(message: GetExclusionRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.name !== undefined) { + if (message.name !== "") { writer.uint32(10).string(message.name); } return writer; @@ -5061,9 +5232,9 @@ export const GetExclusionRequest = { return message; }, fromJSON(object: any): GetExclusionRequest { - const obj = createBaseGetExclusionRequest(); - if (isSet(object.name)) obj.name = String(object.name); - return obj; + return { + name: isSet(object.name) ? String(object.name) : "" + }; }, toJSON(message: GetExclusionRequest): JsonSafe<GetExclusionRequest> { const obj: any = {}; @@ -5127,7 +5298,7 @@ function createBaseCreateExclusionRequest(): CreateExclusionRequest { export const CreateExclusionRequest = { typeUrl: "/google.logging.v2.CreateExclusionRequest", encode(message: CreateExclusionRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.parent !== undefined) { + if (message.parent !== "") { writer.uint32(10).string(message.parent); } if (message.exclusion !== undefined) { @@ -5156,10 +5327,10 @@ export const CreateExclusionRequest = { return message; }, fromJSON(object: any): CreateExclusionRequest { - const obj = createBaseCreateExclusionRequest(); - if (isSet(object.parent)) obj.parent = String(object.parent); - if (isSet(object.exclusion)) obj.exclusion = LogExclusion.fromJSON(object.exclusion); - return obj; + return { + parent: isSet(object.parent) ? String(object.parent) : "", + exclusion: isSet(object.exclusion) ? LogExclusion.fromJSON(object.exclusion) : undefined + }; }, toJSON(message: CreateExclusionRequest): JsonSafe<CreateExclusionRequest> { const obj: any = {}; @@ -5170,9 +5341,7 @@ export const CreateExclusionRequest = { fromPartial(object: DeepPartial<CreateExclusionRequest>): CreateExclusionRequest { const message = createBaseCreateExclusionRequest(); message.parent = object.parent ?? ""; - if (object.exclusion !== undefined && object.exclusion !== null) { - message.exclusion = LogExclusion.fromPartial(object.exclusion); - } + message.exclusion = object.exclusion !== undefined && object.exclusion !== null ? LogExclusion.fromPartial(object.exclusion) : undefined; return message; }, fromSDK(object: CreateExclusionRequestSDKType): CreateExclusionRequest { @@ -5235,7 +5404,7 @@ function createBaseUpdateExclusionRequest(): UpdateExclusionRequest { export const UpdateExclusionRequest = { typeUrl: "/google.logging.v2.UpdateExclusionRequest", encode(message: UpdateExclusionRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.name !== undefined) { + if (message.name !== "") { writer.uint32(10).string(message.name); } if (message.exclusion !== undefined) { @@ -5270,11 +5439,11 @@ export const UpdateExclusionRequest = { return message; }, fromJSON(object: any): UpdateExclusionRequest { - 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; + 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 + }; }, toJSON(message: UpdateExclusionRequest): JsonSafe<UpdateExclusionRequest> { const obj: any = {}; @@ -5286,12 +5455,8 @@ export const UpdateExclusionRequest = { fromPartial(object: DeepPartial<UpdateExclusionRequest>): UpdateExclusionRequest { const message = createBaseUpdateExclusionRequest(); message.name = object.name ?? ""; - 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); - } + 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; return message; }, fromSDK(object: UpdateExclusionRequestSDKType): UpdateExclusionRequest { @@ -5359,7 +5524,7 @@ function createBaseDeleteExclusionRequest(): DeleteExclusionRequest { export const DeleteExclusionRequest = { typeUrl: "/google.logging.v2.DeleteExclusionRequest", encode(message: DeleteExclusionRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.name !== undefined) { + if (message.name !== "") { writer.uint32(10).string(message.name); } return writer; @@ -5382,9 +5547,9 @@ export const DeleteExclusionRequest = { return message; }, fromJSON(object: any): DeleteExclusionRequest { - const obj = createBaseDeleteExclusionRequest(); - if (isSet(object.name)) obj.name = String(object.name); - return obj; + return { + name: isSet(object.name) ? String(object.name) : "" + }; }, toJSON(message: DeleteExclusionRequest): JsonSafe<DeleteExclusionRequest> { const obj: any = {}; @@ -5447,7 +5612,7 @@ function createBaseGetCmekSettingsRequest(): GetCmekSettingsRequest { export const GetCmekSettingsRequest = { typeUrl: "/google.logging.v2.GetCmekSettingsRequest", encode(message: GetCmekSettingsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.name !== undefined) { + if (message.name !== "") { writer.uint32(10).string(message.name); } return writer; @@ -5470,9 +5635,9 @@ export const GetCmekSettingsRequest = { return message; }, fromJSON(object: any): GetCmekSettingsRequest { - const obj = createBaseGetCmekSettingsRequest(); - if (isSet(object.name)) obj.name = String(object.name); - return obj; + return { + name: isSet(object.name) ? String(object.name) : "" + }; }, toJSON(message: GetCmekSettingsRequest): JsonSafe<GetCmekSettingsRequest> { const obj: any = {}; @@ -5537,7 +5702,7 @@ function createBaseUpdateCmekSettingsRequest(): UpdateCmekSettingsRequest { export const UpdateCmekSettingsRequest = { typeUrl: "/google.logging.v2.UpdateCmekSettingsRequest", encode(message: UpdateCmekSettingsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.name !== undefined) { + if (message.name !== "") { writer.uint32(10).string(message.name); } if (message.cmekSettings !== undefined) { @@ -5572,11 +5737,11 @@ export const UpdateCmekSettingsRequest = { return message; }, fromJSON(object: any): UpdateCmekSettingsRequest { - 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; + 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 + }; }, toJSON(message: UpdateCmekSettingsRequest): JsonSafe<UpdateCmekSettingsRequest> { const obj: any = {}; @@ -5588,12 +5753,8 @@ export const UpdateCmekSettingsRequest = { fromPartial(object: DeepPartial<UpdateCmekSettingsRequest>): UpdateCmekSettingsRequest { const message = createBaseUpdateCmekSettingsRequest(); message.name = object.name ?? ""; - 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); - } + 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; return message; }, fromSDK(object: UpdateCmekSettingsRequestSDKType): UpdateCmekSettingsRequest { @@ -5663,13 +5824,13 @@ function createBaseCmekSettings(): CmekSettings { export const CmekSettings = { typeUrl: "/google.logging.v2.CmekSettings", encode(message: CmekSettings, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.name !== undefined) { + if (message.name !== "") { writer.uint32(10).string(message.name); } - if (message.kmsKeyName !== undefined) { + if (message.kmsKeyName !== "") { writer.uint32(18).string(message.kmsKeyName); } - if (message.serviceAccountId !== undefined) { + if (message.serviceAccountId !== "") { writer.uint32(26).string(message.serviceAccountId); } return writer; @@ -5698,11 +5859,11 @@ export const CmekSettings = { return message; }, fromJSON(object: any): CmekSettings { - 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; + return { + name: isSet(object.name) ? String(object.name) : "", + kmsKeyName: isSet(object.kmsKeyName) ? String(object.kmsKeyName) : "", + serviceAccountId: isSet(object.serviceAccountId) ? String(object.serviceAccountId) : "" + }; }, toJSON(message: CmekSettings): JsonSafe<CmekSettings> { const obj: any = {}; @@ -5783,7 +5944,7 @@ function createBaseGetSettingsRequest(): GetSettingsRequest { export const GetSettingsRequest = { typeUrl: "/google.logging.v2.GetSettingsRequest", encode(message: GetSettingsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.name !== undefined) { + if (message.name !== "") { writer.uint32(10).string(message.name); } return writer; @@ -5806,9 +5967,9 @@ export const GetSettingsRequest = { return message; }, fromJSON(object: any): GetSettingsRequest { - const obj = createBaseGetSettingsRequest(); - if (isSet(object.name)) obj.name = String(object.name); - return obj; + return { + name: isSet(object.name) ? String(object.name) : "" + }; }, toJSON(message: GetSettingsRequest): JsonSafe<GetSettingsRequest> { const obj: any = {}; @@ -5873,7 +6034,7 @@ function createBaseUpdateSettingsRequest(): UpdateSettingsRequest { export const UpdateSettingsRequest = { typeUrl: "/google.logging.v2.UpdateSettingsRequest", encode(message: UpdateSettingsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.name !== undefined) { + if (message.name !== "") { writer.uint32(10).string(message.name); } if (message.settings !== undefined) { @@ -5908,11 +6069,11 @@ export const UpdateSettingsRequest = { return message; }, fromJSON(object: any): UpdateSettingsRequest { - 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; + 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 + }; }, toJSON(message: UpdateSettingsRequest): JsonSafe<UpdateSettingsRequest> { const obj: any = {}; @@ -5924,12 +6085,8 @@ export const UpdateSettingsRequest = { fromPartial(object: DeepPartial<UpdateSettingsRequest>): UpdateSettingsRequest { const message = createBaseUpdateSettingsRequest(); message.name = object.name ?? ""; - 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); - } + 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; return message; }, fromSDK(object: UpdateSettingsRequestSDKType): UpdateSettingsRequest { @@ -6001,19 +6158,19 @@ function createBaseSettings(): Settings { export const Settings = { typeUrl: "/google.logging.v2.Settings", encode(message: Settings, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.name !== undefined) { + if (message.name !== "") { writer.uint32(10).string(message.name); } - if (message.kmsKeyName !== undefined) { + if (message.kmsKeyName !== "") { writer.uint32(18).string(message.kmsKeyName); } - if (message.kmsServiceAccountId !== undefined) { + if (message.kmsServiceAccountId !== "") { writer.uint32(26).string(message.kmsServiceAccountId); } - if (message.storageLocation !== undefined) { + if (message.storageLocation !== "") { writer.uint32(34).string(message.storageLocation); } - if (message.disableDefaultSink !== undefined) { + if (message.disableDefaultSink === true) { writer.uint32(40).bool(message.disableDefaultSink); } return writer; @@ -6048,13 +6205,13 @@ export const Settings = { return message; }, fromJSON(object: any): Settings { - 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; + 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 + }; }, toJSON(message: Settings): JsonSafe<Settings> { const obj: any = {}; @@ -6155,13 +6312,13 @@ function createBaseCopyLogEntriesRequest(): CopyLogEntriesRequest { export const CopyLogEntriesRequest = { typeUrl: "/google.logging.v2.CopyLogEntriesRequest", encode(message: CopyLogEntriesRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.name !== undefined) { + if (message.name !== "") { writer.uint32(10).string(message.name); } - if (message.filter !== undefined) { + if (message.filter !== "") { writer.uint32(26).string(message.filter); } - if (message.destination !== undefined) { + if (message.destination !== "") { writer.uint32(34).string(message.destination); } return writer; @@ -6190,11 +6347,11 @@ export const CopyLogEntriesRequest = { return message; }, fromJSON(object: any): CopyLogEntriesRequest { - 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; + return { + name: isSet(object.name) ? String(object.name) : "", + filter: isSet(object.filter) ? String(object.filter) : "", + destination: isSet(object.destination) ? String(object.destination) : "" + }; }, toJSON(message: CopyLogEntriesRequest): JsonSafe<CopyLogEntriesRequest> { const obj: any = {}; @@ -6290,16 +6447,16 @@ export const CopyLogEntriesMetadata = { if (message.state !== 0) { writer.uint32(24).int32(message.state); } - if (message.cancellationRequested !== undefined) { + if (message.cancellationRequested === true) { writer.uint32(32).bool(message.cancellationRequested); } if (message.request !== undefined) { CopyLogEntriesRequest.encode(message.request, writer.uint32(42).fork()).ldelim(); } - if (message.progress !== undefined) { + if (message.progress !== 0) { writer.uint32(48).int32(message.progress); } - if (message.writerIdentity !== undefined) { + if (message.writerIdentity !== "") { writer.uint32(58).string(message.writerIdentity); } return writer; @@ -6340,15 +6497,15 @@ export const CopyLogEntriesMetadata = { return message; }, fromJSON(object: any): CopyLogEntriesMetadata { - 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; + 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) : "" + }; }, toJSON(message: CopyLogEntriesMetadata): JsonSafe<CopyLogEntriesMetadata> { const obj: any = {}; @@ -6367,9 +6524,7 @@ export const CopyLogEntriesMetadata = { message.endTime = object.endTime ?? undefined; message.state = object.state ?? 0; message.cancellationRequested = object.cancellationRequested ?? false; - if (object.request !== undefined && object.request !== null) { - message.request = CopyLogEntriesRequest.fromPartial(object.request); - } + message.request = object.request !== undefined && object.request !== null ? CopyLogEntriesRequest.fromPartial(object.request) : undefined; message.progress = object.progress ?? 0; message.writerIdentity = object.writerIdentity ?? ""; return message; @@ -6467,7 +6622,7 @@ function createBaseCopyLogEntriesResponse(): CopyLogEntriesResponse { export const CopyLogEntriesResponse = { typeUrl: "/google.logging.v2.CopyLogEntriesResponse", encode(message: CopyLogEntriesResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.logEntriesCopiedCount !== undefined) { + if (message.logEntriesCopiedCount !== BigInt(0)) { writer.uint32(8).int64(message.logEntriesCopiedCount); } return writer; @@ -6490,9 +6645,9 @@ export const CopyLogEntriesResponse = { return message; }, fromJSON(object: any): CopyLogEntriesResponse { - const obj = createBaseCopyLogEntriesResponse(); - if (isSet(object.logEntriesCopiedCount)) obj.logEntriesCopiedCount = BigInt(object.logEntriesCopiedCount.toString()); - return obj; + return { + logEntriesCopiedCount: isSet(object.logEntriesCopiedCount) ? BigInt(object.logEntriesCopiedCount.toString()) : BigInt(0) + }; }, toJSON(message: CopyLogEntriesResponse): JsonSafe<CopyLogEntriesResponse> { const obj: any = {}; @@ -6501,9 +6656,7 @@ export const CopyLogEntriesResponse = { }, fromPartial(object: DeepPartial<CopyLogEntriesResponse>): CopyLogEntriesResponse { const message = createBaseCopyLogEntriesResponse(); - if (object.logEntriesCopiedCount !== undefined && object.logEntriesCopiedCount !== null) { - message.logEntriesCopiedCount = BigInt(object.logEntriesCopiedCount.toString()); - } + message.logEntriesCopiedCount = object.logEntriesCopiedCount !== undefined && object.logEntriesCopiedCount !== null ? BigInt(object.logEntriesCopiedCount.toString()) : BigInt(0); 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 d963191aba..5b9a4c6b08 100644 --- a/__fixtures__/v-next/outputv4/google/logging/v2/logging_metrics.ts +++ b/__fixtures__/v-next/outputv4/google/logging/v2/logging_metrics.ts @@ -1,9 +1,10 @@ -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"; +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"; export const protobufPackage = "google.logging.v2"; /** Logging API version. */ export enum LogMetric_ApiVersion { @@ -43,6 +44,10 @@ export interface LogMetric_LabelExtractorsEntry { key: string; value: string; } +export interface ReactiveLogMetric_LabelExtractorsEntry { + key: ComputedRef<string>; + value: ComputedRef<string>; +} export interface LogMetric_LabelExtractorsEntryProtoMsg { typeUrl: string; value: Uint8Array; @@ -187,6 +192,21 @@ export interface LogMetric { /** @deprecated */ version: LogMetric_ApiVersion; } +export interface ReactiveLogMetric { + name: ComputedRef<string>; + description: ComputedRef<string>; + filter: ComputedRef<string>; + disabled: ComputedRef<boolean>; + metricDescriptor?: ComputedRef<MetricDescriptor>; + valueExtractor: ComputedRef<string>; + labelExtractors: ComputedRef<{ + [key: string]: string; + }>; + bucketOptions?: ComputedRef<Distribution_BucketOptions>; + createTime?: ComputedRef<Date>; + updateTime?: ComputedRef<Date>; + version: ComputedRef<LogMetric_ApiVersion>; +} export interface LogMetricProtoMsg { typeUrl: "/google.logging.v2.LogMetric"; value: Uint8Array; @@ -238,6 +258,11 @@ export interface ListLogMetricsRequest { */ pageSize: number; } +export interface ReactiveListLogMetricsRequest { + parent: ComputedRef<string>; + pageToken: ComputedRef<string>; + pageSize: ComputedRef<number>; +} export interface ListLogMetricsRequestProtoMsg { typeUrl: "/google.logging.v2.ListLogMetricsRequest"; value: Uint8Array; @@ -259,6 +284,10 @@ export interface ListLogMetricsResponse { */ nextPageToken: string; } +export interface ReactiveListLogMetricsResponse { + metrics: ComputedRef<LogMetric[]>; + nextPageToken: ComputedRef<string>; +} export interface ListLogMetricsResponseProtoMsg { typeUrl: "/google.logging.v2.ListLogMetricsResponse"; value: Uint8Array; @@ -277,6 +306,9 @@ export interface GetLogMetricRequest { */ metricName: string; } +export interface ReactiveGetLogMetricRequest { + metricName: ComputedRef<string>; +} export interface GetLogMetricRequestProtoMsg { typeUrl: "/google.logging.v2.GetLogMetricRequest"; value: Uint8Array; @@ -301,6 +333,10 @@ export interface CreateLogMetricRequest { */ metric?: LogMetric; } +export interface ReactiveCreateLogMetricRequest { + parent: ComputedRef<string>; + metric?: ComputedRef<LogMetric>; +} export interface CreateLogMetricRequestProtoMsg { typeUrl: "/google.logging.v2.CreateLogMetricRequest"; value: Uint8Array; @@ -325,6 +361,10 @@ export interface UpdateLogMetricRequest { /** Required. The updated metric. */ metric?: LogMetric; } +export interface ReactiveUpdateLogMetricRequest { + metricName: ComputedRef<string>; + metric?: ComputedRef<LogMetric>; +} export interface UpdateLogMetricRequestProtoMsg { typeUrl: "/google.logging.v2.UpdateLogMetricRequest"; value: Uint8Array; @@ -343,6 +383,9 @@ export interface DeleteLogMetricRequest { */ metricName: string; } +export interface ReactiveDeleteLogMetricRequest { + metricName: ComputedRef<string>; +} export interface DeleteLogMetricRequestProtoMsg { typeUrl: "/google.logging.v2.DeleteLogMetricRequest"; value: Uint8Array; @@ -359,10 +402,10 @@ function createBaseLogMetric_LabelExtractorsEntry(): LogMetric_LabelExtractorsEn } export const LogMetric_LabelExtractorsEntry = { encode(message: LogMetric_LabelExtractorsEntry, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.key !== undefined) { + if (message.key !== "") { writer.uint32(10).string(message.key); } - if (message.value !== undefined) { + if (message.value !== "") { writer.uint32(18).string(message.value); } return writer; @@ -388,10 +431,10 @@ export const LogMetric_LabelExtractorsEntry = { return message; }, fromJSON(object: any): LogMetric_LabelExtractorsEntry { - const obj = createBaseLogMetric_LabelExtractorsEntry(); - if (isSet(object.key)) obj.key = String(object.key); - if (isSet(object.value)) obj.value = String(object.value); - return obj; + return { + key: isSet(object.key) ? String(object.key) : "", + value: isSet(object.value) ? String(object.value) : "" + }; }, toJSON(message: LogMetric_LabelExtractorsEntry): JsonSafe<LogMetric_LabelExtractorsEntry> { const obj: any = {}; @@ -467,22 +510,22 @@ function createBaseLogMetric(): LogMetric { export const LogMetric = { typeUrl: "/google.logging.v2.LogMetric", encode(message: LogMetric, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.name !== undefined) { + if (message.name !== "") { writer.uint32(10).string(message.name); } - if (message.description !== undefined) { + if (message.description !== "") { writer.uint32(18).string(message.description); } - if (message.filter !== undefined) { + if (message.filter !== "") { writer.uint32(26).string(message.filter); } - if (message.disabled !== undefined) { + if (message.disabled === true) { writer.uint32(96).bool(message.disabled); } if (message.metricDescriptor !== undefined) { MetricDescriptor.encode(message.metricDescriptor, writer.uint32(42).fork()).ldelim(); } - if (message.valueExtractor !== undefined) { + if (message.valueExtractor !== "") { writer.uint32(50).string(message.valueExtractor); } Object.entries(message.labelExtractors).forEach(([key, value]) => { @@ -556,24 +599,24 @@ export const LogMetric = { return message; }, fromJSON(object: any): LogMetric { - 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; + 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 + }; }, toJSON(message: LogMetric): JsonSafe<LogMetric> { const obj: any = {}; @@ -601,9 +644,7 @@ export const LogMetric = { message.description = object.description ?? ""; message.filter = object.filter ?? ""; message.disabled = object.disabled ?? false; - if (object.metricDescriptor !== undefined && object.metricDescriptor !== null) { - message.metricDescriptor = MetricDescriptor.fromPartial(object.metricDescriptor); - } + message.metricDescriptor = object.metricDescriptor !== undefined && object.metricDescriptor !== null ? MetricDescriptor.fromPartial(object.metricDescriptor) : undefined; message.valueExtractor = object.valueExtractor ?? ""; message.labelExtractors = Object.entries(object.labelExtractors ?? {}).reduce<{ [key: string]: string; @@ -613,9 +654,7 @@ export const LogMetric = { } return acc; }, {}); - if (object.bucketOptions !== undefined && object.bucketOptions !== null) { - message.bucketOptions = Distribution_BucketOptions.fromPartial(object.bucketOptions); - } + message.bucketOptions = object.bucketOptions !== undefined && object.bucketOptions !== null ? Distribution_BucketOptions.fromPartial(object.bucketOptions) : undefined; message.createTime = object.createTime ?? undefined; message.updateTime = object.updateTime ?? undefined; message.version = object.version ?? 0; @@ -769,13 +808,13 @@ function createBaseListLogMetricsRequest(): ListLogMetricsRequest { export const ListLogMetricsRequest = { typeUrl: "/google.logging.v2.ListLogMetricsRequest", encode(message: ListLogMetricsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.parent !== undefined) { + if (message.parent !== "") { writer.uint32(10).string(message.parent); } - if (message.pageToken !== undefined) { + if (message.pageToken !== "") { writer.uint32(18).string(message.pageToken); } - if (message.pageSize !== undefined) { + if (message.pageSize !== 0) { writer.uint32(24).int32(message.pageSize); } return writer; @@ -804,11 +843,11 @@ export const ListLogMetricsRequest = { return message; }, fromJSON(object: any): ListLogMetricsRequest { - 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; + return { + parent: isSet(object.parent) ? String(object.parent) : "", + pageToken: isSet(object.pageToken) ? String(object.pageToken) : "", + pageSize: isSet(object.pageSize) ? Number(object.pageSize) : 0 + }; }, toJSON(message: ListLogMetricsRequest): JsonSafe<ListLogMetricsRequest> { const obj: any = {}; @@ -893,7 +932,7 @@ export const ListLogMetricsResponse = { for (const v of message.metrics) { LogMetric.encode(v!, writer.uint32(10).fork()).ldelim(); } - if (message.nextPageToken !== undefined) { + if (message.nextPageToken !== "") { writer.uint32(18).string(message.nextPageToken); } return writer; @@ -919,10 +958,10 @@ export const ListLogMetricsResponse = { return message; }, fromJSON(object: any): ListLogMetricsResponse { - 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; + return { + metrics: Array.isArray(object?.metrics) ? object.metrics.map((e: any) => LogMetric.fromJSON(e)) : [], + nextPageToken: isSet(object.nextPageToken) ? String(object.nextPageToken) : "" + }; }, toJSON(message: ListLogMetricsResponse): JsonSafe<ListLogMetricsResponse> { const obj: any = {}; @@ -1004,7 +1043,7 @@ function createBaseGetLogMetricRequest(): GetLogMetricRequest { export const GetLogMetricRequest = { typeUrl: "/google.logging.v2.GetLogMetricRequest", encode(message: GetLogMetricRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.metricName !== undefined) { + if (message.metricName !== "") { writer.uint32(10).string(message.metricName); } return writer; @@ -1027,9 +1066,9 @@ export const GetLogMetricRequest = { return message; }, fromJSON(object: any): GetLogMetricRequest { - const obj = createBaseGetLogMetricRequest(); - if (isSet(object.metricName)) obj.metricName = String(object.metricName); - return obj; + return { + metricName: isSet(object.metricName) ? String(object.metricName) : "" + }; }, toJSON(message: GetLogMetricRequest): JsonSafe<GetLogMetricRequest> { const obj: any = {}; @@ -1093,7 +1132,7 @@ function createBaseCreateLogMetricRequest(): CreateLogMetricRequest { export const CreateLogMetricRequest = { typeUrl: "/google.logging.v2.CreateLogMetricRequest", encode(message: CreateLogMetricRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.parent !== undefined) { + if (message.parent !== "") { writer.uint32(10).string(message.parent); } if (message.metric !== undefined) { @@ -1122,10 +1161,10 @@ export const CreateLogMetricRequest = { return message; }, fromJSON(object: any): CreateLogMetricRequest { - const obj = createBaseCreateLogMetricRequest(); - if (isSet(object.parent)) obj.parent = String(object.parent); - if (isSet(object.metric)) obj.metric = LogMetric.fromJSON(object.metric); - return obj; + return { + parent: isSet(object.parent) ? String(object.parent) : "", + metric: isSet(object.metric) ? LogMetric.fromJSON(object.metric) : undefined + }; }, toJSON(message: CreateLogMetricRequest): JsonSafe<CreateLogMetricRequest> { const obj: any = {}; @@ -1136,9 +1175,7 @@ export const CreateLogMetricRequest = { fromPartial(object: DeepPartial<CreateLogMetricRequest>): CreateLogMetricRequest { const message = createBaseCreateLogMetricRequest(); message.parent = object.parent ?? ""; - if (object.metric !== undefined && object.metric !== null) { - message.metric = LogMetric.fromPartial(object.metric); - } + message.metric = object.metric !== undefined && object.metric !== null ? LogMetric.fromPartial(object.metric) : undefined; return message; }, fromSDK(object: CreateLogMetricRequestSDKType): CreateLogMetricRequest { @@ -1200,7 +1237,7 @@ function createBaseUpdateLogMetricRequest(): UpdateLogMetricRequest { export const UpdateLogMetricRequest = { typeUrl: "/google.logging.v2.UpdateLogMetricRequest", encode(message: UpdateLogMetricRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.metricName !== undefined) { + if (message.metricName !== "") { writer.uint32(10).string(message.metricName); } if (message.metric !== undefined) { @@ -1229,10 +1266,10 @@ export const UpdateLogMetricRequest = { return message; }, fromJSON(object: any): UpdateLogMetricRequest { - const obj = createBaseUpdateLogMetricRequest(); - if (isSet(object.metricName)) obj.metricName = String(object.metricName); - if (isSet(object.metric)) obj.metric = LogMetric.fromJSON(object.metric); - return obj; + return { + metricName: isSet(object.metricName) ? String(object.metricName) : "", + metric: isSet(object.metric) ? LogMetric.fromJSON(object.metric) : undefined + }; }, toJSON(message: UpdateLogMetricRequest): JsonSafe<UpdateLogMetricRequest> { const obj: any = {}; @@ -1243,9 +1280,7 @@ export const UpdateLogMetricRequest = { fromPartial(object: DeepPartial<UpdateLogMetricRequest>): UpdateLogMetricRequest { const message = createBaseUpdateLogMetricRequest(); message.metricName = object.metricName ?? ""; - if (object.metric !== undefined && object.metric !== null) { - message.metric = LogMetric.fromPartial(object.metric); - } + message.metric = object.metric !== undefined && object.metric !== null ? LogMetric.fromPartial(object.metric) : undefined; return message; }, fromSDK(object: UpdateLogMetricRequestSDKType): UpdateLogMetricRequest { @@ -1306,7 +1341,7 @@ function createBaseDeleteLogMetricRequest(): DeleteLogMetricRequest { export const DeleteLogMetricRequest = { typeUrl: "/google.logging.v2.DeleteLogMetricRequest", encode(message: DeleteLogMetricRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.metricName !== undefined) { + if (message.metricName !== "") { writer.uint32(10).string(message.metricName); } return writer; @@ -1329,9 +1364,9 @@ export const DeleteLogMetricRequest = { return message; }, fromJSON(object: any): DeleteLogMetricRequest { - const obj = createBaseDeleteLogMetricRequest(); - if (isSet(object.metricName)) obj.metricName = String(object.metricName); - return obj; + return { + metricName: isSet(object.metricName) ? String(object.metricName) : "" + }; }, toJSON(message: DeleteLogMetricRequest): JsonSafe<DeleteLogMetricRequest> { const obj: any = {}; diff --git a/__fixtures__/v-next/outputv4/google/longrunning/operations.ts b/__fixtures__/v-next/outputv4/google/longrunning/operations.ts index a096efd145..21cea55899 100644 --- a/__fixtures__/v-next/outputv4/google/longrunning/operations.ts +++ b/__fixtures__/v-next/outputv4/google/longrunning/operations.ts @@ -1,9 +1,10 @@ -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"; +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"; export const protobufPackage = "google.longrunning"; /** * This resource represents a long-running operation that is the result of a @@ -43,6 +44,13 @@ export interface Operation { */ response?: Any; } +export interface ReactiveOperation { + name: ComputedRef<string>; + metadata?: ComputedRef<Any>; + done: ComputedRef<boolean>; + error?: ComputedRef<Status>; + response?: ComputedRef<Any>; +} export interface OperationProtoMsg { typeUrl: "/google.longrunning.Operation"; value: Uint8Array; @@ -63,6 +71,9 @@ export interface GetOperationRequest { /** The name of the operation resource. */ name: string; } +export interface ReactiveGetOperationRequest { + name: ComputedRef<string>; +} export interface GetOperationRequestProtoMsg { typeUrl: "/google.longrunning.GetOperationRequest"; value: Uint8Array; @@ -82,6 +93,12 @@ export interface ListOperationsRequest { /** The standard list page token. */ pageToken: string; } +export interface ReactiveListOperationsRequest { + name: ComputedRef<string>; + filter: ComputedRef<string>; + pageSize: ComputedRef<number>; + pageToken: ComputedRef<string>; +} export interface ListOperationsRequestProtoMsg { typeUrl: "/google.longrunning.ListOperationsRequest"; value: Uint8Array; @@ -100,6 +117,10 @@ export interface ListOperationsResponse { /** The standard List next-page token. */ nextPageToken: string; } +export interface ReactiveListOperationsResponse { + operations: ComputedRef<Operation[]>; + nextPageToken: ComputedRef<string>; +} export interface ListOperationsResponseProtoMsg { typeUrl: "/google.longrunning.ListOperationsResponse"; value: Uint8Array; @@ -114,6 +135,9 @@ export interface CancelOperationRequest { /** The name of the operation resource to be cancelled. */ name: string; } +export interface ReactiveCancelOperationRequest { + name: ComputedRef<string>; +} export interface CancelOperationRequestProtoMsg { typeUrl: "/google.longrunning.CancelOperationRequest"; value: Uint8Array; @@ -127,6 +151,9 @@ export interface DeleteOperationRequest { /** The name of the operation resource to be deleted. */ name: string; } +export interface ReactiveDeleteOperationRequest { + name: ComputedRef<string>; +} export interface DeleteOperationRequestProtoMsg { typeUrl: "/google.longrunning.DeleteOperationRequest"; value: Uint8Array; @@ -146,6 +173,10 @@ export interface WaitOperationRequest { */ timeout?: Duration; } +export interface ReactiveWaitOperationRequest { + name: ComputedRef<string>; + timeout?: ComputedRef<Duration>; +} export interface WaitOperationRequestProtoMsg { typeUrl: "/google.longrunning.WaitOperationRequest"; value: Uint8Array; @@ -191,6 +222,10 @@ export interface OperationInfo { */ metadataType: string; } +export interface ReactiveOperationInfo { + responseType: ComputedRef<string>; + metadataType: ComputedRef<string>; +} export interface OperationInfoProtoMsg { typeUrl: "/google.longrunning.OperationInfo"; value: Uint8Array; @@ -224,13 +259,13 @@ function createBaseOperation(): Operation { export const Operation = { typeUrl: "/google.longrunning.Operation", encode(message: Operation, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.name !== undefined) { + if (message.name !== "") { writer.uint32(10).string(message.name); } if (message.metadata !== undefined) { Any.encode(message.metadata, writer.uint32(18).fork()).ldelim(); } - if (message.done !== undefined) { + if (message.done === true) { writer.uint32(24).bool(message.done); } if (message.error !== undefined) { @@ -271,13 +306,13 @@ export const Operation = { return message; }, fromJSON(object: any): Operation { - 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; + 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 + }; }, toJSON(message: Operation): JsonSafe<Operation> { const obj: any = {}; @@ -291,16 +326,10 @@ export const Operation = { fromPartial(object: DeepPartial<Operation>): Operation { const message = createBaseOperation(); message.name = object.name ?? ""; - if (object.metadata !== undefined && object.metadata !== null) { - message.metadata = Any.fromPartial(object.metadata); - } + message.metadata = object.metadata !== undefined && object.metadata !== null ? Any.fromPartial(object.metadata) : undefined; message.done = object.done ?? false; - 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); - } + 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; return message; }, fromSDK(object: OperationSDKType): Operation { @@ -382,7 +411,7 @@ function createBaseGetOperationRequest(): GetOperationRequest { export const GetOperationRequest = { typeUrl: "/google.longrunning.GetOperationRequest", encode(message: GetOperationRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.name !== undefined) { + if (message.name !== "") { writer.uint32(10).string(message.name); } return writer; @@ -405,9 +434,9 @@ export const GetOperationRequest = { return message; }, fromJSON(object: any): GetOperationRequest { - const obj = createBaseGetOperationRequest(); - if (isSet(object.name)) obj.name = String(object.name); - return obj; + return { + name: isSet(object.name) ? String(object.name) : "" + }; }, toJSON(message: GetOperationRequest): JsonSafe<GetOperationRequest> { const obj: any = {}; @@ -473,16 +502,16 @@ function createBaseListOperationsRequest(): ListOperationsRequest { export const ListOperationsRequest = { typeUrl: "/google.longrunning.ListOperationsRequest", encode(message: ListOperationsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.name !== undefined) { + if (message.name !== "") { writer.uint32(34).string(message.name); } - if (message.filter !== undefined) { + if (message.filter !== "") { writer.uint32(10).string(message.filter); } - if (message.pageSize !== undefined) { + if (message.pageSize !== 0) { writer.uint32(16).int32(message.pageSize); } - if (message.pageToken !== undefined) { + if (message.pageToken !== "") { writer.uint32(26).string(message.pageToken); } return writer; @@ -514,12 +543,12 @@ export const ListOperationsRequest = { return message; }, fromJSON(object: any): ListOperationsRequest { - 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; + 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) : "" + }; }, toJSON(message: ListOperationsRequest): JsonSafe<ListOperationsRequest> { const obj: any = {}; @@ -613,7 +642,7 @@ export const ListOperationsResponse = { for (const v of message.operations) { Operation.encode(v!, writer.uint32(10).fork()).ldelim(); } - if (message.nextPageToken !== undefined) { + if (message.nextPageToken !== "") { writer.uint32(18).string(message.nextPageToken); } return writer; @@ -639,10 +668,10 @@ export const ListOperationsResponse = { return message; }, fromJSON(object: any): ListOperationsResponse { - 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; + return { + operations: Array.isArray(object?.operations) ? object.operations.map((e: any) => Operation.fromJSON(e)) : [], + nextPageToken: isSet(object.nextPageToken) ? String(object.nextPageToken) : "" + }; }, toJSON(message: ListOperationsResponse): JsonSafe<ListOperationsResponse> { const obj: any = {}; @@ -724,7 +753,7 @@ function createBaseCancelOperationRequest(): CancelOperationRequest { export const CancelOperationRequest = { typeUrl: "/google.longrunning.CancelOperationRequest", encode(message: CancelOperationRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.name !== undefined) { + if (message.name !== "") { writer.uint32(10).string(message.name); } return writer; @@ -747,9 +776,9 @@ export const CancelOperationRequest = { return message; }, fromJSON(object: any): CancelOperationRequest { - const obj = createBaseCancelOperationRequest(); - if (isSet(object.name)) obj.name = String(object.name); - return obj; + return { + name: isSet(object.name) ? String(object.name) : "" + }; }, toJSON(message: CancelOperationRequest): JsonSafe<CancelOperationRequest> { const obj: any = {}; @@ -812,7 +841,7 @@ function createBaseDeleteOperationRequest(): DeleteOperationRequest { export const DeleteOperationRequest = { typeUrl: "/google.longrunning.DeleteOperationRequest", encode(message: DeleteOperationRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.name !== undefined) { + if (message.name !== "") { writer.uint32(10).string(message.name); } return writer; @@ -835,9 +864,9 @@ export const DeleteOperationRequest = { return message; }, fromJSON(object: any): DeleteOperationRequest { - const obj = createBaseDeleteOperationRequest(); - if (isSet(object.name)) obj.name = String(object.name); - return obj; + return { + name: isSet(object.name) ? String(object.name) : "" + }; }, toJSON(message: DeleteOperationRequest): JsonSafe<DeleteOperationRequest> { const obj: any = {}; @@ -901,7 +930,7 @@ function createBaseWaitOperationRequest(): WaitOperationRequest { export const WaitOperationRequest = { typeUrl: "/google.longrunning.WaitOperationRequest", encode(message: WaitOperationRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.name !== undefined) { + if (message.name !== "") { writer.uint32(10).string(message.name); } if (message.timeout !== undefined) { @@ -930,10 +959,10 @@ export const WaitOperationRequest = { return message; }, fromJSON(object: any): WaitOperationRequest { - const obj = createBaseWaitOperationRequest(); - if (isSet(object.name)) obj.name = String(object.name); - if (isSet(object.timeout)) obj.timeout = Duration.fromJSON(object.timeout); - return obj; + return { + name: isSet(object.name) ? String(object.name) : "", + timeout: isSet(object.timeout) ? Duration.fromJSON(object.timeout) : undefined + }; }, toJSON(message: WaitOperationRequest): JsonSafe<WaitOperationRequest> { const obj: any = {}; @@ -944,9 +973,7 @@ export const WaitOperationRequest = { fromPartial(object: DeepPartial<WaitOperationRequest>): WaitOperationRequest { const message = createBaseWaitOperationRequest(); message.name = object.name ?? ""; - if (object.timeout !== undefined && object.timeout !== null) { - message.timeout = Duration.fromPartial(object.timeout); - } + message.timeout = object.timeout !== undefined && object.timeout !== null ? Duration.fromPartial(object.timeout) : undefined; return message; }, fromSDK(object: WaitOperationRequestSDKType): WaitOperationRequest { @@ -1008,10 +1035,10 @@ function createBaseOperationInfo(): OperationInfo { export const OperationInfo = { typeUrl: "/google.longrunning.OperationInfo", encode(message: OperationInfo, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.responseType !== undefined) { + if (message.responseType !== "") { writer.uint32(10).string(message.responseType); } - if (message.metadataType !== undefined) { + if (message.metadataType !== "") { writer.uint32(18).string(message.metadataType); } return writer; @@ -1037,10 +1064,10 @@ export const OperationInfo = { return message; }, fromJSON(object: any): OperationInfo { - const obj = createBaseOperationInfo(); - if (isSet(object.responseType)) obj.responseType = String(object.responseType); - if (isSet(object.metadataType)) obj.metadataType = String(object.metadataType); - return obj; + return { + responseType: isSet(object.responseType) ? String(object.responseType) : "", + metadataType: isSet(object.metadataType) ? String(object.metadataType) : "" + }; }, toJSON(message: OperationInfo): JsonSafe<OperationInfo> { const obj: any = {}; diff --git a/__fixtures__/v-next/outputv4/google/protobuf/any.ts b/__fixtures__/v-next/outputv4/google/protobuf/any.ts index 1a705eea55..f96c95f94e 100644 --- a/__fixtures__/v-next/outputv4/google/protobuf/any.ts +++ b/__fixtures__/v-next/outputv4/google/protobuf/any.ts @@ -1,6 +1,7 @@ -import { BinaryReader, BinaryWriter } from "../../binary.js"; -import { isSet, bytesFromBase64, base64FromBytes, DeepPartial } from "../../helpers.js"; -import { JsonSafe } from "../../json-safe.js"; +import { BinaryReader, BinaryWriter } from "../../binary"; +import { isSet, bytesFromBase64, base64FromBytes, DeepPartial } from "../../helpers"; +import { JsonSafe } from "../../json-safe"; +import { ComputedRef } from "vue"; export const protobufPackage = "google.protobuf"; /** * `Any` contains an arbitrary serialized protocol buffer message along with a @@ -118,6 +119,11 @@ 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<string>; + value: ComputedRef<Uint8Array>; +} export interface AnyProtoMsg { typeUrl: "/google.protobuf.Any"; value: Uint8Array; @@ -218,7 +224,7 @@ function createBaseAny(): Any { export const Any = { typeUrl: "/google.protobuf.Any", encode(message: Any, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.typeUrl !== undefined) { + if (message.typeUrl !== "") { writer.uint32(10).string(message.typeUrl); } if (message.value.length !== 0) { @@ -247,10 +253,10 @@ export const Any = { return message; }, fromJSON(object: any): Any { - const obj = createBaseAny(); - if (isSet(object.typeUrl)) obj.typeUrl = String(object.typeUrl); - if (isSet(object.value)) obj.value = bytesFromBase64(object.value); - return obj; + return { + typeUrl: isSet(object.typeUrl) ? String(object.typeUrl) : "", + value: isSet(object.value) ? bytesFromBase64(object.value) : new Uint8Array() + }; }, toJSON(message: Any): JsonSafe<Any> { const obj: any = {}; diff --git a/__fixtures__/v-next/outputv4/google/protobuf/api.ts b/__fixtures__/v-next/outputv4/google/protobuf/api.ts index 359d83e8cc..8aa053c18d 100644 --- a/__fixtures__/v-next/outputv4/google/protobuf/api.ts +++ b/__fixtures__/v-next/outputv4/google/protobuf/api.ts @@ -1,8 +1,9 @@ -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"; +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"; export const protobufPackage = "google.protobuf"; /** * Api is a light-weight descriptor for an API Interface. @@ -57,6 +58,15 @@ export interface Api { /** The source syntax of the service. */ syntax: Syntax; } +export interface ReactiveApi { + name: ComputedRef<string>; + methods: ComputedRef<Method[]>; + options: ComputedRef<Option[]>; + version: ComputedRef<string>; + sourceContext?: ComputedRef<SourceContext>; + mixins: ComputedRef<Mixin[]>; + syntax: ComputedRef<Syntax>; +} export interface ApiProtoMsg { typeUrl: "/google.protobuf.Api"; value: Uint8Array; @@ -98,6 +108,15 @@ export interface Method { /** The source syntax of this method. */ syntax: Syntax; } +export interface ReactiveMethod { + name: ComputedRef<string>; + requestTypeUrl: ComputedRef<string>; + requestStreaming: ComputedRef<boolean>; + responseTypeUrl: ComputedRef<string>; + responseStreaming: ComputedRef<boolean>; + options: ComputedRef<Option[]>; + syntax: ComputedRef<Syntax>; +} export interface MethodProtoMsg { typeUrl: "/google.protobuf.Method"; value: Uint8Array; @@ -201,6 +220,10 @@ export interface Mixin { */ root: string; } +export interface ReactiveMixin { + name: ComputedRef<string>; + root: ComputedRef<string>; +} export interface MixinProtoMsg { typeUrl: "/google.protobuf.Mixin"; value: Uint8Array; @@ -303,7 +326,7 @@ function createBaseApi(): Api { export const Api = { typeUrl: "/google.protobuf.Api", encode(message: Api, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.name !== undefined) { + if (message.name !== "") { writer.uint32(10).string(message.name); } for (const v of message.methods) { @@ -312,7 +335,7 @@ export const Api = { for (const v of message.options) { Option.encode(v!, writer.uint32(26).fork()).ldelim(); } - if (message.version !== undefined) { + if (message.version !== "") { writer.uint32(34).string(message.version); } if (message.sourceContext !== undefined) { @@ -362,15 +385,15 @@ export const Api = { return message; }, fromJSON(object: any): Api { - 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; + 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 + }; }, toJSON(message: Api): JsonSafe<Api> { const obj: any = {}; @@ -401,9 +424,7 @@ 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 ?? ""; - if (object.sourceContext !== undefined && object.sourceContext !== null) { - message.sourceContext = SourceContext.fromPartial(object.sourceContext); - } + message.sourceContext = object.sourceContext !== undefined && object.sourceContext !== null ? SourceContext.fromPartial(object.sourceContext) : undefined; message.mixins = object.mixins?.map(e => Mixin.fromPartial(e)) || []; message.syntax = object.syntax ?? 0; return message; @@ -525,19 +546,19 @@ function createBaseMethod(): Method { export const Method = { typeUrl: "/google.protobuf.Method", encode(message: Method, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.name !== undefined) { + if (message.name !== "") { writer.uint32(10).string(message.name); } - if (message.requestTypeUrl !== undefined) { + if (message.requestTypeUrl !== "") { writer.uint32(18).string(message.requestTypeUrl); } - if (message.requestStreaming !== undefined) { + if (message.requestStreaming === true) { writer.uint32(24).bool(message.requestStreaming); } - if (message.responseTypeUrl !== undefined) { + if (message.responseTypeUrl !== "") { writer.uint32(34).string(message.responseTypeUrl); } - if (message.responseStreaming !== undefined) { + if (message.responseStreaming === true) { writer.uint32(40).bool(message.responseStreaming); } for (const v of message.options) { @@ -584,15 +605,15 @@ export const Method = { return message; }, fromJSON(object: any): Method { - 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; + 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 + }; }, toJSON(message: Method): JsonSafe<Method> { const obj: any = {}; @@ -720,10 +741,10 @@ function createBaseMixin(): Mixin { export const Mixin = { typeUrl: "/google.protobuf.Mixin", encode(message: Mixin, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.name !== undefined) { + if (message.name !== "") { writer.uint32(10).string(message.name); } - if (message.root !== undefined) { + if (message.root !== "") { writer.uint32(18).string(message.root); } return writer; @@ -749,10 +770,10 @@ export const Mixin = { return message; }, fromJSON(object: any): Mixin { - const obj = createBaseMixin(); - if (isSet(object.name)) obj.name = String(object.name); - if (isSet(object.root)) obj.root = String(object.root); - return obj; + return { + name: isSet(object.name) ? String(object.name) : "", + root: isSet(object.root) ? String(object.root) : "" + }; }, toJSON(message: Mixin): JsonSafe<Mixin> { 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 d057e41456..0d7ab4710e 100644 --- a/__fixtures__/v-next/outputv4/google/protobuf/compiler/plugin.ts +++ b/__fixtures__/v-next/outputv4/google/protobuf/compiler/plugin.ts @@ -1,7 +1,8 @@ -import { FileDescriptorProto, FileDescriptorProtoSDKType } from "../descriptor.js"; -import { BinaryReader, BinaryWriter } from "../../../binary.js"; -import { isSet, DeepPartial } from "../../../helpers.js"; -import { JsonSafe } from "../../../json-safe.js"; +import { FileDescriptorProto, FileDescriptorProtoSDKType } from "../descriptor"; +import { BinaryReader, BinaryWriter } from "../../../binary"; +import { isSet, DeepPartial } from "../../../helpers"; +import { JsonSafe } from "../../../json-safe"; +import { ComputedRef } from "vue"; export const protobufPackage = "google.protobuf.compiler"; /** The version number of protocol compiler. */ export interface Version { @@ -14,6 +15,12 @@ export interface Version { */ suffix: string; } +export interface ReactiveVersion { + major: ComputedRef<number>; + minor: ComputedRef<number>; + patch: ComputedRef<number>; + suffix: ComputedRef<string>; +} export interface VersionProtoMsg { typeUrl: "/google.protobuf.compiler.Version"; value: Uint8Array; @@ -55,6 +62,12 @@ export interface CodeGeneratorRequest { /** The version number of protocol compiler. */ compilerVersion?: Version; } +export interface ReactiveCodeGeneratorRequest { + fileToGenerate: ComputedRef<string[]>; + parameter: ComputedRef<string>; + protoFile: ComputedRef<FileDescriptorProto[]>; + compilerVersion?: ComputedRef<Version>; +} export interface CodeGeneratorRequestProtoMsg { typeUrl: "/google.protobuf.compiler.CodeGeneratorRequest"; value: Uint8Array; @@ -81,6 +94,10 @@ export interface CodeGeneratorResponse { error: string; file: CodeGeneratorResponse_File[]; } +export interface ReactiveCodeGeneratorResponse { + error: ComputedRef<string>; + file: ComputedRef<CodeGeneratorResponse_File[]>; +} export interface CodeGeneratorResponseProtoMsg { typeUrl: "/google.protobuf.compiler.CodeGeneratorResponse"; value: Uint8Array; @@ -149,6 +166,11 @@ export interface CodeGeneratorResponse_File { /** The file contents. */ content: string; } +export interface ReactiveCodeGeneratorResponse_File { + name: ComputedRef<string>; + insertionPoint: ComputedRef<string>; + content: ComputedRef<string>; +} export interface CodeGeneratorResponse_FileProtoMsg { typeUrl: "/google.protobuf.compiler.File"; value: Uint8Array; @@ -170,16 +192,16 @@ function createBaseVersion(): Version { export const Version = { typeUrl: "/google.protobuf.compiler.Version", encode(message: Version, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.major !== undefined) { + if (message.major !== 0) { writer.uint32(8).int32(message.major); } - if (message.minor !== undefined) { + if (message.minor !== 0) { writer.uint32(16).int32(message.minor); } - if (message.patch !== undefined) { + if (message.patch !== 0) { writer.uint32(24).int32(message.patch); } - if (message.suffix !== undefined) { + if (message.suffix !== "") { writer.uint32(34).string(message.suffix); } return writer; @@ -211,12 +233,12 @@ export const Version = { return message; }, fromJSON(object: any): Version { - 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; + 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) : "" + }; }, toJSON(message: Version): JsonSafe<Version> { const obj: any = {}; @@ -312,7 +334,7 @@ export const CodeGeneratorRequest = { for (const v of message.fileToGenerate) { writer.uint32(10).string(v!); } - if (message.parameter !== undefined) { + if (message.parameter !== "") { writer.uint32(18).string(message.parameter); } for (const v of message.protoFile) { @@ -350,12 +372,12 @@ export const CodeGeneratorRequest = { return message; }, fromJSON(object: any): CodeGeneratorRequest { - 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; + 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 + }; }, toJSON(message: CodeGeneratorRequest): JsonSafe<CodeGeneratorRequest> { const obj: any = {}; @@ -378,9 +400,7 @@ export const CodeGeneratorRequest = { message.fileToGenerate = object.fileToGenerate?.map(e => e) || []; message.parameter = object.parameter ?? ""; message.protoFile = object.protoFile?.map(e => FileDescriptorProto.fromPartial(e)) || []; - if (object.compilerVersion !== undefined && object.compilerVersion !== null) { - message.compilerVersion = Version.fromPartial(object.compilerVersion); - } + message.compilerVersion = object.compilerVersion !== undefined && object.compilerVersion !== null ? Version.fromPartial(object.compilerVersion) : undefined; return message; }, fromSDK(object: CodeGeneratorRequestSDKType): CodeGeneratorRequest { @@ -468,7 +488,7 @@ function createBaseCodeGeneratorResponse(): CodeGeneratorResponse { export const CodeGeneratorResponse = { typeUrl: "/google.protobuf.compiler.CodeGeneratorResponse", encode(message: CodeGeneratorResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.error !== undefined) { + if (message.error !== "") { writer.uint32(10).string(message.error); } for (const v of message.file) { @@ -497,10 +517,10 @@ export const CodeGeneratorResponse = { return message; }, fromJSON(object: any): CodeGeneratorResponse { - 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; + return { + error: isSet(object.error) ? String(object.error) : "", + file: Array.isArray(object?.file) ? object.file.map((e: any) => CodeGeneratorResponse_File.fromJSON(e)) : [] + }; }, toJSON(message: CodeGeneratorResponse): JsonSafe<CodeGeneratorResponse> { const obj: any = {}; @@ -584,13 +604,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 !== undefined) { + if (message.name !== "") { writer.uint32(10).string(message.name); } - if (message.insertionPoint !== undefined) { + if (message.insertionPoint !== "") { writer.uint32(18).string(message.insertionPoint); } - if (message.content !== undefined) { + if (message.content !== "") { writer.uint32(122).string(message.content); } return writer; @@ -619,11 +639,11 @@ export const CodeGeneratorResponse_File = { return message; }, fromJSON(object: any): CodeGeneratorResponse_File { - 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; + return { + name: isSet(object.name) ? String(object.name) : "", + insertionPoint: isSet(object.insertionPoint) ? String(object.insertionPoint) : "", + content: isSet(object.content) ? String(object.content) : "" + }; }, toJSON(message: CodeGeneratorResponse_File): JsonSafe<CodeGeneratorResponse_File> { const obj: any = {}; diff --git a/__fixtures__/v-next/outputv4/google/protobuf/descriptor.ts b/__fixtures__/v-next/outputv4/google/protobuf/descriptor.ts index 91fbd835f5..5ee1a23e75 100644 --- a/__fixtures__/v-next/outputv4/google/protobuf/descriptor.ts +++ b/__fixtures__/v-next/outputv4/google/protobuf/descriptor.ts @@ -1,6 +1,7 @@ -import { BinaryReader, BinaryWriter } from "../../binary.js"; -import { JsonSafe } from "../../json-safe.js"; -import { DeepPartial, isSet, bytesFromBase64, base64FromBytes } from "../../helpers.js"; +import { BinaryReader, BinaryWriter } from "../../binary"; +import { JsonSafe } from "../../json-safe"; +import { DeepPartial, isSet, bytesFromBase64, base64FromBytes } from "../../helpers"; +import { ComputedRef } from "vue"; export const protobufPackage = "google.protobuf"; export enum FieldDescriptorProto_Type { /** @@ -359,6 +360,9 @@ export function methodOptions_IdempotencyLevelToJSON(object: MethodOptions_Idemp export interface FileDescriptorSet { file: FileDescriptorProto[]; } +export interface ReactiveFileDescriptorSet { + file: ComputedRef<FileDescriptorProto[]>; +} export interface FileDescriptorSetProtoMsg { typeUrl: "/google.protobuf.FileDescriptorSet"; value: Uint8Array; @@ -404,6 +408,20 @@ export interface FileDescriptorProto { */ syntax: string; } +export interface ReactiveFileDescriptorProto { + name: ComputedRef<string>; + package: ComputedRef<string>; + dependency: ComputedRef<string[]>; + publicDependency: ComputedRef<number[]>; + weakDependency: ComputedRef<number[]>; + messageType: ComputedRef<DescriptorProto[]>; + enumType: ComputedRef<EnumDescriptorProto[]>; + service: ComputedRef<ServiceDescriptorProto[]>; + extension: ComputedRef<FieldDescriptorProto[]>; + options?: ComputedRef<FileOptions>; + sourceCodeInfo?: ComputedRef<SourceCodeInfo>; + syntax: ComputedRef<string>; +} export interface FileDescriptorProtoProtoMsg { typeUrl: "/google.protobuf.FileDescriptorProto"; value: Uint8Array; @@ -440,6 +458,18 @@ export interface DescriptorProto { */ reservedName: string[]; } +export interface ReactiveDescriptorProto { + name: ComputedRef<string>; + field: ComputedRef<FieldDescriptorProto[]>; + extension: ComputedRef<FieldDescriptorProto[]>; + nestedType: ComputedRef<DescriptorProto[]>; + enumType: ComputedRef<EnumDescriptorProto[]>; + extensionRange: ComputedRef<DescriptorProto_ExtensionRange[]>; + oneofDecl: ComputedRef<OneofDescriptorProto[]>; + options?: ComputedRef<MessageOptions>; + reservedRange: ComputedRef<DescriptorProto_ReservedRange[]>; + reservedName: ComputedRef<string[]>; +} export interface DescriptorProtoProtoMsg { typeUrl: "/google.protobuf.DescriptorProto"; value: Uint8Array; @@ -464,6 +494,11 @@ export interface DescriptorProto_ExtensionRange { end: number; options?: ExtensionRangeOptions; } +export interface ReactiveDescriptorProto_ExtensionRange { + start: ComputedRef<number>; + end: ComputedRef<number>; + options?: ComputedRef<ExtensionRangeOptions>; +} export interface DescriptorProto_ExtensionRangeProtoMsg { typeUrl: "/google.protobuf.ExtensionRange"; value: Uint8Array; @@ -484,6 +519,10 @@ export interface DescriptorProto_ReservedRange { /** Exclusive. */ end: number; } +export interface ReactiveDescriptorProto_ReservedRange { + start: ComputedRef<number>; + end: ComputedRef<number>; +} export interface DescriptorProto_ReservedRangeProtoMsg { typeUrl: "/google.protobuf.ReservedRange"; value: Uint8Array; @@ -501,6 +540,9 @@ export interface ExtensionRangeOptions { /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } +export interface ReactiveExtensionRangeOptions { + uninterpretedOption: ComputedRef<UninterpretedOption[]>; +} export interface ExtensionRangeOptionsProtoMsg { typeUrl: "/google.protobuf.ExtensionRangeOptions"; value: Uint8Array; @@ -553,6 +595,18 @@ export interface FieldDescriptorProto { jsonName: string; options?: FieldOptions; } +export interface ReactiveFieldDescriptorProto { + name: ComputedRef<string>; + number: ComputedRef<number>; + label: ComputedRef<FieldDescriptorProto_Label>; + type: ComputedRef<FieldDescriptorProto_Type>; + typeName: ComputedRef<string>; + extendee: ComputedRef<string>; + defaultValue: ComputedRef<string>; + oneofIndex: ComputedRef<number>; + jsonName: ComputedRef<string>; + options?: ComputedRef<FieldOptions>; +} export interface FieldDescriptorProtoProtoMsg { typeUrl: "/google.protobuf.FieldDescriptorProto"; value: Uint8Array; @@ -575,6 +629,10 @@ export interface OneofDescriptorProto { name: string; options?: OneofOptions; } +export interface ReactiveOneofDescriptorProto { + name: ComputedRef<string>; + options?: ComputedRef<OneofOptions>; +} export interface OneofDescriptorProtoProtoMsg { typeUrl: "/google.protobuf.OneofDescriptorProto"; value: Uint8Array; @@ -601,6 +659,13 @@ export interface EnumDescriptorProto { */ reservedName: string[]; } +export interface ReactiveEnumDescriptorProto { + name: ComputedRef<string>; + value: ComputedRef<EnumValueDescriptorProto[]>; + options?: ComputedRef<EnumOptions>; + reservedRange: ComputedRef<EnumDescriptorProto_EnumReservedRange[]>; + reservedName: ComputedRef<string[]>; +} export interface EnumDescriptorProtoProtoMsg { typeUrl: "/google.protobuf.EnumDescriptorProto"; value: Uint8Array; @@ -627,6 +692,10 @@ export interface EnumDescriptorProto_EnumReservedRange { /** Inclusive. */ end: number; } +export interface ReactiveEnumDescriptorProto_EnumReservedRange { + start: ComputedRef<number>; + end: ComputedRef<number>; +} export interface EnumDescriptorProto_EnumReservedRangeProtoMsg { typeUrl: "/google.protobuf.EnumReservedRange"; value: Uint8Array; @@ -649,6 +718,11 @@ export interface EnumValueDescriptorProto { number: number; options?: EnumValueOptions; } +export interface ReactiveEnumValueDescriptorProto { + name: ComputedRef<string>; + number: ComputedRef<number>; + options?: ComputedRef<EnumValueOptions>; +} export interface EnumValueDescriptorProtoProtoMsg { typeUrl: "/google.protobuf.EnumValueDescriptorProto"; value: Uint8Array; @@ -665,6 +739,11 @@ export interface ServiceDescriptorProto { method: MethodDescriptorProto[]; options?: ServiceOptions; } +export interface ReactiveServiceDescriptorProto { + name: ComputedRef<string>; + method: ComputedRef<MethodDescriptorProto[]>; + options?: ComputedRef<ServiceOptions>; +} export interface ServiceDescriptorProtoProtoMsg { typeUrl: "/google.protobuf.ServiceDescriptorProto"; value: Uint8Array; @@ -690,6 +769,14 @@ export interface MethodDescriptorProto { /** Identifies if server streams multiple server messages */ serverStreaming: boolean; } +export interface ReactiveMethodDescriptorProto { + name: ComputedRef<string>; + inputType: ComputedRef<string>; + outputType: ComputedRef<string>; + options?: ComputedRef<MethodOptions>; + clientStreaming: ComputedRef<boolean>; + serverStreaming: ComputedRef<boolean>; +} export interface MethodDescriptorProtoProtoMsg { typeUrl: "/google.protobuf.MethodDescriptorProto"; value: Uint8Array; @@ -820,6 +907,29 @@ export interface FileOptions { */ uninterpretedOption: UninterpretedOption[]; } +export interface ReactiveFileOptions { + javaPackage: ComputedRef<string>; + javaOuterClassname: ComputedRef<string>; + javaMultipleFiles: ComputedRef<boolean>; + javaGenerateEqualsAndHash: ComputedRef<boolean>; + javaStringCheckUtf8: ComputedRef<boolean>; + optimizeFor: ComputedRef<FileOptions_OptimizeMode>; + goPackage: ComputedRef<string>; + ccGenericServices: ComputedRef<boolean>; + javaGenericServices: ComputedRef<boolean>; + pyGenericServices: ComputedRef<boolean>; + phpGenericServices: ComputedRef<boolean>; + deprecated: ComputedRef<boolean>; + ccEnableArenas: ComputedRef<boolean>; + objcClassPrefix: ComputedRef<string>; + csharpNamespace: ComputedRef<string>; + swiftPrefix: ComputedRef<string>; + phpClassPrefix: ComputedRef<string>; + phpNamespace: ComputedRef<string>; + phpMetadataNamespace: ComputedRef<string>; + rubyPackage: ComputedRef<string>; + uninterpretedOption: ComputedRef<UninterpretedOption[]>; +} export interface FileOptionsProtoMsg { typeUrl: "/google.protobuf.FileOptions"; value: Uint8Array; @@ -910,6 +1020,13 @@ export interface MessageOptions { /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } +export interface ReactiveMessageOptions { + messageSetWireFormat: ComputedRef<boolean>; + noStandardDescriptorAccessor: ComputedRef<boolean>; + deprecated: ComputedRef<boolean>; + mapEntry: ComputedRef<boolean>; + uninterpretedOption: ComputedRef<UninterpretedOption[]>; +} export interface MessageOptionsProtoMsg { typeUrl: "/google.protobuf.MessageOptions"; value: Uint8Array; @@ -994,6 +1111,15 @@ export interface FieldOptions { /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } +export interface ReactiveFieldOptions { + ctype: ComputedRef<FieldOptions_CType>; + packed: ComputedRef<boolean>; + jstype: ComputedRef<FieldOptions_JSType>; + lazy: ComputedRef<boolean>; + deprecated: ComputedRef<boolean>; + weak: ComputedRef<boolean>; + uninterpretedOption: ComputedRef<UninterpretedOption[]>; +} export interface FieldOptionsProtoMsg { typeUrl: "/google.protobuf.FieldOptions"; value: Uint8Array; @@ -1011,6 +1137,9 @@ export interface OneofOptions { /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } +export interface ReactiveOneofOptions { + uninterpretedOption: ComputedRef<UninterpretedOption[]>; +} export interface OneofOptionsProtoMsg { typeUrl: "/google.protobuf.OneofOptions"; value: Uint8Array; @@ -1034,6 +1163,11 @@ export interface EnumOptions { /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } +export interface ReactiveEnumOptions { + allowAlias: ComputedRef<boolean>; + deprecated: ComputedRef<boolean>; + uninterpretedOption: ComputedRef<UninterpretedOption[]>; +} export interface EnumOptionsProtoMsg { typeUrl: "/google.protobuf.EnumOptions"; value: Uint8Array; @@ -1054,6 +1188,10 @@ export interface EnumValueOptions { /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } +export interface ReactiveEnumValueOptions { + deprecated: ComputedRef<boolean>; + uninterpretedOption: ComputedRef<UninterpretedOption[]>; +} export interface EnumValueOptionsProtoMsg { typeUrl: "/google.protobuf.EnumValueOptions"; value: Uint8Array; @@ -1073,6 +1211,10 @@ export interface ServiceOptions { /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } +export interface ReactiveServiceOptions { + deprecated: ComputedRef<boolean>; + uninterpretedOption: ComputedRef<UninterpretedOption[]>; +} export interface ServiceOptionsProtoMsg { typeUrl: "/google.protobuf.ServiceOptions"; value: Uint8Array; @@ -1093,6 +1235,11 @@ export interface MethodOptions { /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } +export interface ReactiveMethodOptions { + deprecated: ComputedRef<boolean>; + idempotencyLevel: ComputedRef<MethodOptions_IdempotencyLevel>; + uninterpretedOption: ComputedRef<UninterpretedOption[]>; +} export interface MethodOptionsProtoMsg { typeUrl: "/google.protobuf.MethodOptions"; value: Uint8Array; @@ -1123,6 +1270,15 @@ export interface UninterpretedOption { stringValue: Uint8Array; aggregateValue: string; } +export interface ReactiveUninterpretedOption { + name: ComputedRef<UninterpretedOption_NamePart[]>; + identifierValue: ComputedRef<string>; + positiveIntValue: ComputedRef<bigint>; + negativeIntValue: ComputedRef<bigint>; + doubleValue: ComputedRef<number>; + stringValue: ComputedRef<Uint8Array>; + aggregateValue: ComputedRef<string>; +} export interface UninterpretedOptionProtoMsg { typeUrl: "/google.protobuf.UninterpretedOption"; value: Uint8Array; @@ -1155,6 +1311,10 @@ export interface UninterpretedOption_NamePart { namePart: string; isExtension: boolean; } +export interface ReactiveUninterpretedOption_NamePart { + namePart: ComputedRef<string>; + isExtension: ComputedRef<boolean>; +} export interface UninterpretedOption_NamePartProtoMsg { typeUrl: "/google.protobuf.NamePart"; value: Uint8Array; @@ -1222,6 +1382,9 @@ export interface SourceCodeInfo { */ location: SourceCodeInfo_Location[]; } +export interface ReactiveSourceCodeInfo { + location: ComputedRef<SourceCodeInfo_Location[]>; +} export interface SourceCodeInfoProtoMsg { typeUrl: "/google.protobuf.SourceCodeInfo"; value: Uint8Array; @@ -1321,6 +1484,13 @@ export interface SourceCodeInfo_Location { trailingComments: string; leadingDetachedComments: string[]; } +export interface ReactiveSourceCodeInfo_Location { + path: ComputedRef<number[]>; + span: ComputedRef<number[]>; + leadingComments: ComputedRef<string>; + trailingComments: ComputedRef<string>; + leadingDetachedComments: ComputedRef<string[]>; +} export interface SourceCodeInfo_LocationProtoMsg { typeUrl: "/google.protobuf.Location"; value: Uint8Array; @@ -1344,6 +1514,9 @@ export interface GeneratedCodeInfo { */ annotation: GeneratedCodeInfo_Annotation[]; } +export interface ReactiveGeneratedCodeInfo { + annotation: ComputedRef<GeneratedCodeInfo_Annotation[]>; +} export interface GeneratedCodeInfoProtoMsg { typeUrl: "/google.protobuf.GeneratedCodeInfo"; value: Uint8Array; @@ -1376,6 +1549,12 @@ export interface GeneratedCodeInfo_Annotation { */ end: number; } +export interface ReactiveGeneratedCodeInfo_Annotation { + path: ComputedRef<number[]>; + sourceFile: ComputedRef<string>; + begin: ComputedRef<number>; + end: ComputedRef<number>; +} export interface GeneratedCodeInfo_AnnotationProtoMsg { typeUrl: "/google.protobuf.Annotation"; value: Uint8Array; @@ -1417,9 +1596,9 @@ export const FileDescriptorSet = { return message; }, fromJSON(object: any): FileDescriptorSet { - const obj = createBaseFileDescriptorSet(); - if (Array.isArray(object?.file)) obj.file = object.file.map((e: any) => FileDescriptorProto.fromJSON(e)); - return obj; + return { + file: Array.isArray(object?.file) ? object.file.map((e: any) => FileDescriptorProto.fromJSON(e)) : [] + }; }, toJSON(message: FileDescriptorSet): JsonSafe<FileDescriptorSet> { const obj: any = {}; @@ -1503,10 +1682,10 @@ function createBaseFileDescriptorProto(): FileDescriptorProto { export const FileDescriptorProto = { typeUrl: "/google.protobuf.FileDescriptorProto", encode(message: FileDescriptorProto, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.name !== undefined) { + if (message.name !== "") { writer.uint32(10).string(message.name); } - if (message.package !== undefined) { + if (message.package !== "") { writer.uint32(18).string(message.package); } for (const v of message.dependency) { @@ -1540,7 +1719,7 @@ export const FileDescriptorProto = { if (message.sourceCodeInfo !== undefined) { SourceCodeInfo.encode(message.sourceCodeInfo, writer.uint32(74).fork()).ldelim(); } - if (message.syntax !== undefined) { + if (message.syntax !== "") { writer.uint32(98).string(message.syntax); } return writer; @@ -1610,20 +1789,20 @@ export const FileDescriptorProto = { return message; }, fromJSON(object: any): FileDescriptorProto { - const obj = createBaseFileDescriptorProto(); - if (isSet(object.name)) obj.name = String(object.name); - if (isSet(object.package)) obj.package = String(object.package); - if (Array.isArray(object?.dependency)) obj.dependency = object.dependency.map((e: any) => String(e)); - if (Array.isArray(object?.publicDependency)) obj.publicDependency = object.publicDependency.map((e: any) => Number(e)); - if (Array.isArray(object?.weakDependency)) obj.weakDependency = object.weakDependency.map((e: any) => Number(e)); - if (Array.isArray(object?.messageType)) obj.messageType = object.messageType.map((e: any) => DescriptorProto.fromJSON(e)); - if (Array.isArray(object?.enumType)) obj.enumType = object.enumType.map((e: any) => EnumDescriptorProto.fromJSON(e)); - if (Array.isArray(object?.service)) obj.service = object.service.map((e: any) => ServiceDescriptorProto.fromJSON(e)); - if (Array.isArray(object?.extension)) obj.extension = object.extension.map((e: any) => FieldDescriptorProto.fromJSON(e)); - if (isSet(object.options)) obj.options = FileOptions.fromJSON(object.options); - if (isSet(object.sourceCodeInfo)) obj.sourceCodeInfo = SourceCodeInfo.fromJSON(object.sourceCodeInfo); - if (isSet(object.syntax)) obj.syntax = String(object.syntax); - return obj; + 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) : "" + }; }, toJSON(message: FileDescriptorProto): JsonSafe<FileDescriptorProto> { const obj: any = {}; @@ -1680,12 +1859,8 @@ 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)) || []; - 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.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; message.syntax = object.syntax ?? ""; return message; }, @@ -1868,7 +2043,7 @@ function createBaseDescriptorProto(): DescriptorProto { export const DescriptorProto = { typeUrl: "/google.protobuf.DescriptorProto", encode(message: DescriptorProto, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.name !== undefined) { + if (message.name !== "") { writer.uint32(10).string(message.name); } for (const v of message.field) { @@ -1945,18 +2120,18 @@ export const DescriptorProto = { return message; }, fromJSON(object: any): DescriptorProto { - const obj = createBaseDescriptorProto(); - if (isSet(object.name)) obj.name = String(object.name); - if (Array.isArray(object?.field)) obj.field = object.field.map((e: any) => FieldDescriptorProto.fromJSON(e)); - if (Array.isArray(object?.extension)) obj.extension = object.extension.map((e: any) => FieldDescriptorProto.fromJSON(e)); - if (Array.isArray(object?.nestedType)) obj.nestedType = object.nestedType.map((e: any) => DescriptorProto.fromJSON(e)); - if (Array.isArray(object?.enumType)) obj.enumType = object.enumType.map((e: any) => EnumDescriptorProto.fromJSON(e)); - if (Array.isArray(object?.extensionRange)) obj.extensionRange = object.extensionRange.map((e: any) => DescriptorProto_ExtensionRange.fromJSON(e)); - if (Array.isArray(object?.oneofDecl)) obj.oneofDecl = object.oneofDecl.map((e: any) => OneofDescriptorProto.fromJSON(e)); - if (isSet(object.options)) obj.options = MessageOptions.fromJSON(object.options); - if (Array.isArray(object?.reservedRange)) obj.reservedRange = object.reservedRange.map((e: any) => DescriptorProto_ReservedRange.fromJSON(e)); - if (Array.isArray(object?.reservedName)) obj.reservedName = object.reservedName.map((e: any) => String(e)); - return obj; + 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)) : [] + }; }, toJSON(message: DescriptorProto): JsonSafe<DescriptorProto> { const obj: any = {}; @@ -2013,9 +2188,7 @@ 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)) || []; - if (object.options !== undefined && object.options !== null) { - message.options = MessageOptions.fromPartial(object.options); - } + message.options = object.options !== undefined && object.options !== null ? MessageOptions.fromPartial(object.options) : undefined; message.reservedRange = object.reservedRange?.map(e => DescriptorProto_ReservedRange.fromPartial(e)) || []; message.reservedName = object.reservedName?.map(e => e) || []; return message; @@ -2184,10 +2357,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 !== undefined) { + if (message.start !== 0) { writer.uint32(8).int32(message.start); } - if (message.end !== undefined) { + if (message.end !== 0) { writer.uint32(16).int32(message.end); } if (message.options !== undefined) { @@ -2219,11 +2392,11 @@ export const DescriptorProto_ExtensionRange = { return message; }, fromJSON(object: any): DescriptorProto_ExtensionRange { - const obj = createBaseDescriptorProto_ExtensionRange(); - if (isSet(object.start)) obj.start = Number(object.start); - if (isSet(object.end)) obj.end = Number(object.end); - if (isSet(object.options)) obj.options = ExtensionRangeOptions.fromJSON(object.options); - return obj; + 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 + }; }, toJSON(message: DescriptorProto_ExtensionRange): JsonSafe<DescriptorProto_ExtensionRange> { const obj: any = {}; @@ -2236,9 +2409,7 @@ export const DescriptorProto_ExtensionRange = { const message = createBaseDescriptorProto_ExtensionRange(); message.start = object.start ?? 0; message.end = object.end ?? 0; - if (object.options !== undefined && object.options !== null) { - message.options = ExtensionRangeOptions.fromPartial(object.options); - } + message.options = object.options !== undefined && object.options !== null ? ExtensionRangeOptions.fromPartial(object.options) : undefined; return message; }, fromSDK(object: DescriptorProto_ExtensionRangeSDKType): DescriptorProto_ExtensionRange { @@ -2307,10 +2478,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 !== undefined) { + if (message.start !== 0) { writer.uint32(8).int32(message.start); } - if (message.end !== undefined) { + if (message.end !== 0) { writer.uint32(16).int32(message.end); } return writer; @@ -2336,10 +2507,10 @@ export const DescriptorProto_ReservedRange = { return message; }, fromJSON(object: any): DescriptorProto_ReservedRange { - const obj = createBaseDescriptorProto_ReservedRange(); - if (isSet(object.start)) obj.start = Number(object.start); - if (isSet(object.end)) obj.end = Number(object.end); - return obj; + return { + start: isSet(object.start) ? Number(object.start) : 0, + end: isSet(object.end) ? Number(object.end) : 0 + }; }, toJSON(message: DescriptorProto_ReservedRange): JsonSafe<DescriptorProto_ReservedRange> { const obj: any = {}; @@ -2434,9 +2605,9 @@ export const ExtensionRangeOptions = { return message; }, fromJSON(object: any): ExtensionRangeOptions { - const obj = createBaseExtensionRangeOptions(); - if (Array.isArray(object?.uninterpretedOption)) obj.uninterpretedOption = object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)); - return obj; + return { + uninterpretedOption: Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [] + }; }, toJSON(message: ExtensionRangeOptions): JsonSafe<ExtensionRangeOptions> { const obj: any = {}; @@ -2518,10 +2689,10 @@ function createBaseFieldDescriptorProto(): FieldDescriptorProto { export const FieldDescriptorProto = { typeUrl: "/google.protobuf.FieldDescriptorProto", encode(message: FieldDescriptorProto, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.name !== undefined) { + if (message.name !== "") { writer.uint32(10).string(message.name); } - if (message.number !== undefined) { + if (message.number !== 0) { writer.uint32(24).int32(message.number); } if (message.label !== 1) { @@ -2530,19 +2701,19 @@ export const FieldDescriptorProto = { if (message.type !== 1) { writer.uint32(40).int32(message.type); } - if (message.typeName !== undefined) { + if (message.typeName !== "") { writer.uint32(50).string(message.typeName); } - if (message.extendee !== undefined) { + if (message.extendee !== "") { writer.uint32(18).string(message.extendee); } - if (message.defaultValue !== undefined) { + if (message.defaultValue !== "") { writer.uint32(58).string(message.defaultValue); } - if (message.oneofIndex !== undefined) { + if (message.oneofIndex !== 0) { writer.uint32(72).int32(message.oneofIndex); } - if (message.jsonName !== undefined) { + if (message.jsonName !== "") { writer.uint32(82).string(message.jsonName); } if (message.options !== undefined) { @@ -2595,18 +2766,18 @@ export const FieldDescriptorProto = { return message; }, fromJSON(object: any): FieldDescriptorProto { - const obj = createBaseFieldDescriptorProto(); - if (isSet(object.name)) obj.name = String(object.name); - if (isSet(object.number)) obj.number = Number(object.number); - if (isSet(object.label)) obj.label = fieldDescriptorProto_LabelFromJSON(object.label); - if (isSet(object.type)) obj.type = fieldDescriptorProto_TypeFromJSON(object.type); - if (isSet(object.typeName)) obj.typeName = String(object.typeName); - if (isSet(object.extendee)) obj.extendee = String(object.extendee); - if (isSet(object.defaultValue)) obj.defaultValue = String(object.defaultValue); - if (isSet(object.oneofIndex)) obj.oneofIndex = Number(object.oneofIndex); - if (isSet(object.jsonName)) obj.jsonName = String(object.jsonName); - if (isSet(object.options)) obj.options = FieldOptions.fromJSON(object.options); - return obj; + 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 + }; }, toJSON(message: FieldDescriptorProto): JsonSafe<FieldDescriptorProto> { const obj: any = {}; @@ -2633,9 +2804,7 @@ export const FieldDescriptorProto = { message.defaultValue = object.defaultValue ?? ""; message.oneofIndex = object.oneofIndex ?? 0; message.jsonName = object.jsonName ?? ""; - if (object.options !== undefined && object.options !== null) { - message.options = FieldOptions.fromPartial(object.options); - } + message.options = object.options !== undefined && object.options !== null ? FieldOptions.fromPartial(object.options) : undefined; return message; }, fromSDK(object: FieldDescriptorProtoSDKType): FieldDescriptorProto { @@ -2753,7 +2922,7 @@ function createBaseOneofDescriptorProto(): OneofDescriptorProto { export const OneofDescriptorProto = { typeUrl: "/google.protobuf.OneofDescriptorProto", encode(message: OneofDescriptorProto, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.name !== undefined) { + if (message.name !== "") { writer.uint32(10).string(message.name); } if (message.options !== undefined) { @@ -2782,10 +2951,10 @@ export const OneofDescriptorProto = { return message; }, fromJSON(object: any): OneofDescriptorProto { - const obj = createBaseOneofDescriptorProto(); - if (isSet(object.name)) obj.name = String(object.name); - if (isSet(object.options)) obj.options = OneofOptions.fromJSON(object.options); - return obj; + return { + name: isSet(object.name) ? String(object.name) : "", + options: isSet(object.options) ? OneofOptions.fromJSON(object.options) : undefined + }; }, toJSON(message: OneofDescriptorProto): JsonSafe<OneofDescriptorProto> { const obj: any = {}; @@ -2796,9 +2965,7 @@ export const OneofDescriptorProto = { fromPartial(object: DeepPartial<OneofDescriptorProto>): OneofDescriptorProto { const message = createBaseOneofDescriptorProto(); message.name = object.name ?? ""; - if (object.options !== undefined && object.options !== null) { - message.options = OneofOptions.fromPartial(object.options); - } + message.options = object.options !== undefined && object.options !== null ? OneofOptions.fromPartial(object.options) : undefined; return message; }, fromSDK(object: OneofDescriptorProtoSDKType): OneofDescriptorProto { @@ -2863,7 +3030,7 @@ function createBaseEnumDescriptorProto(): EnumDescriptorProto { export const EnumDescriptorProto = { typeUrl: "/google.protobuf.EnumDescriptorProto", encode(message: EnumDescriptorProto, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.name !== undefined) { + if (message.name !== "") { writer.uint32(10).string(message.name); } for (const v of message.value) { @@ -2910,13 +3077,13 @@ export const EnumDescriptorProto = { return message; }, fromJSON(object: any): EnumDescriptorProto { - const obj = createBaseEnumDescriptorProto(); - if (isSet(object.name)) obj.name = String(object.name); - if (Array.isArray(object?.value)) obj.value = object.value.map((e: any) => EnumValueDescriptorProto.fromJSON(e)); - if (isSet(object.options)) obj.options = EnumOptions.fromJSON(object.options); - if (Array.isArray(object?.reservedRange)) obj.reservedRange = object.reservedRange.map((e: any) => EnumDescriptorProto_EnumReservedRange.fromJSON(e)); - if (Array.isArray(object?.reservedName)) obj.reservedName = object.reservedName.map((e: any) => String(e)); - return obj; + 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)) : [] + }; }, toJSON(message: EnumDescriptorProto): JsonSafe<EnumDescriptorProto> { const obj: any = {}; @@ -2943,9 +3110,7 @@ export const EnumDescriptorProto = { const message = createBaseEnumDescriptorProto(); message.name = object.name ?? ""; message.value = object.value?.map(e => EnumValueDescriptorProto.fromPartial(e)) || []; - if (object.options !== undefined && object.options !== null) { - message.options = EnumOptions.fromPartial(object.options); - } + message.options = object.options !== undefined && object.options !== null ? EnumOptions.fromPartial(object.options) : undefined; message.reservedRange = object.reservedRange?.map(e => EnumDescriptorProto_EnumReservedRange.fromPartial(e)) || []; message.reservedName = object.reservedName?.map(e => e) || []; return message; @@ -3048,10 +3213,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 !== undefined) { + if (message.start !== 0) { writer.uint32(8).int32(message.start); } - if (message.end !== undefined) { + if (message.end !== 0) { writer.uint32(16).int32(message.end); } return writer; @@ -3077,10 +3242,10 @@ export const EnumDescriptorProto_EnumReservedRange = { return message; }, fromJSON(object: any): EnumDescriptorProto_EnumReservedRange { - const obj = createBaseEnumDescriptorProto_EnumReservedRange(); - if (isSet(object.start)) obj.start = Number(object.start); - if (isSet(object.end)) obj.end = Number(object.end); - return obj; + return { + start: isSet(object.start) ? Number(object.start) : 0, + end: isSet(object.end) ? Number(object.end) : 0 + }; }, toJSON(message: EnumDescriptorProto_EnumReservedRange): JsonSafe<EnumDescriptorProto_EnumReservedRange> { const obj: any = {}; @@ -3154,10 +3319,10 @@ function createBaseEnumValueDescriptorProto(): EnumValueDescriptorProto { export const EnumValueDescriptorProto = { typeUrl: "/google.protobuf.EnumValueDescriptorProto", encode(message: EnumValueDescriptorProto, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.name !== undefined) { + if (message.name !== "") { writer.uint32(10).string(message.name); } - if (message.number !== undefined) { + if (message.number !== 0) { writer.uint32(16).int32(message.number); } if (message.options !== undefined) { @@ -3189,11 +3354,11 @@ export const EnumValueDescriptorProto = { return message; }, fromJSON(object: any): EnumValueDescriptorProto { - const obj = createBaseEnumValueDescriptorProto(); - if (isSet(object.name)) obj.name = String(object.name); - if (isSet(object.number)) obj.number = Number(object.number); - if (isSet(object.options)) obj.options = EnumValueOptions.fromJSON(object.options); - return obj; + 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 + }; }, toJSON(message: EnumValueDescriptorProto): JsonSafe<EnumValueDescriptorProto> { const obj: any = {}; @@ -3206,9 +3371,7 @@ export const EnumValueDescriptorProto = { const message = createBaseEnumValueDescriptorProto(); message.name = object.name ?? ""; message.number = object.number ?? 0; - if (object.options !== undefined && object.options !== null) { - message.options = EnumValueOptions.fromPartial(object.options); - } + message.options = object.options !== undefined && object.options !== null ? EnumValueOptions.fromPartial(object.options) : undefined; return message; }, fromSDK(object: EnumValueDescriptorProtoSDKType): EnumValueDescriptorProto { @@ -3278,7 +3441,7 @@ function createBaseServiceDescriptorProto(): ServiceDescriptorProto { export const ServiceDescriptorProto = { typeUrl: "/google.protobuf.ServiceDescriptorProto", encode(message: ServiceDescriptorProto, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.name !== undefined) { + if (message.name !== "") { writer.uint32(10).string(message.name); } for (const v of message.method) { @@ -3313,11 +3476,11 @@ export const ServiceDescriptorProto = { return message; }, fromJSON(object: any): ServiceDescriptorProto { - const obj = createBaseServiceDescriptorProto(); - if (isSet(object.name)) obj.name = String(object.name); - if (Array.isArray(object?.method)) obj.method = object.method.map((e: any) => MethodDescriptorProto.fromJSON(e)); - if (isSet(object.options)) obj.options = ServiceOptions.fromJSON(object.options); - return obj; + 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 + }; }, toJSON(message: ServiceDescriptorProto): JsonSafe<ServiceDescriptorProto> { const obj: any = {}; @@ -3334,9 +3497,7 @@ export const ServiceDescriptorProto = { const message = createBaseServiceDescriptorProto(); message.name = object.name ?? ""; message.method = object.method?.map(e => MethodDescriptorProto.fromPartial(e)) || []; - if (object.options !== undefined && object.options !== null) { - message.options = ServiceOptions.fromPartial(object.options); - } + message.options = object.options !== undefined && object.options !== null ? ServiceOptions.fromPartial(object.options) : undefined; return message; }, fromSDK(object: ServiceDescriptorProtoSDKType): ServiceDescriptorProto { @@ -3415,22 +3576,22 @@ function createBaseMethodDescriptorProto(): MethodDescriptorProto { export const MethodDescriptorProto = { typeUrl: "/google.protobuf.MethodDescriptorProto", encode(message: MethodDescriptorProto, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.name !== undefined) { + if (message.name !== "") { writer.uint32(10).string(message.name); } - if (message.inputType !== undefined) { + if (message.inputType !== "") { writer.uint32(18).string(message.inputType); } - if (message.outputType !== undefined) { + if (message.outputType !== "") { writer.uint32(26).string(message.outputType); } if (message.options !== undefined) { MethodOptions.encode(message.options, writer.uint32(34).fork()).ldelim(); } - if (message.clientStreaming !== undefined) { + if (message.clientStreaming === true) { writer.uint32(40).bool(message.clientStreaming); } - if (message.serverStreaming !== undefined) { + if (message.serverStreaming === true) { writer.uint32(48).bool(message.serverStreaming); } return writer; @@ -3468,14 +3629,14 @@ export const MethodDescriptorProto = { return message; }, fromJSON(object: any): MethodDescriptorProto { - const obj = createBaseMethodDescriptorProto(); - if (isSet(object.name)) obj.name = String(object.name); - if (isSet(object.inputType)) obj.inputType = String(object.inputType); - if (isSet(object.outputType)) obj.outputType = String(object.outputType); - if (isSet(object.options)) obj.options = MethodOptions.fromJSON(object.options); - if (isSet(object.clientStreaming)) obj.clientStreaming = Boolean(object.clientStreaming); - if (isSet(object.serverStreaming)) obj.serverStreaming = Boolean(object.serverStreaming); - return obj; + 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 + }; }, toJSON(message: MethodDescriptorProto): JsonSafe<MethodDescriptorProto> { const obj: any = {}; @@ -3492,9 +3653,7 @@ export const MethodDescriptorProto = { message.name = object.name ?? ""; message.inputType = object.inputType ?? ""; message.outputType = object.outputType ?? ""; - if (object.options !== undefined && object.options !== null) { - message.options = MethodOptions.fromPartial(object.options); - } + message.options = object.options !== undefined && object.options !== null ? MethodOptions.fromPartial(object.options) : undefined; message.clientStreaming = object.clientStreaming ?? false; message.serverStreaming = object.serverStreaming ?? false; return message; @@ -3605,64 +3764,64 @@ function createBaseFileOptions(): FileOptions { export const FileOptions = { typeUrl: "/google.protobuf.FileOptions", encode(message: FileOptions, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.javaPackage !== undefined) { + if (message.javaPackage !== "") { writer.uint32(10).string(message.javaPackage); } - if (message.javaOuterClassname !== undefined) { + if (message.javaOuterClassname !== "") { writer.uint32(66).string(message.javaOuterClassname); } - if (message.javaMultipleFiles !== undefined) { + if (message.javaMultipleFiles === true) { writer.uint32(80).bool(message.javaMultipleFiles); } - if (message.javaGenerateEqualsAndHash !== undefined) { + if (message.javaGenerateEqualsAndHash === true) { writer.uint32(160).bool(message.javaGenerateEqualsAndHash); } - if (message.javaStringCheckUtf8 !== undefined) { + if (message.javaStringCheckUtf8 === true) { writer.uint32(216).bool(message.javaStringCheckUtf8); } if (message.optimizeFor !== 1) { writer.uint32(72).int32(message.optimizeFor); } - if (message.goPackage !== undefined) { + if (message.goPackage !== "") { writer.uint32(90).string(message.goPackage); } - if (message.ccGenericServices !== undefined) { + if (message.ccGenericServices === true) { writer.uint32(128).bool(message.ccGenericServices); } - if (message.javaGenericServices !== undefined) { + if (message.javaGenericServices === true) { writer.uint32(136).bool(message.javaGenericServices); } - if (message.pyGenericServices !== undefined) { + if (message.pyGenericServices === true) { writer.uint32(144).bool(message.pyGenericServices); } - if (message.phpGenericServices !== undefined) { + if (message.phpGenericServices === true) { writer.uint32(336).bool(message.phpGenericServices); } - if (message.deprecated !== undefined) { + if (message.deprecated === true) { writer.uint32(184).bool(message.deprecated); } - if (message.ccEnableArenas !== undefined) { + if (message.ccEnableArenas === true) { writer.uint32(248).bool(message.ccEnableArenas); } - if (message.objcClassPrefix !== undefined) { + if (message.objcClassPrefix !== "") { writer.uint32(290).string(message.objcClassPrefix); } - if (message.csharpNamespace !== undefined) { + if (message.csharpNamespace !== "") { writer.uint32(298).string(message.csharpNamespace); } - if (message.swiftPrefix !== undefined) { + if (message.swiftPrefix !== "") { writer.uint32(314).string(message.swiftPrefix); } - if (message.phpClassPrefix !== undefined) { + if (message.phpClassPrefix !== "") { writer.uint32(322).string(message.phpClassPrefix); } - if (message.phpNamespace !== undefined) { + if (message.phpNamespace !== "") { writer.uint32(330).string(message.phpNamespace); } - if (message.phpMetadataNamespace !== undefined) { + if (message.phpMetadataNamespace !== "") { writer.uint32(354).string(message.phpMetadataNamespace); } - if (message.rubyPackage !== undefined) { + if (message.rubyPackage !== "") { writer.uint32(362).string(message.rubyPackage); } for (const v of message.uninterpretedOption) { @@ -3748,29 +3907,29 @@ export const FileOptions = { return message; }, fromJSON(object: any): FileOptions { - const obj = createBaseFileOptions(); - if (isSet(object.javaPackage)) obj.javaPackage = String(object.javaPackage); - if (isSet(object.javaOuterClassname)) obj.javaOuterClassname = String(object.javaOuterClassname); - if (isSet(object.javaMultipleFiles)) obj.javaMultipleFiles = Boolean(object.javaMultipleFiles); - if (isSet(object.javaGenerateEqualsAndHash)) obj.javaGenerateEqualsAndHash = Boolean(object.javaGenerateEqualsAndHash); - if (isSet(object.javaStringCheckUtf8)) obj.javaStringCheckUtf8 = Boolean(object.javaStringCheckUtf8); - if (isSet(object.optimizeFor)) obj.optimizeFor = fileOptions_OptimizeModeFromJSON(object.optimizeFor); - if (isSet(object.goPackage)) obj.goPackage = String(object.goPackage); - if (isSet(object.ccGenericServices)) obj.ccGenericServices = Boolean(object.ccGenericServices); - if (isSet(object.javaGenericServices)) obj.javaGenericServices = Boolean(object.javaGenericServices); - if (isSet(object.pyGenericServices)) obj.pyGenericServices = Boolean(object.pyGenericServices); - if (isSet(object.phpGenericServices)) obj.phpGenericServices = Boolean(object.phpGenericServices); - if (isSet(object.deprecated)) obj.deprecated = Boolean(object.deprecated); - if (isSet(object.ccEnableArenas)) obj.ccEnableArenas = Boolean(object.ccEnableArenas); - if (isSet(object.objcClassPrefix)) obj.objcClassPrefix = String(object.objcClassPrefix); - if (isSet(object.csharpNamespace)) obj.csharpNamespace = String(object.csharpNamespace); - if (isSet(object.swiftPrefix)) obj.swiftPrefix = String(object.swiftPrefix); - if (isSet(object.phpClassPrefix)) obj.phpClassPrefix = String(object.phpClassPrefix); - if (isSet(object.phpNamespace)) obj.phpNamespace = String(object.phpNamespace); - if (isSet(object.phpMetadataNamespace)) obj.phpMetadataNamespace = String(object.phpMetadataNamespace); - if (isSet(object.rubyPackage)) obj.rubyPackage = String(object.rubyPackage); - if (Array.isArray(object?.uninterpretedOption)) obj.uninterpretedOption = object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)); - return obj; + 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)) : [] + }; }, toJSON(message: FileOptions): JsonSafe<FileOptions> { const obj: any = {}; @@ -4027,16 +4186,16 @@ function createBaseMessageOptions(): MessageOptions { export const MessageOptions = { typeUrl: "/google.protobuf.MessageOptions", encode(message: MessageOptions, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.messageSetWireFormat !== undefined) { + if (message.messageSetWireFormat === true) { writer.uint32(8).bool(message.messageSetWireFormat); } - if (message.noStandardDescriptorAccessor !== undefined) { + if (message.noStandardDescriptorAccessor === true) { writer.uint32(16).bool(message.noStandardDescriptorAccessor); } - if (message.deprecated !== undefined) { + if (message.deprecated === true) { writer.uint32(24).bool(message.deprecated); } - if (message.mapEntry !== undefined) { + if (message.mapEntry === true) { writer.uint32(56).bool(message.mapEntry); } for (const v of message.uninterpretedOption) { @@ -4074,13 +4233,13 @@ export const MessageOptions = { return message; }, fromJSON(object: any): MessageOptions { - const obj = createBaseMessageOptions(); - if (isSet(object.messageSetWireFormat)) obj.messageSetWireFormat = Boolean(object.messageSetWireFormat); - if (isSet(object.noStandardDescriptorAccessor)) obj.noStandardDescriptorAccessor = Boolean(object.noStandardDescriptorAccessor); - if (isSet(object.deprecated)) obj.deprecated = Boolean(object.deprecated); - if (isSet(object.mapEntry)) obj.mapEntry = Boolean(object.mapEntry); - if (Array.isArray(object?.uninterpretedOption)) obj.uninterpretedOption = object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)); - return obj; + 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)) : [] + }; }, toJSON(message: MessageOptions): JsonSafe<MessageOptions> { const obj: any = {}; @@ -4198,19 +4357,19 @@ export const FieldOptions = { if (message.ctype !== 1) { writer.uint32(8).int32(message.ctype); } - if (message.packed !== undefined) { + if (message.packed === true) { writer.uint32(16).bool(message.packed); } if (message.jstype !== 1) { writer.uint32(48).int32(message.jstype); } - if (message.lazy !== undefined) { + if (message.lazy === true) { writer.uint32(40).bool(message.lazy); } - if (message.deprecated !== undefined) { + if (message.deprecated === true) { writer.uint32(24).bool(message.deprecated); } - if (message.weak !== undefined) { + if (message.weak === true) { writer.uint32(80).bool(message.weak); } for (const v of message.uninterpretedOption) { @@ -4254,15 +4413,15 @@ export const FieldOptions = { return message; }, fromJSON(object: any): FieldOptions { - const obj = createBaseFieldOptions(); - if (isSet(object.ctype)) obj.ctype = fieldOptions_CTypeFromJSON(object.ctype); - if (isSet(object.packed)) obj.packed = Boolean(object.packed); - if (isSet(object.jstype)) obj.jstype = fieldOptions_JSTypeFromJSON(object.jstype); - if (isSet(object.lazy)) obj.lazy = Boolean(object.lazy); - if (isSet(object.deprecated)) obj.deprecated = Boolean(object.deprecated); - if (isSet(object.weak)) obj.weak = Boolean(object.weak); - if (Array.isArray(object?.uninterpretedOption)) obj.uninterpretedOption = object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)); - return obj; + 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)) : [] + }; }, toJSON(message: FieldOptions): JsonSafe<FieldOptions> { const obj: any = {}; @@ -4412,9 +4571,9 @@ export const OneofOptions = { return message; }, fromJSON(object: any): OneofOptions { - const obj = createBaseOneofOptions(); - if (Array.isArray(object?.uninterpretedOption)) obj.uninterpretedOption = object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)); - return obj; + return { + uninterpretedOption: Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [] + }; }, toJSON(message: OneofOptions): JsonSafe<OneofOptions> { const obj: any = {}; @@ -4489,10 +4648,10 @@ function createBaseEnumOptions(): EnumOptions { export const EnumOptions = { typeUrl: "/google.protobuf.EnumOptions", encode(message: EnumOptions, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.allowAlias !== undefined) { + if (message.allowAlias === true) { writer.uint32(16).bool(message.allowAlias); } - if (message.deprecated !== undefined) { + if (message.deprecated === true) { writer.uint32(24).bool(message.deprecated); } for (const v of message.uninterpretedOption) { @@ -4524,11 +4683,11 @@ export const EnumOptions = { return message; }, fromJSON(object: any): EnumOptions { - const obj = createBaseEnumOptions(); - if (isSet(object.allowAlias)) obj.allowAlias = Boolean(object.allowAlias); - if (isSet(object.deprecated)) obj.deprecated = Boolean(object.deprecated); - if (Array.isArray(object?.uninterpretedOption)) obj.uninterpretedOption = object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)); - return obj; + 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)) : [] + }; }, toJSON(message: EnumOptions): JsonSafe<EnumOptions> { const obj: any = {}; @@ -4620,7 +4779,7 @@ function createBaseEnumValueOptions(): EnumValueOptions { export const EnumValueOptions = { typeUrl: "/google.protobuf.EnumValueOptions", encode(message: EnumValueOptions, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.deprecated !== undefined) { + if (message.deprecated === true) { writer.uint32(8).bool(message.deprecated); } for (const v of message.uninterpretedOption) { @@ -4649,10 +4808,10 @@ export const EnumValueOptions = { return message; }, fromJSON(object: any): EnumValueOptions { - const obj = createBaseEnumValueOptions(); - if (isSet(object.deprecated)) obj.deprecated = Boolean(object.deprecated); - if (Array.isArray(object?.uninterpretedOption)) obj.uninterpretedOption = object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)); - return obj; + return { + deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, + uninterpretedOption: Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [] + }; }, toJSON(message: EnumValueOptions): JsonSafe<EnumValueOptions> { const obj: any = {}; @@ -4735,7 +4894,7 @@ function createBaseServiceOptions(): ServiceOptions { export const ServiceOptions = { typeUrl: "/google.protobuf.ServiceOptions", encode(message: ServiceOptions, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.deprecated !== undefined) { + if (message.deprecated === true) { writer.uint32(264).bool(message.deprecated); } for (const v of message.uninterpretedOption) { @@ -4764,10 +4923,10 @@ export const ServiceOptions = { return message; }, fromJSON(object: any): ServiceOptions { - const obj = createBaseServiceOptions(); - if (isSet(object.deprecated)) obj.deprecated = Boolean(object.deprecated); - if (Array.isArray(object?.uninterpretedOption)) obj.uninterpretedOption = object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)); - return obj; + return { + deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, + uninterpretedOption: Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [] + }; }, toJSON(message: ServiceOptions): JsonSafe<ServiceOptions> { const obj: any = {}; @@ -4851,7 +5010,7 @@ function createBaseMethodOptions(): MethodOptions { export const MethodOptions = { typeUrl: "/google.protobuf.MethodOptions", encode(message: MethodOptions, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.deprecated !== undefined) { + if (message.deprecated === true) { writer.uint32(264).bool(message.deprecated); } if (message.idempotencyLevel !== 1) { @@ -4886,11 +5045,11 @@ export const MethodOptions = { return message; }, fromJSON(object: any): MethodOptions { - const obj = createBaseMethodOptions(); - if (isSet(object.deprecated)) obj.deprecated = Boolean(object.deprecated); - if (isSet(object.idempotencyLevel)) obj.idempotencyLevel = methodOptions_IdempotencyLevelFromJSON(object.idempotencyLevel); - if (Array.isArray(object?.uninterpretedOption)) obj.uninterpretedOption = object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)); - return obj; + 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)) : [] + }; }, toJSON(message: MethodOptions): JsonSafe<MethodOptions> { const obj: any = {}; @@ -4990,22 +5149,22 @@ export const UninterpretedOption = { for (const v of message.name) { UninterpretedOption_NamePart.encode(v!, writer.uint32(18).fork()).ldelim(); } - if (message.identifierValue !== undefined) { + if (message.identifierValue !== "") { writer.uint32(26).string(message.identifierValue); } - if (message.positiveIntValue !== undefined) { + if (message.positiveIntValue !== BigInt(0)) { writer.uint32(32).uint64(message.positiveIntValue); } - if (message.negativeIntValue !== undefined) { + if (message.negativeIntValue !== BigInt(0)) { writer.uint32(40).int64(message.negativeIntValue); } - if (message.doubleValue !== undefined) { + if (message.doubleValue !== 0) { writer.uint32(49).double(message.doubleValue); } if (message.stringValue.length !== 0) { writer.uint32(58).bytes(message.stringValue); } - if (message.aggregateValue !== undefined) { + if (message.aggregateValue !== "") { writer.uint32(66).string(message.aggregateValue); } return writer; @@ -5046,15 +5205,15 @@ export const UninterpretedOption = { return message; }, fromJSON(object: any): UninterpretedOption { - const obj = createBaseUninterpretedOption(); - if (Array.isArray(object?.name)) obj.name = object.name.map((e: any) => UninterpretedOption_NamePart.fromJSON(e)); - if (isSet(object.identifierValue)) obj.identifierValue = String(object.identifierValue); - if (isSet(object.positiveIntValue)) obj.positiveIntValue = BigInt(object.positiveIntValue.toString()); - if (isSet(object.negativeIntValue)) obj.negativeIntValue = BigInt(object.negativeIntValue.toString()); - if (isSet(object.doubleValue)) obj.doubleValue = Number(object.doubleValue); - if (isSet(object.stringValue)) obj.stringValue = bytesFromBase64(object.stringValue); - if (isSet(object.aggregateValue)) obj.aggregateValue = String(object.aggregateValue); - return obj; + 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) : "" + }; }, toJSON(message: UninterpretedOption): JsonSafe<UninterpretedOption> { const obj: any = {}; @@ -5075,12 +5234,8 @@ export const UninterpretedOption = { const message = createBaseUninterpretedOption(); message.name = object.name?.map(e => UninterpretedOption_NamePart.fromPartial(e)) || []; message.identifierValue = object.identifierValue ?? ""; - if (object.positiveIntValue !== undefined && object.positiveIntValue !== null) { - message.positiveIntValue = BigInt(object.positiveIntValue.toString()); - } - if (object.negativeIntValue !== undefined && object.negativeIntValue !== null) { - message.negativeIntValue = BigInt(object.negativeIntValue.toString()); - } + message.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); message.doubleValue = object.doubleValue ?? 0; message.stringValue = object.stringValue ?? new Uint8Array(); message.aggregateValue = object.aggregateValue ?? ""; @@ -5186,10 +5341,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 !== undefined) { + if (message.namePart !== "") { writer.uint32(10).string(message.namePart); } - if (message.isExtension !== undefined) { + if (message.isExtension === true) { writer.uint32(16).bool(message.isExtension); } return writer; @@ -5215,10 +5370,10 @@ export const UninterpretedOption_NamePart = { return message; }, fromJSON(object: any): UninterpretedOption_NamePart { - const obj = createBaseUninterpretedOption_NamePart(); - if (isSet(object.namePart)) obj.namePart = String(object.namePart); - if (isSet(object.isExtension)) obj.isExtension = Boolean(object.isExtension); - return obj; + return { + namePart: isSet(object.namePart) ? String(object.namePart) : "", + isExtension: isSet(object.isExtension) ? Boolean(object.isExtension) : false + }; }, toJSON(message: UninterpretedOption_NamePart): JsonSafe<UninterpretedOption_NamePart> { const obj: any = {}; @@ -5313,9 +5468,9 @@ export const SourceCodeInfo = { return message; }, fromJSON(object: any): SourceCodeInfo { - const obj = createBaseSourceCodeInfo(); - if (Array.isArray(object?.location)) obj.location = object.location.map((e: any) => SourceCodeInfo_Location.fromJSON(e)); - return obj; + return { + location: Array.isArray(object?.location) ? object.location.map((e: any) => SourceCodeInfo_Location.fromJSON(e)) : [] + }; }, toJSON(message: SourceCodeInfo): JsonSafe<SourceCodeInfo> { const obj: any = {}; @@ -5402,10 +5557,10 @@ export const SourceCodeInfo_Location = { writer.int32(v); } writer.ldelim(); - if (message.leadingComments !== undefined) { + if (message.leadingComments !== "") { writer.uint32(26).string(message.leadingComments); } - if (message.trailingComments !== undefined) { + if (message.trailingComments !== "") { writer.uint32(34).string(message.trailingComments); } for (const v of message.leadingDetachedComments) { @@ -5457,13 +5612,13 @@ export const SourceCodeInfo_Location = { return message; }, fromJSON(object: any): SourceCodeInfo_Location { - const obj = createBaseSourceCodeInfo_Location(); - if (Array.isArray(object?.path)) obj.path = object.path.map((e: any) => Number(e)); - if (Array.isArray(object?.span)) obj.span = object.span.map((e: any) => Number(e)); - if (isSet(object.leadingComments)) obj.leadingComments = String(object.leadingComments); - if (isSet(object.trailingComments)) obj.trailingComments = String(object.trailingComments); - if (Array.isArray(object?.leadingDetachedComments)) obj.leadingDetachedComments = object.leadingDetachedComments.map((e: any) => String(e)); - return obj; + 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)) : [] + }; }, toJSON(message: SourceCodeInfo_Location): JsonSafe<SourceCodeInfo_Location> { const obj: any = {}; @@ -5615,9 +5770,9 @@ export const GeneratedCodeInfo = { return message; }, fromJSON(object: any): GeneratedCodeInfo { - const obj = createBaseGeneratedCodeInfo(); - if (Array.isArray(object?.annotation)) obj.annotation = object.annotation.map((e: any) => GeneratedCodeInfo_Annotation.fromJSON(e)); - return obj; + return { + annotation: Array.isArray(object?.annotation) ? object.annotation.map((e: any) => GeneratedCodeInfo_Annotation.fromJSON(e)) : [] + }; }, toJSON(message: GeneratedCodeInfo): JsonSafe<GeneratedCodeInfo> { const obj: any = {}; @@ -5698,13 +5853,13 @@ export const GeneratedCodeInfo_Annotation = { writer.int32(v); } writer.ldelim(); - if (message.sourceFile !== undefined) { + if (message.sourceFile !== "") { writer.uint32(18).string(message.sourceFile); } - if (message.begin !== undefined) { + if (message.begin !== 0) { writer.uint32(24).int32(message.begin); } - if (message.end !== undefined) { + if (message.end !== 0) { writer.uint32(32).int32(message.end); } return writer; @@ -5743,12 +5898,12 @@ export const GeneratedCodeInfo_Annotation = { return message; }, fromJSON(object: any): GeneratedCodeInfo_Annotation { - const obj = createBaseGeneratedCodeInfo_Annotation(); - if (Array.isArray(object?.path)) obj.path = object.path.map((e: any) => Number(e)); - if (isSet(object.sourceFile)) obj.sourceFile = String(object.sourceFile); - if (isSet(object.begin)) obj.begin = Number(object.begin); - if (isSet(object.end)) obj.end = Number(object.end); - return obj; + 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 + }; }, toJSON(message: GeneratedCodeInfo_Annotation): JsonSafe<GeneratedCodeInfo_Annotation> { const obj: any = {}; diff --git a/__fixtures__/v-next/outputv4/google/protobuf/duration.ts b/__fixtures__/v-next/outputv4/google/protobuf/duration.ts index 2fa45e4f46..6634159cfe 100644 --- a/__fixtures__/v-next/outputv4/google/protobuf/duration.ts +++ b/__fixtures__/v-next/outputv4/google/protobuf/duration.ts @@ -1,6 +1,7 @@ -import { BinaryReader, BinaryWriter } from "../../binary.js"; -import { isSet, DeepPartial } from "../../helpers.js"; -import { JsonSafe } from "../../json-safe.js"; +import { BinaryReader, BinaryWriter } from "../../binary"; +import { isSet, DeepPartial } from "../../helpers"; +import { JsonSafe } from "../../json-safe"; +import { ComputedRef } from "vue"; export const protobufPackage = "google.protobuf"; /** * A Duration represents a signed, fixed-length span of time represented @@ -79,6 +80,10 @@ export interface Duration { */ nanos: number; } +export interface ReactiveDuration { + seconds: ComputedRef<bigint>; + nanos: ComputedRef<number>; +} export interface DurationProtoMsg { typeUrl: "/google.protobuf.Duration"; value: Uint8Array; @@ -156,10 +161,10 @@ function createBaseDuration(): Duration { export const Duration = { typeUrl: "/google.protobuf.Duration", encode(message: Duration, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.seconds !== undefined) { + if (message.seconds !== BigInt(0)) { writer.uint32(8).int64(message.seconds); } - if (message.nanos !== undefined) { + if (message.nanos !== 0) { writer.uint32(16).int32(message.nanos); } return writer; @@ -185,10 +190,10 @@ export const Duration = { return message; }, fromJSON(object: any): Duration { - const obj = createBaseDuration(); - if (isSet(object.seconds)) obj.seconds = BigInt(object.seconds.toString()); - if (isSet(object.nanos)) obj.nanos = Number(object.nanos); - return obj; + return { + seconds: isSet(object.seconds) ? BigInt(object.seconds.toString()) : BigInt(0), + nanos: isSet(object.nanos) ? Number(object.nanos) : 0 + }; }, toJSON(message: Duration): JsonSafe<Duration> { const obj: any = {}; @@ -198,9 +203,7 @@ export const Duration = { }, fromPartial(object: DeepPartial<Duration>): Duration { const message = createBaseDuration(); - if (object.seconds !== undefined && object.seconds !== null) { - message.seconds = BigInt(object.seconds.toString()); - } + message.seconds = object.seconds !== undefined && object.seconds !== null ? BigInt(object.seconds.toString()) : BigInt(0); 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 a7e3fcd23c..0a1f0441e0 100644 --- a/__fixtures__/v-next/outputv4/google/protobuf/empty.ts +++ b/__fixtures__/v-next/outputv4/google/protobuf/empty.ts @@ -1,6 +1,7 @@ -import { BinaryReader, BinaryWriter } from "../../binary.js"; -import { JsonSafe } from "../../json-safe.js"; -import { DeepPartial } from "../../helpers.js"; +import { BinaryReader, BinaryWriter } from "../../binary"; +import { JsonSafe } from "../../json-safe"; +import { DeepPartial } from "../../helpers"; +import { ComputedRef } from "vue"; export const protobufPackage = "google.protobuf"; /** * A generic empty message that you can re-use to avoid defining duplicated @@ -14,6 +15,7 @@ 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; @@ -53,8 +55,7 @@ export const Empty = { return message; }, fromJSON(_: any): Empty { - const obj = createBaseEmpty(); - return obj; + return {}; }, toJSON(_: Empty): JsonSafe<Empty> { 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 f0247add07..934e420b01 100644 --- a/__fixtures__/v-next/outputv4/google/protobuf/field_mask.ts +++ b/__fixtures__/v-next/outputv4/google/protobuf/field_mask.ts @@ -1,6 +1,7 @@ -import { BinaryReader, BinaryWriter } from "../../binary.js"; -import { JsonSafe } from "../../json-safe.js"; -import { DeepPartial } from "../../helpers.js"; +import { BinaryReader, BinaryWriter } from "../../binary"; +import { JsonSafe } from "../../json-safe"; +import { DeepPartial } from "../../helpers"; +import { ComputedRef } from "vue"; export const protobufPackage = "google.protobuf"; /** * `FieldMask` represents a set of symbolic field paths, for example: @@ -207,6 +208,9 @@ export interface FieldMask { /** The set of field mask paths. */ paths: string[]; } +export interface ReactiveFieldMask { + paths: ComputedRef<string[]>; +} export interface FieldMaskProtoMsg { typeUrl: "/google.protobuf.FieldMask"; value: Uint8Array; @@ -446,9 +450,9 @@ export const FieldMask = { return message; }, fromJSON(object: any): FieldMask { - const obj = createBaseFieldMask(); - if (Array.isArray(object?.paths)) obj.paths = object.paths.map((e: any) => String(e)); - return obj; + return { + paths: Array.isArray(object?.paths) ? object.paths.map((e: any) => String(e)) : [] + }; }, toJSON(message: FieldMask): JsonSafe<FieldMask> { 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 b30ee947bd..e7eba72e22 100644 --- a/__fixtures__/v-next/outputv4/google/protobuf/source_context.ts +++ b/__fixtures__/v-next/outputv4/google/protobuf/source_context.ts @@ -1,6 +1,7 @@ -import { BinaryReader, BinaryWriter } from "../../binary.js"; -import { isSet, DeepPartial } from "../../helpers.js"; -import { JsonSafe } from "../../json-safe.js"; +import { BinaryReader, BinaryWriter } from "../../binary"; +import { isSet, DeepPartial } from "../../helpers"; +import { JsonSafe } from "../../json-safe"; +import { ComputedRef } from "vue"; export const protobufPackage = "google.protobuf"; /** * `SourceContext` represents information about the source of a @@ -13,6 +14,9 @@ export interface SourceContext { */ fileName: string; } +export interface ReactiveSourceContext { + fileName: ComputedRef<string>; +} export interface SourceContextProtoMsg { typeUrl: "/google.protobuf.SourceContext"; value: Uint8Array; @@ -32,7 +36,7 @@ function createBaseSourceContext(): SourceContext { export const SourceContext = { typeUrl: "/google.protobuf.SourceContext", encode(message: SourceContext, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.fileName !== undefined) { + if (message.fileName !== "") { writer.uint32(10).string(message.fileName); } return writer; @@ -55,9 +59,9 @@ export const SourceContext = { return message; }, fromJSON(object: any): SourceContext { - const obj = createBaseSourceContext(); - if (isSet(object.fileName)) obj.fileName = String(object.fileName); - return obj; + return { + fileName: isSet(object.fileName) ? String(object.fileName) : "" + }; }, toJSON(message: SourceContext): JsonSafe<SourceContext> { const obj: any = {}; diff --git a/__fixtures__/v-next/outputv4/google/protobuf/struct.ts b/__fixtures__/v-next/outputv4/google/protobuf/struct.ts index 930dab6e07..0af6d60ff1 100644 --- a/__fixtures__/v-next/outputv4/google/protobuf/struct.ts +++ b/__fixtures__/v-next/outputv4/google/protobuf/struct.ts @@ -1,6 +1,7 @@ -import { BinaryReader, BinaryWriter } from "../../binary.js"; -import { isSet, DeepPartial, isObject } from "../../helpers.js"; -import { JsonSafe } from "../../json-safe.js"; +import { BinaryReader, BinaryWriter } from "../../binary"; +import { isSet, DeepPartial, isObject } from "../../helpers"; +import { JsonSafe } from "../../json-safe"; +import { ComputedRef } from "vue"; export const protobufPackage = "google.protobuf"; /** * `NullValue` is a singleton enumeration to represent the null value for the @@ -38,6 +39,10 @@ export interface Struct_FieldsEntry { key: string; value?: Value; } +export interface ReactiveStruct_FieldsEntry { + key: ComputedRef<string>; + value?: ComputedRef<Value>; +} export interface Struct_FieldsEntryProtoMsg { typeUrl: string; value: Uint8Array; @@ -62,6 +67,11 @@ export interface Struct { [key: string]: Value; }; } +export interface ReactiveStruct { + fields: ComputedRef<{ + [key: string]: Value; + }>; +} export interface StructProtoMsg { typeUrl: "/google.protobuf.Struct"; value: Uint8Array; @@ -103,6 +113,14 @@ export interface Value { /** Represents a repeated `Value`. */ listValue?: ListValue; } +export interface ReactiveValue { + nullValue?: ComputedRef<NullValue>; + numberValue?: ComputedRef<number>; + stringValue?: ComputedRef<string>; + boolValue?: ComputedRef<boolean>; + structValue?: ComputedRef<Struct>; + listValue?: ComputedRef<ListValue>; +} export interface ValueProtoMsg { typeUrl: "/google.protobuf.Value"; value: Uint8Array; @@ -132,6 +150,9 @@ export interface ListValue { /** Repeated field of dynamically typed values. */ values: Value[]; } +export interface ReactiveListValue { + values: ComputedRef<Value[]>; +} export interface ListValueProtoMsg { typeUrl: "/google.protobuf.ListValue"; value: Uint8Array; @@ -152,7 +173,7 @@ function createBaseStruct_FieldsEntry(): Struct_FieldsEntry { } export const Struct_FieldsEntry = { encode(message: Struct_FieldsEntry, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.key !== undefined) { + if (message.key !== "") { writer.uint32(10).string(message.key); } if (message.value !== undefined) { @@ -181,10 +202,10 @@ export const Struct_FieldsEntry = { return message; }, fromJSON(object: any): Struct_FieldsEntry { - 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; + return { + key: isSet(object.key) ? String(object.key) : "", + value: isSet(object.value) ? Value.fromJSON(object.value) : undefined + }; }, toJSON(message: Struct_FieldsEntry): JsonSafe<Struct_FieldsEntry> { const obj: any = {}; @@ -195,9 +216,7 @@ export const Struct_FieldsEntry = { fromPartial(object: DeepPartial<Struct_FieldsEntry>): Struct_FieldsEntry { const message = createBaseStruct_FieldsEntry(); message.key = object.key ?? ""; - if (object.value !== undefined && object.value !== null) { - message.value = Value.fromPartial(object.value); - } + message.value = object.value !== undefined && object.value !== null ? Value.fromPartial(object.value) : undefined; return message; }, fromSDK(object: Struct_FieldsEntrySDKType): Struct_FieldsEntry { @@ -281,14 +300,14 @@ export const Struct = { return message; }, fromJSON(object: any): Struct { - 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; + return { + fields: isObject(object.fields) ? Object.entries(object.fields).reduce<{ + [key: string]: Value; + }>((acc, [key, value]) => { + acc[key] = Value.fromJSON(value); + return acc; + }, {}) : {} + }; }, toJSON(message: Struct): JsonSafe<Struct> { const obj: any = {}; @@ -446,14 +465,14 @@ export const Value = { return message; }, fromJSON(object: any): Value { - 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; + 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 + }; }, toJSON(message: Value): JsonSafe<Value> { const obj: any = {}; @@ -471,12 +490,8 @@ export const Value = { message.numberValue = object.numberValue ?? undefined; message.stringValue = object.stringValue ?? undefined; message.boolValue = object.boolValue ?? 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); - } + 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; return message; }, fromSDK(object: ValueSDKType): Value { @@ -588,9 +603,9 @@ export const ListValue = { return message; }, fromJSON(object: any): ListValue { - const obj = createBaseListValue(); - if (Array.isArray(object?.values)) obj.values = object.values.map((e: any) => Value.fromJSON(e)); - return obj; + return { + values: Array.isArray(object?.values) ? object.values.map((e: any) => Value.fromJSON(e)) : [] + }; }, toJSON(message: ListValue): JsonSafe<ListValue> { const obj: any = {}; diff --git a/__fixtures__/v-next/outputv4/google/protobuf/timestamp.ts b/__fixtures__/v-next/outputv4/google/protobuf/timestamp.ts index 9b0ae07ea7..6a68fca801 100644 --- a/__fixtures__/v-next/outputv4/google/protobuf/timestamp.ts +++ b/__fixtures__/v-next/outputv4/google/protobuf/timestamp.ts @@ -1,6 +1,7 @@ -import { BinaryReader, BinaryWriter } from "../../binary.js"; -import { isSet, DeepPartial, fromJsonTimestamp, fromTimestamp } from "../../helpers.js"; -import { JsonSafe } from "../../json-safe.js"; +import { BinaryReader, BinaryWriter } from "../../binary"; +import { isSet, DeepPartial, fromJsonTimestamp, fromTimestamp } from "../../helpers"; +import { JsonSafe } from "../../json-safe"; +import { ComputedRef } from "vue"; export const protobufPackage = "google.protobuf"; /** * A Timestamp represents a point in time independent of any time zone or local @@ -101,6 +102,10 @@ export interface Timestamp { */ nanos: number; } +export interface ReactiveTimestamp { + seconds: ComputedRef<bigint>; + nanos: ComputedRef<number>; +} export interface TimestampProtoMsg { typeUrl: "/google.protobuf.Timestamp"; value: Uint8Array; @@ -202,10 +207,10 @@ function createBaseTimestamp(): Timestamp { export const Timestamp = { typeUrl: "/google.protobuf.Timestamp", encode(message: Timestamp, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.seconds !== undefined) { + if (message.seconds !== BigInt(0)) { writer.uint32(8).int64(message.seconds); } - if (message.nanos !== undefined) { + if (message.nanos !== 0) { writer.uint32(16).int32(message.nanos); } return writer; @@ -231,10 +236,10 @@ export const Timestamp = { return message; }, fromJSON(object: any): Timestamp { - const obj = createBaseTimestamp(); - if (isSet(object.seconds)) obj.seconds = BigInt(object.seconds.toString()); - if (isSet(object.nanos)) obj.nanos = Number(object.nanos); - return obj; + return { + seconds: isSet(object.seconds) ? BigInt(object.seconds.toString()) : BigInt(0), + nanos: isSet(object.nanos) ? Number(object.nanos) : 0 + }; }, toJSON(message: Timestamp): JsonSafe<Timestamp> { const obj: any = {}; @@ -244,9 +249,7 @@ export const Timestamp = { }, fromPartial(object: DeepPartial<Timestamp>): Timestamp { const message = createBaseTimestamp(); - if (object.seconds !== undefined && object.seconds !== null) { - message.seconds = BigInt(object.seconds.toString()); - } + message.seconds = object.seconds !== undefined && object.seconds !== null ? BigInt(object.seconds.toString()) : BigInt(0); 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 74eef8b121..cad2ebf48f 100644 --- a/__fixtures__/v-next/outputv4/google/protobuf/type.ts +++ b/__fixtures__/v-next/outputv4/google/protobuf/type.ts @@ -1,8 +1,9 @@ -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"; +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"; export const protobufPackage = "google.protobuf"; /** Basic field types. */ export enum Field_Kind { @@ -254,6 +255,14 @@ export interface Type { /** The source syntax. */ syntax: Syntax; } +export interface ReactiveType { + name: ComputedRef<string>; + fields: ComputedRef<Field[]>; + oneofs: ComputedRef<string[]>; + options: ComputedRef<Option[]>; + sourceContext?: ComputedRef<SourceContext>; + syntax: ComputedRef<Syntax>; +} export interface TypeProtoMsg { typeUrl: "/google.protobuf.Type"; value: Uint8Array; @@ -296,6 +305,18 @@ export interface Field { /** The string value of the default value of this field. Proto2 syntax only. */ defaultValue: string; } +export interface ReactiveField { + kind: ComputedRef<Field_Kind>; + cardinality: ComputedRef<Field_Cardinality>; + number: ComputedRef<number>; + name: ComputedRef<string>; + typeUrl: ComputedRef<string>; + oneofIndex: ComputedRef<number>; + packed: ComputedRef<boolean>; + options: ComputedRef<Option[]>; + jsonName: ComputedRef<string>; + defaultValue: ComputedRef<string>; +} export interface FieldProtoMsg { typeUrl: "/google.protobuf.Field"; value: Uint8Array; @@ -326,6 +347,13 @@ export interface Enum { /** The source syntax. */ syntax: Syntax; } +export interface ReactiveEnum { + name: ComputedRef<string>; + enumvalue: ComputedRef<EnumValue[]>; + options: ComputedRef<Option[]>; + sourceContext?: ComputedRef<SourceContext>; + syntax: ComputedRef<Syntax>; +} export interface EnumProtoMsg { typeUrl: "/google.protobuf.Enum"; value: Uint8Array; @@ -347,6 +375,11 @@ export interface EnumValue { /** Protocol buffer options. */ options: Option[]; } +export interface ReactiveEnumValue { + name: ComputedRef<string>; + number: ComputedRef<number>; + options: ComputedRef<Option[]>; +} export interface EnumValueProtoMsg { typeUrl: "/google.protobuf.EnumValue"; value: Uint8Array; @@ -377,6 +410,10 @@ export interface Option { */ value?: Any; } +export interface ReactiveOption { + name: ComputedRef<string>; + value?: ComputedRef<Any>; +} export interface OptionProtoMsg { typeUrl: "/google.protobuf.Option"; value: Uint8Array; @@ -402,7 +439,7 @@ function createBaseType(): Type { export const Type = { typeUrl: "/google.protobuf.Type", encode(message: Type, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.name !== undefined) { + if (message.name !== "") { writer.uint32(10).string(message.name); } for (const v of message.fields) { @@ -455,14 +492,14 @@ export const Type = { return message; }, fromJSON(object: any): Type { - 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; + 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 + }; }, toJSON(message: Type): JsonSafe<Type> { const obj: any = {}; @@ -492,9 +529,7 @@ 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)) || []; - if (object.sourceContext !== undefined && object.sourceContext !== null) { - message.sourceContext = SourceContext.fromPartial(object.sourceContext); - } + message.sourceContext = object.sourceContext !== undefined && object.sourceContext !== null ? SourceContext.fromPartial(object.sourceContext) : undefined; message.syntax = object.syntax ?? 0; return message; }, @@ -617,28 +652,28 @@ export const Field = { if (message.cardinality !== 0) { writer.uint32(16).int32(message.cardinality); } - if (message.number !== undefined) { + if (message.number !== 0) { writer.uint32(24).int32(message.number); } - if (message.name !== undefined) { + if (message.name !== "") { writer.uint32(34).string(message.name); } - if (message.typeUrl !== undefined) { + if (message.typeUrl !== "") { writer.uint32(50).string(message.typeUrl); } - if (message.oneofIndex !== undefined) { + if (message.oneofIndex !== 0) { writer.uint32(56).int32(message.oneofIndex); } - if (message.packed !== undefined) { + if (message.packed === true) { writer.uint32(64).bool(message.packed); } for (const v of message.options) { Option.encode(v!, writer.uint32(74).fork()).ldelim(); } - if (message.jsonName !== undefined) { + if (message.jsonName !== "") { writer.uint32(82).string(message.jsonName); } - if (message.defaultValue !== undefined) { + if (message.defaultValue !== "") { writer.uint32(90).string(message.defaultValue); } return writer; @@ -688,18 +723,18 @@ export const Field = { return message; }, fromJSON(object: any): Field { - 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; + 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) : "" + }; }, toJSON(message: Field): JsonSafe<Field> { const obj: any = {}; @@ -857,7 +892,7 @@ function createBaseEnum(): Enum { export const Enum = { typeUrl: "/google.protobuf.Enum", encode(message: Enum, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.name !== undefined) { + if (message.name !== "") { writer.uint32(10).string(message.name); } for (const v of message.enumvalue) { @@ -904,13 +939,13 @@ export const Enum = { return message; }, fromJSON(object: any): Enum { - 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; + 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 + }; }, toJSON(message: Enum): JsonSafe<Enum> { const obj: any = {}; @@ -934,9 +969,7 @@ 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)) || []; - if (object.sourceContext !== undefined && object.sourceContext !== null) { - message.sourceContext = SourceContext.fromPartial(object.sourceContext); - } + message.sourceContext = object.sourceContext !== undefined && object.sourceContext !== null ? SourceContext.fromPartial(object.sourceContext) : undefined; message.syntax = object.syntax ?? 0; return message; }, @@ -1033,10 +1066,10 @@ function createBaseEnumValue(): EnumValue { export const EnumValue = { typeUrl: "/google.protobuf.EnumValue", encode(message: EnumValue, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.name !== undefined) { + if (message.name !== "") { writer.uint32(10).string(message.name); } - if (message.number !== undefined) { + if (message.number !== 0) { writer.uint32(16).int32(message.number); } for (const v of message.options) { @@ -1068,11 +1101,11 @@ export const EnumValue = { return message; }, fromJSON(object: any): EnumValue { - 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; + 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)) : [] + }; }, toJSON(message: EnumValue): JsonSafe<EnumValue> { const obj: any = {}; @@ -1164,7 +1197,7 @@ function createBaseOption(): Option { export const Option = { typeUrl: "/google.protobuf.Option", encode(message: Option, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.name !== undefined) { + if (message.name !== "") { writer.uint32(10).string(message.name); } if (message.value !== undefined) { @@ -1193,10 +1226,10 @@ export const Option = { return message; }, fromJSON(object: any): Option { - const obj = createBaseOption(); - if (isSet(object.name)) obj.name = String(object.name); - if (isSet(object.value)) obj.value = Any.fromJSON(object.value); - return obj; + return { + name: isSet(object.name) ? String(object.name) : "", + value: isSet(object.value) ? Any.fromJSON(object.value) : undefined + }; }, toJSON(message: Option): JsonSafe<Option> { const obj: any = {}; @@ -1207,9 +1240,7 @@ export const Option = { fromPartial(object: DeepPartial<Option>): Option { const message = createBaseOption(); message.name = object.name ?? ""; - if (object.value !== undefined && object.value !== null) { - message.value = Any.fromPartial(object.value); - } + message.value = object.value !== undefined && object.value !== null ? Any.fromPartial(object.value) : undefined; return message; }, fromSDK(object: OptionSDKType): Option { diff --git a/__fixtures__/v-next/outputv4/google/protobuf/wrappers.ts b/__fixtures__/v-next/outputv4/google/protobuf/wrappers.ts index 62cc4f6c9f..fe36ab72e8 100644 --- a/__fixtures__/v-next/outputv4/google/protobuf/wrappers.ts +++ b/__fixtures__/v-next/outputv4/google/protobuf/wrappers.ts @@ -1,6 +1,7 @@ -import { BinaryReader, BinaryWriter } from "../../binary.js"; -import { isSet, DeepPartial, bytesFromBase64, base64FromBytes } from "../../helpers.js"; -import { JsonSafe } from "../../json-safe.js"; +import { BinaryReader, BinaryWriter } from "../../binary"; +import { isSet, DeepPartial, bytesFromBase64, base64FromBytes } from "../../helpers"; +import { JsonSafe } from "../../json-safe"; +import { ComputedRef } from "vue"; export const protobufPackage = "google.protobuf"; /** * Wrapper message for `double`. @@ -11,6 +12,9 @@ export interface DoubleValue { /** The double value. */ value: number; } +export interface ReactiveDoubleValue { + value: ComputedRef<number>; +} export interface DoubleValueProtoMsg { typeUrl: "/google.protobuf.DoubleValue"; value: Uint8Array; @@ -32,6 +36,9 @@ export interface FloatValue { /** The float value. */ value: number; } +export interface ReactiveFloatValue { + value: ComputedRef<number>; +} export interface FloatValueProtoMsg { typeUrl: "/google.protobuf.FloatValue"; value: Uint8Array; @@ -53,6 +60,9 @@ export interface Int64Value { /** The int64 value. */ value: bigint; } +export interface ReactiveInt64Value { + value: ComputedRef<bigint>; +} export interface Int64ValueProtoMsg { typeUrl: "/google.protobuf.Int64Value"; value: Uint8Array; @@ -74,6 +84,9 @@ export interface UInt64Value { /** The uint64 value. */ value: bigint; } +export interface ReactiveUInt64Value { + value: ComputedRef<bigint>; +} export interface UInt64ValueProtoMsg { typeUrl: "/google.protobuf.UInt64Value"; value: Uint8Array; @@ -95,6 +108,9 @@ export interface Int32Value { /** The int32 value. */ value: number; } +export interface ReactiveInt32Value { + value: ComputedRef<number>; +} export interface Int32ValueProtoMsg { typeUrl: "/google.protobuf.Int32Value"; value: Uint8Array; @@ -116,6 +132,9 @@ export interface UInt32Value { /** The uint32 value. */ value: number; } +export interface ReactiveUInt32Value { + value: ComputedRef<number>; +} export interface UInt32ValueProtoMsg { typeUrl: "/google.protobuf.UInt32Value"; value: Uint8Array; @@ -137,6 +156,9 @@ export interface BoolValue { /** The bool value. */ value: boolean; } +export interface ReactiveBoolValue { + value: ComputedRef<boolean>; +} export interface BoolValueProtoMsg { typeUrl: "/google.protobuf.BoolValue"; value: Uint8Array; @@ -158,6 +180,9 @@ export interface StringValue { /** The string value. */ value: string; } +export interface ReactiveStringValue { + value: ComputedRef<string>; +} export interface StringValueProtoMsg { typeUrl: "/google.protobuf.StringValue"; value: Uint8Array; @@ -179,6 +204,9 @@ export interface BytesValue { /** The bytes value. */ value: Uint8Array; } +export interface ReactiveBytesValue { + value: ComputedRef<Uint8Array>; +} export interface BytesValueProtoMsg { typeUrl: "/google.protobuf.BytesValue"; value: Uint8Array; @@ -199,7 +227,7 @@ function createBaseDoubleValue(): DoubleValue { export const DoubleValue = { typeUrl: "/google.protobuf.DoubleValue", encode(message: DoubleValue, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.value !== undefined) { + if (message.value !== 0) { writer.uint32(9).double(message.value); } return writer; @@ -222,9 +250,9 @@ export const DoubleValue = { return message; }, fromJSON(object: any): DoubleValue { - const obj = createBaseDoubleValue(); - if (isSet(object.value)) obj.value = Number(object.value); - return obj; + return { + value: isSet(object.value) ? Number(object.value) : 0 + }; }, toJSON(message: DoubleValue): JsonSafe<DoubleValue> { const obj: any = {}; @@ -287,7 +315,7 @@ function createBaseFloatValue(): FloatValue { export const FloatValue = { typeUrl: "/google.protobuf.FloatValue", encode(message: FloatValue, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.value !== undefined) { + if (message.value !== 0) { writer.uint32(13).float(message.value); } return writer; @@ -310,9 +338,9 @@ export const FloatValue = { return message; }, fromJSON(object: any): FloatValue { - const obj = createBaseFloatValue(); - if (isSet(object.value)) obj.value = Number(object.value); - return obj; + return { + value: isSet(object.value) ? Number(object.value) : 0 + }; }, toJSON(message: FloatValue): JsonSafe<FloatValue> { const obj: any = {}; @@ -375,7 +403,7 @@ function createBaseInt64Value(): Int64Value { export const Int64Value = { typeUrl: "/google.protobuf.Int64Value", encode(message: Int64Value, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.value !== undefined) { + if (message.value !== BigInt(0)) { writer.uint32(8).int64(message.value); } return writer; @@ -398,9 +426,9 @@ export const Int64Value = { return message; }, fromJSON(object: any): Int64Value { - const obj = createBaseInt64Value(); - if (isSet(object.value)) obj.value = BigInt(object.value.toString()); - return obj; + return { + value: isSet(object.value) ? BigInt(object.value.toString()) : BigInt(0) + }; }, toJSON(message: Int64Value): JsonSafe<Int64Value> { const obj: any = {}; @@ -409,9 +437,7 @@ export const Int64Value = { }, fromPartial(object: DeepPartial<Int64Value>): Int64Value { const message = createBaseInt64Value(); - if (object.value !== undefined && object.value !== null) { - message.value = BigInt(object.value.toString()); - } + message.value = object.value !== undefined && object.value !== null ? BigInt(object.value.toString()) : BigInt(0); return message; }, fromSDK(object: Int64ValueSDKType): Int64Value { @@ -465,7 +491,7 @@ function createBaseUInt64Value(): UInt64Value { export const UInt64Value = { typeUrl: "/google.protobuf.UInt64Value", encode(message: UInt64Value, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.value !== undefined) { + if (message.value !== BigInt(0)) { writer.uint32(8).uint64(message.value); } return writer; @@ -488,9 +514,9 @@ export const UInt64Value = { return message; }, fromJSON(object: any): UInt64Value { - const obj = createBaseUInt64Value(); - if (isSet(object.value)) obj.value = BigInt(object.value.toString()); - return obj; + return { + value: isSet(object.value) ? BigInt(object.value.toString()) : BigInt(0) + }; }, toJSON(message: UInt64Value): JsonSafe<UInt64Value> { const obj: any = {}; @@ -499,9 +525,7 @@ export const UInt64Value = { }, fromPartial(object: DeepPartial<UInt64Value>): UInt64Value { const message = createBaseUInt64Value(); - if (object.value !== undefined && object.value !== null) { - message.value = BigInt(object.value.toString()); - } + message.value = object.value !== undefined && object.value !== null ? BigInt(object.value.toString()) : BigInt(0); return message; }, fromSDK(object: UInt64ValueSDKType): UInt64Value { @@ -555,7 +579,7 @@ function createBaseInt32Value(): Int32Value { export const Int32Value = { typeUrl: "/google.protobuf.Int32Value", encode(message: Int32Value, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.value !== undefined) { + if (message.value !== 0) { writer.uint32(8).int32(message.value); } return writer; @@ -578,9 +602,9 @@ export const Int32Value = { return message; }, fromJSON(object: any): Int32Value { - const obj = createBaseInt32Value(); - if (isSet(object.value)) obj.value = Number(object.value); - return obj; + return { + value: isSet(object.value) ? Number(object.value) : 0 + }; }, toJSON(message: Int32Value): JsonSafe<Int32Value> { const obj: any = {}; @@ -643,7 +667,7 @@ function createBaseUInt32Value(): UInt32Value { export const UInt32Value = { typeUrl: "/google.protobuf.UInt32Value", encode(message: UInt32Value, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.value !== undefined) { + if (message.value !== 0) { writer.uint32(8).uint32(message.value); } return writer; @@ -666,9 +690,9 @@ export const UInt32Value = { return message; }, fromJSON(object: any): UInt32Value { - const obj = createBaseUInt32Value(); - if (isSet(object.value)) obj.value = Number(object.value); - return obj; + return { + value: isSet(object.value) ? Number(object.value) : 0 + }; }, toJSON(message: UInt32Value): JsonSafe<UInt32Value> { const obj: any = {}; @@ -731,7 +755,7 @@ function createBaseBoolValue(): BoolValue { export const BoolValue = { typeUrl: "/google.protobuf.BoolValue", encode(message: BoolValue, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.value !== undefined) { + if (message.value === true) { writer.uint32(8).bool(message.value); } return writer; @@ -754,9 +778,9 @@ export const BoolValue = { return message; }, fromJSON(object: any): BoolValue { - const obj = createBaseBoolValue(); - if (isSet(object.value)) obj.value = Boolean(object.value); - return obj; + return { + value: isSet(object.value) ? Boolean(object.value) : false + }; }, toJSON(message: BoolValue): JsonSafe<BoolValue> { const obj: any = {}; @@ -819,7 +843,7 @@ function createBaseStringValue(): StringValue { export const StringValue = { typeUrl: "/google.protobuf.StringValue", encode(message: StringValue, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.value !== undefined) { + if (message.value !== "") { writer.uint32(10).string(message.value); } return writer; @@ -842,9 +866,9 @@ export const StringValue = { return message; }, fromJSON(object: any): StringValue { - const obj = createBaseStringValue(); - if (isSet(object.value)) obj.value = String(object.value); - return obj; + return { + value: isSet(object.value) ? String(object.value) : "" + }; }, toJSON(message: StringValue): JsonSafe<StringValue> { const obj: any = {}; @@ -930,9 +954,9 @@ export const BytesValue = { return message; }, fromJSON(object: any): BytesValue { - const obj = createBaseBytesValue(); - if (isSet(object.value)) obj.value = bytesFromBase64(object.value); - return obj; + return { + value: isSet(object.value) ? bytesFromBase64(object.value) : new Uint8Array() + }; }, toJSON(message: BytesValue): JsonSafe<BytesValue> { const obj: any = {}; diff --git a/__fixtures__/v-next/outputv4/google/rpc/code.ts b/__fixtures__/v-next/outputv4/google/rpc/code.ts index 760beecfc3..569c06a0e2 100644 --- a/__fixtures__/v-next/outputv4/google/rpc/code.ts +++ b/__fixtures__/v-next/outputv4/google/rpc/code.ts @@ -1,3 +1,4 @@ +import { ComputedRef } from "vue"; export const protobufPackage = "google.rpc"; /** * The canonical error codes for gRPC APIs. diff --git a/__fixtures__/v-next/outputv4/google/rpc/context/attribute_context.ts b/__fixtures__/v-next/outputv4/google/rpc/context/attribute_context.ts index 8e5084d68c..abbaf1348d 100644 --- a/__fixtures__/v-next/outputv4/google/rpc/context/attribute_context.ts +++ b/__fixtures__/v-next/outputv4/google/rpc/context/attribute_context.ts @@ -1,10 +1,11 @@ -import { Struct, StructSDKType } from "../../protobuf/struct.js"; -import { Timestamp, TimestampSDKType } from "../../protobuf/timestamp.js"; -import { Duration, DurationSDKType } from "../../protobuf/duration.js"; -import { Any, AnySDKType } from "../../protobuf/any.js"; -import { BinaryReader, BinaryWriter } from "../../../binary.js"; -import { isSet, DeepPartial, isObject, toTimestamp, fromTimestamp } from "../../../helpers.js"; -import { JsonSafe } from "../../../json-safe.js"; +import { Struct, StructSDKType } from "../../protobuf/struct"; +import { Timestamp, TimestampSDKType } from "../../protobuf/timestamp"; +import { Duration, DurationSDKType } from "../../protobuf/duration"; +import { Any, AnySDKType } from "../../protobuf/any"; +import { BinaryReader, BinaryWriter } from "../../../binary"; +import { isSet, DeepPartial, isObject, toTimestamp, fromTimestamp } from "../../../helpers"; +import { JsonSafe } from "../../../json-safe"; +import { ComputedRef } from "vue"; export const protobufPackage = "google.rpc.context"; /** * This message defines the standard attribute vocabulary for Google APIs. @@ -59,6 +60,16 @@ export interface AttributeContext { /** Supports extensions for advanced use cases, such as logs and metrics. */ extensions: Any[]; } +export interface ReactiveAttributeContext { + origin?: ComputedRef<AttributeContext_Peer>; + source?: ComputedRef<AttributeContext_Peer>; + destination?: ComputedRef<AttributeContext_Peer>; + request?: ComputedRef<AttributeContext_Request>; + response?: ComputedRef<AttributeContext_Response>; + resource?: ComputedRef<AttributeContext_Resource>; + api?: ComputedRef<AttributeContext_Api>; + extensions: ComputedRef<Any[]>; +} export interface AttributeContextProtoMsg { typeUrl: "/google.rpc.context.AttributeContext"; value: Uint8Array; @@ -96,6 +107,10 @@ export interface AttributeContext_Peer_LabelsEntry { key: string; value: string; } +export interface ReactiveAttributeContext_Peer_LabelsEntry { + key: ComputedRef<string>; + value: ComputedRef<string>; +} export interface AttributeContext_Peer_LabelsEntryProtoMsg { typeUrl: string; value: Uint8Array; @@ -132,6 +147,15 @@ export interface AttributeContext_Peer { */ regionCode: string; } +export interface ReactiveAttributeContext_Peer { + ip: ComputedRef<string>; + port: ComputedRef<bigint>; + labels: ComputedRef<{ + [key: string]: string; + }>; + principal: ComputedRef<string>; + regionCode: ComputedRef<string>; +} export interface AttributeContext_PeerProtoMsg { typeUrl: "/google.rpc.context.Peer"; value: Uint8Array; @@ -180,6 +204,12 @@ export interface AttributeContext_Api { */ version: string; } +export interface ReactiveAttributeContext_Api { + service: ComputedRef<string>; + operation: ComputedRef<string>; + protocol: ComputedRef<string>; + version: ComputedRef<string>; +} export interface AttributeContext_ApiProtoMsg { typeUrl: "/google.rpc.context.Api"; value: Uint8Array; @@ -262,6 +292,13 @@ export interface AttributeContext_Auth { */ accessLevels: string[]; } +export interface ReactiveAttributeContext_Auth { + principal: ComputedRef<string>; + audiences: ComputedRef<string[]>; + presenter: ComputedRef<string>; + claims?: ComputedRef<Struct>; + accessLevels: ComputedRef<string[]>; +} export interface AttributeContext_AuthProtoMsg { typeUrl: "/google.rpc.context.Auth"; value: Uint8Array; @@ -282,6 +319,10 @@ export interface AttributeContext_Request_HeadersEntry { key: string; value: string; } +export interface ReactiveAttributeContext_Request_HeadersEntry { + key: ComputedRef<string>; + value: ComputedRef<string>; +} export interface AttributeContext_Request_HeadersEntryProtoMsg { typeUrl: string; value: Uint8Array; @@ -348,6 +389,22 @@ export interface AttributeContext_Request { */ auth?: AttributeContext_Auth; } +export interface ReactiveAttributeContext_Request { + id: ComputedRef<string>; + method: ComputedRef<string>; + headers: ComputedRef<{ + [key: string]: string; + }>; + path: ComputedRef<string>; + host: ComputedRef<string>; + scheme: ComputedRef<string>; + query: ComputedRef<string>; + time?: ComputedRef<Date>; + size: ComputedRef<bigint>; + protocol: ComputedRef<string>; + reason: ComputedRef<string>; + auth?: ComputedRef<AttributeContext_Auth>; +} export interface AttributeContext_RequestProtoMsg { typeUrl: "/google.rpc.context.Request"; value: Uint8Array; @@ -377,6 +434,10 @@ export interface AttributeContext_Response_HeadersEntry { key: string; value: string; } +export interface ReactiveAttributeContext_Response_HeadersEntry { + key: ComputedRef<string>; + value: ComputedRef<string>; +} export interface AttributeContext_Response_HeadersEntryProtoMsg { typeUrl: string; value: Uint8Array; @@ -415,6 +476,15 @@ export interface AttributeContext_Response { */ backendLatency?: Duration; } +export interface ReactiveAttributeContext_Response { + code: ComputedRef<bigint>; + size: ComputedRef<bigint>; + headers: ComputedRef<{ + [key: string]: string; + }>; + time?: ComputedRef<Date>; + backendLatency?: ComputedRef<Duration>; +} export interface AttributeContext_ResponseProtoMsg { typeUrl: "/google.rpc.context.Response"; value: Uint8Array; @@ -436,6 +506,10 @@ export interface AttributeContext_Resource_LabelsEntry { key: string; value: string; } +export interface ReactiveAttributeContext_Resource_LabelsEntry { + key: ComputedRef<string>; + value: ComputedRef<string>; +} export interface AttributeContext_Resource_LabelsEntryProtoMsg { typeUrl: string; value: Uint8Array; @@ -448,6 +522,10 @@ export interface AttributeContext_Resource_AnnotationsEntry { key: string; value: string; } +export interface ReactiveAttributeContext_Resource_AnnotationsEntry { + key: ComputedRef<string>; + value: ComputedRef<string>; +} export interface AttributeContext_Resource_AnnotationsEntryProtoMsg { typeUrl: string; value: Uint8Array; @@ -551,6 +629,24 @@ export interface AttributeContext_Resource { */ location: string; } +export interface ReactiveAttributeContext_Resource { + service: ComputedRef<string>; + name: ComputedRef<string>; + type: ComputedRef<string>; + labels: ComputedRef<{ + [key: string]: string; + }>; + uid: ComputedRef<string>; + annotations: ComputedRef<{ + [key: string]: string; + }>; + displayName: ComputedRef<string>; + createTime?: ComputedRef<Date>; + updateTime?: ComputedRef<Date>; + deleteTime?: ComputedRef<Date>; + etag: ComputedRef<string>; + location: ComputedRef<string>; +} export interface AttributeContext_ResourceProtoMsg { typeUrl: "/google.rpc.context.Resource"; value: Uint8Array; @@ -658,16 +754,16 @@ export const AttributeContext = { return message; }, fromJSON(object: any): AttributeContext { - const obj = createBaseAttributeContext(); - if (isSet(object.origin)) obj.origin = AttributeContext_Peer.fromJSON(object.origin); - if (isSet(object.source)) obj.source = AttributeContext_Peer.fromJSON(object.source); - if (isSet(object.destination)) obj.destination = AttributeContext_Peer.fromJSON(object.destination); - if (isSet(object.request)) obj.request = AttributeContext_Request.fromJSON(object.request); - if (isSet(object.response)) obj.response = AttributeContext_Response.fromJSON(object.response); - if (isSet(object.resource)) obj.resource = AttributeContext_Resource.fromJSON(object.resource); - if (isSet(object.api)) obj.api = AttributeContext_Api.fromJSON(object.api); - if (Array.isArray(object?.extensions)) obj.extensions = object.extensions.map((e: any) => Any.fromJSON(e)); - return obj; + return { + origin: isSet(object.origin) ? AttributeContext_Peer.fromJSON(object.origin) : undefined, + source: isSet(object.source) ? AttributeContext_Peer.fromJSON(object.source) : undefined, + destination: isSet(object.destination) ? AttributeContext_Peer.fromJSON(object.destination) : undefined, + request: isSet(object.request) ? AttributeContext_Request.fromJSON(object.request) : undefined, + response: isSet(object.response) ? AttributeContext_Response.fromJSON(object.response) : undefined, + resource: isSet(object.resource) ? AttributeContext_Resource.fromJSON(object.resource) : undefined, + api: isSet(object.api) ? AttributeContext_Api.fromJSON(object.api) : undefined, + extensions: Array.isArray(object?.extensions) ? object.extensions.map((e: any) => Any.fromJSON(e)) : [] + }; }, toJSON(message: AttributeContext): JsonSafe<AttributeContext> { const obj: any = {}; @@ -687,27 +783,13 @@ export const AttributeContext = { }, fromPartial(object: DeepPartial<AttributeContext>): AttributeContext { const message = createBaseAttributeContext(); - if (object.origin !== undefined && object.origin !== null) { - message.origin = AttributeContext_Peer.fromPartial(object.origin); - } - if (object.source !== undefined && object.source !== null) { - message.source = AttributeContext_Peer.fromPartial(object.source); - } - if (object.destination !== undefined && object.destination !== null) { - message.destination = AttributeContext_Peer.fromPartial(object.destination); - } - if (object.request !== undefined && object.request !== null) { - message.request = AttributeContext_Request.fromPartial(object.request); - } - if (object.response !== undefined && object.response !== null) { - message.response = AttributeContext_Response.fromPartial(object.response); - } - if (object.resource !== undefined && object.resource !== null) { - message.resource = AttributeContext_Resource.fromPartial(object.resource); - } - if (object.api !== undefined && object.api !== null) { - message.api = AttributeContext_Api.fromPartial(object.api); - } + message.origin = object.origin !== undefined && object.origin !== null ? AttributeContext_Peer.fromPartial(object.origin) : undefined; + message.source = object.source !== undefined && object.source !== null ? AttributeContext_Peer.fromPartial(object.source) : undefined; + message.destination = object.destination !== undefined && object.destination !== null ? AttributeContext_Peer.fromPartial(object.destination) : undefined; + message.request = object.request !== undefined && object.request !== null ? AttributeContext_Request.fromPartial(object.request) : undefined; + message.response = object.response !== undefined && object.response !== null ? AttributeContext_Response.fromPartial(object.response) : undefined; + message.resource = object.resource !== undefined && object.resource !== null ? AttributeContext_Resource.fromPartial(object.resource) : undefined; + message.api = object.api !== undefined && object.api !== null ? AttributeContext_Api.fromPartial(object.api) : undefined; message.extensions = object.extensions?.map(e => Any.fromPartial(e)) || []; return message; }, @@ -817,10 +899,10 @@ function createBaseAttributeContext_Peer_LabelsEntry(): AttributeContext_Peer_La } export const AttributeContext_Peer_LabelsEntry = { encode(message: AttributeContext_Peer_LabelsEntry, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.key !== undefined) { + if (message.key !== "") { writer.uint32(10).string(message.key); } - if (message.value !== undefined) { + if (message.value !== "") { writer.uint32(18).string(message.value); } return writer; @@ -846,10 +928,10 @@ export const AttributeContext_Peer_LabelsEntry = { return message; }, fromJSON(object: any): AttributeContext_Peer_LabelsEntry { - const obj = createBaseAttributeContext_Peer_LabelsEntry(); - if (isSet(object.key)) obj.key = String(object.key); - if (isSet(object.value)) obj.value = String(object.value); - return obj; + return { + key: isSet(object.key) ? String(object.key) : "", + value: isSet(object.value) ? String(object.value) : "" + }; }, toJSON(message: AttributeContext_Peer_LabelsEntry): JsonSafe<AttributeContext_Peer_LabelsEntry> { const obj: any = {}; @@ -919,10 +1001,10 @@ function createBaseAttributeContext_Peer(): AttributeContext_Peer { export const AttributeContext_Peer = { typeUrl: "/google.rpc.context.Peer", encode(message: AttributeContext_Peer, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.ip !== undefined) { + if (message.ip !== "") { writer.uint32(10).string(message.ip); } - if (message.port !== undefined) { + if (message.port !== BigInt(0)) { writer.uint32(16).int64(message.port); } Object.entries(message.labels).forEach(([key, value]) => { @@ -931,10 +1013,10 @@ export const AttributeContext_Peer = { value }, writer.uint32(50).fork()).ldelim(); }); - if (message.principal !== undefined) { + if (message.principal !== "") { writer.uint32(58).string(message.principal); } - if (message.regionCode !== undefined) { + if (message.regionCode !== "") { writer.uint32(66).string(message.regionCode); } return writer; @@ -972,18 +1054,18 @@ export const AttributeContext_Peer = { return message; }, fromJSON(object: any): AttributeContext_Peer { - const obj = createBaseAttributeContext_Peer(); - if (isSet(object.ip)) obj.ip = String(object.ip); - if (isSet(object.port)) obj.port = BigInt(object.port.toString()); - 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.principal)) obj.principal = String(object.principal); - if (isSet(object.regionCode)) obj.regionCode = String(object.regionCode); - return obj; + return { + ip: isSet(object.ip) ? String(object.ip) : "", + port: isSet(object.port) ? BigInt(object.port.toString()) : BigInt(0), + labels: isObject(object.labels) ? Object.entries(object.labels).reduce<{ + [key: string]: string; + }>((acc, [key, value]) => { + acc[key] = String(value); + return acc; + }, {}) : {}, + principal: isSet(object.principal) ? String(object.principal) : "", + regionCode: isSet(object.regionCode) ? String(object.regionCode) : "" + }; }, toJSON(message: AttributeContext_Peer): JsonSafe<AttributeContext_Peer> { const obj: any = {}; @@ -1002,9 +1084,7 @@ export const AttributeContext_Peer = { fromPartial(object: DeepPartial<AttributeContext_Peer>): AttributeContext_Peer { const message = createBaseAttributeContext_Peer(); message.ip = object.ip ?? ""; - if (object.port !== undefined && object.port !== null) { - message.port = BigInt(object.port.toString()); - } + message.port = object.port !== undefined && object.port !== null ? BigInt(object.port.toString()) : BigInt(0); message.labels = Object.entries(object.labels ?? {}).reduce<{ [key: string]: string; }>((acc, [key, value]) => { @@ -1124,16 +1204,16 @@ function createBaseAttributeContext_Api(): AttributeContext_Api { export const AttributeContext_Api = { typeUrl: "/google.rpc.context.Api", encode(message: AttributeContext_Api, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.service !== undefined) { + if (message.service !== "") { writer.uint32(10).string(message.service); } - if (message.operation !== undefined) { + if (message.operation !== "") { writer.uint32(18).string(message.operation); } - if (message.protocol !== undefined) { + if (message.protocol !== "") { writer.uint32(26).string(message.protocol); } - if (message.version !== undefined) { + if (message.version !== "") { writer.uint32(34).string(message.version); } return writer; @@ -1165,12 +1245,12 @@ export const AttributeContext_Api = { return message; }, fromJSON(object: any): AttributeContext_Api { - const obj = createBaseAttributeContext_Api(); - if (isSet(object.service)) obj.service = String(object.service); - if (isSet(object.operation)) obj.operation = String(object.operation); - if (isSet(object.protocol)) obj.protocol = String(object.protocol); - if (isSet(object.version)) obj.version = String(object.version); - return obj; + return { + service: isSet(object.service) ? String(object.service) : "", + operation: isSet(object.operation) ? String(object.operation) : "", + protocol: isSet(object.protocol) ? String(object.protocol) : "", + version: isSet(object.version) ? String(object.version) : "" + }; }, toJSON(message: AttributeContext_Api): JsonSafe<AttributeContext_Api> { const obj: any = {}; @@ -1264,13 +1344,13 @@ function createBaseAttributeContext_Auth(): AttributeContext_Auth { export const AttributeContext_Auth = { typeUrl: "/google.rpc.context.Auth", encode(message: AttributeContext_Auth, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.principal !== undefined) { + if (message.principal !== "") { writer.uint32(10).string(message.principal); } for (const v of message.audiences) { writer.uint32(18).string(v!); } - if (message.presenter !== undefined) { + if (message.presenter !== "") { writer.uint32(26).string(message.presenter); } if (message.claims !== undefined) { @@ -1311,13 +1391,13 @@ export const AttributeContext_Auth = { return message; }, fromJSON(object: any): AttributeContext_Auth { - const obj = createBaseAttributeContext_Auth(); - if (isSet(object.principal)) obj.principal = String(object.principal); - if (Array.isArray(object?.audiences)) obj.audiences = object.audiences.map((e: any) => String(e)); - if (isSet(object.presenter)) obj.presenter = String(object.presenter); - if (isSet(object.claims)) obj.claims = Struct.fromJSON(object.claims); - if (Array.isArray(object?.accessLevels)) obj.accessLevels = object.accessLevels.map((e: any) => String(e)); - return obj; + return { + principal: isSet(object.principal) ? String(object.principal) : "", + audiences: Array.isArray(object?.audiences) ? object.audiences.map((e: any) => String(e)) : [], + presenter: isSet(object.presenter) ? String(object.presenter) : "", + claims: isSet(object.claims) ? Struct.fromJSON(object.claims) : undefined, + accessLevels: Array.isArray(object?.accessLevels) ? object.accessLevels.map((e: any) => String(e)) : [] + }; }, toJSON(message: AttributeContext_Auth): JsonSafe<AttributeContext_Auth> { const obj: any = {}; @@ -1341,9 +1421,7 @@ export const AttributeContext_Auth = { message.principal = object.principal ?? ""; message.audiences = object.audiences?.map(e => e) || []; message.presenter = object.presenter ?? ""; - if (object.claims !== undefined && object.claims !== null) { - message.claims = Struct.fromPartial(object.claims); - } + message.claims = object.claims !== undefined && object.claims !== null ? Struct.fromPartial(object.claims) : undefined; message.accessLevels = object.accessLevels?.map(e => e) || []; return message; }, @@ -1438,10 +1516,10 @@ function createBaseAttributeContext_Request_HeadersEntry(): AttributeContext_Req } export const AttributeContext_Request_HeadersEntry = { encode(message: AttributeContext_Request_HeadersEntry, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.key !== undefined) { + if (message.key !== "") { writer.uint32(10).string(message.key); } - if (message.value !== undefined) { + if (message.value !== "") { writer.uint32(18).string(message.value); } return writer; @@ -1467,10 +1545,10 @@ export const AttributeContext_Request_HeadersEntry = { return message; }, fromJSON(object: any): AttributeContext_Request_HeadersEntry { - const obj = createBaseAttributeContext_Request_HeadersEntry(); - if (isSet(object.key)) obj.key = String(object.key); - if (isSet(object.value)) obj.value = String(object.value); - return obj; + return { + key: isSet(object.key) ? String(object.key) : "", + value: isSet(object.value) ? String(object.value) : "" + }; }, toJSON(message: AttributeContext_Request_HeadersEntry): JsonSafe<AttributeContext_Request_HeadersEntry> { const obj: any = {}; @@ -1547,10 +1625,10 @@ function createBaseAttributeContext_Request(): AttributeContext_Request { export const AttributeContext_Request = { typeUrl: "/google.rpc.context.Request", encode(message: AttributeContext_Request, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.id !== undefined) { + if (message.id !== "") { writer.uint32(10).string(message.id); } - if (message.method !== undefined) { + if (message.method !== "") { writer.uint32(18).string(message.method); } Object.entries(message.headers).forEach(([key, value]) => { @@ -1559,28 +1637,28 @@ export const AttributeContext_Request = { value }, writer.uint32(26).fork()).ldelim(); }); - if (message.path !== undefined) { + if (message.path !== "") { writer.uint32(34).string(message.path); } - if (message.host !== undefined) { + if (message.host !== "") { writer.uint32(42).string(message.host); } - if (message.scheme !== undefined) { + if (message.scheme !== "") { writer.uint32(50).string(message.scheme); } - if (message.query !== undefined) { + if (message.query !== "") { writer.uint32(58).string(message.query); } if (message.time !== undefined) { Timestamp.encode(toTimestamp(message.time), writer.uint32(74).fork()).ldelim(); } - if (message.size !== undefined) { + if (message.size !== BigInt(0)) { writer.uint32(80).int64(message.size); } - if (message.protocol !== undefined) { + if (message.protocol !== "") { writer.uint32(90).string(message.protocol); } - if (message.reason !== undefined) { + if (message.reason !== "") { writer.uint32(98).string(message.reason); } if (message.auth !== undefined) { @@ -1642,25 +1720,25 @@ export const AttributeContext_Request = { return message; }, fromJSON(object: any): AttributeContext_Request { - const obj = createBaseAttributeContext_Request(); - if (isSet(object.id)) obj.id = String(object.id); - if (isSet(object.method)) obj.method = String(object.method); - if (isObject(object.headers)) obj.headers = Object.entries(object.headers).reduce<{ - [key: string]: string; - }>((acc, [key, value]) => { - acc[key] = String(value); - return acc; - }, {}); - if (isSet(object.path)) obj.path = String(object.path); - if (isSet(object.host)) obj.host = String(object.host); - if (isSet(object.scheme)) obj.scheme = String(object.scheme); - if (isSet(object.query)) obj.query = String(object.query); - if (isSet(object.time)) obj.time = new Date(object.time); - if (isSet(object.size)) obj.size = BigInt(object.size.toString()); - if (isSet(object.protocol)) obj.protocol = String(object.protocol); - if (isSet(object.reason)) obj.reason = String(object.reason); - if (isSet(object.auth)) obj.auth = AttributeContext_Auth.fromJSON(object.auth); - return obj; + return { + id: isSet(object.id) ? String(object.id) : "", + method: isSet(object.method) ? String(object.method) : "", + headers: isObject(object.headers) ? Object.entries(object.headers).reduce<{ + [key: string]: string; + }>((acc, [key, value]) => { + acc[key] = String(value); + return acc; + }, {}) : {}, + path: isSet(object.path) ? String(object.path) : "", + host: isSet(object.host) ? String(object.host) : "", + scheme: isSet(object.scheme) ? String(object.scheme) : "", + query: isSet(object.query) ? String(object.query) : "", + time: isSet(object.time) ? new Date(object.time) : undefined, + size: isSet(object.size) ? BigInt(object.size.toString()) : BigInt(0), + protocol: isSet(object.protocol) ? String(object.protocol) : "", + reason: isSet(object.reason) ? String(object.reason) : "", + auth: isSet(object.auth) ? AttributeContext_Auth.fromJSON(object.auth) : undefined + }; }, toJSON(message: AttributeContext_Request): JsonSafe<AttributeContext_Request> { const obj: any = {}; @@ -1700,14 +1778,10 @@ export const AttributeContext_Request = { message.scheme = object.scheme ?? ""; message.query = object.query ?? ""; message.time = object.time ?? undefined; - if (object.size !== undefined && object.size !== null) { - message.size = BigInt(object.size.toString()); - } + message.size = object.size !== undefined && object.size !== null ? BigInt(object.size.toString()) : BigInt(0); message.protocol = object.protocol ?? ""; message.reason = object.reason ?? ""; - if (object.auth !== undefined && object.auth !== null) { - message.auth = AttributeContext_Auth.fromPartial(object.auth); - } + message.auth = object.auth !== undefined && object.auth !== null ? AttributeContext_Auth.fromPartial(object.auth) : undefined; return message; }, fromSDK(object: AttributeContext_RequestSDKType): AttributeContext_Request { @@ -1863,10 +1937,10 @@ function createBaseAttributeContext_Response_HeadersEntry(): AttributeContext_Re } export const AttributeContext_Response_HeadersEntry = { encode(message: AttributeContext_Response_HeadersEntry, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.key !== undefined) { + if (message.key !== "") { writer.uint32(10).string(message.key); } - if (message.value !== undefined) { + if (message.value !== "") { writer.uint32(18).string(message.value); } return writer; @@ -1892,10 +1966,10 @@ export const AttributeContext_Response_HeadersEntry = { return message; }, fromJSON(object: any): AttributeContext_Response_HeadersEntry { - const obj = createBaseAttributeContext_Response_HeadersEntry(); - if (isSet(object.key)) obj.key = String(object.key); - if (isSet(object.value)) obj.value = String(object.value); - return obj; + return { + key: isSet(object.key) ? String(object.key) : "", + value: isSet(object.value) ? String(object.value) : "" + }; }, toJSON(message: AttributeContext_Response_HeadersEntry): JsonSafe<AttributeContext_Response_HeadersEntry> { const obj: any = {}; @@ -1965,10 +2039,10 @@ function createBaseAttributeContext_Response(): AttributeContext_Response { export const AttributeContext_Response = { typeUrl: "/google.rpc.context.Response", encode(message: AttributeContext_Response, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.code !== undefined) { + if (message.code !== BigInt(0)) { writer.uint32(8).int64(message.code); } - if (message.size !== undefined) { + if (message.size !== BigInt(0)) { writer.uint32(16).int64(message.size); } Object.entries(message.headers).forEach(([key, value]) => { @@ -2018,18 +2092,18 @@ export const AttributeContext_Response = { return message; }, fromJSON(object: any): AttributeContext_Response { - const obj = createBaseAttributeContext_Response(); - if (isSet(object.code)) obj.code = BigInt(object.code.toString()); - if (isSet(object.size)) obj.size = BigInt(object.size.toString()); - if (isObject(object.headers)) obj.headers = Object.entries(object.headers).reduce<{ - [key: string]: string; - }>((acc, [key, value]) => { - acc[key] = String(value); - return acc; - }, {}); - if (isSet(object.time)) obj.time = new Date(object.time); - if (isSet(object.backendLatency)) obj.backendLatency = Duration.fromJSON(object.backendLatency); - return obj; + return { + code: isSet(object.code) ? BigInt(object.code.toString()) : BigInt(0), + size: isSet(object.size) ? BigInt(object.size.toString()) : BigInt(0), + headers: isObject(object.headers) ? Object.entries(object.headers).reduce<{ + [key: string]: string; + }>((acc, [key, value]) => { + acc[key] = String(value); + return acc; + }, {}) : {}, + time: isSet(object.time) ? new Date(object.time) : undefined, + backendLatency: isSet(object.backendLatency) ? Duration.fromJSON(object.backendLatency) : undefined + }; }, toJSON(message: AttributeContext_Response): JsonSafe<AttributeContext_Response> { const obj: any = {}; @@ -2047,12 +2121,8 @@ export const AttributeContext_Response = { }, fromPartial(object: DeepPartial<AttributeContext_Response>): AttributeContext_Response { const message = createBaseAttributeContext_Response(); - if (object.code !== undefined && object.code !== null) { - message.code = BigInt(object.code.toString()); - } - if (object.size !== undefined && object.size !== null) { - message.size = BigInt(object.size.toString()); - } + message.code = object.code !== undefined && object.code !== null ? BigInt(object.code.toString()) : BigInt(0); + message.size = object.size !== undefined && object.size !== null ? BigInt(object.size.toString()) : BigInt(0); message.headers = Object.entries(object.headers ?? {}).reduce<{ [key: string]: string; }>((acc, [key, value]) => { @@ -2062,9 +2132,7 @@ export const AttributeContext_Response = { return acc; }, {}); message.time = object.time ?? undefined; - if (object.backendLatency !== undefined && object.backendLatency !== null) { - message.backendLatency = Duration.fromPartial(object.backendLatency); - } + message.backendLatency = object.backendLatency !== undefined && object.backendLatency !== null ? Duration.fromPartial(object.backendLatency) : undefined; return message; }, fromSDK(object: AttributeContext_ResponseSDKType): AttributeContext_Response { @@ -2171,10 +2239,10 @@ function createBaseAttributeContext_Resource_LabelsEntry(): AttributeContext_Res } export const AttributeContext_Resource_LabelsEntry = { encode(message: AttributeContext_Resource_LabelsEntry, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.key !== undefined) { + if (message.key !== "") { writer.uint32(10).string(message.key); } - if (message.value !== undefined) { + if (message.value !== "") { writer.uint32(18).string(message.value); } return writer; @@ -2200,10 +2268,10 @@ export const AttributeContext_Resource_LabelsEntry = { return message; }, fromJSON(object: any): AttributeContext_Resource_LabelsEntry { - const obj = createBaseAttributeContext_Resource_LabelsEntry(); - if (isSet(object.key)) obj.key = String(object.key); - if (isSet(object.value)) obj.value = String(object.value); - return obj; + return { + key: isSet(object.key) ? String(object.key) : "", + value: isSet(object.value) ? String(object.value) : "" + }; }, toJSON(message: AttributeContext_Resource_LabelsEntry): JsonSafe<AttributeContext_Resource_LabelsEntry> { const obj: any = {}; @@ -2269,10 +2337,10 @@ function createBaseAttributeContext_Resource_AnnotationsEntry(): AttributeContex } export const AttributeContext_Resource_AnnotationsEntry = { encode(message: AttributeContext_Resource_AnnotationsEntry, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.key !== undefined) { + if (message.key !== "") { writer.uint32(10).string(message.key); } - if (message.value !== undefined) { + if (message.value !== "") { writer.uint32(18).string(message.value); } return writer; @@ -2298,10 +2366,10 @@ export const AttributeContext_Resource_AnnotationsEntry = { return message; }, fromJSON(object: any): AttributeContext_Resource_AnnotationsEntry { - const obj = createBaseAttributeContext_Resource_AnnotationsEntry(); - if (isSet(object.key)) obj.key = String(object.key); - if (isSet(object.value)) obj.value = String(object.value); - return obj; + return { + key: isSet(object.key) ? String(object.key) : "", + value: isSet(object.value) ? String(object.value) : "" + }; }, toJSON(message: AttributeContext_Resource_AnnotationsEntry): JsonSafe<AttributeContext_Resource_AnnotationsEntry> { const obj: any = {}; @@ -2378,13 +2446,13 @@ function createBaseAttributeContext_Resource(): AttributeContext_Resource { export const AttributeContext_Resource = { typeUrl: "/google.rpc.context.Resource", encode(message: AttributeContext_Resource, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.service !== undefined) { + if (message.service !== "") { writer.uint32(10).string(message.service); } - if (message.name !== undefined) { + if (message.name !== "") { writer.uint32(18).string(message.name); } - if (message.type !== undefined) { + if (message.type !== "") { writer.uint32(26).string(message.type); } Object.entries(message.labels).forEach(([key, value]) => { @@ -2393,7 +2461,7 @@ export const AttributeContext_Resource = { value }, writer.uint32(34).fork()).ldelim(); }); - if (message.uid !== undefined) { + if (message.uid !== "") { writer.uint32(42).string(message.uid); } Object.entries(message.annotations).forEach(([key, value]) => { @@ -2402,7 +2470,7 @@ export const AttributeContext_Resource = { value }, writer.uint32(50).fork()).ldelim(); }); - if (message.displayName !== undefined) { + if (message.displayName !== "") { writer.uint32(58).string(message.displayName); } if (message.createTime !== undefined) { @@ -2414,10 +2482,10 @@ export const AttributeContext_Resource = { if (message.deleteTime !== undefined) { Timestamp.encode(toTimestamp(message.deleteTime), writer.uint32(82).fork()).ldelim(); } - if (message.etag !== undefined) { + if (message.etag !== "") { writer.uint32(90).string(message.etag); } - if (message.location !== undefined) { + if (message.location !== "") { writer.uint32(98).string(message.location); } return writer; @@ -2479,30 +2547,30 @@ export const AttributeContext_Resource = { return message; }, fromJSON(object: any): AttributeContext_Resource { - const obj = createBaseAttributeContext_Resource(); - if (isSet(object.service)) obj.service = String(object.service); - if (isSet(object.name)) obj.name = String(object.name); - 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; - }, {}); - if (isSet(object.uid)) obj.uid = String(object.uid); - if (isObject(object.annotations)) obj.annotations = Object.entries(object.annotations).reduce<{ - [key: string]: string; - }>((acc, [key, value]) => { - acc[key] = String(value); - return acc; - }, {}); - if (isSet(object.displayName)) obj.displayName = String(object.displayName); - if (isSet(object.createTime)) obj.createTime = new Date(object.createTime); - if (isSet(object.updateTime)) obj.updateTime = new Date(object.updateTime); - if (isSet(object.deleteTime)) obj.deleteTime = new Date(object.deleteTime); - if (isSet(object.etag)) obj.etag = String(object.etag); - if (isSet(object.location)) obj.location = String(object.location); - return obj; + return { + service: isSet(object.service) ? String(object.service) : "", + name: isSet(object.name) ? String(object.name) : "", + 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; + }, {}) : {}, + uid: isSet(object.uid) ? String(object.uid) : "", + annotations: isObject(object.annotations) ? Object.entries(object.annotations).reduce<{ + [key: string]: string; + }>((acc, [key, value]) => { + acc[key] = String(value); + return acc; + }, {}) : {}, + displayName: isSet(object.displayName) ? String(object.displayName) : "", + createTime: isSet(object.createTime) ? new Date(object.createTime) : undefined, + updateTime: isSet(object.updateTime) ? new Date(object.updateTime) : undefined, + deleteTime: isSet(object.deleteTime) ? new Date(object.deleteTime) : undefined, + etag: isSet(object.etag) ? String(object.etag) : "", + location: isSet(object.location) ? String(object.location) : "" + }; }, toJSON(message: AttributeContext_Resource): JsonSafe<AttributeContext_Resource> { const obj: any = {}; diff --git a/__fixtures__/v-next/outputv4/google/rpc/error_details.ts b/__fixtures__/v-next/outputv4/google/rpc/error_details.ts index b5a8a5fb05..56f7daf6fc 100644 --- a/__fixtures__/v-next/outputv4/google/rpc/error_details.ts +++ b/__fixtures__/v-next/outputv4/google/rpc/error_details.ts @@ -1,7 +1,8 @@ -import { Duration, DurationSDKType } from "../protobuf/duration.js"; -import { BinaryReader, BinaryWriter } from "../../binary.js"; -import { isSet, DeepPartial, isObject } from "../../helpers.js"; -import { JsonSafe } from "../../json-safe.js"; +import { Duration, DurationSDKType } from "../protobuf/duration"; +import { BinaryReader, BinaryWriter } from "../../binary"; +import { isSet, DeepPartial, isObject } from "../../helpers"; +import { JsonSafe } from "../../json-safe"; +import { ComputedRef } from "vue"; export const protobufPackage = "google.rpc"; /** * Describes when the clients can retry a failed request. Clients could ignore @@ -22,6 +23,9 @@ export interface RetryInfo { /** Clients should wait at least this long between retrying the same request. */ retryDelay?: Duration; } +export interface ReactiveRetryInfo { + retryDelay?: ComputedRef<Duration>; +} export interface RetryInfoProtoMsg { typeUrl: "/google.rpc.RetryInfo"; value: Uint8Array; @@ -51,6 +55,10 @@ export interface DebugInfo { /** Additional debugging information provided by the server. */ detail: string; } +export interface ReactiveDebugInfo { + stackEntries: ComputedRef<string[]>; + detail: ComputedRef<string>; +} export interface DebugInfoProtoMsg { typeUrl: "/google.rpc.DebugInfo"; value: Uint8Array; @@ -77,6 +85,9 @@ export interface QuotaFailure { /** Describes all quota violations. */ violations: QuotaFailure_Violation[]; } +export interface ReactiveQuotaFailure { + violations: ComputedRef<QuotaFailure_Violation[]>; +} export interface QuotaFailureProtoMsg { typeUrl: "/google.rpc.QuotaFailure"; value: Uint8Array; @@ -119,6 +130,10 @@ export interface QuotaFailure_Violation { */ description: string; } +export interface ReactiveQuotaFailure_Violation { + subject: ComputedRef<string>; + description: ComputedRef<string>; +} export interface QuotaFailure_ViolationProtoMsg { typeUrl: "/google.rpc.Violation"; value: Uint8Array; @@ -135,6 +150,10 @@ export interface ErrorInfo_MetadataEntry { key: string; value: string; } +export interface ReactiveErrorInfo_MetadataEntry { + key: ComputedRef<string>; + value: ComputedRef<string>; +} export interface ErrorInfo_MetadataEntryProtoMsg { typeUrl: string; value: Uint8Array; @@ -200,6 +219,13 @@ export interface ErrorInfo { [key: string]: string; }; } +export interface ReactiveErrorInfo { + reason: ComputedRef<string>; + domain: ComputedRef<string>; + metadata: ComputedRef<{ + [key: string]: string; + }>; +} export interface ErrorInfoProtoMsg { typeUrl: "/google.rpc.ErrorInfo"; value: Uint8Array; @@ -248,6 +274,9 @@ export interface PreconditionFailure { /** Describes all precondition violations. */ violations: PreconditionFailure_Violation[]; } +export interface ReactivePreconditionFailure { + violations: ComputedRef<PreconditionFailure_Violation[]>; +} export interface PreconditionFailureProtoMsg { typeUrl: "/google.rpc.PreconditionFailure"; value: Uint8Array; @@ -284,6 +313,11 @@ export interface PreconditionFailure_Violation { */ description: string; } +export interface ReactivePreconditionFailure_Violation { + type: ComputedRef<string>; + subject: ComputedRef<string>; + description: ComputedRef<string>; +} export interface PreconditionFailure_ViolationProtoMsg { typeUrl: "/google.rpc.Violation"; value: Uint8Array; @@ -302,6 +336,9 @@ export interface BadRequest { /** Describes all violations in a client request. */ fieldViolations: BadRequest_FieldViolation[]; } +export interface ReactiveBadRequest { + fieldViolations: ComputedRef<BadRequest_FieldViolation[]>; +} export interface BadRequestProtoMsg { typeUrl: "/google.rpc.BadRequest"; value: Uint8Array; @@ -324,6 +361,10 @@ export interface BadRequest_FieldViolation { /** A description of why the request element is bad. */ description: string; } +export interface ReactiveBadRequest_FieldViolation { + field: ComputedRef<string>; + description: ComputedRef<string>; +} export interface BadRequest_FieldViolationProtoMsg { typeUrl: "/google.rpc.FieldViolation"; value: Uint8Array; @@ -349,6 +390,10 @@ export interface RequestInfo { */ servingData: string; } +export interface ReactiveRequestInfo { + requestId: ComputedRef<string>; + servingData: ComputedRef<string>; +} export interface RequestInfoProtoMsg { typeUrl: "/google.rpc.RequestInfo"; value: Uint8Array; @@ -388,6 +433,12 @@ export interface ResourceInfo { */ description: string; } +export interface ReactiveResourceInfo { + resourceType: ComputedRef<string>; + resourceName: ComputedRef<string>; + owner: ComputedRef<string>; + description: ComputedRef<string>; +} export interface ResourceInfoProtoMsg { typeUrl: "/google.rpc.ResourceInfo"; value: Uint8Array; @@ -410,6 +461,9 @@ export interface Help { /** URL(s) pointing to additional information on handling the current error. */ links: Help_Link[]; } +export interface ReactiveHelp { + links: ComputedRef<Help_Link[]>; +} export interface HelpProtoMsg { typeUrl: "/google.rpc.Help"; value: Uint8Array; @@ -431,6 +485,10 @@ export interface Help_Link { /** The URL of the link. */ url: string; } +export interface ReactiveHelp_Link { + description: ComputedRef<string>; + url: ComputedRef<string>; +} export interface Help_LinkProtoMsg { typeUrl: "/google.rpc.Link"; value: Uint8Array; @@ -454,6 +512,10 @@ export interface LocalizedMessage { /** The localized error message in the above locale. */ message: string; } +export interface ReactiveLocalizedMessage { + locale: ComputedRef<string>; + message: ComputedRef<string>; +} export interface LocalizedMessageProtoMsg { typeUrl: "/google.rpc.LocalizedMessage"; value: Uint8Array; @@ -497,9 +559,9 @@ export const RetryInfo = { return message; }, fromJSON(object: any): RetryInfo { - const obj = createBaseRetryInfo(); - if (isSet(object.retryDelay)) obj.retryDelay = Duration.fromJSON(object.retryDelay); - return obj; + return { + retryDelay: isSet(object.retryDelay) ? Duration.fromJSON(object.retryDelay) : undefined + }; }, toJSON(message: RetryInfo): JsonSafe<RetryInfo> { const obj: any = {}; @@ -508,9 +570,7 @@ export const RetryInfo = { }, fromPartial(object: DeepPartial<RetryInfo>): RetryInfo { const message = createBaseRetryInfo(); - if (object.retryDelay !== undefined && object.retryDelay !== null) { - message.retryDelay = Duration.fromPartial(object.retryDelay); - } + message.retryDelay = object.retryDelay !== undefined && object.retryDelay !== null ? Duration.fromPartial(object.retryDelay) : undefined; return message; }, fromSDK(object: RetryInfoSDKType): RetryInfo { @@ -568,7 +628,7 @@ export const DebugInfo = { for (const v of message.stackEntries) { writer.uint32(10).string(v!); } - if (message.detail !== undefined) { + if (message.detail !== "") { writer.uint32(18).string(message.detail); } return writer; @@ -594,10 +654,10 @@ export const DebugInfo = { return message; }, fromJSON(object: any): DebugInfo { - const obj = createBaseDebugInfo(); - if (Array.isArray(object?.stackEntries)) obj.stackEntries = object.stackEntries.map((e: any) => String(e)); - if (isSet(object.detail)) obj.detail = String(object.detail); - return obj; + return { + stackEntries: Array.isArray(object?.stackEntries) ? object.stackEntries.map((e: any) => String(e)) : [], + detail: isSet(object.detail) ? String(object.detail) : "" + }; }, toJSON(message: DebugInfo): JsonSafe<DebugInfo> { const obj: any = {}; @@ -702,9 +762,9 @@ export const QuotaFailure = { return message; }, fromJSON(object: any): QuotaFailure { - const obj = createBaseQuotaFailure(); - if (Array.isArray(object?.violations)) obj.violations = object.violations.map((e: any) => QuotaFailure_Violation.fromJSON(e)); - return obj; + return { + violations: Array.isArray(object?.violations) ? object.violations.map((e: any) => QuotaFailure_Violation.fromJSON(e)) : [] + }; }, toJSON(message: QuotaFailure): JsonSafe<QuotaFailure> { const obj: any = {}; @@ -778,10 +838,10 @@ function createBaseQuotaFailure_Violation(): QuotaFailure_Violation { export const QuotaFailure_Violation = { typeUrl: "/google.rpc.Violation", encode(message: QuotaFailure_Violation, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.subject !== undefined) { + if (message.subject !== "") { writer.uint32(10).string(message.subject); } - if (message.description !== undefined) { + if (message.description !== "") { writer.uint32(18).string(message.description); } return writer; @@ -807,10 +867,10 @@ export const QuotaFailure_Violation = { return message; }, fromJSON(object: any): QuotaFailure_Violation { - const obj = createBaseQuotaFailure_Violation(); - if (isSet(object.subject)) obj.subject = String(object.subject); - if (isSet(object.description)) obj.description = String(object.description); - return obj; + return { + subject: isSet(object.subject) ? String(object.subject) : "", + description: isSet(object.description) ? String(object.description) : "" + }; }, toJSON(message: QuotaFailure_Violation): JsonSafe<QuotaFailure_Violation> { const obj: any = {}; @@ -882,10 +942,10 @@ function createBaseErrorInfo_MetadataEntry(): ErrorInfo_MetadataEntry { } export const ErrorInfo_MetadataEntry = { encode(message: ErrorInfo_MetadataEntry, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.key !== undefined) { + if (message.key !== "") { writer.uint32(10).string(message.key); } - if (message.value !== undefined) { + if (message.value !== "") { writer.uint32(18).string(message.value); } return writer; @@ -911,10 +971,10 @@ export const ErrorInfo_MetadataEntry = { return message; }, fromJSON(object: any): ErrorInfo_MetadataEntry { - const obj = createBaseErrorInfo_MetadataEntry(); - if (isSet(object.key)) obj.key = String(object.key); - if (isSet(object.value)) obj.value = String(object.value); - return obj; + return { + key: isSet(object.key) ? String(object.key) : "", + value: isSet(object.value) ? String(object.value) : "" + }; }, toJSON(message: ErrorInfo_MetadataEntry): JsonSafe<ErrorInfo_MetadataEntry> { const obj: any = {}; @@ -982,10 +1042,10 @@ function createBaseErrorInfo(): ErrorInfo { export const ErrorInfo = { typeUrl: "/google.rpc.ErrorInfo", encode(message: ErrorInfo, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.reason !== undefined) { + if (message.reason !== "") { writer.uint32(10).string(message.reason); } - if (message.domain !== undefined) { + if (message.domain !== "") { writer.uint32(18).string(message.domain); } Object.entries(message.metadata).forEach(([key, value]) => { @@ -1023,16 +1083,16 @@ export const ErrorInfo = { return message; }, fromJSON(object: any): ErrorInfo { - const obj = createBaseErrorInfo(); - if (isSet(object.reason)) obj.reason = String(object.reason); - if (isSet(object.domain)) obj.domain = String(object.domain); - if (isObject(object.metadata)) obj.metadata = Object.entries(object.metadata).reduce<{ - [key: string]: string; - }>((acc, [key, value]) => { - acc[key] = String(value); - return acc; - }, {}); - return obj; + return { + reason: isSet(object.reason) ? String(object.reason) : "", + domain: isSet(object.domain) ? String(object.domain) : "", + metadata: isObject(object.metadata) ? Object.entries(object.metadata).reduce<{ + [key: string]: string; + }>((acc, [key, value]) => { + acc[key] = String(value); + return acc; + }, {}) : {} + }; }, toJSON(message: ErrorInfo): JsonSafe<ErrorInfo> { const obj: any = {}; @@ -1173,9 +1233,9 @@ export const PreconditionFailure = { return message; }, fromJSON(object: any): PreconditionFailure { - const obj = createBasePreconditionFailure(); - if (Array.isArray(object?.violations)) obj.violations = object.violations.map((e: any) => PreconditionFailure_Violation.fromJSON(e)); - return obj; + return { + violations: Array.isArray(object?.violations) ? object.violations.map((e: any) => PreconditionFailure_Violation.fromJSON(e)) : [] + }; }, toJSON(message: PreconditionFailure): JsonSafe<PreconditionFailure> { const obj: any = {}; @@ -1250,13 +1310,13 @@ function createBasePreconditionFailure_Violation(): PreconditionFailure_Violatio export const PreconditionFailure_Violation = { typeUrl: "/google.rpc.Violation", encode(message: PreconditionFailure_Violation, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.type !== undefined) { + if (message.type !== "") { writer.uint32(10).string(message.type); } - if (message.subject !== undefined) { + if (message.subject !== "") { writer.uint32(18).string(message.subject); } - if (message.description !== undefined) { + if (message.description !== "") { writer.uint32(26).string(message.description); } return writer; @@ -1285,11 +1345,11 @@ export const PreconditionFailure_Violation = { return message; }, fromJSON(object: any): PreconditionFailure_Violation { - const obj = createBasePreconditionFailure_Violation(); - if (isSet(object.type)) obj.type = String(object.type); - if (isSet(object.subject)) obj.subject = String(object.subject); - if (isSet(object.description)) obj.description = String(object.description); - return obj; + return { + type: isSet(object.type) ? String(object.type) : "", + subject: isSet(object.subject) ? String(object.subject) : "", + description: isSet(object.description) ? String(object.description) : "" + }; }, toJSON(message: PreconditionFailure_Violation): JsonSafe<PreconditionFailure_Violation> { const obj: any = {}; @@ -1393,9 +1453,9 @@ export const BadRequest = { return message; }, fromJSON(object: any): BadRequest { - const obj = createBaseBadRequest(); - if (Array.isArray(object?.fieldViolations)) obj.fieldViolations = object.fieldViolations.map((e: any) => BadRequest_FieldViolation.fromJSON(e)); - return obj; + return { + fieldViolations: Array.isArray(object?.fieldViolations) ? object.fieldViolations.map((e: any) => BadRequest_FieldViolation.fromJSON(e)) : [] + }; }, toJSON(message: BadRequest): JsonSafe<BadRequest> { const obj: any = {}; @@ -1469,10 +1529,10 @@ function createBaseBadRequest_FieldViolation(): BadRequest_FieldViolation { export const BadRequest_FieldViolation = { typeUrl: "/google.rpc.FieldViolation", encode(message: BadRequest_FieldViolation, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.field !== undefined) { + if (message.field !== "") { writer.uint32(10).string(message.field); } - if (message.description !== undefined) { + if (message.description !== "") { writer.uint32(18).string(message.description); } return writer; @@ -1498,10 +1558,10 @@ export const BadRequest_FieldViolation = { return message; }, fromJSON(object: any): BadRequest_FieldViolation { - const obj = createBaseBadRequest_FieldViolation(); - if (isSet(object.field)) obj.field = String(object.field); - if (isSet(object.description)) obj.description = String(object.description); - return obj; + return { + field: isSet(object.field) ? String(object.field) : "", + description: isSet(object.description) ? String(object.description) : "" + }; }, toJSON(message: BadRequest_FieldViolation): JsonSafe<BadRequest_FieldViolation> { const obj: any = {}; @@ -1574,10 +1634,10 @@ function createBaseRequestInfo(): RequestInfo { export const RequestInfo = { typeUrl: "/google.rpc.RequestInfo", encode(message: RequestInfo, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.requestId !== undefined) { + if (message.requestId !== "") { writer.uint32(10).string(message.requestId); } - if (message.servingData !== undefined) { + if (message.servingData !== "") { writer.uint32(18).string(message.servingData); } return writer; @@ -1603,10 +1663,10 @@ export const RequestInfo = { return message; }, fromJSON(object: any): RequestInfo { - const obj = createBaseRequestInfo(); - if (isSet(object.requestId)) obj.requestId = String(object.requestId); - if (isSet(object.servingData)) obj.servingData = String(object.servingData); - return obj; + return { + requestId: isSet(object.requestId) ? String(object.requestId) : "", + servingData: isSet(object.servingData) ? String(object.servingData) : "" + }; }, toJSON(message: RequestInfo): JsonSafe<RequestInfo> { const obj: any = {}; @@ -1681,16 +1741,16 @@ function createBaseResourceInfo(): ResourceInfo { export const ResourceInfo = { typeUrl: "/google.rpc.ResourceInfo", encode(message: ResourceInfo, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.resourceType !== undefined) { + if (message.resourceType !== "") { writer.uint32(10).string(message.resourceType); } - if (message.resourceName !== undefined) { + if (message.resourceName !== "") { writer.uint32(18).string(message.resourceName); } - if (message.owner !== undefined) { + if (message.owner !== "") { writer.uint32(26).string(message.owner); } - if (message.description !== undefined) { + if (message.description !== "") { writer.uint32(34).string(message.description); } return writer; @@ -1722,12 +1782,12 @@ export const ResourceInfo = { return message; }, fromJSON(object: any): ResourceInfo { - const obj = createBaseResourceInfo(); - if (isSet(object.resourceType)) obj.resourceType = String(object.resourceType); - if (isSet(object.resourceName)) obj.resourceName = String(object.resourceName); - if (isSet(object.owner)) obj.owner = String(object.owner); - if (isSet(object.description)) obj.description = String(object.description); - return obj; + return { + resourceType: isSet(object.resourceType) ? String(object.resourceType) : "", + resourceName: isSet(object.resourceName) ? String(object.resourceName) : "", + owner: isSet(object.owner) ? String(object.owner) : "", + description: isSet(object.description) ? String(object.description) : "" + }; }, toJSON(message: ResourceInfo): JsonSafe<ResourceInfo> { const obj: any = {}; @@ -1840,9 +1900,9 @@ export const Help = { return message; }, fromJSON(object: any): Help { - const obj = createBaseHelp(); - if (Array.isArray(object?.links)) obj.links = object.links.map((e: any) => Help_Link.fromJSON(e)); - return obj; + return { + links: Array.isArray(object?.links) ? object.links.map((e: any) => Help_Link.fromJSON(e)) : [] + }; }, toJSON(message: Help): JsonSafe<Help> { const obj: any = {}; @@ -1916,10 +1976,10 @@ function createBaseHelp_Link(): Help_Link { export const Help_Link = { typeUrl: "/google.rpc.Link", encode(message: Help_Link, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.description !== undefined) { + if (message.description !== "") { writer.uint32(10).string(message.description); } - if (message.url !== undefined) { + if (message.url !== "") { writer.uint32(18).string(message.url); } return writer; @@ -1945,10 +2005,10 @@ export const Help_Link = { return message; }, fromJSON(object: any): Help_Link { - const obj = createBaseHelp_Link(); - if (isSet(object.description)) obj.description = String(object.description); - if (isSet(object.url)) obj.url = String(object.url); - return obj; + return { + description: isSet(object.description) ? String(object.description) : "", + url: isSet(object.url) ? String(object.url) : "" + }; }, toJSON(message: Help_Link): JsonSafe<Help_Link> { const obj: any = {}; @@ -2021,10 +2081,10 @@ function createBaseLocalizedMessage(): LocalizedMessage { export const LocalizedMessage = { typeUrl: "/google.rpc.LocalizedMessage", encode(message: LocalizedMessage, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.locale !== undefined) { + if (message.locale !== "") { writer.uint32(10).string(message.locale); } - if (message.message !== undefined) { + if (message.message !== "") { writer.uint32(18).string(message.message); } return writer; @@ -2050,10 +2110,10 @@ export const LocalizedMessage = { return message; }, fromJSON(object: any): LocalizedMessage { - const obj = createBaseLocalizedMessage(); - if (isSet(object.locale)) obj.locale = String(object.locale); - if (isSet(object.message)) obj.message = String(object.message); - return obj; + return { + locale: isSet(object.locale) ? String(object.locale) : "", + message: isSet(object.message) ? String(object.message) : "" + }; }, toJSON(message: LocalizedMessage): JsonSafe<LocalizedMessage> { const obj: any = {}; diff --git a/__fixtures__/v-next/outputv4/google/rpc/status.ts b/__fixtures__/v-next/outputv4/google/rpc/status.ts index bf75c4ece5..1e980c825d 100644 --- a/__fixtures__/v-next/outputv4/google/rpc/status.ts +++ b/__fixtures__/v-next/outputv4/google/rpc/status.ts @@ -1,7 +1,8 @@ -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"; +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"; export const protobufPackage = "google.rpc"; /** * The `Status` type defines a logical error model that is suitable for @@ -27,6 +28,11 @@ export interface Status { */ details: Any[]; } +export interface ReactiveStatus { + code: ComputedRef<number>; + message: ComputedRef<string>; + details: ComputedRef<Any[]>; +} export interface StatusProtoMsg { typeUrl: "/google.rpc.Status"; value: Uint8Array; @@ -55,10 +61,10 @@ function createBaseStatus(): Status { export const Status = { typeUrl: "/google.rpc.Status", encode(message: Status, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.code !== undefined) { + if (message.code !== 0) { writer.uint32(8).int32(message.code); } - if (message.message !== undefined) { + if (message.message !== "") { writer.uint32(18).string(message.message); } for (const v of message.details) { @@ -90,11 +96,11 @@ export const Status = { return message; }, fromJSON(object: any): Status { - const obj = createBaseStatus(); - if (isSet(object.code)) obj.code = Number(object.code); - if (isSet(object.message)) obj.message = String(object.message); - if (Array.isArray(object?.details)) obj.details = object.details.map((e: any) => Any.fromJSON(e)); - return obj; + return { + code: isSet(object.code) ? Number(object.code) : 0, + message: isSet(object.message) ? String(object.message) : "", + details: Array.isArray(object?.details) ? object.details.map((e: any) => Any.fromJSON(e)) : [] + }; }, toJSON(message: Status): JsonSafe<Status> { const obj: any = {}; diff --git a/__fixtures__/v-next/outputv4/ibc/applications/transfer/v1/genesis.ts b/__fixtures__/v-next/outputv4/ibc/applications/transfer/v1/genesis.ts index ac8ef6f589..090c202a9f 100644 --- a/__fixtures__/v-next/outputv4/ibc/applications/transfer/v1/genesis.ts +++ b/__fixtures__/v-next/outputv4/ibc/applications/transfer/v1/genesis.ts @@ -1,7 +1,8 @@ -import { DenomTrace, DenomTraceSDKType, Params, ParamsSDKType } from "./transfer.js"; -import { BinaryReader, BinaryWriter } from "../../../../binary.js"; -import { isSet, DeepPartial } from "../../../../helpers.js"; -import { JsonSafe } from "../../../../json-safe.js"; +import { DenomTrace, DenomTraceSDKType, Params, ParamsSDKType } from "./transfer"; +import { BinaryReader, BinaryWriter } from "../../../../binary"; +import { isSet, DeepPartial } from "../../../../helpers"; +import { JsonSafe } from "../../../../json-safe"; +import { ComputedRef } from "vue"; export const protobufPackage = "ibc.applications.transfer.v1"; /** GenesisState defines the ibc-transfer genesis state */ export interface GenesisState { @@ -9,6 +10,11 @@ export interface GenesisState { denomTraces: DenomTrace[]; params: Params; } +export interface ReactiveGenesisState { + portId: ComputedRef<string>; + denomTraces: ComputedRef<DenomTrace[]>; + params: ComputedRef<Params>; +} export interface GenesisStateProtoMsg { typeUrl: "/ibc.applications.transfer.v1.GenesisState"; value: Uint8Array; @@ -29,7 +35,7 @@ function createBaseGenesisState(): GenesisState { export const GenesisState = { typeUrl: "/ibc.applications.transfer.v1.GenesisState", encode(message: GenesisState, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.portId !== undefined) { + if (message.portId !== "") { writer.uint32(10).string(message.portId); } for (const v of message.denomTraces) { @@ -64,11 +70,11 @@ export const GenesisState = { return message; }, fromJSON(object: any): GenesisState { - const obj = createBaseGenesisState(); - if (isSet(object.portId)) obj.portId = String(object.portId); - if (Array.isArray(object?.denomTraces)) obj.denomTraces = object.denomTraces.map((e: any) => DenomTrace.fromJSON(e)); - if (isSet(object.params)) obj.params = Params.fromJSON(object.params); - return obj; + return { + portId: isSet(object.portId) ? String(object.portId) : "", + denomTraces: Array.isArray(object?.denomTraces) ? object.denomTraces.map((e: any) => DenomTrace.fromJSON(e)) : [], + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined + }; }, toJSON(message: GenesisState): JsonSafe<GenesisState> { const obj: any = {}; @@ -85,9 +91,7 @@ export const GenesisState = { const message = createBaseGenesisState(); message.portId = object.portId ?? ""; message.denomTraces = object.denomTraces?.map(e => DenomTrace.fromPartial(e)) || []; - if (object.params !== undefined && object.params !== null) { - message.params = Params.fromPartial(object.params); - } + message.params = object.params !== undefined && object.params !== null ? Params.fromPartial(object.params) : undefined; return message; }, fromSDK(object: GenesisStateSDKType): GenesisState { diff --git a/__fixtures__/v-next/outputv4/ibc/applications/transfer/v1/query.lcd.ts b/__fixtures__/v-next/outputv4/ibc/applications/transfer/v1/query.lcd.ts index a6e0bfec83..d6bc4ab049 100644 --- a/__fixtures__/v-next/outputv4/ibc/applications/transfer/v1/query.lcd.ts +++ b/__fixtures__/v-next/outputv4/ibc/applications/transfer/v1/query.lcd.ts @@ -1,8 +1,8 @@ -import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../../../cosmos/base/query/v1beta1/pagination.js"; -import { DenomTrace, DenomTraceSDKType, Params, ParamsSDKType } from "./transfer.js"; -import { setPaginationParams } from "../../../../helpers.js"; +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../../../cosmos/base/query/v1beta1/pagination"; +import { DenomTrace, DenomTraceSDKType, Params, ParamsSDKType } from "./transfer"; +import { setPaginationParams } from "../../../../helpers"; import { LCDClient } from "@cosmology/lcd"; -import { QueryDenomTraceRequest, QueryDenomTraceRequestSDKType, QueryDenomTraceResponse, QueryDenomTraceResponseSDKType, QueryDenomTracesRequest, QueryDenomTracesRequestSDKType, QueryDenomTracesResponse, QueryDenomTracesResponseSDKType, QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType } from "./query.js"; +import { QueryDenomTraceRequest, QueryDenomTraceRequestSDKType, QueryDenomTraceResponse, QueryDenomTraceResponseSDKType, QueryDenomTracesRequest, QueryDenomTracesRequestSDKType, QueryDenomTracesResponse, QueryDenomTracesResponseSDKType, QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType } from "./query"; export class LCDQueryClient { req: LCDClient; constructor({ @@ -22,7 +22,7 @@ export class LCDQueryClient { } /* DenomTraces queries all denomination traces. */ async denomTraces(params: QueryDenomTracesRequest = { - pagination: PageRequest.fromPartial({}) + pagination: undefined }): Promise<QueryDenomTracesResponseSDKType> { const options: any = { params: {} diff --git a/__fixtures__/v-next/outputv4/ibc/applications/transfer/v1/query.rpc.Query.ts b/__fixtures__/v-next/outputv4/ibc/applications/transfer/v1/query.rpc.Query.ts index dc3b247181..2666724b79 100644 --- a/__fixtures__/v-next/outputv4/ibc/applications/transfer/v1/query.rpc.Query.ts +++ b/__fixtures__/v-next/outputv4/ibc/applications/transfer/v1/query.rpc.Query.ts @@ -1,9 +1,9 @@ -import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../../../cosmos/base/query/v1beta1/pagination.js"; -import { DenomTrace, DenomTraceSDKType, Params, ParamsSDKType } from "./transfer.js"; -import { Rpc } from "../../../../helpers.js"; -import { BinaryReader } from "../../../../binary.js"; +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../../../cosmos/base/query/v1beta1/pagination"; +import { DenomTrace, DenomTraceSDKType, Params, ParamsSDKType } from "./transfer"; +import { Rpc } from "../../../../helpers"; +import { BinaryReader } from "../../../../binary"; import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; -import { QueryDenomTraceRequest, QueryDenomTraceRequestSDKType, QueryDenomTraceResponse, QueryDenomTraceResponseSDKType, QueryDenomTracesRequest, QueryDenomTracesRequestSDKType, QueryDenomTracesResponse, QueryDenomTracesResponseSDKType, QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType } from "./query.js"; +import { QueryDenomTraceRequest, QueryDenomTraceRequestSDKType, QueryDenomTraceResponse, QueryDenomTraceResponseSDKType, QueryDenomTracesRequest, QueryDenomTracesRequestSDKType, QueryDenomTracesResponse, QueryDenomTracesResponseSDKType, QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType, ReactiveQueryDenomTraceRequest, ReactiveQueryDenomTracesRequest, ReactiveQueryParamsRequest } from "./query"; /** Query provides defines the gRPC querier service. */ export interface Query { /** DenomTrace queries a denomination trace information. */ @@ -27,7 +27,7 @@ export class QueryClientImpl implements Query { return promise.then(data => QueryDenomTraceResponse.decode(new BinaryReader(data))); } denomTraces(request: QueryDenomTracesRequest = { - pagination: PageRequest.fromPartial({}) + pagination: undefined }): Promise<QueryDenomTracesResponse> { const data = QueryDenomTracesRequest.encode(request).finish(); const promise = this.rpc.request("ibc.applications.transfer.v1.Query", "DenomTraces", data); diff --git a/__fixtures__/v-next/outputv4/ibc/applications/transfer/v1/query.ts b/__fixtures__/v-next/outputv4/ibc/applications/transfer/v1/query.ts index ae55529188..6fb5a26e1c 100644 --- a/__fixtures__/v-next/outputv4/ibc/applications/transfer/v1/query.ts +++ b/__fixtures__/v-next/outputv4/ibc/applications/transfer/v1/query.ts @@ -1,8 +1,9 @@ -import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../../../cosmos/base/query/v1beta1/pagination.js"; -import { DenomTrace, DenomTraceSDKType, Params, ParamsSDKType } from "./transfer.js"; -import { BinaryReader, BinaryWriter } from "../../../../binary.js"; -import { isSet, DeepPartial } from "../../../../helpers.js"; -import { JsonSafe } from "../../../../json-safe.js"; +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../../../cosmos/base/query/v1beta1/pagination"; +import { DenomTrace, DenomTraceSDKType, Params, ParamsSDKType } from "./transfer"; +import { BinaryReader, BinaryWriter } from "../../../../binary"; +import { isSet, DeepPartial } from "../../../../helpers"; +import { JsonSafe } from "../../../../json-safe"; +import { ComputedRef } from "vue"; export const protobufPackage = "ibc.applications.transfer.v1"; /** * QueryDenomTraceRequest is the request type for the Query/DenomTrace RPC @@ -12,6 +13,9 @@ export interface QueryDenomTraceRequest { /** hash (in hex format) of the denomination trace information. */ hash: string; } +export interface ReactiveQueryDenomTraceRequest { + hash: ComputedRef<string>; +} export interface QueryDenomTraceRequestProtoMsg { typeUrl: "/ibc.applications.transfer.v1.QueryDenomTraceRequest"; value: Uint8Array; @@ -31,6 +35,9 @@ export interface QueryDenomTraceResponse { /** denom_trace returns the requested denomination trace information. */ denomTrace?: DenomTrace; } +export interface ReactiveQueryDenomTraceResponse { + denomTrace?: ComputedRef<DenomTrace>; +} export interface QueryDenomTraceResponseProtoMsg { typeUrl: "/ibc.applications.transfer.v1.QueryDenomTraceResponse"; value: Uint8Array; @@ -50,6 +57,9 @@ export interface QueryDenomTracesRequest { /** pagination defines an optional pagination for the request. */ pagination?: PageRequest; } +export interface ReactiveQueryDenomTracesRequest { + pagination?: ComputedRef<PageRequest>; +} export interface QueryDenomTracesRequestProtoMsg { typeUrl: "/ibc.applications.transfer.v1.QueryDenomTracesRequest"; value: Uint8Array; @@ -71,6 +81,10 @@ export interface QueryDenomTracesResponse { /** pagination defines the pagination in the response. */ pagination?: PageResponse; } +export interface ReactiveQueryDenomTracesResponse { + denomTraces: ComputedRef<DenomTrace[]>; + pagination?: ComputedRef<PageResponse>; +} export interface QueryDenomTracesResponseProtoMsg { typeUrl: "/ibc.applications.transfer.v1.QueryDenomTracesResponse"; value: Uint8Array; @@ -85,6 +99,7 @@ export interface QueryDenomTracesResponseSDKType { } /** QueryParamsRequest is the request type for the Query/Params RPC method. */ export interface QueryParamsRequest {} +export interface ReactiveQueryParamsRequest {} export interface QueryParamsRequestProtoMsg { typeUrl: "/ibc.applications.transfer.v1.QueryParamsRequest"; value: Uint8Array; @@ -96,6 +111,9 @@ export interface QueryParamsResponse { /** params defines the parameters of the module. */ params?: Params; } +export interface ReactiveQueryParamsResponse { + params?: ComputedRef<Params>; +} export interface QueryParamsResponseProtoMsg { typeUrl: "/ibc.applications.transfer.v1.QueryParamsResponse"; value: Uint8Array; @@ -112,7 +130,7 @@ function createBaseQueryDenomTraceRequest(): QueryDenomTraceRequest { export const QueryDenomTraceRequest = { typeUrl: "/ibc.applications.transfer.v1.QueryDenomTraceRequest", encode(message: QueryDenomTraceRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.hash !== undefined) { + if (message.hash !== "") { writer.uint32(10).string(message.hash); } return writer; @@ -135,9 +153,9 @@ export const QueryDenomTraceRequest = { return message; }, fromJSON(object: any): QueryDenomTraceRequest { - const obj = createBaseQueryDenomTraceRequest(); - if (isSet(object.hash)) obj.hash = String(object.hash); - return obj; + return { + hash: isSet(object.hash) ? String(object.hash) : "" + }; }, toJSON(message: QueryDenomTraceRequest): JsonSafe<QueryDenomTraceRequest> { const obj: any = {}; @@ -229,9 +247,9 @@ export const QueryDenomTraceResponse = { return message; }, fromJSON(object: any): QueryDenomTraceResponse { - const obj = createBaseQueryDenomTraceResponse(); - if (isSet(object.denomTrace)) obj.denomTrace = DenomTrace.fromJSON(object.denomTrace); - return obj; + return { + denomTrace: isSet(object.denomTrace) ? DenomTrace.fromJSON(object.denomTrace) : undefined + }; }, toJSON(message: QueryDenomTraceResponse): JsonSafe<QueryDenomTraceResponse> { const obj: any = {}; @@ -240,9 +258,7 @@ export const QueryDenomTraceResponse = { }, fromPartial(object: DeepPartial<QueryDenomTraceResponse>): QueryDenomTraceResponse { const message = createBaseQueryDenomTraceResponse(); - if (object.denomTrace !== undefined && object.denomTrace !== null) { - message.denomTrace = DenomTrace.fromPartial(object.denomTrace); - } + message.denomTrace = object.denomTrace !== undefined && object.denomTrace !== null ? DenomTrace.fromPartial(object.denomTrace) : undefined; return message; }, fromSDK(object: QueryDenomTraceResponseSDKType): QueryDenomTraceResponse { @@ -325,9 +341,9 @@ export const QueryDenomTracesRequest = { return message; }, fromJSON(object: any): QueryDenomTracesRequest { - const obj = createBaseQueryDenomTracesRequest(); - if (isSet(object.pagination)) obj.pagination = PageRequest.fromJSON(object.pagination); - return obj; + return { + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined + }; }, toJSON(message: QueryDenomTracesRequest): JsonSafe<QueryDenomTracesRequest> { const obj: any = {}; @@ -336,9 +352,7 @@ export const QueryDenomTracesRequest = { }, fromPartial(object: DeepPartial<QueryDenomTracesRequest>): QueryDenomTracesRequest { const message = createBaseQueryDenomTracesRequest(); - if (object.pagination !== undefined && object.pagination !== null) { - message.pagination = PageRequest.fromPartial(object.pagination); - } + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageRequest.fromPartial(object.pagination) : undefined; return message; }, fromSDK(object: QueryDenomTracesRequestSDKType): QueryDenomTracesRequest { @@ -428,10 +442,10 @@ export const QueryDenomTracesResponse = { return message; }, fromJSON(object: any): QueryDenomTracesResponse { - const obj = createBaseQueryDenomTracesResponse(); - if (Array.isArray(object?.denomTraces)) obj.denomTraces = object.denomTraces.map((e: any) => DenomTrace.fromJSON(e)); - if (isSet(object.pagination)) obj.pagination = PageResponse.fromJSON(object.pagination); - return obj; + return { + denomTraces: Array.isArray(object?.denomTraces) ? object.denomTraces.map((e: any) => DenomTrace.fromJSON(e)) : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined + }; }, toJSON(message: QueryDenomTracesResponse): JsonSafe<QueryDenomTracesResponse> { const obj: any = {}; @@ -446,9 +460,7 @@ export const QueryDenomTracesResponse = { fromPartial(object: DeepPartial<QueryDenomTracesResponse>): QueryDenomTracesResponse { const message = createBaseQueryDenomTracesResponse(); message.denomTraces = object.denomTraces?.map(e => DenomTrace.fromPartial(e)) || []; - if (object.pagination !== undefined && object.pagination !== null) { - message.pagination = PageResponse.fromPartial(object.pagination); - } + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageResponse.fromPartial(object.pagination) : undefined; return message; }, fromSDK(object: QueryDenomTracesResponseSDKType): QueryDenomTracesResponse { @@ -536,8 +548,7 @@ export const QueryParamsRequest = { return message; }, fromJSON(_: any): QueryParamsRequest { - const obj = createBaseQueryParamsRequest(); - return obj; + return {}; }, toJSON(_: QueryParamsRequest): JsonSafe<QueryParamsRequest> { const obj: any = {}; @@ -618,9 +629,9 @@ export const QueryParamsResponse = { return message; }, fromJSON(object: any): QueryParamsResponse { - const obj = createBaseQueryParamsResponse(); - if (isSet(object.params)) obj.params = Params.fromJSON(object.params); - return obj; + return { + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined + }; }, toJSON(message: QueryParamsResponse): JsonSafe<QueryParamsResponse> { const obj: any = {}; @@ -629,9 +640,7 @@ export const QueryParamsResponse = { }, fromPartial(object: DeepPartial<QueryParamsResponse>): QueryParamsResponse { const message = createBaseQueryParamsResponse(); - if (object.params !== undefined && object.params !== null) { - message.params = Params.fromPartial(object.params); - } + message.params = object.params !== undefined && object.params !== null ? Params.fromPartial(object.params) : undefined; return message; }, fromSDK(object: QueryParamsResponseSDKType): QueryParamsResponse { diff --git a/__fixtures__/v-next/outputv4/ibc/applications/transfer/v1/transfer.ts b/__fixtures__/v-next/outputv4/ibc/applications/transfer/v1/transfer.ts index 4c74da1946..4afa411d77 100644 --- a/__fixtures__/v-next/outputv4/ibc/applications/transfer/v1/transfer.ts +++ b/__fixtures__/v-next/outputv4/ibc/applications/transfer/v1/transfer.ts @@ -1,6 +1,7 @@ -import { BinaryReader, BinaryWriter } from "../../../../binary.js"; -import { isSet, DeepPartial } from "../../../../helpers.js"; -import { JsonSafe } from "../../../../json-safe.js"; +import { BinaryReader, BinaryWriter } from "../../../../binary"; +import { isSet, DeepPartial } from "../../../../helpers"; +import { JsonSafe } from "../../../../json-safe"; +import { ComputedRef } from "vue"; export const protobufPackage = "ibc.applications.transfer.v1"; /** * DenomTrace contains the base denomination for ICS20 fungible tokens and the @@ -15,6 +16,10 @@ export interface DenomTrace { /** base denomination of the relayed fungible token. */ baseDenom: string; } +export interface ReactiveDenomTrace { + path: ComputedRef<string>; + baseDenom: ComputedRef<string>; +} export interface DenomTraceProtoMsg { typeUrl: "/ibc.applications.transfer.v1.DenomTrace"; value: Uint8Array; @@ -45,6 +50,10 @@ export interface Params { */ receiveEnabled: boolean; } +export interface ReactiveParams { + sendEnabled: ComputedRef<boolean>; + receiveEnabled: ComputedRef<boolean>; +} export interface ParamsProtoMsg { typeUrl: "/ibc.applications.transfer.v1.Params"; value: Uint8Array; @@ -68,10 +77,10 @@ function createBaseDenomTrace(): DenomTrace { export const DenomTrace = { typeUrl: "/ibc.applications.transfer.v1.DenomTrace", encode(message: DenomTrace, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.path !== undefined) { + if (message.path !== "") { writer.uint32(10).string(message.path); } - if (message.baseDenom !== undefined) { + if (message.baseDenom !== "") { writer.uint32(18).string(message.baseDenom); } return writer; @@ -97,10 +106,10 @@ export const DenomTrace = { return message; }, fromJSON(object: any): DenomTrace { - const obj = createBaseDenomTrace(); - if (isSet(object.path)) obj.path = String(object.path); - if (isSet(object.baseDenom)) obj.baseDenom = String(object.baseDenom); - return obj; + return { + path: isSet(object.path) ? String(object.path) : "", + baseDenom: isSet(object.baseDenom) ? String(object.baseDenom) : "" + }; }, toJSON(message: DenomTrace): JsonSafe<DenomTrace> { const obj: any = {}; @@ -179,10 +188,10 @@ function createBaseParams(): Params { export const Params = { typeUrl: "/ibc.applications.transfer.v1.Params", encode(message: Params, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.sendEnabled !== undefined) { + if (message.sendEnabled === true) { writer.uint32(8).bool(message.sendEnabled); } - if (message.receiveEnabled !== undefined) { + if (message.receiveEnabled === true) { writer.uint32(16).bool(message.receiveEnabled); } return writer; @@ -208,10 +217,10 @@ export const Params = { return message; }, fromJSON(object: any): Params { - const obj = createBaseParams(); - if (isSet(object.sendEnabled)) obj.sendEnabled = Boolean(object.sendEnabled); - if (isSet(object.receiveEnabled)) obj.receiveEnabled = Boolean(object.receiveEnabled); - return obj; + return { + sendEnabled: isSet(object.sendEnabled) ? Boolean(object.sendEnabled) : false, + receiveEnabled: isSet(object.receiveEnabled) ? Boolean(object.receiveEnabled) : false + }; }, toJSON(message: Params): JsonSafe<Params> { const obj: any = {}; diff --git a/__fixtures__/v-next/outputv4/ibc/applications/transfer/v1/tx.amino.ts b/__fixtures__/v-next/outputv4/ibc/applications/transfer/v1/tx.amino.ts index 44d8193064..a03ccde6de 100644 --- a/__fixtures__/v-next/outputv4/ibc/applications/transfer/v1/tx.amino.ts +++ b/__fixtures__/v-next/outputv4/ibc/applications/transfer/v1/tx.amino.ts @@ -1,8 +1,8 @@ -import { Coin, CoinSDKType } from "../../../../cosmos/base/v1beta1/coin.js"; -import { Height, HeightSDKType } from "../../../core/client/v1/client.js"; +import { Coin, CoinSDKType } from "../../../../cosmos/base/v1beta1/coin"; +import { Height, HeightSDKType } from "../../../core/client/v1/client"; import { AminoMsg } from "@cosmjs/amino"; -import { AminoHeight, omitDefault } from "../../../../helpers.js"; -import { MsgTransfer, MsgTransferSDKType } from "./tx.js"; +import { AminoHeight, omitDefault } from "../../../../helpers"; +import { MsgTransfer, MsgTransferSDKType } from "./tx"; export interface MsgTransferAminoType extends AminoMsg { type: "cosmos-sdk/MsgTransfer"; value: { diff --git a/__fixtures__/v-next/outputv4/ibc/applications/transfer/v1/tx.registry.ts b/__fixtures__/v-next/outputv4/ibc/applications/transfer/v1/tx.registry.ts index f4b300e8d7..204a0db521 100644 --- a/__fixtures__/v-next/outputv4/ibc/applications/transfer/v1/tx.registry.ts +++ b/__fixtures__/v-next/outputv4/ibc/applications/transfer/v1/tx.registry.ts @@ -1,7 +1,7 @@ -import { Coin, CoinSDKType } from "../../../../cosmos/base/v1beta1/coin.js"; -import { Height, HeightSDKType } from "../../../core/client/v1/client.js"; +import { Coin, CoinSDKType } from "../../../../cosmos/base/v1beta1/coin"; +import { Height, HeightSDKType } from "../../../core/client/v1/client"; import { GeneratedType, Registry } from "@cosmjs/proto-signing"; -import { MsgTransfer, MsgTransferSDKType } from "./tx.js"; +import { MsgTransfer, MsgTransferSDKType } from "./tx"; export const registry: ReadonlyArray<[string, GeneratedType]> = [["/ibc.applications.transfer.v1.MsgTransfer", MsgTransfer]]; export const load = (protoRegistry: Registry) => { registry.forEach(([typeUrl, mod]) => { diff --git a/__fixtures__/v-next/outputv4/ibc/applications/transfer/v1/tx.rpc.msg.ts b/__fixtures__/v-next/outputv4/ibc/applications/transfer/v1/tx.rpc.msg.ts index 2e9a9506bf..0184a5fb40 100644 --- a/__fixtures__/v-next/outputv4/ibc/applications/transfer/v1/tx.rpc.msg.ts +++ b/__fixtures__/v-next/outputv4/ibc/applications/transfer/v1/tx.rpc.msg.ts @@ -1,8 +1,8 @@ -import { Coin, CoinSDKType } from "../../../../cosmos/base/v1beta1/coin.js"; -import { Height, HeightSDKType } from "../../../core/client/v1/client.js"; -import { Rpc } from "../../../../helpers.js"; -import { BinaryReader } from "../../../../binary.js"; -import { MsgTransfer, MsgTransferSDKType, MsgTransferResponse, MsgTransferResponseSDKType } from "./tx.js"; +import { Coin, CoinSDKType } from "../../../../cosmos/base/v1beta1/coin"; +import { Height, HeightSDKType } from "../../../core/client/v1/client"; +import { Rpc } from "../../../../helpers"; +import { BinaryReader } from "../../../../binary"; +import { MsgTransfer, MsgTransferSDKType, MsgTransferResponse, MsgTransferResponseSDKType } from "./tx"; /** Msg defines the ibc/transfer Msg service. */ export interface Msg { /** Transfer defines a rpc handler method for MsgTransfer. */ diff --git a/__fixtures__/v-next/outputv4/ibc/applications/transfer/v1/tx.ts b/__fixtures__/v-next/outputv4/ibc/applications/transfer/v1/tx.ts index 00f4c1ca1b..ad50b69a98 100644 --- a/__fixtures__/v-next/outputv4/ibc/applications/transfer/v1/tx.ts +++ b/__fixtures__/v-next/outputv4/ibc/applications/transfer/v1/tx.ts @@ -1,8 +1,9 @@ -import { Coin, CoinSDKType } from "../../../../cosmos/base/v1beta1/coin.js"; -import { Height, HeightSDKType } from "../../../core/client/v1/client.js"; -import { BinaryReader, BinaryWriter } from "../../../../binary.js"; -import { isSet, DeepPartial } from "../../../../helpers.js"; -import { JsonSafe } from "../../../../json-safe.js"; +import { Coin, CoinSDKType } from "../../../../cosmos/base/v1beta1/coin"; +import { Height, HeightSDKType } from "../../../core/client/v1/client"; +import { BinaryReader, BinaryWriter } from "../../../../binary"; +import { isSet, DeepPartial } from "../../../../helpers"; +import { JsonSafe } from "../../../../json-safe"; +import { ComputedRef } from "vue"; export const protobufPackage = "ibc.applications.transfer.v1"; /** * MsgTransfer defines a msg to transfer fungible tokens (i.e Coins) between @@ -31,6 +32,15 @@ export interface MsgTransfer { */ timeoutTimestamp: bigint; } +export interface ReactiveMsgTransfer { + sourcePort: ComputedRef<string>; + sourceChannel: ComputedRef<string>; + token: ComputedRef<Coin>; + sender: ComputedRef<string>; + receiver: ComputedRef<string>; + timeoutHeight: ComputedRef<Height>; + timeoutTimestamp: ComputedRef<bigint>; +} export interface MsgTransferProtoMsg { typeUrl: "/ibc.applications.transfer.v1.MsgTransfer"; value: Uint8Array; @@ -51,6 +61,7 @@ export interface MsgTransferSDKType { } /** MsgTransferResponse defines the Msg/Transfer response type. */ export interface MsgTransferResponse {} +export interface ReactiveMsgTransferResponse {} export interface MsgTransferResponseProtoMsg { typeUrl: "/ibc.applications.transfer.v1.MsgTransferResponse"; value: Uint8Array; @@ -71,25 +82,25 @@ function createBaseMsgTransfer(): MsgTransfer { export const MsgTransfer = { typeUrl: "/ibc.applications.transfer.v1.MsgTransfer", encode(message: MsgTransfer, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.sourcePort !== undefined) { + if (message.sourcePort !== "") { writer.uint32(10).string(message.sourcePort); } - if (message.sourceChannel !== undefined) { + if (message.sourceChannel !== "") { writer.uint32(18).string(message.sourceChannel); } if (message.token !== undefined) { Coin.encode(message.token, writer.uint32(26).fork()).ldelim(); } - if (message.sender !== undefined) { + if (message.sender !== "") { writer.uint32(34).string(message.sender); } - if (message.receiver !== undefined) { + if (message.receiver !== "") { writer.uint32(42).string(message.receiver); } if (message.timeoutHeight !== undefined) { Height.encode(message.timeoutHeight, writer.uint32(50).fork()).ldelim(); } - if (message.timeoutTimestamp !== undefined) { + if (message.timeoutTimestamp !== BigInt(0)) { writer.uint32(56).uint64(message.timeoutTimestamp); } return writer; @@ -130,15 +141,15 @@ export const MsgTransfer = { return message; }, fromJSON(object: any): MsgTransfer { - const obj = createBaseMsgTransfer(); - if (isSet(object.sourcePort)) obj.sourcePort = String(object.sourcePort); - if (isSet(object.sourceChannel)) obj.sourceChannel = String(object.sourceChannel); - if (isSet(object.token)) obj.token = Coin.fromJSON(object.token); - if (isSet(object.sender)) obj.sender = String(object.sender); - if (isSet(object.receiver)) obj.receiver = String(object.receiver); - if (isSet(object.timeoutHeight)) obj.timeoutHeight = Height.fromJSON(object.timeoutHeight); - if (isSet(object.timeoutTimestamp)) obj.timeoutTimestamp = BigInt(object.timeoutTimestamp.toString()); - return obj; + return { + sourcePort: isSet(object.sourcePort) ? String(object.sourcePort) : "", + sourceChannel: isSet(object.sourceChannel) ? String(object.sourceChannel) : "", + token: isSet(object.token) ? Coin.fromJSON(object.token) : undefined, + sender: isSet(object.sender) ? String(object.sender) : "", + receiver: isSet(object.receiver) ? String(object.receiver) : "", + timeoutHeight: isSet(object.timeoutHeight) ? Height.fromJSON(object.timeoutHeight) : undefined, + timeoutTimestamp: isSet(object.timeoutTimestamp) ? BigInt(object.timeoutTimestamp.toString()) : BigInt(0) + }; }, toJSON(message: MsgTransfer): JsonSafe<MsgTransfer> { const obj: any = {}; @@ -155,17 +166,11 @@ export const MsgTransfer = { const message = createBaseMsgTransfer(); message.sourcePort = object.sourcePort ?? ""; message.sourceChannel = object.sourceChannel ?? ""; - if (object.token !== undefined && object.token !== null) { - message.token = Coin.fromPartial(object.token); - } + message.token = object.token !== undefined && object.token !== null ? Coin.fromPartial(object.token) : undefined; message.sender = object.sender ?? ""; message.receiver = object.receiver ?? ""; - if (object.timeoutHeight !== undefined && object.timeoutHeight !== null) { - message.timeoutHeight = Height.fromPartial(object.timeoutHeight); - } - if (object.timeoutTimestamp !== undefined && object.timeoutTimestamp !== null) { - message.timeoutTimestamp = BigInt(object.timeoutTimestamp.toString()); - } + message.timeoutHeight = object.timeoutHeight !== undefined && object.timeoutHeight !== null ? Height.fromPartial(object.timeoutHeight) : undefined; + message.timeoutTimestamp = object.timeoutTimestamp !== undefined && object.timeoutTimestamp !== null ? BigInt(object.timeoutTimestamp.toString()) : BigInt(0); return message; }, fromSDK(object: MsgTransferSDKType): MsgTransfer { @@ -282,8 +287,7 @@ export const MsgTransferResponse = { return message; }, fromJSON(_: any): MsgTransferResponse { - const obj = createBaseMsgTransferResponse(); - return obj; + return {}; }, toJSON(_: MsgTransferResponse): JsonSafe<MsgTransferResponse> { const obj: any = {}; diff --git a/__fixtures__/v-next/outputv4/ibc/applications/transfer/v2/packet.ts b/__fixtures__/v-next/outputv4/ibc/applications/transfer/v2/packet.ts index 4c501f1df7..f2f4d050a3 100644 --- a/__fixtures__/v-next/outputv4/ibc/applications/transfer/v2/packet.ts +++ b/__fixtures__/v-next/outputv4/ibc/applications/transfer/v2/packet.ts @@ -1,6 +1,7 @@ -import { BinaryReader, BinaryWriter } from "../../../../binary.js"; -import { isSet, DeepPartial } from "../../../../helpers.js"; -import { JsonSafe } from "../../../../json-safe.js"; +import { BinaryReader, BinaryWriter } from "../../../../binary"; +import { isSet, DeepPartial } from "../../../../helpers"; +import { JsonSafe } from "../../../../json-safe"; +import { ComputedRef } from "vue"; export const protobufPackage = "ibc.applications.transfer.v2"; /** * FungibleTokenPacketData defines a struct for the packet payload @@ -17,6 +18,12 @@ export interface FungibleTokenPacketData { /** the recipient address on the destination chain */ receiver: string; } +export interface ReactiveFungibleTokenPacketData { + denom: ComputedRef<string>; + amount: ComputedRef<string>; + sender: ComputedRef<string>; + receiver: ComputedRef<string>; +} export interface FungibleTokenPacketDataProtoMsg { typeUrl: "/ibc.applications.transfer.v2.FungibleTokenPacketData"; value: Uint8Array; @@ -43,16 +50,16 @@ function createBaseFungibleTokenPacketData(): FungibleTokenPacketData { export const FungibleTokenPacketData = { typeUrl: "/ibc.applications.transfer.v2.FungibleTokenPacketData", encode(message: FungibleTokenPacketData, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.denom !== undefined) { + if (message.denom !== "") { writer.uint32(10).string(message.denom); } - if (message.amount !== undefined) { + if (message.amount !== "") { writer.uint32(18).string(message.amount); } - if (message.sender !== undefined) { + if (message.sender !== "") { writer.uint32(26).string(message.sender); } - if (message.receiver !== undefined) { + if (message.receiver !== "") { writer.uint32(34).string(message.receiver); } return writer; @@ -84,12 +91,12 @@ export const FungibleTokenPacketData = { return message; }, fromJSON(object: any): FungibleTokenPacketData { - const obj = createBaseFungibleTokenPacketData(); - if (isSet(object.denom)) obj.denom = String(object.denom); - if (isSet(object.amount)) obj.amount = String(object.amount); - if (isSet(object.sender)) obj.sender = String(object.sender); - if (isSet(object.receiver)) obj.receiver = String(object.receiver); - return obj; + return { + denom: isSet(object.denom) ? String(object.denom) : "", + amount: isSet(object.amount) ? String(object.amount) : "", + sender: isSet(object.sender) ? String(object.sender) : "", + receiver: isSet(object.receiver) ? String(object.receiver) : "" + }; }, toJSON(message: FungibleTokenPacketData): JsonSafe<FungibleTokenPacketData> { const obj: any = {}; diff --git a/__fixtures__/v-next/outputv4/ibc/bundle.ts b/__fixtures__/v-next/outputv4/ibc/bundle.ts index 30a5f69a55..96a0c86c58 100644 --- a/__fixtures__/v-next/outputv4/ibc/bundle.ts +++ b/__fixtures__/v-next/outputv4/ibc/bundle.ts @@ -1,150 +1,234 @@ -import * as _230 from "./applications/transfer/v1/genesis.js"; -import * as _231 from "./applications/transfer/v1/query.js"; -import * as _232 from "./applications/transfer/v1/transfer.js"; -import * as _233 from "./applications/transfer/v1/tx.js"; -import * as _234 from "./applications/transfer/v2/packet.js"; -import * as _235 from "./core/channel/v1/channel.js"; -import * as _236 from "./core/channel/v1/genesis.js"; -import * as _237 from "./core/channel/v1/query.js"; -import * as _238 from "./core/channel/v1/tx.js"; -import * as _239 from "./core/client/v1/client.js"; -import * as _240 from "./core/client/v1/genesis.js"; -import * as _241 from "./core/client/v1/query.js"; -import * as _242 from "./core/client/v1/tx.js"; -import * as _243 from "./core/commitment/v1/commitment.js"; -import * as _244 from "./core/connection/v1/connection.js"; -import * as _245 from "./core/connection/v1/genesis.js"; -import * as _246 from "./core/connection/v1/query.js"; -import * as _247 from "./core/connection/v1/tx.js"; -import * as _248 from "./core/port/v1/query.js"; -import * as _249 from "./core/types/v1/genesis.js"; -import * as _250 from "./lightclients/localhost/v1/localhost.js"; -import * as _251 from "./lightclients/solomachine/v1/solomachine.js"; -import * as _252 from "./lightclients/solomachine/v2/solomachine.js"; -import * as _253 from "./lightclients/tendermint/v1/tendermint.js"; -import * as _465 from "./applications/transfer/v1/tx.amino.js"; -import * as _466 from "./core/channel/v1/tx.amino.js"; -import * as _467 from "./core/client/v1/tx.amino.js"; -import * as _468 from "./core/connection/v1/tx.amino.js"; -import * as _469 from "./applications/transfer/v1/tx.registry.js"; -import * as _470 from "./core/channel/v1/tx.registry.js"; -import * as _471 from "./core/client/v1/tx.registry.js"; -import * as _472 from "./core/connection/v1/tx.registry.js"; -import * as _473 from "./applications/transfer/v1/query.lcd.js"; -import * as _474 from "./core/channel/v1/query.lcd.js"; -import * as _475 from "./core/client/v1/query.lcd.js"; -import * as _476 from "./core/connection/v1/query.lcd.js"; -import * as _477 from "./applications/transfer/v1/query.rpc.Query.js"; -import * as _478 from "./core/channel/v1/query.rpc.Query.js"; -import * as _479 from "./core/client/v1/query.rpc.Query.js"; -import * as _480 from "./core/connection/v1/query.rpc.Query.js"; -import * as _481 from "./core/port/v1/query.rpc.Query.js"; -import * as _482 from "./applications/transfer/v1/tx.rpc.msg.js"; -import * as _483 from "./core/channel/v1/tx.rpc.msg.js"; -import * as _484 from "./core/client/v1/tx.rpc.msg.js"; -import * as _485 from "./core/connection/v1/tx.rpc.msg.js"; -import * as _553 from "./lcd.js"; -import * as _554 from "./rpc.query.js"; -import * as _555 from "./rpc.tx.js"; +import * as _233 from "./applications/transfer/v1/genesis"; +import * as _234 from "./applications/transfer/v1/query"; +import * as _235 from "./applications/transfer/v1/transfer"; +import * as _236 from "./applications/transfer/v1/tx"; +import * as _237 from "./applications/transfer/v1/authz"; +import * as _238 from "./applications/transfer/v2/packet"; +import * as _239 from "./applications/fee/v1/ack"; +import * as _240 from "./applications/fee/v1/fee"; +import * as _241 from "./applications/fee/v1/genesis"; +import * as _242 from "./applications/fee/v1/metadata"; +import * as _243 from "./applications/fee/v1/query"; +import * as _244 from "./applications/fee/v1/tx"; +import * as _245 from "./applications/interchain_accounts/controller/v1/controller"; +import * as _246 from "./applications/interchain_accounts/controller/v1/query"; +import * as _247 from "./applications/interchain_accounts/controller/v1/tx"; +import * as _248 from "./applications/interchain_accounts/genesis/v1/genesis"; +import * as _249 from "./applications/interchain_accounts/host/v1/host"; +import * as _250 from "./applications/interchain_accounts/host/v1/query"; +import * as _251 from "./applications/interchain_accounts/v1/account"; +import * as _252 from "./applications/interchain_accounts/v1/metadata"; +import * as _253 from "./applications/interchain_accounts/v1/packet"; +import * as _254 from "./core/channel/v1/channel"; +import * as _255 from "./core/channel/v1/genesis"; +import * as _256 from "./core/channel/v1/query"; +import * as _257 from "./core/channel/v1/tx"; +import * as _258 from "./core/client/v1/client"; +import * as _259 from "./core/client/v1/genesis"; +import * as _260 from "./core/client/v1/query"; +import * as _261 from "./core/client/v1/tx"; +import * as _262 from "./core/commitment/v1/commitment"; +import * as _263 from "./core/connection/v1/connection"; +import * as _264 from "./core/connection/v1/genesis"; +import * as _265 from "./core/connection/v1/query"; +import * as _266 from "./core/connection/v1/tx"; +import * as _267 from "./core/port/v1/query"; +import * as _268 from "./core/types/v1/genesis"; +import * as _269 from "./lightclients/localhost/v1/localhost"; +import * as _270 from "./lightclients/localhost/v2/localhost"; +import * as _271 from "./lightclients/solomachine/v1/solomachine"; +import * as _272 from "./lightclients/solomachine/v2/solomachine"; +import * as _273 from "./lightclients/solomachine/v3/solomachine"; +import * as _274 from "./lightclients/tendermint/v1/tendermint"; +import * as _515 from "./applications/transfer/v1/tx.amino"; +import * as _516 from "./core/channel/v1/tx.amino"; +import * as _517 from "./core/client/v1/tx.amino"; +import * as _518 from "./core/connection/v1/tx.amino"; +import * as _519 from "./applications/fee/v1/tx.amino"; +import * as _520 from "./applications/interchain_accounts/controller/v1/tx.amino"; +import * as _521 from "./applications/transfer/v1/tx.registry"; +import * as _522 from "./core/channel/v1/tx.registry"; +import * as _523 from "./core/client/v1/tx.registry"; +import * as _524 from "./core/connection/v1/tx.registry"; +import * as _525 from "./applications/fee/v1/tx.registry"; +import * as _526 from "./applications/interchain_accounts/controller/v1/tx.registry"; +import * as _527 from "./applications/transfer/v1/query.lcd"; +import * as _528 from "./core/channel/v1/query.lcd"; +import * as _529 from "./core/client/v1/query.lcd"; +import * as _530 from "./core/connection/v1/query.lcd"; +import * as _531 from "./applications/fee/v1/query.lcd"; +import * as _532 from "./applications/interchain_accounts/controller/v1/query.lcd"; +import * as _533 from "./applications/interchain_accounts/host/v1/query.lcd"; +import * as _534 from "./applications/transfer/v1/query.rpc.Query"; +import * as _535 from "./core/channel/v1/query.rpc.Query"; +import * as _536 from "./core/client/v1/query.rpc.Query"; +import * as _537 from "./core/connection/v1/query.rpc.Query"; +import * as _538 from "./core/port/v1/query.rpc.Query"; +import * as _539 from "./applications/fee/v1/query.rpc.Query"; +import * as _540 from "./applications/interchain_accounts/controller/v1/query.rpc.Query"; +import * as _541 from "./applications/interchain_accounts/host/v1/query.rpc.Query"; +import * as _542 from "./applications/transfer/v1/tx.rpc.msg"; +import * as _543 from "./core/channel/v1/tx.rpc.msg"; +import * as _544 from "./core/client/v1/tx.rpc.msg"; +import * as _545 from "./core/connection/v1/tx.rpc.msg"; +import * as _546 from "./applications/fee/v1/tx.rpc.msg"; +import * as _547 from "./applications/interchain_accounts/controller/v1/tx.rpc.msg"; +import * as _637 from "./lcd"; +import * as _638 from "./rpc.query"; +import * as _639 from "./rpc.tx"; export namespace ibc { export namespace applications { export namespace transfer { export const v1 = { - ..._230, - ..._231, - ..._232, ..._233, - ..._465, - ..._469, - ..._473, - ..._477, - ..._482 + ..._234, + ..._235, + ..._236, + ..._237, + ..._515, + ..._521, + ..._527, + ..._534, + ..._542 }; export const v2 = { - ..._234 + ..._238 + }; + } + export namespace fee { + export const v1 = { + ..._239, + ..._240, + ..._241, + ..._242, + ..._243, + ..._244, + ..._519, + ..._525, + ..._531, + ..._539, + ..._546 + }; + } + export namespace interchain_accounts { + export namespace controller { + export const v1 = { + ..._245, + ..._246, + ..._247, + ..._520, + ..._526, + ..._532, + ..._540, + ..._547 + }; + } + export namespace genesis { + export const v1 = { + ..._248 + }; + } + export namespace host { + export const v1 = { + ..._249, + ..._250, + ..._533, + ..._541 + }; + } + export const v1 = { + ..._251, + ..._252, + ..._253 }; } } export namespace core { export namespace channel { export const v1 = { - ..._235, - ..._236, - ..._237, - ..._238, - ..._466, - ..._470, - ..._474, - ..._478, - ..._483 + ..._254, + ..._255, + ..._256, + ..._257, + ..._516, + ..._522, + ..._528, + ..._535, + ..._543 }; } export namespace client { export const v1 = { - ..._239, - ..._240, - ..._241, - ..._242, - ..._467, - ..._471, - ..._475, - ..._479, - ..._484 + ..._258, + ..._259, + ..._260, + ..._261, + ..._517, + ..._523, + ..._529, + ..._536, + ..._544 }; } export namespace commitment { export const v1 = { - ..._243 + ..._262 }; } export namespace connection { export const v1 = { - ..._244, - ..._245, - ..._246, - ..._247, - ..._468, - ..._472, - ..._476, - ..._480, - ..._485 + ..._263, + ..._264, + ..._265, + ..._266, + ..._518, + ..._524, + ..._530, + ..._537, + ..._545 }; } export namespace port { export const v1 = { - ..._248, - ..._481 + ..._267, + ..._538 }; } export namespace types { export const v1 = { - ..._249 + ..._268 }; } } export namespace lightclients { export namespace localhost { export const v1 = { - ..._250 + ..._269 + }; + export const v2 = { + ..._270 }; } export namespace solomachine { export const v1 = { - ..._251 + ..._271 }; export const v2 = { - ..._252 + ..._272 + }; + export const v3 = { + ..._273 }; } export namespace tendermint { export const v1 = { - ..._253 + ..._274 }; } } export const ClientFactory = { - ..._553, - ..._554, - ..._555 + ..._637, + ..._638, + ..._639 }; } \ No newline at end of file diff --git a/__fixtures__/v-next/outputv4/ibc/client.ts b/__fixtures__/v-next/outputv4/ibc/client.ts index c609e18f7b..5f3f23488b 100644 --- a/__fixtures__/v-next/outputv4/ibc/client.ts +++ b/__fixtures__/v-next/outputv4/ibc/client.ts @@ -1,21 +1,27 @@ 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.js"; -import * as ibcCoreChannelV1TxRegistry from "./core/channel/v1/tx.registry.js"; -import * as ibcCoreClientV1TxRegistry from "./core/client/v1/tx.registry.js"; -import * as ibcCoreConnectionV1TxRegistry from "./core/connection/v1/tx.registry.js"; -import * as ibcApplicationsTransferV1TxAmino from "./applications/transfer/v1/tx.amino.js"; -import * as ibcCoreChannelV1TxAmino from "./core/channel/v1/tx.amino.js"; -import * as ibcCoreClientV1TxAmino from "./core/client/v1/tx.amino.js"; -import * as ibcCoreConnectionV1TxAmino from "./core/connection/v1/tx.amino.js"; +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"; +import * as ibcApplicationsFeeV1TxRegistry from "./applications/fee/v1/tx.registry"; +import * as ibcApplicationsInterchainAccountsControllerV1TxRegistry from "./applications/interchain_accounts/controller/v1/tx.registry"; +import * as ibcApplicationsTransferV1TxAmino from "./applications/transfer/v1/tx.amino"; +import * as ibcCoreChannelV1TxAmino from "./core/channel/v1/tx.amino"; +import * as ibcCoreClientV1TxAmino from "./core/client/v1/tx.amino"; +import * as ibcCoreConnectionV1TxAmino from "./core/connection/v1/tx.amino"; +import * as ibcApplicationsFeeV1TxAmino from "./applications/fee/v1/tx.amino"; +import * as ibcApplicationsInterchainAccountsControllerV1TxAmino from "./applications/interchain_accounts/controller/v1/tx.amino"; export const ibcAminoConverters = { ...ibcApplicationsTransferV1TxAmino.AminoConverter, ...ibcCoreChannelV1TxAmino.AminoConverter, ...ibcCoreClientV1TxAmino.AminoConverter, - ...ibcCoreConnectionV1TxAmino.AminoConverter + ...ibcCoreConnectionV1TxAmino.AminoConverter, + ...ibcApplicationsFeeV1TxAmino.AminoConverter, + ...ibcApplicationsInterchainAccountsControllerV1TxAmino.AminoConverter }; -export const ibcProtoRegistry: ReadonlyArray<[string, GeneratedType]> = [...ibcApplicationsTransferV1TxRegistry.registry, ...ibcCoreChannelV1TxRegistry.registry, ...ibcCoreClientV1TxRegistry.registry, ...ibcCoreConnectionV1TxRegistry.registry]; +export const ibcProtoRegistry: ReadonlyArray<[string, GeneratedType]> = [...ibcApplicationsTransferV1TxRegistry.registry, ...ibcCoreChannelV1TxRegistry.registry, ...ibcCoreClientV1TxRegistry.registry, ...ibcCoreConnectionV1TxRegistry.registry, ...ibcApplicationsFeeV1TxRegistry.registry, ...ibcApplicationsInterchainAccountsControllerV1TxRegistry.registry]; export const getSigningIbcClientOptions = ({ defaultTypes = defaultRegistryTypes }: { diff --git a/__fixtures__/v-next/outputv4/ibc/core/channel/v1/channel.ts b/__fixtures__/v-next/outputv4/ibc/core/channel/v1/channel.ts index 3fd7b9ce73..2e36aab5e0 100644 --- a/__fixtures__/v-next/outputv4/ibc/core/channel/v1/channel.ts +++ b/__fixtures__/v-next/outputv4/ibc/core/channel/v1/channel.ts @@ -1,7 +1,8 @@ -import { Height, HeightSDKType } from "../../client/v1/client.js"; -import { BinaryReader, BinaryWriter } from "../../../../binary.js"; -import { isSet, DeepPartial, bytesFromBase64, base64FromBytes } from "../../../../helpers.js"; -import { JsonSafe } from "../../../../json-safe.js"; +import { Height, HeightSDKType } from "../../client/v1/client"; +import { BinaryReader, BinaryWriter } from "../../../../binary"; +import { isSet, DeepPartial, bytesFromBase64, base64FromBytes } from "../../../../helpers"; +import { JsonSafe } from "../../../../json-safe"; +import { ComputedRef } from "vue"; export const protobufPackage = "ibc.core.channel.v1"; /** * State defines if a channel is in one of the following states: @@ -131,6 +132,13 @@ export interface Channel { /** opaque channel version, which is agreed upon during the handshake */ version: string; } +export interface ReactiveChannel { + state: ComputedRef<State>; + ordering: ComputedRef<Order>; + counterparty: ComputedRef<Counterparty>; + connectionHops: ComputedRef<string[]>; + version: ComputedRef<string>; +} export interface ChannelProtoMsg { typeUrl: "/ibc.core.channel.v1.Channel"; value: Uint8Array; @@ -170,6 +178,15 @@ export interface IdentifiedChannel { /** channel identifier */ channelId: string; } +export interface ReactiveIdentifiedChannel { + state: ComputedRef<State>; + ordering: ComputedRef<Order>; + counterparty: ComputedRef<Counterparty>; + connectionHops: ComputedRef<string[]>; + version: ComputedRef<string>; + portId: ComputedRef<string>; + channelId: ComputedRef<string>; +} export interface IdentifiedChannelProtoMsg { typeUrl: "/ibc.core.channel.v1.IdentifiedChannel"; value: Uint8Array; @@ -194,6 +211,10 @@ export interface Counterparty { /** channel end on the counterparty chain */ channelId: string; } +export interface ReactiveCounterparty { + portId: ComputedRef<string>; + channelId: ComputedRef<string>; +} export interface CounterpartyProtoMsg { typeUrl: "/ibc.core.channel.v1.Counterparty"; value: Uint8Array; @@ -226,6 +247,16 @@ export interface Packet { /** block timestamp (in nanoseconds) after which the packet times out */ timeoutTimestamp: bigint; } +export interface ReactivePacket { + sequence: ComputedRef<bigint>; + sourcePort: ComputedRef<string>; + sourceChannel: ComputedRef<string>; + destinationPort: ComputedRef<string>; + destinationChannel: ComputedRef<string>; + data: ComputedRef<Uint8Array>; + timeoutHeight: ComputedRef<Height>; + timeoutTimestamp: ComputedRef<bigint>; +} export interface PacketProtoMsg { typeUrl: "/ibc.core.channel.v1.Packet"; value: Uint8Array; @@ -257,6 +288,12 @@ export interface PacketState { /** embedded data that represents packet state. */ data: Uint8Array; } +export interface ReactivePacketState { + portId: ComputedRef<string>; + channelId: ComputedRef<string>; + sequence: ComputedRef<bigint>; + data: ComputedRef<Uint8Array>; +} export interface PacketStateProtoMsg { typeUrl: "/ibc.core.channel.v1.PacketState"; value: Uint8Array; @@ -286,6 +323,10 @@ export interface Acknowledgement { result?: Uint8Array; error?: string; } +export interface ReactiveAcknowledgement { + result?: ComputedRef<Uint8Array>; + error?: ComputedRef<string>; +} export interface AcknowledgementProtoMsg { typeUrl: "/ibc.core.channel.v1.Acknowledgement"; value: Uint8Array; @@ -327,7 +368,7 @@ export const Channel = { for (const v of message.connectionHops) { writer.uint32(34).string(v!); } - if (message.version !== undefined) { + if (message.version !== "") { writer.uint32(42).string(message.version); } return writer; @@ -362,13 +403,13 @@ export const Channel = { return message; }, fromJSON(object: any): Channel { - const obj = createBaseChannel(); - if (isSet(object.state)) obj.state = stateFromJSON(object.state); - if (isSet(object.ordering)) obj.ordering = orderFromJSON(object.ordering); - if (isSet(object.counterparty)) obj.counterparty = Counterparty.fromJSON(object.counterparty); - if (Array.isArray(object?.connectionHops)) obj.connectionHops = object.connectionHops.map((e: any) => String(e)); - if (isSet(object.version)) obj.version = String(object.version); - return obj; + return { + state: isSet(object.state) ? stateFromJSON(object.state) : -1, + ordering: isSet(object.ordering) ? orderFromJSON(object.ordering) : -1, + counterparty: isSet(object.counterparty) ? Counterparty.fromJSON(object.counterparty) : undefined, + connectionHops: Array.isArray(object?.connectionHops) ? object.connectionHops.map((e: any) => String(e)) : [], + version: isSet(object.version) ? String(object.version) : "" + }; }, toJSON(message: Channel): JsonSafe<Channel> { const obj: any = {}; @@ -387,9 +428,7 @@ export const Channel = { const message = createBaseChannel(); message.state = object.state ?? 0; message.ordering = object.ordering ?? 0; - if (object.counterparty !== undefined && object.counterparty !== null) { - message.counterparty = Counterparty.fromPartial(object.counterparty); - } + message.counterparty = object.counterparty !== undefined && object.counterparty !== null ? Counterparty.fromPartial(object.counterparty) : undefined; message.connectionHops = object.connectionHops?.map(e => e) || []; message.version = object.version ?? ""; return message; @@ -503,13 +542,13 @@ export const IdentifiedChannel = { for (const v of message.connectionHops) { writer.uint32(34).string(v!); } - if (message.version !== undefined) { + if (message.version !== "") { writer.uint32(42).string(message.version); } - if (message.portId !== undefined) { + if (message.portId !== "") { writer.uint32(50).string(message.portId); } - if (message.channelId !== undefined) { + if (message.channelId !== "") { writer.uint32(58).string(message.channelId); } return writer; @@ -550,15 +589,15 @@ export const IdentifiedChannel = { return message; }, fromJSON(object: any): IdentifiedChannel { - const obj = createBaseIdentifiedChannel(); - if (isSet(object.state)) obj.state = stateFromJSON(object.state); - if (isSet(object.ordering)) obj.ordering = orderFromJSON(object.ordering); - if (isSet(object.counterparty)) obj.counterparty = Counterparty.fromJSON(object.counterparty); - if (Array.isArray(object?.connectionHops)) obj.connectionHops = object.connectionHops.map((e: any) => String(e)); - if (isSet(object.version)) obj.version = String(object.version); - if (isSet(object.portId)) obj.portId = String(object.portId); - if (isSet(object.channelId)) obj.channelId = String(object.channelId); - return obj; + return { + state: isSet(object.state) ? stateFromJSON(object.state) : -1, + ordering: isSet(object.ordering) ? orderFromJSON(object.ordering) : -1, + counterparty: isSet(object.counterparty) ? Counterparty.fromJSON(object.counterparty) : undefined, + connectionHops: Array.isArray(object?.connectionHops) ? object.connectionHops.map((e: any) => String(e)) : [], + version: isSet(object.version) ? String(object.version) : "", + portId: isSet(object.portId) ? String(object.portId) : "", + channelId: isSet(object.channelId) ? String(object.channelId) : "" + }; }, toJSON(message: IdentifiedChannel): JsonSafe<IdentifiedChannel> { const obj: any = {}; @@ -579,9 +618,7 @@ export const IdentifiedChannel = { const message = createBaseIdentifiedChannel(); message.state = object.state ?? 0; message.ordering = object.ordering ?? 0; - if (object.counterparty !== undefined && object.counterparty !== null) { - message.counterparty = Counterparty.fromPartial(object.counterparty); - } + message.counterparty = object.counterparty !== undefined && object.counterparty !== null ? Counterparty.fromPartial(object.counterparty) : undefined; message.connectionHops = object.connectionHops?.map(e => e) || []; message.version = object.version ?? ""; message.portId = object.portId ?? ""; @@ -694,10 +731,10 @@ function createBaseCounterparty(): Counterparty { export const Counterparty = { typeUrl: "/ibc.core.channel.v1.Counterparty", encode(message: Counterparty, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.portId !== undefined) { + if (message.portId !== "") { writer.uint32(10).string(message.portId); } - if (message.channelId !== undefined) { + if (message.channelId !== "") { writer.uint32(18).string(message.channelId); } return writer; @@ -723,10 +760,10 @@ export const Counterparty = { return message; }, fromJSON(object: any): Counterparty { - const obj = createBaseCounterparty(); - if (isSet(object.portId)) obj.portId = String(object.portId); - if (isSet(object.channelId)) obj.channelId = String(object.channelId); - return obj; + return { + portId: isSet(object.portId) ? String(object.portId) : "", + channelId: isSet(object.channelId) ? String(object.channelId) : "" + }; }, toJSON(message: Counterparty): JsonSafe<Counterparty> { const obj: any = {}; @@ -811,19 +848,19 @@ function createBasePacket(): Packet { export const Packet = { typeUrl: "/ibc.core.channel.v1.Packet", encode(message: Packet, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.sequence !== undefined) { + if (message.sequence !== BigInt(0)) { writer.uint32(8).uint64(message.sequence); } - if (message.sourcePort !== undefined) { + if (message.sourcePort !== "") { writer.uint32(18).string(message.sourcePort); } - if (message.sourceChannel !== undefined) { + if (message.sourceChannel !== "") { writer.uint32(26).string(message.sourceChannel); } - if (message.destinationPort !== undefined) { + if (message.destinationPort !== "") { writer.uint32(34).string(message.destinationPort); } - if (message.destinationChannel !== undefined) { + if (message.destinationChannel !== "") { writer.uint32(42).string(message.destinationChannel); } if (message.data.length !== 0) { @@ -832,7 +869,7 @@ export const Packet = { if (message.timeoutHeight !== undefined) { Height.encode(message.timeoutHeight, writer.uint32(58).fork()).ldelim(); } - if (message.timeoutTimestamp !== undefined) { + if (message.timeoutTimestamp !== BigInt(0)) { writer.uint32(64).uint64(message.timeoutTimestamp); } return writer; @@ -876,16 +913,16 @@ export const Packet = { return message; }, fromJSON(object: any): Packet { - const obj = createBasePacket(); - if (isSet(object.sequence)) obj.sequence = BigInt(object.sequence.toString()); - if (isSet(object.sourcePort)) obj.sourcePort = String(object.sourcePort); - if (isSet(object.sourceChannel)) obj.sourceChannel = String(object.sourceChannel); - if (isSet(object.destinationPort)) obj.destinationPort = String(object.destinationPort); - if (isSet(object.destinationChannel)) obj.destinationChannel = String(object.destinationChannel); - if (isSet(object.data)) obj.data = bytesFromBase64(object.data); - if (isSet(object.timeoutHeight)) obj.timeoutHeight = Height.fromJSON(object.timeoutHeight); - if (isSet(object.timeoutTimestamp)) obj.timeoutTimestamp = BigInt(object.timeoutTimestamp.toString()); - return obj; + return { + sequence: isSet(object.sequence) ? BigInt(object.sequence.toString()) : BigInt(0), + sourcePort: isSet(object.sourcePort) ? String(object.sourcePort) : "", + sourceChannel: isSet(object.sourceChannel) ? String(object.sourceChannel) : "", + destinationPort: isSet(object.destinationPort) ? String(object.destinationPort) : "", + destinationChannel: isSet(object.destinationChannel) ? String(object.destinationChannel) : "", + data: isSet(object.data) ? bytesFromBase64(object.data) : new Uint8Array(), + timeoutHeight: isSet(object.timeoutHeight) ? Height.fromJSON(object.timeoutHeight) : undefined, + timeoutTimestamp: isSet(object.timeoutTimestamp) ? BigInt(object.timeoutTimestamp.toString()) : BigInt(0) + }; }, toJSON(message: Packet): JsonSafe<Packet> { const obj: any = {}; @@ -901,20 +938,14 @@ export const Packet = { }, fromPartial(object: DeepPartial<Packet>): Packet { const message = createBasePacket(); - if (object.sequence !== undefined && object.sequence !== null) { - message.sequence = BigInt(object.sequence.toString()); - } + message.sequence = object.sequence !== undefined && object.sequence !== null ? BigInt(object.sequence.toString()) : BigInt(0); message.sourcePort = object.sourcePort ?? ""; message.sourceChannel = object.sourceChannel ?? ""; message.destinationPort = object.destinationPort ?? ""; message.destinationChannel = object.destinationChannel ?? ""; message.data = object.data ?? new Uint8Array(); - if (object.timeoutHeight !== undefined && object.timeoutHeight !== null) { - message.timeoutHeight = Height.fromPartial(object.timeoutHeight); - } - if (object.timeoutTimestamp !== undefined && object.timeoutTimestamp !== null) { - message.timeoutTimestamp = BigInt(object.timeoutTimestamp.toString()); - } + message.timeoutHeight = object.timeoutHeight !== undefined && object.timeoutHeight !== null ? Height.fromPartial(object.timeoutHeight) : undefined; + message.timeoutTimestamp = object.timeoutTimestamp !== undefined && object.timeoutTimestamp !== null ? BigInt(object.timeoutTimestamp.toString()) : BigInt(0); return message; }, fromSDK(object: PacketSDKType): Packet { @@ -1026,13 +1057,13 @@ function createBasePacketState(): PacketState { export const PacketState = { typeUrl: "/ibc.core.channel.v1.PacketState", encode(message: PacketState, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.portId !== undefined) { + if (message.portId !== "") { writer.uint32(10).string(message.portId); } - if (message.channelId !== undefined) { + if (message.channelId !== "") { writer.uint32(18).string(message.channelId); } - if (message.sequence !== undefined) { + if (message.sequence !== BigInt(0)) { writer.uint32(24).uint64(message.sequence); } if (message.data.length !== 0) { @@ -1067,12 +1098,12 @@ export const PacketState = { return message; }, fromJSON(object: any): PacketState { - const obj = createBasePacketState(); - if (isSet(object.portId)) obj.portId = String(object.portId); - if (isSet(object.channelId)) obj.channelId = String(object.channelId); - if (isSet(object.sequence)) obj.sequence = BigInt(object.sequence.toString()); - if (isSet(object.data)) obj.data = bytesFromBase64(object.data); - return obj; + return { + portId: isSet(object.portId) ? String(object.portId) : "", + channelId: isSet(object.channelId) ? String(object.channelId) : "", + sequence: isSet(object.sequence) ? BigInt(object.sequence.toString()) : BigInt(0), + data: isSet(object.data) ? bytesFromBase64(object.data) : new Uint8Array() + }; }, toJSON(message: PacketState): JsonSafe<PacketState> { const obj: any = {}; @@ -1086,9 +1117,7 @@ export const PacketState = { const message = createBasePacketState(); message.portId = object.portId ?? ""; message.channelId = object.channelId ?? ""; - if (object.sequence !== undefined && object.sequence !== null) { - message.sequence = BigInt(object.sequence.toString()); - } + message.sequence = object.sequence !== undefined && object.sequence !== null ? BigInt(object.sequence.toString()) : BigInt(0); message.data = object.data ?? new Uint8Array(); return message; }, @@ -1200,10 +1229,10 @@ export const Acknowledgement = { return message; }, fromJSON(object: any): Acknowledgement { - const obj = createBaseAcknowledgement(); - if (isSet(object.result)) obj.result = bytesFromBase64(object.result); - if (isSet(object.error)) obj.error = String(object.error); - return obj; + return { + result: isSet(object.result) ? bytesFromBase64(object.result) : undefined, + error: isSet(object.error) ? String(object.error) : undefined + }; }, toJSON(message: Acknowledgement): JsonSafe<Acknowledgement> { const obj: any = {}; diff --git a/__fixtures__/v-next/outputv4/ibc/core/channel/v1/genesis.ts b/__fixtures__/v-next/outputv4/ibc/core/channel/v1/genesis.ts index 26b75f119b..f7a7fda5af 100644 --- a/__fixtures__/v-next/outputv4/ibc/core/channel/v1/genesis.ts +++ b/__fixtures__/v-next/outputv4/ibc/core/channel/v1/genesis.ts @@ -1,7 +1,8 @@ -import { IdentifiedChannel, IdentifiedChannelSDKType, PacketState, PacketStateSDKType } from "./channel.js"; -import { BinaryReader, BinaryWriter } from "../../../../binary.js"; -import { isSet, DeepPartial } from "../../../../helpers.js"; -import { JsonSafe } from "../../../../json-safe.js"; +import { IdentifiedChannel, IdentifiedChannelSDKType, PacketState, PacketStateSDKType } from "./channel"; +import { BinaryReader, BinaryWriter } from "../../../../binary"; +import { isSet, DeepPartial } from "../../../../helpers"; +import { JsonSafe } from "../../../../json-safe"; +import { ComputedRef } from "vue"; export const protobufPackage = "ibc.core.channel.v1"; /** GenesisState defines the ibc channel submodule's genesis state. */ export interface GenesisState { @@ -15,6 +16,16 @@ export interface GenesisState { /** the sequence for the next generated channel identifier */ nextChannelSequence: bigint; } +export interface ReactiveGenesisState { + channels: ComputedRef<IdentifiedChannel[]>; + acknowledgements: ComputedRef<PacketState[]>; + commitments: ComputedRef<PacketState[]>; + receipts: ComputedRef<PacketState[]>; + sendSequences: ComputedRef<PacketSequence[]>; + recvSequences: ComputedRef<PacketSequence[]>; + ackSequences: ComputedRef<PacketSequence[]>; + nextChannelSequence: ComputedRef<bigint>; +} export interface GenesisStateProtoMsg { typeUrl: "/ibc.core.channel.v1.GenesisState"; value: Uint8Array; @@ -39,6 +50,11 @@ export interface PacketSequence { channelId: string; sequence: bigint; } +export interface ReactivePacketSequence { + portId: ComputedRef<string>; + channelId: ComputedRef<string>; + sequence: ComputedRef<bigint>; +} export interface PacketSequenceProtoMsg { typeUrl: "/ibc.core.channel.v1.PacketSequence"; value: Uint8Array; @@ -88,7 +104,7 @@ export const GenesisState = { for (const v of message.ackSequences) { PacketSequence.encode(v!, writer.uint32(58).fork()).ldelim(); } - if (message.nextChannelSequence !== undefined) { + if (message.nextChannelSequence !== BigInt(0)) { writer.uint32(64).uint64(message.nextChannelSequence); } return writer; @@ -132,16 +148,16 @@ export const GenesisState = { return message; }, fromJSON(object: any): GenesisState { - const obj = createBaseGenesisState(); - if (Array.isArray(object?.channels)) obj.channels = object.channels.map((e: any) => IdentifiedChannel.fromJSON(e)); - if (Array.isArray(object?.acknowledgements)) obj.acknowledgements = object.acknowledgements.map((e: any) => PacketState.fromJSON(e)); - if (Array.isArray(object?.commitments)) obj.commitments = object.commitments.map((e: any) => PacketState.fromJSON(e)); - if (Array.isArray(object?.receipts)) obj.receipts = object.receipts.map((e: any) => PacketState.fromJSON(e)); - if (Array.isArray(object?.sendSequences)) obj.sendSequences = object.sendSequences.map((e: any) => PacketSequence.fromJSON(e)); - if (Array.isArray(object?.recvSequences)) obj.recvSequences = object.recvSequences.map((e: any) => PacketSequence.fromJSON(e)); - if (Array.isArray(object?.ackSequences)) obj.ackSequences = object.ackSequences.map((e: any) => PacketSequence.fromJSON(e)); - if (isSet(object.nextChannelSequence)) obj.nextChannelSequence = BigInt(object.nextChannelSequence.toString()); - return obj; + return { + channels: Array.isArray(object?.channels) ? object.channels.map((e: any) => IdentifiedChannel.fromJSON(e)) : [], + acknowledgements: Array.isArray(object?.acknowledgements) ? object.acknowledgements.map((e: any) => PacketState.fromJSON(e)) : [], + commitments: Array.isArray(object?.commitments) ? object.commitments.map((e: any) => PacketState.fromJSON(e)) : [], + receipts: Array.isArray(object?.receipts) ? object.receipts.map((e: any) => PacketState.fromJSON(e)) : [], + sendSequences: Array.isArray(object?.sendSequences) ? object.sendSequences.map((e: any) => PacketSequence.fromJSON(e)) : [], + recvSequences: Array.isArray(object?.recvSequences) ? object.recvSequences.map((e: any) => PacketSequence.fromJSON(e)) : [], + ackSequences: Array.isArray(object?.ackSequences) ? object.ackSequences.map((e: any) => PacketSequence.fromJSON(e)) : [], + nextChannelSequence: isSet(object.nextChannelSequence) ? BigInt(object.nextChannelSequence.toString()) : BigInt(0) + }; }, toJSON(message: GenesisState): JsonSafe<GenesisState> { const obj: any = {}; @@ -192,9 +208,7 @@ export const GenesisState = { message.sendSequences = object.sendSequences?.map(e => PacketSequence.fromPartial(e)) || []; message.recvSequences = object.recvSequences?.map(e => PacketSequence.fromPartial(e)) || []; message.ackSequences = object.ackSequences?.map(e => PacketSequence.fromPartial(e)) || []; - if (object.nextChannelSequence !== undefined && object.nextChannelSequence !== null) { - message.nextChannelSequence = BigInt(object.nextChannelSequence.toString()); - } + message.nextChannelSequence = object.nextChannelSequence !== undefined && object.nextChannelSequence !== null ? BigInt(object.nextChannelSequence.toString()) : BigInt(0); return message; }, fromSDK(object: GenesisStateSDKType): GenesisState { @@ -347,13 +361,13 @@ function createBasePacketSequence(): PacketSequence { export const PacketSequence = { typeUrl: "/ibc.core.channel.v1.PacketSequence", encode(message: PacketSequence, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.portId !== undefined) { + if (message.portId !== "") { writer.uint32(10).string(message.portId); } - if (message.channelId !== undefined) { + if (message.channelId !== "") { writer.uint32(18).string(message.channelId); } - if (message.sequence !== undefined) { + if (message.sequence !== BigInt(0)) { writer.uint32(24).uint64(message.sequence); } return writer; @@ -382,11 +396,11 @@ export const PacketSequence = { return message; }, fromJSON(object: any): PacketSequence { - const obj = createBasePacketSequence(); - if (isSet(object.portId)) obj.portId = String(object.portId); - if (isSet(object.channelId)) obj.channelId = String(object.channelId); - if (isSet(object.sequence)) obj.sequence = BigInt(object.sequence.toString()); - return obj; + return { + portId: isSet(object.portId) ? String(object.portId) : "", + channelId: isSet(object.channelId) ? String(object.channelId) : "", + sequence: isSet(object.sequence) ? BigInt(object.sequence.toString()) : BigInt(0) + }; }, toJSON(message: PacketSequence): JsonSafe<PacketSequence> { const obj: any = {}; @@ -399,9 +413,7 @@ export const PacketSequence = { const message = createBasePacketSequence(); message.portId = object.portId ?? ""; message.channelId = object.channelId ?? ""; - if (object.sequence !== undefined && object.sequence !== null) { - message.sequence = BigInt(object.sequence.toString()); - } + message.sequence = object.sequence !== undefined && object.sequence !== null ? BigInt(object.sequence.toString()) : BigInt(0); return message; }, fromSDK(object: PacketSequenceSDKType): PacketSequence { diff --git a/__fixtures__/v-next/outputv4/ibc/core/channel/v1/query.lcd.ts b/__fixtures__/v-next/outputv4/ibc/core/channel/v1/query.lcd.ts index 251c2363f3..907635a584 100644 --- a/__fixtures__/v-next/outputv4/ibc/core/channel/v1/query.lcd.ts +++ b/__fixtures__/v-next/outputv4/ibc/core/channel/v1/query.lcd.ts @@ -1,10 +1,10 @@ -import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../../../cosmos/base/query/v1beta1/pagination.js"; -import { Channel, ChannelSDKType, IdentifiedChannel, IdentifiedChannelSDKType, PacketState, PacketStateSDKType } from "./channel.js"; -import { Height, HeightSDKType, IdentifiedClientState, IdentifiedClientStateSDKType } from "../../client/v1/client.js"; -import { Any, AnySDKType } from "../../../../google/protobuf/any.js"; -import { setPaginationParams } from "../../../../helpers.js"; +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../../../cosmos/base/query/v1beta1/pagination"; +import { Channel, ChannelSDKType, IdentifiedChannel, IdentifiedChannelSDKType, PacketState, PacketStateSDKType } from "./channel"; +import { Height, HeightSDKType, IdentifiedClientState, IdentifiedClientStateSDKType } from "../../client/v1/client"; +import { Any, AnySDKType } from "../../../../google/protobuf/any"; +import { setPaginationParams } from "../../../../helpers"; import { LCDClient } from "@cosmology/lcd"; -import { QueryChannelRequest, QueryChannelRequestSDKType, QueryChannelResponse, QueryChannelResponseSDKType, QueryChannelsRequest, QueryChannelsRequestSDKType, QueryChannelsResponse, QueryChannelsResponseSDKType, QueryConnectionChannelsRequest, QueryConnectionChannelsRequestSDKType, QueryConnectionChannelsResponse, QueryConnectionChannelsResponseSDKType, QueryChannelClientStateRequest, QueryChannelClientStateRequestSDKType, QueryChannelClientStateResponse, QueryChannelClientStateResponseSDKType, QueryChannelConsensusStateRequest, QueryChannelConsensusStateRequestSDKType, QueryChannelConsensusStateResponse, QueryChannelConsensusStateResponseSDKType, QueryPacketCommitmentRequest, QueryPacketCommitmentRequestSDKType, QueryPacketCommitmentResponse, QueryPacketCommitmentResponseSDKType, QueryPacketCommitmentsRequest, QueryPacketCommitmentsRequestSDKType, QueryPacketCommitmentsResponse, QueryPacketCommitmentsResponseSDKType, QueryPacketReceiptRequest, QueryPacketReceiptRequestSDKType, QueryPacketReceiptResponse, QueryPacketReceiptResponseSDKType, QueryPacketAcknowledgementRequest, QueryPacketAcknowledgementRequestSDKType, QueryPacketAcknowledgementResponse, QueryPacketAcknowledgementResponseSDKType, QueryPacketAcknowledgementsRequest, QueryPacketAcknowledgementsRequestSDKType, QueryPacketAcknowledgementsResponse, QueryPacketAcknowledgementsResponseSDKType, QueryUnreceivedPacketsRequest, QueryUnreceivedPacketsRequestSDKType, QueryUnreceivedPacketsResponse, QueryUnreceivedPacketsResponseSDKType, QueryUnreceivedAcksRequest, QueryUnreceivedAcksRequestSDKType, QueryUnreceivedAcksResponse, QueryUnreceivedAcksResponseSDKType, QueryNextSequenceReceiveRequest, QueryNextSequenceReceiveRequestSDKType, QueryNextSequenceReceiveResponse, QueryNextSequenceReceiveResponseSDKType } from "./query.js"; +import { QueryChannelRequest, QueryChannelRequestSDKType, QueryChannelResponse, QueryChannelResponseSDKType, QueryChannelsRequest, QueryChannelsRequestSDKType, QueryChannelsResponse, QueryChannelsResponseSDKType, QueryConnectionChannelsRequest, QueryConnectionChannelsRequestSDKType, QueryConnectionChannelsResponse, QueryConnectionChannelsResponseSDKType, QueryChannelClientStateRequest, QueryChannelClientStateRequestSDKType, QueryChannelClientStateResponse, QueryChannelClientStateResponseSDKType, QueryChannelConsensusStateRequest, QueryChannelConsensusStateRequestSDKType, QueryChannelConsensusStateResponse, QueryChannelConsensusStateResponseSDKType, QueryPacketCommitmentRequest, QueryPacketCommitmentRequestSDKType, QueryPacketCommitmentResponse, QueryPacketCommitmentResponseSDKType, QueryPacketCommitmentsRequest, QueryPacketCommitmentsRequestSDKType, QueryPacketCommitmentsResponse, QueryPacketCommitmentsResponseSDKType, QueryPacketReceiptRequest, QueryPacketReceiptRequestSDKType, QueryPacketReceiptResponse, QueryPacketReceiptResponseSDKType, QueryPacketAcknowledgementRequest, QueryPacketAcknowledgementRequestSDKType, QueryPacketAcknowledgementResponse, QueryPacketAcknowledgementResponseSDKType, QueryPacketAcknowledgementsRequest, QueryPacketAcknowledgementsRequestSDKType, QueryPacketAcknowledgementsResponse, QueryPacketAcknowledgementsResponseSDKType, QueryUnreceivedPacketsRequest, QueryUnreceivedPacketsRequestSDKType, QueryUnreceivedPacketsResponse, QueryUnreceivedPacketsResponseSDKType, QueryUnreceivedAcksRequest, QueryUnreceivedAcksRequestSDKType, QueryUnreceivedAcksResponse, QueryUnreceivedAcksResponseSDKType, QueryNextSequenceReceiveRequest, QueryNextSequenceReceiveRequestSDKType, QueryNextSequenceReceiveResponse, QueryNextSequenceReceiveResponseSDKType } from "./query"; export class LCDQueryClient { req: LCDClient; constructor({ @@ -34,7 +34,7 @@ export class LCDQueryClient { } /* Channels queries all the IBC channels of a chain. */ async channels(params: QueryChannelsRequest = { - pagination: PageRequest.fromPartial({}) + pagination: undefined }): Promise<QueryChannelsResponseSDKType> { const options: any = { params: {} diff --git a/__fixtures__/v-next/outputv4/ibc/core/channel/v1/query.rpc.Query.ts b/__fixtures__/v-next/outputv4/ibc/core/channel/v1/query.rpc.Query.ts index 2b1d8d73fd..d3e712f5fc 100644 --- a/__fixtures__/v-next/outputv4/ibc/core/channel/v1/query.rpc.Query.ts +++ b/__fixtures__/v-next/outputv4/ibc/core/channel/v1/query.rpc.Query.ts @@ -1,11 +1,11 @@ -import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../../../cosmos/base/query/v1beta1/pagination.js"; -import { Channel, ChannelSDKType, IdentifiedChannel, IdentifiedChannelSDKType, PacketState, PacketStateSDKType } from "./channel.js"; -import { Height, HeightSDKType, IdentifiedClientState, IdentifiedClientStateSDKType } from "../../client/v1/client.js"; -import { Any, AnySDKType } from "../../../../google/protobuf/any.js"; -import { Rpc } from "../../../../helpers.js"; -import { BinaryReader } from "../../../../binary.js"; +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../../../cosmos/base/query/v1beta1/pagination"; +import { Channel, ChannelSDKType, IdentifiedChannel, IdentifiedChannelSDKType, PacketState, PacketStateSDKType } from "./channel"; +import { Height, HeightSDKType, IdentifiedClientState, IdentifiedClientStateSDKType } from "../../client/v1/client"; +import { Any, AnySDKType } from "../../../../google/protobuf/any"; +import { Rpc } from "../../../../helpers"; +import { BinaryReader } from "../../../../binary"; import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; -import { QueryChannelRequest, QueryChannelRequestSDKType, QueryChannelResponse, QueryChannelResponseSDKType, QueryChannelsRequest, QueryChannelsRequestSDKType, QueryChannelsResponse, QueryChannelsResponseSDKType, QueryConnectionChannelsRequest, QueryConnectionChannelsRequestSDKType, QueryConnectionChannelsResponse, QueryConnectionChannelsResponseSDKType, QueryChannelClientStateRequest, QueryChannelClientStateRequestSDKType, QueryChannelClientStateResponse, QueryChannelClientStateResponseSDKType, QueryChannelConsensusStateRequest, QueryChannelConsensusStateRequestSDKType, QueryChannelConsensusStateResponse, QueryChannelConsensusStateResponseSDKType, QueryPacketCommitmentRequest, QueryPacketCommitmentRequestSDKType, QueryPacketCommitmentResponse, QueryPacketCommitmentResponseSDKType, QueryPacketCommitmentsRequest, QueryPacketCommitmentsRequestSDKType, QueryPacketCommitmentsResponse, QueryPacketCommitmentsResponseSDKType, QueryPacketReceiptRequest, QueryPacketReceiptRequestSDKType, QueryPacketReceiptResponse, QueryPacketReceiptResponseSDKType, QueryPacketAcknowledgementRequest, QueryPacketAcknowledgementRequestSDKType, QueryPacketAcknowledgementResponse, QueryPacketAcknowledgementResponseSDKType, QueryPacketAcknowledgementsRequest, QueryPacketAcknowledgementsRequestSDKType, QueryPacketAcknowledgementsResponse, QueryPacketAcknowledgementsResponseSDKType, QueryUnreceivedPacketsRequest, QueryUnreceivedPacketsRequestSDKType, QueryUnreceivedPacketsResponse, QueryUnreceivedPacketsResponseSDKType, QueryUnreceivedAcksRequest, QueryUnreceivedAcksRequestSDKType, QueryUnreceivedAcksResponse, QueryUnreceivedAcksResponseSDKType, QueryNextSequenceReceiveRequest, QueryNextSequenceReceiveRequestSDKType, QueryNextSequenceReceiveResponse, QueryNextSequenceReceiveResponseSDKType } from "./query.js"; +import { QueryChannelRequest, QueryChannelRequestSDKType, QueryChannelResponse, QueryChannelResponseSDKType, QueryChannelsRequest, QueryChannelsRequestSDKType, QueryChannelsResponse, QueryChannelsResponseSDKType, QueryConnectionChannelsRequest, QueryConnectionChannelsRequestSDKType, QueryConnectionChannelsResponse, QueryConnectionChannelsResponseSDKType, QueryChannelClientStateRequest, QueryChannelClientStateRequestSDKType, QueryChannelClientStateResponse, QueryChannelClientStateResponseSDKType, QueryChannelConsensusStateRequest, QueryChannelConsensusStateRequestSDKType, QueryChannelConsensusStateResponse, QueryChannelConsensusStateResponseSDKType, QueryPacketCommitmentRequest, QueryPacketCommitmentRequestSDKType, QueryPacketCommitmentResponse, QueryPacketCommitmentResponseSDKType, QueryPacketCommitmentsRequest, QueryPacketCommitmentsRequestSDKType, QueryPacketCommitmentsResponse, QueryPacketCommitmentsResponseSDKType, QueryPacketReceiptRequest, QueryPacketReceiptRequestSDKType, QueryPacketReceiptResponse, QueryPacketReceiptResponseSDKType, QueryPacketAcknowledgementRequest, QueryPacketAcknowledgementRequestSDKType, QueryPacketAcknowledgementResponse, QueryPacketAcknowledgementResponseSDKType, QueryPacketAcknowledgementsRequest, QueryPacketAcknowledgementsRequestSDKType, QueryPacketAcknowledgementsResponse, QueryPacketAcknowledgementsResponseSDKType, QueryUnreceivedPacketsRequest, QueryUnreceivedPacketsRequestSDKType, QueryUnreceivedPacketsResponse, QueryUnreceivedPacketsResponseSDKType, QueryUnreceivedAcksRequest, QueryUnreceivedAcksRequestSDKType, QueryUnreceivedAcksResponse, QueryUnreceivedAcksResponseSDKType, QueryNextSequenceReceiveRequest, QueryNextSequenceReceiveRequestSDKType, QueryNextSequenceReceiveResponse, QueryNextSequenceReceiveResponseSDKType, ReactiveQueryChannelRequest, ReactiveQueryChannelsRequest, ReactiveQueryConnectionChannelsRequest, ReactiveQueryChannelClientStateRequest, ReactiveQueryChannelConsensusStateRequest, ReactiveQueryPacketCommitmentRequest, ReactiveQueryPacketCommitmentsRequest, ReactiveQueryPacketReceiptRequest, ReactiveQueryPacketAcknowledgementRequest, ReactiveQueryPacketAcknowledgementsRequest, ReactiveQueryUnreceivedPacketsRequest, ReactiveQueryUnreceivedAcksRequest, ReactiveQueryNextSequenceReceiveRequest } from "./query"; /** Query provides defines the gRPC querier service */ export interface Query { /** Channel queries an IBC Channel. */ @@ -83,7 +83,7 @@ export class QueryClientImpl implements Query { return promise.then(data => QueryChannelResponse.decode(new BinaryReader(data))); } channels(request: QueryChannelsRequest = { - pagination: PageRequest.fromPartial({}) + pagination: undefined }): Promise<QueryChannelsResponse> { const data = QueryChannelsRequest.encode(request).finish(); const promise = this.rpc.request("ibc.core.channel.v1.Query", "Channels", data); diff --git a/__fixtures__/v-next/outputv4/ibc/core/channel/v1/query.ts b/__fixtures__/v-next/outputv4/ibc/core/channel/v1/query.ts index 60d1f026a8..47123e9594 100644 --- a/__fixtures__/v-next/outputv4/ibc/core/channel/v1/query.ts +++ b/__fixtures__/v-next/outputv4/ibc/core/channel/v1/query.ts @@ -1,10 +1,11 @@ -import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../../../cosmos/base/query/v1beta1/pagination.js"; -import { Channel, ChannelSDKType, IdentifiedChannel, IdentifiedChannelSDKType, PacketState, PacketStateSDKType } from "./channel.js"; -import { Height, HeightSDKType, IdentifiedClientState, IdentifiedClientStateSDKType } from "../../client/v1/client.js"; -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 { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../../../cosmos/base/query/v1beta1/pagination"; +import { Channel, ChannelSDKType, IdentifiedChannel, IdentifiedChannelSDKType, PacketState, PacketStateSDKType } from "./channel"; +import { Height, HeightSDKType, IdentifiedClientState, IdentifiedClientStateSDKType } from "../../client/v1/client"; +import { Any, AnySDKType } from "../../../../google/protobuf/any"; +import { BinaryReader, BinaryWriter } from "../../../../binary"; +import { isSet, DeepPartial, bytesFromBase64, base64FromBytes } from "../../../../helpers"; +import { JsonSafe } from "../../../../json-safe"; +import { ComputedRef } from "vue"; export const protobufPackage = "ibc.core.channel.v1"; /** QueryChannelRequest is the request type for the Query/Channel RPC method */ export interface QueryChannelRequest { @@ -13,6 +14,10 @@ export interface QueryChannelRequest { /** channel unique identifier */ channelId: string; } +export interface ReactiveQueryChannelRequest { + portId: ComputedRef<string>; + channelId: ComputedRef<string>; +} export interface QueryChannelRequestProtoMsg { typeUrl: "/ibc.core.channel.v1.QueryChannelRequest"; value: Uint8Array; @@ -35,6 +40,11 @@ export interface QueryChannelResponse { /** height at which the proof was retrieved */ proofHeight: Height; } +export interface ReactiveQueryChannelResponse { + channel?: ComputedRef<Channel>; + proof: ComputedRef<Uint8Array>; + proofHeight: ComputedRef<Height>; +} export interface QueryChannelResponseProtoMsg { typeUrl: "/ibc.core.channel.v1.QueryChannelResponse"; value: Uint8Array; @@ -54,6 +64,9 @@ export interface QueryChannelsRequest { /** pagination request */ pagination?: PageRequest; } +export interface ReactiveQueryChannelsRequest { + pagination?: ComputedRef<PageRequest>; +} export interface QueryChannelsRequestProtoMsg { typeUrl: "/ibc.core.channel.v1.QueryChannelsRequest"; value: Uint8Array; @@ -71,6 +84,11 @@ export interface QueryChannelsResponse { /** query block height */ height: Height; } +export interface ReactiveQueryChannelsResponse { + channels: ComputedRef<IdentifiedChannel[]>; + pagination?: ComputedRef<PageResponse>; + height: ComputedRef<Height>; +} export interface QueryChannelsResponseProtoMsg { typeUrl: "/ibc.core.channel.v1.QueryChannelsResponse"; value: Uint8Array; @@ -91,6 +109,10 @@ export interface QueryConnectionChannelsRequest { /** pagination request */ pagination?: PageRequest; } +export interface ReactiveQueryConnectionChannelsRequest { + connection: ComputedRef<string>; + pagination?: ComputedRef<PageRequest>; +} export interface QueryConnectionChannelsRequestProtoMsg { typeUrl: "/ibc.core.channel.v1.QueryConnectionChannelsRequest"; value: Uint8Array; @@ -115,6 +137,11 @@ export interface QueryConnectionChannelsResponse { /** query block height */ height: Height; } +export interface ReactiveQueryConnectionChannelsResponse { + channels: ComputedRef<IdentifiedChannel[]>; + pagination?: ComputedRef<PageResponse>; + height: ComputedRef<Height>; +} export interface QueryConnectionChannelsResponseProtoMsg { typeUrl: "/ibc.core.channel.v1.QueryConnectionChannelsResponse"; value: Uint8Array; @@ -138,6 +165,10 @@ export interface QueryChannelClientStateRequest { /** channel unique identifier */ channelId: string; } +export interface ReactiveQueryChannelClientStateRequest { + portId: ComputedRef<string>; + channelId: ComputedRef<string>; +} export interface QueryChannelClientStateRequestProtoMsg { typeUrl: "/ibc.core.channel.v1.QueryChannelClientStateRequest"; value: Uint8Array; @@ -162,6 +193,11 @@ export interface QueryChannelClientStateResponse { /** height at which the proof was retrieved */ proofHeight: Height; } +export interface ReactiveQueryChannelClientStateResponse { + identifiedClientState?: ComputedRef<IdentifiedClientState>; + proof: ComputedRef<Uint8Array>; + proofHeight: ComputedRef<Height>; +} export interface QueryChannelClientStateResponseProtoMsg { typeUrl: "/ibc.core.channel.v1.QueryChannelClientStateResponse"; value: Uint8Array; @@ -189,6 +225,12 @@ export interface QueryChannelConsensusStateRequest { /** revision height of the consensus state */ revisionHeight: bigint; } +export interface ReactiveQueryChannelConsensusStateRequest { + portId: ComputedRef<string>; + channelId: ComputedRef<string>; + revisionNumber: ComputedRef<bigint>; + revisionHeight: ComputedRef<bigint>; +} export interface QueryChannelConsensusStateRequestProtoMsg { typeUrl: "/ibc.core.channel.v1.QueryChannelConsensusStateRequest"; value: Uint8Array; @@ -217,6 +259,12 @@ export interface QueryChannelConsensusStateResponse { /** height at which the proof was retrieved */ proofHeight: Height; } +export interface ReactiveQueryChannelConsensusStateResponse { + consensusState?: ComputedRef<Any>; + clientId: ComputedRef<string>; + proof: ComputedRef<Uint8Array>; + proofHeight: ComputedRef<Height>; +} export interface QueryChannelConsensusStateResponseProtoMsg { typeUrl: "/ibc.core.channel.v1.QueryChannelConsensusStateResponse"; value: Uint8Array; @@ -243,6 +291,11 @@ export interface QueryPacketCommitmentRequest { /** packet sequence */ sequence: bigint; } +export interface ReactiveQueryPacketCommitmentRequest { + portId: ComputedRef<string>; + channelId: ComputedRef<string>; + sequence: ComputedRef<bigint>; +} export interface QueryPacketCommitmentRequestProtoMsg { typeUrl: "/ibc.core.channel.v1.QueryPacketCommitmentRequest"; value: Uint8Array; @@ -269,6 +322,11 @@ export interface QueryPacketCommitmentResponse { /** height at which the proof was retrieved */ proofHeight: Height; } +export interface ReactiveQueryPacketCommitmentResponse { + commitment: ComputedRef<Uint8Array>; + proof: ComputedRef<Uint8Array>; + proofHeight: ComputedRef<Height>; +} export interface QueryPacketCommitmentResponseProtoMsg { typeUrl: "/ibc.core.channel.v1.QueryPacketCommitmentResponse"; value: Uint8Array; @@ -295,6 +353,11 @@ export interface QueryPacketCommitmentsRequest { /** pagination request */ pagination?: PageRequest; } +export interface ReactiveQueryPacketCommitmentsRequest { + portId: ComputedRef<string>; + channelId: ComputedRef<string>; + pagination?: ComputedRef<PageRequest>; +} export interface QueryPacketCommitmentsRequestProtoMsg { typeUrl: "/ibc.core.channel.v1.QueryPacketCommitmentsRequest"; value: Uint8Array; @@ -319,6 +382,11 @@ export interface QueryPacketCommitmentsResponse { /** query block height */ height: Height; } +export interface ReactiveQueryPacketCommitmentsResponse { + commitments: ComputedRef<PacketState[]>; + pagination?: ComputedRef<PageResponse>; + height: ComputedRef<Height>; +} export interface QueryPacketCommitmentsResponseProtoMsg { typeUrl: "/ibc.core.channel.v1.QueryPacketCommitmentsResponse"; value: Uint8Array; @@ -344,6 +412,11 @@ export interface QueryPacketReceiptRequest { /** packet sequence */ sequence: bigint; } +export interface ReactiveQueryPacketReceiptRequest { + portId: ComputedRef<string>; + channelId: ComputedRef<string>; + sequence: ComputedRef<bigint>; +} export interface QueryPacketReceiptRequestProtoMsg { typeUrl: "/ibc.core.channel.v1.QueryPacketReceiptRequest"; value: Uint8Array; @@ -370,6 +443,11 @@ export interface QueryPacketReceiptResponse { /** height at which the proof was retrieved */ proofHeight: Height; } +export interface ReactiveQueryPacketReceiptResponse { + received: ComputedRef<boolean>; + proof: ComputedRef<Uint8Array>; + proofHeight: ComputedRef<Height>; +} export interface QueryPacketReceiptResponseProtoMsg { typeUrl: "/ibc.core.channel.v1.QueryPacketReceiptResponse"; value: Uint8Array; @@ -396,6 +474,11 @@ export interface QueryPacketAcknowledgementRequest { /** packet sequence */ sequence: bigint; } +export interface ReactiveQueryPacketAcknowledgementRequest { + portId: ComputedRef<string>; + channelId: ComputedRef<string>; + sequence: ComputedRef<bigint>; +} export interface QueryPacketAcknowledgementRequestProtoMsg { typeUrl: "/ibc.core.channel.v1.QueryPacketAcknowledgementRequest"; value: Uint8Array; @@ -422,6 +505,11 @@ export interface QueryPacketAcknowledgementResponse { /** height at which the proof was retrieved */ proofHeight: Height; } +export interface ReactiveQueryPacketAcknowledgementResponse { + acknowledgement: ComputedRef<Uint8Array>; + proof: ComputedRef<Uint8Array>; + proofHeight: ComputedRef<Height>; +} export interface QueryPacketAcknowledgementResponseProtoMsg { typeUrl: "/ibc.core.channel.v1.QueryPacketAcknowledgementResponse"; value: Uint8Array; @@ -450,6 +538,12 @@ export interface QueryPacketAcknowledgementsRequest { /** list of packet sequences */ packetCommitmentSequences: bigint[]; } +export interface ReactiveQueryPacketAcknowledgementsRequest { + portId: ComputedRef<string>; + channelId: ComputedRef<string>; + pagination?: ComputedRef<PageRequest>; + packetCommitmentSequences: ComputedRef<bigint[]>; +} export interface QueryPacketAcknowledgementsRequestProtoMsg { typeUrl: "/ibc.core.channel.v1.QueryPacketAcknowledgementsRequest"; value: Uint8Array; @@ -475,6 +569,11 @@ export interface QueryPacketAcknowledgementsResponse { /** query block height */ height: Height; } +export interface ReactiveQueryPacketAcknowledgementsResponse { + acknowledgements: ComputedRef<PacketState[]>; + pagination?: ComputedRef<PageResponse>; + height: ComputedRef<Height>; +} export interface QueryPacketAcknowledgementsResponseProtoMsg { typeUrl: "/ibc.core.channel.v1.QueryPacketAcknowledgementsResponse"; value: Uint8Array; @@ -500,6 +599,11 @@ export interface QueryUnreceivedPacketsRequest { /** list of packet sequences */ packetCommitmentSequences: bigint[]; } +export interface ReactiveQueryUnreceivedPacketsRequest { + portId: ComputedRef<string>; + channelId: ComputedRef<string>; + packetCommitmentSequences: ComputedRef<bigint[]>; +} export interface QueryUnreceivedPacketsRequestProtoMsg { typeUrl: "/ibc.core.channel.v1.QueryUnreceivedPacketsRequest"; value: Uint8Array; @@ -523,6 +627,10 @@ export interface QueryUnreceivedPacketsResponse { /** query block height */ height: Height; } +export interface ReactiveQueryUnreceivedPacketsResponse { + sequences: ComputedRef<bigint[]>; + height: ComputedRef<Height>; +} export interface QueryUnreceivedPacketsResponseProtoMsg { typeUrl: "/ibc.core.channel.v1.QueryUnreceivedPacketsResponse"; value: Uint8Array; @@ -547,6 +655,11 @@ export interface QueryUnreceivedAcksRequest { /** list of acknowledgement sequences */ packetAckSequences: bigint[]; } +export interface ReactiveQueryUnreceivedAcksRequest { + portId: ComputedRef<string>; + channelId: ComputedRef<string>; + packetAckSequences: ComputedRef<bigint[]>; +} export interface QueryUnreceivedAcksRequestProtoMsg { typeUrl: "/ibc.core.channel.v1.QueryUnreceivedAcksRequest"; value: Uint8Array; @@ -570,6 +683,10 @@ export interface QueryUnreceivedAcksResponse { /** query block height */ height: Height; } +export interface ReactiveQueryUnreceivedAcksResponse { + sequences: ComputedRef<bigint[]>; + height: ComputedRef<Height>; +} export interface QueryUnreceivedAcksResponseProtoMsg { typeUrl: "/ibc.core.channel.v1.QueryUnreceivedAcksResponse"; value: Uint8Array; @@ -592,6 +709,10 @@ export interface QueryNextSequenceReceiveRequest { /** channel unique identifier */ channelId: string; } +export interface ReactiveQueryNextSequenceReceiveRequest { + portId: ComputedRef<string>; + channelId: ComputedRef<string>; +} export interface QueryNextSequenceReceiveRequestProtoMsg { typeUrl: "/ibc.core.channel.v1.QueryNextSequenceReceiveRequest"; value: Uint8Array; @@ -616,6 +737,11 @@ export interface QueryNextSequenceReceiveResponse { /** height at which the proof was retrieved */ proofHeight: Height; } +export interface ReactiveQueryNextSequenceReceiveResponse { + nextSequenceReceive: ComputedRef<bigint>; + proof: ComputedRef<Uint8Array>; + proofHeight: ComputedRef<Height>; +} export interface QueryNextSequenceReceiveResponseProtoMsg { typeUrl: "/ibc.core.channel.v1.QueryNextSequenceReceiveResponse"; value: Uint8Array; @@ -638,10 +764,10 @@ function createBaseQueryChannelRequest(): QueryChannelRequest { export const QueryChannelRequest = { typeUrl: "/ibc.core.channel.v1.QueryChannelRequest", encode(message: QueryChannelRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.portId !== undefined) { + if (message.portId !== "") { writer.uint32(10).string(message.portId); } - if (message.channelId !== undefined) { + if (message.channelId !== "") { writer.uint32(18).string(message.channelId); } return writer; @@ -667,10 +793,10 @@ export const QueryChannelRequest = { return message; }, fromJSON(object: any): QueryChannelRequest { - const obj = createBaseQueryChannelRequest(); - if (isSet(object.portId)) obj.portId = String(object.portId); - if (isSet(object.channelId)) obj.channelId = String(object.channelId); - return obj; + return { + portId: isSet(object.portId) ? String(object.portId) : "", + channelId: isSet(object.channelId) ? String(object.channelId) : "" + }; }, toJSON(message: QueryChannelRequest): JsonSafe<QueryChannelRequest> { const obj: any = {}; @@ -785,11 +911,11 @@ export const QueryChannelResponse = { return message; }, fromJSON(object: any): QueryChannelResponse { - const obj = createBaseQueryChannelResponse(); - if (isSet(object.channel)) obj.channel = Channel.fromJSON(object.channel); - if (isSet(object.proof)) obj.proof = bytesFromBase64(object.proof); - if (isSet(object.proofHeight)) obj.proofHeight = Height.fromJSON(object.proofHeight); - return obj; + return { + channel: isSet(object.channel) ? Channel.fromJSON(object.channel) : undefined, + proof: isSet(object.proof) ? bytesFromBase64(object.proof) : new Uint8Array(), + proofHeight: isSet(object.proofHeight) ? Height.fromJSON(object.proofHeight) : undefined + }; }, toJSON(message: QueryChannelResponse): JsonSafe<QueryChannelResponse> { const obj: any = {}; @@ -800,13 +926,9 @@ export const QueryChannelResponse = { }, fromPartial(object: DeepPartial<QueryChannelResponse>): QueryChannelResponse { const message = createBaseQueryChannelResponse(); - if (object.channel !== undefined && object.channel !== null) { - message.channel = Channel.fromPartial(object.channel); - } + message.channel = object.channel !== undefined && object.channel !== null ? Channel.fromPartial(object.channel) : undefined; message.proof = object.proof ?? new Uint8Array(); - if (object.proofHeight !== undefined && object.proofHeight !== null) { - message.proofHeight = Height.fromPartial(object.proofHeight); - } + message.proofHeight = object.proofHeight !== undefined && object.proofHeight !== null ? Height.fromPartial(object.proofHeight) : undefined; return message; }, fromSDK(object: QueryChannelResponseSDKType): QueryChannelResponse { @@ -903,9 +1025,9 @@ export const QueryChannelsRequest = { return message; }, fromJSON(object: any): QueryChannelsRequest { - const obj = createBaseQueryChannelsRequest(); - if (isSet(object.pagination)) obj.pagination = PageRequest.fromJSON(object.pagination); - return obj; + return { + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined + }; }, toJSON(message: QueryChannelsRequest): JsonSafe<QueryChannelsRequest> { const obj: any = {}; @@ -914,9 +1036,7 @@ export const QueryChannelsRequest = { }, fromPartial(object: DeepPartial<QueryChannelsRequest>): QueryChannelsRequest { const message = createBaseQueryChannelsRequest(); - if (object.pagination !== undefined && object.pagination !== null) { - message.pagination = PageRequest.fromPartial(object.pagination); - } + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageRequest.fromPartial(object.pagination) : undefined; return message; }, fromSDK(object: QueryChannelsRequestSDKType): QueryChannelsRequest { @@ -1013,11 +1133,11 @@ export const QueryChannelsResponse = { return message; }, fromJSON(object: any): QueryChannelsResponse { - const obj = createBaseQueryChannelsResponse(); - if (Array.isArray(object?.channels)) obj.channels = object.channels.map((e: any) => IdentifiedChannel.fromJSON(e)); - if (isSet(object.pagination)) obj.pagination = PageResponse.fromJSON(object.pagination); - if (isSet(object.height)) obj.height = Height.fromJSON(object.height); - return obj; + return { + channels: Array.isArray(object?.channels) ? object.channels.map((e: any) => IdentifiedChannel.fromJSON(e)) : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + height: isSet(object.height) ? Height.fromJSON(object.height) : undefined + }; }, toJSON(message: QueryChannelsResponse): JsonSafe<QueryChannelsResponse> { const obj: any = {}; @@ -1033,12 +1153,8 @@ export const QueryChannelsResponse = { fromPartial(object: DeepPartial<QueryChannelsResponse>): QueryChannelsResponse { const message = createBaseQueryChannelsResponse(); message.channels = object.channels?.map(e => IdentifiedChannel.fromPartial(e)) || []; - if (object.pagination !== undefined && object.pagination !== null) { - message.pagination = PageResponse.fromPartial(object.pagination); - } - if (object.height !== undefined && object.height !== null) { - message.height = Height.fromPartial(object.height); - } + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageResponse.fromPartial(object.pagination) : undefined; + message.height = object.height !== undefined && object.height !== null ? Height.fromPartial(object.height) : undefined; return message; }, fromSDK(object: QueryChannelsResponseSDKType): QueryChannelsResponse { @@ -1119,7 +1235,7 @@ function createBaseQueryConnectionChannelsRequest(): QueryConnectionChannelsRequ export const QueryConnectionChannelsRequest = { typeUrl: "/ibc.core.channel.v1.QueryConnectionChannelsRequest", encode(message: QueryConnectionChannelsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.connection !== undefined) { + if (message.connection !== "") { writer.uint32(10).string(message.connection); } if (message.pagination !== undefined) { @@ -1148,10 +1264,10 @@ export const QueryConnectionChannelsRequest = { return message; }, fromJSON(object: any): QueryConnectionChannelsRequest { - const obj = createBaseQueryConnectionChannelsRequest(); - if (isSet(object.connection)) obj.connection = String(object.connection); - if (isSet(object.pagination)) obj.pagination = PageRequest.fromJSON(object.pagination); - return obj; + return { + connection: isSet(object.connection) ? String(object.connection) : "", + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined + }; }, toJSON(message: QueryConnectionChannelsRequest): JsonSafe<QueryConnectionChannelsRequest> { const obj: any = {}; @@ -1162,9 +1278,7 @@ export const QueryConnectionChannelsRequest = { fromPartial(object: DeepPartial<QueryConnectionChannelsRequest>): QueryConnectionChannelsRequest { const message = createBaseQueryConnectionChannelsRequest(); message.connection = object.connection ?? ""; - if (object.pagination !== undefined && object.pagination !== null) { - message.pagination = PageRequest.fromPartial(object.pagination); - } + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageRequest.fromPartial(object.pagination) : undefined; return message; }, fromSDK(object: QueryConnectionChannelsRequestSDKType): QueryConnectionChannelsRequest { @@ -1268,11 +1382,11 @@ export const QueryConnectionChannelsResponse = { return message; }, fromJSON(object: any): QueryConnectionChannelsResponse { - const obj = createBaseQueryConnectionChannelsResponse(); - if (Array.isArray(object?.channels)) obj.channels = object.channels.map((e: any) => IdentifiedChannel.fromJSON(e)); - if (isSet(object.pagination)) obj.pagination = PageResponse.fromJSON(object.pagination); - if (isSet(object.height)) obj.height = Height.fromJSON(object.height); - return obj; + return { + channels: Array.isArray(object?.channels) ? object.channels.map((e: any) => IdentifiedChannel.fromJSON(e)) : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + height: isSet(object.height) ? Height.fromJSON(object.height) : undefined + }; }, toJSON(message: QueryConnectionChannelsResponse): JsonSafe<QueryConnectionChannelsResponse> { const obj: any = {}; @@ -1288,12 +1402,8 @@ export const QueryConnectionChannelsResponse = { fromPartial(object: DeepPartial<QueryConnectionChannelsResponse>): QueryConnectionChannelsResponse { const message = createBaseQueryConnectionChannelsResponse(); message.channels = object.channels?.map(e => IdentifiedChannel.fromPartial(e)) || []; - if (object.pagination !== undefined && object.pagination !== null) { - message.pagination = PageResponse.fromPartial(object.pagination); - } - if (object.height !== undefined && object.height !== null) { - message.height = Height.fromPartial(object.height); - } + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageResponse.fromPartial(object.pagination) : undefined; + message.height = object.height !== undefined && object.height !== null ? Height.fromPartial(object.height) : undefined; return message; }, fromSDK(object: QueryConnectionChannelsResponseSDKType): QueryConnectionChannelsResponse { @@ -1374,10 +1484,10 @@ function createBaseQueryChannelClientStateRequest(): QueryChannelClientStateRequ export const QueryChannelClientStateRequest = { typeUrl: "/ibc.core.channel.v1.QueryChannelClientStateRequest", encode(message: QueryChannelClientStateRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.portId !== undefined) { + if (message.portId !== "") { writer.uint32(10).string(message.portId); } - if (message.channelId !== undefined) { + if (message.channelId !== "") { writer.uint32(18).string(message.channelId); } return writer; @@ -1403,10 +1513,10 @@ export const QueryChannelClientStateRequest = { return message; }, fromJSON(object: any): QueryChannelClientStateRequest { - const obj = createBaseQueryChannelClientStateRequest(); - if (isSet(object.portId)) obj.portId = String(object.portId); - if (isSet(object.channelId)) obj.channelId = String(object.channelId); - return obj; + return { + portId: isSet(object.portId) ? String(object.portId) : "", + channelId: isSet(object.channelId) ? String(object.channelId) : "" + }; }, toJSON(message: QueryChannelClientStateRequest): JsonSafe<QueryChannelClientStateRequest> { const obj: any = {}; @@ -1521,11 +1631,11 @@ export const QueryChannelClientStateResponse = { return message; }, fromJSON(object: any): QueryChannelClientStateResponse { - const obj = createBaseQueryChannelClientStateResponse(); - if (isSet(object.identifiedClientState)) obj.identifiedClientState = IdentifiedClientState.fromJSON(object.identifiedClientState); - if (isSet(object.proof)) obj.proof = bytesFromBase64(object.proof); - if (isSet(object.proofHeight)) obj.proofHeight = Height.fromJSON(object.proofHeight); - return obj; + return { + identifiedClientState: isSet(object.identifiedClientState) ? IdentifiedClientState.fromJSON(object.identifiedClientState) : undefined, + proof: isSet(object.proof) ? bytesFromBase64(object.proof) : new Uint8Array(), + proofHeight: isSet(object.proofHeight) ? Height.fromJSON(object.proofHeight) : undefined + }; }, toJSON(message: QueryChannelClientStateResponse): JsonSafe<QueryChannelClientStateResponse> { const obj: any = {}; @@ -1536,13 +1646,9 @@ export const QueryChannelClientStateResponse = { }, fromPartial(object: DeepPartial<QueryChannelClientStateResponse>): QueryChannelClientStateResponse { const message = createBaseQueryChannelClientStateResponse(); - if (object.identifiedClientState !== undefined && object.identifiedClientState !== null) { - message.identifiedClientState = IdentifiedClientState.fromPartial(object.identifiedClientState); - } + message.identifiedClientState = object.identifiedClientState !== undefined && object.identifiedClientState !== null ? IdentifiedClientState.fromPartial(object.identifiedClientState) : undefined; message.proof = object.proof ?? new Uint8Array(); - if (object.proofHeight !== undefined && object.proofHeight !== null) { - message.proofHeight = Height.fromPartial(object.proofHeight); - } + message.proofHeight = object.proofHeight !== undefined && object.proofHeight !== null ? Height.fromPartial(object.proofHeight) : undefined; return message; }, fromSDK(object: QueryChannelClientStateResponseSDKType): QueryChannelClientStateResponse { @@ -1619,16 +1725,16 @@ function createBaseQueryChannelConsensusStateRequest(): QueryChannelConsensusSta export const QueryChannelConsensusStateRequest = { typeUrl: "/ibc.core.channel.v1.QueryChannelConsensusStateRequest", encode(message: QueryChannelConsensusStateRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.portId !== undefined) { + if (message.portId !== "") { writer.uint32(10).string(message.portId); } - if (message.channelId !== undefined) { + if (message.channelId !== "") { writer.uint32(18).string(message.channelId); } - if (message.revisionNumber !== undefined) { + if (message.revisionNumber !== BigInt(0)) { writer.uint32(24).uint64(message.revisionNumber); } - if (message.revisionHeight !== undefined) { + if (message.revisionHeight !== BigInt(0)) { writer.uint32(32).uint64(message.revisionHeight); } return writer; @@ -1660,12 +1766,12 @@ export const QueryChannelConsensusStateRequest = { return message; }, fromJSON(object: any): QueryChannelConsensusStateRequest { - const obj = createBaseQueryChannelConsensusStateRequest(); - if (isSet(object.portId)) obj.portId = String(object.portId); - if (isSet(object.channelId)) obj.channelId = String(object.channelId); - if (isSet(object.revisionNumber)) obj.revisionNumber = BigInt(object.revisionNumber.toString()); - if (isSet(object.revisionHeight)) obj.revisionHeight = BigInt(object.revisionHeight.toString()); - return obj; + return { + portId: isSet(object.portId) ? String(object.portId) : "", + channelId: isSet(object.channelId) ? String(object.channelId) : "", + revisionNumber: isSet(object.revisionNumber) ? BigInt(object.revisionNumber.toString()) : BigInt(0), + revisionHeight: isSet(object.revisionHeight) ? BigInt(object.revisionHeight.toString()) : BigInt(0) + }; }, toJSON(message: QueryChannelConsensusStateRequest): JsonSafe<QueryChannelConsensusStateRequest> { const obj: any = {}; @@ -1679,12 +1785,8 @@ export const QueryChannelConsensusStateRequest = { const message = createBaseQueryChannelConsensusStateRequest(); message.portId = object.portId ?? ""; message.channelId = object.channelId ?? ""; - if (object.revisionNumber !== undefined && object.revisionNumber !== null) { - message.revisionNumber = BigInt(object.revisionNumber.toString()); - } - if (object.revisionHeight !== undefined && object.revisionHeight !== null) { - message.revisionHeight = BigInt(object.revisionHeight.toString()); - } + message.revisionNumber = object.revisionNumber !== undefined && object.revisionNumber !== null ? BigInt(object.revisionNumber.toString()) : BigInt(0); + message.revisionHeight = object.revisionHeight !== undefined && object.revisionHeight !== null ? BigInt(object.revisionHeight.toString()) : BigInt(0); return message; }, fromSDK(object: QueryChannelConsensusStateRequestSDKType): QueryChannelConsensusStateRequest { @@ -1771,7 +1873,7 @@ export const QueryChannelConsensusStateResponse = { if (message.consensusState !== undefined) { Any.encode(message.consensusState, writer.uint32(10).fork()).ldelim(); } - if (message.clientId !== undefined) { + if (message.clientId !== "") { writer.uint32(18).string(message.clientId); } if (message.proof.length !== 0) { @@ -1809,12 +1911,12 @@ export const QueryChannelConsensusStateResponse = { return message; }, fromJSON(object: any): QueryChannelConsensusStateResponse { - const obj = createBaseQueryChannelConsensusStateResponse(); - if (isSet(object.consensusState)) obj.consensusState = Any.fromJSON(object.consensusState); - if (isSet(object.clientId)) obj.clientId = String(object.clientId); - if (isSet(object.proof)) obj.proof = bytesFromBase64(object.proof); - if (isSet(object.proofHeight)) obj.proofHeight = Height.fromJSON(object.proofHeight); - return obj; + return { + consensusState: isSet(object.consensusState) ? Any.fromJSON(object.consensusState) : undefined, + clientId: isSet(object.clientId) ? String(object.clientId) : "", + proof: isSet(object.proof) ? bytesFromBase64(object.proof) : new Uint8Array(), + proofHeight: isSet(object.proofHeight) ? Height.fromJSON(object.proofHeight) : undefined + }; }, toJSON(message: QueryChannelConsensusStateResponse): JsonSafe<QueryChannelConsensusStateResponse> { const obj: any = {}; @@ -1826,14 +1928,10 @@ export const QueryChannelConsensusStateResponse = { }, fromPartial(object: DeepPartial<QueryChannelConsensusStateResponse>): QueryChannelConsensusStateResponse { const message = createBaseQueryChannelConsensusStateResponse(); - if (object.consensusState !== undefined && object.consensusState !== null) { - message.consensusState = Any.fromPartial(object.consensusState); - } + message.consensusState = object.consensusState !== undefined && object.consensusState !== null ? Any.fromPartial(object.consensusState) : undefined; message.clientId = object.clientId ?? ""; message.proof = object.proof ?? new Uint8Array(); - if (object.proofHeight !== undefined && object.proofHeight !== null) { - message.proofHeight = Height.fromPartial(object.proofHeight); - } + message.proofHeight = object.proofHeight !== undefined && object.proofHeight !== null ? Height.fromPartial(object.proofHeight) : undefined; return message; }, fromSDK(object: QueryChannelConsensusStateResponseSDKType): QueryChannelConsensusStateResponse { @@ -1916,13 +2014,13 @@ function createBaseQueryPacketCommitmentRequest(): QueryPacketCommitmentRequest export const QueryPacketCommitmentRequest = { typeUrl: "/ibc.core.channel.v1.QueryPacketCommitmentRequest", encode(message: QueryPacketCommitmentRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.portId !== undefined) { + if (message.portId !== "") { writer.uint32(10).string(message.portId); } - if (message.channelId !== undefined) { + if (message.channelId !== "") { writer.uint32(18).string(message.channelId); } - if (message.sequence !== undefined) { + if (message.sequence !== BigInt(0)) { writer.uint32(24).uint64(message.sequence); } return writer; @@ -1951,11 +2049,11 @@ export const QueryPacketCommitmentRequest = { return message; }, fromJSON(object: any): QueryPacketCommitmentRequest { - const obj = createBaseQueryPacketCommitmentRequest(); - if (isSet(object.portId)) obj.portId = String(object.portId); - if (isSet(object.channelId)) obj.channelId = String(object.channelId); - if (isSet(object.sequence)) obj.sequence = BigInt(object.sequence.toString()); - return obj; + return { + portId: isSet(object.portId) ? String(object.portId) : "", + channelId: isSet(object.channelId) ? String(object.channelId) : "", + sequence: isSet(object.sequence) ? BigInt(object.sequence.toString()) : BigInt(0) + }; }, toJSON(message: QueryPacketCommitmentRequest): JsonSafe<QueryPacketCommitmentRequest> { const obj: any = {}; @@ -1968,9 +2066,7 @@ export const QueryPacketCommitmentRequest = { const message = createBaseQueryPacketCommitmentRequest(); message.portId = object.portId ?? ""; message.channelId = object.channelId ?? ""; - if (object.sequence !== undefined && object.sequence !== null) { - message.sequence = BigInt(object.sequence.toString()); - } + message.sequence = object.sequence !== undefined && object.sequence !== null ? BigInt(object.sequence.toString()) : BigInt(0); return message; }, fromSDK(object: QueryPacketCommitmentRequestSDKType): QueryPacketCommitmentRequest { @@ -2081,11 +2177,11 @@ export const QueryPacketCommitmentResponse = { return message; }, fromJSON(object: any): QueryPacketCommitmentResponse { - const obj = createBaseQueryPacketCommitmentResponse(); - if (isSet(object.commitment)) obj.commitment = bytesFromBase64(object.commitment); - if (isSet(object.proof)) obj.proof = bytesFromBase64(object.proof); - if (isSet(object.proofHeight)) obj.proofHeight = Height.fromJSON(object.proofHeight); - return obj; + return { + commitment: isSet(object.commitment) ? bytesFromBase64(object.commitment) : new Uint8Array(), + proof: isSet(object.proof) ? bytesFromBase64(object.proof) : new Uint8Array(), + proofHeight: isSet(object.proofHeight) ? Height.fromJSON(object.proofHeight) : undefined + }; }, toJSON(message: QueryPacketCommitmentResponse): JsonSafe<QueryPacketCommitmentResponse> { const obj: any = {}; @@ -2098,9 +2194,7 @@ export const QueryPacketCommitmentResponse = { const message = createBaseQueryPacketCommitmentResponse(); message.commitment = object.commitment ?? new Uint8Array(); message.proof = object.proof ?? new Uint8Array(); - if (object.proofHeight !== undefined && object.proofHeight !== null) { - message.proofHeight = Height.fromPartial(object.proofHeight); - } + message.proofHeight = object.proofHeight !== undefined && object.proofHeight !== null ? Height.fromPartial(object.proofHeight) : undefined; return message; }, fromSDK(object: QueryPacketCommitmentResponseSDKType): QueryPacketCommitmentResponse { @@ -2176,10 +2270,10 @@ function createBaseQueryPacketCommitmentsRequest(): QueryPacketCommitmentsReques export const QueryPacketCommitmentsRequest = { typeUrl: "/ibc.core.channel.v1.QueryPacketCommitmentsRequest", encode(message: QueryPacketCommitmentsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.portId !== undefined) { + if (message.portId !== "") { writer.uint32(10).string(message.portId); } - if (message.channelId !== undefined) { + if (message.channelId !== "") { writer.uint32(18).string(message.channelId); } if (message.pagination !== undefined) { @@ -2211,11 +2305,11 @@ export const QueryPacketCommitmentsRequest = { return message; }, fromJSON(object: any): QueryPacketCommitmentsRequest { - const obj = createBaseQueryPacketCommitmentsRequest(); - if (isSet(object.portId)) obj.portId = String(object.portId); - if (isSet(object.channelId)) obj.channelId = String(object.channelId); - if (isSet(object.pagination)) obj.pagination = PageRequest.fromJSON(object.pagination); - return obj; + return { + portId: isSet(object.portId) ? String(object.portId) : "", + channelId: isSet(object.channelId) ? String(object.channelId) : "", + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined + }; }, toJSON(message: QueryPacketCommitmentsRequest): JsonSafe<QueryPacketCommitmentsRequest> { const obj: any = {}; @@ -2228,9 +2322,7 @@ export const QueryPacketCommitmentsRequest = { const message = createBaseQueryPacketCommitmentsRequest(); message.portId = object.portId ?? ""; message.channelId = object.channelId ?? ""; - if (object.pagination !== undefined && object.pagination !== null) { - message.pagination = PageRequest.fromPartial(object.pagination); - } + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageRequest.fromPartial(object.pagination) : undefined; return message; }, fromSDK(object: QueryPacketCommitmentsRequestSDKType): QueryPacketCommitmentsRequest { @@ -2341,11 +2433,11 @@ export const QueryPacketCommitmentsResponse = { return message; }, fromJSON(object: any): QueryPacketCommitmentsResponse { - const obj = createBaseQueryPacketCommitmentsResponse(); - if (Array.isArray(object?.commitments)) obj.commitments = object.commitments.map((e: any) => PacketState.fromJSON(e)); - if (isSet(object.pagination)) obj.pagination = PageResponse.fromJSON(object.pagination); - if (isSet(object.height)) obj.height = Height.fromJSON(object.height); - return obj; + return { + commitments: Array.isArray(object?.commitments) ? object.commitments.map((e: any) => PacketState.fromJSON(e)) : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + height: isSet(object.height) ? Height.fromJSON(object.height) : undefined + }; }, toJSON(message: QueryPacketCommitmentsResponse): JsonSafe<QueryPacketCommitmentsResponse> { const obj: any = {}; @@ -2361,12 +2453,8 @@ export const QueryPacketCommitmentsResponse = { fromPartial(object: DeepPartial<QueryPacketCommitmentsResponse>): QueryPacketCommitmentsResponse { const message = createBaseQueryPacketCommitmentsResponse(); message.commitments = object.commitments?.map(e => PacketState.fromPartial(e)) || []; - if (object.pagination !== undefined && object.pagination !== null) { - message.pagination = PageResponse.fromPartial(object.pagination); - } - if (object.height !== undefined && object.height !== null) { - message.height = Height.fromPartial(object.height); - } + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageResponse.fromPartial(object.pagination) : undefined; + message.height = object.height !== undefined && object.height !== null ? Height.fromPartial(object.height) : undefined; return message; }, fromSDK(object: QueryPacketCommitmentsResponseSDKType): QueryPacketCommitmentsResponse { @@ -2448,13 +2536,13 @@ function createBaseQueryPacketReceiptRequest(): QueryPacketReceiptRequest { export const QueryPacketReceiptRequest = { typeUrl: "/ibc.core.channel.v1.QueryPacketReceiptRequest", encode(message: QueryPacketReceiptRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.portId !== undefined) { + if (message.portId !== "") { writer.uint32(10).string(message.portId); } - if (message.channelId !== undefined) { + if (message.channelId !== "") { writer.uint32(18).string(message.channelId); } - if (message.sequence !== undefined) { + if (message.sequence !== BigInt(0)) { writer.uint32(24).uint64(message.sequence); } return writer; @@ -2483,11 +2571,11 @@ export const QueryPacketReceiptRequest = { return message; }, fromJSON(object: any): QueryPacketReceiptRequest { - const obj = createBaseQueryPacketReceiptRequest(); - if (isSet(object.portId)) obj.portId = String(object.portId); - if (isSet(object.channelId)) obj.channelId = String(object.channelId); - if (isSet(object.sequence)) obj.sequence = BigInt(object.sequence.toString()); - return obj; + return { + portId: isSet(object.portId) ? String(object.portId) : "", + channelId: isSet(object.channelId) ? String(object.channelId) : "", + sequence: isSet(object.sequence) ? BigInt(object.sequence.toString()) : BigInt(0) + }; }, toJSON(message: QueryPacketReceiptRequest): JsonSafe<QueryPacketReceiptRequest> { const obj: any = {}; @@ -2500,9 +2588,7 @@ export const QueryPacketReceiptRequest = { const message = createBaseQueryPacketReceiptRequest(); message.portId = object.portId ?? ""; message.channelId = object.channelId ?? ""; - if (object.sequence !== undefined && object.sequence !== null) { - message.sequence = BigInt(object.sequence.toString()); - } + message.sequence = object.sequence !== undefined && object.sequence !== null ? BigInt(object.sequence.toString()) : BigInt(0); return message; }, fromSDK(object: QueryPacketReceiptRequestSDKType): QueryPacketReceiptRequest { @@ -2578,7 +2664,7 @@ function createBaseQueryPacketReceiptResponse(): QueryPacketReceiptResponse { export const QueryPacketReceiptResponse = { typeUrl: "/ibc.core.channel.v1.QueryPacketReceiptResponse", encode(message: QueryPacketReceiptResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.received !== undefined) { + if (message.received === true) { writer.uint32(16).bool(message.received); } if (message.proof.length !== 0) { @@ -2613,11 +2699,11 @@ export const QueryPacketReceiptResponse = { return message; }, fromJSON(object: any): QueryPacketReceiptResponse { - const obj = createBaseQueryPacketReceiptResponse(); - if (isSet(object.received)) obj.received = Boolean(object.received); - if (isSet(object.proof)) obj.proof = bytesFromBase64(object.proof); - if (isSet(object.proofHeight)) obj.proofHeight = Height.fromJSON(object.proofHeight); - return obj; + return { + received: isSet(object.received) ? Boolean(object.received) : false, + proof: isSet(object.proof) ? bytesFromBase64(object.proof) : new Uint8Array(), + proofHeight: isSet(object.proofHeight) ? Height.fromJSON(object.proofHeight) : undefined + }; }, toJSON(message: QueryPacketReceiptResponse): JsonSafe<QueryPacketReceiptResponse> { const obj: any = {}; @@ -2630,9 +2716,7 @@ export const QueryPacketReceiptResponse = { const message = createBaseQueryPacketReceiptResponse(); message.received = object.received ?? false; message.proof = object.proof ?? new Uint8Array(); - if (object.proofHeight !== undefined && object.proofHeight !== null) { - message.proofHeight = Height.fromPartial(object.proofHeight); - } + message.proofHeight = object.proofHeight !== undefined && object.proofHeight !== null ? Height.fromPartial(object.proofHeight) : undefined; return message; }, fromSDK(object: QueryPacketReceiptResponseSDKType): QueryPacketReceiptResponse { @@ -2708,13 +2792,13 @@ function createBaseQueryPacketAcknowledgementRequest(): QueryPacketAcknowledgeme export const QueryPacketAcknowledgementRequest = { typeUrl: "/ibc.core.channel.v1.QueryPacketAcknowledgementRequest", encode(message: QueryPacketAcknowledgementRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.portId !== undefined) { + if (message.portId !== "") { writer.uint32(10).string(message.portId); } - if (message.channelId !== undefined) { + if (message.channelId !== "") { writer.uint32(18).string(message.channelId); } - if (message.sequence !== undefined) { + if (message.sequence !== BigInt(0)) { writer.uint32(24).uint64(message.sequence); } return writer; @@ -2743,11 +2827,11 @@ export const QueryPacketAcknowledgementRequest = { return message; }, fromJSON(object: any): QueryPacketAcknowledgementRequest { - const obj = createBaseQueryPacketAcknowledgementRequest(); - if (isSet(object.portId)) obj.portId = String(object.portId); - if (isSet(object.channelId)) obj.channelId = String(object.channelId); - if (isSet(object.sequence)) obj.sequence = BigInt(object.sequence.toString()); - return obj; + return { + portId: isSet(object.portId) ? String(object.portId) : "", + channelId: isSet(object.channelId) ? String(object.channelId) : "", + sequence: isSet(object.sequence) ? BigInt(object.sequence.toString()) : BigInt(0) + }; }, toJSON(message: QueryPacketAcknowledgementRequest): JsonSafe<QueryPacketAcknowledgementRequest> { const obj: any = {}; @@ -2760,9 +2844,7 @@ export const QueryPacketAcknowledgementRequest = { const message = createBaseQueryPacketAcknowledgementRequest(); message.portId = object.portId ?? ""; message.channelId = object.channelId ?? ""; - if (object.sequence !== undefined && object.sequence !== null) { - message.sequence = BigInt(object.sequence.toString()); - } + message.sequence = object.sequence !== undefined && object.sequence !== null ? BigInt(object.sequence.toString()) : BigInt(0); return message; }, fromSDK(object: QueryPacketAcknowledgementRequestSDKType): QueryPacketAcknowledgementRequest { @@ -2873,11 +2955,11 @@ export const QueryPacketAcknowledgementResponse = { return message; }, fromJSON(object: any): QueryPacketAcknowledgementResponse { - const obj = createBaseQueryPacketAcknowledgementResponse(); - if (isSet(object.acknowledgement)) obj.acknowledgement = bytesFromBase64(object.acknowledgement); - if (isSet(object.proof)) obj.proof = bytesFromBase64(object.proof); - if (isSet(object.proofHeight)) obj.proofHeight = Height.fromJSON(object.proofHeight); - return obj; + return { + acknowledgement: isSet(object.acknowledgement) ? bytesFromBase64(object.acknowledgement) : new Uint8Array(), + proof: isSet(object.proof) ? bytesFromBase64(object.proof) : new Uint8Array(), + proofHeight: isSet(object.proofHeight) ? Height.fromJSON(object.proofHeight) : undefined + }; }, toJSON(message: QueryPacketAcknowledgementResponse): JsonSafe<QueryPacketAcknowledgementResponse> { const obj: any = {}; @@ -2890,9 +2972,7 @@ export const QueryPacketAcknowledgementResponse = { const message = createBaseQueryPacketAcknowledgementResponse(); message.acknowledgement = object.acknowledgement ?? new Uint8Array(); message.proof = object.proof ?? new Uint8Array(); - if (object.proofHeight !== undefined && object.proofHeight !== null) { - message.proofHeight = Height.fromPartial(object.proofHeight); - } + message.proofHeight = object.proofHeight !== undefined && object.proofHeight !== null ? Height.fromPartial(object.proofHeight) : undefined; return message; }, fromSDK(object: QueryPacketAcknowledgementResponseSDKType): QueryPacketAcknowledgementResponse { @@ -2969,10 +3049,10 @@ function createBaseQueryPacketAcknowledgementsRequest(): QueryPacketAcknowledgem export const QueryPacketAcknowledgementsRequest = { typeUrl: "/ibc.core.channel.v1.QueryPacketAcknowledgementsRequest", encode(message: QueryPacketAcknowledgementsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.portId !== undefined) { + if (message.portId !== "") { writer.uint32(10).string(message.portId); } - if (message.channelId !== undefined) { + if (message.channelId !== "") { writer.uint32(18).string(message.channelId); } if (message.pagination !== undefined) { @@ -3019,12 +3099,12 @@ export const QueryPacketAcknowledgementsRequest = { return message; }, fromJSON(object: any): QueryPacketAcknowledgementsRequest { - const obj = createBaseQueryPacketAcknowledgementsRequest(); - if (isSet(object.portId)) obj.portId = String(object.portId); - if (isSet(object.channelId)) obj.channelId = String(object.channelId); - if (isSet(object.pagination)) obj.pagination = PageRequest.fromJSON(object.pagination); - if (Array.isArray(object?.packetCommitmentSequences)) obj.packetCommitmentSequences = object.packetCommitmentSequences.map((e: any) => BigInt(e.toString())); - return obj; + return { + portId: isSet(object.portId) ? String(object.portId) : "", + channelId: isSet(object.channelId) ? String(object.channelId) : "", + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + packetCommitmentSequences: Array.isArray(object?.packetCommitmentSequences) ? object.packetCommitmentSequences.map((e: any) => BigInt(e.toString())) : [] + }; }, toJSON(message: QueryPacketAcknowledgementsRequest): JsonSafe<QueryPacketAcknowledgementsRequest> { const obj: any = {}; @@ -3042,9 +3122,7 @@ export const QueryPacketAcknowledgementsRequest = { const message = createBaseQueryPacketAcknowledgementsRequest(); message.portId = object.portId ?? ""; message.channelId = object.channelId ?? ""; - if (object.pagination !== undefined && object.pagination !== null) { - message.pagination = PageRequest.fromPartial(object.pagination); - } + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageRequest.fromPartial(object.pagination) : undefined; message.packetCommitmentSequences = object.packetCommitmentSequences?.map(e => BigInt(e.toString())) || []; return message; }, @@ -3169,11 +3247,11 @@ export const QueryPacketAcknowledgementsResponse = { return message; }, fromJSON(object: any): QueryPacketAcknowledgementsResponse { - const obj = createBaseQueryPacketAcknowledgementsResponse(); - if (Array.isArray(object?.acknowledgements)) obj.acknowledgements = object.acknowledgements.map((e: any) => PacketState.fromJSON(e)); - if (isSet(object.pagination)) obj.pagination = PageResponse.fromJSON(object.pagination); - if (isSet(object.height)) obj.height = Height.fromJSON(object.height); - return obj; + return { + acknowledgements: Array.isArray(object?.acknowledgements) ? object.acknowledgements.map((e: any) => PacketState.fromJSON(e)) : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + height: isSet(object.height) ? Height.fromJSON(object.height) : undefined + }; }, toJSON(message: QueryPacketAcknowledgementsResponse): JsonSafe<QueryPacketAcknowledgementsResponse> { const obj: any = {}; @@ -3189,12 +3267,8 @@ export const QueryPacketAcknowledgementsResponse = { fromPartial(object: DeepPartial<QueryPacketAcknowledgementsResponse>): QueryPacketAcknowledgementsResponse { const message = createBaseQueryPacketAcknowledgementsResponse(); message.acknowledgements = object.acknowledgements?.map(e => PacketState.fromPartial(e)) || []; - if (object.pagination !== undefined && object.pagination !== null) { - message.pagination = PageResponse.fromPartial(object.pagination); - } - if (object.height !== undefined && object.height !== null) { - message.height = Height.fromPartial(object.height); - } + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageResponse.fromPartial(object.pagination) : undefined; + message.height = object.height !== undefined && object.height !== null ? Height.fromPartial(object.height) : undefined; return message; }, fromSDK(object: QueryPacketAcknowledgementsResponseSDKType): QueryPacketAcknowledgementsResponse { @@ -3276,10 +3350,10 @@ function createBaseQueryUnreceivedPacketsRequest(): QueryUnreceivedPacketsReques export const QueryUnreceivedPacketsRequest = { typeUrl: "/ibc.core.channel.v1.QueryUnreceivedPacketsRequest", encode(message: QueryUnreceivedPacketsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.portId !== undefined) { + if (message.portId !== "") { writer.uint32(10).string(message.portId); } - if (message.channelId !== undefined) { + if (message.channelId !== "") { writer.uint32(18).string(message.channelId); } writer.uint32(26).fork(); @@ -3320,11 +3394,11 @@ export const QueryUnreceivedPacketsRequest = { return message; }, fromJSON(object: any): QueryUnreceivedPacketsRequest { - const obj = createBaseQueryUnreceivedPacketsRequest(); - if (isSet(object.portId)) obj.portId = String(object.portId); - if (isSet(object.channelId)) obj.channelId = String(object.channelId); - if (Array.isArray(object?.packetCommitmentSequences)) obj.packetCommitmentSequences = object.packetCommitmentSequences.map((e: any) => BigInt(e.toString())); - return obj; + return { + portId: isSet(object.portId) ? String(object.portId) : "", + channelId: isSet(object.channelId) ? String(object.channelId) : "", + packetCommitmentSequences: Array.isArray(object?.packetCommitmentSequences) ? object.packetCommitmentSequences.map((e: any) => BigInt(e.toString())) : [] + }; }, toJSON(message: QueryUnreceivedPacketsRequest): JsonSafe<QueryUnreceivedPacketsRequest> { const obj: any = {}; @@ -3460,10 +3534,10 @@ export const QueryUnreceivedPacketsResponse = { return message; }, fromJSON(object: any): QueryUnreceivedPacketsResponse { - const obj = createBaseQueryUnreceivedPacketsResponse(); - if (Array.isArray(object?.sequences)) obj.sequences = object.sequences.map((e: any) => BigInt(e.toString())); - if (isSet(object.height)) obj.height = Height.fromJSON(object.height); - return obj; + return { + sequences: Array.isArray(object?.sequences) ? object.sequences.map((e: any) => BigInt(e.toString())) : [], + height: isSet(object.height) ? Height.fromJSON(object.height) : undefined + }; }, toJSON(message: QueryUnreceivedPacketsResponse): JsonSafe<QueryUnreceivedPacketsResponse> { const obj: any = {}; @@ -3478,9 +3552,7 @@ export const QueryUnreceivedPacketsResponse = { fromPartial(object: DeepPartial<QueryUnreceivedPacketsResponse>): QueryUnreceivedPacketsResponse { const message = createBaseQueryUnreceivedPacketsResponse(); message.sequences = object.sequences?.map(e => BigInt(e.toString())) || []; - if (object.height !== undefined && object.height !== null) { - message.height = Height.fromPartial(object.height); - } + message.height = object.height !== undefined && object.height !== null ? Height.fromPartial(object.height) : undefined; return message; }, fromSDK(object: QueryUnreceivedPacketsResponseSDKType): QueryUnreceivedPacketsResponse { @@ -3555,10 +3627,10 @@ function createBaseQueryUnreceivedAcksRequest(): QueryUnreceivedAcksRequest { export const QueryUnreceivedAcksRequest = { typeUrl: "/ibc.core.channel.v1.QueryUnreceivedAcksRequest", encode(message: QueryUnreceivedAcksRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.portId !== undefined) { + if (message.portId !== "") { writer.uint32(10).string(message.portId); } - if (message.channelId !== undefined) { + if (message.channelId !== "") { writer.uint32(18).string(message.channelId); } writer.uint32(26).fork(); @@ -3599,11 +3671,11 @@ export const QueryUnreceivedAcksRequest = { return message; }, fromJSON(object: any): QueryUnreceivedAcksRequest { - const obj = createBaseQueryUnreceivedAcksRequest(); - if (isSet(object.portId)) obj.portId = String(object.portId); - if (isSet(object.channelId)) obj.channelId = String(object.channelId); - if (Array.isArray(object?.packetAckSequences)) obj.packetAckSequences = object.packetAckSequences.map((e: any) => BigInt(e.toString())); - return obj; + return { + portId: isSet(object.portId) ? String(object.portId) : "", + channelId: isSet(object.channelId) ? String(object.channelId) : "", + packetAckSequences: Array.isArray(object?.packetAckSequences) ? object.packetAckSequences.map((e: any) => BigInt(e.toString())) : [] + }; }, toJSON(message: QueryUnreceivedAcksRequest): JsonSafe<QueryUnreceivedAcksRequest> { const obj: any = {}; @@ -3739,10 +3811,10 @@ export const QueryUnreceivedAcksResponse = { return message; }, fromJSON(object: any): QueryUnreceivedAcksResponse { - const obj = createBaseQueryUnreceivedAcksResponse(); - if (Array.isArray(object?.sequences)) obj.sequences = object.sequences.map((e: any) => BigInt(e.toString())); - if (isSet(object.height)) obj.height = Height.fromJSON(object.height); - return obj; + return { + sequences: Array.isArray(object?.sequences) ? object.sequences.map((e: any) => BigInt(e.toString())) : [], + height: isSet(object.height) ? Height.fromJSON(object.height) : undefined + }; }, toJSON(message: QueryUnreceivedAcksResponse): JsonSafe<QueryUnreceivedAcksResponse> { const obj: any = {}; @@ -3757,9 +3829,7 @@ export const QueryUnreceivedAcksResponse = { fromPartial(object: DeepPartial<QueryUnreceivedAcksResponse>): QueryUnreceivedAcksResponse { const message = createBaseQueryUnreceivedAcksResponse(); message.sequences = object.sequences?.map(e => BigInt(e.toString())) || []; - if (object.height !== undefined && object.height !== null) { - message.height = Height.fromPartial(object.height); - } + message.height = object.height !== undefined && object.height !== null ? Height.fromPartial(object.height) : undefined; return message; }, fromSDK(object: QueryUnreceivedAcksResponseSDKType): QueryUnreceivedAcksResponse { @@ -3833,10 +3903,10 @@ function createBaseQueryNextSequenceReceiveRequest(): QueryNextSequenceReceiveRe export const QueryNextSequenceReceiveRequest = { typeUrl: "/ibc.core.channel.v1.QueryNextSequenceReceiveRequest", encode(message: QueryNextSequenceReceiveRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.portId !== undefined) { + if (message.portId !== "") { writer.uint32(10).string(message.portId); } - if (message.channelId !== undefined) { + if (message.channelId !== "") { writer.uint32(18).string(message.channelId); } return writer; @@ -3862,10 +3932,10 @@ export const QueryNextSequenceReceiveRequest = { return message; }, fromJSON(object: any): QueryNextSequenceReceiveRequest { - const obj = createBaseQueryNextSequenceReceiveRequest(); - if (isSet(object.portId)) obj.portId = String(object.portId); - if (isSet(object.channelId)) obj.channelId = String(object.channelId); - return obj; + return { + portId: isSet(object.portId) ? String(object.portId) : "", + channelId: isSet(object.channelId) ? String(object.channelId) : "" + }; }, toJSON(message: QueryNextSequenceReceiveRequest): JsonSafe<QueryNextSequenceReceiveRequest> { const obj: any = {}; @@ -3945,7 +4015,7 @@ function createBaseQueryNextSequenceReceiveResponse(): QueryNextSequenceReceiveR export const QueryNextSequenceReceiveResponse = { typeUrl: "/ibc.core.channel.v1.QueryNextSequenceReceiveResponse", encode(message: QueryNextSequenceReceiveResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.nextSequenceReceive !== undefined) { + if (message.nextSequenceReceive !== BigInt(0)) { writer.uint32(8).uint64(message.nextSequenceReceive); } if (message.proof.length !== 0) { @@ -3980,11 +4050,11 @@ export const QueryNextSequenceReceiveResponse = { return message; }, fromJSON(object: any): QueryNextSequenceReceiveResponse { - const obj = createBaseQueryNextSequenceReceiveResponse(); - if (isSet(object.nextSequenceReceive)) obj.nextSequenceReceive = BigInt(object.nextSequenceReceive.toString()); - if (isSet(object.proof)) obj.proof = bytesFromBase64(object.proof); - if (isSet(object.proofHeight)) obj.proofHeight = Height.fromJSON(object.proofHeight); - return obj; + return { + nextSequenceReceive: isSet(object.nextSequenceReceive) ? BigInt(object.nextSequenceReceive.toString()) : BigInt(0), + proof: isSet(object.proof) ? bytesFromBase64(object.proof) : new Uint8Array(), + proofHeight: isSet(object.proofHeight) ? Height.fromJSON(object.proofHeight) : undefined + }; }, toJSON(message: QueryNextSequenceReceiveResponse): JsonSafe<QueryNextSequenceReceiveResponse> { const obj: any = {}; @@ -3995,13 +4065,9 @@ export const QueryNextSequenceReceiveResponse = { }, fromPartial(object: DeepPartial<QueryNextSequenceReceiveResponse>): QueryNextSequenceReceiveResponse { const message = createBaseQueryNextSequenceReceiveResponse(); - if (object.nextSequenceReceive !== undefined && object.nextSequenceReceive !== null) { - message.nextSequenceReceive = BigInt(object.nextSequenceReceive.toString()); - } + message.nextSequenceReceive = object.nextSequenceReceive !== undefined && object.nextSequenceReceive !== null ? BigInt(object.nextSequenceReceive.toString()) : BigInt(0); message.proof = object.proof ?? new Uint8Array(); - if (object.proofHeight !== undefined && object.proofHeight !== null) { - message.proofHeight = Height.fromPartial(object.proofHeight); - } + message.proofHeight = object.proofHeight !== undefined && object.proofHeight !== null ? Height.fromPartial(object.proofHeight) : undefined; return message; }, fromSDK(object: QueryNextSequenceReceiveResponseSDKType): QueryNextSequenceReceiveResponse { diff --git a/__fixtures__/v-next/outputv4/ibc/core/channel/v1/tx.amino.ts b/__fixtures__/v-next/outputv4/ibc/core/channel/v1/tx.amino.ts index b87fc43286..a2055c9569 100644 --- a/__fixtures__/v-next/outputv4/ibc/core/channel/v1/tx.amino.ts +++ b/__fixtures__/v-next/outputv4/ibc/core/channel/v1/tx.amino.ts @@ -1,8 +1,8 @@ -import { Channel, ChannelSDKType, Packet, PacketSDKType, Counterparty, CounterpartySDKType, stateFromJSON, orderFromJSON } from "./channel.js"; -import { Height, HeightSDKType } from "../../client/v1/client.js"; +import { Channel, ChannelSDKType, Packet, PacketSDKType, Counterparty, CounterpartySDKType, stateFromJSON, orderFromJSON } from "./channel"; +import { Height, HeightSDKType } from "../../client/v1/client"; import { AminoMsg } from "@cosmjs/amino"; -import { AminoHeight, omitDefault } from "../../../../helpers.js"; -import { MsgChannelOpenInit, MsgChannelOpenInitSDKType, MsgChannelOpenTry, MsgChannelOpenTrySDKType, MsgChannelOpenAck, MsgChannelOpenAckSDKType, MsgChannelOpenConfirm, MsgChannelOpenConfirmSDKType, MsgChannelCloseInit, MsgChannelCloseInitSDKType, MsgChannelCloseConfirm, MsgChannelCloseConfirmSDKType, MsgRecvPacket, MsgRecvPacketSDKType, MsgTimeout, MsgTimeoutSDKType, MsgTimeoutOnClose, MsgTimeoutOnCloseSDKType, MsgAcknowledgement, MsgAcknowledgementSDKType } from "./tx.js"; +import { AminoHeight, omitDefault } from "../../../../helpers"; +import { MsgChannelOpenInit, MsgChannelOpenInitSDKType, MsgChannelOpenTry, MsgChannelOpenTrySDKType, MsgChannelOpenAck, MsgChannelOpenAckSDKType, MsgChannelOpenConfirm, MsgChannelOpenConfirmSDKType, MsgChannelCloseInit, MsgChannelCloseInitSDKType, MsgChannelCloseConfirm, MsgChannelCloseConfirmSDKType, MsgRecvPacket, MsgRecvPacketSDKType, MsgTimeout, MsgTimeoutSDKType, MsgTimeoutOnClose, MsgTimeoutOnCloseSDKType, MsgAcknowledgement, MsgAcknowledgementSDKType } from "./tx"; export interface MsgChannelOpenInitAminoType extends AminoMsg { type: "cosmos-sdk/MsgChannelOpenInit"; value: { diff --git a/__fixtures__/v-next/outputv4/ibc/core/channel/v1/tx.registry.ts b/__fixtures__/v-next/outputv4/ibc/core/channel/v1/tx.registry.ts index cab31fe462..a74ee98c9d 100644 --- a/__fixtures__/v-next/outputv4/ibc/core/channel/v1/tx.registry.ts +++ b/__fixtures__/v-next/outputv4/ibc/core/channel/v1/tx.registry.ts @@ -1,7 +1,7 @@ -import { Channel, ChannelSDKType, Packet, PacketSDKType } from "./channel.js"; -import { Height, HeightSDKType } from "../../client/v1/client.js"; +import { Channel, ChannelSDKType, Packet, PacketSDKType } from "./channel"; +import { Height, HeightSDKType } from "../../client/v1/client"; import { GeneratedType, Registry } from "@cosmjs/proto-signing"; -import { MsgChannelOpenInit, MsgChannelOpenInitSDKType, MsgChannelOpenTry, MsgChannelOpenTrySDKType, MsgChannelOpenAck, MsgChannelOpenAckSDKType, MsgChannelOpenConfirm, MsgChannelOpenConfirmSDKType, MsgChannelCloseInit, MsgChannelCloseInitSDKType, MsgChannelCloseConfirm, MsgChannelCloseConfirmSDKType, MsgRecvPacket, MsgRecvPacketSDKType, MsgTimeout, MsgTimeoutSDKType, MsgTimeoutOnClose, MsgTimeoutOnCloseSDKType, MsgAcknowledgement, MsgAcknowledgementSDKType } from "./tx.js"; +import { MsgChannelOpenInit, MsgChannelOpenInitSDKType, MsgChannelOpenTry, MsgChannelOpenTrySDKType, MsgChannelOpenAck, MsgChannelOpenAckSDKType, MsgChannelOpenConfirm, MsgChannelOpenConfirmSDKType, MsgChannelCloseInit, MsgChannelCloseInitSDKType, MsgChannelCloseConfirm, MsgChannelCloseConfirmSDKType, MsgRecvPacket, MsgRecvPacketSDKType, MsgTimeout, MsgTimeoutSDKType, MsgTimeoutOnClose, MsgTimeoutOnCloseSDKType, MsgAcknowledgement, MsgAcknowledgementSDKType } from "./tx"; export const registry: ReadonlyArray<[string, GeneratedType]> = [["/ibc.core.channel.v1.MsgChannelOpenInit", MsgChannelOpenInit], ["/ibc.core.channel.v1.MsgChannelOpenTry", MsgChannelOpenTry], ["/ibc.core.channel.v1.MsgChannelOpenAck", MsgChannelOpenAck], ["/ibc.core.channel.v1.MsgChannelOpenConfirm", MsgChannelOpenConfirm], ["/ibc.core.channel.v1.MsgChannelCloseInit", MsgChannelCloseInit], ["/ibc.core.channel.v1.MsgChannelCloseConfirm", MsgChannelCloseConfirm], ["/ibc.core.channel.v1.MsgRecvPacket", MsgRecvPacket], ["/ibc.core.channel.v1.MsgTimeout", MsgTimeout], ["/ibc.core.channel.v1.MsgTimeoutOnClose", MsgTimeoutOnClose], ["/ibc.core.channel.v1.MsgAcknowledgement", MsgAcknowledgement]]; export const load = (protoRegistry: Registry) => { registry.forEach(([typeUrl, mod]) => { diff --git a/__fixtures__/v-next/outputv4/ibc/core/channel/v1/tx.rpc.msg.ts b/__fixtures__/v-next/outputv4/ibc/core/channel/v1/tx.rpc.msg.ts index 34a59be53f..66669e2dd7 100644 --- a/__fixtures__/v-next/outputv4/ibc/core/channel/v1/tx.rpc.msg.ts +++ b/__fixtures__/v-next/outputv4/ibc/core/channel/v1/tx.rpc.msg.ts @@ -1,8 +1,8 @@ -import { Channel, ChannelSDKType, Packet, PacketSDKType } from "./channel.js"; -import { Height, HeightSDKType } from "../../client/v1/client.js"; -import { Rpc } from "../../../../helpers.js"; -import { BinaryReader } from "../../../../binary.js"; -import { MsgChannelOpenInit, MsgChannelOpenInitSDKType, MsgChannelOpenInitResponse, MsgChannelOpenInitResponseSDKType, MsgChannelOpenTry, MsgChannelOpenTrySDKType, MsgChannelOpenTryResponse, MsgChannelOpenTryResponseSDKType, MsgChannelOpenAck, MsgChannelOpenAckSDKType, MsgChannelOpenAckResponse, MsgChannelOpenAckResponseSDKType, MsgChannelOpenConfirm, MsgChannelOpenConfirmSDKType, MsgChannelOpenConfirmResponse, MsgChannelOpenConfirmResponseSDKType, MsgChannelCloseInit, MsgChannelCloseInitSDKType, MsgChannelCloseInitResponse, MsgChannelCloseInitResponseSDKType, MsgChannelCloseConfirm, MsgChannelCloseConfirmSDKType, MsgChannelCloseConfirmResponse, MsgChannelCloseConfirmResponseSDKType, MsgRecvPacket, MsgRecvPacketSDKType, MsgRecvPacketResponse, MsgRecvPacketResponseSDKType, MsgTimeout, MsgTimeoutSDKType, MsgTimeoutResponse, MsgTimeoutResponseSDKType, MsgTimeoutOnClose, MsgTimeoutOnCloseSDKType, MsgTimeoutOnCloseResponse, MsgTimeoutOnCloseResponseSDKType, MsgAcknowledgement, MsgAcknowledgementSDKType, MsgAcknowledgementResponse, MsgAcknowledgementResponseSDKType } from "./tx.js"; +import { Channel, ChannelSDKType, Packet, PacketSDKType } from "./channel"; +import { Height, HeightSDKType } from "../../client/v1/client"; +import { Rpc } from "../../../../helpers"; +import { BinaryReader } from "../../../../binary"; +import { MsgChannelOpenInit, MsgChannelOpenInitSDKType, MsgChannelOpenInitResponse, MsgChannelOpenInitResponseSDKType, MsgChannelOpenTry, MsgChannelOpenTrySDKType, MsgChannelOpenTryResponse, MsgChannelOpenTryResponseSDKType, MsgChannelOpenAck, MsgChannelOpenAckSDKType, MsgChannelOpenAckResponse, MsgChannelOpenAckResponseSDKType, MsgChannelOpenConfirm, MsgChannelOpenConfirmSDKType, MsgChannelOpenConfirmResponse, MsgChannelOpenConfirmResponseSDKType, MsgChannelCloseInit, MsgChannelCloseInitSDKType, MsgChannelCloseInitResponse, MsgChannelCloseInitResponseSDKType, MsgChannelCloseConfirm, MsgChannelCloseConfirmSDKType, MsgChannelCloseConfirmResponse, MsgChannelCloseConfirmResponseSDKType, MsgRecvPacket, MsgRecvPacketSDKType, MsgRecvPacketResponse, MsgRecvPacketResponseSDKType, MsgTimeout, MsgTimeoutSDKType, MsgTimeoutResponse, MsgTimeoutResponseSDKType, MsgTimeoutOnClose, MsgTimeoutOnCloseSDKType, MsgTimeoutOnCloseResponse, MsgTimeoutOnCloseResponseSDKType, MsgAcknowledgement, MsgAcknowledgementSDKType, MsgAcknowledgementResponse, MsgAcknowledgementResponseSDKType } from "./tx"; /** Msg defines the ibc/channel Msg service. */ export interface Msg { /** ChannelOpenInit defines a rpc handler method for MsgChannelOpenInit. */ diff --git a/__fixtures__/v-next/outputv4/ibc/core/channel/v1/tx.ts b/__fixtures__/v-next/outputv4/ibc/core/channel/v1/tx.ts index 326dfece0a..594bbcb750 100644 --- a/__fixtures__/v-next/outputv4/ibc/core/channel/v1/tx.ts +++ b/__fixtures__/v-next/outputv4/ibc/core/channel/v1/tx.ts @@ -1,8 +1,9 @@ -import { Channel, ChannelSDKType, Packet, PacketSDKType } from "./channel.js"; -import { Height, HeightSDKType } from "../../client/v1/client.js"; -import { BinaryReader, BinaryWriter } from "../../../../binary.js"; -import { isSet, DeepPartial, bytesFromBase64, base64FromBytes } from "../../../../helpers.js"; -import { JsonSafe } from "../../../../json-safe.js"; +import { Channel, ChannelSDKType, Packet, PacketSDKType } from "./channel"; +import { Height, HeightSDKType } from "../../client/v1/client"; +import { BinaryReader, BinaryWriter } from "../../../../binary"; +import { isSet, DeepPartial, bytesFromBase64, base64FromBytes } from "../../../../helpers"; +import { JsonSafe } from "../../../../json-safe"; +import { ComputedRef } from "vue"; export const protobufPackage = "ibc.core.channel.v1"; /** * MsgChannelOpenInit defines an sdk.Msg to initialize a channel handshake. It @@ -13,6 +14,11 @@ export interface MsgChannelOpenInit { channel: Channel; signer: string; } +export interface ReactiveMsgChannelOpenInit { + portId: ComputedRef<string>; + channel: ComputedRef<Channel>; + signer: ComputedRef<string>; +} export interface MsgChannelOpenInitProtoMsg { typeUrl: "/ibc.core.channel.v1.MsgChannelOpenInit"; value: Uint8Array; @@ -28,6 +34,7 @@ export interface MsgChannelOpenInitSDKType { } /** MsgChannelOpenInitResponse defines the Msg/ChannelOpenInit response type. */ export interface MsgChannelOpenInitResponse {} +export interface ReactiveMsgChannelOpenInitResponse {} export interface MsgChannelOpenInitResponseProtoMsg { typeUrl: "/ibc.core.channel.v1.MsgChannelOpenInitResponse"; value: Uint8Array; @@ -51,6 +58,15 @@ export interface MsgChannelOpenTry { proofHeight: Height; signer: string; } +export interface ReactiveMsgChannelOpenTry { + portId: ComputedRef<string>; + previousChannelId: ComputedRef<string>; + channel: ComputedRef<Channel>; + counterpartyVersion: ComputedRef<string>; + proofInit: ComputedRef<Uint8Array>; + proofHeight: ComputedRef<Height>; + signer: ComputedRef<string>; +} export interface MsgChannelOpenTryProtoMsg { typeUrl: "/ibc.core.channel.v1.MsgChannelOpenTry"; value: Uint8Array; @@ -70,6 +86,7 @@ export interface MsgChannelOpenTrySDKType { } /** MsgChannelOpenTryResponse defines the Msg/ChannelOpenTry response type. */ export interface MsgChannelOpenTryResponse {} +export interface ReactiveMsgChannelOpenTryResponse {} export interface MsgChannelOpenTryResponseProtoMsg { typeUrl: "/ibc.core.channel.v1.MsgChannelOpenTryResponse"; value: Uint8Array; @@ -89,6 +106,15 @@ export interface MsgChannelOpenAck { proofHeight: Height; signer: string; } +export interface ReactiveMsgChannelOpenAck { + portId: ComputedRef<string>; + channelId: ComputedRef<string>; + counterpartyChannelId: ComputedRef<string>; + counterpartyVersion: ComputedRef<string>; + proofTry: ComputedRef<Uint8Array>; + proofHeight: ComputedRef<Height>; + signer: ComputedRef<string>; +} export interface MsgChannelOpenAckProtoMsg { typeUrl: "/ibc.core.channel.v1.MsgChannelOpenAck"; value: Uint8Array; @@ -108,6 +134,7 @@ export interface MsgChannelOpenAckSDKType { } /** MsgChannelOpenAckResponse defines the Msg/ChannelOpenAck response type. */ export interface MsgChannelOpenAckResponse {} +export interface ReactiveMsgChannelOpenAckResponse {} export interface MsgChannelOpenAckResponseProtoMsg { typeUrl: "/ibc.core.channel.v1.MsgChannelOpenAckResponse"; value: Uint8Array; @@ -125,6 +152,13 @@ export interface MsgChannelOpenConfirm { proofHeight: Height; signer: string; } +export interface ReactiveMsgChannelOpenConfirm { + portId: ComputedRef<string>; + channelId: ComputedRef<string>; + proofAck: ComputedRef<Uint8Array>; + proofHeight: ComputedRef<Height>; + signer: ComputedRef<string>; +} export interface MsgChannelOpenConfirmProtoMsg { typeUrl: "/ibc.core.channel.v1.MsgChannelOpenConfirm"; value: Uint8Array; @@ -145,6 +179,7 @@ export interface MsgChannelOpenConfirmSDKType { * type. */ export interface MsgChannelOpenConfirmResponse {} +export interface ReactiveMsgChannelOpenConfirmResponse {} export interface MsgChannelOpenConfirmResponseProtoMsg { typeUrl: "/ibc.core.channel.v1.MsgChannelOpenConfirmResponse"; value: Uint8Array; @@ -163,6 +198,11 @@ export interface MsgChannelCloseInit { channelId: string; signer: string; } +export interface ReactiveMsgChannelCloseInit { + portId: ComputedRef<string>; + channelId: ComputedRef<string>; + signer: ComputedRef<string>; +} export interface MsgChannelCloseInitProtoMsg { typeUrl: "/ibc.core.channel.v1.MsgChannelCloseInit"; value: Uint8Array; @@ -178,6 +218,7 @@ export interface MsgChannelCloseInitSDKType { } /** MsgChannelCloseInitResponse defines the Msg/ChannelCloseInit response type. */ export interface MsgChannelCloseInitResponse {} +export interface ReactiveMsgChannelCloseInitResponse {} export interface MsgChannelCloseInitResponseProtoMsg { typeUrl: "/ibc.core.channel.v1.MsgChannelCloseInitResponse"; value: Uint8Array; @@ -195,6 +236,13 @@ export interface MsgChannelCloseConfirm { proofHeight: Height; signer: string; } +export interface ReactiveMsgChannelCloseConfirm { + portId: ComputedRef<string>; + channelId: ComputedRef<string>; + proofInit: ComputedRef<Uint8Array>; + proofHeight: ComputedRef<Height>; + signer: ComputedRef<string>; +} export interface MsgChannelCloseConfirmProtoMsg { typeUrl: "/ibc.core.channel.v1.MsgChannelCloseConfirm"; value: Uint8Array; @@ -215,6 +263,7 @@ export interface MsgChannelCloseConfirmSDKType { * type. */ export interface MsgChannelCloseConfirmResponse {} +export interface ReactiveMsgChannelCloseConfirmResponse {} export interface MsgChannelCloseConfirmResponseProtoMsg { typeUrl: "/ibc.core.channel.v1.MsgChannelCloseConfirmResponse"; value: Uint8Array; @@ -231,6 +280,12 @@ export interface MsgRecvPacket { proofHeight: Height; signer: string; } +export interface ReactiveMsgRecvPacket { + packet: ComputedRef<Packet>; + proofCommitment: ComputedRef<Uint8Array>; + proofHeight: ComputedRef<Height>; + signer: ComputedRef<string>; +} export interface MsgRecvPacketProtoMsg { typeUrl: "/ibc.core.channel.v1.MsgRecvPacket"; value: Uint8Array; @@ -244,6 +299,7 @@ export interface MsgRecvPacketSDKType { } /** MsgRecvPacketResponse defines the Msg/RecvPacket response type. */ export interface MsgRecvPacketResponse {} +export interface ReactiveMsgRecvPacketResponse {} export interface MsgRecvPacketResponseProtoMsg { typeUrl: "/ibc.core.channel.v1.MsgRecvPacketResponse"; value: Uint8Array; @@ -258,6 +314,13 @@ export interface MsgTimeout { nextSequenceRecv: bigint; signer: string; } +export interface ReactiveMsgTimeout { + packet: ComputedRef<Packet>; + proofUnreceived: ComputedRef<Uint8Array>; + proofHeight: ComputedRef<Height>; + nextSequenceRecv: ComputedRef<bigint>; + signer: ComputedRef<string>; +} export interface MsgTimeoutProtoMsg { typeUrl: "/ibc.core.channel.v1.MsgTimeout"; value: Uint8Array; @@ -272,6 +335,7 @@ export interface MsgTimeoutSDKType { } /** MsgTimeoutResponse defines the Msg/Timeout response type. */ export interface MsgTimeoutResponse {} +export interface ReactiveMsgTimeoutResponse {} export interface MsgTimeoutResponseProtoMsg { typeUrl: "/ibc.core.channel.v1.MsgTimeoutResponse"; value: Uint8Array; @@ -287,6 +351,14 @@ export interface MsgTimeoutOnClose { nextSequenceRecv: bigint; signer: string; } +export interface ReactiveMsgTimeoutOnClose { + packet: ComputedRef<Packet>; + proofUnreceived: ComputedRef<Uint8Array>; + proofClose: ComputedRef<Uint8Array>; + proofHeight: ComputedRef<Height>; + nextSequenceRecv: ComputedRef<bigint>; + signer: ComputedRef<string>; +} export interface MsgTimeoutOnCloseProtoMsg { typeUrl: "/ibc.core.channel.v1.MsgTimeoutOnClose"; value: Uint8Array; @@ -302,6 +374,7 @@ export interface MsgTimeoutOnCloseSDKType { } /** MsgTimeoutOnCloseResponse defines the Msg/TimeoutOnClose response type. */ export interface MsgTimeoutOnCloseResponse {} +export interface ReactiveMsgTimeoutOnCloseResponse {} export interface MsgTimeoutOnCloseResponseProtoMsg { typeUrl: "/ibc.core.channel.v1.MsgTimeoutOnCloseResponse"; value: Uint8Array; @@ -316,6 +389,13 @@ export interface MsgAcknowledgement { proofHeight: Height; signer: string; } +export interface ReactiveMsgAcknowledgement { + packet: ComputedRef<Packet>; + acknowledgement: ComputedRef<Uint8Array>; + proofAcked: ComputedRef<Uint8Array>; + proofHeight: ComputedRef<Height>; + signer: ComputedRef<string>; +} export interface MsgAcknowledgementProtoMsg { typeUrl: "/ibc.core.channel.v1.MsgAcknowledgement"; value: Uint8Array; @@ -330,6 +410,7 @@ export interface MsgAcknowledgementSDKType { } /** MsgAcknowledgementResponse defines the Msg/Acknowledgement response type. */ export interface MsgAcknowledgementResponse {} +export interface ReactiveMsgAcknowledgementResponse {} export interface MsgAcknowledgementResponseProtoMsg { typeUrl: "/ibc.core.channel.v1.MsgAcknowledgementResponse"; value: Uint8Array; @@ -346,13 +427,13 @@ function createBaseMsgChannelOpenInit(): MsgChannelOpenInit { export const MsgChannelOpenInit = { typeUrl: "/ibc.core.channel.v1.MsgChannelOpenInit", encode(message: MsgChannelOpenInit, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.portId !== undefined) { + if (message.portId !== "") { writer.uint32(10).string(message.portId); } if (message.channel !== undefined) { Channel.encode(message.channel, writer.uint32(18).fork()).ldelim(); } - if (message.signer !== undefined) { + if (message.signer !== "") { writer.uint32(26).string(message.signer); } return writer; @@ -381,11 +462,11 @@ export const MsgChannelOpenInit = { return message; }, fromJSON(object: any): MsgChannelOpenInit { - const obj = createBaseMsgChannelOpenInit(); - if (isSet(object.portId)) obj.portId = String(object.portId); - if (isSet(object.channel)) obj.channel = Channel.fromJSON(object.channel); - if (isSet(object.signer)) obj.signer = String(object.signer); - return obj; + return { + portId: isSet(object.portId) ? String(object.portId) : "", + channel: isSet(object.channel) ? Channel.fromJSON(object.channel) : undefined, + signer: isSet(object.signer) ? String(object.signer) : "" + }; }, toJSON(message: MsgChannelOpenInit): JsonSafe<MsgChannelOpenInit> { const obj: any = {}; @@ -397,9 +478,7 @@ export const MsgChannelOpenInit = { fromPartial(object: DeepPartial<MsgChannelOpenInit>): MsgChannelOpenInit { const message = createBaseMsgChannelOpenInit(); message.portId = object.portId ?? ""; - if (object.channel !== undefined && object.channel !== null) { - message.channel = Channel.fromPartial(object.channel); - } + message.channel = object.channel !== undefined && object.channel !== null ? Channel.fromPartial(object.channel) : undefined; message.signer = object.signer ?? ""; return message; }, @@ -489,8 +568,7 @@ export const MsgChannelOpenInitResponse = { return message; }, fromJSON(_: any): MsgChannelOpenInitResponse { - const obj = createBaseMsgChannelOpenInitResponse(); - return obj; + return {}; }, toJSON(_: MsgChannelOpenInitResponse): JsonSafe<MsgChannelOpenInitResponse> { const obj: any = {}; @@ -554,16 +632,16 @@ function createBaseMsgChannelOpenTry(): MsgChannelOpenTry { export const MsgChannelOpenTry = { typeUrl: "/ibc.core.channel.v1.MsgChannelOpenTry", encode(message: MsgChannelOpenTry, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.portId !== undefined) { + if (message.portId !== "") { writer.uint32(10).string(message.portId); } - if (message.previousChannelId !== undefined) { + if (message.previousChannelId !== "") { writer.uint32(18).string(message.previousChannelId); } if (message.channel !== undefined) { Channel.encode(message.channel, writer.uint32(26).fork()).ldelim(); } - if (message.counterpartyVersion !== undefined) { + if (message.counterpartyVersion !== "") { writer.uint32(34).string(message.counterpartyVersion); } if (message.proofInit.length !== 0) { @@ -572,7 +650,7 @@ export const MsgChannelOpenTry = { if (message.proofHeight !== undefined) { Height.encode(message.proofHeight, writer.uint32(50).fork()).ldelim(); } - if (message.signer !== undefined) { + if (message.signer !== "") { writer.uint32(58).string(message.signer); } return writer; @@ -613,15 +691,15 @@ export const MsgChannelOpenTry = { return message; }, fromJSON(object: any): MsgChannelOpenTry { - const obj = createBaseMsgChannelOpenTry(); - if (isSet(object.portId)) obj.portId = String(object.portId); - if (isSet(object.previousChannelId)) obj.previousChannelId = String(object.previousChannelId); - if (isSet(object.channel)) obj.channel = Channel.fromJSON(object.channel); - if (isSet(object.counterpartyVersion)) obj.counterpartyVersion = String(object.counterpartyVersion); - if (isSet(object.proofInit)) obj.proofInit = bytesFromBase64(object.proofInit); - if (isSet(object.proofHeight)) obj.proofHeight = Height.fromJSON(object.proofHeight); - if (isSet(object.signer)) obj.signer = String(object.signer); - return obj; + return { + portId: isSet(object.portId) ? String(object.portId) : "", + previousChannelId: isSet(object.previousChannelId) ? String(object.previousChannelId) : "", + channel: isSet(object.channel) ? Channel.fromJSON(object.channel) : undefined, + counterpartyVersion: isSet(object.counterpartyVersion) ? String(object.counterpartyVersion) : "", + proofInit: isSet(object.proofInit) ? bytesFromBase64(object.proofInit) : new Uint8Array(), + proofHeight: isSet(object.proofHeight) ? Height.fromJSON(object.proofHeight) : undefined, + signer: isSet(object.signer) ? String(object.signer) : "" + }; }, toJSON(message: MsgChannelOpenTry): JsonSafe<MsgChannelOpenTry> { const obj: any = {}; @@ -638,14 +716,10 @@ export const MsgChannelOpenTry = { const message = createBaseMsgChannelOpenTry(); message.portId = object.portId ?? ""; message.previousChannelId = object.previousChannelId ?? ""; - if (object.channel !== undefined && object.channel !== null) { - message.channel = Channel.fromPartial(object.channel); - } + message.channel = object.channel !== undefined && object.channel !== null ? Channel.fromPartial(object.channel) : undefined; message.counterpartyVersion = object.counterpartyVersion ?? ""; message.proofInit = object.proofInit ?? new Uint8Array(); - if (object.proofHeight !== undefined && object.proofHeight !== null) { - message.proofHeight = Height.fromPartial(object.proofHeight); - } + message.proofHeight = object.proofHeight !== undefined && object.proofHeight !== null ? Height.fromPartial(object.proofHeight) : undefined; message.signer = object.signer ?? ""; return message; }, @@ -763,8 +837,7 @@ export const MsgChannelOpenTryResponse = { return message; }, fromJSON(_: any): MsgChannelOpenTryResponse { - const obj = createBaseMsgChannelOpenTryResponse(); - return obj; + return {}; }, toJSON(_: MsgChannelOpenTryResponse): JsonSafe<MsgChannelOpenTryResponse> { const obj: any = {}; @@ -828,16 +901,16 @@ function createBaseMsgChannelOpenAck(): MsgChannelOpenAck { export const MsgChannelOpenAck = { typeUrl: "/ibc.core.channel.v1.MsgChannelOpenAck", encode(message: MsgChannelOpenAck, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.portId !== undefined) { + if (message.portId !== "") { writer.uint32(10).string(message.portId); } - if (message.channelId !== undefined) { + if (message.channelId !== "") { writer.uint32(18).string(message.channelId); } - if (message.counterpartyChannelId !== undefined) { + if (message.counterpartyChannelId !== "") { writer.uint32(26).string(message.counterpartyChannelId); } - if (message.counterpartyVersion !== undefined) { + if (message.counterpartyVersion !== "") { writer.uint32(34).string(message.counterpartyVersion); } if (message.proofTry.length !== 0) { @@ -846,7 +919,7 @@ export const MsgChannelOpenAck = { if (message.proofHeight !== undefined) { Height.encode(message.proofHeight, writer.uint32(50).fork()).ldelim(); } - if (message.signer !== undefined) { + if (message.signer !== "") { writer.uint32(58).string(message.signer); } return writer; @@ -887,15 +960,15 @@ export const MsgChannelOpenAck = { return message; }, fromJSON(object: any): MsgChannelOpenAck { - const obj = createBaseMsgChannelOpenAck(); - if (isSet(object.portId)) obj.portId = String(object.portId); - if (isSet(object.channelId)) obj.channelId = String(object.channelId); - if (isSet(object.counterpartyChannelId)) obj.counterpartyChannelId = String(object.counterpartyChannelId); - if (isSet(object.counterpartyVersion)) obj.counterpartyVersion = String(object.counterpartyVersion); - if (isSet(object.proofTry)) obj.proofTry = bytesFromBase64(object.proofTry); - if (isSet(object.proofHeight)) obj.proofHeight = Height.fromJSON(object.proofHeight); - if (isSet(object.signer)) obj.signer = String(object.signer); - return obj; + return { + portId: isSet(object.portId) ? String(object.portId) : "", + channelId: isSet(object.channelId) ? String(object.channelId) : "", + counterpartyChannelId: isSet(object.counterpartyChannelId) ? String(object.counterpartyChannelId) : "", + counterpartyVersion: isSet(object.counterpartyVersion) ? String(object.counterpartyVersion) : "", + proofTry: isSet(object.proofTry) ? bytesFromBase64(object.proofTry) : new Uint8Array(), + proofHeight: isSet(object.proofHeight) ? Height.fromJSON(object.proofHeight) : undefined, + signer: isSet(object.signer) ? String(object.signer) : "" + }; }, toJSON(message: MsgChannelOpenAck): JsonSafe<MsgChannelOpenAck> { const obj: any = {}; @@ -915,9 +988,7 @@ export const MsgChannelOpenAck = { message.counterpartyChannelId = object.counterpartyChannelId ?? ""; message.counterpartyVersion = object.counterpartyVersion ?? ""; message.proofTry = object.proofTry ?? new Uint8Array(); - if (object.proofHeight !== undefined && object.proofHeight !== null) { - message.proofHeight = Height.fromPartial(object.proofHeight); - } + message.proofHeight = object.proofHeight !== undefined && object.proofHeight !== null ? Height.fromPartial(object.proofHeight) : undefined; message.signer = object.signer ?? ""; return message; }, @@ -1035,8 +1106,7 @@ export const MsgChannelOpenAckResponse = { return message; }, fromJSON(_: any): MsgChannelOpenAckResponse { - const obj = createBaseMsgChannelOpenAckResponse(); - return obj; + return {}; }, toJSON(_: MsgChannelOpenAckResponse): JsonSafe<MsgChannelOpenAckResponse> { const obj: any = {}; @@ -1098,10 +1168,10 @@ function createBaseMsgChannelOpenConfirm(): MsgChannelOpenConfirm { export const MsgChannelOpenConfirm = { typeUrl: "/ibc.core.channel.v1.MsgChannelOpenConfirm", encode(message: MsgChannelOpenConfirm, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.portId !== undefined) { + if (message.portId !== "") { writer.uint32(10).string(message.portId); } - if (message.channelId !== undefined) { + if (message.channelId !== "") { writer.uint32(18).string(message.channelId); } if (message.proofAck.length !== 0) { @@ -1110,7 +1180,7 @@ export const MsgChannelOpenConfirm = { if (message.proofHeight !== undefined) { Height.encode(message.proofHeight, writer.uint32(34).fork()).ldelim(); } - if (message.signer !== undefined) { + if (message.signer !== "") { writer.uint32(42).string(message.signer); } return writer; @@ -1145,13 +1215,13 @@ export const MsgChannelOpenConfirm = { return message; }, fromJSON(object: any): MsgChannelOpenConfirm { - const obj = createBaseMsgChannelOpenConfirm(); - if (isSet(object.portId)) obj.portId = String(object.portId); - if (isSet(object.channelId)) obj.channelId = String(object.channelId); - if (isSet(object.proofAck)) obj.proofAck = bytesFromBase64(object.proofAck); - if (isSet(object.proofHeight)) obj.proofHeight = Height.fromJSON(object.proofHeight); - if (isSet(object.signer)) obj.signer = String(object.signer); - return obj; + return { + portId: isSet(object.portId) ? String(object.portId) : "", + channelId: isSet(object.channelId) ? String(object.channelId) : "", + proofAck: isSet(object.proofAck) ? bytesFromBase64(object.proofAck) : new Uint8Array(), + proofHeight: isSet(object.proofHeight) ? Height.fromJSON(object.proofHeight) : undefined, + signer: isSet(object.signer) ? String(object.signer) : "" + }; }, toJSON(message: MsgChannelOpenConfirm): JsonSafe<MsgChannelOpenConfirm> { const obj: any = {}; @@ -1167,9 +1237,7 @@ export const MsgChannelOpenConfirm = { message.portId = object.portId ?? ""; message.channelId = object.channelId ?? ""; message.proofAck = object.proofAck ?? new Uint8Array(); - if (object.proofHeight !== undefined && object.proofHeight !== null) { - message.proofHeight = Height.fromPartial(object.proofHeight); - } + message.proofHeight = object.proofHeight !== undefined && object.proofHeight !== null ? Height.fromPartial(object.proofHeight) : undefined; message.signer = object.signer ?? ""; return message; }, @@ -1273,8 +1341,7 @@ export const MsgChannelOpenConfirmResponse = { return message; }, fromJSON(_: any): MsgChannelOpenConfirmResponse { - const obj = createBaseMsgChannelOpenConfirmResponse(); - return obj; + return {}; }, toJSON(_: MsgChannelOpenConfirmResponse): JsonSafe<MsgChannelOpenConfirmResponse> { const obj: any = {}; @@ -1334,13 +1401,13 @@ function createBaseMsgChannelCloseInit(): MsgChannelCloseInit { export const MsgChannelCloseInit = { typeUrl: "/ibc.core.channel.v1.MsgChannelCloseInit", encode(message: MsgChannelCloseInit, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.portId !== undefined) { + if (message.portId !== "") { writer.uint32(10).string(message.portId); } - if (message.channelId !== undefined) { + if (message.channelId !== "") { writer.uint32(18).string(message.channelId); } - if (message.signer !== undefined) { + if (message.signer !== "") { writer.uint32(26).string(message.signer); } return writer; @@ -1369,11 +1436,11 @@ export const MsgChannelCloseInit = { return message; }, fromJSON(object: any): MsgChannelCloseInit { - const obj = createBaseMsgChannelCloseInit(); - if (isSet(object.portId)) obj.portId = String(object.portId); - if (isSet(object.channelId)) obj.channelId = String(object.channelId); - if (isSet(object.signer)) obj.signer = String(object.signer); - return obj; + return { + portId: isSet(object.portId) ? String(object.portId) : "", + channelId: isSet(object.channelId) ? String(object.channelId) : "", + signer: isSet(object.signer) ? String(object.signer) : "" + }; }, toJSON(message: MsgChannelCloseInit): JsonSafe<MsgChannelCloseInit> { const obj: any = {}; @@ -1475,8 +1542,7 @@ export const MsgChannelCloseInitResponse = { return message; }, fromJSON(_: any): MsgChannelCloseInitResponse { - const obj = createBaseMsgChannelCloseInitResponse(); - return obj; + return {}; }, toJSON(_: MsgChannelCloseInitResponse): JsonSafe<MsgChannelCloseInitResponse> { const obj: any = {}; @@ -1538,10 +1604,10 @@ function createBaseMsgChannelCloseConfirm(): MsgChannelCloseConfirm { export const MsgChannelCloseConfirm = { typeUrl: "/ibc.core.channel.v1.MsgChannelCloseConfirm", encode(message: MsgChannelCloseConfirm, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.portId !== undefined) { + if (message.portId !== "") { writer.uint32(10).string(message.portId); } - if (message.channelId !== undefined) { + if (message.channelId !== "") { writer.uint32(18).string(message.channelId); } if (message.proofInit.length !== 0) { @@ -1550,7 +1616,7 @@ export const MsgChannelCloseConfirm = { if (message.proofHeight !== undefined) { Height.encode(message.proofHeight, writer.uint32(34).fork()).ldelim(); } - if (message.signer !== undefined) { + if (message.signer !== "") { writer.uint32(42).string(message.signer); } return writer; @@ -1585,13 +1651,13 @@ export const MsgChannelCloseConfirm = { return message; }, fromJSON(object: any): MsgChannelCloseConfirm { - const obj = createBaseMsgChannelCloseConfirm(); - if (isSet(object.portId)) obj.portId = String(object.portId); - if (isSet(object.channelId)) obj.channelId = String(object.channelId); - if (isSet(object.proofInit)) obj.proofInit = bytesFromBase64(object.proofInit); - if (isSet(object.proofHeight)) obj.proofHeight = Height.fromJSON(object.proofHeight); - if (isSet(object.signer)) obj.signer = String(object.signer); - return obj; + return { + portId: isSet(object.portId) ? String(object.portId) : "", + channelId: isSet(object.channelId) ? String(object.channelId) : "", + proofInit: isSet(object.proofInit) ? bytesFromBase64(object.proofInit) : new Uint8Array(), + proofHeight: isSet(object.proofHeight) ? Height.fromJSON(object.proofHeight) : undefined, + signer: isSet(object.signer) ? String(object.signer) : "" + }; }, toJSON(message: MsgChannelCloseConfirm): JsonSafe<MsgChannelCloseConfirm> { const obj: any = {}; @@ -1607,9 +1673,7 @@ export const MsgChannelCloseConfirm = { message.portId = object.portId ?? ""; message.channelId = object.channelId ?? ""; message.proofInit = object.proofInit ?? new Uint8Array(); - if (object.proofHeight !== undefined && object.proofHeight !== null) { - message.proofHeight = Height.fromPartial(object.proofHeight); - } + message.proofHeight = object.proofHeight !== undefined && object.proofHeight !== null ? Height.fromPartial(object.proofHeight) : undefined; message.signer = object.signer ?? ""; return message; }, @@ -1713,8 +1777,7 @@ export const MsgChannelCloseConfirmResponse = { return message; }, fromJSON(_: any): MsgChannelCloseConfirmResponse { - const obj = createBaseMsgChannelCloseConfirmResponse(); - return obj; + return {}; }, toJSON(_: MsgChannelCloseConfirmResponse): JsonSafe<MsgChannelCloseConfirmResponse> { const obj: any = {}; @@ -1784,7 +1847,7 @@ export const MsgRecvPacket = { if (message.proofHeight !== undefined) { Height.encode(message.proofHeight, writer.uint32(26).fork()).ldelim(); } - if (message.signer !== undefined) { + if (message.signer !== "") { writer.uint32(34).string(message.signer); } return writer; @@ -1816,12 +1879,12 @@ export const MsgRecvPacket = { return message; }, fromJSON(object: any): MsgRecvPacket { - const obj = createBaseMsgRecvPacket(); - if (isSet(object.packet)) obj.packet = Packet.fromJSON(object.packet); - if (isSet(object.proofCommitment)) obj.proofCommitment = bytesFromBase64(object.proofCommitment); - if (isSet(object.proofHeight)) obj.proofHeight = Height.fromJSON(object.proofHeight); - if (isSet(object.signer)) obj.signer = String(object.signer); - return obj; + return { + packet: isSet(object.packet) ? Packet.fromJSON(object.packet) : undefined, + proofCommitment: isSet(object.proofCommitment) ? bytesFromBase64(object.proofCommitment) : new Uint8Array(), + proofHeight: isSet(object.proofHeight) ? Height.fromJSON(object.proofHeight) : undefined, + signer: isSet(object.signer) ? String(object.signer) : "" + }; }, toJSON(message: MsgRecvPacket): JsonSafe<MsgRecvPacket> { const obj: any = {}; @@ -1833,13 +1896,9 @@ export const MsgRecvPacket = { }, fromPartial(object: DeepPartial<MsgRecvPacket>): MsgRecvPacket { const message = createBaseMsgRecvPacket(); - if (object.packet !== undefined && object.packet !== null) { - message.packet = Packet.fromPartial(object.packet); - } + message.packet = object.packet !== undefined && object.packet !== null ? Packet.fromPartial(object.packet) : undefined; message.proofCommitment = object.proofCommitment ?? new Uint8Array(); - if (object.proofHeight !== undefined && object.proofHeight !== null) { - message.proofHeight = Height.fromPartial(object.proofHeight); - } + message.proofHeight = object.proofHeight !== undefined && object.proofHeight !== null ? Height.fromPartial(object.proofHeight) : undefined; message.signer = object.signer ?? ""; return message; }, @@ -1936,8 +1995,7 @@ export const MsgRecvPacketResponse = { return message; }, fromJSON(_: any): MsgRecvPacketResponse { - const obj = createBaseMsgRecvPacketResponse(); - return obj; + return {}; }, toJSON(_: MsgRecvPacketResponse): JsonSafe<MsgRecvPacketResponse> { const obj: any = {}; @@ -2008,10 +2066,10 @@ export const MsgTimeout = { if (message.proofHeight !== undefined) { Height.encode(message.proofHeight, writer.uint32(26).fork()).ldelim(); } - if (message.nextSequenceRecv !== undefined) { + if (message.nextSequenceRecv !== BigInt(0)) { writer.uint32(32).uint64(message.nextSequenceRecv); } - if (message.signer !== undefined) { + if (message.signer !== "") { writer.uint32(42).string(message.signer); } return writer; @@ -2046,13 +2104,13 @@ export const MsgTimeout = { return message; }, fromJSON(object: any): MsgTimeout { - const obj = createBaseMsgTimeout(); - if (isSet(object.packet)) obj.packet = Packet.fromJSON(object.packet); - if (isSet(object.proofUnreceived)) obj.proofUnreceived = bytesFromBase64(object.proofUnreceived); - if (isSet(object.proofHeight)) obj.proofHeight = Height.fromJSON(object.proofHeight); - if (isSet(object.nextSequenceRecv)) obj.nextSequenceRecv = BigInt(object.nextSequenceRecv.toString()); - if (isSet(object.signer)) obj.signer = String(object.signer); - return obj; + return { + packet: isSet(object.packet) ? Packet.fromJSON(object.packet) : undefined, + proofUnreceived: isSet(object.proofUnreceived) ? bytesFromBase64(object.proofUnreceived) : new Uint8Array(), + proofHeight: isSet(object.proofHeight) ? Height.fromJSON(object.proofHeight) : undefined, + nextSequenceRecv: isSet(object.nextSequenceRecv) ? BigInt(object.nextSequenceRecv.toString()) : BigInt(0), + signer: isSet(object.signer) ? String(object.signer) : "" + }; }, toJSON(message: MsgTimeout): JsonSafe<MsgTimeout> { const obj: any = {}; @@ -2065,16 +2123,10 @@ export const MsgTimeout = { }, fromPartial(object: DeepPartial<MsgTimeout>): MsgTimeout { const message = createBaseMsgTimeout(); - if (object.packet !== undefined && object.packet !== null) { - message.packet = Packet.fromPartial(object.packet); - } + message.packet = object.packet !== undefined && object.packet !== null ? Packet.fromPartial(object.packet) : undefined; message.proofUnreceived = object.proofUnreceived ?? new Uint8Array(); - if (object.proofHeight !== undefined && object.proofHeight !== null) { - message.proofHeight = Height.fromPartial(object.proofHeight); - } - if (object.nextSequenceRecv !== undefined && object.nextSequenceRecv !== null) { - message.nextSequenceRecv = BigInt(object.nextSequenceRecv.toString()); - } + message.proofHeight = object.proofHeight !== undefined && object.proofHeight !== null ? Height.fromPartial(object.proofHeight) : undefined; + message.nextSequenceRecv = object.nextSequenceRecv !== undefined && object.nextSequenceRecv !== null ? BigInt(object.nextSequenceRecv.toString()) : BigInt(0); message.signer = object.signer ?? ""; return message; }, @@ -2178,8 +2230,7 @@ export const MsgTimeoutResponse = { return message; }, fromJSON(_: any): MsgTimeoutResponse { - const obj = createBaseMsgTimeoutResponse(); - return obj; + return {}; }, toJSON(_: MsgTimeoutResponse): JsonSafe<MsgTimeoutResponse> { const obj: any = {}; @@ -2254,10 +2305,10 @@ export const MsgTimeoutOnClose = { if (message.proofHeight !== undefined) { Height.encode(message.proofHeight, writer.uint32(34).fork()).ldelim(); } - if (message.nextSequenceRecv !== undefined) { + if (message.nextSequenceRecv !== BigInt(0)) { writer.uint32(40).uint64(message.nextSequenceRecv); } - if (message.signer !== undefined) { + if (message.signer !== "") { writer.uint32(50).string(message.signer); } return writer; @@ -2295,14 +2346,14 @@ export const MsgTimeoutOnClose = { return message; }, fromJSON(object: any): MsgTimeoutOnClose { - const obj = createBaseMsgTimeoutOnClose(); - if (isSet(object.packet)) obj.packet = Packet.fromJSON(object.packet); - if (isSet(object.proofUnreceived)) obj.proofUnreceived = bytesFromBase64(object.proofUnreceived); - if (isSet(object.proofClose)) obj.proofClose = bytesFromBase64(object.proofClose); - if (isSet(object.proofHeight)) obj.proofHeight = Height.fromJSON(object.proofHeight); - if (isSet(object.nextSequenceRecv)) obj.nextSequenceRecv = BigInt(object.nextSequenceRecv.toString()); - if (isSet(object.signer)) obj.signer = String(object.signer); - return obj; + return { + packet: isSet(object.packet) ? Packet.fromJSON(object.packet) : undefined, + proofUnreceived: isSet(object.proofUnreceived) ? bytesFromBase64(object.proofUnreceived) : new Uint8Array(), + proofClose: isSet(object.proofClose) ? bytesFromBase64(object.proofClose) : new Uint8Array(), + proofHeight: isSet(object.proofHeight) ? Height.fromJSON(object.proofHeight) : undefined, + nextSequenceRecv: isSet(object.nextSequenceRecv) ? BigInt(object.nextSequenceRecv.toString()) : BigInt(0), + signer: isSet(object.signer) ? String(object.signer) : "" + }; }, toJSON(message: MsgTimeoutOnClose): JsonSafe<MsgTimeoutOnClose> { const obj: any = {}; @@ -2316,17 +2367,11 @@ export const MsgTimeoutOnClose = { }, fromPartial(object: DeepPartial<MsgTimeoutOnClose>): MsgTimeoutOnClose { const message = createBaseMsgTimeoutOnClose(); - if (object.packet !== undefined && object.packet !== null) { - message.packet = Packet.fromPartial(object.packet); - } + message.packet = object.packet !== undefined && object.packet !== null ? Packet.fromPartial(object.packet) : undefined; message.proofUnreceived = object.proofUnreceived ?? new Uint8Array(); message.proofClose = object.proofClose ?? new Uint8Array(); - if (object.proofHeight !== undefined && object.proofHeight !== null) { - message.proofHeight = Height.fromPartial(object.proofHeight); - } - if (object.nextSequenceRecv !== undefined && object.nextSequenceRecv !== null) { - message.nextSequenceRecv = BigInt(object.nextSequenceRecv.toString()); - } + message.proofHeight = object.proofHeight !== undefined && object.proofHeight !== null ? Height.fromPartial(object.proofHeight) : undefined; + message.nextSequenceRecv = object.nextSequenceRecv !== undefined && object.nextSequenceRecv !== null ? BigInt(object.nextSequenceRecv.toString()) : BigInt(0); message.signer = object.signer ?? ""; return message; }, @@ -2437,8 +2482,7 @@ export const MsgTimeoutOnCloseResponse = { return message; }, fromJSON(_: any): MsgTimeoutOnCloseResponse { - const obj = createBaseMsgTimeoutOnCloseResponse(); - return obj; + return {}; }, toJSON(_: MsgTimeoutOnCloseResponse): JsonSafe<MsgTimeoutOnCloseResponse> { const obj: any = {}; @@ -2512,7 +2556,7 @@ export const MsgAcknowledgement = { if (message.proofHeight !== undefined) { Height.encode(message.proofHeight, writer.uint32(34).fork()).ldelim(); } - if (message.signer !== undefined) { + if (message.signer !== "") { writer.uint32(42).string(message.signer); } return writer; @@ -2547,13 +2591,13 @@ export const MsgAcknowledgement = { return message; }, fromJSON(object: any): MsgAcknowledgement { - const obj = createBaseMsgAcknowledgement(); - if (isSet(object.packet)) obj.packet = Packet.fromJSON(object.packet); - if (isSet(object.acknowledgement)) obj.acknowledgement = bytesFromBase64(object.acknowledgement); - if (isSet(object.proofAcked)) obj.proofAcked = bytesFromBase64(object.proofAcked); - if (isSet(object.proofHeight)) obj.proofHeight = Height.fromJSON(object.proofHeight); - if (isSet(object.signer)) obj.signer = String(object.signer); - return obj; + return { + packet: isSet(object.packet) ? Packet.fromJSON(object.packet) : undefined, + acknowledgement: isSet(object.acknowledgement) ? bytesFromBase64(object.acknowledgement) : new Uint8Array(), + proofAcked: isSet(object.proofAcked) ? bytesFromBase64(object.proofAcked) : new Uint8Array(), + proofHeight: isSet(object.proofHeight) ? Height.fromJSON(object.proofHeight) : undefined, + signer: isSet(object.signer) ? String(object.signer) : "" + }; }, toJSON(message: MsgAcknowledgement): JsonSafe<MsgAcknowledgement> { const obj: any = {}; @@ -2566,14 +2610,10 @@ export const MsgAcknowledgement = { }, fromPartial(object: DeepPartial<MsgAcknowledgement>): MsgAcknowledgement { const message = createBaseMsgAcknowledgement(); - if (object.packet !== undefined && object.packet !== null) { - message.packet = Packet.fromPartial(object.packet); - } + message.packet = object.packet !== undefined && object.packet !== null ? Packet.fromPartial(object.packet) : undefined; message.acknowledgement = object.acknowledgement ?? new Uint8Array(); message.proofAcked = object.proofAcked ?? new Uint8Array(); - if (object.proofHeight !== undefined && object.proofHeight !== null) { - message.proofHeight = Height.fromPartial(object.proofHeight); - } + message.proofHeight = object.proofHeight !== undefined && object.proofHeight !== null ? Height.fromPartial(object.proofHeight) : undefined; message.signer = object.signer ?? ""; return message; }, @@ -2677,8 +2717,7 @@ export const MsgAcknowledgementResponse = { return message; }, fromJSON(_: any): MsgAcknowledgementResponse { - const obj = createBaseMsgAcknowledgementResponse(); - return obj; + return {}; }, toJSON(_: MsgAcknowledgementResponse): JsonSafe<MsgAcknowledgementResponse> { const obj: any = {}; diff --git a/__fixtures__/v-next/outputv4/ibc/core/client/v1/client.ts b/__fixtures__/v-next/outputv4/ibc/core/client/v1/client.ts index 7ec1280379..bfd733ee23 100644 --- a/__fixtures__/v-next/outputv4/ibc/core/client/v1/client.ts +++ b/__fixtures__/v-next/outputv4/ibc/core/client/v1/client.ts @@ -1,8 +1,9 @@ -import { Any, AnySDKType } from "../../../../google/protobuf/any.js"; -import { Plan, PlanSDKType } from "../../../../cosmos/upgrade/v1beta1/upgrade.js"; -import { BinaryReader, BinaryWriter } from "../../../../binary.js"; -import { isSet, DeepPartial } from "../../../../helpers.js"; -import { JsonSafe } from "../../../../json-safe.js"; +import { Any, AnySDKType } from "../../../../google/protobuf/any"; +import { Plan, PlanSDKType } from "../../../../cosmos/upgrade/v1beta1/upgrade"; +import { BinaryReader, BinaryWriter } from "../../../../binary"; +import { isSet, DeepPartial } from "../../../../helpers"; +import { JsonSafe } from "../../../../json-safe"; +import { ComputedRef } from "vue"; export const protobufPackage = "ibc.core.client.v1"; /** * IdentifiedClientState defines a client state with an additional client @@ -14,6 +15,10 @@ export interface IdentifiedClientState { /** client state */ clientState?: Any; } +export interface ReactiveIdentifiedClientState { + clientId: ComputedRef<string>; + clientState?: ComputedRef<Any>; +} export interface IdentifiedClientStateProtoMsg { typeUrl: "/ibc.core.client.v1.IdentifiedClientState"; value: Uint8Array; @@ -36,6 +41,10 @@ export interface ConsensusStateWithHeight { /** consensus state */ consensusState?: Any; } +export interface ReactiveConsensusStateWithHeight { + height: ComputedRef<Height>; + consensusState?: ComputedRef<Any>; +} export interface ConsensusStateWithHeightProtoMsg { typeUrl: "/ibc.core.client.v1.ConsensusStateWithHeight"; value: Uint8Array; @@ -58,6 +67,10 @@ export interface ClientConsensusStates { /** consensus states and their heights associated with the client */ consensusStates: ConsensusStateWithHeight[]; } +export interface ReactiveClientConsensusStates { + clientId: ComputedRef<string>; + consensusStates: ComputedRef<ConsensusStateWithHeight[]>; +} export interface ClientConsensusStatesProtoMsg { typeUrl: "/ibc.core.client.v1.ClientConsensusStates"; value: Uint8Array; @@ -89,6 +102,12 @@ export interface ClientUpdateProposal { */ substituteClientId: string; } +export interface ReactiveClientUpdateProposal { + title: ComputedRef<string>; + description: ComputedRef<string>; + subjectClientId: ComputedRef<string>; + substituteClientId: ComputedRef<string>; +} export interface ClientUpdateProposalProtoMsg { typeUrl: "/ibc.core.client.v1.ClientUpdateProposal"; value: Uint8Array; @@ -123,6 +142,12 @@ export interface UpgradeProposal { */ upgradedClientState?: Any; } +export interface ReactiveUpgradeProposal { + title: ComputedRef<string>; + description: ComputedRef<string>; + plan: ComputedRef<Plan>; + upgradedClientState?: ComputedRef<Any>; +} export interface UpgradeProposalProtoMsg { typeUrl: "/ibc.core.client.v1.UpgradeProposal"; value: Uint8Array; @@ -155,6 +180,10 @@ export interface Height { /** the height within the given revision */ revisionHeight: bigint; } +export interface ReactiveHeight { + revisionNumber: ComputedRef<bigint>; + revisionHeight: ComputedRef<bigint>; +} export interface HeightProtoMsg { typeUrl: "/ibc.core.client.v1.Height"; value: Uint8Array; @@ -180,6 +209,9 @@ export interface Params { /** allowed_clients defines the list of allowed client state types. */ allowedClients: string[]; } +export interface ReactiveParams { + allowedClients: ComputedRef<string[]>; +} export interface ParamsProtoMsg { typeUrl: "/ibc.core.client.v1.Params"; value: Uint8Array; @@ -197,7 +229,7 @@ function createBaseIdentifiedClientState(): IdentifiedClientState { export const IdentifiedClientState = { typeUrl: "/ibc.core.client.v1.IdentifiedClientState", encode(message: IdentifiedClientState, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.clientId !== undefined) { + if (message.clientId !== "") { writer.uint32(10).string(message.clientId); } if (message.clientState !== undefined) { @@ -226,10 +258,10 @@ export const IdentifiedClientState = { return message; }, fromJSON(object: any): IdentifiedClientState { - const obj = createBaseIdentifiedClientState(); - if (isSet(object.clientId)) obj.clientId = String(object.clientId); - if (isSet(object.clientState)) obj.clientState = Any.fromJSON(object.clientState); - return obj; + return { + clientId: isSet(object.clientId) ? String(object.clientId) : "", + clientState: isSet(object.clientState) ? Any.fromJSON(object.clientState) : undefined + }; }, toJSON(message: IdentifiedClientState): JsonSafe<IdentifiedClientState> { const obj: any = {}; @@ -240,9 +272,7 @@ export const IdentifiedClientState = { fromPartial(object: DeepPartial<IdentifiedClientState>): IdentifiedClientState { const message = createBaseIdentifiedClientState(); message.clientId = object.clientId ?? ""; - if (object.clientState !== undefined && object.clientState !== null) { - message.clientState = Any.fromPartial(object.clientState); - } + message.clientState = object.clientState !== undefined && object.clientState !== null ? Any.fromPartial(object.clientState) : undefined; return message; }, fromSDK(object: IdentifiedClientStateSDKType): IdentifiedClientState { @@ -339,10 +369,10 @@ export const ConsensusStateWithHeight = { return message; }, fromJSON(object: any): ConsensusStateWithHeight { - const obj = createBaseConsensusStateWithHeight(); - if (isSet(object.height)) obj.height = Height.fromJSON(object.height); - if (isSet(object.consensusState)) obj.consensusState = Any.fromJSON(object.consensusState); - return obj; + return { + height: isSet(object.height) ? Height.fromJSON(object.height) : undefined, + consensusState: isSet(object.consensusState) ? Any.fromJSON(object.consensusState) : undefined + }; }, toJSON(message: ConsensusStateWithHeight): JsonSafe<ConsensusStateWithHeight> { const obj: any = {}; @@ -352,12 +382,8 @@ export const ConsensusStateWithHeight = { }, fromPartial(object: DeepPartial<ConsensusStateWithHeight>): ConsensusStateWithHeight { const message = createBaseConsensusStateWithHeight(); - if (object.height !== undefined && object.height !== null) { - message.height = Height.fromPartial(object.height); - } - if (object.consensusState !== undefined && object.consensusState !== null) { - message.consensusState = Any.fromPartial(object.consensusState); - } + message.height = object.height !== undefined && object.height !== null ? Height.fromPartial(object.height) : undefined; + message.consensusState = object.consensusState !== undefined && object.consensusState !== null ? Any.fromPartial(object.consensusState) : undefined; return message; }, fromSDK(object: ConsensusStateWithHeightSDKType): ConsensusStateWithHeight { @@ -425,7 +451,7 @@ function createBaseClientConsensusStates(): ClientConsensusStates { export const ClientConsensusStates = { typeUrl: "/ibc.core.client.v1.ClientConsensusStates", encode(message: ClientConsensusStates, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.clientId !== undefined) { + if (message.clientId !== "") { writer.uint32(10).string(message.clientId); } for (const v of message.consensusStates) { @@ -454,10 +480,10 @@ export const ClientConsensusStates = { return message; }, fromJSON(object: any): ClientConsensusStates { - const obj = createBaseClientConsensusStates(); - if (isSet(object.clientId)) obj.clientId = String(object.clientId); - if (Array.isArray(object?.consensusStates)) obj.consensusStates = object.consensusStates.map((e: any) => ConsensusStateWithHeight.fromJSON(e)); - return obj; + return { + clientId: isSet(object.clientId) ? String(object.clientId) : "", + consensusStates: Array.isArray(object?.consensusStates) ? object.consensusStates.map((e: any) => ConsensusStateWithHeight.fromJSON(e)) : [] + }; }, toJSON(message: ClientConsensusStates): JsonSafe<ClientConsensusStates> { const obj: any = {}; @@ -548,16 +574,16 @@ function createBaseClientUpdateProposal(): ClientUpdateProposal { export const ClientUpdateProposal = { typeUrl: "/ibc.core.client.v1.ClientUpdateProposal", encode(message: ClientUpdateProposal, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.title !== undefined) { + if (message.title !== "") { writer.uint32(10).string(message.title); } - if (message.description !== undefined) { + if (message.description !== "") { writer.uint32(18).string(message.description); } - if (message.subjectClientId !== undefined) { + if (message.subjectClientId !== "") { writer.uint32(26).string(message.subjectClientId); } - if (message.substituteClientId !== undefined) { + if (message.substituteClientId !== "") { writer.uint32(34).string(message.substituteClientId); } return writer; @@ -589,12 +615,12 @@ export const ClientUpdateProposal = { return message; }, fromJSON(object: any): ClientUpdateProposal { - const obj = createBaseClientUpdateProposal(); - if (isSet(object.title)) obj.title = String(object.title); - if (isSet(object.description)) obj.description = String(object.description); - if (isSet(object.subjectClientId)) obj.subjectClientId = String(object.subjectClientId); - if (isSet(object.substituteClientId)) obj.substituteClientId = String(object.substituteClientId); - return obj; + return { + title: isSet(object.title) ? String(object.title) : "", + description: isSet(object.description) ? String(object.description) : "", + subjectClientId: isSet(object.subjectClientId) ? String(object.subjectClientId) : "", + substituteClientId: isSet(object.substituteClientId) ? String(object.substituteClientId) : "" + }; }, toJSON(message: ClientUpdateProposal): JsonSafe<ClientUpdateProposal> { const obj: any = {}; @@ -693,10 +719,10 @@ function createBaseUpgradeProposal(): UpgradeProposal { export const UpgradeProposal = { typeUrl: "/ibc.core.client.v1.UpgradeProposal", encode(message: UpgradeProposal, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.title !== undefined) { + if (message.title !== "") { writer.uint32(10).string(message.title); } - if (message.description !== undefined) { + if (message.description !== "") { writer.uint32(18).string(message.description); } if (message.plan !== undefined) { @@ -734,12 +760,12 @@ export const UpgradeProposal = { return message; }, fromJSON(object: any): UpgradeProposal { - const obj = createBaseUpgradeProposal(); - 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); - if (isSet(object.upgradedClientState)) obj.upgradedClientState = Any.fromJSON(object.upgradedClientState); - return obj; + return { + title: isSet(object.title) ? String(object.title) : "", + description: isSet(object.description) ? String(object.description) : "", + plan: isSet(object.plan) ? Plan.fromJSON(object.plan) : undefined, + upgradedClientState: isSet(object.upgradedClientState) ? Any.fromJSON(object.upgradedClientState) : undefined + }; }, toJSON(message: UpgradeProposal): JsonSafe<UpgradeProposal> { const obj: any = {}; @@ -753,12 +779,8 @@ export const UpgradeProposal = { const message = createBaseUpgradeProposal(); message.title = object.title ?? ""; message.description = object.description ?? ""; - if (object.plan !== undefined && object.plan !== null) { - message.plan = Plan.fromPartial(object.plan); - } - if (object.upgradedClientState !== undefined && object.upgradedClientState !== null) { - message.upgradedClientState = Any.fromPartial(object.upgradedClientState); - } + message.plan = object.plan !== undefined && object.plan !== null ? Plan.fromPartial(object.plan) : undefined; + message.upgradedClientState = object.upgradedClientState !== undefined && object.upgradedClientState !== null ? Any.fromPartial(object.upgradedClientState) : undefined; return message; }, fromSDK(object: UpgradeProposalSDKType): UpgradeProposal { @@ -840,10 +862,10 @@ function createBaseHeight(): Height { export const Height = { typeUrl: "/ibc.core.client.v1.Height", encode(message: Height, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.revisionNumber !== undefined) { + if (message.revisionNumber !== BigInt(0)) { writer.uint32(8).uint64(message.revisionNumber); } - if (message.revisionHeight !== undefined) { + if (message.revisionHeight !== BigInt(0)) { writer.uint32(16).uint64(message.revisionHeight); } return writer; @@ -869,10 +891,10 @@ export const Height = { return message; }, fromJSON(object: any): Height { - const obj = createBaseHeight(); - if (isSet(object.revisionNumber)) obj.revisionNumber = BigInt(object.revisionNumber.toString()); - if (isSet(object.revisionHeight)) obj.revisionHeight = BigInt(object.revisionHeight.toString()); - return obj; + return { + revisionNumber: isSet(object.revisionNumber) ? BigInt(object.revisionNumber.toString()) : BigInt(0), + revisionHeight: isSet(object.revisionHeight) ? BigInt(object.revisionHeight.toString()) : BigInt(0) + }; }, toJSON(message: Height): JsonSafe<Height> { const obj: any = {}; @@ -882,12 +904,8 @@ export const Height = { }, fromPartial(object: DeepPartial<Height>): Height { const message = createBaseHeight(); - if (object.revisionNumber !== undefined && object.revisionNumber !== null) { - message.revisionNumber = BigInt(object.revisionNumber.toString()); - } - if (object.revisionHeight !== undefined && object.revisionHeight !== null) { - message.revisionHeight = BigInt(object.revisionHeight.toString()); - } + message.revisionNumber = object.revisionNumber !== undefined && object.revisionNumber !== null ? BigInt(object.revisionNumber.toString()) : BigInt(0); + message.revisionHeight = object.revisionHeight !== undefined && object.revisionHeight !== null ? BigInt(object.revisionHeight.toString()) : BigInt(0); return message; }, fromSDK(object: HeightSDKType): Height { @@ -973,9 +991,9 @@ export const Params = { return message; }, fromJSON(object: any): Params { - const obj = createBaseParams(); - if (Array.isArray(object?.allowedClients)) obj.allowedClients = object.allowedClients.map((e: any) => String(e)); - return obj; + return { + allowedClients: Array.isArray(object?.allowedClients) ? object.allowedClients.map((e: any) => String(e)) : [] + }; }, toJSON(message: Params): JsonSafe<Params> { const obj: any = {}; diff --git a/__fixtures__/v-next/outputv4/ibc/core/client/v1/genesis.ts b/__fixtures__/v-next/outputv4/ibc/core/client/v1/genesis.ts index 5758609a4f..6655d76f7b 100644 --- a/__fixtures__/v-next/outputv4/ibc/core/client/v1/genesis.ts +++ b/__fixtures__/v-next/outputv4/ibc/core/client/v1/genesis.ts @@ -1,7 +1,8 @@ -import { IdentifiedClientState, IdentifiedClientStateSDKType, ClientConsensusStates, ClientConsensusStatesSDKType, Params, ParamsSDKType } from "./client.js"; -import { BinaryReader, BinaryWriter } from "../../../../binary.js"; -import { isSet, DeepPartial, bytesFromBase64, base64FromBytes } from "../../../../helpers.js"; -import { JsonSafe } from "../../../../json-safe.js"; +import { IdentifiedClientState, IdentifiedClientStateSDKType, ClientConsensusStates, ClientConsensusStatesSDKType, Params, ParamsSDKType } from "./client"; +import { BinaryReader, BinaryWriter } from "../../../../binary"; +import { isSet, DeepPartial, bytesFromBase64, base64FromBytes } from "../../../../helpers"; +import { JsonSafe } from "../../../../json-safe"; +import { ComputedRef } from "vue"; export const protobufPackage = "ibc.core.client.v1"; /** GenesisState defines the ibc client submodule's genesis state. */ export interface GenesisState { @@ -17,6 +18,14 @@ export interface GenesisState { /** the sequence for the next generated client identifier */ nextClientSequence: bigint; } +export interface ReactiveGenesisState { + clients: ComputedRef<IdentifiedClientState[]>; + clientsConsensus: ComputedRef<ClientConsensusStates[]>; + clientsMetadata: ComputedRef<IdentifiedGenesisMetadata[]>; + params: ComputedRef<Params>; + createLocalhost: ComputedRef<boolean>; + nextClientSequence: ComputedRef<bigint>; +} export interface GenesisStateProtoMsg { typeUrl: "/ibc.core.client.v1.GenesisState"; value: Uint8Array; @@ -40,6 +49,10 @@ export interface GenesisMetadata { /** metadata value */ value: Uint8Array; } +export interface ReactiveGenesisMetadata { + key: ComputedRef<Uint8Array>; + value: ComputedRef<Uint8Array>; +} export interface GenesisMetadataProtoMsg { typeUrl: "/ibc.core.client.v1.GenesisMetadata"; value: Uint8Array; @@ -60,6 +73,10 @@ export interface IdentifiedGenesisMetadata { clientId: string; clientMetadata: GenesisMetadata[]; } +export interface ReactiveIdentifiedGenesisMetadata { + clientId: ComputedRef<string>; + clientMetadata: ComputedRef<GenesisMetadata[]>; +} export interface IdentifiedGenesisMetadataProtoMsg { typeUrl: "/ibc.core.client.v1.IdentifiedGenesisMetadata"; value: Uint8Array; @@ -97,10 +114,10 @@ export const GenesisState = { if (message.params !== undefined) { Params.encode(message.params, writer.uint32(34).fork()).ldelim(); } - if (message.createLocalhost !== undefined) { + if (message.createLocalhost === true) { writer.uint32(40).bool(message.createLocalhost); } - if (message.nextClientSequence !== undefined) { + if (message.nextClientSequence !== BigInt(0)) { writer.uint32(48).uint64(message.nextClientSequence); } return writer; @@ -138,14 +155,14 @@ export const GenesisState = { return message; }, fromJSON(object: any): GenesisState { - const obj = createBaseGenesisState(); - if (Array.isArray(object?.clients)) obj.clients = object.clients.map((e: any) => IdentifiedClientState.fromJSON(e)); - if (Array.isArray(object?.clientsConsensus)) obj.clientsConsensus = object.clientsConsensus.map((e: any) => ClientConsensusStates.fromJSON(e)); - if (Array.isArray(object?.clientsMetadata)) obj.clientsMetadata = object.clientsMetadata.map((e: any) => IdentifiedGenesisMetadata.fromJSON(e)); - if (isSet(object.params)) obj.params = Params.fromJSON(object.params); - if (isSet(object.createLocalhost)) obj.createLocalhost = Boolean(object.createLocalhost); - if (isSet(object.nextClientSequence)) obj.nextClientSequence = BigInt(object.nextClientSequence.toString()); - return obj; + return { + clients: Array.isArray(object?.clients) ? object.clients.map((e: any) => IdentifiedClientState.fromJSON(e)) : [], + clientsConsensus: Array.isArray(object?.clientsConsensus) ? object.clientsConsensus.map((e: any) => ClientConsensusStates.fromJSON(e)) : [], + clientsMetadata: Array.isArray(object?.clientsMetadata) ? object.clientsMetadata.map((e: any) => IdentifiedGenesisMetadata.fromJSON(e)) : [], + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + createLocalhost: isSet(object.createLocalhost) ? Boolean(object.createLocalhost) : false, + nextClientSequence: isSet(object.nextClientSequence) ? BigInt(object.nextClientSequence.toString()) : BigInt(0) + }; }, toJSON(message: GenesisState): JsonSafe<GenesisState> { const obj: any = {}; @@ -174,13 +191,9 @@ export const GenesisState = { message.clients = object.clients?.map(e => IdentifiedClientState.fromPartial(e)) || []; message.clientsConsensus = object.clientsConsensus?.map(e => ClientConsensusStates.fromPartial(e)) || []; message.clientsMetadata = object.clientsMetadata?.map(e => IdentifiedGenesisMetadata.fromPartial(e)) || []; - if (object.params !== undefined && object.params !== null) { - message.params = Params.fromPartial(object.params); - } + message.params = object.params !== undefined && object.params !== null ? Params.fromPartial(object.params) : undefined; message.createLocalhost = object.createLocalhost ?? false; - if (object.nextClientSequence !== undefined && object.nextClientSequence !== null) { - message.nextClientSequence = BigInt(object.nextClientSequence.toString()); - } + message.nextClientSequence = object.nextClientSequence !== undefined && object.nextClientSequence !== null ? BigInt(object.nextClientSequence.toString()) : BigInt(0); return message; }, fromSDK(object: GenesisStateSDKType): GenesisState { @@ -323,10 +336,10 @@ export const GenesisMetadata = { return message; }, fromJSON(object: any): GenesisMetadata { - const obj = createBaseGenesisMetadata(); - if (isSet(object.key)) obj.key = bytesFromBase64(object.key); - if (isSet(object.value)) obj.value = bytesFromBase64(object.value); - return obj; + return { + key: isSet(object.key) ? bytesFromBase64(object.key) : new Uint8Array(), + value: isSet(object.value) ? bytesFromBase64(object.value) : new Uint8Array() + }; }, toJSON(message: GenesisMetadata): JsonSafe<GenesisMetadata> { const obj: any = {}; @@ -405,7 +418,7 @@ function createBaseIdentifiedGenesisMetadata(): IdentifiedGenesisMetadata { export const IdentifiedGenesisMetadata = { typeUrl: "/ibc.core.client.v1.IdentifiedGenesisMetadata", encode(message: IdentifiedGenesisMetadata, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.clientId !== undefined) { + if (message.clientId !== "") { writer.uint32(10).string(message.clientId); } for (const v of message.clientMetadata) { @@ -434,10 +447,10 @@ export const IdentifiedGenesisMetadata = { return message; }, fromJSON(object: any): IdentifiedGenesisMetadata { - const obj = createBaseIdentifiedGenesisMetadata(); - if (isSet(object.clientId)) obj.clientId = String(object.clientId); - if (Array.isArray(object?.clientMetadata)) obj.clientMetadata = object.clientMetadata.map((e: any) => GenesisMetadata.fromJSON(e)); - return obj; + return { + clientId: isSet(object.clientId) ? String(object.clientId) : "", + clientMetadata: Array.isArray(object?.clientMetadata) ? object.clientMetadata.map((e: any) => GenesisMetadata.fromJSON(e)) : [] + }; }, toJSON(message: IdentifiedGenesisMetadata): JsonSafe<IdentifiedGenesisMetadata> { const obj: any = {}; diff --git a/__fixtures__/v-next/outputv4/ibc/core/client/v1/query.lcd.ts b/__fixtures__/v-next/outputv4/ibc/core/client/v1/query.lcd.ts index 798d0480eb..2461a687d4 100644 --- a/__fixtures__/v-next/outputv4/ibc/core/client/v1/query.lcd.ts +++ b/__fixtures__/v-next/outputv4/ibc/core/client/v1/query.lcd.ts @@ -1,9 +1,9 @@ -import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../../../cosmos/base/query/v1beta1/pagination.js"; -import { Any, AnySDKType } from "../../../../google/protobuf/any.js"; -import { Height, HeightSDKType, IdentifiedClientState, IdentifiedClientStateSDKType, ConsensusStateWithHeight, ConsensusStateWithHeightSDKType, Params, ParamsSDKType } from "./client.js"; -import { setPaginationParams } from "../../../../helpers.js"; +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../../../cosmos/base/query/v1beta1/pagination"; +import { Any, AnySDKType } from "../../../../google/protobuf/any"; +import { Height, HeightSDKType, IdentifiedClientState, IdentifiedClientStateSDKType, ConsensusStateWithHeight, ConsensusStateWithHeightSDKType, Params, ParamsSDKType } from "./client"; +import { setPaginationParams } from "../../../../helpers"; import { LCDClient } from "@cosmology/lcd"; -import { QueryClientStateRequest, QueryClientStateRequestSDKType, QueryClientStateResponse, QueryClientStateResponseSDKType, QueryClientStatesRequest, QueryClientStatesRequestSDKType, QueryClientStatesResponse, QueryClientStatesResponseSDKType, QueryConsensusStateRequest, QueryConsensusStateRequestSDKType, QueryConsensusStateResponse, QueryConsensusStateResponseSDKType, QueryConsensusStatesRequest, QueryConsensusStatesRequestSDKType, QueryConsensusStatesResponse, QueryConsensusStatesResponseSDKType, QueryClientStatusRequest, QueryClientStatusRequestSDKType, QueryClientStatusResponse, QueryClientStatusResponseSDKType, QueryClientParamsRequest, QueryClientParamsRequestSDKType, QueryClientParamsResponse, QueryClientParamsResponseSDKType, QueryUpgradedClientStateRequest, QueryUpgradedClientStateRequestSDKType, QueryUpgradedClientStateResponse, QueryUpgradedClientStateResponseSDKType, QueryUpgradedConsensusStateRequest, QueryUpgradedConsensusStateRequestSDKType, QueryUpgradedConsensusStateResponse, QueryUpgradedConsensusStateResponseSDKType } from "./query.js"; +import { QueryClientStateRequest, QueryClientStateRequestSDKType, QueryClientStateResponse, QueryClientStateResponseSDKType, QueryClientStatesRequest, QueryClientStatesRequestSDKType, QueryClientStatesResponse, QueryClientStatesResponseSDKType, QueryConsensusStateRequest, QueryConsensusStateRequestSDKType, QueryConsensusStateResponse, QueryConsensusStateResponseSDKType, QueryConsensusStatesRequest, QueryConsensusStatesRequestSDKType, QueryConsensusStatesResponse, QueryConsensusStatesResponseSDKType, QueryClientStatusRequest, QueryClientStatusRequestSDKType, QueryClientStatusResponse, QueryClientStatusResponseSDKType, QueryClientParamsRequest, QueryClientParamsRequestSDKType, QueryClientParamsResponse, QueryClientParamsResponseSDKType, QueryUpgradedClientStateRequest, QueryUpgradedClientStateRequestSDKType, QueryUpgradedClientStateResponse, QueryUpgradedClientStateResponseSDKType, QueryUpgradedConsensusStateRequest, QueryUpgradedConsensusStateRequestSDKType, QueryUpgradedConsensusStateResponse, QueryUpgradedConsensusStateResponseSDKType } from "./query"; export class LCDQueryClient { req: LCDClient; constructor({ @@ -28,7 +28,7 @@ export class LCDQueryClient { } /* ClientStates queries all the IBC light clients of a chain. */ async clientStates(params: QueryClientStatesRequest = { - pagination: PageRequest.fromPartial({}) + pagination: undefined }): Promise<QueryClientStatesResponseSDKType> { const options: any = { params: {} diff --git a/__fixtures__/v-next/outputv4/ibc/core/client/v1/query.rpc.Query.ts b/__fixtures__/v-next/outputv4/ibc/core/client/v1/query.rpc.Query.ts index 56430ae5a5..daa5df9439 100644 --- a/__fixtures__/v-next/outputv4/ibc/core/client/v1/query.rpc.Query.ts +++ b/__fixtures__/v-next/outputv4/ibc/core/client/v1/query.rpc.Query.ts @@ -1,10 +1,10 @@ -import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../../../cosmos/base/query/v1beta1/pagination.js"; -import { Any, AnySDKType } from "../../../../google/protobuf/any.js"; -import { Height, HeightSDKType, IdentifiedClientState, IdentifiedClientStateSDKType, ConsensusStateWithHeight, ConsensusStateWithHeightSDKType, Params, ParamsSDKType } from "./client.js"; -import { Rpc } from "../../../../helpers.js"; -import { BinaryReader } from "../../../../binary.js"; +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../../../cosmos/base/query/v1beta1/pagination"; +import { Any, AnySDKType } from "../../../../google/protobuf/any"; +import { Height, HeightSDKType, IdentifiedClientState, IdentifiedClientStateSDKType, ConsensusStateWithHeight, ConsensusStateWithHeightSDKType, Params, ParamsSDKType } from "./client"; +import { Rpc } from "../../../../helpers"; +import { BinaryReader } from "../../../../binary"; import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; -import { QueryClientStateRequest, QueryClientStateRequestSDKType, QueryClientStateResponse, QueryClientStateResponseSDKType, QueryClientStatesRequest, QueryClientStatesRequestSDKType, QueryClientStatesResponse, QueryClientStatesResponseSDKType, QueryConsensusStateRequest, QueryConsensusStateRequestSDKType, QueryConsensusStateResponse, QueryConsensusStateResponseSDKType, QueryConsensusStatesRequest, QueryConsensusStatesRequestSDKType, QueryConsensusStatesResponse, QueryConsensusStatesResponseSDKType, QueryClientStatusRequest, QueryClientStatusRequestSDKType, QueryClientStatusResponse, QueryClientStatusResponseSDKType, QueryClientParamsRequest, QueryClientParamsRequestSDKType, QueryClientParamsResponse, QueryClientParamsResponseSDKType, QueryUpgradedClientStateRequest, QueryUpgradedClientStateRequestSDKType, QueryUpgradedClientStateResponse, QueryUpgradedClientStateResponseSDKType, QueryUpgradedConsensusStateRequest, QueryUpgradedConsensusStateRequestSDKType, QueryUpgradedConsensusStateResponse, QueryUpgradedConsensusStateResponseSDKType } from "./query.js"; +import { QueryClientStateRequest, QueryClientStateRequestSDKType, QueryClientStateResponse, QueryClientStateResponseSDKType, QueryClientStatesRequest, QueryClientStatesRequestSDKType, QueryClientStatesResponse, QueryClientStatesResponseSDKType, QueryConsensusStateRequest, QueryConsensusStateRequestSDKType, QueryConsensusStateResponse, QueryConsensusStateResponseSDKType, QueryConsensusStatesRequest, QueryConsensusStatesRequestSDKType, QueryConsensusStatesResponse, QueryConsensusStatesResponseSDKType, QueryClientStatusRequest, QueryClientStatusRequestSDKType, QueryClientStatusResponse, QueryClientStatusResponseSDKType, QueryClientParamsRequest, QueryClientParamsRequestSDKType, QueryClientParamsResponse, QueryClientParamsResponseSDKType, QueryUpgradedClientStateRequest, QueryUpgradedClientStateRequestSDKType, QueryUpgradedClientStateResponse, QueryUpgradedClientStateResponseSDKType, QueryUpgradedConsensusStateRequest, QueryUpgradedConsensusStateRequestSDKType, QueryUpgradedConsensusStateResponse, QueryUpgradedConsensusStateResponseSDKType, ReactiveQueryClientStateRequest, ReactiveQueryClientStatesRequest, ReactiveQueryConsensusStateRequest, ReactiveQueryConsensusStatesRequest, ReactiveQueryClientStatusRequest, ReactiveQueryClientParamsRequest, ReactiveQueryUpgradedClientStateRequest, ReactiveQueryUpgradedConsensusStateRequest } from "./query"; /** Query provides defines the gRPC querier service */ export interface Query { /** ClientState queries an IBC light client. */ @@ -49,7 +49,7 @@ export class QueryClientImpl implements Query { return promise.then(data => QueryClientStateResponse.decode(new BinaryReader(data))); } clientStates(request: QueryClientStatesRequest = { - pagination: PageRequest.fromPartial({}) + pagination: undefined }): Promise<QueryClientStatesResponse> { const data = QueryClientStatesRequest.encode(request).finish(); const promise = this.rpc.request("ibc.core.client.v1.Query", "ClientStates", data); diff --git a/__fixtures__/v-next/outputv4/ibc/core/client/v1/query.ts b/__fixtures__/v-next/outputv4/ibc/core/client/v1/query.ts index 4dfcdec70b..a5a94e7a20 100644 --- a/__fixtures__/v-next/outputv4/ibc/core/client/v1/query.ts +++ b/__fixtures__/v-next/outputv4/ibc/core/client/v1/query.ts @@ -1,9 +1,10 @@ -import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../../../cosmos/base/query/v1beta1/pagination.js"; -import { Any, AnySDKType } from "../../../../google/protobuf/any.js"; -import { Height, HeightSDKType, IdentifiedClientState, IdentifiedClientStateSDKType, ConsensusStateWithHeight, ConsensusStateWithHeightSDKType, Params, ParamsSDKType } from "./client.js"; -import { BinaryReader, BinaryWriter } from "../../../../binary.js"; -import { isSet, DeepPartial, bytesFromBase64, base64FromBytes } from "../../../../helpers.js"; -import { JsonSafe } from "../../../../json-safe.js"; +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../../../cosmos/base/query/v1beta1/pagination"; +import { Any, AnySDKType } from "../../../../google/protobuf/any"; +import { Height, HeightSDKType, IdentifiedClientState, IdentifiedClientStateSDKType, ConsensusStateWithHeight, ConsensusStateWithHeightSDKType, Params, ParamsSDKType } from "./client"; +import { BinaryReader, BinaryWriter } from "../../../../binary"; +import { isSet, DeepPartial, bytesFromBase64, base64FromBytes } from "../../../../helpers"; +import { JsonSafe } from "../../../../json-safe"; +import { ComputedRef } from "vue"; export const protobufPackage = "ibc.core.client.v1"; /** * QueryClientStateRequest is the request type for the Query/ClientState RPC @@ -13,6 +14,9 @@ export interface QueryClientStateRequest { /** client state unique identifier */ clientId: string; } +export interface ReactiveQueryClientStateRequest { + clientId: ComputedRef<string>; +} export interface QueryClientStateRequestProtoMsg { typeUrl: "/ibc.core.client.v1.QueryClientStateRequest"; value: Uint8Array; @@ -37,6 +41,11 @@ export interface QueryClientStateResponse { /** height at which the proof was retrieved */ proofHeight: Height; } +export interface ReactiveQueryClientStateResponse { + clientState?: ComputedRef<Any>; + proof: ComputedRef<Uint8Array>; + proofHeight: ComputedRef<Height>; +} export interface QueryClientStateResponseProtoMsg { typeUrl: "/ibc.core.client.v1.QueryClientStateResponse"; value: Uint8Array; @@ -59,6 +68,9 @@ export interface QueryClientStatesRequest { /** pagination request */ pagination?: PageRequest; } +export interface ReactiveQueryClientStatesRequest { + pagination?: ComputedRef<PageRequest>; +} export interface QueryClientStatesRequestProtoMsg { typeUrl: "/ibc.core.client.v1.QueryClientStatesRequest"; value: Uint8Array; @@ -80,6 +92,10 @@ export interface QueryClientStatesResponse { /** pagination response */ pagination?: PageResponse; } +export interface ReactiveQueryClientStatesResponse { + clientStates: ComputedRef<IdentifiedClientState[]>; + pagination?: ComputedRef<PageResponse>; +} export interface QueryClientStatesResponseProtoMsg { typeUrl: "/ibc.core.client.v1.QueryClientStatesResponse"; value: Uint8Array; @@ -110,6 +126,12 @@ export interface QueryConsensusStateRequest { */ latestHeight: boolean; } +export interface ReactiveQueryConsensusStateRequest { + clientId: ComputedRef<string>; + revisionNumber: ComputedRef<bigint>; + revisionHeight: ComputedRef<bigint>; + latestHeight: ComputedRef<boolean>; +} export interface QueryConsensusStateRequestProtoMsg { typeUrl: "/ibc.core.client.v1.QueryConsensusStateRequest"; value: Uint8Array; @@ -137,6 +159,11 @@ export interface QueryConsensusStateResponse { /** height at which the proof was retrieved */ proofHeight: Height; } +export interface ReactiveQueryConsensusStateResponse { + consensusState?: ComputedRef<Any>; + proof: ComputedRef<Uint8Array>; + proofHeight: ComputedRef<Height>; +} export interface QueryConsensusStateResponseProtoMsg { typeUrl: "/ibc.core.client.v1.QueryConsensusStateResponse"; value: Uint8Array; @@ -160,6 +187,10 @@ export interface QueryConsensusStatesRequest { /** pagination request */ pagination?: PageRequest; } +export interface ReactiveQueryConsensusStatesRequest { + clientId: ComputedRef<string>; + pagination?: ComputedRef<PageRequest>; +} export interface QueryConsensusStatesRequestProtoMsg { typeUrl: "/ibc.core.client.v1.QueryConsensusStatesRequest"; value: Uint8Array; @@ -182,6 +213,10 @@ export interface QueryConsensusStatesResponse { /** pagination response */ pagination?: PageResponse; } +export interface ReactiveQueryConsensusStatesResponse { + consensusStates: ComputedRef<ConsensusStateWithHeight[]>; + pagination?: ComputedRef<PageResponse>; +} export interface QueryConsensusStatesResponseProtoMsg { typeUrl: "/ibc.core.client.v1.QueryConsensusStatesResponse"; value: Uint8Array; @@ -202,6 +237,9 @@ export interface QueryClientStatusRequest { /** client unique identifier */ clientId: string; } +export interface ReactiveQueryClientStatusRequest { + clientId: ComputedRef<string>; +} export interface QueryClientStatusRequestProtoMsg { typeUrl: "/ibc.core.client.v1.QueryClientStatusRequest"; value: Uint8Array; @@ -220,6 +258,9 @@ export interface QueryClientStatusRequestSDKType { export interface QueryClientStatusResponse { status: string; } +export interface ReactiveQueryClientStatusResponse { + status: ComputedRef<string>; +} export interface QueryClientStatusResponseProtoMsg { typeUrl: "/ibc.core.client.v1.QueryClientStatusResponse"; value: Uint8Array; @@ -236,6 +277,7 @@ export interface QueryClientStatusResponseSDKType { * method. */ export interface QueryClientParamsRequest {} +export interface ReactiveQueryClientParamsRequest {} export interface QueryClientParamsRequestProtoMsg { typeUrl: "/ibc.core.client.v1.QueryClientParamsRequest"; value: Uint8Array; @@ -253,6 +295,9 @@ export interface QueryClientParamsResponse { /** params defines the parameters of the module. */ params?: Params; } +export interface ReactiveQueryClientParamsResponse { + params?: ComputedRef<Params>; +} export interface QueryClientParamsResponseProtoMsg { typeUrl: "/ibc.core.client.v1.QueryClientParamsResponse"; value: Uint8Array; @@ -269,6 +314,7 @@ export interface QueryClientParamsResponseSDKType { * Query/UpgradedClientState RPC method */ export interface QueryUpgradedClientStateRequest {} +export interface ReactiveQueryUpgradedClientStateRequest {} export interface QueryUpgradedClientStateRequestProtoMsg { typeUrl: "/ibc.core.client.v1.QueryUpgradedClientStateRequest"; value: Uint8Array; @@ -286,6 +332,9 @@ export interface QueryUpgradedClientStateResponse { /** client state associated with the request identifier */ upgradedClientState?: Any; } +export interface ReactiveQueryUpgradedClientStateResponse { + upgradedClientState?: ComputedRef<Any>; +} export interface QueryUpgradedClientStateResponseProtoMsg { typeUrl: "/ibc.core.client.v1.QueryUpgradedClientStateResponse"; value: Uint8Array; @@ -302,6 +351,7 @@ export interface QueryUpgradedClientStateResponseSDKType { * Query/UpgradedConsensusState RPC method */ export interface QueryUpgradedConsensusStateRequest {} +export interface ReactiveQueryUpgradedConsensusStateRequest {} export interface QueryUpgradedConsensusStateRequestProtoMsg { typeUrl: "/ibc.core.client.v1.QueryUpgradedConsensusStateRequest"; value: Uint8Array; @@ -319,6 +369,9 @@ export interface QueryUpgradedConsensusStateResponse { /** Consensus state associated with the request identifier */ upgradedConsensusState?: Any; } +export interface ReactiveQueryUpgradedConsensusStateResponse { + upgradedConsensusState?: ComputedRef<Any>; +} export interface QueryUpgradedConsensusStateResponseProtoMsg { typeUrl: "/ibc.core.client.v1.QueryUpgradedConsensusStateResponse"; value: Uint8Array; @@ -338,7 +391,7 @@ function createBaseQueryClientStateRequest(): QueryClientStateRequest { export const QueryClientStateRequest = { typeUrl: "/ibc.core.client.v1.QueryClientStateRequest", encode(message: QueryClientStateRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.clientId !== undefined) { + if (message.clientId !== "") { writer.uint32(10).string(message.clientId); } return writer; @@ -361,9 +414,9 @@ export const QueryClientStateRequest = { return message; }, fromJSON(object: any): QueryClientStateRequest { - const obj = createBaseQueryClientStateRequest(); - if (isSet(object.clientId)) obj.clientId = String(object.clientId); - return obj; + return { + clientId: isSet(object.clientId) ? String(object.clientId) : "" + }; }, toJSON(message: QueryClientStateRequest): JsonSafe<QueryClientStateRequest> { const obj: any = {}; @@ -469,11 +522,11 @@ export const QueryClientStateResponse = { return message; }, fromJSON(object: any): QueryClientStateResponse { - const obj = createBaseQueryClientStateResponse(); - if (isSet(object.clientState)) obj.clientState = Any.fromJSON(object.clientState); - if (isSet(object.proof)) obj.proof = bytesFromBase64(object.proof); - if (isSet(object.proofHeight)) obj.proofHeight = Height.fromJSON(object.proofHeight); - return obj; + return { + clientState: isSet(object.clientState) ? Any.fromJSON(object.clientState) : undefined, + proof: isSet(object.proof) ? bytesFromBase64(object.proof) : new Uint8Array(), + proofHeight: isSet(object.proofHeight) ? Height.fromJSON(object.proofHeight) : undefined + }; }, toJSON(message: QueryClientStateResponse): JsonSafe<QueryClientStateResponse> { const obj: any = {}; @@ -484,13 +537,9 @@ export const QueryClientStateResponse = { }, fromPartial(object: DeepPartial<QueryClientStateResponse>): QueryClientStateResponse { const message = createBaseQueryClientStateResponse(); - if (object.clientState !== undefined && object.clientState !== null) { - message.clientState = Any.fromPartial(object.clientState); - } + message.clientState = object.clientState !== undefined && object.clientState !== null ? Any.fromPartial(object.clientState) : undefined; message.proof = object.proof ?? new Uint8Array(); - if (object.proofHeight !== undefined && object.proofHeight !== null) { - message.proofHeight = Height.fromPartial(object.proofHeight); - } + message.proofHeight = object.proofHeight !== undefined && object.proofHeight !== null ? Height.fromPartial(object.proofHeight) : undefined; return message; }, fromSDK(object: QueryClientStateResponseSDKType): QueryClientStateResponse { @@ -587,9 +636,9 @@ export const QueryClientStatesRequest = { return message; }, fromJSON(object: any): QueryClientStatesRequest { - const obj = createBaseQueryClientStatesRequest(); - if (isSet(object.pagination)) obj.pagination = PageRequest.fromJSON(object.pagination); - return obj; + return { + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined + }; }, toJSON(message: QueryClientStatesRequest): JsonSafe<QueryClientStatesRequest> { const obj: any = {}; @@ -598,9 +647,7 @@ export const QueryClientStatesRequest = { }, fromPartial(object: DeepPartial<QueryClientStatesRequest>): QueryClientStatesRequest { const message = createBaseQueryClientStatesRequest(); - if (object.pagination !== undefined && object.pagination !== null) { - message.pagination = PageRequest.fromPartial(object.pagination); - } + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageRequest.fromPartial(object.pagination) : undefined; return message; }, fromSDK(object: QueryClientStatesRequestSDKType): QueryClientStatesRequest { @@ -690,10 +737,10 @@ export const QueryClientStatesResponse = { return message; }, fromJSON(object: any): QueryClientStatesResponse { - const obj = createBaseQueryClientStatesResponse(); - if (Array.isArray(object?.clientStates)) obj.clientStates = object.clientStates.map((e: any) => IdentifiedClientState.fromJSON(e)); - if (isSet(object.pagination)) obj.pagination = PageResponse.fromJSON(object.pagination); - return obj; + return { + clientStates: Array.isArray(object?.clientStates) ? object.clientStates.map((e: any) => IdentifiedClientState.fromJSON(e)) : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined + }; }, toJSON(message: QueryClientStatesResponse): JsonSafe<QueryClientStatesResponse> { const obj: any = {}; @@ -708,9 +755,7 @@ export const QueryClientStatesResponse = { fromPartial(object: DeepPartial<QueryClientStatesResponse>): QueryClientStatesResponse { const message = createBaseQueryClientStatesResponse(); message.clientStates = object.clientStates?.map(e => IdentifiedClientState.fromPartial(e)) || []; - if (object.pagination !== undefined && object.pagination !== null) { - message.pagination = PageResponse.fromPartial(object.pagination); - } + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageResponse.fromPartial(object.pagination) : undefined; return message; }, fromSDK(object: QueryClientStatesResponseSDKType): QueryClientStatesResponse { @@ -786,16 +831,16 @@ function createBaseQueryConsensusStateRequest(): QueryConsensusStateRequest { export const QueryConsensusStateRequest = { typeUrl: "/ibc.core.client.v1.QueryConsensusStateRequest", encode(message: QueryConsensusStateRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.clientId !== undefined) { + if (message.clientId !== "") { writer.uint32(10).string(message.clientId); } - if (message.revisionNumber !== undefined) { + if (message.revisionNumber !== BigInt(0)) { writer.uint32(16).uint64(message.revisionNumber); } - if (message.revisionHeight !== undefined) { + if (message.revisionHeight !== BigInt(0)) { writer.uint32(24).uint64(message.revisionHeight); } - if (message.latestHeight !== undefined) { + if (message.latestHeight === true) { writer.uint32(32).bool(message.latestHeight); } return writer; @@ -827,12 +872,12 @@ export const QueryConsensusStateRequest = { return message; }, fromJSON(object: any): QueryConsensusStateRequest { - const obj = createBaseQueryConsensusStateRequest(); - if (isSet(object.clientId)) obj.clientId = String(object.clientId); - if (isSet(object.revisionNumber)) obj.revisionNumber = BigInt(object.revisionNumber.toString()); - if (isSet(object.revisionHeight)) obj.revisionHeight = BigInt(object.revisionHeight.toString()); - if (isSet(object.latestHeight)) obj.latestHeight = Boolean(object.latestHeight); - return obj; + return { + clientId: isSet(object.clientId) ? String(object.clientId) : "", + revisionNumber: isSet(object.revisionNumber) ? BigInt(object.revisionNumber.toString()) : BigInt(0), + revisionHeight: isSet(object.revisionHeight) ? BigInt(object.revisionHeight.toString()) : BigInt(0), + latestHeight: isSet(object.latestHeight) ? Boolean(object.latestHeight) : false + }; }, toJSON(message: QueryConsensusStateRequest): JsonSafe<QueryConsensusStateRequest> { const obj: any = {}; @@ -845,12 +890,8 @@ export const QueryConsensusStateRequest = { fromPartial(object: DeepPartial<QueryConsensusStateRequest>): QueryConsensusStateRequest { const message = createBaseQueryConsensusStateRequest(); message.clientId = object.clientId ?? ""; - if (object.revisionNumber !== undefined && object.revisionNumber !== null) { - message.revisionNumber = BigInt(object.revisionNumber.toString()); - } - if (object.revisionHeight !== undefined && object.revisionHeight !== null) { - message.revisionHeight = BigInt(object.revisionHeight.toString()); - } + message.revisionNumber = object.revisionNumber !== undefined && object.revisionNumber !== null ? BigInt(object.revisionNumber.toString()) : BigInt(0); + message.revisionHeight = object.revisionHeight !== undefined && object.revisionHeight !== null ? BigInt(object.revisionHeight.toString()) : BigInt(0); message.latestHeight = object.latestHeight ?? false; return message; }, @@ -969,11 +1010,11 @@ export const QueryConsensusStateResponse = { return message; }, fromJSON(object: any): QueryConsensusStateResponse { - const obj = createBaseQueryConsensusStateResponse(); - if (isSet(object.consensusState)) obj.consensusState = Any.fromJSON(object.consensusState); - if (isSet(object.proof)) obj.proof = bytesFromBase64(object.proof); - if (isSet(object.proofHeight)) obj.proofHeight = Height.fromJSON(object.proofHeight); - return obj; + return { + consensusState: isSet(object.consensusState) ? Any.fromJSON(object.consensusState) : undefined, + proof: isSet(object.proof) ? bytesFromBase64(object.proof) : new Uint8Array(), + proofHeight: isSet(object.proofHeight) ? Height.fromJSON(object.proofHeight) : undefined + }; }, toJSON(message: QueryConsensusStateResponse): JsonSafe<QueryConsensusStateResponse> { const obj: any = {}; @@ -984,13 +1025,9 @@ export const QueryConsensusStateResponse = { }, fromPartial(object: DeepPartial<QueryConsensusStateResponse>): QueryConsensusStateResponse { const message = createBaseQueryConsensusStateResponse(); - if (object.consensusState !== undefined && object.consensusState !== null) { - message.consensusState = Any.fromPartial(object.consensusState); - } + message.consensusState = object.consensusState !== undefined && object.consensusState !== null ? Any.fromPartial(object.consensusState) : undefined; message.proof = object.proof ?? new Uint8Array(); - if (object.proofHeight !== undefined && object.proofHeight !== null) { - message.proofHeight = Height.fromPartial(object.proofHeight); - } + message.proofHeight = object.proofHeight !== undefined && object.proofHeight !== null ? Height.fromPartial(object.proofHeight) : undefined; return message; }, fromSDK(object: QueryConsensusStateResponseSDKType): QueryConsensusStateResponse { @@ -1065,7 +1102,7 @@ function createBaseQueryConsensusStatesRequest(): QueryConsensusStatesRequest { export const QueryConsensusStatesRequest = { typeUrl: "/ibc.core.client.v1.QueryConsensusStatesRequest", encode(message: QueryConsensusStatesRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.clientId !== undefined) { + if (message.clientId !== "") { writer.uint32(10).string(message.clientId); } if (message.pagination !== undefined) { @@ -1094,10 +1131,10 @@ export const QueryConsensusStatesRequest = { return message; }, fromJSON(object: any): QueryConsensusStatesRequest { - const obj = createBaseQueryConsensusStatesRequest(); - if (isSet(object.clientId)) obj.clientId = String(object.clientId); - if (isSet(object.pagination)) obj.pagination = PageRequest.fromJSON(object.pagination); - return obj; + return { + clientId: isSet(object.clientId) ? String(object.clientId) : "", + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined + }; }, toJSON(message: QueryConsensusStatesRequest): JsonSafe<QueryConsensusStatesRequest> { const obj: any = {}; @@ -1108,9 +1145,7 @@ export const QueryConsensusStatesRequest = { fromPartial(object: DeepPartial<QueryConsensusStatesRequest>): QueryConsensusStatesRequest { const message = createBaseQueryConsensusStatesRequest(); message.clientId = object.clientId ?? ""; - if (object.pagination !== undefined && object.pagination !== null) { - message.pagination = PageRequest.fromPartial(object.pagination); - } + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageRequest.fromPartial(object.pagination) : undefined; return message; }, fromSDK(object: QueryConsensusStatesRequestSDKType): QueryConsensusStatesRequest { @@ -1207,10 +1242,10 @@ export const QueryConsensusStatesResponse = { return message; }, fromJSON(object: any): QueryConsensusStatesResponse { - const obj = createBaseQueryConsensusStatesResponse(); - if (Array.isArray(object?.consensusStates)) obj.consensusStates = object.consensusStates.map((e: any) => ConsensusStateWithHeight.fromJSON(e)); - if (isSet(object.pagination)) obj.pagination = PageResponse.fromJSON(object.pagination); - return obj; + return { + consensusStates: Array.isArray(object?.consensusStates) ? object.consensusStates.map((e: any) => ConsensusStateWithHeight.fromJSON(e)) : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined + }; }, toJSON(message: QueryConsensusStatesResponse): JsonSafe<QueryConsensusStatesResponse> { const obj: any = {}; @@ -1225,9 +1260,7 @@ export const QueryConsensusStatesResponse = { fromPartial(object: DeepPartial<QueryConsensusStatesResponse>): QueryConsensusStatesResponse { const message = createBaseQueryConsensusStatesResponse(); message.consensusStates = object.consensusStates?.map(e => ConsensusStateWithHeight.fromPartial(e)) || []; - if (object.pagination !== undefined && object.pagination !== null) { - message.pagination = PageResponse.fromPartial(object.pagination); - } + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageResponse.fromPartial(object.pagination) : undefined; return message; }, fromSDK(object: QueryConsensusStatesResponseSDKType): QueryConsensusStatesResponse { @@ -1300,7 +1333,7 @@ function createBaseQueryClientStatusRequest(): QueryClientStatusRequest { export const QueryClientStatusRequest = { typeUrl: "/ibc.core.client.v1.QueryClientStatusRequest", encode(message: QueryClientStatusRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.clientId !== undefined) { + if (message.clientId !== "") { writer.uint32(10).string(message.clientId); } return writer; @@ -1323,9 +1356,9 @@ export const QueryClientStatusRequest = { return message; }, fromJSON(object: any): QueryClientStatusRequest { - const obj = createBaseQueryClientStatusRequest(); - if (isSet(object.clientId)) obj.clientId = String(object.clientId); - return obj; + return { + clientId: isSet(object.clientId) ? String(object.clientId) : "" + }; }, toJSON(message: QueryClientStatusRequest): JsonSafe<QueryClientStatusRequest> { const obj: any = {}; @@ -1394,7 +1427,7 @@ function createBaseQueryClientStatusResponse(): QueryClientStatusResponse { export const QueryClientStatusResponse = { typeUrl: "/ibc.core.client.v1.QueryClientStatusResponse", encode(message: QueryClientStatusResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.status !== undefined) { + if (message.status !== "") { writer.uint32(10).string(message.status); } return writer; @@ -1417,9 +1450,9 @@ export const QueryClientStatusResponse = { return message; }, fromJSON(object: any): QueryClientStatusResponse { - const obj = createBaseQueryClientStatusResponse(); - if (isSet(object.status)) obj.status = String(object.status); - return obj; + return { + status: isSet(object.status) ? String(object.status) : "" + }; }, toJSON(message: QueryClientStatusResponse): JsonSafe<QueryClientStatusResponse> { const obj: any = {}; @@ -1503,8 +1536,7 @@ export const QueryClientParamsRequest = { return message; }, fromJSON(_: any): QueryClientParamsRequest { - const obj = createBaseQueryClientParamsRequest(); - return obj; + return {}; }, toJSON(_: QueryClientParamsRequest): JsonSafe<QueryClientParamsRequest> { const obj: any = {}; @@ -1585,9 +1617,9 @@ export const QueryClientParamsResponse = { return message; }, fromJSON(object: any): QueryClientParamsResponse { - const obj = createBaseQueryClientParamsResponse(); - if (isSet(object.params)) obj.params = Params.fromJSON(object.params); - return obj; + return { + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined + }; }, toJSON(message: QueryClientParamsResponse): JsonSafe<QueryClientParamsResponse> { const obj: any = {}; @@ -1596,9 +1628,7 @@ export const QueryClientParamsResponse = { }, fromPartial(object: DeepPartial<QueryClientParamsResponse>): QueryClientParamsResponse { const message = createBaseQueryClientParamsResponse(); - if (object.params !== undefined && object.params !== null) { - message.params = Params.fromPartial(object.params); - } + message.params = object.params !== undefined && object.params !== null ? Params.fromPartial(object.params) : undefined; return message; }, fromSDK(object: QueryClientParamsResponseSDKType): QueryClientParamsResponse { @@ -1673,8 +1703,7 @@ export const QueryUpgradedClientStateRequest = { return message; }, fromJSON(_: any): QueryUpgradedClientStateRequest { - const obj = createBaseQueryUpgradedClientStateRequest(); - return obj; + return {}; }, toJSON(_: QueryUpgradedClientStateRequest): JsonSafe<QueryUpgradedClientStateRequest> { const obj: any = {}; @@ -1755,9 +1784,9 @@ export const QueryUpgradedClientStateResponse = { return message; }, fromJSON(object: any): QueryUpgradedClientStateResponse { - const obj = createBaseQueryUpgradedClientStateResponse(); - if (isSet(object.upgradedClientState)) obj.upgradedClientState = Any.fromJSON(object.upgradedClientState); - return obj; + return { + upgradedClientState: isSet(object.upgradedClientState) ? Any.fromJSON(object.upgradedClientState) : undefined + }; }, toJSON(message: QueryUpgradedClientStateResponse): JsonSafe<QueryUpgradedClientStateResponse> { const obj: any = {}; @@ -1766,9 +1795,7 @@ export const QueryUpgradedClientStateResponse = { }, fromPartial(object: DeepPartial<QueryUpgradedClientStateResponse>): QueryUpgradedClientStateResponse { const message = createBaseQueryUpgradedClientStateResponse(); - if (object.upgradedClientState !== undefined && object.upgradedClientState !== null) { - message.upgradedClientState = Any.fromPartial(object.upgradedClientState); - } + message.upgradedClientState = object.upgradedClientState !== undefined && object.upgradedClientState !== null ? Any.fromPartial(object.upgradedClientState) : undefined; return message; }, fromSDK(object: QueryUpgradedClientStateResponseSDKType): QueryUpgradedClientStateResponse { @@ -1843,8 +1870,7 @@ export const QueryUpgradedConsensusStateRequest = { return message; }, fromJSON(_: any): QueryUpgradedConsensusStateRequest { - const obj = createBaseQueryUpgradedConsensusStateRequest(); - return obj; + return {}; }, toJSON(_: QueryUpgradedConsensusStateRequest): JsonSafe<QueryUpgradedConsensusStateRequest> { const obj: any = {}; @@ -1925,9 +1951,9 @@ export const QueryUpgradedConsensusStateResponse = { return message; }, fromJSON(object: any): QueryUpgradedConsensusStateResponse { - const obj = createBaseQueryUpgradedConsensusStateResponse(); - if (isSet(object.upgradedConsensusState)) obj.upgradedConsensusState = Any.fromJSON(object.upgradedConsensusState); - return obj; + return { + upgradedConsensusState: isSet(object.upgradedConsensusState) ? Any.fromJSON(object.upgradedConsensusState) : undefined + }; }, toJSON(message: QueryUpgradedConsensusStateResponse): JsonSafe<QueryUpgradedConsensusStateResponse> { const obj: any = {}; @@ -1936,9 +1962,7 @@ export const QueryUpgradedConsensusStateResponse = { }, fromPartial(object: DeepPartial<QueryUpgradedConsensusStateResponse>): QueryUpgradedConsensusStateResponse { const message = createBaseQueryUpgradedConsensusStateResponse(); - if (object.upgradedConsensusState !== undefined && object.upgradedConsensusState !== null) { - message.upgradedConsensusState = Any.fromPartial(object.upgradedConsensusState); - } + message.upgradedConsensusState = object.upgradedConsensusState !== undefined && object.upgradedConsensusState !== null ? Any.fromPartial(object.upgradedConsensusState) : undefined; return message; }, fromSDK(object: QueryUpgradedConsensusStateResponseSDKType): QueryUpgradedConsensusStateResponse { diff --git a/__fixtures__/v-next/outputv4/ibc/core/client/v1/tx.amino.ts b/__fixtures__/v-next/outputv4/ibc/core/client/v1/tx.amino.ts index 3e102b8cf8..727e135426 100644 --- a/__fixtures__/v-next/outputv4/ibc/core/client/v1/tx.amino.ts +++ b/__fixtures__/v-next/outputv4/ibc/core/client/v1/tx.amino.ts @@ -1,6 +1,6 @@ -import { Any, AnySDKType } from "../../../../google/protobuf/any.js"; +import { Any, AnySDKType } from "../../../../google/protobuf/any"; import { AminoMsg } from "@cosmjs/amino"; -import { MsgCreateClient, MsgCreateClientSDKType, MsgUpdateClient, MsgUpdateClientSDKType, MsgUpgradeClient, MsgUpgradeClientSDKType, MsgSubmitMisbehaviour, MsgSubmitMisbehaviourSDKType } from "./tx.js"; +import { MsgCreateClient, MsgCreateClientSDKType, MsgUpdateClient, MsgUpdateClientSDKType, MsgUpgradeClient, MsgUpgradeClientSDKType, MsgSubmitMisbehaviour, MsgSubmitMisbehaviourSDKType } from "./tx"; export interface MsgCreateClientAminoType extends AminoMsg { type: "cosmos-sdk/MsgCreateClient"; value: { diff --git a/__fixtures__/v-next/outputv4/ibc/core/client/v1/tx.registry.ts b/__fixtures__/v-next/outputv4/ibc/core/client/v1/tx.registry.ts index c459f0a06c..8fdd202504 100644 --- a/__fixtures__/v-next/outputv4/ibc/core/client/v1/tx.registry.ts +++ b/__fixtures__/v-next/outputv4/ibc/core/client/v1/tx.registry.ts @@ -1,6 +1,6 @@ -import { Any, AnySDKType } from "../../../../google/protobuf/any.js"; +import { Any, AnySDKType } from "../../../../google/protobuf/any"; import { GeneratedType, Registry } from "@cosmjs/proto-signing"; -import { MsgCreateClient, MsgCreateClientSDKType, MsgUpdateClient, MsgUpdateClientSDKType, MsgUpgradeClient, MsgUpgradeClientSDKType, MsgSubmitMisbehaviour, MsgSubmitMisbehaviourSDKType } from "./tx.js"; +import { MsgCreateClient, MsgCreateClientSDKType, MsgUpdateClient, MsgUpdateClientSDKType, MsgUpgradeClient, MsgUpgradeClientSDKType, MsgSubmitMisbehaviour, MsgSubmitMisbehaviourSDKType } from "./tx"; export const registry: ReadonlyArray<[string, GeneratedType]> = [["/ibc.core.client.v1.MsgCreateClient", MsgCreateClient], ["/ibc.core.client.v1.MsgUpdateClient", MsgUpdateClient], ["/ibc.core.client.v1.MsgUpgradeClient", MsgUpgradeClient], ["/ibc.core.client.v1.MsgSubmitMisbehaviour", MsgSubmitMisbehaviour]]; export const load = (protoRegistry: Registry) => { registry.forEach(([typeUrl, mod]) => { diff --git a/__fixtures__/v-next/outputv4/ibc/core/client/v1/tx.rpc.msg.ts b/__fixtures__/v-next/outputv4/ibc/core/client/v1/tx.rpc.msg.ts index ba3bc78b09..aa64390f0c 100644 --- a/__fixtures__/v-next/outputv4/ibc/core/client/v1/tx.rpc.msg.ts +++ b/__fixtures__/v-next/outputv4/ibc/core/client/v1/tx.rpc.msg.ts @@ -1,7 +1,7 @@ -import { Any, AnySDKType } from "../../../../google/protobuf/any.js"; -import { Rpc } from "../../../../helpers.js"; -import { BinaryReader } from "../../../../binary.js"; -import { MsgCreateClient, MsgCreateClientSDKType, MsgCreateClientResponse, MsgCreateClientResponseSDKType, MsgUpdateClient, MsgUpdateClientSDKType, MsgUpdateClientResponse, MsgUpdateClientResponseSDKType, MsgUpgradeClient, MsgUpgradeClientSDKType, MsgUpgradeClientResponse, MsgUpgradeClientResponseSDKType, MsgSubmitMisbehaviour, MsgSubmitMisbehaviourSDKType, MsgSubmitMisbehaviourResponse, MsgSubmitMisbehaviourResponseSDKType } from "./tx.js"; +import { Any, AnySDKType } from "../../../../google/protobuf/any"; +import { Rpc } from "../../../../helpers"; +import { BinaryReader } from "../../../../binary"; +import { MsgCreateClient, MsgCreateClientSDKType, MsgCreateClientResponse, MsgCreateClientResponseSDKType, MsgUpdateClient, MsgUpdateClientSDKType, MsgUpdateClientResponse, MsgUpdateClientResponseSDKType, MsgUpgradeClient, MsgUpgradeClientSDKType, MsgUpgradeClientResponse, MsgUpgradeClientResponseSDKType, MsgSubmitMisbehaviour, MsgSubmitMisbehaviourSDKType, MsgSubmitMisbehaviourResponse, MsgSubmitMisbehaviourResponseSDKType } from "./tx"; /** Msg defines the ibc/client Msg service. */ export interface Msg { /** CreateClient defines a rpc handler method for MsgCreateClient. */ diff --git a/__fixtures__/v-next/outputv4/ibc/core/client/v1/tx.ts b/__fixtures__/v-next/outputv4/ibc/core/client/v1/tx.ts index db930310aa..dd4e808590 100644 --- a/__fixtures__/v-next/outputv4/ibc/core/client/v1/tx.ts +++ b/__fixtures__/v-next/outputv4/ibc/core/client/v1/tx.ts @@ -1,7 +1,8 @@ -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 { Any, AnySDKType } from "../../../../google/protobuf/any"; +import { BinaryReader, BinaryWriter } from "../../../../binary"; +import { isSet, DeepPartial, bytesFromBase64, base64FromBytes } from "../../../../helpers"; +import { JsonSafe } from "../../../../json-safe"; +import { ComputedRef } from "vue"; export const protobufPackage = "ibc.core.client.v1"; /** MsgCreateClient defines a message to create an IBC client */ export interface MsgCreateClient { @@ -15,6 +16,11 @@ export interface MsgCreateClient { /** signer address */ signer: string; } +export interface ReactiveMsgCreateClient { + clientState?: ComputedRef<Any>; + consensusState?: ComputedRef<Any>; + signer: ComputedRef<string>; +} export interface MsgCreateClientProtoMsg { typeUrl: "/ibc.core.client.v1.MsgCreateClient"; value: Uint8Array; @@ -27,6 +33,7 @@ export interface MsgCreateClientSDKType { } /** MsgCreateClientResponse defines the Msg/CreateClient response type. */ export interface MsgCreateClientResponse {} +export interface ReactiveMsgCreateClientResponse {} export interface MsgCreateClientResponseProtoMsg { typeUrl: "/ibc.core.client.v1.MsgCreateClientResponse"; value: Uint8Array; @@ -45,6 +52,11 @@ export interface MsgUpdateClient { /** signer address */ signer: string; } +export interface ReactiveMsgUpdateClient { + clientId: ComputedRef<string>; + header?: ComputedRef<Any>; + signer: ComputedRef<string>; +} export interface MsgUpdateClientProtoMsg { typeUrl: "/ibc.core.client.v1.MsgUpdateClient"; value: Uint8Array; @@ -60,6 +72,7 @@ export interface MsgUpdateClientSDKType { } /** MsgUpdateClientResponse defines the Msg/UpdateClient response type. */ export interface MsgUpdateClientResponse {} +export interface ReactiveMsgUpdateClientResponse {} export interface MsgUpdateClientResponseProtoMsg { typeUrl: "/ibc.core.client.v1.MsgUpdateClientResponse"; value: Uint8Array; @@ -87,6 +100,14 @@ export interface MsgUpgradeClient { /** signer address */ signer: string; } +export interface ReactiveMsgUpgradeClient { + clientId: ComputedRef<string>; + clientState?: ComputedRef<Any>; + consensusState?: ComputedRef<Any>; + proofUpgradeClient: ComputedRef<Uint8Array>; + proofUpgradeConsensusState: ComputedRef<Uint8Array>; + signer: ComputedRef<string>; +} export interface MsgUpgradeClientProtoMsg { typeUrl: "/ibc.core.client.v1.MsgUpgradeClient"; value: Uint8Array; @@ -105,6 +126,7 @@ export interface MsgUpgradeClientSDKType { } /** MsgUpgradeClientResponse defines the Msg/UpgradeClient response type. */ export interface MsgUpgradeClientResponse {} +export interface ReactiveMsgUpgradeClientResponse {} export interface MsgUpgradeClientResponseProtoMsg { typeUrl: "/ibc.core.client.v1.MsgUpgradeClientResponse"; value: Uint8Array; @@ -123,6 +145,11 @@ export interface MsgSubmitMisbehaviour { /** signer address */ signer: string; } +export interface ReactiveMsgSubmitMisbehaviour { + clientId: ComputedRef<string>; + misbehaviour?: ComputedRef<Any>; + signer: ComputedRef<string>; +} export interface MsgSubmitMisbehaviourProtoMsg { typeUrl: "/ibc.core.client.v1.MsgSubmitMisbehaviour"; value: Uint8Array; @@ -141,6 +168,7 @@ export interface MsgSubmitMisbehaviourSDKType { * type. */ export interface MsgSubmitMisbehaviourResponse {} +export interface ReactiveMsgSubmitMisbehaviourResponse {} export interface MsgSubmitMisbehaviourResponseProtoMsg { typeUrl: "/ibc.core.client.v1.MsgSubmitMisbehaviourResponse"; value: Uint8Array; @@ -166,7 +194,7 @@ export const MsgCreateClient = { if (message.consensusState !== undefined) { Any.encode(message.consensusState, writer.uint32(18).fork()).ldelim(); } - if (message.signer !== undefined) { + if (message.signer !== "") { writer.uint32(26).string(message.signer); } return writer; @@ -195,11 +223,11 @@ export const MsgCreateClient = { return message; }, fromJSON(object: any): MsgCreateClient { - const obj = createBaseMsgCreateClient(); - if (isSet(object.clientState)) obj.clientState = Any.fromJSON(object.clientState); - if (isSet(object.consensusState)) obj.consensusState = Any.fromJSON(object.consensusState); - if (isSet(object.signer)) obj.signer = String(object.signer); - return obj; + return { + clientState: isSet(object.clientState) ? Any.fromJSON(object.clientState) : undefined, + consensusState: isSet(object.consensusState) ? Any.fromJSON(object.consensusState) : undefined, + signer: isSet(object.signer) ? String(object.signer) : "" + }; }, toJSON(message: MsgCreateClient): JsonSafe<MsgCreateClient> { const obj: any = {}; @@ -210,12 +238,8 @@ export const MsgCreateClient = { }, fromPartial(object: DeepPartial<MsgCreateClient>): MsgCreateClient { const message = createBaseMsgCreateClient(); - if (object.clientState !== undefined && object.clientState !== null) { - message.clientState = Any.fromPartial(object.clientState); - } - if (object.consensusState !== undefined && object.consensusState !== null) { - message.consensusState = Any.fromPartial(object.consensusState); - } + message.clientState = object.clientState !== undefined && object.clientState !== null ? Any.fromPartial(object.clientState) : undefined; + message.consensusState = object.consensusState !== undefined && object.consensusState !== null ? Any.fromPartial(object.consensusState) : undefined; message.signer = object.signer ?? ""; return message; }, @@ -305,8 +329,7 @@ export const MsgCreateClientResponse = { return message; }, fromJSON(_: any): MsgCreateClientResponse { - const obj = createBaseMsgCreateClientResponse(); - return obj; + return {}; }, toJSON(_: MsgCreateClientResponse): JsonSafe<MsgCreateClientResponse> { const obj: any = {}; @@ -366,13 +389,13 @@ function createBaseMsgUpdateClient(): MsgUpdateClient { export const MsgUpdateClient = { typeUrl: "/ibc.core.client.v1.MsgUpdateClient", encode(message: MsgUpdateClient, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.clientId !== undefined) { + if (message.clientId !== "") { writer.uint32(10).string(message.clientId); } if (message.header !== undefined) { Any.encode(message.header, writer.uint32(18).fork()).ldelim(); } - if (message.signer !== undefined) { + if (message.signer !== "") { writer.uint32(26).string(message.signer); } return writer; @@ -401,11 +424,11 @@ export const MsgUpdateClient = { return message; }, fromJSON(object: any): MsgUpdateClient { - const obj = createBaseMsgUpdateClient(); - if (isSet(object.clientId)) obj.clientId = String(object.clientId); - if (isSet(object.header)) obj.header = Any.fromJSON(object.header); - if (isSet(object.signer)) obj.signer = String(object.signer); - return obj; + return { + clientId: isSet(object.clientId) ? String(object.clientId) : "", + header: isSet(object.header) ? Any.fromJSON(object.header) : undefined, + signer: isSet(object.signer) ? String(object.signer) : "" + }; }, toJSON(message: MsgUpdateClient): JsonSafe<MsgUpdateClient> { const obj: any = {}; @@ -417,9 +440,7 @@ export const MsgUpdateClient = { fromPartial(object: DeepPartial<MsgUpdateClient>): MsgUpdateClient { const message = createBaseMsgUpdateClient(); message.clientId = object.clientId ?? ""; - if (object.header !== undefined && object.header !== null) { - message.header = Any.fromPartial(object.header); - } + message.header = object.header !== undefined && object.header !== null ? Any.fromPartial(object.header) : undefined; message.signer = object.signer ?? ""; return message; }, @@ -509,8 +530,7 @@ export const MsgUpdateClientResponse = { return message; }, fromJSON(_: any): MsgUpdateClientResponse { - const obj = createBaseMsgUpdateClientResponse(); - return obj; + return {}; }, toJSON(_: MsgUpdateClientResponse): JsonSafe<MsgUpdateClientResponse> { const obj: any = {}; @@ -573,7 +593,7 @@ function createBaseMsgUpgradeClient(): MsgUpgradeClient { export const MsgUpgradeClient = { typeUrl: "/ibc.core.client.v1.MsgUpgradeClient", encode(message: MsgUpgradeClient, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.clientId !== undefined) { + if (message.clientId !== "") { writer.uint32(10).string(message.clientId); } if (message.clientState !== undefined) { @@ -588,7 +608,7 @@ export const MsgUpgradeClient = { if (message.proofUpgradeConsensusState.length !== 0) { writer.uint32(42).bytes(message.proofUpgradeConsensusState); } - if (message.signer !== undefined) { + if (message.signer !== "") { writer.uint32(50).string(message.signer); } return writer; @@ -626,14 +646,14 @@ export const MsgUpgradeClient = { return message; }, fromJSON(object: any): MsgUpgradeClient { - const obj = createBaseMsgUpgradeClient(); - if (isSet(object.clientId)) obj.clientId = String(object.clientId); - if (isSet(object.clientState)) obj.clientState = Any.fromJSON(object.clientState); - if (isSet(object.consensusState)) obj.consensusState = Any.fromJSON(object.consensusState); - if (isSet(object.proofUpgradeClient)) obj.proofUpgradeClient = bytesFromBase64(object.proofUpgradeClient); - if (isSet(object.proofUpgradeConsensusState)) obj.proofUpgradeConsensusState = bytesFromBase64(object.proofUpgradeConsensusState); - if (isSet(object.signer)) obj.signer = String(object.signer); - return obj; + return { + clientId: isSet(object.clientId) ? String(object.clientId) : "", + clientState: isSet(object.clientState) ? Any.fromJSON(object.clientState) : undefined, + consensusState: isSet(object.consensusState) ? Any.fromJSON(object.consensusState) : undefined, + proofUpgradeClient: isSet(object.proofUpgradeClient) ? bytesFromBase64(object.proofUpgradeClient) : new Uint8Array(), + proofUpgradeConsensusState: isSet(object.proofUpgradeConsensusState) ? bytesFromBase64(object.proofUpgradeConsensusState) : new Uint8Array(), + signer: isSet(object.signer) ? String(object.signer) : "" + }; }, toJSON(message: MsgUpgradeClient): JsonSafe<MsgUpgradeClient> { const obj: any = {}; @@ -648,12 +668,8 @@ export const MsgUpgradeClient = { fromPartial(object: DeepPartial<MsgUpgradeClient>): MsgUpgradeClient { const message = createBaseMsgUpgradeClient(); message.clientId = object.clientId ?? ""; - if (object.clientState !== undefined && object.clientState !== null) { - message.clientState = Any.fromPartial(object.clientState); - } - if (object.consensusState !== undefined && object.consensusState !== null) { - message.consensusState = Any.fromPartial(object.consensusState); - } + message.clientState = object.clientState !== undefined && object.clientState !== null ? Any.fromPartial(object.clientState) : undefined; + message.consensusState = object.consensusState !== undefined && object.consensusState !== null ? Any.fromPartial(object.consensusState) : undefined; message.proofUpgradeClient = object.proofUpgradeClient ?? new Uint8Array(); message.proofUpgradeConsensusState = object.proofUpgradeConsensusState ?? new Uint8Array(); message.signer = object.signer ?? ""; @@ -766,8 +782,7 @@ export const MsgUpgradeClientResponse = { return message; }, fromJSON(_: any): MsgUpgradeClientResponse { - const obj = createBaseMsgUpgradeClientResponse(); - return obj; + return {}; }, toJSON(_: MsgUpgradeClientResponse): JsonSafe<MsgUpgradeClientResponse> { const obj: any = {}; @@ -827,13 +842,13 @@ function createBaseMsgSubmitMisbehaviour(): MsgSubmitMisbehaviour { export const MsgSubmitMisbehaviour = { typeUrl: "/ibc.core.client.v1.MsgSubmitMisbehaviour", encode(message: MsgSubmitMisbehaviour, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.clientId !== undefined) { + if (message.clientId !== "") { writer.uint32(10).string(message.clientId); } if (message.misbehaviour !== undefined) { Any.encode(message.misbehaviour, writer.uint32(18).fork()).ldelim(); } - if (message.signer !== undefined) { + if (message.signer !== "") { writer.uint32(26).string(message.signer); } return writer; @@ -862,11 +877,11 @@ export const MsgSubmitMisbehaviour = { return message; }, fromJSON(object: any): MsgSubmitMisbehaviour { - const obj = createBaseMsgSubmitMisbehaviour(); - if (isSet(object.clientId)) obj.clientId = String(object.clientId); - if (isSet(object.misbehaviour)) obj.misbehaviour = Any.fromJSON(object.misbehaviour); - if (isSet(object.signer)) obj.signer = String(object.signer); - return obj; + return { + clientId: isSet(object.clientId) ? String(object.clientId) : "", + misbehaviour: isSet(object.misbehaviour) ? Any.fromJSON(object.misbehaviour) : undefined, + signer: isSet(object.signer) ? String(object.signer) : "" + }; }, toJSON(message: MsgSubmitMisbehaviour): JsonSafe<MsgSubmitMisbehaviour> { const obj: any = {}; @@ -878,9 +893,7 @@ export const MsgSubmitMisbehaviour = { fromPartial(object: DeepPartial<MsgSubmitMisbehaviour>): MsgSubmitMisbehaviour { const message = createBaseMsgSubmitMisbehaviour(); message.clientId = object.clientId ?? ""; - if (object.misbehaviour !== undefined && object.misbehaviour !== null) { - message.misbehaviour = Any.fromPartial(object.misbehaviour); - } + message.misbehaviour = object.misbehaviour !== undefined && object.misbehaviour !== null ? Any.fromPartial(object.misbehaviour) : undefined; message.signer = object.signer ?? ""; return message; }, @@ -970,8 +983,7 @@ export const MsgSubmitMisbehaviourResponse = { return message; }, fromJSON(_: any): MsgSubmitMisbehaviourResponse { - const obj = createBaseMsgSubmitMisbehaviourResponse(); - return obj; + return {}; }, toJSON(_: MsgSubmitMisbehaviourResponse): JsonSafe<MsgSubmitMisbehaviourResponse> { const obj: any = {}; diff --git a/__fixtures__/v-next/outputv4/ibc/core/commitment/v1/commitment.ts b/__fixtures__/v-next/outputv4/ibc/core/commitment/v1/commitment.ts index 2f880de87a..f885a6ff97 100644 --- a/__fixtures__/v-next/outputv4/ibc/core/commitment/v1/commitment.ts +++ b/__fixtures__/v-next/outputv4/ibc/core/commitment/v1/commitment.ts @@ -1,7 +1,8 @@ -import { CommitmentProof, CommitmentProofSDKType } from "../../../../confio/proofs.js"; -import { BinaryReader, BinaryWriter } from "../../../../binary.js"; -import { isSet, bytesFromBase64, base64FromBytes, DeepPartial } from "../../../../helpers.js"; -import { JsonSafe } from "../../../../json-safe.js"; +import { CommitmentProof, CommitmentProofSDKType } from "../../../../confio/proofs"; +import { BinaryReader, BinaryWriter } from "../../../../binary"; +import { isSet, bytesFromBase64, base64FromBytes, DeepPartial } from "../../../../helpers"; +import { JsonSafe } from "../../../../json-safe"; +import { ComputedRef } from "vue"; export const protobufPackage = "ibc.core.commitment.v1"; /** * MerkleRoot defines a merkle root hash. @@ -10,6 +11,9 @@ export const protobufPackage = "ibc.core.commitment.v1"; export interface MerkleRoot { hash: Uint8Array; } +export interface ReactiveMerkleRoot { + hash: ComputedRef<Uint8Array>; +} export interface MerkleRootProtoMsg { typeUrl: "/ibc.core.commitment.v1.MerkleRoot"; value: Uint8Array; @@ -29,6 +33,9 @@ export interface MerkleRootSDKType { export interface MerklePrefix { keyPrefix: Uint8Array; } +export interface ReactiveMerklePrefix { + keyPrefix: ComputedRef<Uint8Array>; +} export interface MerklePrefixProtoMsg { typeUrl: "/ibc.core.commitment.v1.MerklePrefix"; value: Uint8Array; @@ -49,6 +56,9 @@ export interface MerklePrefixSDKType { export interface MerklePath { keyPath: string[]; } +export interface ReactiveMerklePath { + keyPath: ComputedRef<string[]>; +} export interface MerklePathProtoMsg { typeUrl: "/ibc.core.commitment.v1.MerklePath"; value: Uint8Array; @@ -71,6 +81,9 @@ export interface MerklePathSDKType { export interface MerkleProof { proofs: CommitmentProof[]; } +export interface ReactiveMerkleProof { + proofs: ComputedRef<CommitmentProof[]>; +} export interface MerkleProofProtoMsg { typeUrl: "/ibc.core.commitment.v1.MerkleProof"; value: Uint8Array; @@ -116,9 +129,9 @@ export const MerkleRoot = { return message; }, fromJSON(object: any): MerkleRoot { - const obj = createBaseMerkleRoot(); - if (isSet(object.hash)) obj.hash = bytesFromBase64(object.hash); - return obj; + return { + hash: isSet(object.hash) ? bytesFromBase64(object.hash) : new Uint8Array() + }; }, toJSON(message: MerkleRoot): JsonSafe<MerkleRoot> { const obj: any = {}; @@ -210,9 +223,9 @@ export const MerklePrefix = { return message; }, fromJSON(object: any): MerklePrefix { - const obj = createBaseMerklePrefix(); - if (isSet(object.keyPrefix)) obj.keyPrefix = bytesFromBase64(object.keyPrefix); - return obj; + return { + keyPrefix: isSet(object.keyPrefix) ? bytesFromBase64(object.keyPrefix) : new Uint8Array() + }; }, toJSON(message: MerklePrefix): JsonSafe<MerklePrefix> { const obj: any = {}; @@ -304,9 +317,9 @@ export const MerklePath = { return message; }, fromJSON(object: any): MerklePath { - const obj = createBaseMerklePath(); - if (Array.isArray(object?.keyPath)) obj.keyPath = object.keyPath.map((e: any) => String(e)); - return obj; + return { + keyPath: Array.isArray(object?.keyPath) ? object.keyPath.map((e: any) => String(e)) : [] + }; }, toJSON(message: MerklePath): JsonSafe<MerklePath> { const obj: any = {}; @@ -408,9 +421,9 @@ export const MerkleProof = { return message; }, fromJSON(object: any): MerkleProof { - const obj = createBaseMerkleProof(); - if (Array.isArray(object?.proofs)) obj.proofs = object.proofs.map((e: any) => CommitmentProof.fromJSON(e)); - return obj; + return { + proofs: Array.isArray(object?.proofs) ? object.proofs.map((e: any) => CommitmentProof.fromJSON(e)) : [] + }; }, toJSON(message: MerkleProof): JsonSafe<MerkleProof> { const obj: any = {}; diff --git a/__fixtures__/v-next/outputv4/ibc/core/connection/v1/connection.ts b/__fixtures__/v-next/outputv4/ibc/core/connection/v1/connection.ts index c16c59eac9..731040ddff 100644 --- a/__fixtures__/v-next/outputv4/ibc/core/connection/v1/connection.ts +++ b/__fixtures__/v-next/outputv4/ibc/core/connection/v1/connection.ts @@ -1,7 +1,8 @@ -import { MerklePrefix, MerklePrefixSDKType } from "../../commitment/v1/commitment.js"; -import { BinaryReader, BinaryWriter } from "../../../../binary.js"; -import { isSet, DeepPartial } from "../../../../helpers.js"; -import { JsonSafe } from "../../../../json-safe.js"; +import { MerklePrefix, MerklePrefixSDKType } from "../../commitment/v1/commitment"; +import { BinaryReader, BinaryWriter } from "../../../../binary"; +import { isSet, DeepPartial } from "../../../../helpers"; +import { JsonSafe } from "../../../../json-safe"; +import { ComputedRef } from "vue"; export const protobufPackage = "ibc.core.connection.v1"; /** * State defines if a connection is in one of the following states: @@ -82,6 +83,13 @@ export interface ConnectionEnd { */ delayPeriod: bigint; } +export interface ReactiveConnectionEnd { + clientId: ComputedRef<string>; + versions: ComputedRef<Version[]>; + state: ComputedRef<State>; + counterparty: ComputedRef<Counterparty>; + delayPeriod: ComputedRef<bigint>; +} export interface ConnectionEndProtoMsg { typeUrl: "/ibc.core.connection.v1.ConnectionEnd"; value: Uint8Array; @@ -120,6 +128,14 @@ export interface IdentifiedConnection { /** delay period associated with this connection. */ delayPeriod: bigint; } +export interface ReactiveIdentifiedConnection { + id: ComputedRef<string>; + clientId: ComputedRef<string>; + versions: ComputedRef<Version[]>; + state: ComputedRef<State>; + counterparty: ComputedRef<Counterparty>; + delayPeriod: ComputedRef<bigint>; +} export interface IdentifiedConnectionProtoMsg { typeUrl: "/ibc.core.connection.v1.IdentifiedConnection"; value: Uint8Array; @@ -151,6 +167,11 @@ export interface Counterparty { /** commitment merkle prefix of the counterparty chain. */ prefix: MerklePrefix; } +export interface ReactiveCounterparty { + clientId: ComputedRef<string>; + connectionId: ComputedRef<string>; + prefix: ComputedRef<MerklePrefix>; +} export interface CounterpartyProtoMsg { typeUrl: "/ibc.core.connection.v1.Counterparty"; value: Uint8Array; @@ -166,6 +187,9 @@ export interface ClientPaths { /** list of connection paths */ paths: string[]; } +export interface ReactiveClientPaths { + paths: ComputedRef<string[]>; +} export interface ClientPathsProtoMsg { typeUrl: "/ibc.core.connection.v1.ClientPaths"; value: Uint8Array; @@ -181,6 +205,10 @@ export interface ConnectionPaths { /** list of connection paths */ paths: string[]; } +export interface ReactiveConnectionPaths { + clientId: ComputedRef<string>; + paths: ComputedRef<string[]>; +} export interface ConnectionPathsProtoMsg { typeUrl: "/ibc.core.connection.v1.ConnectionPaths"; value: Uint8Array; @@ -200,6 +228,10 @@ export interface Version { /** list of features compatible with the specified identifier */ features: string[]; } +export interface ReactiveVersion { + identifier: ComputedRef<string>; + features: ComputedRef<string[]>; +} export interface VersionProtoMsg { typeUrl: "/ibc.core.connection.v1.Version"; value: Uint8Array; @@ -221,6 +253,9 @@ export interface Params { */ maxExpectedTimePerBlock: bigint; } +export interface ReactiveParams { + maxExpectedTimePerBlock: ComputedRef<bigint>; +} export interface ParamsProtoMsg { typeUrl: "/ibc.core.connection.v1.Params"; value: Uint8Array; @@ -241,7 +276,7 @@ function createBaseConnectionEnd(): ConnectionEnd { export const ConnectionEnd = { typeUrl: "/ibc.core.connection.v1.ConnectionEnd", encode(message: ConnectionEnd, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.clientId !== undefined) { + if (message.clientId !== "") { writer.uint32(10).string(message.clientId); } for (const v of message.versions) { @@ -253,7 +288,7 @@ export const ConnectionEnd = { if (message.counterparty !== undefined) { Counterparty.encode(message.counterparty, writer.uint32(34).fork()).ldelim(); } - if (message.delayPeriod !== undefined) { + if (message.delayPeriod !== BigInt(0)) { writer.uint32(40).uint64(message.delayPeriod); } return writer; @@ -288,13 +323,13 @@ export const ConnectionEnd = { return message; }, fromJSON(object: any): ConnectionEnd { - const obj = createBaseConnectionEnd(); - if (isSet(object.clientId)) obj.clientId = String(object.clientId); - if (Array.isArray(object?.versions)) obj.versions = object.versions.map((e: any) => Version.fromJSON(e)); - if (isSet(object.state)) obj.state = stateFromJSON(object.state); - if (isSet(object.counterparty)) obj.counterparty = Counterparty.fromJSON(object.counterparty); - if (isSet(object.delayPeriod)) obj.delayPeriod = BigInt(object.delayPeriod.toString()); - return obj; + return { + clientId: isSet(object.clientId) ? String(object.clientId) : "", + versions: Array.isArray(object?.versions) ? object.versions.map((e: any) => Version.fromJSON(e)) : [], + state: isSet(object.state) ? stateFromJSON(object.state) : -1, + counterparty: isSet(object.counterparty) ? Counterparty.fromJSON(object.counterparty) : undefined, + delayPeriod: isSet(object.delayPeriod) ? BigInt(object.delayPeriod.toString()) : BigInt(0) + }; }, toJSON(message: ConnectionEnd): JsonSafe<ConnectionEnd> { const obj: any = {}; @@ -314,12 +349,8 @@ export const ConnectionEnd = { message.clientId = object.clientId ?? ""; message.versions = object.versions?.map(e => Version.fromPartial(e)) || []; message.state = object.state ?? 0; - if (object.counterparty !== undefined && object.counterparty !== null) { - message.counterparty = Counterparty.fromPartial(object.counterparty); - } - if (object.delayPeriod !== undefined && object.delayPeriod !== null) { - message.delayPeriod = BigInt(object.delayPeriod.toString()); - } + message.counterparty = object.counterparty !== undefined && object.counterparty !== null ? Counterparty.fromPartial(object.counterparty) : undefined; + message.delayPeriod = object.delayPeriod !== undefined && object.delayPeriod !== null ? BigInt(object.delayPeriod.toString()) : BigInt(0); return message; }, fromSDK(object: ConnectionEndSDKType): ConnectionEnd { @@ -418,10 +449,10 @@ function createBaseIdentifiedConnection(): IdentifiedConnection { export const IdentifiedConnection = { typeUrl: "/ibc.core.connection.v1.IdentifiedConnection", encode(message: IdentifiedConnection, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.id !== undefined) { + if (message.id !== "") { writer.uint32(10).string(message.id); } - if (message.clientId !== undefined) { + if (message.clientId !== "") { writer.uint32(18).string(message.clientId); } for (const v of message.versions) { @@ -433,7 +464,7 @@ export const IdentifiedConnection = { if (message.counterparty !== undefined) { Counterparty.encode(message.counterparty, writer.uint32(42).fork()).ldelim(); } - if (message.delayPeriod !== undefined) { + if (message.delayPeriod !== BigInt(0)) { writer.uint32(48).uint64(message.delayPeriod); } return writer; @@ -471,14 +502,14 @@ export const IdentifiedConnection = { return message; }, fromJSON(object: any): IdentifiedConnection { - const obj = createBaseIdentifiedConnection(); - if (isSet(object.id)) obj.id = String(object.id); - if (isSet(object.clientId)) obj.clientId = String(object.clientId); - if (Array.isArray(object?.versions)) obj.versions = object.versions.map((e: any) => Version.fromJSON(e)); - if (isSet(object.state)) obj.state = stateFromJSON(object.state); - if (isSet(object.counterparty)) obj.counterparty = Counterparty.fromJSON(object.counterparty); - if (isSet(object.delayPeriod)) obj.delayPeriod = BigInt(object.delayPeriod.toString()); - return obj; + return { + id: isSet(object.id) ? String(object.id) : "", + clientId: isSet(object.clientId) ? String(object.clientId) : "", + versions: Array.isArray(object?.versions) ? object.versions.map((e: any) => Version.fromJSON(e)) : [], + state: isSet(object.state) ? stateFromJSON(object.state) : -1, + counterparty: isSet(object.counterparty) ? Counterparty.fromJSON(object.counterparty) : undefined, + delayPeriod: isSet(object.delayPeriod) ? BigInt(object.delayPeriod.toString()) : BigInt(0) + }; }, toJSON(message: IdentifiedConnection): JsonSafe<IdentifiedConnection> { const obj: any = {}; @@ -500,12 +531,8 @@ export const IdentifiedConnection = { message.clientId = object.clientId ?? ""; message.versions = object.versions?.map(e => Version.fromPartial(e)) || []; message.state = object.state ?? 0; - if (object.counterparty !== undefined && object.counterparty !== null) { - message.counterparty = Counterparty.fromPartial(object.counterparty); - } - if (object.delayPeriod !== undefined && object.delayPeriod !== null) { - message.delayPeriod = BigInt(object.delayPeriod.toString()); - } + message.counterparty = object.counterparty !== undefined && object.counterparty !== null ? Counterparty.fromPartial(object.counterparty) : undefined; + message.delayPeriod = object.delayPeriod !== undefined && object.delayPeriod !== null ? BigInt(object.delayPeriod.toString()) : BigInt(0); return message; }, fromSDK(object: IdentifiedConnectionSDKType): IdentifiedConnection { @@ -608,10 +635,10 @@ function createBaseCounterparty(): Counterparty { export const Counterparty = { typeUrl: "/ibc.core.connection.v1.Counterparty", encode(message: Counterparty, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.clientId !== undefined) { + if (message.clientId !== "") { writer.uint32(10).string(message.clientId); } - if (message.connectionId !== undefined) { + if (message.connectionId !== "") { writer.uint32(18).string(message.connectionId); } if (message.prefix !== undefined) { @@ -643,11 +670,11 @@ export const Counterparty = { return message; }, fromJSON(object: any): Counterparty { - const obj = createBaseCounterparty(); - if (isSet(object.clientId)) obj.clientId = String(object.clientId); - if (isSet(object.connectionId)) obj.connectionId = String(object.connectionId); - if (isSet(object.prefix)) obj.prefix = MerklePrefix.fromJSON(object.prefix); - return obj; + return { + clientId: isSet(object.clientId) ? String(object.clientId) : "", + connectionId: isSet(object.connectionId) ? String(object.connectionId) : "", + prefix: isSet(object.prefix) ? MerklePrefix.fromJSON(object.prefix) : undefined + }; }, toJSON(message: Counterparty): JsonSafe<Counterparty> { const obj: any = {}; @@ -660,9 +687,7 @@ export const Counterparty = { const message = createBaseCounterparty(); message.clientId = object.clientId ?? ""; message.connectionId = object.connectionId ?? ""; - if (object.prefix !== undefined && object.prefix !== null) { - message.prefix = MerklePrefix.fromPartial(object.prefix); - } + message.prefix = object.prefix !== undefined && object.prefix !== null ? MerklePrefix.fromPartial(object.prefix) : undefined; return message; }, fromSDK(object: CounterpartySDKType): Counterparty { @@ -759,9 +784,9 @@ export const ClientPaths = { return message; }, fromJSON(object: any): ClientPaths { - const obj = createBaseClientPaths(); - if (Array.isArray(object?.paths)) obj.paths = object.paths.map((e: any) => String(e)); - return obj; + return { + paths: Array.isArray(object?.paths) ? object.paths.map((e: any) => String(e)) : [] + }; }, toJSON(message: ClientPaths): JsonSafe<ClientPaths> { const obj: any = {}; @@ -841,7 +866,7 @@ function createBaseConnectionPaths(): ConnectionPaths { export const ConnectionPaths = { typeUrl: "/ibc.core.connection.v1.ConnectionPaths", encode(message: ConnectionPaths, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.clientId !== undefined) { + if (message.clientId !== "") { writer.uint32(10).string(message.clientId); } for (const v of message.paths) { @@ -870,10 +895,10 @@ export const ConnectionPaths = { return message; }, fromJSON(object: any): ConnectionPaths { - const obj = createBaseConnectionPaths(); - if (isSet(object.clientId)) obj.clientId = String(object.clientId); - if (Array.isArray(object?.paths)) obj.paths = object.paths.map((e: any) => String(e)); - return obj; + return { + clientId: isSet(object.clientId) ? String(object.clientId) : "", + paths: Array.isArray(object?.paths) ? object.paths.map((e: any) => String(e)) : [] + }; }, toJSON(message: ConnectionPaths): JsonSafe<ConnectionPaths> { const obj: any = {}; @@ -962,7 +987,7 @@ function createBaseVersion(): Version { export const Version = { typeUrl: "/ibc.core.connection.v1.Version", encode(message: Version, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.identifier !== undefined) { + if (message.identifier !== "") { writer.uint32(10).string(message.identifier); } for (const v of message.features) { @@ -991,10 +1016,10 @@ export const Version = { return message; }, fromJSON(object: any): Version { - const obj = createBaseVersion(); - if (isSet(object.identifier)) obj.identifier = String(object.identifier); - if (Array.isArray(object?.features)) obj.features = object.features.map((e: any) => String(e)); - return obj; + return { + identifier: isSet(object.identifier) ? String(object.identifier) : "", + features: Array.isArray(object?.features) ? object.features.map((e: any) => String(e)) : [] + }; }, toJSON(message: Version): JsonSafe<Version> { const obj: any = {}; @@ -1082,7 +1107,7 @@ function createBaseParams(): Params { export const Params = { typeUrl: "/ibc.core.connection.v1.Params", encode(message: Params, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.maxExpectedTimePerBlock !== undefined) { + if (message.maxExpectedTimePerBlock !== BigInt(0)) { writer.uint32(8).uint64(message.maxExpectedTimePerBlock); } return writer; @@ -1105,9 +1130,9 @@ export const Params = { return message; }, fromJSON(object: any): Params { - const obj = createBaseParams(); - if (isSet(object.maxExpectedTimePerBlock)) obj.maxExpectedTimePerBlock = BigInt(object.maxExpectedTimePerBlock.toString()); - return obj; + return { + maxExpectedTimePerBlock: isSet(object.maxExpectedTimePerBlock) ? BigInt(object.maxExpectedTimePerBlock.toString()) : BigInt(0) + }; }, toJSON(message: Params): JsonSafe<Params> { const obj: any = {}; @@ -1116,9 +1141,7 @@ export const Params = { }, fromPartial(object: DeepPartial<Params>): Params { const message = createBaseParams(); - if (object.maxExpectedTimePerBlock !== undefined && object.maxExpectedTimePerBlock !== null) { - message.maxExpectedTimePerBlock = BigInt(object.maxExpectedTimePerBlock.toString()); - } + message.maxExpectedTimePerBlock = object.maxExpectedTimePerBlock !== undefined && object.maxExpectedTimePerBlock !== null ? BigInt(object.maxExpectedTimePerBlock.toString()) : BigInt(0); return message; }, fromSDK(object: ParamsSDKType): Params { diff --git a/__fixtures__/v-next/outputv4/ibc/core/connection/v1/genesis.ts b/__fixtures__/v-next/outputv4/ibc/core/connection/v1/genesis.ts index f4ea4cdab9..952d80b7f5 100644 --- a/__fixtures__/v-next/outputv4/ibc/core/connection/v1/genesis.ts +++ b/__fixtures__/v-next/outputv4/ibc/core/connection/v1/genesis.ts @@ -1,7 +1,8 @@ -import { IdentifiedConnection, IdentifiedConnectionSDKType, ConnectionPaths, ConnectionPathsSDKType, Params, ParamsSDKType } from "./connection.js"; -import { BinaryReader, BinaryWriter } from "../../../../binary.js"; -import { isSet, DeepPartial } from "../../../../helpers.js"; -import { JsonSafe } from "../../../../json-safe.js"; +import { IdentifiedConnection, IdentifiedConnectionSDKType, ConnectionPaths, ConnectionPathsSDKType, Params, ParamsSDKType } from "./connection"; +import { BinaryReader, BinaryWriter } from "../../../../binary"; +import { isSet, DeepPartial } from "../../../../helpers"; +import { JsonSafe } from "../../../../json-safe"; +import { ComputedRef } from "vue"; export const protobufPackage = "ibc.core.connection.v1"; /** GenesisState defines the ibc connection submodule's genesis state. */ export interface GenesisState { @@ -11,6 +12,12 @@ export interface GenesisState { nextConnectionSequence: bigint; params: Params; } +export interface ReactiveGenesisState { + connections: ComputedRef<IdentifiedConnection[]>; + clientConnectionPaths: ComputedRef<ConnectionPaths[]>; + nextConnectionSequence: ComputedRef<bigint>; + params: ComputedRef<Params>; +} export interface GenesisStateProtoMsg { typeUrl: "/ibc.core.connection.v1.GenesisState"; value: Uint8Array; @@ -39,7 +46,7 @@ export const GenesisState = { for (const v of message.clientConnectionPaths) { ConnectionPaths.encode(v!, writer.uint32(18).fork()).ldelim(); } - if (message.nextConnectionSequence !== undefined) { + if (message.nextConnectionSequence !== BigInt(0)) { writer.uint32(24).uint64(message.nextConnectionSequence); } if (message.params !== undefined) { @@ -74,12 +81,12 @@ export const GenesisState = { return message; }, fromJSON(object: any): GenesisState { - const obj = createBaseGenesisState(); - if (Array.isArray(object?.connections)) obj.connections = object.connections.map((e: any) => IdentifiedConnection.fromJSON(e)); - if (Array.isArray(object?.clientConnectionPaths)) obj.clientConnectionPaths = object.clientConnectionPaths.map((e: any) => ConnectionPaths.fromJSON(e)); - if (isSet(object.nextConnectionSequence)) obj.nextConnectionSequence = BigInt(object.nextConnectionSequence.toString()); - if (isSet(object.params)) obj.params = Params.fromJSON(object.params); - return obj; + return { + connections: Array.isArray(object?.connections) ? object.connections.map((e: any) => IdentifiedConnection.fromJSON(e)) : [], + clientConnectionPaths: Array.isArray(object?.clientConnectionPaths) ? object.clientConnectionPaths.map((e: any) => ConnectionPaths.fromJSON(e)) : [], + nextConnectionSequence: isSet(object.nextConnectionSequence) ? BigInt(object.nextConnectionSequence.toString()) : BigInt(0), + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined + }; }, toJSON(message: GenesisState): JsonSafe<GenesisState> { const obj: any = {}; @@ -101,12 +108,8 @@ export const GenesisState = { const message = createBaseGenesisState(); message.connections = object.connections?.map(e => IdentifiedConnection.fromPartial(e)) || []; message.clientConnectionPaths = object.clientConnectionPaths?.map(e => ConnectionPaths.fromPartial(e)) || []; - if (object.nextConnectionSequence !== undefined && object.nextConnectionSequence !== null) { - message.nextConnectionSequence = BigInt(object.nextConnectionSequence.toString()); - } - if (object.params !== undefined && object.params !== null) { - message.params = Params.fromPartial(object.params); - } + message.nextConnectionSequence = object.nextConnectionSequence !== undefined && object.nextConnectionSequence !== null ? BigInt(object.nextConnectionSequence.toString()) : BigInt(0); + message.params = object.params !== undefined && object.params !== null ? Params.fromPartial(object.params) : undefined; return message; }, fromSDK(object: GenesisStateSDKType): GenesisState { diff --git a/__fixtures__/v-next/outputv4/ibc/core/connection/v1/query.lcd.ts b/__fixtures__/v-next/outputv4/ibc/core/connection/v1/query.lcd.ts index d9ecbe6173..db7693eb9a 100644 --- a/__fixtures__/v-next/outputv4/ibc/core/connection/v1/query.lcd.ts +++ b/__fixtures__/v-next/outputv4/ibc/core/connection/v1/query.lcd.ts @@ -1,10 +1,10 @@ -import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../../../cosmos/base/query/v1beta1/pagination.js"; -import { ConnectionEnd, ConnectionEndSDKType, IdentifiedConnection, IdentifiedConnectionSDKType } from "./connection.js"; -import { Height, HeightSDKType, IdentifiedClientState, IdentifiedClientStateSDKType } from "../../client/v1/client.js"; -import { Any, AnySDKType } from "../../../../google/protobuf/any.js"; -import { setPaginationParams } from "../../../../helpers.js"; +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../../../cosmos/base/query/v1beta1/pagination"; +import { ConnectionEnd, ConnectionEndSDKType, IdentifiedConnection, IdentifiedConnectionSDKType } from "./connection"; +import { Height, HeightSDKType, IdentifiedClientState, IdentifiedClientStateSDKType } from "../../client/v1/client"; +import { Any, AnySDKType } from "../../../../google/protobuf/any"; +import { setPaginationParams } from "../../../../helpers"; import { LCDClient } from "@cosmology/lcd"; -import { QueryConnectionRequest, QueryConnectionRequestSDKType, QueryConnectionResponse, QueryConnectionResponseSDKType, QueryConnectionsRequest, QueryConnectionsRequestSDKType, QueryConnectionsResponse, QueryConnectionsResponseSDKType, QueryClientConnectionsRequest, QueryClientConnectionsRequestSDKType, QueryClientConnectionsResponse, QueryClientConnectionsResponseSDKType, QueryConnectionClientStateRequest, QueryConnectionClientStateRequestSDKType, QueryConnectionClientStateResponse, QueryConnectionClientStateResponseSDKType, QueryConnectionConsensusStateRequest, QueryConnectionConsensusStateRequestSDKType, QueryConnectionConsensusStateResponse, QueryConnectionConsensusStateResponseSDKType } from "./query.js"; +import { QueryConnectionRequest, QueryConnectionRequestSDKType, QueryConnectionResponse, QueryConnectionResponseSDKType, QueryConnectionsRequest, QueryConnectionsRequestSDKType, QueryConnectionsResponse, QueryConnectionsResponseSDKType, QueryClientConnectionsRequest, QueryClientConnectionsRequestSDKType, QueryClientConnectionsResponse, QueryClientConnectionsResponseSDKType, QueryConnectionClientStateRequest, QueryConnectionClientStateRequestSDKType, QueryConnectionClientStateResponse, QueryConnectionClientStateResponseSDKType, QueryConnectionConsensusStateRequest, QueryConnectionConsensusStateRequestSDKType, QueryConnectionConsensusStateResponse, QueryConnectionConsensusStateResponseSDKType } from "./query"; export class LCDQueryClient { req: LCDClient; constructor({ @@ -26,7 +26,7 @@ export class LCDQueryClient { } /* Connections queries all the IBC connections of a chain. */ async connections(params: QueryConnectionsRequest = { - pagination: PageRequest.fromPartial({}) + pagination: undefined }): Promise<QueryConnectionsResponseSDKType> { const options: any = { params: {} diff --git a/__fixtures__/v-next/outputv4/ibc/core/connection/v1/query.rpc.Query.ts b/__fixtures__/v-next/outputv4/ibc/core/connection/v1/query.rpc.Query.ts index 7a925539b4..344506aef1 100644 --- a/__fixtures__/v-next/outputv4/ibc/core/connection/v1/query.rpc.Query.ts +++ b/__fixtures__/v-next/outputv4/ibc/core/connection/v1/query.rpc.Query.ts @@ -1,11 +1,11 @@ -import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../../../cosmos/base/query/v1beta1/pagination.js"; -import { ConnectionEnd, ConnectionEndSDKType, IdentifiedConnection, IdentifiedConnectionSDKType } from "./connection.js"; -import { Height, HeightSDKType, IdentifiedClientState, IdentifiedClientStateSDKType } from "../../client/v1/client.js"; -import { Any, AnySDKType } from "../../../../google/protobuf/any.js"; -import { Rpc } from "../../../../helpers.js"; -import { BinaryReader } from "../../../../binary.js"; +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../../../cosmos/base/query/v1beta1/pagination"; +import { ConnectionEnd, ConnectionEndSDKType, IdentifiedConnection, IdentifiedConnectionSDKType } from "./connection"; +import { Height, HeightSDKType, IdentifiedClientState, IdentifiedClientStateSDKType } from "../../client/v1/client"; +import { Any, AnySDKType } from "../../../../google/protobuf/any"; +import { Rpc } from "../../../../helpers"; +import { BinaryReader } from "../../../../binary"; import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; -import { QueryConnectionRequest, QueryConnectionRequestSDKType, QueryConnectionResponse, QueryConnectionResponseSDKType, QueryConnectionsRequest, QueryConnectionsRequestSDKType, QueryConnectionsResponse, QueryConnectionsResponseSDKType, QueryClientConnectionsRequest, QueryClientConnectionsRequestSDKType, QueryClientConnectionsResponse, QueryClientConnectionsResponseSDKType, QueryConnectionClientStateRequest, QueryConnectionClientStateRequestSDKType, QueryConnectionClientStateResponse, QueryConnectionClientStateResponseSDKType, QueryConnectionConsensusStateRequest, QueryConnectionConsensusStateRequestSDKType, QueryConnectionConsensusStateResponse, QueryConnectionConsensusStateResponseSDKType } from "./query.js"; +import { QueryConnectionRequest, QueryConnectionRequestSDKType, QueryConnectionResponse, QueryConnectionResponseSDKType, QueryConnectionsRequest, QueryConnectionsRequestSDKType, QueryConnectionsResponse, QueryConnectionsResponseSDKType, QueryClientConnectionsRequest, QueryClientConnectionsRequestSDKType, QueryClientConnectionsResponse, QueryClientConnectionsResponseSDKType, QueryConnectionClientStateRequest, QueryConnectionClientStateRequestSDKType, QueryConnectionClientStateResponse, QueryConnectionClientStateResponseSDKType, QueryConnectionConsensusStateRequest, QueryConnectionConsensusStateRequestSDKType, QueryConnectionConsensusStateResponse, QueryConnectionConsensusStateResponseSDKType, ReactiveQueryConnectionRequest, ReactiveQueryConnectionsRequest, ReactiveQueryClientConnectionsRequest, ReactiveQueryConnectionClientStateRequest, ReactiveQueryConnectionConsensusStateRequest } from "./query"; /** Query provides defines the gRPC querier service */ export interface Query { /** Connection queries an IBC connection end. */ @@ -44,7 +44,7 @@ export class QueryClientImpl implements Query { return promise.then(data => QueryConnectionResponse.decode(new BinaryReader(data))); } connections(request: QueryConnectionsRequest = { - pagination: PageRequest.fromPartial({}) + pagination: undefined }): Promise<QueryConnectionsResponse> { const data = QueryConnectionsRequest.encode(request).finish(); const promise = this.rpc.request("ibc.core.connection.v1.Query", "Connections", data); diff --git a/__fixtures__/v-next/outputv4/ibc/core/connection/v1/query.ts b/__fixtures__/v-next/outputv4/ibc/core/connection/v1/query.ts index 71a52c8c2f..382d5419a1 100644 --- a/__fixtures__/v-next/outputv4/ibc/core/connection/v1/query.ts +++ b/__fixtures__/v-next/outputv4/ibc/core/connection/v1/query.ts @@ -1,10 +1,11 @@ -import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../../../cosmos/base/query/v1beta1/pagination.js"; -import { ConnectionEnd, ConnectionEndSDKType, IdentifiedConnection, IdentifiedConnectionSDKType } from "./connection.js"; -import { Height, HeightSDKType, IdentifiedClientState, IdentifiedClientStateSDKType } from "../../client/v1/client.js"; -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 { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../../../cosmos/base/query/v1beta1/pagination"; +import { ConnectionEnd, ConnectionEndSDKType, IdentifiedConnection, IdentifiedConnectionSDKType } from "./connection"; +import { Height, HeightSDKType, IdentifiedClientState, IdentifiedClientStateSDKType } from "../../client/v1/client"; +import { Any, AnySDKType } from "../../../../google/protobuf/any"; +import { BinaryReader, BinaryWriter } from "../../../../binary"; +import { isSet, DeepPartial, bytesFromBase64, base64FromBytes } from "../../../../helpers"; +import { JsonSafe } from "../../../../json-safe"; +import { ComputedRef } from "vue"; export const protobufPackage = "ibc.core.connection.v1"; /** * QueryConnectionRequest is the request type for the Query/Connection RPC @@ -14,6 +15,9 @@ export interface QueryConnectionRequest { /** connection unique identifier */ connectionId: string; } +export interface ReactiveQueryConnectionRequest { + connectionId: ComputedRef<string>; +} export interface QueryConnectionRequestProtoMsg { typeUrl: "/ibc.core.connection.v1.QueryConnectionRequest"; value: Uint8Array; @@ -38,6 +42,11 @@ export interface QueryConnectionResponse { /** height at which the proof was retrieved */ proofHeight: Height; } +export interface ReactiveQueryConnectionResponse { + connection?: ComputedRef<ConnectionEnd>; + proof: ComputedRef<Uint8Array>; + proofHeight: ComputedRef<Height>; +} export interface QueryConnectionResponseProtoMsg { typeUrl: "/ibc.core.connection.v1.QueryConnectionResponse"; value: Uint8Array; @@ -59,6 +68,9 @@ export interface QueryConnectionResponseSDKType { export interface QueryConnectionsRequest { pagination?: PageRequest; } +export interface ReactiveQueryConnectionsRequest { + pagination?: ComputedRef<PageRequest>; +} export interface QueryConnectionsRequestProtoMsg { typeUrl: "/ibc.core.connection.v1.QueryConnectionsRequest"; value: Uint8Array; @@ -82,6 +94,11 @@ export interface QueryConnectionsResponse { /** query block height */ height: Height; } +export interface ReactiveQueryConnectionsResponse { + connections: ComputedRef<IdentifiedConnection[]>; + pagination?: ComputedRef<PageResponse>; + height: ComputedRef<Height>; +} export interface QueryConnectionsResponseProtoMsg { typeUrl: "/ibc.core.connection.v1.QueryConnectionsResponse"; value: Uint8Array; @@ -103,6 +120,9 @@ export interface QueryClientConnectionsRequest { /** client identifier associated with a connection */ clientId: string; } +export interface ReactiveQueryClientConnectionsRequest { + clientId: ComputedRef<string>; +} export interface QueryClientConnectionsRequestProtoMsg { typeUrl: "/ibc.core.connection.v1.QueryClientConnectionsRequest"; value: Uint8Array; @@ -126,6 +146,11 @@ export interface QueryClientConnectionsResponse { /** height at which the proof was generated */ proofHeight: Height; } +export interface ReactiveQueryClientConnectionsResponse { + connectionPaths: ComputedRef<string[]>; + proof: ComputedRef<Uint8Array>; + proofHeight: ComputedRef<Height>; +} export interface QueryClientConnectionsResponseProtoMsg { typeUrl: "/ibc.core.connection.v1.QueryClientConnectionsResponse"; value: Uint8Array; @@ -147,6 +172,9 @@ export interface QueryConnectionClientStateRequest { /** connection identifier */ connectionId: string; } +export interface ReactiveQueryConnectionClientStateRequest { + connectionId: ComputedRef<string>; +} export interface QueryConnectionClientStateRequestProtoMsg { typeUrl: "/ibc.core.connection.v1.QueryConnectionClientStateRequest"; value: Uint8Array; @@ -170,6 +198,11 @@ export interface QueryConnectionClientStateResponse { /** height at which the proof was retrieved */ proofHeight: Height; } +export interface ReactiveQueryConnectionClientStateResponse { + identifiedClientState?: ComputedRef<IdentifiedClientState>; + proof: ComputedRef<Uint8Array>; + proofHeight: ComputedRef<Height>; +} export interface QueryConnectionClientStateResponseProtoMsg { typeUrl: "/ibc.core.connection.v1.QueryConnectionClientStateResponse"; value: Uint8Array; @@ -193,6 +226,11 @@ export interface QueryConnectionConsensusStateRequest { revisionNumber: bigint; revisionHeight: bigint; } +export interface ReactiveQueryConnectionConsensusStateRequest { + connectionId: ComputedRef<string>; + revisionNumber: ComputedRef<bigint>; + revisionHeight: ComputedRef<bigint>; +} export interface QueryConnectionConsensusStateRequestProtoMsg { typeUrl: "/ibc.core.connection.v1.QueryConnectionConsensusStateRequest"; value: Uint8Array; @@ -220,6 +258,12 @@ export interface QueryConnectionConsensusStateResponse { /** height at which the proof was retrieved */ proofHeight: Height; } +export interface ReactiveQueryConnectionConsensusStateResponse { + consensusState?: ComputedRef<Any>; + clientId: ComputedRef<string>; + proof: ComputedRef<Uint8Array>; + proofHeight: ComputedRef<Height>; +} export interface QueryConnectionConsensusStateResponseProtoMsg { typeUrl: "/ibc.core.connection.v1.QueryConnectionConsensusStateResponse"; value: Uint8Array; @@ -242,7 +286,7 @@ function createBaseQueryConnectionRequest(): QueryConnectionRequest { export const QueryConnectionRequest = { typeUrl: "/ibc.core.connection.v1.QueryConnectionRequest", encode(message: QueryConnectionRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.connectionId !== undefined) { + if (message.connectionId !== "") { writer.uint32(10).string(message.connectionId); } return writer; @@ -265,9 +309,9 @@ export const QueryConnectionRequest = { return message; }, fromJSON(object: any): QueryConnectionRequest { - const obj = createBaseQueryConnectionRequest(); - if (isSet(object.connectionId)) obj.connectionId = String(object.connectionId); - return obj; + return { + connectionId: isSet(object.connectionId) ? String(object.connectionId) : "" + }; }, toJSON(message: QueryConnectionRequest): JsonSafe<QueryConnectionRequest> { const obj: any = {}; @@ -373,11 +417,11 @@ export const QueryConnectionResponse = { return message; }, fromJSON(object: any): QueryConnectionResponse { - const obj = createBaseQueryConnectionResponse(); - if (isSet(object.connection)) obj.connection = ConnectionEnd.fromJSON(object.connection); - if (isSet(object.proof)) obj.proof = bytesFromBase64(object.proof); - if (isSet(object.proofHeight)) obj.proofHeight = Height.fromJSON(object.proofHeight); - return obj; + return { + connection: isSet(object.connection) ? ConnectionEnd.fromJSON(object.connection) : undefined, + proof: isSet(object.proof) ? bytesFromBase64(object.proof) : new Uint8Array(), + proofHeight: isSet(object.proofHeight) ? Height.fromJSON(object.proofHeight) : undefined + }; }, toJSON(message: QueryConnectionResponse): JsonSafe<QueryConnectionResponse> { const obj: any = {}; @@ -388,13 +432,9 @@ export const QueryConnectionResponse = { }, fromPartial(object: DeepPartial<QueryConnectionResponse>): QueryConnectionResponse { const message = createBaseQueryConnectionResponse(); - if (object.connection !== undefined && object.connection !== null) { - message.connection = ConnectionEnd.fromPartial(object.connection); - } + message.connection = object.connection !== undefined && object.connection !== null ? ConnectionEnd.fromPartial(object.connection) : undefined; message.proof = object.proof ?? new Uint8Array(); - if (object.proofHeight !== undefined && object.proofHeight !== null) { - message.proofHeight = Height.fromPartial(object.proofHeight); - } + message.proofHeight = object.proofHeight !== undefined && object.proofHeight !== null ? Height.fromPartial(object.proofHeight) : undefined; return message; }, fromSDK(object: QueryConnectionResponseSDKType): QueryConnectionResponse { @@ -491,9 +531,9 @@ export const QueryConnectionsRequest = { return message; }, fromJSON(object: any): QueryConnectionsRequest { - const obj = createBaseQueryConnectionsRequest(); - if (isSet(object.pagination)) obj.pagination = PageRequest.fromJSON(object.pagination); - return obj; + return { + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined + }; }, toJSON(message: QueryConnectionsRequest): JsonSafe<QueryConnectionsRequest> { const obj: any = {}; @@ -502,9 +542,7 @@ export const QueryConnectionsRequest = { }, fromPartial(object: DeepPartial<QueryConnectionsRequest>): QueryConnectionsRequest { const message = createBaseQueryConnectionsRequest(); - if (object.pagination !== undefined && object.pagination !== null) { - message.pagination = PageRequest.fromPartial(object.pagination); - } + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageRequest.fromPartial(object.pagination) : undefined; return message; }, fromSDK(object: QueryConnectionsRequestSDKType): QueryConnectionsRequest { @@ -601,11 +639,11 @@ export const QueryConnectionsResponse = { return message; }, fromJSON(object: any): QueryConnectionsResponse { - const obj = createBaseQueryConnectionsResponse(); - if (Array.isArray(object?.connections)) obj.connections = object.connections.map((e: any) => IdentifiedConnection.fromJSON(e)); - if (isSet(object.pagination)) obj.pagination = PageResponse.fromJSON(object.pagination); - if (isSet(object.height)) obj.height = Height.fromJSON(object.height); - return obj; + return { + connections: Array.isArray(object?.connections) ? object.connections.map((e: any) => IdentifiedConnection.fromJSON(e)) : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + height: isSet(object.height) ? Height.fromJSON(object.height) : undefined + }; }, toJSON(message: QueryConnectionsResponse): JsonSafe<QueryConnectionsResponse> { const obj: any = {}; @@ -621,12 +659,8 @@ export const QueryConnectionsResponse = { fromPartial(object: DeepPartial<QueryConnectionsResponse>): QueryConnectionsResponse { const message = createBaseQueryConnectionsResponse(); message.connections = object.connections?.map(e => IdentifiedConnection.fromPartial(e)) || []; - if (object.pagination !== undefined && object.pagination !== null) { - message.pagination = PageResponse.fromPartial(object.pagination); - } - if (object.height !== undefined && object.height !== null) { - message.height = Height.fromPartial(object.height); - } + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageResponse.fromPartial(object.pagination) : undefined; + message.height = object.height !== undefined && object.height !== null ? Height.fromPartial(object.height) : undefined; return message; }, fromSDK(object: QueryConnectionsResponseSDKType): QueryConnectionsResponse { @@ -706,7 +740,7 @@ function createBaseQueryClientConnectionsRequest(): QueryClientConnectionsReques export const QueryClientConnectionsRequest = { typeUrl: "/ibc.core.connection.v1.QueryClientConnectionsRequest", encode(message: QueryClientConnectionsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.clientId !== undefined) { + if (message.clientId !== "") { writer.uint32(10).string(message.clientId); } return writer; @@ -729,9 +763,9 @@ export const QueryClientConnectionsRequest = { return message; }, fromJSON(object: any): QueryClientConnectionsRequest { - const obj = createBaseQueryClientConnectionsRequest(); - if (isSet(object.clientId)) obj.clientId = String(object.clientId); - return obj; + return { + clientId: isSet(object.clientId) ? String(object.clientId) : "" + }; }, toJSON(message: QueryClientConnectionsRequest): JsonSafe<QueryClientConnectionsRequest> { const obj: any = {}; @@ -837,11 +871,11 @@ export const QueryClientConnectionsResponse = { return message; }, fromJSON(object: any): QueryClientConnectionsResponse { - const obj = createBaseQueryClientConnectionsResponse(); - if (Array.isArray(object?.connectionPaths)) obj.connectionPaths = object.connectionPaths.map((e: any) => String(e)); - if (isSet(object.proof)) obj.proof = bytesFromBase64(object.proof); - if (isSet(object.proofHeight)) obj.proofHeight = Height.fromJSON(object.proofHeight); - return obj; + return { + connectionPaths: Array.isArray(object?.connectionPaths) ? object.connectionPaths.map((e: any) => String(e)) : [], + proof: isSet(object.proof) ? bytesFromBase64(object.proof) : new Uint8Array(), + proofHeight: isSet(object.proofHeight) ? Height.fromJSON(object.proofHeight) : undefined + }; }, toJSON(message: QueryClientConnectionsResponse): JsonSafe<QueryClientConnectionsResponse> { const obj: any = {}; @@ -858,9 +892,7 @@ export const QueryClientConnectionsResponse = { const message = createBaseQueryClientConnectionsResponse(); message.connectionPaths = object.connectionPaths?.map(e => e) || []; message.proof = object.proof ?? new Uint8Array(); - if (object.proofHeight !== undefined && object.proofHeight !== null) { - message.proofHeight = Height.fromPartial(object.proofHeight); - } + message.proofHeight = object.proofHeight !== undefined && object.proofHeight !== null ? Height.fromPartial(object.proofHeight) : undefined; return message; }, fromSDK(object: QueryClientConnectionsResponseSDKType): QueryClientConnectionsResponse { @@ -940,7 +972,7 @@ function createBaseQueryConnectionClientStateRequest(): QueryConnectionClientSta export const QueryConnectionClientStateRequest = { typeUrl: "/ibc.core.connection.v1.QueryConnectionClientStateRequest", encode(message: QueryConnectionClientStateRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.connectionId !== undefined) { + if (message.connectionId !== "") { writer.uint32(10).string(message.connectionId); } return writer; @@ -963,9 +995,9 @@ export const QueryConnectionClientStateRequest = { return message; }, fromJSON(object: any): QueryConnectionClientStateRequest { - const obj = createBaseQueryConnectionClientStateRequest(); - if (isSet(object.connectionId)) obj.connectionId = String(object.connectionId); - return obj; + return { + connectionId: isSet(object.connectionId) ? String(object.connectionId) : "" + }; }, toJSON(message: QueryConnectionClientStateRequest): JsonSafe<QueryConnectionClientStateRequest> { const obj: any = {}; @@ -1071,11 +1103,11 @@ export const QueryConnectionClientStateResponse = { return message; }, fromJSON(object: any): QueryConnectionClientStateResponse { - const obj = createBaseQueryConnectionClientStateResponse(); - if (isSet(object.identifiedClientState)) obj.identifiedClientState = IdentifiedClientState.fromJSON(object.identifiedClientState); - if (isSet(object.proof)) obj.proof = bytesFromBase64(object.proof); - if (isSet(object.proofHeight)) obj.proofHeight = Height.fromJSON(object.proofHeight); - return obj; + return { + identifiedClientState: isSet(object.identifiedClientState) ? IdentifiedClientState.fromJSON(object.identifiedClientState) : undefined, + proof: isSet(object.proof) ? bytesFromBase64(object.proof) : new Uint8Array(), + proofHeight: isSet(object.proofHeight) ? Height.fromJSON(object.proofHeight) : undefined + }; }, toJSON(message: QueryConnectionClientStateResponse): JsonSafe<QueryConnectionClientStateResponse> { const obj: any = {}; @@ -1086,13 +1118,9 @@ export const QueryConnectionClientStateResponse = { }, fromPartial(object: DeepPartial<QueryConnectionClientStateResponse>): QueryConnectionClientStateResponse { const message = createBaseQueryConnectionClientStateResponse(); - if (object.identifiedClientState !== undefined && object.identifiedClientState !== null) { - message.identifiedClientState = IdentifiedClientState.fromPartial(object.identifiedClientState); - } + message.identifiedClientState = object.identifiedClientState !== undefined && object.identifiedClientState !== null ? IdentifiedClientState.fromPartial(object.identifiedClientState) : undefined; message.proof = object.proof ?? new Uint8Array(); - if (object.proofHeight !== undefined && object.proofHeight !== null) { - message.proofHeight = Height.fromPartial(object.proofHeight); - } + message.proofHeight = object.proofHeight !== undefined && object.proofHeight !== null ? Height.fromPartial(object.proofHeight) : undefined; return message; }, fromSDK(object: QueryConnectionClientStateResponseSDKType): QueryConnectionClientStateResponse { @@ -1168,13 +1196,13 @@ function createBaseQueryConnectionConsensusStateRequest(): QueryConnectionConsen export const QueryConnectionConsensusStateRequest = { typeUrl: "/ibc.core.connection.v1.QueryConnectionConsensusStateRequest", encode(message: QueryConnectionConsensusStateRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.connectionId !== undefined) { + if (message.connectionId !== "") { writer.uint32(10).string(message.connectionId); } - if (message.revisionNumber !== undefined) { + if (message.revisionNumber !== BigInt(0)) { writer.uint32(16).uint64(message.revisionNumber); } - if (message.revisionHeight !== undefined) { + if (message.revisionHeight !== BigInt(0)) { writer.uint32(24).uint64(message.revisionHeight); } return writer; @@ -1203,11 +1231,11 @@ export const QueryConnectionConsensusStateRequest = { return message; }, fromJSON(object: any): QueryConnectionConsensusStateRequest { - const obj = createBaseQueryConnectionConsensusStateRequest(); - if (isSet(object.connectionId)) obj.connectionId = String(object.connectionId); - if (isSet(object.revisionNumber)) obj.revisionNumber = BigInt(object.revisionNumber.toString()); - if (isSet(object.revisionHeight)) obj.revisionHeight = BigInt(object.revisionHeight.toString()); - return obj; + return { + connectionId: isSet(object.connectionId) ? String(object.connectionId) : "", + revisionNumber: isSet(object.revisionNumber) ? BigInt(object.revisionNumber.toString()) : BigInt(0), + revisionHeight: isSet(object.revisionHeight) ? BigInt(object.revisionHeight.toString()) : BigInt(0) + }; }, toJSON(message: QueryConnectionConsensusStateRequest): JsonSafe<QueryConnectionConsensusStateRequest> { const obj: any = {}; @@ -1219,12 +1247,8 @@ export const QueryConnectionConsensusStateRequest = { fromPartial(object: DeepPartial<QueryConnectionConsensusStateRequest>): QueryConnectionConsensusStateRequest { const message = createBaseQueryConnectionConsensusStateRequest(); message.connectionId = object.connectionId ?? ""; - if (object.revisionNumber !== undefined && object.revisionNumber !== null) { - message.revisionNumber = BigInt(object.revisionNumber.toString()); - } - if (object.revisionHeight !== undefined && object.revisionHeight !== null) { - message.revisionHeight = BigInt(object.revisionHeight.toString()); - } + message.revisionNumber = object.revisionNumber !== undefined && object.revisionNumber !== null ? BigInt(object.revisionNumber.toString()) : BigInt(0); + message.revisionHeight = object.revisionHeight !== undefined && object.revisionHeight !== null ? BigInt(object.revisionHeight.toString()) : BigInt(0); return message; }, fromSDK(object: QueryConnectionConsensusStateRequestSDKType): QueryConnectionConsensusStateRequest { @@ -1304,7 +1328,7 @@ export const QueryConnectionConsensusStateResponse = { if (message.consensusState !== undefined) { Any.encode(message.consensusState, writer.uint32(10).fork()).ldelim(); } - if (message.clientId !== undefined) { + if (message.clientId !== "") { writer.uint32(18).string(message.clientId); } if (message.proof.length !== 0) { @@ -1342,12 +1366,12 @@ export const QueryConnectionConsensusStateResponse = { return message; }, fromJSON(object: any): QueryConnectionConsensusStateResponse { - const obj = createBaseQueryConnectionConsensusStateResponse(); - if (isSet(object.consensusState)) obj.consensusState = Any.fromJSON(object.consensusState); - if (isSet(object.clientId)) obj.clientId = String(object.clientId); - if (isSet(object.proof)) obj.proof = bytesFromBase64(object.proof); - if (isSet(object.proofHeight)) obj.proofHeight = Height.fromJSON(object.proofHeight); - return obj; + return { + consensusState: isSet(object.consensusState) ? Any.fromJSON(object.consensusState) : undefined, + clientId: isSet(object.clientId) ? String(object.clientId) : "", + proof: isSet(object.proof) ? bytesFromBase64(object.proof) : new Uint8Array(), + proofHeight: isSet(object.proofHeight) ? Height.fromJSON(object.proofHeight) : undefined + }; }, toJSON(message: QueryConnectionConsensusStateResponse): JsonSafe<QueryConnectionConsensusStateResponse> { const obj: any = {}; @@ -1359,14 +1383,10 @@ export const QueryConnectionConsensusStateResponse = { }, fromPartial(object: DeepPartial<QueryConnectionConsensusStateResponse>): QueryConnectionConsensusStateResponse { const message = createBaseQueryConnectionConsensusStateResponse(); - if (object.consensusState !== undefined && object.consensusState !== null) { - message.consensusState = Any.fromPartial(object.consensusState); - } + message.consensusState = object.consensusState !== undefined && object.consensusState !== null ? Any.fromPartial(object.consensusState) : undefined; message.clientId = object.clientId ?? ""; message.proof = object.proof ?? new Uint8Array(); - if (object.proofHeight !== undefined && object.proofHeight !== null) { - message.proofHeight = Height.fromPartial(object.proofHeight); - } + message.proofHeight = object.proofHeight !== undefined && object.proofHeight !== null ? Height.fromPartial(object.proofHeight) : undefined; return message; }, fromSDK(object: QueryConnectionConsensusStateResponseSDKType): QueryConnectionConsensusStateResponse { diff --git a/__fixtures__/v-next/outputv4/ibc/core/connection/v1/tx.amino.ts b/__fixtures__/v-next/outputv4/ibc/core/connection/v1/tx.amino.ts index 2ca50c7e98..53e0a3765c 100644 --- a/__fixtures__/v-next/outputv4/ibc/core/connection/v1/tx.amino.ts +++ b/__fixtures__/v-next/outputv4/ibc/core/connection/v1/tx.amino.ts @@ -1,10 +1,10 @@ -import { Counterparty, CounterpartySDKType, Version, VersionSDKType } from "./connection.js"; -import { Any, AnySDKType } from "../../../../google/protobuf/any.js"; -import { Height, HeightSDKType } from "../../client/v1/client.js"; +import { Counterparty, CounterpartySDKType, Version, VersionSDKType } from "./connection"; +import { Any, AnySDKType } from "../../../../google/protobuf/any"; +import { Height, HeightSDKType } from "../../client/v1/client"; import { AminoMsg } from "@cosmjs/amino"; -import { AminoHeight, omitDefault } from "../../../../helpers.js"; -import { MerklePrefix, MerklePrefixSDKType } from "../../commitment/v1/commitment.js"; -import { MsgConnectionOpenInit, MsgConnectionOpenInitSDKType, MsgConnectionOpenTry, MsgConnectionOpenTrySDKType, MsgConnectionOpenAck, MsgConnectionOpenAckSDKType, MsgConnectionOpenConfirm, MsgConnectionOpenConfirmSDKType } from "./tx.js"; +import { AminoHeight, omitDefault } from "../../../../helpers"; +import { MerklePrefix, MerklePrefixSDKType } from "../../commitment/v1/commitment"; +import { MsgConnectionOpenInit, MsgConnectionOpenInitSDKType, MsgConnectionOpenTry, MsgConnectionOpenTrySDKType, MsgConnectionOpenAck, MsgConnectionOpenAckSDKType, MsgConnectionOpenConfirm, MsgConnectionOpenConfirmSDKType } from "./tx"; export interface MsgConnectionOpenInitAminoType extends AminoMsg { type: "cosmos-sdk/MsgConnectionOpenInit"; value: { diff --git a/__fixtures__/v-next/outputv4/ibc/core/connection/v1/tx.registry.ts b/__fixtures__/v-next/outputv4/ibc/core/connection/v1/tx.registry.ts index 1f71c96e40..f01b0b714c 100644 --- a/__fixtures__/v-next/outputv4/ibc/core/connection/v1/tx.registry.ts +++ b/__fixtures__/v-next/outputv4/ibc/core/connection/v1/tx.registry.ts @@ -1,8 +1,8 @@ -import { Counterparty, CounterpartySDKType, Version, VersionSDKType } from "./connection.js"; -import { Any, AnySDKType } from "../../../../google/protobuf/any.js"; -import { Height, HeightSDKType } from "../../client/v1/client.js"; +import { Counterparty, CounterpartySDKType, Version, VersionSDKType } from "./connection"; +import { Any, AnySDKType } from "../../../../google/protobuf/any"; +import { Height, HeightSDKType } from "../../client/v1/client"; import { GeneratedType, Registry } from "@cosmjs/proto-signing"; -import { MsgConnectionOpenInit, MsgConnectionOpenInitSDKType, MsgConnectionOpenTry, MsgConnectionOpenTrySDKType, MsgConnectionOpenAck, MsgConnectionOpenAckSDKType, MsgConnectionOpenConfirm, MsgConnectionOpenConfirmSDKType } from "./tx.js"; +import { MsgConnectionOpenInit, MsgConnectionOpenInitSDKType, MsgConnectionOpenTry, MsgConnectionOpenTrySDKType, MsgConnectionOpenAck, MsgConnectionOpenAckSDKType, MsgConnectionOpenConfirm, MsgConnectionOpenConfirmSDKType } from "./tx"; export const registry: ReadonlyArray<[string, GeneratedType]> = [["/ibc.core.connection.v1.MsgConnectionOpenInit", MsgConnectionOpenInit], ["/ibc.core.connection.v1.MsgConnectionOpenTry", MsgConnectionOpenTry], ["/ibc.core.connection.v1.MsgConnectionOpenAck", MsgConnectionOpenAck], ["/ibc.core.connection.v1.MsgConnectionOpenConfirm", MsgConnectionOpenConfirm]]; export const load = (protoRegistry: Registry) => { registry.forEach(([typeUrl, mod]) => { diff --git a/__fixtures__/v-next/outputv4/ibc/core/connection/v1/tx.rpc.msg.ts b/__fixtures__/v-next/outputv4/ibc/core/connection/v1/tx.rpc.msg.ts index 68bdc882ff..e4818a48ea 100644 --- a/__fixtures__/v-next/outputv4/ibc/core/connection/v1/tx.rpc.msg.ts +++ b/__fixtures__/v-next/outputv4/ibc/core/connection/v1/tx.rpc.msg.ts @@ -1,9 +1,9 @@ -import { Counterparty, CounterpartySDKType, Version, VersionSDKType } from "./connection.js"; -import { Any, AnySDKType } from "../../../../google/protobuf/any.js"; -import { Height, HeightSDKType } from "../../client/v1/client.js"; -import { Rpc } from "../../../../helpers.js"; -import { BinaryReader } from "../../../../binary.js"; -import { MsgConnectionOpenInit, MsgConnectionOpenInitSDKType, MsgConnectionOpenInitResponse, MsgConnectionOpenInitResponseSDKType, MsgConnectionOpenTry, MsgConnectionOpenTrySDKType, MsgConnectionOpenTryResponse, MsgConnectionOpenTryResponseSDKType, MsgConnectionOpenAck, MsgConnectionOpenAckSDKType, MsgConnectionOpenAckResponse, MsgConnectionOpenAckResponseSDKType, MsgConnectionOpenConfirm, MsgConnectionOpenConfirmSDKType, MsgConnectionOpenConfirmResponse, MsgConnectionOpenConfirmResponseSDKType } from "./tx.js"; +import { Counterparty, CounterpartySDKType, Version, VersionSDKType } from "./connection"; +import { Any, AnySDKType } from "../../../../google/protobuf/any"; +import { Height, HeightSDKType } from "../../client/v1/client"; +import { Rpc } from "../../../../helpers"; +import { BinaryReader } from "../../../../binary"; +import { MsgConnectionOpenInit, MsgConnectionOpenInitSDKType, MsgConnectionOpenInitResponse, MsgConnectionOpenInitResponseSDKType, MsgConnectionOpenTry, MsgConnectionOpenTrySDKType, MsgConnectionOpenTryResponse, MsgConnectionOpenTryResponseSDKType, MsgConnectionOpenAck, MsgConnectionOpenAckSDKType, MsgConnectionOpenAckResponse, MsgConnectionOpenAckResponseSDKType, MsgConnectionOpenConfirm, MsgConnectionOpenConfirmSDKType, MsgConnectionOpenConfirmResponse, MsgConnectionOpenConfirmResponseSDKType } from "./tx"; /** Msg defines the ibc/connection Msg service. */ export interface Msg { /** ConnectionOpenInit defines a rpc handler method for MsgConnectionOpenInit. */ diff --git a/__fixtures__/v-next/outputv4/ibc/core/connection/v1/tx.ts b/__fixtures__/v-next/outputv4/ibc/core/connection/v1/tx.ts index 624401ba19..eb1096f0bf 100644 --- a/__fixtures__/v-next/outputv4/ibc/core/connection/v1/tx.ts +++ b/__fixtures__/v-next/outputv4/ibc/core/connection/v1/tx.ts @@ -1,9 +1,10 @@ -import { Counterparty, CounterpartySDKType, Version, VersionSDKType } from "./connection.js"; -import { Any, AnySDKType } from "../../../../google/protobuf/any.js"; -import { Height, HeightSDKType } from "../../client/v1/client.js"; -import { BinaryReader, BinaryWriter } from "../../../../binary.js"; -import { isSet, DeepPartial, bytesFromBase64, base64FromBytes } from "../../../../helpers.js"; -import { JsonSafe } from "../../../../json-safe.js"; +import { Counterparty, CounterpartySDKType, Version, VersionSDKType } from "./connection"; +import { Any, AnySDKType } from "../../../../google/protobuf/any"; +import { Height, HeightSDKType } from "../../client/v1/client"; +import { BinaryReader, BinaryWriter } from "../../../../binary"; +import { isSet, DeepPartial, bytesFromBase64, base64FromBytes } from "../../../../helpers"; +import { JsonSafe } from "../../../../json-safe"; +import { ComputedRef } from "vue"; export const protobufPackage = "ibc.core.connection.v1"; /** * MsgConnectionOpenInit defines the msg sent by an account on Chain A to @@ -16,6 +17,13 @@ export interface MsgConnectionOpenInit { delayPeriod: bigint; signer: string; } +export interface ReactiveMsgConnectionOpenInit { + clientId: ComputedRef<string>; + counterparty: ComputedRef<Counterparty>; + version?: ComputedRef<Version>; + delayPeriod: ComputedRef<bigint>; + signer: ComputedRef<string>; +} export interface MsgConnectionOpenInitProtoMsg { typeUrl: "/ibc.core.connection.v1.MsgConnectionOpenInit"; value: Uint8Array; @@ -36,6 +44,7 @@ export interface MsgConnectionOpenInitSDKType { * type. */ export interface MsgConnectionOpenInitResponse {} +export interface ReactiveMsgConnectionOpenInitResponse {} export interface MsgConnectionOpenInitResponseProtoMsg { typeUrl: "/ibc.core.connection.v1.MsgConnectionOpenInitResponse"; value: Uint8Array; @@ -73,6 +82,20 @@ export interface MsgConnectionOpenTry { consensusHeight: Height; signer: string; } +export interface ReactiveMsgConnectionOpenTry { + clientId: ComputedRef<string>; + previousConnectionId: ComputedRef<string>; + clientState?: ComputedRef<Any>; + counterparty: ComputedRef<Counterparty>; + delayPeriod: ComputedRef<bigint>; + counterpartyVersions: ComputedRef<Version[]>; + proofHeight: ComputedRef<Height>; + proofInit: ComputedRef<Uint8Array>; + proofClient: ComputedRef<Uint8Array>; + proofConsensus: ComputedRef<Uint8Array>; + consensusHeight: ComputedRef<Height>; + signer: ComputedRef<string>; +} export interface MsgConnectionOpenTryProtoMsg { typeUrl: "/ibc.core.connection.v1.MsgConnectionOpenTry"; value: Uint8Array; @@ -97,6 +120,7 @@ export interface MsgConnectionOpenTrySDKType { } /** MsgConnectionOpenTryResponse defines the Msg/ConnectionOpenTry response type. */ export interface MsgConnectionOpenTryResponse {} +export interface ReactiveMsgConnectionOpenTryResponse {} export interface MsgConnectionOpenTryResponseProtoMsg { typeUrl: "/ibc.core.connection.v1.MsgConnectionOpenTryResponse"; value: Uint8Array; @@ -125,6 +149,18 @@ export interface MsgConnectionOpenAck { consensusHeight: Height; signer: string; } +export interface ReactiveMsgConnectionOpenAck { + connectionId: ComputedRef<string>; + counterpartyConnectionId: ComputedRef<string>; + version?: ComputedRef<Version>; + clientState?: ComputedRef<Any>; + proofHeight: ComputedRef<Height>; + proofTry: ComputedRef<Uint8Array>; + proofClient: ComputedRef<Uint8Array>; + proofConsensus: ComputedRef<Uint8Array>; + consensusHeight: ComputedRef<Height>; + signer: ComputedRef<string>; +} export interface MsgConnectionOpenAckProtoMsg { typeUrl: "/ibc.core.connection.v1.MsgConnectionOpenAck"; value: Uint8Array; @@ -147,6 +183,7 @@ export interface MsgConnectionOpenAckSDKType { } /** MsgConnectionOpenAckResponse defines the Msg/ConnectionOpenAck response type. */ export interface MsgConnectionOpenAckResponse {} +export interface ReactiveMsgConnectionOpenAckResponse {} export interface MsgConnectionOpenAckResponseProtoMsg { typeUrl: "/ibc.core.connection.v1.MsgConnectionOpenAckResponse"; value: Uint8Array; @@ -164,6 +201,12 @@ export interface MsgConnectionOpenConfirm { proofHeight: Height; signer: string; } +export interface ReactiveMsgConnectionOpenConfirm { + connectionId: ComputedRef<string>; + proofAck: ComputedRef<Uint8Array>; + proofHeight: ComputedRef<Height>; + signer: ComputedRef<string>; +} export interface MsgConnectionOpenConfirmProtoMsg { typeUrl: "/ibc.core.connection.v1.MsgConnectionOpenConfirm"; value: Uint8Array; @@ -183,6 +226,7 @@ export interface MsgConnectionOpenConfirmSDKType { * response type. */ export interface MsgConnectionOpenConfirmResponse {} +export interface ReactiveMsgConnectionOpenConfirmResponse {} export interface MsgConnectionOpenConfirmResponseProtoMsg { typeUrl: "/ibc.core.connection.v1.MsgConnectionOpenConfirmResponse"; value: Uint8Array; @@ -204,7 +248,7 @@ function createBaseMsgConnectionOpenInit(): MsgConnectionOpenInit { export const MsgConnectionOpenInit = { typeUrl: "/ibc.core.connection.v1.MsgConnectionOpenInit", encode(message: MsgConnectionOpenInit, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.clientId !== undefined) { + if (message.clientId !== "") { writer.uint32(10).string(message.clientId); } if (message.counterparty !== undefined) { @@ -213,10 +257,10 @@ export const MsgConnectionOpenInit = { if (message.version !== undefined) { Version.encode(message.version, writer.uint32(26).fork()).ldelim(); } - if (message.delayPeriod !== undefined) { + if (message.delayPeriod !== BigInt(0)) { writer.uint32(32).uint64(message.delayPeriod); } - if (message.signer !== undefined) { + if (message.signer !== "") { writer.uint32(42).string(message.signer); } return writer; @@ -251,13 +295,13 @@ export const MsgConnectionOpenInit = { return message; }, fromJSON(object: any): MsgConnectionOpenInit { - const obj = createBaseMsgConnectionOpenInit(); - if (isSet(object.clientId)) obj.clientId = String(object.clientId); - if (isSet(object.counterparty)) obj.counterparty = Counterparty.fromJSON(object.counterparty); - if (isSet(object.version)) obj.version = Version.fromJSON(object.version); - if (isSet(object.delayPeriod)) obj.delayPeriod = BigInt(object.delayPeriod.toString()); - if (isSet(object.signer)) obj.signer = String(object.signer); - return obj; + return { + clientId: isSet(object.clientId) ? String(object.clientId) : "", + counterparty: isSet(object.counterparty) ? Counterparty.fromJSON(object.counterparty) : undefined, + version: isSet(object.version) ? Version.fromJSON(object.version) : undefined, + delayPeriod: isSet(object.delayPeriod) ? BigInt(object.delayPeriod.toString()) : BigInt(0), + signer: isSet(object.signer) ? String(object.signer) : "" + }; }, toJSON(message: MsgConnectionOpenInit): JsonSafe<MsgConnectionOpenInit> { const obj: any = {}; @@ -271,15 +315,9 @@ export const MsgConnectionOpenInit = { fromPartial(object: DeepPartial<MsgConnectionOpenInit>): MsgConnectionOpenInit { const message = createBaseMsgConnectionOpenInit(); message.clientId = object.clientId ?? ""; - if (object.counterparty !== undefined && object.counterparty !== null) { - message.counterparty = Counterparty.fromPartial(object.counterparty); - } - if (object.version !== undefined && object.version !== null) { - message.version = Version.fromPartial(object.version); - } - if (object.delayPeriod !== undefined && object.delayPeriod !== null) { - message.delayPeriod = BigInt(object.delayPeriod.toString()); - } + message.counterparty = object.counterparty !== undefined && object.counterparty !== null ? Counterparty.fromPartial(object.counterparty) : undefined; + message.version = object.version !== undefined && object.version !== null ? Version.fromPartial(object.version) : undefined; + message.delayPeriod = object.delayPeriod !== undefined && object.delayPeriod !== null ? BigInt(object.delayPeriod.toString()) : BigInt(0); message.signer = object.signer ?? ""; return message; }, @@ -383,8 +421,7 @@ export const MsgConnectionOpenInitResponse = { return message; }, fromJSON(_: any): MsgConnectionOpenInitResponse { - const obj = createBaseMsgConnectionOpenInitResponse(); - return obj; + return {}; }, toJSON(_: MsgConnectionOpenInitResponse): JsonSafe<MsgConnectionOpenInitResponse> { const obj: any = {}; @@ -453,10 +490,10 @@ function createBaseMsgConnectionOpenTry(): MsgConnectionOpenTry { export const MsgConnectionOpenTry = { typeUrl: "/ibc.core.connection.v1.MsgConnectionOpenTry", encode(message: MsgConnectionOpenTry, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.clientId !== undefined) { + if (message.clientId !== "") { writer.uint32(10).string(message.clientId); } - if (message.previousConnectionId !== undefined) { + if (message.previousConnectionId !== "") { writer.uint32(18).string(message.previousConnectionId); } if (message.clientState !== undefined) { @@ -465,7 +502,7 @@ export const MsgConnectionOpenTry = { if (message.counterparty !== undefined) { Counterparty.encode(message.counterparty, writer.uint32(34).fork()).ldelim(); } - if (message.delayPeriod !== undefined) { + if (message.delayPeriod !== BigInt(0)) { writer.uint32(40).uint64(message.delayPeriod); } for (const v of message.counterpartyVersions) { @@ -486,7 +523,7 @@ export const MsgConnectionOpenTry = { if (message.consensusHeight !== undefined) { Height.encode(message.consensusHeight, writer.uint32(90).fork()).ldelim(); } - if (message.signer !== undefined) { + if (message.signer !== "") { writer.uint32(98).string(message.signer); } return writer; @@ -542,20 +579,20 @@ export const MsgConnectionOpenTry = { return message; }, fromJSON(object: any): MsgConnectionOpenTry { - const obj = createBaseMsgConnectionOpenTry(); - if (isSet(object.clientId)) obj.clientId = String(object.clientId); - if (isSet(object.previousConnectionId)) obj.previousConnectionId = String(object.previousConnectionId); - if (isSet(object.clientState)) obj.clientState = Any.fromJSON(object.clientState); - if (isSet(object.counterparty)) obj.counterparty = Counterparty.fromJSON(object.counterparty); - if (isSet(object.delayPeriod)) obj.delayPeriod = BigInt(object.delayPeriod.toString()); - if (Array.isArray(object?.counterpartyVersions)) obj.counterpartyVersions = object.counterpartyVersions.map((e: any) => Version.fromJSON(e)); - if (isSet(object.proofHeight)) obj.proofHeight = Height.fromJSON(object.proofHeight); - if (isSet(object.proofInit)) obj.proofInit = bytesFromBase64(object.proofInit); - if (isSet(object.proofClient)) obj.proofClient = bytesFromBase64(object.proofClient); - if (isSet(object.proofConsensus)) obj.proofConsensus = bytesFromBase64(object.proofConsensus); - if (isSet(object.consensusHeight)) obj.consensusHeight = Height.fromJSON(object.consensusHeight); - if (isSet(object.signer)) obj.signer = String(object.signer); - return obj; + return { + clientId: isSet(object.clientId) ? String(object.clientId) : "", + previousConnectionId: isSet(object.previousConnectionId) ? String(object.previousConnectionId) : "", + clientState: isSet(object.clientState) ? Any.fromJSON(object.clientState) : undefined, + counterparty: isSet(object.counterparty) ? Counterparty.fromJSON(object.counterparty) : undefined, + delayPeriod: isSet(object.delayPeriod) ? BigInt(object.delayPeriod.toString()) : BigInt(0), + counterpartyVersions: Array.isArray(object?.counterpartyVersions) ? object.counterpartyVersions.map((e: any) => Version.fromJSON(e)) : [], + proofHeight: isSet(object.proofHeight) ? Height.fromJSON(object.proofHeight) : undefined, + proofInit: isSet(object.proofInit) ? bytesFromBase64(object.proofInit) : new Uint8Array(), + proofClient: isSet(object.proofClient) ? bytesFromBase64(object.proofClient) : new Uint8Array(), + proofConsensus: isSet(object.proofConsensus) ? bytesFromBase64(object.proofConsensus) : new Uint8Array(), + consensusHeight: isSet(object.consensusHeight) ? Height.fromJSON(object.consensusHeight) : undefined, + signer: isSet(object.signer) ? String(object.signer) : "" + }; }, toJSON(message: MsgConnectionOpenTry): JsonSafe<MsgConnectionOpenTry> { const obj: any = {}; @@ -581,25 +618,15 @@ export const MsgConnectionOpenTry = { const message = createBaseMsgConnectionOpenTry(); message.clientId = object.clientId ?? ""; message.previousConnectionId = object.previousConnectionId ?? ""; - if (object.clientState !== undefined && object.clientState !== null) { - message.clientState = Any.fromPartial(object.clientState); - } - if (object.counterparty !== undefined && object.counterparty !== null) { - message.counterparty = Counterparty.fromPartial(object.counterparty); - } - if (object.delayPeriod !== undefined && object.delayPeriod !== null) { - message.delayPeriod = BigInt(object.delayPeriod.toString()); - } + message.clientState = object.clientState !== undefined && object.clientState !== null ? Any.fromPartial(object.clientState) : undefined; + message.counterparty = object.counterparty !== undefined && object.counterparty !== null ? Counterparty.fromPartial(object.counterparty) : undefined; + message.delayPeriod = object.delayPeriod !== undefined && object.delayPeriod !== null ? BigInt(object.delayPeriod.toString()) : BigInt(0); message.counterpartyVersions = object.counterpartyVersions?.map(e => Version.fromPartial(e)) || []; - if (object.proofHeight !== undefined && object.proofHeight !== null) { - message.proofHeight = Height.fromPartial(object.proofHeight); - } + message.proofHeight = object.proofHeight !== undefined && object.proofHeight !== null ? Height.fromPartial(object.proofHeight) : undefined; message.proofInit = object.proofInit ?? new Uint8Array(); message.proofClient = object.proofClient ?? new Uint8Array(); message.proofConsensus = object.proofConsensus ?? new Uint8Array(); - if (object.consensusHeight !== undefined && object.consensusHeight !== null) { - message.consensusHeight = Height.fromPartial(object.consensusHeight); - } + message.consensusHeight = object.consensusHeight !== undefined && object.consensusHeight !== null ? Height.fromPartial(object.consensusHeight) : undefined; message.signer = object.signer ?? ""; return message; }, @@ -758,8 +785,7 @@ export const MsgConnectionOpenTryResponse = { return message; }, fromJSON(_: any): MsgConnectionOpenTryResponse { - const obj = createBaseMsgConnectionOpenTryResponse(); - return obj; + return {}; }, toJSON(_: MsgConnectionOpenTryResponse): JsonSafe<MsgConnectionOpenTryResponse> { const obj: any = {}; @@ -826,10 +852,10 @@ function createBaseMsgConnectionOpenAck(): MsgConnectionOpenAck { export const MsgConnectionOpenAck = { typeUrl: "/ibc.core.connection.v1.MsgConnectionOpenAck", encode(message: MsgConnectionOpenAck, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.connectionId !== undefined) { + if (message.connectionId !== "") { writer.uint32(10).string(message.connectionId); } - if (message.counterpartyConnectionId !== undefined) { + if (message.counterpartyConnectionId !== "") { writer.uint32(18).string(message.counterpartyConnectionId); } if (message.version !== undefined) { @@ -853,7 +879,7 @@ export const MsgConnectionOpenAck = { if (message.consensusHeight !== undefined) { Height.encode(message.consensusHeight, writer.uint32(74).fork()).ldelim(); } - if (message.signer !== undefined) { + if (message.signer !== "") { writer.uint32(82).string(message.signer); } return writer; @@ -903,18 +929,18 @@ export const MsgConnectionOpenAck = { return message; }, fromJSON(object: any): MsgConnectionOpenAck { - const obj = createBaseMsgConnectionOpenAck(); - if (isSet(object.connectionId)) obj.connectionId = String(object.connectionId); - if (isSet(object.counterpartyConnectionId)) obj.counterpartyConnectionId = String(object.counterpartyConnectionId); - if (isSet(object.version)) obj.version = Version.fromJSON(object.version); - if (isSet(object.clientState)) obj.clientState = Any.fromJSON(object.clientState); - if (isSet(object.proofHeight)) obj.proofHeight = Height.fromJSON(object.proofHeight); - if (isSet(object.proofTry)) obj.proofTry = bytesFromBase64(object.proofTry); - if (isSet(object.proofClient)) obj.proofClient = bytesFromBase64(object.proofClient); - if (isSet(object.proofConsensus)) obj.proofConsensus = bytesFromBase64(object.proofConsensus); - if (isSet(object.consensusHeight)) obj.consensusHeight = Height.fromJSON(object.consensusHeight); - if (isSet(object.signer)) obj.signer = String(object.signer); - return obj; + return { + connectionId: isSet(object.connectionId) ? String(object.connectionId) : "", + counterpartyConnectionId: isSet(object.counterpartyConnectionId) ? String(object.counterpartyConnectionId) : "", + version: isSet(object.version) ? Version.fromJSON(object.version) : undefined, + clientState: isSet(object.clientState) ? Any.fromJSON(object.clientState) : undefined, + proofHeight: isSet(object.proofHeight) ? Height.fromJSON(object.proofHeight) : undefined, + proofTry: isSet(object.proofTry) ? bytesFromBase64(object.proofTry) : new Uint8Array(), + proofClient: isSet(object.proofClient) ? bytesFromBase64(object.proofClient) : new Uint8Array(), + proofConsensus: isSet(object.proofConsensus) ? bytesFromBase64(object.proofConsensus) : new Uint8Array(), + consensusHeight: isSet(object.consensusHeight) ? Height.fromJSON(object.consensusHeight) : undefined, + signer: isSet(object.signer) ? String(object.signer) : "" + }; }, toJSON(message: MsgConnectionOpenAck): JsonSafe<MsgConnectionOpenAck> { const obj: any = {}; @@ -934,21 +960,13 @@ export const MsgConnectionOpenAck = { const message = createBaseMsgConnectionOpenAck(); message.connectionId = object.connectionId ?? ""; message.counterpartyConnectionId = object.counterpartyConnectionId ?? ""; - if (object.version !== undefined && object.version !== null) { - message.version = Version.fromPartial(object.version); - } - if (object.clientState !== undefined && object.clientState !== null) { - message.clientState = Any.fromPartial(object.clientState); - } - if (object.proofHeight !== undefined && object.proofHeight !== null) { - message.proofHeight = Height.fromPartial(object.proofHeight); - } + message.version = object.version !== undefined && object.version !== null ? Version.fromPartial(object.version) : undefined; + message.clientState = object.clientState !== undefined && object.clientState !== null ? Any.fromPartial(object.clientState) : undefined; + message.proofHeight = object.proofHeight !== undefined && object.proofHeight !== null ? Height.fromPartial(object.proofHeight) : undefined; message.proofTry = object.proofTry ?? new Uint8Array(); message.proofClient = object.proofClient ?? new Uint8Array(); message.proofConsensus = object.proofConsensus ?? new Uint8Array(); - if (object.consensusHeight !== undefined && object.consensusHeight !== null) { - message.consensusHeight = Height.fromPartial(object.consensusHeight); - } + message.consensusHeight = object.consensusHeight !== undefined && object.consensusHeight !== null ? Height.fromPartial(object.consensusHeight) : undefined; message.signer = object.signer ?? ""; return message; }, @@ -1087,8 +1105,7 @@ export const MsgConnectionOpenAckResponse = { return message; }, fromJSON(_: any): MsgConnectionOpenAckResponse { - const obj = createBaseMsgConnectionOpenAckResponse(); - return obj; + return {}; }, toJSON(_: MsgConnectionOpenAckResponse): JsonSafe<MsgConnectionOpenAckResponse> { const obj: any = {}; @@ -1149,7 +1166,7 @@ function createBaseMsgConnectionOpenConfirm(): MsgConnectionOpenConfirm { export const MsgConnectionOpenConfirm = { typeUrl: "/ibc.core.connection.v1.MsgConnectionOpenConfirm", encode(message: MsgConnectionOpenConfirm, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.connectionId !== undefined) { + if (message.connectionId !== "") { writer.uint32(10).string(message.connectionId); } if (message.proofAck.length !== 0) { @@ -1158,7 +1175,7 @@ export const MsgConnectionOpenConfirm = { if (message.proofHeight !== undefined) { Height.encode(message.proofHeight, writer.uint32(26).fork()).ldelim(); } - if (message.signer !== undefined) { + if (message.signer !== "") { writer.uint32(34).string(message.signer); } return writer; @@ -1190,12 +1207,12 @@ export const MsgConnectionOpenConfirm = { return message; }, fromJSON(object: any): MsgConnectionOpenConfirm { - const obj = createBaseMsgConnectionOpenConfirm(); - if (isSet(object.connectionId)) obj.connectionId = String(object.connectionId); - if (isSet(object.proofAck)) obj.proofAck = bytesFromBase64(object.proofAck); - if (isSet(object.proofHeight)) obj.proofHeight = Height.fromJSON(object.proofHeight); - if (isSet(object.signer)) obj.signer = String(object.signer); - return obj; + return { + connectionId: isSet(object.connectionId) ? String(object.connectionId) : "", + proofAck: isSet(object.proofAck) ? bytesFromBase64(object.proofAck) : new Uint8Array(), + proofHeight: isSet(object.proofHeight) ? Height.fromJSON(object.proofHeight) : undefined, + signer: isSet(object.signer) ? String(object.signer) : "" + }; }, toJSON(message: MsgConnectionOpenConfirm): JsonSafe<MsgConnectionOpenConfirm> { const obj: any = {}; @@ -1209,9 +1226,7 @@ export const MsgConnectionOpenConfirm = { const message = createBaseMsgConnectionOpenConfirm(); message.connectionId = object.connectionId ?? ""; message.proofAck = object.proofAck ?? new Uint8Array(); - if (object.proofHeight !== undefined && object.proofHeight !== null) { - message.proofHeight = Height.fromPartial(object.proofHeight); - } + message.proofHeight = object.proofHeight !== undefined && object.proofHeight !== null ? Height.fromPartial(object.proofHeight) : undefined; message.signer = object.signer ?? ""; return message; }, @@ -1308,8 +1323,7 @@ export const MsgConnectionOpenConfirmResponse = { return message; }, fromJSON(_: any): MsgConnectionOpenConfirmResponse { - const obj = createBaseMsgConnectionOpenConfirmResponse(); - return obj; + return {}; }, toJSON(_: MsgConnectionOpenConfirmResponse): JsonSafe<MsgConnectionOpenConfirmResponse> { const obj: any = {}; diff --git a/__fixtures__/v-next/outputv4/ibc/core/port/v1/query.rpc.Query.ts b/__fixtures__/v-next/outputv4/ibc/core/port/v1/query.rpc.Query.ts index 31f4b61e2b..8989244c17 100644 --- a/__fixtures__/v-next/outputv4/ibc/core/port/v1/query.rpc.Query.ts +++ b/__fixtures__/v-next/outputv4/ibc/core/port/v1/query.rpc.Query.ts @@ -1,8 +1,8 @@ -import { Order, OrderSDKType, Counterparty, CounterpartySDKType } from "../../channel/v1/channel.js"; -import { Rpc } from "../../../../helpers.js"; -import { BinaryReader } from "../../../../binary.js"; +import { Order, OrderSDKType, Counterparty, CounterpartySDKType } from "../../channel/v1/channel"; +import { Rpc } from "../../../../helpers"; +import { BinaryReader } from "../../../../binary"; import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; -import { QueryAppVersionRequest, QueryAppVersionRequestSDKType, QueryAppVersionResponse, QueryAppVersionResponseSDKType } from "./query.js"; +import { QueryAppVersionRequest, QueryAppVersionRequestSDKType, QueryAppVersionResponse, QueryAppVersionResponseSDKType, ReactiveQueryAppVersionRequest } from "./query"; /** Query defines the gRPC querier service */ export interface Query { /** AppVersion queries an IBC Port and determines the appropriate application version to be used */ diff --git a/__fixtures__/v-next/outputv4/ibc/core/port/v1/query.ts b/__fixtures__/v-next/outputv4/ibc/core/port/v1/query.ts index 828afe798e..b0489fa051 100644 --- a/__fixtures__/v-next/outputv4/ibc/core/port/v1/query.ts +++ b/__fixtures__/v-next/outputv4/ibc/core/port/v1/query.ts @@ -1,7 +1,8 @@ -import { Order, OrderSDKType, Counterparty, CounterpartySDKType, orderFromJSON, orderToJSON } from "../../channel/v1/channel.js"; -import { BinaryReader, BinaryWriter } from "../../../../binary.js"; -import { isSet, DeepPartial } from "../../../../helpers.js"; -import { JsonSafe } from "../../../../json-safe.js"; +import { Order, OrderSDKType, Counterparty, CounterpartySDKType, orderFromJSON, orderToJSON } from "../../channel/v1/channel"; +import { BinaryReader, BinaryWriter } from "../../../../binary"; +import { isSet, DeepPartial } from "../../../../helpers"; +import { JsonSafe } from "../../../../json-safe"; +import { ComputedRef } from "vue"; export const protobufPackage = "ibc.core.port.v1"; /** QueryAppVersionRequest is the request type for the Query/AppVersion RPC method */ export interface QueryAppVersionRequest { @@ -16,6 +17,13 @@ export interface QueryAppVersionRequest { /** proposed version */ proposedVersion: string; } +export interface ReactiveQueryAppVersionRequest { + portId: ComputedRef<string>; + connectionId: ComputedRef<string>; + ordering: ComputedRef<Order>; + counterparty?: ComputedRef<Counterparty>; + proposedVersion: ComputedRef<string>; +} export interface QueryAppVersionRequestProtoMsg { typeUrl: "/ibc.core.port.v1.QueryAppVersionRequest"; value: Uint8Array; @@ -35,6 +43,10 @@ export interface QueryAppVersionResponse { /** supported app version */ version: string; } +export interface ReactiveQueryAppVersionResponse { + portId: ComputedRef<string>; + version: ComputedRef<string>; +} export interface QueryAppVersionResponseProtoMsg { typeUrl: "/ibc.core.port.v1.QueryAppVersionResponse"; value: Uint8Array; @@ -56,10 +68,10 @@ function createBaseQueryAppVersionRequest(): QueryAppVersionRequest { export const QueryAppVersionRequest = { typeUrl: "/ibc.core.port.v1.QueryAppVersionRequest", encode(message: QueryAppVersionRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.portId !== undefined) { + if (message.portId !== "") { writer.uint32(10).string(message.portId); } - if (message.connectionId !== undefined) { + if (message.connectionId !== "") { writer.uint32(18).string(message.connectionId); } if (message.ordering !== 0) { @@ -68,7 +80,7 @@ export const QueryAppVersionRequest = { if (message.counterparty !== undefined) { Counterparty.encode(message.counterparty, writer.uint32(34).fork()).ldelim(); } - if (message.proposedVersion !== undefined) { + if (message.proposedVersion !== "") { writer.uint32(42).string(message.proposedVersion); } return writer; @@ -103,13 +115,13 @@ export const QueryAppVersionRequest = { return message; }, fromJSON(object: any): QueryAppVersionRequest { - const obj = createBaseQueryAppVersionRequest(); - if (isSet(object.portId)) obj.portId = String(object.portId); - if (isSet(object.connectionId)) obj.connectionId = String(object.connectionId); - if (isSet(object.ordering)) obj.ordering = orderFromJSON(object.ordering); - if (isSet(object.counterparty)) obj.counterparty = Counterparty.fromJSON(object.counterparty); - if (isSet(object.proposedVersion)) obj.proposedVersion = String(object.proposedVersion); - return obj; + return { + portId: isSet(object.portId) ? String(object.portId) : "", + connectionId: isSet(object.connectionId) ? String(object.connectionId) : "", + ordering: isSet(object.ordering) ? orderFromJSON(object.ordering) : -1, + counterparty: isSet(object.counterparty) ? Counterparty.fromJSON(object.counterparty) : undefined, + proposedVersion: isSet(object.proposedVersion) ? String(object.proposedVersion) : "" + }; }, toJSON(message: QueryAppVersionRequest): JsonSafe<QueryAppVersionRequest> { const obj: any = {}; @@ -125,9 +137,7 @@ export const QueryAppVersionRequest = { message.portId = object.portId ?? ""; message.connectionId = object.connectionId ?? ""; message.ordering = object.ordering ?? 0; - if (object.counterparty !== undefined && object.counterparty !== null) { - message.counterparty = Counterparty.fromPartial(object.counterparty); - } + message.counterparty = object.counterparty !== undefined && object.counterparty !== null ? Counterparty.fromPartial(object.counterparty) : undefined; message.proposedVersion = object.proposedVersion ?? ""; return message; }, @@ -217,10 +227,10 @@ function createBaseQueryAppVersionResponse(): QueryAppVersionResponse { export const QueryAppVersionResponse = { typeUrl: "/ibc.core.port.v1.QueryAppVersionResponse", encode(message: QueryAppVersionResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.portId !== undefined) { + if (message.portId !== "") { writer.uint32(10).string(message.portId); } - if (message.version !== undefined) { + if (message.version !== "") { writer.uint32(18).string(message.version); } return writer; @@ -246,10 +256,10 @@ export const QueryAppVersionResponse = { return message; }, fromJSON(object: any): QueryAppVersionResponse { - const obj = createBaseQueryAppVersionResponse(); - if (isSet(object.portId)) obj.portId = String(object.portId); - if (isSet(object.version)) obj.version = String(object.version); - return obj; + return { + portId: isSet(object.portId) ? String(object.portId) : "", + version: isSet(object.version) ? String(object.version) : "" + }; }, toJSON(message: QueryAppVersionResponse): JsonSafe<QueryAppVersionResponse> { const obj: any = {}; diff --git a/__fixtures__/v-next/outputv4/ibc/core/types/v1/genesis.ts b/__fixtures__/v-next/outputv4/ibc/core/types/v1/genesis.ts index 9a8f407b17..c0b6d7b76d 100644 --- a/__fixtures__/v-next/outputv4/ibc/core/types/v1/genesis.ts +++ b/__fixtures__/v-next/outputv4/ibc/core/types/v1/genesis.ts @@ -1,12 +1,13 @@ -import { GenesisState as GenesisState1 } from "../../client/v1/genesis.js"; -import { GenesisStateSDKType as GenesisState1SDKType } from "../../client/v1/genesis.js"; -import { GenesisState as GenesisState2 } from "../../connection/v1/genesis.js"; -import { GenesisStateSDKType as GenesisState2SDKType } from "../../connection/v1/genesis.js"; -import { GenesisState as GenesisState3 } from "../../channel/v1/genesis.js"; -import { GenesisStateSDKType as GenesisState3SDKType } from "../../channel/v1/genesis.js"; -import { BinaryReader, BinaryWriter } from "../../../../binary.js"; -import { isSet, DeepPartial } from "../../../../helpers.js"; -import { JsonSafe } from "../../../../json-safe.js"; +import { GenesisState as GenesisState1 } from "../../client/v1/genesis"; +import { GenesisStateSDKType as GenesisState1SDKType } from "../../client/v1/genesis"; +import { GenesisState as GenesisState2 } from "../../connection/v1/genesis"; +import { GenesisStateSDKType as GenesisState2SDKType } from "../../connection/v1/genesis"; +import { GenesisState as GenesisState3 } from "../../channel/v1/genesis"; +import { GenesisStateSDKType as GenesisState3SDKType } from "../../channel/v1/genesis"; +import { BinaryReader, BinaryWriter } from "../../../../binary"; +import { isSet, DeepPartial } from "../../../../helpers"; +import { JsonSafe } from "../../../../json-safe"; +import { ComputedRef } from "vue"; export const protobufPackage = "ibc.core.types.v1"; /** GenesisState defines the ibc module's genesis state. */ export interface GenesisState { @@ -17,6 +18,11 @@ export interface GenesisState { /** ICS004 - Channel genesis state */ channelGenesis: GenesisState3; } +export interface ReactiveGenesisState { + clientGenesis: ComputedRef<GenesisState1>; + connectionGenesis: ComputedRef<GenesisState2>; + channelGenesis: ComputedRef<GenesisState3>; +} export interface GenesisStateProtoMsg { typeUrl: "/ibc.core.types.v1.GenesisState"; value: Uint8Array; @@ -72,11 +78,11 @@ export const GenesisState = { return message; }, fromJSON(object: any): GenesisState { - const obj = createBaseGenesisState(); - if (isSet(object.clientGenesis)) obj.clientGenesis = GenesisState1.fromJSON(object.clientGenesis); - if (isSet(object.connectionGenesis)) obj.connectionGenesis = GenesisState2.fromJSON(object.connectionGenesis); - if (isSet(object.channelGenesis)) obj.channelGenesis = GenesisState3.fromJSON(object.channelGenesis); - return obj; + return { + clientGenesis: isSet(object.clientGenesis) ? GenesisState1.fromJSON(object.clientGenesis) : undefined, + connectionGenesis: isSet(object.connectionGenesis) ? GenesisState2.fromJSON(object.connectionGenesis) : undefined, + channelGenesis: isSet(object.channelGenesis) ? GenesisState3.fromJSON(object.channelGenesis) : undefined + }; }, toJSON(message: GenesisState): JsonSafe<GenesisState> { const obj: any = {}; @@ -87,15 +93,9 @@ export const GenesisState = { }, fromPartial(object: DeepPartial<GenesisState>): GenesisState { const message = createBaseGenesisState(); - if (object.clientGenesis !== undefined && object.clientGenesis !== null) { - message.clientGenesis = GenesisState1.fromPartial(object.clientGenesis); - } - if (object.connectionGenesis !== undefined && object.connectionGenesis !== null) { - message.connectionGenesis = GenesisState2.fromPartial(object.connectionGenesis); - } - if (object.channelGenesis !== undefined && object.channelGenesis !== null) { - message.channelGenesis = GenesisState3.fromPartial(object.channelGenesis); - } + message.clientGenesis = object.clientGenesis !== undefined && object.clientGenesis !== null ? GenesisState1.fromPartial(object.clientGenesis) : undefined; + message.connectionGenesis = object.connectionGenesis !== undefined && object.connectionGenesis !== null ? GenesisState2.fromPartial(object.connectionGenesis) : undefined; + message.channelGenesis = object.channelGenesis !== undefined && object.channelGenesis !== null ? GenesisState3.fromPartial(object.channelGenesis) : undefined; return message; }, fromSDK(object: GenesisStateSDKType): GenesisState { diff --git a/__fixtures__/v-next/outputv4/ibc/lcd.ts b/__fixtures__/v-next/outputv4/ibc/lcd.ts index c9e8f73f97..70990ff5f5 100644 --- a/__fixtures__/v-next/outputv4/ibc/lcd.ts +++ b/__fixtures__/v-next/outputv4/ibc/lcd.ts @@ -37,6 +37,11 @@ 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: { @@ -109,6 +114,23 @@ export const createLCDClient = async ({ v1: new (await import("./applications/transfer/v1/query.lcd")).LCDQueryClient({ requestClient }) + }, + fee: { + v1: new (await import("./applications/fee/v1/query.lcd")).LCDQueryClient({ + requestClient + }) + }, + interchain_accounts: { + controller: { + v1: new (await import("./applications/interchain_accounts/controller/v1/query.lcd")).LCDQueryClient({ + requestClient + }) + }, + host: { + v1: new (await import("./applications/interchain_accounts/host/v1/query.lcd")).LCDQueryClient({ + requestClient + }) + } } }, core: { diff --git a/__fixtures__/v-next/outputv4/ibc/lightclients/localhost/v1/localhost.ts b/__fixtures__/v-next/outputv4/ibc/lightclients/localhost/v1/localhost.ts index 5efc897130..b8d0529913 100644 --- a/__fixtures__/v-next/outputv4/ibc/lightclients/localhost/v1/localhost.ts +++ b/__fixtures__/v-next/outputv4/ibc/lightclients/localhost/v1/localhost.ts @@ -1,7 +1,8 @@ -import { Height, HeightSDKType } from "../../../core/client/v1/client.js"; -import { BinaryReader, BinaryWriter } from "../../../../binary.js"; -import { isSet, DeepPartial } from "../../../../helpers.js"; -import { JsonSafe } from "../../../../json-safe.js"; +import { Height, HeightSDKType } from "../../../core/client/v1/client"; +import { BinaryReader, BinaryWriter } from "../../../../binary"; +import { isSet, DeepPartial } from "../../../../helpers"; +import { JsonSafe } from "../../../../json-safe"; +import { ComputedRef } from "vue"; export const protobufPackage = "ibc.lightclients.localhost.v1"; /** * ClientState defines a loopback (localhost) client. It requires (read-only) @@ -13,6 +14,10 @@ export interface ClientState { /** self latest block height */ height: Height; } +export interface ReactiveClientState { + chainId: ComputedRef<string>; + height: ComputedRef<Height>; +} export interface ClientStateProtoMsg { typeUrl: "/ibc.lightclients.localhost.v1.ClientState"; value: Uint8Array; @@ -34,7 +39,7 @@ function createBaseClientState(): ClientState { export const ClientState = { typeUrl: "/ibc.lightclients.localhost.v1.ClientState", encode(message: ClientState, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.chainId !== undefined) { + if (message.chainId !== "") { writer.uint32(10).string(message.chainId); } if (message.height !== undefined) { @@ -63,10 +68,10 @@ export const ClientState = { return message; }, fromJSON(object: any): ClientState { - const obj = createBaseClientState(); - if (isSet(object.chainId)) obj.chainId = String(object.chainId); - if (isSet(object.height)) obj.height = Height.fromJSON(object.height); - return obj; + return { + chainId: isSet(object.chainId) ? String(object.chainId) : "", + height: isSet(object.height) ? Height.fromJSON(object.height) : undefined + }; }, toJSON(message: ClientState): JsonSafe<ClientState> { const obj: any = {}; @@ -77,9 +82,7 @@ export const ClientState = { fromPartial(object: DeepPartial<ClientState>): ClientState { const message = createBaseClientState(); message.chainId = object.chainId ?? ""; - if (object.height !== undefined && object.height !== null) { - message.height = Height.fromPartial(object.height); - } + message.height = object.height !== undefined && object.height !== null ? Height.fromPartial(object.height) : undefined; return message; }, fromSDK(object: ClientStateSDKType): ClientState { diff --git a/__fixtures__/v-next/outputv4/ibc/lightclients/solomachine/v1/solomachine.ts b/__fixtures__/v-next/outputv4/ibc/lightclients/solomachine/v1/solomachine.ts index b1c6ce6ff6..b8841ae022 100644 --- a/__fixtures__/v-next/outputv4/ibc/lightclients/solomachine/v1/solomachine.ts +++ b/__fixtures__/v-next/outputv4/ibc/lightclients/solomachine/v1/solomachine.ts @@ -1,9 +1,10 @@ -import { Any, AnySDKType } from "../../../../google/protobuf/any.js"; -import { ConnectionEnd, ConnectionEndSDKType } from "../../../core/connection/v1/connection.js"; -import { Channel, ChannelSDKType } from "../../../core/channel/v1/channel.js"; -import { BinaryReader, BinaryWriter } from "../../../../binary.js"; -import { isSet, DeepPartial, bytesFromBase64, base64FromBytes } from "../../../../helpers.js"; -import { JsonSafe } from "../../../../json-safe.js"; +import { Any, AnySDKType } from "../../../../google/protobuf/any"; +import { ConnectionEnd, ConnectionEndSDKType } from "../../../core/connection/v1/connection"; +import { Channel, ChannelSDKType } from "../../../core/channel/v1/channel"; +import { BinaryReader, BinaryWriter } from "../../../../binary"; +import { isSet, DeepPartial, bytesFromBase64, base64FromBytes } from "../../../../helpers"; +import { JsonSafe } from "../../../../json-safe"; +import { ComputedRef } from "vue"; export const protobufPackage = "ibc.lightclients.solomachine.v1"; /** * DataType defines the type of solo machine proof being created. This is done @@ -114,6 +115,12 @@ export interface ClientState { */ allowUpdateAfterProposal: boolean; } +export interface ReactiveClientState { + sequence: ComputedRef<bigint>; + frozenSequence: ComputedRef<bigint>; + consensusState?: ComputedRef<ConsensusState>; + allowUpdateAfterProposal: ComputedRef<boolean>; +} export interface ClientStateProtoMsg { typeUrl: "/ibc.lightclients.solomachine.v1.ClientState"; value: Uint8Array; @@ -144,6 +151,11 @@ export interface ConsensusState { diversifier: string; timestamp: bigint; } +export interface ReactiveConsensusState { + publicKey?: ComputedRef<Any>; + diversifier: ComputedRef<string>; + timestamp: ComputedRef<bigint>; +} export interface ConsensusStateProtoMsg { typeUrl: "/ibc.lightclients.solomachine.v1.ConsensusState"; value: Uint8Array; @@ -167,6 +179,13 @@ export interface Header { newPublicKey?: Any; newDiversifier: string; } +export interface ReactiveHeader { + sequence: ComputedRef<bigint>; + timestamp: ComputedRef<bigint>; + signature: ComputedRef<Uint8Array>; + newPublicKey?: ComputedRef<Any>; + newDiversifier: ComputedRef<string>; +} export interface HeaderProtoMsg { typeUrl: "/ibc.lightclients.solomachine.v1.Header"; value: Uint8Array; @@ -189,6 +208,12 @@ export interface Misbehaviour { signatureOne?: SignatureAndData; signatureTwo?: SignatureAndData; } +export interface ReactiveMisbehaviour { + clientId: ComputedRef<string>; + sequence: ComputedRef<bigint>; + signatureOne?: ComputedRef<SignatureAndData>; + signatureTwo?: ComputedRef<SignatureAndData>; +} export interface MisbehaviourProtoMsg { typeUrl: "/ibc.lightclients.solomachine.v1.Misbehaviour"; value: Uint8Array; @@ -213,6 +238,12 @@ export interface SignatureAndData { data: Uint8Array; timestamp: bigint; } +export interface ReactiveSignatureAndData { + signature: ComputedRef<Uint8Array>; + dataType: ComputedRef<DataType>; + data: ComputedRef<Uint8Array>; + timestamp: ComputedRef<bigint>; +} export interface SignatureAndDataProtoMsg { typeUrl: "/ibc.lightclients.solomachine.v1.SignatureAndData"; value: Uint8Array; @@ -235,6 +266,10 @@ export interface TimestampedSignatureData { signatureData: Uint8Array; timestamp: bigint; } +export interface ReactiveTimestampedSignatureData { + signatureData: ComputedRef<Uint8Array>; + timestamp: ComputedRef<bigint>; +} export interface TimestampedSignatureDataProtoMsg { typeUrl: "/ibc.lightclients.solomachine.v1.TimestampedSignatureData"; value: Uint8Array; @@ -257,6 +292,13 @@ export interface SignBytes { /** marshaled data */ data: Uint8Array; } +export interface ReactiveSignBytes { + sequence: ComputedRef<bigint>; + timestamp: ComputedRef<bigint>; + diversifier: ComputedRef<string>; + dataType: ComputedRef<DataType>; + data: ComputedRef<Uint8Array>; +} export interface SignBytesProtoMsg { typeUrl: "/ibc.lightclients.solomachine.v1.SignBytes"; value: Uint8Array; @@ -276,6 +318,10 @@ export interface HeaderData { /** header diversifier */ newDiversifier: string; } +export interface ReactiveHeaderData { + newPubKey?: ComputedRef<Any>; + newDiversifier: ComputedRef<string>; +} export interface HeaderDataProtoMsg { typeUrl: "/ibc.lightclients.solomachine.v1.HeaderData"; value: Uint8Array; @@ -290,6 +336,10 @@ export interface ClientStateData { path: Uint8Array; clientState?: Any; } +export interface ReactiveClientStateData { + path: ComputedRef<Uint8Array>; + clientState?: ComputedRef<Any>; +} export interface ClientStateDataProtoMsg { typeUrl: "/ibc.lightclients.solomachine.v1.ClientStateData"; value: Uint8Array; @@ -307,6 +357,10 @@ export interface ConsensusStateData { path: Uint8Array; consensusState?: Any; } +export interface ReactiveConsensusStateData { + path: ComputedRef<Uint8Array>; + consensusState?: ComputedRef<Any>; +} export interface ConsensusStateDataProtoMsg { typeUrl: "/ibc.lightclients.solomachine.v1.ConsensusStateData"; value: Uint8Array; @@ -327,6 +381,10 @@ export interface ConnectionStateData { path: Uint8Array; connection?: ConnectionEnd; } +export interface ReactiveConnectionStateData { + path: ComputedRef<Uint8Array>; + connection?: ComputedRef<ConnectionEnd>; +} export interface ConnectionStateDataProtoMsg { typeUrl: "/ibc.lightclients.solomachine.v1.ConnectionStateData"; value: Uint8Array; @@ -347,6 +405,10 @@ export interface ChannelStateData { path: Uint8Array; channel?: Channel; } +export interface ReactiveChannelStateData { + path: ComputedRef<Uint8Array>; + channel?: ComputedRef<Channel>; +} export interface ChannelStateDataProtoMsg { typeUrl: "/ibc.lightclients.solomachine.v1.ChannelStateData"; value: Uint8Array; @@ -367,6 +429,10 @@ export interface PacketCommitmentData { path: Uint8Array; commitment: Uint8Array; } +export interface ReactivePacketCommitmentData { + path: ComputedRef<Uint8Array>; + commitment: ComputedRef<Uint8Array>; +} export interface PacketCommitmentDataProtoMsg { typeUrl: "/ibc.lightclients.solomachine.v1.PacketCommitmentData"; value: Uint8Array; @@ -387,6 +453,10 @@ export interface PacketAcknowledgementData { path: Uint8Array; acknowledgement: Uint8Array; } +export interface ReactivePacketAcknowledgementData { + path: ComputedRef<Uint8Array>; + acknowledgement: ComputedRef<Uint8Array>; +} export interface PacketAcknowledgementDataProtoMsg { typeUrl: "/ibc.lightclients.solomachine.v1.PacketAcknowledgementData"; value: Uint8Array; @@ -406,6 +476,9 @@ export interface PacketAcknowledgementDataSDKType { export interface PacketReceiptAbsenceData { path: Uint8Array; } +export interface ReactivePacketReceiptAbsenceData { + path: ComputedRef<Uint8Array>; +} export interface PacketReceiptAbsenceDataProtoMsg { typeUrl: "/ibc.lightclients.solomachine.v1.PacketReceiptAbsenceData"; value: Uint8Array; @@ -425,6 +498,10 @@ export interface NextSequenceRecvData { path: Uint8Array; nextSeqRecv: bigint; } +export interface ReactiveNextSequenceRecvData { + path: ComputedRef<Uint8Array>; + nextSeqRecv: ComputedRef<bigint>; +} export interface NextSequenceRecvDataProtoMsg { typeUrl: "/ibc.lightclients.solomachine.v1.NextSequenceRecvData"; value: Uint8Array; @@ -448,16 +525,16 @@ function createBaseClientState(): ClientState { export const ClientState = { typeUrl: "/ibc.lightclients.solomachine.v1.ClientState", encode(message: ClientState, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.sequence !== undefined) { + if (message.sequence !== BigInt(0)) { writer.uint32(8).uint64(message.sequence); } - if (message.frozenSequence !== undefined) { + if (message.frozenSequence !== BigInt(0)) { writer.uint32(16).uint64(message.frozenSequence); } if (message.consensusState !== undefined) { ConsensusState.encode(message.consensusState, writer.uint32(26).fork()).ldelim(); } - if (message.allowUpdateAfterProposal !== undefined) { + if (message.allowUpdateAfterProposal === true) { writer.uint32(32).bool(message.allowUpdateAfterProposal); } return writer; @@ -489,12 +566,12 @@ export const ClientState = { return message; }, fromJSON(object: any): ClientState { - const obj = createBaseClientState(); - if (isSet(object.sequence)) obj.sequence = BigInt(object.sequence.toString()); - if (isSet(object.frozenSequence)) obj.frozenSequence = BigInt(object.frozenSequence.toString()); - if (isSet(object.consensusState)) obj.consensusState = ConsensusState.fromJSON(object.consensusState); - if (isSet(object.allowUpdateAfterProposal)) obj.allowUpdateAfterProposal = Boolean(object.allowUpdateAfterProposal); - return obj; + return { + sequence: isSet(object.sequence) ? BigInt(object.sequence.toString()) : BigInt(0), + frozenSequence: isSet(object.frozenSequence) ? BigInt(object.frozenSequence.toString()) : BigInt(0), + consensusState: isSet(object.consensusState) ? ConsensusState.fromJSON(object.consensusState) : undefined, + allowUpdateAfterProposal: isSet(object.allowUpdateAfterProposal) ? Boolean(object.allowUpdateAfterProposal) : false + }; }, toJSON(message: ClientState): JsonSafe<ClientState> { const obj: any = {}; @@ -506,15 +583,9 @@ export const ClientState = { }, fromPartial(object: DeepPartial<ClientState>): ClientState { const message = createBaseClientState(); - if (object.sequence !== undefined && object.sequence !== null) { - message.sequence = BigInt(object.sequence.toString()); - } - if (object.frozenSequence !== undefined && object.frozenSequence !== null) { - message.frozenSequence = BigInt(object.frozenSequence.toString()); - } - if (object.consensusState !== undefined && object.consensusState !== null) { - message.consensusState = ConsensusState.fromPartial(object.consensusState); - } + message.sequence = object.sequence !== undefined && object.sequence !== null ? BigInt(object.sequence.toString()) : BigInt(0); + message.frozenSequence = object.frozenSequence !== undefined && object.frozenSequence !== null ? BigInt(object.frozenSequence.toString()) : BigInt(0); + message.consensusState = object.consensusState !== undefined && object.consensusState !== null ? ConsensusState.fromPartial(object.consensusState) : undefined; message.allowUpdateAfterProposal = object.allowUpdateAfterProposal ?? false; return message; }, @@ -601,10 +672,10 @@ export const ConsensusState = { if (message.publicKey !== undefined) { Any.encode(message.publicKey, writer.uint32(10).fork()).ldelim(); } - if (message.diversifier !== undefined) { + if (message.diversifier !== "") { writer.uint32(18).string(message.diversifier); } - if (message.timestamp !== undefined) { + if (message.timestamp !== BigInt(0)) { writer.uint32(24).uint64(message.timestamp); } return writer; @@ -633,11 +704,11 @@ export const ConsensusState = { return message; }, fromJSON(object: any): ConsensusState { - const obj = createBaseConsensusState(); - if (isSet(object.publicKey)) obj.publicKey = Any.fromJSON(object.publicKey); - if (isSet(object.diversifier)) obj.diversifier = String(object.diversifier); - if (isSet(object.timestamp)) obj.timestamp = BigInt(object.timestamp.toString()); - return obj; + return { + publicKey: isSet(object.publicKey) ? Any.fromJSON(object.publicKey) : undefined, + diversifier: isSet(object.diversifier) ? String(object.diversifier) : "", + timestamp: isSet(object.timestamp) ? BigInt(object.timestamp.toString()) : BigInt(0) + }; }, toJSON(message: ConsensusState): JsonSafe<ConsensusState> { const obj: any = {}; @@ -648,13 +719,9 @@ export const ConsensusState = { }, fromPartial(object: DeepPartial<ConsensusState>): ConsensusState { const message = createBaseConsensusState(); - if (object.publicKey !== undefined && object.publicKey !== null) { - message.publicKey = Any.fromPartial(object.publicKey); - } + message.publicKey = object.publicKey !== undefined && object.publicKey !== null ? Any.fromPartial(object.publicKey) : undefined; message.diversifier = object.diversifier ?? ""; - if (object.timestamp !== undefined && object.timestamp !== null) { - message.timestamp = BigInt(object.timestamp.toString()); - } + message.timestamp = object.timestamp !== undefined && object.timestamp !== null ? BigInt(object.timestamp.toString()) : BigInt(0); return message; }, fromSDK(object: ConsensusStateSDKType): ConsensusState { @@ -732,10 +799,10 @@ function createBaseHeader(): Header { export const Header = { typeUrl: "/ibc.lightclients.solomachine.v1.Header", encode(message: Header, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.sequence !== undefined) { + if (message.sequence !== BigInt(0)) { writer.uint32(8).uint64(message.sequence); } - if (message.timestamp !== undefined) { + if (message.timestamp !== BigInt(0)) { writer.uint32(16).uint64(message.timestamp); } if (message.signature.length !== 0) { @@ -744,7 +811,7 @@ export const Header = { if (message.newPublicKey !== undefined) { Any.encode(message.newPublicKey, writer.uint32(34).fork()).ldelim(); } - if (message.newDiversifier !== undefined) { + if (message.newDiversifier !== "") { writer.uint32(42).string(message.newDiversifier); } return writer; @@ -779,13 +846,13 @@ export const Header = { return message; }, fromJSON(object: any): Header { - const obj = createBaseHeader(); - if (isSet(object.sequence)) obj.sequence = BigInt(object.sequence.toString()); - if (isSet(object.timestamp)) obj.timestamp = BigInt(object.timestamp.toString()); - if (isSet(object.signature)) obj.signature = bytesFromBase64(object.signature); - if (isSet(object.newPublicKey)) obj.newPublicKey = Any.fromJSON(object.newPublicKey); - if (isSet(object.newDiversifier)) obj.newDiversifier = String(object.newDiversifier); - return obj; + return { + sequence: isSet(object.sequence) ? BigInt(object.sequence.toString()) : BigInt(0), + timestamp: isSet(object.timestamp) ? BigInt(object.timestamp.toString()) : BigInt(0), + signature: isSet(object.signature) ? bytesFromBase64(object.signature) : new Uint8Array(), + newPublicKey: isSet(object.newPublicKey) ? Any.fromJSON(object.newPublicKey) : undefined, + newDiversifier: isSet(object.newDiversifier) ? String(object.newDiversifier) : "" + }; }, toJSON(message: Header): JsonSafe<Header> { const obj: any = {}; @@ -798,16 +865,10 @@ export const Header = { }, fromPartial(object: DeepPartial<Header>): Header { const message = createBaseHeader(); - if (object.sequence !== undefined && object.sequence !== null) { - message.sequence = BigInt(object.sequence.toString()); - } - if (object.timestamp !== undefined && object.timestamp !== null) { - message.timestamp = BigInt(object.timestamp.toString()); - } + message.sequence = object.sequence !== undefined && object.sequence !== null ? BigInt(object.sequence.toString()) : BigInt(0); + message.timestamp = object.timestamp !== undefined && object.timestamp !== null ? BigInt(object.timestamp.toString()) : BigInt(0); message.signature = object.signature ?? new Uint8Array(); - if (object.newPublicKey !== undefined && object.newPublicKey !== null) { - message.newPublicKey = Any.fromPartial(object.newPublicKey); - } + message.newPublicKey = object.newPublicKey !== undefined && object.newPublicKey !== null ? Any.fromPartial(object.newPublicKey) : undefined; message.newDiversifier = object.newDiversifier ?? ""; return message; }, @@ -899,10 +960,10 @@ function createBaseMisbehaviour(): Misbehaviour { export const Misbehaviour = { typeUrl: "/ibc.lightclients.solomachine.v1.Misbehaviour", encode(message: Misbehaviour, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.clientId !== undefined) { + if (message.clientId !== "") { writer.uint32(10).string(message.clientId); } - if (message.sequence !== undefined) { + if (message.sequence !== BigInt(0)) { writer.uint32(16).uint64(message.sequence); } if (message.signatureOne !== undefined) { @@ -940,12 +1001,12 @@ export const Misbehaviour = { return message; }, fromJSON(object: any): Misbehaviour { - const obj = createBaseMisbehaviour(); - if (isSet(object.clientId)) obj.clientId = String(object.clientId); - if (isSet(object.sequence)) obj.sequence = BigInt(object.sequence.toString()); - if (isSet(object.signatureOne)) obj.signatureOne = SignatureAndData.fromJSON(object.signatureOne); - if (isSet(object.signatureTwo)) obj.signatureTwo = SignatureAndData.fromJSON(object.signatureTwo); - return obj; + return { + clientId: isSet(object.clientId) ? String(object.clientId) : "", + sequence: isSet(object.sequence) ? BigInt(object.sequence.toString()) : BigInt(0), + signatureOne: isSet(object.signatureOne) ? SignatureAndData.fromJSON(object.signatureOne) : undefined, + signatureTwo: isSet(object.signatureTwo) ? SignatureAndData.fromJSON(object.signatureTwo) : undefined + }; }, toJSON(message: Misbehaviour): JsonSafe<Misbehaviour> { const obj: any = {}; @@ -958,15 +1019,9 @@ export const Misbehaviour = { fromPartial(object: DeepPartial<Misbehaviour>): Misbehaviour { const message = createBaseMisbehaviour(); message.clientId = object.clientId ?? ""; - if (object.sequence !== undefined && object.sequence !== null) { - message.sequence = BigInt(object.sequence.toString()); - } - if (object.signatureOne !== undefined && object.signatureOne !== null) { - message.signatureOne = SignatureAndData.fromPartial(object.signatureOne); - } - if (object.signatureTwo !== undefined && object.signatureTwo !== null) { - message.signatureTwo = SignatureAndData.fromPartial(object.signatureTwo); - } + message.sequence = object.sequence !== undefined && object.sequence !== null ? BigInt(object.sequence.toString()) : BigInt(0); + message.signatureOne = object.signatureOne !== undefined && object.signatureOne !== null ? SignatureAndData.fromPartial(object.signatureOne) : undefined; + message.signatureTwo = object.signatureTwo !== undefined && object.signatureTwo !== null ? SignatureAndData.fromPartial(object.signatureTwo) : undefined; return message; }, fromSDK(object: MisbehaviourSDKType): Misbehaviour { @@ -1059,7 +1114,7 @@ export const SignatureAndData = { if (message.data.length !== 0) { writer.uint32(26).bytes(message.data); } - if (message.timestamp !== undefined) { + if (message.timestamp !== BigInt(0)) { writer.uint32(32).uint64(message.timestamp); } return writer; @@ -1091,12 +1146,12 @@ export const SignatureAndData = { return message; }, fromJSON(object: any): SignatureAndData { - const obj = createBaseSignatureAndData(); - if (isSet(object.signature)) obj.signature = bytesFromBase64(object.signature); - if (isSet(object.dataType)) obj.dataType = dataTypeFromJSON(object.dataType); - if (isSet(object.data)) obj.data = bytesFromBase64(object.data); - if (isSet(object.timestamp)) obj.timestamp = BigInt(object.timestamp.toString()); - return obj; + return { + signature: isSet(object.signature) ? bytesFromBase64(object.signature) : new Uint8Array(), + dataType: isSet(object.dataType) ? dataTypeFromJSON(object.dataType) : -1, + data: isSet(object.data) ? bytesFromBase64(object.data) : new Uint8Array(), + timestamp: isSet(object.timestamp) ? BigInt(object.timestamp.toString()) : BigInt(0) + }; }, toJSON(message: SignatureAndData): JsonSafe<SignatureAndData> { const obj: any = {}; @@ -1111,9 +1166,7 @@ export const SignatureAndData = { message.signature = object.signature ?? new Uint8Array(); message.dataType = object.dataType ?? 0; message.data = object.data ?? new Uint8Array(); - if (object.timestamp !== undefined && object.timestamp !== null) { - message.timestamp = BigInt(object.timestamp.toString()); - } + message.timestamp = object.timestamp !== undefined && object.timestamp !== null ? BigInt(object.timestamp.toString()) : BigInt(0); return message; }, fromSDK(object: SignatureAndDataSDKType): SignatureAndData { @@ -1198,7 +1251,7 @@ export const TimestampedSignatureData = { if (message.signatureData.length !== 0) { writer.uint32(10).bytes(message.signatureData); } - if (message.timestamp !== undefined) { + if (message.timestamp !== BigInt(0)) { writer.uint32(16).uint64(message.timestamp); } return writer; @@ -1224,10 +1277,10 @@ export const TimestampedSignatureData = { return message; }, fromJSON(object: any): TimestampedSignatureData { - const obj = createBaseTimestampedSignatureData(); - if (isSet(object.signatureData)) obj.signatureData = bytesFromBase64(object.signatureData); - if (isSet(object.timestamp)) obj.timestamp = BigInt(object.timestamp.toString()); - return obj; + return { + signatureData: isSet(object.signatureData) ? bytesFromBase64(object.signatureData) : new Uint8Array(), + timestamp: isSet(object.timestamp) ? BigInt(object.timestamp.toString()) : BigInt(0) + }; }, toJSON(message: TimestampedSignatureData): JsonSafe<TimestampedSignatureData> { const obj: any = {}; @@ -1238,9 +1291,7 @@ export const TimestampedSignatureData = { fromPartial(object: DeepPartial<TimestampedSignatureData>): TimestampedSignatureData { const message = createBaseTimestampedSignatureData(); message.signatureData = object.signatureData ?? new Uint8Array(); - if (object.timestamp !== undefined && object.timestamp !== null) { - message.timestamp = BigInt(object.timestamp.toString()); - } + message.timestamp = object.timestamp !== undefined && object.timestamp !== null ? BigInt(object.timestamp.toString()) : BigInt(0); return message; }, fromSDK(object: TimestampedSignatureDataSDKType): TimestampedSignatureData { @@ -1311,13 +1362,13 @@ function createBaseSignBytes(): SignBytes { export const SignBytes = { typeUrl: "/ibc.lightclients.solomachine.v1.SignBytes", encode(message: SignBytes, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.sequence !== undefined) { + if (message.sequence !== BigInt(0)) { writer.uint32(8).uint64(message.sequence); } - if (message.timestamp !== undefined) { + if (message.timestamp !== BigInt(0)) { writer.uint32(16).uint64(message.timestamp); } - if (message.diversifier !== undefined) { + if (message.diversifier !== "") { writer.uint32(26).string(message.diversifier); } if (message.dataType !== 0) { @@ -1358,13 +1409,13 @@ export const SignBytes = { return message; }, fromJSON(object: any): SignBytes { - const obj = createBaseSignBytes(); - if (isSet(object.sequence)) obj.sequence = BigInt(object.sequence.toString()); - if (isSet(object.timestamp)) obj.timestamp = BigInt(object.timestamp.toString()); - if (isSet(object.diversifier)) obj.diversifier = String(object.diversifier); - if (isSet(object.dataType)) obj.dataType = dataTypeFromJSON(object.dataType); - if (isSet(object.data)) obj.data = bytesFromBase64(object.data); - return obj; + return { + sequence: isSet(object.sequence) ? BigInt(object.sequence.toString()) : BigInt(0), + timestamp: isSet(object.timestamp) ? BigInt(object.timestamp.toString()) : BigInt(0), + diversifier: isSet(object.diversifier) ? String(object.diversifier) : "", + dataType: isSet(object.dataType) ? dataTypeFromJSON(object.dataType) : -1, + data: isSet(object.data) ? bytesFromBase64(object.data) : new Uint8Array() + }; }, toJSON(message: SignBytes): JsonSafe<SignBytes> { const obj: any = {}; @@ -1377,12 +1428,8 @@ export const SignBytes = { }, fromPartial(object: DeepPartial<SignBytes>): SignBytes { const message = createBaseSignBytes(); - if (object.sequence !== undefined && object.sequence !== null) { - message.sequence = BigInt(object.sequence.toString()); - } - if (object.timestamp !== undefined && object.timestamp !== null) { - message.timestamp = BigInt(object.timestamp.toString()); - } + message.sequence = object.sequence !== undefined && object.sequence !== null ? BigInt(object.sequence.toString()) : BigInt(0); + message.timestamp = object.timestamp !== undefined && object.timestamp !== null ? BigInt(object.timestamp.toString()) : BigInt(0); message.diversifier = object.diversifier ?? ""; message.dataType = object.dataType ?? 0; message.data = object.data ?? new Uint8Array(); @@ -1477,7 +1524,7 @@ export const HeaderData = { if (message.newPubKey !== undefined) { Any.encode(message.newPubKey, writer.uint32(10).fork()).ldelim(); } - if (message.newDiversifier !== undefined) { + if (message.newDiversifier !== "") { writer.uint32(18).string(message.newDiversifier); } return writer; @@ -1503,10 +1550,10 @@ export const HeaderData = { return message; }, fromJSON(object: any): HeaderData { - const obj = createBaseHeaderData(); - if (isSet(object.newPubKey)) obj.newPubKey = Any.fromJSON(object.newPubKey); - if (isSet(object.newDiversifier)) obj.newDiversifier = String(object.newDiversifier); - return obj; + return { + newPubKey: isSet(object.newPubKey) ? Any.fromJSON(object.newPubKey) : undefined, + newDiversifier: isSet(object.newDiversifier) ? String(object.newDiversifier) : "" + }; }, toJSON(message: HeaderData): JsonSafe<HeaderData> { const obj: any = {}; @@ -1516,9 +1563,7 @@ export const HeaderData = { }, fromPartial(object: DeepPartial<HeaderData>): HeaderData { const message = createBaseHeaderData(); - if (object.newPubKey !== undefined && object.newPubKey !== null) { - message.newPubKey = Any.fromPartial(object.newPubKey); - } + message.newPubKey = object.newPubKey !== undefined && object.newPubKey !== null ? Any.fromPartial(object.newPubKey) : undefined; message.newDiversifier = object.newDiversifier ?? ""; return message; }, @@ -1616,10 +1661,10 @@ export const ClientStateData = { return message; }, fromJSON(object: any): ClientStateData { - const obj = createBaseClientStateData(); - if (isSet(object.path)) obj.path = bytesFromBase64(object.path); - if (isSet(object.clientState)) obj.clientState = Any.fromJSON(object.clientState); - return obj; + return { + path: isSet(object.path) ? bytesFromBase64(object.path) : new Uint8Array(), + clientState: isSet(object.clientState) ? Any.fromJSON(object.clientState) : undefined + }; }, toJSON(message: ClientStateData): JsonSafe<ClientStateData> { const obj: any = {}; @@ -1630,9 +1675,7 @@ export const ClientStateData = { fromPartial(object: DeepPartial<ClientStateData>): ClientStateData { const message = createBaseClientStateData(); message.path = object.path ?? new Uint8Array(); - if (object.clientState !== undefined && object.clientState !== null) { - message.clientState = Any.fromPartial(object.clientState); - } + message.clientState = object.clientState !== undefined && object.clientState !== null ? Any.fromPartial(object.clientState) : undefined; return message; }, fromSDK(object: ClientStateDataSDKType): ClientStateData { @@ -1729,10 +1772,10 @@ export const ConsensusStateData = { return message; }, fromJSON(object: any): ConsensusStateData { - const obj = createBaseConsensusStateData(); - if (isSet(object.path)) obj.path = bytesFromBase64(object.path); - if (isSet(object.consensusState)) obj.consensusState = Any.fromJSON(object.consensusState); - return obj; + return { + path: isSet(object.path) ? bytesFromBase64(object.path) : new Uint8Array(), + consensusState: isSet(object.consensusState) ? Any.fromJSON(object.consensusState) : undefined + }; }, toJSON(message: ConsensusStateData): JsonSafe<ConsensusStateData> { const obj: any = {}; @@ -1743,9 +1786,7 @@ export const ConsensusStateData = { fromPartial(object: DeepPartial<ConsensusStateData>): ConsensusStateData { const message = createBaseConsensusStateData(); message.path = object.path ?? new Uint8Array(); - if (object.consensusState !== undefined && object.consensusState !== null) { - message.consensusState = Any.fromPartial(object.consensusState); - } + message.consensusState = object.consensusState !== undefined && object.consensusState !== null ? Any.fromPartial(object.consensusState) : undefined; return message; }, fromSDK(object: ConsensusStateDataSDKType): ConsensusStateData { @@ -1842,10 +1883,10 @@ export const ConnectionStateData = { return message; }, fromJSON(object: any): ConnectionStateData { - const obj = createBaseConnectionStateData(); - if (isSet(object.path)) obj.path = bytesFromBase64(object.path); - if (isSet(object.connection)) obj.connection = ConnectionEnd.fromJSON(object.connection); - return obj; + return { + path: isSet(object.path) ? bytesFromBase64(object.path) : new Uint8Array(), + connection: isSet(object.connection) ? ConnectionEnd.fromJSON(object.connection) : undefined + }; }, toJSON(message: ConnectionStateData): JsonSafe<ConnectionStateData> { const obj: any = {}; @@ -1856,9 +1897,7 @@ export const ConnectionStateData = { fromPartial(object: DeepPartial<ConnectionStateData>): ConnectionStateData { const message = createBaseConnectionStateData(); message.path = object.path ?? new Uint8Array(); - if (object.connection !== undefined && object.connection !== null) { - message.connection = ConnectionEnd.fromPartial(object.connection); - } + message.connection = object.connection !== undefined && object.connection !== null ? ConnectionEnd.fromPartial(object.connection) : undefined; return message; }, fromSDK(object: ConnectionStateDataSDKType): ConnectionStateData { @@ -1955,10 +1994,10 @@ export const ChannelStateData = { return message; }, fromJSON(object: any): ChannelStateData { - const obj = createBaseChannelStateData(); - if (isSet(object.path)) obj.path = bytesFromBase64(object.path); - if (isSet(object.channel)) obj.channel = Channel.fromJSON(object.channel); - return obj; + return { + path: isSet(object.path) ? bytesFromBase64(object.path) : new Uint8Array(), + channel: isSet(object.channel) ? Channel.fromJSON(object.channel) : undefined + }; }, toJSON(message: ChannelStateData): JsonSafe<ChannelStateData> { const obj: any = {}; @@ -1969,9 +2008,7 @@ export const ChannelStateData = { fromPartial(object: DeepPartial<ChannelStateData>): ChannelStateData { const message = createBaseChannelStateData(); message.path = object.path ?? new Uint8Array(); - if (object.channel !== undefined && object.channel !== null) { - message.channel = Channel.fromPartial(object.channel); - } + message.channel = object.channel !== undefined && object.channel !== null ? Channel.fromPartial(object.channel) : undefined; return message; }, fromSDK(object: ChannelStateDataSDKType): ChannelStateData { @@ -2068,10 +2105,10 @@ export const PacketCommitmentData = { return message; }, fromJSON(object: any): PacketCommitmentData { - const obj = createBasePacketCommitmentData(); - if (isSet(object.path)) obj.path = bytesFromBase64(object.path); - if (isSet(object.commitment)) obj.commitment = bytesFromBase64(object.commitment); - return obj; + return { + path: isSet(object.path) ? bytesFromBase64(object.path) : new Uint8Array(), + commitment: isSet(object.commitment) ? bytesFromBase64(object.commitment) : new Uint8Array() + }; }, toJSON(message: PacketCommitmentData): JsonSafe<PacketCommitmentData> { const obj: any = {}; @@ -2179,10 +2216,10 @@ export const PacketAcknowledgementData = { return message; }, fromJSON(object: any): PacketAcknowledgementData { - const obj = createBasePacketAcknowledgementData(); - if (isSet(object.path)) obj.path = bytesFromBase64(object.path); - if (isSet(object.acknowledgement)) obj.acknowledgement = bytesFromBase64(object.acknowledgement); - return obj; + return { + path: isSet(object.path) ? bytesFromBase64(object.path) : new Uint8Array(), + acknowledgement: isSet(object.acknowledgement) ? bytesFromBase64(object.acknowledgement) : new Uint8Array() + }; }, toJSON(message: PacketAcknowledgementData): JsonSafe<PacketAcknowledgementData> { const obj: any = {}; @@ -2283,9 +2320,9 @@ export const PacketReceiptAbsenceData = { return message; }, fromJSON(object: any): PacketReceiptAbsenceData { - const obj = createBasePacketReceiptAbsenceData(); - if (isSet(object.path)) obj.path = bytesFromBase64(object.path); - return obj; + return { + path: isSet(object.path) ? bytesFromBase64(object.path) : new Uint8Array() + }; }, toJSON(message: PacketReceiptAbsenceData): JsonSafe<PacketReceiptAbsenceData> { const obj: any = {}; @@ -2358,7 +2395,7 @@ export const NextSequenceRecvData = { if (message.path.length !== 0) { writer.uint32(10).bytes(message.path); } - if (message.nextSeqRecv !== undefined) { + if (message.nextSeqRecv !== BigInt(0)) { writer.uint32(16).uint64(message.nextSeqRecv); } return writer; @@ -2384,10 +2421,10 @@ export const NextSequenceRecvData = { return message; }, fromJSON(object: any): NextSequenceRecvData { - const obj = createBaseNextSequenceRecvData(); - if (isSet(object.path)) obj.path = bytesFromBase64(object.path); - if (isSet(object.nextSeqRecv)) obj.nextSeqRecv = BigInt(object.nextSeqRecv.toString()); - return obj; + return { + path: isSet(object.path) ? bytesFromBase64(object.path) : new Uint8Array(), + nextSeqRecv: isSet(object.nextSeqRecv) ? BigInt(object.nextSeqRecv.toString()) : BigInt(0) + }; }, toJSON(message: NextSequenceRecvData): JsonSafe<NextSequenceRecvData> { const obj: any = {}; @@ -2398,9 +2435,7 @@ export const NextSequenceRecvData = { fromPartial(object: DeepPartial<NextSequenceRecvData>): NextSequenceRecvData { const message = createBaseNextSequenceRecvData(); message.path = object.path ?? new Uint8Array(); - if (object.nextSeqRecv !== undefined && object.nextSeqRecv !== null) { - message.nextSeqRecv = BigInt(object.nextSeqRecv.toString()); - } + message.nextSeqRecv = object.nextSeqRecv !== undefined && object.nextSeqRecv !== null ? BigInt(object.nextSeqRecv.toString()) : BigInt(0); return message; }, fromSDK(object: NextSequenceRecvDataSDKType): NextSequenceRecvData { diff --git a/__fixtures__/v-next/outputv4/ibc/lightclients/solomachine/v2/solomachine.ts b/__fixtures__/v-next/outputv4/ibc/lightclients/solomachine/v2/solomachine.ts index a13d208b11..251f953310 100644 --- a/__fixtures__/v-next/outputv4/ibc/lightclients/solomachine/v2/solomachine.ts +++ b/__fixtures__/v-next/outputv4/ibc/lightclients/solomachine/v2/solomachine.ts @@ -1,9 +1,10 @@ -import { Any, AnySDKType } from "../../../../google/protobuf/any.js"; -import { ConnectionEnd, ConnectionEndSDKType } from "../../../core/connection/v1/connection.js"; -import { Channel, ChannelSDKType } from "../../../core/channel/v1/channel.js"; -import { BinaryReader, BinaryWriter } from "../../../../binary.js"; -import { isSet, DeepPartial, bytesFromBase64, base64FromBytes } from "../../../../helpers.js"; -import { JsonSafe } from "../../../../json-safe.js"; +import { Any, AnySDKType } from "../../../../google/protobuf/any"; +import { ConnectionEnd, ConnectionEndSDKType } from "../../../core/connection/v1/connection"; +import { Channel, ChannelSDKType } from "../../../core/channel/v1/channel"; +import { BinaryReader, BinaryWriter } from "../../../../binary"; +import { isSet, DeepPartial, bytesFromBase64, base64FromBytes } from "../../../../helpers"; +import { JsonSafe } from "../../../../json-safe"; +import { ComputedRef } from "vue"; export const protobufPackage = "ibc.lightclients.solomachine.v2"; /** * DataType defines the type of solo machine proof being created. This is done @@ -114,6 +115,12 @@ export interface ClientState { */ allowUpdateAfterProposal: boolean; } +export interface ReactiveClientState { + sequence: ComputedRef<bigint>; + isFrozen: ComputedRef<boolean>; + consensusState?: ComputedRef<ConsensusState>; + allowUpdateAfterProposal: ComputedRef<boolean>; +} export interface ClientStateProtoMsg { typeUrl: "/ibc.lightclients.solomachine.v2.ClientState"; value: Uint8Array; @@ -144,6 +151,11 @@ export interface ConsensusState { diversifier: string; timestamp: bigint; } +export interface ReactiveConsensusState { + publicKey?: ComputedRef<Any>; + diversifier: ComputedRef<string>; + timestamp: ComputedRef<bigint>; +} export interface ConsensusStateProtoMsg { typeUrl: "/ibc.lightclients.solomachine.v2.ConsensusState"; value: Uint8Array; @@ -167,6 +179,13 @@ export interface Header { newPublicKey?: Any; newDiversifier: string; } +export interface ReactiveHeader { + sequence: ComputedRef<bigint>; + timestamp: ComputedRef<bigint>; + signature: ComputedRef<Uint8Array>; + newPublicKey?: ComputedRef<Any>; + newDiversifier: ComputedRef<string>; +} export interface HeaderProtoMsg { typeUrl: "/ibc.lightclients.solomachine.v2.Header"; value: Uint8Array; @@ -189,6 +208,12 @@ export interface Misbehaviour { signatureOne?: SignatureAndData; signatureTwo?: SignatureAndData; } +export interface ReactiveMisbehaviour { + clientId: ComputedRef<string>; + sequence: ComputedRef<bigint>; + signatureOne?: ComputedRef<SignatureAndData>; + signatureTwo?: ComputedRef<SignatureAndData>; +} export interface MisbehaviourProtoMsg { typeUrl: "/ibc.lightclients.solomachine.v2.Misbehaviour"; value: Uint8Array; @@ -213,6 +238,12 @@ export interface SignatureAndData { data: Uint8Array; timestamp: bigint; } +export interface ReactiveSignatureAndData { + signature: ComputedRef<Uint8Array>; + dataType: ComputedRef<DataType>; + data: ComputedRef<Uint8Array>; + timestamp: ComputedRef<bigint>; +} export interface SignatureAndDataProtoMsg { typeUrl: "/ibc.lightclients.solomachine.v2.SignatureAndData"; value: Uint8Array; @@ -235,6 +266,10 @@ export interface TimestampedSignatureData { signatureData: Uint8Array; timestamp: bigint; } +export interface ReactiveTimestampedSignatureData { + signatureData: ComputedRef<Uint8Array>; + timestamp: ComputedRef<bigint>; +} export interface TimestampedSignatureDataProtoMsg { typeUrl: "/ibc.lightclients.solomachine.v2.TimestampedSignatureData"; value: Uint8Array; @@ -257,6 +292,13 @@ export interface SignBytes { /** marshaled data */ data: Uint8Array; } +export interface ReactiveSignBytes { + sequence: ComputedRef<bigint>; + timestamp: ComputedRef<bigint>; + diversifier: ComputedRef<string>; + dataType: ComputedRef<DataType>; + data: ComputedRef<Uint8Array>; +} export interface SignBytesProtoMsg { typeUrl: "/ibc.lightclients.solomachine.v2.SignBytes"; value: Uint8Array; @@ -276,6 +318,10 @@ export interface HeaderData { /** header diversifier */ newDiversifier: string; } +export interface ReactiveHeaderData { + newPubKey?: ComputedRef<Any>; + newDiversifier: ComputedRef<string>; +} export interface HeaderDataProtoMsg { typeUrl: "/ibc.lightclients.solomachine.v2.HeaderData"; value: Uint8Array; @@ -290,6 +336,10 @@ export interface ClientStateData { path: Uint8Array; clientState?: Any; } +export interface ReactiveClientStateData { + path: ComputedRef<Uint8Array>; + clientState?: ComputedRef<Any>; +} export interface ClientStateDataProtoMsg { typeUrl: "/ibc.lightclients.solomachine.v2.ClientStateData"; value: Uint8Array; @@ -307,6 +357,10 @@ export interface ConsensusStateData { path: Uint8Array; consensusState?: Any; } +export interface ReactiveConsensusStateData { + path: ComputedRef<Uint8Array>; + consensusState?: ComputedRef<Any>; +} export interface ConsensusStateDataProtoMsg { typeUrl: "/ibc.lightclients.solomachine.v2.ConsensusStateData"; value: Uint8Array; @@ -327,6 +381,10 @@ export interface ConnectionStateData { path: Uint8Array; connection?: ConnectionEnd; } +export interface ReactiveConnectionStateData { + path: ComputedRef<Uint8Array>; + connection?: ComputedRef<ConnectionEnd>; +} export interface ConnectionStateDataProtoMsg { typeUrl: "/ibc.lightclients.solomachine.v2.ConnectionStateData"; value: Uint8Array; @@ -347,6 +405,10 @@ export interface ChannelStateData { path: Uint8Array; channel?: Channel; } +export interface ReactiveChannelStateData { + path: ComputedRef<Uint8Array>; + channel?: ComputedRef<Channel>; +} export interface ChannelStateDataProtoMsg { typeUrl: "/ibc.lightclients.solomachine.v2.ChannelStateData"; value: Uint8Array; @@ -367,6 +429,10 @@ export interface PacketCommitmentData { path: Uint8Array; commitment: Uint8Array; } +export interface ReactivePacketCommitmentData { + path: ComputedRef<Uint8Array>; + commitment: ComputedRef<Uint8Array>; +} export interface PacketCommitmentDataProtoMsg { typeUrl: "/ibc.lightclients.solomachine.v2.PacketCommitmentData"; value: Uint8Array; @@ -387,6 +453,10 @@ export interface PacketAcknowledgementData { path: Uint8Array; acknowledgement: Uint8Array; } +export interface ReactivePacketAcknowledgementData { + path: ComputedRef<Uint8Array>; + acknowledgement: ComputedRef<Uint8Array>; +} export interface PacketAcknowledgementDataProtoMsg { typeUrl: "/ibc.lightclients.solomachine.v2.PacketAcknowledgementData"; value: Uint8Array; @@ -406,6 +476,9 @@ export interface PacketAcknowledgementDataSDKType { export interface PacketReceiptAbsenceData { path: Uint8Array; } +export interface ReactivePacketReceiptAbsenceData { + path: ComputedRef<Uint8Array>; +} export interface PacketReceiptAbsenceDataProtoMsg { typeUrl: "/ibc.lightclients.solomachine.v2.PacketReceiptAbsenceData"; value: Uint8Array; @@ -425,6 +498,10 @@ export interface NextSequenceRecvData { path: Uint8Array; nextSeqRecv: bigint; } +export interface ReactiveNextSequenceRecvData { + path: ComputedRef<Uint8Array>; + nextSeqRecv: ComputedRef<bigint>; +} export interface NextSequenceRecvDataProtoMsg { typeUrl: "/ibc.lightclients.solomachine.v2.NextSequenceRecvData"; value: Uint8Array; @@ -448,16 +525,16 @@ function createBaseClientState(): ClientState { export const ClientState = { typeUrl: "/ibc.lightclients.solomachine.v2.ClientState", encode(message: ClientState, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.sequence !== undefined) { + if (message.sequence !== BigInt(0)) { writer.uint32(8).uint64(message.sequence); } - if (message.isFrozen !== undefined) { + if (message.isFrozen === true) { writer.uint32(16).bool(message.isFrozen); } if (message.consensusState !== undefined) { ConsensusState.encode(message.consensusState, writer.uint32(26).fork()).ldelim(); } - if (message.allowUpdateAfterProposal !== undefined) { + if (message.allowUpdateAfterProposal === true) { writer.uint32(32).bool(message.allowUpdateAfterProposal); } return writer; @@ -489,12 +566,12 @@ export const ClientState = { return message; }, fromJSON(object: any): ClientState { - const obj = createBaseClientState(); - if (isSet(object.sequence)) obj.sequence = BigInt(object.sequence.toString()); - if (isSet(object.isFrozen)) obj.isFrozen = Boolean(object.isFrozen); - if (isSet(object.consensusState)) obj.consensusState = ConsensusState.fromJSON(object.consensusState); - if (isSet(object.allowUpdateAfterProposal)) obj.allowUpdateAfterProposal = Boolean(object.allowUpdateAfterProposal); - return obj; + return { + sequence: isSet(object.sequence) ? BigInt(object.sequence.toString()) : BigInt(0), + isFrozen: isSet(object.isFrozen) ? Boolean(object.isFrozen) : false, + consensusState: isSet(object.consensusState) ? ConsensusState.fromJSON(object.consensusState) : undefined, + allowUpdateAfterProposal: isSet(object.allowUpdateAfterProposal) ? Boolean(object.allowUpdateAfterProposal) : false + }; }, toJSON(message: ClientState): JsonSafe<ClientState> { const obj: any = {}; @@ -506,13 +583,9 @@ export const ClientState = { }, fromPartial(object: DeepPartial<ClientState>): ClientState { const message = createBaseClientState(); - if (object.sequence !== undefined && object.sequence !== null) { - message.sequence = BigInt(object.sequence.toString()); - } + message.sequence = object.sequence !== undefined && object.sequence !== null ? BigInt(object.sequence.toString()) : BigInt(0); message.isFrozen = object.isFrozen ?? false; - if (object.consensusState !== undefined && object.consensusState !== null) { - message.consensusState = ConsensusState.fromPartial(object.consensusState); - } + message.consensusState = object.consensusState !== undefined && object.consensusState !== null ? ConsensusState.fromPartial(object.consensusState) : undefined; message.allowUpdateAfterProposal = object.allowUpdateAfterProposal ?? false; return message; }, @@ -599,10 +672,10 @@ export const ConsensusState = { if (message.publicKey !== undefined) { Any.encode(message.publicKey, writer.uint32(10).fork()).ldelim(); } - if (message.diversifier !== undefined) { + if (message.diversifier !== "") { writer.uint32(18).string(message.diversifier); } - if (message.timestamp !== undefined) { + if (message.timestamp !== BigInt(0)) { writer.uint32(24).uint64(message.timestamp); } return writer; @@ -631,11 +704,11 @@ export const ConsensusState = { return message; }, fromJSON(object: any): ConsensusState { - const obj = createBaseConsensusState(); - if (isSet(object.publicKey)) obj.publicKey = Any.fromJSON(object.publicKey); - if (isSet(object.diversifier)) obj.diversifier = String(object.diversifier); - if (isSet(object.timestamp)) obj.timestamp = BigInt(object.timestamp.toString()); - return obj; + return { + publicKey: isSet(object.publicKey) ? Any.fromJSON(object.publicKey) : undefined, + diversifier: isSet(object.diversifier) ? String(object.diversifier) : "", + timestamp: isSet(object.timestamp) ? BigInt(object.timestamp.toString()) : BigInt(0) + }; }, toJSON(message: ConsensusState): JsonSafe<ConsensusState> { const obj: any = {}; @@ -646,13 +719,9 @@ export const ConsensusState = { }, fromPartial(object: DeepPartial<ConsensusState>): ConsensusState { const message = createBaseConsensusState(); - if (object.publicKey !== undefined && object.publicKey !== null) { - message.publicKey = Any.fromPartial(object.publicKey); - } + message.publicKey = object.publicKey !== undefined && object.publicKey !== null ? Any.fromPartial(object.publicKey) : undefined; message.diversifier = object.diversifier ?? ""; - if (object.timestamp !== undefined && object.timestamp !== null) { - message.timestamp = BigInt(object.timestamp.toString()); - } + message.timestamp = object.timestamp !== undefined && object.timestamp !== null ? BigInt(object.timestamp.toString()) : BigInt(0); return message; }, fromSDK(object: ConsensusStateSDKType): ConsensusState { @@ -730,10 +799,10 @@ function createBaseHeader(): Header { export const Header = { typeUrl: "/ibc.lightclients.solomachine.v2.Header", encode(message: Header, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.sequence !== undefined) { + if (message.sequence !== BigInt(0)) { writer.uint32(8).uint64(message.sequence); } - if (message.timestamp !== undefined) { + if (message.timestamp !== BigInt(0)) { writer.uint32(16).uint64(message.timestamp); } if (message.signature.length !== 0) { @@ -742,7 +811,7 @@ export const Header = { if (message.newPublicKey !== undefined) { Any.encode(message.newPublicKey, writer.uint32(34).fork()).ldelim(); } - if (message.newDiversifier !== undefined) { + if (message.newDiversifier !== "") { writer.uint32(42).string(message.newDiversifier); } return writer; @@ -777,13 +846,13 @@ export const Header = { return message; }, fromJSON(object: any): Header { - const obj = createBaseHeader(); - if (isSet(object.sequence)) obj.sequence = BigInt(object.sequence.toString()); - if (isSet(object.timestamp)) obj.timestamp = BigInt(object.timestamp.toString()); - if (isSet(object.signature)) obj.signature = bytesFromBase64(object.signature); - if (isSet(object.newPublicKey)) obj.newPublicKey = Any.fromJSON(object.newPublicKey); - if (isSet(object.newDiversifier)) obj.newDiversifier = String(object.newDiversifier); - return obj; + return { + sequence: isSet(object.sequence) ? BigInt(object.sequence.toString()) : BigInt(0), + timestamp: isSet(object.timestamp) ? BigInt(object.timestamp.toString()) : BigInt(0), + signature: isSet(object.signature) ? bytesFromBase64(object.signature) : new Uint8Array(), + newPublicKey: isSet(object.newPublicKey) ? Any.fromJSON(object.newPublicKey) : undefined, + newDiversifier: isSet(object.newDiversifier) ? String(object.newDiversifier) : "" + }; }, toJSON(message: Header): JsonSafe<Header> { const obj: any = {}; @@ -796,16 +865,10 @@ export const Header = { }, fromPartial(object: DeepPartial<Header>): Header { const message = createBaseHeader(); - if (object.sequence !== undefined && object.sequence !== null) { - message.sequence = BigInt(object.sequence.toString()); - } - if (object.timestamp !== undefined && object.timestamp !== null) { - message.timestamp = BigInt(object.timestamp.toString()); - } + message.sequence = object.sequence !== undefined && object.sequence !== null ? BigInt(object.sequence.toString()) : BigInt(0); + message.timestamp = object.timestamp !== undefined && object.timestamp !== null ? BigInt(object.timestamp.toString()) : BigInt(0); message.signature = object.signature ?? new Uint8Array(); - if (object.newPublicKey !== undefined && object.newPublicKey !== null) { - message.newPublicKey = Any.fromPartial(object.newPublicKey); - } + message.newPublicKey = object.newPublicKey !== undefined && object.newPublicKey !== null ? Any.fromPartial(object.newPublicKey) : undefined; message.newDiversifier = object.newDiversifier ?? ""; return message; }, @@ -897,10 +960,10 @@ function createBaseMisbehaviour(): Misbehaviour { export const Misbehaviour = { typeUrl: "/ibc.lightclients.solomachine.v2.Misbehaviour", encode(message: Misbehaviour, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.clientId !== undefined) { + if (message.clientId !== "") { writer.uint32(10).string(message.clientId); } - if (message.sequence !== undefined) { + if (message.sequence !== BigInt(0)) { writer.uint32(16).uint64(message.sequence); } if (message.signatureOne !== undefined) { @@ -938,12 +1001,12 @@ export const Misbehaviour = { return message; }, fromJSON(object: any): Misbehaviour { - const obj = createBaseMisbehaviour(); - if (isSet(object.clientId)) obj.clientId = String(object.clientId); - if (isSet(object.sequence)) obj.sequence = BigInt(object.sequence.toString()); - if (isSet(object.signatureOne)) obj.signatureOne = SignatureAndData.fromJSON(object.signatureOne); - if (isSet(object.signatureTwo)) obj.signatureTwo = SignatureAndData.fromJSON(object.signatureTwo); - return obj; + return { + clientId: isSet(object.clientId) ? String(object.clientId) : "", + sequence: isSet(object.sequence) ? BigInt(object.sequence.toString()) : BigInt(0), + signatureOne: isSet(object.signatureOne) ? SignatureAndData.fromJSON(object.signatureOne) : undefined, + signatureTwo: isSet(object.signatureTwo) ? SignatureAndData.fromJSON(object.signatureTwo) : undefined + }; }, toJSON(message: Misbehaviour): JsonSafe<Misbehaviour> { const obj: any = {}; @@ -956,15 +1019,9 @@ export const Misbehaviour = { fromPartial(object: DeepPartial<Misbehaviour>): Misbehaviour { const message = createBaseMisbehaviour(); message.clientId = object.clientId ?? ""; - if (object.sequence !== undefined && object.sequence !== null) { - message.sequence = BigInt(object.sequence.toString()); - } - if (object.signatureOne !== undefined && object.signatureOne !== null) { - message.signatureOne = SignatureAndData.fromPartial(object.signatureOne); - } - if (object.signatureTwo !== undefined && object.signatureTwo !== null) { - message.signatureTwo = SignatureAndData.fromPartial(object.signatureTwo); - } + message.sequence = object.sequence !== undefined && object.sequence !== null ? BigInt(object.sequence.toString()) : BigInt(0); + message.signatureOne = object.signatureOne !== undefined && object.signatureOne !== null ? SignatureAndData.fromPartial(object.signatureOne) : undefined; + message.signatureTwo = object.signatureTwo !== undefined && object.signatureTwo !== null ? SignatureAndData.fromPartial(object.signatureTwo) : undefined; return message; }, fromSDK(object: MisbehaviourSDKType): Misbehaviour { @@ -1057,7 +1114,7 @@ export const SignatureAndData = { if (message.data.length !== 0) { writer.uint32(26).bytes(message.data); } - if (message.timestamp !== undefined) { + if (message.timestamp !== BigInt(0)) { writer.uint32(32).uint64(message.timestamp); } return writer; @@ -1089,12 +1146,12 @@ export const SignatureAndData = { return message; }, fromJSON(object: any): SignatureAndData { - const obj = createBaseSignatureAndData(); - if (isSet(object.signature)) obj.signature = bytesFromBase64(object.signature); - if (isSet(object.dataType)) obj.dataType = dataTypeFromJSON(object.dataType); - if (isSet(object.data)) obj.data = bytesFromBase64(object.data); - if (isSet(object.timestamp)) obj.timestamp = BigInt(object.timestamp.toString()); - return obj; + return { + signature: isSet(object.signature) ? bytesFromBase64(object.signature) : new Uint8Array(), + dataType: isSet(object.dataType) ? dataTypeFromJSON(object.dataType) : -1, + data: isSet(object.data) ? bytesFromBase64(object.data) : new Uint8Array(), + timestamp: isSet(object.timestamp) ? BigInt(object.timestamp.toString()) : BigInt(0) + }; }, toJSON(message: SignatureAndData): JsonSafe<SignatureAndData> { const obj: any = {}; @@ -1109,9 +1166,7 @@ export const SignatureAndData = { message.signature = object.signature ?? new Uint8Array(); message.dataType = object.dataType ?? 0; message.data = object.data ?? new Uint8Array(); - if (object.timestamp !== undefined && object.timestamp !== null) { - message.timestamp = BigInt(object.timestamp.toString()); - } + message.timestamp = object.timestamp !== undefined && object.timestamp !== null ? BigInt(object.timestamp.toString()) : BigInt(0); return message; }, fromSDK(object: SignatureAndDataSDKType): SignatureAndData { @@ -1196,7 +1251,7 @@ export const TimestampedSignatureData = { if (message.signatureData.length !== 0) { writer.uint32(10).bytes(message.signatureData); } - if (message.timestamp !== undefined) { + if (message.timestamp !== BigInt(0)) { writer.uint32(16).uint64(message.timestamp); } return writer; @@ -1222,10 +1277,10 @@ export const TimestampedSignatureData = { return message; }, fromJSON(object: any): TimestampedSignatureData { - const obj = createBaseTimestampedSignatureData(); - if (isSet(object.signatureData)) obj.signatureData = bytesFromBase64(object.signatureData); - if (isSet(object.timestamp)) obj.timestamp = BigInt(object.timestamp.toString()); - return obj; + return { + signatureData: isSet(object.signatureData) ? bytesFromBase64(object.signatureData) : new Uint8Array(), + timestamp: isSet(object.timestamp) ? BigInt(object.timestamp.toString()) : BigInt(0) + }; }, toJSON(message: TimestampedSignatureData): JsonSafe<TimestampedSignatureData> { const obj: any = {}; @@ -1236,9 +1291,7 @@ export const TimestampedSignatureData = { fromPartial(object: DeepPartial<TimestampedSignatureData>): TimestampedSignatureData { const message = createBaseTimestampedSignatureData(); message.signatureData = object.signatureData ?? new Uint8Array(); - if (object.timestamp !== undefined && object.timestamp !== null) { - message.timestamp = BigInt(object.timestamp.toString()); - } + message.timestamp = object.timestamp !== undefined && object.timestamp !== null ? BigInt(object.timestamp.toString()) : BigInt(0); return message; }, fromSDK(object: TimestampedSignatureDataSDKType): TimestampedSignatureData { @@ -1309,13 +1362,13 @@ function createBaseSignBytes(): SignBytes { export const SignBytes = { typeUrl: "/ibc.lightclients.solomachine.v2.SignBytes", encode(message: SignBytes, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.sequence !== undefined) { + if (message.sequence !== BigInt(0)) { writer.uint32(8).uint64(message.sequence); } - if (message.timestamp !== undefined) { + if (message.timestamp !== BigInt(0)) { writer.uint32(16).uint64(message.timestamp); } - if (message.diversifier !== undefined) { + if (message.diversifier !== "") { writer.uint32(26).string(message.diversifier); } if (message.dataType !== 0) { @@ -1356,13 +1409,13 @@ export const SignBytes = { return message; }, fromJSON(object: any): SignBytes { - const obj = createBaseSignBytes(); - if (isSet(object.sequence)) obj.sequence = BigInt(object.sequence.toString()); - if (isSet(object.timestamp)) obj.timestamp = BigInt(object.timestamp.toString()); - if (isSet(object.diversifier)) obj.diversifier = String(object.diversifier); - if (isSet(object.dataType)) obj.dataType = dataTypeFromJSON(object.dataType); - if (isSet(object.data)) obj.data = bytesFromBase64(object.data); - return obj; + return { + sequence: isSet(object.sequence) ? BigInt(object.sequence.toString()) : BigInt(0), + timestamp: isSet(object.timestamp) ? BigInt(object.timestamp.toString()) : BigInt(0), + diversifier: isSet(object.diversifier) ? String(object.diversifier) : "", + dataType: isSet(object.dataType) ? dataTypeFromJSON(object.dataType) : -1, + data: isSet(object.data) ? bytesFromBase64(object.data) : new Uint8Array() + }; }, toJSON(message: SignBytes): JsonSafe<SignBytes> { const obj: any = {}; @@ -1375,12 +1428,8 @@ export const SignBytes = { }, fromPartial(object: DeepPartial<SignBytes>): SignBytes { const message = createBaseSignBytes(); - if (object.sequence !== undefined && object.sequence !== null) { - message.sequence = BigInt(object.sequence.toString()); - } - if (object.timestamp !== undefined && object.timestamp !== null) { - message.timestamp = BigInt(object.timestamp.toString()); - } + message.sequence = object.sequence !== undefined && object.sequence !== null ? BigInt(object.sequence.toString()) : BigInt(0); + message.timestamp = object.timestamp !== undefined && object.timestamp !== null ? BigInt(object.timestamp.toString()) : BigInt(0); message.diversifier = object.diversifier ?? ""; message.dataType = object.dataType ?? 0; message.data = object.data ?? new Uint8Array(); @@ -1475,7 +1524,7 @@ export const HeaderData = { if (message.newPubKey !== undefined) { Any.encode(message.newPubKey, writer.uint32(10).fork()).ldelim(); } - if (message.newDiversifier !== undefined) { + if (message.newDiversifier !== "") { writer.uint32(18).string(message.newDiversifier); } return writer; @@ -1501,10 +1550,10 @@ export const HeaderData = { return message; }, fromJSON(object: any): HeaderData { - const obj = createBaseHeaderData(); - if (isSet(object.newPubKey)) obj.newPubKey = Any.fromJSON(object.newPubKey); - if (isSet(object.newDiversifier)) obj.newDiversifier = String(object.newDiversifier); - return obj; + return { + newPubKey: isSet(object.newPubKey) ? Any.fromJSON(object.newPubKey) : undefined, + newDiversifier: isSet(object.newDiversifier) ? String(object.newDiversifier) : "" + }; }, toJSON(message: HeaderData): JsonSafe<HeaderData> { const obj: any = {}; @@ -1514,9 +1563,7 @@ export const HeaderData = { }, fromPartial(object: DeepPartial<HeaderData>): HeaderData { const message = createBaseHeaderData(); - if (object.newPubKey !== undefined && object.newPubKey !== null) { - message.newPubKey = Any.fromPartial(object.newPubKey); - } + message.newPubKey = object.newPubKey !== undefined && object.newPubKey !== null ? Any.fromPartial(object.newPubKey) : undefined; message.newDiversifier = object.newDiversifier ?? ""; return message; }, @@ -1614,10 +1661,10 @@ export const ClientStateData = { return message; }, fromJSON(object: any): ClientStateData { - const obj = createBaseClientStateData(); - if (isSet(object.path)) obj.path = bytesFromBase64(object.path); - if (isSet(object.clientState)) obj.clientState = Any.fromJSON(object.clientState); - return obj; + return { + path: isSet(object.path) ? bytesFromBase64(object.path) : new Uint8Array(), + clientState: isSet(object.clientState) ? Any.fromJSON(object.clientState) : undefined + }; }, toJSON(message: ClientStateData): JsonSafe<ClientStateData> { const obj: any = {}; @@ -1628,9 +1675,7 @@ export const ClientStateData = { fromPartial(object: DeepPartial<ClientStateData>): ClientStateData { const message = createBaseClientStateData(); message.path = object.path ?? new Uint8Array(); - if (object.clientState !== undefined && object.clientState !== null) { - message.clientState = Any.fromPartial(object.clientState); - } + message.clientState = object.clientState !== undefined && object.clientState !== null ? Any.fromPartial(object.clientState) : undefined; return message; }, fromSDK(object: ClientStateDataSDKType): ClientStateData { @@ -1727,10 +1772,10 @@ export const ConsensusStateData = { return message; }, fromJSON(object: any): ConsensusStateData { - const obj = createBaseConsensusStateData(); - if (isSet(object.path)) obj.path = bytesFromBase64(object.path); - if (isSet(object.consensusState)) obj.consensusState = Any.fromJSON(object.consensusState); - return obj; + return { + path: isSet(object.path) ? bytesFromBase64(object.path) : new Uint8Array(), + consensusState: isSet(object.consensusState) ? Any.fromJSON(object.consensusState) : undefined + }; }, toJSON(message: ConsensusStateData): JsonSafe<ConsensusStateData> { const obj: any = {}; @@ -1741,9 +1786,7 @@ export const ConsensusStateData = { fromPartial(object: DeepPartial<ConsensusStateData>): ConsensusStateData { const message = createBaseConsensusStateData(); message.path = object.path ?? new Uint8Array(); - if (object.consensusState !== undefined && object.consensusState !== null) { - message.consensusState = Any.fromPartial(object.consensusState); - } + message.consensusState = object.consensusState !== undefined && object.consensusState !== null ? Any.fromPartial(object.consensusState) : undefined; return message; }, fromSDK(object: ConsensusStateDataSDKType): ConsensusStateData { @@ -1840,10 +1883,10 @@ export const ConnectionStateData = { return message; }, fromJSON(object: any): ConnectionStateData { - const obj = createBaseConnectionStateData(); - if (isSet(object.path)) obj.path = bytesFromBase64(object.path); - if (isSet(object.connection)) obj.connection = ConnectionEnd.fromJSON(object.connection); - return obj; + return { + path: isSet(object.path) ? bytesFromBase64(object.path) : new Uint8Array(), + connection: isSet(object.connection) ? ConnectionEnd.fromJSON(object.connection) : undefined + }; }, toJSON(message: ConnectionStateData): JsonSafe<ConnectionStateData> { const obj: any = {}; @@ -1854,9 +1897,7 @@ export const ConnectionStateData = { fromPartial(object: DeepPartial<ConnectionStateData>): ConnectionStateData { const message = createBaseConnectionStateData(); message.path = object.path ?? new Uint8Array(); - if (object.connection !== undefined && object.connection !== null) { - message.connection = ConnectionEnd.fromPartial(object.connection); - } + message.connection = object.connection !== undefined && object.connection !== null ? ConnectionEnd.fromPartial(object.connection) : undefined; return message; }, fromSDK(object: ConnectionStateDataSDKType): ConnectionStateData { @@ -1953,10 +1994,10 @@ export const ChannelStateData = { return message; }, fromJSON(object: any): ChannelStateData { - const obj = createBaseChannelStateData(); - if (isSet(object.path)) obj.path = bytesFromBase64(object.path); - if (isSet(object.channel)) obj.channel = Channel.fromJSON(object.channel); - return obj; + return { + path: isSet(object.path) ? bytesFromBase64(object.path) : new Uint8Array(), + channel: isSet(object.channel) ? Channel.fromJSON(object.channel) : undefined + }; }, toJSON(message: ChannelStateData): JsonSafe<ChannelStateData> { const obj: any = {}; @@ -1967,9 +2008,7 @@ export const ChannelStateData = { fromPartial(object: DeepPartial<ChannelStateData>): ChannelStateData { const message = createBaseChannelStateData(); message.path = object.path ?? new Uint8Array(); - if (object.channel !== undefined && object.channel !== null) { - message.channel = Channel.fromPartial(object.channel); - } + message.channel = object.channel !== undefined && object.channel !== null ? Channel.fromPartial(object.channel) : undefined; return message; }, fromSDK(object: ChannelStateDataSDKType): ChannelStateData { @@ -2066,10 +2105,10 @@ export const PacketCommitmentData = { return message; }, fromJSON(object: any): PacketCommitmentData { - const obj = createBasePacketCommitmentData(); - if (isSet(object.path)) obj.path = bytesFromBase64(object.path); - if (isSet(object.commitment)) obj.commitment = bytesFromBase64(object.commitment); - return obj; + return { + path: isSet(object.path) ? bytesFromBase64(object.path) : new Uint8Array(), + commitment: isSet(object.commitment) ? bytesFromBase64(object.commitment) : new Uint8Array() + }; }, toJSON(message: PacketCommitmentData): JsonSafe<PacketCommitmentData> { const obj: any = {}; @@ -2177,10 +2216,10 @@ export const PacketAcknowledgementData = { return message; }, fromJSON(object: any): PacketAcknowledgementData { - const obj = createBasePacketAcknowledgementData(); - if (isSet(object.path)) obj.path = bytesFromBase64(object.path); - if (isSet(object.acknowledgement)) obj.acknowledgement = bytesFromBase64(object.acknowledgement); - return obj; + return { + path: isSet(object.path) ? bytesFromBase64(object.path) : new Uint8Array(), + acknowledgement: isSet(object.acknowledgement) ? bytesFromBase64(object.acknowledgement) : new Uint8Array() + }; }, toJSON(message: PacketAcknowledgementData): JsonSafe<PacketAcknowledgementData> { const obj: any = {}; @@ -2281,9 +2320,9 @@ export const PacketReceiptAbsenceData = { return message; }, fromJSON(object: any): PacketReceiptAbsenceData { - const obj = createBasePacketReceiptAbsenceData(); - if (isSet(object.path)) obj.path = bytesFromBase64(object.path); - return obj; + return { + path: isSet(object.path) ? bytesFromBase64(object.path) : new Uint8Array() + }; }, toJSON(message: PacketReceiptAbsenceData): JsonSafe<PacketReceiptAbsenceData> { const obj: any = {}; @@ -2356,7 +2395,7 @@ export const NextSequenceRecvData = { if (message.path.length !== 0) { writer.uint32(10).bytes(message.path); } - if (message.nextSeqRecv !== undefined) { + if (message.nextSeqRecv !== BigInt(0)) { writer.uint32(16).uint64(message.nextSeqRecv); } return writer; @@ -2382,10 +2421,10 @@ export const NextSequenceRecvData = { return message; }, fromJSON(object: any): NextSequenceRecvData { - const obj = createBaseNextSequenceRecvData(); - if (isSet(object.path)) obj.path = bytesFromBase64(object.path); - if (isSet(object.nextSeqRecv)) obj.nextSeqRecv = BigInt(object.nextSeqRecv.toString()); - return obj; + return { + path: isSet(object.path) ? bytesFromBase64(object.path) : new Uint8Array(), + nextSeqRecv: isSet(object.nextSeqRecv) ? BigInt(object.nextSeqRecv.toString()) : BigInt(0) + }; }, toJSON(message: NextSequenceRecvData): JsonSafe<NextSequenceRecvData> { const obj: any = {}; @@ -2396,9 +2435,7 @@ export const NextSequenceRecvData = { fromPartial(object: DeepPartial<NextSequenceRecvData>): NextSequenceRecvData { const message = createBaseNextSequenceRecvData(); message.path = object.path ?? new Uint8Array(); - if (object.nextSeqRecv !== undefined && object.nextSeqRecv !== null) { - message.nextSeqRecv = BigInt(object.nextSeqRecv.toString()); - } + message.nextSeqRecv = object.nextSeqRecv !== undefined && object.nextSeqRecv !== null ? BigInt(object.nextSeqRecv.toString()) : BigInt(0); return message; }, fromSDK(object: NextSequenceRecvDataSDKType): NextSequenceRecvData { diff --git a/__fixtures__/v-next/outputv4/ibc/lightclients/tendermint/v1/tendermint.ts b/__fixtures__/v-next/outputv4/ibc/lightclients/tendermint/v1/tendermint.ts index 638b4c0a82..50698fb012 100644 --- a/__fixtures__/v-next/outputv4/ibc/lightclients/tendermint/v1/tendermint.ts +++ b/__fixtures__/v-next/outputv4/ibc/lightclients/tendermint/v1/tendermint.ts @@ -1,13 +1,14 @@ -import { Duration, DurationSDKType } from "../../../../google/protobuf/duration.js"; -import { Height, HeightSDKType } from "../../../core/client/v1/client.js"; -import { ProofSpec, ProofSpecSDKType } from "../../../../confio/proofs.js"; -import { Timestamp, TimestampSDKType } from "../../../../google/protobuf/timestamp.js"; -import { MerkleRoot, MerkleRootSDKType } from "../../../core/commitment/v1/commitment.js"; -import { SignedHeader, SignedHeaderSDKType } from "../../../../tendermint/types/types.js"; -import { ValidatorSet, ValidatorSetSDKType } from "../../../../tendermint/types/validator.js"; -import { BinaryReader, BinaryWriter } from "../../../../binary.js"; -import { isSet, DeepPartial, toTimestamp, fromTimestamp, bytesFromBase64, base64FromBytes } from "../../../../helpers.js"; -import { JsonSafe } from "../../../../json-safe.js"; +import { Duration, DurationSDKType } from "../../../../google/protobuf/duration"; +import { Height, HeightSDKType } from "../../../core/client/v1/client"; +import { ProofSpec, ProofSpecSDKType } from "../../../../confio/proofs"; +import { Timestamp, TimestampSDKType } from "../../../../google/protobuf/timestamp"; +import { MerkleRoot, MerkleRootSDKType } from "../../../core/commitment/v1/commitment"; +import { SignedHeader, SignedHeaderSDKType } from "../../../../tendermint/types/types"; +import { ValidatorSet, ValidatorSetSDKType } from "../../../../tendermint/types/validator"; +import { BinaryReader, BinaryWriter } from "../../../../binary"; +import { isSet, DeepPartial, toTimestamp, fromTimestamp, bytesFromBase64, base64FromBytes } from "../../../../helpers"; +import { JsonSafe } from "../../../../json-safe"; +import { ComputedRef } from "vue"; export const protobufPackage = "ibc.lightclients.tendermint.v1"; /** * ClientState from Tendermint tracks the current validator set, latest height, @@ -52,6 +53,19 @@ export interface ClientState { */ allowUpdateAfterMisbehaviour: boolean; } +export interface ReactiveClientState { + chainId: ComputedRef<string>; + trustLevel: ComputedRef<Fraction>; + trustingPeriod: ComputedRef<Duration>; + unbondingPeriod: ComputedRef<Duration>; + maxClockDrift: ComputedRef<Duration>; + frozenHeight: ComputedRef<Height>; + latestHeight: ComputedRef<Height>; + proofSpecs: ComputedRef<ProofSpec[]>; + upgradePath: ComputedRef<string[]>; + allowUpdateAfterExpiry: ComputedRef<boolean>; + allowUpdateAfterMisbehaviour: ComputedRef<boolean>; +} export interface ClientStateProtoMsg { typeUrl: "/ibc.lightclients.tendermint.v1.ClientState"; value: Uint8Array; @@ -84,6 +98,11 @@ export interface ConsensusState { root: MerkleRoot; nextValidatorsHash: Uint8Array; } +export interface ReactiveConsensusState { + timestamp: ComputedRef<Date>; + root: ComputedRef<MerkleRoot>; + nextValidatorsHash: ComputedRef<Uint8Array>; +} export interface ConsensusStateProtoMsg { typeUrl: "/ibc.lightclients.tendermint.v1.ConsensusState"; value: Uint8Array; @@ -103,6 +122,11 @@ export interface Misbehaviour { header1?: Header; header2?: Header; } +export interface ReactiveMisbehaviour { + clientId: ComputedRef<string>; + header1?: ComputedRef<Header>; + header2?: ComputedRef<Header>; +} export interface MisbehaviourProtoMsg { typeUrl: "/ibc.lightclients.tendermint.v1.Misbehaviour"; value: Uint8Array; @@ -136,6 +160,12 @@ export interface Header { trustedHeight: Height; trustedValidators?: ValidatorSet; } +export interface ReactiveHeader { + signedHeader?: ComputedRef<SignedHeader>; + validatorSet?: ComputedRef<ValidatorSet>; + trustedHeight: ComputedRef<Height>; + trustedValidators?: ComputedRef<ValidatorSet>; +} export interface HeaderProtoMsg { typeUrl: "/ibc.lightclients.tendermint.v1.Header"; value: Uint8Array; @@ -168,6 +198,10 @@ export interface Fraction { numerator: bigint; denominator: bigint; } +export interface ReactiveFraction { + numerator: ComputedRef<bigint>; + denominator: ComputedRef<bigint>; +} export interface FractionProtoMsg { typeUrl: "/ibc.lightclients.tendermint.v1.Fraction"; value: Uint8Array; @@ -198,7 +232,7 @@ function createBaseClientState(): ClientState { export const ClientState = { typeUrl: "/ibc.lightclients.tendermint.v1.ClientState", encode(message: ClientState, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.chainId !== undefined) { + if (message.chainId !== "") { writer.uint32(10).string(message.chainId); } if (message.trustLevel !== undefined) { @@ -225,10 +259,10 @@ export const ClientState = { for (const v of message.upgradePath) { writer.uint32(74).string(v!); } - if (message.allowUpdateAfterExpiry !== undefined) { + if (message.allowUpdateAfterExpiry === true) { writer.uint32(80).bool(message.allowUpdateAfterExpiry); } - if (message.allowUpdateAfterMisbehaviour !== undefined) { + if (message.allowUpdateAfterMisbehaviour === true) { writer.uint32(88).bool(message.allowUpdateAfterMisbehaviour); } return writer; @@ -281,19 +315,19 @@ export const ClientState = { return message; }, fromJSON(object: any): ClientState { - const obj = createBaseClientState(); - if (isSet(object.chainId)) obj.chainId = String(object.chainId); - if (isSet(object.trustLevel)) obj.trustLevel = Fraction.fromJSON(object.trustLevel); - if (isSet(object.trustingPeriod)) obj.trustingPeriod = Duration.fromJSON(object.trustingPeriod); - if (isSet(object.unbondingPeriod)) obj.unbondingPeriod = Duration.fromJSON(object.unbondingPeriod); - if (isSet(object.maxClockDrift)) obj.maxClockDrift = Duration.fromJSON(object.maxClockDrift); - if (isSet(object.frozenHeight)) obj.frozenHeight = Height.fromJSON(object.frozenHeight); - if (isSet(object.latestHeight)) obj.latestHeight = Height.fromJSON(object.latestHeight); - if (Array.isArray(object?.proofSpecs)) obj.proofSpecs = object.proofSpecs.map((e: any) => ProofSpec.fromJSON(e)); - if (Array.isArray(object?.upgradePath)) obj.upgradePath = object.upgradePath.map((e: any) => String(e)); - if (isSet(object.allowUpdateAfterExpiry)) obj.allowUpdateAfterExpiry = Boolean(object.allowUpdateAfterExpiry); - if (isSet(object.allowUpdateAfterMisbehaviour)) obj.allowUpdateAfterMisbehaviour = Boolean(object.allowUpdateAfterMisbehaviour); - return obj; + return { + chainId: isSet(object.chainId) ? String(object.chainId) : "", + trustLevel: isSet(object.trustLevel) ? Fraction.fromJSON(object.trustLevel) : undefined, + trustingPeriod: isSet(object.trustingPeriod) ? Duration.fromJSON(object.trustingPeriod) : undefined, + unbondingPeriod: isSet(object.unbondingPeriod) ? Duration.fromJSON(object.unbondingPeriod) : undefined, + maxClockDrift: isSet(object.maxClockDrift) ? Duration.fromJSON(object.maxClockDrift) : undefined, + frozenHeight: isSet(object.frozenHeight) ? Height.fromJSON(object.frozenHeight) : undefined, + latestHeight: isSet(object.latestHeight) ? Height.fromJSON(object.latestHeight) : undefined, + proofSpecs: Array.isArray(object?.proofSpecs) ? object.proofSpecs.map((e: any) => ProofSpec.fromJSON(e)) : [], + upgradePath: Array.isArray(object?.upgradePath) ? object.upgradePath.map((e: any) => String(e)) : [], + allowUpdateAfterExpiry: isSet(object.allowUpdateAfterExpiry) ? Boolean(object.allowUpdateAfterExpiry) : false, + allowUpdateAfterMisbehaviour: isSet(object.allowUpdateAfterMisbehaviour) ? Boolean(object.allowUpdateAfterMisbehaviour) : false + }; }, toJSON(message: ClientState): JsonSafe<ClientState> { const obj: any = {}; @@ -321,24 +355,12 @@ export const ClientState = { fromPartial(object: DeepPartial<ClientState>): ClientState { const message = createBaseClientState(); message.chainId = object.chainId ?? ""; - if (object.trustLevel !== undefined && object.trustLevel !== null) { - message.trustLevel = Fraction.fromPartial(object.trustLevel); - } - if (object.trustingPeriod !== undefined && object.trustingPeriod !== null) { - message.trustingPeriod = Duration.fromPartial(object.trustingPeriod); - } - if (object.unbondingPeriod !== undefined && object.unbondingPeriod !== null) { - message.unbondingPeriod = Duration.fromPartial(object.unbondingPeriod); - } - if (object.maxClockDrift !== undefined && object.maxClockDrift !== null) { - message.maxClockDrift = Duration.fromPartial(object.maxClockDrift); - } - if (object.frozenHeight !== undefined && object.frozenHeight !== null) { - message.frozenHeight = Height.fromPartial(object.frozenHeight); - } - if (object.latestHeight !== undefined && object.latestHeight !== null) { - message.latestHeight = Height.fromPartial(object.latestHeight); - } + message.trustLevel = object.trustLevel !== undefined && object.trustLevel !== null ? Fraction.fromPartial(object.trustLevel) : undefined; + message.trustingPeriod = object.trustingPeriod !== undefined && object.trustingPeriod !== null ? Duration.fromPartial(object.trustingPeriod) : undefined; + message.unbondingPeriod = object.unbondingPeriod !== undefined && object.unbondingPeriod !== null ? Duration.fromPartial(object.unbondingPeriod) : undefined; + message.maxClockDrift = object.maxClockDrift !== undefined && object.maxClockDrift !== null ? Duration.fromPartial(object.maxClockDrift) : undefined; + message.frozenHeight = object.frozenHeight !== undefined && object.frozenHeight !== null ? Height.fromPartial(object.frozenHeight) : undefined; + message.latestHeight = object.latestHeight !== undefined && object.latestHeight !== null ? Height.fromPartial(object.latestHeight) : undefined; message.proofSpecs = object.proofSpecs?.map(e => ProofSpec.fromPartial(e)) || []; message.upgradePath = object.upgradePath?.map(e => e) || []; message.allowUpdateAfterExpiry = object.allowUpdateAfterExpiry ?? false; @@ -521,11 +543,11 @@ export const ConsensusState = { return message; }, fromJSON(object: any): ConsensusState { - const obj = createBaseConsensusState(); - if (isSet(object.timestamp)) obj.timestamp = new Date(object.timestamp); - if (isSet(object.root)) obj.root = MerkleRoot.fromJSON(object.root); - if (isSet(object.nextValidatorsHash)) obj.nextValidatorsHash = bytesFromBase64(object.nextValidatorsHash); - return obj; + return { + timestamp: isSet(object.timestamp) ? new Date(object.timestamp) : undefined, + root: isSet(object.root) ? MerkleRoot.fromJSON(object.root) : undefined, + nextValidatorsHash: isSet(object.nextValidatorsHash) ? bytesFromBase64(object.nextValidatorsHash) : new Uint8Array() + }; }, toJSON(message: ConsensusState): JsonSafe<ConsensusState> { const obj: any = {}; @@ -537,9 +559,7 @@ export const ConsensusState = { fromPartial(object: DeepPartial<ConsensusState>): ConsensusState { const message = createBaseConsensusState(); message.timestamp = object.timestamp ?? undefined; - if (object.root !== undefined && object.root !== null) { - message.root = MerkleRoot.fromPartial(object.root); - } + message.root = object.root !== undefined && object.root !== null ? MerkleRoot.fromPartial(object.root) : undefined; message.nextValidatorsHash = object.nextValidatorsHash ?? new Uint8Array(); return message; }, @@ -616,7 +636,7 @@ function createBaseMisbehaviour(): Misbehaviour { export const Misbehaviour = { typeUrl: "/ibc.lightclients.tendermint.v1.Misbehaviour", encode(message: Misbehaviour, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.clientId !== undefined) { + if (message.clientId !== "") { writer.uint32(10).string(message.clientId); } if (message.header1 !== undefined) { @@ -651,11 +671,11 @@ export const Misbehaviour = { return message; }, fromJSON(object: any): Misbehaviour { - const obj = createBaseMisbehaviour(); - if (isSet(object.clientId)) obj.clientId = String(object.clientId); - if (isSet(object.header1)) obj.header1 = Header.fromJSON(object.header1); - if (isSet(object.header2)) obj.header2 = Header.fromJSON(object.header2); - return obj; + return { + clientId: isSet(object.clientId) ? String(object.clientId) : "", + header1: isSet(object.header1) ? Header.fromJSON(object.header1) : undefined, + header2: isSet(object.header2) ? Header.fromJSON(object.header2) : undefined + }; }, toJSON(message: Misbehaviour): JsonSafe<Misbehaviour> { const obj: any = {}; @@ -667,12 +687,8 @@ export const Misbehaviour = { fromPartial(object: DeepPartial<Misbehaviour>): Misbehaviour { const message = createBaseMisbehaviour(); message.clientId = object.clientId ?? ""; - if (object.header1 !== undefined && object.header1 !== null) { - message.header1 = Header.fromPartial(object.header1); - } - if (object.header2 !== undefined && object.header2 !== null) { - message.header2 = Header.fromPartial(object.header2); - } + message.header1 = object.header1 !== undefined && object.header1 !== null ? Header.fromPartial(object.header1) : undefined; + message.header2 = object.header2 !== undefined && object.header2 !== null ? Header.fromPartial(object.header2) : undefined; return message; }, fromSDK(object: MisbehaviourSDKType): Misbehaviour { @@ -790,12 +806,12 @@ export const Header = { return message; }, fromJSON(object: any): Header { - const obj = createBaseHeader(); - if (isSet(object.signedHeader)) obj.signedHeader = SignedHeader.fromJSON(object.signedHeader); - if (isSet(object.validatorSet)) obj.validatorSet = ValidatorSet.fromJSON(object.validatorSet); - if (isSet(object.trustedHeight)) obj.trustedHeight = Height.fromJSON(object.trustedHeight); - if (isSet(object.trustedValidators)) obj.trustedValidators = ValidatorSet.fromJSON(object.trustedValidators); - return obj; + return { + signedHeader: isSet(object.signedHeader) ? SignedHeader.fromJSON(object.signedHeader) : undefined, + validatorSet: isSet(object.validatorSet) ? ValidatorSet.fromJSON(object.validatorSet) : undefined, + trustedHeight: isSet(object.trustedHeight) ? Height.fromJSON(object.trustedHeight) : undefined, + trustedValidators: isSet(object.trustedValidators) ? ValidatorSet.fromJSON(object.trustedValidators) : undefined + }; }, toJSON(message: Header): JsonSafe<Header> { const obj: any = {}; @@ -807,18 +823,10 @@ export const Header = { }, fromPartial(object: DeepPartial<Header>): Header { const message = createBaseHeader(); - if (object.signedHeader !== undefined && object.signedHeader !== null) { - message.signedHeader = SignedHeader.fromPartial(object.signedHeader); - } - if (object.validatorSet !== undefined && object.validatorSet !== null) { - message.validatorSet = ValidatorSet.fromPartial(object.validatorSet); - } - if (object.trustedHeight !== undefined && object.trustedHeight !== null) { - message.trustedHeight = Height.fromPartial(object.trustedHeight); - } - if (object.trustedValidators !== undefined && object.trustedValidators !== null) { - message.trustedValidators = ValidatorSet.fromPartial(object.trustedValidators); - } + message.signedHeader = object.signedHeader !== undefined && object.signedHeader !== null ? SignedHeader.fromPartial(object.signedHeader) : undefined; + message.validatorSet = object.validatorSet !== undefined && object.validatorSet !== null ? ValidatorSet.fromPartial(object.validatorSet) : undefined; + message.trustedHeight = object.trustedHeight !== undefined && object.trustedHeight !== null ? Height.fromPartial(object.trustedHeight) : undefined; + message.trustedValidators = object.trustedValidators !== undefined && object.trustedValidators !== null ? ValidatorSet.fromPartial(object.trustedValidators) : undefined; return message; }, fromSDK(object: HeaderSDKType): Header { @@ -900,10 +908,10 @@ function createBaseFraction(): Fraction { export const Fraction = { typeUrl: "/ibc.lightclients.tendermint.v1.Fraction", encode(message: Fraction, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.numerator !== undefined) { + if (message.numerator !== BigInt(0)) { writer.uint32(8).uint64(message.numerator); } - if (message.denominator !== undefined) { + if (message.denominator !== BigInt(0)) { writer.uint32(16).uint64(message.denominator); } return writer; @@ -929,10 +937,10 @@ export const Fraction = { return message; }, fromJSON(object: any): Fraction { - const obj = createBaseFraction(); - if (isSet(object.numerator)) obj.numerator = BigInt(object.numerator.toString()); - if (isSet(object.denominator)) obj.denominator = BigInt(object.denominator.toString()); - return obj; + return { + numerator: isSet(object.numerator) ? BigInt(object.numerator.toString()) : BigInt(0), + denominator: isSet(object.denominator) ? BigInt(object.denominator.toString()) : BigInt(0) + }; }, toJSON(message: Fraction): JsonSafe<Fraction> { const obj: any = {}; @@ -942,12 +950,8 @@ export const Fraction = { }, fromPartial(object: DeepPartial<Fraction>): Fraction { const message = createBaseFraction(); - if (object.numerator !== undefined && object.numerator !== null) { - message.numerator = BigInt(object.numerator.toString()); - } - if (object.denominator !== undefined && object.denominator !== null) { - message.denominator = BigInt(object.denominator.toString()); - } + message.numerator = object.numerator !== undefined && object.numerator !== null ? BigInt(object.numerator.toString()) : BigInt(0); + message.denominator = object.denominator !== undefined && object.denominator !== null ? BigInt(object.denominator.toString()) : BigInt(0); return message; }, fromSDK(object: FractionSDKType): Fraction { diff --git a/__fixtures__/v-next/outputv4/ibc/rpc.query.ts b/__fixtures__/v-next/outputv4/ibc/rpc.query.ts index 6a632ee738..8ed4c6c328 100644 --- a/__fixtures__/v-next/outputv4/ibc/rpc.query.ts +++ b/__fixtures__/v-next/outputv4/ibc/rpc.query.ts @@ -1,92 +1,106 @@ -import { Rpc } from "../helpers.js"; -import { connectComet, HttpEndpoint } from "@cosmjs/tendermint-rpc"; +import { Rpc } from "../helpers"; +import { Tendermint34Client, HttpEndpoint } from "@cosmjs/tendermint-rpc"; import { QueryClient } from "@cosmjs/stargate"; export const createRPCQueryClient = async ({ rpcEndpoint }: { rpcEndpoint: string | HttpEndpoint; }) => { - const tmClient = await connectComet(rpcEndpoint); + const tmClient = await Tendermint34Client.connect(rpcEndpoint); const client = new QueryClient(tmClient); return { cosmos: { app: { - v1alpha1: (await import("../cosmos/app/v1alpha1/query.rpc.Query.js")).createRpcQueryExtension(client) + v1alpha1: (await import("../cosmos/app/v1alpha1/query.rpc.Query")).createRpcQueryExtension(client) }, auth: { - v1beta1: (await import("../cosmos/auth/v1beta1/query.rpc.Query.js")).createRpcQueryExtension(client) + v1beta1: (await import("../cosmos/auth/v1beta1/query.rpc.Query")).createRpcQueryExtension(client) }, authz: { - v1beta1: (await import("../cosmos/authz/v1beta1/query.rpc.Query.js")).createRpcQueryExtension(client) + v1beta1: (await import("../cosmos/authz/v1beta1/query.rpc.Query")).createRpcQueryExtension(client) }, bank: { - v1beta1: (await import("../cosmos/bank/v1beta1/query.rpc.Query.js")).createRpcQueryExtension(client) + v1beta1: (await import("../cosmos/bank/v1beta1/query.rpc.Query")).createRpcQueryExtension(client) }, base: { reflection: { - 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) + v1beta1: (await import("../cosmos/base/reflection/v1beta1/reflection.rpc.ReflectionService")).createRpcQueryExtension(client), + v2alpha1: (await import("../cosmos/base/reflection/v2alpha1/reflection.rpc.ReflectionService")).createRpcQueryExtension(client) }, tendermint: { - v1beta1: (await import("../cosmos/base/tendermint/v1beta1/query.rpc.Service.js")).createRpcQueryExtension(client) + 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) } }, distribution: { - v1beta1: (await import("../cosmos/distribution/v1beta1/query.rpc.Query.js")).createRpcQueryExtension(client) + v1beta1: (await import("../cosmos/distribution/v1beta1/query.rpc.Query")).createRpcQueryExtension(client) }, evidence: { - v1beta1: (await import("../cosmos/evidence/v1beta1/query.rpc.Query.js")).createRpcQueryExtension(client) + v1beta1: (await import("../cosmos/evidence/v1beta1/query.rpc.Query")).createRpcQueryExtension(client) }, feegrant: { - v1beta1: (await import("../cosmos/feegrant/v1beta1/query.rpc.Query.js")).createRpcQueryExtension(client) + v1beta1: (await import("../cosmos/feegrant/v1beta1/query.rpc.Query")).createRpcQueryExtension(client) }, gov: { - v1: (await import("../cosmos/gov/v1/query.rpc.Query.js")).createRpcQueryExtension(client), - v1beta1: (await import("../cosmos/gov/v1beta1/query.rpc.Query.js")).createRpcQueryExtension(client) + v1: (await import("../cosmos/gov/v1/query.rpc.Query")).createRpcQueryExtension(client), + v1beta1: (await import("../cosmos/gov/v1beta1/query.rpc.Query")).createRpcQueryExtension(client) }, group: { - v1: (await import("../cosmos/group/v1/query.rpc.Query.js")).createRpcQueryExtension(client) + v1: (await import("../cosmos/group/v1/query.rpc.Query")).createRpcQueryExtension(client) }, mint: { - v1beta1: (await import("../cosmos/mint/v1beta1/query.rpc.Query.js")).createRpcQueryExtension(client) + v1beta1: (await import("../cosmos/mint/v1beta1/query.rpc.Query")).createRpcQueryExtension(client) }, nft: { - v1beta1: (await import("../cosmos/nft/v1beta1/query.rpc.Query.js")).createRpcQueryExtension(client) + v1beta1: (await import("../cosmos/nft/v1beta1/query.rpc.Query")).createRpcQueryExtension(client) }, params: { - v1beta1: (await import("../cosmos/params/v1beta1/query.rpc.Query.js")).createRpcQueryExtension(client) + v1beta1: (await import("../cosmos/params/v1beta1/query.rpc.Query")).createRpcQueryExtension(client) }, slashing: { - v1beta1: (await import("../cosmos/slashing/v1beta1/query.rpc.Query.js")).createRpcQueryExtension(client) + v1beta1: (await import("../cosmos/slashing/v1beta1/query.rpc.Query")).createRpcQueryExtension(client) }, staking: { - v1beta1: (await import("../cosmos/staking/v1beta1/query.rpc.Query.js")).createRpcQueryExtension(client) + v1beta1: (await import("../cosmos/staking/v1beta1/query.rpc.Query")).createRpcQueryExtension(client) }, tx: { - v1beta1: (await import("../cosmos/tx/v1beta1/service.rpc.Service.js")).createRpcQueryExtension(client) + v1beta1: (await import("../cosmos/tx/v1beta1/service.rpc.Service")).createRpcQueryExtension(client) }, upgrade: { - v1beta1: (await import("../cosmos/upgrade/v1beta1/query.rpc.Query.js")).createRpcQueryExtension(client) + v1beta1: (await import("../cosmos/upgrade/v1beta1/query.rpc.Query")).createRpcQueryExtension(client) } }, ibc: { applications: { transfer: { - v1: (await import("./applications/transfer/v1/query.rpc.Query.js")).createRpcQueryExtension(client) + v1: (await import("./applications/transfer/v1/query.rpc.Query")).createRpcQueryExtension(client) + }, + fee: { + v1: (await import("./applications/fee/v1/query.rpc.Query")).createRpcQueryExtension(client) + }, + interchain_accounts: { + controller: { + v1: (await import("./applications/interchain_accounts/controller/v1/query.rpc.Query")).createRpcQueryExtension(client) + }, + host: { + v1: (await import("./applications/interchain_accounts/host/v1/query.rpc.Query")).createRpcQueryExtension(client) + } } }, core: { channel: { - v1: (await import("./core/channel/v1/query.rpc.Query.js")).createRpcQueryExtension(client) + v1: (await import("./core/channel/v1/query.rpc.Query")).createRpcQueryExtension(client) }, client: { - v1: (await import("./core/client/v1/query.rpc.Query.js")).createRpcQueryExtension(client) + v1: (await import("./core/client/v1/query.rpc.Query")).createRpcQueryExtension(client) }, connection: { - v1: (await import("./core/connection/v1/query.rpc.Query.js")).createRpcQueryExtension(client) + v1: (await import("./core/connection/v1/query.rpc.Query")).createRpcQueryExtension(client) }, port: { - v1: (await import("./core/port/v1/query.rpc.Query.js")).createRpcQueryExtension(client) + v1: (await import("./core/port/v1/query.rpc.Query")).createRpcQueryExtension(client) } } } diff --git a/__fixtures__/v-next/outputv4/ibc/rpc.tx.ts b/__fixtures__/v-next/outputv4/ibc/rpc.tx.ts index 2747de45d8..9153173b70 100644 --- a/__fixtures__/v-next/outputv4/ibc/rpc.tx.ts +++ b/__fixtures__/v-next/outputv4/ibc/rpc.tx.ts @@ -1,4 +1,4 @@ -import { Rpc } from "../helpers.js"; +import { Rpc } from "../helpers"; export const createRPCMsgClient = async ({ rpc }: { @@ -6,61 +6,69 @@ export const createRPCMsgClient = async ({ }) => ({ cosmos: { authz: { - v1beta1: new (await import("../cosmos/authz/v1beta1/tx.rpc.msg.js")).MsgClientImpl(rpc) + v1beta1: new (await import("../cosmos/authz/v1beta1/tx.rpc.msg")).MsgClientImpl(rpc) }, bank: { - v1beta1: new (await import("../cosmos/bank/v1beta1/tx.rpc.msg.js")).MsgClientImpl(rpc) + v1beta1: new (await import("../cosmos/bank/v1beta1/tx.rpc.msg")).MsgClientImpl(rpc) }, crisis: { - v1beta1: new (await import("../cosmos/crisis/v1beta1/tx.rpc.msg.js")).MsgClientImpl(rpc) + v1beta1: new (await import("../cosmos/crisis/v1beta1/tx.rpc.msg")).MsgClientImpl(rpc) }, distribution: { - v1beta1: new (await import("../cosmos/distribution/v1beta1/tx.rpc.msg.js")).MsgClientImpl(rpc) + v1beta1: new (await import("../cosmos/distribution/v1beta1/tx.rpc.msg")).MsgClientImpl(rpc) }, evidence: { - v1beta1: new (await import("../cosmos/evidence/v1beta1/tx.rpc.msg.js")).MsgClientImpl(rpc) + v1beta1: new (await import("../cosmos/evidence/v1beta1/tx.rpc.msg")).MsgClientImpl(rpc) }, feegrant: { - v1beta1: new (await import("../cosmos/feegrant/v1beta1/tx.rpc.msg.js")).MsgClientImpl(rpc) + v1beta1: new (await import("../cosmos/feegrant/v1beta1/tx.rpc.msg")).MsgClientImpl(rpc) }, gov: { - 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) + v1: new (await import("../cosmos/gov/v1/tx.rpc.msg")).MsgClientImpl(rpc), + v1beta1: new (await import("../cosmos/gov/v1beta1/tx.rpc.msg")).MsgClientImpl(rpc) }, group: { - v1: new (await import("../cosmos/group/v1/tx.rpc.msg.js")).MsgClientImpl(rpc) + v1: new (await import("../cosmos/group/v1/tx.rpc.msg")).MsgClientImpl(rpc) }, nft: { - v1beta1: new (await import("../cosmos/nft/v1beta1/tx.rpc.msg.js")).MsgClientImpl(rpc) + v1beta1: new (await import("../cosmos/nft/v1beta1/tx.rpc.msg")).MsgClientImpl(rpc) }, slashing: { - v1beta1: new (await import("../cosmos/slashing/v1beta1/tx.rpc.msg.js")).MsgClientImpl(rpc) + v1beta1: new (await import("../cosmos/slashing/v1beta1/tx.rpc.msg")).MsgClientImpl(rpc) }, staking: { - v1beta1: new (await import("../cosmos/staking/v1beta1/tx.rpc.msg.js")).MsgClientImpl(rpc) + v1beta1: new (await import("../cosmos/staking/v1beta1/tx.rpc.msg")).MsgClientImpl(rpc) }, upgrade: { - v1beta1: new (await import("../cosmos/upgrade/v1beta1/tx.rpc.msg.js")).MsgClientImpl(rpc) + v1beta1: new (await import("../cosmos/upgrade/v1beta1/tx.rpc.msg")).MsgClientImpl(rpc) }, vesting: { - v1beta1: new (await import("../cosmos/vesting/v1beta1/tx.rpc.msg.js")).MsgClientImpl(rpc) + v1beta1: new (await import("../cosmos/vesting/v1beta1/tx.rpc.msg")).MsgClientImpl(rpc) } }, ibc: { applications: { transfer: { - v1: new (await import("./applications/transfer/v1/tx.rpc.msg.js")).MsgClientImpl(rpc) + v1: new (await import("./applications/transfer/v1/tx.rpc.msg")).MsgClientImpl(rpc) + }, + fee: { + v1: new (await import("./applications/fee/v1/tx.rpc.msg")).MsgClientImpl(rpc) + }, + interchain_accounts: { + controller: { + v1: new (await import("./applications/interchain_accounts/controller/v1/tx.rpc.msg")).MsgClientImpl(rpc) + } } }, core: { channel: { - v1: new (await import("./core/channel/v1/tx.rpc.msg.js")).MsgClientImpl(rpc) + v1: new (await import("./core/channel/v1/tx.rpc.msg")).MsgClientImpl(rpc) }, client: { - v1: new (await import("./core/client/v1/tx.rpc.msg.js")).MsgClientImpl(rpc) + v1: new (await import("./core/client/v1/tx.rpc.msg")).MsgClientImpl(rpc) }, connection: { - v1: new (await import("./core/connection/v1/tx.rpc.msg.js")).MsgClientImpl(rpc) + v1: new (await import("./core/connection/v1/tx.rpc.msg")).MsgClientImpl(rpc) } } } diff --git a/__fixtures__/v-next/outputv4/ics23/bundle.ts b/__fixtures__/v-next/outputv4/ics23/bundle.ts index 3ce5856448..148f7764f3 100644 --- a/__fixtures__/v-next/outputv4/ics23/bundle.ts +++ b/__fixtures__/v-next/outputv4/ics23/bundle.ts @@ -1,4 +1,4 @@ -import * as _53 from "../confio/proofs.js"; +import * as _53 from "../confio/proofs"; export const ics23 = { ..._53 }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv4/index.ts b/__fixtures__/v-next/outputv4/index.ts index b0cfcf1ba6..8f09bda17c 100644 --- a/__fixtures__/v-next/outputv4/index.ts +++ b/__fixtures__/v-next/outputv4/index.ts @@ -4,31 +4,28 @@ * and run the transpile command or npm scripts command that is used to regenerate this bundle. */ -export * from "./akash/bundle.js"; -export * from "./akash/client.js"; -export * from "./ics23/bundle.js"; -export * from "./cosmos_proto/bundle.js"; -export * from "./cosmos/bundle.js"; -export * from "./cosmos/client.js"; -export * from "./cosmwasm/bundle.js"; -export * from "./cosmwasm/client.js"; -export * from "./evmos/bundle.js"; -export * from "./evmos/client.js"; -export * from "./gogoproto/bundle.js"; -export * from "./google/bundle.js"; -export * from "./ibc/bundle.js"; -export * from "./ibc/client.js"; -export * from "./osmosis/bundle.js"; -export * from "./osmosis/client.js"; -export * from "./tendermint/bundle.js"; -export * from "./hooks.js"; -export * from "./mobx.stores.js"; -export * from "./extern.js"; -export * from "./react-query.js"; -export * from "./mobx.js"; -export * from "./pinia-endpoint.js"; -export * from "./json-safe.js"; -export * from "./varint.js"; -export * from "./utf8.js"; -export * from "./binary.js"; -export * from "./pinia.store.js"; \ No newline at end of file +export * from "./akash/bundle"; +export * from "./akash/client"; +export * from "./ics23/bundle"; +export * from "./cosmos_proto/bundle"; +export * from "./cosmos/bundle"; +export * from "./cosmos/client"; +export * from "./cosmwasm/bundle"; +export * from "./cosmwasm/client"; +export * from "./evmos/bundle"; +export * from "./evmos/client"; +export * from "./gogoproto/bundle"; +export * from "./google/bundle"; +export * from "./ibc/bundle"; +export * from "./ibc/client"; +export * from "./osmosis/bundle"; +export * from "./osmosis/client"; +export * from "./tendermint/bundle"; +export * from "./amino/bundle"; +export * from "./capability/bundle"; +export * from "./extern"; +export * from "./vue-query"; +export * from "./json-safe"; +export * from "./varint"; +export * from "./utf8"; +export * from "./binary"; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv4/osmosis/agg-lcd.ts b/__fixtures__/v-next/outputv4/osmosis/agg-lcd.ts index f90b9d5a8d..c454c2fe60 100644 --- a/__fixtures__/v-next/outputv4/osmosis/agg-lcd.ts +++ b/__fixtures__/v-next/outputv4/osmosis/agg-lcd.ts @@ -1,12 +1,12 @@ -import { Coin, CoinSDKType } from "../cosmos/base/v1beta1/coin.js"; +import { Coin, CoinSDKType } from "../cosmos/base/v1beta1/coin"; import { LCDClient } from "@cosmology/lcd"; -import { setPaginationParams } from "../helpers.js"; -import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../cosmos/base/query/v1beta1/pagination.js"; -import { SwapAmountInRoute, SwapAmountOutRoute, SwapAmountInRouteSDKType, SwapAmountOutRouteSDKType } from "./gamm/v1beta1/tx.js"; -import { Params, ParamsSDKType, Metadata, MetadataSDKType } from "../cosmos/bank/v1beta1/bank.js"; -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 "../cosmos/bank/v1beta1/query.js"; -import { Any, AnySDKType } from "../google/protobuf/any.js"; -import { QueryPoolsRequest, QueryPoolsRequestSDKType, QueryPoolsResponse, QueryPoolsResponseSDKType, QueryNumPoolsRequest, QueryNumPoolsRequestSDKType, QueryNumPoolsResponse, QueryNumPoolsResponseSDKType, QueryTotalLiquidityRequest, QueryTotalLiquidityRequestSDKType, QueryTotalLiquidityResponse, QueryTotalLiquidityResponseSDKType, QueryPoolsWithFilterRequest, QueryPoolsWithFilterRequestSDKType, QueryPoolsWithFilterResponse, QueryPoolsWithFilterResponseSDKType, QueryPoolRequest, QueryPoolRequestSDKType, QueryPoolResponse, QueryPoolResponseSDKType, QueryPoolTypeRequest, QueryPoolTypeRequestSDKType, QueryPoolTypeResponse, QueryPoolTypeResponseSDKType, QueryCalcJoinPoolNoSwapSharesRequest, QueryCalcJoinPoolNoSwapSharesRequestSDKType, QueryCalcJoinPoolNoSwapSharesResponse, QueryCalcJoinPoolNoSwapSharesResponseSDKType, QueryCalcJoinPoolSharesRequest, QueryCalcJoinPoolSharesRequestSDKType, QueryCalcJoinPoolSharesResponse, QueryCalcJoinPoolSharesResponseSDKType, QueryCalcExitPoolCoinsFromSharesRequest, QueryCalcExitPoolCoinsFromSharesRequestSDKType, QueryCalcExitPoolCoinsFromSharesResponse, QueryCalcExitPoolCoinsFromSharesResponseSDKType, QueryPoolParamsRequest, QueryPoolParamsRequestSDKType, QueryPoolParamsResponse, QueryPoolParamsResponseSDKType, QueryTotalPoolLiquidityRequest, QueryTotalPoolLiquidityRequestSDKType, QueryTotalPoolLiquidityResponse, QueryTotalPoolLiquidityResponseSDKType, QueryTotalSharesRequest, QueryTotalSharesRequestSDKType, QueryTotalSharesResponse, QueryTotalSharesResponseSDKType, QuerySpotPriceRequest, QuerySpotPriceRequestSDKType, QuerySpotPriceResponse, QuerySpotPriceResponseSDKType, QuerySwapExactAmountInRequest, QuerySwapExactAmountInRequestSDKType, QuerySwapExactAmountInResponse, QuerySwapExactAmountInResponseSDKType, QuerySwapExactAmountOutRequest, QuerySwapExactAmountOutRequestSDKType, QuerySwapExactAmountOutResponse, QuerySwapExactAmountOutResponseSDKType } from "./gamm/v1beta1/query.js"; +import { setPaginationParams } from "../helpers"; +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../cosmos/base/query/v1beta1/pagination"; +import { SwapAmountInRoute, SwapAmountOutRoute, SwapAmountInRouteSDKType, SwapAmountOutRouteSDKType } from "./gamm/v1beta1/tx"; +import { Params, ParamsSDKType, Metadata, MetadataSDKType } from "../cosmos/bank/v1beta1/bank"; +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 "../cosmos/bank/v1beta1/query"; +import { Any, AnySDKType } from "../google/protobuf/any"; +import { QueryPoolsRequest, QueryPoolsRequestSDKType, QueryPoolsResponse, QueryPoolsResponseSDKType, QueryNumPoolsRequest, QueryNumPoolsRequestSDKType, QueryNumPoolsResponse, QueryNumPoolsResponseSDKType, QueryTotalLiquidityRequest, QueryTotalLiquidityRequestSDKType, QueryTotalLiquidityResponse, QueryTotalLiquidityResponseSDKType, QueryPoolsWithFilterRequest, QueryPoolsWithFilterRequestSDKType, QueryPoolsWithFilterResponse, QueryPoolsWithFilterResponseSDKType, QueryPoolRequest, QueryPoolRequestSDKType, QueryPoolResponse, QueryPoolResponseSDKType, QueryPoolTypeRequest, QueryPoolTypeRequestSDKType, QueryPoolTypeResponse, QueryPoolTypeResponseSDKType, QueryCalcJoinPoolNoSwapSharesRequest, QueryCalcJoinPoolNoSwapSharesRequestSDKType, QueryCalcJoinPoolNoSwapSharesResponse, QueryCalcJoinPoolNoSwapSharesResponseSDKType, QueryCalcJoinPoolSharesRequest, QueryCalcJoinPoolSharesRequestSDKType, QueryCalcJoinPoolSharesResponse, QueryCalcJoinPoolSharesResponseSDKType, QueryCalcExitPoolCoinsFromSharesRequest, QueryCalcExitPoolCoinsFromSharesRequestSDKType, QueryCalcExitPoolCoinsFromSharesResponse, QueryCalcExitPoolCoinsFromSharesResponseSDKType, QueryPoolParamsRequest, QueryPoolParamsRequestSDKType, QueryPoolParamsResponse, QueryPoolParamsResponseSDKType, QueryTotalPoolLiquidityRequest, QueryTotalPoolLiquidityRequestSDKType, QueryTotalPoolLiquidityResponse, QueryTotalPoolLiquidityResponseSDKType, QueryTotalSharesRequest, QueryTotalSharesRequestSDKType, QueryTotalSharesResponse, QueryTotalSharesResponseSDKType, QuerySpotPriceRequest, QuerySpotPriceRequestSDKType, QuerySpotPriceResponse, QuerySpotPriceResponseSDKType, QuerySwapExactAmountInRequest, QuerySwapExactAmountInRequestSDKType, QuerySwapExactAmountInResponse, QuerySwapExactAmountInResponseSDKType, QuerySwapExactAmountOutRequest, QuerySwapExactAmountOutRequestSDKType, QuerySwapExactAmountOutResponse, QuerySwapExactAmountOutResponseSDKType } from "./gamm/v1beta1/query"; export class QueryClient { req: LCDClient; constructor({ @@ -52,7 +52,7 @@ export class QueryClient { } /* TotalSupply queries the total supply of all coins. */ async totalSupply(params: QueryTotalSupplyRequest = { - pagination: PageRequest.fromPartial({}) + pagination: undefined }): Promise<QueryTotalSupplyResponseSDKType> { const options: any = { params: {} @@ -87,7 +87,7 @@ export class QueryClient { /* DenomsMetadata queries the client metadata for all registered coin denominations. */ async denomsMetadata(params: QueryDenomsMetadataRequest = { - pagination: PageRequest.fromPartial({}) + pagination: undefined }): Promise<QueryDenomsMetadataResponseSDKType> { const options: any = { params: {} @@ -112,7 +112,7 @@ export class QueryClient { } /* Pools */ async pools(params: QueryPoolsRequest = { - pagination: PageRequest.fromPartial({}) + pagination: undefined }): Promise<QueryPoolsResponseSDKType> { const options: any = { params: {} diff --git a/__fixtures__/v-next/outputv4/osmosis/bundle.ts b/__fixtures__/v-next/outputv4/osmosis/bundle.ts index 730e500d00..d2d093d9e2 100644 --- a/__fixtures__/v-next/outputv4/osmosis/bundle.ts +++ b/__fixtures__/v-next/outputv4/osmosis/bundle.ts @@ -1,270 +1,394 @@ -import * as _254 from "./claim/v1beta1/claim.js"; -import * as _255 from "./claim/v1beta1/genesis.js"; -import * as _256 from "./claim/v1beta1/params.js"; -import * as _257 from "./claim/v1beta1/query.js"; -import * as _258 from "./epochs/genesis.js"; -import * as _259 from "./epochs/query.js"; -import * as _260 from "./gamm/pool-models/balancer/balancerPool.js"; -import * as _261 from "./gamm/v1beta1/genesis.js"; -import * as _262 from "./gamm/v1beta1/query.js"; -import * as _263 from "./gamm/v1beta1/tx.js"; -import * as _264 from "./gamm/pool-models/balancer/tx/tx.js"; -import * as _265 from "./gamm/pool-models/stableswap/stableswap_pool.js"; -import * as _266 from "./gamm/pool-models/stableswap/tx.js"; -import * as _267 from "./gamm/v2/query.js"; -import * as _268 from "./ibc-rate-limit/v1beta1/params.js"; -import * as _269 from "./ibc-rate-limit/v1beta1/query.js"; -import * as _270 from "./incentives/gauge.js"; -import * as _271 from "./incentives/genesis.js"; -import * as _272 from "./incentives/params.js"; -import * as _273 from "./incentives/query.js"; -import * as _274 from "./incentives/tx.js"; -import * as _275 from "./lockup/genesis.js"; -import * as _276 from "./lockup/lock.js"; -import * as _277 from "./lockup/params.js"; -import * as _278 from "./lockup/query.js"; -import * as _279 from "./lockup/tx.js"; -import * as _280 from "./mint/v1beta1/genesis.js"; -import * as _281 from "./mint/v1beta1/mint.js"; -import * as _282 from "./mint/v1beta1/query.js"; -import * as _283 from "./pool-incentives/v1beta1/genesis.js"; -import * as _284 from "./pool-incentives/v1beta1/gov.js"; -import * as _285 from "./pool-incentives/v1beta1/incentives.js"; -import * as _286 from "./pool-incentives/v1beta1/query.js"; -import * as _287 from "./sumtree/v1beta1/tree.js"; -import * as _288 from "./superfluid/genesis.js"; -import * as _289 from "./superfluid/params.js"; -import * as _290 from "./superfluid/query.js"; -import * as _291 from "./superfluid/superfluid.js"; -import * as _292 from "./superfluid/tx.js"; -import * as _293 from "./tokenfactory/v1beta1/authorityMetadata.js"; -import * as _294 from "./tokenfactory/v1beta1/genesis.js"; -import * as _295 from "./tokenfactory/v1beta1/params.js"; -import * as _296 from "./tokenfactory/v1beta1/query.js"; -import * as _297 from "./tokenfactory/v1beta1/tx.js"; -import * as _298 from "./twap/v1beta1/genesis.js"; -import * as _299 from "./twap/v1beta1/query.js"; -import * as _300 from "./twap/v1beta1/twap_record.js"; -import * as _301 from "./txfees/v1beta1/feetoken.js"; -import * as _302 from "./txfees/v1beta1/genesis.js"; -import * as _303 from "./txfees/v1beta1/gov.js"; -import * as _304 from "./txfees/v1beta1/query.js"; -import * as _486 from "./gamm/pool-models/balancer/tx/tx.amino.js"; -import * as _487 from "./gamm/pool-models/stableswap/tx.amino.js"; -import * as _488 from "./gamm/v1beta1/tx.amino.js"; -import * as _489 from "./incentives/tx.amino.js"; -import * as _490 from "./lockup/tx.amino.js"; -import * as _491 from "./superfluid/tx.amino.js"; -import * as _492 from "./tokenfactory/v1beta1/tx.amino.js"; -import * as _493 from "./gamm/pool-models/balancer/tx/tx.registry.js"; -import * as _494 from "./gamm/pool-models/stableswap/tx.registry.js"; -import * as _495 from "./gamm/v1beta1/tx.registry.js"; -import * as _496 from "./incentives/tx.registry.js"; -import * as _497 from "./lockup/tx.registry.js"; -import * as _498 from "./superfluid/tx.registry.js"; -import * as _499 from "./tokenfactory/v1beta1/tx.registry.js"; -import * as _500 from "./claim/v1beta1/query.lcd.js"; -import * as _501 from "./epochs/query.lcd.js"; -import * as _502 from "./gamm/v1beta1/query.lcd.js"; -import * as _503 from "./gamm/v2/query.lcd.js"; -import * as _504 from "./ibc-rate-limit/v1beta1/query.lcd.js"; -import * as _505 from "./incentives/query.lcd.js"; -import * as _506 from "./lockup/query.lcd.js"; -import * as _507 from "./mint/v1beta1/query.lcd.js"; -import * as _508 from "./pool-incentives/v1beta1/query.lcd.js"; -import * as _509 from "./superfluid/query.lcd.js"; -import * as _510 from "./tokenfactory/v1beta1/query.lcd.js"; -import * as _511 from "./twap/v1beta1/query.lcd.js"; -import * as _512 from "./txfees/v1beta1/query.lcd.js"; -import * as _513 from "./claim/v1beta1/query.rpc.Query.js"; -import * as _514 from "./epochs/query.rpc.Query.js"; -import * as _515 from "./gamm/v1beta1/query.rpc.Query.js"; -import * as _516 from "./gamm/v2/query.rpc.Query.js"; -import * as _517 from "./ibc-rate-limit/v1beta1/query.rpc.Query.js"; -import * as _518 from "./incentives/query.rpc.Query.js"; -import * as _519 from "./lockup/query.rpc.Query.js"; -import * as _520 from "./mint/v1beta1/query.rpc.Query.js"; -import * as _521 from "./pool-incentives/v1beta1/query.rpc.Query.js"; -import * as _522 from "./superfluid/query.rpc.Query.js"; -import * as _523 from "./tokenfactory/v1beta1/query.rpc.Query.js"; -import * as _524 from "./twap/v1beta1/query.rpc.Query.js"; -import * as _525 from "./txfees/v1beta1/query.rpc.Query.js"; -import * as _526 from "./gamm/pool-models/balancer/tx/tx.rpc.msg.js"; -import * as _527 from "./gamm/pool-models/stableswap/tx.rpc.msg.js"; -import * as _528 from "./gamm/v1beta1/tx.rpc.msg.js"; -import * as _529 from "./incentives/tx.rpc.msg.js"; -import * as _530 from "./lockup/tx.rpc.msg.js"; -import * as _531 from "./superfluid/tx.rpc.msg.js"; -import * as _532 from "./tokenfactory/v1beta1/tx.rpc.msg.js"; -import * as _533 from "./gamm/v1beta1/query.pinia.store.js"; -import * as _534 from "./gamm/v2/query.pinia.store.js"; -import * as _556 from "./lcd.js"; -import * as _557 from "./custom-lcd-client.js"; -import * as _558 from "./rpc.query.js"; -import * as _559 from "./rpc.tx.js"; +import * as _275 from "./claim/v1beta1/claim"; +import * as _276 from "./claim/v1beta1/genesis"; +import * as _277 from "./claim/v1beta1/params"; +import * as _278 from "./claim/v1beta1/query"; +import * as _279 from "./epochs/genesis"; +import * as _280 from "./epochs/query"; +import * as _281 from "./gamm/pool-models/balancer/balancerPool"; +import * as _282 from "./gamm/v1beta1/genesis"; +import * as _283 from "./gamm/v1beta1/query"; +import * as _284 from "./gamm/v1beta1/tx"; +import * as _285 from "./gamm/v1beta1/gov"; +import * as _286 from "./gamm/pool-models/balancer/tx/tx"; +import * as _287 from "./gamm/pool-models/stableswap/stableswap_pool"; +import * as _288 from "./gamm/pool-models/stableswap/tx"; +import * as _289 from "./gamm/v2/query"; +import * as _290 from "./ibc-rate-limit/v1beta1/params"; +import * as _291 from "./ibc-rate-limit/v1beta1/query"; +import * as _292 from "./ibc-rate-limit/v1beta1/genesis"; +import * as _293 from "./incentives/gauge"; +import * as _294 from "./incentives/genesis"; +import * as _295 from "./incentives/params"; +import * as _296 from "./incentives/query"; +import * as _297 from "./incentives/tx"; +import * as _298 from "./lockup/genesis"; +import * as _299 from "./lockup/lock"; +import * as _300 from "./lockup/params"; +import * as _301 from "./lockup/query"; +import * as _302 from "./lockup/tx"; +import * as _303 from "./mint/v1beta1/genesis"; +import * as _304 from "./mint/v1beta1/mint"; +import * as _305 from "./mint/v1beta1/query"; +import * as _306 from "./pool-incentives/v1beta1/genesis"; +import * as _307 from "./pool-incentives/v1beta1/gov"; +import * as _308 from "./pool-incentives/v1beta1/incentives"; +import * as _309 from "./pool-incentives/v1beta1/query"; +import * as _310 from "./sumtree/v1beta1/tree"; +import * as _311 from "./superfluid/genesis"; +import * as _312 from "./superfluid/params"; +import * as _313 from "./superfluid/query"; +import * as _314 from "./superfluid/superfluid"; +import * as _315 from "./superfluid/tx"; +import * as _316 from "./tokenfactory/v1beta1/authorityMetadata"; +import * as _317 from "./tokenfactory/v1beta1/genesis"; +import * as _318 from "./tokenfactory/v1beta1/params"; +import * as _319 from "./tokenfactory/v1beta1/query"; +import * as _320 from "./tokenfactory/v1beta1/tx"; +import * as _321 from "./twap/v1beta1/genesis"; +import * as _322 from "./twap/v1beta1/query"; +import * as _323 from "./twap/v1beta1/twap_record"; +import * as _324 from "./txfees/v1beta1/feetoken"; +import * as _325 from "./txfees/v1beta1/genesis"; +import * as _326 from "./txfees/v1beta1/gov"; +import * as _327 from "./txfees/v1beta1/query"; +import * as _328 from "./accum/v1beta1/accum"; +import * as _329 from "./concentrated-liquidity/params"; +import * as _330 from "./cosmwasmpool/v1beta1/genesis"; +import * as _331 from "./cosmwasmpool/v1beta1/model/pool"; +import * as _332 from "./cosmwasmpool/v1beta1/model/tx"; +import * as _333 from "./cosmwasmpool/v1beta1/query"; +import * as _334 from "./cosmwasmpool/v1beta1/tx"; +import * as _335 from "./downtime-detector/v1beta1/downtime_duration"; +import * as _336 from "./downtime-detector/v1beta1/genesis"; +import * as _337 from "./downtime-detector/v1beta1/query"; +import * as _338 from "./poolmanager/v1beta1/genesis"; +import * as _339 from "./poolmanager/v1beta1/module_route"; +import * as _340 from "./poolmanager/v1beta1/query"; +import * as _341 from "./poolmanager/v1beta1/swap_route"; +import * as _342 from "./poolmanager/v1beta1/tx"; +import * as _343 from "./protorev/v1beta1/genesis"; +import * as _344 from "./protorev/v1beta1/gov"; +import * as _345 from "./protorev/v1beta1/params"; +import * as _346 from "./protorev/v1beta1/protorev"; +import * as _347 from "./protorev/v1beta1/query"; +import * as _348 from "./protorev/v1beta1/tx"; +import * as _349 from "./valset-pref/v1beta1/query"; +import * as _350 from "./valset-pref/v1beta1/state"; +import * as _351 from "./valset-pref/v1beta1/tx"; +import * as _548 from "./gamm/pool-models/balancer/tx/tx.amino"; +import * as _549 from "./gamm/pool-models/stableswap/tx.amino"; +import * as _550 from "./gamm/v1beta1/tx.amino"; +import * as _551 from "./incentives/tx.amino"; +import * as _552 from "./lockup/tx.amino"; +import * as _553 from "./superfluid/tx.amino"; +import * as _554 from "./tokenfactory/v1beta1/tx.amino"; +import * as _555 from "./concentrated-liquidity/tx.amino"; +import * as _556 from "./poolmanager/v1beta1/tx.amino"; +import * as _557 from "./protorev/v1beta1/tx.amino"; +import * as _558 from "./valset-pref/v1beta1/tx.amino"; +import * as _559 from "./gamm/pool-models/balancer/tx/tx.registry"; +import * as _560 from "./gamm/pool-models/stableswap/tx.registry"; +import * as _561 from "./gamm/v1beta1/tx.registry"; +import * as _562 from "./incentives/tx.registry"; +import * as _563 from "./lockup/tx.registry"; +import * as _564 from "./superfluid/tx.registry"; +import * as _565 from "./tokenfactory/v1beta1/tx.registry"; +import * as _566 from "./concentrated-liquidity/tx.registry"; +import * as _567 from "./poolmanager/v1beta1/tx.registry"; +import * as _568 from "./protorev/v1beta1/tx.registry"; +import * as _569 from "./valset-pref/v1beta1/tx.registry"; +import * as _570 from "./claim/v1beta1/query.lcd"; +import * as _571 from "./epochs/query.lcd"; +import * as _572 from "./gamm/v1beta1/query.lcd"; +import * as _573 from "./gamm/v2/query.lcd"; +import * as _574 from "./ibc-rate-limit/v1beta1/query.lcd"; +import * as _575 from "./incentives/query.lcd"; +import * as _576 from "./lockup/query.lcd"; +import * as _577 from "./mint/v1beta1/query.lcd"; +import * as _578 from "./pool-incentives/v1beta1/query.lcd"; +import * as _579 from "./superfluid/query.lcd"; +import * as _580 from "./tokenfactory/v1beta1/query.lcd"; +import * as _581 from "./twap/v1beta1/query.lcd"; +import * as _582 from "./txfees/v1beta1/query.lcd"; +import * as _583 from "./concentrated-liquidity/pool-model/query.lcd"; +import * as _584 from "./cosmwasmpool/v1beta1/query.lcd"; +import * as _585 from "./downtime-detector/v1beta1/query.lcd"; +import * as _586 from "./poolmanager/v1beta1/query.lcd"; +import * as _587 from "./protorev/v1beta1/query.lcd"; +import * as _588 from "./valset-pref/v1beta1/query.lcd"; +import * as _589 from "./claim/v1beta1/query.rpc.Query"; +import * as _590 from "./epochs/query.rpc.Query"; +import * as _591 from "./gamm/v1beta1/query.rpc.Query"; +import * as _592 from "./gamm/v2/query.rpc.Query"; +import * as _593 from "./ibc-rate-limit/v1beta1/query.rpc.Query"; +import * as _594 from "./incentives/query.rpc.Query"; +import * as _595 from "./lockup/query.rpc.Query"; +import * as _596 from "./mint/v1beta1/query.rpc.Query"; +import * as _597 from "./pool-incentives/v1beta1/query.rpc.Query"; +import * as _598 from "./superfluid/query.rpc.Query"; +import * as _599 from "./tokenfactory/v1beta1/query.rpc.Query"; +import * as _600 from "./twap/v1beta1/query.rpc.Query"; +import * as _601 from "./txfees/v1beta1/query.rpc.Query"; +import * as _602 from "./concentrated-liquidity/pool-model/query.rpc.Query"; +import * as _603 from "./cosmwasmpool/v1beta1/query.rpc.Query"; +import * as _604 from "./downtime-detector/v1beta1/query.rpc.Query"; +import * as _605 from "./poolmanager/v1beta1/query.rpc.Query"; +import * as _606 from "./protorev/v1beta1/query.rpc.Query"; +import * as _607 from "./valset-pref/v1beta1/query.rpc.Query"; +import * as _608 from "./gamm/pool-models/balancer/tx/tx.rpc.msg"; +import * as _609 from "./gamm/pool-models/stableswap/tx.rpc.msg"; +import * as _610 from "./gamm/v1beta1/tx.rpc.msg"; +import * as _611 from "./incentives/tx.rpc.msg"; +import * as _612 from "./lockup/tx.rpc.msg"; +import * as _613 from "./superfluid/tx.rpc.msg"; +import * as _614 from "./tokenfactory/v1beta1/tx.rpc.msg"; +import * as _615 from "./concentrated-liquidity/tx.rpc.msg"; +import * as _616 from "./poolmanager/v1beta1/tx.rpc.msg"; +import * as _617 from "./protorev/v1beta1/tx.rpc.msg"; +import * as _618 from "./valset-pref/v1beta1/tx.rpc.msg"; +import * as _640 from "./lcd"; +import * as _641 from "./custom-lcd-client"; +import * as _642 from "./rpc.query"; +import * as _643 from "./rpc.tx"; export namespace osmosis { export namespace claim { export const v1beta1 = { - ..._254, - ..._255, - ..._256, - ..._257, - ..._500, - ..._513 + ..._275, + ..._276, + ..._277, + ..._278, + ..._570, + ..._589 }; } export namespace epochs { export const v1beta1 = { - ..._258, - ..._259, - ..._501, - ..._514 + ..._279, + ..._280, + ..._571, + ..._590 }; } export namespace gamm { export const v1beta1 = { - ..._260, - ..._261, - ..._262, - ..._263, - ..._488, - ..._495, - ..._502, - ..._515, - ..._528, - ..._533 + ..._281, + ..._282, + ..._283, + ..._284, + ..._285, + ..._550, + ..._561, + ..._572, + ..._591, + ..._610 }; export namespace poolmodels { export namespace balancer { export const v1beta1 = { - ..._264, - ..._486, - ..._493, - ..._526 + ..._286, + ..._548, + ..._559, + ..._608 }; } export namespace stableswap { export const v1beta1 = { - ..._265, - ..._266, - ..._487, - ..._494, - ..._527 + ..._287, + ..._288, + ..._549, + ..._560, + ..._609 }; } } export const v2 = { - ..._267, - ..._503, - ..._516, - ..._534 + ..._289, + ..._573, + ..._592 }; } export namespace ibcratelimit { export const v1beta1 = { - ..._268, - ..._269, - ..._504, - ..._517 + ..._290, + ..._291, + ..._292, + ..._574, + ..._593 }; } export const incentives = { - ..._270, - ..._271, - ..._272, - ..._273, - ..._274, - ..._489, - ..._496, - ..._505, - ..._518, - ..._529 + ..._293, + ..._294, + ..._295, + ..._296, + ..._297, + ..._551, + ..._562, + ..._575, + ..._594, + ..._611 }; export const lockup = { - ..._275, - ..._276, - ..._277, - ..._278, - ..._279, - ..._490, - ..._497, - ..._506, - ..._519, - ..._530 + ..._298, + ..._299, + ..._300, + ..._301, + ..._302, + ..._552, + ..._563, + ..._576, + ..._595, + ..._612 }; export namespace mint { export const v1beta1 = { - ..._280, - ..._281, - ..._282, - ..._507, - ..._520 + ..._303, + ..._304, + ..._305, + ..._577, + ..._596 }; } export namespace poolincentives { export const v1beta1 = { - ..._283, - ..._284, - ..._285, - ..._286, - ..._508, - ..._521 + ..._306, + ..._307, + ..._308, + ..._309, + ..._578, + ..._597 }; } export namespace store { export const v1beta1 = { - ..._287 + ..._310 }; } export const superfluid = { - ..._288, - ..._289, - ..._290, - ..._291, - ..._292, - ..._491, - ..._498, - ..._509, - ..._522, - ..._531 + ..._311, + ..._312, + ..._313, + ..._314, + ..._315, + ..._553, + ..._564, + ..._579, + ..._598, + ..._613 }; export namespace tokenfactory { export const v1beta1 = { - ..._293, - ..._294, - ..._295, - ..._296, - ..._297, - ..._492, - ..._499, - ..._510, - ..._523, - ..._532 + ..._316, + ..._317, + ..._318, + ..._319, + ..._320, + ..._554, + ..._565, + ..._580, + ..._599, + ..._614 }; } export namespace twap { export const v1beta1 = { - ..._298, - ..._299, - ..._300, - ..._511, - ..._524 + ..._321, + ..._322, + ..._323, + ..._581, + ..._600 }; } export namespace txfees { export const v1beta1 = { - ..._301, - ..._302, - ..._303, - ..._304, - ..._512, - ..._525 + ..._324, + ..._325, + ..._326, + ..._327, + ..._582, + ..._601 + }; + } + export namespace accum { + export const v1beta1 = { + ..._328 + }; + } + export const concentratedliquidity = { + ..._329, + v1beta1: { + ..._555, + ..._566, + ..._583, + ..._602, + ..._615 + } + }; + export namespace cosmwasmpool { + export const v1beta1 = { + ..._330, + ..._331, + ..._332, + ..._333, + ..._334, + ..._584, + ..._603 + }; + } + export namespace downtimedetector { + export const v1beta1 = { + ..._335, + ..._336, + ..._337, + ..._585, + ..._604 + }; + } + export namespace poolmanager { + export const v1beta1 = { + ..._338, + ..._339, + ..._340, + ..._341, + ..._342, + ..._556, + ..._567, + ..._586, + ..._605, + ..._616 + }; + } + export namespace protorev { + export const v1beta1 = { + ..._343, + ..._344, + ..._345, + ..._346, + ..._347, + ..._348, + ..._557, + ..._568, + ..._587, + ..._606, + ..._617 + }; + } + export namespace valsetpref { + export const v1beta1 = { + ..._349, + ..._350, + ..._351, + ..._558, + ..._569, + ..._588, + ..._607, + ..._618 }; } export const ClientFactory = { - ..._556, - ..._557, - ..._558, - ..._559 + ..._640, + ..._641, + ..._642, + ..._643 }; } \ No newline at end of file diff --git a/__fixtures__/v-next/outputv4/osmosis/claim/v1beta1/claim.ts b/__fixtures__/v-next/outputv4/osmosis/claim/v1beta1/claim.ts index 8caab06ea1..65852f671d 100644 --- a/__fixtures__/v-next/outputv4/osmosis/claim/v1beta1/claim.ts +++ b/__fixtures__/v-next/outputv4/osmosis/claim/v1beta1/claim.ts @@ -1,7 +1,8 @@ -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"; +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"; export const protobufPackage = "osmosis.claim.v1beta1"; export enum Action { ActionAddLiquidity = 0, @@ -58,6 +59,11 @@ export interface ClaimRecord { */ actionCompleted: boolean[]; } +export interface ReactiveClaimRecord { + address: ComputedRef<string>; + initialClaimableAmount: ComputedRef<Coin[]>; + actionCompleted: ComputedRef<boolean[]>; +} export interface ClaimRecordProtoMsg { typeUrl: "/osmosis.claim.v1beta1.ClaimRecord"; value: Uint8Array; @@ -78,7 +84,7 @@ function createBaseClaimRecord(): ClaimRecord { export const ClaimRecord = { typeUrl: "/osmosis.claim.v1beta1.ClaimRecord", encode(message: ClaimRecord, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.address !== undefined) { + if (message.address !== "") { writer.uint32(10).string(message.address); } for (const v of message.initialClaimableAmount) { @@ -122,11 +128,11 @@ export const ClaimRecord = { return message; }, fromJSON(object: any): ClaimRecord { - const obj = createBaseClaimRecord(); - if (isSet(object.address)) obj.address = String(object.address); - if (Array.isArray(object?.initialClaimableAmount)) obj.initialClaimableAmount = object.initialClaimableAmount.map((e: any) => Coin.fromJSON(e)); - if (Array.isArray(object?.actionCompleted)) obj.actionCompleted = object.actionCompleted.map((e: any) => Boolean(e)); - return obj; + return { + address: isSet(object.address) ? String(object.address) : "", + initialClaimableAmount: Array.isArray(object?.initialClaimableAmount) ? object.initialClaimableAmount.map((e: any) => Coin.fromJSON(e)) : [], + actionCompleted: Array.isArray(object?.actionCompleted) ? object.actionCompleted.map((e: any) => Boolean(e)) : [] + }; }, toJSON(message: ClaimRecord): JsonSafe<ClaimRecord> { const obj: any = {}; diff --git a/__fixtures__/v-next/outputv4/osmosis/claim/v1beta1/genesis.ts b/__fixtures__/v-next/outputv4/osmosis/claim/v1beta1/genesis.ts index 801b77a53d..5bc09ab64c 100644 --- a/__fixtures__/v-next/outputv4/osmosis/claim/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputv4/osmosis/claim/v1beta1/genesis.ts @@ -1,9 +1,10 @@ -import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin.js"; -import { Params, ParamsSDKType } from "./params.js"; -import { ClaimRecord, ClaimRecordSDKType } from "./claim.js"; -import { BinaryReader, BinaryWriter } from "../../../binary.js"; -import { isSet, DeepPartial } from "../../../helpers.js"; -import { JsonSafe } from "../../../json-safe.js"; +import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; +import { Params, ParamsSDKType } from "./params"; +import { ClaimRecord, ClaimRecordSDKType } from "./claim"; +import { BinaryReader, BinaryWriter } from "../../../binary"; +import { isSet, DeepPartial } from "../../../helpers"; +import { JsonSafe } from "../../../json-safe"; +import { ComputedRef } from "vue"; export const protobufPackage = "osmosis.claim.v1beta1"; /** GenesisState defines the claim module's genesis state. */ export interface GenesisState { @@ -14,6 +15,11 @@ export interface GenesisState { /** list of claim records, one for every airdrop recipient */ claimRecords: ClaimRecord[]; } +export interface ReactiveGenesisState { + moduleAccountBalance: ComputedRef<Coin>; + params: ComputedRef<Params>; + claimRecords: ComputedRef<ClaimRecord[]>; +} export interface GenesisStateProtoMsg { typeUrl: "/osmosis.claim.v1beta1.GenesisState"; value: Uint8Array; @@ -69,11 +75,11 @@ export const GenesisState = { return message; }, fromJSON(object: any): GenesisState { - const obj = createBaseGenesisState(); - if (isSet(object.moduleAccountBalance)) obj.moduleAccountBalance = Coin.fromJSON(object.moduleAccountBalance); - if (isSet(object.params)) obj.params = Params.fromJSON(object.params); - if (Array.isArray(object?.claimRecords)) obj.claimRecords = object.claimRecords.map((e: any) => ClaimRecord.fromJSON(e)); - return obj; + return { + moduleAccountBalance: isSet(object.moduleAccountBalance) ? Coin.fromJSON(object.moduleAccountBalance) : undefined, + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + claimRecords: Array.isArray(object?.claimRecords) ? object.claimRecords.map((e: any) => ClaimRecord.fromJSON(e)) : [] + }; }, toJSON(message: GenesisState): JsonSafe<GenesisState> { const obj: any = {}; @@ -88,12 +94,8 @@ export const GenesisState = { }, fromPartial(object: DeepPartial<GenesisState>): GenesisState { const message = createBaseGenesisState(); - if (object.moduleAccountBalance !== undefined && object.moduleAccountBalance !== null) { - message.moduleAccountBalance = Coin.fromPartial(object.moduleAccountBalance); - } - if (object.params !== undefined && object.params !== null) { - message.params = Params.fromPartial(object.params); - } + message.moduleAccountBalance = object.moduleAccountBalance !== undefined && object.moduleAccountBalance !== null ? Coin.fromPartial(object.moduleAccountBalance) : undefined; + message.params = object.params !== undefined && object.params !== null ? Params.fromPartial(object.params) : undefined; message.claimRecords = object.claimRecords?.map(e => ClaimRecord.fromPartial(e)) || []; return message; }, diff --git a/__fixtures__/v-next/outputv4/osmosis/claim/v1beta1/params.ts b/__fixtures__/v-next/outputv4/osmosis/claim/v1beta1/params.ts index f86f2824e1..a5223ca2fd 100644 --- a/__fixtures__/v-next/outputv4/osmosis/claim/v1beta1/params.ts +++ b/__fixtures__/v-next/outputv4/osmosis/claim/v1beta1/params.ts @@ -1,8 +1,9 @@ -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"; +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"; export const protobufPackage = "osmosis.claim.v1beta1"; /** Params defines the claim module's parameters. */ export interface Params { @@ -12,6 +13,12 @@ export interface Params { /** denom of claimable asset */ claimDenom: string; } +export interface ReactiveParams { + airdropStartTime: ComputedRef<Date>; + durationUntilDecay: ComputedRef<Duration>; + durationOfDecay: ComputedRef<Duration>; + claimDenom: ComputedRef<string>; +} export interface ParamsProtoMsg { typeUrl: "/osmosis.claim.v1beta1.Params"; value: Uint8Array; @@ -43,7 +50,7 @@ export const Params = { if (message.durationOfDecay !== undefined) { Duration.encode(message.durationOfDecay, writer.uint32(26).fork()).ldelim(); } - if (message.claimDenom !== undefined) { + if (message.claimDenom !== "") { writer.uint32(34).string(message.claimDenom); } return writer; @@ -75,12 +82,12 @@ export const Params = { return message; }, fromJSON(object: any): Params { - const obj = createBaseParams(); - 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.claimDenom)) obj.claimDenom = String(object.claimDenom); - return obj; + return { + 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, + claimDenom: isSet(object.claimDenom) ? String(object.claimDenom) : "" + }; }, toJSON(message: Params): JsonSafe<Params> { const obj: any = {}; @@ -93,12 +100,8 @@ export const Params = { fromPartial(object: DeepPartial<Params>): Params { const message = createBaseParams(); message.airdropStartTime = object.airdropStartTime ?? 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.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; message.claimDenom = object.claimDenom ?? ""; return message; }, diff --git a/__fixtures__/v-next/outputv4/osmosis/claim/v1beta1/query.lcd.ts b/__fixtures__/v-next/outputv4/osmosis/claim/v1beta1/query.lcd.ts index 9973711a58..a84b1c6abf 100644 --- a/__fixtures__/v-next/outputv4/osmosis/claim/v1beta1/query.lcd.ts +++ b/__fixtures__/v-next/outputv4/osmosis/claim/v1beta1/query.lcd.ts @@ -1,8 +1,8 @@ -import { Action, ActionSDKType, ClaimRecord, ClaimRecordSDKType } from "./claim.js"; -import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin.js"; -import { Params, ParamsSDKType } from "./params.js"; +import { Action, ActionSDKType, ClaimRecord, ClaimRecordSDKType } from "./claim"; +import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; +import { Params, ParamsSDKType } from "./params"; import { LCDClient } from "@cosmology/lcd"; -import { QueryModuleAccountBalanceRequest, QueryModuleAccountBalanceRequestSDKType, QueryModuleAccountBalanceResponse, QueryModuleAccountBalanceResponseSDKType, QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType, QueryClaimRecordRequest, QueryClaimRecordRequestSDKType, QueryClaimRecordResponse, QueryClaimRecordResponseSDKType, QueryClaimableForActionRequest, QueryClaimableForActionRequestSDKType, QueryClaimableForActionResponse, QueryClaimableForActionResponseSDKType, QueryTotalClaimableRequest, QueryTotalClaimableRequestSDKType, QueryTotalClaimableResponse, QueryTotalClaimableResponseSDKType } from "./query.js"; +import { QueryModuleAccountBalanceRequest, QueryModuleAccountBalanceRequestSDKType, QueryModuleAccountBalanceResponse, QueryModuleAccountBalanceResponseSDKType, QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType, QueryClaimRecordRequest, QueryClaimRecordRequestSDKType, QueryClaimRecordResponse, QueryClaimRecordResponseSDKType, QueryClaimableForActionRequest, QueryClaimableForActionRequestSDKType, QueryClaimableForActionResponse, QueryClaimableForActionResponseSDKType, QueryTotalClaimableRequest, QueryTotalClaimableRequestSDKType, QueryTotalClaimableResponse, QueryTotalClaimableResponseSDKType } from "./query"; export class LCDQueryClient { req: LCDClient; constructor({ diff --git a/__fixtures__/v-next/outputv4/osmosis/claim/v1beta1/query.rpc.Query.ts b/__fixtures__/v-next/outputv4/osmosis/claim/v1beta1/query.rpc.Query.ts index 9e17414b36..a87799e875 100644 --- a/__fixtures__/v-next/outputv4/osmosis/claim/v1beta1/query.rpc.Query.ts +++ b/__fixtures__/v-next/outputv4/osmosis/claim/v1beta1/query.rpc.Query.ts @@ -1,10 +1,10 @@ -import { Action, ActionSDKType, ClaimRecord, ClaimRecordSDKType } from "./claim.js"; -import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin.js"; -import { Params, ParamsSDKType } from "./params.js"; -import { Rpc } from "../../../helpers.js"; -import { BinaryReader } from "../../../binary.js"; +import { Action, ActionSDKType, ClaimRecord, ClaimRecordSDKType } from "./claim"; +import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; +import { Params, ParamsSDKType } from "./params"; +import { Rpc } from "../../../helpers"; +import { BinaryReader } from "../../../binary"; import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; -import { QueryModuleAccountBalanceRequest, QueryModuleAccountBalanceRequestSDKType, QueryModuleAccountBalanceResponse, QueryModuleAccountBalanceResponseSDKType, QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType, QueryClaimRecordRequest, QueryClaimRecordRequestSDKType, QueryClaimRecordResponse, QueryClaimRecordResponseSDKType, QueryClaimableForActionRequest, QueryClaimableForActionRequestSDKType, QueryClaimableForActionResponse, QueryClaimableForActionResponseSDKType, QueryTotalClaimableRequest, QueryTotalClaimableRequestSDKType, QueryTotalClaimableResponse, QueryTotalClaimableResponseSDKType } from "./query.js"; +import { QueryModuleAccountBalanceRequest, QueryModuleAccountBalanceRequestSDKType, QueryModuleAccountBalanceResponse, QueryModuleAccountBalanceResponseSDKType, QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType, QueryClaimRecordRequest, QueryClaimRecordRequestSDKType, QueryClaimRecordResponse, QueryClaimRecordResponseSDKType, QueryClaimableForActionRequest, QueryClaimableForActionRequestSDKType, QueryClaimableForActionResponse, QueryClaimableForActionResponseSDKType, QueryTotalClaimableRequest, QueryTotalClaimableRequestSDKType, QueryTotalClaimableResponse, QueryTotalClaimableResponseSDKType, ReactiveQueryModuleAccountBalanceRequest, ReactiveQueryParamsRequest, ReactiveQueryClaimRecordRequest, ReactiveQueryClaimableForActionRequest, ReactiveQueryTotalClaimableRequest } from "./query"; /** Query defines the gRPC querier service. */ export interface Query { moduleAccountBalance(request?: QueryModuleAccountBalanceRequest): Promise<QueryModuleAccountBalanceResponse>; diff --git a/__fixtures__/v-next/outputv4/osmosis/claim/v1beta1/query.ts b/__fixtures__/v-next/outputv4/osmosis/claim/v1beta1/query.ts index fe56319185..0f864e09a2 100644 --- a/__fixtures__/v-next/outputv4/osmosis/claim/v1beta1/query.ts +++ b/__fixtures__/v-next/outputv4/osmosis/claim/v1beta1/query.ts @@ -1,12 +1,14 @@ -import { Action, ActionSDKType, ClaimRecord, ClaimRecordSDKType, actionFromJSON, actionToJSON } from "./claim.js"; -import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin.js"; -import { Params, ParamsSDKType } from "./params.js"; -import { BinaryReader, BinaryWriter } from "../../../binary.js"; -import { JsonSafe } from "../../../json-safe.js"; -import { DeepPartial, isSet } from "../../../helpers.js"; +import { Action, ActionSDKType, ClaimRecord, ClaimRecordSDKType, actionFromJSON, actionToJSON } from "./claim"; +import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; +import { Params, ParamsSDKType } from "./params"; +import { BinaryReader, BinaryWriter } from "../../../binary"; +import { JsonSafe } from "../../../json-safe"; +import { DeepPartial, isSet } from "../../../helpers"; +import { ComputedRef } from "vue"; export const protobufPackage = "osmosis.claim.v1beta1"; /** QueryParamsRequest is the request type for the Query/Params RPC method. */ export interface QueryModuleAccountBalanceRequest {} +export interface ReactiveQueryModuleAccountBalanceRequest {} export interface QueryModuleAccountBalanceRequestProtoMsg { typeUrl: "/osmosis.claim.v1beta1.QueryModuleAccountBalanceRequest"; value: Uint8Array; @@ -18,6 +20,9 @@ export interface QueryModuleAccountBalanceResponse { /** params defines the parameters of the module. */ moduleAccountBalance: Coin[]; } +export interface ReactiveQueryModuleAccountBalanceResponse { + moduleAccountBalance: ComputedRef<Coin[]>; +} export interface QueryModuleAccountBalanceResponseProtoMsg { typeUrl: "/osmosis.claim.v1beta1.QueryModuleAccountBalanceResponse"; value: Uint8Array; @@ -28,6 +33,7 @@ export interface QueryModuleAccountBalanceResponseSDKType { } /** QueryParamsRequest is the request type for the Query/Params RPC method. */ export interface QueryParamsRequest {} +export interface ReactiveQueryParamsRequest {} export interface QueryParamsRequestProtoMsg { typeUrl: "/osmosis.claim.v1beta1.QueryParamsRequest"; value: Uint8Array; @@ -39,6 +45,9 @@ export interface QueryParamsResponse { /** params defines the parameters of the module. */ params: Params; } +export interface ReactiveQueryParamsResponse { + params: ComputedRef<Params>; +} export interface QueryParamsResponseProtoMsg { typeUrl: "/osmosis.claim.v1beta1.QueryParamsResponse"; value: Uint8Array; @@ -50,6 +59,9 @@ export interface QueryParamsResponseSDKType { export interface QueryClaimRecordRequest { address: string; } +export interface ReactiveQueryClaimRecordRequest { + address: ComputedRef<string>; +} export interface QueryClaimRecordRequestProtoMsg { typeUrl: "/osmosis.claim.v1beta1.QueryClaimRecordRequest"; value: Uint8Array; @@ -60,6 +72,9 @@ export interface QueryClaimRecordRequestSDKType { export interface QueryClaimRecordResponse { claimRecord: ClaimRecord; } +export interface ReactiveQueryClaimRecordResponse { + claimRecord: ComputedRef<ClaimRecord>; +} export interface QueryClaimRecordResponseProtoMsg { typeUrl: "/osmosis.claim.v1beta1.QueryClaimRecordResponse"; value: Uint8Array; @@ -71,6 +86,10 @@ export interface QueryClaimableForActionRequest { address: string; action: Action; } +export interface ReactiveQueryClaimableForActionRequest { + address: ComputedRef<string>; + action: ComputedRef<Action>; +} export interface QueryClaimableForActionRequestProtoMsg { typeUrl: "/osmosis.claim.v1beta1.QueryClaimableForActionRequest"; value: Uint8Array; @@ -82,6 +101,9 @@ export interface QueryClaimableForActionRequestSDKType { export interface QueryClaimableForActionResponse { coins: Coin[]; } +export interface ReactiveQueryClaimableForActionResponse { + coins: ComputedRef<Coin[]>; +} export interface QueryClaimableForActionResponseProtoMsg { typeUrl: "/osmosis.claim.v1beta1.QueryClaimableForActionResponse"; value: Uint8Array; @@ -92,6 +114,9 @@ export interface QueryClaimableForActionResponseSDKType { export interface QueryTotalClaimableRequest { address: string; } +export interface ReactiveQueryTotalClaimableRequest { + address: ComputedRef<string>; +} export interface QueryTotalClaimableRequestProtoMsg { typeUrl: "/osmosis.claim.v1beta1.QueryTotalClaimableRequest"; value: Uint8Array; @@ -102,6 +127,9 @@ export interface QueryTotalClaimableRequestSDKType { export interface QueryTotalClaimableResponse { coins: Coin[]; } +export interface ReactiveQueryTotalClaimableResponse { + coins: ComputedRef<Coin[]>; +} export interface QueryTotalClaimableResponseProtoMsg { typeUrl: "/osmosis.claim.v1beta1.QueryTotalClaimableResponse"; value: Uint8Array; @@ -132,8 +160,7 @@ export const QueryModuleAccountBalanceRequest = { return message; }, fromJSON(_: any): QueryModuleAccountBalanceRequest { - const obj = createBaseQueryModuleAccountBalanceRequest(); - return obj; + return {}; }, toJSON(_: QueryModuleAccountBalanceRequest): JsonSafe<QueryModuleAccountBalanceRequest> { const obj: any = {}; @@ -214,9 +241,9 @@ export const QueryModuleAccountBalanceResponse = { return message; }, fromJSON(object: any): QueryModuleAccountBalanceResponse { - const obj = createBaseQueryModuleAccountBalanceResponse(); - if (Array.isArray(object?.moduleAccountBalance)) obj.moduleAccountBalance = object.moduleAccountBalance.map((e: any) => Coin.fromJSON(e)); - return obj; + return { + moduleAccountBalance: Array.isArray(object?.moduleAccountBalance) ? object.moduleAccountBalance.map((e: any) => Coin.fromJSON(e)) : [] + }; }, toJSON(message: QueryModuleAccountBalanceResponse): JsonSafe<QueryModuleAccountBalanceResponse> { const obj: any = {}; @@ -310,8 +337,7 @@ export const QueryParamsRequest = { return message; }, fromJSON(_: any): QueryParamsRequest { - const obj = createBaseQueryParamsRequest(); - return obj; + return {}; }, toJSON(_: QueryParamsRequest): JsonSafe<QueryParamsRequest> { const obj: any = {}; @@ -392,9 +418,9 @@ export const QueryParamsResponse = { return message; }, fromJSON(object: any): QueryParamsResponse { - const obj = createBaseQueryParamsResponse(); - if (isSet(object.params)) obj.params = Params.fromJSON(object.params); - return obj; + return { + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined + }; }, toJSON(message: QueryParamsResponse): JsonSafe<QueryParamsResponse> { const obj: any = {}; @@ -403,9 +429,7 @@ export const QueryParamsResponse = { }, fromPartial(object: DeepPartial<QueryParamsResponse>): QueryParamsResponse { const message = createBaseQueryParamsResponse(); - if (object.params !== undefined && object.params !== null) { - message.params = Params.fromPartial(object.params); - } + message.params = object.params !== undefined && object.params !== null ? Params.fromPartial(object.params) : undefined; return message; }, fromSDK(object: QueryParamsResponseSDKType): QueryParamsResponse { @@ -465,7 +489,7 @@ function createBaseQueryClaimRecordRequest(): QueryClaimRecordRequest { export const QueryClaimRecordRequest = { typeUrl: "/osmosis.claim.v1beta1.QueryClaimRecordRequest", encode(message: QueryClaimRecordRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.address !== undefined) { + if (message.address !== "") { writer.uint32(10).string(message.address); } return writer; @@ -488,9 +512,9 @@ export const QueryClaimRecordRequest = { return message; }, fromJSON(object: any): QueryClaimRecordRequest { - const obj = createBaseQueryClaimRecordRequest(); - if (isSet(object.address)) obj.address = String(object.address); - return obj; + return { + address: isSet(object.address) ? String(object.address) : "" + }; }, toJSON(message: QueryClaimRecordRequest): JsonSafe<QueryClaimRecordRequest> { const obj: any = {}; @@ -582,9 +606,9 @@ export const QueryClaimRecordResponse = { return message; }, fromJSON(object: any): QueryClaimRecordResponse { - const obj = createBaseQueryClaimRecordResponse(); - if (isSet(object.claimRecord)) obj.claimRecord = ClaimRecord.fromJSON(object.claimRecord); - return obj; + return { + claimRecord: isSet(object.claimRecord) ? ClaimRecord.fromJSON(object.claimRecord) : undefined + }; }, toJSON(message: QueryClaimRecordResponse): JsonSafe<QueryClaimRecordResponse> { const obj: any = {}; @@ -593,9 +617,7 @@ export const QueryClaimRecordResponse = { }, fromPartial(object: DeepPartial<QueryClaimRecordResponse>): QueryClaimRecordResponse { const message = createBaseQueryClaimRecordResponse(); - if (object.claimRecord !== undefined && object.claimRecord !== null) { - message.claimRecord = ClaimRecord.fromPartial(object.claimRecord); - } + message.claimRecord = object.claimRecord !== undefined && object.claimRecord !== null ? ClaimRecord.fromPartial(object.claimRecord) : undefined; return message; }, fromSDK(object: QueryClaimRecordResponseSDKType): QueryClaimRecordResponse { @@ -656,7 +678,7 @@ function createBaseQueryClaimableForActionRequest(): QueryClaimableForActionRequ export const QueryClaimableForActionRequest = { typeUrl: "/osmosis.claim.v1beta1.QueryClaimableForActionRequest", encode(message: QueryClaimableForActionRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.address !== undefined) { + if (message.address !== "") { writer.uint32(10).string(message.address); } if (message.action !== 0) { @@ -685,10 +707,10 @@ export const QueryClaimableForActionRequest = { return message; }, fromJSON(object: any): QueryClaimableForActionRequest { - const obj = createBaseQueryClaimableForActionRequest(); - if (isSet(object.address)) obj.address = String(object.address); - if (isSet(object.action)) obj.action = actionFromJSON(object.action); - return obj; + return { + address: isSet(object.address) ? String(object.address) : "", + action: isSet(object.action) ? actionFromJSON(object.action) : -1 + }; }, toJSON(message: QueryClaimableForActionRequest): JsonSafe<QueryClaimableForActionRequest> { const obj: any = {}; @@ -789,9 +811,9 @@ export const QueryClaimableForActionResponse = { return message; }, fromJSON(object: any): QueryClaimableForActionResponse { - const obj = createBaseQueryClaimableForActionResponse(); - if (Array.isArray(object?.coins)) obj.coins = object.coins.map((e: any) => Coin.fromJSON(e)); - return obj; + return { + coins: Array.isArray(object?.coins) ? object.coins.map((e: any) => Coin.fromJSON(e)) : [] + }; }, toJSON(message: QueryClaimableForActionResponse): JsonSafe<QueryClaimableForActionResponse> { const obj: any = {}; @@ -870,7 +892,7 @@ function createBaseQueryTotalClaimableRequest(): QueryTotalClaimableRequest { export const QueryTotalClaimableRequest = { typeUrl: "/osmosis.claim.v1beta1.QueryTotalClaimableRequest", encode(message: QueryTotalClaimableRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.address !== undefined) { + if (message.address !== "") { writer.uint32(10).string(message.address); } return writer; @@ -893,9 +915,9 @@ export const QueryTotalClaimableRequest = { return message; }, fromJSON(object: any): QueryTotalClaimableRequest { - const obj = createBaseQueryTotalClaimableRequest(); - if (isSet(object.address)) obj.address = String(object.address); - return obj; + return { + address: isSet(object.address) ? String(object.address) : "" + }; }, toJSON(message: QueryTotalClaimableRequest): JsonSafe<QueryTotalClaimableRequest> { const obj: any = {}; @@ -987,9 +1009,9 @@ export const QueryTotalClaimableResponse = { return message; }, fromJSON(object: any): QueryTotalClaimableResponse { - const obj = createBaseQueryTotalClaimableResponse(); - if (Array.isArray(object?.coins)) obj.coins = object.coins.map((e: any) => Coin.fromJSON(e)); - return obj; + return { + coins: Array.isArray(object?.coins) ? object.coins.map((e: any) => Coin.fromJSON(e)) : [] + }; }, toJSON(message: QueryTotalClaimableResponse): JsonSafe<QueryTotalClaimableResponse> { const obj: any = {}; diff --git a/__fixtures__/v-next/outputv4/osmosis/client.ts b/__fixtures__/v-next/outputv4/osmosis/client.ts index 7bbbce2ad8..def190e062 100644 --- a/__fixtures__/v-next/outputv4/osmosis/client.ts +++ b/__fixtures__/v-next/outputv4/osmosis/client.ts @@ -1,20 +1,28 @@ 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.js"; -import * as osmosisGammPoolmodelsStableswapTxRegistry from "./gamm/pool-models/stableswap/tx.registry.js"; -import * as osmosisGammV1beta1TxRegistry from "./gamm/v1beta1/tx.registry.js"; -import * as osmosisIncentivesTxRegistry from "./incentives/tx.registry.js"; -import * as osmosisLockupTxRegistry from "./lockup/tx.registry.js"; -import * as osmosisSuperfluidTxRegistry from "./superfluid/tx.registry.js"; -import * as osmosisTokenfactoryV1beta1TxRegistry from "./tokenfactory/v1beta1/tx.registry.js"; -import * as osmosisGammPoolmodelsBalancerTxTxAmino from "./gamm/pool-models/balancer/tx/tx.amino.js"; -import * as osmosisGammPoolmodelsStableswapTxAmino from "./gamm/pool-models/stableswap/tx.amino.js"; -import * as osmosisGammV1beta1TxAmino from "./gamm/v1beta1/tx.amino.js"; -import * as osmosisIncentivesTxAmino from "./incentives/tx.amino.js"; -import * as osmosisLockupTxAmino from "./lockup/tx.amino.js"; -import * as osmosisSuperfluidTxAmino from "./superfluid/tx.amino.js"; -import * as osmosisTokenfactoryV1beta1TxAmino from "./tokenfactory/v1beta1/tx.amino.js"; +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"; +import * as osmosisConcentratedliquidityTxRegistry from "./concentrated-liquidity/tx.registry"; +import * as osmosisPoolmanagerV1beta1TxRegistry from "./poolmanager/v1beta1/tx.registry"; +import * as osmosisProtorevV1beta1TxRegistry from "./protorev/v1beta1/tx.registry"; +import * as osmosisValsetprefV1beta1TxRegistry from "./valset-pref/v1beta1/tx.registry"; +import * as osmosisGammPoolmodelsBalancerTxTxAmino from "./gamm/pool-models/balancer/tx/tx.amino"; +import * as osmosisGammPoolmodelsStableswapTxAmino from "./gamm/pool-models/stableswap/tx.amino"; +import * as osmosisGammV1beta1TxAmino from "./gamm/v1beta1/tx.amino"; +import * as osmosisIncentivesTxAmino from "./incentives/tx.amino"; +import * as osmosisLockupTxAmino from "./lockup/tx.amino"; +import * as osmosisSuperfluidTxAmino from "./superfluid/tx.amino"; +import * as osmosisTokenfactoryV1beta1TxAmino from "./tokenfactory/v1beta1/tx.amino"; +import * as osmosisConcentratedliquidityTxAmino from "./concentrated-liquidity/tx.amino"; +import * as osmosisPoolmanagerV1beta1TxAmino from "./poolmanager/v1beta1/tx.amino"; +import * as osmosisProtorevV1beta1TxAmino from "./protorev/v1beta1/tx.amino"; +import * as osmosisValsetprefV1beta1TxAmino from "./valset-pref/v1beta1/tx.amino"; export const osmosisAminoConverters = { ...osmosisGammPoolmodelsBalancerTxTxAmino.AminoConverter, ...osmosisGammPoolmodelsStableswapTxAmino.AminoConverter, @@ -22,9 +30,13 @@ export const osmosisAminoConverters = { ...osmosisIncentivesTxAmino.AminoConverter, ...osmosisLockupTxAmino.AminoConverter, ...osmosisSuperfluidTxAmino.AminoConverter, - ...osmosisTokenfactoryV1beta1TxAmino.AminoConverter + ...osmosisTokenfactoryV1beta1TxAmino.AminoConverter, + ...osmosisConcentratedliquidityTxAmino.AminoConverter, + ...osmosisPoolmanagerV1beta1TxAmino.AminoConverter, + ...osmosisProtorevV1beta1TxAmino.AminoConverter, + ...osmosisValsetprefV1beta1TxAmino.AminoConverter }; -export const osmosisProtoRegistry: ReadonlyArray<[string, GeneratedType]> = [...osmosisGammPoolmodelsBalancerTxTxRegistry.registry, ...osmosisGammPoolmodelsStableswapTxRegistry.registry, ...osmosisGammV1beta1TxRegistry.registry, ...osmosisIncentivesTxRegistry.registry, ...osmosisLockupTxRegistry.registry, ...osmosisSuperfluidTxRegistry.registry, ...osmosisTokenfactoryV1beta1TxRegistry.registry]; +export const osmosisProtoRegistry: ReadonlyArray<[string, GeneratedType]> = [...osmosisGammPoolmodelsBalancerTxTxRegistry.registry, ...osmosisGammPoolmodelsStableswapTxRegistry.registry, ...osmosisGammV1beta1TxRegistry.registry, ...osmosisIncentivesTxRegistry.registry, ...osmosisLockupTxRegistry.registry, ...osmosisSuperfluidTxRegistry.registry, ...osmosisTokenfactoryV1beta1TxRegistry.registry, ...osmosisConcentratedliquidityTxRegistry.registry, ...osmosisPoolmanagerV1beta1TxRegistry.registry, ...osmosisProtorevV1beta1TxRegistry.registry, ...osmosisValsetprefV1beta1TxRegistry.registry]; export const getSigningOsmosisClientOptions = ({ defaultTypes = defaultRegistryTypes }: { diff --git a/__fixtures__/v-next/outputv4/osmosis/epochs/genesis.ts b/__fixtures__/v-next/outputv4/osmosis/epochs/genesis.ts index 94345deb48..df19f54644 100644 --- a/__fixtures__/v-next/outputv4/osmosis/epochs/genesis.ts +++ b/__fixtures__/v-next/outputv4/osmosis/epochs/genesis.ts @@ -1,8 +1,9 @@ -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"; +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"; export const protobufPackage = "osmosis.epochs.v1beta1"; /** * EpochInfo is a struct that describes the data going into @@ -62,6 +63,15 @@ export interface EpochInfo { */ currentEpochStartHeight: bigint; } +export interface ReactiveEpochInfo { + identifier: ComputedRef<string>; + startTime: ComputedRef<Date>; + duration: ComputedRef<Duration>; + currentEpoch: ComputedRef<bigint>; + currentEpochStartTime: ComputedRef<Date>; + epochCountingStarted: ComputedRef<boolean>; + currentEpochStartHeight: ComputedRef<bigint>; +} export interface EpochInfoProtoMsg { typeUrl: "/osmosis.epochs.v1beta1.EpochInfo"; value: Uint8Array; @@ -83,6 +93,9 @@ export interface EpochInfoSDKType { export interface GenesisState { epochs: EpochInfo[]; } +export interface ReactiveGenesisState { + epochs: ComputedRef<EpochInfo[]>; +} export interface GenesisStateProtoMsg { typeUrl: "/osmosis.epochs.v1beta1.GenesisState"; value: Uint8Array; @@ -105,7 +118,7 @@ function createBaseEpochInfo(): EpochInfo { export const EpochInfo = { typeUrl: "/osmosis.epochs.v1beta1.EpochInfo", encode(message: EpochInfo, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.identifier !== undefined) { + if (message.identifier !== "") { writer.uint32(10).string(message.identifier); } if (message.startTime !== undefined) { @@ -114,16 +127,16 @@ export const EpochInfo = { if (message.duration !== undefined) { Duration.encode(message.duration, writer.uint32(26).fork()).ldelim(); } - if (message.currentEpoch !== undefined) { + if (message.currentEpoch !== BigInt(0)) { writer.uint32(32).int64(message.currentEpoch); } if (message.currentEpochStartTime !== undefined) { Timestamp.encode(toTimestamp(message.currentEpochStartTime), writer.uint32(42).fork()).ldelim(); } - if (message.epochCountingStarted !== undefined) { + if (message.epochCountingStarted === true) { writer.uint32(48).bool(message.epochCountingStarted); } - if (message.currentEpochStartHeight !== undefined) { + if (message.currentEpochStartHeight !== BigInt(0)) { writer.uint32(64).int64(message.currentEpochStartHeight); } return writer; @@ -164,15 +177,15 @@ export const EpochInfo = { return message; }, fromJSON(object: any): EpochInfo { - 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; + 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) + }; }, toJSON(message: EpochInfo): JsonSafe<EpochInfo> { const obj: any = {}; @@ -189,17 +202,11 @@ export const EpochInfo = { const message = createBaseEpochInfo(); message.identifier = object.identifier ?? ""; message.startTime = object.startTime ?? undefined; - 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.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); message.currentEpochStartTime = object.currentEpochStartTime ?? undefined; message.epochCountingStarted = object.epochCountingStarted ?? false; - if (object.currentEpochStartHeight !== undefined && object.currentEpochStartHeight !== null) { - message.currentEpochStartHeight = BigInt(object.currentEpochStartHeight.toString()); - } + message.currentEpochStartHeight = object.currentEpochStartHeight !== undefined && object.currentEpochStartHeight !== null ? BigInt(object.currentEpochStartHeight.toString()) : BigInt(0); return message; }, fromSDK(object: EpochInfoSDKType): EpochInfo { @@ -324,9 +331,9 @@ export const GenesisState = { return message; }, fromJSON(object: any): GenesisState { - const obj = createBaseGenesisState(); - if (Array.isArray(object?.epochs)) obj.epochs = object.epochs.map((e: any) => EpochInfo.fromJSON(e)); - return obj; + return { + epochs: Array.isArray(object?.epochs) ? object.epochs.map((e: any) => EpochInfo.fromJSON(e)) : [] + }; }, toJSON(message: GenesisState): JsonSafe<GenesisState> { const obj: any = {}; diff --git a/__fixtures__/v-next/outputv4/osmosis/epochs/query.lcd.ts b/__fixtures__/v-next/outputv4/osmosis/epochs/query.lcd.ts index 254a6c6dbf..5c26bf7b3e 100644 --- a/__fixtures__/v-next/outputv4/osmosis/epochs/query.lcd.ts +++ b/__fixtures__/v-next/outputv4/osmosis/epochs/query.lcd.ts @@ -1,6 +1,6 @@ -import { EpochInfo, EpochInfoSDKType } from "./genesis.js"; +import { EpochInfo, EpochInfoSDKType } from "./genesis"; import { LCDClient } from "@cosmology/lcd"; -import { QueryEpochsInfoRequest, QueryEpochsInfoRequestSDKType, QueryEpochsInfoResponse, QueryEpochsInfoResponseSDKType, QueryCurrentEpochRequest, QueryCurrentEpochRequestSDKType, QueryCurrentEpochResponse, QueryCurrentEpochResponseSDKType } from "./query.js"; +import { QueryEpochsInfoRequest, QueryEpochsInfoRequestSDKType, QueryEpochsInfoResponse, QueryEpochsInfoResponseSDKType, QueryCurrentEpochRequest, QueryCurrentEpochRequestSDKType, QueryCurrentEpochResponse, QueryCurrentEpochResponseSDKType } from "./query"; export class LCDQueryClient { req: LCDClient; constructor({ diff --git a/__fixtures__/v-next/outputv4/osmosis/epochs/query.rpc.Query.ts b/__fixtures__/v-next/outputv4/osmosis/epochs/query.rpc.Query.ts index b74ffde1d0..da4b15cc14 100644 --- a/__fixtures__/v-next/outputv4/osmosis/epochs/query.rpc.Query.ts +++ b/__fixtures__/v-next/outputv4/osmosis/epochs/query.rpc.Query.ts @@ -1,8 +1,8 @@ -import { EpochInfo, EpochInfoSDKType } from "./genesis.js"; -import { Rpc } from "../../helpers.js"; -import { BinaryReader } from "../../binary.js"; +import { EpochInfo, EpochInfoSDKType } from "./genesis"; +import { Rpc } from "../../helpers"; +import { BinaryReader } from "../../binary"; import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; -import { QueryEpochsInfoRequest, QueryEpochsInfoRequestSDKType, QueryEpochsInfoResponse, QueryEpochsInfoResponseSDKType, QueryCurrentEpochRequest, QueryCurrentEpochRequestSDKType, QueryCurrentEpochResponse, QueryCurrentEpochResponseSDKType } from "./query.js"; +import { QueryEpochsInfoRequest, QueryEpochsInfoRequestSDKType, QueryEpochsInfoResponse, QueryEpochsInfoResponseSDKType, QueryCurrentEpochRequest, QueryCurrentEpochRequestSDKType, QueryCurrentEpochResponse, QueryCurrentEpochResponseSDKType, ReactiveQueryEpochsInfoRequest, ReactiveQueryCurrentEpochRequest } from "./query"; /** Query defines the gRPC querier service. */ export interface Query { /** EpochInfos provide running epochInfos */ diff --git a/__fixtures__/v-next/outputv4/osmosis/epochs/query.ts b/__fixtures__/v-next/outputv4/osmosis/epochs/query.ts index bdf7103b6c..d4ad03de8f 100644 --- a/__fixtures__/v-next/outputv4/osmosis/epochs/query.ts +++ b/__fixtures__/v-next/outputv4/osmosis/epochs/query.ts @@ -1,9 +1,11 @@ -import { EpochInfo, EpochInfoSDKType } from "./genesis.js"; -import { BinaryReader, BinaryWriter } from "../../binary.js"; -import { JsonSafe } from "../../json-safe.js"; -import { DeepPartial, isSet } from "../../helpers.js"; +import { EpochInfo, EpochInfoSDKType } from "./genesis"; +import { BinaryReader, BinaryWriter } from "../../binary"; +import { JsonSafe } from "../../json-safe"; +import { DeepPartial, isSet } from "../../helpers"; +import { ComputedRef } from "vue"; export const protobufPackage = "osmosis.epochs.v1beta1"; export interface QueryEpochsInfoRequest {} +export interface ReactiveQueryEpochsInfoRequest {} export interface QueryEpochsInfoRequestProtoMsg { typeUrl: "/osmosis.epochs.v1beta1.QueryEpochsInfoRequest"; value: Uint8Array; @@ -12,6 +14,9 @@ export interface QueryEpochsInfoRequestSDKType {} export interface QueryEpochsInfoResponse { epochs: EpochInfo[]; } +export interface ReactiveQueryEpochsInfoResponse { + epochs: ComputedRef<EpochInfo[]>; +} export interface QueryEpochsInfoResponseProtoMsg { typeUrl: "/osmosis.epochs.v1beta1.QueryEpochsInfoResponse"; value: Uint8Array; @@ -22,6 +27,9 @@ export interface QueryEpochsInfoResponseSDKType { export interface QueryCurrentEpochRequest { identifier: string; } +export interface ReactiveQueryCurrentEpochRequest { + identifier: ComputedRef<string>; +} export interface QueryCurrentEpochRequestProtoMsg { typeUrl: "/osmosis.epochs.v1beta1.QueryCurrentEpochRequest"; value: Uint8Array; @@ -32,6 +40,9 @@ export interface QueryCurrentEpochRequestSDKType { export interface QueryCurrentEpochResponse { currentEpoch: bigint; } +export interface ReactiveQueryCurrentEpochResponse { + currentEpoch: ComputedRef<bigint>; +} export interface QueryCurrentEpochResponseProtoMsg { typeUrl: "/osmosis.epochs.v1beta1.QueryCurrentEpochResponse"; value: Uint8Array; @@ -62,8 +73,7 @@ export const QueryEpochsInfoRequest = { return message; }, fromJSON(_: any): QueryEpochsInfoRequest { - const obj = createBaseQueryEpochsInfoRequest(); - return obj; + return {}; }, toJSON(_: QueryEpochsInfoRequest): JsonSafe<QueryEpochsInfoRequest> { const obj: any = {}; @@ -144,9 +154,9 @@ export const QueryEpochsInfoResponse = { return message; }, fromJSON(object: any): QueryEpochsInfoResponse { - const obj = createBaseQueryEpochsInfoResponse(); - if (Array.isArray(object?.epochs)) obj.epochs = object.epochs.map((e: any) => EpochInfo.fromJSON(e)); - return obj; + return { + epochs: Array.isArray(object?.epochs) ? object.epochs.map((e: any) => EpochInfo.fromJSON(e)) : [] + }; }, toJSON(message: QueryEpochsInfoResponse): JsonSafe<QueryEpochsInfoResponse> { const obj: any = {}; @@ -225,7 +235,7 @@ function createBaseQueryCurrentEpochRequest(): QueryCurrentEpochRequest { export const QueryCurrentEpochRequest = { typeUrl: "/osmosis.epochs.v1beta1.QueryCurrentEpochRequest", encode(message: QueryCurrentEpochRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.identifier !== undefined) { + if (message.identifier !== "") { writer.uint32(10).string(message.identifier); } return writer; @@ -248,9 +258,9 @@ export const QueryCurrentEpochRequest = { return message; }, fromJSON(object: any): QueryCurrentEpochRequest { - const obj = createBaseQueryCurrentEpochRequest(); - if (isSet(object.identifier)) obj.identifier = String(object.identifier); - return obj; + return { + identifier: isSet(object.identifier) ? String(object.identifier) : "" + }; }, toJSON(message: QueryCurrentEpochRequest): JsonSafe<QueryCurrentEpochRequest> { const obj: any = {}; @@ -319,7 +329,7 @@ function createBaseQueryCurrentEpochResponse(): QueryCurrentEpochResponse { export const QueryCurrentEpochResponse = { typeUrl: "/osmosis.epochs.v1beta1.QueryCurrentEpochResponse", encode(message: QueryCurrentEpochResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.currentEpoch !== undefined) { + if (message.currentEpoch !== BigInt(0)) { writer.uint32(8).int64(message.currentEpoch); } return writer; @@ -342,9 +352,9 @@ export const QueryCurrentEpochResponse = { return message; }, fromJSON(object: any): QueryCurrentEpochResponse { - const obj = createBaseQueryCurrentEpochResponse(); - if (isSet(object.currentEpoch)) obj.currentEpoch = BigInt(object.currentEpoch.toString()); - return obj; + return { + currentEpoch: isSet(object.currentEpoch) ? BigInt(object.currentEpoch.toString()) : BigInt(0) + }; }, toJSON(message: QueryCurrentEpochResponse): JsonSafe<QueryCurrentEpochResponse> { const obj: any = {}; @@ -353,9 +363,7 @@ export const QueryCurrentEpochResponse = { }, fromPartial(object: DeepPartial<QueryCurrentEpochResponse>): QueryCurrentEpochResponse { const message = createBaseQueryCurrentEpochResponse(); - if (object.currentEpoch !== undefined && object.currentEpoch !== null) { - message.currentEpoch = BigInt(object.currentEpoch.toString()); - } + message.currentEpoch = object.currentEpoch !== undefined && object.currentEpoch !== null ? BigInt(object.currentEpoch.toString()) : BigInt(0); return message; }, fromSDK(object: QueryCurrentEpochResponseSDKType): QueryCurrentEpochResponse { diff --git a/__fixtures__/v-next/outputv4/osmosis/gamm/pool-models/balancer/balancerPool.ts b/__fixtures__/v-next/outputv4/osmosis/gamm/pool-models/balancer/balancerPool.ts index 57874a83f4..9d3acf2234 100644 --- a/__fixtures__/v-next/outputv4/osmosis/gamm/pool-models/balancer/balancerPool.ts +++ b/__fixtures__/v-next/outputv4/osmosis/gamm/pool-models/balancer/balancerPool.ts @@ -1,10 +1,11 @@ -import { Timestamp, TimestampSDKType } from "../../../../google/protobuf/timestamp.js"; -import { Duration, DurationSDKType } from "../../../../google/protobuf/duration.js"; -import { Coin, CoinSDKType } from "../../../../cosmos/base/v1beta1/coin.js"; -import { BinaryReader, BinaryWriter } from "../../../../binary.js"; -import { toTimestamp, fromTimestamp, isSet, DeepPartial } from "../../../../helpers.js"; -import { JsonSafe } from "../../../../json-safe.js"; +import { Timestamp, TimestampSDKType } from "../../../../google/protobuf/timestamp"; +import { Duration, DurationSDKType } from "../../../../google/protobuf/duration"; +import { Coin, CoinSDKType } from "../../../../cosmos/base/v1beta1/coin"; +import { BinaryReader, BinaryWriter } from "../../../../binary"; +import { toTimestamp, fromTimestamp, isSet, DeepPartial } from "../../../../helpers"; +import { JsonSafe } from "../../../../json-safe"; import { Decimal } from "@cosmjs/math"; +import { ComputedRef } from "vue"; export const protobufPackage = "osmosis.gamm.v1beta1"; /** * Parameters for changing the weights in a balancer pool smoothly from @@ -44,6 +45,12 @@ export interface SmoothWeightChangeParams { */ targetPoolWeights: PoolAsset[]; } +export interface ReactiveSmoothWeightChangeParams { + startTime: ComputedRef<Date>; + duration: ComputedRef<Duration>; + initialPoolWeights: ComputedRef<PoolAsset[]>; + targetPoolWeights: ComputedRef<PoolAsset[]>; +} export interface SmoothWeightChangeParamsProtoMsg { typeUrl: "/osmosis.gamm.v1beta1.SmoothWeightChangeParams"; value: Uint8Array; @@ -78,6 +85,11 @@ export interface PoolParams { exitFee: string; smoothWeightChangeParams?: SmoothWeightChangeParams; } +export interface ReactivePoolParams { + swapFee: ComputedRef<string>; + exitFee: ComputedRef<string>; + smoothWeightChangeParams?: ComputedRef<SmoothWeightChangeParams>; +} export interface PoolParamsProtoMsg { typeUrl: "/osmosis.gamm.v1beta1.PoolParams"; value: Uint8Array; @@ -108,6 +120,10 @@ export interface PoolAsset { /** Weight that is not normalized. This weight must be less than 2^50 */ weight: string; } +export interface ReactivePoolAsset { + token: ComputedRef<Coin>; + weight: ComputedRef<string>; +} export interface PoolAssetProtoMsg { typeUrl: "/osmosis.gamm.v1beta1.PoolAsset"; value: Uint8Array; @@ -148,6 +164,15 @@ export interface Pool { /** sum of all non-normalized pool weights */ totalWeight: string; } +export interface ReactivePool { + address: ComputedRef<string>; + id: ComputedRef<bigint>; + poolParams: ComputedRef<PoolParams>; + futurePoolGovernor: ComputedRef<string>; + totalShares: ComputedRef<Coin>; + poolAssets: ComputedRef<PoolAsset[]>; + totalWeight: ComputedRef<string>; +} export interface PoolProtoMsg { typeUrl: "/osmosis.gamm.v1beta1.Pool"; value: Uint8Array; @@ -213,12 +238,12 @@ export const SmoothWeightChangeParams = { return message; }, fromJSON(object: any): SmoothWeightChangeParams { - const obj = createBaseSmoothWeightChangeParams(); - if (isSet(object.startTime)) obj.startTime = new Date(object.startTime); - if (isSet(object.duration)) obj.duration = Duration.fromJSON(object.duration); - if (Array.isArray(object?.initialPoolWeights)) obj.initialPoolWeights = object.initialPoolWeights.map((e: any) => PoolAsset.fromJSON(e)); - if (Array.isArray(object?.targetPoolWeights)) obj.targetPoolWeights = object.targetPoolWeights.map((e: any) => PoolAsset.fromJSON(e)); - return obj; + return { + startTime: isSet(object.startTime) ? new Date(object.startTime) : undefined, + duration: isSet(object.duration) ? Duration.fromJSON(object.duration) : undefined, + initialPoolWeights: Array.isArray(object?.initialPoolWeights) ? object.initialPoolWeights.map((e: any) => PoolAsset.fromJSON(e)) : [], + targetPoolWeights: Array.isArray(object?.targetPoolWeights) ? object.targetPoolWeights.map((e: any) => PoolAsset.fromJSON(e)) : [] + }; }, toJSON(message: SmoothWeightChangeParams): JsonSafe<SmoothWeightChangeParams> { const obj: any = {}; @@ -239,9 +264,7 @@ export const SmoothWeightChangeParams = { fromPartial(object: DeepPartial<SmoothWeightChangeParams>): SmoothWeightChangeParams { const message = createBaseSmoothWeightChangeParams(); message.startTime = object.startTime ?? undefined; - if (object.duration !== undefined && object.duration !== null) { - message.duration = Duration.fromPartial(object.duration); - } + message.duration = object.duration !== undefined && object.duration !== null ? Duration.fromPartial(object.duration) : undefined; message.initialPoolWeights = object.initialPoolWeights?.map(e => PoolAsset.fromPartial(e)) || []; message.targetPoolWeights = object.targetPoolWeights?.map(e => PoolAsset.fromPartial(e)) || []; return message; @@ -338,10 +361,10 @@ function createBasePoolParams(): PoolParams { export const PoolParams = { typeUrl: "/osmosis.gamm.v1beta1.PoolParams", encode(message: PoolParams, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.swapFee !== undefined) { + if (message.swapFee !== "") { writer.uint32(10).string(Decimal.fromUserInput(message.swapFee, 18).atomics); } - if (message.exitFee !== undefined) { + if (message.exitFee !== "") { writer.uint32(18).string(Decimal.fromUserInput(message.exitFee, 18).atomics); } if (message.smoothWeightChangeParams !== undefined) { @@ -373,11 +396,11 @@ export const PoolParams = { return message; }, fromJSON(object: any): PoolParams { - const obj = createBasePoolParams(); - if (isSet(object.swapFee)) obj.swapFee = String(object.swapFee); - if (isSet(object.exitFee)) obj.exitFee = String(object.exitFee); - if (isSet(object.smoothWeightChangeParams)) obj.smoothWeightChangeParams = SmoothWeightChangeParams.fromJSON(object.smoothWeightChangeParams); - return obj; + return { + swapFee: isSet(object.swapFee) ? String(object.swapFee) : "", + exitFee: isSet(object.exitFee) ? String(object.exitFee) : "", + smoothWeightChangeParams: isSet(object.smoothWeightChangeParams) ? SmoothWeightChangeParams.fromJSON(object.smoothWeightChangeParams) : undefined + }; }, toJSON(message: PoolParams): JsonSafe<PoolParams> { const obj: any = {}; @@ -390,9 +413,7 @@ export const PoolParams = { const message = createBasePoolParams(); message.swapFee = object.swapFee ?? ""; message.exitFee = object.exitFee ?? ""; - if (object.smoothWeightChangeParams !== undefined && object.smoothWeightChangeParams !== null) { - message.smoothWeightChangeParams = SmoothWeightChangeParams.fromPartial(object.smoothWeightChangeParams); - } + message.smoothWeightChangeParams = object.smoothWeightChangeParams !== undefined && object.smoothWeightChangeParams !== null ? SmoothWeightChangeParams.fromPartial(object.smoothWeightChangeParams) : undefined; return message; }, fromSDK(object: PoolParamsSDKType): PoolParams { @@ -470,7 +491,7 @@ export const PoolAsset = { if (message.token !== undefined) { Coin.encode(message.token, writer.uint32(10).fork()).ldelim(); } - if (message.weight !== undefined) { + if (message.weight !== "") { writer.uint32(18).string(message.weight); } return writer; @@ -496,10 +517,10 @@ export const PoolAsset = { return message; }, fromJSON(object: any): PoolAsset { - const obj = createBasePoolAsset(); - if (isSet(object.token)) obj.token = Coin.fromJSON(object.token); - if (isSet(object.weight)) obj.weight = String(object.weight); - return obj; + return { + token: isSet(object.token) ? Coin.fromJSON(object.token) : undefined, + weight: isSet(object.weight) ? String(object.weight) : "" + }; }, toJSON(message: PoolAsset): JsonSafe<PoolAsset> { const obj: any = {}; @@ -509,9 +530,7 @@ export const PoolAsset = { }, fromPartial(object: DeepPartial<PoolAsset>): PoolAsset { const message = createBasePoolAsset(); - if (object.token !== undefined && object.token !== null) { - message.token = Coin.fromPartial(object.token); - } + message.token = object.token !== undefined && object.token !== null ? Coin.fromPartial(object.token) : undefined; message.weight = object.weight ?? ""; return message; }, @@ -585,16 +604,16 @@ function createBasePool(): Pool { export const Pool = { typeUrl: "/osmosis.gamm.v1beta1.Pool", encode(message: Pool, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.address !== undefined) { + if (message.address !== "") { writer.uint32(10).string(message.address); } - if (message.id !== undefined) { + if (message.id !== BigInt(0)) { writer.uint32(16).uint64(message.id); } if (message.poolParams !== undefined) { PoolParams.encode(message.poolParams, writer.uint32(26).fork()).ldelim(); } - if (message.futurePoolGovernor !== undefined) { + if (message.futurePoolGovernor !== "") { writer.uint32(34).string(message.futurePoolGovernor); } if (message.totalShares !== undefined) { @@ -603,7 +622,7 @@ export const Pool = { for (const v of message.poolAssets) { PoolAsset.encode(v!, writer.uint32(50).fork()).ldelim(); } - if (message.totalWeight !== undefined) { + if (message.totalWeight !== "") { writer.uint32(58).string(message.totalWeight); } return writer; @@ -644,15 +663,15 @@ export const Pool = { return message; }, fromJSON(object: any): Pool { - const obj = createBasePool(); - if (isSet(object.address)) obj.address = String(object.address); - if (isSet(object.id)) obj.id = BigInt(object.id.toString()); - if (isSet(object.poolParams)) obj.poolParams = PoolParams.fromJSON(object.poolParams); - if (isSet(object.futurePoolGovernor)) obj.futurePoolGovernor = String(object.futurePoolGovernor); - if (isSet(object.totalShares)) obj.totalShares = Coin.fromJSON(object.totalShares); - if (Array.isArray(object?.poolAssets)) obj.poolAssets = object.poolAssets.map((e: any) => PoolAsset.fromJSON(e)); - if (isSet(object.totalWeight)) obj.totalWeight = String(object.totalWeight); - return obj; + return { + address: isSet(object.address) ? String(object.address) : "", + id: isSet(object.id) ? BigInt(object.id.toString()) : BigInt(0), + poolParams: isSet(object.poolParams) ? PoolParams.fromJSON(object.poolParams) : undefined, + futurePoolGovernor: isSet(object.futurePoolGovernor) ? String(object.futurePoolGovernor) : "", + totalShares: isSet(object.totalShares) ? Coin.fromJSON(object.totalShares) : undefined, + poolAssets: Array.isArray(object?.poolAssets) ? object.poolAssets.map((e: any) => PoolAsset.fromJSON(e)) : [], + totalWeight: isSet(object.totalWeight) ? String(object.totalWeight) : "" + }; }, toJSON(message: Pool): JsonSafe<Pool> { const obj: any = {}; @@ -672,16 +691,10 @@ export const Pool = { fromPartial(object: DeepPartial<Pool>): Pool { const message = createBasePool(); message.address = object.address ?? ""; - if (object.id !== undefined && object.id !== null) { - message.id = BigInt(object.id.toString()); - } - if (object.poolParams !== undefined && object.poolParams !== null) { - message.poolParams = PoolParams.fromPartial(object.poolParams); - } + message.id = object.id !== undefined && object.id !== null ? BigInt(object.id.toString()) : BigInt(0); + message.poolParams = object.poolParams !== undefined && object.poolParams !== null ? PoolParams.fromPartial(object.poolParams) : undefined; message.futurePoolGovernor = object.futurePoolGovernor ?? ""; - if (object.totalShares !== undefined && object.totalShares !== null) { - message.totalShares = Coin.fromPartial(object.totalShares); - } + message.totalShares = object.totalShares !== undefined && object.totalShares !== null ? Coin.fromPartial(object.totalShares) : undefined; message.poolAssets = object.poolAssets?.map(e => PoolAsset.fromPartial(e)) || []; message.totalWeight = object.totalWeight ?? ""; return message; diff --git a/__fixtures__/v-next/outputv4/osmosis/gamm/pool-models/balancer/tx/tx.amino.ts b/__fixtures__/v-next/outputv4/osmosis/gamm/pool-models/balancer/tx/tx.amino.ts index 21be6aafdb..e481a8e582 100644 --- a/__fixtures__/v-next/outputv4/osmosis/gamm/pool-models/balancer/tx/tx.amino.ts +++ b/__fixtures__/v-next/outputv4/osmosis/gamm/pool-models/balancer/tx/tx.amino.ts @@ -1,9 +1,9 @@ //@ts-nocheck -import { PoolParams, PoolParamsSDKType, PoolAsset, PoolAssetSDKType, SmoothWeightChangeParams, SmoothWeightChangeParamsSDKType } from "../balancerPool.js"; +import { PoolParams, PoolParamsSDKType, PoolAsset, PoolAssetSDKType, SmoothWeightChangeParams, SmoothWeightChangeParamsSDKType } from "../balancerPool"; import { AminoMsg } from "@cosmjs/amino"; -import { Duration, DurationSDKType } from "../../../../../google/protobuf/duration.js"; -import { Coin, CoinSDKType } from "../../../../../cosmos/base/v1beta1/coin.js"; -import { MsgCreateBalancerPool, MsgCreateBalancerPoolSDKType } from "./tx.js"; +import { Duration, DurationSDKType } from "../../../../../google/protobuf/duration"; +import { Coin, CoinSDKType } from "../../../../../cosmos/base/v1beta1/coin"; +import { MsgCreateBalancerPool, MsgCreateBalancerPoolSDKType } from "./tx"; export interface MsgCreateBalancerPoolAminoType extends AminoMsg { type: "osmosis/gamm/poolmodels/balancer/create-balancer-pool"; value: { diff --git a/__fixtures__/v-next/outputv4/osmosis/gamm/pool-models/balancer/tx/tx.registry.ts b/__fixtures__/v-next/outputv4/osmosis/gamm/pool-models/balancer/tx/tx.registry.ts index b8074d4f53..2f35b2b3f4 100644 --- a/__fixtures__/v-next/outputv4/osmosis/gamm/pool-models/balancer/tx/tx.registry.ts +++ b/__fixtures__/v-next/outputv4/osmosis/gamm/pool-models/balancer/tx/tx.registry.ts @@ -1,6 +1,6 @@ -import { PoolParams, PoolParamsSDKType, PoolAsset, PoolAssetSDKType } from "../balancerPool.js"; +import { PoolParams, PoolParamsSDKType, PoolAsset, PoolAssetSDKType } from "../balancerPool"; import { GeneratedType, Registry } from "@cosmjs/proto-signing"; -import { MsgCreateBalancerPool, MsgCreateBalancerPoolSDKType } from "./tx.js"; +import { MsgCreateBalancerPool, MsgCreateBalancerPoolSDKType } from "./tx"; export const registry: ReadonlyArray<[string, GeneratedType]> = [["/osmosis.gamm.poolmodels.balancer.v1beta1.MsgCreateBalancerPool", MsgCreateBalancerPool]]; export const load = (protoRegistry: Registry) => { registry.forEach(([typeUrl, mod]) => { diff --git a/__fixtures__/v-next/outputv4/osmosis/gamm/pool-models/balancer/tx/tx.rpc.msg.ts b/__fixtures__/v-next/outputv4/osmosis/gamm/pool-models/balancer/tx/tx.rpc.msg.ts index 3333871754..c73a6d2a01 100644 --- a/__fixtures__/v-next/outputv4/osmosis/gamm/pool-models/balancer/tx/tx.rpc.msg.ts +++ b/__fixtures__/v-next/outputv4/osmosis/gamm/pool-models/balancer/tx/tx.rpc.msg.ts @@ -1,7 +1,7 @@ -import { PoolParams, PoolParamsSDKType, PoolAsset, PoolAssetSDKType } from "../balancerPool.js"; -import { Rpc } from "../../../../../helpers.js"; -import { BinaryReader } from "../../../../../binary.js"; -import { MsgCreateBalancerPool, MsgCreateBalancerPoolSDKType, MsgCreateBalancerPoolResponse, MsgCreateBalancerPoolResponseSDKType } from "./tx.js"; +import { PoolParams, PoolParamsSDKType, PoolAsset, PoolAssetSDKType } from "../balancerPool"; +import { Rpc } from "../../../../../helpers"; +import { BinaryReader } from "../../../../../binary"; +import { MsgCreateBalancerPool, MsgCreateBalancerPoolSDKType, MsgCreateBalancerPoolResponse, MsgCreateBalancerPoolResponseSDKType } from "./tx"; export interface Msg { createBalancerPool(request: MsgCreateBalancerPool): Promise<MsgCreateBalancerPoolResponse>; } diff --git a/__fixtures__/v-next/outputv4/osmosis/gamm/pool-models/balancer/tx/tx.ts b/__fixtures__/v-next/outputv4/osmosis/gamm/pool-models/balancer/tx/tx.ts index 37f43a7d22..fc987db64a 100644 --- a/__fixtures__/v-next/outputv4/osmosis/gamm/pool-models/balancer/tx/tx.ts +++ b/__fixtures__/v-next/outputv4/osmosis/gamm/pool-models/balancer/tx/tx.ts @@ -1,7 +1,8 @@ -import { PoolParams, PoolParamsSDKType, PoolAsset, PoolAssetSDKType } from "../balancerPool.js"; -import { BinaryReader, BinaryWriter } from "../../../../../binary.js"; -import { isSet, DeepPartial } from "../../../../../helpers.js"; -import { JsonSafe } from "../../../../../json-safe.js"; +import { PoolParams, PoolParamsSDKType, PoolAsset, PoolAssetSDKType } from "../balancerPool"; +import { BinaryReader, BinaryWriter } from "../../../../../binary"; +import { isSet, DeepPartial } from "../../../../../helpers"; +import { JsonSafe } from "../../../../../json-safe"; +import { ComputedRef } from "vue"; export const protobufPackage = "osmosis.gamm.poolmodels.balancer.v1beta1"; /** ===================== MsgCreatePool */ export interface MsgCreateBalancerPool { @@ -10,6 +11,12 @@ export interface MsgCreateBalancerPool { poolAssets: PoolAsset[]; futurePoolGovernor: string; } +export interface ReactiveMsgCreateBalancerPool { + sender: ComputedRef<string>; + poolParams?: ComputedRef<PoolParams>; + poolAssets: ComputedRef<PoolAsset[]>; + futurePoolGovernor: ComputedRef<string>; +} export interface MsgCreateBalancerPoolProtoMsg { typeUrl: "/osmosis.gamm.poolmodels.balancer.v1beta1.MsgCreateBalancerPool"; value: Uint8Array; @@ -25,6 +32,9 @@ export interface MsgCreateBalancerPoolSDKType { export interface MsgCreateBalancerPoolResponse { poolId: bigint; } +export interface ReactiveMsgCreateBalancerPoolResponse { + poolId: ComputedRef<bigint>; +} export interface MsgCreateBalancerPoolResponseProtoMsg { typeUrl: "/osmosis.gamm.poolmodels.balancer.v1beta1.MsgCreateBalancerPoolResponse"; value: Uint8Array; @@ -44,7 +54,7 @@ function createBaseMsgCreateBalancerPool(): MsgCreateBalancerPool { export const MsgCreateBalancerPool = { typeUrl: "/osmosis.gamm.poolmodels.balancer.v1beta1.MsgCreateBalancerPool", encode(message: MsgCreateBalancerPool, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.sender !== undefined) { + if (message.sender !== "") { writer.uint32(10).string(message.sender); } if (message.poolParams !== undefined) { @@ -53,7 +63,7 @@ export const MsgCreateBalancerPool = { for (const v of message.poolAssets) { PoolAsset.encode(v!, writer.uint32(26).fork()).ldelim(); } - if (message.futurePoolGovernor !== undefined) { + if (message.futurePoolGovernor !== "") { writer.uint32(34).string(message.futurePoolGovernor); } return writer; @@ -85,12 +95,12 @@ export const MsgCreateBalancerPool = { return message; }, fromJSON(object: any): MsgCreateBalancerPool { - const obj = createBaseMsgCreateBalancerPool(); - if (isSet(object.sender)) obj.sender = String(object.sender); - if (isSet(object.poolParams)) obj.poolParams = PoolParams.fromJSON(object.poolParams); - if (Array.isArray(object?.poolAssets)) obj.poolAssets = object.poolAssets.map((e: any) => PoolAsset.fromJSON(e)); - if (isSet(object.futurePoolGovernor)) obj.futurePoolGovernor = String(object.futurePoolGovernor); - return obj; + return { + sender: isSet(object.sender) ? String(object.sender) : "", + poolParams: isSet(object.poolParams) ? PoolParams.fromJSON(object.poolParams) : undefined, + poolAssets: Array.isArray(object?.poolAssets) ? object.poolAssets.map((e: any) => PoolAsset.fromJSON(e)) : [], + futurePoolGovernor: isSet(object.futurePoolGovernor) ? String(object.futurePoolGovernor) : "" + }; }, toJSON(message: MsgCreateBalancerPool): JsonSafe<MsgCreateBalancerPool> { const obj: any = {}; @@ -107,9 +117,7 @@ export const MsgCreateBalancerPool = { fromPartial(object: DeepPartial<MsgCreateBalancerPool>): MsgCreateBalancerPool { const message = createBaseMsgCreateBalancerPool(); message.sender = object.sender ?? ""; - if (object.poolParams !== undefined && object.poolParams !== null) { - message.poolParams = PoolParams.fromPartial(object.poolParams); - } + message.poolParams = object.poolParams !== undefined && object.poolParams !== null ? PoolParams.fromPartial(object.poolParams) : undefined; message.poolAssets = object.poolAssets?.map(e => PoolAsset.fromPartial(e)) || []; message.futurePoolGovernor = object.futurePoolGovernor ?? ""; return message; @@ -198,7 +206,7 @@ function createBaseMsgCreateBalancerPoolResponse(): MsgCreateBalancerPoolRespons export const MsgCreateBalancerPoolResponse = { typeUrl: "/osmosis.gamm.poolmodels.balancer.v1beta1.MsgCreateBalancerPoolResponse", encode(message: MsgCreateBalancerPoolResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.poolId !== undefined) { + if (message.poolId !== BigInt(0)) { writer.uint32(8).uint64(message.poolId); } return writer; @@ -221,9 +229,9 @@ export const MsgCreateBalancerPoolResponse = { return message; }, fromJSON(object: any): MsgCreateBalancerPoolResponse { - const obj = createBaseMsgCreateBalancerPoolResponse(); - if (isSet(object.poolId)) obj.poolId = BigInt(object.poolId.toString()); - return obj; + return { + poolId: isSet(object.poolId) ? BigInt(object.poolId.toString()) : BigInt(0) + }; }, toJSON(message: MsgCreateBalancerPoolResponse): JsonSafe<MsgCreateBalancerPoolResponse> { const obj: any = {}; @@ -232,9 +240,7 @@ export const MsgCreateBalancerPoolResponse = { }, fromPartial(object: DeepPartial<MsgCreateBalancerPoolResponse>): MsgCreateBalancerPoolResponse { const message = createBaseMsgCreateBalancerPoolResponse(); - if (object.poolId !== undefined && object.poolId !== null) { - message.poolId = BigInt(object.poolId.toString()); - } + message.poolId = object.poolId !== undefined && object.poolId !== null ? BigInt(object.poolId.toString()) : BigInt(0); return message; }, fromSDK(object: MsgCreateBalancerPoolResponseSDKType): MsgCreateBalancerPoolResponse { diff --git a/__fixtures__/v-next/outputv4/osmosis/gamm/pool-models/stableswap/stableswap_pool.ts b/__fixtures__/v-next/outputv4/osmosis/gamm/pool-models/stableswap/stableswap_pool.ts index a1e1aeaf76..ca4ed4cfa4 100644 --- a/__fixtures__/v-next/outputv4/osmosis/gamm/pool-models/stableswap/stableswap_pool.ts +++ b/__fixtures__/v-next/outputv4/osmosis/gamm/pool-models/stableswap/stableswap_pool.ts @@ -1,8 +1,9 @@ -import { Coin, CoinSDKType } from "../../../../cosmos/base/v1beta1/coin.js"; -import { BinaryReader, BinaryWriter } from "../../../../binary.js"; +import { Coin, CoinSDKType } from "../../../../cosmos/base/v1beta1/coin"; +import { BinaryReader, BinaryWriter } from "../../../../binary"; import { Decimal } from "@cosmjs/math"; -import { isSet, DeepPartial } from "../../../../helpers.js"; -import { JsonSafe } from "../../../../json-safe.js"; +import { isSet, DeepPartial } from "../../../../helpers"; +import { JsonSafe } from "../../../../json-safe"; +import { ComputedRef } from "vue"; export const protobufPackage = "osmosis.gamm.poolmodels.stableswap.v1beta1"; /** * PoolParams defined the parameters that will be managed by the pool @@ -14,6 +15,10 @@ export interface PoolParams { swapFee: string; exitFee: string; } +export interface ReactivePoolParams { + swapFee: ComputedRef<string>; + exitFee: ComputedRef<string>; +} export interface PoolParamsProtoMsg { typeUrl: "/osmosis.gamm.poolmodels.stableswap.v1beta1.PoolParams"; value: Uint8Array; @@ -53,6 +58,16 @@ export interface Pool { /** scaling_factor_controller is the address can adjust pool scaling factors */ scalingFactorController: string; } +export interface ReactivePool { + address: ComputedRef<string>; + id: ComputedRef<bigint>; + poolParams: ComputedRef<PoolParams>; + futurePoolGovernor: ComputedRef<string>; + totalShares: ComputedRef<Coin>; + poolLiquidity: ComputedRef<Coin[]>; + scalingFactors: ComputedRef<bigint[]>; + scalingFactorController: ComputedRef<string>; +} export interface PoolProtoMsg { typeUrl: "/osmosis.gamm.poolmodels.stableswap.v1beta1.Pool"; value: Uint8Array; @@ -77,10 +92,10 @@ function createBasePoolParams(): PoolParams { export const PoolParams = { typeUrl: "/osmosis.gamm.poolmodels.stableswap.v1beta1.PoolParams", encode(message: PoolParams, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.swapFee !== undefined) { + if (message.swapFee !== "") { writer.uint32(10).string(Decimal.fromUserInput(message.swapFee, 18).atomics); } - if (message.exitFee !== undefined) { + if (message.exitFee !== "") { writer.uint32(18).string(Decimal.fromUserInput(message.exitFee, 18).atomics); } return writer; @@ -106,10 +121,10 @@ export const PoolParams = { return message; }, fromJSON(object: any): PoolParams { - const obj = createBasePoolParams(); - if (isSet(object.swapFee)) obj.swapFee = String(object.swapFee); - if (isSet(object.exitFee)) obj.exitFee = String(object.exitFee); - return obj; + return { + swapFee: isSet(object.swapFee) ? String(object.swapFee) : "", + exitFee: isSet(object.exitFee) ? String(object.exitFee) : "" + }; }, toJSON(message: PoolParams): JsonSafe<PoolParams> { const obj: any = {}; @@ -194,16 +209,16 @@ function createBasePool(): Pool { export const Pool = { typeUrl: "/osmosis.gamm.poolmodels.stableswap.v1beta1.Pool", encode(message: Pool, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.address !== undefined) { + if (message.address !== "") { writer.uint32(10).string(message.address); } - if (message.id !== undefined) { + if (message.id !== BigInt(0)) { writer.uint32(16).uint64(message.id); } if (message.poolParams !== undefined) { PoolParams.encode(message.poolParams, writer.uint32(26).fork()).ldelim(); } - if (message.futurePoolGovernor !== undefined) { + if (message.futurePoolGovernor !== "") { writer.uint32(34).string(message.futurePoolGovernor); } if (message.totalShares !== undefined) { @@ -217,7 +232,7 @@ export const Pool = { writer.uint64(v); } writer.ldelim(); - if (message.scalingFactorController !== undefined) { + if (message.scalingFactorController !== "") { writer.uint32(66).string(message.scalingFactorController); } return writer; @@ -268,16 +283,16 @@ export const Pool = { return message; }, fromJSON(object: any): Pool { - const obj = createBasePool(); - if (isSet(object.address)) obj.address = String(object.address); - if (isSet(object.id)) obj.id = BigInt(object.id.toString()); - if (isSet(object.poolParams)) obj.poolParams = PoolParams.fromJSON(object.poolParams); - if (isSet(object.futurePoolGovernor)) obj.futurePoolGovernor = String(object.futurePoolGovernor); - if (isSet(object.totalShares)) obj.totalShares = Coin.fromJSON(object.totalShares); - if (Array.isArray(object?.poolLiquidity)) obj.poolLiquidity = object.poolLiquidity.map((e: any) => Coin.fromJSON(e)); - if (Array.isArray(object?.scalingFactors)) obj.scalingFactors = object.scalingFactors.map((e: any) => BigInt(e.toString())); - if (isSet(object.scalingFactorController)) obj.scalingFactorController = String(object.scalingFactorController); - return obj; + return { + address: isSet(object.address) ? String(object.address) : "", + id: isSet(object.id) ? BigInt(object.id.toString()) : BigInt(0), + poolParams: isSet(object.poolParams) ? PoolParams.fromJSON(object.poolParams) : undefined, + futurePoolGovernor: isSet(object.futurePoolGovernor) ? String(object.futurePoolGovernor) : "", + totalShares: isSet(object.totalShares) ? Coin.fromJSON(object.totalShares) : undefined, + poolLiquidity: Array.isArray(object?.poolLiquidity) ? object.poolLiquidity.map((e: any) => Coin.fromJSON(e)) : [], + scalingFactors: Array.isArray(object?.scalingFactors) ? object.scalingFactors.map((e: any) => BigInt(e.toString())) : [], + scalingFactorController: isSet(object.scalingFactorController) ? String(object.scalingFactorController) : "" + }; }, toJSON(message: Pool): JsonSafe<Pool> { const obj: any = {}; @@ -302,16 +317,10 @@ export const Pool = { fromPartial(object: DeepPartial<Pool>): Pool { const message = createBasePool(); message.address = object.address ?? ""; - if (object.id !== undefined && object.id !== null) { - message.id = BigInt(object.id.toString()); - } - if (object.poolParams !== undefined && object.poolParams !== null) { - message.poolParams = PoolParams.fromPartial(object.poolParams); - } + message.id = object.id !== undefined && object.id !== null ? BigInt(object.id.toString()) : BigInt(0); + message.poolParams = object.poolParams !== undefined && object.poolParams !== null ? PoolParams.fromPartial(object.poolParams) : undefined; message.futurePoolGovernor = object.futurePoolGovernor ?? ""; - if (object.totalShares !== undefined && object.totalShares !== null) { - message.totalShares = Coin.fromPartial(object.totalShares); - } + message.totalShares = object.totalShares !== undefined && object.totalShares !== null ? Coin.fromPartial(object.totalShares) : undefined; message.poolLiquidity = object.poolLiquidity?.map(e => Coin.fromPartial(e)) || []; message.scalingFactors = object.scalingFactors?.map(e => BigInt(e.toString())) || []; message.scalingFactorController = object.scalingFactorController ?? ""; diff --git a/__fixtures__/v-next/outputv4/osmosis/gamm/pool-models/stableswap/tx.amino.ts b/__fixtures__/v-next/outputv4/osmosis/gamm/pool-models/stableswap/tx.amino.ts index e0434c0e71..7811c40f43 100644 --- a/__fixtures__/v-next/outputv4/osmosis/gamm/pool-models/stableswap/tx.amino.ts +++ b/__fixtures__/v-next/outputv4/osmosis/gamm/pool-models/stableswap/tx.amino.ts @@ -1,8 +1,8 @@ //@ts-nocheck -import { PoolParams, PoolParamsSDKType } from "./stableswap_pool.js"; -import { Coin, CoinSDKType } from "../../../../cosmos/base/v1beta1/coin.js"; +import { PoolParams, PoolParamsSDKType } from "./stableswap_pool"; +import { Coin, CoinSDKType } from "../../../../cosmos/base/v1beta1/coin"; import { AminoMsg } from "@cosmjs/amino"; -import { MsgCreateStableswapPool, MsgCreateStableswapPoolSDKType, MsgStableSwapAdjustScalingFactors, MsgStableSwapAdjustScalingFactorsSDKType } from "./tx.js"; +import { MsgCreateStableswapPool, MsgCreateStableswapPoolSDKType, MsgStableSwapAdjustScalingFactors, MsgStableSwapAdjustScalingFactorsSDKType } from "./tx"; export interface MsgCreateStableswapPoolAminoType extends AminoMsg { type: "osmosis/gamm/create-stableswap-pool"; value: { diff --git a/__fixtures__/v-next/outputv4/osmosis/gamm/pool-models/stableswap/tx.registry.ts b/__fixtures__/v-next/outputv4/osmosis/gamm/pool-models/stableswap/tx.registry.ts index 3c5ae672b8..3266bc5bb8 100644 --- a/__fixtures__/v-next/outputv4/osmosis/gamm/pool-models/stableswap/tx.registry.ts +++ b/__fixtures__/v-next/outputv4/osmosis/gamm/pool-models/stableswap/tx.registry.ts @@ -1,7 +1,7 @@ -import { PoolParams, PoolParamsSDKType } from "./stableswap_pool.js"; -import { Coin, CoinSDKType } from "../../../../cosmos/base/v1beta1/coin.js"; +import { PoolParams, PoolParamsSDKType } from "./stableswap_pool"; +import { Coin, CoinSDKType } from "../../../../cosmos/base/v1beta1/coin"; import { GeneratedType, Registry } from "@cosmjs/proto-signing"; -import { MsgCreateStableswapPool, MsgCreateStableswapPoolSDKType, MsgStableSwapAdjustScalingFactors, MsgStableSwapAdjustScalingFactorsSDKType } from "./tx.js"; +import { MsgCreateStableswapPool, MsgCreateStableswapPoolSDKType, MsgStableSwapAdjustScalingFactors, MsgStableSwapAdjustScalingFactorsSDKType } from "./tx"; export const registry: ReadonlyArray<[string, GeneratedType]> = [["/osmosis.gamm.poolmodels.stableswap.v1beta1.MsgCreateStableswapPool", MsgCreateStableswapPool], ["/osmosis.gamm.poolmodels.stableswap.v1beta1.MsgStableSwapAdjustScalingFactors", MsgStableSwapAdjustScalingFactors]]; export const load = (protoRegistry: Registry) => { registry.forEach(([typeUrl, mod]) => { diff --git a/__fixtures__/v-next/outputv4/osmosis/gamm/pool-models/stableswap/tx.rpc.msg.ts b/__fixtures__/v-next/outputv4/osmosis/gamm/pool-models/stableswap/tx.rpc.msg.ts index 542d6a0002..bbaaf941cb 100644 --- a/__fixtures__/v-next/outputv4/osmosis/gamm/pool-models/stableswap/tx.rpc.msg.ts +++ b/__fixtures__/v-next/outputv4/osmosis/gamm/pool-models/stableswap/tx.rpc.msg.ts @@ -1,8 +1,8 @@ -import { PoolParams, PoolParamsSDKType } from "./stableswap_pool.js"; -import { Coin, CoinSDKType } from "../../../../cosmos/base/v1beta1/coin.js"; -import { Rpc } from "../../../../helpers.js"; -import { BinaryReader } from "../../../../binary.js"; -import { MsgCreateStableswapPool, MsgCreateStableswapPoolSDKType, MsgCreateStableswapPoolResponse, MsgCreateStableswapPoolResponseSDKType, MsgStableSwapAdjustScalingFactors, MsgStableSwapAdjustScalingFactorsSDKType, MsgStableSwapAdjustScalingFactorsResponse, MsgStableSwapAdjustScalingFactorsResponseSDKType } from "./tx.js"; +import { PoolParams, PoolParamsSDKType } from "./stableswap_pool"; +import { Coin, CoinSDKType } from "../../../../cosmos/base/v1beta1/coin"; +import { Rpc } from "../../../../helpers"; +import { BinaryReader } from "../../../../binary"; +import { MsgCreateStableswapPool, MsgCreateStableswapPoolSDKType, MsgCreateStableswapPoolResponse, MsgCreateStableswapPoolResponseSDKType, MsgStableSwapAdjustScalingFactors, MsgStableSwapAdjustScalingFactorsSDKType, MsgStableSwapAdjustScalingFactorsResponse, MsgStableSwapAdjustScalingFactorsResponseSDKType } from "./tx"; export interface Msg { createStableswapPool(request: MsgCreateStableswapPool): Promise<MsgCreateStableswapPoolResponse>; stableSwapAdjustScalingFactors(request: MsgStableSwapAdjustScalingFactors): Promise<MsgStableSwapAdjustScalingFactorsResponse>; diff --git a/__fixtures__/v-next/outputv4/osmosis/gamm/pool-models/stableswap/tx.ts b/__fixtures__/v-next/outputv4/osmosis/gamm/pool-models/stableswap/tx.ts index 161a69ee17..f9707c373c 100644 --- a/__fixtures__/v-next/outputv4/osmosis/gamm/pool-models/stableswap/tx.ts +++ b/__fixtures__/v-next/outputv4/osmosis/gamm/pool-models/stableswap/tx.ts @@ -1,8 +1,9 @@ -import { PoolParams, PoolParamsSDKType } from "./stableswap_pool.js"; -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"; +import { PoolParams, PoolParamsSDKType } from "./stableswap_pool"; +import { Coin, CoinSDKType } from "../../../../cosmos/base/v1beta1/coin"; +import { BinaryReader, BinaryWriter } from "../../../../binary"; +import { isSet, DeepPartial } from "../../../../helpers"; +import { JsonSafe } from "../../../../json-safe"; +import { ComputedRef } from "vue"; export const protobufPackage = "osmosis.gamm.poolmodels.stableswap.v1beta1"; /** ===================== MsgCreatePool */ export interface MsgCreateStableswapPool { @@ -13,6 +14,14 @@ export interface MsgCreateStableswapPool { futurePoolGovernor: string; scalingFactorController: string; } +export interface ReactiveMsgCreateStableswapPool { + sender: ComputedRef<string>; + poolParams?: ComputedRef<PoolParams>; + initialPoolLiquidity: ComputedRef<Coin[]>; + scalingFactors: ComputedRef<bigint[]>; + futurePoolGovernor: ComputedRef<string>; + scalingFactorController: ComputedRef<string>; +} export interface MsgCreateStableswapPoolProtoMsg { typeUrl: "/osmosis.gamm.poolmodels.stableswap.v1beta1.MsgCreateStableswapPool"; value: Uint8Array; @@ -30,6 +39,9 @@ export interface MsgCreateStableswapPoolSDKType { export interface MsgCreateStableswapPoolResponse { poolId: bigint; } +export interface ReactiveMsgCreateStableswapPoolResponse { + poolId: ComputedRef<bigint>; +} export interface MsgCreateStableswapPoolResponseProtoMsg { typeUrl: "/osmosis.gamm.poolmodels.stableswap.v1beta1.MsgCreateStableswapPoolResponse"; value: Uint8Array; @@ -47,6 +59,11 @@ export interface MsgStableSwapAdjustScalingFactors { poolId: bigint; scalingFactors: bigint[]; } +export interface ReactiveMsgStableSwapAdjustScalingFactors { + sender: ComputedRef<string>; + poolId: ComputedRef<bigint>; + scalingFactors: ComputedRef<bigint[]>; +} export interface MsgStableSwapAdjustScalingFactorsProtoMsg { typeUrl: "/osmosis.gamm.poolmodels.stableswap.v1beta1.MsgStableSwapAdjustScalingFactors"; value: Uint8Array; @@ -61,6 +78,7 @@ export interface MsgStableSwapAdjustScalingFactorsSDKType { scaling_factors: bigint[]; } export interface MsgStableSwapAdjustScalingFactorsResponse {} +export interface ReactiveMsgStableSwapAdjustScalingFactorsResponse {} export interface MsgStableSwapAdjustScalingFactorsResponseProtoMsg { typeUrl: "/osmosis.gamm.poolmodels.stableswap.v1beta1.MsgStableSwapAdjustScalingFactorsResponse"; value: Uint8Array; @@ -79,7 +97,7 @@ function createBaseMsgCreateStableswapPool(): MsgCreateStableswapPool { export const MsgCreateStableswapPool = { typeUrl: "/osmosis.gamm.poolmodels.stableswap.v1beta1.MsgCreateStableswapPool", encode(message: MsgCreateStableswapPool, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.sender !== undefined) { + if (message.sender !== "") { writer.uint32(10).string(message.sender); } if (message.poolParams !== undefined) { @@ -93,10 +111,10 @@ export const MsgCreateStableswapPool = { writer.uint64(v); } writer.ldelim(); - if (message.futurePoolGovernor !== undefined) { + if (message.futurePoolGovernor !== "") { writer.uint32(42).string(message.futurePoolGovernor); } - if (message.scalingFactorController !== undefined) { + if (message.scalingFactorController !== "") { writer.uint32(50).string(message.scalingFactorController); } return writer; @@ -141,14 +159,14 @@ export const MsgCreateStableswapPool = { return message; }, fromJSON(object: any): MsgCreateStableswapPool { - const obj = createBaseMsgCreateStableswapPool(); - if (isSet(object.sender)) obj.sender = String(object.sender); - if (isSet(object.poolParams)) obj.poolParams = PoolParams.fromJSON(object.poolParams); - if (Array.isArray(object?.initialPoolLiquidity)) obj.initialPoolLiquidity = object.initialPoolLiquidity.map((e: any) => Coin.fromJSON(e)); - if (Array.isArray(object?.scalingFactors)) obj.scalingFactors = object.scalingFactors.map((e: any) => BigInt(e.toString())); - if (isSet(object.futurePoolGovernor)) obj.futurePoolGovernor = String(object.futurePoolGovernor); - if (isSet(object.scalingFactorController)) obj.scalingFactorController = String(object.scalingFactorController); - return obj; + return { + sender: isSet(object.sender) ? String(object.sender) : "", + poolParams: isSet(object.poolParams) ? PoolParams.fromJSON(object.poolParams) : undefined, + initialPoolLiquidity: Array.isArray(object?.initialPoolLiquidity) ? object.initialPoolLiquidity.map((e: any) => Coin.fromJSON(e)) : [], + scalingFactors: Array.isArray(object?.scalingFactors) ? object.scalingFactors.map((e: any) => BigInt(e.toString())) : [], + futurePoolGovernor: isSet(object.futurePoolGovernor) ? String(object.futurePoolGovernor) : "", + scalingFactorController: isSet(object.scalingFactorController) ? String(object.scalingFactorController) : "" + }; }, toJSON(message: MsgCreateStableswapPool): JsonSafe<MsgCreateStableswapPool> { const obj: any = {}; @@ -171,9 +189,7 @@ export const MsgCreateStableswapPool = { fromPartial(object: DeepPartial<MsgCreateStableswapPool>): MsgCreateStableswapPool { const message = createBaseMsgCreateStableswapPool(); message.sender = object.sender ?? ""; - if (object.poolParams !== undefined && object.poolParams !== null) { - message.poolParams = PoolParams.fromPartial(object.poolParams); - } + message.poolParams = object.poolParams !== undefined && object.poolParams !== null ? PoolParams.fromPartial(object.poolParams) : undefined; message.initialPoolLiquidity = object.initialPoolLiquidity?.map(e => Coin.fromPartial(e)) || []; message.scalingFactors = object.scalingFactors?.map(e => BigInt(e.toString())) || []; message.futurePoolGovernor = object.futurePoolGovernor ?? ""; @@ -284,7 +300,7 @@ function createBaseMsgCreateStableswapPoolResponse(): MsgCreateStableswapPoolRes export const MsgCreateStableswapPoolResponse = { typeUrl: "/osmosis.gamm.poolmodels.stableswap.v1beta1.MsgCreateStableswapPoolResponse", encode(message: MsgCreateStableswapPoolResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.poolId !== undefined) { + if (message.poolId !== BigInt(0)) { writer.uint32(8).uint64(message.poolId); } return writer; @@ -307,9 +323,9 @@ export const MsgCreateStableswapPoolResponse = { return message; }, fromJSON(object: any): MsgCreateStableswapPoolResponse { - const obj = createBaseMsgCreateStableswapPoolResponse(); - if (isSet(object.poolId)) obj.poolId = BigInt(object.poolId.toString()); - return obj; + return { + poolId: isSet(object.poolId) ? BigInt(object.poolId.toString()) : BigInt(0) + }; }, toJSON(message: MsgCreateStableswapPoolResponse): JsonSafe<MsgCreateStableswapPoolResponse> { const obj: any = {}; @@ -318,9 +334,7 @@ export const MsgCreateStableswapPoolResponse = { }, fromPartial(object: DeepPartial<MsgCreateStableswapPoolResponse>): MsgCreateStableswapPoolResponse { const message = createBaseMsgCreateStableswapPoolResponse(); - if (object.poolId !== undefined && object.poolId !== null) { - message.poolId = BigInt(object.poolId.toString()); - } + message.poolId = object.poolId !== undefined && object.poolId !== null ? BigInt(object.poolId.toString()) : BigInt(0); return message; }, fromSDK(object: MsgCreateStableswapPoolResponseSDKType): MsgCreateStableswapPoolResponse { @@ -382,10 +396,10 @@ function createBaseMsgStableSwapAdjustScalingFactors(): MsgStableSwapAdjustScali export const MsgStableSwapAdjustScalingFactors = { typeUrl: "/osmosis.gamm.poolmodels.stableswap.v1beta1.MsgStableSwapAdjustScalingFactors", encode(message: MsgStableSwapAdjustScalingFactors, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.sender !== undefined) { + if (message.sender !== "") { writer.uint32(10).string(message.sender); } - if (message.poolId !== undefined) { + if (message.poolId !== BigInt(0)) { writer.uint32(16).uint64(message.poolId); } writer.uint32(26).fork(); @@ -426,11 +440,11 @@ export const MsgStableSwapAdjustScalingFactors = { return message; }, fromJSON(object: any): MsgStableSwapAdjustScalingFactors { - const obj = createBaseMsgStableSwapAdjustScalingFactors(); - if (isSet(object.sender)) obj.sender = String(object.sender); - if (isSet(object.poolId)) obj.poolId = BigInt(object.poolId.toString()); - if (Array.isArray(object?.scalingFactors)) obj.scalingFactors = object.scalingFactors.map((e: any) => BigInt(e.toString())); - return obj; + return { + sender: isSet(object.sender) ? String(object.sender) : "", + poolId: isSet(object.poolId) ? BigInt(object.poolId.toString()) : BigInt(0), + scalingFactors: Array.isArray(object?.scalingFactors) ? object.scalingFactors.map((e: any) => BigInt(e.toString())) : [] + }; }, toJSON(message: MsgStableSwapAdjustScalingFactors): JsonSafe<MsgStableSwapAdjustScalingFactors> { const obj: any = {}; @@ -446,9 +460,7 @@ export const MsgStableSwapAdjustScalingFactors = { fromPartial(object: DeepPartial<MsgStableSwapAdjustScalingFactors>): MsgStableSwapAdjustScalingFactors { const message = createBaseMsgStableSwapAdjustScalingFactors(); message.sender = object.sender ?? ""; - if (object.poolId !== undefined && object.poolId !== null) { - message.poolId = BigInt(object.poolId.toString()); - } + message.poolId = object.poolId !== undefined && object.poolId !== null ? BigInt(object.poolId.toString()) : BigInt(0); message.scalingFactors = object.scalingFactors?.map(e => BigInt(e.toString())) || []; return message; }, @@ -544,8 +556,7 @@ export const MsgStableSwapAdjustScalingFactorsResponse = { return message; }, fromJSON(_: any): MsgStableSwapAdjustScalingFactorsResponse { - const obj = createBaseMsgStableSwapAdjustScalingFactorsResponse(); - return obj; + return {}; }, toJSON(_: MsgStableSwapAdjustScalingFactorsResponse): JsonSafe<MsgStableSwapAdjustScalingFactorsResponse> { const obj: any = {}; diff --git a/__fixtures__/v-next/outputv4/osmosis/gamm/v1beta1/genesis.ts b/__fixtures__/v-next/outputv4/osmosis/gamm/v1beta1/genesis.ts index 1db002cced..6dcf7c82a2 100644 --- a/__fixtures__/v-next/outputv4/osmosis/gamm/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputv4/osmosis/gamm/v1beta1/genesis.ts @@ -1,13 +1,17 @@ -import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin.js"; -import { Any, AnySDKType } from "../../../google/protobuf/any.js"; -import { BinaryReader, BinaryWriter } from "../../../binary.js"; -import { JsonSafe } from "../../../json-safe.js"; -import { DeepPartial, isSet } from "../../../helpers.js"; +import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; +import { Any, AnySDKType } from "../../../google/protobuf/any"; +import { BinaryReader, BinaryWriter } from "../../../binary"; +import { JsonSafe } from "../../../json-safe"; +import { DeepPartial, isSet } from "../../../helpers"; +import { ComputedRef } from "vue"; export const protobufPackage = "osmosis.gamm.v1beta1"; /** Params holds parameters for the incentives module */ export interface Params { poolCreationFee: Coin[]; } +export interface ReactiveParams { + poolCreationFee: ComputedRef<Coin[]>; +} export interface ParamsProtoMsg { typeUrl: "/osmosis.gamm.v1beta1.Params"; value: Uint8Array; @@ -23,6 +27,11 @@ export interface GenesisState { nextPoolNumber: bigint; params: Params; } +export interface ReactiveGenesisState { + pools: ComputedRef<Any[]>; + nextPoolNumber: ComputedRef<bigint>; + params: ComputedRef<Params>; +} export interface GenesisStateProtoMsg { typeUrl: "/osmosis.gamm.v1beta1.GenesisState"; value: Uint8Array; @@ -64,9 +73,9 @@ export const Params = { return message; }, fromJSON(object: any): Params { - const obj = createBaseParams(); - if (Array.isArray(object?.poolCreationFee)) obj.poolCreationFee = object.poolCreationFee.map((e: any) => Coin.fromJSON(e)); - return obj; + return { + poolCreationFee: Array.isArray(object?.poolCreationFee) ? object.poolCreationFee.map((e: any) => Coin.fromJSON(e)) : [] + }; }, toJSON(message: Params): JsonSafe<Params> { const obj: any = {}; @@ -150,7 +159,7 @@ export const GenesisState = { for (const v of message.pools) { Any.encode(v!, writer.uint32(10).fork()).ldelim(); } - if (message.nextPoolNumber !== undefined) { + if (message.nextPoolNumber !== BigInt(0)) { writer.uint32(16).uint64(message.nextPoolNumber); } if (message.params !== undefined) { @@ -182,11 +191,11 @@ export const GenesisState = { return message; }, fromJSON(object: any): GenesisState { - const obj = createBaseGenesisState(); - if (Array.isArray(object?.pools)) obj.pools = object.pools.map((e: any) => Any.fromJSON(e)); - if (isSet(object.nextPoolNumber)) obj.nextPoolNumber = BigInt(object.nextPoolNumber.toString()); - if (isSet(object.params)) obj.params = Params.fromJSON(object.params); - return obj; + return { + pools: Array.isArray(object?.pools) ? object.pools.map((e: any) => Any.fromJSON(e)) : [], + nextPoolNumber: isSet(object.nextPoolNumber) ? BigInt(object.nextPoolNumber.toString()) : BigInt(0), + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined + }; }, toJSON(message: GenesisState): JsonSafe<GenesisState> { const obj: any = {}; @@ -202,12 +211,8 @@ export const GenesisState = { fromPartial(object: DeepPartial<GenesisState>): GenesisState { const message = createBaseGenesisState(); message.pools = object.pools?.map(e => Any.fromPartial(e)) || []; - if (object.nextPoolNumber !== undefined && object.nextPoolNumber !== null) { - message.nextPoolNumber = BigInt(object.nextPoolNumber.toString()); - } - if (object.params !== undefined && object.params !== null) { - message.params = Params.fromPartial(object.params); - } + message.nextPoolNumber = object.nextPoolNumber !== undefined && object.nextPoolNumber !== null ? BigInt(object.nextPoolNumber.toString()) : BigInt(0); + message.params = object.params !== undefined && object.params !== null ? Params.fromPartial(object.params) : undefined; return message; }, fromSDK(object: GenesisStateSDKType): GenesisState { diff --git a/__fixtures__/v-next/outputv4/osmosis/gamm/v1beta1/query.lcd.ts b/__fixtures__/v-next/outputv4/osmosis/gamm/v1beta1/query.lcd.ts index 63a8d8241d..d093725ffe 100644 --- a/__fixtures__/v-next/outputv4/osmosis/gamm/v1beta1/query.lcd.ts +++ b/__fixtures__/v-next/outputv4/osmosis/gamm/v1beta1/query.lcd.ts @@ -1,10 +1,10 @@ -import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../../cosmos/base/query/v1beta1/pagination.js"; -import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin.js"; -import { SwapAmountInRoute, SwapAmountInRouteSDKType, SwapAmountOutRoute, SwapAmountOutRouteSDKType } from "./tx.js"; -import { Any, AnySDKType } from "../../../google/protobuf/any.js"; -import { setPaginationParams } from "../../../helpers.js"; +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../../cosmos/base/query/v1beta1/pagination"; +import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; +import { SwapAmountInRoute, SwapAmountInRouteSDKType, SwapAmountOutRoute, SwapAmountOutRouteSDKType } from "./tx"; +import { Any, AnySDKType } from "../../../google/protobuf/any"; +import { setPaginationParams } from "../../../helpers"; import { LCDClient } from "@cosmology/lcd"; -import { QueryPoolsRequest, QueryPoolsRequestSDKType, QueryPoolsResponse, QueryPoolsResponseSDKType, QueryNumPoolsRequest, QueryNumPoolsRequestSDKType, QueryNumPoolsResponse, QueryNumPoolsResponseSDKType, QueryTotalLiquidityRequest, QueryTotalLiquidityRequestSDKType, QueryTotalLiquidityResponse, QueryTotalLiquidityResponseSDKType, QueryPoolsWithFilterRequest, QueryPoolsWithFilterRequestSDKType, QueryPoolsWithFilterResponse, QueryPoolsWithFilterResponseSDKType, QueryPoolRequest, QueryPoolRequestSDKType, QueryPoolResponse, QueryPoolResponseSDKType, QueryPoolTypeRequest, QueryPoolTypeRequestSDKType, QueryPoolTypeResponse, QueryPoolTypeResponseSDKType, QueryCalcJoinPoolNoSwapSharesRequest, QueryCalcJoinPoolNoSwapSharesRequestSDKType, QueryCalcJoinPoolNoSwapSharesResponse, QueryCalcJoinPoolNoSwapSharesResponseSDKType, QueryCalcJoinPoolSharesRequest, QueryCalcJoinPoolSharesRequestSDKType, QueryCalcJoinPoolSharesResponse, QueryCalcJoinPoolSharesResponseSDKType, QueryCalcExitPoolCoinsFromSharesRequest, QueryCalcExitPoolCoinsFromSharesRequestSDKType, QueryCalcExitPoolCoinsFromSharesResponse, QueryCalcExitPoolCoinsFromSharesResponseSDKType, QueryPoolParamsRequest, QueryPoolParamsRequestSDKType, QueryPoolParamsResponse, QueryPoolParamsResponseSDKType, QueryTotalPoolLiquidityRequest, QueryTotalPoolLiquidityRequestSDKType, QueryTotalPoolLiquidityResponse, QueryTotalPoolLiquidityResponseSDKType, QueryTotalSharesRequest, QueryTotalSharesRequestSDKType, QueryTotalSharesResponse, QueryTotalSharesResponseSDKType, QuerySpotPriceRequest, QuerySpotPriceRequestSDKType, QuerySpotPriceResponse, QuerySpotPriceResponseSDKType, QuerySwapExactAmountInRequest, QuerySwapExactAmountInRequestSDKType, QuerySwapExactAmountInResponse, QuerySwapExactAmountInResponseSDKType, QuerySwapExactAmountOutRequest, QuerySwapExactAmountOutRequestSDKType, QuerySwapExactAmountOutResponse, QuerySwapExactAmountOutResponseSDKType } from "./query.js"; +import { QueryPoolsRequest, QueryPoolsRequestSDKType, QueryPoolsResponse, QueryPoolsResponseSDKType, QueryNumPoolsRequest, QueryNumPoolsRequestSDKType, QueryNumPoolsResponse, QueryNumPoolsResponseSDKType, QueryTotalLiquidityRequest, QueryTotalLiquidityRequestSDKType, QueryTotalLiquidityResponse, QueryTotalLiquidityResponseSDKType, QueryPoolsWithFilterRequest, QueryPoolsWithFilterRequestSDKType, QueryPoolsWithFilterResponse, QueryPoolsWithFilterResponseSDKType, QueryPoolRequest, QueryPoolRequestSDKType, QueryPoolResponse, QueryPoolResponseSDKType, QueryPoolTypeRequest, QueryPoolTypeRequestSDKType, QueryPoolTypeResponse, QueryPoolTypeResponseSDKType, QueryCalcJoinPoolNoSwapSharesRequest, QueryCalcJoinPoolNoSwapSharesRequestSDKType, QueryCalcJoinPoolNoSwapSharesResponse, QueryCalcJoinPoolNoSwapSharesResponseSDKType, QueryCalcJoinPoolSharesRequest, QueryCalcJoinPoolSharesRequestSDKType, QueryCalcJoinPoolSharesResponse, QueryCalcJoinPoolSharesResponseSDKType, QueryCalcExitPoolCoinsFromSharesRequest, QueryCalcExitPoolCoinsFromSharesRequestSDKType, QueryCalcExitPoolCoinsFromSharesResponse, QueryCalcExitPoolCoinsFromSharesResponseSDKType, QueryPoolParamsRequest, QueryPoolParamsRequestSDKType, QueryPoolParamsResponse, QueryPoolParamsResponseSDKType, QueryTotalPoolLiquidityRequest, QueryTotalPoolLiquidityRequestSDKType, QueryTotalPoolLiquidityResponse, QueryTotalPoolLiquidityResponseSDKType, QueryTotalSharesRequest, QueryTotalSharesRequestSDKType, QueryTotalSharesResponse, QueryTotalSharesResponseSDKType, QuerySpotPriceRequest, QuerySpotPriceRequestSDKType, QuerySpotPriceResponse, QuerySpotPriceResponseSDKType, QuerySwapExactAmountInRequest, QuerySwapExactAmountInRequestSDKType, QuerySwapExactAmountInResponse, QuerySwapExactAmountInResponseSDKType, QuerySwapExactAmountOutRequest, QuerySwapExactAmountOutRequestSDKType, QuerySwapExactAmountOutResponse, QuerySwapExactAmountOutResponseSDKType } from "./query"; export class LCDQueryClient { req: LCDClient; constructor({ @@ -30,7 +30,7 @@ export class LCDQueryClient { } /* Pools */ async pools(params: QueryPoolsRequest = { - pagination: PageRequest.fromPartial({}) + pagination: undefined }): Promise<QueryPoolsResponseSDKType> { const options: any = { params: {} diff --git a/__fixtures__/v-next/outputv4/osmosis/gamm/v1beta1/query.rpc.Query.ts b/__fixtures__/v-next/outputv4/osmosis/gamm/v1beta1/query.rpc.Query.ts index e76b904e28..bdf27fb306 100644 --- a/__fixtures__/v-next/outputv4/osmosis/gamm/v1beta1/query.rpc.Query.ts +++ b/__fixtures__/v-next/outputv4/osmosis/gamm/v1beta1/query.rpc.Query.ts @@ -1,15 +1,14 @@ -import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../../cosmos/base/query/v1beta1/pagination.js"; -import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin.js"; -import { SwapAmountInRoute, SwapAmountInRouteSDKType, SwapAmountOutRoute, SwapAmountOutRouteSDKType } from "./tx.js"; -import { Any, AnySDKType } from "../../../google/protobuf/any.js"; -import { Rpc } from "../../../helpers.js"; -import { BinaryReader } from "../../../binary.js"; +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../../cosmos/base/query/v1beta1/pagination"; +import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; +import { SwapAmountInRoute, SwapAmountInRouteSDKType, SwapAmountOutRoute, SwapAmountOutRouteSDKType } from "./tx"; +import { Any, AnySDKType } from "../../../google/protobuf/any"; +import { Rpc } from "../../../helpers"; +import { BinaryReader } from "../../../binary"; import { QueryClient, createProtobufRpcClient, ProtobufRpcClient } from "@cosmjs/stargate"; -import { ReactQueryParams } from "../../../react-query.js"; -import { useQuery } from "@tanstack/react-query"; -import { QueryStore, MobxResponse } from "../../../mobx.js"; -import { makeObservable, override } from "mobx"; -import { QueryPoolsRequest, QueryPoolsRequestSDKType, QueryPoolsResponse, QueryPoolsResponseSDKType, QueryNumPoolsRequest, QueryNumPoolsRequestSDKType, QueryNumPoolsResponse, QueryNumPoolsResponseSDKType, QueryTotalLiquidityRequest, QueryTotalLiquidityRequestSDKType, QueryTotalLiquidityResponse, QueryTotalLiquidityResponseSDKType, QueryPoolsWithFilterRequest, QueryPoolsWithFilterRequestSDKType, QueryPoolsWithFilterResponse, QueryPoolsWithFilterResponseSDKType, QueryPoolRequest, QueryPoolRequestSDKType, QueryPoolResponse, QueryPoolResponseSDKType, QueryPoolTypeRequest, QueryPoolTypeRequestSDKType, QueryPoolTypeResponse, QueryPoolTypeResponseSDKType, QueryCalcJoinPoolNoSwapSharesRequest, QueryCalcJoinPoolNoSwapSharesRequestSDKType, QueryCalcJoinPoolNoSwapSharesResponse, QueryCalcJoinPoolNoSwapSharesResponseSDKType, QueryCalcJoinPoolSharesRequest, QueryCalcJoinPoolSharesRequestSDKType, QueryCalcJoinPoolSharesResponse, QueryCalcJoinPoolSharesResponseSDKType, QueryCalcExitPoolCoinsFromSharesRequest, QueryCalcExitPoolCoinsFromSharesRequestSDKType, QueryCalcExitPoolCoinsFromSharesResponse, QueryCalcExitPoolCoinsFromSharesResponseSDKType, QueryPoolParamsRequest, QueryPoolParamsRequestSDKType, QueryPoolParamsResponse, QueryPoolParamsResponseSDKType, QueryTotalPoolLiquidityRequest, QueryTotalPoolLiquidityRequestSDKType, QueryTotalPoolLiquidityResponse, QueryTotalPoolLiquidityResponseSDKType, QueryTotalSharesRequest, QueryTotalSharesRequestSDKType, QueryTotalSharesResponse, QueryTotalSharesResponseSDKType, QuerySpotPriceRequest, QuerySpotPriceRequestSDKType, QuerySpotPriceResponse, QuerySpotPriceResponseSDKType, QuerySwapExactAmountInRequest, QuerySwapExactAmountInRequestSDKType, QuerySwapExactAmountInResponse, QuerySwapExactAmountInResponseSDKType, QuerySwapExactAmountOutRequest, QuerySwapExactAmountOutRequestSDKType, QuerySwapExactAmountOutResponse, QuerySwapExactAmountOutResponseSDKType } from "./query.js"; +import { VueQueryParams } from "../../../vue-query"; +import { ComputedRef, computed, Ref } from "vue"; +import { useQuery } from "@tanstack/vue-query"; +import { QueryPoolsRequest, QueryPoolsRequestSDKType, QueryPoolsResponse, QueryPoolsResponseSDKType, QueryNumPoolsRequest, QueryNumPoolsRequestSDKType, QueryNumPoolsResponse, QueryNumPoolsResponseSDKType, QueryTotalLiquidityRequest, QueryTotalLiquidityRequestSDKType, QueryTotalLiquidityResponse, QueryTotalLiquidityResponseSDKType, QueryPoolsWithFilterRequest, QueryPoolsWithFilterRequestSDKType, QueryPoolsWithFilterResponse, QueryPoolsWithFilterResponseSDKType, QueryPoolRequest, QueryPoolRequestSDKType, QueryPoolResponse, QueryPoolResponseSDKType, QueryPoolTypeRequest, QueryPoolTypeRequestSDKType, QueryPoolTypeResponse, QueryPoolTypeResponseSDKType, QueryCalcJoinPoolNoSwapSharesRequest, QueryCalcJoinPoolNoSwapSharesRequestSDKType, QueryCalcJoinPoolNoSwapSharesResponse, QueryCalcJoinPoolNoSwapSharesResponseSDKType, QueryCalcJoinPoolSharesRequest, QueryCalcJoinPoolSharesRequestSDKType, QueryCalcJoinPoolSharesResponse, QueryCalcJoinPoolSharesResponseSDKType, QueryCalcExitPoolCoinsFromSharesRequest, QueryCalcExitPoolCoinsFromSharesRequestSDKType, QueryCalcExitPoolCoinsFromSharesResponse, QueryCalcExitPoolCoinsFromSharesResponseSDKType, QueryPoolParamsRequest, QueryPoolParamsRequestSDKType, QueryPoolParamsResponse, QueryPoolParamsResponseSDKType, QueryTotalPoolLiquidityRequest, QueryTotalPoolLiquidityRequestSDKType, QueryTotalPoolLiquidityResponse, QueryTotalPoolLiquidityResponseSDKType, QueryTotalSharesRequest, QueryTotalSharesRequestSDKType, QueryTotalSharesResponse, QueryTotalSharesResponseSDKType, QuerySpotPriceRequest, QuerySpotPriceRequestSDKType, QuerySpotPriceResponse, QuerySpotPriceResponseSDKType, QuerySwapExactAmountInRequest, QuerySwapExactAmountInRequestSDKType, QuerySwapExactAmountInResponse, QuerySwapExactAmountInResponseSDKType, QuerySwapExactAmountOutRequest, QuerySwapExactAmountOutRequestSDKType, QuerySwapExactAmountOutResponse, QuerySwapExactAmountOutResponseSDKType, ReactiveQueryPoolsRequest, ReactiveQueryNumPoolsRequest, ReactiveQueryTotalLiquidityRequest, ReactiveQueryPoolsWithFilterRequest, ReactiveQueryPoolRequest, ReactiveQueryPoolTypeRequest, ReactiveQueryCalcJoinPoolNoSwapSharesRequest, ReactiveQueryCalcJoinPoolSharesRequest, ReactiveQueryCalcExitPoolCoinsFromSharesRequest, ReactiveQueryPoolParamsRequest, ReactiveQueryTotalPoolLiquidityRequest, ReactiveQueryTotalSharesRequest, ReactiveQuerySpotPriceRequest, ReactiveQuerySwapExactAmountInRequest, ReactiveQuerySwapExactAmountOutRequest } from "./query"; export interface Query { pools(request?: QueryPoolsRequest): Promise<QueryPoolsResponse>; numPools(request?: QueryNumPoolsRequest): Promise<QueryNumPoolsResponse>; @@ -67,7 +66,7 @@ export class QueryClientImpl implements Query { this.estimateSwapExactAmountOut = this.estimateSwapExactAmountOut.bind(this); } pools(request: QueryPoolsRequest = { - pagination: PageRequest.fromPartial({}) + pagination: undefined }): Promise<QueryPoolsResponse> { const data = QueryPoolsRequest.encode(request).finish(); const promise = this.rpc.request("osmosis.gamm.v1beta1.Query", "Pools", data); @@ -195,197 +194,440 @@ export const createRpcQueryExtension = (base: QueryClient) => { } }; }; -export interface UsePoolsQuery<TData> extends ReactQueryParams<QueryPoolsResponse, TData> { - request?: QueryPoolsRequest; +export interface UsePoolsQuery<TData> extends VueQueryParams<QueryPoolsResponse, TData> { + request?: ReactiveQueryPoolsRequest; } -export interface UseNumPoolsQuery<TData> extends ReactQueryParams<QueryNumPoolsResponse, TData> { - request?: QueryNumPoolsRequest; +export interface UseNumPoolsQuery<TData> extends VueQueryParams<QueryNumPoolsResponse, TData> { + request?: ReactiveQueryNumPoolsRequest; } -export interface UseTotalLiquidityQuery<TData> extends ReactQueryParams<QueryTotalLiquidityResponse, TData> { - request?: QueryTotalLiquidityRequest; +export interface UseTotalLiquidityQuery<TData> extends VueQueryParams<QueryTotalLiquidityResponse, TData> { + request?: ReactiveQueryTotalLiquidityRequest; } -export interface UsePoolsWithFilterQuery<TData> extends ReactQueryParams<QueryPoolsWithFilterResponse, TData> { - request: QueryPoolsWithFilterRequest; +export interface UsePoolsWithFilterQuery<TData> extends VueQueryParams<QueryPoolsWithFilterResponse, TData> { + request: ReactiveQueryPoolsWithFilterRequest; } -export interface UsePoolQuery<TData> extends ReactQueryParams<QueryPoolResponse, TData> { - request: QueryPoolRequest; +export interface UsePoolQuery<TData> extends VueQueryParams<QueryPoolResponse, TData> { + request: ReactiveQueryPoolRequest; } -export interface UsePoolTypeQuery<TData> extends ReactQueryParams<QueryPoolTypeResponse, TData> { - request: QueryPoolTypeRequest; +export interface UsePoolTypeQuery<TData> extends VueQueryParams<QueryPoolTypeResponse, TData> { + request: ReactiveQueryPoolTypeRequest; } -export interface UseCalcJoinPoolNoSwapSharesQuery<TData> extends ReactQueryParams<QueryCalcJoinPoolNoSwapSharesResponse, TData> { - request: QueryCalcJoinPoolNoSwapSharesRequest; +export interface UseCalcJoinPoolNoSwapSharesQuery<TData> extends VueQueryParams<QueryCalcJoinPoolNoSwapSharesResponse, TData> { + request: ReactiveQueryCalcJoinPoolNoSwapSharesRequest; } -export interface UseCalcJoinPoolSharesQuery<TData> extends ReactQueryParams<QueryCalcJoinPoolSharesResponse, TData> { - request: QueryCalcJoinPoolSharesRequest; +export interface UseCalcJoinPoolSharesQuery<TData> extends VueQueryParams<QueryCalcJoinPoolSharesResponse, TData> { + request: ReactiveQueryCalcJoinPoolSharesRequest; } -export interface UseCalcExitPoolCoinsFromSharesQuery<TData> extends ReactQueryParams<QueryCalcExitPoolCoinsFromSharesResponse, TData> { - request: QueryCalcExitPoolCoinsFromSharesRequest; +export interface UseCalcExitPoolCoinsFromSharesQuery<TData> extends VueQueryParams<QueryCalcExitPoolCoinsFromSharesResponse, TData> { + request: ReactiveQueryCalcExitPoolCoinsFromSharesRequest; } -export interface UsePoolParamsQuery<TData> extends ReactQueryParams<QueryPoolParamsResponse, TData> { - request: QueryPoolParamsRequest; +export interface UsePoolParamsQuery<TData> extends VueQueryParams<QueryPoolParamsResponse, TData> { + request: ReactiveQueryPoolParamsRequest; } -export interface UseTotalPoolLiquidityQuery<TData> extends ReactQueryParams<QueryTotalPoolLiquidityResponse, TData> { - request: QueryTotalPoolLiquidityRequest; +export interface UseTotalPoolLiquidityQuery<TData> extends VueQueryParams<QueryTotalPoolLiquidityResponse, TData> { + request: ReactiveQueryTotalPoolLiquidityRequest; } -export interface UseTotalSharesQuery<TData> extends ReactQueryParams<QueryTotalSharesResponse, TData> { - request: QueryTotalSharesRequest; +export interface UseTotalSharesQuery<TData> extends VueQueryParams<QueryTotalSharesResponse, TData> { + request: ReactiveQueryTotalSharesRequest; } -export interface UseSpotPriceQuery<TData> extends ReactQueryParams<QuerySpotPriceResponse, TData> { - request: QuerySpotPriceRequest; +export interface UseSpotPriceQuery<TData> extends VueQueryParams<QuerySpotPriceResponse, TData> { + request: ReactiveQuerySpotPriceRequest; } -export interface UseEstimateSwapExactAmountInQuery<TData> extends ReactQueryParams<QuerySwapExactAmountInResponse, TData> { - request: QuerySwapExactAmountInRequest; +export interface UseEstimateSwapExactAmountInQuery<TData> extends VueQueryParams<QuerySwapExactAmountInResponse, TData> { + request: ReactiveQuerySwapExactAmountInRequest; } -export interface UseEstimateSwapExactAmountOutQuery<TData> extends ReactQueryParams<QuerySwapExactAmountOutResponse, TData> { - request: QuerySwapExactAmountOutRequest; +export interface UseEstimateSwapExactAmountOutQuery<TData> extends VueQueryParams<QuerySwapExactAmountOutResponse, TData> { + request: ReactiveQuerySwapExactAmountOutRequest; } -const _queryClients: WeakMap<ProtobufRpcClient, QueryClientImpl> = 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 useQueryService = (rpc: Ref<ProtobufRpcClient | undefined>): ComputedRef<QueryClientImpl | undefined> => { + 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: ProtobufRpcClient | undefined) => { - const queryService = getQueryService(rpc); +export const createRpcQueryHooks = (rpc: Ref<ProtobufRpcClient | undefined>) => { + const queryService = useQueryService(rpc); const usePools = <TData = QueryPoolsResponse,>({ request, options }: UsePoolsQuery<TData>) => { - return useQuery<QueryPoolsResponse, Error, TData>(["poolsQuery", request], () => { - if (!queryService) throw new Error("Query Service not initialized"); - return queryService.pools(request); - }, options); + const queryKey = ["poolsQuery", queryService]; + if (request) { + Object.values(request).forEach((val: any) => { + queryKey.push(val); + }); + } + return useQuery<QueryPoolsResponse, Error, TData>({ + 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.pools(params); + }, + ...options + }); }; const useNumPools = <TData = QueryNumPoolsResponse,>({ request, options }: UseNumPoolsQuery<TData>) => { - return useQuery<QueryNumPoolsResponse, Error, TData>(["numPoolsQuery", request], () => { - if (!queryService) throw new Error("Query Service not initialized"); - return queryService.numPools(request); - }, options); + const queryKey = ["numPoolsQuery", queryService]; + if (request) { + Object.values(request).forEach((val: any) => { + queryKey.push(val); + }); + } + return useQuery<QueryNumPoolsResponse, Error, TData>({ + 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.numPools(params); + }, + ...options + }); }; const useTotalLiquidity = <TData = QueryTotalLiquidityResponse,>({ request, options }: UseTotalLiquidityQuery<TData>) => { - return useQuery<QueryTotalLiquidityResponse, Error, TData>(["totalLiquidityQuery", request], () => { - if (!queryService) throw new Error("Query Service not initialized"); - return queryService.totalLiquidity(request); - }, options); + const queryKey = ["totalLiquidityQuery", queryService]; + if (request) { + Object.values(request).forEach((val: any) => { + queryKey.push(val); + }); + } + return useQuery<QueryTotalLiquidityResponse, Error, TData>({ + 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.totalLiquidity(params); + }, + ...options + }); }; const usePoolsWithFilter = <TData = QueryPoolsWithFilterResponse,>({ request, options }: UsePoolsWithFilterQuery<TData>) => { - return useQuery<QueryPoolsWithFilterResponse, Error, TData>(["poolsWithFilterQuery", request], () => { - if (!queryService) throw new Error("Query Service not initialized"); - return queryService.poolsWithFilter(request); - }, options); + const queryKey = ["poolsWithFilterQuery", queryService]; + if (request) { + Object.values(request).forEach((val: any) => { + queryKey.push(val); + }); + } + return useQuery<QueryPoolsWithFilterResponse, Error, TData>({ + 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.poolsWithFilter(params); + }, + ...options + }); }; const usePool = <TData = QueryPoolResponse,>({ request, options }: UsePoolQuery<TData>) => { - return useQuery<QueryPoolResponse, Error, TData>(["poolQuery", request], () => { - if (!queryService) throw new Error("Query Service not initialized"); - return queryService.pool(request); - }, options); + const queryKey = ["poolQuery", queryService]; + if (request) { + Object.values(request).forEach((val: any) => { + queryKey.push(val); + }); + } + return useQuery<QueryPoolResponse, Error, TData>({ + 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 usePoolType = <TData = QueryPoolTypeResponse,>({ request, options }: UsePoolTypeQuery<TData>) => { - return useQuery<QueryPoolTypeResponse, Error, TData>(["poolTypeQuery", request], () => { - if (!queryService) throw new Error("Query Service not initialized"); - return queryService.poolType(request); - }, options); + const queryKey = ["poolTypeQuery", queryService]; + if (request) { + Object.values(request).forEach((val: any) => { + queryKey.push(val); + }); + } + return useQuery<QueryPoolTypeResponse, Error, TData>({ + 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.poolType(params); + }, + ...options + }); }; const useCalcJoinPoolNoSwapShares = <TData = QueryCalcJoinPoolNoSwapSharesResponse,>({ request, options }: UseCalcJoinPoolNoSwapSharesQuery<TData>) => { - return useQuery<QueryCalcJoinPoolNoSwapSharesResponse, Error, TData>(["calcJoinPoolNoSwapSharesQuery", request], () => { - if (!queryService) throw new Error("Query Service not initialized"); - return queryService.calcJoinPoolNoSwapShares(request); - }, options); + const queryKey = ["calcJoinPoolNoSwapSharesQuery", queryService]; + if (request) { + Object.values(request).forEach((val: any) => { + queryKey.push(val); + }); + } + return useQuery<QueryCalcJoinPoolNoSwapSharesResponse, Error, TData>({ + 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.calcJoinPoolNoSwapShares(params); + }, + ...options + }); }; const useCalcJoinPoolShares = <TData = QueryCalcJoinPoolSharesResponse,>({ request, options }: UseCalcJoinPoolSharesQuery<TData>) => { - return useQuery<QueryCalcJoinPoolSharesResponse, Error, TData>(["calcJoinPoolSharesQuery", request], () => { - if (!queryService) throw new Error("Query Service not initialized"); - return queryService.calcJoinPoolShares(request); - }, options); + const queryKey = ["calcJoinPoolSharesQuery", queryService]; + if (request) { + Object.values(request).forEach((val: any) => { + queryKey.push(val); + }); + } + return useQuery<QueryCalcJoinPoolSharesResponse, Error, TData>({ + 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.calcJoinPoolShares(params); + }, + ...options + }); }; const useCalcExitPoolCoinsFromShares = <TData = QueryCalcExitPoolCoinsFromSharesResponse,>({ request, options }: UseCalcExitPoolCoinsFromSharesQuery<TData>) => { - return useQuery<QueryCalcExitPoolCoinsFromSharesResponse, Error, TData>(["calcExitPoolCoinsFromSharesQuery", request], () => { - if (!queryService) throw new Error("Query Service not initialized"); - return queryService.calcExitPoolCoinsFromShares(request); - }, options); + const queryKey = ["calcExitPoolCoinsFromSharesQuery", queryService]; + if (request) { + Object.values(request).forEach((val: any) => { + queryKey.push(val); + }); + } + return useQuery<QueryCalcExitPoolCoinsFromSharesResponse, Error, TData>({ + 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.calcExitPoolCoinsFromShares(params); + }, + ...options + }); }; const usePoolParams = <TData = QueryPoolParamsResponse,>({ request, options }: UsePoolParamsQuery<TData>) => { - return useQuery<QueryPoolParamsResponse, Error, TData>(["poolParamsQuery", request], () => { - if (!queryService) throw new Error("Query Service not initialized"); - return queryService.poolParams(request); - }, options); + const queryKey = ["poolParamsQuery", queryService]; + if (request) { + Object.values(request).forEach((val: any) => { + queryKey.push(val); + }); + } + return useQuery<QueryPoolParamsResponse, Error, TData>({ + 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.poolParams(params); + }, + ...options + }); }; const useTotalPoolLiquidity = <TData = QueryTotalPoolLiquidityResponse,>({ request, options }: UseTotalPoolLiquidityQuery<TData>) => { - return useQuery<QueryTotalPoolLiquidityResponse, Error, TData>(["totalPoolLiquidityQuery", request], () => { - if (!queryService) throw new Error("Query Service not initialized"); - return queryService.totalPoolLiquidity(request); - }, options); + const queryKey = ["totalPoolLiquidityQuery", queryService]; + if (request) { + Object.values(request).forEach((val: any) => { + queryKey.push(val); + }); + } + return useQuery<QueryTotalPoolLiquidityResponse, Error, TData>({ + 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.totalPoolLiquidity(params); + }, + ...options + }); }; const useTotalShares = <TData = QueryTotalSharesResponse,>({ request, options }: UseTotalSharesQuery<TData>) => { - return useQuery<QueryTotalSharesResponse, Error, TData>(["totalSharesQuery", request], () => { - if (!queryService) throw new Error("Query Service not initialized"); - return queryService.totalShares(request); - }, options); + const queryKey = ["totalSharesQuery", queryService]; + if (request) { + Object.values(request).forEach((val: any) => { + queryKey.push(val); + }); + } + return useQuery<QueryTotalSharesResponse, Error, TData>({ + 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.totalShares(params); + }, + ...options + }); }; const useSpotPrice = <TData = QuerySpotPriceResponse,>({ request, options }: UseSpotPriceQuery<TData>) => { - return useQuery<QuerySpotPriceResponse, Error, TData>(["spotPriceQuery", request], () => { - if (!queryService) throw new Error("Query Service not initialized"); - return queryService.spotPrice(request); - }, options); + const queryKey = ["spotPriceQuery", queryService]; + if (request) { + Object.values(request).forEach((val: any) => { + queryKey.push(val); + }); + } + return useQuery<QuerySpotPriceResponse, Error, TData>({ + 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.spotPrice(params); + }, + ...options + }); }; const useEstimateSwapExactAmountIn = <TData = QuerySwapExactAmountInResponse,>({ request, options }: UseEstimateSwapExactAmountInQuery<TData>) => { - return useQuery<QuerySwapExactAmountInResponse, Error, TData>(["estimateSwapExactAmountInQuery", request], () => { - if (!queryService) throw new Error("Query Service not initialized"); - return queryService.estimateSwapExactAmountIn(request); - }, options); + const queryKey = ["estimateSwapExactAmountInQuery", queryService]; + if (request) { + Object.values(request).forEach((val: any) => { + queryKey.push(val); + }); + } + return useQuery<QuerySwapExactAmountInResponse, Error, TData>({ + 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.estimateSwapExactAmountIn(params); + }, + ...options + }); }; const useEstimateSwapExactAmountOut = <TData = QuerySwapExactAmountOutResponse,>({ request, options }: UseEstimateSwapExactAmountOutQuery<TData>) => { - return useQuery<QuerySwapExactAmountOutResponse, Error, TData>(["estimateSwapExactAmountOutQuery", request], () => { - if (!queryService) throw new Error("Query Service not initialized"); - return queryService.estimateSwapExactAmountOut(request); - }, options); + const queryKey = ["estimateSwapExactAmountOutQuery", queryService]; + if (request) { + Object.values(request).forEach((val: any) => { + queryKey.push(val); + }); + } + return useQuery<QuerySwapExactAmountOutResponse, Error, TData>({ + 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.estimateSwapExactAmountOut(params); + }, + ...options + }); }; return { usePools, @@ -421,131 +663,4 @@ export const createRpcQueryHooks = (rpc: ProtobufRpcClient | undefined) => { /** Estimate the swap. */useEstimateSwapExactAmountIn, useEstimateSwapExactAmountOut }; -}; -export const createRpcQueryMobxStores = (rpc: ProtobufRpcClient | undefined) => { - const queryService = getQueryService(rpc); - class QueryPoolsStore { - store = new QueryStore<QueryPoolsRequest, QueryPoolsResponse>(queryService?.pools); - pools(request: QueryPoolsRequest) { - return this.store.getData(request); - } - } - class QueryNumPoolsStore { - store = new QueryStore<QueryNumPoolsRequest, QueryNumPoolsResponse>(queryService?.numPools); - numPools(request: QueryNumPoolsRequest) { - return this.store.getData(request); - } - } - class QueryTotalLiquidityStore { - store = new QueryStore<QueryTotalLiquidityRequest, QueryTotalLiquidityResponse>(queryService?.totalLiquidity); - totalLiquidity(request: QueryTotalLiquidityRequest) { - return this.store.getData(request); - } - } - class QueryPoolsWithFilterStore { - store = new QueryStore<QueryPoolsWithFilterRequest, QueryPoolsWithFilterResponse>(queryService?.poolsWithFilter); - poolsWithFilter(request: QueryPoolsWithFilterRequest) { - return this.store.getData(request); - } - } - class QueryPoolStore { - store = new QueryStore<QueryPoolRequest, QueryPoolResponse>(queryService?.pool); - pool(request: QueryPoolRequest) { - return this.store.getData(request); - } - } - class QueryPoolTypeStore { - store = new QueryStore<QueryPoolTypeRequest, QueryPoolTypeResponse>(queryService?.poolType); - poolType(request: QueryPoolTypeRequest) { - return this.store.getData(request); - } - } - class QueryCalcJoinPoolNoSwapSharesStore { - store = new QueryStore<QueryCalcJoinPoolNoSwapSharesRequest, QueryCalcJoinPoolNoSwapSharesResponse>(queryService?.calcJoinPoolNoSwapShares); - calcJoinPoolNoSwapShares(request: QueryCalcJoinPoolNoSwapSharesRequest) { - return this.store.getData(request); - } - } - class QueryCalcJoinPoolSharesStore { - store = new QueryStore<QueryCalcJoinPoolSharesRequest, QueryCalcJoinPoolSharesResponse>(queryService?.calcJoinPoolShares); - calcJoinPoolShares(request: QueryCalcJoinPoolSharesRequest) { - return this.store.getData(request); - } - } - class QueryCalcExitPoolCoinsFromSharesStore { - store = new QueryStore<QueryCalcExitPoolCoinsFromSharesRequest, QueryCalcExitPoolCoinsFromSharesResponse>(queryService?.calcExitPoolCoinsFromShares); - calcExitPoolCoinsFromShares(request: QueryCalcExitPoolCoinsFromSharesRequest) { - return this.store.getData(request); - } - } - class QueryPoolParamsStore { - store = new QueryStore<QueryPoolParamsRequest, QueryPoolParamsResponse>(queryService?.poolParams); - poolParams(request: QueryPoolParamsRequest) { - return this.store.getData(request); - } - } - class QueryTotalPoolLiquidityStore { - store = new QueryStore<QueryTotalPoolLiquidityRequest, QueryTotalPoolLiquidityResponse>(queryService?.totalPoolLiquidity); - totalPoolLiquidity(request: QueryTotalPoolLiquidityRequest) { - return this.store.getData(request); - } - } - class QueryTotalSharesStore { - store = new QueryStore<QueryTotalSharesRequest, QueryTotalSharesResponse>(queryService?.totalShares); - totalShares(request: QueryTotalSharesRequest) { - return this.store.getData(request); - } - } - class QuerySpotPriceStore { - store = new QueryStore<QuerySpotPriceRequest, QuerySpotPriceResponse>(queryService?.spotPrice); - spotPrice(request: QuerySpotPriceRequest) { - return this.store.getData(request); - } - } - class QueryEstimateSwapExactAmountInStore { - store = new QueryStore<QuerySwapExactAmountInRequest, QuerySwapExactAmountInResponse>(queryService?.estimateSwapExactAmountIn); - estimateSwapExactAmountIn(request: QuerySwapExactAmountInRequest) { - return this.store.getData(request); - } - } - class QueryEstimateSwapExactAmountOutStore { - store = new QueryStore<QuerySwapExactAmountOutRequest, QuerySwapExactAmountOutResponse>(queryService?.estimateSwapExactAmountOut); - estimateSwapExactAmountOut(request: QuerySwapExactAmountOutRequest) { - return this.store.getData(request); - } - } - return { - QueryPoolsStore, - QueryNumPoolsStore, - QueryTotalLiquidityStore, - /** - * PoolsWithFilter allows you to query specific pools with requested - * parameters - */ - QueryPoolsWithFilterStore, - /** Per Pool gRPC Endpoints */QueryPoolStore, - /** - * PoolType returns the type of the pool. - * Returns "Balancer" as a string literal when the pool is a balancer pool. - * Errors if the pool is failed to be type caseted. - */ - QueryPoolTypeStore, - /** - * Simulates joining pool without a swap. Returns the amount of shares you'd - * get and tokens needed to provide - */ - QueryCalcJoinPoolNoSwapSharesStore, - QueryCalcJoinPoolSharesStore, - QueryCalcExitPoolCoinsFromSharesStore, - QueryPoolParamsStore, - QueryTotalPoolLiquidityStore, - QueryTotalSharesStore, - /** - * SpotPrice defines a gRPC query handler that returns the spot price given - * a base denomination and a quote denomination. - */ - QuerySpotPriceStore, - /** Estimate the swap. */QueryEstimateSwapExactAmountInStore, - QueryEstimateSwapExactAmountOutStore - }; }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv4/osmosis/gamm/v1beta1/query.ts b/__fixtures__/v-next/outputv4/osmosis/gamm/v1beta1/query.ts index 555de581a7..0a66f68878 100644 --- a/__fixtures__/v-next/outputv4/osmosis/gamm/v1beta1/query.ts +++ b/__fixtures__/v-next/outputv4/osmosis/gamm/v1beta1/query.ts @@ -1,15 +1,19 @@ -import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../../cosmos/base/query/v1beta1/pagination.js"; -import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin.js"; -import { SwapAmountInRoute, SwapAmountInRouteSDKType, SwapAmountOutRoute, SwapAmountOutRouteSDKType } from "./tx.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"; +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../../cosmos/base/query/v1beta1/pagination"; +import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; +import { SwapAmountInRoute, SwapAmountInRouteSDKType, SwapAmountOutRoute, SwapAmountOutRouteSDKType } from "./tx"; +import { Any, AnySDKType } from "../../../google/protobuf/any"; +import { BinaryReader, BinaryWriter } from "../../../binary"; +import { isSet, DeepPartial } from "../../../helpers"; +import { JsonSafe } from "../../../json-safe"; +import { ComputedRef } from "vue"; export const protobufPackage = "osmosis.gamm.v1beta1"; /** =============================== Pool */ export interface QueryPoolRequest { poolId: bigint; } +export interface ReactiveQueryPoolRequest { + poolId: ComputedRef<bigint>; +} export interface QueryPoolRequestProtoMsg { typeUrl: "/osmosis.gamm.v1beta1.QueryPoolRequest"; value: Uint8Array; @@ -21,6 +25,9 @@ export interface QueryPoolRequestSDKType { export interface QueryPoolResponse { pool?: Any; } +export interface ReactiveQueryPoolResponse { + pool?: ComputedRef<Any>; +} export interface QueryPoolResponseProtoMsg { typeUrl: "/osmosis.gamm.v1beta1.QueryPoolResponse"; value: Uint8Array; @@ -33,6 +40,9 @@ export interface QueryPoolsRequest { /** pagination defines an optional pagination for the request. */ pagination?: PageRequest; } +export interface ReactiveQueryPoolsRequest { + pagination?: ComputedRef<PageRequest>; +} export interface QueryPoolsRequestProtoMsg { typeUrl: "/osmosis.gamm.v1beta1.QueryPoolsRequest"; value: Uint8Array; @@ -46,6 +56,10 @@ export interface QueryPoolsResponse { /** pagination defines the pagination in the response. */ pagination?: PageResponse; } +export interface ReactiveQueryPoolsResponse { + pools: ComputedRef<Any[]>; + pagination?: ComputedRef<PageResponse>; +} export interface QueryPoolsResponseProtoMsg { typeUrl: "/osmosis.gamm.v1beta1.QueryPoolsResponse"; value: Uint8Array; @@ -56,6 +70,7 @@ export interface QueryPoolsResponseSDKType { } /** =============================== NumPools */ export interface QueryNumPoolsRequest {} +export interface ReactiveQueryNumPoolsRequest {} export interface QueryNumPoolsRequestProtoMsg { typeUrl: "/osmosis.gamm.v1beta1.QueryNumPoolsRequest"; value: Uint8Array; @@ -65,6 +80,9 @@ export interface QueryNumPoolsRequestSDKType {} export interface QueryNumPoolsResponse { numPools: bigint; } +export interface ReactiveQueryNumPoolsResponse { + numPools: ComputedRef<bigint>; +} export interface QueryNumPoolsResponseProtoMsg { typeUrl: "/osmosis.gamm.v1beta1.QueryNumPoolsResponse"; value: Uint8Array; @@ -76,6 +94,9 @@ export interface QueryNumPoolsResponseSDKType { export interface QueryPoolTypeRequest { poolId: bigint; } +export interface ReactiveQueryPoolTypeRequest { + poolId: ComputedRef<bigint>; +} export interface QueryPoolTypeRequestProtoMsg { typeUrl: "/osmosis.gamm.v1beta1.QueryPoolTypeRequest"; value: Uint8Array; @@ -87,6 +108,9 @@ export interface QueryPoolTypeRequestSDKType { export interface QueryPoolTypeResponse { poolType: string; } +export interface ReactiveQueryPoolTypeResponse { + poolType: ComputedRef<string>; +} export interface QueryPoolTypeResponseProtoMsg { typeUrl: "/osmosis.gamm.v1beta1.QueryPoolTypeResponse"; value: Uint8Array; @@ -99,6 +123,10 @@ export interface QueryCalcJoinPoolSharesRequest { poolId: bigint; tokensIn: Coin[]; } +export interface ReactiveQueryCalcJoinPoolSharesRequest { + poolId: ComputedRef<bigint>; + tokensIn: ComputedRef<Coin[]>; +} export interface QueryCalcJoinPoolSharesRequestProtoMsg { typeUrl: "/osmosis.gamm.v1beta1.QueryCalcJoinPoolSharesRequest"; value: Uint8Array; @@ -112,6 +140,10 @@ export interface QueryCalcJoinPoolSharesResponse { shareOutAmount: string; tokensOut: Coin[]; } +export interface ReactiveQueryCalcJoinPoolSharesResponse { + shareOutAmount: ComputedRef<string>; + tokensOut: ComputedRef<Coin[]>; +} export interface QueryCalcJoinPoolSharesResponseProtoMsg { typeUrl: "/osmosis.gamm.v1beta1.QueryCalcJoinPoolSharesResponse"; value: Uint8Array; @@ -125,6 +157,10 @@ export interface QueryCalcExitPoolCoinsFromSharesRequest { poolId: bigint; shareInAmount: string; } +export interface ReactiveQueryCalcExitPoolCoinsFromSharesRequest { + poolId: ComputedRef<bigint>; + shareInAmount: ComputedRef<string>; +} export interface QueryCalcExitPoolCoinsFromSharesRequestProtoMsg { typeUrl: "/osmosis.gamm.v1beta1.QueryCalcExitPoolCoinsFromSharesRequest"; value: Uint8Array; @@ -137,6 +173,9 @@ export interface QueryCalcExitPoolCoinsFromSharesRequestSDKType { export interface QueryCalcExitPoolCoinsFromSharesResponse { tokensOut: Coin[]; } +export interface ReactiveQueryCalcExitPoolCoinsFromSharesResponse { + tokensOut: ComputedRef<Coin[]>; +} export interface QueryCalcExitPoolCoinsFromSharesResponseProtoMsg { typeUrl: "/osmosis.gamm.v1beta1.QueryCalcExitPoolCoinsFromSharesResponse"; value: Uint8Array; @@ -148,6 +187,9 @@ export interface QueryCalcExitPoolCoinsFromSharesResponseSDKType { export interface QueryPoolParamsRequest { poolId: bigint; } +export interface ReactiveQueryPoolParamsRequest { + poolId: ComputedRef<bigint>; +} export interface QueryPoolParamsRequestProtoMsg { typeUrl: "/osmosis.gamm.v1beta1.QueryPoolParamsRequest"; value: Uint8Array; @@ -159,6 +201,9 @@ export interface QueryPoolParamsRequestSDKType { export interface QueryPoolParamsResponse { params?: Any; } +export interface ReactiveQueryPoolParamsResponse { + params?: ComputedRef<Any>; +} export interface QueryPoolParamsResponseProtoMsg { typeUrl: "/osmosis.gamm.v1beta1.QueryPoolParamsResponse"; value: Uint8Array; @@ -170,6 +215,9 @@ export interface QueryPoolParamsResponseSDKType { export interface QueryTotalPoolLiquidityRequest { poolId: bigint; } +export interface ReactiveQueryTotalPoolLiquidityRequest { + poolId: ComputedRef<bigint>; +} export interface QueryTotalPoolLiquidityRequestProtoMsg { typeUrl: "/osmosis.gamm.v1beta1.QueryTotalPoolLiquidityRequest"; value: Uint8Array; @@ -181,6 +229,9 @@ export interface QueryTotalPoolLiquidityRequestSDKType { export interface QueryTotalPoolLiquidityResponse { liquidity: Coin[]; } +export interface ReactiveQueryTotalPoolLiquidityResponse { + liquidity: ComputedRef<Coin[]>; +} export interface QueryTotalPoolLiquidityResponseProtoMsg { typeUrl: "/osmosis.gamm.v1beta1.QueryTotalPoolLiquidityResponse"; value: Uint8Array; @@ -192,6 +243,9 @@ export interface QueryTotalPoolLiquidityResponseSDKType { export interface QueryTotalSharesRequest { poolId: bigint; } +export interface ReactiveQueryTotalSharesRequest { + poolId: ComputedRef<bigint>; +} export interface QueryTotalSharesRequestProtoMsg { typeUrl: "/osmosis.gamm.v1beta1.QueryTotalSharesRequest"; value: Uint8Array; @@ -203,6 +257,9 @@ export interface QueryTotalSharesRequestSDKType { export interface QueryTotalSharesResponse { totalShares: Coin; } +export interface ReactiveQueryTotalSharesResponse { + totalShares: ComputedRef<Coin>; +} export interface QueryTotalSharesResponseProtoMsg { typeUrl: "/osmosis.gamm.v1beta1.QueryTotalSharesResponse"; value: Uint8Array; @@ -215,6 +272,10 @@ export interface QueryCalcJoinPoolNoSwapSharesRequest { poolId: bigint; tokensIn: Coin[]; } +export interface ReactiveQueryCalcJoinPoolNoSwapSharesRequest { + poolId: ComputedRef<bigint>; + tokensIn: ComputedRef<Coin[]>; +} export interface QueryCalcJoinPoolNoSwapSharesRequestProtoMsg { typeUrl: "/osmosis.gamm.v1beta1.QueryCalcJoinPoolNoSwapSharesRequest"; value: Uint8Array; @@ -228,6 +289,10 @@ export interface QueryCalcJoinPoolNoSwapSharesResponse { tokensOut: Coin[]; sharesOut: string; } +export interface ReactiveQueryCalcJoinPoolNoSwapSharesResponse { + tokensOut: ComputedRef<Coin[]>; + sharesOut: ComputedRef<string>; +} export interface QueryCalcJoinPoolNoSwapSharesResponseProtoMsg { typeUrl: "/osmosis.gamm.v1beta1.QueryCalcJoinPoolNoSwapSharesResponse"; value: Uint8Array; @@ -246,6 +311,11 @@ export interface QuerySpotPriceRequest { baseAssetDenom: string; quoteAssetDenom: string; } +export interface ReactiveQuerySpotPriceRequest { + poolId: ComputedRef<bigint>; + baseAssetDenom: ComputedRef<string>; + quoteAssetDenom: ComputedRef<string>; +} export interface QuerySpotPriceRequestProtoMsg { typeUrl: "/osmosis.gamm.v1beta1.QuerySpotPriceRequest"; value: Uint8Array; @@ -265,6 +335,11 @@ export interface QueryPoolsWithFilterRequest { poolType: string; pagination?: PageRequest; } +export interface ReactiveQueryPoolsWithFilterRequest { + minLiquidity: ComputedRef<Coin[]>; + poolType: ComputedRef<string>; + pagination?: ComputedRef<PageRequest>; +} export interface QueryPoolsWithFilterRequestProtoMsg { typeUrl: "/osmosis.gamm.v1beta1.QueryPoolsWithFilterRequest"; value: Uint8Array; @@ -279,6 +354,10 @@ export interface QueryPoolsWithFilterResponse { /** pagination defines the pagination in the response. */ pagination?: PageResponse; } +export interface ReactiveQueryPoolsWithFilterResponse { + pools: ComputedRef<Any[]>; + pagination?: ComputedRef<PageResponse>; +} export interface QueryPoolsWithFilterResponseProtoMsg { typeUrl: "/osmosis.gamm.v1beta1.QueryPoolsWithFilterResponse"; value: Uint8Array; @@ -296,6 +375,9 @@ export interface QuerySpotPriceResponse { /** String of the Dec. Ex) 10.203uatom */ spotPrice: string; } +export interface ReactiveQuerySpotPriceResponse { + spotPrice: ComputedRef<string>; +} export interface QuerySpotPriceResponseProtoMsg { typeUrl: "/osmosis.gamm.v1beta1.QuerySpotPriceResponse"; value: Uint8Array; @@ -316,6 +398,12 @@ export interface QuerySwapExactAmountInRequest { tokenIn: string; routes: SwapAmountInRoute[]; } +export interface ReactiveQuerySwapExactAmountInRequest { + sender: ComputedRef<string>; + poolId: ComputedRef<bigint>; + tokenIn: ComputedRef<string>; + routes: ComputedRef<SwapAmountInRoute[]>; +} export interface QuerySwapExactAmountInRequestProtoMsg { typeUrl: "/osmosis.gamm.v1beta1.QuerySwapExactAmountInRequest"; value: Uint8Array; @@ -330,6 +418,9 @@ export interface QuerySwapExactAmountInRequestSDKType { export interface QuerySwapExactAmountInResponse { tokenOutAmount: string; } +export interface ReactiveQuerySwapExactAmountInResponse { + tokenOutAmount: ComputedRef<string>; +} export interface QuerySwapExactAmountInResponseProtoMsg { typeUrl: "/osmosis.gamm.v1beta1.QuerySwapExactAmountInResponse"; value: Uint8Array; @@ -345,6 +436,12 @@ export interface QuerySwapExactAmountOutRequest { routes: SwapAmountOutRoute[]; tokenOut: string; } +export interface ReactiveQuerySwapExactAmountOutRequest { + sender: ComputedRef<string>; + poolId: ComputedRef<bigint>; + routes: ComputedRef<SwapAmountOutRoute[]>; + tokenOut: ComputedRef<string>; +} export interface QuerySwapExactAmountOutRequestProtoMsg { typeUrl: "/osmosis.gamm.v1beta1.QuerySwapExactAmountOutRequest"; value: Uint8Array; @@ -359,6 +456,9 @@ export interface QuerySwapExactAmountOutRequestSDKType { export interface QuerySwapExactAmountOutResponse { tokenInAmount: string; } +export interface ReactiveQuerySwapExactAmountOutResponse { + tokenInAmount: ComputedRef<string>; +} export interface QuerySwapExactAmountOutResponseProtoMsg { typeUrl: "/osmosis.gamm.v1beta1.QuerySwapExactAmountOutResponse"; value: Uint8Array; @@ -367,6 +467,7 @@ export interface QuerySwapExactAmountOutResponseSDKType { token_in_amount: string; } export interface QueryTotalLiquidityRequest {} +export interface ReactiveQueryTotalLiquidityRequest {} export interface QueryTotalLiquidityRequestProtoMsg { typeUrl: "/osmosis.gamm.v1beta1.QueryTotalLiquidityRequest"; value: Uint8Array; @@ -375,6 +476,9 @@ export interface QueryTotalLiquidityRequestSDKType {} export interface QueryTotalLiquidityResponse { liquidity: Coin[]; } +export interface ReactiveQueryTotalLiquidityResponse { + liquidity: ComputedRef<Coin[]>; +} export interface QueryTotalLiquidityResponseProtoMsg { typeUrl: "/osmosis.gamm.v1beta1.QueryTotalLiquidityResponse"; value: Uint8Array; @@ -390,7 +494,7 @@ function createBaseQueryPoolRequest(): QueryPoolRequest { export const QueryPoolRequest = { typeUrl: "/osmosis.gamm.v1beta1.QueryPoolRequest", encode(message: QueryPoolRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.poolId !== undefined) { + if (message.poolId !== BigInt(0)) { writer.uint32(8).uint64(message.poolId); } return writer; @@ -413,9 +517,9 @@ export const QueryPoolRequest = { return message; }, fromJSON(object: any): QueryPoolRequest { - const obj = createBaseQueryPoolRequest(); - if (isSet(object.poolId)) obj.poolId = BigInt(object.poolId.toString()); - return obj; + return { + poolId: isSet(object.poolId) ? BigInt(object.poolId.toString()) : BigInt(0) + }; }, toJSON(message: QueryPoolRequest): JsonSafe<QueryPoolRequest> { const obj: any = {}; @@ -424,9 +528,7 @@ export const QueryPoolRequest = { }, fromPartial(object: DeepPartial<QueryPoolRequest>): QueryPoolRequest { const message = createBaseQueryPoolRequest(); - if (object.poolId !== undefined && object.poolId !== null) { - message.poolId = BigInt(object.poolId.toString()); - } + message.poolId = object.poolId !== undefined && object.poolId !== null ? BigInt(object.poolId.toString()) : BigInt(0); return message; }, fromSDK(object: QueryPoolRequestSDKType): QueryPoolRequest { @@ -509,9 +611,9 @@ export const QueryPoolResponse = { return message; }, fromJSON(object: any): QueryPoolResponse { - const obj = createBaseQueryPoolResponse(); - if (isSet(object.pool)) obj.pool = Any.fromJSON(object.pool); - return obj; + return { + pool: isSet(object.pool) ? Any.fromJSON(object.pool) : undefined + }; }, toJSON(message: QueryPoolResponse): JsonSafe<QueryPoolResponse> { const obj: any = {}; @@ -520,9 +622,7 @@ export const QueryPoolResponse = { }, fromPartial(object: DeepPartial<QueryPoolResponse>): QueryPoolResponse { const message = createBaseQueryPoolResponse(); - if (object.pool !== undefined && object.pool !== null) { - message.pool = Any.fromPartial(object.pool); - } + message.pool = object.pool !== undefined && object.pool !== null ? Any.fromPartial(object.pool) : undefined; return message; }, fromSDK(object: QueryPoolResponseSDKType): QueryPoolResponse { @@ -605,9 +705,9 @@ export const QueryPoolsRequest = { return message; }, fromJSON(object: any): QueryPoolsRequest { - const obj = createBaseQueryPoolsRequest(); - if (isSet(object.pagination)) obj.pagination = PageRequest.fromJSON(object.pagination); - return obj; + return { + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined + }; }, toJSON(message: QueryPoolsRequest): JsonSafe<QueryPoolsRequest> { const obj: any = {}; @@ -616,9 +716,7 @@ export const QueryPoolsRequest = { }, fromPartial(object: DeepPartial<QueryPoolsRequest>): QueryPoolsRequest { const message = createBaseQueryPoolsRequest(); - if (object.pagination !== undefined && object.pagination !== null) { - message.pagination = PageRequest.fromPartial(object.pagination); - } + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageRequest.fromPartial(object.pagination) : undefined; return message; }, fromSDK(object: QueryPoolsRequestSDKType): QueryPoolsRequest { @@ -708,10 +806,10 @@ export const QueryPoolsResponse = { return message; }, fromJSON(object: any): QueryPoolsResponse { - const obj = createBaseQueryPoolsResponse(); - if (Array.isArray(object?.pools)) obj.pools = object.pools.map((e: any) => Any.fromJSON(e)); - if (isSet(object.pagination)) obj.pagination = PageResponse.fromJSON(object.pagination); - return obj; + return { + pools: Array.isArray(object?.pools) ? object.pools.map((e: any) => Any.fromJSON(e)) : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined + }; }, toJSON(message: QueryPoolsResponse): JsonSafe<QueryPoolsResponse> { const obj: any = {}; @@ -726,9 +824,7 @@ export const QueryPoolsResponse = { fromPartial(object: DeepPartial<QueryPoolsResponse>): QueryPoolsResponse { const message = createBaseQueryPoolsResponse(); message.pools = object.pools?.map(e => Any.fromPartial(e)) || []; - if (object.pagination !== undefined && object.pagination !== null) { - message.pagination = PageResponse.fromPartial(object.pagination); - } + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageResponse.fromPartial(object.pagination) : undefined; return message; }, fromSDK(object: QueryPoolsResponseSDKType): QueryPoolsResponse { @@ -816,8 +912,7 @@ export const QueryNumPoolsRequest = { return message; }, fromJSON(_: any): QueryNumPoolsRequest { - const obj = createBaseQueryNumPoolsRequest(); - return obj; + return {}; }, toJSON(_: QueryNumPoolsRequest): JsonSafe<QueryNumPoolsRequest> { const obj: any = {}; @@ -875,7 +970,7 @@ function createBaseQueryNumPoolsResponse(): QueryNumPoolsResponse { export const QueryNumPoolsResponse = { typeUrl: "/osmosis.gamm.v1beta1.QueryNumPoolsResponse", encode(message: QueryNumPoolsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.numPools !== undefined) { + if (message.numPools !== BigInt(0)) { writer.uint32(8).uint64(message.numPools); } return writer; @@ -898,9 +993,9 @@ export const QueryNumPoolsResponse = { return message; }, fromJSON(object: any): QueryNumPoolsResponse { - const obj = createBaseQueryNumPoolsResponse(); - if (isSet(object.numPools)) obj.numPools = BigInt(object.numPools.toString()); - return obj; + return { + numPools: isSet(object.numPools) ? BigInt(object.numPools.toString()) : BigInt(0) + }; }, toJSON(message: QueryNumPoolsResponse): JsonSafe<QueryNumPoolsResponse> { const obj: any = {}; @@ -909,9 +1004,7 @@ export const QueryNumPoolsResponse = { }, fromPartial(object: DeepPartial<QueryNumPoolsResponse>): QueryNumPoolsResponse { const message = createBaseQueryNumPoolsResponse(); - if (object.numPools !== undefined && object.numPools !== null) { - message.numPools = BigInt(object.numPools.toString()); - } + message.numPools = object.numPools !== undefined && object.numPools !== null ? BigInt(object.numPools.toString()) : BigInt(0); return message; }, fromSDK(object: QueryNumPoolsResponseSDKType): QueryNumPoolsResponse { @@ -971,7 +1064,7 @@ function createBaseQueryPoolTypeRequest(): QueryPoolTypeRequest { export const QueryPoolTypeRequest = { typeUrl: "/osmosis.gamm.v1beta1.QueryPoolTypeRequest", encode(message: QueryPoolTypeRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.poolId !== undefined) { + if (message.poolId !== BigInt(0)) { writer.uint32(8).uint64(message.poolId); } return writer; @@ -994,9 +1087,9 @@ export const QueryPoolTypeRequest = { return message; }, fromJSON(object: any): QueryPoolTypeRequest { - const obj = createBaseQueryPoolTypeRequest(); - if (isSet(object.poolId)) obj.poolId = BigInt(object.poolId.toString()); - return obj; + return { + poolId: isSet(object.poolId) ? BigInt(object.poolId.toString()) : BigInt(0) + }; }, toJSON(message: QueryPoolTypeRequest): JsonSafe<QueryPoolTypeRequest> { const obj: any = {}; @@ -1005,9 +1098,7 @@ export const QueryPoolTypeRequest = { }, fromPartial(object: DeepPartial<QueryPoolTypeRequest>): QueryPoolTypeRequest { const message = createBaseQueryPoolTypeRequest(); - if (object.poolId !== undefined && object.poolId !== null) { - message.poolId = BigInt(object.poolId.toString()); - } + message.poolId = object.poolId !== undefined && object.poolId !== null ? BigInt(object.poolId.toString()) : BigInt(0); return message; }, fromSDK(object: QueryPoolTypeRequestSDKType): QueryPoolTypeRequest { @@ -1067,7 +1158,7 @@ function createBaseQueryPoolTypeResponse(): QueryPoolTypeResponse { export const QueryPoolTypeResponse = { typeUrl: "/osmosis.gamm.v1beta1.QueryPoolTypeResponse", encode(message: QueryPoolTypeResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.poolType !== undefined) { + if (message.poolType !== "") { writer.uint32(10).string(message.poolType); } return writer; @@ -1090,9 +1181,9 @@ export const QueryPoolTypeResponse = { return message; }, fromJSON(object: any): QueryPoolTypeResponse { - const obj = createBaseQueryPoolTypeResponse(); - if (isSet(object.poolType)) obj.poolType = String(object.poolType); - return obj; + return { + poolType: isSet(object.poolType) ? String(object.poolType) : "" + }; }, toJSON(message: QueryPoolTypeResponse): JsonSafe<QueryPoolTypeResponse> { const obj: any = {}; @@ -1162,7 +1253,7 @@ function createBaseQueryCalcJoinPoolSharesRequest(): QueryCalcJoinPoolSharesRequ export const QueryCalcJoinPoolSharesRequest = { typeUrl: "/osmosis.gamm.v1beta1.QueryCalcJoinPoolSharesRequest", encode(message: QueryCalcJoinPoolSharesRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.poolId !== undefined) { + if (message.poolId !== BigInt(0)) { writer.uint32(8).uint64(message.poolId); } for (const v of message.tokensIn) { @@ -1191,10 +1282,10 @@ export const QueryCalcJoinPoolSharesRequest = { return message; }, fromJSON(object: any): QueryCalcJoinPoolSharesRequest { - const obj = createBaseQueryCalcJoinPoolSharesRequest(); - if (isSet(object.poolId)) obj.poolId = BigInt(object.poolId.toString()); - if (Array.isArray(object?.tokensIn)) obj.tokensIn = object.tokensIn.map((e: any) => Coin.fromJSON(e)); - return obj; + return { + poolId: isSet(object.poolId) ? BigInt(object.poolId.toString()) : BigInt(0), + tokensIn: Array.isArray(object?.tokensIn) ? object.tokensIn.map((e: any) => Coin.fromJSON(e)) : [] + }; }, toJSON(message: QueryCalcJoinPoolSharesRequest): JsonSafe<QueryCalcJoinPoolSharesRequest> { const obj: any = {}; @@ -1208,9 +1299,7 @@ export const QueryCalcJoinPoolSharesRequest = { }, fromPartial(object: DeepPartial<QueryCalcJoinPoolSharesRequest>): QueryCalcJoinPoolSharesRequest { const message = createBaseQueryCalcJoinPoolSharesRequest(); - if (object.poolId !== undefined && object.poolId !== null) { - message.poolId = BigInt(object.poolId.toString()); - } + message.poolId = object.poolId !== undefined && object.poolId !== null ? BigInt(object.poolId.toString()) : BigInt(0); message.tokensIn = object.tokensIn?.map(e => Coin.fromPartial(e)) || []; return message; }, @@ -1285,7 +1374,7 @@ function createBaseQueryCalcJoinPoolSharesResponse(): QueryCalcJoinPoolSharesRes export const QueryCalcJoinPoolSharesResponse = { typeUrl: "/osmosis.gamm.v1beta1.QueryCalcJoinPoolSharesResponse", encode(message: QueryCalcJoinPoolSharesResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.shareOutAmount !== undefined) { + if (message.shareOutAmount !== "") { writer.uint32(10).string(message.shareOutAmount); } for (const v of message.tokensOut) { @@ -1314,10 +1403,10 @@ export const QueryCalcJoinPoolSharesResponse = { return message; }, fromJSON(object: any): QueryCalcJoinPoolSharesResponse { - const obj = createBaseQueryCalcJoinPoolSharesResponse(); - if (isSet(object.shareOutAmount)) obj.shareOutAmount = String(object.shareOutAmount); - if (Array.isArray(object?.tokensOut)) obj.tokensOut = object.tokensOut.map((e: any) => Coin.fromJSON(e)); - return obj; + return { + shareOutAmount: isSet(object.shareOutAmount) ? String(object.shareOutAmount) : "", + tokensOut: Array.isArray(object?.tokensOut) ? object.tokensOut.map((e: any) => Coin.fromJSON(e)) : [] + }; }, toJSON(message: QueryCalcJoinPoolSharesResponse): JsonSafe<QueryCalcJoinPoolSharesResponse> { const obj: any = {}; @@ -1406,10 +1495,10 @@ function createBaseQueryCalcExitPoolCoinsFromSharesRequest(): QueryCalcExitPoolC export const QueryCalcExitPoolCoinsFromSharesRequest = { typeUrl: "/osmosis.gamm.v1beta1.QueryCalcExitPoolCoinsFromSharesRequest", encode(message: QueryCalcExitPoolCoinsFromSharesRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.poolId !== undefined) { + if (message.poolId !== BigInt(0)) { writer.uint32(8).uint64(message.poolId); } - if (message.shareInAmount !== undefined) { + if (message.shareInAmount !== "") { writer.uint32(18).string(message.shareInAmount); } return writer; @@ -1435,10 +1524,10 @@ export const QueryCalcExitPoolCoinsFromSharesRequest = { return message; }, fromJSON(object: any): QueryCalcExitPoolCoinsFromSharesRequest { - const obj = createBaseQueryCalcExitPoolCoinsFromSharesRequest(); - if (isSet(object.poolId)) obj.poolId = BigInt(object.poolId.toString()); - if (isSet(object.shareInAmount)) obj.shareInAmount = String(object.shareInAmount); - return obj; + return { + poolId: isSet(object.poolId) ? BigInt(object.poolId.toString()) : BigInt(0), + shareInAmount: isSet(object.shareInAmount) ? String(object.shareInAmount) : "" + }; }, toJSON(message: QueryCalcExitPoolCoinsFromSharesRequest): JsonSafe<QueryCalcExitPoolCoinsFromSharesRequest> { const obj: any = {}; @@ -1448,9 +1537,7 @@ export const QueryCalcExitPoolCoinsFromSharesRequest = { }, fromPartial(object: DeepPartial<QueryCalcExitPoolCoinsFromSharesRequest>): QueryCalcExitPoolCoinsFromSharesRequest { const message = createBaseQueryCalcExitPoolCoinsFromSharesRequest(); - if (object.poolId !== undefined && object.poolId !== null) { - message.poolId = BigInt(object.poolId.toString()); - } + message.poolId = object.poolId !== undefined && object.poolId !== null ? BigInt(object.poolId.toString()) : BigInt(0); message.shareInAmount = object.shareInAmount ?? ""; return message; }, @@ -1541,9 +1628,9 @@ export const QueryCalcExitPoolCoinsFromSharesResponse = { return message; }, fromJSON(object: any): QueryCalcExitPoolCoinsFromSharesResponse { - const obj = createBaseQueryCalcExitPoolCoinsFromSharesResponse(); - if (Array.isArray(object?.tokensOut)) obj.tokensOut = object.tokensOut.map((e: any) => Coin.fromJSON(e)); - return obj; + return { + tokensOut: Array.isArray(object?.tokensOut) ? object.tokensOut.map((e: any) => Coin.fromJSON(e)) : [] + }; }, toJSON(message: QueryCalcExitPoolCoinsFromSharesResponse): JsonSafe<QueryCalcExitPoolCoinsFromSharesResponse> { const obj: any = {}; @@ -1622,7 +1709,7 @@ function createBaseQueryPoolParamsRequest(): QueryPoolParamsRequest { export const QueryPoolParamsRequest = { typeUrl: "/osmosis.gamm.v1beta1.QueryPoolParamsRequest", encode(message: QueryPoolParamsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.poolId !== undefined) { + if (message.poolId !== BigInt(0)) { writer.uint32(8).uint64(message.poolId); } return writer; @@ -1645,9 +1732,9 @@ export const QueryPoolParamsRequest = { return message; }, fromJSON(object: any): QueryPoolParamsRequest { - const obj = createBaseQueryPoolParamsRequest(); - if (isSet(object.poolId)) obj.poolId = BigInt(object.poolId.toString()); - return obj; + return { + poolId: isSet(object.poolId) ? BigInt(object.poolId.toString()) : BigInt(0) + }; }, toJSON(message: QueryPoolParamsRequest): JsonSafe<QueryPoolParamsRequest> { const obj: any = {}; @@ -1656,9 +1743,7 @@ export const QueryPoolParamsRequest = { }, fromPartial(object: DeepPartial<QueryPoolParamsRequest>): QueryPoolParamsRequest { const message = createBaseQueryPoolParamsRequest(); - if (object.poolId !== undefined && object.poolId !== null) { - message.poolId = BigInt(object.poolId.toString()); - } + message.poolId = object.poolId !== undefined && object.poolId !== null ? BigInt(object.poolId.toString()) : BigInt(0); return message; }, fromSDK(object: QueryPoolParamsRequestSDKType): QueryPoolParamsRequest { @@ -1741,9 +1826,9 @@ export const QueryPoolParamsResponse = { return message; }, fromJSON(object: any): QueryPoolParamsResponse { - const obj = createBaseQueryPoolParamsResponse(); - if (isSet(object.params)) obj.params = Any.fromJSON(object.params); - return obj; + return { + params: isSet(object.params) ? Any.fromJSON(object.params) : undefined + }; }, toJSON(message: QueryPoolParamsResponse): JsonSafe<QueryPoolParamsResponse> { const obj: any = {}; @@ -1752,9 +1837,7 @@ export const QueryPoolParamsResponse = { }, fromPartial(object: DeepPartial<QueryPoolParamsResponse>): QueryPoolParamsResponse { const message = createBaseQueryPoolParamsResponse(); - if (object.params !== undefined && object.params !== null) { - message.params = Any.fromPartial(object.params); - } + message.params = object.params !== undefined && object.params !== null ? Any.fromPartial(object.params) : undefined; return message; }, fromSDK(object: QueryPoolParamsResponseSDKType): QueryPoolParamsResponse { @@ -1814,7 +1897,7 @@ function createBaseQueryTotalPoolLiquidityRequest(): QueryTotalPoolLiquidityRequ export const QueryTotalPoolLiquidityRequest = { typeUrl: "/osmosis.gamm.v1beta1.QueryTotalPoolLiquidityRequest", encode(message: QueryTotalPoolLiquidityRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.poolId !== undefined) { + if (message.poolId !== BigInt(0)) { writer.uint32(8).uint64(message.poolId); } return writer; @@ -1837,9 +1920,9 @@ export const QueryTotalPoolLiquidityRequest = { return message; }, fromJSON(object: any): QueryTotalPoolLiquidityRequest { - const obj = createBaseQueryTotalPoolLiquidityRequest(); - if (isSet(object.poolId)) obj.poolId = BigInt(object.poolId.toString()); - return obj; + return { + poolId: isSet(object.poolId) ? BigInt(object.poolId.toString()) : BigInt(0) + }; }, toJSON(message: QueryTotalPoolLiquidityRequest): JsonSafe<QueryTotalPoolLiquidityRequest> { const obj: any = {}; @@ -1848,9 +1931,7 @@ export const QueryTotalPoolLiquidityRequest = { }, fromPartial(object: DeepPartial<QueryTotalPoolLiquidityRequest>): QueryTotalPoolLiquidityRequest { const message = createBaseQueryTotalPoolLiquidityRequest(); - if (object.poolId !== undefined && object.poolId !== null) { - message.poolId = BigInt(object.poolId.toString()); - } + message.poolId = object.poolId !== undefined && object.poolId !== null ? BigInt(object.poolId.toString()) : BigInt(0); return message; }, fromSDK(object: QueryTotalPoolLiquidityRequestSDKType): QueryTotalPoolLiquidityRequest { @@ -1933,9 +2014,9 @@ export const QueryTotalPoolLiquidityResponse = { return message; }, fromJSON(object: any): QueryTotalPoolLiquidityResponse { - const obj = createBaseQueryTotalPoolLiquidityResponse(); - if (Array.isArray(object?.liquidity)) obj.liquidity = object.liquidity.map((e: any) => Coin.fromJSON(e)); - return obj; + return { + liquidity: Array.isArray(object?.liquidity) ? object.liquidity.map((e: any) => Coin.fromJSON(e)) : [] + }; }, toJSON(message: QueryTotalPoolLiquidityResponse): JsonSafe<QueryTotalPoolLiquidityResponse> { const obj: any = {}; @@ -2014,7 +2095,7 @@ function createBaseQueryTotalSharesRequest(): QueryTotalSharesRequest { export const QueryTotalSharesRequest = { typeUrl: "/osmosis.gamm.v1beta1.QueryTotalSharesRequest", encode(message: QueryTotalSharesRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.poolId !== undefined) { + if (message.poolId !== BigInt(0)) { writer.uint32(8).uint64(message.poolId); } return writer; @@ -2037,9 +2118,9 @@ export const QueryTotalSharesRequest = { return message; }, fromJSON(object: any): QueryTotalSharesRequest { - const obj = createBaseQueryTotalSharesRequest(); - if (isSet(object.poolId)) obj.poolId = BigInt(object.poolId.toString()); - return obj; + return { + poolId: isSet(object.poolId) ? BigInt(object.poolId.toString()) : BigInt(0) + }; }, toJSON(message: QueryTotalSharesRequest): JsonSafe<QueryTotalSharesRequest> { const obj: any = {}; @@ -2048,9 +2129,7 @@ export const QueryTotalSharesRequest = { }, fromPartial(object: DeepPartial<QueryTotalSharesRequest>): QueryTotalSharesRequest { const message = createBaseQueryTotalSharesRequest(); - if (object.poolId !== undefined && object.poolId !== null) { - message.poolId = BigInt(object.poolId.toString()); - } + message.poolId = object.poolId !== undefined && object.poolId !== null ? BigInt(object.poolId.toString()) : BigInt(0); return message; }, fromSDK(object: QueryTotalSharesRequestSDKType): QueryTotalSharesRequest { @@ -2133,9 +2212,9 @@ export const QueryTotalSharesResponse = { return message; }, fromJSON(object: any): QueryTotalSharesResponse { - const obj = createBaseQueryTotalSharesResponse(); - if (isSet(object.totalShares)) obj.totalShares = Coin.fromJSON(object.totalShares); - return obj; + return { + totalShares: isSet(object.totalShares) ? Coin.fromJSON(object.totalShares) : undefined + }; }, toJSON(message: QueryTotalSharesResponse): JsonSafe<QueryTotalSharesResponse> { const obj: any = {}; @@ -2144,9 +2223,7 @@ export const QueryTotalSharesResponse = { }, fromPartial(object: DeepPartial<QueryTotalSharesResponse>): QueryTotalSharesResponse { const message = createBaseQueryTotalSharesResponse(); - if (object.totalShares !== undefined && object.totalShares !== null) { - message.totalShares = Coin.fromPartial(object.totalShares); - } + message.totalShares = object.totalShares !== undefined && object.totalShares !== null ? Coin.fromPartial(object.totalShares) : undefined; return message; }, fromSDK(object: QueryTotalSharesResponseSDKType): QueryTotalSharesResponse { @@ -2207,7 +2284,7 @@ function createBaseQueryCalcJoinPoolNoSwapSharesRequest(): QueryCalcJoinPoolNoSw export const QueryCalcJoinPoolNoSwapSharesRequest = { typeUrl: "/osmosis.gamm.v1beta1.QueryCalcJoinPoolNoSwapSharesRequest", encode(message: QueryCalcJoinPoolNoSwapSharesRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.poolId !== undefined) { + if (message.poolId !== BigInt(0)) { writer.uint32(8).uint64(message.poolId); } for (const v of message.tokensIn) { @@ -2236,10 +2313,10 @@ export const QueryCalcJoinPoolNoSwapSharesRequest = { return message; }, fromJSON(object: any): QueryCalcJoinPoolNoSwapSharesRequest { - const obj = createBaseQueryCalcJoinPoolNoSwapSharesRequest(); - if (isSet(object.poolId)) obj.poolId = BigInt(object.poolId.toString()); - if (Array.isArray(object?.tokensIn)) obj.tokensIn = object.tokensIn.map((e: any) => Coin.fromJSON(e)); - return obj; + return { + poolId: isSet(object.poolId) ? BigInt(object.poolId.toString()) : BigInt(0), + tokensIn: Array.isArray(object?.tokensIn) ? object.tokensIn.map((e: any) => Coin.fromJSON(e)) : [] + }; }, toJSON(message: QueryCalcJoinPoolNoSwapSharesRequest): JsonSafe<QueryCalcJoinPoolNoSwapSharesRequest> { const obj: any = {}; @@ -2253,9 +2330,7 @@ export const QueryCalcJoinPoolNoSwapSharesRequest = { }, fromPartial(object: DeepPartial<QueryCalcJoinPoolNoSwapSharesRequest>): QueryCalcJoinPoolNoSwapSharesRequest { const message = createBaseQueryCalcJoinPoolNoSwapSharesRequest(); - if (object.poolId !== undefined && object.poolId !== null) { - message.poolId = BigInt(object.poolId.toString()); - } + message.poolId = object.poolId !== undefined && object.poolId !== null ? BigInt(object.poolId.toString()) : BigInt(0); message.tokensIn = object.tokensIn?.map(e => Coin.fromPartial(e)) || []; return message; }, @@ -2333,7 +2408,7 @@ export const QueryCalcJoinPoolNoSwapSharesResponse = { for (const v of message.tokensOut) { Coin.encode(v!, writer.uint32(10).fork()).ldelim(); } - if (message.sharesOut !== undefined) { + if (message.sharesOut !== "") { writer.uint32(18).string(message.sharesOut); } return writer; @@ -2359,10 +2434,10 @@ export const QueryCalcJoinPoolNoSwapSharesResponse = { return message; }, fromJSON(object: any): QueryCalcJoinPoolNoSwapSharesResponse { - const obj = createBaseQueryCalcJoinPoolNoSwapSharesResponse(); - if (Array.isArray(object?.tokensOut)) obj.tokensOut = object.tokensOut.map((e: any) => Coin.fromJSON(e)); - if (isSet(object.sharesOut)) obj.sharesOut = String(object.sharesOut); - return obj; + return { + tokensOut: Array.isArray(object?.tokensOut) ? object.tokensOut.map((e: any) => Coin.fromJSON(e)) : [], + sharesOut: isSet(object.sharesOut) ? String(object.sharesOut) : "" + }; }, toJSON(message: QueryCalcJoinPoolNoSwapSharesResponse): JsonSafe<QueryCalcJoinPoolNoSwapSharesResponse> { const obj: any = {}; @@ -2452,13 +2527,13 @@ function createBaseQuerySpotPriceRequest(): QuerySpotPriceRequest { export const QuerySpotPriceRequest = { typeUrl: "/osmosis.gamm.v1beta1.QuerySpotPriceRequest", encode(message: QuerySpotPriceRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.poolId !== undefined) { + if (message.poolId !== BigInt(0)) { writer.uint32(8).uint64(message.poolId); } - if (message.baseAssetDenom !== undefined) { + if (message.baseAssetDenom !== "") { writer.uint32(18).string(message.baseAssetDenom); } - if (message.quoteAssetDenom !== undefined) { + if (message.quoteAssetDenom !== "") { writer.uint32(26).string(message.quoteAssetDenom); } return writer; @@ -2487,11 +2562,11 @@ export const QuerySpotPriceRequest = { return message; }, fromJSON(object: any): QuerySpotPriceRequest { - const obj = createBaseQuerySpotPriceRequest(); - if (isSet(object.poolId)) obj.poolId = BigInt(object.poolId.toString()); - if (isSet(object.baseAssetDenom)) obj.baseAssetDenom = String(object.baseAssetDenom); - if (isSet(object.quoteAssetDenom)) obj.quoteAssetDenom = String(object.quoteAssetDenom); - return obj; + return { + poolId: isSet(object.poolId) ? BigInt(object.poolId.toString()) : BigInt(0), + baseAssetDenom: isSet(object.baseAssetDenom) ? String(object.baseAssetDenom) : "", + quoteAssetDenom: isSet(object.quoteAssetDenom) ? String(object.quoteAssetDenom) : "" + }; }, toJSON(message: QuerySpotPriceRequest): JsonSafe<QuerySpotPriceRequest> { const obj: any = {}; @@ -2502,9 +2577,7 @@ export const QuerySpotPriceRequest = { }, fromPartial(object: DeepPartial<QuerySpotPriceRequest>): QuerySpotPriceRequest { const message = createBaseQuerySpotPriceRequest(); - if (object.poolId !== undefined && object.poolId !== null) { - message.poolId = BigInt(object.poolId.toString()); - } + message.poolId = object.poolId !== undefined && object.poolId !== null ? BigInt(object.poolId.toString()) : BigInt(0); message.baseAssetDenom = object.baseAssetDenom ?? ""; message.quoteAssetDenom = object.quoteAssetDenom ?? ""; return message; @@ -2585,7 +2658,7 @@ export const QueryPoolsWithFilterRequest = { for (const v of message.minLiquidity) { Coin.encode(v!, writer.uint32(10).fork()).ldelim(); } - if (message.poolType !== undefined) { + if (message.poolType !== "") { writer.uint32(18).string(message.poolType); } if (message.pagination !== undefined) { @@ -2617,11 +2690,11 @@ export const QueryPoolsWithFilterRequest = { return message; }, fromJSON(object: any): QueryPoolsWithFilterRequest { - const obj = createBaseQueryPoolsWithFilterRequest(); - if (Array.isArray(object?.minLiquidity)) obj.minLiquidity = object.minLiquidity.map((e: any) => Coin.fromJSON(e)); - if (isSet(object.poolType)) obj.poolType = String(object.poolType); - if (isSet(object.pagination)) obj.pagination = PageRequest.fromJSON(object.pagination); - return obj; + return { + minLiquidity: Array.isArray(object?.minLiquidity) ? object.minLiquidity.map((e: any) => Coin.fromJSON(e)) : [], + poolType: isSet(object.poolType) ? String(object.poolType) : "", + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined + }; }, toJSON(message: QueryPoolsWithFilterRequest): JsonSafe<QueryPoolsWithFilterRequest> { const obj: any = {}; @@ -2638,9 +2711,7 @@ export const QueryPoolsWithFilterRequest = { const message = createBaseQueryPoolsWithFilterRequest(); message.minLiquidity = object.minLiquidity?.map(e => Coin.fromPartial(e)) || []; message.poolType = object.poolType ?? ""; - if (object.pagination !== undefined && object.pagination !== null) { - message.pagination = PageRequest.fromPartial(object.pagination); - } + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageRequest.fromPartial(object.pagination) : undefined; return message; }, fromSDK(object: QueryPoolsWithFilterRequestSDKType): QueryPoolsWithFilterRequest { @@ -2750,10 +2821,10 @@ export const QueryPoolsWithFilterResponse = { return message; }, fromJSON(object: any): QueryPoolsWithFilterResponse { - const obj = createBaseQueryPoolsWithFilterResponse(); - if (Array.isArray(object?.pools)) obj.pools = object.pools.map((e: any) => Any.fromJSON(e)); - if (isSet(object.pagination)) obj.pagination = PageResponse.fromJSON(object.pagination); - return obj; + return { + pools: Array.isArray(object?.pools) ? object.pools.map((e: any) => Any.fromJSON(e)) : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined + }; }, toJSON(message: QueryPoolsWithFilterResponse): JsonSafe<QueryPoolsWithFilterResponse> { const obj: any = {}; @@ -2768,9 +2839,7 @@ export const QueryPoolsWithFilterResponse = { fromPartial(object: DeepPartial<QueryPoolsWithFilterResponse>): QueryPoolsWithFilterResponse { const message = createBaseQueryPoolsWithFilterResponse(); message.pools = object.pools?.map(e => Any.fromPartial(e)) || []; - if (object.pagination !== undefined && object.pagination !== null) { - message.pagination = PageResponse.fromPartial(object.pagination); - } + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageResponse.fromPartial(object.pagination) : undefined; return message; }, fromSDK(object: QueryPoolsWithFilterResponseSDKType): QueryPoolsWithFilterResponse { @@ -2843,7 +2912,7 @@ function createBaseQuerySpotPriceResponse(): QuerySpotPriceResponse { export const QuerySpotPriceResponse = { typeUrl: "/osmosis.gamm.v1beta1.QuerySpotPriceResponse", encode(message: QuerySpotPriceResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.spotPrice !== undefined) { + if (message.spotPrice !== "") { writer.uint32(10).string(message.spotPrice); } return writer; @@ -2866,9 +2935,9 @@ export const QuerySpotPriceResponse = { return message; }, fromJSON(object: any): QuerySpotPriceResponse { - const obj = createBaseQuerySpotPriceResponse(); - if (isSet(object.spotPrice)) obj.spotPrice = String(object.spotPrice); - return obj; + return { + spotPrice: isSet(object.spotPrice) ? String(object.spotPrice) : "" + }; }, toJSON(message: QuerySpotPriceResponse): JsonSafe<QuerySpotPriceResponse> { const obj: any = {}; @@ -2940,13 +3009,13 @@ function createBaseQuerySwapExactAmountInRequest(): QuerySwapExactAmountInReques export const QuerySwapExactAmountInRequest = { typeUrl: "/osmosis.gamm.v1beta1.QuerySwapExactAmountInRequest", encode(message: QuerySwapExactAmountInRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.sender !== undefined) { + if (message.sender !== "") { writer.uint32(10).string(message.sender); } - if (message.poolId !== undefined) { + if (message.poolId !== BigInt(0)) { writer.uint32(16).uint64(message.poolId); } - if (message.tokenIn !== undefined) { + if (message.tokenIn !== "") { writer.uint32(26).string(message.tokenIn); } for (const v of message.routes) { @@ -2981,12 +3050,12 @@ export const QuerySwapExactAmountInRequest = { return message; }, fromJSON(object: any): QuerySwapExactAmountInRequest { - const obj = createBaseQuerySwapExactAmountInRequest(); - if (isSet(object.sender)) obj.sender = String(object.sender); - if (isSet(object.poolId)) obj.poolId = BigInt(object.poolId.toString()); - if (isSet(object.tokenIn)) obj.tokenIn = String(object.tokenIn); - if (Array.isArray(object?.routes)) obj.routes = object.routes.map((e: any) => SwapAmountInRoute.fromJSON(e)); - return obj; + return { + sender: isSet(object.sender) ? String(object.sender) : "", + poolId: isSet(object.poolId) ? BigInt(object.poolId.toString()) : BigInt(0), + tokenIn: isSet(object.tokenIn) ? String(object.tokenIn) : "", + routes: Array.isArray(object?.routes) ? object.routes.map((e: any) => SwapAmountInRoute.fromJSON(e)) : [] + }; }, toJSON(message: QuerySwapExactAmountInRequest): JsonSafe<QuerySwapExactAmountInRequest> { const obj: any = {}; @@ -3003,9 +3072,7 @@ export const QuerySwapExactAmountInRequest = { fromPartial(object: DeepPartial<QuerySwapExactAmountInRequest>): QuerySwapExactAmountInRequest { const message = createBaseQuerySwapExactAmountInRequest(); message.sender = object.sender ?? ""; - if (object.poolId !== undefined && object.poolId !== null) { - message.poolId = BigInt(object.poolId.toString()); - } + message.poolId = object.poolId !== undefined && object.poolId !== null ? BigInt(object.poolId.toString()) : BigInt(0); message.tokenIn = object.tokenIn ?? ""; message.routes = object.routes?.map(e => SwapAmountInRoute.fromPartial(e)) || []; return message; @@ -3094,7 +3161,7 @@ function createBaseQuerySwapExactAmountInResponse(): QuerySwapExactAmountInRespo export const QuerySwapExactAmountInResponse = { typeUrl: "/osmosis.gamm.v1beta1.QuerySwapExactAmountInResponse", encode(message: QuerySwapExactAmountInResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.tokenOutAmount !== undefined) { + if (message.tokenOutAmount !== "") { writer.uint32(10).string(message.tokenOutAmount); } return writer; @@ -3117,9 +3184,9 @@ export const QuerySwapExactAmountInResponse = { return message; }, fromJSON(object: any): QuerySwapExactAmountInResponse { - const obj = createBaseQuerySwapExactAmountInResponse(); - if (isSet(object.tokenOutAmount)) obj.tokenOutAmount = String(object.tokenOutAmount); - return obj; + return { + tokenOutAmount: isSet(object.tokenOutAmount) ? String(object.tokenOutAmount) : "" + }; }, toJSON(message: QuerySwapExactAmountInResponse): JsonSafe<QuerySwapExactAmountInResponse> { const obj: any = {}; @@ -3191,16 +3258,16 @@ function createBaseQuerySwapExactAmountOutRequest(): QuerySwapExactAmountOutRequ export const QuerySwapExactAmountOutRequest = { typeUrl: "/osmosis.gamm.v1beta1.QuerySwapExactAmountOutRequest", encode(message: QuerySwapExactAmountOutRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.sender !== undefined) { + if (message.sender !== "") { writer.uint32(10).string(message.sender); } - if (message.poolId !== undefined) { + if (message.poolId !== BigInt(0)) { writer.uint32(16).uint64(message.poolId); } for (const v of message.routes) { SwapAmountOutRoute.encode(v!, writer.uint32(26).fork()).ldelim(); } - if (message.tokenOut !== undefined) { + if (message.tokenOut !== "") { writer.uint32(34).string(message.tokenOut); } return writer; @@ -3232,12 +3299,12 @@ export const QuerySwapExactAmountOutRequest = { return message; }, fromJSON(object: any): QuerySwapExactAmountOutRequest { - const obj = createBaseQuerySwapExactAmountOutRequest(); - if (isSet(object.sender)) obj.sender = String(object.sender); - if (isSet(object.poolId)) obj.poolId = BigInt(object.poolId.toString()); - if (Array.isArray(object?.routes)) obj.routes = object.routes.map((e: any) => SwapAmountOutRoute.fromJSON(e)); - if (isSet(object.tokenOut)) obj.tokenOut = String(object.tokenOut); - return obj; + return { + sender: isSet(object.sender) ? String(object.sender) : "", + poolId: isSet(object.poolId) ? BigInt(object.poolId.toString()) : BigInt(0), + routes: Array.isArray(object?.routes) ? object.routes.map((e: any) => SwapAmountOutRoute.fromJSON(e)) : [], + tokenOut: isSet(object.tokenOut) ? String(object.tokenOut) : "" + }; }, toJSON(message: QuerySwapExactAmountOutRequest): JsonSafe<QuerySwapExactAmountOutRequest> { const obj: any = {}; @@ -3254,9 +3321,7 @@ export const QuerySwapExactAmountOutRequest = { fromPartial(object: DeepPartial<QuerySwapExactAmountOutRequest>): QuerySwapExactAmountOutRequest { const message = createBaseQuerySwapExactAmountOutRequest(); message.sender = object.sender ?? ""; - if (object.poolId !== undefined && object.poolId !== null) { - message.poolId = BigInt(object.poolId.toString()); - } + message.poolId = object.poolId !== undefined && object.poolId !== null ? BigInt(object.poolId.toString()) : BigInt(0); message.routes = object.routes?.map(e => SwapAmountOutRoute.fromPartial(e)) || []; message.tokenOut = object.tokenOut ?? ""; return message; @@ -3345,7 +3410,7 @@ function createBaseQuerySwapExactAmountOutResponse(): QuerySwapExactAmountOutRes export const QuerySwapExactAmountOutResponse = { typeUrl: "/osmosis.gamm.v1beta1.QuerySwapExactAmountOutResponse", encode(message: QuerySwapExactAmountOutResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.tokenInAmount !== undefined) { + if (message.tokenInAmount !== "") { writer.uint32(10).string(message.tokenInAmount); } return writer; @@ -3368,9 +3433,9 @@ export const QuerySwapExactAmountOutResponse = { return message; }, fromJSON(object: any): QuerySwapExactAmountOutResponse { - const obj = createBaseQuerySwapExactAmountOutResponse(); - if (isSet(object.tokenInAmount)) obj.tokenInAmount = String(object.tokenInAmount); - return obj; + return { + tokenInAmount: isSet(object.tokenInAmount) ? String(object.tokenInAmount) : "" + }; }, toJSON(message: QuerySwapExactAmountOutResponse): JsonSafe<QuerySwapExactAmountOutResponse> { const obj: any = {}; @@ -3454,8 +3519,7 @@ export const QueryTotalLiquidityRequest = { return message; }, fromJSON(_: any): QueryTotalLiquidityRequest { - const obj = createBaseQueryTotalLiquidityRequest(); - return obj; + return {}; }, toJSON(_: QueryTotalLiquidityRequest): JsonSafe<QueryTotalLiquidityRequest> { const obj: any = {}; @@ -3536,9 +3600,9 @@ export const QueryTotalLiquidityResponse = { return message; }, fromJSON(object: any): QueryTotalLiquidityResponse { - const obj = createBaseQueryTotalLiquidityResponse(); - if (Array.isArray(object?.liquidity)) obj.liquidity = object.liquidity.map((e: any) => Coin.fromJSON(e)); - return obj; + return { + liquidity: Array.isArray(object?.liquidity) ? object.liquidity.map((e: any) => Coin.fromJSON(e)) : [] + }; }, toJSON(message: QueryTotalLiquidityResponse): JsonSafe<QueryTotalLiquidityResponse> { const obj: any = {}; diff --git a/__fixtures__/v-next/outputv4/osmosis/gamm/v1beta1/tx.amino.ts b/__fixtures__/v-next/outputv4/osmosis/gamm/v1beta1/tx.amino.ts index 529b82e3d4..e82624ab3d 100644 --- a/__fixtures__/v-next/outputv4/osmosis/gamm/v1beta1/tx.amino.ts +++ b/__fixtures__/v-next/outputv4/osmosis/gamm/v1beta1/tx.amino.ts @@ -1,7 +1,7 @@ //@ts-nocheck -import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin.js"; +import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { AminoMsg } from "@cosmjs/amino"; -import { SwapAmountInRoute, SwapAmountInRouteSDKType, SwapAmountOutRoute, SwapAmountOutRouteSDKType, MsgJoinPool, MsgJoinPoolSDKType, MsgExitPool, MsgExitPoolSDKType, MsgSwapExactAmountIn, MsgSwapExactAmountInSDKType, MsgSwapExactAmountOut, MsgSwapExactAmountOutSDKType, MsgJoinSwapExternAmountIn, MsgJoinSwapExternAmountInSDKType, MsgJoinSwapShareAmountOut, MsgJoinSwapShareAmountOutSDKType, MsgExitSwapExternAmountOut, MsgExitSwapExternAmountOutSDKType, MsgExitSwapShareAmountIn, MsgExitSwapShareAmountInSDKType } from "./tx.js"; +import { SwapAmountInRoute, SwapAmountInRouteSDKType, SwapAmountOutRoute, SwapAmountOutRouteSDKType, MsgJoinPool, MsgJoinPoolSDKType, MsgExitPool, MsgExitPoolSDKType, MsgSwapExactAmountIn, MsgSwapExactAmountInSDKType, MsgSwapExactAmountOut, MsgSwapExactAmountOutSDKType, MsgJoinSwapExternAmountIn, MsgJoinSwapExternAmountInSDKType, MsgJoinSwapShareAmountOut, MsgJoinSwapShareAmountOutSDKType, MsgExitSwapExternAmountOut, MsgExitSwapExternAmountOutSDKType, MsgExitSwapShareAmountIn, MsgExitSwapShareAmountInSDKType } from "./tx"; export interface MsgJoinPoolAminoType extends AminoMsg { type: "osmosis/gamm/join-pool"; value: { diff --git a/__fixtures__/v-next/outputv4/osmosis/gamm/v1beta1/tx.registry.ts b/__fixtures__/v-next/outputv4/osmosis/gamm/v1beta1/tx.registry.ts index 98ccbd8976..edf6e0b6b9 100644 --- a/__fixtures__/v-next/outputv4/osmosis/gamm/v1beta1/tx.registry.ts +++ b/__fixtures__/v-next/outputv4/osmosis/gamm/v1beta1/tx.registry.ts @@ -1,6 +1,6 @@ -import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin.js"; +import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { GeneratedType, Registry } from "@cosmjs/proto-signing"; -import { MsgJoinPool, MsgJoinPoolSDKType, MsgExitPool, MsgExitPoolSDKType, MsgSwapExactAmountIn, MsgSwapExactAmountInSDKType, MsgSwapExactAmountOut, MsgSwapExactAmountOutSDKType, MsgJoinSwapExternAmountIn, MsgJoinSwapExternAmountInSDKType, MsgJoinSwapShareAmountOut, MsgJoinSwapShareAmountOutSDKType, MsgExitSwapExternAmountOut, MsgExitSwapExternAmountOutSDKType, MsgExitSwapShareAmountIn, MsgExitSwapShareAmountInSDKType } from "./tx.js"; +import { MsgJoinPool, MsgJoinPoolSDKType, MsgExitPool, MsgExitPoolSDKType, MsgSwapExactAmountIn, MsgSwapExactAmountInSDKType, MsgSwapExactAmountOut, MsgSwapExactAmountOutSDKType, MsgJoinSwapExternAmountIn, MsgJoinSwapExternAmountInSDKType, MsgJoinSwapShareAmountOut, MsgJoinSwapShareAmountOutSDKType, MsgExitSwapExternAmountOut, MsgExitSwapExternAmountOutSDKType, MsgExitSwapShareAmountIn, MsgExitSwapShareAmountInSDKType } from "./tx"; export const registry: ReadonlyArray<[string, GeneratedType]> = [["/osmosis.gamm.v1beta1.MsgJoinPool", MsgJoinPool], ["/osmosis.gamm.v1beta1.MsgExitPool", MsgExitPool], ["/osmosis.gamm.v1beta1.MsgSwapExactAmountIn", MsgSwapExactAmountIn], ["/osmosis.gamm.v1beta1.MsgSwapExactAmountOut", MsgSwapExactAmountOut], ["/osmosis.gamm.v1beta1.MsgJoinSwapExternAmountIn", MsgJoinSwapExternAmountIn], ["/osmosis.gamm.v1beta1.MsgJoinSwapShareAmountOut", MsgJoinSwapShareAmountOut], ["/osmosis.gamm.v1beta1.MsgExitSwapExternAmountOut", MsgExitSwapExternAmountOut], ["/osmosis.gamm.v1beta1.MsgExitSwapShareAmountIn", MsgExitSwapShareAmountIn]]; export const load = (protoRegistry: Registry) => { registry.forEach(([typeUrl, mod]) => { diff --git a/__fixtures__/v-next/outputv4/osmosis/gamm/v1beta1/tx.rpc.msg.ts b/__fixtures__/v-next/outputv4/osmosis/gamm/v1beta1/tx.rpc.msg.ts index 708dfeaa1a..ef9c4b4ade 100644 --- a/__fixtures__/v-next/outputv4/osmosis/gamm/v1beta1/tx.rpc.msg.ts +++ b/__fixtures__/v-next/outputv4/osmosis/gamm/v1beta1/tx.rpc.msg.ts @@ -1,7 +1,7 @@ -import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin.js"; -import { Rpc } from "../../../helpers.js"; -import { BinaryReader } from "../../../binary.js"; -import { MsgJoinPool, MsgJoinPoolSDKType, MsgJoinPoolResponse, MsgJoinPoolResponseSDKType, MsgExitPool, MsgExitPoolSDKType, MsgExitPoolResponse, MsgExitPoolResponseSDKType, MsgSwapExactAmountIn, MsgSwapExactAmountInSDKType, MsgSwapExactAmountInResponse, MsgSwapExactAmountInResponseSDKType, MsgSwapExactAmountOut, MsgSwapExactAmountOutSDKType, MsgSwapExactAmountOutResponse, MsgSwapExactAmountOutResponseSDKType, MsgJoinSwapExternAmountIn, MsgJoinSwapExternAmountInSDKType, MsgJoinSwapExternAmountInResponse, MsgJoinSwapExternAmountInResponseSDKType, MsgJoinSwapShareAmountOut, MsgJoinSwapShareAmountOutSDKType, MsgJoinSwapShareAmountOutResponse, MsgJoinSwapShareAmountOutResponseSDKType, MsgExitSwapExternAmountOut, MsgExitSwapExternAmountOutSDKType, MsgExitSwapExternAmountOutResponse, MsgExitSwapExternAmountOutResponseSDKType, MsgExitSwapShareAmountIn, MsgExitSwapShareAmountInSDKType, MsgExitSwapShareAmountInResponse, MsgExitSwapShareAmountInResponseSDKType } from "./tx.js"; +import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; +import { Rpc } from "../../../helpers"; +import { BinaryReader } from "../../../binary"; +import { MsgJoinPool, MsgJoinPoolSDKType, MsgJoinPoolResponse, MsgJoinPoolResponseSDKType, MsgExitPool, MsgExitPoolSDKType, MsgExitPoolResponse, MsgExitPoolResponseSDKType, MsgSwapExactAmountIn, MsgSwapExactAmountInSDKType, MsgSwapExactAmountInResponse, MsgSwapExactAmountInResponseSDKType, MsgSwapExactAmountOut, MsgSwapExactAmountOutSDKType, MsgSwapExactAmountOutResponse, MsgSwapExactAmountOutResponseSDKType, MsgJoinSwapExternAmountIn, MsgJoinSwapExternAmountInSDKType, MsgJoinSwapExternAmountInResponse, MsgJoinSwapExternAmountInResponseSDKType, MsgJoinSwapShareAmountOut, MsgJoinSwapShareAmountOutSDKType, MsgJoinSwapShareAmountOutResponse, MsgJoinSwapShareAmountOutResponseSDKType, MsgExitSwapExternAmountOut, MsgExitSwapExternAmountOutSDKType, MsgExitSwapExternAmountOutResponse, MsgExitSwapExternAmountOutResponseSDKType, MsgExitSwapShareAmountIn, MsgExitSwapShareAmountInSDKType, MsgExitSwapShareAmountInResponse, MsgExitSwapShareAmountInResponseSDKType } from "./tx"; export interface Msg { joinPool(request: MsgJoinPool): Promise<MsgJoinPoolResponse>; exitPool(request: MsgExitPool): Promise<MsgExitPoolResponse>; diff --git a/__fixtures__/v-next/outputv4/osmosis/gamm/v1beta1/tx.ts b/__fixtures__/v-next/outputv4/osmosis/gamm/v1beta1/tx.ts index 867a622ec8..04ca74fc6c 100644 --- a/__fixtures__/v-next/outputv4/osmosis/gamm/v1beta1/tx.ts +++ b/__fixtures__/v-next/outputv4/osmosis/gamm/v1beta1/tx.ts @@ -1,7 +1,8 @@ -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"; +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"; export const protobufPackage = "osmosis.gamm.v1beta1"; /** * ===================== MsgJoinPool @@ -13,6 +14,12 @@ export interface MsgJoinPool { shareOutAmount: string; tokenInMaxs: Coin[]; } +export interface ReactiveMsgJoinPool { + sender: ComputedRef<string>; + poolId: ComputedRef<bigint>; + shareOutAmount: ComputedRef<string>; + tokenInMaxs: ComputedRef<Coin[]>; +} export interface MsgJoinPoolProtoMsg { typeUrl: "/osmosis.gamm.v1beta1.MsgJoinPool"; value: Uint8Array; @@ -31,6 +38,10 @@ export interface MsgJoinPoolResponse { shareOutAmount: string; tokenIn: Coin[]; } +export interface ReactiveMsgJoinPoolResponse { + shareOutAmount: ComputedRef<string>; + tokenIn: ComputedRef<Coin[]>; +} export interface MsgJoinPoolResponseProtoMsg { typeUrl: "/osmosis.gamm.v1beta1.MsgJoinPoolResponse"; value: Uint8Array; @@ -46,6 +57,12 @@ export interface MsgExitPool { shareInAmount: string; tokenOutMins: Coin[]; } +export interface ReactiveMsgExitPool { + sender: ComputedRef<string>; + poolId: ComputedRef<bigint>; + shareInAmount: ComputedRef<string>; + tokenOutMins: ComputedRef<Coin[]>; +} export interface MsgExitPoolProtoMsg { typeUrl: "/osmosis.gamm.v1beta1.MsgExitPool"; value: Uint8Array; @@ -60,6 +77,9 @@ export interface MsgExitPoolSDKType { export interface MsgExitPoolResponse { tokenOut: Coin[]; } +export interface ReactiveMsgExitPoolResponse { + tokenOut: ComputedRef<Coin[]>; +} export interface MsgExitPoolResponseProtoMsg { typeUrl: "/osmosis.gamm.v1beta1.MsgExitPoolResponse"; value: Uint8Array; @@ -72,6 +92,10 @@ export interface SwapAmountInRoute { poolId: bigint; tokenOutDenom: string; } +export interface ReactiveSwapAmountInRoute { + poolId: ComputedRef<bigint>; + tokenOutDenom: ComputedRef<string>; +} export interface SwapAmountInRouteProtoMsg { typeUrl: "/osmosis.gamm.v1beta1.SwapAmountInRoute"; value: Uint8Array; @@ -87,6 +111,12 @@ export interface MsgSwapExactAmountIn { tokenIn: Coin; tokenOutMinAmount: string; } +export interface ReactiveMsgSwapExactAmountIn { + sender: ComputedRef<string>; + routes: ComputedRef<SwapAmountInRoute[]>; + tokenIn: ComputedRef<Coin>; + tokenOutMinAmount: ComputedRef<string>; +} export interface MsgSwapExactAmountInProtoMsg { typeUrl: "/osmosis.gamm.v1beta1.MsgSwapExactAmountIn"; value: Uint8Array; @@ -100,6 +130,9 @@ export interface MsgSwapExactAmountInSDKType { export interface MsgSwapExactAmountInResponse { tokenOutAmount: string; } +export interface ReactiveMsgSwapExactAmountInResponse { + tokenOutAmount: ComputedRef<string>; +} export interface MsgSwapExactAmountInResponseProtoMsg { typeUrl: "/osmosis.gamm.v1beta1.MsgSwapExactAmountInResponse"; value: Uint8Array; @@ -112,6 +145,10 @@ export interface SwapAmountOutRoute { poolId: bigint; tokenInDenom: string; } +export interface ReactiveSwapAmountOutRoute { + poolId: ComputedRef<bigint>; + tokenInDenom: ComputedRef<string>; +} export interface SwapAmountOutRouteProtoMsg { typeUrl: "/osmosis.gamm.v1beta1.SwapAmountOutRoute"; value: Uint8Array; @@ -127,6 +164,12 @@ export interface MsgSwapExactAmountOut { tokenInMaxAmount: string; tokenOut: Coin; } +export interface ReactiveMsgSwapExactAmountOut { + sender: ComputedRef<string>; + routes: ComputedRef<SwapAmountOutRoute[]>; + tokenInMaxAmount: ComputedRef<string>; + tokenOut: ComputedRef<Coin>; +} export interface MsgSwapExactAmountOutProtoMsg { typeUrl: "/osmosis.gamm.v1beta1.MsgSwapExactAmountOut"; value: Uint8Array; @@ -140,6 +183,9 @@ export interface MsgSwapExactAmountOutSDKType { export interface MsgSwapExactAmountOutResponse { tokenInAmount: string; } +export interface ReactiveMsgSwapExactAmountOutResponse { + tokenInAmount: ComputedRef<string>; +} export interface MsgSwapExactAmountOutResponseProtoMsg { typeUrl: "/osmosis.gamm.v1beta1.MsgSwapExactAmountOutResponse"; value: Uint8Array; @@ -157,6 +203,12 @@ export interface MsgJoinSwapExternAmountIn { tokenIn: Coin; shareOutMinAmount: string; } +export interface ReactiveMsgJoinSwapExternAmountIn { + sender: ComputedRef<string>; + poolId: ComputedRef<bigint>; + tokenIn: ComputedRef<Coin>; + shareOutMinAmount: ComputedRef<string>; +} export interface MsgJoinSwapExternAmountInProtoMsg { typeUrl: "/osmosis.gamm.v1beta1.MsgJoinSwapExternAmountIn"; value: Uint8Array; @@ -174,6 +226,9 @@ export interface MsgJoinSwapExternAmountInSDKType { export interface MsgJoinSwapExternAmountInResponse { shareOutAmount: string; } +export interface ReactiveMsgJoinSwapExternAmountInResponse { + shareOutAmount: ComputedRef<string>; +} export interface MsgJoinSwapExternAmountInResponseProtoMsg { typeUrl: "/osmosis.gamm.v1beta1.MsgJoinSwapExternAmountInResponse"; value: Uint8Array; @@ -189,6 +244,13 @@ export interface MsgJoinSwapShareAmountOut { shareOutAmount: string; tokenInMaxAmount: string; } +export interface ReactiveMsgJoinSwapShareAmountOut { + sender: ComputedRef<string>; + poolId: ComputedRef<bigint>; + tokenInDenom: ComputedRef<string>; + shareOutAmount: ComputedRef<string>; + tokenInMaxAmount: ComputedRef<string>; +} export interface MsgJoinSwapShareAmountOutProtoMsg { typeUrl: "/osmosis.gamm.v1beta1.MsgJoinSwapShareAmountOut"; value: Uint8Array; @@ -204,6 +266,9 @@ export interface MsgJoinSwapShareAmountOutSDKType { export interface MsgJoinSwapShareAmountOutResponse { tokenInAmount: string; } +export interface ReactiveMsgJoinSwapShareAmountOutResponse { + tokenInAmount: ComputedRef<string>; +} export interface MsgJoinSwapShareAmountOutResponseProtoMsg { typeUrl: "/osmosis.gamm.v1beta1.MsgJoinSwapShareAmountOutResponse"; value: Uint8Array; @@ -219,6 +284,13 @@ export interface MsgExitSwapShareAmountIn { shareInAmount: string; tokenOutMinAmount: string; } +export interface ReactiveMsgExitSwapShareAmountIn { + sender: ComputedRef<string>; + poolId: ComputedRef<bigint>; + tokenOutDenom: ComputedRef<string>; + shareInAmount: ComputedRef<string>; + tokenOutMinAmount: ComputedRef<string>; +} export interface MsgExitSwapShareAmountInProtoMsg { typeUrl: "/osmosis.gamm.v1beta1.MsgExitSwapShareAmountIn"; value: Uint8Array; @@ -234,6 +306,9 @@ export interface MsgExitSwapShareAmountInSDKType { export interface MsgExitSwapShareAmountInResponse { tokenOutAmount: string; } +export interface ReactiveMsgExitSwapShareAmountInResponse { + tokenOutAmount: ComputedRef<string>; +} export interface MsgExitSwapShareAmountInResponseProtoMsg { typeUrl: "/osmosis.gamm.v1beta1.MsgExitSwapShareAmountInResponse"; value: Uint8Array; @@ -248,6 +323,12 @@ export interface MsgExitSwapExternAmountOut { tokenOut: Coin; shareInMaxAmount: string; } +export interface ReactiveMsgExitSwapExternAmountOut { + sender: ComputedRef<string>; + poolId: ComputedRef<bigint>; + tokenOut: ComputedRef<Coin>; + shareInMaxAmount: ComputedRef<string>; +} export interface MsgExitSwapExternAmountOutProtoMsg { typeUrl: "/osmosis.gamm.v1beta1.MsgExitSwapExternAmountOut"; value: Uint8Array; @@ -262,6 +343,9 @@ export interface MsgExitSwapExternAmountOutSDKType { export interface MsgExitSwapExternAmountOutResponse { shareInAmount: string; } +export interface ReactiveMsgExitSwapExternAmountOutResponse { + shareInAmount: ComputedRef<string>; +} export interface MsgExitSwapExternAmountOutResponseProtoMsg { typeUrl: "/osmosis.gamm.v1beta1.MsgExitSwapExternAmountOutResponse"; value: Uint8Array; @@ -280,13 +364,13 @@ function createBaseMsgJoinPool(): MsgJoinPool { export const MsgJoinPool = { typeUrl: "/osmosis.gamm.v1beta1.MsgJoinPool", encode(message: MsgJoinPool, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.sender !== undefined) { + if (message.sender !== "") { writer.uint32(10).string(message.sender); } - if (message.poolId !== undefined) { + if (message.poolId !== BigInt(0)) { writer.uint32(16).uint64(message.poolId); } - if (message.shareOutAmount !== undefined) { + if (message.shareOutAmount !== "") { writer.uint32(26).string(message.shareOutAmount); } for (const v of message.tokenInMaxs) { @@ -321,12 +405,12 @@ export const MsgJoinPool = { return message; }, fromJSON(object: any): MsgJoinPool { - const obj = createBaseMsgJoinPool(); - if (isSet(object.sender)) obj.sender = String(object.sender); - if (isSet(object.poolId)) obj.poolId = BigInt(object.poolId.toString()); - if (isSet(object.shareOutAmount)) obj.shareOutAmount = String(object.shareOutAmount); - if (Array.isArray(object?.tokenInMaxs)) obj.tokenInMaxs = object.tokenInMaxs.map((e: any) => Coin.fromJSON(e)); - return obj; + return { + sender: isSet(object.sender) ? String(object.sender) : "", + poolId: isSet(object.poolId) ? BigInt(object.poolId.toString()) : BigInt(0), + shareOutAmount: isSet(object.shareOutAmount) ? String(object.shareOutAmount) : "", + tokenInMaxs: Array.isArray(object?.tokenInMaxs) ? object.tokenInMaxs.map((e: any) => Coin.fromJSON(e)) : [] + }; }, toJSON(message: MsgJoinPool): JsonSafe<MsgJoinPool> { const obj: any = {}; @@ -343,9 +427,7 @@ export const MsgJoinPool = { fromPartial(object: DeepPartial<MsgJoinPool>): MsgJoinPool { const message = createBaseMsgJoinPool(); message.sender = object.sender ?? ""; - if (object.poolId !== undefined && object.poolId !== null) { - message.poolId = BigInt(object.poolId.toString()); - } + message.poolId = object.poolId !== undefined && object.poolId !== null ? BigInt(object.poolId.toString()) : BigInt(0); message.shareOutAmount = object.shareOutAmount ?? ""; message.tokenInMaxs = object.tokenInMaxs?.map(e => Coin.fromPartial(e)) || []; return message; @@ -435,7 +517,7 @@ function createBaseMsgJoinPoolResponse(): MsgJoinPoolResponse { export const MsgJoinPoolResponse = { typeUrl: "/osmosis.gamm.v1beta1.MsgJoinPoolResponse", encode(message: MsgJoinPoolResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.shareOutAmount !== undefined) { + if (message.shareOutAmount !== "") { writer.uint32(10).string(message.shareOutAmount); } for (const v of message.tokenIn) { @@ -464,10 +546,10 @@ export const MsgJoinPoolResponse = { return message; }, fromJSON(object: any): MsgJoinPoolResponse { - const obj = createBaseMsgJoinPoolResponse(); - if (isSet(object.shareOutAmount)) obj.shareOutAmount = String(object.shareOutAmount); - if (Array.isArray(object?.tokenIn)) obj.tokenIn = object.tokenIn.map((e: any) => Coin.fromJSON(e)); - return obj; + return { + shareOutAmount: isSet(object.shareOutAmount) ? String(object.shareOutAmount) : "", + tokenIn: Array.isArray(object?.tokenIn) ? object.tokenIn.map((e: any) => Coin.fromJSON(e)) : [] + }; }, toJSON(message: MsgJoinPoolResponse): JsonSafe<MsgJoinPoolResponse> { const obj: any = {}; @@ -558,13 +640,13 @@ function createBaseMsgExitPool(): MsgExitPool { export const MsgExitPool = { typeUrl: "/osmosis.gamm.v1beta1.MsgExitPool", encode(message: MsgExitPool, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.sender !== undefined) { + if (message.sender !== "") { writer.uint32(10).string(message.sender); } - if (message.poolId !== undefined) { + if (message.poolId !== BigInt(0)) { writer.uint32(16).uint64(message.poolId); } - if (message.shareInAmount !== undefined) { + if (message.shareInAmount !== "") { writer.uint32(26).string(message.shareInAmount); } for (const v of message.tokenOutMins) { @@ -599,12 +681,12 @@ export const MsgExitPool = { return message; }, fromJSON(object: any): MsgExitPool { - const obj = createBaseMsgExitPool(); - if (isSet(object.sender)) obj.sender = String(object.sender); - if (isSet(object.poolId)) obj.poolId = BigInt(object.poolId.toString()); - if (isSet(object.shareInAmount)) obj.shareInAmount = String(object.shareInAmount); - if (Array.isArray(object?.tokenOutMins)) obj.tokenOutMins = object.tokenOutMins.map((e: any) => Coin.fromJSON(e)); - return obj; + return { + sender: isSet(object.sender) ? String(object.sender) : "", + poolId: isSet(object.poolId) ? BigInt(object.poolId.toString()) : BigInt(0), + shareInAmount: isSet(object.shareInAmount) ? String(object.shareInAmount) : "", + tokenOutMins: Array.isArray(object?.tokenOutMins) ? object.tokenOutMins.map((e: any) => Coin.fromJSON(e)) : [] + }; }, toJSON(message: MsgExitPool): JsonSafe<MsgExitPool> { const obj: any = {}; @@ -621,9 +703,7 @@ export const MsgExitPool = { fromPartial(object: DeepPartial<MsgExitPool>): MsgExitPool { const message = createBaseMsgExitPool(); message.sender = object.sender ?? ""; - if (object.poolId !== undefined && object.poolId !== null) { - message.poolId = BigInt(object.poolId.toString()); - } + message.poolId = object.poolId !== undefined && object.poolId !== null ? BigInt(object.poolId.toString()) : BigInt(0); message.shareInAmount = object.shareInAmount ?? ""; message.tokenOutMins = object.tokenOutMins?.map(e => Coin.fromPartial(e)) || []; return message; @@ -735,9 +815,9 @@ export const MsgExitPoolResponse = { return message; }, fromJSON(object: any): MsgExitPoolResponse { - const obj = createBaseMsgExitPoolResponse(); - if (Array.isArray(object?.tokenOut)) obj.tokenOut = object.tokenOut.map((e: any) => Coin.fromJSON(e)); - return obj; + return { + tokenOut: Array.isArray(object?.tokenOut) ? object.tokenOut.map((e: any) => Coin.fromJSON(e)) : [] + }; }, toJSON(message: MsgExitPoolResponse): JsonSafe<MsgExitPoolResponse> { const obj: any = {}; @@ -817,10 +897,10 @@ function createBaseSwapAmountInRoute(): SwapAmountInRoute { export const SwapAmountInRoute = { typeUrl: "/osmosis.gamm.v1beta1.SwapAmountInRoute", encode(message: SwapAmountInRoute, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.poolId !== undefined) { + if (message.poolId !== BigInt(0)) { writer.uint32(8).uint64(message.poolId); } - if (message.tokenOutDenom !== undefined) { + if (message.tokenOutDenom !== "") { writer.uint32(18).string(message.tokenOutDenom); } return writer; @@ -846,10 +926,10 @@ export const SwapAmountInRoute = { return message; }, fromJSON(object: any): SwapAmountInRoute { - const obj = createBaseSwapAmountInRoute(); - if (isSet(object.poolId)) obj.poolId = BigInt(object.poolId.toString()); - if (isSet(object.tokenOutDenom)) obj.tokenOutDenom = String(object.tokenOutDenom); - return obj; + return { + poolId: isSet(object.poolId) ? BigInt(object.poolId.toString()) : BigInt(0), + tokenOutDenom: isSet(object.tokenOutDenom) ? String(object.tokenOutDenom) : "" + }; }, toJSON(message: SwapAmountInRoute): JsonSafe<SwapAmountInRoute> { const obj: any = {}; @@ -859,9 +939,7 @@ export const SwapAmountInRoute = { }, fromPartial(object: DeepPartial<SwapAmountInRoute>): SwapAmountInRoute { const message = createBaseSwapAmountInRoute(); - if (object.poolId !== undefined && object.poolId !== null) { - message.poolId = BigInt(object.poolId.toString()); - } + message.poolId = object.poolId !== undefined && object.poolId !== null ? BigInt(object.poolId.toString()) : BigInt(0); message.tokenOutDenom = object.tokenOutDenom ?? ""; return message; }, @@ -932,7 +1010,7 @@ function createBaseMsgSwapExactAmountIn(): MsgSwapExactAmountIn { export const MsgSwapExactAmountIn = { typeUrl: "/osmosis.gamm.v1beta1.MsgSwapExactAmountIn", encode(message: MsgSwapExactAmountIn, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.sender !== undefined) { + if (message.sender !== "") { writer.uint32(10).string(message.sender); } for (const v of message.routes) { @@ -941,7 +1019,7 @@ export const MsgSwapExactAmountIn = { if (message.tokenIn !== undefined) { Coin.encode(message.tokenIn, writer.uint32(26).fork()).ldelim(); } - if (message.tokenOutMinAmount !== undefined) { + if (message.tokenOutMinAmount !== "") { writer.uint32(34).string(message.tokenOutMinAmount); } return writer; @@ -973,12 +1051,12 @@ export const MsgSwapExactAmountIn = { return message; }, fromJSON(object: any): MsgSwapExactAmountIn { - const obj = createBaseMsgSwapExactAmountIn(); - if (isSet(object.sender)) obj.sender = String(object.sender); - if (Array.isArray(object?.routes)) obj.routes = object.routes.map((e: any) => SwapAmountInRoute.fromJSON(e)); - if (isSet(object.tokenIn)) obj.tokenIn = Coin.fromJSON(object.tokenIn); - if (isSet(object.tokenOutMinAmount)) obj.tokenOutMinAmount = String(object.tokenOutMinAmount); - return obj; + return { + sender: isSet(object.sender) ? String(object.sender) : "", + routes: Array.isArray(object?.routes) ? object.routes.map((e: any) => SwapAmountInRoute.fromJSON(e)) : [], + tokenIn: isSet(object.tokenIn) ? Coin.fromJSON(object.tokenIn) : undefined, + tokenOutMinAmount: isSet(object.tokenOutMinAmount) ? String(object.tokenOutMinAmount) : "" + }; }, toJSON(message: MsgSwapExactAmountIn): JsonSafe<MsgSwapExactAmountIn> { const obj: any = {}; @@ -996,9 +1074,7 @@ export const MsgSwapExactAmountIn = { const message = createBaseMsgSwapExactAmountIn(); message.sender = object.sender ?? ""; message.routes = object.routes?.map(e => SwapAmountInRoute.fromPartial(e)) || []; - if (object.tokenIn !== undefined && object.tokenIn !== null) { - message.tokenIn = Coin.fromPartial(object.tokenIn); - } + message.tokenIn = object.tokenIn !== undefined && object.tokenIn !== null ? Coin.fromPartial(object.tokenIn) : undefined; message.tokenOutMinAmount = object.tokenOutMinAmount ?? ""; return message; }, @@ -1086,7 +1162,7 @@ function createBaseMsgSwapExactAmountInResponse(): MsgSwapExactAmountInResponse export const MsgSwapExactAmountInResponse = { typeUrl: "/osmosis.gamm.v1beta1.MsgSwapExactAmountInResponse", encode(message: MsgSwapExactAmountInResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.tokenOutAmount !== undefined) { + if (message.tokenOutAmount !== "") { writer.uint32(10).string(message.tokenOutAmount); } return writer; @@ -1109,9 +1185,9 @@ export const MsgSwapExactAmountInResponse = { return message; }, fromJSON(object: any): MsgSwapExactAmountInResponse { - const obj = createBaseMsgSwapExactAmountInResponse(); - if (isSet(object.tokenOutAmount)) obj.tokenOutAmount = String(object.tokenOutAmount); - return obj; + return { + tokenOutAmount: isSet(object.tokenOutAmount) ? String(object.tokenOutAmount) : "" + }; }, toJSON(message: MsgSwapExactAmountInResponse): JsonSafe<MsgSwapExactAmountInResponse> { const obj: any = {}; @@ -1181,10 +1257,10 @@ function createBaseSwapAmountOutRoute(): SwapAmountOutRoute { export const SwapAmountOutRoute = { typeUrl: "/osmosis.gamm.v1beta1.SwapAmountOutRoute", encode(message: SwapAmountOutRoute, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.poolId !== undefined) { + if (message.poolId !== BigInt(0)) { writer.uint32(8).uint64(message.poolId); } - if (message.tokenInDenom !== undefined) { + if (message.tokenInDenom !== "") { writer.uint32(18).string(message.tokenInDenom); } return writer; @@ -1210,10 +1286,10 @@ export const SwapAmountOutRoute = { return message; }, fromJSON(object: any): SwapAmountOutRoute { - const obj = createBaseSwapAmountOutRoute(); - if (isSet(object.poolId)) obj.poolId = BigInt(object.poolId.toString()); - if (isSet(object.tokenInDenom)) obj.tokenInDenom = String(object.tokenInDenom); - return obj; + return { + poolId: isSet(object.poolId) ? BigInt(object.poolId.toString()) : BigInt(0), + tokenInDenom: isSet(object.tokenInDenom) ? String(object.tokenInDenom) : "" + }; }, toJSON(message: SwapAmountOutRoute): JsonSafe<SwapAmountOutRoute> { const obj: any = {}; @@ -1223,9 +1299,7 @@ export const SwapAmountOutRoute = { }, fromPartial(object: DeepPartial<SwapAmountOutRoute>): SwapAmountOutRoute { const message = createBaseSwapAmountOutRoute(); - if (object.poolId !== undefined && object.poolId !== null) { - message.poolId = BigInt(object.poolId.toString()); - } + message.poolId = object.poolId !== undefined && object.poolId !== null ? BigInt(object.poolId.toString()) : BigInt(0); message.tokenInDenom = object.tokenInDenom ?? ""; return message; }, @@ -1296,13 +1370,13 @@ function createBaseMsgSwapExactAmountOut(): MsgSwapExactAmountOut { export const MsgSwapExactAmountOut = { typeUrl: "/osmosis.gamm.v1beta1.MsgSwapExactAmountOut", encode(message: MsgSwapExactAmountOut, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.sender !== undefined) { + if (message.sender !== "") { writer.uint32(10).string(message.sender); } for (const v of message.routes) { SwapAmountOutRoute.encode(v!, writer.uint32(18).fork()).ldelim(); } - if (message.tokenInMaxAmount !== undefined) { + if (message.tokenInMaxAmount !== "") { writer.uint32(26).string(message.tokenInMaxAmount); } if (message.tokenOut !== undefined) { @@ -1337,12 +1411,12 @@ export const MsgSwapExactAmountOut = { return message; }, fromJSON(object: any): MsgSwapExactAmountOut { - const obj = createBaseMsgSwapExactAmountOut(); - if (isSet(object.sender)) obj.sender = String(object.sender); - if (Array.isArray(object?.routes)) obj.routes = object.routes.map((e: any) => SwapAmountOutRoute.fromJSON(e)); - if (isSet(object.tokenInMaxAmount)) obj.tokenInMaxAmount = String(object.tokenInMaxAmount); - if (isSet(object.tokenOut)) obj.tokenOut = Coin.fromJSON(object.tokenOut); - return obj; + return { + sender: isSet(object.sender) ? String(object.sender) : "", + routes: Array.isArray(object?.routes) ? object.routes.map((e: any) => SwapAmountOutRoute.fromJSON(e)) : [], + tokenInMaxAmount: isSet(object.tokenInMaxAmount) ? String(object.tokenInMaxAmount) : "", + tokenOut: isSet(object.tokenOut) ? Coin.fromJSON(object.tokenOut) : undefined + }; }, toJSON(message: MsgSwapExactAmountOut): JsonSafe<MsgSwapExactAmountOut> { const obj: any = {}; @@ -1361,9 +1435,7 @@ export const MsgSwapExactAmountOut = { message.sender = object.sender ?? ""; message.routes = object.routes?.map(e => SwapAmountOutRoute.fromPartial(e)) || []; message.tokenInMaxAmount = object.tokenInMaxAmount ?? ""; - if (object.tokenOut !== undefined && object.tokenOut !== null) { - message.tokenOut = Coin.fromPartial(object.tokenOut); - } + message.tokenOut = object.tokenOut !== undefined && object.tokenOut !== null ? Coin.fromPartial(object.tokenOut) : undefined; return message; }, fromSDK(object: MsgSwapExactAmountOutSDKType): MsgSwapExactAmountOut { @@ -1450,7 +1522,7 @@ function createBaseMsgSwapExactAmountOutResponse(): MsgSwapExactAmountOutRespons export const MsgSwapExactAmountOutResponse = { typeUrl: "/osmosis.gamm.v1beta1.MsgSwapExactAmountOutResponse", encode(message: MsgSwapExactAmountOutResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.tokenInAmount !== undefined) { + if (message.tokenInAmount !== "") { writer.uint32(10).string(message.tokenInAmount); } return writer; @@ -1473,9 +1545,9 @@ export const MsgSwapExactAmountOutResponse = { return message; }, fromJSON(object: any): MsgSwapExactAmountOutResponse { - const obj = createBaseMsgSwapExactAmountOutResponse(); - if (isSet(object.tokenInAmount)) obj.tokenInAmount = String(object.tokenInAmount); - return obj; + return { + tokenInAmount: isSet(object.tokenInAmount) ? String(object.tokenInAmount) : "" + }; }, toJSON(message: MsgSwapExactAmountOutResponse): JsonSafe<MsgSwapExactAmountOutResponse> { const obj: any = {}; @@ -1547,16 +1619,16 @@ function createBaseMsgJoinSwapExternAmountIn(): MsgJoinSwapExternAmountIn { export const MsgJoinSwapExternAmountIn = { typeUrl: "/osmosis.gamm.v1beta1.MsgJoinSwapExternAmountIn", encode(message: MsgJoinSwapExternAmountIn, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.sender !== undefined) { + if (message.sender !== "") { writer.uint32(10).string(message.sender); } - if (message.poolId !== undefined) { + if (message.poolId !== BigInt(0)) { writer.uint32(16).uint64(message.poolId); } if (message.tokenIn !== undefined) { Coin.encode(message.tokenIn, writer.uint32(26).fork()).ldelim(); } - if (message.shareOutMinAmount !== undefined) { + if (message.shareOutMinAmount !== "") { writer.uint32(34).string(message.shareOutMinAmount); } return writer; @@ -1588,12 +1660,12 @@ export const MsgJoinSwapExternAmountIn = { return message; }, fromJSON(object: any): MsgJoinSwapExternAmountIn { - const obj = createBaseMsgJoinSwapExternAmountIn(); - if (isSet(object.sender)) obj.sender = String(object.sender); - if (isSet(object.poolId)) obj.poolId = BigInt(object.poolId.toString()); - if (isSet(object.tokenIn)) obj.tokenIn = Coin.fromJSON(object.tokenIn); - if (isSet(object.shareOutMinAmount)) obj.shareOutMinAmount = String(object.shareOutMinAmount); - return obj; + return { + sender: isSet(object.sender) ? String(object.sender) : "", + poolId: isSet(object.poolId) ? BigInt(object.poolId.toString()) : BigInt(0), + tokenIn: isSet(object.tokenIn) ? Coin.fromJSON(object.tokenIn) : undefined, + shareOutMinAmount: isSet(object.shareOutMinAmount) ? String(object.shareOutMinAmount) : "" + }; }, toJSON(message: MsgJoinSwapExternAmountIn): JsonSafe<MsgJoinSwapExternAmountIn> { const obj: any = {}; @@ -1606,12 +1678,8 @@ export const MsgJoinSwapExternAmountIn = { fromPartial(object: DeepPartial<MsgJoinSwapExternAmountIn>): MsgJoinSwapExternAmountIn { const message = createBaseMsgJoinSwapExternAmountIn(); message.sender = object.sender ?? ""; - if (object.poolId !== undefined && object.poolId !== null) { - message.poolId = BigInt(object.poolId.toString()); - } - if (object.tokenIn !== undefined && object.tokenIn !== null) { - message.tokenIn = Coin.fromPartial(object.tokenIn); - } + message.poolId = object.poolId !== undefined && object.poolId !== null ? BigInt(object.poolId.toString()) : BigInt(0); + message.tokenIn = object.tokenIn !== undefined && object.tokenIn !== null ? Coin.fromPartial(object.tokenIn) : undefined; message.shareOutMinAmount = object.shareOutMinAmount ?? ""; return message; }, @@ -1693,7 +1761,7 @@ function createBaseMsgJoinSwapExternAmountInResponse(): MsgJoinSwapExternAmountI export const MsgJoinSwapExternAmountInResponse = { typeUrl: "/osmosis.gamm.v1beta1.MsgJoinSwapExternAmountInResponse", encode(message: MsgJoinSwapExternAmountInResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.shareOutAmount !== undefined) { + if (message.shareOutAmount !== "") { writer.uint32(10).string(message.shareOutAmount); } return writer; @@ -1716,9 +1784,9 @@ export const MsgJoinSwapExternAmountInResponse = { return message; }, fromJSON(object: any): MsgJoinSwapExternAmountInResponse { - const obj = createBaseMsgJoinSwapExternAmountInResponse(); - if (isSet(object.shareOutAmount)) obj.shareOutAmount = String(object.shareOutAmount); - return obj; + return { + shareOutAmount: isSet(object.shareOutAmount) ? String(object.shareOutAmount) : "" + }; }, toJSON(message: MsgJoinSwapExternAmountInResponse): JsonSafe<MsgJoinSwapExternAmountInResponse> { const obj: any = {}; @@ -1791,19 +1859,19 @@ function createBaseMsgJoinSwapShareAmountOut(): MsgJoinSwapShareAmountOut { export const MsgJoinSwapShareAmountOut = { typeUrl: "/osmosis.gamm.v1beta1.MsgJoinSwapShareAmountOut", encode(message: MsgJoinSwapShareAmountOut, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.sender !== undefined) { + if (message.sender !== "") { writer.uint32(10).string(message.sender); } - if (message.poolId !== undefined) { + if (message.poolId !== BigInt(0)) { writer.uint32(16).uint64(message.poolId); } - if (message.tokenInDenom !== undefined) { + if (message.tokenInDenom !== "") { writer.uint32(26).string(message.tokenInDenom); } - if (message.shareOutAmount !== undefined) { + if (message.shareOutAmount !== "") { writer.uint32(34).string(message.shareOutAmount); } - if (message.tokenInMaxAmount !== undefined) { + if (message.tokenInMaxAmount !== "") { writer.uint32(42).string(message.tokenInMaxAmount); } return writer; @@ -1838,13 +1906,13 @@ export const MsgJoinSwapShareAmountOut = { return message; }, fromJSON(object: any): MsgJoinSwapShareAmountOut { - const obj = createBaseMsgJoinSwapShareAmountOut(); - if (isSet(object.sender)) obj.sender = String(object.sender); - if (isSet(object.poolId)) obj.poolId = BigInt(object.poolId.toString()); - if (isSet(object.tokenInDenom)) obj.tokenInDenom = String(object.tokenInDenom); - if (isSet(object.shareOutAmount)) obj.shareOutAmount = String(object.shareOutAmount); - if (isSet(object.tokenInMaxAmount)) obj.tokenInMaxAmount = String(object.tokenInMaxAmount); - return obj; + return { + sender: isSet(object.sender) ? String(object.sender) : "", + poolId: isSet(object.poolId) ? BigInt(object.poolId.toString()) : BigInt(0), + tokenInDenom: isSet(object.tokenInDenom) ? String(object.tokenInDenom) : "", + shareOutAmount: isSet(object.shareOutAmount) ? String(object.shareOutAmount) : "", + tokenInMaxAmount: isSet(object.tokenInMaxAmount) ? String(object.tokenInMaxAmount) : "" + }; }, toJSON(message: MsgJoinSwapShareAmountOut): JsonSafe<MsgJoinSwapShareAmountOut> { const obj: any = {}; @@ -1858,9 +1926,7 @@ export const MsgJoinSwapShareAmountOut = { fromPartial(object: DeepPartial<MsgJoinSwapShareAmountOut>): MsgJoinSwapShareAmountOut { const message = createBaseMsgJoinSwapShareAmountOut(); message.sender = object.sender ?? ""; - if (object.poolId !== undefined && object.poolId !== null) { - message.poolId = BigInt(object.poolId.toString()); - } + message.poolId = object.poolId !== undefined && object.poolId !== null ? BigInt(object.poolId.toString()) : BigInt(0); message.tokenInDenom = object.tokenInDenom ?? ""; message.shareOutAmount = object.shareOutAmount ?? ""; message.tokenInMaxAmount = object.tokenInMaxAmount ?? ""; @@ -1951,7 +2017,7 @@ function createBaseMsgJoinSwapShareAmountOutResponse(): MsgJoinSwapShareAmountOu export const MsgJoinSwapShareAmountOutResponse = { typeUrl: "/osmosis.gamm.v1beta1.MsgJoinSwapShareAmountOutResponse", encode(message: MsgJoinSwapShareAmountOutResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.tokenInAmount !== undefined) { + if (message.tokenInAmount !== "") { writer.uint32(10).string(message.tokenInAmount); } return writer; @@ -1974,9 +2040,9 @@ export const MsgJoinSwapShareAmountOutResponse = { return message; }, fromJSON(object: any): MsgJoinSwapShareAmountOutResponse { - const obj = createBaseMsgJoinSwapShareAmountOutResponse(); - if (isSet(object.tokenInAmount)) obj.tokenInAmount = String(object.tokenInAmount); - return obj; + return { + tokenInAmount: isSet(object.tokenInAmount) ? String(object.tokenInAmount) : "" + }; }, toJSON(message: MsgJoinSwapShareAmountOutResponse): JsonSafe<MsgJoinSwapShareAmountOutResponse> { const obj: any = {}; @@ -2049,19 +2115,19 @@ function createBaseMsgExitSwapShareAmountIn(): MsgExitSwapShareAmountIn { export const MsgExitSwapShareAmountIn = { typeUrl: "/osmosis.gamm.v1beta1.MsgExitSwapShareAmountIn", encode(message: MsgExitSwapShareAmountIn, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.sender !== undefined) { + if (message.sender !== "") { writer.uint32(10).string(message.sender); } - if (message.poolId !== undefined) { + if (message.poolId !== BigInt(0)) { writer.uint32(16).uint64(message.poolId); } - if (message.tokenOutDenom !== undefined) { + if (message.tokenOutDenom !== "") { writer.uint32(26).string(message.tokenOutDenom); } - if (message.shareInAmount !== undefined) { + if (message.shareInAmount !== "") { writer.uint32(34).string(message.shareInAmount); } - if (message.tokenOutMinAmount !== undefined) { + if (message.tokenOutMinAmount !== "") { writer.uint32(42).string(message.tokenOutMinAmount); } return writer; @@ -2096,13 +2162,13 @@ export const MsgExitSwapShareAmountIn = { return message; }, fromJSON(object: any): MsgExitSwapShareAmountIn { - const obj = createBaseMsgExitSwapShareAmountIn(); - if (isSet(object.sender)) obj.sender = String(object.sender); - if (isSet(object.poolId)) obj.poolId = BigInt(object.poolId.toString()); - if (isSet(object.tokenOutDenom)) obj.tokenOutDenom = String(object.tokenOutDenom); - if (isSet(object.shareInAmount)) obj.shareInAmount = String(object.shareInAmount); - if (isSet(object.tokenOutMinAmount)) obj.tokenOutMinAmount = String(object.tokenOutMinAmount); - return obj; + return { + sender: isSet(object.sender) ? String(object.sender) : "", + poolId: isSet(object.poolId) ? BigInt(object.poolId.toString()) : BigInt(0), + tokenOutDenom: isSet(object.tokenOutDenom) ? String(object.tokenOutDenom) : "", + shareInAmount: isSet(object.shareInAmount) ? String(object.shareInAmount) : "", + tokenOutMinAmount: isSet(object.tokenOutMinAmount) ? String(object.tokenOutMinAmount) : "" + }; }, toJSON(message: MsgExitSwapShareAmountIn): JsonSafe<MsgExitSwapShareAmountIn> { const obj: any = {}; @@ -2116,9 +2182,7 @@ export const MsgExitSwapShareAmountIn = { fromPartial(object: DeepPartial<MsgExitSwapShareAmountIn>): MsgExitSwapShareAmountIn { const message = createBaseMsgExitSwapShareAmountIn(); message.sender = object.sender ?? ""; - if (object.poolId !== undefined && object.poolId !== null) { - message.poolId = BigInt(object.poolId.toString()); - } + message.poolId = object.poolId !== undefined && object.poolId !== null ? BigInt(object.poolId.toString()) : BigInt(0); message.tokenOutDenom = object.tokenOutDenom ?? ""; message.shareInAmount = object.shareInAmount ?? ""; message.tokenOutMinAmount = object.tokenOutMinAmount ?? ""; @@ -2209,7 +2273,7 @@ function createBaseMsgExitSwapShareAmountInResponse(): MsgExitSwapShareAmountInR export const MsgExitSwapShareAmountInResponse = { typeUrl: "/osmosis.gamm.v1beta1.MsgExitSwapShareAmountInResponse", encode(message: MsgExitSwapShareAmountInResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.tokenOutAmount !== undefined) { + if (message.tokenOutAmount !== "") { writer.uint32(10).string(message.tokenOutAmount); } return writer; @@ -2232,9 +2296,9 @@ export const MsgExitSwapShareAmountInResponse = { return message; }, fromJSON(object: any): MsgExitSwapShareAmountInResponse { - const obj = createBaseMsgExitSwapShareAmountInResponse(); - if (isSet(object.tokenOutAmount)) obj.tokenOutAmount = String(object.tokenOutAmount); - return obj; + return { + tokenOutAmount: isSet(object.tokenOutAmount) ? String(object.tokenOutAmount) : "" + }; }, toJSON(message: MsgExitSwapShareAmountInResponse): JsonSafe<MsgExitSwapShareAmountInResponse> { const obj: any = {}; @@ -2306,16 +2370,16 @@ function createBaseMsgExitSwapExternAmountOut(): MsgExitSwapExternAmountOut { export const MsgExitSwapExternAmountOut = { typeUrl: "/osmosis.gamm.v1beta1.MsgExitSwapExternAmountOut", encode(message: MsgExitSwapExternAmountOut, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.sender !== undefined) { + if (message.sender !== "") { writer.uint32(10).string(message.sender); } - if (message.poolId !== undefined) { + if (message.poolId !== BigInt(0)) { writer.uint32(16).uint64(message.poolId); } if (message.tokenOut !== undefined) { Coin.encode(message.tokenOut, writer.uint32(26).fork()).ldelim(); } - if (message.shareInMaxAmount !== undefined) { + if (message.shareInMaxAmount !== "") { writer.uint32(34).string(message.shareInMaxAmount); } return writer; @@ -2347,12 +2411,12 @@ export const MsgExitSwapExternAmountOut = { return message; }, fromJSON(object: any): MsgExitSwapExternAmountOut { - const obj = createBaseMsgExitSwapExternAmountOut(); - if (isSet(object.sender)) obj.sender = String(object.sender); - if (isSet(object.poolId)) obj.poolId = BigInt(object.poolId.toString()); - if (isSet(object.tokenOut)) obj.tokenOut = Coin.fromJSON(object.tokenOut); - if (isSet(object.shareInMaxAmount)) obj.shareInMaxAmount = String(object.shareInMaxAmount); - return obj; + return { + sender: isSet(object.sender) ? String(object.sender) : "", + poolId: isSet(object.poolId) ? BigInt(object.poolId.toString()) : BigInt(0), + tokenOut: isSet(object.tokenOut) ? Coin.fromJSON(object.tokenOut) : undefined, + shareInMaxAmount: isSet(object.shareInMaxAmount) ? String(object.shareInMaxAmount) : "" + }; }, toJSON(message: MsgExitSwapExternAmountOut): JsonSafe<MsgExitSwapExternAmountOut> { const obj: any = {}; @@ -2365,12 +2429,8 @@ export const MsgExitSwapExternAmountOut = { fromPartial(object: DeepPartial<MsgExitSwapExternAmountOut>): MsgExitSwapExternAmountOut { const message = createBaseMsgExitSwapExternAmountOut(); message.sender = object.sender ?? ""; - if (object.poolId !== undefined && object.poolId !== null) { - message.poolId = BigInt(object.poolId.toString()); - } - if (object.tokenOut !== undefined && object.tokenOut !== null) { - message.tokenOut = Coin.fromPartial(object.tokenOut); - } + message.poolId = object.poolId !== undefined && object.poolId !== null ? BigInt(object.poolId.toString()) : BigInt(0); + message.tokenOut = object.tokenOut !== undefined && object.tokenOut !== null ? Coin.fromPartial(object.tokenOut) : undefined; message.shareInMaxAmount = object.shareInMaxAmount ?? ""; return message; }, @@ -2452,7 +2512,7 @@ function createBaseMsgExitSwapExternAmountOutResponse(): MsgExitSwapExternAmount export const MsgExitSwapExternAmountOutResponse = { typeUrl: "/osmosis.gamm.v1beta1.MsgExitSwapExternAmountOutResponse", encode(message: MsgExitSwapExternAmountOutResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.shareInAmount !== undefined) { + if (message.shareInAmount !== "") { writer.uint32(10).string(message.shareInAmount); } return writer; @@ -2475,9 +2535,9 @@ export const MsgExitSwapExternAmountOutResponse = { return message; }, fromJSON(object: any): MsgExitSwapExternAmountOutResponse { - const obj = createBaseMsgExitSwapExternAmountOutResponse(); - if (isSet(object.shareInAmount)) obj.shareInAmount = String(object.shareInAmount); - return obj; + return { + shareInAmount: isSet(object.shareInAmount) ? String(object.shareInAmount) : "" + }; }, toJSON(message: MsgExitSwapExternAmountOutResponse): JsonSafe<MsgExitSwapExternAmountOutResponse> { const obj: any = {}; diff --git a/__fixtures__/v-next/outputv4/osmosis/gamm/v2/query.lcd.ts b/__fixtures__/v-next/outputv4/osmosis/gamm/v2/query.lcd.ts index 0824e393af..f85e74c3fc 100644 --- a/__fixtures__/v-next/outputv4/osmosis/gamm/v2/query.lcd.ts +++ b/__fixtures__/v-next/outputv4/osmosis/gamm/v2/query.lcd.ts @@ -1,5 +1,5 @@ import { LCDClient } from "@cosmology/lcd"; -import { QuerySpotPriceRequest, QuerySpotPriceRequestSDKType, QuerySpotPriceResponse, QuerySpotPriceResponseSDKType } from "./query.js"; +import { QuerySpotPriceRequest, QuerySpotPriceRequestSDKType, QuerySpotPriceResponse, QuerySpotPriceResponseSDKType } from "./query"; export class LCDQueryClient { req: LCDClient; constructor({ diff --git a/__fixtures__/v-next/outputv4/osmosis/gamm/v2/query.rpc.Query.ts b/__fixtures__/v-next/outputv4/osmosis/gamm/v2/query.rpc.Query.ts index 1ee524a750..b342303e99 100644 --- a/__fixtures__/v-next/outputv4/osmosis/gamm/v2/query.rpc.Query.ts +++ b/__fixtures__/v-next/outputv4/osmosis/gamm/v2/query.rpc.Query.ts @@ -1,11 +1,10 @@ -import { Rpc } from "../../../helpers.js"; -import { BinaryReader } from "../../../binary.js"; +import { Rpc } from "../../../helpers"; +import { BinaryReader } from "../../../binary"; import { QueryClient, createProtobufRpcClient, ProtobufRpcClient } from "@cosmjs/stargate"; -import { ReactQueryParams } from "../../../react-query.js"; -import { useQuery } from "@tanstack/react-query"; -import { QueryStore, MobxResponse } from "../../../mobx.js"; -import { makeObservable, override } from "mobx"; -import { QuerySpotPriceRequest, QuerySpotPriceRequestSDKType, QuerySpotPriceResponse, QuerySpotPriceResponseSDKType } from "./query.js"; +import { VueQueryParams } from "../../../vue-query"; +import { ComputedRef, computed, Ref } from "vue"; +import { useQuery } from "@tanstack/vue-query"; +import { QuerySpotPriceRequest, QuerySpotPriceRequestSDKType, QuerySpotPriceResponse, QuerySpotPriceResponseSDKType, ReactiveQuerySpotPriceRequest } from "./query"; export interface Query { /** * SpotPrice defines a gRPC query handler that returns the spot price given @@ -34,29 +33,48 @@ export const createRpcQueryExtension = (base: QueryClient) => { } }; }; -export interface UseSpotPriceQuery<TData> extends ReactQueryParams<QuerySpotPriceResponse, TData> { - request: QuerySpotPriceRequest; +export interface UseSpotPriceQuery<TData> extends VueQueryParams<QuerySpotPriceResponse, TData> { + request: ReactiveQuerySpotPriceRequest; } -const _queryClients: WeakMap<ProtobufRpcClient, QueryClientImpl> = 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 useQueryService = (rpc: Ref<ProtobufRpcClient | undefined>): ComputedRef<QueryClientImpl | undefined> => { + 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: ProtobufRpcClient | undefined) => { - const queryService = getQueryService(rpc); +export const createRpcQueryHooks = (rpc: Ref<ProtobufRpcClient | undefined>) => { + const queryService = useQueryService(rpc); const useSpotPrice = <TData = QuerySpotPriceResponse,>({ request, options }: UseSpotPriceQuery<TData>) => { - return useQuery<QuerySpotPriceResponse, Error, TData>(["spotPriceQuery", request], () => { - if (!queryService) throw new Error("Query Service not initialized"); - return queryService.spotPrice(request); - }, options); + const queryKey = ["spotPriceQuery", queryService]; + if (request) { + Object.values(request).forEach((val: any) => { + queryKey.push(val); + }); + } + return useQuery<QuerySpotPriceResponse, Error, TData>({ + 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.spotPrice(params); + }, + ...options + }); }; return { /** @@ -65,20 +83,4 @@ export const createRpcQueryHooks = (rpc: ProtobufRpcClient | undefined) => { */ useSpotPrice }; -}; -export const createRpcQueryMobxStores = (rpc: ProtobufRpcClient | undefined) => { - const queryService = getQueryService(rpc); - class QuerySpotPriceStore { - store = new QueryStore<QuerySpotPriceRequest, QuerySpotPriceResponse>(queryService?.spotPrice); - spotPrice(request: QuerySpotPriceRequest) { - return this.store.getData(request); - } - } - return { - /** - * SpotPrice defines a gRPC query handler that returns the spot price given - * a base denomination and a quote denomination. - */ - QuerySpotPriceStore - }; }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv4/osmosis/gamm/v2/query.ts b/__fixtures__/v-next/outputv4/osmosis/gamm/v2/query.ts index 1c7d47a57e..3c2f8b5064 100644 --- a/__fixtures__/v-next/outputv4/osmosis/gamm/v2/query.ts +++ b/__fixtures__/v-next/outputv4/osmosis/gamm/v2/query.ts @@ -1,6 +1,7 @@ -import { BinaryReader, BinaryWriter } from "../../../binary.js"; -import { isSet, DeepPartial } from "../../../helpers.js"; -import { JsonSafe } from "../../../json-safe.js"; +import { BinaryReader, BinaryWriter } from "../../../binary"; +import { isSet, DeepPartial } from "../../../helpers"; +import { JsonSafe } from "../../../json-safe"; +import { ComputedRef } from "vue"; export const protobufPackage = "osmosis.gamm.v2"; /** * QuerySpotPriceRequest defines the gRPC request structure for a SpotPrice @@ -11,6 +12,11 @@ export interface QuerySpotPriceRequest { baseAssetDenom: string; quoteAssetDenom: string; } +export interface ReactiveQuerySpotPriceRequest { + poolId: ComputedRef<bigint>; + baseAssetDenom: ComputedRef<string>; + quoteAssetDenom: ComputedRef<string>; +} export interface QuerySpotPriceRequestProtoMsg { typeUrl: "/osmosis.gamm.v2.QuerySpotPriceRequest"; value: Uint8Array; @@ -32,6 +38,9 @@ export interface QuerySpotPriceResponse { /** String of the Dec. Ex) 10.203uatom */ spotPrice: string; } +export interface ReactiveQuerySpotPriceResponse { + spotPrice: ComputedRef<string>; +} export interface QuerySpotPriceResponseProtoMsg { typeUrl: "/osmosis.gamm.v2.QuerySpotPriceResponse"; value: Uint8Array; @@ -53,13 +62,13 @@ function createBaseQuerySpotPriceRequest(): QuerySpotPriceRequest { export const QuerySpotPriceRequest = { typeUrl: "/osmosis.gamm.v2.QuerySpotPriceRequest", encode(message: QuerySpotPriceRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.poolId !== undefined) { + if (message.poolId !== BigInt(0)) { writer.uint32(8).uint64(message.poolId); } - if (message.baseAssetDenom !== undefined) { + if (message.baseAssetDenom !== "") { writer.uint32(18).string(message.baseAssetDenom); } - if (message.quoteAssetDenom !== undefined) { + if (message.quoteAssetDenom !== "") { writer.uint32(26).string(message.quoteAssetDenom); } return writer; @@ -88,11 +97,11 @@ export const QuerySpotPriceRequest = { return message; }, fromJSON(object: any): QuerySpotPriceRequest { - const obj = createBaseQuerySpotPriceRequest(); - if (isSet(object.poolId)) obj.poolId = BigInt(object.poolId.toString()); - if (isSet(object.baseAssetDenom)) obj.baseAssetDenom = String(object.baseAssetDenom); - if (isSet(object.quoteAssetDenom)) obj.quoteAssetDenom = String(object.quoteAssetDenom); - return obj; + return { + poolId: isSet(object.poolId) ? BigInt(object.poolId.toString()) : BigInt(0), + baseAssetDenom: isSet(object.baseAssetDenom) ? String(object.baseAssetDenom) : "", + quoteAssetDenom: isSet(object.quoteAssetDenom) ? String(object.quoteAssetDenom) : "" + }; }, toJSON(message: QuerySpotPriceRequest): JsonSafe<QuerySpotPriceRequest> { const obj: any = {}; @@ -103,9 +112,7 @@ export const QuerySpotPriceRequest = { }, fromPartial(object: DeepPartial<QuerySpotPriceRequest>): QuerySpotPriceRequest { const message = createBaseQuerySpotPriceRequest(); - if (object.poolId !== undefined && object.poolId !== null) { - message.poolId = BigInt(object.poolId.toString()); - } + message.poolId = object.poolId !== undefined && object.poolId !== null ? BigInt(object.poolId.toString()) : BigInt(0); message.baseAssetDenom = object.baseAssetDenom ?? ""; message.quoteAssetDenom = object.quoteAssetDenom ?? ""; return message; @@ -181,7 +188,7 @@ function createBaseQuerySpotPriceResponse(): QuerySpotPriceResponse { export const QuerySpotPriceResponse = { typeUrl: "/osmosis.gamm.v2.QuerySpotPriceResponse", encode(message: QuerySpotPriceResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.spotPrice !== undefined) { + if (message.spotPrice !== "") { writer.uint32(10).string(message.spotPrice); } return writer; @@ -204,9 +211,9 @@ export const QuerySpotPriceResponse = { return message; }, fromJSON(object: any): QuerySpotPriceResponse { - const obj = createBaseQuerySpotPriceResponse(); - if (isSet(object.spotPrice)) obj.spotPrice = String(object.spotPrice); - return obj; + return { + spotPrice: isSet(object.spotPrice) ? String(object.spotPrice) : "" + }; }, toJSON(message: QuerySpotPriceResponse): JsonSafe<QuerySpotPriceResponse> { const obj: any = {}; diff --git a/__fixtures__/v-next/outputv4/osmosis/ibc-rate-limit/v1beta1/params.ts b/__fixtures__/v-next/outputv4/osmosis/ibc-rate-limit/v1beta1/params.ts index 172bb38407..e569470ad9 100644 --- a/__fixtures__/v-next/outputv4/osmosis/ibc-rate-limit/v1beta1/params.ts +++ b/__fixtures__/v-next/outputv4/osmosis/ibc-rate-limit/v1beta1/params.ts @@ -1,11 +1,15 @@ -import { BinaryReader, BinaryWriter } from "../../../binary.js"; -import { isSet, DeepPartial } from "../../../helpers.js"; -import { JsonSafe } from "../../../json-safe.js"; +import { BinaryReader, BinaryWriter } from "../../../binary"; +import { isSet, DeepPartial } from "../../../helpers"; +import { JsonSafe } from "../../../json-safe"; +import { ComputedRef } from "vue"; export const protobufPackage = "osmosis.ibcratelimit.v1beta1"; /** Params defines the parameters for the ibc-rate-limit module. */ export interface Params { contractAddress: string; } +export interface ReactiveParams { + contractAddress: ComputedRef<string>; +} export interface ParamsProtoMsg { typeUrl: "/osmosis.ibcratelimit.v1beta1.Params"; value: Uint8Array; @@ -22,7 +26,7 @@ function createBaseParams(): Params { export const Params = { typeUrl: "/osmosis.ibcratelimit.v1beta1.Params", encode(message: Params, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.contractAddress !== undefined) { + if (message.contractAddress !== "") { writer.uint32(10).string(message.contractAddress); } return writer; @@ -45,9 +49,9 @@ export const Params = { return message; }, fromJSON(object: any): Params { - const obj = createBaseParams(); - if (isSet(object.contractAddress)) obj.contractAddress = String(object.contractAddress); - return obj; + return { + contractAddress: isSet(object.contractAddress) ? String(object.contractAddress) : "" + }; }, toJSON(message: Params): JsonSafe<Params> { const obj: any = {}; diff --git a/__fixtures__/v-next/outputv4/osmosis/ibc-rate-limit/v1beta1/query.lcd.ts b/__fixtures__/v-next/outputv4/osmosis/ibc-rate-limit/v1beta1/query.lcd.ts index 4b9aee3dd2..4d2448271a 100644 --- a/__fixtures__/v-next/outputv4/osmosis/ibc-rate-limit/v1beta1/query.lcd.ts +++ b/__fixtures__/v-next/outputv4/osmosis/ibc-rate-limit/v1beta1/query.lcd.ts @@ -1,6 +1,6 @@ -import { Params, ParamsSDKType } from "./params.js"; +import { Params, ParamsSDKType } from "./params"; import { LCDClient } from "@cosmology/lcd"; -import { QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType } from "./query.js"; +import { QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType } from "./query"; export class LCDQueryClient { req: LCDClient; constructor({ diff --git a/__fixtures__/v-next/outputv4/osmosis/ibc-rate-limit/v1beta1/query.rpc.Query.ts b/__fixtures__/v-next/outputv4/osmosis/ibc-rate-limit/v1beta1/query.rpc.Query.ts index 9603682384..4511c5cd7a 100644 --- a/__fixtures__/v-next/outputv4/osmosis/ibc-rate-limit/v1beta1/query.rpc.Query.ts +++ b/__fixtures__/v-next/outputv4/osmosis/ibc-rate-limit/v1beta1/query.rpc.Query.ts @@ -1,8 +1,8 @@ -import { Params, ParamsSDKType } from "./params.js"; -import { Rpc } from "../../../helpers.js"; -import { BinaryReader } from "../../../binary.js"; +import { Params, ParamsSDKType } from "./params"; +import { Rpc } from "../../../helpers"; +import { BinaryReader } from "../../../binary"; import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; -import { QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType } from "./query.js"; +import { QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType, ReactiveQueryParamsRequest } from "./query"; /** Query defines the gRPC querier service. */ export interface Query { /** diff --git a/__fixtures__/v-next/outputv4/osmosis/ibc-rate-limit/v1beta1/query.ts b/__fixtures__/v-next/outputv4/osmosis/ibc-rate-limit/v1beta1/query.ts index be54eba06e..65dd06ac66 100644 --- a/__fixtures__/v-next/outputv4/osmosis/ibc-rate-limit/v1beta1/query.ts +++ b/__fixtures__/v-next/outputv4/osmosis/ibc-rate-limit/v1beta1/query.ts @@ -1,10 +1,12 @@ -import { Params, ParamsSDKType } from "./params.js"; -import { BinaryReader, BinaryWriter } from "../../../binary.js"; -import { JsonSafe } from "../../../json-safe.js"; -import { DeepPartial, isSet } from "../../../helpers.js"; +import { Params, ParamsSDKType } from "./params"; +import { BinaryReader, BinaryWriter } from "../../../binary"; +import { JsonSafe } from "../../../json-safe"; +import { DeepPartial, isSet } from "../../../helpers"; +import { ComputedRef } from "vue"; export const protobufPackage = "osmosis.ibcratelimit.v1beta1"; /** QueryParamsRequest is the request type for the Query/Params RPC method. */ export interface QueryParamsRequest {} +export interface ReactiveQueryParamsRequest {} export interface QueryParamsRequestProtoMsg { typeUrl: "/osmosis.ibcratelimit.v1beta1.QueryParamsRequest"; value: Uint8Array; @@ -16,6 +18,9 @@ export interface QueryParamsResponse { /** params defines the parameters of the module. */ params: Params; } +export interface ReactiveQueryParamsResponse { + params: ComputedRef<Params>; +} export interface QueryParamsResponseProtoMsg { typeUrl: "/osmosis.ibcratelimit.v1beta1.QueryParamsResponse"; value: Uint8Array; @@ -47,8 +52,7 @@ export const QueryParamsRequest = { return message; }, fromJSON(_: any): QueryParamsRequest { - const obj = createBaseQueryParamsRequest(); - return obj; + return {}; }, toJSON(_: QueryParamsRequest): JsonSafe<QueryParamsRequest> { const obj: any = {}; @@ -129,9 +133,9 @@ export const QueryParamsResponse = { return message; }, fromJSON(object: any): QueryParamsResponse { - const obj = createBaseQueryParamsResponse(); - if (isSet(object.params)) obj.params = Params.fromJSON(object.params); - return obj; + return { + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined + }; }, toJSON(message: QueryParamsResponse): JsonSafe<QueryParamsResponse> { const obj: any = {}; @@ -140,9 +144,7 @@ export const QueryParamsResponse = { }, fromPartial(object: DeepPartial<QueryParamsResponse>): QueryParamsResponse { const message = createBaseQueryParamsResponse(); - if (object.params !== undefined && object.params !== null) { - message.params = Params.fromPartial(object.params); - } + message.params = object.params !== undefined && object.params !== null ? Params.fromPartial(object.params) : undefined; return message; }, fromSDK(object: QueryParamsResponseSDKType): QueryParamsResponse { diff --git a/__fixtures__/v-next/outputv4/osmosis/incentives/gauge.ts b/__fixtures__/v-next/outputv4/osmosis/incentives/gauge.ts index 1c9033e0aa..b72a54974d 100644 --- a/__fixtures__/v-next/outputv4/osmosis/incentives/gauge.ts +++ b/__fixtures__/v-next/outputv4/osmosis/incentives/gauge.ts @@ -1,10 +1,11 @@ -import { QueryCondition, QueryConditionSDKType } from "../lockup/lock.js"; -import { Coin, CoinSDKType } from "../../cosmos/base/v1beta1/coin.js"; -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"; +import { QueryCondition, QueryConditionSDKType } from "../lockup/lock"; +import { Coin, CoinSDKType } from "../../cosmos/base/v1beta1/coin"; +import { Timestamp, TimestampSDKType } from "../../google/protobuf/timestamp"; +import { Duration, DurationSDKType } from "../../google/protobuf/duration"; +import { BinaryReader, BinaryWriter } from "../../binary"; +import { toTimestamp, fromTimestamp, isSet, DeepPartial } from "../../helpers"; +import { JsonSafe } from "../../json-safe"; +import { ComputedRef } from "vue"; export const protobufPackage = "osmosis.incentives"; /** * Gauge is an object that stores and distributes yields to recipients who @@ -47,6 +48,16 @@ export interface Gauge { /** distributed_coins are coins that have been distributed already */ distributedCoins: Coin[]; } +export interface ReactiveGauge { + id: ComputedRef<bigint>; + isPerpetual: ComputedRef<boolean>; + distributeTo: ComputedRef<QueryCondition>; + coins: ComputedRef<Coin[]>; + startTime: ComputedRef<Date>; + numEpochsPaidOver: ComputedRef<bigint>; + filledEpochs: ComputedRef<bigint>; + distributedCoins: ComputedRef<Coin[]>; +} export interface GaugeProtoMsg { typeUrl: "/osmosis.incentives.Gauge"; value: Uint8Array; @@ -70,6 +81,9 @@ export interface LockableDurationsInfo { /** List of incentivised durations that gauges will pay out to */ lockableDurations: Duration[]; } +export interface ReactiveLockableDurationsInfo { + lockableDurations: ComputedRef<Duration[]>; +} export interface LockableDurationsInfoProtoMsg { typeUrl: "/osmosis.incentives.LockableDurationsInfo"; value: Uint8Array; @@ -92,10 +106,10 @@ function createBaseGauge(): Gauge { export const Gauge = { typeUrl: "/osmosis.incentives.Gauge", encode(message: Gauge, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.id !== undefined) { + if (message.id !== BigInt(0)) { writer.uint32(8).uint64(message.id); } - if (message.isPerpetual !== undefined) { + if (message.isPerpetual === true) { writer.uint32(16).bool(message.isPerpetual); } if (message.distributeTo !== undefined) { @@ -107,10 +121,10 @@ export const Gauge = { if (message.startTime !== undefined) { Timestamp.encode(toTimestamp(message.startTime), writer.uint32(42).fork()).ldelim(); } - if (message.numEpochsPaidOver !== undefined) { + if (message.numEpochsPaidOver !== BigInt(0)) { writer.uint32(48).uint64(message.numEpochsPaidOver); } - if (message.filledEpochs !== undefined) { + if (message.filledEpochs !== BigInt(0)) { writer.uint32(56).uint64(message.filledEpochs); } for (const v of message.distributedCoins) { @@ -157,16 +171,16 @@ export const Gauge = { return message; }, fromJSON(object: any): Gauge { - const obj = createBaseGauge(); - if (isSet(object.id)) obj.id = BigInt(object.id.toString()); - if (isSet(object.isPerpetual)) obj.isPerpetual = Boolean(object.isPerpetual); - if (isSet(object.distributeTo)) obj.distributeTo = QueryCondition.fromJSON(object.distributeTo); - if (Array.isArray(object?.coins)) obj.coins = object.coins.map((e: any) => Coin.fromJSON(e)); - if (isSet(object.startTime)) obj.startTime = new Date(object.startTime); - if (isSet(object.numEpochsPaidOver)) obj.numEpochsPaidOver = BigInt(object.numEpochsPaidOver.toString()); - if (isSet(object.filledEpochs)) obj.filledEpochs = BigInt(object.filledEpochs.toString()); - if (Array.isArray(object?.distributedCoins)) obj.distributedCoins = object.distributedCoins.map((e: any) => Coin.fromJSON(e)); - return obj; + return { + id: isSet(object.id) ? BigInt(object.id.toString()) : BigInt(0), + isPerpetual: isSet(object.isPerpetual) ? Boolean(object.isPerpetual) : false, + distributeTo: isSet(object.distributeTo) ? QueryCondition.fromJSON(object.distributeTo) : undefined, + coins: Array.isArray(object?.coins) ? object.coins.map((e: any) => Coin.fromJSON(e)) : [], + startTime: isSet(object.startTime) ? new Date(object.startTime) : undefined, + numEpochsPaidOver: isSet(object.numEpochsPaidOver) ? BigInt(object.numEpochsPaidOver.toString()) : BigInt(0), + filledEpochs: isSet(object.filledEpochs) ? BigInt(object.filledEpochs.toString()) : BigInt(0), + distributedCoins: Array.isArray(object?.distributedCoins) ? object.distributedCoins.map((e: any) => Coin.fromJSON(e)) : [] + }; }, toJSON(message: Gauge): JsonSafe<Gauge> { const obj: any = {}; @@ -190,21 +204,13 @@ export const Gauge = { }, fromPartial(object: DeepPartial<Gauge>): Gauge { const message = createBaseGauge(); - if (object.id !== undefined && object.id !== null) { - message.id = BigInt(object.id.toString()); - } + message.id = object.id !== undefined && object.id !== null ? BigInt(object.id.toString()) : BigInt(0); message.isPerpetual = object.isPerpetual ?? false; - if (object.distributeTo !== undefined && object.distributeTo !== null) { - message.distributeTo = QueryCondition.fromPartial(object.distributeTo); - } + message.distributeTo = object.distributeTo !== undefined && object.distributeTo !== null ? QueryCondition.fromPartial(object.distributeTo) : undefined; message.coins = object.coins?.map(e => Coin.fromPartial(e)) || []; message.startTime = object.startTime ?? undefined; - if (object.numEpochsPaidOver !== undefined && object.numEpochsPaidOver !== null) { - message.numEpochsPaidOver = BigInt(object.numEpochsPaidOver.toString()); - } - if (object.filledEpochs !== undefined && object.filledEpochs !== null) { - message.filledEpochs = BigInt(object.filledEpochs.toString()); - } + message.numEpochsPaidOver = object.numEpochsPaidOver !== undefined && object.numEpochsPaidOver !== null ? BigInt(object.numEpochsPaidOver.toString()) : BigInt(0); + message.filledEpochs = object.filledEpochs !== undefined && object.filledEpochs !== null ? BigInt(object.filledEpochs.toString()) : BigInt(0); message.distributedCoins = object.distributedCoins?.map(e => Coin.fromPartial(e)) || []; return message; }, @@ -349,9 +355,9 @@ export const LockableDurationsInfo = { return message; }, fromJSON(object: any): LockableDurationsInfo { - const obj = createBaseLockableDurationsInfo(); - if (Array.isArray(object?.lockableDurations)) obj.lockableDurations = object.lockableDurations.map((e: any) => Duration.fromJSON(e)); - return obj; + return { + lockableDurations: Array.isArray(object?.lockableDurations) ? object.lockableDurations.map((e: any) => Duration.fromJSON(e)) : [] + }; }, toJSON(message: LockableDurationsInfo): JsonSafe<LockableDurationsInfo> { const obj: any = {}; diff --git a/__fixtures__/v-next/outputv4/osmosis/incentives/genesis.ts b/__fixtures__/v-next/outputv4/osmosis/incentives/genesis.ts index 4bb70dcfb0..4288959cea 100644 --- a/__fixtures__/v-next/outputv4/osmosis/incentives/genesis.ts +++ b/__fixtures__/v-next/outputv4/osmosis/incentives/genesis.ts @@ -1,9 +1,10 @@ -import { Params, ParamsSDKType } from "./params.js"; -import { Gauge, GaugeSDKType } from "./gauge.js"; -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"; +import { Params, ParamsSDKType } from "./params"; +import { Gauge, GaugeSDKType } from "./gauge"; +import { Duration, DurationSDKType } from "../../google/protobuf/duration"; +import { BinaryReader, BinaryWriter } from "../../binary"; +import { isSet, DeepPartial } from "../../helpers"; +import { JsonSafe } from "../../json-safe"; +import { ComputedRef } from "vue"; export const protobufPackage = "osmosis.incentives"; /** * GenesisState defines the incentives module's various parameters when first @@ -25,6 +26,12 @@ export interface GenesisState { */ lastGaugeId: bigint; } +export interface ReactiveGenesisState { + params: ComputedRef<Params>; + gauges: ComputedRef<Gauge[]>; + lockableDurations: ComputedRef<Duration[]>; + lastGaugeId: ComputedRef<bigint>; +} export interface GenesisStateProtoMsg { typeUrl: "/osmosis.incentives.GenesisState"; value: Uint8Array; @@ -59,7 +66,7 @@ export const GenesisState = { for (const v of message.lockableDurations) { Duration.encode(v!, writer.uint32(26).fork()).ldelim(); } - if (message.lastGaugeId !== undefined) { + if (message.lastGaugeId !== BigInt(0)) { writer.uint32(32).uint64(message.lastGaugeId); } return writer; @@ -91,12 +98,12 @@ export const GenesisState = { return message; }, fromJSON(object: any): GenesisState { - const obj = createBaseGenesisState(); - if (isSet(object.params)) obj.params = Params.fromJSON(object.params); - if (Array.isArray(object?.gauges)) obj.gauges = object.gauges.map((e: any) => Gauge.fromJSON(e)); - if (Array.isArray(object?.lockableDurations)) obj.lockableDurations = object.lockableDurations.map((e: any) => Duration.fromJSON(e)); - if (isSet(object.lastGaugeId)) obj.lastGaugeId = BigInt(object.lastGaugeId.toString()); - return obj; + return { + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + gauges: Array.isArray(object?.gauges) ? object.gauges.map((e: any) => Gauge.fromJSON(e)) : [], + lockableDurations: Array.isArray(object?.lockableDurations) ? object.lockableDurations.map((e: any) => Duration.fromJSON(e)) : [], + lastGaugeId: isSet(object.lastGaugeId) ? BigInt(object.lastGaugeId.toString()) : BigInt(0) + }; }, toJSON(message: GenesisState): JsonSafe<GenesisState> { const obj: any = {}; @@ -116,14 +123,10 @@ export const GenesisState = { }, fromPartial(object: DeepPartial<GenesisState>): GenesisState { const message = createBaseGenesisState(); - if (object.params !== undefined && object.params !== null) { - message.params = Params.fromPartial(object.params); - } + message.params = object.params !== undefined && object.params !== null ? Params.fromPartial(object.params) : undefined; message.gauges = object.gauges?.map(e => Gauge.fromPartial(e)) || []; message.lockableDurations = object.lockableDurations?.map(e => Duration.fromPartial(e)) || []; - if (object.lastGaugeId !== undefined && object.lastGaugeId !== null) { - message.lastGaugeId = BigInt(object.lastGaugeId.toString()); - } + message.lastGaugeId = object.lastGaugeId !== undefined && object.lastGaugeId !== null ? BigInt(object.lastGaugeId.toString()) : BigInt(0); return message; }, fromSDK(object: GenesisStateSDKType): GenesisState { diff --git a/__fixtures__/v-next/outputv4/osmosis/incentives/params.ts b/__fixtures__/v-next/outputv4/osmosis/incentives/params.ts index 51e4cea767..fccd3abd34 100644 --- a/__fixtures__/v-next/outputv4/osmosis/incentives/params.ts +++ b/__fixtures__/v-next/outputv4/osmosis/incentives/params.ts @@ -1,6 +1,7 @@ -import { BinaryReader, BinaryWriter } from "../../binary.js"; -import { isSet, DeepPartial } from "../../helpers.js"; -import { JsonSafe } from "../../json-safe.js"; +import { BinaryReader, BinaryWriter } from "../../binary"; +import { isSet, DeepPartial } from "../../helpers"; +import { JsonSafe } from "../../json-safe"; +import { ComputedRef } from "vue"; export const protobufPackage = "osmosis.incentives"; /** Params holds parameters for the incentives module */ export interface Params { @@ -10,6 +11,9 @@ export interface Params { */ distrEpochIdentifier: string; } +export interface ReactiveParams { + distrEpochIdentifier: ComputedRef<string>; +} export interface ParamsProtoMsg { typeUrl: "/osmosis.incentives.Params"; value: Uint8Array; @@ -26,7 +30,7 @@ function createBaseParams(): Params { export const Params = { typeUrl: "/osmosis.incentives.Params", encode(message: Params, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.distrEpochIdentifier !== undefined) { + if (message.distrEpochIdentifier !== "") { writer.uint32(10).string(message.distrEpochIdentifier); } return writer; @@ -49,9 +53,9 @@ export const Params = { return message; }, fromJSON(object: any): Params { - const obj = createBaseParams(); - if (isSet(object.distrEpochIdentifier)) obj.distrEpochIdentifier = String(object.distrEpochIdentifier); - return obj; + return { + distrEpochIdentifier: isSet(object.distrEpochIdentifier) ? String(object.distrEpochIdentifier) : "" + }; }, toJSON(message: Params): JsonSafe<Params> { const obj: any = {}; diff --git a/__fixtures__/v-next/outputv4/osmosis/incentives/query.lcd.ts b/__fixtures__/v-next/outputv4/osmosis/incentives/query.lcd.ts index e69429ec7b..e6b02d8377 100644 --- a/__fixtures__/v-next/outputv4/osmosis/incentives/query.lcd.ts +++ b/__fixtures__/v-next/outputv4/osmosis/incentives/query.lcd.ts @@ -1,10 +1,10 @@ -import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../cosmos/base/query/v1beta1/pagination.js"; -import { Coin, CoinSDKType } from "../../cosmos/base/v1beta1/coin.js"; -import { Gauge, GaugeSDKType } from "./gauge.js"; -import { Duration, DurationSDKType } from "../../google/protobuf/duration.js"; -import { setPaginationParams } from "../../helpers.js"; +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../cosmos/base/query/v1beta1/pagination"; +import { Coin, CoinSDKType } from "../../cosmos/base/v1beta1/coin"; +import { Gauge, GaugeSDKType } from "./gauge"; +import { Duration, DurationSDKType } from "../../google/protobuf/duration"; +import { setPaginationParams } from "../../helpers"; import { LCDClient } from "@cosmology/lcd"; -import { ModuleToDistributeCoinsRequest, ModuleToDistributeCoinsRequestSDKType, ModuleToDistributeCoinsResponse, ModuleToDistributeCoinsResponseSDKType, GaugeByIDRequest, GaugeByIDRequestSDKType, GaugeByIDResponse, GaugeByIDResponseSDKType, GaugesRequest, GaugesRequestSDKType, GaugesResponse, GaugesResponseSDKType, ActiveGaugesRequest, ActiveGaugesRequestSDKType, ActiveGaugesResponse, ActiveGaugesResponseSDKType, ActiveGaugesPerDenomRequest, ActiveGaugesPerDenomRequestSDKType, ActiveGaugesPerDenomResponse, ActiveGaugesPerDenomResponseSDKType, UpcomingGaugesRequest, UpcomingGaugesRequestSDKType, UpcomingGaugesResponse, UpcomingGaugesResponseSDKType, UpcomingGaugesPerDenomRequest, UpcomingGaugesPerDenomRequestSDKType, UpcomingGaugesPerDenomResponse, UpcomingGaugesPerDenomResponseSDKType, RewardsEstRequest, RewardsEstRequestSDKType, RewardsEstResponse, RewardsEstResponseSDKType, QueryLockableDurationsRequest, QueryLockableDurationsRequestSDKType, QueryLockableDurationsResponse, QueryLockableDurationsResponseSDKType } from "./query.js"; +import { ModuleToDistributeCoinsRequest, ModuleToDistributeCoinsRequestSDKType, ModuleToDistributeCoinsResponse, ModuleToDistributeCoinsResponseSDKType, GaugeByIDRequest, GaugeByIDRequestSDKType, GaugeByIDResponse, GaugeByIDResponseSDKType, GaugesRequest, GaugesRequestSDKType, GaugesResponse, GaugesResponseSDKType, ActiveGaugesRequest, ActiveGaugesRequestSDKType, ActiveGaugesResponse, ActiveGaugesResponseSDKType, ActiveGaugesPerDenomRequest, ActiveGaugesPerDenomRequestSDKType, ActiveGaugesPerDenomResponse, ActiveGaugesPerDenomResponseSDKType, UpcomingGaugesRequest, UpcomingGaugesRequestSDKType, UpcomingGaugesResponse, UpcomingGaugesResponseSDKType, UpcomingGaugesPerDenomRequest, UpcomingGaugesPerDenomRequestSDKType, UpcomingGaugesPerDenomResponse, UpcomingGaugesPerDenomResponseSDKType, RewardsEstRequest, RewardsEstRequestSDKType, RewardsEstResponse, RewardsEstResponseSDKType, QueryLockableDurationsRequest, QueryLockableDurationsRequestSDKType, QueryLockableDurationsResponse, QueryLockableDurationsResponseSDKType } from "./query"; export class LCDQueryClient { req: LCDClient; constructor({ @@ -35,7 +35,7 @@ export class LCDQueryClient { } /* Gauges returns both upcoming and active gauges */ async gauges(params: GaugesRequest = { - pagination: PageRequest.fromPartial({}) + pagination: undefined }): Promise<GaugesResponseSDKType> { const options: any = { params: {} @@ -48,7 +48,7 @@ export class LCDQueryClient { } /* ActiveGauges returns active gauges */ async activeGauges(params: ActiveGaugesRequest = { - pagination: PageRequest.fromPartial({}) + pagination: undefined }): Promise<ActiveGaugesResponseSDKType> { const options: any = { params: {} @@ -75,7 +75,7 @@ export class LCDQueryClient { } /* Returns scheduled gauges that have not yet occured */ async upcomingGauges(params: UpcomingGaugesRequest = { - pagination: PageRequest.fromPartial({}) + pagination: undefined }): Promise<UpcomingGaugesResponseSDKType> { const options: any = { params: {} diff --git a/__fixtures__/v-next/outputv4/osmosis/incentives/query.rpc.Query.ts b/__fixtures__/v-next/outputv4/osmosis/incentives/query.rpc.Query.ts index a022665455..582e814650 100644 --- a/__fixtures__/v-next/outputv4/osmosis/incentives/query.rpc.Query.ts +++ b/__fixtures__/v-next/outputv4/osmosis/incentives/query.rpc.Query.ts @@ -1,11 +1,11 @@ -import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../cosmos/base/query/v1beta1/pagination.js"; -import { Coin, CoinSDKType } from "../../cosmos/base/v1beta1/coin.js"; -import { Gauge, GaugeSDKType } from "./gauge.js"; -import { Duration, DurationSDKType } from "../../google/protobuf/duration.js"; -import { Rpc } from "../../helpers.js"; -import { BinaryReader } from "../../binary.js"; +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../cosmos/base/query/v1beta1/pagination"; +import { Coin, CoinSDKType } from "../../cosmos/base/v1beta1/coin"; +import { Gauge, GaugeSDKType } from "./gauge"; +import { Duration, DurationSDKType } from "../../google/protobuf/duration"; +import { Rpc } from "../../helpers"; +import { BinaryReader } from "../../binary"; import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; -import { ModuleToDistributeCoinsRequest, ModuleToDistributeCoinsRequestSDKType, ModuleToDistributeCoinsResponse, ModuleToDistributeCoinsResponseSDKType, GaugeByIDRequest, GaugeByIDRequestSDKType, GaugeByIDResponse, GaugeByIDResponseSDKType, GaugesRequest, GaugesRequestSDKType, GaugesResponse, GaugesResponseSDKType, ActiveGaugesRequest, ActiveGaugesRequestSDKType, ActiveGaugesResponse, ActiveGaugesResponseSDKType, ActiveGaugesPerDenomRequest, ActiveGaugesPerDenomRequestSDKType, ActiveGaugesPerDenomResponse, ActiveGaugesPerDenomResponseSDKType, UpcomingGaugesRequest, UpcomingGaugesRequestSDKType, UpcomingGaugesResponse, UpcomingGaugesResponseSDKType, UpcomingGaugesPerDenomRequest, UpcomingGaugesPerDenomRequestSDKType, UpcomingGaugesPerDenomResponse, UpcomingGaugesPerDenomResponseSDKType, RewardsEstRequest, RewardsEstRequestSDKType, RewardsEstResponse, RewardsEstResponseSDKType, QueryLockableDurationsRequest, QueryLockableDurationsRequestSDKType, QueryLockableDurationsResponse, QueryLockableDurationsResponseSDKType } from "./query.js"; +import { ModuleToDistributeCoinsRequest, ModuleToDistributeCoinsRequestSDKType, ModuleToDistributeCoinsResponse, ModuleToDistributeCoinsResponseSDKType, GaugeByIDRequest, GaugeByIDRequestSDKType, GaugeByIDResponse, GaugeByIDResponseSDKType, GaugesRequest, GaugesRequestSDKType, GaugesResponse, GaugesResponseSDKType, ActiveGaugesRequest, ActiveGaugesRequestSDKType, ActiveGaugesResponse, ActiveGaugesResponseSDKType, ActiveGaugesPerDenomRequest, ActiveGaugesPerDenomRequestSDKType, ActiveGaugesPerDenomResponse, ActiveGaugesPerDenomResponseSDKType, UpcomingGaugesRequest, UpcomingGaugesRequestSDKType, UpcomingGaugesResponse, UpcomingGaugesResponseSDKType, UpcomingGaugesPerDenomRequest, UpcomingGaugesPerDenomRequestSDKType, UpcomingGaugesPerDenomResponse, UpcomingGaugesPerDenomResponseSDKType, RewardsEstRequest, RewardsEstRequestSDKType, RewardsEstResponse, RewardsEstResponseSDKType, QueryLockableDurationsRequest, QueryLockableDurationsRequestSDKType, QueryLockableDurationsResponse, QueryLockableDurationsResponseSDKType, ReactiveQueryLockableDurationsRequest } from "./query"; /** Query defines the gRPC querier service */ export interface Query { /** ModuleToDistributeCoins returns coins that are going to be distributed */ @@ -62,14 +62,14 @@ export class QueryClientImpl implements Query { return promise.then(data => GaugeByIDResponse.decode(new BinaryReader(data))); } gauges(request: GaugesRequest = { - pagination: PageRequest.fromPartial({}) + pagination: undefined }): Promise<GaugesResponse> { const data = GaugesRequest.encode(request).finish(); const promise = this.rpc.request("osmosis.incentives.Query", "Gauges", data); return promise.then(data => GaugesResponse.decode(new BinaryReader(data))); } activeGauges(request: ActiveGaugesRequest = { - pagination: PageRequest.fromPartial({}) + pagination: undefined }): Promise<ActiveGaugesResponse> { const data = ActiveGaugesRequest.encode(request).finish(); const promise = this.rpc.request("osmosis.incentives.Query", "ActiveGauges", data); @@ -81,7 +81,7 @@ export class QueryClientImpl implements Query { return promise.then(data => ActiveGaugesPerDenomResponse.decode(new BinaryReader(data))); } upcomingGauges(request: UpcomingGaugesRequest = { - pagination: PageRequest.fromPartial({}) + pagination: undefined }): Promise<UpcomingGaugesResponse> { const data = UpcomingGaugesRequest.encode(request).finish(); const promise = this.rpc.request("osmosis.incentives.Query", "UpcomingGauges", data); diff --git a/__fixtures__/v-next/outputv4/osmosis/incentives/query.ts b/__fixtures__/v-next/outputv4/osmosis/incentives/query.ts index a6e7d42e8f..a9e72a7768 100644 --- a/__fixtures__/v-next/outputv4/osmosis/incentives/query.ts +++ b/__fixtures__/v-next/outputv4/osmosis/incentives/query.ts @@ -1,12 +1,14 @@ -import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../cosmos/base/query/v1beta1/pagination.js"; -import { Coin, CoinSDKType } from "../../cosmos/base/v1beta1/coin.js"; -import { Gauge, GaugeSDKType } from "./gauge.js"; -import { Duration, DurationSDKType } from "../../google/protobuf/duration.js"; -import { BinaryReader, BinaryWriter } from "../../binary.js"; -import { JsonSafe } from "../../json-safe.js"; -import { DeepPartial, isSet } from "../../helpers.js"; +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../cosmos/base/query/v1beta1/pagination"; +import { Coin, CoinSDKType } from "../../cosmos/base/v1beta1/coin"; +import { Gauge, GaugeSDKType } from "./gauge"; +import { Duration, DurationSDKType } from "../../google/protobuf/duration"; +import { BinaryReader, BinaryWriter } from "../../binary"; +import { JsonSafe } from "../../json-safe"; +import { DeepPartial, isSet } from "../../helpers"; +import { ComputedRef } from "vue"; export const protobufPackage = "osmosis.incentives"; export interface ModuleToDistributeCoinsRequest {} +export interface ReactiveModuleToDistributeCoinsRequest {} export interface ModuleToDistributeCoinsRequestProtoMsg { typeUrl: "/osmosis.incentives.ModuleToDistributeCoinsRequest"; value: Uint8Array; @@ -16,6 +18,9 @@ export interface ModuleToDistributeCoinsResponse { /** Coins that have yet to be distributed */ coins: Coin[]; } +export interface ReactiveModuleToDistributeCoinsResponse { + coins: ComputedRef<Coin[]>; +} export interface ModuleToDistributeCoinsResponseProtoMsg { typeUrl: "/osmosis.incentives.ModuleToDistributeCoinsResponse"; value: Uint8Array; @@ -27,6 +32,9 @@ export interface GaugeByIDRequest { /** Gague ID being queried */ id: bigint; } +export interface ReactiveGaugeByIDRequest { + id: ComputedRef<bigint>; +} export interface GaugeByIDRequestProtoMsg { typeUrl: "/osmosis.incentives.GaugeByIDRequest"; value: Uint8Array; @@ -38,6 +46,9 @@ export interface GaugeByIDResponse { /** Gauge that corresponds to provided gague ID */ gauge?: Gauge; } +export interface ReactiveGaugeByIDResponse { + gauge?: ComputedRef<Gauge>; +} export interface GaugeByIDResponseProtoMsg { typeUrl: "/osmosis.incentives.GaugeByIDResponse"; value: Uint8Array; @@ -49,6 +60,9 @@ export interface GaugesRequest { /** Pagination defines pagination for the request */ pagination?: PageRequest; } +export interface ReactiveGaugesRequest { + pagination?: ComputedRef<PageRequest>; +} export interface GaugesRequestProtoMsg { typeUrl: "/osmosis.incentives.GaugesRequest"; value: Uint8Array; @@ -62,6 +76,10 @@ export interface GaugesResponse { /** Pagination defines pagination for the response */ pagination?: PageResponse; } +export interface ReactiveGaugesResponse { + data: ComputedRef<Gauge[]>; + pagination?: ComputedRef<PageResponse>; +} export interface GaugesResponseProtoMsg { typeUrl: "/osmosis.incentives.GaugesResponse"; value: Uint8Array; @@ -74,6 +92,9 @@ export interface ActiveGaugesRequest { /** Pagination defines pagination for the request */ pagination?: PageRequest; } +export interface ReactiveActiveGaugesRequest { + pagination?: ComputedRef<PageRequest>; +} export interface ActiveGaugesRequestProtoMsg { typeUrl: "/osmosis.incentives.ActiveGaugesRequest"; value: Uint8Array; @@ -87,6 +108,10 @@ export interface ActiveGaugesResponse { /** Pagination defines pagination for the response */ pagination?: PageResponse; } +export interface ReactiveActiveGaugesResponse { + data: ComputedRef<Gauge[]>; + pagination?: ComputedRef<PageResponse>; +} export interface ActiveGaugesResponseProtoMsg { typeUrl: "/osmosis.incentives.ActiveGaugesResponse"; value: Uint8Array; @@ -101,6 +126,10 @@ export interface ActiveGaugesPerDenomRequest { /** Pagination defines pagination for the request */ pagination?: PageRequest; } +export interface ReactiveActiveGaugesPerDenomRequest { + denom: ComputedRef<string>; + pagination?: ComputedRef<PageRequest>; +} export interface ActiveGaugesPerDenomRequestProtoMsg { typeUrl: "/osmosis.incentives.ActiveGaugesPerDenomRequest"; value: Uint8Array; @@ -115,6 +144,10 @@ export interface ActiveGaugesPerDenomResponse { /** Pagination defines pagination for the response */ pagination?: PageResponse; } +export interface ReactiveActiveGaugesPerDenomResponse { + data: ComputedRef<Gauge[]>; + pagination?: ComputedRef<PageResponse>; +} export interface ActiveGaugesPerDenomResponseProtoMsg { typeUrl: "/osmosis.incentives.ActiveGaugesPerDenomResponse"; value: Uint8Array; @@ -127,6 +160,9 @@ export interface UpcomingGaugesRequest { /** Pagination defines pagination for the request */ pagination?: PageRequest; } +export interface ReactiveUpcomingGaugesRequest { + pagination?: ComputedRef<PageRequest>; +} export interface UpcomingGaugesRequestProtoMsg { typeUrl: "/osmosis.incentives.UpcomingGaugesRequest"; value: Uint8Array; @@ -140,6 +176,10 @@ export interface UpcomingGaugesResponse { /** Pagination defines pagination for the response */ pagination?: PageResponse; } +export interface ReactiveUpcomingGaugesResponse { + data: ComputedRef<Gauge[]>; + pagination?: ComputedRef<PageResponse>; +} export interface UpcomingGaugesResponseProtoMsg { typeUrl: "/osmosis.incentives.UpcomingGaugesResponse"; value: Uint8Array; @@ -154,6 +194,10 @@ export interface UpcomingGaugesPerDenomRequest { /** Pagination defines pagination for the request */ pagination?: PageRequest; } +export interface ReactiveUpcomingGaugesPerDenomRequest { + denom: ComputedRef<string>; + pagination?: ComputedRef<PageRequest>; +} export interface UpcomingGaugesPerDenomRequestProtoMsg { typeUrl: "/osmosis.incentives.UpcomingGaugesPerDenomRequest"; value: Uint8Array; @@ -168,6 +212,10 @@ export interface UpcomingGaugesPerDenomResponse { /** Pagination defines pagination for the response */ pagination?: PageResponse; } +export interface ReactiveUpcomingGaugesPerDenomResponse { + upcomingGauges: ComputedRef<Gauge[]>; + pagination?: ComputedRef<PageResponse>; +} export interface UpcomingGaugesPerDenomResponseProtoMsg { typeUrl: "/osmosis.incentives.UpcomingGaugesPerDenomResponse"; value: Uint8Array; @@ -187,6 +235,11 @@ export interface RewardsEstRequest { */ endEpoch: bigint; } +export interface ReactiveRewardsEstRequest { + owner: ComputedRef<string>; + lockIds: ComputedRef<bigint[]>; + endEpoch: ComputedRef<bigint>; +} export interface RewardsEstRequestProtoMsg { typeUrl: "/osmosis.incentives.RewardsEstRequest"; value: Uint8Array; @@ -203,6 +256,9 @@ export interface RewardsEstResponse { */ coins: Coin[]; } +export interface ReactiveRewardsEstResponse { + coins: ComputedRef<Coin[]>; +} export interface RewardsEstResponseProtoMsg { typeUrl: "/osmosis.incentives.RewardsEstResponse"; value: Uint8Array; @@ -211,6 +267,7 @@ export interface RewardsEstResponseSDKType { coins: CoinSDKType[]; } export interface QueryLockableDurationsRequest {} +export interface ReactiveQueryLockableDurationsRequest {} export interface QueryLockableDurationsRequestProtoMsg { typeUrl: "/osmosis.incentives.QueryLockableDurationsRequest"; value: Uint8Array; @@ -220,6 +277,9 @@ export interface QueryLockableDurationsResponse { /** Time durations that users can lock coins for in order to recieve rewards */ lockableDurations: Duration[]; } +export interface ReactiveQueryLockableDurationsResponse { + lockableDurations: ComputedRef<Duration[]>; +} export interface QueryLockableDurationsResponseProtoMsg { typeUrl: "/osmosis.incentives.QueryLockableDurationsResponse"; value: Uint8Array; @@ -250,8 +310,7 @@ export const ModuleToDistributeCoinsRequest = { return message; }, fromJSON(_: any): ModuleToDistributeCoinsRequest { - const obj = createBaseModuleToDistributeCoinsRequest(); - return obj; + return {}; }, toJSON(_: ModuleToDistributeCoinsRequest): JsonSafe<ModuleToDistributeCoinsRequest> { const obj: any = {}; @@ -332,9 +391,9 @@ export const ModuleToDistributeCoinsResponse = { return message; }, fromJSON(object: any): ModuleToDistributeCoinsResponse { - const obj = createBaseModuleToDistributeCoinsResponse(); - if (Array.isArray(object?.coins)) obj.coins = object.coins.map((e: any) => Coin.fromJSON(e)); - return obj; + return { + coins: Array.isArray(object?.coins) ? object.coins.map((e: any) => Coin.fromJSON(e)) : [] + }; }, toJSON(message: ModuleToDistributeCoinsResponse): JsonSafe<ModuleToDistributeCoinsResponse> { const obj: any = {}; @@ -413,7 +472,7 @@ function createBaseGaugeByIDRequest(): GaugeByIDRequest { export const GaugeByIDRequest = { typeUrl: "/osmosis.incentives.GaugeByIDRequest", encode(message: GaugeByIDRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.id !== undefined) { + if (message.id !== BigInt(0)) { writer.uint32(8).uint64(message.id); } return writer; @@ -436,9 +495,9 @@ export const GaugeByIDRequest = { return message; }, fromJSON(object: any): GaugeByIDRequest { - const obj = createBaseGaugeByIDRequest(); - if (isSet(object.id)) obj.id = BigInt(object.id.toString()); - return obj; + return { + id: isSet(object.id) ? BigInt(object.id.toString()) : BigInt(0) + }; }, toJSON(message: GaugeByIDRequest): JsonSafe<GaugeByIDRequest> { const obj: any = {}; @@ -447,9 +506,7 @@ export const GaugeByIDRequest = { }, fromPartial(object: DeepPartial<GaugeByIDRequest>): GaugeByIDRequest { const message = createBaseGaugeByIDRequest(); - if (object.id !== undefined && object.id !== null) { - message.id = BigInt(object.id.toString()); - } + message.id = object.id !== undefined && object.id !== null ? BigInt(object.id.toString()) : BigInt(0); return message; }, fromSDK(object: GaugeByIDRequestSDKType): GaugeByIDRequest { @@ -532,9 +589,9 @@ export const GaugeByIDResponse = { return message; }, fromJSON(object: any): GaugeByIDResponse { - const obj = createBaseGaugeByIDResponse(); - if (isSet(object.gauge)) obj.gauge = Gauge.fromJSON(object.gauge); - return obj; + return { + gauge: isSet(object.gauge) ? Gauge.fromJSON(object.gauge) : undefined + }; }, toJSON(message: GaugeByIDResponse): JsonSafe<GaugeByIDResponse> { const obj: any = {}; @@ -543,9 +600,7 @@ export const GaugeByIDResponse = { }, fromPartial(object: DeepPartial<GaugeByIDResponse>): GaugeByIDResponse { const message = createBaseGaugeByIDResponse(); - if (object.gauge !== undefined && object.gauge !== null) { - message.gauge = Gauge.fromPartial(object.gauge); - } + message.gauge = object.gauge !== undefined && object.gauge !== null ? Gauge.fromPartial(object.gauge) : undefined; return message; }, fromSDK(object: GaugeByIDResponseSDKType): GaugeByIDResponse { @@ -628,9 +683,9 @@ export const GaugesRequest = { return message; }, fromJSON(object: any): GaugesRequest { - const obj = createBaseGaugesRequest(); - if (isSet(object.pagination)) obj.pagination = PageRequest.fromJSON(object.pagination); - return obj; + return { + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined + }; }, toJSON(message: GaugesRequest): JsonSafe<GaugesRequest> { const obj: any = {}; @@ -639,9 +694,7 @@ export const GaugesRequest = { }, fromPartial(object: DeepPartial<GaugesRequest>): GaugesRequest { const message = createBaseGaugesRequest(); - if (object.pagination !== undefined && object.pagination !== null) { - message.pagination = PageRequest.fromPartial(object.pagination); - } + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageRequest.fromPartial(object.pagination) : undefined; return message; }, fromSDK(object: GaugesRequestSDKType): GaugesRequest { @@ -731,10 +784,10 @@ export const GaugesResponse = { return message; }, fromJSON(object: any): GaugesResponse { - const obj = createBaseGaugesResponse(); - if (Array.isArray(object?.data)) obj.data = object.data.map((e: any) => Gauge.fromJSON(e)); - if (isSet(object.pagination)) obj.pagination = PageResponse.fromJSON(object.pagination); - return obj; + return { + data: Array.isArray(object?.data) ? object.data.map((e: any) => Gauge.fromJSON(e)) : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined + }; }, toJSON(message: GaugesResponse): JsonSafe<GaugesResponse> { const obj: any = {}; @@ -749,9 +802,7 @@ export const GaugesResponse = { fromPartial(object: DeepPartial<GaugesResponse>): GaugesResponse { const message = createBaseGaugesResponse(); message.data = object.data?.map(e => Gauge.fromPartial(e)) || []; - if (object.pagination !== undefined && object.pagination !== null) { - message.pagination = PageResponse.fromPartial(object.pagination); - } + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageResponse.fromPartial(object.pagination) : undefined; return message; }, fromSDK(object: GaugesResponseSDKType): GaugesResponse { @@ -847,9 +898,9 @@ export const ActiveGaugesRequest = { return message; }, fromJSON(object: any): ActiveGaugesRequest { - const obj = createBaseActiveGaugesRequest(); - if (isSet(object.pagination)) obj.pagination = PageRequest.fromJSON(object.pagination); - return obj; + return { + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined + }; }, toJSON(message: ActiveGaugesRequest): JsonSafe<ActiveGaugesRequest> { const obj: any = {}; @@ -858,9 +909,7 @@ export const ActiveGaugesRequest = { }, fromPartial(object: DeepPartial<ActiveGaugesRequest>): ActiveGaugesRequest { const message = createBaseActiveGaugesRequest(); - if (object.pagination !== undefined && object.pagination !== null) { - message.pagination = PageRequest.fromPartial(object.pagination); - } + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageRequest.fromPartial(object.pagination) : undefined; return message; }, fromSDK(object: ActiveGaugesRequestSDKType): ActiveGaugesRequest { @@ -950,10 +999,10 @@ export const ActiveGaugesResponse = { return message; }, fromJSON(object: any): ActiveGaugesResponse { - const obj = createBaseActiveGaugesResponse(); - if (Array.isArray(object?.data)) obj.data = object.data.map((e: any) => Gauge.fromJSON(e)); - if (isSet(object.pagination)) obj.pagination = PageResponse.fromJSON(object.pagination); - return obj; + return { + data: Array.isArray(object?.data) ? object.data.map((e: any) => Gauge.fromJSON(e)) : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined + }; }, toJSON(message: ActiveGaugesResponse): JsonSafe<ActiveGaugesResponse> { const obj: any = {}; @@ -968,9 +1017,7 @@ export const ActiveGaugesResponse = { fromPartial(object: DeepPartial<ActiveGaugesResponse>): ActiveGaugesResponse { const message = createBaseActiveGaugesResponse(); message.data = object.data?.map(e => Gauge.fromPartial(e)) || []; - if (object.pagination !== undefined && object.pagination !== null) { - message.pagination = PageResponse.fromPartial(object.pagination); - } + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageResponse.fromPartial(object.pagination) : undefined; return message; }, fromSDK(object: ActiveGaugesResponseSDKType): ActiveGaugesResponse { @@ -1044,7 +1091,7 @@ function createBaseActiveGaugesPerDenomRequest(): ActiveGaugesPerDenomRequest { export const ActiveGaugesPerDenomRequest = { typeUrl: "/osmosis.incentives.ActiveGaugesPerDenomRequest", encode(message: ActiveGaugesPerDenomRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.denom !== undefined) { + if (message.denom !== "") { writer.uint32(10).string(message.denom); } if (message.pagination !== undefined) { @@ -1073,10 +1120,10 @@ export const ActiveGaugesPerDenomRequest = { return message; }, fromJSON(object: any): ActiveGaugesPerDenomRequest { - const obj = createBaseActiveGaugesPerDenomRequest(); - if (isSet(object.denom)) obj.denom = String(object.denom); - if (isSet(object.pagination)) obj.pagination = PageRequest.fromJSON(object.pagination); - return obj; + return { + denom: isSet(object.denom) ? String(object.denom) : "", + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined + }; }, toJSON(message: ActiveGaugesPerDenomRequest): JsonSafe<ActiveGaugesPerDenomRequest> { const obj: any = {}; @@ -1087,9 +1134,7 @@ export const ActiveGaugesPerDenomRequest = { fromPartial(object: DeepPartial<ActiveGaugesPerDenomRequest>): ActiveGaugesPerDenomRequest { const message = createBaseActiveGaugesPerDenomRequest(); message.denom = object.denom ?? ""; - if (object.pagination !== undefined && object.pagination !== null) { - message.pagination = PageRequest.fromPartial(object.pagination); - } + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageRequest.fromPartial(object.pagination) : undefined; return message; }, fromSDK(object: ActiveGaugesPerDenomRequestSDKType): ActiveGaugesPerDenomRequest { @@ -1186,10 +1231,10 @@ export const ActiveGaugesPerDenomResponse = { return message; }, fromJSON(object: any): ActiveGaugesPerDenomResponse { - const obj = createBaseActiveGaugesPerDenomResponse(); - if (Array.isArray(object?.data)) obj.data = object.data.map((e: any) => Gauge.fromJSON(e)); - if (isSet(object.pagination)) obj.pagination = PageResponse.fromJSON(object.pagination); - return obj; + return { + data: Array.isArray(object?.data) ? object.data.map((e: any) => Gauge.fromJSON(e)) : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined + }; }, toJSON(message: ActiveGaugesPerDenomResponse): JsonSafe<ActiveGaugesPerDenomResponse> { const obj: any = {}; @@ -1204,9 +1249,7 @@ export const ActiveGaugesPerDenomResponse = { fromPartial(object: DeepPartial<ActiveGaugesPerDenomResponse>): ActiveGaugesPerDenomResponse { const message = createBaseActiveGaugesPerDenomResponse(); message.data = object.data?.map(e => Gauge.fromPartial(e)) || []; - if (object.pagination !== undefined && object.pagination !== null) { - message.pagination = PageResponse.fromPartial(object.pagination); - } + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageResponse.fromPartial(object.pagination) : undefined; return message; }, fromSDK(object: ActiveGaugesPerDenomResponseSDKType): ActiveGaugesPerDenomResponse { @@ -1302,9 +1345,9 @@ export const UpcomingGaugesRequest = { return message; }, fromJSON(object: any): UpcomingGaugesRequest { - const obj = createBaseUpcomingGaugesRequest(); - if (isSet(object.pagination)) obj.pagination = PageRequest.fromJSON(object.pagination); - return obj; + return { + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined + }; }, toJSON(message: UpcomingGaugesRequest): JsonSafe<UpcomingGaugesRequest> { const obj: any = {}; @@ -1313,9 +1356,7 @@ export const UpcomingGaugesRequest = { }, fromPartial(object: DeepPartial<UpcomingGaugesRequest>): UpcomingGaugesRequest { const message = createBaseUpcomingGaugesRequest(); - if (object.pagination !== undefined && object.pagination !== null) { - message.pagination = PageRequest.fromPartial(object.pagination); - } + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageRequest.fromPartial(object.pagination) : undefined; return message; }, fromSDK(object: UpcomingGaugesRequestSDKType): UpcomingGaugesRequest { @@ -1405,10 +1446,10 @@ export const UpcomingGaugesResponse = { return message; }, fromJSON(object: any): UpcomingGaugesResponse { - const obj = createBaseUpcomingGaugesResponse(); - if (Array.isArray(object?.data)) obj.data = object.data.map((e: any) => Gauge.fromJSON(e)); - if (isSet(object.pagination)) obj.pagination = PageResponse.fromJSON(object.pagination); - return obj; + return { + data: Array.isArray(object?.data) ? object.data.map((e: any) => Gauge.fromJSON(e)) : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined + }; }, toJSON(message: UpcomingGaugesResponse): JsonSafe<UpcomingGaugesResponse> { const obj: any = {}; @@ -1423,9 +1464,7 @@ export const UpcomingGaugesResponse = { fromPartial(object: DeepPartial<UpcomingGaugesResponse>): UpcomingGaugesResponse { const message = createBaseUpcomingGaugesResponse(); message.data = object.data?.map(e => Gauge.fromPartial(e)) || []; - if (object.pagination !== undefined && object.pagination !== null) { - message.pagination = PageResponse.fromPartial(object.pagination); - } + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageResponse.fromPartial(object.pagination) : undefined; return message; }, fromSDK(object: UpcomingGaugesResponseSDKType): UpcomingGaugesResponse { @@ -1499,7 +1538,7 @@ function createBaseUpcomingGaugesPerDenomRequest(): UpcomingGaugesPerDenomReques export const UpcomingGaugesPerDenomRequest = { typeUrl: "/osmosis.incentives.UpcomingGaugesPerDenomRequest", encode(message: UpcomingGaugesPerDenomRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.denom !== undefined) { + if (message.denom !== "") { writer.uint32(10).string(message.denom); } if (message.pagination !== undefined) { @@ -1528,10 +1567,10 @@ export const UpcomingGaugesPerDenomRequest = { return message; }, fromJSON(object: any): UpcomingGaugesPerDenomRequest { - const obj = createBaseUpcomingGaugesPerDenomRequest(); - if (isSet(object.denom)) obj.denom = String(object.denom); - if (isSet(object.pagination)) obj.pagination = PageRequest.fromJSON(object.pagination); - return obj; + return { + denom: isSet(object.denom) ? String(object.denom) : "", + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined + }; }, toJSON(message: UpcomingGaugesPerDenomRequest): JsonSafe<UpcomingGaugesPerDenomRequest> { const obj: any = {}; @@ -1542,9 +1581,7 @@ export const UpcomingGaugesPerDenomRequest = { fromPartial(object: DeepPartial<UpcomingGaugesPerDenomRequest>): UpcomingGaugesPerDenomRequest { const message = createBaseUpcomingGaugesPerDenomRequest(); message.denom = object.denom ?? ""; - if (object.pagination !== undefined && object.pagination !== null) { - message.pagination = PageRequest.fromPartial(object.pagination); - } + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageRequest.fromPartial(object.pagination) : undefined; return message; }, fromSDK(object: UpcomingGaugesPerDenomRequestSDKType): UpcomingGaugesPerDenomRequest { @@ -1641,10 +1678,10 @@ export const UpcomingGaugesPerDenomResponse = { return message; }, fromJSON(object: any): UpcomingGaugesPerDenomResponse { - const obj = createBaseUpcomingGaugesPerDenomResponse(); - if (Array.isArray(object?.upcomingGauges)) obj.upcomingGauges = object.upcomingGauges.map((e: any) => Gauge.fromJSON(e)); - if (isSet(object.pagination)) obj.pagination = PageResponse.fromJSON(object.pagination); - return obj; + return { + upcomingGauges: Array.isArray(object?.upcomingGauges) ? object.upcomingGauges.map((e: any) => Gauge.fromJSON(e)) : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined + }; }, toJSON(message: UpcomingGaugesPerDenomResponse): JsonSafe<UpcomingGaugesPerDenomResponse> { const obj: any = {}; @@ -1659,9 +1696,7 @@ export const UpcomingGaugesPerDenomResponse = { fromPartial(object: DeepPartial<UpcomingGaugesPerDenomResponse>): UpcomingGaugesPerDenomResponse { const message = createBaseUpcomingGaugesPerDenomResponse(); message.upcomingGauges = object.upcomingGauges?.map(e => Gauge.fromPartial(e)) || []; - if (object.pagination !== undefined && object.pagination !== null) { - message.pagination = PageResponse.fromPartial(object.pagination); - } + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageResponse.fromPartial(object.pagination) : undefined; return message; }, fromSDK(object: UpcomingGaugesPerDenomResponseSDKType): UpcomingGaugesPerDenomResponse { @@ -1736,7 +1771,7 @@ function createBaseRewardsEstRequest(): RewardsEstRequest { export const RewardsEstRequest = { typeUrl: "/osmosis.incentives.RewardsEstRequest", encode(message: RewardsEstRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.owner !== undefined) { + if (message.owner !== "") { writer.uint32(10).string(message.owner); } writer.uint32(18).fork(); @@ -1744,7 +1779,7 @@ export const RewardsEstRequest = { writer.uint64(v); } writer.ldelim(); - if (message.endEpoch !== undefined) { + if (message.endEpoch !== BigInt(0)) { writer.uint32(24).int64(message.endEpoch); } return writer; @@ -1780,11 +1815,11 @@ export const RewardsEstRequest = { return message; }, fromJSON(object: any): RewardsEstRequest { - const obj = createBaseRewardsEstRequest(); - if (isSet(object.owner)) obj.owner = String(object.owner); - if (Array.isArray(object?.lockIds)) obj.lockIds = object.lockIds.map((e: any) => BigInt(e.toString())); - if (isSet(object.endEpoch)) obj.endEpoch = BigInt(object.endEpoch.toString()); - return obj; + return { + owner: isSet(object.owner) ? String(object.owner) : "", + lockIds: Array.isArray(object?.lockIds) ? object.lockIds.map((e: any) => BigInt(e.toString())) : [], + endEpoch: isSet(object.endEpoch) ? BigInt(object.endEpoch.toString()) : BigInt(0) + }; }, toJSON(message: RewardsEstRequest): JsonSafe<RewardsEstRequest> { const obj: any = {}; @@ -1801,9 +1836,7 @@ export const RewardsEstRequest = { const message = createBaseRewardsEstRequest(); message.owner = object.owner ?? ""; message.lockIds = object.lockIds?.map(e => BigInt(e.toString())) || []; - if (object.endEpoch !== undefined && object.endEpoch !== null) { - message.endEpoch = BigInt(object.endEpoch.toString()); - } + message.endEpoch = object.endEpoch !== undefined && object.endEpoch !== null ? BigInt(object.endEpoch.toString()) : BigInt(0); return message; }, fromSDK(object: RewardsEstRequestSDKType): RewardsEstRequest { @@ -1906,9 +1939,9 @@ export const RewardsEstResponse = { return message; }, fromJSON(object: any): RewardsEstResponse { - const obj = createBaseRewardsEstResponse(); - if (Array.isArray(object?.coins)) obj.coins = object.coins.map((e: any) => Coin.fromJSON(e)); - return obj; + return { + coins: Array.isArray(object?.coins) ? object.coins.map((e: any) => Coin.fromJSON(e)) : [] + }; }, toJSON(message: RewardsEstResponse): JsonSafe<RewardsEstResponse> { const obj: any = {}; @@ -2002,8 +2035,7 @@ export const QueryLockableDurationsRequest = { return message; }, fromJSON(_: any): QueryLockableDurationsRequest { - const obj = createBaseQueryLockableDurationsRequest(); - return obj; + return {}; }, toJSON(_: QueryLockableDurationsRequest): JsonSafe<QueryLockableDurationsRequest> { const obj: any = {}; @@ -2084,9 +2116,9 @@ export const QueryLockableDurationsResponse = { return message; }, fromJSON(object: any): QueryLockableDurationsResponse { - const obj = createBaseQueryLockableDurationsResponse(); - if (Array.isArray(object?.lockableDurations)) obj.lockableDurations = object.lockableDurations.map((e: any) => Duration.fromJSON(e)); - return obj; + return { + lockableDurations: Array.isArray(object?.lockableDurations) ? object.lockableDurations.map((e: any) => Duration.fromJSON(e)) : [] + }; }, toJSON(message: QueryLockableDurationsResponse): JsonSafe<QueryLockableDurationsResponse> { const obj: any = {}; diff --git a/__fixtures__/v-next/outputv4/osmosis/incentives/tx.amino.ts b/__fixtures__/v-next/outputv4/osmosis/incentives/tx.amino.ts index 155170724a..fc284ed915 100644 --- a/__fixtures__/v-next/outputv4/osmosis/incentives/tx.amino.ts +++ b/__fixtures__/v-next/outputv4/osmosis/incentives/tx.amino.ts @@ -1,10 +1,10 @@ //@ts-nocheck -import { QueryCondition, QueryConditionSDKType, lockQueryTypeFromJSON } from "../lockup/lock.js"; -import { Coin, CoinSDKType } from "../../cosmos/base/v1beta1/coin.js"; -import { Timestamp, TimestampSDKType } from "../../google/protobuf/timestamp.js"; +import { QueryCondition, QueryConditionSDKType, lockQueryTypeFromJSON } from "../lockup/lock"; +import { Coin, CoinSDKType } from "../../cosmos/base/v1beta1/coin"; +import { Timestamp, TimestampSDKType } from "../../google/protobuf/timestamp"; import { AminoMsg } from "@cosmjs/amino"; -import { Duration, DurationSDKType } from "../../google/protobuf/duration.js"; -import { MsgCreateGauge, MsgCreateGaugeSDKType, MsgAddToGauge, MsgAddToGaugeSDKType } from "./tx.js"; +import { Duration, DurationSDKType } from "../../google/protobuf/duration"; +import { MsgCreateGauge, MsgCreateGaugeSDKType, MsgAddToGauge, MsgAddToGaugeSDKType } from "./tx"; export interface MsgCreateGaugeAminoType extends AminoMsg { type: "osmosis/incentives/create-gauge"; value: { diff --git a/__fixtures__/v-next/outputv4/osmosis/incentives/tx.registry.ts b/__fixtures__/v-next/outputv4/osmosis/incentives/tx.registry.ts index a8b1e500fe..78505bdf4d 100644 --- a/__fixtures__/v-next/outputv4/osmosis/incentives/tx.registry.ts +++ b/__fixtures__/v-next/outputv4/osmosis/incentives/tx.registry.ts @@ -1,8 +1,8 @@ -import { QueryCondition, QueryConditionSDKType } from "../lockup/lock.js"; -import { Coin, CoinSDKType } from "../../cosmos/base/v1beta1/coin.js"; -import { Timestamp, TimestampSDKType } from "../../google/protobuf/timestamp.js"; +import { QueryCondition, QueryConditionSDKType } from "../lockup/lock"; +import { Coin, CoinSDKType } from "../../cosmos/base/v1beta1/coin"; +import { Timestamp, TimestampSDKType } from "../../google/protobuf/timestamp"; import { GeneratedType, Registry } from "@cosmjs/proto-signing"; -import { MsgCreateGauge, MsgCreateGaugeSDKType, MsgAddToGauge, MsgAddToGaugeSDKType } from "./tx.js"; +import { MsgCreateGauge, MsgCreateGaugeSDKType, MsgAddToGauge, MsgAddToGaugeSDKType } from "./tx"; export const registry: ReadonlyArray<[string, GeneratedType]> = [["/osmosis.incentives.MsgCreateGauge", MsgCreateGauge], ["/osmosis.incentives.MsgAddToGauge", MsgAddToGauge]]; export const load = (protoRegistry: Registry) => { registry.forEach(([typeUrl, mod]) => { diff --git a/__fixtures__/v-next/outputv4/osmosis/incentives/tx.rpc.msg.ts b/__fixtures__/v-next/outputv4/osmosis/incentives/tx.rpc.msg.ts index cfe8c47986..c3d761eac7 100644 --- a/__fixtures__/v-next/outputv4/osmosis/incentives/tx.rpc.msg.ts +++ b/__fixtures__/v-next/outputv4/osmosis/incentives/tx.rpc.msg.ts @@ -1,9 +1,9 @@ -import { QueryCondition, QueryConditionSDKType } from "../lockup/lock.js"; -import { Coin, CoinSDKType } from "../../cosmos/base/v1beta1/coin.js"; -import { Timestamp, TimestampSDKType } from "../../google/protobuf/timestamp.js"; -import { Rpc } from "../../helpers.js"; -import { BinaryReader } from "../../binary.js"; -import { MsgCreateGauge, MsgCreateGaugeSDKType, MsgCreateGaugeResponse, MsgCreateGaugeResponseSDKType, MsgAddToGauge, MsgAddToGaugeSDKType, MsgAddToGaugeResponse, MsgAddToGaugeResponseSDKType } from "./tx.js"; +import { QueryCondition, QueryConditionSDKType } from "../lockup/lock"; +import { Coin, CoinSDKType } from "../../cosmos/base/v1beta1/coin"; +import { Timestamp, TimestampSDKType } from "../../google/protobuf/timestamp"; +import { Rpc } from "../../helpers"; +import { BinaryReader } from "../../binary"; +import { MsgCreateGauge, MsgCreateGaugeSDKType, MsgCreateGaugeResponse, MsgCreateGaugeResponseSDKType, MsgAddToGauge, MsgAddToGaugeSDKType, MsgAddToGaugeResponse, MsgAddToGaugeResponseSDKType } from "./tx"; export interface Msg { createGauge(request: MsgCreateGauge): Promise<MsgCreateGaugeResponse>; addToGauge(request: MsgAddToGauge): Promise<MsgAddToGaugeResponse>; diff --git a/__fixtures__/v-next/outputv4/osmosis/incentives/tx.ts b/__fixtures__/v-next/outputv4/osmosis/incentives/tx.ts index e5dac7e6f7..3db6458bbd 100644 --- a/__fixtures__/v-next/outputv4/osmosis/incentives/tx.ts +++ b/__fixtures__/v-next/outputv4/osmosis/incentives/tx.ts @@ -1,9 +1,10 @@ -import { QueryCondition, QueryConditionSDKType } from "../lockup/lock.js"; -import { Coin, CoinSDKType } 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"; +import { QueryCondition, QueryConditionSDKType } from "../lockup/lock"; +import { Coin, CoinSDKType } from "../../cosmos/base/v1beta1/coin"; +import { Timestamp, TimestampSDKType } from "../../google/protobuf/timestamp"; +import { BinaryReader, BinaryWriter } from "../../binary"; +import { toTimestamp, fromTimestamp, isSet, DeepPartial } from "../../helpers"; +import { JsonSafe } from "../../json-safe"; +import { ComputedRef } from "vue"; export const protobufPackage = "osmosis.incentives"; /** MsgCreateGauge creates a gague to distribute rewards to users */ export interface MsgCreateGauge { @@ -32,6 +33,14 @@ export interface MsgCreateGauge { */ numEpochsPaidOver: bigint; } +export interface ReactiveMsgCreateGauge { + isPerpetual: ComputedRef<boolean>; + owner: ComputedRef<string>; + distributeTo: ComputedRef<QueryCondition>; + coins: ComputedRef<Coin[]>; + startTime: ComputedRef<Date>; + numEpochsPaidOver: ComputedRef<bigint>; +} export interface MsgCreateGaugeProtoMsg { typeUrl: "/osmosis.incentives.MsgCreateGauge"; value: Uint8Array; @@ -46,6 +55,7 @@ export interface MsgCreateGaugeSDKType { num_epochs_paid_over: bigint; } export interface MsgCreateGaugeResponse {} +export interface ReactiveMsgCreateGaugeResponse {} export interface MsgCreateGaugeResponseProtoMsg { typeUrl: "/osmosis.incentives.MsgCreateGaugeResponse"; value: Uint8Array; @@ -60,6 +70,11 @@ export interface MsgAddToGauge { /** rewards are the coin(s) to add to gauge */ rewards: Coin[]; } +export interface ReactiveMsgAddToGauge { + owner: ComputedRef<string>; + gaugeId: ComputedRef<bigint>; + rewards: ComputedRef<Coin[]>; +} export interface MsgAddToGaugeProtoMsg { typeUrl: "/osmosis.incentives.MsgAddToGauge"; value: Uint8Array; @@ -71,6 +86,7 @@ export interface MsgAddToGaugeSDKType { rewards: CoinSDKType[]; } export interface MsgAddToGaugeResponse {} +export interface ReactiveMsgAddToGaugeResponse {} export interface MsgAddToGaugeResponseProtoMsg { typeUrl: "/osmosis.incentives.MsgAddToGaugeResponse"; value: Uint8Array; @@ -89,10 +105,10 @@ function createBaseMsgCreateGauge(): MsgCreateGauge { export const MsgCreateGauge = { typeUrl: "/osmosis.incentives.MsgCreateGauge", encode(message: MsgCreateGauge, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.isPerpetual !== undefined) { + if (message.isPerpetual === true) { writer.uint32(8).bool(message.isPerpetual); } - if (message.owner !== undefined) { + if (message.owner !== "") { writer.uint32(18).string(message.owner); } if (message.distributeTo !== undefined) { @@ -104,7 +120,7 @@ export const MsgCreateGauge = { if (message.startTime !== undefined) { Timestamp.encode(toTimestamp(message.startTime), writer.uint32(42).fork()).ldelim(); } - if (message.numEpochsPaidOver !== undefined) { + if (message.numEpochsPaidOver !== BigInt(0)) { writer.uint32(48).uint64(message.numEpochsPaidOver); } return writer; @@ -142,14 +158,14 @@ export const MsgCreateGauge = { return message; }, fromJSON(object: any): MsgCreateGauge { - const obj = createBaseMsgCreateGauge(); - if (isSet(object.isPerpetual)) obj.isPerpetual = Boolean(object.isPerpetual); - if (isSet(object.owner)) obj.owner = String(object.owner); - if (isSet(object.distributeTo)) obj.distributeTo = QueryCondition.fromJSON(object.distributeTo); - if (Array.isArray(object?.coins)) obj.coins = object.coins.map((e: any) => Coin.fromJSON(e)); - if (isSet(object.startTime)) obj.startTime = new Date(object.startTime); - if (isSet(object.numEpochsPaidOver)) obj.numEpochsPaidOver = BigInt(object.numEpochsPaidOver.toString()); - return obj; + return { + isPerpetual: isSet(object.isPerpetual) ? Boolean(object.isPerpetual) : false, + owner: isSet(object.owner) ? String(object.owner) : "", + distributeTo: isSet(object.distributeTo) ? QueryCondition.fromJSON(object.distributeTo) : undefined, + coins: Array.isArray(object?.coins) ? object.coins.map((e: any) => Coin.fromJSON(e)) : [], + startTime: isSet(object.startTime) ? new Date(object.startTime) : undefined, + numEpochsPaidOver: isSet(object.numEpochsPaidOver) ? BigInt(object.numEpochsPaidOver.toString()) : BigInt(0) + }; }, toJSON(message: MsgCreateGauge): JsonSafe<MsgCreateGauge> { const obj: any = {}; @@ -169,14 +185,10 @@ export const MsgCreateGauge = { const message = createBaseMsgCreateGauge(); message.isPerpetual = object.isPerpetual ?? false; message.owner = object.owner ?? ""; - if (object.distributeTo !== undefined && object.distributeTo !== null) { - message.distributeTo = QueryCondition.fromPartial(object.distributeTo); - } + message.distributeTo = object.distributeTo !== undefined && object.distributeTo !== null ? QueryCondition.fromPartial(object.distributeTo) : undefined; message.coins = object.coins?.map(e => Coin.fromPartial(e)) || []; message.startTime = object.startTime ?? undefined; - if (object.numEpochsPaidOver !== undefined && object.numEpochsPaidOver !== null) { - message.numEpochsPaidOver = BigInt(object.numEpochsPaidOver.toString()); - } + message.numEpochsPaidOver = object.numEpochsPaidOver !== undefined && object.numEpochsPaidOver !== null ? BigInt(object.numEpochsPaidOver.toString()) : BigInt(0); return message; }, fromSDK(object: MsgCreateGaugeSDKType): MsgCreateGauge { @@ -292,8 +304,7 @@ export const MsgCreateGaugeResponse = { return message; }, fromJSON(_: any): MsgCreateGaugeResponse { - const obj = createBaseMsgCreateGaugeResponse(); - return obj; + return {}; }, toJSON(_: MsgCreateGaugeResponse): JsonSafe<MsgCreateGaugeResponse> { const obj: any = {}; @@ -353,10 +364,10 @@ function createBaseMsgAddToGauge(): MsgAddToGauge { export const MsgAddToGauge = { typeUrl: "/osmosis.incentives.MsgAddToGauge", encode(message: MsgAddToGauge, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.owner !== undefined) { + if (message.owner !== "") { writer.uint32(10).string(message.owner); } - if (message.gaugeId !== undefined) { + if (message.gaugeId !== BigInt(0)) { writer.uint32(16).uint64(message.gaugeId); } for (const v of message.rewards) { @@ -388,11 +399,11 @@ export const MsgAddToGauge = { return message; }, fromJSON(object: any): MsgAddToGauge { - const obj = createBaseMsgAddToGauge(); - if (isSet(object.owner)) obj.owner = String(object.owner); - if (isSet(object.gaugeId)) obj.gaugeId = BigInt(object.gaugeId.toString()); - if (Array.isArray(object?.rewards)) obj.rewards = object.rewards.map((e: any) => Coin.fromJSON(e)); - return obj; + return { + owner: isSet(object.owner) ? String(object.owner) : "", + gaugeId: isSet(object.gaugeId) ? BigInt(object.gaugeId.toString()) : BigInt(0), + rewards: Array.isArray(object?.rewards) ? object.rewards.map((e: any) => Coin.fromJSON(e)) : [] + }; }, toJSON(message: MsgAddToGauge): JsonSafe<MsgAddToGauge> { const obj: any = {}; @@ -408,9 +419,7 @@ export const MsgAddToGauge = { fromPartial(object: DeepPartial<MsgAddToGauge>): MsgAddToGauge { const message = createBaseMsgAddToGauge(); message.owner = object.owner ?? ""; - if (object.gaugeId !== undefined && object.gaugeId !== null) { - message.gaugeId = BigInt(object.gaugeId.toString()); - } + message.gaugeId = object.gaugeId !== undefined && object.gaugeId !== null ? BigInt(object.gaugeId.toString()) : BigInt(0); message.rewards = object.rewards?.map(e => Coin.fromPartial(e)) || []; return message; }, @@ -506,8 +515,7 @@ export const MsgAddToGaugeResponse = { return message; }, fromJSON(_: any): MsgAddToGaugeResponse { - const obj = createBaseMsgAddToGaugeResponse(); - return obj; + return {}; }, toJSON(_: MsgAddToGaugeResponse): JsonSafe<MsgAddToGaugeResponse> { const obj: any = {}; diff --git a/__fixtures__/v-next/outputv4/osmosis/lcd.ts b/__fixtures__/v-next/outputv4/osmosis/lcd.ts index 615e8fa721..a2e461470a 100644 --- a/__fixtures__/v-next/outputv4/osmosis/lcd.ts +++ b/__fixtures__/v-next/outputv4/osmosis/lcd.ts @@ -37,6 +37,11 @@ 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: { @@ -160,6 +165,36 @@ export const createLCDClient = async ({ v1beta1: new (await import("./txfees/v1beta1/query.lcd")).LCDQueryClient({ requestClient }) + }, + concentratedliquidity: { + v1beta1: new (await import("./concentrated-liquidity/pool-model/query.lcd")).LCDQueryClient({ + requestClient + }) + }, + cosmwasmpool: { + v1beta1: new (await import("./cosmwasmpool/v1beta1/query.lcd")).LCDQueryClient({ + requestClient + }) + }, + downtimedetector: { + v1beta1: new (await import("./downtime-detector/v1beta1/query.lcd")).LCDQueryClient({ + requestClient + }) + }, + poolmanager: { + v1beta1: new (await import("./poolmanager/v1beta1/query.lcd")).LCDQueryClient({ + requestClient + }) + }, + protorev: { + v1beta1: new (await import("./protorev/v1beta1/query.lcd")).LCDQueryClient({ + requestClient + }) + }, + valsetpref: { + v1beta1: new (await import("./valset-pref/v1beta1/query.lcd")).LCDQueryClient({ + requestClient + }) } } }; diff --git a/__fixtures__/v-next/outputv4/osmosis/lockup/genesis.ts b/__fixtures__/v-next/outputv4/osmosis/lockup/genesis.ts index 06a82678e2..35b0ae95ab 100644 --- a/__fixtures__/v-next/outputv4/osmosis/lockup/genesis.ts +++ b/__fixtures__/v-next/outputv4/osmosis/lockup/genesis.ts @@ -1,7 +1,8 @@ -import { PeriodLock, PeriodLockSDKType, SyntheticLock, SyntheticLockSDKType } from "./lock.js"; -import { BinaryReader, BinaryWriter } from "../../binary.js"; -import { isSet, DeepPartial } from "../../helpers.js"; -import { JsonSafe } from "../../json-safe.js"; +import { PeriodLock, PeriodLockSDKType, SyntheticLock, SyntheticLockSDKType } from "./lock"; +import { BinaryReader, BinaryWriter } from "../../binary"; +import { isSet, DeepPartial } from "../../helpers"; +import { JsonSafe } from "../../json-safe"; +import { ComputedRef } from "vue"; export const protobufPackage = "osmosis.lockup"; /** GenesisState defines the lockup module's genesis state. */ export interface GenesisState { @@ -9,6 +10,11 @@ export interface GenesisState { locks: PeriodLock[]; syntheticLocks: SyntheticLock[]; } +export interface ReactiveGenesisState { + lastLockId: ComputedRef<bigint>; + locks: ComputedRef<PeriodLock[]>; + syntheticLocks: ComputedRef<SyntheticLock[]>; +} export interface GenesisStateProtoMsg { typeUrl: "/osmosis.lockup.GenesisState"; value: Uint8Array; @@ -29,7 +35,7 @@ function createBaseGenesisState(): GenesisState { export const GenesisState = { typeUrl: "/osmosis.lockup.GenesisState", encode(message: GenesisState, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.lastLockId !== undefined) { + if (message.lastLockId !== BigInt(0)) { writer.uint32(8).uint64(message.lastLockId); } for (const v of message.locks) { @@ -64,11 +70,11 @@ export const GenesisState = { return message; }, fromJSON(object: any): GenesisState { - const obj = createBaseGenesisState(); - if (isSet(object.lastLockId)) obj.lastLockId = BigInt(object.lastLockId.toString()); - if (Array.isArray(object?.locks)) obj.locks = object.locks.map((e: any) => PeriodLock.fromJSON(e)); - if (Array.isArray(object?.syntheticLocks)) obj.syntheticLocks = object.syntheticLocks.map((e: any) => SyntheticLock.fromJSON(e)); - return obj; + return { + lastLockId: isSet(object.lastLockId) ? BigInt(object.lastLockId.toString()) : BigInt(0), + locks: Array.isArray(object?.locks) ? object.locks.map((e: any) => PeriodLock.fromJSON(e)) : [], + syntheticLocks: Array.isArray(object?.syntheticLocks) ? object.syntheticLocks.map((e: any) => SyntheticLock.fromJSON(e)) : [] + }; }, toJSON(message: GenesisState): JsonSafe<GenesisState> { const obj: any = {}; @@ -87,9 +93,7 @@ export const GenesisState = { }, fromPartial(object: DeepPartial<GenesisState>): GenesisState { const message = createBaseGenesisState(); - if (object.lastLockId !== undefined && object.lastLockId !== null) { - message.lastLockId = BigInt(object.lastLockId.toString()); - } + message.lastLockId = object.lastLockId !== undefined && object.lastLockId !== null ? BigInt(object.lastLockId.toString()) : BigInt(0); message.locks = object.locks?.map(e => PeriodLock.fromPartial(e)) || []; message.syntheticLocks = object.syntheticLocks?.map(e => SyntheticLock.fromPartial(e)) || []; return message; diff --git a/__fixtures__/v-next/outputv4/osmosis/lockup/lock.ts b/__fixtures__/v-next/outputv4/osmosis/lockup/lock.ts index e5b56ac098..99ef4a9f4d 100644 --- a/__fixtures__/v-next/outputv4/osmosis/lockup/lock.ts +++ b/__fixtures__/v-next/outputv4/osmosis/lockup/lock.ts @@ -1,9 +1,10 @@ -import { Duration, DurationSDKType } from "../../google/protobuf/duration.js"; -import { Timestamp, TimestampSDKType } from "../../google/protobuf/timestamp.js"; -import { Coin, CoinSDKType } from "../../cosmos/base/v1beta1/coin.js"; -import { BinaryReader, BinaryWriter } from "../../binary.js"; -import { toTimestamp, fromTimestamp, isSet, DeepPartial } from "../../helpers.js"; -import { JsonSafe } from "../../json-safe.js"; +import { Duration, DurationSDKType } from "../../google/protobuf/duration"; +import { Timestamp, TimestampSDKType } from "../../google/protobuf/timestamp"; +import { Coin, CoinSDKType } from "../../cosmos/base/v1beta1/coin"; +import { BinaryReader, BinaryWriter } from "../../binary"; +import { toTimestamp, fromTimestamp, isSet, DeepPartial } from "../../helpers"; +import { JsonSafe } from "../../json-safe"; +import { ComputedRef } from "vue"; export const protobufPackage = "osmosis.lockup"; /** * LockQueryType defines the type of the lock query that can @@ -73,6 +74,13 @@ export interface PeriodLock { /** Coins are the tokens locked within the lock, kept in the module account. */ coins: Coin[]; } +export interface ReactivePeriodLock { + iD: ComputedRef<bigint>; + owner: ComputedRef<string>; + duration: ComputedRef<Duration>; + endTime: ComputedRef<Date>; + coins: ComputedRef<Coin[]>; +} export interface PeriodLockProtoMsg { typeUrl: "/osmosis.lockup.PeriodLock"; value: Uint8Array; @@ -114,6 +122,12 @@ export interface QueryCondition { */ timestamp: Date; } +export interface ReactiveQueryCondition { + lockQueryType: ComputedRef<LockQueryType>; + denom: ComputedRef<string>; + duration: ComputedRef<Duration>; + timestamp: ComputedRef<Date>; +} export interface QueryConditionProtoMsg { typeUrl: "/osmosis.lockup.QueryCondition"; value: Uint8Array; @@ -157,6 +171,12 @@ export interface SyntheticLock { */ duration: Duration; } +export interface ReactiveSyntheticLock { + underlyingLockId: ComputedRef<bigint>; + synthDenom: ComputedRef<string>; + endTime: ComputedRef<Date>; + duration: ComputedRef<Duration>; +} export interface SyntheticLockProtoMsg { typeUrl: "/osmosis.lockup.SyntheticLock"; value: Uint8Array; @@ -185,10 +205,10 @@ function createBasePeriodLock(): PeriodLock { export const PeriodLock = { typeUrl: "/osmosis.lockup.PeriodLock", encode(message: PeriodLock, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.iD !== undefined) { + if (message.iD !== BigInt(0)) { writer.uint32(8).uint64(message.iD); } - if (message.owner !== undefined) { + if (message.owner !== "") { writer.uint32(18).string(message.owner); } if (message.duration !== undefined) { @@ -232,13 +252,13 @@ export const PeriodLock = { return message; }, fromJSON(object: any): PeriodLock { - const obj = createBasePeriodLock(); - if (isSet(object.iD)) obj.iD = BigInt(object.iD.toString()); - if (isSet(object.owner)) obj.owner = String(object.owner); - if (isSet(object.duration)) obj.duration = Duration.fromJSON(object.duration); - if (isSet(object.endTime)) obj.endTime = new Date(object.endTime); - if (Array.isArray(object?.coins)) obj.coins = object.coins.map((e: any) => Coin.fromJSON(e)); - return obj; + return { + iD: isSet(object.iD) ? BigInt(object.iD.toString()) : BigInt(0), + owner: isSet(object.owner) ? String(object.owner) : "", + duration: isSet(object.duration) ? Duration.fromJSON(object.duration) : undefined, + endTime: isSet(object.endTime) ? new Date(object.endTime) : undefined, + coins: Array.isArray(object?.coins) ? object.coins.map((e: any) => Coin.fromJSON(e)) : [] + }; }, toJSON(message: PeriodLock): JsonSafe<PeriodLock> { const obj: any = {}; @@ -255,13 +275,9 @@ export const PeriodLock = { }, fromPartial(object: DeepPartial<PeriodLock>): PeriodLock { const message = createBasePeriodLock(); - if (object.iD !== undefined && object.iD !== null) { - message.iD = BigInt(object.iD.toString()); - } + message.iD = object.iD !== undefined && object.iD !== null ? BigInt(object.iD.toString()) : BigInt(0); message.owner = object.owner ?? ""; - if (object.duration !== undefined && object.duration !== null) { - message.duration = Duration.fromPartial(object.duration); - } + message.duration = object.duration !== undefined && object.duration !== null ? Duration.fromPartial(object.duration) : undefined; message.endTime = object.endTime ?? undefined; message.coins = object.coins?.map(e => Coin.fromPartial(e)) || []; return message; @@ -363,7 +379,7 @@ export const QueryCondition = { if (message.lockQueryType !== 0) { writer.uint32(8).int32(message.lockQueryType); } - if (message.denom !== undefined) { + if (message.denom !== "") { writer.uint32(18).string(message.denom); } if (message.duration !== undefined) { @@ -401,12 +417,12 @@ export const QueryCondition = { return message; }, fromJSON(object: any): QueryCondition { - const obj = createBaseQueryCondition(); - if (isSet(object.lockQueryType)) obj.lockQueryType = lockQueryTypeFromJSON(object.lockQueryType); - if (isSet(object.denom)) obj.denom = String(object.denom); - if (isSet(object.duration)) obj.duration = Duration.fromJSON(object.duration); - if (isSet(object.timestamp)) obj.timestamp = new Date(object.timestamp); - return obj; + return { + lockQueryType: isSet(object.lockQueryType) ? lockQueryTypeFromJSON(object.lockQueryType) : -1, + denom: isSet(object.denom) ? String(object.denom) : "", + duration: isSet(object.duration) ? Duration.fromJSON(object.duration) : undefined, + timestamp: isSet(object.timestamp) ? new Date(object.timestamp) : undefined + }; }, toJSON(message: QueryCondition): JsonSafe<QueryCondition> { const obj: any = {}; @@ -420,9 +436,7 @@ export const QueryCondition = { const message = createBaseQueryCondition(); message.lockQueryType = object.lockQueryType ?? 0; message.denom = object.denom ?? ""; - if (object.duration !== undefined && object.duration !== null) { - message.duration = Duration.fromPartial(object.duration); - } + message.duration = object.duration !== undefined && object.duration !== null ? Duration.fromPartial(object.duration) : undefined; message.timestamp = object.timestamp ?? undefined; return message; }, @@ -507,10 +521,10 @@ function createBaseSyntheticLock(): SyntheticLock { export const SyntheticLock = { typeUrl: "/osmosis.lockup.SyntheticLock", encode(message: SyntheticLock, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.underlyingLockId !== undefined) { + if (message.underlyingLockId !== BigInt(0)) { writer.uint32(8).uint64(message.underlyingLockId); } - if (message.synthDenom !== undefined) { + if (message.synthDenom !== "") { writer.uint32(18).string(message.synthDenom); } if (message.endTime !== undefined) { @@ -548,12 +562,12 @@ export const SyntheticLock = { return message; }, fromJSON(object: any): SyntheticLock { - const obj = createBaseSyntheticLock(); - if (isSet(object.underlyingLockId)) obj.underlyingLockId = BigInt(object.underlyingLockId.toString()); - if (isSet(object.synthDenom)) obj.synthDenom = String(object.synthDenom); - if (isSet(object.endTime)) obj.endTime = new Date(object.endTime); - if (isSet(object.duration)) obj.duration = Duration.fromJSON(object.duration); - return obj; + return { + underlyingLockId: isSet(object.underlyingLockId) ? BigInt(object.underlyingLockId.toString()) : BigInt(0), + synthDenom: isSet(object.synthDenom) ? String(object.synthDenom) : "", + endTime: isSet(object.endTime) ? new Date(object.endTime) : undefined, + duration: isSet(object.duration) ? Duration.fromJSON(object.duration) : undefined + }; }, toJSON(message: SyntheticLock): JsonSafe<SyntheticLock> { const obj: any = {}; @@ -565,14 +579,10 @@ export const SyntheticLock = { }, fromPartial(object: DeepPartial<SyntheticLock>): SyntheticLock { const message = createBaseSyntheticLock(); - if (object.underlyingLockId !== undefined && object.underlyingLockId !== null) { - message.underlyingLockId = BigInt(object.underlyingLockId.toString()); - } + message.underlyingLockId = object.underlyingLockId !== undefined && object.underlyingLockId !== null ? BigInt(object.underlyingLockId.toString()) : BigInt(0); message.synthDenom = object.synthDenom ?? ""; message.endTime = object.endTime ?? undefined; - if (object.duration !== undefined && object.duration !== null) { - message.duration = Duration.fromPartial(object.duration); - } + message.duration = object.duration !== undefined && object.duration !== null ? Duration.fromPartial(object.duration) : undefined; return message; }, fromSDK(object: SyntheticLockSDKType): SyntheticLock { diff --git a/__fixtures__/v-next/outputv4/osmosis/lockup/params.ts b/__fixtures__/v-next/outputv4/osmosis/lockup/params.ts index ecf0202e72..18c13cf7d7 100644 --- a/__fixtures__/v-next/outputv4/osmosis/lockup/params.ts +++ b/__fixtures__/v-next/outputv4/osmosis/lockup/params.ts @@ -1,10 +1,14 @@ -import { BinaryReader, BinaryWriter } from "../../binary.js"; -import { JsonSafe } from "../../json-safe.js"; -import { DeepPartial } from "../../helpers.js"; +import { BinaryReader, BinaryWriter } from "../../binary"; +import { JsonSafe } from "../../json-safe"; +import { DeepPartial } from "../../helpers"; +import { ComputedRef } from "vue"; export const protobufPackage = "osmosis.lockup"; export interface Params { forceUnlockAllowedAddresses: string[]; } +export interface ReactiveParams { + forceUnlockAllowedAddresses: ComputedRef<string[]>; +} export interface ParamsProtoMsg { typeUrl: "/osmosis.lockup.Params"; value: Uint8Array; @@ -43,9 +47,9 @@ export const Params = { return message; }, fromJSON(object: any): Params { - const obj = createBaseParams(); - if (Array.isArray(object?.forceUnlockAllowedAddresses)) obj.forceUnlockAllowedAddresses = object.forceUnlockAllowedAddresses.map((e: any) => String(e)); - return obj; + return { + forceUnlockAllowedAddresses: Array.isArray(object?.forceUnlockAllowedAddresses) ? object.forceUnlockAllowedAddresses.map((e: any) => String(e)) : [] + }; }, toJSON(message: Params): JsonSafe<Params> { const obj: any = {}; diff --git a/__fixtures__/v-next/outputv4/osmosis/lockup/query.lcd.ts b/__fixtures__/v-next/outputv4/osmosis/lockup/query.lcd.ts index cf0a489706..590e072e26 100644 --- a/__fixtures__/v-next/outputv4/osmosis/lockup/query.lcd.ts +++ b/__fixtures__/v-next/outputv4/osmosis/lockup/query.lcd.ts @@ -1,10 +1,10 @@ -import { Timestamp, TimestampSDKType } from "../../google/protobuf/timestamp.js"; -import { Duration, DurationSDKType } from "../../google/protobuf/duration.js"; -import { Coin, CoinSDKType } from "../../cosmos/base/v1beta1/coin.js"; -import { PeriodLock, PeriodLockSDKType, SyntheticLock, SyntheticLockSDKType } from "./lock.js"; -import { Params, ParamsSDKType } from "./params.js"; +import { Timestamp, TimestampSDKType } from "../../google/protobuf/timestamp"; +import { Duration, DurationSDKType } from "../../google/protobuf/duration"; +import { Coin, CoinSDKType } from "../../cosmos/base/v1beta1/coin"; +import { PeriodLock, PeriodLockSDKType, SyntheticLock, SyntheticLockSDKType } from "./lock"; +import { Params, ParamsSDKType } from "./params"; import { LCDClient } from "@cosmology/lcd"; -import { ModuleBalanceRequest, ModuleBalanceRequestSDKType, ModuleBalanceResponse, ModuleBalanceResponseSDKType, ModuleLockedAmountRequest, ModuleLockedAmountRequestSDKType, ModuleLockedAmountResponse, ModuleLockedAmountResponseSDKType, AccountUnlockableCoinsRequest, AccountUnlockableCoinsRequestSDKType, AccountUnlockableCoinsResponse, AccountUnlockableCoinsResponseSDKType, AccountUnlockingCoinsRequest, AccountUnlockingCoinsRequestSDKType, AccountUnlockingCoinsResponse, AccountUnlockingCoinsResponseSDKType, AccountLockedCoinsRequest, AccountLockedCoinsRequestSDKType, AccountLockedCoinsResponse, AccountLockedCoinsResponseSDKType, AccountLockedPastTimeRequest, AccountLockedPastTimeRequestSDKType, AccountLockedPastTimeResponse, AccountLockedPastTimeResponseSDKType, AccountLockedPastTimeNotUnlockingOnlyRequest, AccountLockedPastTimeNotUnlockingOnlyRequestSDKType, AccountLockedPastTimeNotUnlockingOnlyResponse, AccountLockedPastTimeNotUnlockingOnlyResponseSDKType, AccountUnlockedBeforeTimeRequest, AccountUnlockedBeforeTimeRequestSDKType, AccountUnlockedBeforeTimeResponse, AccountUnlockedBeforeTimeResponseSDKType, AccountLockedPastTimeDenomRequest, AccountLockedPastTimeDenomRequestSDKType, AccountLockedPastTimeDenomResponse, AccountLockedPastTimeDenomResponseSDKType, LockedDenomRequest, LockedDenomRequestSDKType, LockedDenomResponse, LockedDenomResponseSDKType, LockedRequest, LockedRequestSDKType, LockedResponse, LockedResponseSDKType, SyntheticLockupsByLockupIDRequest, SyntheticLockupsByLockupIDRequestSDKType, SyntheticLockupsByLockupIDResponse, SyntheticLockupsByLockupIDResponseSDKType, AccountLockedLongerDurationRequest, AccountLockedLongerDurationRequestSDKType, AccountLockedLongerDurationResponse, AccountLockedLongerDurationResponseSDKType, AccountLockedDurationRequest, AccountLockedDurationRequestSDKType, AccountLockedDurationResponse, AccountLockedDurationResponseSDKType, AccountLockedLongerDurationNotUnlockingOnlyRequest, AccountLockedLongerDurationNotUnlockingOnlyRequestSDKType, AccountLockedLongerDurationNotUnlockingOnlyResponse, AccountLockedLongerDurationNotUnlockingOnlyResponseSDKType, AccountLockedLongerDurationDenomRequest, AccountLockedLongerDurationDenomRequestSDKType, AccountLockedLongerDurationDenomResponse, AccountLockedLongerDurationDenomResponseSDKType, QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType } from "./query.js"; +import { ModuleBalanceRequest, ModuleBalanceRequestSDKType, ModuleBalanceResponse, ModuleBalanceResponseSDKType, ModuleLockedAmountRequest, ModuleLockedAmountRequestSDKType, ModuleLockedAmountResponse, ModuleLockedAmountResponseSDKType, AccountUnlockableCoinsRequest, AccountUnlockableCoinsRequestSDKType, AccountUnlockableCoinsResponse, AccountUnlockableCoinsResponseSDKType, AccountUnlockingCoinsRequest, AccountUnlockingCoinsRequestSDKType, AccountUnlockingCoinsResponse, AccountUnlockingCoinsResponseSDKType, AccountLockedCoinsRequest, AccountLockedCoinsRequestSDKType, AccountLockedCoinsResponse, AccountLockedCoinsResponseSDKType, AccountLockedPastTimeRequest, AccountLockedPastTimeRequestSDKType, AccountLockedPastTimeResponse, AccountLockedPastTimeResponseSDKType, AccountLockedPastTimeNotUnlockingOnlyRequest, AccountLockedPastTimeNotUnlockingOnlyRequestSDKType, AccountLockedPastTimeNotUnlockingOnlyResponse, AccountLockedPastTimeNotUnlockingOnlyResponseSDKType, AccountUnlockedBeforeTimeRequest, AccountUnlockedBeforeTimeRequestSDKType, AccountUnlockedBeforeTimeResponse, AccountUnlockedBeforeTimeResponseSDKType, AccountLockedPastTimeDenomRequest, AccountLockedPastTimeDenomRequestSDKType, AccountLockedPastTimeDenomResponse, AccountLockedPastTimeDenomResponseSDKType, LockedDenomRequest, LockedDenomRequestSDKType, LockedDenomResponse, LockedDenomResponseSDKType, LockedRequest, LockedRequestSDKType, LockedResponse, LockedResponseSDKType, SyntheticLockupsByLockupIDRequest, SyntheticLockupsByLockupIDRequestSDKType, SyntheticLockupsByLockupIDResponse, SyntheticLockupsByLockupIDResponseSDKType, AccountLockedLongerDurationRequest, AccountLockedLongerDurationRequestSDKType, AccountLockedLongerDurationResponse, AccountLockedLongerDurationResponseSDKType, AccountLockedDurationRequest, AccountLockedDurationRequestSDKType, AccountLockedDurationResponse, AccountLockedDurationResponseSDKType, AccountLockedLongerDurationNotUnlockingOnlyRequest, AccountLockedLongerDurationNotUnlockingOnlyRequestSDKType, AccountLockedLongerDurationNotUnlockingOnlyResponse, AccountLockedLongerDurationNotUnlockingOnlyResponseSDKType, AccountLockedLongerDurationDenomRequest, AccountLockedLongerDurationDenomRequestSDKType, AccountLockedLongerDurationDenomResponse, AccountLockedLongerDurationDenomResponseSDKType, QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType } from "./query"; export class LCDQueryClient { req: LCDClient; constructor({ diff --git a/__fixtures__/v-next/outputv4/osmosis/lockup/query.rpc.Query.ts b/__fixtures__/v-next/outputv4/osmosis/lockup/query.rpc.Query.ts index 5834f9b405..03f8b1acd1 100644 --- a/__fixtures__/v-next/outputv4/osmosis/lockup/query.rpc.Query.ts +++ b/__fixtures__/v-next/outputv4/osmosis/lockup/query.rpc.Query.ts @@ -1,12 +1,12 @@ -import { Timestamp, TimestampSDKType } from "../../google/protobuf/timestamp.js"; -import { Duration, DurationSDKType } from "../../google/protobuf/duration.js"; -import { Coin, CoinSDKType } from "../../cosmos/base/v1beta1/coin.js"; -import { PeriodLock, PeriodLockSDKType, SyntheticLock, SyntheticLockSDKType } from "./lock.js"; -import { Params, ParamsSDKType } from "./params.js"; -import { Rpc } from "../../helpers.js"; -import { BinaryReader } from "../../binary.js"; +import { Timestamp, TimestampSDKType } from "../../google/protobuf/timestamp"; +import { Duration, DurationSDKType } from "../../google/protobuf/duration"; +import { Coin, CoinSDKType } from "../../cosmos/base/v1beta1/coin"; +import { PeriodLock, PeriodLockSDKType, SyntheticLock, SyntheticLockSDKType } from "./lock"; +import { Params, ParamsSDKType } from "./params"; +import { Rpc } from "../../helpers"; +import { BinaryReader } from "../../binary"; import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; -import { ModuleBalanceRequest, ModuleBalanceRequestSDKType, ModuleBalanceResponse, ModuleBalanceResponseSDKType, ModuleLockedAmountRequest, ModuleLockedAmountRequestSDKType, ModuleLockedAmountResponse, ModuleLockedAmountResponseSDKType, AccountUnlockableCoinsRequest, AccountUnlockableCoinsRequestSDKType, AccountUnlockableCoinsResponse, AccountUnlockableCoinsResponseSDKType, AccountUnlockingCoinsRequest, AccountUnlockingCoinsRequestSDKType, AccountUnlockingCoinsResponse, AccountUnlockingCoinsResponseSDKType, AccountLockedCoinsRequest, AccountLockedCoinsRequestSDKType, AccountLockedCoinsResponse, AccountLockedCoinsResponseSDKType, AccountLockedPastTimeRequest, AccountLockedPastTimeRequestSDKType, AccountLockedPastTimeResponse, AccountLockedPastTimeResponseSDKType, AccountLockedPastTimeNotUnlockingOnlyRequest, AccountLockedPastTimeNotUnlockingOnlyRequestSDKType, AccountLockedPastTimeNotUnlockingOnlyResponse, AccountLockedPastTimeNotUnlockingOnlyResponseSDKType, AccountUnlockedBeforeTimeRequest, AccountUnlockedBeforeTimeRequestSDKType, AccountUnlockedBeforeTimeResponse, AccountUnlockedBeforeTimeResponseSDKType, AccountLockedPastTimeDenomRequest, AccountLockedPastTimeDenomRequestSDKType, AccountLockedPastTimeDenomResponse, AccountLockedPastTimeDenomResponseSDKType, LockedDenomRequest, LockedDenomRequestSDKType, LockedDenomResponse, LockedDenomResponseSDKType, LockedRequest, LockedRequestSDKType, LockedResponse, LockedResponseSDKType, SyntheticLockupsByLockupIDRequest, SyntheticLockupsByLockupIDRequestSDKType, SyntheticLockupsByLockupIDResponse, SyntheticLockupsByLockupIDResponseSDKType, AccountLockedLongerDurationRequest, AccountLockedLongerDurationRequestSDKType, AccountLockedLongerDurationResponse, AccountLockedLongerDurationResponseSDKType, AccountLockedDurationRequest, AccountLockedDurationRequestSDKType, AccountLockedDurationResponse, AccountLockedDurationResponseSDKType, AccountLockedLongerDurationNotUnlockingOnlyRequest, AccountLockedLongerDurationNotUnlockingOnlyRequestSDKType, AccountLockedLongerDurationNotUnlockingOnlyResponse, AccountLockedLongerDurationNotUnlockingOnlyResponseSDKType, AccountLockedLongerDurationDenomRequest, AccountLockedLongerDurationDenomRequestSDKType, AccountLockedLongerDurationDenomResponse, AccountLockedLongerDurationDenomResponseSDKType, QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType } from "./query.js"; +import { ModuleBalanceRequest, ModuleBalanceRequestSDKType, ModuleBalanceResponse, ModuleBalanceResponseSDKType, ModuleLockedAmountRequest, ModuleLockedAmountRequestSDKType, ModuleLockedAmountResponse, ModuleLockedAmountResponseSDKType, AccountUnlockableCoinsRequest, AccountUnlockableCoinsRequestSDKType, AccountUnlockableCoinsResponse, AccountUnlockableCoinsResponseSDKType, AccountUnlockingCoinsRequest, AccountUnlockingCoinsRequestSDKType, AccountUnlockingCoinsResponse, AccountUnlockingCoinsResponseSDKType, AccountLockedCoinsRequest, AccountLockedCoinsRequestSDKType, AccountLockedCoinsResponse, AccountLockedCoinsResponseSDKType, AccountLockedPastTimeRequest, AccountLockedPastTimeRequestSDKType, AccountLockedPastTimeResponse, AccountLockedPastTimeResponseSDKType, AccountLockedPastTimeNotUnlockingOnlyRequest, AccountLockedPastTimeNotUnlockingOnlyRequestSDKType, AccountLockedPastTimeNotUnlockingOnlyResponse, AccountLockedPastTimeNotUnlockingOnlyResponseSDKType, AccountUnlockedBeforeTimeRequest, AccountUnlockedBeforeTimeRequestSDKType, AccountUnlockedBeforeTimeResponse, AccountUnlockedBeforeTimeResponseSDKType, AccountLockedPastTimeDenomRequest, AccountLockedPastTimeDenomRequestSDKType, AccountLockedPastTimeDenomResponse, AccountLockedPastTimeDenomResponseSDKType, LockedDenomRequest, LockedDenomRequestSDKType, LockedDenomResponse, LockedDenomResponseSDKType, LockedRequest, LockedRequestSDKType, LockedResponse, LockedResponseSDKType, SyntheticLockupsByLockupIDRequest, SyntheticLockupsByLockupIDRequestSDKType, SyntheticLockupsByLockupIDResponse, SyntheticLockupsByLockupIDResponseSDKType, AccountLockedLongerDurationRequest, AccountLockedLongerDurationRequestSDKType, AccountLockedLongerDurationResponse, AccountLockedLongerDurationResponseSDKType, AccountLockedDurationRequest, AccountLockedDurationRequestSDKType, AccountLockedDurationResponse, AccountLockedDurationResponseSDKType, AccountLockedLongerDurationNotUnlockingOnlyRequest, AccountLockedLongerDurationNotUnlockingOnlyRequestSDKType, AccountLockedLongerDurationNotUnlockingOnlyResponse, AccountLockedLongerDurationNotUnlockingOnlyResponseSDKType, AccountLockedLongerDurationDenomRequest, AccountLockedLongerDurationDenomRequestSDKType, AccountLockedLongerDurationDenomResponse, AccountLockedLongerDurationDenomResponseSDKType, QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType, ReactiveQueryParamsRequest } from "./query"; /** Query defines the gRPC querier service. */ export interface Query { /** Return full balance of the module */ diff --git a/__fixtures__/v-next/outputv4/osmosis/lockup/query.ts b/__fixtures__/v-next/outputv4/osmosis/lockup/query.ts index aca2d21797..a4f5ca6893 100644 --- a/__fixtures__/v-next/outputv4/osmosis/lockup/query.ts +++ b/__fixtures__/v-next/outputv4/osmosis/lockup/query.ts @@ -1,13 +1,15 @@ -import { Timestamp, TimestampSDKType } from "../../google/protobuf/timestamp.js"; -import { Duration, DurationSDKType } from "../../google/protobuf/duration.js"; -import { Coin, CoinSDKType } from "../../cosmos/base/v1beta1/coin.js"; -import { PeriodLock, PeriodLockSDKType, SyntheticLock, SyntheticLockSDKType } from "./lock.js"; -import { Params, ParamsSDKType } from "./params.js"; -import { BinaryReader, BinaryWriter } from "../../binary.js"; -import { JsonSafe } from "../../json-safe.js"; -import { DeepPartial, isSet, toTimestamp, fromTimestamp } from "../../helpers.js"; +import { Timestamp, TimestampSDKType } from "../../google/protobuf/timestamp"; +import { Duration, DurationSDKType } from "../../google/protobuf/duration"; +import { Coin, CoinSDKType } from "../../cosmos/base/v1beta1/coin"; +import { PeriodLock, PeriodLockSDKType, SyntheticLock, SyntheticLockSDKType } from "./lock"; +import { Params, ParamsSDKType } from "./params"; +import { BinaryReader, BinaryWriter } from "../../binary"; +import { JsonSafe } from "../../json-safe"; +import { DeepPartial, isSet, toTimestamp, fromTimestamp } from "../../helpers"; +import { ComputedRef } from "vue"; export const protobufPackage = "osmosis.lockup"; export interface ModuleBalanceRequest {} +export interface ReactiveModuleBalanceRequest {} export interface ModuleBalanceRequestProtoMsg { typeUrl: "/osmosis.lockup.ModuleBalanceRequest"; value: Uint8Array; @@ -16,6 +18,9 @@ export interface ModuleBalanceRequestSDKType {} export interface ModuleBalanceResponse { coins: Coin[]; } +export interface ReactiveModuleBalanceResponse { + coins: ComputedRef<Coin[]>; +} export interface ModuleBalanceResponseProtoMsg { typeUrl: "/osmosis.lockup.ModuleBalanceResponse"; value: Uint8Array; @@ -24,6 +29,7 @@ export interface ModuleBalanceResponseSDKType { coins: CoinSDKType[]; } export interface ModuleLockedAmountRequest {} +export interface ReactiveModuleLockedAmountRequest {} export interface ModuleLockedAmountRequestProtoMsg { typeUrl: "/osmosis.lockup.ModuleLockedAmountRequest"; value: Uint8Array; @@ -32,6 +38,9 @@ export interface ModuleLockedAmountRequestSDKType {} export interface ModuleLockedAmountResponse { coins: Coin[]; } +export interface ReactiveModuleLockedAmountResponse { + coins: ComputedRef<Coin[]>; +} export interface ModuleLockedAmountResponseProtoMsg { typeUrl: "/osmosis.lockup.ModuleLockedAmountResponse"; value: Uint8Array; @@ -42,6 +51,9 @@ export interface ModuleLockedAmountResponseSDKType { export interface AccountUnlockableCoinsRequest { owner: string; } +export interface ReactiveAccountUnlockableCoinsRequest { + owner: ComputedRef<string>; +} export interface AccountUnlockableCoinsRequestProtoMsg { typeUrl: "/osmosis.lockup.AccountUnlockableCoinsRequest"; value: Uint8Array; @@ -52,6 +64,9 @@ export interface AccountUnlockableCoinsRequestSDKType { export interface AccountUnlockableCoinsResponse { coins: Coin[]; } +export interface ReactiveAccountUnlockableCoinsResponse { + coins: ComputedRef<Coin[]>; +} export interface AccountUnlockableCoinsResponseProtoMsg { typeUrl: "/osmosis.lockup.AccountUnlockableCoinsResponse"; value: Uint8Array; @@ -62,6 +77,9 @@ export interface AccountUnlockableCoinsResponseSDKType { export interface AccountUnlockingCoinsRequest { owner: string; } +export interface ReactiveAccountUnlockingCoinsRequest { + owner: ComputedRef<string>; +} export interface AccountUnlockingCoinsRequestProtoMsg { typeUrl: "/osmosis.lockup.AccountUnlockingCoinsRequest"; value: Uint8Array; @@ -72,6 +90,9 @@ export interface AccountUnlockingCoinsRequestSDKType { export interface AccountUnlockingCoinsResponse { coins: Coin[]; } +export interface ReactiveAccountUnlockingCoinsResponse { + coins: ComputedRef<Coin[]>; +} export interface AccountUnlockingCoinsResponseProtoMsg { typeUrl: "/osmosis.lockup.AccountUnlockingCoinsResponse"; value: Uint8Array; @@ -82,6 +103,9 @@ export interface AccountUnlockingCoinsResponseSDKType { export interface AccountLockedCoinsRequest { owner: string; } +export interface ReactiveAccountLockedCoinsRequest { + owner: ComputedRef<string>; +} export interface AccountLockedCoinsRequestProtoMsg { typeUrl: "/osmosis.lockup.AccountLockedCoinsRequest"; value: Uint8Array; @@ -92,6 +116,9 @@ export interface AccountLockedCoinsRequestSDKType { export interface AccountLockedCoinsResponse { coins: Coin[]; } +export interface ReactiveAccountLockedCoinsResponse { + coins: ComputedRef<Coin[]>; +} export interface AccountLockedCoinsResponseProtoMsg { typeUrl: "/osmosis.lockup.AccountLockedCoinsResponse"; value: Uint8Array; @@ -103,6 +130,10 @@ export interface AccountLockedPastTimeRequest { owner: string; timestamp: Date; } +export interface ReactiveAccountLockedPastTimeRequest { + owner: ComputedRef<string>; + timestamp: ComputedRef<Date>; +} export interface AccountLockedPastTimeRequestProtoMsg { typeUrl: "/osmosis.lockup.AccountLockedPastTimeRequest"; value: Uint8Array; @@ -114,6 +145,9 @@ export interface AccountLockedPastTimeRequestSDKType { export interface AccountLockedPastTimeResponse { locks: PeriodLock[]; } +export interface ReactiveAccountLockedPastTimeResponse { + locks: ComputedRef<PeriodLock[]>; +} export interface AccountLockedPastTimeResponseProtoMsg { typeUrl: "/osmosis.lockup.AccountLockedPastTimeResponse"; value: Uint8Array; @@ -125,6 +159,10 @@ export interface AccountLockedPastTimeNotUnlockingOnlyRequest { owner: string; timestamp: Date; } +export interface ReactiveAccountLockedPastTimeNotUnlockingOnlyRequest { + owner: ComputedRef<string>; + timestamp: ComputedRef<Date>; +} export interface AccountLockedPastTimeNotUnlockingOnlyRequestProtoMsg { typeUrl: "/osmosis.lockup.AccountLockedPastTimeNotUnlockingOnlyRequest"; value: Uint8Array; @@ -136,6 +174,9 @@ export interface AccountLockedPastTimeNotUnlockingOnlyRequestSDKType { export interface AccountLockedPastTimeNotUnlockingOnlyResponse { locks: PeriodLock[]; } +export interface ReactiveAccountLockedPastTimeNotUnlockingOnlyResponse { + locks: ComputedRef<PeriodLock[]>; +} export interface AccountLockedPastTimeNotUnlockingOnlyResponseProtoMsg { typeUrl: "/osmosis.lockup.AccountLockedPastTimeNotUnlockingOnlyResponse"; value: Uint8Array; @@ -147,6 +188,10 @@ export interface AccountUnlockedBeforeTimeRequest { owner: string; timestamp: Date; } +export interface ReactiveAccountUnlockedBeforeTimeRequest { + owner: ComputedRef<string>; + timestamp: ComputedRef<Date>; +} export interface AccountUnlockedBeforeTimeRequestProtoMsg { typeUrl: "/osmosis.lockup.AccountUnlockedBeforeTimeRequest"; value: Uint8Array; @@ -158,6 +203,9 @@ export interface AccountUnlockedBeforeTimeRequestSDKType { export interface AccountUnlockedBeforeTimeResponse { locks: PeriodLock[]; } +export interface ReactiveAccountUnlockedBeforeTimeResponse { + locks: ComputedRef<PeriodLock[]>; +} export interface AccountUnlockedBeforeTimeResponseProtoMsg { typeUrl: "/osmosis.lockup.AccountUnlockedBeforeTimeResponse"; value: Uint8Array; @@ -170,6 +218,11 @@ export interface AccountLockedPastTimeDenomRequest { timestamp: Date; denom: string; } +export interface ReactiveAccountLockedPastTimeDenomRequest { + owner: ComputedRef<string>; + timestamp: ComputedRef<Date>; + denom: ComputedRef<string>; +} export interface AccountLockedPastTimeDenomRequestProtoMsg { typeUrl: "/osmosis.lockup.AccountLockedPastTimeDenomRequest"; value: Uint8Array; @@ -182,6 +235,9 @@ export interface AccountLockedPastTimeDenomRequestSDKType { export interface AccountLockedPastTimeDenomResponse { locks: PeriodLock[]; } +export interface ReactiveAccountLockedPastTimeDenomResponse { + locks: ComputedRef<PeriodLock[]>; +} export interface AccountLockedPastTimeDenomResponseProtoMsg { typeUrl: "/osmosis.lockup.AccountLockedPastTimeDenomResponse"; value: Uint8Array; @@ -193,6 +249,10 @@ export interface LockedDenomRequest { denom: string; duration: Duration; } +export interface ReactiveLockedDenomRequest { + denom: ComputedRef<string>; + duration: ComputedRef<Duration>; +} export interface LockedDenomRequestProtoMsg { typeUrl: "/osmosis.lockup.LockedDenomRequest"; value: Uint8Array; @@ -204,6 +264,9 @@ export interface LockedDenomRequestSDKType { export interface LockedDenomResponse { amount: string; } +export interface ReactiveLockedDenomResponse { + amount: ComputedRef<string>; +} export interface LockedDenomResponseProtoMsg { typeUrl: "/osmosis.lockup.LockedDenomResponse"; value: Uint8Array; @@ -214,6 +277,9 @@ export interface LockedDenomResponseSDKType { export interface LockedRequest { lockId: bigint; } +export interface ReactiveLockedRequest { + lockId: ComputedRef<bigint>; +} export interface LockedRequestProtoMsg { typeUrl: "/osmosis.lockup.LockedRequest"; value: Uint8Array; @@ -224,6 +290,9 @@ export interface LockedRequestSDKType { export interface LockedResponse { lock?: PeriodLock; } +export interface ReactiveLockedResponse { + lock?: ComputedRef<PeriodLock>; +} export interface LockedResponseProtoMsg { typeUrl: "/osmosis.lockup.LockedResponse"; value: Uint8Array; @@ -234,6 +303,9 @@ export interface LockedResponseSDKType { export interface SyntheticLockupsByLockupIDRequest { lockId: bigint; } +export interface ReactiveSyntheticLockupsByLockupIDRequest { + lockId: ComputedRef<bigint>; +} export interface SyntheticLockupsByLockupIDRequestProtoMsg { typeUrl: "/osmosis.lockup.SyntheticLockupsByLockupIDRequest"; value: Uint8Array; @@ -244,6 +316,9 @@ export interface SyntheticLockupsByLockupIDRequestSDKType { export interface SyntheticLockupsByLockupIDResponse { syntheticLocks: SyntheticLock[]; } +export interface ReactiveSyntheticLockupsByLockupIDResponse { + syntheticLocks: ComputedRef<SyntheticLock[]>; +} export interface SyntheticLockupsByLockupIDResponseProtoMsg { typeUrl: "/osmosis.lockup.SyntheticLockupsByLockupIDResponse"; value: Uint8Array; @@ -255,6 +330,10 @@ export interface AccountLockedLongerDurationRequest { owner: string; duration: Duration; } +export interface ReactiveAccountLockedLongerDurationRequest { + owner: ComputedRef<string>; + duration: ComputedRef<Duration>; +} export interface AccountLockedLongerDurationRequestProtoMsg { typeUrl: "/osmosis.lockup.AccountLockedLongerDurationRequest"; value: Uint8Array; @@ -266,6 +345,9 @@ export interface AccountLockedLongerDurationRequestSDKType { export interface AccountLockedLongerDurationResponse { locks: PeriodLock[]; } +export interface ReactiveAccountLockedLongerDurationResponse { + locks: ComputedRef<PeriodLock[]>; +} export interface AccountLockedLongerDurationResponseProtoMsg { typeUrl: "/osmosis.lockup.AccountLockedLongerDurationResponse"; value: Uint8Array; @@ -277,6 +359,10 @@ export interface AccountLockedDurationRequest { owner: string; duration: Duration; } +export interface ReactiveAccountLockedDurationRequest { + owner: ComputedRef<string>; + duration: ComputedRef<Duration>; +} export interface AccountLockedDurationRequestProtoMsg { typeUrl: "/osmosis.lockup.AccountLockedDurationRequest"; value: Uint8Array; @@ -288,6 +374,9 @@ export interface AccountLockedDurationRequestSDKType { export interface AccountLockedDurationResponse { locks: PeriodLock[]; } +export interface ReactiveAccountLockedDurationResponse { + locks: ComputedRef<PeriodLock[]>; +} export interface AccountLockedDurationResponseProtoMsg { typeUrl: "/osmosis.lockup.AccountLockedDurationResponse"; value: Uint8Array; @@ -299,6 +388,10 @@ export interface AccountLockedLongerDurationNotUnlockingOnlyRequest { owner: string; duration: Duration; } +export interface ReactiveAccountLockedLongerDurationNotUnlockingOnlyRequest { + owner: ComputedRef<string>; + duration: ComputedRef<Duration>; +} export interface AccountLockedLongerDurationNotUnlockingOnlyRequestProtoMsg { typeUrl: "/osmosis.lockup.AccountLockedLongerDurationNotUnlockingOnlyRequest"; value: Uint8Array; @@ -310,6 +403,9 @@ export interface AccountLockedLongerDurationNotUnlockingOnlyRequestSDKType { export interface AccountLockedLongerDurationNotUnlockingOnlyResponse { locks: PeriodLock[]; } +export interface ReactiveAccountLockedLongerDurationNotUnlockingOnlyResponse { + locks: ComputedRef<PeriodLock[]>; +} export interface AccountLockedLongerDurationNotUnlockingOnlyResponseProtoMsg { typeUrl: "/osmosis.lockup.AccountLockedLongerDurationNotUnlockingOnlyResponse"; value: Uint8Array; @@ -322,6 +418,11 @@ export interface AccountLockedLongerDurationDenomRequest { duration: Duration; denom: string; } +export interface ReactiveAccountLockedLongerDurationDenomRequest { + owner: ComputedRef<string>; + duration: ComputedRef<Duration>; + denom: ComputedRef<string>; +} export interface AccountLockedLongerDurationDenomRequestProtoMsg { typeUrl: "/osmosis.lockup.AccountLockedLongerDurationDenomRequest"; value: Uint8Array; @@ -334,6 +435,9 @@ export interface AccountLockedLongerDurationDenomRequestSDKType { export interface AccountLockedLongerDurationDenomResponse { locks: PeriodLock[]; } +export interface ReactiveAccountLockedLongerDurationDenomResponse { + locks: ComputedRef<PeriodLock[]>; +} export interface AccountLockedLongerDurationDenomResponseProtoMsg { typeUrl: "/osmosis.lockup.AccountLockedLongerDurationDenomResponse"; value: Uint8Array; @@ -342,6 +446,7 @@ export interface AccountLockedLongerDurationDenomResponseSDKType { locks: PeriodLockSDKType[]; } export interface QueryParamsRequest {} +export interface ReactiveQueryParamsRequest {} export interface QueryParamsRequestProtoMsg { typeUrl: "/osmosis.lockup.QueryParamsRequest"; value: Uint8Array; @@ -350,6 +455,9 @@ export interface QueryParamsRequestSDKType {} export interface QueryParamsResponse { params: Params; } +export interface ReactiveQueryParamsResponse { + params: ComputedRef<Params>; +} export interface QueryParamsResponseProtoMsg { typeUrl: "/osmosis.lockup.QueryParamsResponse"; value: Uint8Array; @@ -380,8 +488,7 @@ export const ModuleBalanceRequest = { return message; }, fromJSON(_: any): ModuleBalanceRequest { - const obj = createBaseModuleBalanceRequest(); - return obj; + return {}; }, toJSON(_: ModuleBalanceRequest): JsonSafe<ModuleBalanceRequest> { const obj: any = {}; @@ -462,9 +569,9 @@ export const ModuleBalanceResponse = { return message; }, fromJSON(object: any): ModuleBalanceResponse { - const obj = createBaseModuleBalanceResponse(); - if (Array.isArray(object?.coins)) obj.coins = object.coins.map((e: any) => Coin.fromJSON(e)); - return obj; + return { + coins: Array.isArray(object?.coins) ? object.coins.map((e: any) => Coin.fromJSON(e)) : [] + }; }, toJSON(message: ModuleBalanceResponse): JsonSafe<ModuleBalanceResponse> { const obj: any = {}; @@ -558,8 +665,7 @@ export const ModuleLockedAmountRequest = { return message; }, fromJSON(_: any): ModuleLockedAmountRequest { - const obj = createBaseModuleLockedAmountRequest(); - return obj; + return {}; }, toJSON(_: ModuleLockedAmountRequest): JsonSafe<ModuleLockedAmountRequest> { const obj: any = {}; @@ -640,9 +746,9 @@ export const ModuleLockedAmountResponse = { return message; }, fromJSON(object: any): ModuleLockedAmountResponse { - const obj = createBaseModuleLockedAmountResponse(); - if (Array.isArray(object?.coins)) obj.coins = object.coins.map((e: any) => Coin.fromJSON(e)); - return obj; + return { + coins: Array.isArray(object?.coins) ? object.coins.map((e: any) => Coin.fromJSON(e)) : [] + }; }, toJSON(message: ModuleLockedAmountResponse): JsonSafe<ModuleLockedAmountResponse> { const obj: any = {}; @@ -721,7 +827,7 @@ function createBaseAccountUnlockableCoinsRequest(): AccountUnlockableCoinsReques export const AccountUnlockableCoinsRequest = { typeUrl: "/osmosis.lockup.AccountUnlockableCoinsRequest", encode(message: AccountUnlockableCoinsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.owner !== undefined) { + if (message.owner !== "") { writer.uint32(10).string(message.owner); } return writer; @@ -744,9 +850,9 @@ export const AccountUnlockableCoinsRequest = { return message; }, fromJSON(object: any): AccountUnlockableCoinsRequest { - const obj = createBaseAccountUnlockableCoinsRequest(); - if (isSet(object.owner)) obj.owner = String(object.owner); - return obj; + return { + owner: isSet(object.owner) ? String(object.owner) : "" + }; }, toJSON(message: AccountUnlockableCoinsRequest): JsonSafe<AccountUnlockableCoinsRequest> { const obj: any = {}; @@ -838,9 +944,9 @@ export const AccountUnlockableCoinsResponse = { return message; }, fromJSON(object: any): AccountUnlockableCoinsResponse { - const obj = createBaseAccountUnlockableCoinsResponse(); - if (Array.isArray(object?.coins)) obj.coins = object.coins.map((e: any) => Coin.fromJSON(e)); - return obj; + return { + coins: Array.isArray(object?.coins) ? object.coins.map((e: any) => Coin.fromJSON(e)) : [] + }; }, toJSON(message: AccountUnlockableCoinsResponse): JsonSafe<AccountUnlockableCoinsResponse> { const obj: any = {}; @@ -919,7 +1025,7 @@ function createBaseAccountUnlockingCoinsRequest(): AccountUnlockingCoinsRequest export const AccountUnlockingCoinsRequest = { typeUrl: "/osmosis.lockup.AccountUnlockingCoinsRequest", encode(message: AccountUnlockingCoinsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.owner !== undefined) { + if (message.owner !== "") { writer.uint32(10).string(message.owner); } return writer; @@ -942,9 +1048,9 @@ export const AccountUnlockingCoinsRequest = { return message; }, fromJSON(object: any): AccountUnlockingCoinsRequest { - const obj = createBaseAccountUnlockingCoinsRequest(); - if (isSet(object.owner)) obj.owner = String(object.owner); - return obj; + return { + owner: isSet(object.owner) ? String(object.owner) : "" + }; }, toJSON(message: AccountUnlockingCoinsRequest): JsonSafe<AccountUnlockingCoinsRequest> { const obj: any = {}; @@ -1036,9 +1142,9 @@ export const AccountUnlockingCoinsResponse = { return message; }, fromJSON(object: any): AccountUnlockingCoinsResponse { - const obj = createBaseAccountUnlockingCoinsResponse(); - if (Array.isArray(object?.coins)) obj.coins = object.coins.map((e: any) => Coin.fromJSON(e)); - return obj; + return { + coins: Array.isArray(object?.coins) ? object.coins.map((e: any) => Coin.fromJSON(e)) : [] + }; }, toJSON(message: AccountUnlockingCoinsResponse): JsonSafe<AccountUnlockingCoinsResponse> { const obj: any = {}; @@ -1117,7 +1223,7 @@ function createBaseAccountLockedCoinsRequest(): AccountLockedCoinsRequest { export const AccountLockedCoinsRequest = { typeUrl: "/osmosis.lockup.AccountLockedCoinsRequest", encode(message: AccountLockedCoinsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.owner !== undefined) { + if (message.owner !== "") { writer.uint32(10).string(message.owner); } return writer; @@ -1140,9 +1246,9 @@ export const AccountLockedCoinsRequest = { return message; }, fromJSON(object: any): AccountLockedCoinsRequest { - const obj = createBaseAccountLockedCoinsRequest(); - if (isSet(object.owner)) obj.owner = String(object.owner); - return obj; + return { + owner: isSet(object.owner) ? String(object.owner) : "" + }; }, toJSON(message: AccountLockedCoinsRequest): JsonSafe<AccountLockedCoinsRequest> { const obj: any = {}; @@ -1234,9 +1340,9 @@ export const AccountLockedCoinsResponse = { return message; }, fromJSON(object: any): AccountLockedCoinsResponse { - const obj = createBaseAccountLockedCoinsResponse(); - if (Array.isArray(object?.coins)) obj.coins = object.coins.map((e: any) => Coin.fromJSON(e)); - return obj; + return { + coins: Array.isArray(object?.coins) ? object.coins.map((e: any) => Coin.fromJSON(e)) : [] + }; }, toJSON(message: AccountLockedCoinsResponse): JsonSafe<AccountLockedCoinsResponse> { const obj: any = {}; @@ -1316,7 +1422,7 @@ function createBaseAccountLockedPastTimeRequest(): AccountLockedPastTimeRequest export const AccountLockedPastTimeRequest = { typeUrl: "/osmosis.lockup.AccountLockedPastTimeRequest", encode(message: AccountLockedPastTimeRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.owner !== undefined) { + if (message.owner !== "") { writer.uint32(10).string(message.owner); } if (message.timestamp !== undefined) { @@ -1345,10 +1451,10 @@ export const AccountLockedPastTimeRequest = { return message; }, fromJSON(object: any): AccountLockedPastTimeRequest { - const obj = createBaseAccountLockedPastTimeRequest(); - if (isSet(object.owner)) obj.owner = String(object.owner); - if (isSet(object.timestamp)) obj.timestamp = new Date(object.timestamp); - return obj; + return { + owner: isSet(object.owner) ? String(object.owner) : "", + timestamp: isSet(object.timestamp) ? new Date(object.timestamp) : undefined + }; }, toJSON(message: AccountLockedPastTimeRequest): JsonSafe<AccountLockedPastTimeRequest> { const obj: any = {}; @@ -1449,9 +1555,9 @@ export const AccountLockedPastTimeResponse = { return message; }, fromJSON(object: any): AccountLockedPastTimeResponse { - const obj = createBaseAccountLockedPastTimeResponse(); - if (Array.isArray(object?.locks)) obj.locks = object.locks.map((e: any) => PeriodLock.fromJSON(e)); - return obj; + return { + locks: Array.isArray(object?.locks) ? object.locks.map((e: any) => PeriodLock.fromJSON(e)) : [] + }; }, toJSON(message: AccountLockedPastTimeResponse): JsonSafe<AccountLockedPastTimeResponse> { const obj: any = {}; @@ -1531,7 +1637,7 @@ function createBaseAccountLockedPastTimeNotUnlockingOnlyRequest(): AccountLocked export const AccountLockedPastTimeNotUnlockingOnlyRequest = { typeUrl: "/osmosis.lockup.AccountLockedPastTimeNotUnlockingOnlyRequest", encode(message: AccountLockedPastTimeNotUnlockingOnlyRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.owner !== undefined) { + if (message.owner !== "") { writer.uint32(10).string(message.owner); } if (message.timestamp !== undefined) { @@ -1560,10 +1666,10 @@ export const AccountLockedPastTimeNotUnlockingOnlyRequest = { return message; }, fromJSON(object: any): AccountLockedPastTimeNotUnlockingOnlyRequest { - const obj = createBaseAccountLockedPastTimeNotUnlockingOnlyRequest(); - if (isSet(object.owner)) obj.owner = String(object.owner); - if (isSet(object.timestamp)) obj.timestamp = new Date(object.timestamp); - return obj; + return { + owner: isSet(object.owner) ? String(object.owner) : "", + timestamp: isSet(object.timestamp) ? new Date(object.timestamp) : undefined + }; }, toJSON(message: AccountLockedPastTimeNotUnlockingOnlyRequest): JsonSafe<AccountLockedPastTimeNotUnlockingOnlyRequest> { const obj: any = {}; @@ -1664,9 +1770,9 @@ export const AccountLockedPastTimeNotUnlockingOnlyResponse = { return message; }, fromJSON(object: any): AccountLockedPastTimeNotUnlockingOnlyResponse { - const obj = createBaseAccountLockedPastTimeNotUnlockingOnlyResponse(); - if (Array.isArray(object?.locks)) obj.locks = object.locks.map((e: any) => PeriodLock.fromJSON(e)); - return obj; + return { + locks: Array.isArray(object?.locks) ? object.locks.map((e: any) => PeriodLock.fromJSON(e)) : [] + }; }, toJSON(message: AccountLockedPastTimeNotUnlockingOnlyResponse): JsonSafe<AccountLockedPastTimeNotUnlockingOnlyResponse> { const obj: any = {}; @@ -1746,7 +1852,7 @@ function createBaseAccountUnlockedBeforeTimeRequest(): AccountUnlockedBeforeTime export const AccountUnlockedBeforeTimeRequest = { typeUrl: "/osmosis.lockup.AccountUnlockedBeforeTimeRequest", encode(message: AccountUnlockedBeforeTimeRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.owner !== undefined) { + if (message.owner !== "") { writer.uint32(10).string(message.owner); } if (message.timestamp !== undefined) { @@ -1775,10 +1881,10 @@ export const AccountUnlockedBeforeTimeRequest = { return message; }, fromJSON(object: any): AccountUnlockedBeforeTimeRequest { - const obj = createBaseAccountUnlockedBeforeTimeRequest(); - if (isSet(object.owner)) obj.owner = String(object.owner); - if (isSet(object.timestamp)) obj.timestamp = new Date(object.timestamp); - return obj; + return { + owner: isSet(object.owner) ? String(object.owner) : "", + timestamp: isSet(object.timestamp) ? new Date(object.timestamp) : undefined + }; }, toJSON(message: AccountUnlockedBeforeTimeRequest): JsonSafe<AccountUnlockedBeforeTimeRequest> { const obj: any = {}; @@ -1879,9 +1985,9 @@ export const AccountUnlockedBeforeTimeResponse = { return message; }, fromJSON(object: any): AccountUnlockedBeforeTimeResponse { - const obj = createBaseAccountUnlockedBeforeTimeResponse(); - if (Array.isArray(object?.locks)) obj.locks = object.locks.map((e: any) => PeriodLock.fromJSON(e)); - return obj; + return { + locks: Array.isArray(object?.locks) ? object.locks.map((e: any) => PeriodLock.fromJSON(e)) : [] + }; }, toJSON(message: AccountUnlockedBeforeTimeResponse): JsonSafe<AccountUnlockedBeforeTimeResponse> { const obj: any = {}; @@ -1962,13 +2068,13 @@ function createBaseAccountLockedPastTimeDenomRequest(): AccountLockedPastTimeDen export const AccountLockedPastTimeDenomRequest = { typeUrl: "/osmosis.lockup.AccountLockedPastTimeDenomRequest", encode(message: AccountLockedPastTimeDenomRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.owner !== undefined) { + if (message.owner !== "") { writer.uint32(10).string(message.owner); } if (message.timestamp !== undefined) { Timestamp.encode(toTimestamp(message.timestamp), writer.uint32(18).fork()).ldelim(); } - if (message.denom !== undefined) { + if (message.denom !== "") { writer.uint32(26).string(message.denom); } return writer; @@ -1997,11 +2103,11 @@ export const AccountLockedPastTimeDenomRequest = { return message; }, fromJSON(object: any): AccountLockedPastTimeDenomRequest { - const obj = createBaseAccountLockedPastTimeDenomRequest(); - if (isSet(object.owner)) obj.owner = String(object.owner); - if (isSet(object.timestamp)) obj.timestamp = new Date(object.timestamp); - if (isSet(object.denom)) obj.denom = String(object.denom); - return obj; + return { + owner: isSet(object.owner) ? String(object.owner) : "", + timestamp: isSet(object.timestamp) ? new Date(object.timestamp) : undefined, + denom: isSet(object.denom) ? String(object.denom) : "" + }; }, toJSON(message: AccountLockedPastTimeDenomRequest): JsonSafe<AccountLockedPastTimeDenomRequest> { const obj: any = {}; @@ -2111,9 +2217,9 @@ export const AccountLockedPastTimeDenomResponse = { return message; }, fromJSON(object: any): AccountLockedPastTimeDenomResponse { - const obj = createBaseAccountLockedPastTimeDenomResponse(); - if (Array.isArray(object?.locks)) obj.locks = object.locks.map((e: any) => PeriodLock.fromJSON(e)); - return obj; + return { + locks: Array.isArray(object?.locks) ? object.locks.map((e: any) => PeriodLock.fromJSON(e)) : [] + }; }, toJSON(message: AccountLockedPastTimeDenomResponse): JsonSafe<AccountLockedPastTimeDenomResponse> { const obj: any = {}; @@ -2193,7 +2299,7 @@ function createBaseLockedDenomRequest(): LockedDenomRequest { export const LockedDenomRequest = { typeUrl: "/osmosis.lockup.LockedDenomRequest", encode(message: LockedDenomRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.denom !== undefined) { + if (message.denom !== "") { writer.uint32(10).string(message.denom); } if (message.duration !== undefined) { @@ -2222,10 +2328,10 @@ export const LockedDenomRequest = { return message; }, fromJSON(object: any): LockedDenomRequest { - const obj = createBaseLockedDenomRequest(); - if (isSet(object.denom)) obj.denom = String(object.denom); - if (isSet(object.duration)) obj.duration = Duration.fromJSON(object.duration); - return obj; + return { + denom: isSet(object.denom) ? String(object.denom) : "", + duration: isSet(object.duration) ? Duration.fromJSON(object.duration) : undefined + }; }, toJSON(message: LockedDenomRequest): JsonSafe<LockedDenomRequest> { const obj: any = {}; @@ -2236,9 +2342,7 @@ export const LockedDenomRequest = { fromPartial(object: DeepPartial<LockedDenomRequest>): LockedDenomRequest { const message = createBaseLockedDenomRequest(); message.denom = object.denom ?? ""; - if (object.duration !== undefined && object.duration !== null) { - message.duration = Duration.fromPartial(object.duration); - } + message.duration = object.duration !== undefined && object.duration !== null ? Duration.fromPartial(object.duration) : undefined; return message; }, fromSDK(object: LockedDenomRequestSDKType): LockedDenomRequest { @@ -2305,7 +2409,7 @@ function createBaseLockedDenomResponse(): LockedDenomResponse { export const LockedDenomResponse = { typeUrl: "/osmosis.lockup.LockedDenomResponse", encode(message: LockedDenomResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.amount !== undefined) { + if (message.amount !== "") { writer.uint32(10).string(message.amount); } return writer; @@ -2328,9 +2432,9 @@ export const LockedDenomResponse = { return message; }, fromJSON(object: any): LockedDenomResponse { - const obj = createBaseLockedDenomResponse(); - if (isSet(object.amount)) obj.amount = String(object.amount); - return obj; + return { + amount: isSet(object.amount) ? String(object.amount) : "" + }; }, toJSON(message: LockedDenomResponse): JsonSafe<LockedDenomResponse> { const obj: any = {}; @@ -2399,7 +2503,7 @@ function createBaseLockedRequest(): LockedRequest { export const LockedRequest = { typeUrl: "/osmosis.lockup.LockedRequest", encode(message: LockedRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.lockId !== undefined) { + if (message.lockId !== BigInt(0)) { writer.uint32(8).uint64(message.lockId); } return writer; @@ -2422,9 +2526,9 @@ export const LockedRequest = { return message; }, fromJSON(object: any): LockedRequest { - const obj = createBaseLockedRequest(); - if (isSet(object.lockId)) obj.lockId = BigInt(object.lockId.toString()); - return obj; + return { + lockId: isSet(object.lockId) ? BigInt(object.lockId.toString()) : BigInt(0) + }; }, toJSON(message: LockedRequest): JsonSafe<LockedRequest> { const obj: any = {}; @@ -2433,9 +2537,7 @@ export const LockedRequest = { }, fromPartial(object: DeepPartial<LockedRequest>): LockedRequest { const message = createBaseLockedRequest(); - if (object.lockId !== undefined && object.lockId !== null) { - message.lockId = BigInt(object.lockId.toString()); - } + message.lockId = object.lockId !== undefined && object.lockId !== null ? BigInt(object.lockId.toString()) : BigInt(0); return message; }, fromSDK(object: LockedRequestSDKType): LockedRequest { @@ -2518,9 +2620,9 @@ export const LockedResponse = { return message; }, fromJSON(object: any): LockedResponse { - const obj = createBaseLockedResponse(); - if (isSet(object.lock)) obj.lock = PeriodLock.fromJSON(object.lock); - return obj; + return { + lock: isSet(object.lock) ? PeriodLock.fromJSON(object.lock) : undefined + }; }, toJSON(message: LockedResponse): JsonSafe<LockedResponse> { const obj: any = {}; @@ -2529,9 +2631,7 @@ export const LockedResponse = { }, fromPartial(object: DeepPartial<LockedResponse>): LockedResponse { const message = createBaseLockedResponse(); - if (object.lock !== undefined && object.lock !== null) { - message.lock = PeriodLock.fromPartial(object.lock); - } + message.lock = object.lock !== undefined && object.lock !== null ? PeriodLock.fromPartial(object.lock) : undefined; return message; }, fromSDK(object: LockedResponseSDKType): LockedResponse { @@ -2591,7 +2691,7 @@ function createBaseSyntheticLockupsByLockupIDRequest(): SyntheticLockupsByLockup export const SyntheticLockupsByLockupIDRequest = { typeUrl: "/osmosis.lockup.SyntheticLockupsByLockupIDRequest", encode(message: SyntheticLockupsByLockupIDRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.lockId !== undefined) { + if (message.lockId !== BigInt(0)) { writer.uint32(8).uint64(message.lockId); } return writer; @@ -2614,9 +2714,9 @@ export const SyntheticLockupsByLockupIDRequest = { return message; }, fromJSON(object: any): SyntheticLockupsByLockupIDRequest { - const obj = createBaseSyntheticLockupsByLockupIDRequest(); - if (isSet(object.lockId)) obj.lockId = BigInt(object.lockId.toString()); - return obj; + return { + lockId: isSet(object.lockId) ? BigInt(object.lockId.toString()) : BigInt(0) + }; }, toJSON(message: SyntheticLockupsByLockupIDRequest): JsonSafe<SyntheticLockupsByLockupIDRequest> { const obj: any = {}; @@ -2625,9 +2725,7 @@ export const SyntheticLockupsByLockupIDRequest = { }, fromPartial(object: DeepPartial<SyntheticLockupsByLockupIDRequest>): SyntheticLockupsByLockupIDRequest { const message = createBaseSyntheticLockupsByLockupIDRequest(); - if (object.lockId !== undefined && object.lockId !== null) { - message.lockId = BigInt(object.lockId.toString()); - } + message.lockId = object.lockId !== undefined && object.lockId !== null ? BigInt(object.lockId.toString()) : BigInt(0); return message; }, fromSDK(object: SyntheticLockupsByLockupIDRequestSDKType): SyntheticLockupsByLockupIDRequest { @@ -2710,9 +2808,9 @@ export const SyntheticLockupsByLockupIDResponse = { return message; }, fromJSON(object: any): SyntheticLockupsByLockupIDResponse { - const obj = createBaseSyntheticLockupsByLockupIDResponse(); - if (Array.isArray(object?.syntheticLocks)) obj.syntheticLocks = object.syntheticLocks.map((e: any) => SyntheticLock.fromJSON(e)); - return obj; + return { + syntheticLocks: Array.isArray(object?.syntheticLocks) ? object.syntheticLocks.map((e: any) => SyntheticLock.fromJSON(e)) : [] + }; }, toJSON(message: SyntheticLockupsByLockupIDResponse): JsonSafe<SyntheticLockupsByLockupIDResponse> { const obj: any = {}; @@ -2792,7 +2890,7 @@ function createBaseAccountLockedLongerDurationRequest(): AccountLockedLongerDura export const AccountLockedLongerDurationRequest = { typeUrl: "/osmosis.lockup.AccountLockedLongerDurationRequest", encode(message: AccountLockedLongerDurationRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.owner !== undefined) { + if (message.owner !== "") { writer.uint32(10).string(message.owner); } if (message.duration !== undefined) { @@ -2821,10 +2919,10 @@ export const AccountLockedLongerDurationRequest = { return message; }, fromJSON(object: any): AccountLockedLongerDurationRequest { - const obj = createBaseAccountLockedLongerDurationRequest(); - if (isSet(object.owner)) obj.owner = String(object.owner); - if (isSet(object.duration)) obj.duration = Duration.fromJSON(object.duration); - return obj; + return { + owner: isSet(object.owner) ? String(object.owner) : "", + duration: isSet(object.duration) ? Duration.fromJSON(object.duration) : undefined + }; }, toJSON(message: AccountLockedLongerDurationRequest): JsonSafe<AccountLockedLongerDurationRequest> { const obj: any = {}; @@ -2835,9 +2933,7 @@ export const AccountLockedLongerDurationRequest = { fromPartial(object: DeepPartial<AccountLockedLongerDurationRequest>): AccountLockedLongerDurationRequest { const message = createBaseAccountLockedLongerDurationRequest(); message.owner = object.owner ?? ""; - if (object.duration !== undefined && object.duration !== null) { - message.duration = Duration.fromPartial(object.duration); - } + message.duration = object.duration !== undefined && object.duration !== null ? Duration.fromPartial(object.duration) : undefined; return message; }, fromSDK(object: AccountLockedLongerDurationRequestSDKType): AccountLockedLongerDurationRequest { @@ -2927,9 +3023,9 @@ export const AccountLockedLongerDurationResponse = { return message; }, fromJSON(object: any): AccountLockedLongerDurationResponse { - const obj = createBaseAccountLockedLongerDurationResponse(); - if (Array.isArray(object?.locks)) obj.locks = object.locks.map((e: any) => PeriodLock.fromJSON(e)); - return obj; + return { + locks: Array.isArray(object?.locks) ? object.locks.map((e: any) => PeriodLock.fromJSON(e)) : [] + }; }, toJSON(message: AccountLockedLongerDurationResponse): JsonSafe<AccountLockedLongerDurationResponse> { const obj: any = {}; @@ -3009,7 +3105,7 @@ function createBaseAccountLockedDurationRequest(): AccountLockedDurationRequest export const AccountLockedDurationRequest = { typeUrl: "/osmosis.lockup.AccountLockedDurationRequest", encode(message: AccountLockedDurationRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.owner !== undefined) { + if (message.owner !== "") { writer.uint32(10).string(message.owner); } if (message.duration !== undefined) { @@ -3038,10 +3134,10 @@ export const AccountLockedDurationRequest = { return message; }, fromJSON(object: any): AccountLockedDurationRequest { - const obj = createBaseAccountLockedDurationRequest(); - if (isSet(object.owner)) obj.owner = String(object.owner); - if (isSet(object.duration)) obj.duration = Duration.fromJSON(object.duration); - return obj; + return { + owner: isSet(object.owner) ? String(object.owner) : "", + duration: isSet(object.duration) ? Duration.fromJSON(object.duration) : undefined + }; }, toJSON(message: AccountLockedDurationRequest): JsonSafe<AccountLockedDurationRequest> { const obj: any = {}; @@ -3052,9 +3148,7 @@ export const AccountLockedDurationRequest = { fromPartial(object: DeepPartial<AccountLockedDurationRequest>): AccountLockedDurationRequest { const message = createBaseAccountLockedDurationRequest(); message.owner = object.owner ?? ""; - if (object.duration !== undefined && object.duration !== null) { - message.duration = Duration.fromPartial(object.duration); - } + message.duration = object.duration !== undefined && object.duration !== null ? Duration.fromPartial(object.duration) : undefined; return message; }, fromSDK(object: AccountLockedDurationRequestSDKType): AccountLockedDurationRequest { @@ -3144,9 +3238,9 @@ export const AccountLockedDurationResponse = { return message; }, fromJSON(object: any): AccountLockedDurationResponse { - const obj = createBaseAccountLockedDurationResponse(); - if (Array.isArray(object?.locks)) obj.locks = object.locks.map((e: any) => PeriodLock.fromJSON(e)); - return obj; + return { + locks: Array.isArray(object?.locks) ? object.locks.map((e: any) => PeriodLock.fromJSON(e)) : [] + }; }, toJSON(message: AccountLockedDurationResponse): JsonSafe<AccountLockedDurationResponse> { const obj: any = {}; @@ -3226,7 +3320,7 @@ function createBaseAccountLockedLongerDurationNotUnlockingOnlyRequest(): Account export const AccountLockedLongerDurationNotUnlockingOnlyRequest = { typeUrl: "/osmosis.lockup.AccountLockedLongerDurationNotUnlockingOnlyRequest", encode(message: AccountLockedLongerDurationNotUnlockingOnlyRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.owner !== undefined) { + if (message.owner !== "") { writer.uint32(10).string(message.owner); } if (message.duration !== undefined) { @@ -3255,10 +3349,10 @@ export const AccountLockedLongerDurationNotUnlockingOnlyRequest = { return message; }, fromJSON(object: any): AccountLockedLongerDurationNotUnlockingOnlyRequest { - const obj = createBaseAccountLockedLongerDurationNotUnlockingOnlyRequest(); - if (isSet(object.owner)) obj.owner = String(object.owner); - if (isSet(object.duration)) obj.duration = Duration.fromJSON(object.duration); - return obj; + return { + owner: isSet(object.owner) ? String(object.owner) : "", + duration: isSet(object.duration) ? Duration.fromJSON(object.duration) : undefined + }; }, toJSON(message: AccountLockedLongerDurationNotUnlockingOnlyRequest): JsonSafe<AccountLockedLongerDurationNotUnlockingOnlyRequest> { const obj: any = {}; @@ -3269,9 +3363,7 @@ export const AccountLockedLongerDurationNotUnlockingOnlyRequest = { fromPartial(object: DeepPartial<AccountLockedLongerDurationNotUnlockingOnlyRequest>): AccountLockedLongerDurationNotUnlockingOnlyRequest { const message = createBaseAccountLockedLongerDurationNotUnlockingOnlyRequest(); message.owner = object.owner ?? ""; - if (object.duration !== undefined && object.duration !== null) { - message.duration = Duration.fromPartial(object.duration); - } + message.duration = object.duration !== undefined && object.duration !== null ? Duration.fromPartial(object.duration) : undefined; return message; }, fromSDK(object: AccountLockedLongerDurationNotUnlockingOnlyRequestSDKType): AccountLockedLongerDurationNotUnlockingOnlyRequest { @@ -3361,9 +3453,9 @@ export const AccountLockedLongerDurationNotUnlockingOnlyResponse = { return message; }, fromJSON(object: any): AccountLockedLongerDurationNotUnlockingOnlyResponse { - const obj = createBaseAccountLockedLongerDurationNotUnlockingOnlyResponse(); - if (Array.isArray(object?.locks)) obj.locks = object.locks.map((e: any) => PeriodLock.fromJSON(e)); - return obj; + return { + locks: Array.isArray(object?.locks) ? object.locks.map((e: any) => PeriodLock.fromJSON(e)) : [] + }; }, toJSON(message: AccountLockedLongerDurationNotUnlockingOnlyResponse): JsonSafe<AccountLockedLongerDurationNotUnlockingOnlyResponse> { const obj: any = {}; @@ -3444,13 +3536,13 @@ function createBaseAccountLockedLongerDurationDenomRequest(): AccountLockedLonge export const AccountLockedLongerDurationDenomRequest = { typeUrl: "/osmosis.lockup.AccountLockedLongerDurationDenomRequest", encode(message: AccountLockedLongerDurationDenomRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.owner !== undefined) { + if (message.owner !== "") { writer.uint32(10).string(message.owner); } if (message.duration !== undefined) { Duration.encode(message.duration, writer.uint32(18).fork()).ldelim(); } - if (message.denom !== undefined) { + if (message.denom !== "") { writer.uint32(26).string(message.denom); } return writer; @@ -3479,11 +3571,11 @@ export const AccountLockedLongerDurationDenomRequest = { return message; }, fromJSON(object: any): AccountLockedLongerDurationDenomRequest { - const obj = createBaseAccountLockedLongerDurationDenomRequest(); - if (isSet(object.owner)) obj.owner = String(object.owner); - if (isSet(object.duration)) obj.duration = Duration.fromJSON(object.duration); - if (isSet(object.denom)) obj.denom = String(object.denom); - return obj; + return { + owner: isSet(object.owner) ? String(object.owner) : "", + duration: isSet(object.duration) ? Duration.fromJSON(object.duration) : undefined, + denom: isSet(object.denom) ? String(object.denom) : "" + }; }, toJSON(message: AccountLockedLongerDurationDenomRequest): JsonSafe<AccountLockedLongerDurationDenomRequest> { const obj: any = {}; @@ -3495,9 +3587,7 @@ export const AccountLockedLongerDurationDenomRequest = { fromPartial(object: DeepPartial<AccountLockedLongerDurationDenomRequest>): AccountLockedLongerDurationDenomRequest { const message = createBaseAccountLockedLongerDurationDenomRequest(); message.owner = object.owner ?? ""; - if (object.duration !== undefined && object.duration !== null) { - message.duration = Duration.fromPartial(object.duration); - } + message.duration = object.duration !== undefined && object.duration !== null ? Duration.fromPartial(object.duration) : undefined; message.denom = object.denom ?? ""; return message; }, @@ -3595,9 +3685,9 @@ export const AccountLockedLongerDurationDenomResponse = { return message; }, fromJSON(object: any): AccountLockedLongerDurationDenomResponse { - const obj = createBaseAccountLockedLongerDurationDenomResponse(); - if (Array.isArray(object?.locks)) obj.locks = object.locks.map((e: any) => PeriodLock.fromJSON(e)); - return obj; + return { + locks: Array.isArray(object?.locks) ? object.locks.map((e: any) => PeriodLock.fromJSON(e)) : [] + }; }, toJSON(message: AccountLockedLongerDurationDenomResponse): JsonSafe<AccountLockedLongerDurationDenomResponse> { const obj: any = {}; @@ -3691,8 +3781,7 @@ export const QueryParamsRequest = { return message; }, fromJSON(_: any): QueryParamsRequest { - const obj = createBaseQueryParamsRequest(); - return obj; + return {}; }, toJSON(_: QueryParamsRequest): JsonSafe<QueryParamsRequest> { const obj: any = {}; @@ -3773,9 +3862,9 @@ export const QueryParamsResponse = { return message; }, fromJSON(object: any): QueryParamsResponse { - const obj = createBaseQueryParamsResponse(); - if (isSet(object.params)) obj.params = Params.fromJSON(object.params); - return obj; + return { + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined + }; }, toJSON(message: QueryParamsResponse): JsonSafe<QueryParamsResponse> { const obj: any = {}; @@ -3784,9 +3873,7 @@ export const QueryParamsResponse = { }, fromPartial(object: DeepPartial<QueryParamsResponse>): QueryParamsResponse { const message = createBaseQueryParamsResponse(); - if (object.params !== undefined && object.params !== null) { - message.params = Params.fromPartial(object.params); - } + message.params = object.params !== undefined && object.params !== null ? Params.fromPartial(object.params) : undefined; return message; }, fromSDK(object: QueryParamsResponseSDKType): QueryParamsResponse { diff --git a/__fixtures__/v-next/outputv4/osmosis/lockup/tx.amino.ts b/__fixtures__/v-next/outputv4/osmosis/lockup/tx.amino.ts index 2165745e9e..970624a329 100644 --- a/__fixtures__/v-next/outputv4/osmosis/lockup/tx.amino.ts +++ b/__fixtures__/v-next/outputv4/osmosis/lockup/tx.amino.ts @@ -1,9 +1,9 @@ //@ts-nocheck -import { Duration, DurationSDKType } from "../../google/protobuf/duration.js"; -import { Coin, CoinSDKType } from "../../cosmos/base/v1beta1/coin.js"; -import { PeriodLock, PeriodLockSDKType } from "./lock.js"; +import { Duration, DurationSDKType } from "../../google/protobuf/duration"; +import { Coin, CoinSDKType } from "../../cosmos/base/v1beta1/coin"; +import { PeriodLock, PeriodLockSDKType } from "./lock"; import { AminoMsg } from "@cosmjs/amino"; -import { MsgLockTokens, MsgLockTokensSDKType, MsgBeginUnlockingAll, MsgBeginUnlockingAllSDKType, MsgBeginUnlocking, MsgBeginUnlockingSDKType, MsgExtendLockup, MsgExtendLockupSDKType, MsgForceUnlock, MsgForceUnlockSDKType } from "./tx.js"; +import { MsgLockTokens, MsgLockTokensSDKType, MsgBeginUnlockingAll, MsgBeginUnlockingAllSDKType, MsgBeginUnlocking, MsgBeginUnlockingSDKType, MsgExtendLockup, MsgExtendLockupSDKType, MsgForceUnlock, MsgForceUnlockSDKType } from "./tx"; export interface MsgLockTokensAminoType extends AminoMsg { type: "osmosis/lockup/lock-tokens"; value: { diff --git a/__fixtures__/v-next/outputv4/osmosis/lockup/tx.registry.ts b/__fixtures__/v-next/outputv4/osmosis/lockup/tx.registry.ts index 6c9c0035d2..dda1657f40 100644 --- a/__fixtures__/v-next/outputv4/osmosis/lockup/tx.registry.ts +++ b/__fixtures__/v-next/outputv4/osmosis/lockup/tx.registry.ts @@ -1,8 +1,8 @@ -import { Duration, DurationSDKType } from "../../google/protobuf/duration.js"; -import { Coin, CoinSDKType } from "../../cosmos/base/v1beta1/coin.js"; -import { PeriodLock, PeriodLockSDKType } from "./lock.js"; +import { Duration, DurationSDKType } from "../../google/protobuf/duration"; +import { Coin, CoinSDKType } from "../../cosmos/base/v1beta1/coin"; +import { PeriodLock, PeriodLockSDKType } from "./lock"; import { GeneratedType, Registry } from "@cosmjs/proto-signing"; -import { MsgLockTokens, MsgLockTokensSDKType, MsgBeginUnlockingAll, MsgBeginUnlockingAllSDKType, MsgBeginUnlocking, MsgBeginUnlockingSDKType, MsgExtendLockup, MsgExtendLockupSDKType, MsgForceUnlock, MsgForceUnlockSDKType } from "./tx.js"; +import { MsgLockTokens, MsgLockTokensSDKType, MsgBeginUnlockingAll, MsgBeginUnlockingAllSDKType, MsgBeginUnlocking, MsgBeginUnlockingSDKType, MsgExtendLockup, MsgExtendLockupSDKType, MsgForceUnlock, MsgForceUnlockSDKType } from "./tx"; export const registry: ReadonlyArray<[string, GeneratedType]> = [["/osmosis.lockup.MsgLockTokens", MsgLockTokens], ["/osmosis.lockup.MsgBeginUnlockingAll", MsgBeginUnlockingAll], ["/osmosis.lockup.MsgBeginUnlocking", MsgBeginUnlocking], ["/osmosis.lockup.MsgExtendLockup", MsgExtendLockup], ["/osmosis.lockup.MsgForceUnlock", MsgForceUnlock]]; export const load = (protoRegistry: Registry) => { registry.forEach(([typeUrl, mod]) => { diff --git a/__fixtures__/v-next/outputv4/osmosis/lockup/tx.rpc.msg.ts b/__fixtures__/v-next/outputv4/osmosis/lockup/tx.rpc.msg.ts index 4f4ea38f2d..b6ed2eed29 100644 --- a/__fixtures__/v-next/outputv4/osmosis/lockup/tx.rpc.msg.ts +++ b/__fixtures__/v-next/outputv4/osmosis/lockup/tx.rpc.msg.ts @@ -1,9 +1,9 @@ -import { Duration, DurationSDKType } from "../../google/protobuf/duration.js"; -import { Coin, CoinSDKType } from "../../cosmos/base/v1beta1/coin.js"; -import { PeriodLock, PeriodLockSDKType } from "./lock.js"; -import { Rpc } from "../../helpers.js"; -import { BinaryReader } from "../../binary.js"; -import { MsgLockTokens, MsgLockTokensSDKType, MsgLockTokensResponse, MsgLockTokensResponseSDKType, MsgBeginUnlockingAll, MsgBeginUnlockingAllSDKType, MsgBeginUnlockingAllResponse, MsgBeginUnlockingAllResponseSDKType, MsgBeginUnlocking, MsgBeginUnlockingSDKType, MsgBeginUnlockingResponse, MsgBeginUnlockingResponseSDKType, MsgExtendLockup, MsgExtendLockupSDKType, MsgExtendLockupResponse, MsgExtendLockupResponseSDKType, MsgForceUnlock, MsgForceUnlockSDKType, MsgForceUnlockResponse, MsgForceUnlockResponseSDKType } from "./tx.js"; +import { Duration, DurationSDKType } from "../../google/protobuf/duration"; +import { Coin, CoinSDKType } from "../../cosmos/base/v1beta1/coin"; +import { PeriodLock, PeriodLockSDKType } from "./lock"; +import { Rpc } from "../../helpers"; +import { BinaryReader } from "../../binary"; +import { MsgLockTokens, MsgLockTokensSDKType, MsgLockTokensResponse, MsgLockTokensResponseSDKType, MsgBeginUnlockingAll, MsgBeginUnlockingAllSDKType, MsgBeginUnlockingAllResponse, MsgBeginUnlockingAllResponseSDKType, MsgBeginUnlocking, MsgBeginUnlockingSDKType, MsgBeginUnlockingResponse, MsgBeginUnlockingResponseSDKType, MsgExtendLockup, MsgExtendLockupSDKType, MsgExtendLockupResponse, MsgExtendLockupResponseSDKType, MsgForceUnlock, MsgForceUnlockSDKType, MsgForceUnlockResponse, MsgForceUnlockResponseSDKType } from "./tx"; /** Msg defines the Msg service. */ export interface Msg { /** LockTokens lock tokens */ diff --git a/__fixtures__/v-next/outputv4/osmosis/lockup/tx.ts b/__fixtures__/v-next/outputv4/osmosis/lockup/tx.ts index 8e941d29cb..1571a2311b 100644 --- a/__fixtures__/v-next/outputv4/osmosis/lockup/tx.ts +++ b/__fixtures__/v-next/outputv4/osmosis/lockup/tx.ts @@ -1,15 +1,21 @@ -import { Duration, DurationSDKType } from "../../google/protobuf/duration.js"; -import { Coin, CoinSDKType } from "../../cosmos/base/v1beta1/coin.js"; -import { PeriodLock, PeriodLockSDKType } from "./lock.js"; -import { BinaryReader, BinaryWriter } from "../../binary.js"; -import { isSet, DeepPartial } from "../../helpers.js"; -import { JsonSafe } from "../../json-safe.js"; +import { Duration, DurationSDKType } from "../../google/protobuf/duration"; +import { Coin, CoinSDKType } from "../../cosmos/base/v1beta1/coin"; +import { PeriodLock, PeriodLockSDKType } from "./lock"; +import { BinaryReader, BinaryWriter } from "../../binary"; +import { isSet, DeepPartial } from "../../helpers"; +import { JsonSafe } from "../../json-safe"; +import { ComputedRef } from "vue"; export const protobufPackage = "osmosis.lockup"; export interface MsgLockTokens { owner: string; duration: Duration; coins: Coin[]; } +export interface ReactiveMsgLockTokens { + owner: ComputedRef<string>; + duration: ComputedRef<Duration>; + coins: ComputedRef<Coin[]>; +} export interface MsgLockTokensProtoMsg { typeUrl: "/osmosis.lockup.MsgLockTokens"; value: Uint8Array; @@ -22,6 +28,9 @@ export interface MsgLockTokensSDKType { export interface MsgLockTokensResponse { iD: bigint; } +export interface ReactiveMsgLockTokensResponse { + iD: ComputedRef<bigint>; +} export interface MsgLockTokensResponseProtoMsg { typeUrl: "/osmosis.lockup.MsgLockTokensResponse"; value: Uint8Array; @@ -32,6 +41,9 @@ export interface MsgLockTokensResponseSDKType { export interface MsgBeginUnlockingAll { owner: string; } +export interface ReactiveMsgBeginUnlockingAll { + owner: ComputedRef<string>; +} export interface MsgBeginUnlockingAllProtoMsg { typeUrl: "/osmosis.lockup.MsgBeginUnlockingAll"; value: Uint8Array; @@ -42,6 +54,9 @@ export interface MsgBeginUnlockingAllSDKType { export interface MsgBeginUnlockingAllResponse { unlocks: PeriodLock[]; } +export interface ReactiveMsgBeginUnlockingAllResponse { + unlocks: ComputedRef<PeriodLock[]>; +} export interface MsgBeginUnlockingAllResponseProtoMsg { typeUrl: "/osmosis.lockup.MsgBeginUnlockingAllResponse"; value: Uint8Array; @@ -55,6 +70,11 @@ export interface MsgBeginUnlocking { /** Amount of unlocking coins. Unlock all if not set. */ coins: Coin[]; } +export interface ReactiveMsgBeginUnlocking { + owner: ComputedRef<string>; + iD: ComputedRef<bigint>; + coins: ComputedRef<Coin[]>; +} export interface MsgBeginUnlockingProtoMsg { typeUrl: "/osmosis.lockup.MsgBeginUnlocking"; value: Uint8Array; @@ -67,6 +87,9 @@ export interface MsgBeginUnlockingSDKType { export interface MsgBeginUnlockingResponse { success: boolean; } +export interface ReactiveMsgBeginUnlockingResponse { + success: ComputedRef<boolean>; +} export interface MsgBeginUnlockingResponseProtoMsg { typeUrl: "/osmosis.lockup.MsgBeginUnlockingResponse"; value: Uint8Array; @@ -87,6 +110,11 @@ export interface MsgExtendLockup { */ duration: Duration; } +export interface ReactiveMsgExtendLockup { + owner: ComputedRef<string>; + iD: ComputedRef<bigint>; + duration: ComputedRef<Duration>; +} export interface MsgExtendLockupProtoMsg { typeUrl: "/osmosis.lockup.MsgExtendLockup"; value: Uint8Array; @@ -103,6 +131,9 @@ export interface MsgExtendLockupSDKType { export interface MsgExtendLockupResponse { success: boolean; } +export interface ReactiveMsgExtendLockupResponse { + success: ComputedRef<boolean>; +} export interface MsgExtendLockupResponseProtoMsg { typeUrl: "/osmosis.lockup.MsgExtendLockupResponse"; value: Uint8Array; @@ -120,6 +151,11 @@ export interface MsgForceUnlock { /** Amount of unlocking coins. Unlock all if not set. */ coins: Coin[]; } +export interface ReactiveMsgForceUnlock { + owner: ComputedRef<string>; + iD: ComputedRef<bigint>; + coins: ComputedRef<Coin[]>; +} export interface MsgForceUnlockProtoMsg { typeUrl: "/osmosis.lockup.MsgForceUnlock"; value: Uint8Array; @@ -136,6 +172,9 @@ export interface MsgForceUnlockSDKType { export interface MsgForceUnlockResponse { success: boolean; } +export interface ReactiveMsgForceUnlockResponse { + success: ComputedRef<boolean>; +} export interface MsgForceUnlockResponseProtoMsg { typeUrl: "/osmosis.lockup.MsgForceUnlockResponse"; value: Uint8Array; @@ -153,7 +192,7 @@ function createBaseMsgLockTokens(): MsgLockTokens { export const MsgLockTokens = { typeUrl: "/osmosis.lockup.MsgLockTokens", encode(message: MsgLockTokens, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.owner !== undefined) { + if (message.owner !== "") { writer.uint32(10).string(message.owner); } if (message.duration !== undefined) { @@ -188,11 +227,11 @@ export const MsgLockTokens = { return message; }, fromJSON(object: any): MsgLockTokens { - const obj = createBaseMsgLockTokens(); - if (isSet(object.owner)) obj.owner = String(object.owner); - if (isSet(object.duration)) obj.duration = Duration.fromJSON(object.duration); - if (Array.isArray(object?.coins)) obj.coins = object.coins.map((e: any) => Coin.fromJSON(e)); - return obj; + return { + owner: isSet(object.owner) ? String(object.owner) : "", + duration: isSet(object.duration) ? Duration.fromJSON(object.duration) : undefined, + coins: Array.isArray(object?.coins) ? object.coins.map((e: any) => Coin.fromJSON(e)) : [] + }; }, toJSON(message: MsgLockTokens): JsonSafe<MsgLockTokens> { const obj: any = {}; @@ -208,9 +247,7 @@ export const MsgLockTokens = { fromPartial(object: DeepPartial<MsgLockTokens>): MsgLockTokens { const message = createBaseMsgLockTokens(); message.owner = object.owner ?? ""; - if (object.duration !== undefined && object.duration !== null) { - message.duration = Duration.fromPartial(object.duration); - } + message.duration = object.duration !== undefined && object.duration !== null ? Duration.fromPartial(object.duration) : undefined; message.coins = object.coins?.map(e => Coin.fromPartial(e)) || []; return message; }, @@ -291,7 +328,7 @@ function createBaseMsgLockTokensResponse(): MsgLockTokensResponse { export const MsgLockTokensResponse = { typeUrl: "/osmosis.lockup.MsgLockTokensResponse", encode(message: MsgLockTokensResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.iD !== undefined) { + if (message.iD !== BigInt(0)) { writer.uint32(8).uint64(message.iD); } return writer; @@ -314,9 +351,9 @@ export const MsgLockTokensResponse = { return message; }, fromJSON(object: any): MsgLockTokensResponse { - const obj = createBaseMsgLockTokensResponse(); - if (isSet(object.iD)) obj.iD = BigInt(object.iD.toString()); - return obj; + return { + iD: isSet(object.iD) ? BigInt(object.iD.toString()) : BigInt(0) + }; }, toJSON(message: MsgLockTokensResponse): JsonSafe<MsgLockTokensResponse> { const obj: any = {}; @@ -325,9 +362,7 @@ export const MsgLockTokensResponse = { }, fromPartial(object: DeepPartial<MsgLockTokensResponse>): MsgLockTokensResponse { const message = createBaseMsgLockTokensResponse(); - if (object.iD !== undefined && object.iD !== null) { - message.iD = BigInt(object.iD.toString()); - } + message.iD = object.iD !== undefined && object.iD !== null ? BigInt(object.iD.toString()) : BigInt(0); return message; }, fromSDK(object: MsgLockTokensResponseSDKType): MsgLockTokensResponse { @@ -387,7 +422,7 @@ function createBaseMsgBeginUnlockingAll(): MsgBeginUnlockingAll { export const MsgBeginUnlockingAll = { typeUrl: "/osmosis.lockup.MsgBeginUnlockingAll", encode(message: MsgBeginUnlockingAll, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.owner !== undefined) { + if (message.owner !== "") { writer.uint32(10).string(message.owner); } return writer; @@ -410,9 +445,9 @@ export const MsgBeginUnlockingAll = { return message; }, fromJSON(object: any): MsgBeginUnlockingAll { - const obj = createBaseMsgBeginUnlockingAll(); - if (isSet(object.owner)) obj.owner = String(object.owner); - return obj; + return { + owner: isSet(object.owner) ? String(object.owner) : "" + }; }, toJSON(message: MsgBeginUnlockingAll): JsonSafe<MsgBeginUnlockingAll> { const obj: any = {}; @@ -504,9 +539,9 @@ export const MsgBeginUnlockingAllResponse = { return message; }, fromJSON(object: any): MsgBeginUnlockingAllResponse { - const obj = createBaseMsgBeginUnlockingAllResponse(); - if (Array.isArray(object?.unlocks)) obj.unlocks = object.unlocks.map((e: any) => PeriodLock.fromJSON(e)); - return obj; + return { + unlocks: Array.isArray(object?.unlocks) ? object.unlocks.map((e: any) => PeriodLock.fromJSON(e)) : [] + }; }, toJSON(message: MsgBeginUnlockingAllResponse): JsonSafe<MsgBeginUnlockingAllResponse> { const obj: any = {}; @@ -587,10 +622,10 @@ function createBaseMsgBeginUnlocking(): MsgBeginUnlocking { export const MsgBeginUnlocking = { typeUrl: "/osmosis.lockup.MsgBeginUnlocking", encode(message: MsgBeginUnlocking, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.owner !== undefined) { + if (message.owner !== "") { writer.uint32(10).string(message.owner); } - if (message.iD !== undefined) { + if (message.iD !== BigInt(0)) { writer.uint32(16).uint64(message.iD); } for (const v of message.coins) { @@ -622,11 +657,11 @@ export const MsgBeginUnlocking = { return message; }, fromJSON(object: any): MsgBeginUnlocking { - const obj = createBaseMsgBeginUnlocking(); - if (isSet(object.owner)) obj.owner = String(object.owner); - if (isSet(object.iD)) obj.iD = BigInt(object.iD.toString()); - if (Array.isArray(object?.coins)) obj.coins = object.coins.map((e: any) => Coin.fromJSON(e)); - return obj; + return { + owner: isSet(object.owner) ? String(object.owner) : "", + iD: isSet(object.iD) ? BigInt(object.iD.toString()) : BigInt(0), + coins: Array.isArray(object?.coins) ? object.coins.map((e: any) => Coin.fromJSON(e)) : [] + }; }, toJSON(message: MsgBeginUnlocking): JsonSafe<MsgBeginUnlocking> { const obj: any = {}; @@ -642,9 +677,7 @@ export const MsgBeginUnlocking = { fromPartial(object: DeepPartial<MsgBeginUnlocking>): MsgBeginUnlocking { const message = createBaseMsgBeginUnlocking(); message.owner = object.owner ?? ""; - if (object.iD !== undefined && object.iD !== null) { - message.iD = BigInt(object.iD.toString()); - } + message.iD = object.iD !== undefined && object.iD !== null ? BigInt(object.iD.toString()) : BigInt(0); message.coins = object.coins?.map(e => Coin.fromPartial(e)) || []; return message; }, @@ -725,7 +758,7 @@ function createBaseMsgBeginUnlockingResponse(): MsgBeginUnlockingResponse { export const MsgBeginUnlockingResponse = { typeUrl: "/osmosis.lockup.MsgBeginUnlockingResponse", encode(message: MsgBeginUnlockingResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.success !== undefined) { + if (message.success === true) { writer.uint32(8).bool(message.success); } return writer; @@ -748,9 +781,9 @@ export const MsgBeginUnlockingResponse = { return message; }, fromJSON(object: any): MsgBeginUnlockingResponse { - const obj = createBaseMsgBeginUnlockingResponse(); - if (isSet(object.success)) obj.success = Boolean(object.success); - return obj; + return { + success: isSet(object.success) ? Boolean(object.success) : false + }; }, toJSON(message: MsgBeginUnlockingResponse): JsonSafe<MsgBeginUnlockingResponse> { const obj: any = {}; @@ -821,10 +854,10 @@ function createBaseMsgExtendLockup(): MsgExtendLockup { export const MsgExtendLockup = { typeUrl: "/osmosis.lockup.MsgExtendLockup", encode(message: MsgExtendLockup, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.owner !== undefined) { + if (message.owner !== "") { writer.uint32(10).string(message.owner); } - if (message.iD !== undefined) { + if (message.iD !== BigInt(0)) { writer.uint32(16).uint64(message.iD); } if (message.duration !== undefined) { @@ -856,11 +889,11 @@ export const MsgExtendLockup = { return message; }, fromJSON(object: any): MsgExtendLockup { - const obj = createBaseMsgExtendLockup(); - if (isSet(object.owner)) obj.owner = String(object.owner); - if (isSet(object.iD)) obj.iD = BigInt(object.iD.toString()); - if (isSet(object.duration)) obj.duration = Duration.fromJSON(object.duration); - return obj; + return { + owner: isSet(object.owner) ? String(object.owner) : "", + iD: isSet(object.iD) ? BigInt(object.iD.toString()) : BigInt(0), + duration: isSet(object.duration) ? Duration.fromJSON(object.duration) : undefined + }; }, toJSON(message: MsgExtendLockup): JsonSafe<MsgExtendLockup> { const obj: any = {}; @@ -872,12 +905,8 @@ export const MsgExtendLockup = { fromPartial(object: DeepPartial<MsgExtendLockup>): MsgExtendLockup { const message = createBaseMsgExtendLockup(); message.owner = object.owner ?? ""; - if (object.iD !== undefined && object.iD !== null) { - message.iD = BigInt(object.iD.toString()); - } - if (object.duration !== undefined && object.duration !== null) { - message.duration = Duration.fromPartial(object.duration); - } + message.iD = object.iD !== undefined && object.iD !== null ? BigInt(object.iD.toString()) : BigInt(0); + message.duration = object.duration !== undefined && object.duration !== null ? Duration.fromPartial(object.duration) : undefined; return message; }, fromSDK(object: MsgExtendLockupSDKType): MsgExtendLockup { @@ -951,7 +980,7 @@ function createBaseMsgExtendLockupResponse(): MsgExtendLockupResponse { export const MsgExtendLockupResponse = { typeUrl: "/osmosis.lockup.MsgExtendLockupResponse", encode(message: MsgExtendLockupResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.success !== undefined) { + if (message.success === true) { writer.uint32(8).bool(message.success); } return writer; @@ -974,9 +1003,9 @@ export const MsgExtendLockupResponse = { return message; }, fromJSON(object: any): MsgExtendLockupResponse { - const obj = createBaseMsgExtendLockupResponse(); - if (isSet(object.success)) obj.success = Boolean(object.success); - return obj; + return { + success: isSet(object.success) ? Boolean(object.success) : false + }; }, toJSON(message: MsgExtendLockupResponse): JsonSafe<MsgExtendLockupResponse> { const obj: any = {}; @@ -1047,10 +1076,10 @@ function createBaseMsgForceUnlock(): MsgForceUnlock { export const MsgForceUnlock = { typeUrl: "/osmosis.lockup.MsgForceUnlock", encode(message: MsgForceUnlock, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.owner !== undefined) { + if (message.owner !== "") { writer.uint32(10).string(message.owner); } - if (message.iD !== undefined) { + if (message.iD !== BigInt(0)) { writer.uint32(16).uint64(message.iD); } for (const v of message.coins) { @@ -1082,11 +1111,11 @@ export const MsgForceUnlock = { return message; }, fromJSON(object: any): MsgForceUnlock { - const obj = createBaseMsgForceUnlock(); - if (isSet(object.owner)) obj.owner = String(object.owner); - if (isSet(object.iD)) obj.iD = BigInt(object.iD.toString()); - if (Array.isArray(object?.coins)) obj.coins = object.coins.map((e: any) => Coin.fromJSON(e)); - return obj; + return { + owner: isSet(object.owner) ? String(object.owner) : "", + iD: isSet(object.iD) ? BigInt(object.iD.toString()) : BigInt(0), + coins: Array.isArray(object?.coins) ? object.coins.map((e: any) => Coin.fromJSON(e)) : [] + }; }, toJSON(message: MsgForceUnlock): JsonSafe<MsgForceUnlock> { const obj: any = {}; @@ -1102,9 +1131,7 @@ export const MsgForceUnlock = { fromPartial(object: DeepPartial<MsgForceUnlock>): MsgForceUnlock { const message = createBaseMsgForceUnlock(); message.owner = object.owner ?? ""; - if (object.iD !== undefined && object.iD !== null) { - message.iD = BigInt(object.iD.toString()); - } + message.iD = object.iD !== undefined && object.iD !== null ? BigInt(object.iD.toString()) : BigInt(0); message.coins = object.coins?.map(e => Coin.fromPartial(e)) || []; return message; }, @@ -1185,7 +1212,7 @@ function createBaseMsgForceUnlockResponse(): MsgForceUnlockResponse { export const MsgForceUnlockResponse = { typeUrl: "/osmosis.lockup.MsgForceUnlockResponse", encode(message: MsgForceUnlockResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.success !== undefined) { + if (message.success === true) { writer.uint32(8).bool(message.success); } return writer; @@ -1208,9 +1235,9 @@ export const MsgForceUnlockResponse = { return message; }, fromJSON(object: any): MsgForceUnlockResponse { - const obj = createBaseMsgForceUnlockResponse(); - if (isSet(object.success)) obj.success = Boolean(object.success); - return obj; + return { + success: isSet(object.success) ? Boolean(object.success) : false + }; }, toJSON(message: MsgForceUnlockResponse): JsonSafe<MsgForceUnlockResponse> { const obj: any = {}; diff --git a/__fixtures__/v-next/outputv4/osmosis/mint/v1beta1/genesis.ts b/__fixtures__/v-next/outputv4/osmosis/mint/v1beta1/genesis.ts index 028ac8fd14..c449c0e671 100644 --- a/__fixtures__/v-next/outputv4/osmosis/mint/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputv4/osmosis/mint/v1beta1/genesis.ts @@ -1,7 +1,8 @@ -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"; +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"; export const protobufPackage = "osmosis.mint.v1beta1"; /** GenesisState defines the mint module's genesis state. */ export interface GenesisState { @@ -15,6 +16,11 @@ export interface GenesisState { */ reductionStartedEpoch: bigint; } +export interface ReactiveGenesisState { + minter: ComputedRef<Minter>; + params: ComputedRef<Params>; + reductionStartedEpoch: ComputedRef<bigint>; +} export interface GenesisStateProtoMsg { typeUrl: "/osmosis.mint.v1beta1.GenesisState"; value: Uint8Array; @@ -41,7 +47,7 @@ export const GenesisState = { if (message.params !== undefined) { Params.encode(message.params, writer.uint32(18).fork()).ldelim(); } - if (message.reductionStartedEpoch !== undefined) { + if (message.reductionStartedEpoch !== BigInt(0)) { writer.uint32(24).int64(message.reductionStartedEpoch); } return writer; @@ -70,11 +76,11 @@ export const GenesisState = { return message; }, fromJSON(object: any): GenesisState { - const obj = createBaseGenesisState(); - if (isSet(object.minter)) obj.minter = Minter.fromJSON(object.minter); - if (isSet(object.params)) obj.params = Params.fromJSON(object.params); - if (isSet(object.reductionStartedEpoch)) obj.reductionStartedEpoch = BigInt(object.reductionStartedEpoch.toString()); - return obj; + return { + minter: isSet(object.minter) ? Minter.fromJSON(object.minter) : undefined, + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + reductionStartedEpoch: isSet(object.reductionStartedEpoch) ? BigInt(object.reductionStartedEpoch.toString()) : BigInt(0) + }; }, toJSON(message: GenesisState): JsonSafe<GenesisState> { const obj: any = {}; @@ -85,15 +91,9 @@ export const GenesisState = { }, fromPartial(object: DeepPartial<GenesisState>): GenesisState { const message = createBaseGenesisState(); - 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); - } - if (object.reductionStartedEpoch !== undefined && object.reductionStartedEpoch !== null) { - message.reductionStartedEpoch = BigInt(object.reductionStartedEpoch.toString()); - } + 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; + message.reductionStartedEpoch = object.reductionStartedEpoch !== undefined && object.reductionStartedEpoch !== null ? BigInt(object.reductionStartedEpoch.toString()) : BigInt(0); return message; }, fromSDK(object: GenesisStateSDKType): GenesisState { diff --git a/__fixtures__/v-next/outputv4/osmosis/mint/v1beta1/mint.ts b/__fixtures__/v-next/outputv4/osmosis/mint/v1beta1/mint.ts index 5d349f1c5e..b86104b70e 100644 --- a/__fixtures__/v-next/outputv4/osmosis/mint/v1beta1/mint.ts +++ b/__fixtures__/v-next/outputv4/osmosis/mint/v1beta1/mint.ts @@ -1,13 +1,17 @@ -import { BinaryReader, BinaryWriter } from "../../../binary.js"; +import { BinaryReader, BinaryWriter } from "../../../binary"; import { Decimal } from "@cosmjs/math"; -import { isSet, DeepPartial } from "../../../helpers.js"; -import { JsonSafe } from "../../../json-safe.js"; +import { isSet, DeepPartial } from "../../../helpers"; +import { JsonSafe } from "../../../json-safe"; +import { ComputedRef } from "vue"; export const protobufPackage = "osmosis.mint.v1beta1"; /** Minter represents the minting state. */ export interface Minter { /** epoch_provisions represent rewards for the current epoch. */ epochProvisions: string; } +export interface ReactiveMinter { + epochProvisions: ComputedRef<string>; +} export interface MinterProtoMsg { typeUrl: "/osmosis.mint.v1beta1.Minter"; value: Uint8Array; @@ -25,6 +29,10 @@ export interface WeightedAddress { address: string; weight: string; } +export interface ReactiveWeightedAddress { + address: ComputedRef<string>; + weight: ComputedRef<string>; +} export interface WeightedAddressProtoMsg { typeUrl: "/osmosis.mint.v1beta1.WeightedAddress"; value: Uint8Array; @@ -65,6 +73,12 @@ export interface DistributionProportions { */ communityPool: string; } +export interface ReactiveDistributionProportions { + staking: ComputedRef<string>; + poolIncentives: ComputedRef<string>; + developerRewards: ComputedRef<string>; + communityPool: ComputedRef<string>; +} export interface DistributionProportionsProtoMsg { typeUrl: "/osmosis.mint.v1beta1.DistributionProportions"; value: Uint8Array; @@ -117,6 +131,16 @@ export interface Params { */ mintingRewardsDistributionStartEpoch: bigint; } +export interface ReactiveParams { + mintDenom: ComputedRef<string>; + genesisEpochProvisions: ComputedRef<string>; + epochIdentifier: ComputedRef<string>; + reductionPeriodInEpochs: ComputedRef<bigint>; + reductionFactor: ComputedRef<string>; + distributionProportions: ComputedRef<DistributionProportions>; + weightedDeveloperRewardsReceivers: ComputedRef<WeightedAddress[]>; + mintingRewardsDistributionStartEpoch: ComputedRef<bigint>; +} export interface ParamsProtoMsg { typeUrl: "/osmosis.mint.v1beta1.Params"; value: Uint8Array; @@ -140,7 +164,7 @@ function createBaseMinter(): Minter { export const Minter = { typeUrl: "/osmosis.mint.v1beta1.Minter", encode(message: Minter, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.epochProvisions !== undefined) { + if (message.epochProvisions !== "") { writer.uint32(10).string(Decimal.fromUserInput(message.epochProvisions, 18).atomics); } return writer; @@ -163,9 +187,9 @@ export const Minter = { return message; }, fromJSON(object: any): Minter { - const obj = createBaseMinter(); - if (isSet(object.epochProvisions)) obj.epochProvisions = String(object.epochProvisions); - return obj; + return { + epochProvisions: isSet(object.epochProvisions) ? String(object.epochProvisions) : "" + }; }, toJSON(message: Minter): JsonSafe<Minter> { const obj: any = {}; @@ -235,10 +259,10 @@ function createBaseWeightedAddress(): WeightedAddress { export const WeightedAddress = { typeUrl: "/osmosis.mint.v1beta1.WeightedAddress", encode(message: WeightedAddress, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.address !== undefined) { + if (message.address !== "") { writer.uint32(10).string(message.address); } - if (message.weight !== undefined) { + if (message.weight !== "") { writer.uint32(18).string(Decimal.fromUserInput(message.weight, 18).atomics); } return writer; @@ -264,10 +288,10 @@ export const WeightedAddress = { return message; }, fromJSON(object: any): WeightedAddress { - const obj = createBaseWeightedAddress(); - if (isSet(object.address)) obj.address = String(object.address); - if (isSet(object.weight)) obj.weight = String(object.weight); - return obj; + return { + address: isSet(object.address) ? String(object.address) : "", + weight: isSet(object.weight) ? String(object.weight) : "" + }; }, toJSON(message: WeightedAddress): JsonSafe<WeightedAddress> { const obj: any = {}; @@ -348,16 +372,16 @@ function createBaseDistributionProportions(): DistributionProportions { export const DistributionProportions = { typeUrl: "/osmosis.mint.v1beta1.DistributionProportions", encode(message: DistributionProportions, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.staking !== undefined) { + if (message.staking !== "") { writer.uint32(10).string(Decimal.fromUserInput(message.staking, 18).atomics); } - if (message.poolIncentives !== undefined) { + if (message.poolIncentives !== "") { writer.uint32(18).string(Decimal.fromUserInput(message.poolIncentives, 18).atomics); } - if (message.developerRewards !== undefined) { + if (message.developerRewards !== "") { writer.uint32(26).string(Decimal.fromUserInput(message.developerRewards, 18).atomics); } - if (message.communityPool !== undefined) { + if (message.communityPool !== "") { writer.uint32(34).string(Decimal.fromUserInput(message.communityPool, 18).atomics); } return writer; @@ -389,12 +413,12 @@ export const DistributionProportions = { return message; }, fromJSON(object: any): DistributionProportions { - const obj = createBaseDistributionProportions(); - if (isSet(object.staking)) obj.staking = String(object.staking); - if (isSet(object.poolIncentives)) obj.poolIncentives = String(object.poolIncentives); - if (isSet(object.developerRewards)) obj.developerRewards = String(object.developerRewards); - if (isSet(object.communityPool)) obj.communityPool = String(object.communityPool); - return obj; + return { + staking: isSet(object.staking) ? String(object.staking) : "", + poolIncentives: isSet(object.poolIncentives) ? String(object.poolIncentives) : "", + developerRewards: isSet(object.developerRewards) ? String(object.developerRewards) : "", + communityPool: isSet(object.communityPool) ? String(object.communityPool) : "" + }; }, toJSON(message: DistributionProportions): JsonSafe<DistributionProportions> { const obj: any = {}; @@ -497,19 +521,19 @@ function createBaseParams(): Params { export const Params = { typeUrl: "/osmosis.mint.v1beta1.Params", encode(message: Params, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.mintDenom !== undefined) { + if (message.mintDenom !== "") { writer.uint32(10).string(message.mintDenom); } - if (message.genesisEpochProvisions !== undefined) { + if (message.genesisEpochProvisions !== "") { writer.uint32(18).string(Decimal.fromUserInput(message.genesisEpochProvisions, 18).atomics); } - if (message.epochIdentifier !== undefined) { + if (message.epochIdentifier !== "") { writer.uint32(26).string(message.epochIdentifier); } - if (message.reductionPeriodInEpochs !== undefined) { + if (message.reductionPeriodInEpochs !== BigInt(0)) { writer.uint32(32).int64(message.reductionPeriodInEpochs); } - if (message.reductionFactor !== undefined) { + if (message.reductionFactor !== "") { writer.uint32(42).string(Decimal.fromUserInput(message.reductionFactor, 18).atomics); } if (message.distributionProportions !== undefined) { @@ -518,7 +542,7 @@ export const Params = { for (const v of message.weightedDeveloperRewardsReceivers) { WeightedAddress.encode(v!, writer.uint32(58).fork()).ldelim(); } - if (message.mintingRewardsDistributionStartEpoch !== undefined) { + if (message.mintingRewardsDistributionStartEpoch !== BigInt(0)) { writer.uint32(64).int64(message.mintingRewardsDistributionStartEpoch); } return writer; @@ -562,16 +586,16 @@ export const Params = { return message; }, fromJSON(object: any): Params { - const obj = createBaseParams(); - if (isSet(object.mintDenom)) obj.mintDenom = String(object.mintDenom); - if (isSet(object.genesisEpochProvisions)) obj.genesisEpochProvisions = String(object.genesisEpochProvisions); - if (isSet(object.epochIdentifier)) obj.epochIdentifier = String(object.epochIdentifier); - if (isSet(object.reductionPeriodInEpochs)) obj.reductionPeriodInEpochs = BigInt(object.reductionPeriodInEpochs.toString()); - if (isSet(object.reductionFactor)) obj.reductionFactor = String(object.reductionFactor); - if (isSet(object.distributionProportions)) obj.distributionProportions = DistributionProportions.fromJSON(object.distributionProportions); - if (Array.isArray(object?.weightedDeveloperRewardsReceivers)) obj.weightedDeveloperRewardsReceivers = object.weightedDeveloperRewardsReceivers.map((e: any) => WeightedAddress.fromJSON(e)); - if (isSet(object.mintingRewardsDistributionStartEpoch)) obj.mintingRewardsDistributionStartEpoch = BigInt(object.mintingRewardsDistributionStartEpoch.toString()); - return obj; + return { + mintDenom: isSet(object.mintDenom) ? String(object.mintDenom) : "", + genesisEpochProvisions: isSet(object.genesisEpochProvisions) ? String(object.genesisEpochProvisions) : "", + epochIdentifier: isSet(object.epochIdentifier) ? String(object.epochIdentifier) : "", + reductionPeriodInEpochs: isSet(object.reductionPeriodInEpochs) ? BigInt(object.reductionPeriodInEpochs.toString()) : BigInt(0), + reductionFactor: isSet(object.reductionFactor) ? String(object.reductionFactor) : "", + distributionProportions: isSet(object.distributionProportions) ? DistributionProportions.fromJSON(object.distributionProportions) : undefined, + weightedDeveloperRewardsReceivers: Array.isArray(object?.weightedDeveloperRewardsReceivers) ? object.weightedDeveloperRewardsReceivers.map((e: any) => WeightedAddress.fromJSON(e)) : [], + mintingRewardsDistributionStartEpoch: isSet(object.mintingRewardsDistributionStartEpoch) ? BigInt(object.mintingRewardsDistributionStartEpoch.toString()) : BigInt(0) + }; }, toJSON(message: Params): JsonSafe<Params> { const obj: any = {}; @@ -594,17 +618,11 @@ export const Params = { message.mintDenom = object.mintDenom ?? ""; message.genesisEpochProvisions = object.genesisEpochProvisions ?? ""; message.epochIdentifier = object.epochIdentifier ?? ""; - if (object.reductionPeriodInEpochs !== undefined && object.reductionPeriodInEpochs !== null) { - message.reductionPeriodInEpochs = BigInt(object.reductionPeriodInEpochs.toString()); - } + message.reductionPeriodInEpochs = object.reductionPeriodInEpochs !== undefined && object.reductionPeriodInEpochs !== null ? BigInt(object.reductionPeriodInEpochs.toString()) : BigInt(0); message.reductionFactor = object.reductionFactor ?? ""; - if (object.distributionProportions !== undefined && object.distributionProportions !== null) { - message.distributionProportions = DistributionProportions.fromPartial(object.distributionProportions); - } + message.distributionProportions = object.distributionProportions !== undefined && object.distributionProportions !== null ? DistributionProportions.fromPartial(object.distributionProportions) : undefined; message.weightedDeveloperRewardsReceivers = object.weightedDeveloperRewardsReceivers?.map(e => WeightedAddress.fromPartial(e)) || []; - if (object.mintingRewardsDistributionStartEpoch !== undefined && object.mintingRewardsDistributionStartEpoch !== null) { - message.mintingRewardsDistributionStartEpoch = BigInt(object.mintingRewardsDistributionStartEpoch.toString()); - } + message.mintingRewardsDistributionStartEpoch = object.mintingRewardsDistributionStartEpoch !== undefined && object.mintingRewardsDistributionStartEpoch !== null ? BigInt(object.mintingRewardsDistributionStartEpoch.toString()) : BigInt(0); return message; }, fromSDK(object: ParamsSDKType): Params { diff --git a/__fixtures__/v-next/outputv4/osmosis/mint/v1beta1/query.lcd.ts b/__fixtures__/v-next/outputv4/osmosis/mint/v1beta1/query.lcd.ts index a154a1a457..b775ee33fa 100644 --- a/__fixtures__/v-next/outputv4/osmosis/mint/v1beta1/query.lcd.ts +++ b/__fixtures__/v-next/outputv4/osmosis/mint/v1beta1/query.lcd.ts @@ -1,6 +1,6 @@ -import { Params, ParamsSDKType } from "./mint.js"; +import { Params, ParamsSDKType } from "./mint"; import { LCDClient } from "@cosmology/lcd"; -import { QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType, QueryEpochProvisionsRequest, QueryEpochProvisionsRequestSDKType, QueryEpochProvisionsResponse, QueryEpochProvisionsResponseSDKType } from "./query.js"; +import { QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType, QueryEpochProvisionsRequest, QueryEpochProvisionsRequestSDKType, QueryEpochProvisionsResponse, QueryEpochProvisionsResponseSDKType } from "./query"; export class LCDQueryClient { req: LCDClient; constructor({ diff --git a/__fixtures__/v-next/outputv4/osmosis/mint/v1beta1/query.rpc.Query.ts b/__fixtures__/v-next/outputv4/osmosis/mint/v1beta1/query.rpc.Query.ts index 9b797c4f59..983e1fbfb4 100644 --- a/__fixtures__/v-next/outputv4/osmosis/mint/v1beta1/query.rpc.Query.ts +++ b/__fixtures__/v-next/outputv4/osmosis/mint/v1beta1/query.rpc.Query.ts @@ -1,8 +1,8 @@ -import { Params, ParamsSDKType } from "./mint.js"; -import { Rpc } from "../../../helpers.js"; -import { BinaryReader } from "../../../binary.js"; +import { Params, ParamsSDKType } from "./mint"; +import { Rpc } from "../../../helpers"; +import { BinaryReader } from "../../../binary"; import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; -import { QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType, QueryEpochProvisionsRequest, QueryEpochProvisionsRequestSDKType, QueryEpochProvisionsResponse, QueryEpochProvisionsResponseSDKType } from "./query.js"; +import { QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType, QueryEpochProvisionsRequest, QueryEpochProvisionsRequestSDKType, QueryEpochProvisionsResponse, QueryEpochProvisionsResponseSDKType, ReactiveQueryParamsRequest, ReactiveQueryEpochProvisionsRequest } from "./query"; /** 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/osmosis/mint/v1beta1/query.ts b/__fixtures__/v-next/outputv4/osmosis/mint/v1beta1/query.ts index 37013f2241..b8a8ad71db 100644 --- a/__fixtures__/v-next/outputv4/osmosis/mint/v1beta1/query.ts +++ b/__fixtures__/v-next/outputv4/osmosis/mint/v1beta1/query.ts @@ -1,10 +1,12 @@ -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"; +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"; export const protobufPackage = "osmosis.mint.v1beta1"; /** QueryParamsRequest is the request type for the Query/Params RPC method. */ export interface QueryParamsRequest {} +export interface ReactiveQueryParamsRequest {} export interface QueryParamsRequestProtoMsg { typeUrl: "/osmosis.mint.v1beta1.QueryParamsRequest"; value: Uint8Array; @@ -16,6 +18,9 @@ export interface QueryParamsResponse { /** params defines the parameters of the module. */ params: Params; } +export interface ReactiveQueryParamsResponse { + params: ComputedRef<Params>; +} export interface QueryParamsResponseProtoMsg { typeUrl: "/osmosis.mint.v1beta1.QueryParamsResponse"; value: Uint8Array; @@ -29,6 +34,7 @@ export interface QueryParamsResponseSDKType { * Query/EpochProvisions RPC method. */ export interface QueryEpochProvisionsRequest {} +export interface ReactiveQueryEpochProvisionsRequest {} export interface QueryEpochProvisionsRequestProtoMsg { typeUrl: "/osmosis.mint.v1beta1.QueryEpochProvisionsRequest"; value: Uint8Array; @@ -46,6 +52,9 @@ export interface QueryEpochProvisionsResponse { /** epoch_provisions is the current minting per epoch provisions value. */ epochProvisions: Uint8Array; } +export interface ReactiveQueryEpochProvisionsResponse { + epochProvisions: ComputedRef<Uint8Array>; +} export interface QueryEpochProvisionsResponseProtoMsg { typeUrl: "/osmosis.mint.v1beta1.QueryEpochProvisionsResponse"; value: Uint8Array; @@ -80,8 +89,7 @@ export const QueryParamsRequest = { return message; }, fromJSON(_: any): QueryParamsRequest { - const obj = createBaseQueryParamsRequest(); - return obj; + return {}; }, toJSON(_: QueryParamsRequest): JsonSafe<QueryParamsRequest> { const obj: any = {}; @@ -162,9 +170,9 @@ export const QueryParamsResponse = { return message; }, fromJSON(object: any): QueryParamsResponse { - const obj = createBaseQueryParamsResponse(); - if (isSet(object.params)) obj.params = Params.fromJSON(object.params); - return obj; + return { + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined + }; }, toJSON(message: QueryParamsResponse): JsonSafe<QueryParamsResponse> { const obj: any = {}; @@ -173,9 +181,7 @@ export const QueryParamsResponse = { }, fromPartial(object: DeepPartial<QueryParamsResponse>): QueryParamsResponse { const message = createBaseQueryParamsResponse(); - if (object.params !== undefined && object.params !== null) { - message.params = Params.fromPartial(object.params); - } + message.params = object.params !== undefined && object.params !== null ? Params.fromPartial(object.params) : undefined; return message; }, fromSDK(object: QueryParamsResponseSDKType): QueryParamsResponse { @@ -250,8 +256,7 @@ export const QueryEpochProvisionsRequest = { return message; }, fromJSON(_: any): QueryEpochProvisionsRequest { - const obj = createBaseQueryEpochProvisionsRequest(); - return obj; + return {}; }, toJSON(_: QueryEpochProvisionsRequest): JsonSafe<QueryEpochProvisionsRequest> { const obj: any = {}; @@ -332,9 +337,9 @@ export const QueryEpochProvisionsResponse = { return message; }, fromJSON(object: any): QueryEpochProvisionsResponse { - const obj = createBaseQueryEpochProvisionsResponse(); - if (isSet(object.epochProvisions)) obj.epochProvisions = bytesFromBase64(object.epochProvisions); - return obj; + return { + epochProvisions: isSet(object.epochProvisions) ? bytesFromBase64(object.epochProvisions) : new Uint8Array() + }; }, toJSON(message: QueryEpochProvisionsResponse): JsonSafe<QueryEpochProvisionsResponse> { const obj: any = {}; diff --git a/__fixtures__/v-next/outputv4/osmosis/pool-incentives/v1beta1/genesis.ts b/__fixtures__/v-next/outputv4/osmosis/pool-incentives/v1beta1/genesis.ts index 07313482f3..320160bbac 100644 --- a/__fixtures__/v-next/outputv4/osmosis/pool-incentives/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputv4/osmosis/pool-incentives/v1beta1/genesis.ts @@ -1,8 +1,9 @@ -import { Params, ParamsSDKType, DistrInfo, DistrInfoSDKType, PoolToGauges, PoolToGaugesSDKType } from "./incentives.js"; -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"; +import { Params, ParamsSDKType, DistrInfo, DistrInfoSDKType, PoolToGauges, PoolToGaugesSDKType } from "./incentives"; +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"; export const protobufPackage = "osmosis.poolincentives.v1beta1"; /** GenesisState defines the pool incentives module's genesis state. */ export interface GenesisState { @@ -12,6 +13,12 @@ export interface GenesisState { distrInfo?: DistrInfo; poolToGauges?: PoolToGauges; } +export interface ReactiveGenesisState { + params: ComputedRef<Params>; + lockableDurations: ComputedRef<Duration[]>; + distrInfo?: ComputedRef<DistrInfo>; + poolToGauges?: ComputedRef<PoolToGauges>; +} export interface GenesisStateProtoMsg { typeUrl: "/osmosis.poolincentives.v1beta1.GenesisState"; value: Uint8Array; @@ -75,12 +82,12 @@ export const GenesisState = { return message; }, fromJSON(object: any): GenesisState { - const obj = createBaseGenesisState(); - if (isSet(object.params)) obj.params = Params.fromJSON(object.params); - if (Array.isArray(object?.lockableDurations)) obj.lockableDurations = object.lockableDurations.map((e: any) => Duration.fromJSON(e)); - if (isSet(object.distrInfo)) obj.distrInfo = DistrInfo.fromJSON(object.distrInfo); - if (isSet(object.poolToGauges)) obj.poolToGauges = PoolToGauges.fromJSON(object.poolToGauges); - return obj; + return { + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + lockableDurations: Array.isArray(object?.lockableDurations) ? object.lockableDurations.map((e: any) => Duration.fromJSON(e)) : [], + distrInfo: isSet(object.distrInfo) ? DistrInfo.fromJSON(object.distrInfo) : undefined, + poolToGauges: isSet(object.poolToGauges) ? PoolToGauges.fromJSON(object.poolToGauges) : undefined + }; }, toJSON(message: GenesisState): JsonSafe<GenesisState> { const obj: any = {}; @@ -96,16 +103,10 @@ export const GenesisState = { }, fromPartial(object: DeepPartial<GenesisState>): GenesisState { const message = createBaseGenesisState(); - if (object.params !== undefined && object.params !== null) { - message.params = Params.fromPartial(object.params); - } + message.params = object.params !== undefined && object.params !== null ? Params.fromPartial(object.params) : undefined; message.lockableDurations = object.lockableDurations?.map(e => Duration.fromPartial(e)) || []; - if (object.distrInfo !== undefined && object.distrInfo !== null) { - message.distrInfo = DistrInfo.fromPartial(object.distrInfo); - } - if (object.poolToGauges !== undefined && object.poolToGauges !== null) { - message.poolToGauges = PoolToGauges.fromPartial(object.poolToGauges); - } + message.distrInfo = object.distrInfo !== undefined && object.distrInfo !== null ? DistrInfo.fromPartial(object.distrInfo) : undefined; + message.poolToGauges = object.poolToGauges !== undefined && object.poolToGauges !== null ? PoolToGauges.fromPartial(object.poolToGauges) : undefined; return message; }, fromSDK(object: GenesisStateSDKType): GenesisState { diff --git a/__fixtures__/v-next/outputv4/osmosis/pool-incentives/v1beta1/gov.ts b/__fixtures__/v-next/outputv4/osmosis/pool-incentives/v1beta1/gov.ts index c4560dfcc3..41e1236662 100644 --- a/__fixtures__/v-next/outputv4/osmosis/pool-incentives/v1beta1/gov.ts +++ b/__fixtures__/v-next/outputv4/osmosis/pool-incentives/v1beta1/gov.ts @@ -1,7 +1,8 @@ -import { DistrRecord, DistrRecordSDKType } from "./incentives.js"; -import { BinaryReader, BinaryWriter } from "../../../binary.js"; -import { isSet, DeepPartial } from "../../../helpers.js"; -import { JsonSafe } from "../../../json-safe.js"; +import { DistrRecord, DistrRecordSDKType } from "./incentives"; +import { BinaryReader, BinaryWriter } from "../../../binary"; +import { isSet, DeepPartial } from "../../../helpers"; +import { JsonSafe } from "../../../json-safe"; +import { ComputedRef } from "vue"; export const protobufPackage = "osmosis.poolincentives.v1beta1"; /** * ReplacePoolIncentivesProposal is a gov Content type for updating the pool @@ -17,6 +18,11 @@ export interface ReplacePoolIncentivesProposal { description: string; records: DistrRecord[]; } +export interface ReactiveReplacePoolIncentivesProposal { + title: ComputedRef<string>; + description: ComputedRef<string>; + records: ComputedRef<DistrRecord[]>; +} export interface ReplacePoolIncentivesProposalProtoMsg { typeUrl: "/osmosis.poolincentives.v1beta1.ReplacePoolIncentivesProposal"; value: Uint8Array; @@ -49,6 +55,11 @@ export interface UpdatePoolIncentivesProposal { description: string; records: DistrRecord[]; } +export interface ReactiveUpdatePoolIncentivesProposal { + title: ComputedRef<string>; + description: ComputedRef<string>; + records: ComputedRef<DistrRecord[]>; +} export interface UpdatePoolIncentivesProposalProtoMsg { typeUrl: "/osmosis.poolincentives.v1beta1.UpdatePoolIncentivesProposal"; value: Uint8Array; @@ -77,10 +88,10 @@ function createBaseReplacePoolIncentivesProposal(): ReplacePoolIncentivesProposa export const ReplacePoolIncentivesProposal = { typeUrl: "/osmosis.poolincentives.v1beta1.ReplacePoolIncentivesProposal", encode(message: ReplacePoolIncentivesProposal, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.title !== undefined) { + if (message.title !== "") { writer.uint32(10).string(message.title); } - if (message.description !== undefined) { + if (message.description !== "") { writer.uint32(18).string(message.description); } for (const v of message.records) { @@ -112,11 +123,11 @@ export const ReplacePoolIncentivesProposal = { return message; }, fromJSON(object: any): ReplacePoolIncentivesProposal { - const obj = createBaseReplacePoolIncentivesProposal(); - if (isSet(object.title)) obj.title = String(object.title); - if (isSet(object.description)) obj.description = String(object.description); - if (Array.isArray(object?.records)) obj.records = object.records.map((e: any) => DistrRecord.fromJSON(e)); - return obj; + return { + title: isSet(object.title) ? String(object.title) : "", + description: isSet(object.description) ? String(object.description) : "", + records: Array.isArray(object?.records) ? object.records.map((e: any) => DistrRecord.fromJSON(e)) : [] + }; }, toJSON(message: ReplacePoolIncentivesProposal): JsonSafe<ReplacePoolIncentivesProposal> { const obj: any = {}; @@ -215,10 +226,10 @@ function createBaseUpdatePoolIncentivesProposal(): UpdatePoolIncentivesProposal export const UpdatePoolIncentivesProposal = { typeUrl: "/osmosis.poolincentives.v1beta1.UpdatePoolIncentivesProposal", encode(message: UpdatePoolIncentivesProposal, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.title !== undefined) { + if (message.title !== "") { writer.uint32(10).string(message.title); } - if (message.description !== undefined) { + if (message.description !== "") { writer.uint32(18).string(message.description); } for (const v of message.records) { @@ -250,11 +261,11 @@ export const UpdatePoolIncentivesProposal = { return message; }, fromJSON(object: any): UpdatePoolIncentivesProposal { - const obj = createBaseUpdatePoolIncentivesProposal(); - if (isSet(object.title)) obj.title = String(object.title); - if (isSet(object.description)) obj.description = String(object.description); - if (Array.isArray(object?.records)) obj.records = object.records.map((e: any) => DistrRecord.fromJSON(e)); - return obj; + return { + title: isSet(object.title) ? String(object.title) : "", + description: isSet(object.description) ? String(object.description) : "", + records: Array.isArray(object?.records) ? object.records.map((e: any) => DistrRecord.fromJSON(e)) : [] + }; }, toJSON(message: UpdatePoolIncentivesProposal): JsonSafe<UpdatePoolIncentivesProposal> { const obj: any = {}; diff --git a/__fixtures__/v-next/outputv4/osmosis/pool-incentives/v1beta1/incentives.ts b/__fixtures__/v-next/outputv4/osmosis/pool-incentives/v1beta1/incentives.ts index 37fa7be682..48313883e8 100644 --- a/__fixtures__/v-next/outputv4/osmosis/pool-incentives/v1beta1/incentives.ts +++ b/__fixtures__/v-next/outputv4/osmosis/pool-incentives/v1beta1/incentives.ts @@ -1,7 +1,8 @@ -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"; +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"; export const protobufPackage = "osmosis.poolincentives.v1beta1"; export interface Params { /** @@ -12,6 +13,9 @@ export interface Params { */ mintedDenom: string; } +export interface ReactiveParams { + mintedDenom: ComputedRef<string>; +} export interface ParamsProtoMsg { typeUrl: "/osmosis.poolincentives.v1beta1.Params"; value: Uint8Array; @@ -22,6 +26,9 @@ export interface ParamsSDKType { export interface LockableDurationsInfo { lockableDurations: Duration[]; } +export interface ReactiveLockableDurationsInfo { + lockableDurations: ComputedRef<Duration[]>; +} export interface LockableDurationsInfoProtoMsg { typeUrl: "/osmosis.poolincentives.v1beta1.LockableDurationsInfo"; value: Uint8Array; @@ -33,6 +40,10 @@ export interface DistrInfo { totalWeight: string; records: DistrRecord[]; } +export interface ReactiveDistrInfo { + totalWeight: ComputedRef<string>; + records: ComputedRef<DistrRecord[]>; +} export interface DistrInfoProtoMsg { typeUrl: "/osmosis.poolincentives.v1beta1.DistrInfo"; value: Uint8Array; @@ -45,6 +56,10 @@ export interface DistrRecord { gaugeId: bigint; weight: string; } +export interface ReactiveDistrRecord { + gaugeId: ComputedRef<bigint>; + weight: ComputedRef<string>; +} export interface DistrRecordProtoMsg { typeUrl: "/osmosis.poolincentives.v1beta1.DistrRecord"; value: Uint8Array; @@ -58,6 +73,11 @@ export interface PoolToGauge { gaugeId: bigint; duration: Duration; } +export interface ReactivePoolToGauge { + poolId: ComputedRef<bigint>; + gaugeId: ComputedRef<bigint>; + duration: ComputedRef<Duration>; +} export interface PoolToGaugeProtoMsg { typeUrl: "/osmosis.poolincentives.v1beta1.PoolToGauge"; value: Uint8Array; @@ -70,6 +90,9 @@ export interface PoolToGaugeSDKType { export interface PoolToGauges { poolToGauge: PoolToGauge[]; } +export interface ReactivePoolToGauges { + poolToGauge: ComputedRef<PoolToGauge[]>; +} export interface PoolToGaugesProtoMsg { typeUrl: "/osmosis.poolincentives.v1beta1.PoolToGauges"; value: Uint8Array; @@ -85,7 +108,7 @@ function createBaseParams(): Params { export const Params = { typeUrl: "/osmosis.poolincentives.v1beta1.Params", encode(message: Params, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.mintedDenom !== undefined) { + if (message.mintedDenom !== "") { writer.uint32(10).string(message.mintedDenom); } return writer; @@ -108,9 +131,9 @@ export const Params = { return message; }, fromJSON(object: any): Params { - const obj = createBaseParams(); - if (isSet(object.mintedDenom)) obj.mintedDenom = String(object.mintedDenom); - return obj; + return { + mintedDenom: isSet(object.mintedDenom) ? String(object.mintedDenom) : "" + }; }, toJSON(message: Params): JsonSafe<Params> { const obj: any = {}; @@ -202,9 +225,9 @@ export const LockableDurationsInfo = { return message; }, fromJSON(object: any): LockableDurationsInfo { - const obj = createBaseLockableDurationsInfo(); - if (Array.isArray(object?.lockableDurations)) obj.lockableDurations = object.lockableDurations.map((e: any) => Duration.fromJSON(e)); - return obj; + return { + lockableDurations: Array.isArray(object?.lockableDurations) ? object.lockableDurations.map((e: any) => Duration.fromJSON(e)) : [] + }; }, toJSON(message: LockableDurationsInfo): JsonSafe<LockableDurationsInfo> { const obj: any = {}; @@ -284,7 +307,7 @@ function createBaseDistrInfo(): DistrInfo { export const DistrInfo = { typeUrl: "/osmosis.poolincentives.v1beta1.DistrInfo", encode(message: DistrInfo, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.totalWeight !== undefined) { + if (message.totalWeight !== "") { writer.uint32(10).string(message.totalWeight); } for (const v of message.records) { @@ -313,10 +336,10 @@ export const DistrInfo = { return message; }, fromJSON(object: any): DistrInfo { - const obj = createBaseDistrInfo(); - if (isSet(object.totalWeight)) obj.totalWeight = String(object.totalWeight); - if (Array.isArray(object?.records)) obj.records = object.records.map((e: any) => DistrRecord.fromJSON(e)); - return obj; + return { + totalWeight: isSet(object.totalWeight) ? String(object.totalWeight) : "", + records: Array.isArray(object?.records) ? object.records.map((e: any) => DistrRecord.fromJSON(e)) : [] + }; }, toJSON(message: DistrInfo): JsonSafe<DistrInfo> { const obj: any = {}; @@ -405,10 +428,10 @@ function createBaseDistrRecord(): DistrRecord { export const DistrRecord = { typeUrl: "/osmosis.poolincentives.v1beta1.DistrRecord", encode(message: DistrRecord, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.gaugeId !== undefined) { + if (message.gaugeId !== BigInt(0)) { writer.uint32(8).uint64(message.gaugeId); } - if (message.weight !== undefined) { + if (message.weight !== "") { writer.uint32(18).string(message.weight); } return writer; @@ -434,10 +457,10 @@ export const DistrRecord = { return message; }, fromJSON(object: any): DistrRecord { - const obj = createBaseDistrRecord(); - if (isSet(object.gaugeId)) obj.gaugeId = BigInt(object.gaugeId.toString()); - if (isSet(object.weight)) obj.weight = String(object.weight); - return obj; + return { + gaugeId: isSet(object.gaugeId) ? BigInt(object.gaugeId.toString()) : BigInt(0), + weight: isSet(object.weight) ? String(object.weight) : "" + }; }, toJSON(message: DistrRecord): JsonSafe<DistrRecord> { const obj: any = {}; @@ -447,9 +470,7 @@ export const DistrRecord = { }, fromPartial(object: DeepPartial<DistrRecord>): DistrRecord { const message = createBaseDistrRecord(); - if (object.gaugeId !== undefined && object.gaugeId !== null) { - message.gaugeId = BigInt(object.gaugeId.toString()); - } + message.gaugeId = object.gaugeId !== undefined && object.gaugeId !== null ? BigInt(object.gaugeId.toString()) : BigInt(0); message.weight = object.weight ?? ""; return message; }, @@ -519,10 +540,10 @@ function createBasePoolToGauge(): PoolToGauge { export const PoolToGauge = { typeUrl: "/osmosis.poolincentives.v1beta1.PoolToGauge", encode(message: PoolToGauge, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.poolId !== undefined) { + if (message.poolId !== BigInt(0)) { writer.uint32(8).uint64(message.poolId); } - if (message.gaugeId !== undefined) { + if (message.gaugeId !== BigInt(0)) { writer.uint32(16).uint64(message.gaugeId); } if (message.duration !== undefined) { @@ -554,11 +575,11 @@ export const PoolToGauge = { return message; }, fromJSON(object: any): PoolToGauge { - const obj = createBasePoolToGauge(); - if (isSet(object.poolId)) obj.poolId = BigInt(object.poolId.toString()); - if (isSet(object.gaugeId)) obj.gaugeId = BigInt(object.gaugeId.toString()); - if (isSet(object.duration)) obj.duration = Duration.fromJSON(object.duration); - return obj; + return { + poolId: isSet(object.poolId) ? BigInt(object.poolId.toString()) : BigInt(0), + gaugeId: isSet(object.gaugeId) ? BigInt(object.gaugeId.toString()) : BigInt(0), + duration: isSet(object.duration) ? Duration.fromJSON(object.duration) : undefined + }; }, toJSON(message: PoolToGauge): JsonSafe<PoolToGauge> { const obj: any = {}; @@ -569,15 +590,9 @@ export const PoolToGauge = { }, fromPartial(object: DeepPartial<PoolToGauge>): PoolToGauge { const message = createBasePoolToGauge(); - if (object.poolId !== undefined && object.poolId !== null) { - message.poolId = BigInt(object.poolId.toString()); - } - if (object.gaugeId !== undefined && object.gaugeId !== null) { - message.gaugeId = BigInt(object.gaugeId.toString()); - } - if (object.duration !== undefined && object.duration !== null) { - message.duration = Duration.fromPartial(object.duration); - } + message.poolId = object.poolId !== undefined && object.poolId !== null ? BigInt(object.poolId.toString()) : BigInt(0); + message.gaugeId = object.gaugeId !== undefined && object.gaugeId !== null ? BigInt(object.gaugeId.toString()) : BigInt(0); + message.duration = object.duration !== undefined && object.duration !== null ? Duration.fromPartial(object.duration) : undefined; return message; }, fromSDK(object: PoolToGaugeSDKType): PoolToGauge { @@ -674,9 +689,9 @@ export const PoolToGauges = { return message; }, fromJSON(object: any): PoolToGauges { - const obj = createBasePoolToGauges(); - if (Array.isArray(object?.poolToGauge)) obj.poolToGauge = object.poolToGauge.map((e: any) => PoolToGauge.fromJSON(e)); - return obj; + return { + poolToGauge: Array.isArray(object?.poolToGauge) ? object.poolToGauge.map((e: any) => PoolToGauge.fromJSON(e)) : [] + }; }, toJSON(message: PoolToGauges): JsonSafe<PoolToGauges> { const obj: any = {}; diff --git a/__fixtures__/v-next/outputv4/osmosis/pool-incentives/v1beta1/query.lcd.ts b/__fixtures__/v-next/outputv4/osmosis/pool-incentives/v1beta1/query.lcd.ts index 44171cc8e3..03ee950276 100644 --- a/__fixtures__/v-next/outputv4/osmosis/pool-incentives/v1beta1/query.lcd.ts +++ b/__fixtures__/v-next/outputv4/osmosis/pool-incentives/v1beta1/query.lcd.ts @@ -1,8 +1,8 @@ -import { Duration, DurationSDKType } from "../../../google/protobuf/duration.js"; -import { DistrInfo, DistrInfoSDKType, Params, ParamsSDKType } from "./incentives.js"; -import { Gauge, GaugeSDKType } from "../../incentives/gauge.js"; +import { Duration, DurationSDKType } from "../../../google/protobuf/duration"; +import { DistrInfo, DistrInfoSDKType, Params, ParamsSDKType } from "./incentives"; +import { Gauge, GaugeSDKType } from "../../incentives/gauge"; import { LCDClient } from "@cosmology/lcd"; -import { QueryGaugeIdsRequest, QueryGaugeIdsRequestSDKType, QueryGaugeIdsResponse, QueryGaugeIdsResponseSDKType, QueryDistrInfoRequest, QueryDistrInfoRequestSDKType, QueryDistrInfoResponse, QueryDistrInfoResponseSDKType, QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType, QueryLockableDurationsRequest, QueryLockableDurationsRequestSDKType, QueryLockableDurationsResponse, QueryLockableDurationsResponseSDKType, QueryIncentivizedPoolsRequest, QueryIncentivizedPoolsRequestSDKType, QueryIncentivizedPoolsResponse, QueryIncentivizedPoolsResponseSDKType, QueryExternalIncentiveGaugesRequest, QueryExternalIncentiveGaugesRequestSDKType, QueryExternalIncentiveGaugesResponse, QueryExternalIncentiveGaugesResponseSDKType } from "./query.js"; +import { QueryGaugeIdsRequest, QueryGaugeIdsRequestSDKType, QueryGaugeIdsResponse, QueryGaugeIdsResponseSDKType, QueryDistrInfoRequest, QueryDistrInfoRequestSDKType, QueryDistrInfoResponse, QueryDistrInfoResponseSDKType, QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType, QueryLockableDurationsRequest, QueryLockableDurationsRequestSDKType, QueryLockableDurationsResponse, QueryLockableDurationsResponseSDKType, QueryIncentivizedPoolsRequest, QueryIncentivizedPoolsRequestSDKType, QueryIncentivizedPoolsResponse, QueryIncentivizedPoolsResponseSDKType, QueryExternalIncentiveGaugesRequest, QueryExternalIncentiveGaugesRequestSDKType, QueryExternalIncentiveGaugesResponse, QueryExternalIncentiveGaugesResponseSDKType } from "./query"; export class LCDQueryClient { req: LCDClient; constructor({ diff --git a/__fixtures__/v-next/outputv4/osmosis/pool-incentives/v1beta1/query.rpc.Query.ts b/__fixtures__/v-next/outputv4/osmosis/pool-incentives/v1beta1/query.rpc.Query.ts index 6e0c2c74dd..4b1c0210e6 100644 --- a/__fixtures__/v-next/outputv4/osmosis/pool-incentives/v1beta1/query.rpc.Query.ts +++ b/__fixtures__/v-next/outputv4/osmosis/pool-incentives/v1beta1/query.rpc.Query.ts @@ -1,10 +1,10 @@ -import { Duration, DurationSDKType } from "../../../google/protobuf/duration.js"; -import { DistrInfo, DistrInfoSDKType, Params, ParamsSDKType } from "./incentives.js"; -import { Gauge, GaugeSDKType } from "../../incentives/gauge.js"; -import { Rpc } from "../../../helpers.js"; -import { BinaryReader } from "../../../binary.js"; +import { Duration, DurationSDKType } from "../../../google/protobuf/duration"; +import { DistrInfo, DistrInfoSDKType, Params, ParamsSDKType } from "./incentives"; +import { Gauge, GaugeSDKType } from "../../incentives/gauge"; +import { Rpc } from "../../../helpers"; +import { BinaryReader } from "../../../binary"; import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; -import { QueryGaugeIdsRequest, QueryGaugeIdsRequestSDKType, QueryGaugeIdsResponse, QueryGaugeIdsResponseSDKType, QueryDistrInfoRequest, QueryDistrInfoRequestSDKType, QueryDistrInfoResponse, QueryDistrInfoResponseSDKType, QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType, QueryLockableDurationsRequest, QueryLockableDurationsRequestSDKType, QueryLockableDurationsResponse, QueryLockableDurationsResponseSDKType, QueryIncentivizedPoolsRequest, QueryIncentivizedPoolsRequestSDKType, QueryIncentivizedPoolsResponse, QueryIncentivizedPoolsResponseSDKType, QueryExternalIncentiveGaugesRequest, QueryExternalIncentiveGaugesRequestSDKType, QueryExternalIncentiveGaugesResponse, QueryExternalIncentiveGaugesResponseSDKType } from "./query.js"; +import { QueryGaugeIdsRequest, QueryGaugeIdsRequestSDKType, QueryGaugeIdsResponse, QueryGaugeIdsResponseSDKType, QueryDistrInfoRequest, QueryDistrInfoRequestSDKType, QueryDistrInfoResponse, QueryDistrInfoResponseSDKType, QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType, QueryLockableDurationsRequest, QueryLockableDurationsRequestSDKType, QueryLockableDurationsResponse, QueryLockableDurationsResponseSDKType, QueryIncentivizedPoolsRequest, QueryIncentivizedPoolsRequestSDKType, QueryIncentivizedPoolsResponse, QueryIncentivizedPoolsResponseSDKType, QueryExternalIncentiveGaugesRequest, QueryExternalIncentiveGaugesRequestSDKType, QueryExternalIncentiveGaugesResponse, QueryExternalIncentiveGaugesResponseSDKType, ReactiveQueryGaugeIdsRequest, ReactiveQueryDistrInfoRequest, ReactiveQueryParamsRequest, ReactiveQueryLockableDurationsRequest, ReactiveQueryIncentivizedPoolsRequest, ReactiveQueryExternalIncentiveGaugesRequest } from "./query"; export interface Query { /** GaugeIds takes the pool id and returns the matching gauge ids and durations */ gaugeIds(request: QueryGaugeIdsRequest): Promise<QueryGaugeIdsResponse>; diff --git a/__fixtures__/v-next/outputv4/osmosis/pool-incentives/v1beta1/query.ts b/__fixtures__/v-next/outputv4/osmosis/pool-incentives/v1beta1/query.ts index 42c80e30ec..844cc21355 100644 --- a/__fixtures__/v-next/outputv4/osmosis/pool-incentives/v1beta1/query.ts +++ b/__fixtures__/v-next/outputv4/osmosis/pool-incentives/v1beta1/query.ts @@ -1,13 +1,17 @@ -import { Duration, DurationSDKType } from "../../../google/protobuf/duration.js"; -import { DistrInfo, DistrInfoSDKType, Params, ParamsSDKType } from "./incentives.js"; -import { Gauge, GaugeSDKType } from "../../incentives/gauge.js"; -import { BinaryReader, BinaryWriter } from "../../../binary.js"; -import { isSet, DeepPartial } from "../../../helpers.js"; -import { JsonSafe } from "../../../json-safe.js"; +import { Duration, DurationSDKType } from "../../../google/protobuf/duration"; +import { DistrInfo, DistrInfoSDKType, Params, ParamsSDKType } from "./incentives"; +import { Gauge, GaugeSDKType } from "../../incentives/gauge"; +import { BinaryReader, BinaryWriter } from "../../../binary"; +import { isSet, DeepPartial } from "../../../helpers"; +import { JsonSafe } from "../../../json-safe"; +import { ComputedRef } from "vue"; export const protobufPackage = "osmosis.poolincentives.v1beta1"; export interface QueryGaugeIdsRequest { poolId: bigint; } +export interface ReactiveQueryGaugeIdsRequest { + poolId: ComputedRef<bigint>; +} export interface QueryGaugeIdsRequestProtoMsg { typeUrl: "/osmosis.poolincentives.v1beta1.QueryGaugeIdsRequest"; value: Uint8Array; @@ -18,6 +22,9 @@ export interface QueryGaugeIdsRequestSDKType { export interface QueryGaugeIdsResponse { gaugeIdsWithDuration: QueryGaugeIdsResponse_GaugeIdWithDuration[]; } +export interface ReactiveQueryGaugeIdsResponse { + gaugeIdsWithDuration: ComputedRef<QueryGaugeIdsResponse_GaugeIdWithDuration[]>; +} export interface QueryGaugeIdsResponseProtoMsg { typeUrl: "/osmosis.poolincentives.v1beta1.QueryGaugeIdsResponse"; value: Uint8Array; @@ -30,6 +37,11 @@ export interface QueryGaugeIdsResponse_GaugeIdWithDuration { duration: Duration; gaugeIncentivePercentage: string; } +export interface ReactiveQueryGaugeIdsResponse_GaugeIdWithDuration { + gaugeId: ComputedRef<bigint>; + duration: ComputedRef<Duration>; + gaugeIncentivePercentage: ComputedRef<string>; +} export interface QueryGaugeIdsResponse_GaugeIdWithDurationProtoMsg { typeUrl: "/osmosis.poolincentives.v1beta1.GaugeIdWithDuration"; value: Uint8Array; @@ -40,6 +52,7 @@ export interface QueryGaugeIdsResponse_GaugeIdWithDurationSDKType { gauge_incentive_percentage: string; } export interface QueryDistrInfoRequest {} +export interface ReactiveQueryDistrInfoRequest {} export interface QueryDistrInfoRequestProtoMsg { typeUrl: "/osmosis.poolincentives.v1beta1.QueryDistrInfoRequest"; value: Uint8Array; @@ -48,6 +61,9 @@ export interface QueryDistrInfoRequestSDKType {} export interface QueryDistrInfoResponse { distrInfo: DistrInfo; } +export interface ReactiveQueryDistrInfoResponse { + distrInfo: ComputedRef<DistrInfo>; +} export interface QueryDistrInfoResponseProtoMsg { typeUrl: "/osmosis.poolincentives.v1beta1.QueryDistrInfoResponse"; value: Uint8Array; @@ -56,6 +72,7 @@ export interface QueryDistrInfoResponseSDKType { distr_info: DistrInfoSDKType; } export interface QueryParamsRequest {} +export interface ReactiveQueryParamsRequest {} export interface QueryParamsRequestProtoMsg { typeUrl: "/osmosis.poolincentives.v1beta1.QueryParamsRequest"; value: Uint8Array; @@ -64,6 +81,9 @@ export interface QueryParamsRequestSDKType {} export interface QueryParamsResponse { params: Params; } +export interface ReactiveQueryParamsResponse { + params: ComputedRef<Params>; +} export interface QueryParamsResponseProtoMsg { typeUrl: "/osmosis.poolincentives.v1beta1.QueryParamsResponse"; value: Uint8Array; @@ -72,6 +92,7 @@ export interface QueryParamsResponseSDKType { params: ParamsSDKType; } export interface QueryLockableDurationsRequest {} +export interface ReactiveQueryLockableDurationsRequest {} export interface QueryLockableDurationsRequestProtoMsg { typeUrl: "/osmosis.poolincentives.v1beta1.QueryLockableDurationsRequest"; value: Uint8Array; @@ -80,6 +101,9 @@ export interface QueryLockableDurationsRequestSDKType {} export interface QueryLockableDurationsResponse { lockableDurations: Duration[]; } +export interface ReactiveQueryLockableDurationsResponse { + lockableDurations: ComputedRef<Duration[]>; +} export interface QueryLockableDurationsResponseProtoMsg { typeUrl: "/osmosis.poolincentives.v1beta1.QueryLockableDurationsResponse"; value: Uint8Array; @@ -88,6 +112,7 @@ export interface QueryLockableDurationsResponseSDKType { lockable_durations: DurationSDKType[]; } export interface QueryIncentivizedPoolsRequest {} +export interface ReactiveQueryIncentivizedPoolsRequest {} export interface QueryIncentivizedPoolsRequestProtoMsg { typeUrl: "/osmosis.poolincentives.v1beta1.QueryIncentivizedPoolsRequest"; value: Uint8Array; @@ -98,6 +123,11 @@ export interface IncentivizedPool { lockableDuration: Duration; gaugeId: bigint; } +export interface ReactiveIncentivizedPool { + poolId: ComputedRef<bigint>; + lockableDuration: ComputedRef<Duration>; + gaugeId: ComputedRef<bigint>; +} export interface IncentivizedPoolProtoMsg { typeUrl: "/osmosis.poolincentives.v1beta1.IncentivizedPool"; value: Uint8Array; @@ -110,6 +140,9 @@ export interface IncentivizedPoolSDKType { export interface QueryIncentivizedPoolsResponse { incentivizedPools: IncentivizedPool[]; } +export interface ReactiveQueryIncentivizedPoolsResponse { + incentivizedPools: ComputedRef<IncentivizedPool[]>; +} export interface QueryIncentivizedPoolsResponseProtoMsg { typeUrl: "/osmosis.poolincentives.v1beta1.QueryIncentivizedPoolsResponse"; value: Uint8Array; @@ -118,6 +151,7 @@ export interface QueryIncentivizedPoolsResponseSDKType { incentivized_pools: IncentivizedPoolSDKType[]; } export interface QueryExternalIncentiveGaugesRequest {} +export interface ReactiveQueryExternalIncentiveGaugesRequest {} export interface QueryExternalIncentiveGaugesRequestProtoMsg { typeUrl: "/osmosis.poolincentives.v1beta1.QueryExternalIncentiveGaugesRequest"; value: Uint8Array; @@ -126,6 +160,9 @@ export interface QueryExternalIncentiveGaugesRequestSDKType {} export interface QueryExternalIncentiveGaugesResponse { data: Gauge[]; } +export interface ReactiveQueryExternalIncentiveGaugesResponse { + data: ComputedRef<Gauge[]>; +} export interface QueryExternalIncentiveGaugesResponseProtoMsg { typeUrl: "/osmosis.poolincentives.v1beta1.QueryExternalIncentiveGaugesResponse"; value: Uint8Array; @@ -141,7 +178,7 @@ function createBaseQueryGaugeIdsRequest(): QueryGaugeIdsRequest { export const QueryGaugeIdsRequest = { typeUrl: "/osmosis.poolincentives.v1beta1.QueryGaugeIdsRequest", encode(message: QueryGaugeIdsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.poolId !== undefined) { + if (message.poolId !== BigInt(0)) { writer.uint32(8).uint64(message.poolId); } return writer; @@ -164,9 +201,9 @@ export const QueryGaugeIdsRequest = { return message; }, fromJSON(object: any): QueryGaugeIdsRequest { - const obj = createBaseQueryGaugeIdsRequest(); - if (isSet(object.poolId)) obj.poolId = BigInt(object.poolId.toString()); - return obj; + return { + poolId: isSet(object.poolId) ? BigInt(object.poolId.toString()) : BigInt(0) + }; }, toJSON(message: QueryGaugeIdsRequest): JsonSafe<QueryGaugeIdsRequest> { const obj: any = {}; @@ -175,9 +212,7 @@ export const QueryGaugeIdsRequest = { }, fromPartial(object: DeepPartial<QueryGaugeIdsRequest>): QueryGaugeIdsRequest { const message = createBaseQueryGaugeIdsRequest(); - if (object.poolId !== undefined && object.poolId !== null) { - message.poolId = BigInt(object.poolId.toString()); - } + message.poolId = object.poolId !== undefined && object.poolId !== null ? BigInt(object.poolId.toString()) : BigInt(0); return message; }, fromSDK(object: QueryGaugeIdsRequestSDKType): QueryGaugeIdsRequest { @@ -260,9 +295,9 @@ export const QueryGaugeIdsResponse = { return message; }, fromJSON(object: any): QueryGaugeIdsResponse { - const obj = createBaseQueryGaugeIdsResponse(); - if (Array.isArray(object?.gaugeIdsWithDuration)) obj.gaugeIdsWithDuration = object.gaugeIdsWithDuration.map((e: any) => QueryGaugeIdsResponse_GaugeIdWithDuration.fromJSON(e)); - return obj; + return { + gaugeIdsWithDuration: Array.isArray(object?.gaugeIdsWithDuration) ? object.gaugeIdsWithDuration.map((e: any) => QueryGaugeIdsResponse_GaugeIdWithDuration.fromJSON(e)) : [] + }; }, toJSON(message: QueryGaugeIdsResponse): JsonSafe<QueryGaugeIdsResponse> { const obj: any = {}; @@ -343,13 +378,13 @@ function createBaseQueryGaugeIdsResponse_GaugeIdWithDuration(): QueryGaugeIdsRes export const QueryGaugeIdsResponse_GaugeIdWithDuration = { typeUrl: "/osmosis.poolincentives.v1beta1.GaugeIdWithDuration", encode(message: QueryGaugeIdsResponse_GaugeIdWithDuration, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.gaugeId !== undefined) { + if (message.gaugeId !== BigInt(0)) { writer.uint32(8).uint64(message.gaugeId); } if (message.duration !== undefined) { Duration.encode(message.duration, writer.uint32(18).fork()).ldelim(); } - if (message.gaugeIncentivePercentage !== undefined) { + if (message.gaugeIncentivePercentage !== "") { writer.uint32(26).string(message.gaugeIncentivePercentage); } return writer; @@ -378,11 +413,11 @@ export const QueryGaugeIdsResponse_GaugeIdWithDuration = { return message; }, fromJSON(object: any): QueryGaugeIdsResponse_GaugeIdWithDuration { - const obj = createBaseQueryGaugeIdsResponse_GaugeIdWithDuration(); - if (isSet(object.gaugeId)) obj.gaugeId = BigInt(object.gaugeId.toString()); - if (isSet(object.duration)) obj.duration = Duration.fromJSON(object.duration); - if (isSet(object.gaugeIncentivePercentage)) obj.gaugeIncentivePercentage = String(object.gaugeIncentivePercentage); - return obj; + return { + gaugeId: isSet(object.gaugeId) ? BigInt(object.gaugeId.toString()) : BigInt(0), + duration: isSet(object.duration) ? Duration.fromJSON(object.duration) : undefined, + gaugeIncentivePercentage: isSet(object.gaugeIncentivePercentage) ? String(object.gaugeIncentivePercentage) : "" + }; }, toJSON(message: QueryGaugeIdsResponse_GaugeIdWithDuration): JsonSafe<QueryGaugeIdsResponse_GaugeIdWithDuration> { const obj: any = {}; @@ -393,12 +428,8 @@ export const QueryGaugeIdsResponse_GaugeIdWithDuration = { }, fromPartial(object: DeepPartial<QueryGaugeIdsResponse_GaugeIdWithDuration>): QueryGaugeIdsResponse_GaugeIdWithDuration { const message = createBaseQueryGaugeIdsResponse_GaugeIdWithDuration(); - if (object.gaugeId !== undefined && object.gaugeId !== null) { - message.gaugeId = BigInt(object.gaugeId.toString()); - } - if (object.duration !== undefined && object.duration !== null) { - message.duration = Duration.fromPartial(object.duration); - } + message.gaugeId = object.gaugeId !== undefined && object.gaugeId !== null ? BigInt(object.gaugeId.toString()) : BigInt(0); + message.duration = object.duration !== undefined && object.duration !== null ? Duration.fromPartial(object.duration) : undefined; message.gaugeIncentivePercentage = object.gaugeIncentivePercentage ?? ""; return message; }, @@ -488,8 +519,7 @@ export const QueryDistrInfoRequest = { return message; }, fromJSON(_: any): QueryDistrInfoRequest { - const obj = createBaseQueryDistrInfoRequest(); - return obj; + return {}; }, toJSON(_: QueryDistrInfoRequest): JsonSafe<QueryDistrInfoRequest> { const obj: any = {}; @@ -570,9 +600,9 @@ export const QueryDistrInfoResponse = { return message; }, fromJSON(object: any): QueryDistrInfoResponse { - const obj = createBaseQueryDistrInfoResponse(); - if (isSet(object.distrInfo)) obj.distrInfo = DistrInfo.fromJSON(object.distrInfo); - return obj; + return { + distrInfo: isSet(object.distrInfo) ? DistrInfo.fromJSON(object.distrInfo) : undefined + }; }, toJSON(message: QueryDistrInfoResponse): JsonSafe<QueryDistrInfoResponse> { const obj: any = {}; @@ -581,9 +611,7 @@ export const QueryDistrInfoResponse = { }, fromPartial(object: DeepPartial<QueryDistrInfoResponse>): QueryDistrInfoResponse { const message = createBaseQueryDistrInfoResponse(); - if (object.distrInfo !== undefined && object.distrInfo !== null) { - message.distrInfo = DistrInfo.fromPartial(object.distrInfo); - } + message.distrInfo = object.distrInfo !== undefined && object.distrInfo !== null ? DistrInfo.fromPartial(object.distrInfo) : undefined; return message; }, fromSDK(object: QueryDistrInfoResponseSDKType): QueryDistrInfoResponse { @@ -658,8 +686,7 @@ export const QueryParamsRequest = { return message; }, fromJSON(_: any): QueryParamsRequest { - const obj = createBaseQueryParamsRequest(); - return obj; + return {}; }, toJSON(_: QueryParamsRequest): JsonSafe<QueryParamsRequest> { const obj: any = {}; @@ -740,9 +767,9 @@ export const QueryParamsResponse = { return message; }, fromJSON(object: any): QueryParamsResponse { - const obj = createBaseQueryParamsResponse(); - if (isSet(object.params)) obj.params = Params.fromJSON(object.params); - return obj; + return { + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined + }; }, toJSON(message: QueryParamsResponse): JsonSafe<QueryParamsResponse> { const obj: any = {}; @@ -751,9 +778,7 @@ export const QueryParamsResponse = { }, fromPartial(object: DeepPartial<QueryParamsResponse>): QueryParamsResponse { const message = createBaseQueryParamsResponse(); - if (object.params !== undefined && object.params !== null) { - message.params = Params.fromPartial(object.params); - } + message.params = object.params !== undefined && object.params !== null ? Params.fromPartial(object.params) : undefined; return message; }, fromSDK(object: QueryParamsResponseSDKType): QueryParamsResponse { @@ -828,8 +853,7 @@ export const QueryLockableDurationsRequest = { return message; }, fromJSON(_: any): QueryLockableDurationsRequest { - const obj = createBaseQueryLockableDurationsRequest(); - return obj; + return {}; }, toJSON(_: QueryLockableDurationsRequest): JsonSafe<QueryLockableDurationsRequest> { const obj: any = {}; @@ -910,9 +934,9 @@ export const QueryLockableDurationsResponse = { return message; }, fromJSON(object: any): QueryLockableDurationsResponse { - const obj = createBaseQueryLockableDurationsResponse(); - if (Array.isArray(object?.lockableDurations)) obj.lockableDurations = object.lockableDurations.map((e: any) => Duration.fromJSON(e)); - return obj; + return { + lockableDurations: Array.isArray(object?.lockableDurations) ? object.lockableDurations.map((e: any) => Duration.fromJSON(e)) : [] + }; }, toJSON(message: QueryLockableDurationsResponse): JsonSafe<QueryLockableDurationsResponse> { const obj: any = {}; @@ -1006,8 +1030,7 @@ export const QueryIncentivizedPoolsRequest = { return message; }, fromJSON(_: any): QueryIncentivizedPoolsRequest { - const obj = createBaseQueryIncentivizedPoolsRequest(); - return obj; + return {}; }, toJSON(_: QueryIncentivizedPoolsRequest): JsonSafe<QueryIncentivizedPoolsRequest> { const obj: any = {}; @@ -1067,13 +1090,13 @@ function createBaseIncentivizedPool(): IncentivizedPool { export const IncentivizedPool = { typeUrl: "/osmosis.poolincentives.v1beta1.IncentivizedPool", encode(message: IncentivizedPool, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.poolId !== undefined) { + if (message.poolId !== BigInt(0)) { writer.uint32(8).uint64(message.poolId); } if (message.lockableDuration !== undefined) { Duration.encode(message.lockableDuration, writer.uint32(18).fork()).ldelim(); } - if (message.gaugeId !== undefined) { + if (message.gaugeId !== BigInt(0)) { writer.uint32(24).uint64(message.gaugeId); } return writer; @@ -1102,11 +1125,11 @@ export const IncentivizedPool = { return message; }, fromJSON(object: any): IncentivizedPool { - const obj = createBaseIncentivizedPool(); - if (isSet(object.poolId)) obj.poolId = BigInt(object.poolId.toString()); - if (isSet(object.lockableDuration)) obj.lockableDuration = Duration.fromJSON(object.lockableDuration); - if (isSet(object.gaugeId)) obj.gaugeId = BigInt(object.gaugeId.toString()); - return obj; + return { + poolId: isSet(object.poolId) ? BigInt(object.poolId.toString()) : BigInt(0), + lockableDuration: isSet(object.lockableDuration) ? Duration.fromJSON(object.lockableDuration) : undefined, + gaugeId: isSet(object.gaugeId) ? BigInt(object.gaugeId.toString()) : BigInt(0) + }; }, toJSON(message: IncentivizedPool): JsonSafe<IncentivizedPool> { const obj: any = {}; @@ -1117,15 +1140,9 @@ export const IncentivizedPool = { }, fromPartial(object: DeepPartial<IncentivizedPool>): IncentivizedPool { const message = createBaseIncentivizedPool(); - if (object.poolId !== undefined && object.poolId !== null) { - message.poolId = BigInt(object.poolId.toString()); - } - if (object.lockableDuration !== undefined && object.lockableDuration !== null) { - message.lockableDuration = Duration.fromPartial(object.lockableDuration); - } - if (object.gaugeId !== undefined && object.gaugeId !== null) { - message.gaugeId = BigInt(object.gaugeId.toString()); - } + message.poolId = object.poolId !== undefined && object.poolId !== null ? BigInt(object.poolId.toString()) : BigInt(0); + message.lockableDuration = object.lockableDuration !== undefined && object.lockableDuration !== null ? Duration.fromPartial(object.lockableDuration) : undefined; + message.gaugeId = object.gaugeId !== undefined && object.gaugeId !== null ? BigInt(object.gaugeId.toString()) : BigInt(0); return message; }, fromSDK(object: IncentivizedPoolSDKType): IncentivizedPool { @@ -1222,9 +1239,9 @@ export const QueryIncentivizedPoolsResponse = { return message; }, fromJSON(object: any): QueryIncentivizedPoolsResponse { - const obj = createBaseQueryIncentivizedPoolsResponse(); - if (Array.isArray(object?.incentivizedPools)) obj.incentivizedPools = object.incentivizedPools.map((e: any) => IncentivizedPool.fromJSON(e)); - return obj; + return { + incentivizedPools: Array.isArray(object?.incentivizedPools) ? object.incentivizedPools.map((e: any) => IncentivizedPool.fromJSON(e)) : [] + }; }, toJSON(message: QueryIncentivizedPoolsResponse): JsonSafe<QueryIncentivizedPoolsResponse> { const obj: any = {}; @@ -1318,8 +1335,7 @@ export const QueryExternalIncentiveGaugesRequest = { return message; }, fromJSON(_: any): QueryExternalIncentiveGaugesRequest { - const obj = createBaseQueryExternalIncentiveGaugesRequest(); - return obj; + return {}; }, toJSON(_: QueryExternalIncentiveGaugesRequest): JsonSafe<QueryExternalIncentiveGaugesRequest> { const obj: any = {}; @@ -1400,9 +1416,9 @@ export const QueryExternalIncentiveGaugesResponse = { return message; }, fromJSON(object: any): QueryExternalIncentiveGaugesResponse { - const obj = createBaseQueryExternalIncentiveGaugesResponse(); - if (Array.isArray(object?.data)) obj.data = object.data.map((e: any) => Gauge.fromJSON(e)); - return obj; + return { + data: Array.isArray(object?.data) ? object.data.map((e: any) => Gauge.fromJSON(e)) : [] + }; }, toJSON(message: QueryExternalIncentiveGaugesResponse): JsonSafe<QueryExternalIncentiveGaugesResponse> { const obj: any = {}; diff --git a/__fixtures__/v-next/outputv4/osmosis/rpc.query.ts b/__fixtures__/v-next/outputv4/osmosis/rpc.query.ts index 890b421414..e5fcc1fff5 100644 --- a/__fixtures__/v-next/outputv4/osmosis/rpc.query.ts +++ b/__fixtures__/v-next/outputv4/osmosis/rpc.query.ts @@ -1,105 +1,126 @@ -import { Rpc } from "../helpers.js"; -import { connectComet, HttpEndpoint } from "@cosmjs/tendermint-rpc"; +import { Rpc } from "../helpers"; +import { Tendermint34Client, HttpEndpoint } from "@cosmjs/tendermint-rpc"; import { QueryClient } from "@cosmjs/stargate"; export const createRPCQueryClient = async ({ rpcEndpoint }: { rpcEndpoint: string | HttpEndpoint; }) => { - const tmClient = await connectComet(rpcEndpoint); + const tmClient = await Tendermint34Client.connect(rpcEndpoint); const client = new QueryClient(tmClient); return { cosmos: { app: { - v1alpha1: (await import("../cosmos/app/v1alpha1/query.rpc.Query.js")).createRpcQueryExtension(client) + v1alpha1: (await import("../cosmos/app/v1alpha1/query.rpc.Query")).createRpcQueryExtension(client) }, auth: { - v1beta1: (await import("../cosmos/auth/v1beta1/query.rpc.Query.js")).createRpcQueryExtension(client) + v1beta1: (await import("../cosmos/auth/v1beta1/query.rpc.Query")).createRpcQueryExtension(client) }, authz: { - v1beta1: (await import("../cosmos/authz/v1beta1/query.rpc.Query.js")).createRpcQueryExtension(client) + v1beta1: (await import("../cosmos/authz/v1beta1/query.rpc.Query")).createRpcQueryExtension(client) }, bank: { - v1beta1: (await import("../cosmos/bank/v1beta1/query.rpc.Query.js")).createRpcQueryExtension(client) + v1beta1: (await import("../cosmos/bank/v1beta1/query.rpc.Query")).createRpcQueryExtension(client) }, base: { reflection: { - 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) + v1beta1: (await import("../cosmos/base/reflection/v1beta1/reflection.rpc.ReflectionService")).createRpcQueryExtension(client), + v2alpha1: (await import("../cosmos/base/reflection/v2alpha1/reflection.rpc.ReflectionService")).createRpcQueryExtension(client) }, tendermint: { - v1beta1: (await import("../cosmos/base/tendermint/v1beta1/query.rpc.Service.js")).createRpcQueryExtension(client) + 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) } }, distribution: { - v1beta1: (await import("../cosmos/distribution/v1beta1/query.rpc.Query.js")).createRpcQueryExtension(client) + v1beta1: (await import("../cosmos/distribution/v1beta1/query.rpc.Query")).createRpcQueryExtension(client) }, evidence: { - v1beta1: (await import("../cosmos/evidence/v1beta1/query.rpc.Query.js")).createRpcQueryExtension(client) + v1beta1: (await import("../cosmos/evidence/v1beta1/query.rpc.Query")).createRpcQueryExtension(client) }, feegrant: { - v1beta1: (await import("../cosmos/feegrant/v1beta1/query.rpc.Query.js")).createRpcQueryExtension(client) + v1beta1: (await import("../cosmos/feegrant/v1beta1/query.rpc.Query")).createRpcQueryExtension(client) }, gov: { - v1: (await import("../cosmos/gov/v1/query.rpc.Query.js")).createRpcQueryExtension(client), - v1beta1: (await import("../cosmos/gov/v1beta1/query.rpc.Query.js")).createRpcQueryExtension(client) + v1: (await import("../cosmos/gov/v1/query.rpc.Query")).createRpcQueryExtension(client), + v1beta1: (await import("../cosmos/gov/v1beta1/query.rpc.Query")).createRpcQueryExtension(client) }, group: { - v1: (await import("../cosmos/group/v1/query.rpc.Query.js")).createRpcQueryExtension(client) + v1: (await import("../cosmos/group/v1/query.rpc.Query")).createRpcQueryExtension(client) }, mint: { - v1beta1: (await import("../cosmos/mint/v1beta1/query.rpc.Query.js")).createRpcQueryExtension(client) + v1beta1: (await import("../cosmos/mint/v1beta1/query.rpc.Query")).createRpcQueryExtension(client) }, nft: { - v1beta1: (await import("../cosmos/nft/v1beta1/query.rpc.Query.js")).createRpcQueryExtension(client) + v1beta1: (await import("../cosmos/nft/v1beta1/query.rpc.Query")).createRpcQueryExtension(client) }, params: { - v1beta1: (await import("../cosmos/params/v1beta1/query.rpc.Query.js")).createRpcQueryExtension(client) + v1beta1: (await import("../cosmos/params/v1beta1/query.rpc.Query")).createRpcQueryExtension(client) }, slashing: { - v1beta1: (await import("../cosmos/slashing/v1beta1/query.rpc.Query.js")).createRpcQueryExtension(client) + v1beta1: (await import("../cosmos/slashing/v1beta1/query.rpc.Query")).createRpcQueryExtension(client) }, staking: { - v1beta1: (await import("../cosmos/staking/v1beta1/query.rpc.Query.js")).createRpcQueryExtension(client) + v1beta1: (await import("../cosmos/staking/v1beta1/query.rpc.Query")).createRpcQueryExtension(client) }, tx: { - v1beta1: (await import("../cosmos/tx/v1beta1/service.rpc.Service.js")).createRpcQueryExtension(client) + v1beta1: (await import("../cosmos/tx/v1beta1/service.rpc.Service")).createRpcQueryExtension(client) }, upgrade: { - v1beta1: (await import("../cosmos/upgrade/v1beta1/query.rpc.Query.js")).createRpcQueryExtension(client) + v1beta1: (await import("../cosmos/upgrade/v1beta1/query.rpc.Query")).createRpcQueryExtension(client) } }, osmosis: { claim: { - v1beta1: (await import("./claim/v1beta1/query.rpc.Query.js")).createRpcQueryExtension(client) + v1beta1: (await import("./claim/v1beta1/query.rpc.Query")).createRpcQueryExtension(client) }, epochs: { - v1beta1: (await import("./epochs/query.rpc.Query.js")).createRpcQueryExtension(client) + v1beta1: (await import("./epochs/query.rpc.Query")).createRpcQueryExtension(client) }, gamm: { - v1beta1: (await import("./gamm/v1beta1/query.rpc.Query.js")).createRpcQueryExtension(client), - v2: (await import("./gamm/v2/query.rpc.Query.js")).createRpcQueryExtension(client) + v1beta1: (await import("./gamm/v1beta1/query.rpc.Query")).createRpcQueryExtension(client), + v2: (await import("./gamm/v2/query.rpc.Query")).createRpcQueryExtension(client) }, ibcratelimit: { - v1beta1: (await import("./ibc-rate-limit/v1beta1/query.rpc.Query.js")).createRpcQueryExtension(client) + v1beta1: (await import("./ibc-rate-limit/v1beta1/query.rpc.Query")).createRpcQueryExtension(client) }, - incentives: (await import("./incentives/query.rpc.Query.js")).createRpcQueryExtension(client), - lockup: (await import("./lockup/query.rpc.Query.js")).createRpcQueryExtension(client), + incentives: (await import("./incentives/query.rpc.Query")).createRpcQueryExtension(client), + lockup: (await import("./lockup/query.rpc.Query")).createRpcQueryExtension(client), mint: { - v1beta1: (await import("./mint/v1beta1/query.rpc.Query.js")).createRpcQueryExtension(client) + v1beta1: (await import("./mint/v1beta1/query.rpc.Query")).createRpcQueryExtension(client) }, poolincentives: { - v1beta1: (await import("./pool-incentives/v1beta1/query.rpc.Query.js")).createRpcQueryExtension(client) + v1beta1: (await import("./pool-incentives/v1beta1/query.rpc.Query")).createRpcQueryExtension(client) }, - superfluid: (await import("./superfluid/query.rpc.Query.js")).createRpcQueryExtension(client), + superfluid: (await import("./superfluid/query.rpc.Query")).createRpcQueryExtension(client), tokenfactory: { - v1beta1: (await import("./tokenfactory/v1beta1/query.rpc.Query.js")).createRpcQueryExtension(client) + v1beta1: (await import("./tokenfactory/v1beta1/query.rpc.Query")).createRpcQueryExtension(client) }, twap: { - v1beta1: (await import("./twap/v1beta1/query.rpc.Query.js")).createRpcQueryExtension(client) + v1beta1: (await import("./twap/v1beta1/query.rpc.Query")).createRpcQueryExtension(client) }, txfees: { - v1beta1: (await import("./txfees/v1beta1/query.rpc.Query.js")).createRpcQueryExtension(client) + v1beta1: (await import("./txfees/v1beta1/query.rpc.Query")).createRpcQueryExtension(client) + }, + concentratedliquidity: { + v1beta1: (await import("./concentrated-liquidity/pool-model/query.rpc.Query")).createRpcQueryExtension(client) + }, + cosmwasmpool: { + v1beta1: (await import("./cosmwasmpool/v1beta1/query.rpc.Query")).createRpcQueryExtension(client) + }, + downtimedetector: { + v1beta1: (await import("./downtime-detector/v1beta1/query.rpc.Query")).createRpcQueryExtension(client) + }, + poolmanager: { + v1beta1: (await import("./poolmanager/v1beta1/query.rpc.Query")).createRpcQueryExtension(client) + }, + protorev: { + v1beta1: (await import("./protorev/v1beta1/query.rpc.Query")).createRpcQueryExtension(client) + }, + valsetpref: { + v1beta1: (await import("./valset-pref/v1beta1/query.rpc.Query")).createRpcQueryExtension(client) } } }; diff --git a/__fixtures__/v-next/outputv4/osmosis/rpc.tx.ts b/__fixtures__/v-next/outputv4/osmosis/rpc.tx.ts index 66aefa3f2b..e8d3598064 100644 --- a/__fixtures__/v-next/outputv4/osmosis/rpc.tx.ts +++ b/__fixtures__/v-next/outputv4/osmosis/rpc.tx.ts @@ -1,4 +1,4 @@ -import { Rpc } from "../helpers.js"; +import { Rpc } from "../helpers"; export const createRPCMsgClient = async ({ rpc }: { @@ -6,63 +6,75 @@ export const createRPCMsgClient = async ({ }) => ({ cosmos: { authz: { - v1beta1: new (await import("../cosmos/authz/v1beta1/tx.rpc.msg.js")).MsgClientImpl(rpc) + v1beta1: new (await import("../cosmos/authz/v1beta1/tx.rpc.msg")).MsgClientImpl(rpc) }, bank: { - v1beta1: new (await import("../cosmos/bank/v1beta1/tx.rpc.msg.js")).MsgClientImpl(rpc) + v1beta1: new (await import("../cosmos/bank/v1beta1/tx.rpc.msg")).MsgClientImpl(rpc) }, crisis: { - v1beta1: new (await import("../cosmos/crisis/v1beta1/tx.rpc.msg.js")).MsgClientImpl(rpc) + v1beta1: new (await import("../cosmos/crisis/v1beta1/tx.rpc.msg")).MsgClientImpl(rpc) }, distribution: { - v1beta1: new (await import("../cosmos/distribution/v1beta1/tx.rpc.msg.js")).MsgClientImpl(rpc) + v1beta1: new (await import("../cosmos/distribution/v1beta1/tx.rpc.msg")).MsgClientImpl(rpc) }, evidence: { - v1beta1: new (await import("../cosmos/evidence/v1beta1/tx.rpc.msg.js")).MsgClientImpl(rpc) + v1beta1: new (await import("../cosmos/evidence/v1beta1/tx.rpc.msg")).MsgClientImpl(rpc) }, feegrant: { - v1beta1: new (await import("../cosmos/feegrant/v1beta1/tx.rpc.msg.js")).MsgClientImpl(rpc) + v1beta1: new (await import("../cosmos/feegrant/v1beta1/tx.rpc.msg")).MsgClientImpl(rpc) }, gov: { - 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) + v1: new (await import("../cosmos/gov/v1/tx.rpc.msg")).MsgClientImpl(rpc), + v1beta1: new (await import("../cosmos/gov/v1beta1/tx.rpc.msg")).MsgClientImpl(rpc) }, group: { - v1: new (await import("../cosmos/group/v1/tx.rpc.msg.js")).MsgClientImpl(rpc) + v1: new (await import("../cosmos/group/v1/tx.rpc.msg")).MsgClientImpl(rpc) }, nft: { - v1beta1: new (await import("../cosmos/nft/v1beta1/tx.rpc.msg.js")).MsgClientImpl(rpc) + v1beta1: new (await import("../cosmos/nft/v1beta1/tx.rpc.msg")).MsgClientImpl(rpc) }, slashing: { - v1beta1: new (await import("../cosmos/slashing/v1beta1/tx.rpc.msg.js")).MsgClientImpl(rpc) + v1beta1: new (await import("../cosmos/slashing/v1beta1/tx.rpc.msg")).MsgClientImpl(rpc) }, staking: { - v1beta1: new (await import("../cosmos/staking/v1beta1/tx.rpc.msg.js")).MsgClientImpl(rpc) + v1beta1: new (await import("../cosmos/staking/v1beta1/tx.rpc.msg")).MsgClientImpl(rpc) }, upgrade: { - v1beta1: new (await import("../cosmos/upgrade/v1beta1/tx.rpc.msg.js")).MsgClientImpl(rpc) + v1beta1: new (await import("../cosmos/upgrade/v1beta1/tx.rpc.msg")).MsgClientImpl(rpc) }, vesting: { - v1beta1: new (await import("../cosmos/vesting/v1beta1/tx.rpc.msg.js")).MsgClientImpl(rpc) + v1beta1: new (await import("../cosmos/vesting/v1beta1/tx.rpc.msg")).MsgClientImpl(rpc) } }, osmosis: { gamm: { poolmodels: { balancer: { - v1beta1: new (await import("./gamm/pool-models/balancer/tx/tx.rpc.msg.js")).MsgClientImpl(rpc) + v1beta1: new (await import("./gamm/pool-models/balancer/tx/tx.rpc.msg")).MsgClientImpl(rpc) }, stableswap: { - v1beta1: new (await import("./gamm/pool-models/stableswap/tx.rpc.msg.js")).MsgClientImpl(rpc) + v1beta1: new (await import("./gamm/pool-models/stableswap/tx.rpc.msg")).MsgClientImpl(rpc) } }, - v1beta1: new (await import("./gamm/v1beta1/tx.rpc.msg.js")).MsgClientImpl(rpc) + v1beta1: new (await import("./gamm/v1beta1/tx.rpc.msg")).MsgClientImpl(rpc) }, - incentives: new (await import("./incentives/tx.rpc.msg.js")).MsgClientImpl(rpc), - lockup: new (await import("./lockup/tx.rpc.msg.js")).MsgClientImpl(rpc), - superfluid: new (await import("./superfluid/tx.rpc.msg.js")).MsgClientImpl(rpc), + incentives: new (await import("./incentives/tx.rpc.msg")).MsgClientImpl(rpc), + lockup: new (await import("./lockup/tx.rpc.msg")).MsgClientImpl(rpc), + superfluid: new (await import("./superfluid/tx.rpc.msg")).MsgClientImpl(rpc), tokenfactory: { - v1beta1: new (await import("./tokenfactory/v1beta1/tx.rpc.msg.js")).MsgClientImpl(rpc) + v1beta1: new (await import("./tokenfactory/v1beta1/tx.rpc.msg")).MsgClientImpl(rpc) + }, + concentratedliquidity: { + v1beta1: new (await import("./concentrated-liquidity/tx.rpc.msg")).MsgClientImpl(rpc) + }, + poolmanager: { + v1beta1: new (await import("./poolmanager/v1beta1/tx.rpc.msg")).MsgClientImpl(rpc) + }, + protorev: { + v1beta1: new (await import("./protorev/v1beta1/tx.rpc.msg")).MsgClientImpl(rpc) + }, + valsetpref: { + v1beta1: new (await import("./valset-pref/v1beta1/tx.rpc.msg")).MsgClientImpl(rpc) } } }); \ No newline at end of file diff --git a/__fixtures__/v-next/outputv4/osmosis/sumtree/v1beta1/tree.ts b/__fixtures__/v-next/outputv4/osmosis/sumtree/v1beta1/tree.ts index 19988ec01e..5a31b415c6 100644 --- a/__fixtures__/v-next/outputv4/osmosis/sumtree/v1beta1/tree.ts +++ b/__fixtures__/v-next/outputv4/osmosis/sumtree/v1beta1/tree.ts @@ -1,10 +1,14 @@ -import { BinaryReader, BinaryWriter } from "../../../binary.js"; -import { JsonSafe } from "../../../json-safe.js"; -import { DeepPartial, isSet, bytesFromBase64, base64FromBytes } from "../../../helpers.js"; +import { BinaryReader, BinaryWriter } from "../../../binary"; +import { JsonSafe } from "../../../json-safe"; +import { DeepPartial, isSet, bytesFromBase64, base64FromBytes } from "../../../helpers"; +import { ComputedRef } from "vue"; export const protobufPackage = "osmosis.store.v1beta1"; export interface Node { children: Child[]; } +export interface ReactiveNode { + children: ComputedRef<Child[]>; +} export interface NodeProtoMsg { typeUrl: "/osmosis.store.v1beta1.Node"; value: Uint8Array; @@ -16,6 +20,10 @@ export interface Child { index: Uint8Array; accumulation: string; } +export interface ReactiveChild { + index: ComputedRef<Uint8Array>; + accumulation: ComputedRef<string>; +} export interface ChildProtoMsg { typeUrl: "/osmosis.store.v1beta1.Child"; value: Uint8Array; @@ -27,6 +35,9 @@ export interface ChildSDKType { export interface Leaf { leaf?: Child; } +export interface ReactiveLeaf { + leaf?: ComputedRef<Child>; +} export interface LeafProtoMsg { typeUrl: "/osmosis.store.v1beta1.Leaf"; value: Uint8Array; @@ -65,9 +76,9 @@ export const Node = { return message; }, fromJSON(object: any): Node { - const obj = createBaseNode(); - if (Array.isArray(object?.children)) obj.children = object.children.map((e: any) => Child.fromJSON(e)); - return obj; + return { + children: Array.isArray(object?.children) ? object.children.map((e: any) => Child.fromJSON(e)) : [] + }; }, toJSON(message: Node): JsonSafe<Node> { const obj: any = {}; @@ -150,7 +161,7 @@ export const Child = { if (message.index.length !== 0) { writer.uint32(10).bytes(message.index); } - if (message.accumulation !== undefined) { + if (message.accumulation !== "") { writer.uint32(18).string(message.accumulation); } return writer; @@ -176,10 +187,10 @@ export const Child = { return message; }, fromJSON(object: any): Child { - const obj = createBaseChild(); - if (isSet(object.index)) obj.index = bytesFromBase64(object.index); - if (isSet(object.accumulation)) obj.accumulation = String(object.accumulation); - return obj; + return { + index: isSet(object.index) ? bytesFromBase64(object.index) : new Uint8Array(), + accumulation: isSet(object.accumulation) ? String(object.accumulation) : "" + }; }, toJSON(message: Child): JsonSafe<Child> { const obj: any = {}; @@ -280,9 +291,9 @@ export const Leaf = { return message; }, fromJSON(object: any): Leaf { - const obj = createBaseLeaf(); - if (isSet(object.leaf)) obj.leaf = Child.fromJSON(object.leaf); - return obj; + return { + leaf: isSet(object.leaf) ? Child.fromJSON(object.leaf) : undefined + }; }, toJSON(message: Leaf): JsonSafe<Leaf> { const obj: any = {}; @@ -291,9 +302,7 @@ export const Leaf = { }, fromPartial(object: DeepPartial<Leaf>): Leaf { const message = createBaseLeaf(); - if (object.leaf !== undefined && object.leaf !== null) { - message.leaf = Child.fromPartial(object.leaf); - } + message.leaf = object.leaf !== undefined && object.leaf !== null ? Child.fromPartial(object.leaf) : undefined; return message; }, fromSDK(object: LeafSDKType): Leaf { diff --git a/__fixtures__/v-next/outputv4/osmosis/superfluid/genesis.ts b/__fixtures__/v-next/outputv4/osmosis/superfluid/genesis.ts index 9c10a4e207..ca668658d3 100644 --- a/__fixtures__/v-next/outputv4/osmosis/superfluid/genesis.ts +++ b/__fixtures__/v-next/outputv4/osmosis/superfluid/genesis.ts @@ -1,8 +1,9 @@ -import { Params, ParamsSDKType } from "./params.js"; -import { SuperfluidAsset, SuperfluidAssetSDKType, OsmoEquivalentMultiplierRecord, OsmoEquivalentMultiplierRecordSDKType, SuperfluidIntermediaryAccount, SuperfluidIntermediaryAccountSDKType, LockIdIntermediaryAccountConnection, LockIdIntermediaryAccountConnectionSDKType } from "./superfluid.js"; -import { BinaryReader, BinaryWriter } from "../../binary.js"; -import { isSet, DeepPartial } from "../../helpers.js"; -import { JsonSafe } from "../../json-safe.js"; +import { Params, ParamsSDKType } from "./params"; +import { SuperfluidAsset, SuperfluidAssetSDKType, OsmoEquivalentMultiplierRecord, OsmoEquivalentMultiplierRecordSDKType, SuperfluidIntermediaryAccount, SuperfluidIntermediaryAccountSDKType, LockIdIntermediaryAccountConnection, LockIdIntermediaryAccountConnectionSDKType } from "./superfluid"; +import { BinaryReader, BinaryWriter } from "../../binary"; +import { isSet, DeepPartial } from "../../helpers"; +import { JsonSafe } from "../../json-safe"; +import { ComputedRef } from "vue"; export const protobufPackage = "osmosis.superfluid"; /** GenesisState defines the module's genesis state. */ export interface GenesisState { @@ -24,6 +25,13 @@ export interface GenesisState { intermediaryAccounts: SuperfluidIntermediaryAccount[]; intemediaryAccountConnections: LockIdIntermediaryAccountConnection[]; } +export interface ReactiveGenesisState { + params: ComputedRef<Params>; + superfluidAssets: ComputedRef<SuperfluidAsset[]>; + osmoEquivalentMultipliers: ComputedRef<OsmoEquivalentMultiplierRecord[]>; + intermediaryAccounts: ComputedRef<SuperfluidIntermediaryAccount[]>; + intemediaryAccountConnections: ComputedRef<LockIdIntermediaryAccountConnection[]>; +} export interface GenesisStateProtoMsg { typeUrl: "/osmosis.superfluid.GenesisState"; value: Uint8Array; @@ -95,13 +103,13 @@ export const GenesisState = { return message; }, fromJSON(object: any): GenesisState { - const obj = createBaseGenesisState(); - if (isSet(object.params)) obj.params = Params.fromJSON(object.params); - if (Array.isArray(object?.superfluidAssets)) obj.superfluidAssets = object.superfluidAssets.map((e: any) => SuperfluidAsset.fromJSON(e)); - if (Array.isArray(object?.osmoEquivalentMultipliers)) obj.osmoEquivalentMultipliers = object.osmoEquivalentMultipliers.map((e: any) => OsmoEquivalentMultiplierRecord.fromJSON(e)); - if (Array.isArray(object?.intermediaryAccounts)) obj.intermediaryAccounts = object.intermediaryAccounts.map((e: any) => SuperfluidIntermediaryAccount.fromJSON(e)); - if (Array.isArray(object?.intemediaryAccountConnections)) obj.intemediaryAccountConnections = object.intemediaryAccountConnections.map((e: any) => LockIdIntermediaryAccountConnection.fromJSON(e)); - return obj; + return { + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + superfluidAssets: Array.isArray(object?.superfluidAssets) ? object.superfluidAssets.map((e: any) => SuperfluidAsset.fromJSON(e)) : [], + osmoEquivalentMultipliers: Array.isArray(object?.osmoEquivalentMultipliers) ? object.osmoEquivalentMultipliers.map((e: any) => OsmoEquivalentMultiplierRecord.fromJSON(e)) : [], + intermediaryAccounts: Array.isArray(object?.intermediaryAccounts) ? object.intermediaryAccounts.map((e: any) => SuperfluidIntermediaryAccount.fromJSON(e)) : [], + intemediaryAccountConnections: Array.isArray(object?.intemediaryAccountConnections) ? object.intemediaryAccountConnections.map((e: any) => LockIdIntermediaryAccountConnection.fromJSON(e)) : [] + }; }, toJSON(message: GenesisState): JsonSafe<GenesisState> { const obj: any = {}; @@ -130,9 +138,7 @@ export const GenesisState = { }, fromPartial(object: DeepPartial<GenesisState>): GenesisState { const message = createBaseGenesisState(); - if (object.params !== undefined && object.params !== null) { - message.params = Params.fromPartial(object.params); - } + message.params = object.params !== undefined && object.params !== null ? Params.fromPartial(object.params) : undefined; message.superfluidAssets = object.superfluidAssets?.map(e => SuperfluidAsset.fromPartial(e)) || []; message.osmoEquivalentMultipliers = object.osmoEquivalentMultipliers?.map(e => OsmoEquivalentMultiplierRecord.fromPartial(e)) || []; message.intermediaryAccounts = object.intermediaryAccounts?.map(e => SuperfluidIntermediaryAccount.fromPartial(e)) || []; diff --git a/__fixtures__/v-next/outputv4/osmosis/superfluid/params.ts b/__fixtures__/v-next/outputv4/osmosis/superfluid/params.ts index 0eb081d326..24f03c45cc 100644 --- a/__fixtures__/v-next/outputv4/osmosis/superfluid/params.ts +++ b/__fixtures__/v-next/outputv4/osmosis/superfluid/params.ts @@ -1,7 +1,8 @@ -import { BinaryReader, BinaryWriter } from "../../binary.js"; +import { BinaryReader, BinaryWriter } from "../../binary"; import { Decimal } from "@cosmjs/math"; -import { isSet, DeepPartial } from "../../helpers.js"; -import { JsonSafe } from "../../json-safe.js"; +import { isSet, DeepPartial } from "../../helpers"; +import { JsonSafe } from "../../json-safe"; +import { ComputedRef } from "vue"; export const protobufPackage = "osmosis.superfluid"; /** Params holds parameters for the superfluid module */ export interface Params { @@ -13,6 +14,9 @@ export interface Params { */ minimumRiskFactor: string; } +export interface ReactiveParams { + minimumRiskFactor: ComputedRef<string>; +} export interface ParamsProtoMsg { typeUrl: "/osmosis.superfluid.Params"; value: Uint8Array; @@ -29,7 +33,7 @@ function createBaseParams(): Params { export const Params = { typeUrl: "/osmosis.superfluid.Params", encode(message: Params, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.minimumRiskFactor !== undefined) { + if (message.minimumRiskFactor !== "") { writer.uint32(10).string(Decimal.fromUserInput(message.minimumRiskFactor, 18).atomics); } return writer; @@ -52,9 +56,9 @@ export const Params = { return message; }, fromJSON(object: any): Params { - const obj = createBaseParams(); - if (isSet(object.minimumRiskFactor)) obj.minimumRiskFactor = String(object.minimumRiskFactor); - return obj; + return { + minimumRiskFactor: isSet(object.minimumRiskFactor) ? String(object.minimumRiskFactor) : "" + }; }, toJSON(message: Params): JsonSafe<Params> { const obj: any = {}; diff --git a/__fixtures__/v-next/outputv4/osmosis/superfluid/query.lcd.ts b/__fixtures__/v-next/outputv4/osmosis/superfluid/query.lcd.ts index c21bb0aca1..a148f58540 100644 --- a/__fixtures__/v-next/outputv4/osmosis/superfluid/query.lcd.ts +++ b/__fixtures__/v-next/outputv4/osmosis/superfluid/query.lcd.ts @@ -1,12 +1,12 @@ -import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../cosmos/base/query/v1beta1/pagination.js"; -import { Params, ParamsSDKType } from "./params.js"; -import { SuperfluidAssetType, SuperfluidAssetTypeSDKType, SuperfluidAsset, SuperfluidAssetSDKType, OsmoEquivalentMultiplierRecord, OsmoEquivalentMultiplierRecordSDKType, SuperfluidDelegationRecord, SuperfluidDelegationRecordSDKType } from "./superfluid.js"; -import { Coin, CoinSDKType } from "../../cosmos/base/v1beta1/coin.js"; -import { SyntheticLock, SyntheticLockSDKType } from "../lockup/lock.js"; -import { DelegationResponse, DelegationResponseSDKType } from "../../cosmos/staking/v1beta1/staking.js"; -import { setPaginationParams } from "../../helpers.js"; +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../cosmos/base/query/v1beta1/pagination"; +import { Params, ParamsSDKType } from "./params"; +import { SuperfluidAssetType, SuperfluidAssetTypeSDKType, SuperfluidAsset, SuperfluidAssetSDKType, OsmoEquivalentMultiplierRecord, OsmoEquivalentMultiplierRecordSDKType, SuperfluidDelegationRecord, SuperfluidDelegationRecordSDKType } from "./superfluid"; +import { Coin, CoinSDKType } from "../../cosmos/base/v1beta1/coin"; +import { SyntheticLock, SyntheticLockSDKType } from "../lockup/lock"; +import { DelegationResponse, DelegationResponseSDKType } from "../../cosmos/staking/v1beta1/staking"; +import { setPaginationParams } from "../../helpers"; import { LCDClient } from "@cosmology/lcd"; -import { QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType, AssetTypeRequest, AssetTypeRequestSDKType, AssetTypeResponse, AssetTypeResponseSDKType, AllAssetsRequest, AllAssetsRequestSDKType, AllAssetsResponse, AllAssetsResponseSDKType, AssetMultiplierRequest, AssetMultiplierRequestSDKType, AssetMultiplierResponse, AssetMultiplierResponseSDKType, AllIntermediaryAccountsRequest, AllIntermediaryAccountsRequestSDKType, AllIntermediaryAccountsResponse, AllIntermediaryAccountsResponseSDKType, ConnectedIntermediaryAccountRequest, ConnectedIntermediaryAccountRequestSDKType, ConnectedIntermediaryAccountResponse, ConnectedIntermediaryAccountResponseSDKType, QueryTotalDelegationByValidatorForDenomRequest, QueryTotalDelegationByValidatorForDenomRequestSDKType, QueryTotalDelegationByValidatorForDenomResponse, QueryTotalDelegationByValidatorForDenomResponseSDKType, TotalSuperfluidDelegationsRequest, TotalSuperfluidDelegationsRequestSDKType, TotalSuperfluidDelegationsResponse, TotalSuperfluidDelegationsResponseSDKType, SuperfluidDelegationAmountRequest, SuperfluidDelegationAmountRequestSDKType, SuperfluidDelegationAmountResponse, SuperfluidDelegationAmountResponseSDKType, SuperfluidDelegationsByDelegatorRequest, SuperfluidDelegationsByDelegatorRequestSDKType, SuperfluidDelegationsByDelegatorResponse, SuperfluidDelegationsByDelegatorResponseSDKType, SuperfluidUndelegationsByDelegatorRequest, SuperfluidUndelegationsByDelegatorRequestSDKType, SuperfluidUndelegationsByDelegatorResponse, SuperfluidUndelegationsByDelegatorResponseSDKType, SuperfluidDelegationsByValidatorDenomRequest, SuperfluidDelegationsByValidatorDenomRequestSDKType, SuperfluidDelegationsByValidatorDenomResponse, SuperfluidDelegationsByValidatorDenomResponseSDKType, EstimateSuperfluidDelegatedAmountByValidatorDenomRequest, EstimateSuperfluidDelegatedAmountByValidatorDenomRequestSDKType, EstimateSuperfluidDelegatedAmountByValidatorDenomResponse, EstimateSuperfluidDelegatedAmountByValidatorDenomResponseSDKType, QueryTotalDelegationByDelegatorRequest, QueryTotalDelegationByDelegatorRequestSDKType, QueryTotalDelegationByDelegatorResponse, QueryTotalDelegationByDelegatorResponseSDKType, QueryUnpoolWhitelistRequest, QueryUnpoolWhitelistRequestSDKType, QueryUnpoolWhitelistResponse, QueryUnpoolWhitelistResponseSDKType } from "./query.js"; +import { QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType, AssetTypeRequest, AssetTypeRequestSDKType, AssetTypeResponse, AssetTypeResponseSDKType, AllAssetsRequest, AllAssetsRequestSDKType, AllAssetsResponse, AllAssetsResponseSDKType, AssetMultiplierRequest, AssetMultiplierRequestSDKType, AssetMultiplierResponse, AssetMultiplierResponseSDKType, AllIntermediaryAccountsRequest, AllIntermediaryAccountsRequestSDKType, AllIntermediaryAccountsResponse, AllIntermediaryAccountsResponseSDKType, ConnectedIntermediaryAccountRequest, ConnectedIntermediaryAccountRequestSDKType, ConnectedIntermediaryAccountResponse, ConnectedIntermediaryAccountResponseSDKType, QueryTotalDelegationByValidatorForDenomRequest, QueryTotalDelegationByValidatorForDenomRequestSDKType, QueryTotalDelegationByValidatorForDenomResponse, QueryTotalDelegationByValidatorForDenomResponseSDKType, TotalSuperfluidDelegationsRequest, TotalSuperfluidDelegationsRequestSDKType, TotalSuperfluidDelegationsResponse, TotalSuperfluidDelegationsResponseSDKType, SuperfluidDelegationAmountRequest, SuperfluidDelegationAmountRequestSDKType, SuperfluidDelegationAmountResponse, SuperfluidDelegationAmountResponseSDKType, SuperfluidDelegationsByDelegatorRequest, SuperfluidDelegationsByDelegatorRequestSDKType, SuperfluidDelegationsByDelegatorResponse, SuperfluidDelegationsByDelegatorResponseSDKType, SuperfluidUndelegationsByDelegatorRequest, SuperfluidUndelegationsByDelegatorRequestSDKType, SuperfluidUndelegationsByDelegatorResponse, SuperfluidUndelegationsByDelegatorResponseSDKType, SuperfluidDelegationsByValidatorDenomRequest, SuperfluidDelegationsByValidatorDenomRequestSDKType, SuperfluidDelegationsByValidatorDenomResponse, SuperfluidDelegationsByValidatorDenomResponseSDKType, EstimateSuperfluidDelegatedAmountByValidatorDenomRequest, EstimateSuperfluidDelegatedAmountByValidatorDenomRequestSDKType, EstimateSuperfluidDelegatedAmountByValidatorDenomResponse, EstimateSuperfluidDelegatedAmountByValidatorDenomResponseSDKType, QueryTotalDelegationByDelegatorRequest, QueryTotalDelegationByDelegatorRequestSDKType, QueryTotalDelegationByDelegatorResponse, QueryTotalDelegationByDelegatorResponseSDKType, QueryUnpoolWhitelistRequest, QueryUnpoolWhitelistRequestSDKType, QueryUnpoolWhitelistResponse, QueryUnpoolWhitelistResponseSDKType } from "./query"; export class LCDQueryClient { req: LCDClient; constructor({ @@ -65,7 +65,7 @@ export class LCDQueryClient { } /* Returns all superfluid intermediary accounts. */ async allIntermediaryAccounts(params: AllIntermediaryAccountsRequest = { - pagination: PageRequest.fromPartial({}) + pagination: undefined }): Promise<AllIntermediaryAccountsResponseSDKType> { const options: any = { params: {} diff --git a/__fixtures__/v-next/outputv4/osmosis/superfluid/query.rpc.Query.ts b/__fixtures__/v-next/outputv4/osmosis/superfluid/query.rpc.Query.ts index ff4204896d..1c18761790 100644 --- a/__fixtures__/v-next/outputv4/osmosis/superfluid/query.rpc.Query.ts +++ b/__fixtures__/v-next/outputv4/osmosis/superfluid/query.rpc.Query.ts @@ -1,13 +1,13 @@ -import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../cosmos/base/query/v1beta1/pagination.js"; -import { Params, ParamsSDKType } from "./params.js"; -import { SuperfluidAssetType, SuperfluidAssetTypeSDKType, SuperfluidAsset, SuperfluidAssetSDKType, OsmoEquivalentMultiplierRecord, OsmoEquivalentMultiplierRecordSDKType, SuperfluidDelegationRecord, SuperfluidDelegationRecordSDKType } from "./superfluid.js"; -import { Coin, CoinSDKType } from "../../cosmos/base/v1beta1/coin.js"; -import { SyntheticLock, SyntheticLockSDKType } from "../lockup/lock.js"; -import { DelegationResponse, DelegationResponseSDKType } from "../../cosmos/staking/v1beta1/staking.js"; -import { Rpc } from "../../helpers.js"; -import { BinaryReader } from "../../binary.js"; +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../cosmos/base/query/v1beta1/pagination"; +import { Params, ParamsSDKType } from "./params"; +import { SuperfluidAssetType, SuperfluidAssetTypeSDKType, SuperfluidAsset, SuperfluidAssetSDKType, OsmoEquivalentMultiplierRecord, OsmoEquivalentMultiplierRecordSDKType, SuperfluidDelegationRecord, SuperfluidDelegationRecordSDKType } from "./superfluid"; +import { Coin, CoinSDKType } from "../../cosmos/base/v1beta1/coin"; +import { SyntheticLock, SyntheticLockSDKType } from "../lockup/lock"; +import { DelegationResponse, DelegationResponseSDKType } from "../../cosmos/staking/v1beta1/staking"; +import { Rpc } from "../../helpers"; +import { BinaryReader } from "../../binary"; import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; -import { QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType, AssetTypeRequest, AssetTypeRequestSDKType, AssetTypeResponse, AssetTypeResponseSDKType, AllAssetsRequest, AllAssetsRequestSDKType, AllAssetsResponse, AllAssetsResponseSDKType, AssetMultiplierRequest, AssetMultiplierRequestSDKType, AssetMultiplierResponse, AssetMultiplierResponseSDKType, AllIntermediaryAccountsRequest, AllIntermediaryAccountsRequestSDKType, AllIntermediaryAccountsResponse, AllIntermediaryAccountsResponseSDKType, ConnectedIntermediaryAccountRequest, ConnectedIntermediaryAccountRequestSDKType, ConnectedIntermediaryAccountResponse, ConnectedIntermediaryAccountResponseSDKType, QueryTotalDelegationByValidatorForDenomRequest, QueryTotalDelegationByValidatorForDenomRequestSDKType, QueryTotalDelegationByValidatorForDenomResponse, QueryTotalDelegationByValidatorForDenomResponseSDKType, TotalSuperfluidDelegationsRequest, TotalSuperfluidDelegationsRequestSDKType, TotalSuperfluidDelegationsResponse, TotalSuperfluidDelegationsResponseSDKType, SuperfluidDelegationAmountRequest, SuperfluidDelegationAmountRequestSDKType, SuperfluidDelegationAmountResponse, SuperfluidDelegationAmountResponseSDKType, SuperfluidDelegationsByDelegatorRequest, SuperfluidDelegationsByDelegatorRequestSDKType, SuperfluidDelegationsByDelegatorResponse, SuperfluidDelegationsByDelegatorResponseSDKType, SuperfluidUndelegationsByDelegatorRequest, SuperfluidUndelegationsByDelegatorRequestSDKType, SuperfluidUndelegationsByDelegatorResponse, SuperfluidUndelegationsByDelegatorResponseSDKType, SuperfluidDelegationsByValidatorDenomRequest, SuperfluidDelegationsByValidatorDenomRequestSDKType, SuperfluidDelegationsByValidatorDenomResponse, SuperfluidDelegationsByValidatorDenomResponseSDKType, EstimateSuperfluidDelegatedAmountByValidatorDenomRequest, EstimateSuperfluidDelegatedAmountByValidatorDenomRequestSDKType, EstimateSuperfluidDelegatedAmountByValidatorDenomResponse, EstimateSuperfluidDelegatedAmountByValidatorDenomResponseSDKType, QueryTotalDelegationByDelegatorRequest, QueryTotalDelegationByDelegatorRequestSDKType, QueryTotalDelegationByDelegatorResponse, QueryTotalDelegationByDelegatorResponseSDKType, QueryUnpoolWhitelistRequest, QueryUnpoolWhitelistRequestSDKType, QueryUnpoolWhitelistResponse, QueryUnpoolWhitelistResponseSDKType } from "./query.js"; +import { QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType, AssetTypeRequest, AssetTypeRequestSDKType, AssetTypeResponse, AssetTypeResponseSDKType, AllAssetsRequest, AllAssetsRequestSDKType, AllAssetsResponse, AllAssetsResponseSDKType, AssetMultiplierRequest, AssetMultiplierRequestSDKType, AssetMultiplierResponse, AssetMultiplierResponseSDKType, AllIntermediaryAccountsRequest, AllIntermediaryAccountsRequestSDKType, AllIntermediaryAccountsResponse, AllIntermediaryAccountsResponseSDKType, ConnectedIntermediaryAccountRequest, ConnectedIntermediaryAccountRequestSDKType, ConnectedIntermediaryAccountResponse, ConnectedIntermediaryAccountResponseSDKType, QueryTotalDelegationByValidatorForDenomRequest, QueryTotalDelegationByValidatorForDenomRequestSDKType, QueryTotalDelegationByValidatorForDenomResponse, QueryTotalDelegationByValidatorForDenomResponseSDKType, TotalSuperfluidDelegationsRequest, TotalSuperfluidDelegationsRequestSDKType, TotalSuperfluidDelegationsResponse, TotalSuperfluidDelegationsResponseSDKType, SuperfluidDelegationAmountRequest, SuperfluidDelegationAmountRequestSDKType, SuperfluidDelegationAmountResponse, SuperfluidDelegationAmountResponseSDKType, SuperfluidDelegationsByDelegatorRequest, SuperfluidDelegationsByDelegatorRequestSDKType, SuperfluidDelegationsByDelegatorResponse, SuperfluidDelegationsByDelegatorResponseSDKType, SuperfluidUndelegationsByDelegatorRequest, SuperfluidUndelegationsByDelegatorRequestSDKType, SuperfluidUndelegationsByDelegatorResponse, SuperfluidUndelegationsByDelegatorResponseSDKType, SuperfluidDelegationsByValidatorDenomRequest, SuperfluidDelegationsByValidatorDenomRequestSDKType, SuperfluidDelegationsByValidatorDenomResponse, SuperfluidDelegationsByValidatorDenomResponseSDKType, EstimateSuperfluidDelegatedAmountByValidatorDenomRequest, EstimateSuperfluidDelegatedAmountByValidatorDenomRequestSDKType, EstimateSuperfluidDelegatedAmountByValidatorDenomResponse, EstimateSuperfluidDelegatedAmountByValidatorDenomResponseSDKType, QueryTotalDelegationByDelegatorRequest, QueryTotalDelegationByDelegatorRequestSDKType, QueryTotalDelegationByDelegatorResponse, QueryTotalDelegationByDelegatorResponseSDKType, QueryUnpoolWhitelistRequest, QueryUnpoolWhitelistRequestSDKType, QueryUnpoolWhitelistResponse, QueryUnpoolWhitelistResponseSDKType, ReactiveQueryParamsRequest, ReactiveQueryTotalDelegationByValidatorForDenomRequest, ReactiveQueryTotalDelegationByDelegatorRequest, ReactiveQueryUnpoolWhitelistRequest } from "./query"; /** Query defines the gRPC querier service. */ export interface Query { /** Params returns the total set of superfluid parameters. */ @@ -98,7 +98,7 @@ export class QueryClientImpl implements Query { return promise.then(data => AssetMultiplierResponse.decode(new BinaryReader(data))); } allIntermediaryAccounts(request: AllIntermediaryAccountsRequest = { - pagination: PageRequest.fromPartial({}) + pagination: undefined }): Promise<AllIntermediaryAccountsResponse> { const data = AllIntermediaryAccountsRequest.encode(request).finish(); const promise = this.rpc.request("osmosis.superfluid.Query", "AllIntermediaryAccounts", data); diff --git a/__fixtures__/v-next/outputv4/osmosis/superfluid/query.ts b/__fixtures__/v-next/outputv4/osmosis/superfluid/query.ts index e22326e1df..375dae444c 100644 --- a/__fixtures__/v-next/outputv4/osmosis/superfluid/query.ts +++ b/__fixtures__/v-next/outputv4/osmosis/superfluid/query.ts @@ -1,14 +1,16 @@ -import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../cosmos/base/query/v1beta1/pagination.js"; -import { Params, ParamsSDKType } from "./params.js"; -import { SuperfluidAssetType, SuperfluidAssetTypeSDKType, SuperfluidAsset, SuperfluidAssetSDKType, OsmoEquivalentMultiplierRecord, OsmoEquivalentMultiplierRecordSDKType, SuperfluidDelegationRecord, SuperfluidDelegationRecordSDKType, superfluidAssetTypeFromJSON, superfluidAssetTypeToJSON } from "./superfluid.js"; -import { Coin, CoinSDKType } from "../../cosmos/base/v1beta1/coin.js"; -import { SyntheticLock, SyntheticLockSDKType } from "../lockup/lock.js"; -import { DelegationResponse, DelegationResponseSDKType } from "../../cosmos/staking/v1beta1/staking.js"; -import { BinaryReader, BinaryWriter } from "../../binary.js"; -import { JsonSafe } from "../../json-safe.js"; -import { DeepPartial, isSet } from "../../helpers.js"; +import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../cosmos/base/query/v1beta1/pagination"; +import { Params, ParamsSDKType } from "./params"; +import { SuperfluidAssetType, SuperfluidAssetTypeSDKType, SuperfluidAsset, SuperfluidAssetSDKType, OsmoEquivalentMultiplierRecord, OsmoEquivalentMultiplierRecordSDKType, SuperfluidDelegationRecord, SuperfluidDelegationRecordSDKType, superfluidAssetTypeFromJSON, superfluidAssetTypeToJSON } from "./superfluid"; +import { Coin, CoinSDKType } from "../../cosmos/base/v1beta1/coin"; +import { SyntheticLock, SyntheticLockSDKType } from "../lockup/lock"; +import { DelegationResponse, DelegationResponseSDKType } from "../../cosmos/staking/v1beta1/staking"; +import { BinaryReader, BinaryWriter } from "../../binary"; +import { JsonSafe } from "../../json-safe"; +import { DeepPartial, isSet } from "../../helpers"; +import { ComputedRef } from "vue"; export const protobufPackage = "osmosis.superfluid"; export interface QueryParamsRequest {} +export interface ReactiveQueryParamsRequest {} export interface QueryParamsRequestProtoMsg { typeUrl: "/osmosis.superfluid.QueryParamsRequest"; value: Uint8Array; @@ -18,6 +20,9 @@ export interface QueryParamsResponse { /** params defines the parameters of the module. */ params: Params; } +export interface ReactiveQueryParamsResponse { + params: ComputedRef<Params>; +} export interface QueryParamsResponseProtoMsg { typeUrl: "/osmosis.superfluid.QueryParamsResponse"; value: Uint8Array; @@ -28,6 +33,9 @@ export interface QueryParamsResponseSDKType { export interface AssetTypeRequest { denom: string; } +export interface ReactiveAssetTypeRequest { + denom: ComputedRef<string>; +} export interface AssetTypeRequestProtoMsg { typeUrl: "/osmosis.superfluid.AssetTypeRequest"; value: Uint8Array; @@ -38,6 +46,9 @@ export interface AssetTypeRequestSDKType { export interface AssetTypeResponse { assetType: SuperfluidAssetType; } +export interface ReactiveAssetTypeResponse { + assetType: ComputedRef<SuperfluidAssetType>; +} export interface AssetTypeResponseProtoMsg { typeUrl: "/osmosis.superfluid.AssetTypeResponse"; value: Uint8Array; @@ -46,6 +57,7 @@ export interface AssetTypeResponseSDKType { asset_type: SuperfluidAssetType; } export interface AllAssetsRequest {} +export interface ReactiveAllAssetsRequest {} export interface AllAssetsRequestProtoMsg { typeUrl: "/osmosis.superfluid.AllAssetsRequest"; value: Uint8Array; @@ -54,6 +66,9 @@ export interface AllAssetsRequestSDKType {} export interface AllAssetsResponse { assets: SuperfluidAsset[]; } +export interface ReactiveAllAssetsResponse { + assets: ComputedRef<SuperfluidAsset[]>; +} export interface AllAssetsResponseProtoMsg { typeUrl: "/osmosis.superfluid.AllAssetsResponse"; value: Uint8Array; @@ -64,6 +79,9 @@ export interface AllAssetsResponseSDKType { export interface AssetMultiplierRequest { denom: string; } +export interface ReactiveAssetMultiplierRequest { + denom: ComputedRef<string>; +} export interface AssetMultiplierRequestProtoMsg { typeUrl: "/osmosis.superfluid.AssetMultiplierRequest"; value: Uint8Array; @@ -74,6 +92,9 @@ export interface AssetMultiplierRequestSDKType { export interface AssetMultiplierResponse { osmoEquivalentMultiplier?: OsmoEquivalentMultiplierRecord; } +export interface ReactiveAssetMultiplierResponse { + osmoEquivalentMultiplier?: ComputedRef<OsmoEquivalentMultiplierRecord>; +} export interface AssetMultiplierResponseProtoMsg { typeUrl: "/osmosis.superfluid.AssetMultiplierResponse"; value: Uint8Array; @@ -87,6 +108,12 @@ export interface SuperfluidIntermediaryAccountInfo { gaugeId: bigint; address: string; } +export interface ReactiveSuperfluidIntermediaryAccountInfo { + denom: ComputedRef<string>; + valAddr: ComputedRef<string>; + gaugeId: ComputedRef<bigint>; + address: ComputedRef<string>; +} export interface SuperfluidIntermediaryAccountInfoProtoMsg { typeUrl: "/osmosis.superfluid.SuperfluidIntermediaryAccountInfo"; value: Uint8Array; @@ -100,6 +127,9 @@ export interface SuperfluidIntermediaryAccountInfoSDKType { export interface AllIntermediaryAccountsRequest { pagination?: PageRequest; } +export interface ReactiveAllIntermediaryAccountsRequest { + pagination?: ComputedRef<PageRequest>; +} export interface AllIntermediaryAccountsRequestProtoMsg { typeUrl: "/osmosis.superfluid.AllIntermediaryAccountsRequest"; value: Uint8Array; @@ -111,6 +141,10 @@ export interface AllIntermediaryAccountsResponse { accounts: SuperfluidIntermediaryAccountInfo[]; pagination?: PageResponse; } +export interface ReactiveAllIntermediaryAccountsResponse { + accounts: ComputedRef<SuperfluidIntermediaryAccountInfo[]>; + pagination?: ComputedRef<PageResponse>; +} export interface AllIntermediaryAccountsResponseProtoMsg { typeUrl: "/osmosis.superfluid.AllIntermediaryAccountsResponse"; value: Uint8Array; @@ -122,6 +156,9 @@ export interface AllIntermediaryAccountsResponseSDKType { export interface ConnectedIntermediaryAccountRequest { lockId: bigint; } +export interface ReactiveConnectedIntermediaryAccountRequest { + lockId: ComputedRef<bigint>; +} export interface ConnectedIntermediaryAccountRequestProtoMsg { typeUrl: "/osmosis.superfluid.ConnectedIntermediaryAccountRequest"; value: Uint8Array; @@ -132,6 +169,9 @@ export interface ConnectedIntermediaryAccountRequestSDKType { export interface ConnectedIntermediaryAccountResponse { account?: SuperfluidIntermediaryAccountInfo; } +export interface ReactiveConnectedIntermediaryAccountResponse { + account?: ComputedRef<SuperfluidIntermediaryAccountInfo>; +} export interface ConnectedIntermediaryAccountResponseProtoMsg { typeUrl: "/osmosis.superfluid.ConnectedIntermediaryAccountResponse"; value: Uint8Array; @@ -142,6 +182,9 @@ export interface ConnectedIntermediaryAccountResponseSDKType { export interface QueryTotalDelegationByValidatorForDenomRequest { denom: string; } +export interface ReactiveQueryTotalDelegationByValidatorForDenomRequest { + denom: ComputedRef<string>; +} export interface QueryTotalDelegationByValidatorForDenomRequestProtoMsg { typeUrl: "/osmosis.superfluid.QueryTotalDelegationByValidatorForDenomRequest"; value: Uint8Array; @@ -152,6 +195,9 @@ export interface QueryTotalDelegationByValidatorForDenomRequestSDKType { export interface QueryTotalDelegationByValidatorForDenomResponse { assets: Delegations[]; } +export interface ReactiveQueryTotalDelegationByValidatorForDenomResponse { + assets: ComputedRef<Delegations[]>; +} export interface QueryTotalDelegationByValidatorForDenomResponseProtoMsg { typeUrl: "/osmosis.superfluid.QueryTotalDelegationByValidatorForDenomResponse"; value: Uint8Array; @@ -164,6 +210,11 @@ export interface Delegations { amountSfsd: string; osmoEquivalent: string; } +export interface ReactiveDelegations { + valAddr: ComputedRef<string>; + amountSfsd: ComputedRef<string>; + osmoEquivalent: ComputedRef<string>; +} export interface DelegationsProtoMsg { typeUrl: "/osmosis.superfluid.Delegations"; value: Uint8Array; @@ -174,6 +225,7 @@ export interface DelegationsSDKType { osmo_equivalent: string; } export interface TotalSuperfluidDelegationsRequest {} +export interface ReactiveTotalSuperfluidDelegationsRequest {} export interface TotalSuperfluidDelegationsRequestProtoMsg { typeUrl: "/osmosis.superfluid.TotalSuperfluidDelegationsRequest"; value: Uint8Array; @@ -182,6 +234,9 @@ export interface TotalSuperfluidDelegationsRequestSDKType {} export interface TotalSuperfluidDelegationsResponse { totalDelegations: string; } +export interface ReactiveTotalSuperfluidDelegationsResponse { + totalDelegations: ComputedRef<string>; +} export interface TotalSuperfluidDelegationsResponseProtoMsg { typeUrl: "/osmosis.superfluid.TotalSuperfluidDelegationsResponse"; value: Uint8Array; @@ -194,6 +249,11 @@ export interface SuperfluidDelegationAmountRequest { validatorAddress: string; denom: string; } +export interface ReactiveSuperfluidDelegationAmountRequest { + delegatorAddress: ComputedRef<string>; + validatorAddress: ComputedRef<string>; + denom: ComputedRef<string>; +} export interface SuperfluidDelegationAmountRequestProtoMsg { typeUrl: "/osmosis.superfluid.SuperfluidDelegationAmountRequest"; value: Uint8Array; @@ -206,6 +266,9 @@ export interface SuperfluidDelegationAmountRequestSDKType { export interface SuperfluidDelegationAmountResponse { amount: Coin[]; } +export interface ReactiveSuperfluidDelegationAmountResponse { + amount: ComputedRef<Coin[]>; +} export interface SuperfluidDelegationAmountResponseProtoMsg { typeUrl: "/osmosis.superfluid.SuperfluidDelegationAmountResponse"; value: Uint8Array; @@ -216,6 +279,9 @@ export interface SuperfluidDelegationAmountResponseSDKType { export interface SuperfluidDelegationsByDelegatorRequest { delegatorAddress: string; } +export interface ReactiveSuperfluidDelegationsByDelegatorRequest { + delegatorAddress: ComputedRef<string>; +} export interface SuperfluidDelegationsByDelegatorRequestProtoMsg { typeUrl: "/osmosis.superfluid.SuperfluidDelegationsByDelegatorRequest"; value: Uint8Array; @@ -228,6 +294,11 @@ export interface SuperfluidDelegationsByDelegatorResponse { totalDelegatedCoins: Coin[]; totalEquivalentStakedAmount: Coin; } +export interface ReactiveSuperfluidDelegationsByDelegatorResponse { + superfluidDelegationRecords: ComputedRef<SuperfluidDelegationRecord[]>; + totalDelegatedCoins: ComputedRef<Coin[]>; + totalEquivalentStakedAmount: ComputedRef<Coin>; +} export interface SuperfluidDelegationsByDelegatorResponseProtoMsg { typeUrl: "/osmosis.superfluid.SuperfluidDelegationsByDelegatorResponse"; value: Uint8Array; @@ -241,6 +312,10 @@ export interface SuperfluidUndelegationsByDelegatorRequest { delegatorAddress: string; denom: string; } +export interface ReactiveSuperfluidUndelegationsByDelegatorRequest { + delegatorAddress: ComputedRef<string>; + denom: ComputedRef<string>; +} export interface SuperfluidUndelegationsByDelegatorRequestProtoMsg { typeUrl: "/osmosis.superfluid.SuperfluidUndelegationsByDelegatorRequest"; value: Uint8Array; @@ -254,6 +329,11 @@ export interface SuperfluidUndelegationsByDelegatorResponse { totalUndelegatedCoins: Coin[]; syntheticLocks: SyntheticLock[]; } +export interface ReactiveSuperfluidUndelegationsByDelegatorResponse { + superfluidDelegationRecords: ComputedRef<SuperfluidDelegationRecord[]>; + totalUndelegatedCoins: ComputedRef<Coin[]>; + syntheticLocks: ComputedRef<SyntheticLock[]>; +} export interface SuperfluidUndelegationsByDelegatorResponseProtoMsg { typeUrl: "/osmosis.superfluid.SuperfluidUndelegationsByDelegatorResponse"; value: Uint8Array; @@ -267,6 +347,10 @@ export interface SuperfluidDelegationsByValidatorDenomRequest { validatorAddress: string; denom: string; } +export interface ReactiveSuperfluidDelegationsByValidatorDenomRequest { + validatorAddress: ComputedRef<string>; + denom: ComputedRef<string>; +} export interface SuperfluidDelegationsByValidatorDenomRequestProtoMsg { typeUrl: "/osmosis.superfluid.SuperfluidDelegationsByValidatorDenomRequest"; value: Uint8Array; @@ -278,6 +362,9 @@ export interface SuperfluidDelegationsByValidatorDenomRequestSDKType { export interface SuperfluidDelegationsByValidatorDenomResponse { superfluidDelegationRecords: SuperfluidDelegationRecord[]; } +export interface ReactiveSuperfluidDelegationsByValidatorDenomResponse { + superfluidDelegationRecords: ComputedRef<SuperfluidDelegationRecord[]>; +} export interface SuperfluidDelegationsByValidatorDenomResponseProtoMsg { typeUrl: "/osmosis.superfluid.SuperfluidDelegationsByValidatorDenomResponse"; value: Uint8Array; @@ -289,6 +376,10 @@ export interface EstimateSuperfluidDelegatedAmountByValidatorDenomRequest { validatorAddress: string; denom: string; } +export interface ReactiveEstimateSuperfluidDelegatedAmountByValidatorDenomRequest { + validatorAddress: ComputedRef<string>; + denom: ComputedRef<string>; +} export interface EstimateSuperfluidDelegatedAmountByValidatorDenomRequestProtoMsg { typeUrl: "/osmosis.superfluid.EstimateSuperfluidDelegatedAmountByValidatorDenomRequest"; value: Uint8Array; @@ -300,6 +391,9 @@ export interface EstimateSuperfluidDelegatedAmountByValidatorDenomRequestSDKType export interface EstimateSuperfluidDelegatedAmountByValidatorDenomResponse { totalDelegatedCoins: Coin[]; } +export interface ReactiveEstimateSuperfluidDelegatedAmountByValidatorDenomResponse { + totalDelegatedCoins: ComputedRef<Coin[]>; +} export interface EstimateSuperfluidDelegatedAmountByValidatorDenomResponseProtoMsg { typeUrl: "/osmosis.superfluid.EstimateSuperfluidDelegatedAmountByValidatorDenomResponse"; value: Uint8Array; @@ -310,6 +404,9 @@ export interface EstimateSuperfluidDelegatedAmountByValidatorDenomResponseSDKTyp export interface QueryTotalDelegationByDelegatorRequest { delegatorAddress: string; } +export interface ReactiveQueryTotalDelegationByDelegatorRequest { + delegatorAddress: ComputedRef<string>; +} export interface QueryTotalDelegationByDelegatorRequestProtoMsg { typeUrl: "/osmosis.superfluid.QueryTotalDelegationByDelegatorRequest"; value: Uint8Array; @@ -323,6 +420,12 @@ export interface QueryTotalDelegationByDelegatorResponse { totalDelegatedCoins: Coin[]; totalEquivalentStakedAmount: Coin; } +export interface ReactiveQueryTotalDelegationByDelegatorResponse { + superfluidDelegationRecords: ComputedRef<SuperfluidDelegationRecord[]>; + delegationResponse: ComputedRef<DelegationResponse[]>; + totalDelegatedCoins: ComputedRef<Coin[]>; + totalEquivalentStakedAmount: ComputedRef<Coin>; +} export interface QueryTotalDelegationByDelegatorResponseProtoMsg { typeUrl: "/osmosis.superfluid.QueryTotalDelegationByDelegatorResponse"; value: Uint8Array; @@ -334,6 +437,7 @@ export interface QueryTotalDelegationByDelegatorResponseSDKType { total_equivalent_staked_amount: CoinSDKType; } export interface QueryUnpoolWhitelistRequest {} +export interface ReactiveQueryUnpoolWhitelistRequest {} export interface QueryUnpoolWhitelistRequestProtoMsg { typeUrl: "/osmosis.superfluid.QueryUnpoolWhitelistRequest"; value: Uint8Array; @@ -342,6 +446,9 @@ export interface QueryUnpoolWhitelistRequestSDKType {} export interface QueryUnpoolWhitelistResponse { poolIds: bigint[]; } +export interface ReactiveQueryUnpoolWhitelistResponse { + poolIds: ComputedRef<bigint[]>; +} export interface QueryUnpoolWhitelistResponseProtoMsg { typeUrl: "/osmosis.superfluid.QueryUnpoolWhitelistResponse"; value: Uint8Array; @@ -372,8 +479,7 @@ export const QueryParamsRequest = { return message; }, fromJSON(_: any): QueryParamsRequest { - const obj = createBaseQueryParamsRequest(); - return obj; + return {}; }, toJSON(_: QueryParamsRequest): JsonSafe<QueryParamsRequest> { const obj: any = {}; @@ -454,9 +560,9 @@ export const QueryParamsResponse = { return message; }, fromJSON(object: any): QueryParamsResponse { - const obj = createBaseQueryParamsResponse(); - if (isSet(object.params)) obj.params = Params.fromJSON(object.params); - return obj; + return { + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined + }; }, toJSON(message: QueryParamsResponse): JsonSafe<QueryParamsResponse> { const obj: any = {}; @@ -465,9 +571,7 @@ export const QueryParamsResponse = { }, fromPartial(object: DeepPartial<QueryParamsResponse>): QueryParamsResponse { const message = createBaseQueryParamsResponse(); - if (object.params !== undefined && object.params !== null) { - message.params = Params.fromPartial(object.params); - } + message.params = object.params !== undefined && object.params !== null ? Params.fromPartial(object.params) : undefined; return message; }, fromSDK(object: QueryParamsResponseSDKType): QueryParamsResponse { @@ -527,7 +631,7 @@ function createBaseAssetTypeRequest(): AssetTypeRequest { export const AssetTypeRequest = { typeUrl: "/osmosis.superfluid.AssetTypeRequest", encode(message: AssetTypeRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.denom !== undefined) { + if (message.denom !== "") { writer.uint32(10).string(message.denom); } return writer; @@ -550,9 +654,9 @@ export const AssetTypeRequest = { return message; }, fromJSON(object: any): AssetTypeRequest { - const obj = createBaseAssetTypeRequest(); - if (isSet(object.denom)) obj.denom = String(object.denom); - return obj; + return { + denom: isSet(object.denom) ? String(object.denom) : "" + }; }, toJSON(message: AssetTypeRequest): JsonSafe<AssetTypeRequest> { const obj: any = {}; @@ -644,9 +748,9 @@ export const AssetTypeResponse = { return message; }, fromJSON(object: any): AssetTypeResponse { - const obj = createBaseAssetTypeResponse(); - if (isSet(object.assetType)) obj.assetType = superfluidAssetTypeFromJSON(object.assetType); - return obj; + return { + assetType: isSet(object.assetType) ? superfluidAssetTypeFromJSON(object.assetType) : -1 + }; }, toJSON(message: AssetTypeResponse): JsonSafe<AssetTypeResponse> { const obj: any = {}; @@ -730,8 +834,7 @@ export const AllAssetsRequest = { return message; }, fromJSON(_: any): AllAssetsRequest { - const obj = createBaseAllAssetsRequest(); - return obj; + return {}; }, toJSON(_: AllAssetsRequest): JsonSafe<AllAssetsRequest> { const obj: any = {}; @@ -812,9 +915,9 @@ export const AllAssetsResponse = { return message; }, fromJSON(object: any): AllAssetsResponse { - const obj = createBaseAllAssetsResponse(); - if (Array.isArray(object?.assets)) obj.assets = object.assets.map((e: any) => SuperfluidAsset.fromJSON(e)); - return obj; + return { + assets: Array.isArray(object?.assets) ? object.assets.map((e: any) => SuperfluidAsset.fromJSON(e)) : [] + }; }, toJSON(message: AllAssetsResponse): JsonSafe<AllAssetsResponse> { const obj: any = {}; @@ -893,7 +996,7 @@ function createBaseAssetMultiplierRequest(): AssetMultiplierRequest { export const AssetMultiplierRequest = { typeUrl: "/osmosis.superfluid.AssetMultiplierRequest", encode(message: AssetMultiplierRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.denom !== undefined) { + if (message.denom !== "") { writer.uint32(10).string(message.denom); } return writer; @@ -916,9 +1019,9 @@ export const AssetMultiplierRequest = { return message; }, fromJSON(object: any): AssetMultiplierRequest { - const obj = createBaseAssetMultiplierRequest(); - if (isSet(object.denom)) obj.denom = String(object.denom); - return obj; + return { + denom: isSet(object.denom) ? String(object.denom) : "" + }; }, toJSON(message: AssetMultiplierRequest): JsonSafe<AssetMultiplierRequest> { const obj: any = {}; @@ -1010,9 +1113,9 @@ export const AssetMultiplierResponse = { return message; }, fromJSON(object: any): AssetMultiplierResponse { - const obj = createBaseAssetMultiplierResponse(); - if (isSet(object.osmoEquivalentMultiplier)) obj.osmoEquivalentMultiplier = OsmoEquivalentMultiplierRecord.fromJSON(object.osmoEquivalentMultiplier); - return obj; + return { + osmoEquivalentMultiplier: isSet(object.osmoEquivalentMultiplier) ? OsmoEquivalentMultiplierRecord.fromJSON(object.osmoEquivalentMultiplier) : undefined + }; }, toJSON(message: AssetMultiplierResponse): JsonSafe<AssetMultiplierResponse> { const obj: any = {}; @@ -1021,9 +1124,7 @@ export const AssetMultiplierResponse = { }, fromPartial(object: DeepPartial<AssetMultiplierResponse>): AssetMultiplierResponse { const message = createBaseAssetMultiplierResponse(); - if (object.osmoEquivalentMultiplier !== undefined && object.osmoEquivalentMultiplier !== null) { - message.osmoEquivalentMultiplier = OsmoEquivalentMultiplierRecord.fromPartial(object.osmoEquivalentMultiplier); - } + message.osmoEquivalentMultiplier = object.osmoEquivalentMultiplier !== undefined && object.osmoEquivalentMultiplier !== null ? OsmoEquivalentMultiplierRecord.fromPartial(object.osmoEquivalentMultiplier) : undefined; return message; }, fromSDK(object: AssetMultiplierResponseSDKType): AssetMultiplierResponse { @@ -1086,16 +1187,16 @@ function createBaseSuperfluidIntermediaryAccountInfo(): SuperfluidIntermediaryAc export const SuperfluidIntermediaryAccountInfo = { typeUrl: "/osmosis.superfluid.SuperfluidIntermediaryAccountInfo", encode(message: SuperfluidIntermediaryAccountInfo, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.denom !== undefined) { + if (message.denom !== "") { writer.uint32(10).string(message.denom); } - if (message.valAddr !== undefined) { + if (message.valAddr !== "") { writer.uint32(18).string(message.valAddr); } - if (message.gaugeId !== undefined) { + if (message.gaugeId !== BigInt(0)) { writer.uint32(24).uint64(message.gaugeId); } - if (message.address !== undefined) { + if (message.address !== "") { writer.uint32(34).string(message.address); } return writer; @@ -1127,12 +1228,12 @@ export const SuperfluidIntermediaryAccountInfo = { return message; }, fromJSON(object: any): SuperfluidIntermediaryAccountInfo { - const obj = createBaseSuperfluidIntermediaryAccountInfo(); - if (isSet(object.denom)) obj.denom = String(object.denom); - if (isSet(object.valAddr)) obj.valAddr = String(object.valAddr); - if (isSet(object.gaugeId)) obj.gaugeId = BigInt(object.gaugeId.toString()); - if (isSet(object.address)) obj.address = String(object.address); - return obj; + return { + denom: isSet(object.denom) ? String(object.denom) : "", + valAddr: isSet(object.valAddr) ? String(object.valAddr) : "", + gaugeId: isSet(object.gaugeId) ? BigInt(object.gaugeId.toString()) : BigInt(0), + address: isSet(object.address) ? String(object.address) : "" + }; }, toJSON(message: SuperfluidIntermediaryAccountInfo): JsonSafe<SuperfluidIntermediaryAccountInfo> { const obj: any = {}; @@ -1146,9 +1247,7 @@ export const SuperfluidIntermediaryAccountInfo = { const message = createBaseSuperfluidIntermediaryAccountInfo(); message.denom = object.denom ?? ""; message.valAddr = object.valAddr ?? ""; - if (object.gaugeId !== undefined && object.gaugeId !== null) { - message.gaugeId = BigInt(object.gaugeId.toString()); - } + message.gaugeId = object.gaugeId !== undefined && object.gaugeId !== null ? BigInt(object.gaugeId.toString()) : BigInt(0); message.address = object.address ?? ""; return message; }, @@ -1253,9 +1352,9 @@ export const AllIntermediaryAccountsRequest = { return message; }, fromJSON(object: any): AllIntermediaryAccountsRequest { - const obj = createBaseAllIntermediaryAccountsRequest(); - if (isSet(object.pagination)) obj.pagination = PageRequest.fromJSON(object.pagination); - return obj; + return { + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined + }; }, toJSON(message: AllIntermediaryAccountsRequest): JsonSafe<AllIntermediaryAccountsRequest> { const obj: any = {}; @@ -1264,9 +1363,7 @@ export const AllIntermediaryAccountsRequest = { }, fromPartial(object: DeepPartial<AllIntermediaryAccountsRequest>): AllIntermediaryAccountsRequest { const message = createBaseAllIntermediaryAccountsRequest(); - if (object.pagination !== undefined && object.pagination !== null) { - message.pagination = PageRequest.fromPartial(object.pagination); - } + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageRequest.fromPartial(object.pagination) : undefined; return message; }, fromSDK(object: AllIntermediaryAccountsRequestSDKType): AllIntermediaryAccountsRequest { @@ -1356,10 +1453,10 @@ export const AllIntermediaryAccountsResponse = { return message; }, fromJSON(object: any): AllIntermediaryAccountsResponse { - const obj = createBaseAllIntermediaryAccountsResponse(); - if (Array.isArray(object?.accounts)) obj.accounts = object.accounts.map((e: any) => SuperfluidIntermediaryAccountInfo.fromJSON(e)); - if (isSet(object.pagination)) obj.pagination = PageResponse.fromJSON(object.pagination); - return obj; + return { + accounts: Array.isArray(object?.accounts) ? object.accounts.map((e: any) => SuperfluidIntermediaryAccountInfo.fromJSON(e)) : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined + }; }, toJSON(message: AllIntermediaryAccountsResponse): JsonSafe<AllIntermediaryAccountsResponse> { const obj: any = {}; @@ -1374,9 +1471,7 @@ export const AllIntermediaryAccountsResponse = { fromPartial(object: DeepPartial<AllIntermediaryAccountsResponse>): AllIntermediaryAccountsResponse { const message = createBaseAllIntermediaryAccountsResponse(); message.accounts = object.accounts?.map(e => SuperfluidIntermediaryAccountInfo.fromPartial(e)) || []; - if (object.pagination !== undefined && object.pagination !== null) { - message.pagination = PageResponse.fromPartial(object.pagination); - } + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageResponse.fromPartial(object.pagination) : undefined; return message; }, fromSDK(object: AllIntermediaryAccountsResponseSDKType): AllIntermediaryAccountsResponse { @@ -1449,7 +1544,7 @@ function createBaseConnectedIntermediaryAccountRequest(): ConnectedIntermediaryA export const ConnectedIntermediaryAccountRequest = { typeUrl: "/osmosis.superfluid.ConnectedIntermediaryAccountRequest", encode(message: ConnectedIntermediaryAccountRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.lockId !== undefined) { + if (message.lockId !== BigInt(0)) { writer.uint32(8).uint64(message.lockId); } return writer; @@ -1472,9 +1567,9 @@ export const ConnectedIntermediaryAccountRequest = { return message; }, fromJSON(object: any): ConnectedIntermediaryAccountRequest { - const obj = createBaseConnectedIntermediaryAccountRequest(); - if (isSet(object.lockId)) obj.lockId = BigInt(object.lockId.toString()); - return obj; + return { + lockId: isSet(object.lockId) ? BigInt(object.lockId.toString()) : BigInt(0) + }; }, toJSON(message: ConnectedIntermediaryAccountRequest): JsonSafe<ConnectedIntermediaryAccountRequest> { const obj: any = {}; @@ -1483,9 +1578,7 @@ export const ConnectedIntermediaryAccountRequest = { }, fromPartial(object: DeepPartial<ConnectedIntermediaryAccountRequest>): ConnectedIntermediaryAccountRequest { const message = createBaseConnectedIntermediaryAccountRequest(); - if (object.lockId !== undefined && object.lockId !== null) { - message.lockId = BigInt(object.lockId.toString()); - } + message.lockId = object.lockId !== undefined && object.lockId !== null ? BigInt(object.lockId.toString()) : BigInt(0); return message; }, fromSDK(object: ConnectedIntermediaryAccountRequestSDKType): ConnectedIntermediaryAccountRequest { @@ -1568,9 +1661,9 @@ export const ConnectedIntermediaryAccountResponse = { return message; }, fromJSON(object: any): ConnectedIntermediaryAccountResponse { - const obj = createBaseConnectedIntermediaryAccountResponse(); - if (isSet(object.account)) obj.account = SuperfluidIntermediaryAccountInfo.fromJSON(object.account); - return obj; + return { + account: isSet(object.account) ? SuperfluidIntermediaryAccountInfo.fromJSON(object.account) : undefined + }; }, toJSON(message: ConnectedIntermediaryAccountResponse): JsonSafe<ConnectedIntermediaryAccountResponse> { const obj: any = {}; @@ -1579,9 +1672,7 @@ export const ConnectedIntermediaryAccountResponse = { }, fromPartial(object: DeepPartial<ConnectedIntermediaryAccountResponse>): ConnectedIntermediaryAccountResponse { const message = createBaseConnectedIntermediaryAccountResponse(); - if (object.account !== undefined && object.account !== null) { - message.account = SuperfluidIntermediaryAccountInfo.fromPartial(object.account); - } + message.account = object.account !== undefined && object.account !== null ? SuperfluidIntermediaryAccountInfo.fromPartial(object.account) : undefined; return message; }, fromSDK(object: ConnectedIntermediaryAccountResponseSDKType): ConnectedIntermediaryAccountResponse { @@ -1641,7 +1732,7 @@ function createBaseQueryTotalDelegationByValidatorForDenomRequest(): QueryTotalD export const QueryTotalDelegationByValidatorForDenomRequest = { typeUrl: "/osmosis.superfluid.QueryTotalDelegationByValidatorForDenomRequest", encode(message: QueryTotalDelegationByValidatorForDenomRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.denom !== undefined) { + if (message.denom !== "") { writer.uint32(10).string(message.denom); } return writer; @@ -1664,9 +1755,9 @@ export const QueryTotalDelegationByValidatorForDenomRequest = { return message; }, fromJSON(object: any): QueryTotalDelegationByValidatorForDenomRequest { - const obj = createBaseQueryTotalDelegationByValidatorForDenomRequest(); - if (isSet(object.denom)) obj.denom = String(object.denom); - return obj; + return { + denom: isSet(object.denom) ? String(object.denom) : "" + }; }, toJSON(message: QueryTotalDelegationByValidatorForDenomRequest): JsonSafe<QueryTotalDelegationByValidatorForDenomRequest> { const obj: any = {}; @@ -1758,9 +1849,9 @@ export const QueryTotalDelegationByValidatorForDenomResponse = { return message; }, fromJSON(object: any): QueryTotalDelegationByValidatorForDenomResponse { - const obj = createBaseQueryTotalDelegationByValidatorForDenomResponse(); - if (Array.isArray(object?.assets)) obj.assets = object.assets.map((e: any) => Delegations.fromJSON(e)); - return obj; + return { + assets: Array.isArray(object?.assets) ? object.assets.map((e: any) => Delegations.fromJSON(e)) : [] + }; }, toJSON(message: QueryTotalDelegationByValidatorForDenomResponse): JsonSafe<QueryTotalDelegationByValidatorForDenomResponse> { const obj: any = {}; @@ -1841,13 +1932,13 @@ function createBaseDelegations(): Delegations { export const Delegations = { typeUrl: "/osmosis.superfluid.Delegations", encode(message: Delegations, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.valAddr !== undefined) { + if (message.valAddr !== "") { writer.uint32(10).string(message.valAddr); } - if (message.amountSfsd !== undefined) { + if (message.amountSfsd !== "") { writer.uint32(18).string(message.amountSfsd); } - if (message.osmoEquivalent !== undefined) { + if (message.osmoEquivalent !== "") { writer.uint32(26).string(message.osmoEquivalent); } return writer; @@ -1876,11 +1967,11 @@ export const Delegations = { return message; }, fromJSON(object: any): Delegations { - const obj = createBaseDelegations(); - if (isSet(object.valAddr)) obj.valAddr = String(object.valAddr); - if (isSet(object.amountSfsd)) obj.amountSfsd = String(object.amountSfsd); - if (isSet(object.osmoEquivalent)) obj.osmoEquivalent = String(object.osmoEquivalent); - return obj; + return { + valAddr: isSet(object.valAddr) ? String(object.valAddr) : "", + amountSfsd: isSet(object.amountSfsd) ? String(object.amountSfsd) : "", + osmoEquivalent: isSet(object.osmoEquivalent) ? String(object.osmoEquivalent) : "" + }; }, toJSON(message: Delegations): JsonSafe<Delegations> { const obj: any = {}; @@ -1982,8 +2073,7 @@ export const TotalSuperfluidDelegationsRequest = { return message; }, fromJSON(_: any): TotalSuperfluidDelegationsRequest { - const obj = createBaseTotalSuperfluidDelegationsRequest(); - return obj; + return {}; }, toJSON(_: TotalSuperfluidDelegationsRequest): JsonSafe<TotalSuperfluidDelegationsRequest> { const obj: any = {}; @@ -2041,7 +2131,7 @@ function createBaseTotalSuperfluidDelegationsResponse(): TotalSuperfluidDelegati export const TotalSuperfluidDelegationsResponse = { typeUrl: "/osmosis.superfluid.TotalSuperfluidDelegationsResponse", encode(message: TotalSuperfluidDelegationsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.totalDelegations !== undefined) { + if (message.totalDelegations !== "") { writer.uint32(10).string(message.totalDelegations); } return writer; @@ -2064,9 +2154,9 @@ export const TotalSuperfluidDelegationsResponse = { return message; }, fromJSON(object: any): TotalSuperfluidDelegationsResponse { - const obj = createBaseTotalSuperfluidDelegationsResponse(); - if (isSet(object.totalDelegations)) obj.totalDelegations = String(object.totalDelegations); - return obj; + return { + totalDelegations: isSet(object.totalDelegations) ? String(object.totalDelegations) : "" + }; }, toJSON(message: TotalSuperfluidDelegationsResponse): JsonSafe<TotalSuperfluidDelegationsResponse> { const obj: any = {}; @@ -2137,13 +2227,13 @@ function createBaseSuperfluidDelegationAmountRequest(): SuperfluidDelegationAmou export const SuperfluidDelegationAmountRequest = { typeUrl: "/osmosis.superfluid.SuperfluidDelegationAmountRequest", encode(message: SuperfluidDelegationAmountRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.delegatorAddress !== undefined) { + if (message.delegatorAddress !== "") { writer.uint32(10).string(message.delegatorAddress); } - if (message.validatorAddress !== undefined) { + if (message.validatorAddress !== "") { writer.uint32(18).string(message.validatorAddress); } - if (message.denom !== undefined) { + if (message.denom !== "") { writer.uint32(26).string(message.denom); } return writer; @@ -2172,11 +2262,11 @@ export const SuperfluidDelegationAmountRequest = { return message; }, fromJSON(object: any): SuperfluidDelegationAmountRequest { - const obj = createBaseSuperfluidDelegationAmountRequest(); - if (isSet(object.delegatorAddress)) obj.delegatorAddress = String(object.delegatorAddress); - if (isSet(object.validatorAddress)) obj.validatorAddress = String(object.validatorAddress); - if (isSet(object.denom)) obj.denom = String(object.denom); - return obj; + return { + delegatorAddress: isSet(object.delegatorAddress) ? String(object.delegatorAddress) : "", + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + denom: isSet(object.denom) ? String(object.denom) : "" + }; }, toJSON(message: SuperfluidDelegationAmountRequest): JsonSafe<SuperfluidDelegationAmountRequest> { const obj: any = {}; @@ -2286,9 +2376,9 @@ export const SuperfluidDelegationAmountResponse = { return message; }, fromJSON(object: any): SuperfluidDelegationAmountResponse { - const obj = createBaseSuperfluidDelegationAmountResponse(); - if (Array.isArray(object?.amount)) obj.amount = object.amount.map((e: any) => Coin.fromJSON(e)); - return obj; + return { + amount: Array.isArray(object?.amount) ? object.amount.map((e: any) => Coin.fromJSON(e)) : [] + }; }, toJSON(message: SuperfluidDelegationAmountResponse): JsonSafe<SuperfluidDelegationAmountResponse> { const obj: any = {}; @@ -2367,7 +2457,7 @@ function createBaseSuperfluidDelegationsByDelegatorRequest(): SuperfluidDelegati export const SuperfluidDelegationsByDelegatorRequest = { typeUrl: "/osmosis.superfluid.SuperfluidDelegationsByDelegatorRequest", encode(message: SuperfluidDelegationsByDelegatorRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.delegatorAddress !== undefined) { + if (message.delegatorAddress !== "") { writer.uint32(10).string(message.delegatorAddress); } return writer; @@ -2390,9 +2480,9 @@ export const SuperfluidDelegationsByDelegatorRequest = { return message; }, fromJSON(object: any): SuperfluidDelegationsByDelegatorRequest { - const obj = createBaseSuperfluidDelegationsByDelegatorRequest(); - if (isSet(object.delegatorAddress)) obj.delegatorAddress = String(object.delegatorAddress); - return obj; + return { + delegatorAddress: isSet(object.delegatorAddress) ? String(object.delegatorAddress) : "" + }; }, toJSON(message: SuperfluidDelegationsByDelegatorRequest): JsonSafe<SuperfluidDelegationsByDelegatorRequest> { const obj: any = {}; @@ -2498,11 +2588,11 @@ export const SuperfluidDelegationsByDelegatorResponse = { return message; }, fromJSON(object: any): SuperfluidDelegationsByDelegatorResponse { - const obj = createBaseSuperfluidDelegationsByDelegatorResponse(); - if (Array.isArray(object?.superfluidDelegationRecords)) obj.superfluidDelegationRecords = object.superfluidDelegationRecords.map((e: any) => SuperfluidDelegationRecord.fromJSON(e)); - if (Array.isArray(object?.totalDelegatedCoins)) obj.totalDelegatedCoins = object.totalDelegatedCoins.map((e: any) => Coin.fromJSON(e)); - if (isSet(object.totalEquivalentStakedAmount)) obj.totalEquivalentStakedAmount = Coin.fromJSON(object.totalEquivalentStakedAmount); - return obj; + return { + superfluidDelegationRecords: Array.isArray(object?.superfluidDelegationRecords) ? object.superfluidDelegationRecords.map((e: any) => SuperfluidDelegationRecord.fromJSON(e)) : [], + totalDelegatedCoins: Array.isArray(object?.totalDelegatedCoins) ? object.totalDelegatedCoins.map((e: any) => Coin.fromJSON(e)) : [], + totalEquivalentStakedAmount: isSet(object.totalEquivalentStakedAmount) ? Coin.fromJSON(object.totalEquivalentStakedAmount) : undefined + }; }, toJSON(message: SuperfluidDelegationsByDelegatorResponse): JsonSafe<SuperfluidDelegationsByDelegatorResponse> { const obj: any = {}; @@ -2523,9 +2613,7 @@ export const SuperfluidDelegationsByDelegatorResponse = { const message = createBaseSuperfluidDelegationsByDelegatorResponse(); message.superfluidDelegationRecords = object.superfluidDelegationRecords?.map(e => SuperfluidDelegationRecord.fromPartial(e)) || []; message.totalDelegatedCoins = object.totalDelegatedCoins?.map(e => Coin.fromPartial(e)) || []; - if (object.totalEquivalentStakedAmount !== undefined && object.totalEquivalentStakedAmount !== null) { - message.totalEquivalentStakedAmount = Coin.fromPartial(object.totalEquivalentStakedAmount); - } + message.totalEquivalentStakedAmount = object.totalEquivalentStakedAmount !== undefined && object.totalEquivalentStakedAmount !== null ? Coin.fromPartial(object.totalEquivalentStakedAmount) : undefined; return message; }, fromSDK(object: SuperfluidDelegationsByDelegatorResponseSDKType): SuperfluidDelegationsByDelegatorResponse { @@ -2612,10 +2700,10 @@ function createBaseSuperfluidUndelegationsByDelegatorRequest(): SuperfluidUndele export const SuperfluidUndelegationsByDelegatorRequest = { typeUrl: "/osmosis.superfluid.SuperfluidUndelegationsByDelegatorRequest", encode(message: SuperfluidUndelegationsByDelegatorRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.delegatorAddress !== undefined) { + if (message.delegatorAddress !== "") { writer.uint32(10).string(message.delegatorAddress); } - if (message.denom !== undefined) { + if (message.denom !== "") { writer.uint32(18).string(message.denom); } return writer; @@ -2641,10 +2729,10 @@ export const SuperfluidUndelegationsByDelegatorRequest = { return message; }, fromJSON(object: any): SuperfluidUndelegationsByDelegatorRequest { - const obj = createBaseSuperfluidUndelegationsByDelegatorRequest(); - if (isSet(object.delegatorAddress)) obj.delegatorAddress = String(object.delegatorAddress); - if (isSet(object.denom)) obj.denom = String(object.denom); - return obj; + return { + delegatorAddress: isSet(object.delegatorAddress) ? String(object.delegatorAddress) : "", + denom: isSet(object.denom) ? String(object.denom) : "" + }; }, toJSON(message: SuperfluidUndelegationsByDelegatorRequest): JsonSafe<SuperfluidUndelegationsByDelegatorRequest> { const obj: any = {}; @@ -2759,11 +2847,11 @@ export const SuperfluidUndelegationsByDelegatorResponse = { return message; }, fromJSON(object: any): SuperfluidUndelegationsByDelegatorResponse { - const obj = createBaseSuperfluidUndelegationsByDelegatorResponse(); - if (Array.isArray(object?.superfluidDelegationRecords)) obj.superfluidDelegationRecords = object.superfluidDelegationRecords.map((e: any) => SuperfluidDelegationRecord.fromJSON(e)); - if (Array.isArray(object?.totalUndelegatedCoins)) obj.totalUndelegatedCoins = object.totalUndelegatedCoins.map((e: any) => Coin.fromJSON(e)); - if (Array.isArray(object?.syntheticLocks)) obj.syntheticLocks = object.syntheticLocks.map((e: any) => SyntheticLock.fromJSON(e)); - return obj; + return { + superfluidDelegationRecords: Array.isArray(object?.superfluidDelegationRecords) ? object.superfluidDelegationRecords.map((e: any) => SuperfluidDelegationRecord.fromJSON(e)) : [], + totalUndelegatedCoins: Array.isArray(object?.totalUndelegatedCoins) ? object.totalUndelegatedCoins.map((e: any) => Coin.fromJSON(e)) : [], + syntheticLocks: Array.isArray(object?.syntheticLocks) ? object.syntheticLocks.map((e: any) => SyntheticLock.fromJSON(e)) : [] + }; }, toJSON(message: SuperfluidUndelegationsByDelegatorResponse): JsonSafe<SuperfluidUndelegationsByDelegatorResponse> { const obj: any = {}; @@ -2881,10 +2969,10 @@ function createBaseSuperfluidDelegationsByValidatorDenomRequest(): SuperfluidDel export const SuperfluidDelegationsByValidatorDenomRequest = { typeUrl: "/osmosis.superfluid.SuperfluidDelegationsByValidatorDenomRequest", encode(message: SuperfluidDelegationsByValidatorDenomRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.validatorAddress !== undefined) { + if (message.validatorAddress !== "") { writer.uint32(10).string(message.validatorAddress); } - if (message.denom !== undefined) { + if (message.denom !== "") { writer.uint32(18).string(message.denom); } return writer; @@ -2910,10 +2998,10 @@ export const SuperfluidDelegationsByValidatorDenomRequest = { return message; }, fromJSON(object: any): SuperfluidDelegationsByValidatorDenomRequest { - const obj = createBaseSuperfluidDelegationsByValidatorDenomRequest(); - if (isSet(object.validatorAddress)) obj.validatorAddress = String(object.validatorAddress); - if (isSet(object.denom)) obj.denom = String(object.denom); - return obj; + return { + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + denom: isSet(object.denom) ? String(object.denom) : "" + }; }, toJSON(message: SuperfluidDelegationsByValidatorDenomRequest): JsonSafe<SuperfluidDelegationsByValidatorDenomRequest> { const obj: any = {}; @@ -3014,9 +3102,9 @@ export const SuperfluidDelegationsByValidatorDenomResponse = { return message; }, fromJSON(object: any): SuperfluidDelegationsByValidatorDenomResponse { - const obj = createBaseSuperfluidDelegationsByValidatorDenomResponse(); - if (Array.isArray(object?.superfluidDelegationRecords)) obj.superfluidDelegationRecords = object.superfluidDelegationRecords.map((e: any) => SuperfluidDelegationRecord.fromJSON(e)); - return obj; + return { + superfluidDelegationRecords: Array.isArray(object?.superfluidDelegationRecords) ? object.superfluidDelegationRecords.map((e: any) => SuperfluidDelegationRecord.fromJSON(e)) : [] + }; }, toJSON(message: SuperfluidDelegationsByValidatorDenomResponse): JsonSafe<SuperfluidDelegationsByValidatorDenomResponse> { const obj: any = {}; @@ -3096,10 +3184,10 @@ function createBaseEstimateSuperfluidDelegatedAmountByValidatorDenomRequest(): E export const EstimateSuperfluidDelegatedAmountByValidatorDenomRequest = { typeUrl: "/osmosis.superfluid.EstimateSuperfluidDelegatedAmountByValidatorDenomRequest", encode(message: EstimateSuperfluidDelegatedAmountByValidatorDenomRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.validatorAddress !== undefined) { + if (message.validatorAddress !== "") { writer.uint32(10).string(message.validatorAddress); } - if (message.denom !== undefined) { + if (message.denom !== "") { writer.uint32(18).string(message.denom); } return writer; @@ -3125,10 +3213,10 @@ export const EstimateSuperfluidDelegatedAmountByValidatorDenomRequest = { return message; }, fromJSON(object: any): EstimateSuperfluidDelegatedAmountByValidatorDenomRequest { - const obj = createBaseEstimateSuperfluidDelegatedAmountByValidatorDenomRequest(); - if (isSet(object.validatorAddress)) obj.validatorAddress = String(object.validatorAddress); - if (isSet(object.denom)) obj.denom = String(object.denom); - return obj; + return { + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + denom: isSet(object.denom) ? String(object.denom) : "" + }; }, toJSON(message: EstimateSuperfluidDelegatedAmountByValidatorDenomRequest): JsonSafe<EstimateSuperfluidDelegatedAmountByValidatorDenomRequest> { const obj: any = {}; @@ -3229,9 +3317,9 @@ export const EstimateSuperfluidDelegatedAmountByValidatorDenomResponse = { return message; }, fromJSON(object: any): EstimateSuperfluidDelegatedAmountByValidatorDenomResponse { - const obj = createBaseEstimateSuperfluidDelegatedAmountByValidatorDenomResponse(); - if (Array.isArray(object?.totalDelegatedCoins)) obj.totalDelegatedCoins = object.totalDelegatedCoins.map((e: any) => Coin.fromJSON(e)); - return obj; + return { + totalDelegatedCoins: Array.isArray(object?.totalDelegatedCoins) ? object.totalDelegatedCoins.map((e: any) => Coin.fromJSON(e)) : [] + }; }, toJSON(message: EstimateSuperfluidDelegatedAmountByValidatorDenomResponse): JsonSafe<EstimateSuperfluidDelegatedAmountByValidatorDenomResponse> { const obj: any = {}; @@ -3310,7 +3398,7 @@ function createBaseQueryTotalDelegationByDelegatorRequest(): QueryTotalDelegatio export const QueryTotalDelegationByDelegatorRequest = { typeUrl: "/osmosis.superfluid.QueryTotalDelegationByDelegatorRequest", encode(message: QueryTotalDelegationByDelegatorRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.delegatorAddress !== undefined) { + if (message.delegatorAddress !== "") { writer.uint32(10).string(message.delegatorAddress); } return writer; @@ -3333,9 +3421,9 @@ export const QueryTotalDelegationByDelegatorRequest = { return message; }, fromJSON(object: any): QueryTotalDelegationByDelegatorRequest { - const obj = createBaseQueryTotalDelegationByDelegatorRequest(); - if (isSet(object.delegatorAddress)) obj.delegatorAddress = String(object.delegatorAddress); - return obj; + return { + delegatorAddress: isSet(object.delegatorAddress) ? String(object.delegatorAddress) : "" + }; }, toJSON(message: QueryTotalDelegationByDelegatorRequest): JsonSafe<QueryTotalDelegationByDelegatorRequest> { const obj: any = {}; @@ -3448,12 +3536,12 @@ export const QueryTotalDelegationByDelegatorResponse = { return message; }, fromJSON(object: any): QueryTotalDelegationByDelegatorResponse { - const obj = createBaseQueryTotalDelegationByDelegatorResponse(); - if (Array.isArray(object?.superfluidDelegationRecords)) obj.superfluidDelegationRecords = object.superfluidDelegationRecords.map((e: any) => SuperfluidDelegationRecord.fromJSON(e)); - if (Array.isArray(object?.delegationResponse)) obj.delegationResponse = object.delegationResponse.map((e: any) => DelegationResponse.fromJSON(e)); - if (Array.isArray(object?.totalDelegatedCoins)) obj.totalDelegatedCoins = object.totalDelegatedCoins.map((e: any) => Coin.fromJSON(e)); - if (isSet(object.totalEquivalentStakedAmount)) obj.totalEquivalentStakedAmount = Coin.fromJSON(object.totalEquivalentStakedAmount); - return obj; + return { + superfluidDelegationRecords: Array.isArray(object?.superfluidDelegationRecords) ? object.superfluidDelegationRecords.map((e: any) => SuperfluidDelegationRecord.fromJSON(e)) : [], + delegationResponse: Array.isArray(object?.delegationResponse) ? object.delegationResponse.map((e: any) => DelegationResponse.fromJSON(e)) : [], + totalDelegatedCoins: Array.isArray(object?.totalDelegatedCoins) ? object.totalDelegatedCoins.map((e: any) => Coin.fromJSON(e)) : [], + totalEquivalentStakedAmount: isSet(object.totalEquivalentStakedAmount) ? Coin.fromJSON(object.totalEquivalentStakedAmount) : undefined + }; }, toJSON(message: QueryTotalDelegationByDelegatorResponse): JsonSafe<QueryTotalDelegationByDelegatorResponse> { const obj: any = {}; @@ -3480,9 +3568,7 @@ export const QueryTotalDelegationByDelegatorResponse = { message.superfluidDelegationRecords = object.superfluidDelegationRecords?.map(e => SuperfluidDelegationRecord.fromPartial(e)) || []; message.delegationResponse = object.delegationResponse?.map(e => DelegationResponse.fromPartial(e)) || []; message.totalDelegatedCoins = object.totalDelegatedCoins?.map(e => Coin.fromPartial(e)) || []; - if (object.totalEquivalentStakedAmount !== undefined && object.totalEquivalentStakedAmount !== null) { - message.totalEquivalentStakedAmount = Coin.fromPartial(object.totalEquivalentStakedAmount); - } + message.totalEquivalentStakedAmount = object.totalEquivalentStakedAmount !== undefined && object.totalEquivalentStakedAmount !== null ? Coin.fromPartial(object.totalEquivalentStakedAmount) : undefined; return message; }, fromSDK(object: QueryTotalDelegationByDelegatorResponseSDKType): QueryTotalDelegationByDelegatorResponse { @@ -3596,8 +3682,7 @@ export const QueryUnpoolWhitelistRequest = { return message; }, fromJSON(_: any): QueryUnpoolWhitelistRequest { - const obj = createBaseQueryUnpoolWhitelistRequest(); - return obj; + return {}; }, toJSON(_: QueryUnpoolWhitelistRequest): JsonSafe<QueryUnpoolWhitelistRequest> { const obj: any = {}; @@ -3687,9 +3772,9 @@ export const QueryUnpoolWhitelistResponse = { return message; }, fromJSON(object: any): QueryUnpoolWhitelistResponse { - const obj = createBaseQueryUnpoolWhitelistResponse(); - if (Array.isArray(object?.poolIds)) obj.poolIds = object.poolIds.map((e: any) => BigInt(e.toString())); - return obj; + return { + poolIds: Array.isArray(object?.poolIds) ? object.poolIds.map((e: any) => BigInt(e.toString())) : [] + }; }, toJSON(message: QueryUnpoolWhitelistResponse): JsonSafe<QueryUnpoolWhitelistResponse> { const obj: any = {}; diff --git a/__fixtures__/v-next/outputv4/osmosis/superfluid/superfluid.ts b/__fixtures__/v-next/outputv4/osmosis/superfluid/superfluid.ts index 7b49e53429..c0e253442e 100644 --- a/__fixtures__/v-next/outputv4/osmosis/superfluid/superfluid.ts +++ b/__fixtures__/v-next/outputv4/osmosis/superfluid/superfluid.ts @@ -1,8 +1,9 @@ -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"; +import { Coin, CoinSDKType } from "../../cosmos/base/v1beta1/coin"; +import { BinaryReader, BinaryWriter } from "../../binary"; +import { isSet, DeepPartial } from "../../helpers"; +import { JsonSafe } from "../../json-safe"; import { Decimal } from "@cosmjs/math"; +import { ComputedRef } from "vue"; export const protobufPackage = "osmosis.superfluid"; /** * SuperfluidAssetType indicates whether the superfluid asset is @@ -48,6 +49,10 @@ export interface SuperfluidAsset { */ assetType: SuperfluidAssetType; } +export interface ReactiveSuperfluidAsset { + denom: ComputedRef<string>; + assetType: ComputedRef<SuperfluidAssetType>; +} export interface SuperfluidAssetProtoMsg { typeUrl: "/osmosis.superfluid.SuperfluidAsset"; value: Uint8Array; @@ -69,6 +74,11 @@ export interface SuperfluidIntermediaryAccount { /** perpetual gauge for rewards distribution */ gaugeId: bigint; } +export interface ReactiveSuperfluidIntermediaryAccount { + denom: ComputedRef<string>; + valAddr: ComputedRef<string>; + gaugeId: ComputedRef<bigint>; +} export interface SuperfluidIntermediaryAccountProtoMsg { typeUrl: "/osmosis.superfluid.SuperfluidIntermediaryAccount"; value: Uint8Array; @@ -98,6 +108,11 @@ export interface OsmoEquivalentMultiplierRecord { denom: string; multiplier: string; } +export interface ReactiveOsmoEquivalentMultiplierRecord { + epochNumber: ComputedRef<bigint>; + denom: ComputedRef<string>; + multiplier: ComputedRef<string>; +} export interface OsmoEquivalentMultiplierRecordProtoMsg { typeUrl: "/osmosis.superfluid.OsmoEquivalentMultiplierRecord"; value: Uint8Array; @@ -126,6 +141,12 @@ export interface SuperfluidDelegationRecord { delegationAmount: Coin; equivalentStakedAmount?: Coin; } +export interface ReactiveSuperfluidDelegationRecord { + delegatorAddress: ComputedRef<string>; + validatorAddress: ComputedRef<string>; + delegationAmount: ComputedRef<Coin>; + equivalentStakedAmount?: ComputedRef<Coin>; +} export interface SuperfluidDelegationRecordProtoMsg { typeUrl: "/osmosis.superfluid.SuperfluidDelegationRecord"; value: Uint8Array; @@ -149,6 +170,10 @@ export interface LockIdIntermediaryAccountConnection { lockId: bigint; intermediaryAccount: string; } +export interface ReactiveLockIdIntermediaryAccountConnection { + lockId: ComputedRef<bigint>; + intermediaryAccount: ComputedRef<string>; +} export interface LockIdIntermediaryAccountConnectionProtoMsg { typeUrl: "/osmosis.superfluid.LockIdIntermediaryAccountConnection"; value: Uint8Array; @@ -165,6 +190,9 @@ export interface LockIdIntermediaryAccountConnectionSDKType { export interface UnpoolWhitelistedPools { ids: bigint[]; } +export interface ReactiveUnpoolWhitelistedPools { + ids: ComputedRef<bigint[]>; +} export interface UnpoolWhitelistedPoolsProtoMsg { typeUrl: "/osmosis.superfluid.UnpoolWhitelistedPools"; value: Uint8Array; @@ -181,7 +209,7 @@ function createBaseSuperfluidAsset(): SuperfluidAsset { export const SuperfluidAsset = { typeUrl: "/osmosis.superfluid.SuperfluidAsset", encode(message: SuperfluidAsset, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.denom !== undefined) { + if (message.denom !== "") { writer.uint32(10).string(message.denom); } if (message.assetType !== 0) { @@ -210,10 +238,10 @@ export const SuperfluidAsset = { return message; }, fromJSON(object: any): SuperfluidAsset { - const obj = createBaseSuperfluidAsset(); - if (isSet(object.denom)) obj.denom = String(object.denom); - if (isSet(object.assetType)) obj.assetType = superfluidAssetTypeFromJSON(object.assetType); - return obj; + return { + denom: isSet(object.denom) ? String(object.denom) : "", + assetType: isSet(object.assetType) ? superfluidAssetTypeFromJSON(object.assetType) : -1 + }; }, toJSON(message: SuperfluidAsset): JsonSafe<SuperfluidAsset> { const obj: any = {}; @@ -293,13 +321,13 @@ function createBaseSuperfluidIntermediaryAccount(): SuperfluidIntermediaryAccoun export const SuperfluidIntermediaryAccount = { typeUrl: "/osmosis.superfluid.SuperfluidIntermediaryAccount", encode(message: SuperfluidIntermediaryAccount, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.denom !== undefined) { + if (message.denom !== "") { writer.uint32(10).string(message.denom); } - if (message.valAddr !== undefined) { + if (message.valAddr !== "") { writer.uint32(18).string(message.valAddr); } - if (message.gaugeId !== undefined) { + if (message.gaugeId !== BigInt(0)) { writer.uint32(24).uint64(message.gaugeId); } return writer; @@ -328,11 +356,11 @@ export const SuperfluidIntermediaryAccount = { return message; }, fromJSON(object: any): SuperfluidIntermediaryAccount { - const obj = createBaseSuperfluidIntermediaryAccount(); - if (isSet(object.denom)) obj.denom = String(object.denom); - if (isSet(object.valAddr)) obj.valAddr = String(object.valAddr); - if (isSet(object.gaugeId)) obj.gaugeId = BigInt(object.gaugeId.toString()); - return obj; + return { + denom: isSet(object.denom) ? String(object.denom) : "", + valAddr: isSet(object.valAddr) ? String(object.valAddr) : "", + gaugeId: isSet(object.gaugeId) ? BigInt(object.gaugeId.toString()) : BigInt(0) + }; }, toJSON(message: SuperfluidIntermediaryAccount): JsonSafe<SuperfluidIntermediaryAccount> { const obj: any = {}; @@ -345,9 +373,7 @@ export const SuperfluidIntermediaryAccount = { const message = createBaseSuperfluidIntermediaryAccount(); message.denom = object.denom ?? ""; message.valAddr = object.valAddr ?? ""; - if (object.gaugeId !== undefined && object.gaugeId !== null) { - message.gaugeId = BigInt(object.gaugeId.toString()); - } + message.gaugeId = object.gaugeId !== undefined && object.gaugeId !== null ? BigInt(object.gaugeId.toString()) : BigInt(0); return message; }, fromSDK(object: SuperfluidIntermediaryAccountSDKType): SuperfluidIntermediaryAccount { @@ -423,13 +449,13 @@ function createBaseOsmoEquivalentMultiplierRecord(): OsmoEquivalentMultiplierRec export const OsmoEquivalentMultiplierRecord = { typeUrl: "/osmosis.superfluid.OsmoEquivalentMultiplierRecord", encode(message: OsmoEquivalentMultiplierRecord, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.epochNumber !== undefined) { + if (message.epochNumber !== BigInt(0)) { writer.uint32(8).int64(message.epochNumber); } - if (message.denom !== undefined) { + if (message.denom !== "") { writer.uint32(18).string(message.denom); } - if (message.multiplier !== undefined) { + if (message.multiplier !== "") { writer.uint32(26).string(Decimal.fromUserInput(message.multiplier, 18).atomics); } return writer; @@ -458,11 +484,11 @@ export const OsmoEquivalentMultiplierRecord = { return message; }, fromJSON(object: any): OsmoEquivalentMultiplierRecord { - const obj = createBaseOsmoEquivalentMultiplierRecord(); - if (isSet(object.epochNumber)) obj.epochNumber = BigInt(object.epochNumber.toString()); - if (isSet(object.denom)) obj.denom = String(object.denom); - if (isSet(object.multiplier)) obj.multiplier = String(object.multiplier); - return obj; + return { + epochNumber: isSet(object.epochNumber) ? BigInt(object.epochNumber.toString()) : BigInt(0), + denom: isSet(object.denom) ? String(object.denom) : "", + multiplier: isSet(object.multiplier) ? String(object.multiplier) : "" + }; }, toJSON(message: OsmoEquivalentMultiplierRecord): JsonSafe<OsmoEquivalentMultiplierRecord> { const obj: any = {}; @@ -473,9 +499,7 @@ export const OsmoEquivalentMultiplierRecord = { }, fromPartial(object: DeepPartial<OsmoEquivalentMultiplierRecord>): OsmoEquivalentMultiplierRecord { const message = createBaseOsmoEquivalentMultiplierRecord(); - if (object.epochNumber !== undefined && object.epochNumber !== null) { - message.epochNumber = BigInt(object.epochNumber.toString()); - } + message.epochNumber = object.epochNumber !== undefined && object.epochNumber !== null ? BigInt(object.epochNumber.toString()) : BigInt(0); message.denom = object.denom ?? ""; message.multiplier = object.multiplier ?? ""; return message; @@ -554,10 +578,10 @@ function createBaseSuperfluidDelegationRecord(): SuperfluidDelegationRecord { export const SuperfluidDelegationRecord = { typeUrl: "/osmosis.superfluid.SuperfluidDelegationRecord", encode(message: SuperfluidDelegationRecord, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.delegatorAddress !== undefined) { + if (message.delegatorAddress !== "") { writer.uint32(10).string(message.delegatorAddress); } - if (message.validatorAddress !== undefined) { + if (message.validatorAddress !== "") { writer.uint32(18).string(message.validatorAddress); } if (message.delegationAmount !== undefined) { @@ -595,12 +619,12 @@ export const SuperfluidDelegationRecord = { return message; }, fromJSON(object: any): SuperfluidDelegationRecord { - const obj = createBaseSuperfluidDelegationRecord(); - if (isSet(object.delegatorAddress)) obj.delegatorAddress = String(object.delegatorAddress); - if (isSet(object.validatorAddress)) obj.validatorAddress = String(object.validatorAddress); - if (isSet(object.delegationAmount)) obj.delegationAmount = Coin.fromJSON(object.delegationAmount); - if (isSet(object.equivalentStakedAmount)) obj.equivalentStakedAmount = Coin.fromJSON(object.equivalentStakedAmount); - return obj; + return { + delegatorAddress: isSet(object.delegatorAddress) ? String(object.delegatorAddress) : "", + validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "", + delegationAmount: isSet(object.delegationAmount) ? Coin.fromJSON(object.delegationAmount) : undefined, + equivalentStakedAmount: isSet(object.equivalentStakedAmount) ? Coin.fromJSON(object.equivalentStakedAmount) : undefined + }; }, toJSON(message: SuperfluidDelegationRecord): JsonSafe<SuperfluidDelegationRecord> { const obj: any = {}; @@ -614,12 +638,8 @@ export const SuperfluidDelegationRecord = { const message = createBaseSuperfluidDelegationRecord(); message.delegatorAddress = object.delegatorAddress ?? ""; message.validatorAddress = object.validatorAddress ?? ""; - if (object.delegationAmount !== undefined && object.delegationAmount !== null) { - message.delegationAmount = Coin.fromPartial(object.delegationAmount); - } - if (object.equivalentStakedAmount !== undefined && object.equivalentStakedAmount !== null) { - message.equivalentStakedAmount = Coin.fromPartial(object.equivalentStakedAmount); - } + message.delegationAmount = object.delegationAmount !== undefined && object.delegationAmount !== null ? Coin.fromPartial(object.delegationAmount) : undefined; + message.equivalentStakedAmount = object.equivalentStakedAmount !== undefined && object.equivalentStakedAmount !== null ? Coin.fromPartial(object.equivalentStakedAmount) : undefined; return message; }, fromSDK(object: SuperfluidDelegationRecordSDKType): SuperfluidDelegationRecord { @@ -701,10 +721,10 @@ function createBaseLockIdIntermediaryAccountConnection(): LockIdIntermediaryAcco export const LockIdIntermediaryAccountConnection = { typeUrl: "/osmosis.superfluid.LockIdIntermediaryAccountConnection", encode(message: LockIdIntermediaryAccountConnection, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.lockId !== undefined) { + if (message.lockId !== BigInt(0)) { writer.uint32(8).uint64(message.lockId); } - if (message.intermediaryAccount !== undefined) { + if (message.intermediaryAccount !== "") { writer.uint32(18).string(message.intermediaryAccount); } return writer; @@ -730,10 +750,10 @@ export const LockIdIntermediaryAccountConnection = { return message; }, fromJSON(object: any): LockIdIntermediaryAccountConnection { - const obj = createBaseLockIdIntermediaryAccountConnection(); - if (isSet(object.lockId)) obj.lockId = BigInt(object.lockId.toString()); - if (isSet(object.intermediaryAccount)) obj.intermediaryAccount = String(object.intermediaryAccount); - return obj; + return { + lockId: isSet(object.lockId) ? BigInt(object.lockId.toString()) : BigInt(0), + intermediaryAccount: isSet(object.intermediaryAccount) ? String(object.intermediaryAccount) : "" + }; }, toJSON(message: LockIdIntermediaryAccountConnection): JsonSafe<LockIdIntermediaryAccountConnection> { const obj: any = {}; @@ -743,9 +763,7 @@ export const LockIdIntermediaryAccountConnection = { }, fromPartial(object: DeepPartial<LockIdIntermediaryAccountConnection>): LockIdIntermediaryAccountConnection { const message = createBaseLockIdIntermediaryAccountConnection(); - if (object.lockId !== undefined && object.lockId !== null) { - message.lockId = BigInt(object.lockId.toString()); - } + message.lockId = object.lockId !== undefined && object.lockId !== null ? BigInt(object.lockId.toString()) : BigInt(0); message.intermediaryAccount = object.intermediaryAccount ?? ""; return message; }, @@ -845,9 +863,9 @@ export const UnpoolWhitelistedPools = { return message; }, fromJSON(object: any): UnpoolWhitelistedPools { - const obj = createBaseUnpoolWhitelistedPools(); - if (Array.isArray(object?.ids)) obj.ids = object.ids.map((e: any) => BigInt(e.toString())); - return obj; + return { + ids: Array.isArray(object?.ids) ? object.ids.map((e: any) => BigInt(e.toString())) : [] + }; }, toJSON(message: UnpoolWhitelistedPools): JsonSafe<UnpoolWhitelistedPools> { const obj: any = {}; diff --git a/__fixtures__/v-next/outputv4/osmosis/superfluid/tx.amino.ts b/__fixtures__/v-next/outputv4/osmosis/superfluid/tx.amino.ts index 6a27aeb3ae..ab182966bc 100644 --- a/__fixtures__/v-next/outputv4/osmosis/superfluid/tx.amino.ts +++ b/__fixtures__/v-next/outputv4/osmosis/superfluid/tx.amino.ts @@ -1,7 +1,7 @@ //@ts-nocheck -import { Coin, CoinSDKType } from "../../cosmos/base/v1beta1/coin.js"; +import { Coin, CoinSDKType } from "../../cosmos/base/v1beta1/coin"; import { AminoMsg } from "@cosmjs/amino"; -import { MsgSuperfluidDelegate, MsgSuperfluidDelegateSDKType, MsgSuperfluidUndelegate, MsgSuperfluidUndelegateSDKType, MsgSuperfluidUnbondLock, MsgSuperfluidUnbondLockSDKType, MsgLockAndSuperfluidDelegate, MsgLockAndSuperfluidDelegateSDKType, MsgUnPoolWhitelistedPool, MsgUnPoolWhitelistedPoolSDKType } from "./tx.js"; +import { MsgSuperfluidDelegate, MsgSuperfluidDelegateSDKType, MsgSuperfluidUndelegate, MsgSuperfluidUndelegateSDKType, MsgSuperfluidUnbondLock, MsgSuperfluidUnbondLockSDKType, MsgLockAndSuperfluidDelegate, MsgLockAndSuperfluidDelegateSDKType, MsgUnPoolWhitelistedPool, MsgUnPoolWhitelistedPoolSDKType } from "./tx"; export interface MsgSuperfluidDelegateAminoType extends AminoMsg { type: "osmosis/superfluid-delegate"; value: { diff --git a/__fixtures__/v-next/outputv4/osmosis/superfluid/tx.registry.ts b/__fixtures__/v-next/outputv4/osmosis/superfluid/tx.registry.ts index 739cd238c8..deed96f927 100644 --- a/__fixtures__/v-next/outputv4/osmosis/superfluid/tx.registry.ts +++ b/__fixtures__/v-next/outputv4/osmosis/superfluid/tx.registry.ts @@ -1,6 +1,6 @@ -import { Coin, CoinSDKType } from "../../cosmos/base/v1beta1/coin.js"; +import { Coin, CoinSDKType } from "../../cosmos/base/v1beta1/coin"; import { GeneratedType, Registry } from "@cosmjs/proto-signing"; -import { MsgSuperfluidDelegate, MsgSuperfluidDelegateSDKType, MsgSuperfluidUndelegate, MsgSuperfluidUndelegateSDKType, MsgSuperfluidUnbondLock, MsgSuperfluidUnbondLockSDKType, MsgLockAndSuperfluidDelegate, MsgLockAndSuperfluidDelegateSDKType, MsgUnPoolWhitelistedPool, MsgUnPoolWhitelistedPoolSDKType } from "./tx.js"; +import { MsgSuperfluidDelegate, MsgSuperfluidDelegateSDKType, MsgSuperfluidUndelegate, MsgSuperfluidUndelegateSDKType, MsgSuperfluidUnbondLock, MsgSuperfluidUnbondLockSDKType, MsgLockAndSuperfluidDelegate, MsgLockAndSuperfluidDelegateSDKType, MsgUnPoolWhitelistedPool, MsgUnPoolWhitelistedPoolSDKType } from "./tx"; export const registry: ReadonlyArray<[string, GeneratedType]> = [["/osmosis.superfluid.MsgSuperfluidDelegate", MsgSuperfluidDelegate], ["/osmosis.superfluid.MsgSuperfluidUndelegate", MsgSuperfluidUndelegate], ["/osmosis.superfluid.MsgSuperfluidUnbondLock", MsgSuperfluidUnbondLock], ["/osmosis.superfluid.MsgLockAndSuperfluidDelegate", MsgLockAndSuperfluidDelegate], ["/osmosis.superfluid.MsgUnPoolWhitelistedPool", MsgUnPoolWhitelistedPool]]; export const load = (protoRegistry: Registry) => { registry.forEach(([typeUrl, mod]) => { diff --git a/__fixtures__/v-next/outputv4/osmosis/superfluid/tx.rpc.msg.ts b/__fixtures__/v-next/outputv4/osmosis/superfluid/tx.rpc.msg.ts index 02a468af53..baea77de88 100644 --- a/__fixtures__/v-next/outputv4/osmosis/superfluid/tx.rpc.msg.ts +++ b/__fixtures__/v-next/outputv4/osmosis/superfluid/tx.rpc.msg.ts @@ -1,7 +1,7 @@ -import { Coin, CoinSDKType } from "../../cosmos/base/v1beta1/coin.js"; -import { Rpc } from "../../helpers.js"; -import { BinaryReader } from "../../binary.js"; -import { MsgSuperfluidDelegate, MsgSuperfluidDelegateSDKType, MsgSuperfluidDelegateResponse, MsgSuperfluidDelegateResponseSDKType, MsgSuperfluidUndelegate, MsgSuperfluidUndelegateSDKType, MsgSuperfluidUndelegateResponse, MsgSuperfluidUndelegateResponseSDKType, MsgSuperfluidUnbondLock, MsgSuperfluidUnbondLockSDKType, MsgSuperfluidUnbondLockResponse, MsgSuperfluidUnbondLockResponseSDKType, MsgLockAndSuperfluidDelegate, MsgLockAndSuperfluidDelegateSDKType, MsgLockAndSuperfluidDelegateResponse, MsgLockAndSuperfluidDelegateResponseSDKType, MsgUnPoolWhitelistedPool, MsgUnPoolWhitelistedPoolSDKType, MsgUnPoolWhitelistedPoolResponse, MsgUnPoolWhitelistedPoolResponseSDKType } from "./tx.js"; +import { Coin, CoinSDKType } from "../../cosmos/base/v1beta1/coin"; +import { Rpc } from "../../helpers"; +import { BinaryReader } from "../../binary"; +import { MsgSuperfluidDelegate, MsgSuperfluidDelegateSDKType, MsgSuperfluidDelegateResponse, MsgSuperfluidDelegateResponseSDKType, MsgSuperfluidUndelegate, MsgSuperfluidUndelegateSDKType, MsgSuperfluidUndelegateResponse, MsgSuperfluidUndelegateResponseSDKType, MsgSuperfluidUnbondLock, MsgSuperfluidUnbondLockSDKType, MsgSuperfluidUnbondLockResponse, MsgSuperfluidUnbondLockResponseSDKType, MsgLockAndSuperfluidDelegate, MsgLockAndSuperfluidDelegateSDKType, MsgLockAndSuperfluidDelegateResponse, MsgLockAndSuperfluidDelegateResponseSDKType, MsgUnPoolWhitelistedPool, MsgUnPoolWhitelistedPoolSDKType, MsgUnPoolWhitelistedPoolResponse, MsgUnPoolWhitelistedPoolResponseSDKType } from "./tx"; /** Msg defines the Msg service. */ export interface Msg { /** Execute superfluid delegation for a lockup */ diff --git a/__fixtures__/v-next/outputv4/osmosis/superfluid/tx.ts b/__fixtures__/v-next/outputv4/osmosis/superfluid/tx.ts index 3dead2039c..beb1ba799c 100644 --- a/__fixtures__/v-next/outputv4/osmosis/superfluid/tx.ts +++ b/__fixtures__/v-next/outputv4/osmosis/superfluid/tx.ts @@ -1,13 +1,19 @@ -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"; +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"; export const protobufPackage = "osmosis.superfluid"; export interface MsgSuperfluidDelegate { sender: string; lockId: bigint; valAddr: string; } +export interface ReactiveMsgSuperfluidDelegate { + sender: ComputedRef<string>; + lockId: ComputedRef<bigint>; + valAddr: ComputedRef<string>; +} export interface MsgSuperfluidDelegateProtoMsg { typeUrl: "/osmosis.superfluid.MsgSuperfluidDelegate"; value: Uint8Array; @@ -18,6 +24,7 @@ export interface MsgSuperfluidDelegateSDKType { val_addr: string; } export interface MsgSuperfluidDelegateResponse {} +export interface ReactiveMsgSuperfluidDelegateResponse {} export interface MsgSuperfluidDelegateResponseProtoMsg { typeUrl: "/osmosis.superfluid.MsgSuperfluidDelegateResponse"; value: Uint8Array; @@ -27,6 +34,10 @@ export interface MsgSuperfluidUndelegate { sender: string; lockId: bigint; } +export interface ReactiveMsgSuperfluidUndelegate { + sender: ComputedRef<string>; + lockId: ComputedRef<bigint>; +} export interface MsgSuperfluidUndelegateProtoMsg { typeUrl: "/osmosis.superfluid.MsgSuperfluidUndelegate"; value: Uint8Array; @@ -36,6 +47,7 @@ export interface MsgSuperfluidUndelegateSDKType { lock_id: bigint; } export interface MsgSuperfluidUndelegateResponse {} +export interface ReactiveMsgSuperfluidUndelegateResponse {} export interface MsgSuperfluidUndelegateResponseProtoMsg { typeUrl: "/osmosis.superfluid.MsgSuperfluidUndelegateResponse"; value: Uint8Array; @@ -45,6 +57,10 @@ export interface MsgSuperfluidUnbondLock { sender: string; lockId: bigint; } +export interface ReactiveMsgSuperfluidUnbondLock { + sender: ComputedRef<string>; + lockId: ComputedRef<bigint>; +} export interface MsgSuperfluidUnbondLockProtoMsg { typeUrl: "/osmosis.superfluid.MsgSuperfluidUnbondLock"; value: Uint8Array; @@ -54,6 +70,7 @@ export interface MsgSuperfluidUnbondLockSDKType { lock_id: bigint; } export interface MsgSuperfluidUnbondLockResponse {} +export interface ReactiveMsgSuperfluidUnbondLockResponse {} export interface MsgSuperfluidUnbondLockResponseProtoMsg { typeUrl: "/osmosis.superfluid.MsgSuperfluidUnbondLockResponse"; value: Uint8Array; @@ -69,6 +86,11 @@ export interface MsgLockAndSuperfluidDelegate { coins: Coin[]; valAddr: string; } +export interface ReactiveMsgLockAndSuperfluidDelegate { + sender: ComputedRef<string>; + coins: ComputedRef<Coin[]>; + valAddr: ComputedRef<string>; +} export interface MsgLockAndSuperfluidDelegateProtoMsg { typeUrl: "/osmosis.superfluid.MsgLockAndSuperfluidDelegate"; value: Uint8Array; @@ -86,6 +108,9 @@ export interface MsgLockAndSuperfluidDelegateSDKType { export interface MsgLockAndSuperfluidDelegateResponse { iD: bigint; } +export interface ReactiveMsgLockAndSuperfluidDelegateResponse { + iD: ComputedRef<bigint>; +} export interface MsgLockAndSuperfluidDelegateResponseProtoMsg { typeUrl: "/osmosis.superfluid.MsgLockAndSuperfluidDelegateResponse"; value: Uint8Array; @@ -107,6 +132,10 @@ export interface MsgUnPoolWhitelistedPool { sender: string; poolId: bigint; } +export interface ReactiveMsgUnPoolWhitelistedPool { + sender: ComputedRef<string>; + poolId: ComputedRef<bigint>; +} export interface MsgUnPoolWhitelistedPoolProtoMsg { typeUrl: "/osmosis.superfluid.MsgUnPoolWhitelistedPool"; value: Uint8Array; @@ -128,6 +157,9 @@ export interface MsgUnPoolWhitelistedPoolSDKType { export interface MsgUnPoolWhitelistedPoolResponse { exitedLockIds: bigint[]; } +export interface ReactiveMsgUnPoolWhitelistedPoolResponse { + exitedLockIds: ComputedRef<bigint[]>; +} export interface MsgUnPoolWhitelistedPoolResponseProtoMsg { typeUrl: "/osmosis.superfluid.MsgUnPoolWhitelistedPoolResponse"; value: Uint8Array; @@ -145,13 +177,13 @@ function createBaseMsgSuperfluidDelegate(): MsgSuperfluidDelegate { export const MsgSuperfluidDelegate = { typeUrl: "/osmosis.superfluid.MsgSuperfluidDelegate", encode(message: MsgSuperfluidDelegate, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.sender !== undefined) { + if (message.sender !== "") { writer.uint32(10).string(message.sender); } - if (message.lockId !== undefined) { + if (message.lockId !== BigInt(0)) { writer.uint32(16).uint64(message.lockId); } - if (message.valAddr !== undefined) { + if (message.valAddr !== "") { writer.uint32(26).string(message.valAddr); } return writer; @@ -180,11 +212,11 @@ export const MsgSuperfluidDelegate = { return message; }, fromJSON(object: any): MsgSuperfluidDelegate { - const obj = createBaseMsgSuperfluidDelegate(); - if (isSet(object.sender)) obj.sender = String(object.sender); - if (isSet(object.lockId)) obj.lockId = BigInt(object.lockId.toString()); - if (isSet(object.valAddr)) obj.valAddr = String(object.valAddr); - return obj; + return { + sender: isSet(object.sender) ? String(object.sender) : "", + lockId: isSet(object.lockId) ? BigInt(object.lockId.toString()) : BigInt(0), + valAddr: isSet(object.valAddr) ? String(object.valAddr) : "" + }; }, toJSON(message: MsgSuperfluidDelegate): JsonSafe<MsgSuperfluidDelegate> { const obj: any = {}; @@ -196,9 +228,7 @@ export const MsgSuperfluidDelegate = { fromPartial(object: DeepPartial<MsgSuperfluidDelegate>): MsgSuperfluidDelegate { const message = createBaseMsgSuperfluidDelegate(); message.sender = object.sender ?? ""; - if (object.lockId !== undefined && object.lockId !== null) { - message.lockId = BigInt(object.lockId.toString()); - } + message.lockId = object.lockId !== undefined && object.lockId !== null ? BigInt(object.lockId.toString()) : BigInt(0); message.valAddr = object.valAddr ?? ""; return message; }, @@ -288,8 +318,7 @@ export const MsgSuperfluidDelegateResponse = { return message; }, fromJSON(_: any): MsgSuperfluidDelegateResponse { - const obj = createBaseMsgSuperfluidDelegateResponse(); - return obj; + return {}; }, toJSON(_: MsgSuperfluidDelegateResponse): JsonSafe<MsgSuperfluidDelegateResponse> { const obj: any = {}; @@ -348,10 +377,10 @@ function createBaseMsgSuperfluidUndelegate(): MsgSuperfluidUndelegate { export const MsgSuperfluidUndelegate = { typeUrl: "/osmosis.superfluid.MsgSuperfluidUndelegate", encode(message: MsgSuperfluidUndelegate, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.sender !== undefined) { + if (message.sender !== "") { writer.uint32(10).string(message.sender); } - if (message.lockId !== undefined) { + if (message.lockId !== BigInt(0)) { writer.uint32(16).uint64(message.lockId); } return writer; @@ -377,10 +406,10 @@ export const MsgSuperfluidUndelegate = { return message; }, fromJSON(object: any): MsgSuperfluidUndelegate { - const obj = createBaseMsgSuperfluidUndelegate(); - if (isSet(object.sender)) obj.sender = String(object.sender); - if (isSet(object.lockId)) obj.lockId = BigInt(object.lockId.toString()); - return obj; + return { + sender: isSet(object.sender) ? String(object.sender) : "", + lockId: isSet(object.lockId) ? BigInt(object.lockId.toString()) : BigInt(0) + }; }, toJSON(message: MsgSuperfluidUndelegate): JsonSafe<MsgSuperfluidUndelegate> { const obj: any = {}; @@ -391,9 +420,7 @@ export const MsgSuperfluidUndelegate = { fromPartial(object: DeepPartial<MsgSuperfluidUndelegate>): MsgSuperfluidUndelegate { const message = createBaseMsgSuperfluidUndelegate(); message.sender = object.sender ?? ""; - if (object.lockId !== undefined && object.lockId !== null) { - message.lockId = BigInt(object.lockId.toString()); - } + message.lockId = object.lockId !== undefined && object.lockId !== null ? BigInt(object.lockId.toString()) : BigInt(0); return message; }, fromSDK(object: MsgSuperfluidUndelegateSDKType): MsgSuperfluidUndelegate { @@ -475,8 +502,7 @@ export const MsgSuperfluidUndelegateResponse = { return message; }, fromJSON(_: any): MsgSuperfluidUndelegateResponse { - const obj = createBaseMsgSuperfluidUndelegateResponse(); - return obj; + return {}; }, toJSON(_: MsgSuperfluidUndelegateResponse): JsonSafe<MsgSuperfluidUndelegateResponse> { const obj: any = {}; @@ -535,10 +561,10 @@ function createBaseMsgSuperfluidUnbondLock(): MsgSuperfluidUnbondLock { export const MsgSuperfluidUnbondLock = { typeUrl: "/osmosis.superfluid.MsgSuperfluidUnbondLock", encode(message: MsgSuperfluidUnbondLock, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.sender !== undefined) { + if (message.sender !== "") { writer.uint32(10).string(message.sender); } - if (message.lockId !== undefined) { + if (message.lockId !== BigInt(0)) { writer.uint32(16).uint64(message.lockId); } return writer; @@ -564,10 +590,10 @@ export const MsgSuperfluidUnbondLock = { return message; }, fromJSON(object: any): MsgSuperfluidUnbondLock { - const obj = createBaseMsgSuperfluidUnbondLock(); - if (isSet(object.sender)) obj.sender = String(object.sender); - if (isSet(object.lockId)) obj.lockId = BigInt(object.lockId.toString()); - return obj; + return { + sender: isSet(object.sender) ? String(object.sender) : "", + lockId: isSet(object.lockId) ? BigInt(object.lockId.toString()) : BigInt(0) + }; }, toJSON(message: MsgSuperfluidUnbondLock): JsonSafe<MsgSuperfluidUnbondLock> { const obj: any = {}; @@ -578,9 +604,7 @@ export const MsgSuperfluidUnbondLock = { fromPartial(object: DeepPartial<MsgSuperfluidUnbondLock>): MsgSuperfluidUnbondLock { const message = createBaseMsgSuperfluidUnbondLock(); message.sender = object.sender ?? ""; - if (object.lockId !== undefined && object.lockId !== null) { - message.lockId = BigInt(object.lockId.toString()); - } + message.lockId = object.lockId !== undefined && object.lockId !== null ? BigInt(object.lockId.toString()) : BigInt(0); return message; }, fromSDK(object: MsgSuperfluidUnbondLockSDKType): MsgSuperfluidUnbondLock { @@ -662,8 +686,7 @@ export const MsgSuperfluidUnbondLockResponse = { return message; }, fromJSON(_: any): MsgSuperfluidUnbondLockResponse { - const obj = createBaseMsgSuperfluidUnbondLockResponse(); - return obj; + return {}; }, toJSON(_: MsgSuperfluidUnbondLockResponse): JsonSafe<MsgSuperfluidUnbondLockResponse> { const obj: any = {}; @@ -723,13 +746,13 @@ function createBaseMsgLockAndSuperfluidDelegate(): MsgLockAndSuperfluidDelegate export const MsgLockAndSuperfluidDelegate = { typeUrl: "/osmosis.superfluid.MsgLockAndSuperfluidDelegate", encode(message: MsgLockAndSuperfluidDelegate, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.sender !== undefined) { + if (message.sender !== "") { writer.uint32(10).string(message.sender); } for (const v of message.coins) { Coin.encode(v!, writer.uint32(18).fork()).ldelim(); } - if (message.valAddr !== undefined) { + if (message.valAddr !== "") { writer.uint32(26).string(message.valAddr); } return writer; @@ -758,11 +781,11 @@ export const MsgLockAndSuperfluidDelegate = { return message; }, fromJSON(object: any): MsgLockAndSuperfluidDelegate { - const obj = createBaseMsgLockAndSuperfluidDelegate(); - if (isSet(object.sender)) obj.sender = String(object.sender); - if (Array.isArray(object?.coins)) obj.coins = object.coins.map((e: any) => Coin.fromJSON(e)); - if (isSet(object.valAddr)) obj.valAddr = String(object.valAddr); - return obj; + return { + sender: isSet(object.sender) ? String(object.sender) : "", + coins: Array.isArray(object?.coins) ? object.coins.map((e: any) => Coin.fromJSON(e)) : [], + valAddr: isSet(object.valAddr) ? String(object.valAddr) : "" + }; }, toJSON(message: MsgLockAndSuperfluidDelegate): JsonSafe<MsgLockAndSuperfluidDelegate> { const obj: any = {}; @@ -859,7 +882,7 @@ function createBaseMsgLockAndSuperfluidDelegateResponse(): MsgLockAndSuperfluidD export const MsgLockAndSuperfluidDelegateResponse = { typeUrl: "/osmosis.superfluid.MsgLockAndSuperfluidDelegateResponse", encode(message: MsgLockAndSuperfluidDelegateResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.iD !== undefined) { + if (message.iD !== BigInt(0)) { writer.uint32(8).uint64(message.iD); } return writer; @@ -882,9 +905,9 @@ export const MsgLockAndSuperfluidDelegateResponse = { return message; }, fromJSON(object: any): MsgLockAndSuperfluidDelegateResponse { - const obj = createBaseMsgLockAndSuperfluidDelegateResponse(); - if (isSet(object.iD)) obj.iD = BigInt(object.iD.toString()); - return obj; + return { + iD: isSet(object.iD) ? BigInt(object.iD.toString()) : BigInt(0) + }; }, toJSON(message: MsgLockAndSuperfluidDelegateResponse): JsonSafe<MsgLockAndSuperfluidDelegateResponse> { const obj: any = {}; @@ -893,9 +916,7 @@ export const MsgLockAndSuperfluidDelegateResponse = { }, fromPartial(object: DeepPartial<MsgLockAndSuperfluidDelegateResponse>): MsgLockAndSuperfluidDelegateResponse { const message = createBaseMsgLockAndSuperfluidDelegateResponse(); - if (object.iD !== undefined && object.iD !== null) { - message.iD = BigInt(object.iD.toString()); - } + message.iD = object.iD !== undefined && object.iD !== null ? BigInt(object.iD.toString()) : BigInt(0); return message; }, fromSDK(object: MsgLockAndSuperfluidDelegateResponseSDKType): MsgLockAndSuperfluidDelegateResponse { @@ -956,10 +977,10 @@ function createBaseMsgUnPoolWhitelistedPool(): MsgUnPoolWhitelistedPool { export const MsgUnPoolWhitelistedPool = { typeUrl: "/osmosis.superfluid.MsgUnPoolWhitelistedPool", encode(message: MsgUnPoolWhitelistedPool, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.sender !== undefined) { + if (message.sender !== "") { writer.uint32(10).string(message.sender); } - if (message.poolId !== undefined) { + if (message.poolId !== BigInt(0)) { writer.uint32(16).uint64(message.poolId); } return writer; @@ -985,10 +1006,10 @@ export const MsgUnPoolWhitelistedPool = { return message; }, fromJSON(object: any): MsgUnPoolWhitelistedPool { - const obj = createBaseMsgUnPoolWhitelistedPool(); - if (isSet(object.sender)) obj.sender = String(object.sender); - if (isSet(object.poolId)) obj.poolId = BigInt(object.poolId.toString()); - return obj; + return { + sender: isSet(object.sender) ? String(object.sender) : "", + poolId: isSet(object.poolId) ? BigInt(object.poolId.toString()) : BigInt(0) + }; }, toJSON(message: MsgUnPoolWhitelistedPool): JsonSafe<MsgUnPoolWhitelistedPool> { const obj: any = {}; @@ -999,9 +1020,7 @@ export const MsgUnPoolWhitelistedPool = { fromPartial(object: DeepPartial<MsgUnPoolWhitelistedPool>): MsgUnPoolWhitelistedPool { const message = createBaseMsgUnPoolWhitelistedPool(); message.sender = object.sender ?? ""; - if (object.poolId !== undefined && object.poolId !== null) { - message.poolId = BigInt(object.poolId.toString()); - } + message.poolId = object.poolId !== undefined && object.poolId !== null ? BigInt(object.poolId.toString()) : BigInt(0); return message; }, fromSDK(object: MsgUnPoolWhitelistedPoolSDKType): MsgUnPoolWhitelistedPool { @@ -1100,9 +1119,9 @@ export const MsgUnPoolWhitelistedPoolResponse = { return message; }, fromJSON(object: any): MsgUnPoolWhitelistedPoolResponse { - const obj = createBaseMsgUnPoolWhitelistedPoolResponse(); - if (Array.isArray(object?.exitedLockIds)) obj.exitedLockIds = object.exitedLockIds.map((e: any) => BigInt(e.toString())); - return obj; + return { + exitedLockIds: Array.isArray(object?.exitedLockIds) ? object.exitedLockIds.map((e: any) => BigInt(e.toString())) : [] + }; }, toJSON(message: MsgUnPoolWhitelistedPoolResponse): JsonSafe<MsgUnPoolWhitelistedPoolResponse> { const obj: any = {}; diff --git a/__fixtures__/v-next/outputv4/osmosis/superfluid/v1beta1/gov.ts b/__fixtures__/v-next/outputv4/osmosis/superfluid/v1beta1/gov.ts index ff931cdc2a..54da8f9dc2 100644 --- a/__fixtures__/v-next/outputv4/osmosis/superfluid/v1beta1/gov.ts +++ b/__fixtures__/v-next/outputv4/osmosis/superfluid/v1beta1/gov.ts @@ -1,7 +1,8 @@ -import { SuperfluidAsset, SuperfluidAssetSDKType } from "../superfluid.js"; -import { BinaryReader, BinaryWriter } from "../../../binary.js"; -import { isSet, DeepPartial } from "../../../helpers.js"; -import { JsonSafe } from "../../../json-safe.js"; +import { SuperfluidAsset, SuperfluidAssetSDKType } from "../superfluid"; +import { BinaryReader, BinaryWriter } from "../../../binary"; +import { isSet, DeepPartial } from "../../../helpers"; +import { JsonSafe } from "../../../json-safe"; +import { ComputedRef } from "vue"; export const protobufPackage = "osmosis.superfluid.v1beta1"; /** * SetSuperfluidAssetsProposal is a gov Content type to update the superfluid @@ -12,6 +13,11 @@ export interface SetSuperfluidAssetsProposal { description: string; assets: SuperfluidAsset[]; } +export interface ReactiveSetSuperfluidAssetsProposal { + title: ComputedRef<string>; + description: ComputedRef<string>; + assets: ComputedRef<SuperfluidAsset[]>; +} export interface SetSuperfluidAssetsProposalProtoMsg { typeUrl: "/osmosis.superfluid.v1beta1.SetSuperfluidAssetsProposal"; value: Uint8Array; @@ -34,6 +40,11 @@ export interface RemoveSuperfluidAssetsProposal { description: string; superfluidAssetDenoms: string[]; } +export interface ReactiveRemoveSuperfluidAssetsProposal { + title: ComputedRef<string>; + description: ComputedRef<string>; + superfluidAssetDenoms: ComputedRef<string[]>; +} export interface RemoveSuperfluidAssetsProposalProtoMsg { typeUrl: "/osmosis.superfluid.v1beta1.RemoveSuperfluidAssetsProposal"; value: Uint8Array; @@ -57,6 +68,12 @@ export interface UpdateUnpoolWhiteListProposal { ids: bigint[]; isOverwrite: boolean; } +export interface ReactiveUpdateUnpoolWhiteListProposal { + title: ComputedRef<string>; + description: ComputedRef<string>; + ids: ComputedRef<bigint[]>; + isOverwrite: ComputedRef<boolean>; +} export interface UpdateUnpoolWhiteListProposalProtoMsg { typeUrl: "/osmosis.superfluid.v1beta1.UpdateUnpoolWhiteListProposal"; value: Uint8Array; @@ -81,10 +98,10 @@ function createBaseSetSuperfluidAssetsProposal(): SetSuperfluidAssetsProposal { export const SetSuperfluidAssetsProposal = { typeUrl: "/osmosis.superfluid.v1beta1.SetSuperfluidAssetsProposal", encode(message: SetSuperfluidAssetsProposal, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.title !== undefined) { + if (message.title !== "") { writer.uint32(10).string(message.title); } - if (message.description !== undefined) { + if (message.description !== "") { writer.uint32(18).string(message.description); } for (const v of message.assets) { @@ -116,11 +133,11 @@ export const SetSuperfluidAssetsProposal = { return message; }, fromJSON(object: any): SetSuperfluidAssetsProposal { - const obj = createBaseSetSuperfluidAssetsProposal(); - if (isSet(object.title)) obj.title = String(object.title); - if (isSet(object.description)) obj.description = String(object.description); - if (Array.isArray(object?.assets)) obj.assets = object.assets.map((e: any) => SuperfluidAsset.fromJSON(e)); - return obj; + return { + title: isSet(object.title) ? String(object.title) : "", + description: isSet(object.description) ? String(object.description) : "", + assets: Array.isArray(object?.assets) ? object.assets.map((e: any) => SuperfluidAsset.fromJSON(e)) : [] + }; }, toJSON(message: SetSuperfluidAssetsProposal): JsonSafe<SetSuperfluidAssetsProposal> { const obj: any = {}; @@ -219,10 +236,10 @@ function createBaseRemoveSuperfluidAssetsProposal(): RemoveSuperfluidAssetsPropo export const RemoveSuperfluidAssetsProposal = { typeUrl: "/osmosis.superfluid.v1beta1.RemoveSuperfluidAssetsProposal", encode(message: RemoveSuperfluidAssetsProposal, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.title !== undefined) { + if (message.title !== "") { writer.uint32(10).string(message.title); } - if (message.description !== undefined) { + if (message.description !== "") { writer.uint32(18).string(message.description); } for (const v of message.superfluidAssetDenoms) { @@ -254,11 +271,11 @@ export const RemoveSuperfluidAssetsProposal = { return message; }, fromJSON(object: any): RemoveSuperfluidAssetsProposal { - const obj = createBaseRemoveSuperfluidAssetsProposal(); - if (isSet(object.title)) obj.title = String(object.title); - if (isSet(object.description)) obj.description = String(object.description); - if (Array.isArray(object?.superfluidAssetDenoms)) obj.superfluidAssetDenoms = object.superfluidAssetDenoms.map((e: any) => String(e)); - return obj; + return { + title: isSet(object.title) ? String(object.title) : "", + description: isSet(object.description) ? String(object.description) : "", + superfluidAssetDenoms: Array.isArray(object?.superfluidAssetDenoms) ? object.superfluidAssetDenoms.map((e: any) => String(e)) : [] + }; }, toJSON(message: RemoveSuperfluidAssetsProposal): JsonSafe<RemoveSuperfluidAssetsProposal> { const obj: any = {}; @@ -358,10 +375,10 @@ function createBaseUpdateUnpoolWhiteListProposal(): UpdateUnpoolWhiteListProposa export const UpdateUnpoolWhiteListProposal = { typeUrl: "/osmosis.superfluid.v1beta1.UpdateUnpoolWhiteListProposal", encode(message: UpdateUnpoolWhiteListProposal, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.title !== undefined) { + if (message.title !== "") { writer.uint32(10).string(message.title); } - if (message.description !== undefined) { + if (message.description !== "") { writer.uint32(18).string(message.description); } writer.uint32(26).fork(); @@ -369,7 +386,7 @@ export const UpdateUnpoolWhiteListProposal = { writer.uint64(v); } writer.ldelim(); - if (message.isOverwrite !== undefined) { + if (message.isOverwrite === true) { writer.uint32(32).bool(message.isOverwrite); } return writer; @@ -408,12 +425,12 @@ export const UpdateUnpoolWhiteListProposal = { return message; }, fromJSON(object: any): UpdateUnpoolWhiteListProposal { - const obj = createBaseUpdateUnpoolWhiteListProposal(); - if (isSet(object.title)) obj.title = String(object.title); - if (isSet(object.description)) obj.description = String(object.description); - if (Array.isArray(object?.ids)) obj.ids = object.ids.map((e: any) => BigInt(e.toString())); - if (isSet(object.isOverwrite)) obj.isOverwrite = Boolean(object.isOverwrite); - return obj; + return { + title: isSet(object.title) ? String(object.title) : "", + description: isSet(object.description) ? String(object.description) : "", + ids: Array.isArray(object?.ids) ? object.ids.map((e: any) => BigInt(e.toString())) : [], + isOverwrite: isSet(object.isOverwrite) ? Boolean(object.isOverwrite) : false + }; }, toJSON(message: UpdateUnpoolWhiteListProposal): JsonSafe<UpdateUnpoolWhiteListProposal> { const obj: any = {}; diff --git a/__fixtures__/v-next/outputv4/osmosis/tokenfactory/v1beta1/authorityMetadata.ts b/__fixtures__/v-next/outputv4/osmosis/tokenfactory/v1beta1/authorityMetadata.ts index c5c78020d5..ad7a5044a3 100644 --- a/__fixtures__/v-next/outputv4/osmosis/tokenfactory/v1beta1/authorityMetadata.ts +++ b/__fixtures__/v-next/outputv4/osmosis/tokenfactory/v1beta1/authorityMetadata.ts @@ -1,6 +1,7 @@ -import { BinaryReader, BinaryWriter } from "../../../binary.js"; -import { isSet, DeepPartial } from "../../../helpers.js"; -import { JsonSafe } from "../../../json-safe.js"; +import { BinaryReader, BinaryWriter } from "../../../binary"; +import { isSet, DeepPartial } from "../../../helpers"; +import { JsonSafe } from "../../../json-safe"; +import { ComputedRef } from "vue"; export const protobufPackage = "osmosis.tokenfactory.v1beta1"; /** * DenomAuthorityMetadata specifies metadata for addresses that have specific @@ -11,6 +12,9 @@ export interface DenomAuthorityMetadata { /** Can be empty for no admin, or a valid osmosis address */ admin: string; } +export interface ReactiveDenomAuthorityMetadata { + admin: ComputedRef<string>; +} export interface DenomAuthorityMetadataProtoMsg { typeUrl: "/osmosis.tokenfactory.v1beta1.DenomAuthorityMetadata"; value: Uint8Array; @@ -31,7 +35,7 @@ function createBaseDenomAuthorityMetadata(): DenomAuthorityMetadata { export const DenomAuthorityMetadata = { typeUrl: "/osmosis.tokenfactory.v1beta1.DenomAuthorityMetadata", encode(message: DenomAuthorityMetadata, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.admin !== undefined) { + if (message.admin !== "") { writer.uint32(10).string(message.admin); } return writer; @@ -54,9 +58,9 @@ export const DenomAuthorityMetadata = { return message; }, fromJSON(object: any): DenomAuthorityMetadata { - const obj = createBaseDenomAuthorityMetadata(); - if (isSet(object.admin)) obj.admin = String(object.admin); - return obj; + return { + admin: isSet(object.admin) ? String(object.admin) : "" + }; }, toJSON(message: DenomAuthorityMetadata): JsonSafe<DenomAuthorityMetadata> { const obj: any = {}; diff --git a/__fixtures__/v-next/outputv4/osmosis/tokenfactory/v1beta1/genesis.ts b/__fixtures__/v-next/outputv4/osmosis/tokenfactory/v1beta1/genesis.ts index 0136c35140..c31c22827c 100644 --- a/__fixtures__/v-next/outputv4/osmosis/tokenfactory/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputv4/osmosis/tokenfactory/v1beta1/genesis.ts @@ -1,8 +1,9 @@ -import { Params, ParamsSDKType } from "./params.js"; -import { DenomAuthorityMetadata, DenomAuthorityMetadataSDKType } from "./authorityMetadata.js"; -import { BinaryReader, BinaryWriter } from "../../../binary.js"; -import { isSet, DeepPartial } from "../../../helpers.js"; -import { JsonSafe } from "../../../json-safe.js"; +import { Params, ParamsSDKType } from "./params"; +import { DenomAuthorityMetadata, DenomAuthorityMetadataSDKType } from "./authorityMetadata"; +import { BinaryReader, BinaryWriter } from "../../../binary"; +import { isSet, DeepPartial } from "../../../helpers"; +import { JsonSafe } from "../../../json-safe"; +import { ComputedRef } from "vue"; export const protobufPackage = "osmosis.tokenfactory.v1beta1"; /** GenesisState defines the tokenfactory module's genesis state. */ export interface GenesisState { @@ -10,6 +11,10 @@ export interface GenesisState { params: Params; factoryDenoms: GenesisDenom[]; } +export interface ReactiveGenesisState { + params: ComputedRef<Params>; + factoryDenoms: ComputedRef<GenesisDenom[]>; +} export interface GenesisStateProtoMsg { typeUrl: "/osmosis.tokenfactory.v1beta1.GenesisState"; value: Uint8Array; @@ -28,6 +33,10 @@ export interface GenesisDenom { denom: string; authorityMetadata: DenomAuthorityMetadata; } +export interface ReactiveGenesisDenom { + denom: ComputedRef<string>; + authorityMetadata: ComputedRef<DenomAuthorityMetadata>; +} export interface GenesisDenomProtoMsg { typeUrl: "/osmosis.tokenfactory.v1beta1.GenesisDenom"; value: Uint8Array; @@ -79,10 +88,10 @@ export const GenesisState = { return message; }, fromJSON(object: any): GenesisState { - const obj = createBaseGenesisState(); - if (isSet(object.params)) obj.params = Params.fromJSON(object.params); - if (Array.isArray(object?.factoryDenoms)) obj.factoryDenoms = object.factoryDenoms.map((e: any) => GenesisDenom.fromJSON(e)); - return obj; + return { + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + factoryDenoms: Array.isArray(object?.factoryDenoms) ? object.factoryDenoms.map((e: any) => GenesisDenom.fromJSON(e)) : [] + }; }, toJSON(message: GenesisState): JsonSafe<GenesisState> { const obj: any = {}; @@ -96,9 +105,7 @@ export const GenesisState = { }, fromPartial(object: DeepPartial<GenesisState>): GenesisState { const message = createBaseGenesisState(); - if (object.params !== undefined && object.params !== null) { - message.params = Params.fromPartial(object.params); - } + message.params = object.params !== undefined && object.params !== null ? Params.fromPartial(object.params) : undefined; message.factoryDenoms = object.factoryDenoms?.map(e => GenesisDenom.fromPartial(e)) || []; return message; }, @@ -173,7 +180,7 @@ function createBaseGenesisDenom(): GenesisDenom { export const GenesisDenom = { typeUrl: "/osmosis.tokenfactory.v1beta1.GenesisDenom", encode(message: GenesisDenom, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.denom !== undefined) { + if (message.denom !== "") { writer.uint32(10).string(message.denom); } if (message.authorityMetadata !== undefined) { @@ -202,10 +209,10 @@ export const GenesisDenom = { return message; }, fromJSON(object: any): GenesisDenom { - const obj = createBaseGenesisDenom(); - if (isSet(object.denom)) obj.denom = String(object.denom); - if (isSet(object.authorityMetadata)) obj.authorityMetadata = DenomAuthorityMetadata.fromJSON(object.authorityMetadata); - return obj; + return { + denom: isSet(object.denom) ? String(object.denom) : "", + authorityMetadata: isSet(object.authorityMetadata) ? DenomAuthorityMetadata.fromJSON(object.authorityMetadata) : undefined + }; }, toJSON(message: GenesisDenom): JsonSafe<GenesisDenom> { const obj: any = {}; @@ -216,9 +223,7 @@ export const GenesisDenom = { fromPartial(object: DeepPartial<GenesisDenom>): GenesisDenom { const message = createBaseGenesisDenom(); message.denom = object.denom ?? ""; - if (object.authorityMetadata !== undefined && object.authorityMetadata !== null) { - message.authorityMetadata = DenomAuthorityMetadata.fromPartial(object.authorityMetadata); - } + message.authorityMetadata = object.authorityMetadata !== undefined && object.authorityMetadata !== null ? DenomAuthorityMetadata.fromPartial(object.authorityMetadata) : undefined; return message; }, fromSDK(object: GenesisDenomSDKType): GenesisDenom { diff --git a/__fixtures__/v-next/outputv4/osmosis/tokenfactory/v1beta1/params.ts b/__fixtures__/v-next/outputv4/osmosis/tokenfactory/v1beta1/params.ts index 4716c1b841..0fddd3f113 100644 --- a/__fixtures__/v-next/outputv4/osmosis/tokenfactory/v1beta1/params.ts +++ b/__fixtures__/v-next/outputv4/osmosis/tokenfactory/v1beta1/params.ts @@ -1,12 +1,16 @@ -import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin.js"; -import { BinaryReader, BinaryWriter } from "../../../binary.js"; -import { JsonSafe } from "../../../json-safe.js"; -import { DeepPartial } from "../../../helpers.js"; +import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; +import { BinaryReader, BinaryWriter } from "../../../binary"; +import { JsonSafe } from "../../../json-safe"; +import { DeepPartial } from "../../../helpers"; +import { ComputedRef } from "vue"; export const protobufPackage = "osmosis.tokenfactory.v1beta1"; /** Params defines the parameters for the tokenfactory module. */ export interface Params { denomCreationFee: Coin[]; } +export interface ReactiveParams { + denomCreationFee: ComputedRef<Coin[]>; +} export interface ParamsProtoMsg { typeUrl: "/osmosis.tokenfactory.v1beta1.Params"; value: Uint8Array; @@ -46,9 +50,9 @@ export const Params = { return message; }, fromJSON(object: any): Params { - const obj = createBaseParams(); - if (Array.isArray(object?.denomCreationFee)) obj.denomCreationFee = object.denomCreationFee.map((e: any) => Coin.fromJSON(e)); - return obj; + return { + denomCreationFee: Array.isArray(object?.denomCreationFee) ? object.denomCreationFee.map((e: any) => Coin.fromJSON(e)) : [] + }; }, toJSON(message: Params): JsonSafe<Params> { const obj: any = {}; diff --git a/__fixtures__/v-next/outputv4/osmosis/tokenfactory/v1beta1/query.lcd.ts b/__fixtures__/v-next/outputv4/osmosis/tokenfactory/v1beta1/query.lcd.ts index 0121d5358f..2f42b071f7 100644 --- a/__fixtures__/v-next/outputv4/osmosis/tokenfactory/v1beta1/query.lcd.ts +++ b/__fixtures__/v-next/outputv4/osmosis/tokenfactory/v1beta1/query.lcd.ts @@ -1,7 +1,7 @@ -import { Params, ParamsSDKType } from "./params.js"; -import { DenomAuthorityMetadata, DenomAuthorityMetadataSDKType } from "./authorityMetadata.js"; +import { Params, ParamsSDKType } from "./params"; +import { DenomAuthorityMetadata, DenomAuthorityMetadataSDKType } from "./authorityMetadata"; import { LCDClient } from "@cosmology/lcd"; -import { QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType, QueryDenomAuthorityMetadataRequest, QueryDenomAuthorityMetadataRequestSDKType, QueryDenomAuthorityMetadataResponse, QueryDenomAuthorityMetadataResponseSDKType, QueryDenomsFromCreatorRequest, QueryDenomsFromCreatorRequestSDKType, QueryDenomsFromCreatorResponse, QueryDenomsFromCreatorResponseSDKType } from "./query.js"; +import { QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType, QueryDenomAuthorityMetadataRequest, QueryDenomAuthorityMetadataRequestSDKType, QueryDenomAuthorityMetadataResponse, QueryDenomAuthorityMetadataResponseSDKType, QueryDenomsFromCreatorRequest, QueryDenomsFromCreatorRequestSDKType, QueryDenomsFromCreatorResponse, QueryDenomsFromCreatorResponseSDKType } from "./query"; export class LCDQueryClient { req: LCDClient; constructor({ diff --git a/__fixtures__/v-next/outputv4/osmosis/tokenfactory/v1beta1/query.rpc.Query.ts b/__fixtures__/v-next/outputv4/osmosis/tokenfactory/v1beta1/query.rpc.Query.ts index c55d99b45b..c143896ed3 100644 --- a/__fixtures__/v-next/outputv4/osmosis/tokenfactory/v1beta1/query.rpc.Query.ts +++ b/__fixtures__/v-next/outputv4/osmosis/tokenfactory/v1beta1/query.rpc.Query.ts @@ -1,9 +1,9 @@ -import { Params, ParamsSDKType } from "./params.js"; -import { DenomAuthorityMetadata, DenomAuthorityMetadataSDKType } from "./authorityMetadata.js"; -import { Rpc } from "../../../helpers.js"; -import { BinaryReader } from "../../../binary.js"; +import { Params, ParamsSDKType } from "./params"; +import { DenomAuthorityMetadata, DenomAuthorityMetadataSDKType } from "./authorityMetadata"; +import { Rpc } from "../../../helpers"; +import { BinaryReader } from "../../../binary"; import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; -import { QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType, QueryDenomAuthorityMetadataRequest, QueryDenomAuthorityMetadataRequestSDKType, QueryDenomAuthorityMetadataResponse, QueryDenomAuthorityMetadataResponseSDKType, QueryDenomsFromCreatorRequest, QueryDenomsFromCreatorRequestSDKType, QueryDenomsFromCreatorResponse, QueryDenomsFromCreatorResponseSDKType } from "./query.js"; +import { QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType, QueryDenomAuthorityMetadataRequest, QueryDenomAuthorityMetadataRequestSDKType, QueryDenomAuthorityMetadataResponse, QueryDenomAuthorityMetadataResponseSDKType, QueryDenomsFromCreatorRequest, QueryDenomsFromCreatorRequestSDKType, QueryDenomsFromCreatorResponse, QueryDenomsFromCreatorResponseSDKType, ReactiveQueryParamsRequest, ReactiveQueryDenomAuthorityMetadataRequest, ReactiveQueryDenomsFromCreatorRequest } from "./query"; /** Query defines the gRPC querier service. */ export interface Query { /** diff --git a/__fixtures__/v-next/outputv4/osmosis/tokenfactory/v1beta1/query.ts b/__fixtures__/v-next/outputv4/osmosis/tokenfactory/v1beta1/query.ts index aa5612c4b6..b67197bdfd 100644 --- a/__fixtures__/v-next/outputv4/osmosis/tokenfactory/v1beta1/query.ts +++ b/__fixtures__/v-next/outputv4/osmosis/tokenfactory/v1beta1/query.ts @@ -1,11 +1,13 @@ -import { Params, ParamsSDKType } from "./params.js"; -import { DenomAuthorityMetadata, DenomAuthorityMetadataSDKType } from "./authorityMetadata.js"; -import { BinaryReader, BinaryWriter } from "../../../binary.js"; -import { JsonSafe } from "../../../json-safe.js"; -import { DeepPartial, isSet } from "../../../helpers.js"; +import { Params, ParamsSDKType } from "./params"; +import { DenomAuthorityMetadata, DenomAuthorityMetadataSDKType } from "./authorityMetadata"; +import { BinaryReader, BinaryWriter } from "../../../binary"; +import { JsonSafe } from "../../../json-safe"; +import { DeepPartial, isSet } from "../../../helpers"; +import { ComputedRef } from "vue"; export const protobufPackage = "osmosis.tokenfactory.v1beta1"; /** QueryParamsRequest is the request type for the Query/Params RPC method. */ export interface QueryParamsRequest {} +export interface ReactiveQueryParamsRequest {} export interface QueryParamsRequestProtoMsg { typeUrl: "/osmosis.tokenfactory.v1beta1.QueryParamsRequest"; value: Uint8Array; @@ -17,6 +19,9 @@ export interface QueryParamsResponse { /** params defines the parameters of the module. */ params: Params; } +export interface ReactiveQueryParamsResponse { + params: ComputedRef<Params>; +} export interface QueryParamsResponseProtoMsg { typeUrl: "/osmosis.tokenfactory.v1beta1.QueryParamsResponse"; value: Uint8Array; @@ -32,6 +37,9 @@ export interface QueryParamsResponseSDKType { export interface QueryDenomAuthorityMetadataRequest { denom: string; } +export interface ReactiveQueryDenomAuthorityMetadataRequest { + denom: ComputedRef<string>; +} export interface QueryDenomAuthorityMetadataRequestProtoMsg { typeUrl: "/osmosis.tokenfactory.v1beta1.QueryDenomAuthorityMetadataRequest"; value: Uint8Array; @@ -50,6 +58,9 @@ export interface QueryDenomAuthorityMetadataRequestSDKType { export interface QueryDenomAuthorityMetadataResponse { authorityMetadata: DenomAuthorityMetadata; } +export interface ReactiveQueryDenomAuthorityMetadataResponse { + authorityMetadata: ComputedRef<DenomAuthorityMetadata>; +} export interface QueryDenomAuthorityMetadataResponseProtoMsg { typeUrl: "/osmosis.tokenfactory.v1beta1.QueryDenomAuthorityMetadataResponse"; value: Uint8Array; @@ -68,6 +79,9 @@ export interface QueryDenomAuthorityMetadataResponseSDKType { export interface QueryDenomsFromCreatorRequest { creator: string; } +export interface ReactiveQueryDenomsFromCreatorRequest { + creator: ComputedRef<string>; +} export interface QueryDenomsFromCreatorRequestProtoMsg { typeUrl: "/osmosis.tokenfactory.v1beta1.QueryDenomsFromCreatorRequest"; value: Uint8Array; @@ -86,6 +100,9 @@ export interface QueryDenomsFromCreatorRequestSDKType { export interface QueryDenomsFromCreatorResponse { denoms: string[]; } +export interface ReactiveQueryDenomsFromCreatorResponse { + denoms: ComputedRef<string[]>; +} export interface QueryDenomsFromCreatorResponseProtoMsg { typeUrl: "/osmosis.tokenfactory.v1beta1.QueryDenomsFromCreatorResponse"; value: Uint8Array; @@ -120,8 +137,7 @@ export const QueryParamsRequest = { return message; }, fromJSON(_: any): QueryParamsRequest { - const obj = createBaseQueryParamsRequest(); - return obj; + return {}; }, toJSON(_: QueryParamsRequest): JsonSafe<QueryParamsRequest> { const obj: any = {}; @@ -202,9 +218,9 @@ export const QueryParamsResponse = { return message; }, fromJSON(object: any): QueryParamsResponse { - const obj = createBaseQueryParamsResponse(); - if (isSet(object.params)) obj.params = Params.fromJSON(object.params); - return obj; + return { + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined + }; }, toJSON(message: QueryParamsResponse): JsonSafe<QueryParamsResponse> { const obj: any = {}; @@ -213,9 +229,7 @@ export const QueryParamsResponse = { }, fromPartial(object: DeepPartial<QueryParamsResponse>): QueryParamsResponse { const message = createBaseQueryParamsResponse(); - if (object.params !== undefined && object.params !== null) { - message.params = Params.fromPartial(object.params); - } + message.params = object.params !== undefined && object.params !== null ? Params.fromPartial(object.params) : undefined; return message; }, fromSDK(object: QueryParamsResponseSDKType): QueryParamsResponse { @@ -275,7 +289,7 @@ function createBaseQueryDenomAuthorityMetadataRequest(): QueryDenomAuthorityMeta export const QueryDenomAuthorityMetadataRequest = { typeUrl: "/osmosis.tokenfactory.v1beta1.QueryDenomAuthorityMetadataRequest", encode(message: QueryDenomAuthorityMetadataRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.denom !== undefined) { + if (message.denom !== "") { writer.uint32(10).string(message.denom); } return writer; @@ -298,9 +312,9 @@ export const QueryDenomAuthorityMetadataRequest = { return message; }, fromJSON(object: any): QueryDenomAuthorityMetadataRequest { - const obj = createBaseQueryDenomAuthorityMetadataRequest(); - if (isSet(object.denom)) obj.denom = String(object.denom); - return obj; + return { + denom: isSet(object.denom) ? String(object.denom) : "" + }; }, toJSON(message: QueryDenomAuthorityMetadataRequest): JsonSafe<QueryDenomAuthorityMetadataRequest> { const obj: any = {}; @@ -392,9 +406,9 @@ export const QueryDenomAuthorityMetadataResponse = { return message; }, fromJSON(object: any): QueryDenomAuthorityMetadataResponse { - const obj = createBaseQueryDenomAuthorityMetadataResponse(); - if (isSet(object.authorityMetadata)) obj.authorityMetadata = DenomAuthorityMetadata.fromJSON(object.authorityMetadata); - return obj; + return { + authorityMetadata: isSet(object.authorityMetadata) ? DenomAuthorityMetadata.fromJSON(object.authorityMetadata) : undefined + }; }, toJSON(message: QueryDenomAuthorityMetadataResponse): JsonSafe<QueryDenomAuthorityMetadataResponse> { const obj: any = {}; @@ -403,9 +417,7 @@ export const QueryDenomAuthorityMetadataResponse = { }, fromPartial(object: DeepPartial<QueryDenomAuthorityMetadataResponse>): QueryDenomAuthorityMetadataResponse { const message = createBaseQueryDenomAuthorityMetadataResponse(); - if (object.authorityMetadata !== undefined && object.authorityMetadata !== null) { - message.authorityMetadata = DenomAuthorityMetadata.fromPartial(object.authorityMetadata); - } + message.authorityMetadata = object.authorityMetadata !== undefined && object.authorityMetadata !== null ? DenomAuthorityMetadata.fromPartial(object.authorityMetadata) : undefined; return message; }, fromSDK(object: QueryDenomAuthorityMetadataResponseSDKType): QueryDenomAuthorityMetadataResponse { @@ -465,7 +477,7 @@ function createBaseQueryDenomsFromCreatorRequest(): QueryDenomsFromCreatorReques export const QueryDenomsFromCreatorRequest = { typeUrl: "/osmosis.tokenfactory.v1beta1.QueryDenomsFromCreatorRequest", encode(message: QueryDenomsFromCreatorRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.creator !== undefined) { + if (message.creator !== "") { writer.uint32(10).string(message.creator); } return writer; @@ -488,9 +500,9 @@ export const QueryDenomsFromCreatorRequest = { return message; }, fromJSON(object: any): QueryDenomsFromCreatorRequest { - const obj = createBaseQueryDenomsFromCreatorRequest(); - if (isSet(object.creator)) obj.creator = String(object.creator); - return obj; + return { + creator: isSet(object.creator) ? String(object.creator) : "" + }; }, toJSON(message: QueryDenomsFromCreatorRequest): JsonSafe<QueryDenomsFromCreatorRequest> { const obj: any = {}; @@ -582,9 +594,9 @@ export const QueryDenomsFromCreatorResponse = { return message; }, fromJSON(object: any): QueryDenomsFromCreatorResponse { - const obj = createBaseQueryDenomsFromCreatorResponse(); - if (Array.isArray(object?.denoms)) obj.denoms = object.denoms.map((e: any) => String(e)); - return obj; + return { + denoms: Array.isArray(object?.denoms) ? object.denoms.map((e: any) => String(e)) : [] + }; }, toJSON(message: QueryDenomsFromCreatorResponse): JsonSafe<QueryDenomsFromCreatorResponse> { const obj: any = {}; diff --git a/__fixtures__/v-next/outputv4/osmosis/tokenfactory/v1beta1/tx.amino.ts b/__fixtures__/v-next/outputv4/osmosis/tokenfactory/v1beta1/tx.amino.ts index c8461939e7..6ac7848d13 100644 --- a/__fixtures__/v-next/outputv4/osmosis/tokenfactory/v1beta1/tx.amino.ts +++ b/__fixtures__/v-next/outputv4/osmosis/tokenfactory/v1beta1/tx.amino.ts @@ -1,8 +1,8 @@ //@ts-nocheck -import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin.js"; -import { Metadata, MetadataSDKType, DenomUnit, DenomUnitSDKType } from "../../../cosmos/bank/v1beta1/bank.js"; +import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; +import { Metadata, MetadataSDKType, DenomUnit, DenomUnitSDKType } from "../../../cosmos/bank/v1beta1/bank"; import { AminoMsg } from "@cosmjs/amino"; -import { MsgCreateDenom, MsgCreateDenomSDKType, MsgMint, MsgMintSDKType, MsgBurn, MsgBurnSDKType, MsgChangeAdmin, MsgChangeAdminSDKType, MsgSetDenomMetadata, MsgSetDenomMetadataSDKType } from "./tx.js"; +import { MsgCreateDenom, MsgCreateDenomSDKType, MsgMint, MsgMintSDKType, MsgBurn, MsgBurnSDKType, MsgChangeAdmin, MsgChangeAdminSDKType, MsgSetDenomMetadata, MsgSetDenomMetadataSDKType } from "./tx"; export interface MsgCreateDenomAminoType extends AminoMsg { type: "osmosis/tokenfactory/create-denom"; value: { diff --git a/__fixtures__/v-next/outputv4/osmosis/tokenfactory/v1beta1/tx.registry.ts b/__fixtures__/v-next/outputv4/osmosis/tokenfactory/v1beta1/tx.registry.ts index 5f554c68e0..a351809f22 100644 --- a/__fixtures__/v-next/outputv4/osmosis/tokenfactory/v1beta1/tx.registry.ts +++ b/__fixtures__/v-next/outputv4/osmosis/tokenfactory/v1beta1/tx.registry.ts @@ -1,7 +1,7 @@ -import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin.js"; -import { Metadata, MetadataSDKType } from "../../../cosmos/bank/v1beta1/bank.js"; +import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; +import { Metadata, MetadataSDKType } from "../../../cosmos/bank/v1beta1/bank"; import { GeneratedType, Registry } from "@cosmjs/proto-signing"; -import { MsgCreateDenom, MsgCreateDenomSDKType, MsgMint, MsgMintSDKType, MsgBurn, MsgBurnSDKType, MsgChangeAdmin, MsgChangeAdminSDKType, MsgSetDenomMetadata, MsgSetDenomMetadataSDKType } from "./tx.js"; +import { MsgCreateDenom, MsgCreateDenomSDKType, MsgMint, MsgMintSDKType, MsgBurn, MsgBurnSDKType, MsgChangeAdmin, MsgChangeAdminSDKType, MsgSetDenomMetadata, MsgSetDenomMetadataSDKType } from "./tx"; export const registry: ReadonlyArray<[string, GeneratedType]> = [["/osmosis.tokenfactory.v1beta1.MsgCreateDenom", MsgCreateDenom], ["/osmosis.tokenfactory.v1beta1.MsgMint", MsgMint], ["/osmosis.tokenfactory.v1beta1.MsgBurn", MsgBurn], ["/osmosis.tokenfactory.v1beta1.MsgChangeAdmin", MsgChangeAdmin], ["/osmosis.tokenfactory.v1beta1.MsgSetDenomMetadata", MsgSetDenomMetadata]]; export const load = (protoRegistry: Registry) => { registry.forEach(([typeUrl, mod]) => { diff --git a/__fixtures__/v-next/outputv4/osmosis/tokenfactory/v1beta1/tx.rpc.msg.ts b/__fixtures__/v-next/outputv4/osmosis/tokenfactory/v1beta1/tx.rpc.msg.ts index ccce1ad6a4..509326d21e 100644 --- a/__fixtures__/v-next/outputv4/osmosis/tokenfactory/v1beta1/tx.rpc.msg.ts +++ b/__fixtures__/v-next/outputv4/osmosis/tokenfactory/v1beta1/tx.rpc.msg.ts @@ -1,8 +1,8 @@ -import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin.js"; -import { Metadata, MetadataSDKType } from "../../../cosmos/bank/v1beta1/bank.js"; -import { Rpc } from "../../../helpers.js"; -import { BinaryReader } from "../../../binary.js"; -import { MsgCreateDenom, MsgCreateDenomSDKType, MsgCreateDenomResponse, MsgCreateDenomResponseSDKType, MsgMint, MsgMintSDKType, MsgMintResponse, MsgMintResponseSDKType, MsgBurn, MsgBurnSDKType, MsgBurnResponse, MsgBurnResponseSDKType, MsgChangeAdmin, MsgChangeAdminSDKType, MsgChangeAdminResponse, MsgChangeAdminResponseSDKType, MsgSetDenomMetadata, MsgSetDenomMetadataSDKType, MsgSetDenomMetadataResponse, MsgSetDenomMetadataResponseSDKType } from "./tx.js"; +import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; +import { Metadata, MetadataSDKType } from "../../../cosmos/bank/v1beta1/bank"; +import { Rpc } from "../../../helpers"; +import { BinaryReader } from "../../../binary"; +import { MsgCreateDenom, MsgCreateDenomSDKType, MsgCreateDenomResponse, MsgCreateDenomResponseSDKType, MsgMint, MsgMintSDKType, MsgMintResponse, MsgMintResponseSDKType, MsgBurn, MsgBurnSDKType, MsgBurnResponse, MsgBurnResponseSDKType, MsgChangeAdmin, MsgChangeAdminSDKType, MsgChangeAdminResponse, MsgChangeAdminResponseSDKType, MsgSetDenomMetadata, MsgSetDenomMetadataSDKType, MsgSetDenomMetadataResponse, MsgSetDenomMetadataResponseSDKType } from "./tx"; /** Msg defines the tokefactory module's gRPC message service. */ export interface Msg { createDenom(request: MsgCreateDenom): Promise<MsgCreateDenomResponse>; diff --git a/__fixtures__/v-next/outputv4/osmosis/tokenfactory/v1beta1/tx.ts b/__fixtures__/v-next/outputv4/osmosis/tokenfactory/v1beta1/tx.ts index 6f6001ad5a..c6c8fd2fde 100644 --- a/__fixtures__/v-next/outputv4/osmosis/tokenfactory/v1beta1/tx.ts +++ b/__fixtures__/v-next/outputv4/osmosis/tokenfactory/v1beta1/tx.ts @@ -1,8 +1,9 @@ -import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin.js"; -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"; +import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; +import { Metadata, MetadataSDKType } from "../../../cosmos/bank/v1beta1/bank"; +import { BinaryReader, BinaryWriter } from "../../../binary"; +import { isSet, DeepPartial } from "../../../helpers"; +import { JsonSafe } from "../../../json-safe"; +import { ComputedRef } from "vue"; export const protobufPackage = "osmosis.tokenfactory.v1beta1"; /** * MsgCreateDenom defines the message structure for the CreateDenom gRPC service @@ -20,6 +21,10 @@ export interface MsgCreateDenom { /** subdenom can be up to 44 "alphanumeric" characters long. */ subdenom: string; } +export interface ReactiveMsgCreateDenom { + sender: ComputedRef<string>; + subdenom: ComputedRef<string>; +} export interface MsgCreateDenomProtoMsg { typeUrl: "/osmosis.tokenfactory.v1beta1.MsgCreateDenom"; value: Uint8Array; @@ -46,6 +51,9 @@ export interface MsgCreateDenomSDKType { export interface MsgCreateDenomResponse { newTokenDenom: string; } +export interface ReactiveMsgCreateDenomResponse { + newTokenDenom: ComputedRef<string>; +} export interface MsgCreateDenomResponseProtoMsg { typeUrl: "/osmosis.tokenfactory.v1beta1.MsgCreateDenomResponse"; value: Uint8Array; @@ -65,6 +73,10 @@ export interface MsgMint { sender: string; amount: Coin; } +export interface ReactiveMsgMint { + sender: ComputedRef<string>; + amount: ComputedRef<Coin>; +} export interface MsgMintProtoMsg { typeUrl: "/osmosis.tokenfactory.v1beta1.MsgMint"; value: Uint8Array; @@ -78,6 +90,7 @@ export interface MsgMintSDKType { amount: CoinSDKType; } export interface MsgMintResponse {} +export interface ReactiveMsgMintResponse {} export interface MsgMintResponseProtoMsg { typeUrl: "/osmosis.tokenfactory.v1beta1.MsgMintResponse"; value: Uint8Array; @@ -91,6 +104,10 @@ export interface MsgBurn { sender: string; amount: Coin; } +export interface ReactiveMsgBurn { + sender: ComputedRef<string>; + amount: ComputedRef<Coin>; +} export interface MsgBurnProtoMsg { typeUrl: "/osmosis.tokenfactory.v1beta1.MsgBurn"; value: Uint8Array; @@ -104,6 +121,7 @@ export interface MsgBurnSDKType { amount: CoinSDKType; } export interface MsgBurnResponse {} +export interface ReactiveMsgBurnResponse {} export interface MsgBurnResponseProtoMsg { typeUrl: "/osmosis.tokenfactory.v1beta1.MsgBurnResponse"; value: Uint8Array; @@ -118,6 +136,11 @@ export interface MsgChangeAdmin { denom: string; newAdmin: string; } +export interface ReactiveMsgChangeAdmin { + sender: ComputedRef<string>; + denom: ComputedRef<string>; + newAdmin: ComputedRef<string>; +} export interface MsgChangeAdminProtoMsg { typeUrl: "/osmosis.tokenfactory.v1beta1.MsgChangeAdmin"; value: Uint8Array; @@ -136,6 +159,7 @@ export interface MsgChangeAdminSDKType { * MsgChangeAdmin message. */ export interface MsgChangeAdminResponse {} +export interface ReactiveMsgChangeAdminResponse {} export interface MsgChangeAdminResponseProtoMsg { typeUrl: "/osmosis.tokenfactory.v1beta1.MsgChangeAdminResponse"; value: Uint8Array; @@ -153,6 +177,10 @@ export interface MsgSetDenomMetadata { sender: string; metadata: Metadata; } +export interface ReactiveMsgSetDenomMetadata { + sender: ComputedRef<string>; + metadata: ComputedRef<Metadata>; +} export interface MsgSetDenomMetadataProtoMsg { typeUrl: "/osmosis.tokenfactory.v1beta1.MsgSetDenomMetadata"; value: Uint8Array; @@ -170,6 +198,7 @@ export interface MsgSetDenomMetadataSDKType { * MsgSetDenomMetadata message. */ export interface MsgSetDenomMetadataResponse {} +export interface ReactiveMsgSetDenomMetadataResponse {} export interface MsgSetDenomMetadataResponseProtoMsg { typeUrl: "/osmosis.tokenfactory.v1beta1.MsgSetDenomMetadataResponse"; value: Uint8Array; @@ -188,10 +217,10 @@ function createBaseMsgCreateDenom(): MsgCreateDenom { export const MsgCreateDenom = { typeUrl: "/osmosis.tokenfactory.v1beta1.MsgCreateDenom", encode(message: MsgCreateDenom, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.sender !== undefined) { + if (message.sender !== "") { writer.uint32(10).string(message.sender); } - if (message.subdenom !== undefined) { + if (message.subdenom !== "") { writer.uint32(18).string(message.subdenom); } return writer; @@ -217,10 +246,10 @@ export const MsgCreateDenom = { return message; }, fromJSON(object: any): MsgCreateDenom { - const obj = createBaseMsgCreateDenom(); - if (isSet(object.sender)) obj.sender = String(object.sender); - if (isSet(object.subdenom)) obj.subdenom = String(object.subdenom); - return obj; + return { + sender: isSet(object.sender) ? String(object.sender) : "", + subdenom: isSet(object.subdenom) ? String(object.subdenom) : "" + }; }, toJSON(message: MsgCreateDenom): JsonSafe<MsgCreateDenom> { const obj: any = {}; @@ -298,7 +327,7 @@ function createBaseMsgCreateDenomResponse(): MsgCreateDenomResponse { export const MsgCreateDenomResponse = { typeUrl: "/osmosis.tokenfactory.v1beta1.MsgCreateDenomResponse", encode(message: MsgCreateDenomResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.newTokenDenom !== undefined) { + if (message.newTokenDenom !== "") { writer.uint32(10).string(message.newTokenDenom); } return writer; @@ -321,9 +350,9 @@ export const MsgCreateDenomResponse = { return message; }, fromJSON(object: any): MsgCreateDenomResponse { - const obj = createBaseMsgCreateDenomResponse(); - if (isSet(object.newTokenDenom)) obj.newTokenDenom = String(object.newTokenDenom); - return obj; + return { + newTokenDenom: isSet(object.newTokenDenom) ? String(object.newTokenDenom) : "" + }; }, toJSON(message: MsgCreateDenomResponse): JsonSafe<MsgCreateDenomResponse> { const obj: any = {}; @@ -393,7 +422,7 @@ function createBaseMsgMint(): MsgMint { export const MsgMint = { typeUrl: "/osmosis.tokenfactory.v1beta1.MsgMint", encode(message: MsgMint, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.sender !== undefined) { + if (message.sender !== "") { writer.uint32(10).string(message.sender); } if (message.amount !== undefined) { @@ -422,10 +451,10 @@ export const MsgMint = { return message; }, fromJSON(object: any): MsgMint { - const obj = createBaseMsgMint(); - if (isSet(object.sender)) obj.sender = String(object.sender); - if (isSet(object.amount)) obj.amount = Coin.fromJSON(object.amount); - return obj; + return { + sender: isSet(object.sender) ? String(object.sender) : "", + amount: isSet(object.amount) ? Coin.fromJSON(object.amount) : undefined + }; }, toJSON(message: MsgMint): JsonSafe<MsgMint> { const obj: any = {}; @@ -436,9 +465,7 @@ export const MsgMint = { fromPartial(object: DeepPartial<MsgMint>): MsgMint { const message = createBaseMsgMint(); message.sender = object.sender ?? ""; - if (object.amount !== undefined && object.amount !== null) { - message.amount = Coin.fromPartial(object.amount); - } + message.amount = object.amount !== undefined && object.amount !== null ? Coin.fromPartial(object.amount) : undefined; return message; }, fromSDK(object: MsgMintSDKType): MsgMint { @@ -520,8 +547,7 @@ export const MsgMintResponse = { return message; }, fromJSON(_: any): MsgMintResponse { - const obj = createBaseMsgMintResponse(); - return obj; + return {}; }, toJSON(_: MsgMintResponse): JsonSafe<MsgMintResponse> { const obj: any = {}; @@ -580,7 +606,7 @@ function createBaseMsgBurn(): MsgBurn { export const MsgBurn = { typeUrl: "/osmosis.tokenfactory.v1beta1.MsgBurn", encode(message: MsgBurn, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.sender !== undefined) { + if (message.sender !== "") { writer.uint32(10).string(message.sender); } if (message.amount !== undefined) { @@ -609,10 +635,10 @@ export const MsgBurn = { return message; }, fromJSON(object: any): MsgBurn { - const obj = createBaseMsgBurn(); - if (isSet(object.sender)) obj.sender = String(object.sender); - if (isSet(object.amount)) obj.amount = Coin.fromJSON(object.amount); - return obj; + return { + sender: isSet(object.sender) ? String(object.sender) : "", + amount: isSet(object.amount) ? Coin.fromJSON(object.amount) : undefined + }; }, toJSON(message: MsgBurn): JsonSafe<MsgBurn> { const obj: any = {}; @@ -623,9 +649,7 @@ export const MsgBurn = { fromPartial(object: DeepPartial<MsgBurn>): MsgBurn { const message = createBaseMsgBurn(); message.sender = object.sender ?? ""; - if (object.amount !== undefined && object.amount !== null) { - message.amount = Coin.fromPartial(object.amount); - } + message.amount = object.amount !== undefined && object.amount !== null ? Coin.fromPartial(object.amount) : undefined; return message; }, fromSDK(object: MsgBurnSDKType): MsgBurn { @@ -707,8 +731,7 @@ export const MsgBurnResponse = { return message; }, fromJSON(_: any): MsgBurnResponse { - const obj = createBaseMsgBurnResponse(); - return obj; + return {}; }, toJSON(_: MsgBurnResponse): JsonSafe<MsgBurnResponse> { const obj: any = {}; @@ -768,13 +791,13 @@ function createBaseMsgChangeAdmin(): MsgChangeAdmin { export const MsgChangeAdmin = { typeUrl: "/osmosis.tokenfactory.v1beta1.MsgChangeAdmin", encode(message: MsgChangeAdmin, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.sender !== undefined) { + if (message.sender !== "") { writer.uint32(10).string(message.sender); } - if (message.denom !== undefined) { + if (message.denom !== "") { writer.uint32(18).string(message.denom); } - if (message.newAdmin !== undefined) { + if (message.newAdmin !== "") { writer.uint32(26).string(message.newAdmin); } return writer; @@ -803,11 +826,11 @@ export const MsgChangeAdmin = { return message; }, fromJSON(object: any): MsgChangeAdmin { - const obj = createBaseMsgChangeAdmin(); - if (isSet(object.sender)) obj.sender = String(object.sender); - if (isSet(object.denom)) obj.denom = String(object.denom); - if (isSet(object.newAdmin)) obj.newAdmin = String(object.newAdmin); - return obj; + return { + sender: isSet(object.sender) ? String(object.sender) : "", + denom: isSet(object.denom) ? String(object.denom) : "", + newAdmin: isSet(object.newAdmin) ? String(object.newAdmin) : "" + }; }, toJSON(message: MsgChangeAdmin): JsonSafe<MsgChangeAdmin> { const obj: any = {}; @@ -909,8 +932,7 @@ export const MsgChangeAdminResponse = { return message; }, fromJSON(_: any): MsgChangeAdminResponse { - const obj = createBaseMsgChangeAdminResponse(); - return obj; + return {}; }, toJSON(_: MsgChangeAdminResponse): JsonSafe<MsgChangeAdminResponse> { const obj: any = {}; @@ -969,7 +991,7 @@ function createBaseMsgSetDenomMetadata(): MsgSetDenomMetadata { export const MsgSetDenomMetadata = { typeUrl: "/osmosis.tokenfactory.v1beta1.MsgSetDenomMetadata", encode(message: MsgSetDenomMetadata, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.sender !== undefined) { + if (message.sender !== "") { writer.uint32(10).string(message.sender); } if (message.metadata !== undefined) { @@ -998,10 +1020,10 @@ export const MsgSetDenomMetadata = { return message; }, fromJSON(object: any): MsgSetDenomMetadata { - const obj = createBaseMsgSetDenomMetadata(); - if (isSet(object.sender)) obj.sender = String(object.sender); - if (isSet(object.metadata)) obj.metadata = Metadata.fromJSON(object.metadata); - return obj; + return { + sender: isSet(object.sender) ? String(object.sender) : "", + metadata: isSet(object.metadata) ? Metadata.fromJSON(object.metadata) : undefined + }; }, toJSON(message: MsgSetDenomMetadata): JsonSafe<MsgSetDenomMetadata> { const obj: any = {}; @@ -1012,9 +1034,7 @@ export const MsgSetDenomMetadata = { fromPartial(object: DeepPartial<MsgSetDenomMetadata>): MsgSetDenomMetadata { const message = createBaseMsgSetDenomMetadata(); message.sender = object.sender ?? ""; - if (object.metadata !== undefined && object.metadata !== null) { - message.metadata = Metadata.fromPartial(object.metadata); - } + message.metadata = object.metadata !== undefined && object.metadata !== null ? Metadata.fromPartial(object.metadata) : undefined; return message; }, fromSDK(object: MsgSetDenomMetadataSDKType): MsgSetDenomMetadata { @@ -1096,8 +1116,7 @@ export const MsgSetDenomMetadataResponse = { return message; }, fromJSON(_: any): MsgSetDenomMetadataResponse { - const obj = createBaseMsgSetDenomMetadataResponse(); - return obj; + return {}; }, toJSON(_: MsgSetDenomMetadataResponse): JsonSafe<MsgSetDenomMetadataResponse> { const obj: any = {}; diff --git a/__fixtures__/v-next/outputv4/osmosis/twap/v1beta1/genesis.ts b/__fixtures__/v-next/outputv4/osmosis/twap/v1beta1/genesis.ts index 2040587651..b6819ef9dd 100644 --- a/__fixtures__/v-next/outputv4/osmosis/twap/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputv4/osmosis/twap/v1beta1/genesis.ts @@ -1,14 +1,19 @@ -import { Duration, DurationSDKType } from "../../../google/protobuf/duration.js"; -import { TwapRecord, TwapRecordSDKType } from "./twap_record.js"; -import { BinaryReader, BinaryWriter } from "../../../binary.js"; -import { isSet, DeepPartial } from "../../../helpers.js"; -import { JsonSafe } from "../../../json-safe.js"; +import { Duration, DurationSDKType } from "../../../google/protobuf/duration"; +import { TwapRecord, TwapRecordSDKType } from "./twap_record"; +import { BinaryReader, BinaryWriter } from "../../../binary"; +import { isSet, DeepPartial } from "../../../helpers"; +import { JsonSafe } from "../../../json-safe"; +import { ComputedRef } from "vue"; export const protobufPackage = "osmosis.twap.v1beta1"; /** Params holds parameters for the twap module */ export interface Params { pruneEpochIdentifier: string; recordHistoryKeepPeriod: Duration; } +export interface ReactiveParams { + pruneEpochIdentifier: ComputedRef<string>; + recordHistoryKeepPeriod: ComputedRef<Duration>; +} export interface ParamsProtoMsg { typeUrl: "/osmosis.twap.v1beta1.Params"; value: Uint8Array; @@ -25,6 +30,10 @@ export interface GenesisState { /** params is the container of twap parameters. */ params: Params; } +export interface ReactiveGenesisState { + twaps: ComputedRef<TwapRecord[]>; + params: ComputedRef<Params>; +} export interface GenesisStateProtoMsg { typeUrl: "/osmosis.twap.v1beta1.GenesisState"; value: Uint8Array; @@ -43,7 +52,7 @@ function createBaseParams(): Params { export const Params = { typeUrl: "/osmosis.twap.v1beta1.Params", encode(message: Params, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.pruneEpochIdentifier !== undefined) { + if (message.pruneEpochIdentifier !== "") { writer.uint32(10).string(message.pruneEpochIdentifier); } if (message.recordHistoryKeepPeriod !== undefined) { @@ -72,10 +81,10 @@ export const Params = { return message; }, fromJSON(object: any): Params { - const obj = createBaseParams(); - if (isSet(object.pruneEpochIdentifier)) obj.pruneEpochIdentifier = String(object.pruneEpochIdentifier); - if (isSet(object.recordHistoryKeepPeriod)) obj.recordHistoryKeepPeriod = Duration.fromJSON(object.recordHistoryKeepPeriod); - return obj; + return { + pruneEpochIdentifier: isSet(object.pruneEpochIdentifier) ? String(object.pruneEpochIdentifier) : "", + recordHistoryKeepPeriod: isSet(object.recordHistoryKeepPeriod) ? Duration.fromJSON(object.recordHistoryKeepPeriod) : undefined + }; }, toJSON(message: Params): JsonSafe<Params> { const obj: any = {}; @@ -86,9 +95,7 @@ export const Params = { fromPartial(object: DeepPartial<Params>): Params { const message = createBaseParams(); message.pruneEpochIdentifier = object.pruneEpochIdentifier ?? ""; - if (object.recordHistoryKeepPeriod !== undefined && object.recordHistoryKeepPeriod !== null) { - message.recordHistoryKeepPeriod = Duration.fromPartial(object.recordHistoryKeepPeriod); - } + message.recordHistoryKeepPeriod = object.recordHistoryKeepPeriod !== undefined && object.recordHistoryKeepPeriod !== null ? Duration.fromPartial(object.recordHistoryKeepPeriod) : undefined; return message; }, fromSDK(object: ParamsSDKType): Params { @@ -185,10 +192,10 @@ export const GenesisState = { return message; }, fromJSON(object: any): GenesisState { - const obj = createBaseGenesisState(); - if (Array.isArray(object?.twaps)) obj.twaps = object.twaps.map((e: any) => TwapRecord.fromJSON(e)); - if (isSet(object.params)) obj.params = Params.fromJSON(object.params); - return obj; + return { + twaps: Array.isArray(object?.twaps) ? object.twaps.map((e: any) => TwapRecord.fromJSON(e)) : [], + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined + }; }, toJSON(message: GenesisState): JsonSafe<GenesisState> { const obj: any = {}; @@ -203,9 +210,7 @@ export const GenesisState = { fromPartial(object: DeepPartial<GenesisState>): GenesisState { const message = createBaseGenesisState(); message.twaps = object.twaps?.map(e => TwapRecord.fromPartial(e)) || []; - if (object.params !== undefined && object.params !== null) { - message.params = Params.fromPartial(object.params); - } + message.params = object.params !== undefined && object.params !== null ? Params.fromPartial(object.params) : undefined; return message; }, fromSDK(object: GenesisStateSDKType): GenesisState { diff --git a/__fixtures__/v-next/outputv4/osmosis/twap/v1beta1/query.lcd.ts b/__fixtures__/v-next/outputv4/osmosis/twap/v1beta1/query.lcd.ts index 16f6776693..2cbe52b3c5 100644 --- a/__fixtures__/v-next/outputv4/osmosis/twap/v1beta1/query.lcd.ts +++ b/__fixtures__/v-next/outputv4/osmosis/twap/v1beta1/query.lcd.ts @@ -1,7 +1,7 @@ -import { Timestamp, TimestampSDKType } from "../../../google/protobuf/timestamp.js"; -import { Params, ParamsSDKType } from "./genesis.js"; +import { Timestamp, TimestampSDKType } from "../../../google/protobuf/timestamp"; +import { Params, ParamsSDKType } from "./genesis"; import { LCDClient } from "@cosmology/lcd"; -import { ParamsRequest, ParamsRequestSDKType, ParamsResponse, ParamsResponseSDKType, ArithmeticTwapRequest, ArithmeticTwapRequestSDKType, ArithmeticTwapResponse, ArithmeticTwapResponseSDKType, ArithmeticTwapToNowRequest, ArithmeticTwapToNowRequestSDKType, ArithmeticTwapToNowResponse, ArithmeticTwapToNowResponseSDKType } from "./query.js"; +import { ParamsRequest, ParamsRequestSDKType, ParamsResponse, ParamsResponseSDKType, ArithmeticTwapRequest, ArithmeticTwapRequestSDKType, ArithmeticTwapResponse, ArithmeticTwapResponseSDKType, ArithmeticTwapToNowRequest, ArithmeticTwapToNowRequestSDKType, ArithmeticTwapToNowResponse, ArithmeticTwapToNowResponseSDKType } from "./query"; export class LCDQueryClient { req: LCDClient; constructor({ diff --git a/__fixtures__/v-next/outputv4/osmosis/twap/v1beta1/query.rpc.Query.ts b/__fixtures__/v-next/outputv4/osmosis/twap/v1beta1/query.rpc.Query.ts index 3c231597a7..ae9fb21fdc 100644 --- a/__fixtures__/v-next/outputv4/osmosis/twap/v1beta1/query.rpc.Query.ts +++ b/__fixtures__/v-next/outputv4/osmosis/twap/v1beta1/query.rpc.Query.ts @@ -1,9 +1,9 @@ -import { Timestamp, TimestampSDKType } from "../../../google/protobuf/timestamp.js"; -import { Params, ParamsSDKType } from "./genesis.js"; -import { Rpc } from "../../../helpers.js"; -import { BinaryReader } from "../../../binary.js"; +import { Timestamp, TimestampSDKType } from "../../../google/protobuf/timestamp"; +import { Params, ParamsSDKType } from "./genesis"; +import { Rpc } from "../../../helpers"; +import { BinaryReader } from "../../../binary"; import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; -import { ParamsRequest, ParamsRequestSDKType, ParamsResponse, ParamsResponseSDKType, ArithmeticTwapRequest, ArithmeticTwapRequestSDKType, ArithmeticTwapResponse, ArithmeticTwapResponseSDKType, ArithmeticTwapToNowRequest, ArithmeticTwapToNowRequestSDKType, ArithmeticTwapToNowResponse, ArithmeticTwapToNowResponseSDKType } from "./query.js"; +import { ParamsRequest, ParamsRequestSDKType, ParamsResponse, ParamsResponseSDKType, ArithmeticTwapRequest, ArithmeticTwapRequestSDKType, ArithmeticTwapResponse, ArithmeticTwapResponseSDKType, ArithmeticTwapToNowRequest, ArithmeticTwapToNowRequestSDKType, ArithmeticTwapToNowResponse, ArithmeticTwapToNowResponseSDKType } from "./query"; export interface Query { params(request?: ParamsRequest): Promise<ParamsResponse>; arithmeticTwap(request: ArithmeticTwapRequest): Promise<ArithmeticTwapResponse>; diff --git a/__fixtures__/v-next/outputv4/osmosis/twap/v1beta1/query.ts b/__fixtures__/v-next/outputv4/osmosis/twap/v1beta1/query.ts index 82bc40d3b4..fdce0ecb3d 100644 --- a/__fixtures__/v-next/outputv4/osmosis/twap/v1beta1/query.ts +++ b/__fixtures__/v-next/outputv4/osmosis/twap/v1beta1/query.ts @@ -1,9 +1,10 @@ -import { Timestamp, TimestampSDKType } from "../../../google/protobuf/timestamp.js"; -import { Params, ParamsSDKType } from "./genesis.js"; -import { BinaryReader, BinaryWriter } from "../../../binary.js"; -import { toTimestamp, fromTimestamp, isSet, DeepPartial } from "../../../helpers.js"; -import { JsonSafe } from "../../../json-safe.js"; +import { Timestamp, TimestampSDKType } from "../../../google/protobuf/timestamp"; +import { Params, ParamsSDKType } from "./genesis"; +import { BinaryReader, BinaryWriter } from "../../../binary"; +import { toTimestamp, fromTimestamp, isSet, DeepPartial } from "../../../helpers"; +import { JsonSafe } from "../../../json-safe"; import { Decimal } from "@cosmjs/math"; +import { ComputedRef } from "vue"; export const protobufPackage = "osmosis.twap.v1beta1"; export interface ArithmeticTwapRequest { poolId: bigint; @@ -12,6 +13,13 @@ export interface ArithmeticTwapRequest { startTime: Date; endTime?: Date; } +export interface ReactiveArithmeticTwapRequest { + poolId: ComputedRef<bigint>; + baseAsset: ComputedRef<string>; + quoteAsset: ComputedRef<string>; + startTime: ComputedRef<Date>; + endTime?: ComputedRef<Date>; +} export interface ArithmeticTwapRequestProtoMsg { typeUrl: "/osmosis.twap.v1beta1.ArithmeticTwapRequest"; value: Uint8Array; @@ -26,6 +34,9 @@ export interface ArithmeticTwapRequestSDKType { export interface ArithmeticTwapResponse { arithmeticTwap: string; } +export interface ReactiveArithmeticTwapResponse { + arithmeticTwap: ComputedRef<string>; +} export interface ArithmeticTwapResponseProtoMsg { typeUrl: "/osmosis.twap.v1beta1.ArithmeticTwapResponse"; value: Uint8Array; @@ -39,6 +50,12 @@ export interface ArithmeticTwapToNowRequest { quoteAsset: string; startTime: Date; } +export interface ReactiveArithmeticTwapToNowRequest { + poolId: ComputedRef<bigint>; + baseAsset: ComputedRef<string>; + quoteAsset: ComputedRef<string>; + startTime: ComputedRef<Date>; +} export interface ArithmeticTwapToNowRequestProtoMsg { typeUrl: "/osmosis.twap.v1beta1.ArithmeticTwapToNowRequest"; value: Uint8Array; @@ -52,6 +69,9 @@ export interface ArithmeticTwapToNowRequestSDKType { export interface ArithmeticTwapToNowResponse { arithmeticTwap: string; } +export interface ReactiveArithmeticTwapToNowResponse { + arithmeticTwap: ComputedRef<string>; +} export interface ArithmeticTwapToNowResponseProtoMsg { typeUrl: "/osmosis.twap.v1beta1.ArithmeticTwapToNowResponse"; value: Uint8Array; @@ -60,6 +80,7 @@ export interface ArithmeticTwapToNowResponseSDKType { arithmetic_twap: string; } export interface ParamsRequest {} +export interface ReactiveParamsRequest {} export interface ParamsRequestProtoMsg { typeUrl: "/osmosis.twap.v1beta1.ParamsRequest"; value: Uint8Array; @@ -68,6 +89,9 @@ export interface ParamsRequestSDKType {} export interface ParamsResponse { params: Params; } +export interface ReactiveParamsResponse { + params: ComputedRef<Params>; +} export interface ParamsResponseProtoMsg { typeUrl: "/osmosis.twap.v1beta1.ParamsResponse"; value: Uint8Array; @@ -87,13 +111,13 @@ function createBaseArithmeticTwapRequest(): ArithmeticTwapRequest { export const ArithmeticTwapRequest = { typeUrl: "/osmosis.twap.v1beta1.ArithmeticTwapRequest", encode(message: ArithmeticTwapRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.poolId !== undefined) { + if (message.poolId !== BigInt(0)) { writer.uint32(8).uint64(message.poolId); } - if (message.baseAsset !== undefined) { + if (message.baseAsset !== "") { writer.uint32(18).string(message.baseAsset); } - if (message.quoteAsset !== undefined) { + if (message.quoteAsset !== "") { writer.uint32(26).string(message.quoteAsset); } if (message.startTime !== undefined) { @@ -134,13 +158,13 @@ export const ArithmeticTwapRequest = { return message; }, fromJSON(object: any): ArithmeticTwapRequest { - const obj = createBaseArithmeticTwapRequest(); - if (isSet(object.poolId)) obj.poolId = BigInt(object.poolId.toString()); - if (isSet(object.baseAsset)) obj.baseAsset = String(object.baseAsset); - if (isSet(object.quoteAsset)) obj.quoteAsset = String(object.quoteAsset); - if (isSet(object.startTime)) obj.startTime = new Date(object.startTime); - if (isSet(object.endTime)) obj.endTime = new Date(object.endTime); - return obj; + return { + poolId: isSet(object.poolId) ? BigInt(object.poolId.toString()) : BigInt(0), + baseAsset: isSet(object.baseAsset) ? String(object.baseAsset) : "", + quoteAsset: isSet(object.quoteAsset) ? String(object.quoteAsset) : "", + startTime: isSet(object.startTime) ? new Date(object.startTime) : undefined, + endTime: isSet(object.endTime) ? new Date(object.endTime) : undefined + }; }, toJSON(message: ArithmeticTwapRequest): JsonSafe<ArithmeticTwapRequest> { const obj: any = {}; @@ -153,9 +177,7 @@ export const ArithmeticTwapRequest = { }, fromPartial(object: DeepPartial<ArithmeticTwapRequest>): ArithmeticTwapRequest { const message = createBaseArithmeticTwapRequest(); - if (object.poolId !== undefined && object.poolId !== null) { - message.poolId = BigInt(object.poolId.toString()); - } + message.poolId = object.poolId !== undefined && object.poolId !== null ? BigInt(object.poolId.toString()) : BigInt(0); message.baseAsset = object.baseAsset ?? ""; message.quoteAsset = object.quoteAsset ?? ""; message.startTime = object.startTime ?? undefined; @@ -247,7 +269,7 @@ function createBaseArithmeticTwapResponse(): ArithmeticTwapResponse { export const ArithmeticTwapResponse = { typeUrl: "/osmosis.twap.v1beta1.ArithmeticTwapResponse", encode(message: ArithmeticTwapResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.arithmeticTwap !== undefined) { + if (message.arithmeticTwap !== "") { writer.uint32(10).string(Decimal.fromUserInput(message.arithmeticTwap, 18).atomics); } return writer; @@ -270,9 +292,9 @@ export const ArithmeticTwapResponse = { return message; }, fromJSON(object: any): ArithmeticTwapResponse { - const obj = createBaseArithmeticTwapResponse(); - if (isSet(object.arithmeticTwap)) obj.arithmeticTwap = String(object.arithmeticTwap); - return obj; + return { + arithmeticTwap: isSet(object.arithmeticTwap) ? String(object.arithmeticTwap) : "" + }; }, toJSON(message: ArithmeticTwapResponse): JsonSafe<ArithmeticTwapResponse> { const obj: any = {}; @@ -344,13 +366,13 @@ function createBaseArithmeticTwapToNowRequest(): ArithmeticTwapToNowRequest { export const ArithmeticTwapToNowRequest = { typeUrl: "/osmosis.twap.v1beta1.ArithmeticTwapToNowRequest", encode(message: ArithmeticTwapToNowRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.poolId !== undefined) { + if (message.poolId !== BigInt(0)) { writer.uint32(8).uint64(message.poolId); } - if (message.baseAsset !== undefined) { + if (message.baseAsset !== "") { writer.uint32(18).string(message.baseAsset); } - if (message.quoteAsset !== undefined) { + if (message.quoteAsset !== "") { writer.uint32(26).string(message.quoteAsset); } if (message.startTime !== undefined) { @@ -385,12 +407,12 @@ export const ArithmeticTwapToNowRequest = { return message; }, fromJSON(object: any): ArithmeticTwapToNowRequest { - const obj = createBaseArithmeticTwapToNowRequest(); - if (isSet(object.poolId)) obj.poolId = BigInt(object.poolId.toString()); - if (isSet(object.baseAsset)) obj.baseAsset = String(object.baseAsset); - if (isSet(object.quoteAsset)) obj.quoteAsset = String(object.quoteAsset); - if (isSet(object.startTime)) obj.startTime = new Date(object.startTime); - return obj; + return { + poolId: isSet(object.poolId) ? BigInt(object.poolId.toString()) : BigInt(0), + baseAsset: isSet(object.baseAsset) ? String(object.baseAsset) : "", + quoteAsset: isSet(object.quoteAsset) ? String(object.quoteAsset) : "", + startTime: isSet(object.startTime) ? new Date(object.startTime) : undefined + }; }, toJSON(message: ArithmeticTwapToNowRequest): JsonSafe<ArithmeticTwapToNowRequest> { const obj: any = {}; @@ -402,9 +424,7 @@ export const ArithmeticTwapToNowRequest = { }, fromPartial(object: DeepPartial<ArithmeticTwapToNowRequest>): ArithmeticTwapToNowRequest { const message = createBaseArithmeticTwapToNowRequest(); - if (object.poolId !== undefined && object.poolId !== null) { - message.poolId = BigInt(object.poolId.toString()); - } + message.poolId = object.poolId !== undefined && object.poolId !== null ? BigInt(object.poolId.toString()) : BigInt(0); message.baseAsset = object.baseAsset ?? ""; message.quoteAsset = object.quoteAsset ?? ""; message.startTime = object.startTime ?? undefined; @@ -488,7 +508,7 @@ function createBaseArithmeticTwapToNowResponse(): ArithmeticTwapToNowResponse { export const ArithmeticTwapToNowResponse = { typeUrl: "/osmosis.twap.v1beta1.ArithmeticTwapToNowResponse", encode(message: ArithmeticTwapToNowResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.arithmeticTwap !== undefined) { + if (message.arithmeticTwap !== "") { writer.uint32(10).string(Decimal.fromUserInput(message.arithmeticTwap, 18).atomics); } return writer; @@ -511,9 +531,9 @@ export const ArithmeticTwapToNowResponse = { return message; }, fromJSON(object: any): ArithmeticTwapToNowResponse { - const obj = createBaseArithmeticTwapToNowResponse(); - if (isSet(object.arithmeticTwap)) obj.arithmeticTwap = String(object.arithmeticTwap); - return obj; + return { + arithmeticTwap: isSet(object.arithmeticTwap) ? String(object.arithmeticTwap) : "" + }; }, toJSON(message: ArithmeticTwapToNowResponse): JsonSafe<ArithmeticTwapToNowResponse> { const obj: any = {}; @@ -597,8 +617,7 @@ export const ParamsRequest = { return message; }, fromJSON(_: any): ParamsRequest { - const obj = createBaseParamsRequest(); - return obj; + return {}; }, toJSON(_: ParamsRequest): JsonSafe<ParamsRequest> { const obj: any = {}; @@ -679,9 +698,9 @@ export const ParamsResponse = { return message; }, fromJSON(object: any): ParamsResponse { - const obj = createBaseParamsResponse(); - if (isSet(object.params)) obj.params = Params.fromJSON(object.params); - return obj; + return { + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined + }; }, toJSON(message: ParamsResponse): JsonSafe<ParamsResponse> { const obj: any = {}; @@ -690,9 +709,7 @@ export const ParamsResponse = { }, fromPartial(object: DeepPartial<ParamsResponse>): ParamsResponse { const message = createBaseParamsResponse(); - if (object.params !== undefined && object.params !== null) { - message.params = Params.fromPartial(object.params); - } + message.params = object.params !== undefined && object.params !== null ? Params.fromPartial(object.params) : undefined; return message; }, fromSDK(object: ParamsResponseSDKType): ParamsResponse { diff --git a/__fixtures__/v-next/outputv4/osmosis/twap/v1beta1/twap_record.ts b/__fixtures__/v-next/outputv4/osmosis/twap/v1beta1/twap_record.ts index bc693f691a..bd993cd0d9 100644 --- a/__fixtures__/v-next/outputv4/osmosis/twap/v1beta1/twap_record.ts +++ b/__fixtures__/v-next/outputv4/osmosis/twap/v1beta1/twap_record.ts @@ -1,8 +1,9 @@ -import { Timestamp, TimestampSDKType } from "../../../google/protobuf/timestamp.js"; -import { BinaryReader, BinaryWriter } from "../../../binary.js"; -import { toTimestamp, fromTimestamp, isSet, DeepPartial } from "../../../helpers.js"; +import { Timestamp, TimestampSDKType } from "../../../google/protobuf/timestamp"; +import { BinaryReader, BinaryWriter } from "../../../binary"; +import { toTimestamp, fromTimestamp, isSet, DeepPartial } from "../../../helpers"; import { Decimal } from "@cosmjs/math"; -import { JsonSafe } from "../../../json-safe.js"; +import { JsonSafe } from "../../../json-safe"; +import { ComputedRef } from "vue"; export const protobufPackage = "osmosis.twap.v1beta1"; /** * A TWAP record should be indexed in state by pool_id, (asset pair), timestamp @@ -41,6 +42,18 @@ export interface TwapRecord { */ lastErrorTime: Date; } +export interface ReactiveTwapRecord { + poolId: ComputedRef<bigint>; + asset0Denom: ComputedRef<string>; + asset1Denom: ComputedRef<string>; + height: ComputedRef<bigint>; + time: ComputedRef<Date>; + p0LastSpotPrice: ComputedRef<string>; + p1LastSpotPrice: ComputedRef<string>; + p0ArithmeticTwapAccumulator: ComputedRef<string>; + p1ArithmeticTwapAccumulator: ComputedRef<string>; + lastErrorTime: ComputedRef<Date>; +} export interface TwapRecordProtoMsg { typeUrl: "/osmosis.twap.v1beta1.TwapRecord"; value: Uint8Array; @@ -83,31 +96,31 @@ function createBaseTwapRecord(): TwapRecord { export const TwapRecord = { typeUrl: "/osmosis.twap.v1beta1.TwapRecord", encode(message: TwapRecord, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.poolId !== undefined) { + if (message.poolId !== BigInt(0)) { writer.uint32(8).uint64(message.poolId); } - if (message.asset0Denom !== undefined) { + if (message.asset0Denom !== "") { writer.uint32(18).string(message.asset0Denom); } - if (message.asset1Denom !== undefined) { + if (message.asset1Denom !== "") { writer.uint32(26).string(message.asset1Denom); } - if (message.height !== undefined) { + if (message.height !== BigInt(0)) { writer.uint32(32).int64(message.height); } if (message.time !== undefined) { Timestamp.encode(toTimestamp(message.time), writer.uint32(42).fork()).ldelim(); } - if (message.p0LastSpotPrice !== undefined) { + if (message.p0LastSpotPrice !== "") { writer.uint32(50).string(Decimal.fromUserInput(message.p0LastSpotPrice, 18).atomics); } - if (message.p1LastSpotPrice !== undefined) { + if (message.p1LastSpotPrice !== "") { writer.uint32(58).string(Decimal.fromUserInput(message.p1LastSpotPrice, 18).atomics); } - if (message.p0ArithmeticTwapAccumulator !== undefined) { + if (message.p0ArithmeticTwapAccumulator !== "") { writer.uint32(66).string(Decimal.fromUserInput(message.p0ArithmeticTwapAccumulator, 18).atomics); } - if (message.p1ArithmeticTwapAccumulator !== undefined) { + if (message.p1ArithmeticTwapAccumulator !== "") { writer.uint32(74).string(Decimal.fromUserInput(message.p1ArithmeticTwapAccumulator, 18).atomics); } if (message.lastErrorTime !== undefined) { @@ -160,18 +173,18 @@ export const TwapRecord = { return message; }, fromJSON(object: any): TwapRecord { - const obj = createBaseTwapRecord(); - if (isSet(object.poolId)) obj.poolId = BigInt(object.poolId.toString()); - if (isSet(object.asset0Denom)) obj.asset0Denom = String(object.asset0Denom); - if (isSet(object.asset1Denom)) obj.asset1Denom = String(object.asset1Denom); - if (isSet(object.height)) obj.height = BigInt(object.height.toString()); - if (isSet(object.time)) obj.time = new Date(object.time); - if (isSet(object.p0LastSpotPrice)) obj.p0LastSpotPrice = String(object.p0LastSpotPrice); - if (isSet(object.p1LastSpotPrice)) obj.p1LastSpotPrice = String(object.p1LastSpotPrice); - if (isSet(object.p0ArithmeticTwapAccumulator)) obj.p0ArithmeticTwapAccumulator = String(object.p0ArithmeticTwapAccumulator); - if (isSet(object.p1ArithmeticTwapAccumulator)) obj.p1ArithmeticTwapAccumulator = String(object.p1ArithmeticTwapAccumulator); - if (isSet(object.lastErrorTime)) obj.lastErrorTime = new Date(object.lastErrorTime); - return obj; + return { + poolId: isSet(object.poolId) ? BigInt(object.poolId.toString()) : BigInt(0), + asset0Denom: isSet(object.asset0Denom) ? String(object.asset0Denom) : "", + asset1Denom: isSet(object.asset1Denom) ? String(object.asset1Denom) : "", + height: isSet(object.height) ? BigInt(object.height.toString()) : BigInt(0), + time: isSet(object.time) ? new Date(object.time) : undefined, + p0LastSpotPrice: isSet(object.p0LastSpotPrice) ? String(object.p0LastSpotPrice) : "", + p1LastSpotPrice: isSet(object.p1LastSpotPrice) ? String(object.p1LastSpotPrice) : "", + p0ArithmeticTwapAccumulator: isSet(object.p0ArithmeticTwapAccumulator) ? String(object.p0ArithmeticTwapAccumulator) : "", + p1ArithmeticTwapAccumulator: isSet(object.p1ArithmeticTwapAccumulator) ? String(object.p1ArithmeticTwapAccumulator) : "", + lastErrorTime: isSet(object.lastErrorTime) ? new Date(object.lastErrorTime) : undefined + }; }, toJSON(message: TwapRecord): JsonSafe<TwapRecord> { const obj: any = {}; @@ -189,14 +202,10 @@ export const TwapRecord = { }, fromPartial(object: DeepPartial<TwapRecord>): TwapRecord { const message = createBaseTwapRecord(); - if (object.poolId !== undefined && object.poolId !== null) { - message.poolId = BigInt(object.poolId.toString()); - } + message.poolId = object.poolId !== undefined && object.poolId !== null ? BigInt(object.poolId.toString()) : BigInt(0); message.asset0Denom = object.asset0Denom ?? ""; message.asset1Denom = object.asset1Denom ?? ""; - if (object.height !== undefined && object.height !== null) { - message.height = BigInt(object.height.toString()); - } + message.height = object.height !== undefined && object.height !== null ? BigInt(object.height.toString()) : BigInt(0); message.time = object.time ?? undefined; message.p0LastSpotPrice = object.p0LastSpotPrice ?? ""; message.p1LastSpotPrice = object.p1LastSpotPrice ?? ""; diff --git a/__fixtures__/v-next/outputv4/osmosis/txfees/v1beta1/feetoken.ts b/__fixtures__/v-next/outputv4/osmosis/txfees/v1beta1/feetoken.ts index 5509fa86cb..e246e28477 100644 --- a/__fixtures__/v-next/outputv4/osmosis/txfees/v1beta1/feetoken.ts +++ b/__fixtures__/v-next/outputv4/osmosis/txfees/v1beta1/feetoken.ts @@ -1,6 +1,7 @@ -import { BinaryReader, BinaryWriter } from "../../../binary.js"; -import { isSet, DeepPartial } from "../../../helpers.js"; -import { JsonSafe } from "../../../json-safe.js"; +import { BinaryReader, BinaryWriter } from "../../../binary"; +import { isSet, DeepPartial } from "../../../helpers"; +import { JsonSafe } from "../../../json-safe"; +import { ComputedRef } from "vue"; export const protobufPackage = "osmosis.txfees.v1beta1"; /** * FeeToken is a struct that specifies a coin denom, and pool ID pair. @@ -12,6 +13,10 @@ export interface FeeToken { denom: string; poolID: bigint; } +export interface ReactiveFeeToken { + denom: ComputedRef<string>; + poolID: ComputedRef<bigint>; +} export interface FeeTokenProtoMsg { typeUrl: "/osmosis.txfees.v1beta1.FeeToken"; value: Uint8Array; @@ -35,10 +40,10 @@ function createBaseFeeToken(): FeeToken { export const FeeToken = { typeUrl: "/osmosis.txfees.v1beta1.FeeToken", encode(message: FeeToken, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.denom !== undefined) { + if (message.denom !== "") { writer.uint32(10).string(message.denom); } - if (message.poolID !== undefined) { + if (message.poolID !== BigInt(0)) { writer.uint32(16).uint64(message.poolID); } return writer; @@ -64,10 +69,10 @@ export const FeeToken = { return message; }, fromJSON(object: any): FeeToken { - const obj = createBaseFeeToken(); - if (isSet(object.denom)) obj.denom = String(object.denom); - if (isSet(object.poolID)) obj.poolID = BigInt(object.poolID.toString()); - return obj; + return { + denom: isSet(object.denom) ? String(object.denom) : "", + poolID: isSet(object.poolID) ? BigInt(object.poolID.toString()) : BigInt(0) + }; }, toJSON(message: FeeToken): JsonSafe<FeeToken> { const obj: any = {}; @@ -78,9 +83,7 @@ export const FeeToken = { fromPartial(object: DeepPartial<FeeToken>): FeeToken { const message = createBaseFeeToken(); message.denom = object.denom ?? ""; - if (object.poolID !== undefined && object.poolID !== null) { - message.poolID = BigInt(object.poolID.toString()); - } + message.poolID = object.poolID !== undefined && object.poolID !== null ? BigInt(object.poolID.toString()) : BigInt(0); return message; }, fromSDK(object: FeeTokenSDKType): FeeToken { diff --git a/__fixtures__/v-next/outputv4/osmosis/txfees/v1beta1/genesis.ts b/__fixtures__/v-next/outputv4/osmosis/txfees/v1beta1/genesis.ts index 782b75ef16..15979dfd4b 100644 --- a/__fixtures__/v-next/outputv4/osmosis/txfees/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputv4/osmosis/txfees/v1beta1/genesis.ts @@ -1,13 +1,18 @@ -import { FeeToken, FeeTokenSDKType } from "./feetoken.js"; -import { BinaryReader, BinaryWriter } from "../../../binary.js"; -import { isSet, DeepPartial } from "../../../helpers.js"; -import { JsonSafe } from "../../../json-safe.js"; +import { FeeToken, FeeTokenSDKType } from "./feetoken"; +import { BinaryReader, BinaryWriter } from "../../../binary"; +import { isSet, DeepPartial } from "../../../helpers"; +import { JsonSafe } from "../../../json-safe"; +import { ComputedRef } from "vue"; export const protobufPackage = "osmosis.txfees.v1beta1"; /** GenesisState defines the txfees module's genesis state. */ export interface GenesisState { basedenom: string; feetokens: FeeToken[]; } +export interface ReactiveGenesisState { + basedenom: ComputedRef<string>; + feetokens: ComputedRef<FeeToken[]>; +} export interface GenesisStateProtoMsg { typeUrl: "/osmosis.txfees.v1beta1.GenesisState"; value: Uint8Array; @@ -26,7 +31,7 @@ function createBaseGenesisState(): GenesisState { export const GenesisState = { typeUrl: "/osmosis.txfees.v1beta1.GenesisState", encode(message: GenesisState, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.basedenom !== undefined) { + if (message.basedenom !== "") { writer.uint32(10).string(message.basedenom); } for (const v of message.feetokens) { @@ -55,10 +60,10 @@ export const GenesisState = { return message; }, fromJSON(object: any): GenesisState { - const obj = createBaseGenesisState(); - if (isSet(object.basedenom)) obj.basedenom = String(object.basedenom); - if (Array.isArray(object?.feetokens)) obj.feetokens = object.feetokens.map((e: any) => FeeToken.fromJSON(e)); - return obj; + return { + basedenom: isSet(object.basedenom) ? String(object.basedenom) : "", + feetokens: Array.isArray(object?.feetokens) ? object.feetokens.map((e: any) => FeeToken.fromJSON(e)) : [] + }; }, toJSON(message: GenesisState): JsonSafe<GenesisState> { const obj: any = {}; diff --git a/__fixtures__/v-next/outputv4/osmosis/txfees/v1beta1/gov.ts b/__fixtures__/v-next/outputv4/osmosis/txfees/v1beta1/gov.ts index ca2a223271..2e32e93531 100644 --- a/__fixtures__/v-next/outputv4/osmosis/txfees/v1beta1/gov.ts +++ b/__fixtures__/v-next/outputv4/osmosis/txfees/v1beta1/gov.ts @@ -1,7 +1,8 @@ -import { FeeToken, FeeTokenSDKType } from "./feetoken.js"; -import { BinaryReader, BinaryWriter } from "../../../binary.js"; -import { isSet, DeepPartial } from "../../../helpers.js"; -import { JsonSafe } from "../../../json-safe.js"; +import { FeeToken, FeeTokenSDKType } from "./feetoken"; +import { BinaryReader, BinaryWriter } from "../../../binary"; +import { isSet, DeepPartial } from "../../../helpers"; +import { JsonSafe } from "../../../json-safe"; +import { ComputedRef } from "vue"; export const protobufPackage = "osmosis.txfees.v1beta1"; /** * UpdateFeeTokenProposal is a gov Content type for adding a new whitelisted fee @@ -15,6 +16,11 @@ export interface UpdateFeeTokenProposal { description: string; feetoken: FeeToken; } +export interface ReactiveUpdateFeeTokenProposal { + title: ComputedRef<string>; + description: ComputedRef<string>; + feetoken: ComputedRef<FeeToken>; +} export interface UpdateFeeTokenProposalProtoMsg { typeUrl: "/osmosis.txfees.v1beta1.UpdateFeeTokenProposal"; value: Uint8Array; @@ -41,10 +47,10 @@ function createBaseUpdateFeeTokenProposal(): UpdateFeeTokenProposal { export const UpdateFeeTokenProposal = { typeUrl: "/osmosis.txfees.v1beta1.UpdateFeeTokenProposal", encode(message: UpdateFeeTokenProposal, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.title !== undefined) { + if (message.title !== "") { writer.uint32(10).string(message.title); } - if (message.description !== undefined) { + if (message.description !== "") { writer.uint32(18).string(message.description); } if (message.feetoken !== undefined) { @@ -76,11 +82,11 @@ export const UpdateFeeTokenProposal = { return message; }, fromJSON(object: any): UpdateFeeTokenProposal { - const obj = createBaseUpdateFeeTokenProposal(); - if (isSet(object.title)) obj.title = String(object.title); - if (isSet(object.description)) obj.description = String(object.description); - if (isSet(object.feetoken)) obj.feetoken = FeeToken.fromJSON(object.feetoken); - return obj; + return { + title: isSet(object.title) ? String(object.title) : "", + description: isSet(object.description) ? String(object.description) : "", + feetoken: isSet(object.feetoken) ? FeeToken.fromJSON(object.feetoken) : undefined + }; }, toJSON(message: UpdateFeeTokenProposal): JsonSafe<UpdateFeeTokenProposal> { const obj: any = {}; @@ -93,9 +99,7 @@ export const UpdateFeeTokenProposal = { const message = createBaseUpdateFeeTokenProposal(); message.title = object.title ?? ""; message.description = object.description ?? ""; - if (object.feetoken !== undefined && object.feetoken !== null) { - message.feetoken = FeeToken.fromPartial(object.feetoken); - } + message.feetoken = object.feetoken !== undefined && object.feetoken !== null ? FeeToken.fromPartial(object.feetoken) : undefined; return message; }, fromSDK(object: UpdateFeeTokenProposalSDKType): UpdateFeeTokenProposal { diff --git a/__fixtures__/v-next/outputv4/osmosis/txfees/v1beta1/query.lcd.ts b/__fixtures__/v-next/outputv4/osmosis/txfees/v1beta1/query.lcd.ts index 9370c2b846..44c95575ce 100644 --- a/__fixtures__/v-next/outputv4/osmosis/txfees/v1beta1/query.lcd.ts +++ b/__fixtures__/v-next/outputv4/osmosis/txfees/v1beta1/query.lcd.ts @@ -1,6 +1,6 @@ -import { FeeToken, FeeTokenSDKType } from "./feetoken.js"; +import { FeeToken, FeeTokenSDKType } from "./feetoken"; import { LCDClient } from "@cosmology/lcd"; -import { QueryFeeTokensRequest, QueryFeeTokensRequestSDKType, QueryFeeTokensResponse, QueryFeeTokensResponseSDKType, QueryDenomSpotPriceRequest, QueryDenomSpotPriceRequestSDKType, QueryDenomSpotPriceResponse, QueryDenomSpotPriceResponseSDKType, QueryDenomPoolIdRequest, QueryDenomPoolIdRequestSDKType, QueryDenomPoolIdResponse, QueryDenomPoolIdResponseSDKType, QueryBaseDenomRequest, QueryBaseDenomRequestSDKType, QueryBaseDenomResponse, QueryBaseDenomResponseSDKType } from "./query.js"; +import { QueryFeeTokensRequest, QueryFeeTokensRequestSDKType, QueryFeeTokensResponse, QueryFeeTokensResponseSDKType, QueryDenomSpotPriceRequest, QueryDenomSpotPriceRequestSDKType, QueryDenomSpotPriceResponse, QueryDenomSpotPriceResponseSDKType, QueryDenomPoolIdRequest, QueryDenomPoolIdRequestSDKType, QueryDenomPoolIdResponse, QueryDenomPoolIdResponseSDKType, QueryBaseDenomRequest, QueryBaseDenomRequestSDKType, QueryBaseDenomResponse, QueryBaseDenomResponseSDKType } from "./query"; export class LCDQueryClient { req: LCDClient; constructor({ diff --git a/__fixtures__/v-next/outputv4/osmosis/txfees/v1beta1/query.rpc.Query.ts b/__fixtures__/v-next/outputv4/osmosis/txfees/v1beta1/query.rpc.Query.ts index 09178cb240..3630e9f84b 100644 --- a/__fixtures__/v-next/outputv4/osmosis/txfees/v1beta1/query.rpc.Query.ts +++ b/__fixtures__/v-next/outputv4/osmosis/txfees/v1beta1/query.rpc.Query.ts @@ -1,8 +1,8 @@ -import { FeeToken, FeeTokenSDKType } from "./feetoken.js"; -import { Rpc } from "../../../helpers.js"; -import { BinaryReader } from "../../../binary.js"; +import { FeeToken, FeeTokenSDKType } from "./feetoken"; +import { Rpc } from "../../../helpers"; +import { BinaryReader } from "../../../binary"; import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; -import { QueryFeeTokensRequest, QueryFeeTokensRequestSDKType, QueryFeeTokensResponse, QueryFeeTokensResponseSDKType, QueryDenomSpotPriceRequest, QueryDenomSpotPriceRequestSDKType, QueryDenomSpotPriceResponse, QueryDenomSpotPriceResponseSDKType, QueryDenomPoolIdRequest, QueryDenomPoolIdRequestSDKType, QueryDenomPoolIdResponse, QueryDenomPoolIdResponseSDKType, QueryBaseDenomRequest, QueryBaseDenomRequestSDKType, QueryBaseDenomResponse, QueryBaseDenomResponseSDKType } from "./query.js"; +import { QueryFeeTokensRequest, QueryFeeTokensRequestSDKType, QueryFeeTokensResponse, QueryFeeTokensResponseSDKType, QueryDenomSpotPriceRequest, QueryDenomSpotPriceRequestSDKType, QueryDenomSpotPriceResponse, QueryDenomSpotPriceResponseSDKType, QueryDenomPoolIdRequest, QueryDenomPoolIdRequestSDKType, QueryDenomPoolIdResponse, QueryDenomPoolIdResponseSDKType, QueryBaseDenomRequest, QueryBaseDenomRequestSDKType, QueryBaseDenomResponse, QueryBaseDenomResponseSDKType, ReactiveQueryFeeTokensRequest, ReactiveQueryDenomSpotPriceRequest, ReactiveQueryDenomPoolIdRequest, ReactiveQueryBaseDenomRequest } from "./query"; export interface Query { /** * FeeTokens returns a list of all the whitelisted fee tokens and their diff --git a/__fixtures__/v-next/outputv4/osmosis/txfees/v1beta1/query.ts b/__fixtures__/v-next/outputv4/osmosis/txfees/v1beta1/query.ts index 43461001a6..1bd597f682 100644 --- a/__fixtures__/v-next/outputv4/osmosis/txfees/v1beta1/query.ts +++ b/__fixtures__/v-next/outputv4/osmosis/txfees/v1beta1/query.ts @@ -1,10 +1,12 @@ -import { FeeToken, FeeTokenSDKType } from "./feetoken.js"; -import { BinaryReader, BinaryWriter } from "../../../binary.js"; -import { JsonSafe } from "../../../json-safe.js"; -import { DeepPartial, isSet } from "../../../helpers.js"; +import { FeeToken, FeeTokenSDKType } from "./feetoken"; +import { BinaryReader, BinaryWriter } from "../../../binary"; +import { JsonSafe } from "../../../json-safe"; +import { DeepPartial, isSet } from "../../../helpers"; import { Decimal } from "@cosmjs/math"; +import { ComputedRef } from "vue"; export const protobufPackage = "osmosis.txfees.v1beta1"; export interface QueryFeeTokensRequest {} +export interface ReactiveQueryFeeTokensRequest {} export interface QueryFeeTokensRequestProtoMsg { typeUrl: "/osmosis.txfees.v1beta1.QueryFeeTokensRequest"; value: Uint8Array; @@ -13,6 +15,9 @@ export interface QueryFeeTokensRequestSDKType {} export interface QueryFeeTokensResponse { feeTokens: FeeToken[]; } +export interface ReactiveQueryFeeTokensResponse { + feeTokens: ComputedRef<FeeToken[]>; +} export interface QueryFeeTokensResponseProtoMsg { typeUrl: "/osmosis.txfees.v1beta1.QueryFeeTokensResponse"; value: Uint8Array; @@ -27,6 +32,9 @@ export interface QueryFeeTokensResponseSDKType { export interface QueryDenomSpotPriceRequest { denom: string; } +export interface ReactiveQueryDenomSpotPriceRequest { + denom: ComputedRef<string>; +} export interface QueryDenomSpotPriceRequestProtoMsg { typeUrl: "/osmosis.txfees.v1beta1.QueryDenomSpotPriceRequest"; value: Uint8Array; @@ -46,6 +54,10 @@ export interface QueryDenomSpotPriceResponse { poolID: bigint; spotPrice: string; } +export interface ReactiveQueryDenomSpotPriceResponse { + poolID: ComputedRef<bigint>; + spotPrice: ComputedRef<string>; +} export interface QueryDenomSpotPriceResponseProtoMsg { typeUrl: "/osmosis.txfees.v1beta1.QueryDenomSpotPriceResponse"; value: Uint8Array; @@ -61,6 +73,9 @@ export interface QueryDenomSpotPriceResponseSDKType { export interface QueryDenomPoolIdRequest { denom: string; } +export interface ReactiveQueryDenomPoolIdRequest { + denom: ComputedRef<string>; +} export interface QueryDenomPoolIdRequestProtoMsg { typeUrl: "/osmosis.txfees.v1beta1.QueryDenomPoolIdRequest"; value: Uint8Array; @@ -71,6 +86,9 @@ export interface QueryDenomPoolIdRequestSDKType { export interface QueryDenomPoolIdResponse { poolID: bigint; } +export interface ReactiveQueryDenomPoolIdResponse { + poolID: ComputedRef<bigint>; +} export interface QueryDenomPoolIdResponseProtoMsg { typeUrl: "/osmosis.txfees.v1beta1.QueryDenomPoolIdResponse"; value: Uint8Array; @@ -79,6 +97,7 @@ export interface QueryDenomPoolIdResponseSDKType { poolID: bigint; } export interface QueryBaseDenomRequest {} +export interface ReactiveQueryBaseDenomRequest {} export interface QueryBaseDenomRequestProtoMsg { typeUrl: "/osmosis.txfees.v1beta1.QueryBaseDenomRequest"; value: Uint8Array; @@ -87,6 +106,9 @@ export interface QueryBaseDenomRequestSDKType {} export interface QueryBaseDenomResponse { baseDenom: string; } +export interface ReactiveQueryBaseDenomResponse { + baseDenom: ComputedRef<string>; +} export interface QueryBaseDenomResponseProtoMsg { typeUrl: "/osmosis.txfees.v1beta1.QueryBaseDenomResponse"; value: Uint8Array; @@ -117,8 +139,7 @@ export const QueryFeeTokensRequest = { return message; }, fromJSON(_: any): QueryFeeTokensRequest { - const obj = createBaseQueryFeeTokensRequest(); - return obj; + return {}; }, toJSON(_: QueryFeeTokensRequest): JsonSafe<QueryFeeTokensRequest> { const obj: any = {}; @@ -199,9 +220,9 @@ export const QueryFeeTokensResponse = { return message; }, fromJSON(object: any): QueryFeeTokensResponse { - const obj = createBaseQueryFeeTokensResponse(); - if (Array.isArray(object?.feeTokens)) obj.feeTokens = object.feeTokens.map((e: any) => FeeToken.fromJSON(e)); - return obj; + return { + feeTokens: Array.isArray(object?.feeTokens) ? object.feeTokens.map((e: any) => FeeToken.fromJSON(e)) : [] + }; }, toJSON(message: QueryFeeTokensResponse): JsonSafe<QueryFeeTokensResponse> { const obj: any = {}; @@ -280,7 +301,7 @@ function createBaseQueryDenomSpotPriceRequest(): QueryDenomSpotPriceRequest { export const QueryDenomSpotPriceRequest = { typeUrl: "/osmosis.txfees.v1beta1.QueryDenomSpotPriceRequest", encode(message: QueryDenomSpotPriceRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.denom !== undefined) { + if (message.denom !== "") { writer.uint32(10).string(message.denom); } return writer; @@ -303,9 +324,9 @@ export const QueryDenomSpotPriceRequest = { return message; }, fromJSON(object: any): QueryDenomSpotPriceRequest { - const obj = createBaseQueryDenomSpotPriceRequest(); - if (isSet(object.denom)) obj.denom = String(object.denom); - return obj; + return { + denom: isSet(object.denom) ? String(object.denom) : "" + }; }, toJSON(message: QueryDenomSpotPriceRequest): JsonSafe<QueryDenomSpotPriceRequest> { const obj: any = {}; @@ -375,10 +396,10 @@ function createBaseQueryDenomSpotPriceResponse(): QueryDenomSpotPriceResponse { export const QueryDenomSpotPriceResponse = { typeUrl: "/osmosis.txfees.v1beta1.QueryDenomSpotPriceResponse", encode(message: QueryDenomSpotPriceResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.poolID !== undefined) { + if (message.poolID !== BigInt(0)) { writer.uint32(8).uint64(message.poolID); } - if (message.spotPrice !== undefined) { + if (message.spotPrice !== "") { writer.uint32(18).string(Decimal.fromUserInput(message.spotPrice, 18).atomics); } return writer; @@ -404,10 +425,10 @@ export const QueryDenomSpotPriceResponse = { return message; }, fromJSON(object: any): QueryDenomSpotPriceResponse { - const obj = createBaseQueryDenomSpotPriceResponse(); - if (isSet(object.poolID)) obj.poolID = BigInt(object.poolID.toString()); - if (isSet(object.spotPrice)) obj.spotPrice = String(object.spotPrice); - return obj; + return { + poolID: isSet(object.poolID) ? BigInt(object.poolID.toString()) : BigInt(0), + spotPrice: isSet(object.spotPrice) ? String(object.spotPrice) : "" + }; }, toJSON(message: QueryDenomSpotPriceResponse): JsonSafe<QueryDenomSpotPriceResponse> { const obj: any = {}; @@ -417,9 +438,7 @@ export const QueryDenomSpotPriceResponse = { }, fromPartial(object: DeepPartial<QueryDenomSpotPriceResponse>): QueryDenomSpotPriceResponse { const message = createBaseQueryDenomSpotPriceResponse(); - if (object.poolID !== undefined && object.poolID !== null) { - message.poolID = BigInt(object.poolID.toString()); - } + message.poolID = object.poolID !== undefined && object.poolID !== null ? BigInt(object.poolID.toString()) : BigInt(0); message.spotPrice = object.spotPrice ?? ""; return message; }, @@ -487,7 +506,7 @@ function createBaseQueryDenomPoolIdRequest(): QueryDenomPoolIdRequest { export const QueryDenomPoolIdRequest = { typeUrl: "/osmosis.txfees.v1beta1.QueryDenomPoolIdRequest", encode(message: QueryDenomPoolIdRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.denom !== undefined) { + if (message.denom !== "") { writer.uint32(10).string(message.denom); } return writer; @@ -510,9 +529,9 @@ export const QueryDenomPoolIdRequest = { return message; }, fromJSON(object: any): QueryDenomPoolIdRequest { - const obj = createBaseQueryDenomPoolIdRequest(); - if (isSet(object.denom)) obj.denom = String(object.denom); - return obj; + return { + denom: isSet(object.denom) ? String(object.denom) : "" + }; }, toJSON(message: QueryDenomPoolIdRequest): JsonSafe<QueryDenomPoolIdRequest> { const obj: any = {}; @@ -581,7 +600,7 @@ function createBaseQueryDenomPoolIdResponse(): QueryDenomPoolIdResponse { export const QueryDenomPoolIdResponse = { typeUrl: "/osmosis.txfees.v1beta1.QueryDenomPoolIdResponse", encode(message: QueryDenomPoolIdResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.poolID !== undefined) { + if (message.poolID !== BigInt(0)) { writer.uint32(8).uint64(message.poolID); } return writer; @@ -604,9 +623,9 @@ export const QueryDenomPoolIdResponse = { return message; }, fromJSON(object: any): QueryDenomPoolIdResponse { - const obj = createBaseQueryDenomPoolIdResponse(); - if (isSet(object.poolID)) obj.poolID = BigInt(object.poolID.toString()); - return obj; + return { + poolID: isSet(object.poolID) ? BigInt(object.poolID.toString()) : BigInt(0) + }; }, toJSON(message: QueryDenomPoolIdResponse): JsonSafe<QueryDenomPoolIdResponse> { const obj: any = {}; @@ -615,9 +634,7 @@ export const QueryDenomPoolIdResponse = { }, fromPartial(object: DeepPartial<QueryDenomPoolIdResponse>): QueryDenomPoolIdResponse { const message = createBaseQueryDenomPoolIdResponse(); - if (object.poolID !== undefined && object.poolID !== null) { - message.poolID = BigInt(object.poolID.toString()); - } + message.poolID = object.poolID !== undefined && object.poolID !== null ? BigInt(object.poolID.toString()) : BigInt(0); return message; }, fromSDK(object: QueryDenomPoolIdResponseSDKType): QueryDenomPoolIdResponse { @@ -692,8 +709,7 @@ export const QueryBaseDenomRequest = { return message; }, fromJSON(_: any): QueryBaseDenomRequest { - const obj = createBaseQueryBaseDenomRequest(); - return obj; + return {}; }, toJSON(_: QueryBaseDenomRequest): JsonSafe<QueryBaseDenomRequest> { const obj: any = {}; @@ -751,7 +767,7 @@ function createBaseQueryBaseDenomResponse(): QueryBaseDenomResponse { export const QueryBaseDenomResponse = { typeUrl: "/osmosis.txfees.v1beta1.QueryBaseDenomResponse", encode(message: QueryBaseDenomResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.baseDenom !== undefined) { + if (message.baseDenom !== "") { writer.uint32(10).string(message.baseDenom); } return writer; @@ -774,9 +790,9 @@ export const QueryBaseDenomResponse = { return message; }, fromJSON(object: any): QueryBaseDenomResponse { - const obj = createBaseQueryBaseDenomResponse(); - if (isSet(object.baseDenom)) obj.baseDenom = String(object.baseDenom); - return obj; + return { + baseDenom: isSet(object.baseDenom) ? String(object.baseDenom) : "" + }; }, toJSON(message: QueryBaseDenomResponse): JsonSafe<QueryBaseDenomResponse> { const obj: any = {}; diff --git a/__fixtures__/v-next/outputv4/tendermint/abci/types.rpc.ABCIApplication.ts b/__fixtures__/v-next/outputv4/tendermint/abci/types.rpc.ABCIApplication.ts index 2b7a017033..623b0f2fcb 100644 --- a/__fixtures__/v-next/outputv4/tendermint/abci/types.rpc.ABCIApplication.ts +++ b/__fixtures__/v-next/outputv4/tendermint/abci/types.rpc.ABCIApplication.ts @@ -1,12 +1,12 @@ -import { Timestamp, TimestampSDKType } from "../../google/protobuf/timestamp.js"; -import { Header, HeaderSDKType } from "../types/types.js"; -import { ProofOps, ProofOpsSDKType } from "../crypto/proof.js"; -import { EvidenceParams, EvidenceParamsSDKType, ValidatorParams, ValidatorParamsSDKType, VersionParams, VersionParamsSDKType } from "../types/params.js"; -import { PublicKey, PublicKeySDKType } from "../crypto/keys.js"; -import { Rpc } from "../../helpers.js"; -import { BinaryReader } from "../../binary.js"; +import { Timestamp, TimestampSDKType } from "../../google/protobuf/timestamp"; +import { Header, HeaderSDKType } from "../types/types"; +import { ProofOps, ProofOpsSDKType } from "../crypto/proof"; +import { EvidenceParams, EvidenceParamsSDKType, ValidatorParams, ValidatorParamsSDKType, VersionParams, VersionParamsSDKType } from "../types/params"; +import { PublicKey, PublicKeySDKType } from "../crypto/keys"; +import { Rpc } from "../../helpers"; +import { BinaryReader } from "../../binary"; import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; -import { RequestEcho, RequestEchoSDKType, ResponseEcho, ResponseEchoSDKType, RequestFlush, RequestFlushSDKType, ResponseFlush, ResponseFlushSDKType, RequestInfo, RequestInfoSDKType, ResponseInfo, ResponseInfoSDKType, RequestSetOption, RequestSetOptionSDKType, ResponseSetOption, ResponseSetOptionSDKType, RequestDeliverTx, RequestDeliverTxSDKType, ResponseDeliverTx, ResponseDeliverTxSDKType, RequestCheckTx, RequestCheckTxSDKType, ResponseCheckTx, ResponseCheckTxSDKType, RequestQuery, RequestQuerySDKType, ResponseQuery, ResponseQuerySDKType, RequestCommit, RequestCommitSDKType, ResponseCommit, ResponseCommitSDKType, RequestInitChain, RequestInitChainSDKType, ResponseInitChain, ResponseInitChainSDKType, RequestBeginBlock, RequestBeginBlockSDKType, ResponseBeginBlock, ResponseBeginBlockSDKType, RequestEndBlock, RequestEndBlockSDKType, ResponseEndBlock, ResponseEndBlockSDKType, RequestListSnapshots, RequestListSnapshotsSDKType, ResponseListSnapshots, ResponseListSnapshotsSDKType, RequestOfferSnapshot, RequestOfferSnapshotSDKType, ResponseOfferSnapshot, ResponseOfferSnapshotSDKType, RequestLoadSnapshotChunk, RequestLoadSnapshotChunkSDKType, ResponseLoadSnapshotChunk, ResponseLoadSnapshotChunkSDKType, RequestApplySnapshotChunk, RequestApplySnapshotChunkSDKType, ResponseApplySnapshotChunk, ResponseApplySnapshotChunkSDKType } from "./types.js"; +import { RequestEcho, RequestEchoSDKType, ResponseEcho, ResponseEchoSDKType, RequestFlush, RequestFlushSDKType, ResponseFlush, ResponseFlushSDKType, RequestInfo, RequestInfoSDKType, ResponseInfo, ResponseInfoSDKType, RequestSetOption, RequestSetOptionSDKType, ResponseSetOption, ResponseSetOptionSDKType, RequestDeliverTx, RequestDeliverTxSDKType, ResponseDeliverTx, ResponseDeliverTxSDKType, RequestCheckTx, RequestCheckTxSDKType, ResponseCheckTx, ResponseCheckTxSDKType, RequestQuery, RequestQuerySDKType, ResponseQuery, ResponseQuerySDKType, RequestCommit, RequestCommitSDKType, ResponseCommit, ResponseCommitSDKType, RequestInitChain, RequestInitChainSDKType, ResponseInitChain, ResponseInitChainSDKType, RequestBeginBlock, RequestBeginBlockSDKType, ResponseBeginBlock, ResponseBeginBlockSDKType, RequestEndBlock, RequestEndBlockSDKType, ResponseEndBlock, ResponseEndBlockSDKType, RequestListSnapshots, RequestListSnapshotsSDKType, ResponseListSnapshots, ResponseListSnapshotsSDKType, RequestOfferSnapshot, RequestOfferSnapshotSDKType, ResponseOfferSnapshot, ResponseOfferSnapshotSDKType, RequestLoadSnapshotChunk, RequestLoadSnapshotChunkSDKType, ResponseLoadSnapshotChunk, ResponseLoadSnapshotChunkSDKType, RequestApplySnapshotChunk, RequestApplySnapshotChunkSDKType, ResponseApplySnapshotChunk, ResponseApplySnapshotChunkSDKType } from "./types"; export interface ABCIApplication { echo(request: RequestEcho): Promise<ResponseEcho>; flush(request?: RequestFlush): Promise<ResponseFlush>; diff --git a/__fixtures__/v-next/outputv4/tendermint/abci/types.ts b/__fixtures__/v-next/outputv4/tendermint/abci/types.ts index 05cea2ecc6..4056cfaac1 100644 --- a/__fixtures__/v-next/outputv4/tendermint/abci/types.ts +++ b/__fixtures__/v-next/outputv4/tendermint/abci/types.ts @@ -1,11 +1,12 @@ -import { Timestamp, TimestampSDKType } from "../../google/protobuf/timestamp.js"; -import { Header, HeaderSDKType } from "../types/types.js"; -import { ProofOps, ProofOpsSDKType } from "../crypto/proof.js"; -import { EvidenceParams, EvidenceParamsSDKType, ValidatorParams, ValidatorParamsSDKType, VersionParams, VersionParamsSDKType } from "../types/params.js"; -import { PublicKey, PublicKeySDKType } from "../crypto/keys.js"; -import { BinaryReader, BinaryWriter } from "../../binary.js"; -import { isSet, DeepPartial, toTimestamp, fromTimestamp, bytesFromBase64, base64FromBytes } from "../../helpers.js"; -import { JsonSafe } from "../../json-safe.js"; +import { Timestamp, TimestampSDKType } from "../../google/protobuf/timestamp"; +import { Header, HeaderSDKType } from "../types/types"; +import { ProofOps, ProofOpsSDKType } from "../crypto/proof"; +import { EvidenceParams, EvidenceParamsSDKType, ValidatorParams, ValidatorParamsSDKType, VersionParams, VersionParamsSDKType } from "../types/params"; +import { PublicKey, PublicKeySDKType } from "../crypto/keys"; +import { BinaryReader, BinaryWriter } from "../../binary"; +import { isSet, DeepPartial, toTimestamp, fromTimestamp, bytesFromBase64, base64FromBytes } from "../../helpers"; +import { JsonSafe } from "../../json-safe"; +import { ComputedRef } from "vue"; export const protobufPackage = "tendermint.abci"; export enum CheckTxType { NEW = 0, @@ -214,6 +215,23 @@ export interface Request { loadSnapshotChunk?: RequestLoadSnapshotChunk; applySnapshotChunk?: RequestApplySnapshotChunk; } +export interface ReactiveRequest { + echo?: ComputedRef<RequestEcho>; + flush?: ComputedRef<RequestFlush>; + info?: ComputedRef<RequestInfo>; + setOption?: ComputedRef<RequestSetOption>; + initChain?: ComputedRef<RequestInitChain>; + query?: ComputedRef<RequestQuery>; + beginBlock?: ComputedRef<RequestBeginBlock>; + checkTx?: ComputedRef<RequestCheckTx>; + deliverTx?: ComputedRef<RequestDeliverTx>; + endBlock?: ComputedRef<RequestEndBlock>; + commit?: ComputedRef<RequestCommit>; + listSnapshots?: ComputedRef<RequestListSnapshots>; + offerSnapshot?: ComputedRef<RequestOfferSnapshot>; + loadSnapshotChunk?: ComputedRef<RequestLoadSnapshotChunk>; + applySnapshotChunk?: ComputedRef<RequestApplySnapshotChunk>; +} export interface RequestProtoMsg { typeUrl: "/tendermint.abci.Request"; value: Uint8Array; @@ -238,6 +256,9 @@ export interface RequestSDKType { export interface RequestEcho { message: string; } +export interface ReactiveRequestEcho { + message: ComputedRef<string>; +} export interface RequestEchoProtoMsg { typeUrl: "/tendermint.abci.RequestEcho"; value: Uint8Array; @@ -246,6 +267,7 @@ export interface RequestEchoSDKType { message: string; } export interface RequestFlush {} +export interface ReactiveRequestFlush {} export interface RequestFlushProtoMsg { typeUrl: "/tendermint.abci.RequestFlush"; value: Uint8Array; @@ -256,6 +278,11 @@ export interface RequestInfo { blockVersion: bigint; p2pVersion: bigint; } +export interface ReactiveRequestInfo { + version: ComputedRef<string>; + blockVersion: ComputedRef<bigint>; + p2pVersion: ComputedRef<bigint>; +} export interface RequestInfoProtoMsg { typeUrl: "/tendermint.abci.RequestInfo"; value: Uint8Array; @@ -270,6 +297,10 @@ export interface RequestSetOption { key: string; value: string; } +export interface ReactiveRequestSetOption { + key: ComputedRef<string>; + value: ComputedRef<string>; +} export interface RequestSetOptionProtoMsg { typeUrl: "/tendermint.abci.RequestSetOption"; value: Uint8Array; @@ -287,6 +318,14 @@ export interface RequestInitChain { appStateBytes: Uint8Array; initialHeight: bigint; } +export interface ReactiveRequestInitChain { + time: ComputedRef<Date>; + chainId: ComputedRef<string>; + consensusParams?: ComputedRef<ConsensusParams>; + validators: ComputedRef<ValidatorUpdate[]>; + appStateBytes: ComputedRef<Uint8Array>; + initialHeight: ComputedRef<bigint>; +} export interface RequestInitChainProtoMsg { typeUrl: "/tendermint.abci.RequestInitChain"; value: Uint8Array; @@ -305,6 +344,12 @@ export interface RequestQuery { height: bigint; prove: boolean; } +export interface ReactiveRequestQuery { + data: ComputedRef<Uint8Array>; + path: ComputedRef<string>; + height: ComputedRef<bigint>; + prove: ComputedRef<boolean>; +} export interface RequestQueryProtoMsg { typeUrl: "/tendermint.abci.RequestQuery"; value: Uint8Array; @@ -321,6 +366,12 @@ export interface RequestBeginBlock { lastCommitInfo: LastCommitInfo; byzantineValidators: Evidence[]; } +export interface ReactiveRequestBeginBlock { + hash: ComputedRef<Uint8Array>; + header: ComputedRef<Header>; + lastCommitInfo: ComputedRef<LastCommitInfo>; + byzantineValidators: ComputedRef<Evidence[]>; +} export interface RequestBeginBlockProtoMsg { typeUrl: "/tendermint.abci.RequestBeginBlock"; value: Uint8Array; @@ -335,6 +386,10 @@ export interface RequestCheckTx { tx: Uint8Array; type: CheckTxType; } +export interface ReactiveRequestCheckTx { + tx: ComputedRef<Uint8Array>; + type: ComputedRef<CheckTxType>; +} export interface RequestCheckTxProtoMsg { typeUrl: "/tendermint.abci.RequestCheckTx"; value: Uint8Array; @@ -346,6 +401,9 @@ export interface RequestCheckTxSDKType { export interface RequestDeliverTx { tx: Uint8Array; } +export interface ReactiveRequestDeliverTx { + tx: ComputedRef<Uint8Array>; +} export interface RequestDeliverTxProtoMsg { typeUrl: "/tendermint.abci.RequestDeliverTx"; value: Uint8Array; @@ -356,6 +414,9 @@ export interface RequestDeliverTxSDKType { export interface RequestEndBlock { height: bigint; } +export interface ReactiveRequestEndBlock { + height: ComputedRef<bigint>; +} export interface RequestEndBlockProtoMsg { typeUrl: "/tendermint.abci.RequestEndBlock"; value: Uint8Array; @@ -364,6 +425,7 @@ export interface RequestEndBlockSDKType { height: bigint; } export interface RequestCommit {} +export interface ReactiveRequestCommit {} export interface RequestCommitProtoMsg { typeUrl: "/tendermint.abci.RequestCommit"; value: Uint8Array; @@ -371,6 +433,7 @@ export interface RequestCommitProtoMsg { export interface RequestCommitSDKType {} /** lists available snapshots */ export interface RequestListSnapshots {} +export interface ReactiveRequestListSnapshots {} export interface RequestListSnapshotsProtoMsg { typeUrl: "/tendermint.abci.RequestListSnapshots"; value: Uint8Array; @@ -384,6 +447,10 @@ export interface RequestOfferSnapshot { /** light client-verified app hash for snapshot height */ appHash: Uint8Array; } +export interface ReactiveRequestOfferSnapshot { + snapshot?: ComputedRef<Snapshot>; + appHash: ComputedRef<Uint8Array>; +} export interface RequestOfferSnapshotProtoMsg { typeUrl: "/tendermint.abci.RequestOfferSnapshot"; value: Uint8Array; @@ -399,6 +466,11 @@ export interface RequestLoadSnapshotChunk { format: number; chunk: number; } +export interface ReactiveRequestLoadSnapshotChunk { + height: ComputedRef<bigint>; + format: ComputedRef<number>; + chunk: ComputedRef<number>; +} export interface RequestLoadSnapshotChunkProtoMsg { typeUrl: "/tendermint.abci.RequestLoadSnapshotChunk"; value: Uint8Array; @@ -415,6 +487,11 @@ export interface RequestApplySnapshotChunk { chunk: Uint8Array; sender: string; } +export interface ReactiveRequestApplySnapshotChunk { + index: ComputedRef<number>; + chunk: ComputedRef<Uint8Array>; + sender: ComputedRef<string>; +} export interface RequestApplySnapshotChunkProtoMsg { typeUrl: "/tendermint.abci.RequestApplySnapshotChunk"; value: Uint8Array; @@ -443,6 +520,24 @@ export interface Response { loadSnapshotChunk?: ResponseLoadSnapshotChunk; applySnapshotChunk?: ResponseApplySnapshotChunk; } +export interface ReactiveResponse { + exception?: ComputedRef<ResponseException>; + echo?: ComputedRef<ResponseEcho>; + flush?: ComputedRef<ResponseFlush>; + info?: ComputedRef<ResponseInfo>; + setOption?: ComputedRef<ResponseSetOption>; + initChain?: ComputedRef<ResponseInitChain>; + query?: ComputedRef<ResponseQuery>; + beginBlock?: ComputedRef<ResponseBeginBlock>; + checkTx?: ComputedRef<ResponseCheckTx>; + deliverTx?: ComputedRef<ResponseDeliverTx>; + endBlock?: ComputedRef<ResponseEndBlock>; + commit?: ComputedRef<ResponseCommit>; + listSnapshots?: ComputedRef<ResponseListSnapshots>; + offerSnapshot?: ComputedRef<ResponseOfferSnapshot>; + loadSnapshotChunk?: ComputedRef<ResponseLoadSnapshotChunk>; + applySnapshotChunk?: ComputedRef<ResponseApplySnapshotChunk>; +} export interface ResponseProtoMsg { typeUrl: "/tendermint.abci.Response"; value: Uint8Array; @@ -469,6 +564,9 @@ export interface ResponseSDKType { export interface ResponseException { error: string; } +export interface ReactiveResponseException { + error: ComputedRef<string>; +} export interface ResponseExceptionProtoMsg { typeUrl: "/tendermint.abci.ResponseException"; value: Uint8Array; @@ -480,6 +578,9 @@ export interface ResponseExceptionSDKType { export interface ResponseEcho { message: string; } +export interface ReactiveResponseEcho { + message: ComputedRef<string>; +} export interface ResponseEchoProtoMsg { typeUrl: "/tendermint.abci.ResponseEcho"; value: Uint8Array; @@ -488,6 +589,7 @@ export interface ResponseEchoSDKType { message: string; } export interface ResponseFlush {} +export interface ReactiveResponseFlush {} export interface ResponseFlushProtoMsg { typeUrl: "/tendermint.abci.ResponseFlush"; value: Uint8Array; @@ -500,6 +602,13 @@ export interface ResponseInfo { lastBlockHeight: bigint; lastBlockAppHash: Uint8Array; } +export interface ReactiveResponseInfo { + data: ComputedRef<string>; + version: ComputedRef<string>; + appVersion: ComputedRef<bigint>; + lastBlockHeight: ComputedRef<bigint>; + lastBlockAppHash: ComputedRef<Uint8Array>; +} export interface ResponseInfoProtoMsg { typeUrl: "/tendermint.abci.ResponseInfo"; value: Uint8Array; @@ -518,6 +627,11 @@ export interface ResponseSetOption { log: string; info: string; } +export interface ReactiveResponseSetOption { + code: ComputedRef<number>; + log: ComputedRef<string>; + info: ComputedRef<string>; +} export interface ResponseSetOptionProtoMsg { typeUrl: "/tendermint.abci.ResponseSetOption"; value: Uint8Array; @@ -533,6 +647,11 @@ export interface ResponseInitChain { validators: ValidatorUpdate[]; appHash: Uint8Array; } +export interface ReactiveResponseInitChain { + consensusParams?: ComputedRef<ConsensusParams>; + validators: ComputedRef<ValidatorUpdate[]>; + appHash: ComputedRef<Uint8Array>; +} export interface ResponseInitChainProtoMsg { typeUrl: "/tendermint.abci.ResponseInitChain"; value: Uint8Array; @@ -555,6 +674,17 @@ export interface ResponseQuery { height: bigint; codespace: string; } +export interface ReactiveResponseQuery { + code: ComputedRef<number>; + log: ComputedRef<string>; + info: ComputedRef<string>; + index: ComputedRef<bigint>; + key: ComputedRef<Uint8Array>; + value: ComputedRef<Uint8Array>; + proofOps?: ComputedRef<ProofOps>; + height: ComputedRef<bigint>; + codespace: ComputedRef<string>; +} export interface ResponseQueryProtoMsg { typeUrl: "/tendermint.abci.ResponseQuery"; value: Uint8Array; @@ -573,6 +703,9 @@ export interface ResponseQuerySDKType { export interface ResponseBeginBlock { events: Event[]; } +export interface ReactiveResponseBeginBlock { + events: ComputedRef<Event[]>; +} export interface ResponseBeginBlockProtoMsg { typeUrl: "/tendermint.abci.ResponseBeginBlock"; value: Uint8Array; @@ -592,6 +725,16 @@ export interface ResponseCheckTx { events: Event[]; codespace: string; } +export interface ReactiveResponseCheckTx { + code: ComputedRef<number>; + data: ComputedRef<Uint8Array>; + log: ComputedRef<string>; + info: ComputedRef<string>; + gasWanted: ComputedRef<bigint>; + gasUsed: ComputedRef<bigint>; + events: ComputedRef<Event[]>; + codespace: ComputedRef<string>; +} export interface ResponseCheckTxProtoMsg { typeUrl: "/tendermint.abci.ResponseCheckTx"; value: Uint8Array; @@ -618,6 +761,16 @@ export interface ResponseDeliverTx { events: Event[]; codespace: string; } +export interface ReactiveResponseDeliverTx { + code: ComputedRef<number>; + data: ComputedRef<Uint8Array>; + log: ComputedRef<string>; + info: ComputedRef<string>; + gasWanted: ComputedRef<bigint>; + gasUsed: ComputedRef<bigint>; + events: ComputedRef<Event[]>; + codespace: ComputedRef<string>; +} export interface ResponseDeliverTxProtoMsg { typeUrl: "/tendermint.abci.ResponseDeliverTx"; value: Uint8Array; @@ -637,6 +790,11 @@ export interface ResponseEndBlock { consensusParamUpdates?: ConsensusParams; events: Event[]; } +export interface ReactiveResponseEndBlock { + validatorUpdates: ComputedRef<ValidatorUpdate[]>; + consensusParamUpdates?: ComputedRef<ConsensusParams>; + events: ComputedRef<Event[]>; +} export interface ResponseEndBlockProtoMsg { typeUrl: "/tendermint.abci.ResponseEndBlock"; value: Uint8Array; @@ -651,6 +809,10 @@ export interface ResponseCommit { data: Uint8Array; retainHeight: bigint; } +export interface ReactiveResponseCommit { + data: ComputedRef<Uint8Array>; + retainHeight: ComputedRef<bigint>; +} export interface ResponseCommitProtoMsg { typeUrl: "/tendermint.abci.ResponseCommit"; value: Uint8Array; @@ -662,6 +824,9 @@ export interface ResponseCommitSDKType { export interface ResponseListSnapshots { snapshots: Snapshot[]; } +export interface ReactiveResponseListSnapshots { + snapshots: ComputedRef<Snapshot[]>; +} export interface ResponseListSnapshotsProtoMsg { typeUrl: "/tendermint.abci.ResponseListSnapshots"; value: Uint8Array; @@ -672,6 +837,9 @@ export interface ResponseListSnapshotsSDKType { export interface ResponseOfferSnapshot { result: ResponseOfferSnapshot_Result; } +export interface ReactiveResponseOfferSnapshot { + result: ComputedRef<ResponseOfferSnapshot_Result>; +} export interface ResponseOfferSnapshotProtoMsg { typeUrl: "/tendermint.abci.ResponseOfferSnapshot"; value: Uint8Array; @@ -682,6 +850,9 @@ export interface ResponseOfferSnapshotSDKType { export interface ResponseLoadSnapshotChunk { chunk: Uint8Array; } +export interface ReactiveResponseLoadSnapshotChunk { + chunk: ComputedRef<Uint8Array>; +} export interface ResponseLoadSnapshotChunkProtoMsg { typeUrl: "/tendermint.abci.ResponseLoadSnapshotChunk"; value: Uint8Array; @@ -696,6 +867,11 @@ export interface ResponseApplySnapshotChunk { /** Chunk senders to reject and ban */ rejectSenders: string[]; } +export interface ReactiveResponseApplySnapshotChunk { + result: ComputedRef<ResponseApplySnapshotChunk_Result>; + refetchChunks: ComputedRef<number[]>; + rejectSenders: ComputedRef<string[]>; +} export interface ResponseApplySnapshotChunkProtoMsg { typeUrl: "/tendermint.abci.ResponseApplySnapshotChunk"; value: Uint8Array; @@ -715,6 +891,12 @@ export interface ConsensusParams { validator?: ValidatorParams; version?: VersionParams; } +export interface ReactiveConsensusParams { + block?: ComputedRef<BlockParams>; + evidence?: ComputedRef<EvidenceParams>; + validator?: ComputedRef<ValidatorParams>; + version?: ComputedRef<VersionParams>; +} export interface ConsensusParamsProtoMsg { typeUrl: "/tendermint.abci.ConsensusParams"; value: Uint8Array; @@ -736,6 +918,10 @@ export interface BlockParams { /** Note: must be greater or equal to -1 */ maxGas: bigint; } +export interface ReactiveBlockParams { + maxBytes: ComputedRef<bigint>; + maxGas: ComputedRef<bigint>; +} export interface BlockParamsProtoMsg { typeUrl: "/tendermint.abci.BlockParams"; value: Uint8Array; @@ -749,6 +935,10 @@ export interface LastCommitInfo { round: number; votes: VoteInfo[]; } +export interface ReactiveLastCommitInfo { + round: ComputedRef<number>; + votes: ComputedRef<VoteInfo[]>; +} export interface LastCommitInfoProtoMsg { typeUrl: "/tendermint.abci.LastCommitInfo"; value: Uint8Array; @@ -766,6 +956,10 @@ export interface Event { type: string; attributes: EventAttribute[]; } +export interface ReactiveEvent { + type: ComputedRef<string>; + attributes: ComputedRef<EventAttribute[]>; +} export interface EventProtoMsg { typeUrl: "/tendermint.abci.Event"; value: Uint8Array; @@ -786,6 +980,11 @@ export interface EventAttribute { /** nondeterministic */ index: boolean; } +export interface ReactiveEventAttribute { + key: ComputedRef<Uint8Array>; + value: ComputedRef<Uint8Array>; + index: ComputedRef<boolean>; +} export interface EventAttributeProtoMsg { typeUrl: "/tendermint.abci.EventAttribute"; value: Uint8Array; @@ -807,6 +1006,12 @@ export interface TxResult { tx: Uint8Array; result: ResponseDeliverTx; } +export interface ReactiveTxResult { + height: ComputedRef<bigint>; + index: ComputedRef<number>; + tx: ComputedRef<Uint8Array>; + result: ComputedRef<ResponseDeliverTx>; +} export interface TxResultProtoMsg { typeUrl: "/tendermint.abci.TxResult"; value: Uint8Array; @@ -829,6 +1034,10 @@ export interface Validator { /** PubKey pub_key = 2 [(gogoproto.nullable)=false]; */ power: bigint; } +export interface ReactiveValidator { + address: ComputedRef<Uint8Array>; + power: ComputedRef<bigint>; +} export interface ValidatorProtoMsg { typeUrl: "/tendermint.abci.Validator"; value: Uint8Array; @@ -843,6 +1052,10 @@ export interface ValidatorUpdate { pubKey: PublicKey; power: bigint; } +export interface ReactiveValidatorUpdate { + pubKey: ComputedRef<PublicKey>; + power: ComputedRef<bigint>; +} export interface ValidatorUpdateProtoMsg { typeUrl: "/tendermint.abci.ValidatorUpdate"; value: Uint8Array; @@ -857,6 +1070,10 @@ export interface VoteInfo { validator: Validator; signedLastBlock: boolean; } +export interface ReactiveVoteInfo { + validator: ComputedRef<Validator>; + signedLastBlock: ComputedRef<boolean>; +} export interface VoteInfoProtoMsg { typeUrl: "/tendermint.abci.VoteInfo"; value: Uint8Array; @@ -881,6 +1098,13 @@ export interface Evidence { */ totalVotingPower: bigint; } +export interface ReactiveEvidence { + type: ComputedRef<EvidenceType>; + validator: ComputedRef<Validator>; + height: ComputedRef<bigint>; + time: ComputedRef<Date>; + totalVotingPower: ComputedRef<bigint>; +} export interface EvidenceProtoMsg { typeUrl: "/tendermint.abci.Evidence"; value: Uint8Array; @@ -904,6 +1128,13 @@ export interface Snapshot { /** Arbitrary application metadata */ metadata: Uint8Array; } +export interface ReactiveSnapshot { + height: ComputedRef<bigint>; + format: ComputedRef<number>; + chunks: ComputedRef<number>; + hash: ComputedRef<Uint8Array>; + metadata: ComputedRef<Uint8Array>; +} export interface SnapshotProtoMsg { typeUrl: "/tendermint.abci.Snapshot"; value: Uint8Array; @@ -1044,23 +1275,23 @@ export const Request = { return message; }, fromJSON(object: any): Request { - const obj = createBaseRequest(); - if (isSet(object.echo)) obj.echo = RequestEcho.fromJSON(object.echo); - if (isSet(object.flush)) obj.flush = RequestFlush.fromJSON(object.flush); - if (isSet(object.info)) obj.info = RequestInfo.fromJSON(object.info); - if (isSet(object.setOption)) obj.setOption = RequestSetOption.fromJSON(object.setOption); - if (isSet(object.initChain)) obj.initChain = RequestInitChain.fromJSON(object.initChain); - if (isSet(object.query)) obj.query = RequestQuery.fromJSON(object.query); - if (isSet(object.beginBlock)) obj.beginBlock = RequestBeginBlock.fromJSON(object.beginBlock); - if (isSet(object.checkTx)) obj.checkTx = RequestCheckTx.fromJSON(object.checkTx); - if (isSet(object.deliverTx)) obj.deliverTx = RequestDeliverTx.fromJSON(object.deliverTx); - if (isSet(object.endBlock)) obj.endBlock = RequestEndBlock.fromJSON(object.endBlock); - if (isSet(object.commit)) obj.commit = RequestCommit.fromJSON(object.commit); - if (isSet(object.listSnapshots)) obj.listSnapshots = RequestListSnapshots.fromJSON(object.listSnapshots); - if (isSet(object.offerSnapshot)) obj.offerSnapshot = RequestOfferSnapshot.fromJSON(object.offerSnapshot); - if (isSet(object.loadSnapshotChunk)) obj.loadSnapshotChunk = RequestLoadSnapshotChunk.fromJSON(object.loadSnapshotChunk); - if (isSet(object.applySnapshotChunk)) obj.applySnapshotChunk = RequestApplySnapshotChunk.fromJSON(object.applySnapshotChunk); - return obj; + return { + echo: isSet(object.echo) ? RequestEcho.fromJSON(object.echo) : undefined, + flush: isSet(object.flush) ? RequestFlush.fromJSON(object.flush) : undefined, + info: isSet(object.info) ? RequestInfo.fromJSON(object.info) : undefined, + setOption: isSet(object.setOption) ? RequestSetOption.fromJSON(object.setOption) : undefined, + initChain: isSet(object.initChain) ? RequestInitChain.fromJSON(object.initChain) : undefined, + query: isSet(object.query) ? RequestQuery.fromJSON(object.query) : undefined, + beginBlock: isSet(object.beginBlock) ? RequestBeginBlock.fromJSON(object.beginBlock) : undefined, + checkTx: isSet(object.checkTx) ? RequestCheckTx.fromJSON(object.checkTx) : undefined, + deliverTx: isSet(object.deliverTx) ? RequestDeliverTx.fromJSON(object.deliverTx) : undefined, + endBlock: isSet(object.endBlock) ? RequestEndBlock.fromJSON(object.endBlock) : undefined, + commit: isSet(object.commit) ? RequestCommit.fromJSON(object.commit) : undefined, + listSnapshots: isSet(object.listSnapshots) ? RequestListSnapshots.fromJSON(object.listSnapshots) : undefined, + offerSnapshot: isSet(object.offerSnapshot) ? RequestOfferSnapshot.fromJSON(object.offerSnapshot) : undefined, + loadSnapshotChunk: isSet(object.loadSnapshotChunk) ? RequestLoadSnapshotChunk.fromJSON(object.loadSnapshotChunk) : undefined, + applySnapshotChunk: isSet(object.applySnapshotChunk) ? RequestApplySnapshotChunk.fromJSON(object.applySnapshotChunk) : undefined + }; }, toJSON(message: Request): JsonSafe<Request> { const obj: any = {}; @@ -1083,51 +1314,21 @@ export const Request = { }, fromPartial(object: DeepPartial<Request>): Request { const message = createBaseRequest(); - if (object.echo !== undefined && object.echo !== null) { - message.echo = RequestEcho.fromPartial(object.echo); - } - if (object.flush !== undefined && object.flush !== null) { - message.flush = RequestFlush.fromPartial(object.flush); - } - if (object.info !== undefined && object.info !== null) { - message.info = RequestInfo.fromPartial(object.info); - } - if (object.setOption !== undefined && object.setOption !== null) { - message.setOption = RequestSetOption.fromPartial(object.setOption); - } - if (object.initChain !== undefined && object.initChain !== null) { - message.initChain = RequestInitChain.fromPartial(object.initChain); - } - if (object.query !== undefined && object.query !== null) { - message.query = RequestQuery.fromPartial(object.query); - } - if (object.beginBlock !== undefined && object.beginBlock !== null) { - message.beginBlock = RequestBeginBlock.fromPartial(object.beginBlock); - } - if (object.checkTx !== undefined && object.checkTx !== null) { - message.checkTx = RequestCheckTx.fromPartial(object.checkTx); - } - if (object.deliverTx !== undefined && object.deliverTx !== null) { - message.deliverTx = RequestDeliverTx.fromPartial(object.deliverTx); - } - if (object.endBlock !== undefined && object.endBlock !== null) { - message.endBlock = RequestEndBlock.fromPartial(object.endBlock); - } - if (object.commit !== undefined && object.commit !== null) { - message.commit = RequestCommit.fromPartial(object.commit); - } - if (object.listSnapshots !== undefined && object.listSnapshots !== null) { - message.listSnapshots = RequestListSnapshots.fromPartial(object.listSnapshots); - } - if (object.offerSnapshot !== undefined && object.offerSnapshot !== null) { - message.offerSnapshot = RequestOfferSnapshot.fromPartial(object.offerSnapshot); - } - if (object.loadSnapshotChunk !== undefined && object.loadSnapshotChunk !== null) { - message.loadSnapshotChunk = RequestLoadSnapshotChunk.fromPartial(object.loadSnapshotChunk); - } - if (object.applySnapshotChunk !== undefined && object.applySnapshotChunk !== null) { - message.applySnapshotChunk = RequestApplySnapshotChunk.fromPartial(object.applySnapshotChunk); - } + message.echo = object.echo !== undefined && object.echo !== null ? RequestEcho.fromPartial(object.echo) : undefined; + message.flush = object.flush !== undefined && object.flush !== null ? RequestFlush.fromPartial(object.flush) : undefined; + message.info = object.info !== undefined && object.info !== null ? RequestInfo.fromPartial(object.info) : undefined; + message.setOption = object.setOption !== undefined && object.setOption !== null ? RequestSetOption.fromPartial(object.setOption) : undefined; + message.initChain = object.initChain !== undefined && object.initChain !== null ? RequestInitChain.fromPartial(object.initChain) : undefined; + message.query = object.query !== undefined && object.query !== null ? RequestQuery.fromPartial(object.query) : undefined; + message.beginBlock = object.beginBlock !== undefined && object.beginBlock !== null ? RequestBeginBlock.fromPartial(object.beginBlock) : undefined; + message.checkTx = object.checkTx !== undefined && object.checkTx !== null ? RequestCheckTx.fromPartial(object.checkTx) : undefined; + message.deliverTx = object.deliverTx !== undefined && object.deliverTx !== null ? RequestDeliverTx.fromPartial(object.deliverTx) : undefined; + message.endBlock = object.endBlock !== undefined && object.endBlock !== null ? RequestEndBlock.fromPartial(object.endBlock) : undefined; + message.commit = object.commit !== undefined && object.commit !== null ? RequestCommit.fromPartial(object.commit) : undefined; + message.listSnapshots = object.listSnapshots !== undefined && object.listSnapshots !== null ? RequestListSnapshots.fromPartial(object.listSnapshots) : undefined; + message.offerSnapshot = object.offerSnapshot !== undefined && object.offerSnapshot !== null ? RequestOfferSnapshot.fromPartial(object.offerSnapshot) : undefined; + message.loadSnapshotChunk = object.loadSnapshotChunk !== undefined && object.loadSnapshotChunk !== null ? RequestLoadSnapshotChunk.fromPartial(object.loadSnapshotChunk) : undefined; + message.applySnapshotChunk = object.applySnapshotChunk !== undefined && object.applySnapshotChunk !== null ? RequestApplySnapshotChunk.fromPartial(object.applySnapshotChunk) : undefined; return message; }, fromSDK(object: RequestSDKType): Request { @@ -1279,7 +1480,7 @@ function createBaseRequestEcho(): RequestEcho { export const RequestEcho = { typeUrl: "/tendermint.abci.RequestEcho", encode(message: RequestEcho, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.message !== undefined) { + if (message.message !== "") { writer.uint32(10).string(message.message); } return writer; @@ -1302,9 +1503,9 @@ export const RequestEcho = { return message; }, fromJSON(object: any): RequestEcho { - const obj = createBaseRequestEcho(); - if (isSet(object.message)) obj.message = String(object.message); - return obj; + return { + message: isSet(object.message) ? String(object.message) : "" + }; }, toJSON(message: RequestEcho): JsonSafe<RequestEcho> { const obj: any = {}; @@ -1382,8 +1583,7 @@ export const RequestFlush = { return message; }, fromJSON(_: any): RequestFlush { - const obj = createBaseRequestFlush(); - return obj; + return {}; }, toJSON(_: RequestFlush): JsonSafe<RequestFlush> { const obj: any = {}; @@ -1437,13 +1637,13 @@ function createBaseRequestInfo(): RequestInfo { export const RequestInfo = { typeUrl: "/tendermint.abci.RequestInfo", encode(message: RequestInfo, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.version !== undefined) { + if (message.version !== "") { writer.uint32(10).string(message.version); } - if (message.blockVersion !== undefined) { + if (message.blockVersion !== BigInt(0)) { writer.uint32(16).uint64(message.blockVersion); } - if (message.p2pVersion !== undefined) { + if (message.p2pVersion !== BigInt(0)) { writer.uint32(24).uint64(message.p2pVersion); } return writer; @@ -1472,11 +1672,11 @@ export const RequestInfo = { return message; }, fromJSON(object: any): RequestInfo { - const obj = createBaseRequestInfo(); - if (isSet(object.version)) obj.version = String(object.version); - if (isSet(object.blockVersion)) obj.blockVersion = BigInt(object.blockVersion.toString()); - if (isSet(object.p2pVersion)) obj.p2pVersion = BigInt(object.p2pVersion.toString()); - return obj; + return { + version: isSet(object.version) ? String(object.version) : "", + blockVersion: isSet(object.blockVersion) ? BigInt(object.blockVersion.toString()) : BigInt(0), + p2pVersion: isSet(object.p2pVersion) ? BigInt(object.p2pVersion.toString()) : BigInt(0) + }; }, toJSON(message: RequestInfo): JsonSafe<RequestInfo> { const obj: any = {}; @@ -1488,12 +1688,8 @@ export const RequestInfo = { fromPartial(object: DeepPartial<RequestInfo>): RequestInfo { const message = createBaseRequestInfo(); message.version = object.version ?? ""; - if (object.blockVersion !== undefined && object.blockVersion !== null) { - message.blockVersion = BigInt(object.blockVersion.toString()); - } - if (object.p2pVersion !== undefined && object.p2pVersion !== null) { - message.p2pVersion = BigInt(object.p2pVersion.toString()); - } + message.blockVersion = object.blockVersion !== undefined && object.blockVersion !== null ? BigInt(object.blockVersion.toString()) : BigInt(0); + message.p2pVersion = object.p2pVersion !== undefined && object.p2pVersion !== null ? BigInt(object.p2pVersion.toString()) : BigInt(0); return message; }, fromSDK(object: RequestInfoSDKType): RequestInfo { @@ -1562,10 +1758,10 @@ function createBaseRequestSetOption(): RequestSetOption { export const RequestSetOption = { typeUrl: "/tendermint.abci.RequestSetOption", encode(message: RequestSetOption, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.key !== undefined) { + if (message.key !== "") { writer.uint32(10).string(message.key); } - if (message.value !== undefined) { + if (message.value !== "") { writer.uint32(18).string(message.value); } return writer; @@ -1591,10 +1787,10 @@ export const RequestSetOption = { return message; }, fromJSON(object: any): RequestSetOption { - const obj = createBaseRequestSetOption(); - if (isSet(object.key)) obj.key = String(object.key); - if (isSet(object.value)) obj.value = String(object.value); - return obj; + return { + key: isSet(object.key) ? String(object.key) : "", + value: isSet(object.value) ? String(object.value) : "" + }; }, toJSON(message: RequestSetOption): JsonSafe<RequestSetOption> { const obj: any = {}; @@ -1674,7 +1870,7 @@ export const RequestInitChain = { if (message.time !== undefined) { Timestamp.encode(toTimestamp(message.time), writer.uint32(10).fork()).ldelim(); } - if (message.chainId !== undefined) { + if (message.chainId !== "") { writer.uint32(18).string(message.chainId); } if (message.consensusParams !== undefined) { @@ -1686,7 +1882,7 @@ export const RequestInitChain = { if (message.appStateBytes.length !== 0) { writer.uint32(42).bytes(message.appStateBytes); } - if (message.initialHeight !== undefined) { + if (message.initialHeight !== BigInt(0)) { writer.uint32(48).int64(message.initialHeight); } return writer; @@ -1724,14 +1920,14 @@ export const RequestInitChain = { return message; }, fromJSON(object: any): RequestInitChain { - const obj = createBaseRequestInitChain(); - if (isSet(object.time)) obj.time = new Date(object.time); - if (isSet(object.chainId)) obj.chainId = String(object.chainId); - if (isSet(object.consensusParams)) obj.consensusParams = ConsensusParams.fromJSON(object.consensusParams); - if (Array.isArray(object?.validators)) obj.validators = object.validators.map((e: any) => ValidatorUpdate.fromJSON(e)); - if (isSet(object.appStateBytes)) obj.appStateBytes = bytesFromBase64(object.appStateBytes); - if (isSet(object.initialHeight)) obj.initialHeight = BigInt(object.initialHeight.toString()); - return obj; + return { + time: isSet(object.time) ? new Date(object.time) : undefined, + chainId: isSet(object.chainId) ? String(object.chainId) : "", + consensusParams: isSet(object.consensusParams) ? ConsensusParams.fromJSON(object.consensusParams) : undefined, + validators: Array.isArray(object?.validators) ? object.validators.map((e: any) => ValidatorUpdate.fromJSON(e)) : [], + appStateBytes: isSet(object.appStateBytes) ? bytesFromBase64(object.appStateBytes) : new Uint8Array(), + initialHeight: isSet(object.initialHeight) ? BigInt(object.initialHeight.toString()) : BigInt(0) + }; }, toJSON(message: RequestInitChain): JsonSafe<RequestInitChain> { const obj: any = {}; @@ -1751,14 +1947,10 @@ export const RequestInitChain = { const message = createBaseRequestInitChain(); message.time = object.time ?? undefined; message.chainId = object.chainId ?? ""; - if (object.consensusParams !== undefined && object.consensusParams !== null) { - message.consensusParams = ConsensusParams.fromPartial(object.consensusParams); - } + message.consensusParams = object.consensusParams !== undefined && object.consensusParams !== null ? ConsensusParams.fromPartial(object.consensusParams) : undefined; message.validators = object.validators?.map(e => ValidatorUpdate.fromPartial(e)) || []; message.appStateBytes = object.appStateBytes ?? new Uint8Array(); - if (object.initialHeight !== undefined && object.initialHeight !== null) { - message.initialHeight = BigInt(object.initialHeight.toString()); - } + message.initialHeight = object.initialHeight !== undefined && object.initialHeight !== null ? BigInt(object.initialHeight.toString()) : BigInt(0); return message; }, fromSDK(object: RequestInitChainSDKType): RequestInitChain { @@ -1859,13 +2051,13 @@ export const RequestQuery = { if (message.data.length !== 0) { writer.uint32(10).bytes(message.data); } - if (message.path !== undefined) { + if (message.path !== "") { writer.uint32(18).string(message.path); } - if (message.height !== undefined) { + if (message.height !== BigInt(0)) { writer.uint32(24).int64(message.height); } - if (message.prove !== undefined) { + if (message.prove === true) { writer.uint32(32).bool(message.prove); } return writer; @@ -1897,12 +2089,12 @@ export const RequestQuery = { return message; }, fromJSON(object: any): RequestQuery { - const obj = createBaseRequestQuery(); - if (isSet(object.data)) obj.data = bytesFromBase64(object.data); - if (isSet(object.path)) obj.path = String(object.path); - if (isSet(object.height)) obj.height = BigInt(object.height.toString()); - if (isSet(object.prove)) obj.prove = Boolean(object.prove); - return obj; + return { + data: isSet(object.data) ? bytesFromBase64(object.data) : new Uint8Array(), + path: isSet(object.path) ? String(object.path) : "", + height: isSet(object.height) ? BigInt(object.height.toString()) : BigInt(0), + prove: isSet(object.prove) ? Boolean(object.prove) : false + }; }, toJSON(message: RequestQuery): JsonSafe<RequestQuery> { const obj: any = {}; @@ -1916,9 +2108,7 @@ export const RequestQuery = { const message = createBaseRequestQuery(); message.data = object.data ?? new Uint8Array(); message.path = object.path ?? ""; - if (object.height !== undefined && object.height !== null) { - message.height = BigInt(object.height.toString()); - } + message.height = object.height !== undefined && object.height !== null ? BigInt(object.height.toString()) : BigInt(0); message.prove = object.prove ?? false; return message; }, @@ -2038,12 +2228,12 @@ export const RequestBeginBlock = { return message; }, fromJSON(object: any): RequestBeginBlock { - const obj = createBaseRequestBeginBlock(); - if (isSet(object.hash)) obj.hash = bytesFromBase64(object.hash); - if (isSet(object.header)) obj.header = Header.fromJSON(object.header); - if (isSet(object.lastCommitInfo)) obj.lastCommitInfo = LastCommitInfo.fromJSON(object.lastCommitInfo); - if (Array.isArray(object?.byzantineValidators)) obj.byzantineValidators = object.byzantineValidators.map((e: any) => Evidence.fromJSON(e)); - return obj; + return { + hash: isSet(object.hash) ? bytesFromBase64(object.hash) : new Uint8Array(), + header: isSet(object.header) ? Header.fromJSON(object.header) : undefined, + lastCommitInfo: isSet(object.lastCommitInfo) ? LastCommitInfo.fromJSON(object.lastCommitInfo) : undefined, + byzantineValidators: Array.isArray(object?.byzantineValidators) ? object.byzantineValidators.map((e: any) => Evidence.fromJSON(e)) : [] + }; }, toJSON(message: RequestBeginBlock): JsonSafe<RequestBeginBlock> { const obj: any = {}; @@ -2060,12 +2250,8 @@ export const RequestBeginBlock = { fromPartial(object: DeepPartial<RequestBeginBlock>): RequestBeginBlock { const message = createBaseRequestBeginBlock(); message.hash = object.hash ?? new Uint8Array(); - if (object.header !== undefined && object.header !== null) { - message.header = Header.fromPartial(object.header); - } - if (object.lastCommitInfo !== undefined && object.lastCommitInfo !== null) { - message.lastCommitInfo = LastCommitInfo.fromPartial(object.lastCommitInfo); - } + message.header = object.header !== undefined && object.header !== null ? Header.fromPartial(object.header) : undefined; + message.lastCommitInfo = object.lastCommitInfo !== undefined && object.lastCommitInfo !== null ? LastCommitInfo.fromPartial(object.lastCommitInfo) : undefined; message.byzantineValidators = object.byzantineValidators?.map(e => Evidence.fromPartial(e)) || []; return message; }, @@ -2177,10 +2363,10 @@ export const RequestCheckTx = { return message; }, fromJSON(object: any): RequestCheckTx { - const obj = createBaseRequestCheckTx(); - if (isSet(object.tx)) obj.tx = bytesFromBase64(object.tx); - if (isSet(object.type)) obj.type = checkTxTypeFromJSON(object.type); - return obj; + return { + tx: isSet(object.tx) ? bytesFromBase64(object.tx) : new Uint8Array(), + type: isSet(object.type) ? checkTxTypeFromJSON(object.type) : -1 + }; }, toJSON(message: RequestCheckTx): JsonSafe<RequestCheckTx> { const obj: any = {}; @@ -2275,9 +2461,9 @@ export const RequestDeliverTx = { return message; }, fromJSON(object: any): RequestDeliverTx { - const obj = createBaseRequestDeliverTx(); - if (isSet(object.tx)) obj.tx = bytesFromBase64(object.tx); - return obj; + return { + tx: isSet(object.tx) ? bytesFromBase64(object.tx) : new Uint8Array() + }; }, toJSON(message: RequestDeliverTx): JsonSafe<RequestDeliverTx> { const obj: any = {}; @@ -2340,7 +2526,7 @@ function createBaseRequestEndBlock(): RequestEndBlock { export const RequestEndBlock = { typeUrl: "/tendermint.abci.RequestEndBlock", encode(message: RequestEndBlock, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.height !== undefined) { + if (message.height !== BigInt(0)) { writer.uint32(8).int64(message.height); } return writer; @@ -2363,9 +2549,9 @@ export const RequestEndBlock = { return message; }, fromJSON(object: any): RequestEndBlock { - const obj = createBaseRequestEndBlock(); - if (isSet(object.height)) obj.height = BigInt(object.height.toString()); - return obj; + return { + height: isSet(object.height) ? BigInt(object.height.toString()) : BigInt(0) + }; }, toJSON(message: RequestEndBlock): JsonSafe<RequestEndBlock> { const obj: any = {}; @@ -2374,9 +2560,7 @@ export const RequestEndBlock = { }, fromPartial(object: DeepPartial<RequestEndBlock>): RequestEndBlock { const message = createBaseRequestEndBlock(); - if (object.height !== undefined && object.height !== null) { - message.height = BigInt(object.height.toString()); - } + message.height = object.height !== undefined && object.height !== null ? BigInt(object.height.toString()) : BigInt(0); return message; }, fromSDK(object: RequestEndBlockSDKType): RequestEndBlock { @@ -2445,8 +2629,7 @@ export const RequestCommit = { return message; }, fromJSON(_: any): RequestCommit { - const obj = createBaseRequestCommit(); - return obj; + return {}; }, toJSON(_: RequestCommit): JsonSafe<RequestCommit> { const obj: any = {}; @@ -2513,8 +2696,7 @@ export const RequestListSnapshots = { return message; }, fromJSON(_: any): RequestListSnapshots { - const obj = createBaseRequestListSnapshots(); - return obj; + return {}; }, toJSON(_: RequestListSnapshots): JsonSafe<RequestListSnapshots> { const obj: any = {}; @@ -2596,10 +2778,10 @@ export const RequestOfferSnapshot = { return message; }, fromJSON(object: any): RequestOfferSnapshot { - const obj = createBaseRequestOfferSnapshot(); - if (isSet(object.snapshot)) obj.snapshot = Snapshot.fromJSON(object.snapshot); - if (isSet(object.appHash)) obj.appHash = bytesFromBase64(object.appHash); - return obj; + return { + snapshot: isSet(object.snapshot) ? Snapshot.fromJSON(object.snapshot) : undefined, + appHash: isSet(object.appHash) ? bytesFromBase64(object.appHash) : new Uint8Array() + }; }, toJSON(message: RequestOfferSnapshot): JsonSafe<RequestOfferSnapshot> { const obj: any = {}; @@ -2609,9 +2791,7 @@ export const RequestOfferSnapshot = { }, fromPartial(object: DeepPartial<RequestOfferSnapshot>): RequestOfferSnapshot { const message = createBaseRequestOfferSnapshot(); - if (object.snapshot !== undefined && object.snapshot !== null) { - message.snapshot = Snapshot.fromPartial(object.snapshot); - } + message.snapshot = object.snapshot !== undefined && object.snapshot !== null ? Snapshot.fromPartial(object.snapshot) : undefined; message.appHash = object.appHash ?? new Uint8Array(); return message; }, @@ -2675,13 +2855,13 @@ function createBaseRequestLoadSnapshotChunk(): RequestLoadSnapshotChunk { export const RequestLoadSnapshotChunk = { typeUrl: "/tendermint.abci.RequestLoadSnapshotChunk", encode(message: RequestLoadSnapshotChunk, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.height !== undefined) { + if (message.height !== BigInt(0)) { writer.uint32(8).uint64(message.height); } - if (message.format !== undefined) { + if (message.format !== 0) { writer.uint32(16).uint32(message.format); } - if (message.chunk !== undefined) { + if (message.chunk !== 0) { writer.uint32(24).uint32(message.chunk); } return writer; @@ -2710,11 +2890,11 @@ export const RequestLoadSnapshotChunk = { return message; }, fromJSON(object: any): RequestLoadSnapshotChunk { - const obj = createBaseRequestLoadSnapshotChunk(); - if (isSet(object.height)) obj.height = BigInt(object.height.toString()); - if (isSet(object.format)) obj.format = Number(object.format); - if (isSet(object.chunk)) obj.chunk = Number(object.chunk); - return obj; + return { + height: isSet(object.height) ? BigInt(object.height.toString()) : BigInt(0), + format: isSet(object.format) ? Number(object.format) : 0, + chunk: isSet(object.chunk) ? Number(object.chunk) : 0 + }; }, toJSON(message: RequestLoadSnapshotChunk): JsonSafe<RequestLoadSnapshotChunk> { const obj: any = {}; @@ -2725,9 +2905,7 @@ export const RequestLoadSnapshotChunk = { }, fromPartial(object: DeepPartial<RequestLoadSnapshotChunk>): RequestLoadSnapshotChunk { const message = createBaseRequestLoadSnapshotChunk(); - if (object.height !== undefined && object.height !== null) { - message.height = BigInt(object.height.toString()); - } + message.height = object.height !== undefined && object.height !== null ? BigInt(object.height.toString()) : BigInt(0); message.format = object.format ?? 0; message.chunk = object.chunk ?? 0; return message; @@ -2799,13 +2977,13 @@ function createBaseRequestApplySnapshotChunk(): RequestApplySnapshotChunk { export const RequestApplySnapshotChunk = { typeUrl: "/tendermint.abci.RequestApplySnapshotChunk", encode(message: RequestApplySnapshotChunk, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.index !== undefined) { + if (message.index !== 0) { writer.uint32(8).uint32(message.index); } if (message.chunk.length !== 0) { writer.uint32(18).bytes(message.chunk); } - if (message.sender !== undefined) { + if (message.sender !== "") { writer.uint32(26).string(message.sender); } return writer; @@ -2834,11 +3012,11 @@ export const RequestApplySnapshotChunk = { return message; }, fromJSON(object: any): RequestApplySnapshotChunk { - const obj = createBaseRequestApplySnapshotChunk(); - if (isSet(object.index)) obj.index = Number(object.index); - if (isSet(object.chunk)) obj.chunk = bytesFromBase64(object.chunk); - if (isSet(object.sender)) obj.sender = String(object.sender); - return obj; + return { + index: isSet(object.index) ? Number(object.index) : 0, + chunk: isSet(object.chunk) ? bytesFromBase64(object.chunk) : new Uint8Array(), + sender: isSet(object.sender) ? String(object.sender) : "" + }; }, toJSON(message: RequestApplySnapshotChunk): JsonSafe<RequestApplySnapshotChunk> { const obj: any = {}; @@ -3047,24 +3225,24 @@ export const Response = { return message; }, fromJSON(object: any): Response { - const obj = createBaseResponse(); - if (isSet(object.exception)) obj.exception = ResponseException.fromJSON(object.exception); - if (isSet(object.echo)) obj.echo = ResponseEcho.fromJSON(object.echo); - if (isSet(object.flush)) obj.flush = ResponseFlush.fromJSON(object.flush); - if (isSet(object.info)) obj.info = ResponseInfo.fromJSON(object.info); - if (isSet(object.setOption)) obj.setOption = ResponseSetOption.fromJSON(object.setOption); - if (isSet(object.initChain)) obj.initChain = ResponseInitChain.fromJSON(object.initChain); - if (isSet(object.query)) obj.query = ResponseQuery.fromJSON(object.query); - if (isSet(object.beginBlock)) obj.beginBlock = ResponseBeginBlock.fromJSON(object.beginBlock); - if (isSet(object.checkTx)) obj.checkTx = ResponseCheckTx.fromJSON(object.checkTx); - if (isSet(object.deliverTx)) obj.deliverTx = ResponseDeliverTx.fromJSON(object.deliverTx); - if (isSet(object.endBlock)) obj.endBlock = ResponseEndBlock.fromJSON(object.endBlock); - if (isSet(object.commit)) obj.commit = ResponseCommit.fromJSON(object.commit); - if (isSet(object.listSnapshots)) obj.listSnapshots = ResponseListSnapshots.fromJSON(object.listSnapshots); - if (isSet(object.offerSnapshot)) obj.offerSnapshot = ResponseOfferSnapshot.fromJSON(object.offerSnapshot); - if (isSet(object.loadSnapshotChunk)) obj.loadSnapshotChunk = ResponseLoadSnapshotChunk.fromJSON(object.loadSnapshotChunk); - if (isSet(object.applySnapshotChunk)) obj.applySnapshotChunk = ResponseApplySnapshotChunk.fromJSON(object.applySnapshotChunk); - return obj; + return { + exception: isSet(object.exception) ? ResponseException.fromJSON(object.exception) : undefined, + echo: isSet(object.echo) ? ResponseEcho.fromJSON(object.echo) : undefined, + flush: isSet(object.flush) ? ResponseFlush.fromJSON(object.flush) : undefined, + info: isSet(object.info) ? ResponseInfo.fromJSON(object.info) : undefined, + setOption: isSet(object.setOption) ? ResponseSetOption.fromJSON(object.setOption) : undefined, + initChain: isSet(object.initChain) ? ResponseInitChain.fromJSON(object.initChain) : undefined, + query: isSet(object.query) ? ResponseQuery.fromJSON(object.query) : undefined, + beginBlock: isSet(object.beginBlock) ? ResponseBeginBlock.fromJSON(object.beginBlock) : undefined, + checkTx: isSet(object.checkTx) ? ResponseCheckTx.fromJSON(object.checkTx) : undefined, + deliverTx: isSet(object.deliverTx) ? ResponseDeliverTx.fromJSON(object.deliverTx) : undefined, + endBlock: isSet(object.endBlock) ? ResponseEndBlock.fromJSON(object.endBlock) : undefined, + commit: isSet(object.commit) ? ResponseCommit.fromJSON(object.commit) : undefined, + listSnapshots: isSet(object.listSnapshots) ? ResponseListSnapshots.fromJSON(object.listSnapshots) : undefined, + offerSnapshot: isSet(object.offerSnapshot) ? ResponseOfferSnapshot.fromJSON(object.offerSnapshot) : undefined, + loadSnapshotChunk: isSet(object.loadSnapshotChunk) ? ResponseLoadSnapshotChunk.fromJSON(object.loadSnapshotChunk) : undefined, + applySnapshotChunk: isSet(object.applySnapshotChunk) ? ResponseApplySnapshotChunk.fromJSON(object.applySnapshotChunk) : undefined + }; }, toJSON(message: Response): JsonSafe<Response> { const obj: any = {}; @@ -3088,54 +3266,22 @@ export const Response = { }, fromPartial(object: DeepPartial<Response>): Response { const message = createBaseResponse(); - if (object.exception !== undefined && object.exception !== null) { - message.exception = ResponseException.fromPartial(object.exception); - } - if (object.echo !== undefined && object.echo !== null) { - message.echo = ResponseEcho.fromPartial(object.echo); - } - if (object.flush !== undefined && object.flush !== null) { - message.flush = ResponseFlush.fromPartial(object.flush); - } - if (object.info !== undefined && object.info !== null) { - message.info = ResponseInfo.fromPartial(object.info); - } - if (object.setOption !== undefined && object.setOption !== null) { - message.setOption = ResponseSetOption.fromPartial(object.setOption); - } - if (object.initChain !== undefined && object.initChain !== null) { - message.initChain = ResponseInitChain.fromPartial(object.initChain); - } - if (object.query !== undefined && object.query !== null) { - message.query = ResponseQuery.fromPartial(object.query); - } - if (object.beginBlock !== undefined && object.beginBlock !== null) { - message.beginBlock = ResponseBeginBlock.fromPartial(object.beginBlock); - } - if (object.checkTx !== undefined && object.checkTx !== null) { - message.checkTx = ResponseCheckTx.fromPartial(object.checkTx); - } - if (object.deliverTx !== undefined && object.deliverTx !== null) { - message.deliverTx = ResponseDeliverTx.fromPartial(object.deliverTx); - } - if (object.endBlock !== undefined && object.endBlock !== null) { - message.endBlock = ResponseEndBlock.fromPartial(object.endBlock); - } - if (object.commit !== undefined && object.commit !== null) { - message.commit = ResponseCommit.fromPartial(object.commit); - } - if (object.listSnapshots !== undefined && object.listSnapshots !== null) { - message.listSnapshots = ResponseListSnapshots.fromPartial(object.listSnapshots); - } - if (object.offerSnapshot !== undefined && object.offerSnapshot !== null) { - message.offerSnapshot = ResponseOfferSnapshot.fromPartial(object.offerSnapshot); - } - if (object.loadSnapshotChunk !== undefined && object.loadSnapshotChunk !== null) { - message.loadSnapshotChunk = ResponseLoadSnapshotChunk.fromPartial(object.loadSnapshotChunk); - } - if (object.applySnapshotChunk !== undefined && object.applySnapshotChunk !== null) { - message.applySnapshotChunk = ResponseApplySnapshotChunk.fromPartial(object.applySnapshotChunk); - } + message.exception = object.exception !== undefined && object.exception !== null ? ResponseException.fromPartial(object.exception) : undefined; + message.echo = object.echo !== undefined && object.echo !== null ? ResponseEcho.fromPartial(object.echo) : undefined; + message.flush = object.flush !== undefined && object.flush !== null ? ResponseFlush.fromPartial(object.flush) : undefined; + message.info = object.info !== undefined && object.info !== null ? ResponseInfo.fromPartial(object.info) : undefined; + message.setOption = object.setOption !== undefined && object.setOption !== null ? ResponseSetOption.fromPartial(object.setOption) : undefined; + message.initChain = object.initChain !== undefined && object.initChain !== null ? ResponseInitChain.fromPartial(object.initChain) : undefined; + message.query = object.query !== undefined && object.query !== null ? ResponseQuery.fromPartial(object.query) : undefined; + message.beginBlock = object.beginBlock !== undefined && object.beginBlock !== null ? ResponseBeginBlock.fromPartial(object.beginBlock) : undefined; + message.checkTx = object.checkTx !== undefined && object.checkTx !== null ? ResponseCheckTx.fromPartial(object.checkTx) : undefined; + message.deliverTx = object.deliverTx !== undefined && object.deliverTx !== null ? ResponseDeliverTx.fromPartial(object.deliverTx) : undefined; + message.endBlock = object.endBlock !== undefined && object.endBlock !== null ? ResponseEndBlock.fromPartial(object.endBlock) : undefined; + message.commit = object.commit !== undefined && object.commit !== null ? ResponseCommit.fromPartial(object.commit) : undefined; + message.listSnapshots = object.listSnapshots !== undefined && object.listSnapshots !== null ? ResponseListSnapshots.fromPartial(object.listSnapshots) : undefined; + message.offerSnapshot = object.offerSnapshot !== undefined && object.offerSnapshot !== null ? ResponseOfferSnapshot.fromPartial(object.offerSnapshot) : undefined; + message.loadSnapshotChunk = object.loadSnapshotChunk !== undefined && object.loadSnapshotChunk !== null ? ResponseLoadSnapshotChunk.fromPartial(object.loadSnapshotChunk) : undefined; + message.applySnapshotChunk = object.applySnapshotChunk !== undefined && object.applySnapshotChunk !== null ? ResponseApplySnapshotChunk.fromPartial(object.applySnapshotChunk) : undefined; return message; }, fromSDK(object: ResponseSDKType): Response { @@ -3294,7 +3440,7 @@ function createBaseResponseException(): ResponseException { export const ResponseException = { typeUrl: "/tendermint.abci.ResponseException", encode(message: ResponseException, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.error !== undefined) { + if (message.error !== "") { writer.uint32(10).string(message.error); } return writer; @@ -3317,9 +3463,9 @@ export const ResponseException = { return message; }, fromJSON(object: any): ResponseException { - const obj = createBaseResponseException(); - if (isSet(object.error)) obj.error = String(object.error); - return obj; + return { + error: isSet(object.error) ? String(object.error) : "" + }; }, toJSON(message: ResponseException): JsonSafe<ResponseException> { const obj: any = {}; @@ -3382,7 +3528,7 @@ function createBaseResponseEcho(): ResponseEcho { export const ResponseEcho = { typeUrl: "/tendermint.abci.ResponseEcho", encode(message: ResponseEcho, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.message !== undefined) { + if (message.message !== "") { writer.uint32(10).string(message.message); } return writer; @@ -3405,9 +3551,9 @@ export const ResponseEcho = { return message; }, fromJSON(object: any): ResponseEcho { - const obj = createBaseResponseEcho(); - if (isSet(object.message)) obj.message = String(object.message); - return obj; + return { + message: isSet(object.message) ? String(object.message) : "" + }; }, toJSON(message: ResponseEcho): JsonSafe<ResponseEcho> { const obj: any = {}; @@ -3485,8 +3631,7 @@ export const ResponseFlush = { return message; }, fromJSON(_: any): ResponseFlush { - const obj = createBaseResponseFlush(); - return obj; + return {}; }, toJSON(_: ResponseFlush): JsonSafe<ResponseFlush> { const obj: any = {}; @@ -3542,16 +3687,16 @@ function createBaseResponseInfo(): ResponseInfo { export const ResponseInfo = { typeUrl: "/tendermint.abci.ResponseInfo", encode(message: ResponseInfo, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.data !== undefined) { + if (message.data !== "") { writer.uint32(10).string(message.data); } - if (message.version !== undefined) { + if (message.version !== "") { writer.uint32(18).string(message.version); } - if (message.appVersion !== undefined) { + if (message.appVersion !== BigInt(0)) { writer.uint32(24).uint64(message.appVersion); } - if (message.lastBlockHeight !== undefined) { + if (message.lastBlockHeight !== BigInt(0)) { writer.uint32(32).int64(message.lastBlockHeight); } if (message.lastBlockAppHash.length !== 0) { @@ -3589,13 +3734,13 @@ export const ResponseInfo = { return message; }, fromJSON(object: any): ResponseInfo { - const obj = createBaseResponseInfo(); - if (isSet(object.data)) obj.data = String(object.data); - if (isSet(object.version)) obj.version = String(object.version); - if (isSet(object.appVersion)) obj.appVersion = BigInt(object.appVersion.toString()); - if (isSet(object.lastBlockHeight)) obj.lastBlockHeight = BigInt(object.lastBlockHeight.toString()); - if (isSet(object.lastBlockAppHash)) obj.lastBlockAppHash = bytesFromBase64(object.lastBlockAppHash); - return obj; + return { + data: isSet(object.data) ? String(object.data) : "", + version: isSet(object.version) ? String(object.version) : "", + appVersion: isSet(object.appVersion) ? BigInt(object.appVersion.toString()) : BigInt(0), + lastBlockHeight: isSet(object.lastBlockHeight) ? BigInt(object.lastBlockHeight.toString()) : BigInt(0), + lastBlockAppHash: isSet(object.lastBlockAppHash) ? bytesFromBase64(object.lastBlockAppHash) : new Uint8Array() + }; }, toJSON(message: ResponseInfo): JsonSafe<ResponseInfo> { const obj: any = {}; @@ -3610,12 +3755,8 @@ export const ResponseInfo = { const message = createBaseResponseInfo(); message.data = object.data ?? ""; message.version = object.version ?? ""; - if (object.appVersion !== undefined && object.appVersion !== null) { - message.appVersion = BigInt(object.appVersion.toString()); - } - if (object.lastBlockHeight !== undefined && object.lastBlockHeight !== null) { - message.lastBlockHeight = BigInt(object.lastBlockHeight.toString()); - } + message.appVersion = object.appVersion !== undefined && object.appVersion !== null ? BigInt(object.appVersion.toString()) : BigInt(0); + message.lastBlockHeight = object.lastBlockHeight !== undefined && object.lastBlockHeight !== null ? BigInt(object.lastBlockHeight.toString()) : BigInt(0); message.lastBlockAppHash = object.lastBlockAppHash ?? new Uint8Array(); return message; }, @@ -3700,13 +3841,13 @@ function createBaseResponseSetOption(): ResponseSetOption { export const ResponseSetOption = { typeUrl: "/tendermint.abci.ResponseSetOption", encode(message: ResponseSetOption, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.code !== undefined) { + if (message.code !== 0) { writer.uint32(8).uint32(message.code); } - if (message.log !== undefined) { + if (message.log !== "") { writer.uint32(26).string(message.log); } - if (message.info !== undefined) { + if (message.info !== "") { writer.uint32(34).string(message.info); } return writer; @@ -3735,11 +3876,11 @@ export const ResponseSetOption = { return message; }, fromJSON(object: any): ResponseSetOption { - const obj = createBaseResponseSetOption(); - if (isSet(object.code)) obj.code = Number(object.code); - if (isSet(object.log)) obj.log = String(object.log); - if (isSet(object.info)) obj.info = String(object.info); - return obj; + return { + code: isSet(object.code) ? Number(object.code) : 0, + log: isSet(object.log) ? String(object.log) : "", + info: isSet(object.info) ? String(object.info) : "" + }; }, toJSON(message: ResponseSetOption): JsonSafe<ResponseSetOption> { const obj: any = {}; @@ -3857,11 +3998,11 @@ export const ResponseInitChain = { return message; }, fromJSON(object: any): ResponseInitChain { - const obj = createBaseResponseInitChain(); - if (isSet(object.consensusParams)) obj.consensusParams = ConsensusParams.fromJSON(object.consensusParams); - if (Array.isArray(object?.validators)) obj.validators = object.validators.map((e: any) => ValidatorUpdate.fromJSON(e)); - if (isSet(object.appHash)) obj.appHash = bytesFromBase64(object.appHash); - return obj; + return { + consensusParams: isSet(object.consensusParams) ? ConsensusParams.fromJSON(object.consensusParams) : undefined, + validators: Array.isArray(object?.validators) ? object.validators.map((e: any) => ValidatorUpdate.fromJSON(e)) : [], + appHash: isSet(object.appHash) ? bytesFromBase64(object.appHash) : new Uint8Array() + }; }, toJSON(message: ResponseInitChain): JsonSafe<ResponseInitChain> { const obj: any = {}; @@ -3876,9 +4017,7 @@ export const ResponseInitChain = { }, fromPartial(object: DeepPartial<ResponseInitChain>): ResponseInitChain { const message = createBaseResponseInitChain(); - if (object.consensusParams !== undefined && object.consensusParams !== null) { - message.consensusParams = ConsensusParams.fromPartial(object.consensusParams); - } + message.consensusParams = object.consensusParams !== undefined && object.consensusParams !== null ? ConsensusParams.fromPartial(object.consensusParams) : undefined; message.validators = object.validators?.map(e => ValidatorUpdate.fromPartial(e)) || []; message.appHash = object.appHash ?? new Uint8Array(); return message; @@ -3962,16 +4101,16 @@ function createBaseResponseQuery(): ResponseQuery { export const ResponseQuery = { typeUrl: "/tendermint.abci.ResponseQuery", encode(message: ResponseQuery, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.code !== undefined) { + if (message.code !== 0) { writer.uint32(8).uint32(message.code); } - if (message.log !== undefined) { + if (message.log !== "") { writer.uint32(26).string(message.log); } - if (message.info !== undefined) { + if (message.info !== "") { writer.uint32(34).string(message.info); } - if (message.index !== undefined) { + if (message.index !== BigInt(0)) { writer.uint32(40).int64(message.index); } if (message.key.length !== 0) { @@ -3983,10 +4122,10 @@ export const ResponseQuery = { if (message.proofOps !== undefined) { ProofOps.encode(message.proofOps, writer.uint32(66).fork()).ldelim(); } - if (message.height !== undefined) { + if (message.height !== BigInt(0)) { writer.uint32(72).int64(message.height); } - if (message.codespace !== undefined) { + if (message.codespace !== "") { writer.uint32(82).string(message.codespace); } return writer; @@ -4033,17 +4172,17 @@ export const ResponseQuery = { return message; }, fromJSON(object: any): ResponseQuery { - const obj = createBaseResponseQuery(); - if (isSet(object.code)) obj.code = Number(object.code); - if (isSet(object.log)) obj.log = String(object.log); - if (isSet(object.info)) obj.info = String(object.info); - if (isSet(object.index)) obj.index = BigInt(object.index.toString()); - if (isSet(object.key)) obj.key = bytesFromBase64(object.key); - if (isSet(object.value)) obj.value = bytesFromBase64(object.value); - if (isSet(object.proofOps)) obj.proofOps = ProofOps.fromJSON(object.proofOps); - if (isSet(object.height)) obj.height = BigInt(object.height.toString()); - if (isSet(object.codespace)) obj.codespace = String(object.codespace); - return obj; + return { + code: isSet(object.code) ? Number(object.code) : 0, + log: isSet(object.log) ? String(object.log) : "", + info: isSet(object.info) ? String(object.info) : "", + index: isSet(object.index) ? BigInt(object.index.toString()) : BigInt(0), + key: isSet(object.key) ? bytesFromBase64(object.key) : new Uint8Array(), + value: isSet(object.value) ? bytesFromBase64(object.value) : new Uint8Array(), + proofOps: isSet(object.proofOps) ? ProofOps.fromJSON(object.proofOps) : undefined, + height: isSet(object.height) ? BigInt(object.height.toString()) : BigInt(0), + codespace: isSet(object.codespace) ? String(object.codespace) : "" + }; }, toJSON(message: ResponseQuery): JsonSafe<ResponseQuery> { const obj: any = {}; @@ -4063,17 +4202,11 @@ export const ResponseQuery = { message.code = object.code ?? 0; message.log = object.log ?? ""; message.info = object.info ?? ""; - if (object.index !== undefined && object.index !== null) { - message.index = BigInt(object.index.toString()); - } + message.index = object.index !== undefined && object.index !== null ? BigInt(object.index.toString()) : BigInt(0); message.key = object.key ?? new Uint8Array(); message.value = object.value ?? new Uint8Array(); - if (object.proofOps !== undefined && object.proofOps !== null) { - message.proofOps = ProofOps.fromPartial(object.proofOps); - } - if (object.height !== undefined && object.height !== null) { - message.height = BigInt(object.height.toString()); - } + message.proofOps = object.proofOps !== undefined && object.proofOps !== null ? ProofOps.fromPartial(object.proofOps) : undefined; + message.height = object.height !== undefined && object.height !== null ? BigInt(object.height.toString()) : BigInt(0); message.codespace = object.codespace ?? ""; return message; }, @@ -4207,9 +4340,9 @@ export const ResponseBeginBlock = { return message; }, fromJSON(object: any): ResponseBeginBlock { - const obj = createBaseResponseBeginBlock(); - if (Array.isArray(object?.events)) obj.events = object.events.map((e: any) => Event.fromJSON(e)); - return obj; + return { + events: Array.isArray(object?.events) ? object.events.map((e: any) => Event.fromJSON(e)) : [] + }; }, toJSON(message: ResponseBeginBlock): JsonSafe<ResponseBeginBlock> { const obj: any = {}; @@ -4289,28 +4422,28 @@ function createBaseResponseCheckTx(): ResponseCheckTx { export const ResponseCheckTx = { typeUrl: "/tendermint.abci.ResponseCheckTx", encode(message: ResponseCheckTx, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.code !== undefined) { + if (message.code !== 0) { writer.uint32(8).uint32(message.code); } if (message.data.length !== 0) { writer.uint32(18).bytes(message.data); } - if (message.log !== undefined) { + if (message.log !== "") { writer.uint32(26).string(message.log); } - if (message.info !== undefined) { + if (message.info !== "") { writer.uint32(34).string(message.info); } - if (message.gasWanted !== undefined) { + if (message.gasWanted !== BigInt(0)) { writer.uint32(40).int64(message.gasWanted); } - if (message.gasUsed !== undefined) { + if (message.gasUsed !== BigInt(0)) { writer.uint32(48).int64(message.gasUsed); } for (const v of message.events) { Event.encode(v!, writer.uint32(58).fork()).ldelim(); } - if (message.codespace !== undefined) { + if (message.codespace !== "") { writer.uint32(66).string(message.codespace); } return writer; @@ -4354,16 +4487,16 @@ export const ResponseCheckTx = { return message; }, fromJSON(object: any): ResponseCheckTx { - const obj = createBaseResponseCheckTx(); - if (isSet(object.code)) obj.code = Number(object.code); - if (isSet(object.data)) obj.data = bytesFromBase64(object.data); - if (isSet(object.log)) obj.log = String(object.log); - if (isSet(object.info)) obj.info = String(object.info); - if (isSet(object.gas_wanted)) obj.gasWanted = BigInt(object.gas_wanted.toString()); - if (isSet(object.gas_used)) obj.gasUsed = BigInt(object.gas_used.toString()); - if (Array.isArray(object?.events)) obj.events = object.events.map((e: any) => Event.fromJSON(e)); - if (isSet(object.codespace)) obj.codespace = String(object.codespace); - return obj; + return { + code: isSet(object.code) ? Number(object.code) : 0, + data: isSet(object.data) ? bytesFromBase64(object.data) : new Uint8Array(), + log: isSet(object.log) ? String(object.log) : "", + info: isSet(object.info) ? String(object.info) : "", + gasWanted: isSet(object.gas_wanted) ? BigInt(object.gas_wanted.toString()) : BigInt(0), + gasUsed: isSet(object.gas_used) ? BigInt(object.gas_used.toString()) : BigInt(0), + events: Array.isArray(object?.events) ? object.events.map((e: any) => Event.fromJSON(e)) : [], + codespace: isSet(object.codespace) ? String(object.codespace) : "" + }; }, toJSON(message: ResponseCheckTx): JsonSafe<ResponseCheckTx> { const obj: any = {}; @@ -4387,12 +4520,8 @@ export const ResponseCheckTx = { message.data = object.data ?? new Uint8Array(); message.log = object.log ?? ""; message.info = object.info ?? ""; - if (object.gasWanted !== undefined && object.gasWanted !== null) { - message.gasWanted = BigInt(object.gasWanted.toString()); - } - if (object.gasUsed !== undefined && object.gasUsed !== null) { - message.gasUsed = BigInt(object.gasUsed.toString()); - } + message.gasWanted = object.gasWanted !== undefined && object.gasWanted !== null ? BigInt(object.gasWanted.toString()) : BigInt(0); + message.gasUsed = object.gasUsed !== undefined && object.gasUsed !== null ? BigInt(object.gasUsed.toString()) : BigInt(0); message.events = object.events?.map(e => Event.fromPartial(e)) || []; message.codespace = object.codespace ?? ""; return message; @@ -4510,28 +4639,28 @@ function createBaseResponseDeliverTx(): ResponseDeliverTx { export const ResponseDeliverTx = { typeUrl: "/tendermint.abci.ResponseDeliverTx", encode(message: ResponseDeliverTx, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.code !== undefined) { + if (message.code !== 0) { writer.uint32(8).uint32(message.code); } if (message.data.length !== 0) { writer.uint32(18).bytes(message.data); } - if (message.log !== undefined) { + if (message.log !== "") { writer.uint32(26).string(message.log); } - if (message.info !== undefined) { + if (message.info !== "") { writer.uint32(34).string(message.info); } - if (message.gasWanted !== undefined) { + if (message.gasWanted !== BigInt(0)) { writer.uint32(40).int64(message.gasWanted); } - if (message.gasUsed !== undefined) { + if (message.gasUsed !== BigInt(0)) { writer.uint32(48).int64(message.gasUsed); } for (const v of message.events) { Event.encode(v!, writer.uint32(58).fork()).ldelim(); } - if (message.codespace !== undefined) { + if (message.codespace !== "") { writer.uint32(66).string(message.codespace); } return writer; @@ -4575,16 +4704,16 @@ export const ResponseDeliverTx = { return message; }, fromJSON(object: any): ResponseDeliverTx { - const obj = createBaseResponseDeliverTx(); - if (isSet(object.code)) obj.code = Number(object.code); - if (isSet(object.data)) obj.data = bytesFromBase64(object.data); - if (isSet(object.log)) obj.log = String(object.log); - if (isSet(object.info)) obj.info = String(object.info); - if (isSet(object.gas_wanted)) obj.gasWanted = BigInt(object.gas_wanted.toString()); - if (isSet(object.gas_used)) obj.gasUsed = BigInt(object.gas_used.toString()); - if (Array.isArray(object?.events)) obj.events = object.events.map((e: any) => Event.fromJSON(e)); - if (isSet(object.codespace)) obj.codespace = String(object.codespace); - return obj; + return { + code: isSet(object.code) ? Number(object.code) : 0, + data: isSet(object.data) ? bytesFromBase64(object.data) : new Uint8Array(), + log: isSet(object.log) ? String(object.log) : "", + info: isSet(object.info) ? String(object.info) : "", + gasWanted: isSet(object.gas_wanted) ? BigInt(object.gas_wanted.toString()) : BigInt(0), + gasUsed: isSet(object.gas_used) ? BigInt(object.gas_used.toString()) : BigInt(0), + events: Array.isArray(object?.events) ? object.events.map((e: any) => Event.fromJSON(e)) : [], + codespace: isSet(object.codespace) ? String(object.codespace) : "" + }; }, toJSON(message: ResponseDeliverTx): JsonSafe<ResponseDeliverTx> { const obj: any = {}; @@ -4608,12 +4737,8 @@ export const ResponseDeliverTx = { message.data = object.data ?? new Uint8Array(); message.log = object.log ?? ""; message.info = object.info ?? ""; - if (object.gasWanted !== undefined && object.gasWanted !== null) { - message.gasWanted = BigInt(object.gasWanted.toString()); - } - if (object.gasUsed !== undefined && object.gasUsed !== null) { - message.gasUsed = BigInt(object.gasUsed.toString()); - } + message.gasWanted = object.gasWanted !== undefined && object.gasWanted !== null ? BigInt(object.gasWanted.toString()) : BigInt(0); + message.gasUsed = object.gasUsed !== undefined && object.gasUsed !== null ? BigInt(object.gasUsed.toString()) : BigInt(0); message.events = object.events?.map(e => Event.fromPartial(e)) || []; message.codespace = object.codespace ?? ""; return message; @@ -4761,11 +4886,11 @@ export const ResponseEndBlock = { return message; }, fromJSON(object: any): ResponseEndBlock { - const obj = createBaseResponseEndBlock(); - if (Array.isArray(object?.validatorUpdates)) obj.validatorUpdates = object.validatorUpdates.map((e: any) => ValidatorUpdate.fromJSON(e)); - if (isSet(object.consensusParamUpdates)) obj.consensusParamUpdates = ConsensusParams.fromJSON(object.consensusParamUpdates); - if (Array.isArray(object?.events)) obj.events = object.events.map((e: any) => Event.fromJSON(e)); - return obj; + return { + validatorUpdates: Array.isArray(object?.validatorUpdates) ? object.validatorUpdates.map((e: any) => ValidatorUpdate.fromJSON(e)) : [], + consensusParamUpdates: isSet(object.consensusParamUpdates) ? ConsensusParams.fromJSON(object.consensusParamUpdates) : undefined, + events: Array.isArray(object?.events) ? object.events.map((e: any) => Event.fromJSON(e)) : [] + }; }, toJSON(message: ResponseEndBlock): JsonSafe<ResponseEndBlock> { const obj: any = {}; @@ -4785,9 +4910,7 @@ export const ResponseEndBlock = { fromPartial(object: DeepPartial<ResponseEndBlock>): ResponseEndBlock { const message = createBaseResponseEndBlock(); message.validatorUpdates = object.validatorUpdates?.map(e => ValidatorUpdate.fromPartial(e)) || []; - if (object.consensusParamUpdates !== undefined && object.consensusParamUpdates !== null) { - message.consensusParamUpdates = ConsensusParams.fromPartial(object.consensusParamUpdates); - } + message.consensusParamUpdates = object.consensusParamUpdates !== undefined && object.consensusParamUpdates !== null ? ConsensusParams.fromPartial(object.consensusParamUpdates) : undefined; message.events = object.events?.map(e => Event.fromPartial(e)) || []; return message; }, @@ -4872,7 +4995,7 @@ export const ResponseCommit = { if (message.data.length !== 0) { writer.uint32(18).bytes(message.data); } - if (message.retainHeight !== undefined) { + if (message.retainHeight !== BigInt(0)) { writer.uint32(24).int64(message.retainHeight); } return writer; @@ -4898,10 +5021,10 @@ export const ResponseCommit = { return message; }, fromJSON(object: any): ResponseCommit { - const obj = createBaseResponseCommit(); - if (isSet(object.data)) obj.data = bytesFromBase64(object.data); - if (isSet(object.retainHeight)) obj.retainHeight = BigInt(object.retainHeight.toString()); - return obj; + return { + data: isSet(object.data) ? bytesFromBase64(object.data) : new Uint8Array(), + retainHeight: isSet(object.retainHeight) ? BigInt(object.retainHeight.toString()) : BigInt(0) + }; }, toJSON(message: ResponseCommit): JsonSafe<ResponseCommit> { const obj: any = {}; @@ -4912,9 +5035,7 @@ export const ResponseCommit = { fromPartial(object: DeepPartial<ResponseCommit>): ResponseCommit { const message = createBaseResponseCommit(); message.data = object.data ?? new Uint8Array(); - if (object.retainHeight !== undefined && object.retainHeight !== null) { - message.retainHeight = BigInt(object.retainHeight.toString()); - } + message.retainHeight = object.retainHeight !== undefined && object.retainHeight !== null ? BigInt(object.retainHeight.toString()) : BigInt(0); return message; }, fromSDK(object: ResponseCommitSDKType): ResponseCommit { @@ -4998,9 +5119,9 @@ export const ResponseListSnapshots = { return message; }, fromJSON(object: any): ResponseListSnapshots { - const obj = createBaseResponseListSnapshots(); - if (Array.isArray(object?.snapshots)) obj.snapshots = object.snapshots.map((e: any) => Snapshot.fromJSON(e)); - return obj; + return { + snapshots: Array.isArray(object?.snapshots) ? object.snapshots.map((e: any) => Snapshot.fromJSON(e)) : [] + }; }, toJSON(message: ResponseListSnapshots): JsonSafe<ResponseListSnapshots> { const obj: any = {}; @@ -5096,9 +5217,9 @@ export const ResponseOfferSnapshot = { return message; }, fromJSON(object: any): ResponseOfferSnapshot { - const obj = createBaseResponseOfferSnapshot(); - if (isSet(object.result)) obj.result = responseOfferSnapshot_ResultFromJSON(object.result); - return obj; + return { + result: isSet(object.result) ? responseOfferSnapshot_ResultFromJSON(object.result) : -1 + }; }, toJSON(message: ResponseOfferSnapshot): JsonSafe<ResponseOfferSnapshot> { const obj: any = {}; @@ -5184,9 +5305,9 @@ export const ResponseLoadSnapshotChunk = { return message; }, fromJSON(object: any): ResponseLoadSnapshotChunk { - const obj = createBaseResponseLoadSnapshotChunk(); - if (isSet(object.chunk)) obj.chunk = bytesFromBase64(object.chunk); - return obj; + return { + chunk: isSet(object.chunk) ? bytesFromBase64(object.chunk) : new Uint8Array() + }; }, toJSON(message: ResponseLoadSnapshotChunk): JsonSafe<ResponseLoadSnapshotChunk> { const obj: any = {}; @@ -5295,11 +5416,11 @@ export const ResponseApplySnapshotChunk = { return message; }, fromJSON(object: any): ResponseApplySnapshotChunk { - const obj = createBaseResponseApplySnapshotChunk(); - if (isSet(object.result)) obj.result = responseApplySnapshotChunk_ResultFromJSON(object.result); - if (Array.isArray(object?.refetchChunks)) obj.refetchChunks = object.refetchChunks.map((e: any) => Number(e)); - if (Array.isArray(object?.rejectSenders)) obj.rejectSenders = object.rejectSenders.map((e: any) => String(e)); - return obj; + return { + result: isSet(object.result) ? responseApplySnapshotChunk_ResultFromJSON(object.result) : -1, + refetchChunks: Array.isArray(object?.refetchChunks) ? object.refetchChunks.map((e: any) => Number(e)) : [], + rejectSenders: Array.isArray(object?.rejectSenders) ? object.rejectSenders.map((e: any) => String(e)) : [] + }; }, toJSON(message: ResponseApplySnapshotChunk): JsonSafe<ResponseApplySnapshotChunk> { const obj: any = {}; @@ -5444,12 +5565,12 @@ export const ConsensusParams = { return message; }, fromJSON(object: any): ConsensusParams { - const obj = createBaseConsensusParams(); - if (isSet(object.block)) obj.block = BlockParams.fromJSON(object.block); - if (isSet(object.evidence)) obj.evidence = EvidenceParams.fromJSON(object.evidence); - if (isSet(object.validator)) obj.validator = ValidatorParams.fromJSON(object.validator); - if (isSet(object.version)) obj.version = VersionParams.fromJSON(object.version); - return obj; + return { + block: isSet(object.block) ? BlockParams.fromJSON(object.block) : undefined, + evidence: isSet(object.evidence) ? EvidenceParams.fromJSON(object.evidence) : undefined, + validator: isSet(object.validator) ? ValidatorParams.fromJSON(object.validator) : undefined, + version: isSet(object.version) ? VersionParams.fromJSON(object.version) : undefined + }; }, toJSON(message: ConsensusParams): JsonSafe<ConsensusParams> { const obj: any = {}; @@ -5461,18 +5582,10 @@ export const ConsensusParams = { }, fromPartial(object: DeepPartial<ConsensusParams>): ConsensusParams { const message = createBaseConsensusParams(); - if (object.block !== undefined && object.block !== null) { - message.block = BlockParams.fromPartial(object.block); - } - if (object.evidence !== undefined && object.evidence !== null) { - message.evidence = EvidenceParams.fromPartial(object.evidence); - } - if (object.validator !== undefined && object.validator !== null) { - message.validator = ValidatorParams.fromPartial(object.validator); - } - if (object.version !== undefined && object.version !== null) { - message.version = VersionParams.fromPartial(object.version); - } + message.block = object.block !== undefined && object.block !== null ? BlockParams.fromPartial(object.block) : undefined; + message.evidence = object.evidence !== undefined && object.evidence !== null ? EvidenceParams.fromPartial(object.evidence) : undefined; + message.validator = object.validator !== undefined && object.validator !== null ? ValidatorParams.fromPartial(object.validator) : undefined; + message.version = object.version !== undefined && object.version !== null ? VersionParams.fromPartial(object.version) : undefined; return message; }, fromSDK(object: ConsensusParamsSDKType): ConsensusParams { @@ -5548,10 +5661,10 @@ function createBaseBlockParams(): BlockParams { export const BlockParams = { typeUrl: "/tendermint.abci.BlockParams", encode(message: BlockParams, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.maxBytes !== undefined) { + if (message.maxBytes !== BigInt(0)) { writer.uint32(8).int64(message.maxBytes); } - if (message.maxGas !== undefined) { + if (message.maxGas !== BigInt(0)) { writer.uint32(16).int64(message.maxGas); } return writer; @@ -5577,10 +5690,10 @@ export const BlockParams = { return message; }, fromJSON(object: any): BlockParams { - const obj = createBaseBlockParams(); - if (isSet(object.maxBytes)) obj.maxBytes = BigInt(object.maxBytes.toString()); - if (isSet(object.maxGas)) obj.maxGas = BigInt(object.maxGas.toString()); - return obj; + return { + maxBytes: isSet(object.maxBytes) ? BigInt(object.maxBytes.toString()) : BigInt(0), + maxGas: isSet(object.maxGas) ? BigInt(object.maxGas.toString()) : BigInt(0) + }; }, toJSON(message: BlockParams): JsonSafe<BlockParams> { const obj: any = {}; @@ -5590,12 +5703,8 @@ export const BlockParams = { }, fromPartial(object: DeepPartial<BlockParams>): BlockParams { const message = createBaseBlockParams(); - if (object.maxBytes !== undefined && object.maxBytes !== null) { - message.maxBytes = BigInt(object.maxBytes.toString()); - } - if (object.maxGas !== undefined && object.maxGas !== null) { - message.maxGas = BigInt(object.maxGas.toString()); - } + message.maxBytes = object.maxBytes !== undefined && object.maxBytes !== null ? BigInt(object.maxBytes.toString()) : BigInt(0); + message.maxGas = object.maxGas !== undefined && object.maxGas !== null ? BigInt(object.maxGas.toString()) : BigInt(0); return message; }, fromSDK(object: BlockParamsSDKType): BlockParams { @@ -5657,7 +5766,7 @@ function createBaseLastCommitInfo(): LastCommitInfo { export const LastCommitInfo = { typeUrl: "/tendermint.abci.LastCommitInfo", encode(message: LastCommitInfo, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.round !== undefined) { + if (message.round !== 0) { writer.uint32(8).int32(message.round); } for (const v of message.votes) { @@ -5686,10 +5795,10 @@ export const LastCommitInfo = { return message; }, fromJSON(object: any): LastCommitInfo { - const obj = createBaseLastCommitInfo(); - if (isSet(object.round)) obj.round = Number(object.round); - if (Array.isArray(object?.votes)) obj.votes = object.votes.map((e: any) => VoteInfo.fromJSON(e)); - return obj; + return { + round: isSet(object.round) ? Number(object.round) : 0, + votes: Array.isArray(object?.votes) ? object.votes.map((e: any) => VoteInfo.fromJSON(e)) : [] + }; }, toJSON(message: LastCommitInfo): JsonSafe<LastCommitInfo> { const obj: any = {}; @@ -5772,7 +5881,7 @@ function createBaseEvent(): Event { export const Event = { typeUrl: "/tendermint.abci.Event", encode(message: Event, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.type !== undefined) { + if (message.type !== "") { writer.uint32(10).string(message.type); } for (const v of message.attributes) { @@ -5801,10 +5910,10 @@ export const Event = { return message; }, fromJSON(object: any): Event { - const obj = createBaseEvent(); - if (isSet(object.type)) obj.type = String(object.type); - if (Array.isArray(object?.attributes)) obj.attributes = object.attributes.map((e: any) => EventAttribute.fromJSON(e)); - return obj; + return { + type: isSet(object.type) ? String(object.type) : "", + attributes: Array.isArray(object?.attributes) ? object.attributes.map((e: any) => EventAttribute.fromJSON(e)) : [] + }; }, toJSON(message: Event): JsonSafe<Event> { const obj: any = {}; @@ -5894,7 +6003,7 @@ export const EventAttribute = { if (message.value.length !== 0) { writer.uint32(18).bytes(message.value); } - if (message.index !== undefined) { + if (message.index === true) { writer.uint32(24).bool(message.index); } return writer; @@ -5923,11 +6032,11 @@ export const EventAttribute = { return message; }, fromJSON(object: any): EventAttribute { - const obj = createBaseEventAttribute(); - if (isSet(object.key)) obj.key = bytesFromBase64(object.key); - if (isSet(object.value)) obj.value = bytesFromBase64(object.value); - if (isSet(object.index)) obj.index = Boolean(object.index); - return obj; + return { + key: isSet(object.key) ? bytesFromBase64(object.key) : new Uint8Array(), + value: isSet(object.value) ? bytesFromBase64(object.value) : new Uint8Array(), + index: isSet(object.index) ? Boolean(object.index) : false + }; }, toJSON(message: EventAttribute): JsonSafe<EventAttribute> { const obj: any = {}; @@ -6011,10 +6120,10 @@ function createBaseTxResult(): TxResult { export const TxResult = { typeUrl: "/tendermint.abci.TxResult", encode(message: TxResult, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.height !== undefined) { + if (message.height !== BigInt(0)) { writer.uint32(8).int64(message.height); } - if (message.index !== undefined) { + if (message.index !== 0) { writer.uint32(16).uint32(message.index); } if (message.tx.length !== 0) { @@ -6052,12 +6161,12 @@ export const TxResult = { return message; }, fromJSON(object: any): TxResult { - const obj = createBaseTxResult(); - if (isSet(object.height)) obj.height = BigInt(object.height.toString()); - if (isSet(object.index)) obj.index = Number(object.index); - if (isSet(object.tx)) obj.tx = bytesFromBase64(object.tx); - if (isSet(object.result)) obj.result = ResponseDeliverTx.fromJSON(object.result); - return obj; + return { + height: isSet(object.height) ? BigInt(object.height.toString()) : BigInt(0), + index: isSet(object.index) ? Number(object.index) : 0, + tx: isSet(object.tx) ? bytesFromBase64(object.tx) : new Uint8Array(), + result: isSet(object.result) ? ResponseDeliverTx.fromJSON(object.result) : undefined + }; }, toJSON(message: TxResult): JsonSafe<TxResult> { const obj: any = {}; @@ -6069,14 +6178,10 @@ export const TxResult = { }, fromPartial(object: DeepPartial<TxResult>): TxResult { const message = createBaseTxResult(); - if (object.height !== undefined && object.height !== null) { - message.height = BigInt(object.height.toString()); - } + message.height = object.height !== undefined && object.height !== null ? BigInt(object.height.toString()) : BigInt(0); message.index = object.index ?? 0; message.tx = object.tx ?? new Uint8Array(); - if (object.result !== undefined && object.result !== null) { - message.result = ResponseDeliverTx.fromPartial(object.result); - } + message.result = object.result !== undefined && object.result !== null ? ResponseDeliverTx.fromPartial(object.result) : undefined; return message; }, fromSDK(object: TxResultSDKType): TxResult { @@ -6155,7 +6260,7 @@ export const Validator = { if (message.address.length !== 0) { writer.uint32(10).bytes(message.address); } - if (message.power !== undefined) { + if (message.power !== BigInt(0)) { writer.uint32(24).int64(message.power); } return writer; @@ -6181,10 +6286,10 @@ export const Validator = { return message; }, fromJSON(object: any): Validator { - const obj = createBaseValidator(); - if (isSet(object.address)) obj.address = bytesFromBase64(object.address); - if (isSet(object.power)) obj.power = BigInt(object.power.toString()); - return obj; + return { + address: isSet(object.address) ? bytesFromBase64(object.address) : new Uint8Array(), + power: isSet(object.power) ? BigInt(object.power.toString()) : BigInt(0) + }; }, toJSON(message: Validator): JsonSafe<Validator> { const obj: any = {}; @@ -6195,9 +6300,7 @@ export const Validator = { fromPartial(object: DeepPartial<Validator>): Validator { const message = createBaseValidator(); message.address = object.address ?? new Uint8Array(); - if (object.power !== undefined && object.power !== null) { - message.power = BigInt(object.power.toString()); - } + message.power = object.power !== undefined && object.power !== null ? BigInt(object.power.toString()) : BigInt(0); return message; }, fromSDK(object: ValidatorSDKType): Validator { @@ -6262,7 +6365,7 @@ export const ValidatorUpdate = { if (message.pubKey !== undefined) { PublicKey.encode(message.pubKey, writer.uint32(10).fork()).ldelim(); } - if (message.power !== undefined) { + if (message.power !== BigInt(0)) { writer.uint32(16).int64(message.power); } return writer; @@ -6288,10 +6391,10 @@ export const ValidatorUpdate = { return message; }, fromJSON(object: any): ValidatorUpdate { - const obj = createBaseValidatorUpdate(); - if (isSet(object.pubKey)) obj.pubKey = PublicKey.fromJSON(object.pubKey); - if (isSet(object.power)) obj.power = BigInt(object.power.toString()); - return obj; + return { + pubKey: isSet(object.pubKey) ? PublicKey.fromJSON(object.pubKey) : undefined, + power: isSet(object.power) ? BigInt(object.power.toString()) : BigInt(0) + }; }, toJSON(message: ValidatorUpdate): JsonSafe<ValidatorUpdate> { const obj: any = {}; @@ -6301,12 +6404,8 @@ export const ValidatorUpdate = { }, fromPartial(object: DeepPartial<ValidatorUpdate>): ValidatorUpdate { const message = createBaseValidatorUpdate(); - if (object.pubKey !== undefined && object.pubKey !== null) { - message.pubKey = PublicKey.fromPartial(object.pubKey); - } - if (object.power !== undefined && object.power !== null) { - message.power = BigInt(object.power.toString()); - } + message.pubKey = object.pubKey !== undefined && object.pubKey !== null ? PublicKey.fromPartial(object.pubKey) : undefined; + message.power = object.power !== undefined && object.power !== null ? BigInt(object.power.toString()) : BigInt(0); return message; }, fromSDK(object: ValidatorUpdateSDKType): ValidatorUpdate { @@ -6371,7 +6470,7 @@ export const VoteInfo = { if (message.validator !== undefined) { Validator.encode(message.validator, writer.uint32(10).fork()).ldelim(); } - if (message.signedLastBlock !== undefined) { + if (message.signedLastBlock === true) { writer.uint32(16).bool(message.signedLastBlock); } return writer; @@ -6397,10 +6496,10 @@ export const VoteInfo = { return message; }, fromJSON(object: any): VoteInfo { - const obj = createBaseVoteInfo(); - if (isSet(object.validator)) obj.validator = Validator.fromJSON(object.validator); - if (isSet(object.signedLastBlock)) obj.signedLastBlock = Boolean(object.signedLastBlock); - return obj; + return { + validator: isSet(object.validator) ? Validator.fromJSON(object.validator) : undefined, + signedLastBlock: isSet(object.signedLastBlock) ? Boolean(object.signedLastBlock) : false + }; }, toJSON(message: VoteInfo): JsonSafe<VoteInfo> { const obj: any = {}; @@ -6410,9 +6509,7 @@ export const VoteInfo = { }, fromPartial(object: DeepPartial<VoteInfo>): VoteInfo { const message = createBaseVoteInfo(); - if (object.validator !== undefined && object.validator !== null) { - message.validator = Validator.fromPartial(object.validator); - } + message.validator = object.validator !== undefined && object.validator !== null ? Validator.fromPartial(object.validator) : undefined; message.signedLastBlock = object.signedLastBlock ?? false; return message; }, @@ -6484,13 +6581,13 @@ export const Evidence = { if (message.validator !== undefined) { Validator.encode(message.validator, writer.uint32(18).fork()).ldelim(); } - if (message.height !== undefined) { + if (message.height !== BigInt(0)) { writer.uint32(24).int64(message.height); } if (message.time !== undefined) { Timestamp.encode(toTimestamp(message.time), writer.uint32(34).fork()).ldelim(); } - if (message.totalVotingPower !== undefined) { + if (message.totalVotingPower !== BigInt(0)) { writer.uint32(40).int64(message.totalVotingPower); } return writer; @@ -6525,13 +6622,13 @@ export const Evidence = { return message; }, fromJSON(object: any): Evidence { - const obj = createBaseEvidence(); - if (isSet(object.type)) obj.type = evidenceTypeFromJSON(object.type); - if (isSet(object.validator)) obj.validator = Validator.fromJSON(object.validator); - if (isSet(object.height)) obj.height = BigInt(object.height.toString()); - if (isSet(object.time)) obj.time = new Date(object.time); - if (isSet(object.totalVotingPower)) obj.totalVotingPower = BigInt(object.totalVotingPower.toString()); - return obj; + return { + type: isSet(object.type) ? evidenceTypeFromJSON(object.type) : -1, + validator: isSet(object.validator) ? Validator.fromJSON(object.validator) : undefined, + height: isSet(object.height) ? BigInt(object.height.toString()) : BigInt(0), + time: isSet(object.time) ? new Date(object.time) : undefined, + totalVotingPower: isSet(object.totalVotingPower) ? BigInt(object.totalVotingPower.toString()) : BigInt(0) + }; }, toJSON(message: Evidence): JsonSafe<Evidence> { const obj: any = {}; @@ -6545,16 +6642,10 @@ export const Evidence = { fromPartial(object: DeepPartial<Evidence>): Evidence { const message = createBaseEvidence(); message.type = object.type ?? 0; - if (object.validator !== undefined && object.validator !== null) { - message.validator = Validator.fromPartial(object.validator); - } - if (object.height !== undefined && object.height !== null) { - message.height = BigInt(object.height.toString()); - } + message.validator = object.validator !== undefined && object.validator !== null ? Validator.fromPartial(object.validator) : undefined; + message.height = object.height !== undefined && object.height !== null ? BigInt(object.height.toString()) : BigInt(0); message.time = object.time ?? undefined; - if (object.totalVotingPower !== undefined && object.totalVotingPower !== null) { - message.totalVotingPower = BigInt(object.totalVotingPower.toString()); - } + message.totalVotingPower = object.totalVotingPower !== undefined && object.totalVotingPower !== null ? BigInt(object.totalVotingPower.toString()) : BigInt(0); return message; }, fromSDK(object: EvidenceSDKType): Evidence { @@ -6640,13 +6731,13 @@ function createBaseSnapshot(): Snapshot { export const Snapshot = { typeUrl: "/tendermint.abci.Snapshot", encode(message: Snapshot, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.height !== undefined) { + if (message.height !== BigInt(0)) { writer.uint32(8).uint64(message.height); } - if (message.format !== undefined) { + if (message.format !== 0) { writer.uint32(16).uint32(message.format); } - if (message.chunks !== undefined) { + if (message.chunks !== 0) { writer.uint32(24).uint32(message.chunks); } if (message.hash.length !== 0) { @@ -6687,13 +6778,13 @@ export const Snapshot = { return message; }, fromJSON(object: any): Snapshot { - const obj = createBaseSnapshot(); - if (isSet(object.height)) obj.height = BigInt(object.height.toString()); - if (isSet(object.format)) obj.format = Number(object.format); - if (isSet(object.chunks)) obj.chunks = Number(object.chunks); - if (isSet(object.hash)) obj.hash = bytesFromBase64(object.hash); - if (isSet(object.metadata)) obj.metadata = bytesFromBase64(object.metadata); - return obj; + return { + height: isSet(object.height) ? BigInt(object.height.toString()) : BigInt(0), + format: isSet(object.format) ? Number(object.format) : 0, + chunks: isSet(object.chunks) ? Number(object.chunks) : 0, + hash: isSet(object.hash) ? bytesFromBase64(object.hash) : new Uint8Array(), + metadata: isSet(object.metadata) ? bytesFromBase64(object.metadata) : new Uint8Array() + }; }, toJSON(message: Snapshot): JsonSafe<Snapshot> { const obj: any = {}; @@ -6706,9 +6797,7 @@ export const Snapshot = { }, fromPartial(object: DeepPartial<Snapshot>): Snapshot { const message = createBaseSnapshot(); - if (object.height !== undefined && object.height !== null) { - message.height = BigInt(object.height.toString()); - } + message.height = object.height !== undefined && object.height !== null ? BigInt(object.height.toString()) : BigInt(0); message.format = object.format ?? 0; message.chunks = object.chunks ?? 0; message.hash = object.hash ?? new Uint8Array(); diff --git a/__fixtures__/v-next/outputv4/tendermint/bundle.ts b/__fixtures__/v-next/outputv4/tendermint/bundle.ts index 168b2d6d4d..0ff51c03af 100644 --- a/__fixtures__/v-next/outputv4/tendermint/bundle.ts +++ b/__fixtures__/v-next/outputv4/tendermint/bundle.ts @@ -1,46 +1,46 @@ -import * as _305 from "./abci/types.js"; -import * as _306 from "./crypto/keys.js"; -import * as _307 from "./crypto/proof.js"; -import * as _308 from "./libs/bits/types.js"; -import * as _309 from "./p2p/types.js"; -import * as _310 from "./types/block.js"; -import * as _311 from "./types/evidence.js"; -import * as _312 from "./types/params.js"; -import * as _313 from "./types/types.js"; -import * as _314 from "./types/validator.js"; -import * as _315 from "./version/types.js"; -import * as _535 from "./abci/types.rpc.ABCIApplication.js"; -import * as _560 from "./lcd.js"; -import * as _561 from "./rpc.query.js"; +import * as _352 from "./abci/types"; +import * as _353 from "./crypto/keys"; +import * as _354 from "./crypto/proof"; +import * as _355 from "./libs/bits/types"; +import * as _356 from "./p2p/types"; +import * as _357 from "./types/block"; +import * as _358 from "./types/evidence"; +import * as _359 from "./types/params"; +import * as _360 from "./types/types"; +import * as _361 from "./types/validator"; +import * as _362 from "./version/types"; +import * as _619 from "./abci/types.rpc.ABCIApplication"; +import * as _644 from "./lcd"; +import * as _645 from "./rpc.query"; export namespace tendermint { export const abci = { - ..._305, - ..._535 + ..._352, + ..._619 }; export const crypto = { - ..._306, - ..._307 + ..._353, + ..._354 }; export namespace libs { export const bits = { - ..._308 + ..._355 }; } export const p2p = { - ..._309 + ..._356 }; export const types = { - ..._310, - ..._311, - ..._312, - ..._313, - ..._314 + ..._357, + ..._358, + ..._359, + ..._360, + ..._361 }; export const version = { - ..._315 + ..._362 }; export const ClientFactory = { - ..._560, - ..._561 + ..._644, + ..._645 }; } \ No newline at end of file diff --git a/__fixtures__/v-next/outputv4/tendermint/crypto/keys.ts b/__fixtures__/v-next/outputv4/tendermint/crypto/keys.ts index 5e648834aa..6d844e38a4 100644 --- a/__fixtures__/v-next/outputv4/tendermint/crypto/keys.ts +++ b/__fixtures__/v-next/outputv4/tendermint/crypto/keys.ts @@ -1,12 +1,17 @@ -import { BinaryReader, BinaryWriter } from "../../binary.js"; -import { isSet, bytesFromBase64, base64FromBytes, DeepPartial } from "../../helpers.js"; -import { JsonSafe } from "../../json-safe.js"; +import { BinaryReader, BinaryWriter } from "../../binary"; +import { isSet, bytesFromBase64, base64FromBytes, DeepPartial } from "../../helpers"; +import { JsonSafe } from "../../json-safe"; +import { ComputedRef } from "vue"; export const protobufPackage = "tendermint.crypto"; /** PublicKey defines the keys available for use with Tendermint Validators */ export interface PublicKey { ed25519?: Uint8Array; secp256k1?: Uint8Array; } +export interface ReactivePublicKey { + ed25519?: ComputedRef<Uint8Array>; + secp256k1?: ComputedRef<Uint8Array>; +} export interface PublicKeyProtoMsg { typeUrl: "/tendermint.crypto.PublicKey"; value: Uint8Array; @@ -54,10 +59,10 @@ export const PublicKey = { return message; }, fromJSON(object: any): PublicKey { - const obj = createBasePublicKey(); - if (isSet(object.ed25519)) obj.ed25519 = bytesFromBase64(object.ed25519); - if (isSet(object.secp256k1)) obj.secp256k1 = bytesFromBase64(object.secp256k1); - return obj; + return { + ed25519: isSet(object.ed25519) ? bytesFromBase64(object.ed25519) : undefined, + secp256k1: isSet(object.secp256k1) ? bytesFromBase64(object.secp256k1) : undefined + }; }, toJSON(message: PublicKey): JsonSafe<PublicKey> { const obj: any = {}; diff --git a/__fixtures__/v-next/outputv4/tendermint/crypto/proof.ts b/__fixtures__/v-next/outputv4/tendermint/crypto/proof.ts index b1f4bbde67..aea7ade008 100644 --- a/__fixtures__/v-next/outputv4/tendermint/crypto/proof.ts +++ b/__fixtures__/v-next/outputv4/tendermint/crypto/proof.ts @@ -1,6 +1,7 @@ -import { BinaryReader, BinaryWriter } from "../../binary.js"; -import { isSet, bytesFromBase64, base64FromBytes, DeepPartial } from "../../helpers.js"; -import { JsonSafe } from "../../json-safe.js"; +import { BinaryReader, BinaryWriter } from "../../binary"; +import { isSet, bytesFromBase64, base64FromBytes, DeepPartial } from "../../helpers"; +import { JsonSafe } from "../../json-safe"; +import { ComputedRef } from "vue"; export const protobufPackage = "tendermint.crypto"; export interface Proof { total: bigint; @@ -8,6 +9,12 @@ export interface Proof { leafHash: Uint8Array; aunts: Uint8Array[]; } +export interface ReactiveProof { + total: ComputedRef<bigint>; + index: ComputedRef<bigint>; + leafHash: ComputedRef<Uint8Array>; + aunts: ComputedRef<Uint8Array[]>; +} export interface ProofProtoMsg { typeUrl: "/tendermint.crypto.Proof"; value: Uint8Array; @@ -24,6 +31,10 @@ export interface ValueOp { /** To encode in ProofOp.Data */ proof?: Proof; } +export interface ReactiveValueOp { + key: ComputedRef<Uint8Array>; + proof?: ComputedRef<Proof>; +} export interface ValueOpProtoMsg { typeUrl: "/tendermint.crypto.ValueOp"; value: Uint8Array; @@ -37,6 +48,11 @@ export interface DominoOp { input: string; output: string; } +export interface ReactiveDominoOp { + key: ComputedRef<string>; + input: ComputedRef<string>; + output: ComputedRef<string>; +} export interface DominoOpProtoMsg { typeUrl: "/tendermint.crypto.DominoOp"; value: Uint8Array; @@ -56,6 +72,11 @@ export interface ProofOp { key: Uint8Array; data: Uint8Array; } +export interface ReactiveProofOp { + type: ComputedRef<string>; + key: ComputedRef<Uint8Array>; + data: ComputedRef<Uint8Array>; +} export interface ProofOpProtoMsg { typeUrl: "/tendermint.crypto.ProofOp"; value: Uint8Array; @@ -74,6 +95,9 @@ export interface ProofOpSDKType { export interface ProofOps { ops: ProofOp[]; } +export interface ReactiveProofOps { + ops: ComputedRef<ProofOp[]>; +} export interface ProofOpsProtoMsg { typeUrl: "/tendermint.crypto.ProofOps"; value: Uint8Array; @@ -93,10 +117,10 @@ function createBaseProof(): Proof { export const Proof = { typeUrl: "/tendermint.crypto.Proof", encode(message: Proof, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.total !== undefined) { + if (message.total !== BigInt(0)) { writer.uint32(8).int64(message.total); } - if (message.index !== undefined) { + if (message.index !== BigInt(0)) { writer.uint32(16).int64(message.index); } if (message.leafHash.length !== 0) { @@ -134,12 +158,12 @@ export const Proof = { return message; }, fromJSON(object: any): Proof { - const obj = createBaseProof(); - if (isSet(object.total)) obj.total = BigInt(object.total.toString()); - if (isSet(object.index)) obj.index = BigInt(object.index.toString()); - if (isSet(object.leafHash)) obj.leafHash = bytesFromBase64(object.leafHash); - if (Array.isArray(object?.aunts)) obj.aunts = object.aunts.map((e: any) => bytesFromBase64(e)); - return obj; + return { + total: isSet(object.total) ? BigInt(object.total.toString()) : BigInt(0), + index: isSet(object.index) ? BigInt(object.index.toString()) : BigInt(0), + leafHash: isSet(object.leafHash) ? bytesFromBase64(object.leafHash) : new Uint8Array(), + aunts: Array.isArray(object?.aunts) ? object.aunts.map((e: any) => bytesFromBase64(e)) : [] + }; }, toJSON(message: Proof): JsonSafe<Proof> { const obj: any = {}; @@ -155,12 +179,8 @@ export const Proof = { }, fromPartial(object: DeepPartial<Proof>): Proof { const message = createBaseProof(); - if (object.total !== undefined && object.total !== null) { - message.total = BigInt(object.total.toString()); - } - if (object.index !== undefined && object.index !== null) { - message.index = BigInt(object.index.toString()); - } + message.total = object.total !== undefined && object.total !== null ? BigInt(object.total.toString()) : BigInt(0); + message.index = object.index !== undefined && object.index !== null ? BigInt(object.index.toString()) : BigInt(0); message.leafHash = object.leafHash ?? new Uint8Array(); message.aunts = object.aunts?.map(e => e) || []; return message; @@ -273,10 +293,10 @@ export const ValueOp = { return message; }, fromJSON(object: any): ValueOp { - const obj = createBaseValueOp(); - if (isSet(object.key)) obj.key = bytesFromBase64(object.key); - if (isSet(object.proof)) obj.proof = Proof.fromJSON(object.proof); - return obj; + return { + key: isSet(object.key) ? bytesFromBase64(object.key) : new Uint8Array(), + proof: isSet(object.proof) ? Proof.fromJSON(object.proof) : undefined + }; }, toJSON(message: ValueOp): JsonSafe<ValueOp> { const obj: any = {}; @@ -287,9 +307,7 @@ export const ValueOp = { fromPartial(object: DeepPartial<ValueOp>): ValueOp { const message = createBaseValueOp(); message.key = object.key ?? new Uint8Array(); - if (object.proof !== undefined && object.proof !== null) { - message.proof = Proof.fromPartial(object.proof); - } + message.proof = object.proof !== undefined && object.proof !== null ? Proof.fromPartial(object.proof) : undefined; return message; }, fromSDK(object: ValueOpSDKType): ValueOp { @@ -352,13 +370,13 @@ function createBaseDominoOp(): DominoOp { export const DominoOp = { typeUrl: "/tendermint.crypto.DominoOp", encode(message: DominoOp, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.key !== undefined) { + if (message.key !== "") { writer.uint32(10).string(message.key); } - if (message.input !== undefined) { + if (message.input !== "") { writer.uint32(18).string(message.input); } - if (message.output !== undefined) { + if (message.output !== "") { writer.uint32(26).string(message.output); } return writer; @@ -387,11 +405,11 @@ export const DominoOp = { return message; }, fromJSON(object: any): DominoOp { - const obj = createBaseDominoOp(); - if (isSet(object.key)) obj.key = String(object.key); - if (isSet(object.input)) obj.input = String(object.input); - if (isSet(object.output)) obj.output = String(object.output); - return obj; + return { + key: isSet(object.key) ? String(object.key) : "", + input: isSet(object.input) ? String(object.input) : "", + output: isSet(object.output) ? String(object.output) : "" + }; }, toJSON(message: DominoOp): JsonSafe<DominoOp> { const obj: any = {}; @@ -474,7 +492,7 @@ function createBaseProofOp(): ProofOp { export const ProofOp = { typeUrl: "/tendermint.crypto.ProofOp", encode(message: ProofOp, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.type !== undefined) { + if (message.type !== "") { writer.uint32(10).string(message.type); } if (message.key.length !== 0) { @@ -509,11 +527,11 @@ export const ProofOp = { return message; }, fromJSON(object: any): ProofOp { - const obj = createBaseProofOp(); - if (isSet(object.type)) obj.type = String(object.type); - if (isSet(object.key)) obj.key = bytesFromBase64(object.key); - if (isSet(object.data)) obj.data = bytesFromBase64(object.data); - return obj; + return { + type: isSet(object.type) ? String(object.type) : "", + key: isSet(object.key) ? bytesFromBase64(object.key) : new Uint8Array(), + data: isSet(object.data) ? bytesFromBase64(object.data) : new Uint8Array() + }; }, toJSON(message: ProofOp): JsonSafe<ProofOp> { const obj: any = {}; @@ -617,9 +635,9 @@ export const ProofOps = { return message; }, fromJSON(object: any): ProofOps { - const obj = createBaseProofOps(); - if (Array.isArray(object?.ops)) obj.ops = object.ops.map((e: any) => ProofOp.fromJSON(e)); - return obj; + return { + ops: Array.isArray(object?.ops) ? object.ops.map((e: any) => ProofOp.fromJSON(e)) : [] + }; }, toJSON(message: ProofOps): JsonSafe<ProofOps> { const obj: any = {}; diff --git a/__fixtures__/v-next/outputv4/tendermint/lcd.ts b/__fixtures__/v-next/outputv4/tendermint/lcd.ts index 5cc526f519..2d42461fd6 100644 --- a/__fixtures__/v-next/outputv4/tendermint/lcd.ts +++ b/__fixtures__/v-next/outputv4/tendermint/lcd.ts @@ -37,6 +37,11 @@ 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/tendermint/libs/bits/types.ts b/__fixtures__/v-next/outputv4/tendermint/libs/bits/types.ts index c069612e74..e7ce3e1dad 100644 --- a/__fixtures__/v-next/outputv4/tendermint/libs/bits/types.ts +++ b/__fixtures__/v-next/outputv4/tendermint/libs/bits/types.ts @@ -1,11 +1,16 @@ -import { BinaryReader, BinaryWriter } from "../../../binary.js"; -import { isSet, DeepPartial } from "../../../helpers.js"; -import { JsonSafe } from "../../../json-safe.js"; +import { BinaryReader, BinaryWriter } from "../../../binary"; +import { isSet, DeepPartial } from "../../../helpers"; +import { JsonSafe } from "../../../json-safe"; +import { ComputedRef } from "vue"; export const protobufPackage = "tendermint.libs.bits"; export interface BitArray { bits: bigint; elems: bigint[]; } +export interface ReactiveBitArray { + bits: ComputedRef<bigint>; + elems: ComputedRef<bigint[]>; +} export interface BitArrayProtoMsg { typeUrl: "/tendermint.libs.bits.BitArray"; value: Uint8Array; @@ -23,7 +28,7 @@ function createBaseBitArray(): BitArray { export const BitArray = { typeUrl: "/tendermint.libs.bits.BitArray", encode(message: BitArray, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.bits !== undefined) { + if (message.bits !== BigInt(0)) { writer.uint32(8).int64(message.bits); } writer.uint32(18).fork(); @@ -61,10 +66,10 @@ export const BitArray = { return message; }, fromJSON(object: any): BitArray { - const obj = createBaseBitArray(); - if (isSet(object.bits)) obj.bits = BigInt(object.bits.toString()); - if (Array.isArray(object?.elems)) obj.elems = object.elems.map((e: any) => BigInt(e.toString())); - return obj; + return { + bits: isSet(object.bits) ? BigInt(object.bits.toString()) : BigInt(0), + elems: Array.isArray(object?.elems) ? object.elems.map((e: any) => BigInt(e.toString())) : [] + }; }, toJSON(message: BitArray): JsonSafe<BitArray> { const obj: any = {}; @@ -78,9 +83,7 @@ export const BitArray = { }, fromPartial(object: DeepPartial<BitArray>): BitArray { const message = createBaseBitArray(); - if (object.bits !== undefined && object.bits !== null) { - message.bits = BigInt(object.bits.toString()); - } + message.bits = object.bits !== undefined && object.bits !== null ? BigInt(object.bits.toString()) : BigInt(0); message.elems = object.elems?.map(e => BigInt(e.toString())) || []; return message; }, diff --git a/__fixtures__/v-next/outputv4/tendermint/p2p/types.ts b/__fixtures__/v-next/outputv4/tendermint/p2p/types.ts index 7f7542323f..e26f5a7c9a 100644 --- a/__fixtures__/v-next/outputv4/tendermint/p2p/types.ts +++ b/__fixtures__/v-next/outputv4/tendermint/p2p/types.ts @@ -1,13 +1,19 @@ -import { Timestamp, TimestampSDKType } from "../../google/protobuf/timestamp.js"; -import { BinaryReader, BinaryWriter } from "../../binary.js"; -import { isSet, DeepPartial, bytesFromBase64, base64FromBytes, toTimestamp, fromTimestamp } from "../../helpers.js"; -import { JsonSafe } from "../../json-safe.js"; +import { Timestamp, TimestampSDKType } from "../../google/protobuf/timestamp"; +import { BinaryReader, BinaryWriter } from "../../binary"; +import { isSet, DeepPartial, bytesFromBase64, base64FromBytes, toTimestamp, fromTimestamp } from "../../helpers"; +import { JsonSafe } from "../../json-safe"; +import { ComputedRef } from "vue"; export const protobufPackage = "tendermint.p2p"; export interface ProtocolVersion { p2p: bigint; block: bigint; app: bigint; } +export interface ReactiveProtocolVersion { + p2p: ComputedRef<bigint>; + block: ComputedRef<bigint>; + app: ComputedRef<bigint>; +} export interface ProtocolVersionProtoMsg { typeUrl: "/tendermint.p2p.ProtocolVersion"; value: Uint8Array; @@ -27,6 +33,16 @@ export interface NodeInfo { moniker: string; other: NodeInfoOther; } +export interface ReactiveNodeInfo { + protocolVersion: ComputedRef<ProtocolVersion>; + nodeId: ComputedRef<string>; + listenAddr: ComputedRef<string>; + network: ComputedRef<string>; + version: ComputedRef<string>; + channels: ComputedRef<Uint8Array>; + moniker: ComputedRef<string>; + other: ComputedRef<NodeInfoOther>; +} export interface NodeInfoProtoMsg { typeUrl: "/tendermint.p2p.NodeInfo"; value: Uint8Array; @@ -45,6 +61,10 @@ export interface NodeInfoOther { txIndex: string; rpcAddress: string; } +export interface ReactiveNodeInfoOther { + txIndex: ComputedRef<string>; + rpcAddress: ComputedRef<string>; +} export interface NodeInfoOtherProtoMsg { typeUrl: "/tendermint.p2p.NodeInfoOther"; value: Uint8Array; @@ -58,6 +78,11 @@ export interface PeerInfo { addressInfo: PeerAddressInfo[]; lastConnected?: Date; } +export interface ReactivePeerInfo { + id: ComputedRef<string>; + addressInfo: ComputedRef<PeerAddressInfo[]>; + lastConnected?: ComputedRef<Date>; +} export interface PeerInfoProtoMsg { typeUrl: "/tendermint.p2p.PeerInfo"; value: Uint8Array; @@ -73,6 +98,12 @@ export interface PeerAddressInfo { lastDialFailure?: Date; dialFailures: number; } +export interface ReactivePeerAddressInfo { + address: ComputedRef<string>; + lastDialSuccess?: ComputedRef<Date>; + lastDialFailure?: ComputedRef<Date>; + dialFailures: ComputedRef<number>; +} export interface PeerAddressInfoProtoMsg { typeUrl: "/tendermint.p2p.PeerAddressInfo"; value: Uint8Array; @@ -93,13 +124,13 @@ function createBaseProtocolVersion(): ProtocolVersion { export const ProtocolVersion = { typeUrl: "/tendermint.p2p.ProtocolVersion", encode(message: ProtocolVersion, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.p2p !== undefined) { + if (message.p2p !== BigInt(0)) { writer.uint32(8).uint64(message.p2p); } - if (message.block !== undefined) { + if (message.block !== BigInt(0)) { writer.uint32(16).uint64(message.block); } - if (message.app !== undefined) { + if (message.app !== BigInt(0)) { writer.uint32(24).uint64(message.app); } return writer; @@ -128,11 +159,11 @@ export const ProtocolVersion = { return message; }, fromJSON(object: any): ProtocolVersion { - const obj = createBaseProtocolVersion(); - if (isSet(object.p2p)) obj.p2p = BigInt(object.p2p.toString()); - if (isSet(object.block)) obj.block = BigInt(object.block.toString()); - if (isSet(object.app)) obj.app = BigInt(object.app.toString()); - return obj; + return { + p2p: isSet(object.p2p) ? BigInt(object.p2p.toString()) : BigInt(0), + block: isSet(object.block) ? BigInt(object.block.toString()) : BigInt(0), + app: isSet(object.app) ? BigInt(object.app.toString()) : BigInt(0) + }; }, toJSON(message: ProtocolVersion): JsonSafe<ProtocolVersion> { const obj: any = {}; @@ -143,15 +174,9 @@ export const ProtocolVersion = { }, fromPartial(object: DeepPartial<ProtocolVersion>): ProtocolVersion { const message = createBaseProtocolVersion(); - if (object.p2p !== undefined && object.p2p !== null) { - message.p2p = BigInt(object.p2p.toString()); - } - if (object.block !== undefined && object.block !== null) { - message.block = BigInt(object.block.toString()); - } - if (object.app !== undefined && object.app !== null) { - message.app = BigInt(object.app.toString()); - } + message.p2p = object.p2p !== undefined && object.p2p !== null ? BigInt(object.p2p.toString()) : BigInt(0); + message.block = object.block !== undefined && object.block !== null ? BigInt(object.block.toString()) : BigInt(0); + message.app = object.app !== undefined && object.app !== null ? BigInt(object.app.toString()) : BigInt(0); return message; }, fromSDK(object: ProtocolVersionSDKType): ProtocolVersion { @@ -229,22 +254,22 @@ export const NodeInfo = { if (message.protocolVersion !== undefined) { ProtocolVersion.encode(message.protocolVersion, writer.uint32(10).fork()).ldelim(); } - if (message.nodeId !== undefined) { + if (message.nodeId !== "") { writer.uint32(18).string(message.nodeId); } - if (message.listenAddr !== undefined) { + if (message.listenAddr !== "") { writer.uint32(26).string(message.listenAddr); } - if (message.network !== undefined) { + if (message.network !== "") { writer.uint32(34).string(message.network); } - if (message.version !== undefined) { + if (message.version !== "") { writer.uint32(42).string(message.version); } if (message.channels.length !== 0) { writer.uint32(50).bytes(message.channels); } - if (message.moniker !== undefined) { + if (message.moniker !== "") { writer.uint32(58).string(message.moniker); } if (message.other !== undefined) { @@ -291,16 +316,16 @@ export const NodeInfo = { return message; }, fromJSON(object: any): NodeInfo { - const obj = createBaseNodeInfo(); - if (isSet(object.protocolVersion)) obj.protocolVersion = ProtocolVersion.fromJSON(object.protocolVersion); - if (isSet(object.nodeId)) obj.nodeId = String(object.nodeId); - if (isSet(object.listenAddr)) obj.listenAddr = String(object.listenAddr); - if (isSet(object.network)) obj.network = String(object.network); - if (isSet(object.version)) obj.version = String(object.version); - if (isSet(object.channels)) obj.channels = bytesFromBase64(object.channels); - if (isSet(object.moniker)) obj.moniker = String(object.moniker); - if (isSet(object.other)) obj.other = NodeInfoOther.fromJSON(object.other); - return obj; + return { + protocolVersion: isSet(object.protocolVersion) ? ProtocolVersion.fromJSON(object.protocolVersion) : undefined, + nodeId: isSet(object.nodeId) ? String(object.nodeId) : "", + listenAddr: isSet(object.listenAddr) ? String(object.listenAddr) : "", + network: isSet(object.network) ? String(object.network) : "", + version: isSet(object.version) ? String(object.version) : "", + channels: isSet(object.channels) ? bytesFromBase64(object.channels) : new Uint8Array(), + moniker: isSet(object.moniker) ? String(object.moniker) : "", + other: isSet(object.other) ? NodeInfoOther.fromJSON(object.other) : undefined + }; }, toJSON(message: NodeInfo): JsonSafe<NodeInfo> { const obj: any = {}; @@ -316,18 +341,14 @@ export const NodeInfo = { }, fromPartial(object: DeepPartial<NodeInfo>): NodeInfo { const message = createBaseNodeInfo(); - if (object.protocolVersion !== undefined && object.protocolVersion !== null) { - message.protocolVersion = ProtocolVersion.fromPartial(object.protocolVersion); - } + message.protocolVersion = object.protocolVersion !== undefined && object.protocolVersion !== null ? ProtocolVersion.fromPartial(object.protocolVersion) : undefined; message.nodeId = object.nodeId ?? ""; message.listenAddr = object.listenAddr ?? ""; message.network = object.network ?? ""; message.version = object.version ?? ""; message.channels = object.channels ?? new Uint8Array(); message.moniker = object.moniker ?? ""; - if (object.other !== undefined && object.other !== null) { - message.other = NodeInfoOther.fromPartial(object.other); - } + message.other = object.other !== undefined && object.other !== null ? NodeInfoOther.fromPartial(object.other) : undefined; return message; }, fromSDK(object: NodeInfoSDKType): NodeInfo { @@ -431,10 +452,10 @@ function createBaseNodeInfoOther(): NodeInfoOther { export const NodeInfoOther = { typeUrl: "/tendermint.p2p.NodeInfoOther", encode(message: NodeInfoOther, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.txIndex !== undefined) { + if (message.txIndex !== "") { writer.uint32(10).string(message.txIndex); } - if (message.rpcAddress !== undefined) { + if (message.rpcAddress !== "") { writer.uint32(18).string(message.rpcAddress); } return writer; @@ -460,10 +481,10 @@ export const NodeInfoOther = { return message; }, fromJSON(object: any): NodeInfoOther { - const obj = createBaseNodeInfoOther(); - if (isSet(object.txIndex)) obj.txIndex = String(object.txIndex); - if (isSet(object.rpcAddress)) obj.rpcAddress = String(object.rpcAddress); - return obj; + return { + txIndex: isSet(object.txIndex) ? String(object.txIndex) : "", + rpcAddress: isSet(object.rpcAddress) ? String(object.rpcAddress) : "" + }; }, toJSON(message: NodeInfoOther): JsonSafe<NodeInfoOther> { const obj: any = {}; @@ -537,7 +558,7 @@ function createBasePeerInfo(): PeerInfo { export const PeerInfo = { typeUrl: "/tendermint.p2p.PeerInfo", encode(message: PeerInfo, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.id !== undefined) { + if (message.id !== "") { writer.uint32(10).string(message.id); } for (const v of message.addressInfo) { @@ -572,11 +593,11 @@ export const PeerInfo = { return message; }, fromJSON(object: any): PeerInfo { - const obj = createBasePeerInfo(); - if (isSet(object.id)) obj.id = String(object.id); - if (Array.isArray(object?.addressInfo)) obj.addressInfo = object.addressInfo.map((e: any) => PeerAddressInfo.fromJSON(e)); - if (isSet(object.lastConnected)) obj.lastConnected = new Date(object.lastConnected); - return obj; + return { + id: isSet(object.id) ? String(object.id) : "", + addressInfo: Array.isArray(object?.addressInfo) ? object.addressInfo.map((e: any) => PeerAddressInfo.fromJSON(e)) : [], + lastConnected: isSet(object.lastConnected) ? new Date(object.lastConnected) : undefined + }; }, toJSON(message: PeerInfo): JsonSafe<PeerInfo> { const obj: any = {}; @@ -670,7 +691,7 @@ function createBasePeerAddressInfo(): PeerAddressInfo { export const PeerAddressInfo = { typeUrl: "/tendermint.p2p.PeerAddressInfo", encode(message: PeerAddressInfo, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.address !== undefined) { + if (message.address !== "") { writer.uint32(10).string(message.address); } if (message.lastDialSuccess !== undefined) { @@ -679,7 +700,7 @@ export const PeerAddressInfo = { if (message.lastDialFailure !== undefined) { Timestamp.encode(toTimestamp(message.lastDialFailure), writer.uint32(26).fork()).ldelim(); } - if (message.dialFailures !== undefined) { + if (message.dialFailures !== 0) { writer.uint32(32).uint32(message.dialFailures); } return writer; @@ -711,12 +732,12 @@ export const PeerAddressInfo = { return message; }, fromJSON(object: any): PeerAddressInfo { - const obj = createBasePeerAddressInfo(); - if (isSet(object.address)) obj.address = String(object.address); - if (isSet(object.lastDialSuccess)) obj.lastDialSuccess = new Date(object.lastDialSuccess); - if (isSet(object.lastDialFailure)) obj.lastDialFailure = new Date(object.lastDialFailure); - if (isSet(object.dialFailures)) obj.dialFailures = Number(object.dialFailures); - return obj; + return { + address: isSet(object.address) ? String(object.address) : "", + lastDialSuccess: isSet(object.lastDialSuccess) ? new Date(object.lastDialSuccess) : undefined, + lastDialFailure: isSet(object.lastDialFailure) ? new Date(object.lastDialFailure) : undefined, + dialFailures: isSet(object.dialFailures) ? Number(object.dialFailures) : 0 + }; }, toJSON(message: PeerAddressInfo): JsonSafe<PeerAddressInfo> { const obj: any = {}; diff --git a/__fixtures__/v-next/outputv4/tendermint/rpc.query.ts b/__fixtures__/v-next/outputv4/tendermint/rpc.query.ts index 6785cd44f0..a97403d24f 100644 --- a/__fixtures__/v-next/outputv4/tendermint/rpc.query.ts +++ b/__fixtures__/v-next/outputv4/tendermint/rpc.query.ts @@ -1,76 +1,79 @@ -import { Rpc } from "../helpers.js"; -import { connectComet, HttpEndpoint } from "@cosmjs/tendermint-rpc"; +import { Rpc } from "../helpers"; +import { Tendermint34Client, HttpEndpoint } from "@cosmjs/tendermint-rpc"; import { QueryClient } from "@cosmjs/stargate"; export const createRPCQueryClient = async ({ rpcEndpoint }: { rpcEndpoint: string | HttpEndpoint; }) => { - const tmClient = await connectComet(rpcEndpoint); + const tmClient = await Tendermint34Client.connect(rpcEndpoint); const client = new QueryClient(tmClient); return { cosmos: { app: { - v1alpha1: (await import("../cosmos/app/v1alpha1/query.rpc.Query.js")).createRpcQueryExtension(client) + v1alpha1: (await import("../cosmos/app/v1alpha1/query.rpc.Query")).createRpcQueryExtension(client) }, auth: { - v1beta1: (await import("../cosmos/auth/v1beta1/query.rpc.Query.js")).createRpcQueryExtension(client) + v1beta1: (await import("../cosmos/auth/v1beta1/query.rpc.Query")).createRpcQueryExtension(client) }, authz: { - v1beta1: (await import("../cosmos/authz/v1beta1/query.rpc.Query.js")).createRpcQueryExtension(client) + v1beta1: (await import("../cosmos/authz/v1beta1/query.rpc.Query")).createRpcQueryExtension(client) }, bank: { - v1beta1: (await import("../cosmos/bank/v1beta1/query.rpc.Query.js")).createRpcQueryExtension(client) + v1beta1: (await import("../cosmos/bank/v1beta1/query.rpc.Query")).createRpcQueryExtension(client) }, base: { reflection: { - 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) + v1beta1: (await import("../cosmos/base/reflection/v1beta1/reflection.rpc.ReflectionService")).createRpcQueryExtension(client), + v2alpha1: (await import("../cosmos/base/reflection/v2alpha1/reflection.rpc.ReflectionService")).createRpcQueryExtension(client) }, tendermint: { - v1beta1: (await import("../cosmos/base/tendermint/v1beta1/query.rpc.Service.js")).createRpcQueryExtension(client) + 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) } }, distribution: { - v1beta1: (await import("../cosmos/distribution/v1beta1/query.rpc.Query.js")).createRpcQueryExtension(client) + v1beta1: (await import("../cosmos/distribution/v1beta1/query.rpc.Query")).createRpcQueryExtension(client) }, evidence: { - v1beta1: (await import("../cosmos/evidence/v1beta1/query.rpc.Query.js")).createRpcQueryExtension(client) + v1beta1: (await import("../cosmos/evidence/v1beta1/query.rpc.Query")).createRpcQueryExtension(client) }, feegrant: { - v1beta1: (await import("../cosmos/feegrant/v1beta1/query.rpc.Query.js")).createRpcQueryExtension(client) + v1beta1: (await import("../cosmos/feegrant/v1beta1/query.rpc.Query")).createRpcQueryExtension(client) }, gov: { - v1: (await import("../cosmos/gov/v1/query.rpc.Query.js")).createRpcQueryExtension(client), - v1beta1: (await import("../cosmos/gov/v1beta1/query.rpc.Query.js")).createRpcQueryExtension(client) + v1: (await import("../cosmos/gov/v1/query.rpc.Query")).createRpcQueryExtension(client), + v1beta1: (await import("../cosmos/gov/v1beta1/query.rpc.Query")).createRpcQueryExtension(client) }, group: { - v1: (await import("../cosmos/group/v1/query.rpc.Query.js")).createRpcQueryExtension(client) + v1: (await import("../cosmos/group/v1/query.rpc.Query")).createRpcQueryExtension(client) }, mint: { - v1beta1: (await import("../cosmos/mint/v1beta1/query.rpc.Query.js")).createRpcQueryExtension(client) + v1beta1: (await import("../cosmos/mint/v1beta1/query.rpc.Query")).createRpcQueryExtension(client) }, nft: { - v1beta1: (await import("../cosmos/nft/v1beta1/query.rpc.Query.js")).createRpcQueryExtension(client) + v1beta1: (await import("../cosmos/nft/v1beta1/query.rpc.Query")).createRpcQueryExtension(client) }, params: { - v1beta1: (await import("../cosmos/params/v1beta1/query.rpc.Query.js")).createRpcQueryExtension(client) + v1beta1: (await import("../cosmos/params/v1beta1/query.rpc.Query")).createRpcQueryExtension(client) }, slashing: { - v1beta1: (await import("../cosmos/slashing/v1beta1/query.rpc.Query.js")).createRpcQueryExtension(client) + v1beta1: (await import("../cosmos/slashing/v1beta1/query.rpc.Query")).createRpcQueryExtension(client) }, staking: { - v1beta1: (await import("../cosmos/staking/v1beta1/query.rpc.Query.js")).createRpcQueryExtension(client) + v1beta1: (await import("../cosmos/staking/v1beta1/query.rpc.Query")).createRpcQueryExtension(client) }, tx: { - v1beta1: (await import("../cosmos/tx/v1beta1/service.rpc.Service.js")).createRpcQueryExtension(client) + v1beta1: (await import("../cosmos/tx/v1beta1/service.rpc.Service")).createRpcQueryExtension(client) }, upgrade: { - v1beta1: (await import("../cosmos/upgrade/v1beta1/query.rpc.Query.js")).createRpcQueryExtension(client) + v1beta1: (await import("../cosmos/upgrade/v1beta1/query.rpc.Query")).createRpcQueryExtension(client) } }, tendermint: { - abci: (await import("./abci/types.rpc.ABCIApplication.js")).createRpcQueryExtension(client) + abci: (await import("./abci/types.rpc.ABCIApplication")).createRpcQueryExtension(client) } }; }; \ No newline at end of file diff --git a/__fixtures__/v-next/outputv4/tendermint/types/block.ts b/__fixtures__/v-next/outputv4/tendermint/types/block.ts index ab81e18595..aa0543a0e7 100644 --- a/__fixtures__/v-next/outputv4/tendermint/types/block.ts +++ b/__fixtures__/v-next/outputv4/tendermint/types/block.ts @@ -1,8 +1,9 @@ -import { Header, HeaderSDKType, Data, DataSDKType, Commit, CommitSDKType } from "./types.js"; -import { EvidenceList, EvidenceListSDKType } from "./evidence.js"; -import { BinaryReader, BinaryWriter } from "../../binary.js"; -import { isSet, DeepPartial } from "../../helpers.js"; -import { JsonSafe } from "../../json-safe.js"; +import { Header, HeaderSDKType, Data, DataSDKType, Commit, CommitSDKType } from "./types"; +import { EvidenceList, EvidenceListSDKType } from "./evidence"; +import { BinaryReader, BinaryWriter } from "../../binary"; +import { isSet, DeepPartial } from "../../helpers"; +import { JsonSafe } from "../../json-safe"; +import { ComputedRef } from "vue"; export const protobufPackage = "tendermint.types"; export interface Block { header: Header; @@ -10,6 +11,12 @@ export interface Block { evidence: EvidenceList; lastCommit?: Commit; } +export interface ReactiveBlock { + header: ComputedRef<Header>; + data: ComputedRef<Data>; + evidence: ComputedRef<EvidenceList>; + lastCommit?: ComputedRef<Commit>; +} export interface BlockProtoMsg { typeUrl: "/tendermint.types.Block"; value: Uint8Array; @@ -72,12 +79,12 @@ export const Block = { return message; }, fromJSON(object: any): Block { - const obj = createBaseBlock(); - if (isSet(object.header)) obj.header = Header.fromJSON(object.header); - if (isSet(object.data)) obj.data = Data.fromJSON(object.data); - if (isSet(object.evidence)) obj.evidence = EvidenceList.fromJSON(object.evidence); - if (isSet(object.lastCommit)) obj.lastCommit = Commit.fromJSON(object.lastCommit); - return obj; + return { + header: isSet(object.header) ? Header.fromJSON(object.header) : undefined, + data: isSet(object.data) ? Data.fromJSON(object.data) : undefined, + evidence: isSet(object.evidence) ? EvidenceList.fromJSON(object.evidence) : undefined, + lastCommit: isSet(object.lastCommit) ? Commit.fromJSON(object.lastCommit) : undefined + }; }, toJSON(message: Block): JsonSafe<Block> { const obj: any = {}; @@ -89,18 +96,10 @@ export const Block = { }, fromPartial(object: DeepPartial<Block>): Block { const message = createBaseBlock(); - if (object.header !== undefined && object.header !== null) { - message.header = Header.fromPartial(object.header); - } - if (object.data !== undefined && object.data !== null) { - message.data = Data.fromPartial(object.data); - } - if (object.evidence !== undefined && object.evidence !== null) { - message.evidence = EvidenceList.fromPartial(object.evidence); - } - if (object.lastCommit !== undefined && object.lastCommit !== null) { - message.lastCommit = Commit.fromPartial(object.lastCommit); - } + message.header = object.header !== undefined && object.header !== null ? Header.fromPartial(object.header) : undefined; + message.data = object.data !== undefined && object.data !== null ? Data.fromPartial(object.data) : undefined; + message.evidence = object.evidence !== undefined && object.evidence !== null ? EvidenceList.fromPartial(object.evidence) : undefined; + message.lastCommit = object.lastCommit !== undefined && object.lastCommit !== null ? Commit.fromPartial(object.lastCommit) : undefined; return message; }, fromSDK(object: BlockSDKType): Block { diff --git a/__fixtures__/v-next/outputv4/tendermint/types/evidence.ts b/__fixtures__/v-next/outputv4/tendermint/types/evidence.ts index de48803067..3a7dc073df 100644 --- a/__fixtures__/v-next/outputv4/tendermint/types/evidence.ts +++ b/__fixtures__/v-next/outputv4/tendermint/types/evidence.ts @@ -1,14 +1,19 @@ -import { Vote, VoteSDKType, LightBlock, LightBlockSDKType } from "./types.js"; -import { Timestamp, TimestampSDKType } from "../../google/protobuf/timestamp.js"; -import { Validator, ValidatorSDKType } from "./validator.js"; -import { BinaryReader, BinaryWriter } from "../../binary.js"; -import { isSet, DeepPartial, toTimestamp, fromTimestamp } from "../../helpers.js"; -import { JsonSafe } from "../../json-safe.js"; +import { Vote, VoteSDKType, LightBlock, LightBlockSDKType } from "./types"; +import { Timestamp, TimestampSDKType } from "../../google/protobuf/timestamp"; +import { Validator, ValidatorSDKType } from "./validator"; +import { BinaryReader, BinaryWriter } from "../../binary"; +import { isSet, DeepPartial, toTimestamp, fromTimestamp } from "../../helpers"; +import { JsonSafe } from "../../json-safe"; +import { ComputedRef } from "vue"; export const protobufPackage = "tendermint.types"; export interface Evidence { duplicateVoteEvidence?: DuplicateVoteEvidence; lightClientAttackEvidence?: LightClientAttackEvidence; } +export interface ReactiveEvidence { + duplicateVoteEvidence?: ComputedRef<DuplicateVoteEvidence>; + lightClientAttackEvidence?: ComputedRef<LightClientAttackEvidence>; +} export interface EvidenceProtoMsg { typeUrl: "/tendermint.types.Evidence"; value: Uint8Array; @@ -25,6 +30,13 @@ export interface DuplicateVoteEvidence { validatorPower: bigint; timestamp: Date; } +export interface ReactiveDuplicateVoteEvidence { + voteA?: ComputedRef<Vote>; + voteB?: ComputedRef<Vote>; + totalVotingPower: ComputedRef<bigint>; + validatorPower: ComputedRef<bigint>; + timestamp: ComputedRef<Date>; +} export interface DuplicateVoteEvidenceProtoMsg { typeUrl: "/tendermint.types.DuplicateVoteEvidence"; value: Uint8Array; @@ -45,6 +57,13 @@ export interface LightClientAttackEvidence { totalVotingPower: bigint; timestamp: Date; } +export interface ReactiveLightClientAttackEvidence { + conflictingBlock?: ComputedRef<LightBlock>; + commonHeight: ComputedRef<bigint>; + byzantineValidators: ComputedRef<Validator[]>; + totalVotingPower: ComputedRef<bigint>; + timestamp: ComputedRef<Date>; +} export interface LightClientAttackEvidenceProtoMsg { typeUrl: "/tendermint.types.LightClientAttackEvidence"; value: Uint8Array; @@ -60,6 +79,9 @@ export interface LightClientAttackEvidenceSDKType { export interface EvidenceList { evidence: Evidence[]; } +export interface ReactiveEvidenceList { + evidence: ComputedRef<Evidence[]>; +} export interface EvidenceListProtoMsg { typeUrl: "/tendermint.types.EvidenceList"; value: Uint8Array; @@ -105,10 +127,10 @@ export const Evidence = { return message; }, fromJSON(object: any): Evidence { - const obj = createBaseEvidence(); - if (isSet(object.duplicateVoteEvidence)) obj.duplicateVoteEvidence = DuplicateVoteEvidence.fromJSON(object.duplicateVoteEvidence); - if (isSet(object.lightClientAttackEvidence)) obj.lightClientAttackEvidence = LightClientAttackEvidence.fromJSON(object.lightClientAttackEvidence); - return obj; + return { + duplicateVoteEvidence: isSet(object.duplicateVoteEvidence) ? DuplicateVoteEvidence.fromJSON(object.duplicateVoteEvidence) : undefined, + lightClientAttackEvidence: isSet(object.lightClientAttackEvidence) ? LightClientAttackEvidence.fromJSON(object.lightClientAttackEvidence) : undefined + }; }, toJSON(message: Evidence): JsonSafe<Evidence> { const obj: any = {}; @@ -118,12 +140,8 @@ export const Evidence = { }, fromPartial(object: DeepPartial<Evidence>): Evidence { const message = createBaseEvidence(); - if (object.duplicateVoteEvidence !== undefined && object.duplicateVoteEvidence !== null) { - message.duplicateVoteEvidence = DuplicateVoteEvidence.fromPartial(object.duplicateVoteEvidence); - } - if (object.lightClientAttackEvidence !== undefined && object.lightClientAttackEvidence !== null) { - message.lightClientAttackEvidence = LightClientAttackEvidence.fromPartial(object.lightClientAttackEvidence); - } + message.duplicateVoteEvidence = object.duplicateVoteEvidence !== undefined && object.duplicateVoteEvidence !== null ? DuplicateVoteEvidence.fromPartial(object.duplicateVoteEvidence) : undefined; + message.lightClientAttackEvidence = object.lightClientAttackEvidence !== undefined && object.lightClientAttackEvidence !== null ? LightClientAttackEvidence.fromPartial(object.lightClientAttackEvidence) : undefined; return message; }, fromSDK(object: EvidenceSDKType): Evidence { @@ -194,10 +212,10 @@ export const DuplicateVoteEvidence = { if (message.voteB !== undefined) { Vote.encode(message.voteB, writer.uint32(18).fork()).ldelim(); } - if (message.totalVotingPower !== undefined) { + if (message.totalVotingPower !== BigInt(0)) { writer.uint32(24).int64(message.totalVotingPower); } - if (message.validatorPower !== undefined) { + if (message.validatorPower !== BigInt(0)) { writer.uint32(32).int64(message.validatorPower); } if (message.timestamp !== undefined) { @@ -235,13 +253,13 @@ export const DuplicateVoteEvidence = { return message; }, fromJSON(object: any): DuplicateVoteEvidence { - const obj = createBaseDuplicateVoteEvidence(); - if (isSet(object.voteA)) obj.voteA = Vote.fromJSON(object.voteA); - if (isSet(object.voteB)) obj.voteB = Vote.fromJSON(object.voteB); - if (isSet(object.totalVotingPower)) obj.totalVotingPower = BigInt(object.totalVotingPower.toString()); - if (isSet(object.validatorPower)) obj.validatorPower = BigInt(object.validatorPower.toString()); - if (isSet(object.timestamp)) obj.timestamp = new Date(object.timestamp); - return obj; + return { + voteA: isSet(object.voteA) ? Vote.fromJSON(object.voteA) : undefined, + voteB: isSet(object.voteB) ? Vote.fromJSON(object.voteB) : undefined, + totalVotingPower: isSet(object.totalVotingPower) ? BigInt(object.totalVotingPower.toString()) : BigInt(0), + validatorPower: isSet(object.validatorPower) ? BigInt(object.validatorPower.toString()) : BigInt(0), + timestamp: isSet(object.timestamp) ? new Date(object.timestamp) : undefined + }; }, toJSON(message: DuplicateVoteEvidence): JsonSafe<DuplicateVoteEvidence> { const obj: any = {}; @@ -254,18 +272,10 @@ export const DuplicateVoteEvidence = { }, fromPartial(object: DeepPartial<DuplicateVoteEvidence>): DuplicateVoteEvidence { const message = createBaseDuplicateVoteEvidence(); - if (object.voteA !== undefined && object.voteA !== null) { - message.voteA = Vote.fromPartial(object.voteA); - } - if (object.voteB !== undefined && object.voteB !== null) { - message.voteB = Vote.fromPartial(object.voteB); - } - if (object.totalVotingPower !== undefined && object.totalVotingPower !== null) { - message.totalVotingPower = BigInt(object.totalVotingPower.toString()); - } - if (object.validatorPower !== undefined && object.validatorPower !== null) { - message.validatorPower = BigInt(object.validatorPower.toString()); - } + message.voteA = object.voteA !== undefined && object.voteA !== null ? Vote.fromPartial(object.voteA) : undefined; + message.voteB = object.voteB !== undefined && object.voteB !== null ? Vote.fromPartial(object.voteB) : undefined; + message.totalVotingPower = object.totalVotingPower !== undefined && object.totalVotingPower !== null ? BigInt(object.totalVotingPower.toString()) : BigInt(0); + message.validatorPower = object.validatorPower !== undefined && object.validatorPower !== null ? BigInt(object.validatorPower.toString()) : BigInt(0); message.timestamp = object.timestamp ?? undefined; return message; }, @@ -355,13 +365,13 @@ export const LightClientAttackEvidence = { if (message.conflictingBlock !== undefined) { LightBlock.encode(message.conflictingBlock, writer.uint32(10).fork()).ldelim(); } - if (message.commonHeight !== undefined) { + if (message.commonHeight !== BigInt(0)) { writer.uint32(16).int64(message.commonHeight); } for (const v of message.byzantineValidators) { Validator.encode(v!, writer.uint32(26).fork()).ldelim(); } - if (message.totalVotingPower !== undefined) { + if (message.totalVotingPower !== BigInt(0)) { writer.uint32(32).int64(message.totalVotingPower); } if (message.timestamp !== undefined) { @@ -399,13 +409,13 @@ export const LightClientAttackEvidence = { return message; }, fromJSON(object: any): LightClientAttackEvidence { - const obj = createBaseLightClientAttackEvidence(); - if (isSet(object.conflictingBlock)) obj.conflictingBlock = LightBlock.fromJSON(object.conflictingBlock); - if (isSet(object.commonHeight)) obj.commonHeight = BigInt(object.commonHeight.toString()); - if (Array.isArray(object?.byzantineValidators)) obj.byzantineValidators = object.byzantineValidators.map((e: any) => Validator.fromJSON(e)); - if (isSet(object.totalVotingPower)) obj.totalVotingPower = BigInt(object.totalVotingPower.toString()); - if (isSet(object.timestamp)) obj.timestamp = new Date(object.timestamp); - return obj; + return { + conflictingBlock: isSet(object.conflictingBlock) ? LightBlock.fromJSON(object.conflictingBlock) : undefined, + commonHeight: isSet(object.commonHeight) ? BigInt(object.commonHeight.toString()) : BigInt(0), + byzantineValidators: Array.isArray(object?.byzantineValidators) ? object.byzantineValidators.map((e: any) => Validator.fromJSON(e)) : [], + totalVotingPower: isSet(object.totalVotingPower) ? BigInt(object.totalVotingPower.toString()) : BigInt(0), + timestamp: isSet(object.timestamp) ? new Date(object.timestamp) : undefined + }; }, toJSON(message: LightClientAttackEvidence): JsonSafe<LightClientAttackEvidence> { const obj: any = {}; @@ -422,16 +432,10 @@ export const LightClientAttackEvidence = { }, fromPartial(object: DeepPartial<LightClientAttackEvidence>): LightClientAttackEvidence { const message = createBaseLightClientAttackEvidence(); - if (object.conflictingBlock !== undefined && object.conflictingBlock !== null) { - message.conflictingBlock = LightBlock.fromPartial(object.conflictingBlock); - } - if (object.commonHeight !== undefined && object.commonHeight !== null) { - message.commonHeight = BigInt(object.commonHeight.toString()); - } + message.conflictingBlock = object.conflictingBlock !== undefined && object.conflictingBlock !== null ? LightBlock.fromPartial(object.conflictingBlock) : undefined; + message.commonHeight = object.commonHeight !== undefined && object.commonHeight !== null ? BigInt(object.commonHeight.toString()) : BigInt(0); message.byzantineValidators = object.byzantineValidators?.map(e => Validator.fromPartial(e)) || []; - if (object.totalVotingPower !== undefined && object.totalVotingPower !== null) { - message.totalVotingPower = BigInt(object.totalVotingPower.toString()); - } + message.totalVotingPower = object.totalVotingPower !== undefined && object.totalVotingPower !== null ? BigInt(object.totalVotingPower.toString()) : BigInt(0); message.timestamp = object.timestamp ?? undefined; return message; }, @@ -543,9 +547,9 @@ export const EvidenceList = { return message; }, fromJSON(object: any): EvidenceList { - const obj = createBaseEvidenceList(); - if (Array.isArray(object?.evidence)) obj.evidence = object.evidence.map((e: any) => Evidence.fromJSON(e)); - return obj; + return { + evidence: Array.isArray(object?.evidence) ? object.evidence.map((e: any) => Evidence.fromJSON(e)) : [] + }; }, toJSON(message: EvidenceList): JsonSafe<EvidenceList> { const obj: any = {}; diff --git a/__fixtures__/v-next/outputv4/tendermint/types/params.ts b/__fixtures__/v-next/outputv4/tendermint/types/params.ts index 5d12b7b4cf..2101e6fb3f 100644 --- a/__fixtures__/v-next/outputv4/tendermint/types/params.ts +++ b/__fixtures__/v-next/outputv4/tendermint/types/params.ts @@ -1,7 +1,8 @@ -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"; +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"; export const protobufPackage = "tendermint.types"; /** * ConsensusParams contains consensus critical parameters that determine the @@ -13,6 +14,12 @@ export interface ConsensusParams { validator: ValidatorParams; version: VersionParams; } +export interface ReactiveConsensusParams { + block: ComputedRef<BlockParams>; + evidence: ComputedRef<EvidenceParams>; + validator: ComputedRef<ValidatorParams>; + version: ComputedRef<VersionParams>; +} export interface ConsensusParamsProtoMsg { typeUrl: "/tendermint.types.ConsensusParams"; value: Uint8Array; @@ -47,6 +54,11 @@ export interface BlockParams { */ timeIotaMs: bigint; } +export interface ReactiveBlockParams { + maxBytes: ComputedRef<bigint>; + maxGas: ComputedRef<bigint>; + timeIotaMs: ComputedRef<bigint>; +} export interface BlockParamsProtoMsg { typeUrl: "/tendermint.types.BlockParams"; value: Uint8Array; @@ -81,6 +93,11 @@ export interface EvidenceParams { */ maxBytes: bigint; } +export interface ReactiveEvidenceParams { + maxAgeNumBlocks: ComputedRef<bigint>; + maxAgeDuration: ComputedRef<Duration>; + maxBytes: ComputedRef<bigint>; +} export interface EvidenceParamsProtoMsg { typeUrl: "/tendermint.types.EvidenceParams"; value: Uint8Array; @@ -98,6 +115,9 @@ export interface EvidenceParamsSDKType { export interface ValidatorParams { pubKeyTypes: string[]; } +export interface ReactiveValidatorParams { + pubKeyTypes: ComputedRef<string[]>; +} export interface ValidatorParamsProtoMsg { typeUrl: "/tendermint.types.ValidatorParams"; value: Uint8Array; @@ -113,6 +133,9 @@ export interface ValidatorParamsSDKType { export interface VersionParams { appVersion: bigint; } +export interface ReactiveVersionParams { + appVersion: ComputedRef<bigint>; +} export interface VersionParamsProtoMsg { typeUrl: "/tendermint.types.VersionParams"; value: Uint8Array; @@ -130,6 +153,10 @@ export interface HashedParams { blockMaxBytes: bigint; blockMaxGas: bigint; } +export interface ReactiveHashedParams { + blockMaxBytes: ComputedRef<bigint>; + blockMaxGas: ComputedRef<bigint>; +} export interface HashedParamsProtoMsg { typeUrl: "/tendermint.types.HashedParams"; value: Uint8Array; @@ -195,12 +222,12 @@ export const ConsensusParams = { return message; }, fromJSON(object: any): ConsensusParams { - const obj = createBaseConsensusParams(); - if (isSet(object.block)) obj.block = BlockParams.fromJSON(object.block); - if (isSet(object.evidence)) obj.evidence = EvidenceParams.fromJSON(object.evidence); - if (isSet(object.validator)) obj.validator = ValidatorParams.fromJSON(object.validator); - if (isSet(object.version)) obj.version = VersionParams.fromJSON(object.version); - return obj; + return { + block: isSet(object.block) ? BlockParams.fromJSON(object.block) : undefined, + evidence: isSet(object.evidence) ? EvidenceParams.fromJSON(object.evidence) : undefined, + validator: isSet(object.validator) ? ValidatorParams.fromJSON(object.validator) : undefined, + version: isSet(object.version) ? VersionParams.fromJSON(object.version) : undefined + }; }, toJSON(message: ConsensusParams): JsonSafe<ConsensusParams> { const obj: any = {}; @@ -212,18 +239,10 @@ export const ConsensusParams = { }, fromPartial(object: DeepPartial<ConsensusParams>): ConsensusParams { const message = createBaseConsensusParams(); - if (object.block !== undefined && object.block !== null) { - message.block = BlockParams.fromPartial(object.block); - } - if (object.evidence !== undefined && object.evidence !== null) { - message.evidence = EvidenceParams.fromPartial(object.evidence); - } - if (object.validator !== undefined && object.validator !== null) { - message.validator = ValidatorParams.fromPartial(object.validator); - } - if (object.version !== undefined && object.version !== null) { - message.version = VersionParams.fromPartial(object.version); - } + message.block = object.block !== undefined && object.block !== null ? BlockParams.fromPartial(object.block) : undefined; + message.evidence = object.evidence !== undefined && object.evidence !== null ? EvidenceParams.fromPartial(object.evidence) : undefined; + message.validator = object.validator !== undefined && object.validator !== null ? ValidatorParams.fromPartial(object.validator) : undefined; + message.version = object.version !== undefined && object.version !== null ? VersionParams.fromPartial(object.version) : undefined; return message; }, fromSDK(object: ConsensusParamsSDKType): ConsensusParams { @@ -300,13 +319,13 @@ function createBaseBlockParams(): BlockParams { export const BlockParams = { typeUrl: "/tendermint.types.BlockParams", encode(message: BlockParams, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.maxBytes !== undefined) { + if (message.maxBytes !== BigInt(0)) { writer.uint32(8).int64(message.maxBytes); } - if (message.maxGas !== undefined) { + if (message.maxGas !== BigInt(0)) { writer.uint32(16).int64(message.maxGas); } - if (message.timeIotaMs !== undefined) { + if (message.timeIotaMs !== BigInt(0)) { writer.uint32(24).int64(message.timeIotaMs); } return writer; @@ -335,11 +354,11 @@ export const BlockParams = { return message; }, fromJSON(object: any): BlockParams { - const obj = createBaseBlockParams(); - if (isSet(object.maxBytes)) obj.maxBytes = BigInt(object.maxBytes.toString()); - if (isSet(object.maxGas)) obj.maxGas = BigInt(object.maxGas.toString()); - if (isSet(object.timeIotaMs)) obj.timeIotaMs = BigInt(object.timeIotaMs.toString()); - return obj; + return { + maxBytes: isSet(object.maxBytes) ? BigInt(object.maxBytes.toString()) : BigInt(0), + maxGas: isSet(object.maxGas) ? BigInt(object.maxGas.toString()) : BigInt(0), + timeIotaMs: isSet(object.timeIotaMs) ? BigInt(object.timeIotaMs.toString()) : BigInt(0) + }; }, toJSON(message: BlockParams): JsonSafe<BlockParams> { const obj: any = {}; @@ -350,15 +369,9 @@ export const BlockParams = { }, fromPartial(object: DeepPartial<BlockParams>): BlockParams { const message = createBaseBlockParams(); - if (object.maxBytes !== undefined && object.maxBytes !== null) { - message.maxBytes = BigInt(object.maxBytes.toString()); - } - if (object.maxGas !== undefined && object.maxGas !== null) { - message.maxGas = BigInt(object.maxGas.toString()); - } - if (object.timeIotaMs !== undefined && object.timeIotaMs !== null) { - message.timeIotaMs = BigInt(object.timeIotaMs.toString()); - } + message.maxBytes = object.maxBytes !== undefined && object.maxBytes !== null ? BigInt(object.maxBytes.toString()) : BigInt(0); + message.maxGas = object.maxGas !== undefined && object.maxGas !== null ? BigInt(object.maxGas.toString()) : BigInt(0); + message.timeIotaMs = object.timeIotaMs !== undefined && object.timeIotaMs !== null ? BigInt(object.timeIotaMs.toString()) : BigInt(0); return message; }, fromSDK(object: BlockParamsSDKType): BlockParams { @@ -428,13 +441,13 @@ function createBaseEvidenceParams(): EvidenceParams { export const EvidenceParams = { typeUrl: "/tendermint.types.EvidenceParams", encode(message: EvidenceParams, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.maxAgeNumBlocks !== undefined) { + if (message.maxAgeNumBlocks !== BigInt(0)) { writer.uint32(8).int64(message.maxAgeNumBlocks); } if (message.maxAgeDuration !== undefined) { Duration.encode(message.maxAgeDuration, writer.uint32(18).fork()).ldelim(); } - if (message.maxBytes !== undefined) { + if (message.maxBytes !== BigInt(0)) { writer.uint32(24).int64(message.maxBytes); } return writer; @@ -463,11 +476,11 @@ export const EvidenceParams = { return message; }, fromJSON(object: any): EvidenceParams { - const obj = createBaseEvidenceParams(); - if (isSet(object.maxAgeNumBlocks)) obj.maxAgeNumBlocks = BigInt(object.maxAgeNumBlocks.toString()); - if (isSet(object.maxAgeDuration)) obj.maxAgeDuration = Duration.fromJSON(object.maxAgeDuration); - if (isSet(object.maxBytes)) obj.maxBytes = BigInt(object.maxBytes.toString()); - return obj; + return { + maxAgeNumBlocks: isSet(object.maxAgeNumBlocks) ? BigInt(object.maxAgeNumBlocks.toString()) : BigInt(0), + maxAgeDuration: isSet(object.maxAgeDuration) ? Duration.fromJSON(object.maxAgeDuration) : undefined, + maxBytes: isSet(object.maxBytes) ? BigInt(object.maxBytes.toString()) : BigInt(0) + }; }, toJSON(message: EvidenceParams): JsonSafe<EvidenceParams> { const obj: any = {}; @@ -478,15 +491,9 @@ export const EvidenceParams = { }, fromPartial(object: DeepPartial<EvidenceParams>): EvidenceParams { const message = createBaseEvidenceParams(); - if (object.maxAgeNumBlocks !== undefined && object.maxAgeNumBlocks !== null) { - message.maxAgeNumBlocks = BigInt(object.maxAgeNumBlocks.toString()); - } - if (object.maxAgeDuration !== undefined && object.maxAgeDuration !== null) { - message.maxAgeDuration = Duration.fromPartial(object.maxAgeDuration); - } - if (object.maxBytes !== undefined && object.maxBytes !== null) { - message.maxBytes = BigInt(object.maxBytes.toString()); - } + message.maxAgeNumBlocks = object.maxAgeNumBlocks !== undefined && object.maxAgeNumBlocks !== null ? BigInt(object.maxAgeNumBlocks.toString()) : BigInt(0); + message.maxAgeDuration = object.maxAgeDuration !== undefined && object.maxAgeDuration !== null ? Duration.fromPartial(object.maxAgeDuration) : undefined; + message.maxBytes = object.maxBytes !== undefined && object.maxBytes !== null ? BigInt(object.maxBytes.toString()) : BigInt(0); return message; }, fromSDK(object: EvidenceParamsSDKType): EvidenceParams { @@ -577,9 +584,9 @@ export const ValidatorParams = { return message; }, fromJSON(object: any): ValidatorParams { - const obj = createBaseValidatorParams(); - if (Array.isArray(object?.pubKeyTypes)) obj.pubKeyTypes = object.pubKeyTypes.map((e: any) => String(e)); - return obj; + return { + pubKeyTypes: Array.isArray(object?.pubKeyTypes) ? object.pubKeyTypes.map((e: any) => String(e)) : [] + }; }, toJSON(message: ValidatorParams): JsonSafe<ValidatorParams> { const obj: any = {}; @@ -652,7 +659,7 @@ function createBaseVersionParams(): VersionParams { export const VersionParams = { typeUrl: "/tendermint.types.VersionParams", encode(message: VersionParams, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.appVersion !== undefined) { + if (message.appVersion !== BigInt(0)) { writer.uint32(8).uint64(message.appVersion); } return writer; @@ -675,9 +682,9 @@ export const VersionParams = { return message; }, fromJSON(object: any): VersionParams { - const obj = createBaseVersionParams(); - if (isSet(object.appVersion)) obj.appVersion = BigInt(object.appVersion.toString()); - return obj; + return { + appVersion: isSet(object.appVersion) ? BigInt(object.appVersion.toString()) : BigInt(0) + }; }, toJSON(message: VersionParams): JsonSafe<VersionParams> { const obj: any = {}; @@ -686,9 +693,7 @@ export const VersionParams = { }, fromPartial(object: DeepPartial<VersionParams>): VersionParams { const message = createBaseVersionParams(); - if (object.appVersion !== undefined && object.appVersion !== null) { - message.appVersion = BigInt(object.appVersion.toString()); - } + message.appVersion = object.appVersion !== undefined && object.appVersion !== null ? BigInt(object.appVersion.toString()) : BigInt(0); return message; }, fromSDK(object: VersionParamsSDKType): VersionParams { @@ -743,10 +748,10 @@ function createBaseHashedParams(): HashedParams { export const HashedParams = { typeUrl: "/tendermint.types.HashedParams", encode(message: HashedParams, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.blockMaxBytes !== undefined) { + if (message.blockMaxBytes !== BigInt(0)) { writer.uint32(8).int64(message.blockMaxBytes); } - if (message.blockMaxGas !== undefined) { + if (message.blockMaxGas !== BigInt(0)) { writer.uint32(16).int64(message.blockMaxGas); } return writer; @@ -772,10 +777,10 @@ export const HashedParams = { return message; }, fromJSON(object: any): HashedParams { - const obj = createBaseHashedParams(); - if (isSet(object.blockMaxBytes)) obj.blockMaxBytes = BigInt(object.blockMaxBytes.toString()); - if (isSet(object.blockMaxGas)) obj.blockMaxGas = BigInt(object.blockMaxGas.toString()); - return obj; + return { + blockMaxBytes: isSet(object.blockMaxBytes) ? BigInt(object.blockMaxBytes.toString()) : BigInt(0), + blockMaxGas: isSet(object.blockMaxGas) ? BigInt(object.blockMaxGas.toString()) : BigInt(0) + }; }, toJSON(message: HashedParams): JsonSafe<HashedParams> { const obj: any = {}; @@ -785,12 +790,8 @@ export const HashedParams = { }, fromPartial(object: DeepPartial<HashedParams>): HashedParams { const message = createBaseHashedParams(); - if (object.blockMaxBytes !== undefined && object.blockMaxBytes !== null) { - message.blockMaxBytes = BigInt(object.blockMaxBytes.toString()); - } - if (object.blockMaxGas !== undefined && object.blockMaxGas !== null) { - message.blockMaxGas = BigInt(object.blockMaxGas.toString()); - } + message.blockMaxBytes = object.blockMaxBytes !== undefined && object.blockMaxBytes !== null ? BigInt(object.blockMaxBytes.toString()) : BigInt(0); + message.blockMaxGas = object.blockMaxGas !== undefined && object.blockMaxGas !== null ? BigInt(object.blockMaxGas.toString()) : BigInt(0); return message; }, fromSDK(object: HashedParamsSDKType): HashedParams { diff --git a/__fixtures__/v-next/outputv4/tendermint/types/types.ts b/__fixtures__/v-next/outputv4/tendermint/types/types.ts index 3590d11744..1cea2ac157 100644 --- a/__fixtures__/v-next/outputv4/tendermint/types/types.ts +++ b/__fixtures__/v-next/outputv4/tendermint/types/types.ts @@ -1,10 +1,11 @@ -import { Proof, ProofSDKType } from "../crypto/proof.js"; -import { Consensus, ConsensusSDKType } from "../version/types.js"; -import { Timestamp, TimestampSDKType } from "../../google/protobuf/timestamp.js"; -import { ValidatorSet, ValidatorSetSDKType } from "./validator.js"; -import { BinaryReader, BinaryWriter } from "../../binary.js"; -import { isSet, bytesFromBase64, base64FromBytes, DeepPartial, toTimestamp, fromTimestamp } from "../../helpers.js"; -import { JsonSafe } from "../../json-safe.js"; +import { Proof, ProofSDKType } from "../crypto/proof"; +import { Consensus, ConsensusSDKType } from "../version/types"; +import { Timestamp, TimestampSDKType } from "../../google/protobuf/timestamp"; +import { ValidatorSet, ValidatorSetSDKType } from "./validator"; +import { BinaryReader, BinaryWriter } from "../../binary"; +import { isSet, bytesFromBase64, base64FromBytes, DeepPartial, toTimestamp, fromTimestamp } from "../../helpers"; +import { JsonSafe } from "../../json-safe"; +import { ComputedRef } from "vue"; export const protobufPackage = "tendermint.types"; /** BlockIdFlag indicates which BlcokID the signature is for */ export enum BlockIDFlag { @@ -101,6 +102,10 @@ export interface PartSetHeader { total: number; hash: Uint8Array; } +export interface ReactivePartSetHeader { + total: ComputedRef<number>; + hash: ComputedRef<Uint8Array>; +} export interface PartSetHeaderProtoMsg { typeUrl: "/tendermint.types.PartSetHeader"; value: Uint8Array; @@ -115,6 +120,11 @@ export interface Part { bytes: Uint8Array; proof: Proof; } +export interface ReactivePart { + index: ComputedRef<number>; + bytes: ComputedRef<Uint8Array>; + proof: ComputedRef<Proof>; +} export interface PartProtoMsg { typeUrl: "/tendermint.types.Part"; value: Uint8Array; @@ -129,6 +139,10 @@ export interface BlockID { hash: Uint8Array; partSetHeader: PartSetHeader; } +export interface ReactiveBlockID { + hash: ComputedRef<Uint8Array>; + partSetHeader: ComputedRef<PartSetHeader>; +} export interface BlockIDProtoMsg { typeUrl: "/tendermint.types.BlockID"; value: Uint8Array; @@ -166,6 +180,22 @@ export interface Header { /** original proposer of the block */ proposerAddress: Uint8Array; } +export interface ReactiveHeader { + version: ComputedRef<Consensus>; + chainId: ComputedRef<string>; + height: ComputedRef<bigint>; + time: ComputedRef<Date>; + lastBlockId: ComputedRef<BlockID>; + lastCommitHash: ComputedRef<Uint8Array>; + dataHash: ComputedRef<Uint8Array>; + validatorsHash: ComputedRef<Uint8Array>; + nextValidatorsHash: ComputedRef<Uint8Array>; + consensusHash: ComputedRef<Uint8Array>; + appHash: ComputedRef<Uint8Array>; + lastResultsHash: ComputedRef<Uint8Array>; + evidenceHash: ComputedRef<Uint8Array>; + proposerAddress: ComputedRef<Uint8Array>; +} export interface HeaderProtoMsg { typeUrl: "/tendermint.types.Header"; value: Uint8Array; @@ -196,6 +226,9 @@ export interface Data { */ txs: Uint8Array[]; } +export interface ReactiveData { + txs: ComputedRef<Uint8Array[]>; +} export interface DataProtoMsg { typeUrl: "/tendermint.types.Data"; value: Uint8Array; @@ -219,6 +252,16 @@ export interface Vote { validatorIndex: number; signature: Uint8Array; } +export interface ReactiveVote { + type: ComputedRef<SignedMsgType>; + height: ComputedRef<bigint>; + round: ComputedRef<number>; + blockId: ComputedRef<BlockID>; + timestamp: ComputedRef<Date>; + validatorAddress: ComputedRef<Uint8Array>; + validatorIndex: ComputedRef<number>; + signature: ComputedRef<Uint8Array>; +} export interface VoteProtoMsg { typeUrl: "/tendermint.types.Vote"; value: Uint8Array; @@ -244,6 +287,12 @@ export interface Commit { blockId: BlockID; signatures: CommitSig[]; } +export interface ReactiveCommit { + height: ComputedRef<bigint>; + round: ComputedRef<number>; + blockId: ComputedRef<BlockID>; + signatures: ComputedRef<CommitSig[]>; +} export interface CommitProtoMsg { typeUrl: "/tendermint.types.Commit"; value: Uint8Array; @@ -262,6 +311,12 @@ export interface CommitSig { timestamp: Date; signature: Uint8Array; } +export interface ReactiveCommitSig { + blockIdFlag: ComputedRef<BlockIDFlag>; + validatorAddress: ComputedRef<Uint8Array>; + timestamp: ComputedRef<Date>; + signature: ComputedRef<Uint8Array>; +} export interface CommitSigProtoMsg { typeUrl: "/tendermint.types.CommitSig"; value: Uint8Array; @@ -282,6 +337,15 @@ export interface Proposal { timestamp: Date; signature: Uint8Array; } +export interface ReactiveProposal { + type: ComputedRef<SignedMsgType>; + height: ComputedRef<bigint>; + round: ComputedRef<number>; + polRound: ComputedRef<number>; + blockId: ComputedRef<BlockID>; + timestamp: ComputedRef<Date>; + signature: ComputedRef<Uint8Array>; +} export interface ProposalProtoMsg { typeUrl: "/tendermint.types.Proposal"; value: Uint8Array; @@ -299,6 +363,10 @@ export interface SignedHeader { header?: Header; commit?: Commit; } +export interface ReactiveSignedHeader { + header?: ComputedRef<Header>; + commit?: ComputedRef<Commit>; +} export interface SignedHeaderProtoMsg { typeUrl: "/tendermint.types.SignedHeader"; value: Uint8Array; @@ -311,6 +379,10 @@ export interface LightBlock { signedHeader?: SignedHeader; validatorSet?: ValidatorSet; } +export interface ReactiveLightBlock { + signedHeader?: ComputedRef<SignedHeader>; + validatorSet?: ComputedRef<ValidatorSet>; +} export interface LightBlockProtoMsg { typeUrl: "/tendermint.types.LightBlock"; value: Uint8Array; @@ -325,6 +397,12 @@ export interface BlockMeta { header: Header; numTxs: bigint; } +export interface ReactiveBlockMeta { + blockId: ComputedRef<BlockID>; + blockSize: ComputedRef<bigint>; + header: ComputedRef<Header>; + numTxs: ComputedRef<bigint>; +} export interface BlockMetaProtoMsg { typeUrl: "/tendermint.types.BlockMeta"; value: Uint8Array; @@ -341,6 +419,11 @@ export interface TxProof { data: Uint8Array; proof?: Proof; } +export interface ReactiveTxProof { + rootHash: ComputedRef<Uint8Array>; + data: ComputedRef<Uint8Array>; + proof?: ComputedRef<Proof>; +} export interface TxProofProtoMsg { typeUrl: "/tendermint.types.TxProof"; value: Uint8Array; @@ -360,7 +443,7 @@ function createBasePartSetHeader(): PartSetHeader { export const PartSetHeader = { typeUrl: "/tendermint.types.PartSetHeader", encode(message: PartSetHeader, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.total !== undefined) { + if (message.total !== 0) { writer.uint32(8).uint32(message.total); } if (message.hash.length !== 0) { @@ -389,10 +472,10 @@ export const PartSetHeader = { return message; }, fromJSON(object: any): PartSetHeader { - const obj = createBasePartSetHeader(); - if (isSet(object.total)) obj.total = Number(object.total); - if (isSet(object.hash)) obj.hash = bytesFromBase64(object.hash); - return obj; + return { + total: isSet(object.total) ? Number(object.total) : 0, + hash: isSet(object.hash) ? bytesFromBase64(object.hash) : new Uint8Array() + }; }, toJSON(message: PartSetHeader): JsonSafe<PartSetHeader> { const obj: any = {}; @@ -466,7 +549,7 @@ function createBasePart(): Part { export const Part = { typeUrl: "/tendermint.types.Part", encode(message: Part, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.index !== undefined) { + if (message.index !== 0) { writer.uint32(8).uint32(message.index); } if (message.bytes.length !== 0) { @@ -501,11 +584,11 @@ export const Part = { return message; }, fromJSON(object: any): Part { - const obj = createBasePart(); - if (isSet(object.index)) obj.index = Number(object.index); - if (isSet(object.bytes)) obj.bytes = bytesFromBase64(object.bytes); - if (isSet(object.proof)) obj.proof = Proof.fromJSON(object.proof); - return obj; + return { + index: isSet(object.index) ? Number(object.index) : 0, + bytes: isSet(object.bytes) ? bytesFromBase64(object.bytes) : new Uint8Array(), + proof: isSet(object.proof) ? Proof.fromJSON(object.proof) : undefined + }; }, toJSON(message: Part): JsonSafe<Part> { const obj: any = {}; @@ -518,9 +601,7 @@ export const Part = { const message = createBasePart(); message.index = object.index ?? 0; message.bytes = object.bytes ?? new Uint8Array(); - if (object.proof !== undefined && object.proof !== null) { - message.proof = Proof.fromPartial(object.proof); - } + message.proof = object.proof !== undefined && object.proof !== null ? Proof.fromPartial(object.proof) : undefined; return message; }, fromSDK(object: PartSDKType): Part { @@ -618,10 +699,10 @@ export const BlockID = { return message; }, fromJSON(object: any): BlockID { - const obj = createBaseBlockID(); - if (isSet(object.hash)) obj.hash = bytesFromBase64(object.hash); - if (isSet(object.partSetHeader)) obj.partSetHeader = PartSetHeader.fromJSON(object.partSetHeader); - return obj; + return { + hash: isSet(object.hash) ? bytesFromBase64(object.hash) : new Uint8Array(), + partSetHeader: isSet(object.partSetHeader) ? PartSetHeader.fromJSON(object.partSetHeader) : undefined + }; }, toJSON(message: BlockID): JsonSafe<BlockID> { const obj: any = {}; @@ -632,9 +713,7 @@ export const BlockID = { fromPartial(object: DeepPartial<BlockID>): BlockID { const message = createBaseBlockID(); message.hash = object.hash ?? new Uint8Array(); - if (object.partSetHeader !== undefined && object.partSetHeader !== null) { - message.partSetHeader = PartSetHeader.fromPartial(object.partSetHeader); - } + message.partSetHeader = object.partSetHeader !== undefined && object.partSetHeader !== null ? PartSetHeader.fromPartial(object.partSetHeader) : undefined; return message; }, fromSDK(object: BlockIDSDKType): BlockID { @@ -711,10 +790,10 @@ export const Header = { if (message.version !== undefined) { Consensus.encode(message.version, writer.uint32(10).fork()).ldelim(); } - if (message.chainId !== undefined) { + if (message.chainId !== "") { writer.uint32(18).string(message.chainId); } - if (message.height !== undefined) { + if (message.height !== BigInt(0)) { writer.uint32(24).int64(message.height); } if (message.time !== undefined) { @@ -809,22 +888,22 @@ export const Header = { return message; }, fromJSON(object: any): Header { - const obj = createBaseHeader(); - if (isSet(object.version)) obj.version = Consensus.fromJSON(object.version); - if (isSet(object.chainId)) obj.chainId = String(object.chainId); - if (isSet(object.height)) obj.height = BigInt(object.height.toString()); - if (isSet(object.time)) obj.time = new Date(object.time); - if (isSet(object.lastBlockId)) obj.lastBlockId = BlockID.fromJSON(object.lastBlockId); - if (isSet(object.lastCommitHash)) obj.lastCommitHash = bytesFromBase64(object.lastCommitHash); - if (isSet(object.dataHash)) obj.dataHash = bytesFromBase64(object.dataHash); - if (isSet(object.validatorsHash)) obj.validatorsHash = bytesFromBase64(object.validatorsHash); - if (isSet(object.nextValidatorsHash)) obj.nextValidatorsHash = bytesFromBase64(object.nextValidatorsHash); - if (isSet(object.consensusHash)) obj.consensusHash = bytesFromBase64(object.consensusHash); - if (isSet(object.appHash)) obj.appHash = bytesFromBase64(object.appHash); - if (isSet(object.lastResultsHash)) obj.lastResultsHash = bytesFromBase64(object.lastResultsHash); - if (isSet(object.evidenceHash)) obj.evidenceHash = bytesFromBase64(object.evidenceHash); - if (isSet(object.proposerAddress)) obj.proposerAddress = bytesFromBase64(object.proposerAddress); - return obj; + return { + version: isSet(object.version) ? Consensus.fromJSON(object.version) : undefined, + chainId: isSet(object.chainId) ? String(object.chainId) : "", + height: isSet(object.height) ? BigInt(object.height.toString()) : BigInt(0), + time: isSet(object.time) ? new Date(object.time) : undefined, + lastBlockId: isSet(object.lastBlockId) ? BlockID.fromJSON(object.lastBlockId) : undefined, + lastCommitHash: isSet(object.lastCommitHash) ? bytesFromBase64(object.lastCommitHash) : new Uint8Array(), + dataHash: isSet(object.dataHash) ? bytesFromBase64(object.dataHash) : new Uint8Array(), + validatorsHash: isSet(object.validatorsHash) ? bytesFromBase64(object.validatorsHash) : new Uint8Array(), + nextValidatorsHash: isSet(object.nextValidatorsHash) ? bytesFromBase64(object.nextValidatorsHash) : new Uint8Array(), + consensusHash: isSet(object.consensusHash) ? bytesFromBase64(object.consensusHash) : new Uint8Array(), + appHash: isSet(object.appHash) ? bytesFromBase64(object.appHash) : new Uint8Array(), + lastResultsHash: isSet(object.lastResultsHash) ? bytesFromBase64(object.lastResultsHash) : new Uint8Array(), + evidenceHash: isSet(object.evidenceHash) ? bytesFromBase64(object.evidenceHash) : new Uint8Array(), + proposerAddress: isSet(object.proposerAddress) ? bytesFromBase64(object.proposerAddress) : new Uint8Array() + }; }, toJSON(message: Header): JsonSafe<Header> { const obj: any = {}; @@ -846,17 +925,11 @@ export const Header = { }, fromPartial(object: DeepPartial<Header>): Header { const message = createBaseHeader(); - if (object.version !== undefined && object.version !== null) { - message.version = Consensus.fromPartial(object.version); - } + message.version = object.version !== undefined && object.version !== null ? Consensus.fromPartial(object.version) : undefined; message.chainId = object.chainId ?? ""; - if (object.height !== undefined && object.height !== null) { - message.height = BigInt(object.height.toString()); - } + message.height = object.height !== undefined && object.height !== null ? BigInt(object.height.toString()) : BigInt(0); message.time = object.time ?? undefined; - if (object.lastBlockId !== undefined && object.lastBlockId !== null) { - message.lastBlockId = BlockID.fromPartial(object.lastBlockId); - } + message.lastBlockId = object.lastBlockId !== undefined && object.lastBlockId !== null ? BlockID.fromPartial(object.lastBlockId) : undefined; message.lastCommitHash = object.lastCommitHash ?? new Uint8Array(); message.dataHash = object.dataHash ?? new Uint8Array(); message.validatorsHash = object.validatorsHash ?? new Uint8Array(); @@ -1033,9 +1106,9 @@ export const Data = { return message; }, fromJSON(object: any): Data { - const obj = createBaseData(); - if (Array.isArray(object?.txs)) obj.txs = object.txs.map((e: any) => bytesFromBase64(e)); - return obj; + return { + txs: Array.isArray(object?.txs) ? object.txs.map((e: any) => bytesFromBase64(e)) : [] + }; }, toJSON(message: Data): JsonSafe<Data> { const obj: any = {}; @@ -1118,10 +1191,10 @@ export const Vote = { if (message.type !== 0) { writer.uint32(8).int32(message.type); } - if (message.height !== undefined) { + if (message.height !== BigInt(0)) { writer.uint32(16).int64(message.height); } - if (message.round !== undefined) { + if (message.round !== 0) { writer.uint32(24).int32(message.round); } if (message.blockId !== undefined) { @@ -1133,7 +1206,7 @@ export const Vote = { if (message.validatorAddress.length !== 0) { writer.uint32(50).bytes(message.validatorAddress); } - if (message.validatorIndex !== undefined) { + if (message.validatorIndex !== 0) { writer.uint32(56).int32(message.validatorIndex); } if (message.signature.length !== 0) { @@ -1180,16 +1253,16 @@ export const Vote = { return message; }, fromJSON(object: any): Vote { - const obj = createBaseVote(); - if (isSet(object.type)) obj.type = signedMsgTypeFromJSON(object.type); - if (isSet(object.height)) obj.height = BigInt(object.height.toString()); - if (isSet(object.round)) obj.round = Number(object.round); - if (isSet(object.blockId)) obj.blockId = BlockID.fromJSON(object.blockId); - if (isSet(object.timestamp)) obj.timestamp = new Date(object.timestamp); - if (isSet(object.validatorAddress)) obj.validatorAddress = bytesFromBase64(object.validatorAddress); - if (isSet(object.validatorIndex)) obj.validatorIndex = Number(object.validatorIndex); - if (isSet(object.signature)) obj.signature = bytesFromBase64(object.signature); - return obj; + return { + type: isSet(object.type) ? signedMsgTypeFromJSON(object.type) : -1, + height: isSet(object.height) ? BigInt(object.height.toString()) : BigInt(0), + round: isSet(object.round) ? Number(object.round) : 0, + blockId: isSet(object.blockId) ? BlockID.fromJSON(object.blockId) : undefined, + timestamp: isSet(object.timestamp) ? new Date(object.timestamp) : undefined, + validatorAddress: isSet(object.validatorAddress) ? bytesFromBase64(object.validatorAddress) : new Uint8Array(), + validatorIndex: isSet(object.validatorIndex) ? Number(object.validatorIndex) : 0, + signature: isSet(object.signature) ? bytesFromBase64(object.signature) : new Uint8Array() + }; }, toJSON(message: Vote): JsonSafe<Vote> { const obj: any = {}; @@ -1206,13 +1279,9 @@ export const Vote = { fromPartial(object: DeepPartial<Vote>): Vote { const message = createBaseVote(); message.type = object.type ?? 0; - if (object.height !== undefined && object.height !== null) { - message.height = BigInt(object.height.toString()); - } + message.height = object.height !== undefined && object.height !== null ? BigInt(object.height.toString()) : BigInt(0); message.round = object.round ?? 0; - if (object.blockId !== undefined && object.blockId !== null) { - message.blockId = BlockID.fromPartial(object.blockId); - } + message.blockId = object.blockId !== undefined && object.blockId !== null ? BlockID.fromPartial(object.blockId) : undefined; message.timestamp = object.timestamp ?? undefined; message.validatorAddress = object.validatorAddress ?? new Uint8Array(); message.validatorIndex = object.validatorIndex ?? 0; @@ -1322,10 +1391,10 @@ function createBaseCommit(): Commit { export const Commit = { typeUrl: "/tendermint.types.Commit", encode(message: Commit, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.height !== undefined) { + if (message.height !== BigInt(0)) { writer.uint32(8).int64(message.height); } - if (message.round !== undefined) { + if (message.round !== 0) { writer.uint32(16).int32(message.round); } if (message.blockId !== undefined) { @@ -1363,12 +1432,12 @@ export const Commit = { return message; }, fromJSON(object: any): Commit { - const obj = createBaseCommit(); - if (isSet(object.height)) obj.height = BigInt(object.height.toString()); - if (isSet(object.round)) obj.round = Number(object.round); - if (isSet(object.blockId)) obj.blockId = BlockID.fromJSON(object.blockId); - if (Array.isArray(object?.signatures)) obj.signatures = object.signatures.map((e: any) => CommitSig.fromJSON(e)); - return obj; + return { + height: isSet(object.height) ? BigInt(object.height.toString()) : BigInt(0), + round: isSet(object.round) ? Number(object.round) : 0, + blockId: isSet(object.blockId) ? BlockID.fromJSON(object.blockId) : undefined, + signatures: Array.isArray(object?.signatures) ? object.signatures.map((e: any) => CommitSig.fromJSON(e)) : [] + }; }, toJSON(message: Commit): JsonSafe<Commit> { const obj: any = {}; @@ -1384,13 +1453,9 @@ export const Commit = { }, fromPartial(object: DeepPartial<Commit>): Commit { const message = createBaseCommit(); - if (object.height !== undefined && object.height !== null) { - message.height = BigInt(object.height.toString()); - } + message.height = object.height !== undefined && object.height !== null ? BigInt(object.height.toString()) : BigInt(0); message.round = object.round ?? 0; - if (object.blockId !== undefined && object.blockId !== null) { - message.blockId = BlockID.fromPartial(object.blockId); - } + message.blockId = object.blockId !== undefined && object.blockId !== null ? BlockID.fromPartial(object.blockId) : undefined; message.signatures = object.signatures?.map(e => CommitSig.fromPartial(e)) || []; return message; }, @@ -1516,12 +1581,12 @@ export const CommitSig = { return message; }, fromJSON(object: any): CommitSig { - const obj = createBaseCommitSig(); - if (isSet(object.blockIdFlag)) obj.blockIdFlag = blockIDFlagFromJSON(object.blockIdFlag); - if (isSet(object.validatorAddress)) obj.validatorAddress = bytesFromBase64(object.validatorAddress); - if (isSet(object.timestamp)) obj.timestamp = new Date(object.timestamp); - if (isSet(object.signature)) obj.signature = bytesFromBase64(object.signature); - return obj; + return { + blockIdFlag: isSet(object.blockIdFlag) ? blockIDFlagFromJSON(object.blockIdFlag) : -1, + validatorAddress: isSet(object.validatorAddress) ? bytesFromBase64(object.validatorAddress) : new Uint8Array(), + timestamp: isSet(object.timestamp) ? new Date(object.timestamp) : undefined, + signature: isSet(object.signature) ? bytesFromBase64(object.signature) : new Uint8Array() + }; }, toJSON(message: CommitSig): JsonSafe<CommitSig> { const obj: any = {}; @@ -1620,13 +1685,13 @@ export const Proposal = { if (message.type !== 0) { writer.uint32(8).int32(message.type); } - if (message.height !== undefined) { + if (message.height !== BigInt(0)) { writer.uint32(16).int64(message.height); } - if (message.round !== undefined) { + if (message.round !== 0) { writer.uint32(24).int32(message.round); } - if (message.polRound !== undefined) { + if (message.polRound !== 0) { writer.uint32(32).int32(message.polRound); } if (message.blockId !== undefined) { @@ -1676,15 +1741,15 @@ export const Proposal = { return message; }, fromJSON(object: any): Proposal { - const obj = createBaseProposal(); - if (isSet(object.type)) obj.type = signedMsgTypeFromJSON(object.type); - if (isSet(object.height)) obj.height = BigInt(object.height.toString()); - if (isSet(object.round)) obj.round = Number(object.round); - if (isSet(object.polRound)) obj.polRound = Number(object.polRound); - if (isSet(object.blockId)) obj.blockId = BlockID.fromJSON(object.blockId); - if (isSet(object.timestamp)) obj.timestamp = new Date(object.timestamp); - if (isSet(object.signature)) obj.signature = bytesFromBase64(object.signature); - return obj; + return { + type: isSet(object.type) ? signedMsgTypeFromJSON(object.type) : -1, + height: isSet(object.height) ? BigInt(object.height.toString()) : BigInt(0), + round: isSet(object.round) ? Number(object.round) : 0, + polRound: isSet(object.polRound) ? Number(object.polRound) : 0, + blockId: isSet(object.blockId) ? BlockID.fromJSON(object.blockId) : undefined, + timestamp: isSet(object.timestamp) ? new Date(object.timestamp) : undefined, + signature: isSet(object.signature) ? bytesFromBase64(object.signature) : new Uint8Array() + }; }, toJSON(message: Proposal): JsonSafe<Proposal> { const obj: any = {}; @@ -1700,14 +1765,10 @@ export const Proposal = { fromPartial(object: DeepPartial<Proposal>): Proposal { const message = createBaseProposal(); message.type = object.type ?? 0; - if (object.height !== undefined && object.height !== null) { - message.height = BigInt(object.height.toString()); - } + message.height = object.height !== undefined && object.height !== null ? BigInt(object.height.toString()) : BigInt(0); message.round = object.round ?? 0; message.polRound = object.polRound ?? 0; - if (object.blockId !== undefined && object.blockId !== null) { - message.blockId = BlockID.fromPartial(object.blockId); - } + message.blockId = object.blockId !== undefined && object.blockId !== null ? BlockID.fromPartial(object.blockId) : undefined; message.timestamp = object.timestamp ?? undefined; message.signature = object.signature ?? new Uint8Array(); return message; @@ -1835,10 +1896,10 @@ export const SignedHeader = { return message; }, fromJSON(object: any): SignedHeader { - const obj = createBaseSignedHeader(); - if (isSet(object.header)) obj.header = Header.fromJSON(object.header); - if (isSet(object.commit)) obj.commit = Commit.fromJSON(object.commit); - return obj; + return { + header: isSet(object.header) ? Header.fromJSON(object.header) : undefined, + commit: isSet(object.commit) ? Commit.fromJSON(object.commit) : undefined + }; }, toJSON(message: SignedHeader): JsonSafe<SignedHeader> { const obj: any = {}; @@ -1848,12 +1909,8 @@ export const SignedHeader = { }, fromPartial(object: DeepPartial<SignedHeader>): SignedHeader { const message = createBaseSignedHeader(); - if (object.header !== undefined && object.header !== null) { - message.header = Header.fromPartial(object.header); - } - if (object.commit !== undefined && object.commit !== null) { - message.commit = Commit.fromPartial(object.commit); - } + message.header = object.header !== undefined && object.header !== null ? Header.fromPartial(object.header) : undefined; + message.commit = object.commit !== undefined && object.commit !== null ? Commit.fromPartial(object.commit) : undefined; return message; }, fromSDK(object: SignedHeaderSDKType): SignedHeader { @@ -1944,10 +2001,10 @@ export const LightBlock = { return message; }, fromJSON(object: any): LightBlock { - const obj = createBaseLightBlock(); - if (isSet(object.signedHeader)) obj.signedHeader = SignedHeader.fromJSON(object.signedHeader); - if (isSet(object.validatorSet)) obj.validatorSet = ValidatorSet.fromJSON(object.validatorSet); - return obj; + return { + signedHeader: isSet(object.signedHeader) ? SignedHeader.fromJSON(object.signedHeader) : undefined, + validatorSet: isSet(object.validatorSet) ? ValidatorSet.fromJSON(object.validatorSet) : undefined + }; }, toJSON(message: LightBlock): JsonSafe<LightBlock> { const obj: any = {}; @@ -1957,12 +2014,8 @@ export const LightBlock = { }, fromPartial(object: DeepPartial<LightBlock>): LightBlock { const message = createBaseLightBlock(); - if (object.signedHeader !== undefined && object.signedHeader !== null) { - message.signedHeader = SignedHeader.fromPartial(object.signedHeader); - } - if (object.validatorSet !== undefined && object.validatorSet !== null) { - message.validatorSet = ValidatorSet.fromPartial(object.validatorSet); - } + message.signedHeader = object.signedHeader !== undefined && object.signedHeader !== null ? SignedHeader.fromPartial(object.signedHeader) : undefined; + message.validatorSet = object.validatorSet !== undefined && object.validatorSet !== null ? ValidatorSet.fromPartial(object.validatorSet) : undefined; return message; }, fromSDK(object: LightBlockSDKType): LightBlock { @@ -2029,13 +2082,13 @@ export const BlockMeta = { if (message.blockId !== undefined) { BlockID.encode(message.blockId, writer.uint32(10).fork()).ldelim(); } - if (message.blockSize !== undefined) { + if (message.blockSize !== BigInt(0)) { writer.uint32(16).int64(message.blockSize); } if (message.header !== undefined) { Header.encode(message.header, writer.uint32(26).fork()).ldelim(); } - if (message.numTxs !== undefined) { + if (message.numTxs !== BigInt(0)) { writer.uint32(32).int64(message.numTxs); } return writer; @@ -2067,12 +2120,12 @@ export const BlockMeta = { return message; }, fromJSON(object: any): BlockMeta { - const obj = createBaseBlockMeta(); - if (isSet(object.blockId)) obj.blockId = BlockID.fromJSON(object.blockId); - if (isSet(object.blockSize)) obj.blockSize = BigInt(object.blockSize.toString()); - if (isSet(object.header)) obj.header = Header.fromJSON(object.header); - if (isSet(object.numTxs)) obj.numTxs = BigInt(object.numTxs.toString()); - return obj; + return { + blockId: isSet(object.blockId) ? BlockID.fromJSON(object.blockId) : undefined, + blockSize: isSet(object.blockSize) ? BigInt(object.blockSize.toString()) : BigInt(0), + header: isSet(object.header) ? Header.fromJSON(object.header) : undefined, + numTxs: isSet(object.numTxs) ? BigInt(object.numTxs.toString()) : BigInt(0) + }; }, toJSON(message: BlockMeta): JsonSafe<BlockMeta> { const obj: any = {}; @@ -2084,18 +2137,10 @@ export const BlockMeta = { }, fromPartial(object: DeepPartial<BlockMeta>): BlockMeta { const message = createBaseBlockMeta(); - if (object.blockId !== undefined && object.blockId !== null) { - message.blockId = BlockID.fromPartial(object.blockId); - } - if (object.blockSize !== undefined && object.blockSize !== null) { - message.blockSize = BigInt(object.blockSize.toString()); - } - if (object.header !== undefined && object.header !== null) { - message.header = Header.fromPartial(object.header); - } - if (object.numTxs !== undefined && object.numTxs !== null) { - message.numTxs = BigInt(object.numTxs.toString()); - } + message.blockId = object.blockId !== undefined && object.blockId !== null ? BlockID.fromPartial(object.blockId) : undefined; + message.blockSize = object.blockSize !== undefined && object.blockSize !== null ? BigInt(object.blockSize.toString()) : BigInt(0); + message.header = object.header !== undefined && object.header !== null ? Header.fromPartial(object.header) : undefined; + message.numTxs = object.numTxs !== undefined && object.numTxs !== null ? BigInt(object.numTxs.toString()) : BigInt(0); return message; }, fromSDK(object: BlockMetaSDKType): BlockMeta { @@ -2207,11 +2252,11 @@ export const TxProof = { return message; }, fromJSON(object: any): TxProof { - const obj = createBaseTxProof(); - if (isSet(object.rootHash)) obj.rootHash = bytesFromBase64(object.rootHash); - if (isSet(object.data)) obj.data = bytesFromBase64(object.data); - if (isSet(object.proof)) obj.proof = Proof.fromJSON(object.proof); - return obj; + return { + rootHash: isSet(object.rootHash) ? bytesFromBase64(object.rootHash) : new Uint8Array(), + data: isSet(object.data) ? bytesFromBase64(object.data) : new Uint8Array(), + proof: isSet(object.proof) ? Proof.fromJSON(object.proof) : undefined + }; }, toJSON(message: TxProof): JsonSafe<TxProof> { const obj: any = {}; @@ -2224,9 +2269,7 @@ export const TxProof = { const message = createBaseTxProof(); message.rootHash = object.rootHash ?? new Uint8Array(); message.data = object.data ?? new Uint8Array(); - if (object.proof !== undefined && object.proof !== null) { - message.proof = Proof.fromPartial(object.proof); - } + message.proof = object.proof !== undefined && object.proof !== null ? Proof.fromPartial(object.proof) : undefined; return message; }, fromSDK(object: TxProofSDKType): TxProof { diff --git a/__fixtures__/v-next/outputv4/tendermint/types/validator.ts b/__fixtures__/v-next/outputv4/tendermint/types/validator.ts index 316b53ae0c..a28aebe3cc 100644 --- a/__fixtures__/v-next/outputv4/tendermint/types/validator.ts +++ b/__fixtures__/v-next/outputv4/tendermint/types/validator.ts @@ -1,13 +1,19 @@ -import { PublicKey, PublicKeySDKType } from "../crypto/keys.js"; -import { BinaryReader, BinaryWriter } from "../../binary.js"; -import { isSet, DeepPartial, bytesFromBase64, base64FromBytes } from "../../helpers.js"; -import { JsonSafe } from "../../json-safe.js"; +import { PublicKey, PublicKeySDKType } from "../crypto/keys"; +import { BinaryReader, BinaryWriter } from "../../binary"; +import { isSet, DeepPartial, bytesFromBase64, base64FromBytes } from "../../helpers"; +import { JsonSafe } from "../../json-safe"; +import { ComputedRef } from "vue"; export const protobufPackage = "tendermint.types"; export interface ValidatorSet { validators: Validator[]; proposer?: Validator; totalVotingPower: bigint; } +export interface ReactiveValidatorSet { + validators: ComputedRef<Validator[]>; + proposer?: ComputedRef<Validator>; + totalVotingPower: ComputedRef<bigint>; +} export interface ValidatorSetProtoMsg { typeUrl: "/tendermint.types.ValidatorSet"; value: Uint8Array; @@ -23,6 +29,12 @@ export interface Validator { votingPower: bigint; proposerPriority: bigint; } +export interface ReactiveValidator { + address: ComputedRef<Uint8Array>; + pubKey: ComputedRef<PublicKey>; + votingPower: ComputedRef<bigint>; + proposerPriority: ComputedRef<bigint>; +} export interface ValidatorProtoMsg { typeUrl: "/tendermint.types.Validator"; value: Uint8Array; @@ -37,6 +49,10 @@ export interface SimpleValidator { pubKey?: PublicKey; votingPower: bigint; } +export interface ReactiveSimpleValidator { + pubKey?: ComputedRef<PublicKey>; + votingPower: ComputedRef<bigint>; +} export interface SimpleValidatorProtoMsg { typeUrl: "/tendermint.types.SimpleValidator"; value: Uint8Array; @@ -61,7 +77,7 @@ export const ValidatorSet = { if (message.proposer !== undefined) { Validator.encode(message.proposer, writer.uint32(18).fork()).ldelim(); } - if (message.totalVotingPower !== undefined) { + if (message.totalVotingPower !== BigInt(0)) { writer.uint32(24).int64(message.totalVotingPower); } return writer; @@ -90,11 +106,11 @@ export const ValidatorSet = { return message; }, fromJSON(object: any): ValidatorSet { - const obj = createBaseValidatorSet(); - if (Array.isArray(object?.validators)) obj.validators = object.validators.map((e: any) => Validator.fromJSON(e)); - if (isSet(object.proposer)) obj.proposer = Validator.fromJSON(object.proposer); - if (isSet(object.totalVotingPower)) obj.totalVotingPower = BigInt(object.totalVotingPower.toString()); - return obj; + return { + validators: Array.isArray(object?.validators) ? object.validators.map((e: any) => Validator.fromJSON(e)) : [], + proposer: isSet(object.proposer) ? Validator.fromJSON(object.proposer) : undefined, + totalVotingPower: isSet(object.totalVotingPower) ? BigInt(object.totalVotingPower.toString()) : BigInt(0) + }; }, toJSON(message: ValidatorSet): JsonSafe<ValidatorSet> { const obj: any = {}; @@ -110,12 +126,8 @@ export const ValidatorSet = { fromPartial(object: DeepPartial<ValidatorSet>): ValidatorSet { const message = createBaseValidatorSet(); message.validators = object.validators?.map(e => Validator.fromPartial(e)) || []; - if (object.proposer !== undefined && object.proposer !== null) { - message.proposer = Validator.fromPartial(object.proposer); - } - if (object.totalVotingPower !== undefined && object.totalVotingPower !== null) { - message.totalVotingPower = BigInt(object.totalVotingPower.toString()); - } + message.proposer = object.proposer !== undefined && object.proposer !== null ? Validator.fromPartial(object.proposer) : undefined; + message.totalVotingPower = object.totalVotingPower !== undefined && object.totalVotingPower !== null ? BigInt(object.totalVotingPower.toString()) : BigInt(0); return message; }, fromSDK(object: ValidatorSetSDKType): ValidatorSet { @@ -198,10 +210,10 @@ export const Validator = { if (message.pubKey !== undefined) { PublicKey.encode(message.pubKey, writer.uint32(18).fork()).ldelim(); } - if (message.votingPower !== undefined) { + if (message.votingPower !== BigInt(0)) { writer.uint32(24).int64(message.votingPower); } - if (message.proposerPriority !== undefined) { + if (message.proposerPriority !== BigInt(0)) { writer.uint32(32).int64(message.proposerPriority); } return writer; @@ -233,12 +245,12 @@ export const Validator = { return message; }, fromJSON(object: any): Validator { - const obj = createBaseValidator(); - if (isSet(object.address)) obj.address = bytesFromBase64(object.address); - if (isSet(object.pubKey)) obj.pubKey = PublicKey.fromJSON(object.pubKey); - if (isSet(object.votingPower)) obj.votingPower = BigInt(object.votingPower.toString()); - if (isSet(object.proposerPriority)) obj.proposerPriority = BigInt(object.proposerPriority.toString()); - return obj; + return { + address: isSet(object.address) ? bytesFromBase64(object.address) : new Uint8Array(), + pubKey: isSet(object.pubKey) ? PublicKey.fromJSON(object.pubKey) : undefined, + votingPower: isSet(object.votingPower) ? BigInt(object.votingPower.toString()) : BigInt(0), + proposerPriority: isSet(object.proposerPriority) ? BigInt(object.proposerPriority.toString()) : BigInt(0) + }; }, toJSON(message: Validator): JsonSafe<Validator> { const obj: any = {}; @@ -251,15 +263,9 @@ export const Validator = { fromPartial(object: DeepPartial<Validator>): Validator { const message = createBaseValidator(); message.address = object.address ?? new Uint8Array(); - if (object.pubKey !== undefined && object.pubKey !== null) { - message.pubKey = PublicKey.fromPartial(object.pubKey); - } - if (object.votingPower !== undefined && object.votingPower !== null) { - message.votingPower = BigInt(object.votingPower.toString()); - } - if (object.proposerPriority !== undefined && object.proposerPriority !== null) { - message.proposerPriority = BigInt(object.proposerPriority.toString()); - } + message.pubKey = object.pubKey !== undefined && object.pubKey !== null ? PublicKey.fromPartial(object.pubKey) : undefined; + message.votingPower = object.votingPower !== undefined && object.votingPower !== null ? BigInt(object.votingPower.toString()) : BigInt(0); + message.proposerPriority = object.proposerPriority !== undefined && object.proposerPriority !== null ? BigInt(object.proposerPriority.toString()) : BigInt(0); return message; }, fromSDK(object: ValidatorSDKType): Validator { @@ -338,7 +344,7 @@ export const SimpleValidator = { if (message.pubKey !== undefined) { PublicKey.encode(message.pubKey, writer.uint32(10).fork()).ldelim(); } - if (message.votingPower !== undefined) { + if (message.votingPower !== BigInt(0)) { writer.uint32(16).int64(message.votingPower); } return writer; @@ -364,10 +370,10 @@ export const SimpleValidator = { return message; }, fromJSON(object: any): SimpleValidator { - const obj = createBaseSimpleValidator(); - if (isSet(object.pubKey)) obj.pubKey = PublicKey.fromJSON(object.pubKey); - if (isSet(object.votingPower)) obj.votingPower = BigInt(object.votingPower.toString()); - return obj; + return { + pubKey: isSet(object.pubKey) ? PublicKey.fromJSON(object.pubKey) : undefined, + votingPower: isSet(object.votingPower) ? BigInt(object.votingPower.toString()) : BigInt(0) + }; }, toJSON(message: SimpleValidator): JsonSafe<SimpleValidator> { const obj: any = {}; @@ -377,12 +383,8 @@ export const SimpleValidator = { }, fromPartial(object: DeepPartial<SimpleValidator>): SimpleValidator { const message = createBaseSimpleValidator(); - if (object.pubKey !== undefined && object.pubKey !== null) { - message.pubKey = PublicKey.fromPartial(object.pubKey); - } - if (object.votingPower !== undefined && object.votingPower !== null) { - message.votingPower = BigInt(object.votingPower.toString()); - } + message.pubKey = object.pubKey !== undefined && object.pubKey !== null ? PublicKey.fromPartial(object.pubKey) : undefined; + message.votingPower = object.votingPower !== undefined && object.votingPower !== null ? BigInt(object.votingPower.toString()) : BigInt(0); return message; }, fromSDK(object: SimpleValidatorSDKType): SimpleValidator { diff --git a/__fixtures__/v-next/outputv4/tendermint/version/types.ts b/__fixtures__/v-next/outputv4/tendermint/version/types.ts index d0ccb0dfbb..e61c5b5bf0 100644 --- a/__fixtures__/v-next/outputv4/tendermint/version/types.ts +++ b/__fixtures__/v-next/outputv4/tendermint/version/types.ts @@ -1,6 +1,7 @@ -import { BinaryReader, BinaryWriter } from "../../binary.js"; -import { isSet, DeepPartial } from "../../helpers.js"; -import { JsonSafe } from "../../json-safe.js"; +import { BinaryReader, BinaryWriter } from "../../binary"; +import { isSet, DeepPartial } from "../../helpers"; +import { JsonSafe } from "../../json-safe"; +import { ComputedRef } from "vue"; export const protobufPackage = "tendermint.version"; /** * App includes the protocol and software version for the application. @@ -11,6 +12,10 @@ export interface App { protocol: bigint; software: string; } +export interface ReactiveApp { + protocol: ComputedRef<bigint>; + software: ComputedRef<string>; +} export interface AppProtoMsg { typeUrl: "/tendermint.version.App"; value: Uint8Array; @@ -33,6 +38,10 @@ export interface Consensus { block: bigint; app: bigint; } +export interface ReactiveConsensus { + block: ComputedRef<bigint>; + app: ComputedRef<bigint>; +} export interface ConsensusProtoMsg { typeUrl: "/tendermint.version.Consensus"; value: Uint8Array; @@ -55,10 +64,10 @@ function createBaseApp(): App { export const App = { typeUrl: "/tendermint.version.App", encode(message: App, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.protocol !== undefined) { + if (message.protocol !== BigInt(0)) { writer.uint32(8).uint64(message.protocol); } - if (message.software !== undefined) { + if (message.software !== "") { writer.uint32(18).string(message.software); } return writer; @@ -84,10 +93,10 @@ export const App = { return message; }, fromJSON(object: any): App { - const obj = createBaseApp(); - if (isSet(object.protocol)) obj.protocol = BigInt(object.protocol.toString()); - if (isSet(object.software)) obj.software = String(object.software); - return obj; + return { + protocol: isSet(object.protocol) ? BigInt(object.protocol.toString()) : BigInt(0), + software: isSet(object.software) ? String(object.software) : "" + }; }, toJSON(message: App): JsonSafe<App> { const obj: any = {}; @@ -97,9 +106,7 @@ export const App = { }, fromPartial(object: DeepPartial<App>): App { const message = createBaseApp(); - if (object.protocol !== undefined && object.protocol !== null) { - message.protocol = BigInt(object.protocol.toString()); - } + message.protocol = object.protocol !== undefined && object.protocol !== null ? BigInt(object.protocol.toString()) : BigInt(0); message.software = object.software ?? ""; return message; }, @@ -162,10 +169,10 @@ function createBaseConsensus(): Consensus { export const Consensus = { typeUrl: "/tendermint.version.Consensus", encode(message: Consensus, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.block !== undefined) { + if (message.block !== BigInt(0)) { writer.uint32(8).uint64(message.block); } - if (message.app !== undefined) { + if (message.app !== BigInt(0)) { writer.uint32(16).uint64(message.app); } return writer; @@ -191,10 +198,10 @@ export const Consensus = { return message; }, fromJSON(object: any): Consensus { - const obj = createBaseConsensus(); - if (isSet(object.block)) obj.block = BigInt(object.block.toString()); - if (isSet(object.app)) obj.app = BigInt(object.app.toString()); - return obj; + return { + block: isSet(object.block) ? BigInt(object.block.toString()) : BigInt(0), + app: isSet(object.app) ? BigInt(object.app.toString()) : BigInt(0) + }; }, toJSON(message: Consensus): JsonSafe<Consensus> { const obj: any = {}; @@ -204,12 +211,8 @@ export const Consensus = { }, fromPartial(object: DeepPartial<Consensus>): Consensus { const message = createBaseConsensus(); - if (object.block !== undefined && object.block !== null) { - message.block = BigInt(object.block.toString()); - } - if (object.app !== undefined && object.app !== null) { - message.app = BigInt(object.app.toString()); - } + message.block = object.block !== undefined && object.block !== null ? BigInt(object.block.toString()) : BigInt(0); + message.app = object.app !== undefined && object.app !== null ? BigInt(object.app.toString()) : BigInt(0); return message; }, fromSDK(object: ConsensusSDKType): Consensus { diff --git a/packages/telescope/src/generators/create-registries.ts b/packages/telescope/src/generators/create-registries.ts index 36be7242ca..8d5af59324 100644 --- a/packages/telescope/src/generators/create-registries.ts +++ b/packages/telescope/src/generators/create-registries.ts @@ -8,7 +8,7 @@ export const plugin = ( bundler: Bundler ) => { - if (!builder.options.aminoEncoding?.enabled || !builder.options.rpcClients?.enabled) { + if (!builder.options.aminoEncoding?.enabled) { return; }