From 8c8306acf21c4ebf464243ad8ef1aa9ae96649f4 Mon Sep 17 00:00:00 2001 From: Dan Lynch Date: Sat, 25 May 2024 11:14:21 +0200 Subject: [PATCH] default JsonSafe for toJSON --- .../akash/deployment/v1beta1/authz.ts | 3 +- .../cosmos/authz/v1beta1/authz.ts | 11 +- .../cosmos/authz/v1beta1/tx.ts | 13 +- .../cosmos/bank/v1beta1/authz.ts | 3 +- .../cosmos/bank/v1beta1/tx.ts | 3 +- .../cosmos/base/v1beta1/coin.ts | 9 +- .../cosmos_proto/cosmos.ts | 5 +- .../google/protobuf/any.ts | 3 +- .../google/protobuf/descriptor.ts | 55 +-- .../google/protobuf/timestamp.ts | 3 +- .../misc/output-impl-interfaces-gen/index.ts | 1 + .../output-impl-interfaces-gen/json-safe.ts | 10 + .../google/api/expr/v1alpha1/eval.ts | 5 +- .../google/protobuf/any.ts | 3 +- .../google/protobuf/descriptor.ts | 57 +-- .../google/protobuf/duration.ts | 3 +- .../google/protobuf/timestamp.ts | 3 +- .../index.ts | 1 + .../json-safe.ts | 10 + .../misc/all_fields.ts | 5 +- .../misc/eval_request.ts | 11 +- .../misc/tx.ts | 5 +- .../google/api/expr/v1alpha1/eval.ts | 5 +- .../amino-interface/google/protobuf/any.ts | 3 +- .../google/protobuf/descriptor.ts | 57 +-- .../google/protobuf/duration.ts | 3 +- .../google/protobuf/timestamp.ts | 3 +- .../amino-interface/index.ts | 1 + .../amino-interface/json-safe.ts | 10 + .../amino-interface/misc/all_fields.ts | 5 +- .../amino-interface/misc/eval_request.ts | 11 +- .../amino-interface/misc/tx.ts | 5 +- .../google/api/expr/v1alpha1/eval.ts | 5 +- .../amino-legacy/google/protobuf/any.ts | 3 +- .../google/protobuf/descriptor.ts | 57 +-- .../amino-legacy/google/protobuf/duration.ts | 3 +- .../amino-legacy/google/protobuf/timestamp.ts | 3 +- .../output-proto-amino/amino-legacy/index.ts | 1 + .../amino-legacy/json-safe.ts | 10 + .../amino-legacy/misc/all_fields.ts | 5 +- .../amino-legacy/misc/eval_request.ts | 11 +- .../amino-legacy/misc/tx.ts | 5 +- .../google/api/expr/v1alpha1/eval.ts | 5 +- .../amino-msg-no-func/google/protobuf/any.ts | 3 +- .../google/protobuf/descriptor.ts | 57 +-- .../google/protobuf/duration.ts | 3 +- .../google/protobuf/timestamp.ts | 3 +- .../amino-msg-no-func/index.ts | 1 + .../amino-msg-no-func/json-safe.ts | 10 + .../amino-msg-no-func/misc/all_fields.ts | 5 +- .../amino-msg-no-func/misc/eval_request.ts | 11 +- .../amino-msg-no-func/misc/tx.ts | 5 +- .../google/api/expr/v1alpha1/eval.ts | 5 +- .../google/protobuf/any.ts | 3 +- .../google/protobuf/descriptor.ts | 57 +-- .../google/protobuf/duration.ts | 3 +- .../google/protobuf/timestamp.ts | 3 +- .../amino-msg-with-func/index.ts | 1 + .../amino-msg-with-func/json-safe.ts | 10 + .../amino-msg-with-func/misc/all_fields.ts | 5 +- .../amino-msg-with-func/misc/eval_request.ts | 11 +- .../amino-msg-with-func/misc/tx.ts | 5 +- .../google/api/expr/v1alpha1/eval.ts | 5 +- .../google/protobuf/any.ts | 3 +- .../google/protobuf/descriptor.ts | 57 +-- .../google/protobuf/duration.ts | 3 +- .../google/protobuf/timestamp.ts | 3 +- .../amino-no-msg-with-func/index.ts | 1 + .../amino-no-msg-with-func/json-safe.ts | 10 + .../amino-no-msg-with-func/misc/all_fields.ts | 5 +- .../misc/eval_request.ts | 11 +- .../amino-no-msg-with-func/misc/tx.ts | 5 +- .../google/api/expr/v1alpha1/eval.ts | 5 +- .../google/protobuf/any.ts | 3 +- .../google/protobuf/descriptor.ts | 57 +-- .../google/protobuf/duration.ts | 3 +- .../google/protobuf/timestamp.ts | 3 +- .../no-amino-legacy-no-proto/index.ts | 1 + .../no-amino-legacy-no-proto/json-safe.ts | 10 + .../misc/all_fields.ts | 5 +- .../misc/eval_request.ts | 11 +- .../no-amino-legacy-no-proto/misc/tx.ts | 5 +- .../google/api/expr/v1alpha1/eval.ts | 5 +- .../no-amino-legacy/google/protobuf/any.ts | 3 +- .../google/protobuf/descriptor.ts | 57 +-- .../google/protobuf/duration.ts | 3 +- .../google/protobuf/timestamp.ts | 3 +- .../no-amino-legacy/index.ts | 1 + .../no-amino-legacy/json-safe.ts | 10 + .../no-amino-legacy/misc/all_fields.ts | 5 +- .../no-amino-legacy/misc/eval_request.ts | 11 +- .../no-amino-legacy/misc/tx.ts | 5 +- .../google/api/expr/v1alpha1/eval.ts | 5 +- .../no-amino-no-proto/google/protobuf/any.ts | 3 +- .../google/protobuf/descriptor.ts | 57 +-- .../google/protobuf/duration.ts | 3 +- .../google/protobuf/timestamp.ts | 3 +- .../no-amino-no-proto/index.ts | 1 + .../no-amino-no-proto/json-safe.ts | 10 + .../no-amino-no-proto/misc/all_fields.ts | 5 +- .../no-amino-no-proto/misc/eval_request.ts | 11 +- .../no-amino-no-proto/misc/tx.ts | 5 +- .../no-amino/google/api/expr/v1alpha1/eval.ts | 5 +- .../no-amino/google/protobuf/any.ts | 3 +- .../no-amino/google/protobuf/descriptor.ts | 57 +-- .../no-amino/google/protobuf/duration.ts | 3 +- .../no-amino/google/protobuf/timestamp.ts | 3 +- .../misc/output-proto-amino/no-amino/index.ts | 1 + .../output-proto-amino/no-amino/json-safe.ts | 10 + .../no-amino/misc/all_fields.ts | 5 +- .../no-amino/misc/eval_request.ts | 11 +- .../output-proto-amino/no-amino/misc/tx.ts | 5 +- .../google/api/expr/v1alpha1/eval.ts | 5 +- .../proto-only-legacy/google/protobuf/any.ts | 3 +- .../google/protobuf/descriptor.ts | 57 +-- .../google/protobuf/duration.ts | 3 +- .../google/protobuf/timestamp.ts | 3 +- .../proto-only-legacy/index.ts | 1 + .../proto-only-legacy/json-safe.ts | 10 + .../proto-only-legacy/misc/all_fields.ts | 5 +- .../proto-only-legacy/misc/eval_request.ts | 11 +- .../proto-only-legacy/misc/tx.ts | 5 +- .../google/api/expr/v1alpha1/eval.ts | 5 +- .../proto-only/google/protobuf/any.ts | 3 +- .../proto-only/google/protobuf/descriptor.ts | 57 +-- .../proto-only/google/protobuf/duration.ts | 3 +- .../proto-only/google/protobuf/timestamp.ts | 3 +- .../output-proto-amino/proto-only/index.ts | 1 + .../proto-only/json-safe.ts | 10 + .../proto-only/misc/all_fields.ts | 5 +- .../proto-only/misc/eval_request.ts | 11 +- .../output-proto-amino/proto-only/misc/tx.ts | 5 +- .../output/google/api/expr/v1alpha1/eval.ts | 5 +- .../misc/output/google/protobuf/any.ts | 3 +- .../misc/output/google/protobuf/descriptor.ts | 57 +-- .../misc/output/google/protobuf/duration.ts | 3 +- .../misc/output/google/protobuf/timestamp.ts | 3 +- __fixtures__/misc/output/index.ts | 1 + __fixtures__/misc/output/json-safe.ts | 10 + __fixtures__/misc/output/misc/all_fields.ts | 5 +- __fixtures__/misc/output/misc/eval_request.ts | 11 +- __fixtures__/misc/output/misc/tx.ts | 5 +- .../output1/akash/audit/v1beta1/audit.ts | 17 +- .../output1/akash/audit/v1beta2/audit.ts | 17 +- .../output1/akash/audit/v1beta2/genesis.ts | 3 +- .../output1/akash/audit/v1beta2/query.ts | 13 +- .../output1/akash/base/v1beta1/attribute.ts | 7 +- .../output1/akash/base/v1beta1/endpoint.ts | 3 +- .../output1/akash/base/v1beta1/resource.ts | 9 +- .../akash/base/v1beta1/resourcevalue.ts | 3 +- .../output1/akash/base/v1beta2/attribute.ts | 7 +- .../output1/akash/base/v1beta2/endpoint.ts | 3 +- .../output1/akash/base/v1beta2/resource.ts | 7 +- .../akash/base/v1beta2/resourceunits.ts | 3 +- .../akash/base/v1beta2/resourcevalue.ts | 3 +- .../output1/akash/cert/v1beta2/cert.ts | 15 +- .../output1/akash/cert/v1beta2/genesis.ts | 5 +- .../output1/akash/cert/v1beta2/query.ts | 7 +- .../output1/akash/deployment/v1beta1/authz.ts | 3 +- .../akash/deployment/v1beta1/deployment.ts | 23 +- .../akash/deployment/v1beta1/genesis.ts | 5 +- .../output1/akash/deployment/v1beta1/group.ts | 21 +- .../akash/deployment/v1beta1/params.ts | 3 +- .../output1/akash/deployment/v1beta1/query.ts | 13 +- .../output1/akash/deployment/v1beta2/authz.ts | 3 +- .../akash/deployment/v1beta2/deployment.ts | 7 +- .../akash/deployment/v1beta2/deploymentmsg.ts | 17 +- .../akash/deployment/v1beta2/genesis.ts | 5 +- .../output1/akash/deployment/v1beta2/group.ts | 3 +- .../akash/deployment/v1beta2/groupid.ts | 3 +- .../akash/deployment/v1beta2/groupmsg.ts | 13 +- .../akash/deployment/v1beta2/groupspec.ts | 3 +- .../akash/deployment/v1beta2/params.ts | 3 +- .../output1/akash/deployment/v1beta2/query.ts | 13 +- .../akash/deployment/v1beta2/resource.ts | 3 +- .../output1/akash/escrow/v1beta1/genesis.ts | 3 +- .../output1/akash/escrow/v1beta1/query.ts | 9 +- .../output1/akash/escrow/v1beta1/types.ts | 7 +- .../output1/akash/escrow/v1beta2/genesis.ts | 3 +- .../output1/akash/escrow/v1beta2/query.ts | 9 +- .../output1/akash/escrow/v1beta2/types.ts | 7 +- .../akash/inflation/v1beta2/genesis.ts | 3 +- .../output1/akash/inflation/v1beta2/params.ts | 3 +- .../output1/akash/market/v1beta2/bid.ts | 15 +- .../output1/akash/market/v1beta2/genesis.ts | 3 +- .../output1/akash/market/v1beta2/lease.ts | 19 +- .../output1/akash/market/v1beta2/order.ts | 7 +- .../output1/akash/market/v1beta2/params.ts | 3 +- .../output1/akash/market/v1beta2/query.ts | 25 +- .../akash/provider/v1beta1/provider.ts | 17 +- .../output1/akash/provider/v1beta2/genesis.ts | 3 +- .../akash/provider/v1beta2/provider.ts | 17 +- .../output1/akash/provider/v1beta2/query.ts | 9 +- __fixtures__/output1/confio/proofs.ts | 27 +- .../output1/cosmos/app/v1alpha1/config.ts | 5 +- .../output1/cosmos/app/v1alpha1/module.ts | 7 +- .../output1/cosmos/app/v1alpha1/query.ts | 5 +- .../output1/cosmos/auth/v1beta1/auth.ts | 7 +- .../output1/cosmos/auth/v1beta1/genesis.ts | 3 +- .../output1/cosmos/auth/v1beta1/query.ts | 29 +- .../output1/cosmos/authz/v1beta1/authz.ts | 9 +- .../output1/cosmos/authz/v1beta1/genesis.ts | 3 +- .../output1/cosmos/authz/v1beta1/query.ts | 13 +- .../output1/cosmos/authz/v1beta1/tx.ts | 13 +- .../output1/cosmos/bank/v1beta1/authz.ts | 3 +- .../output1/cosmos/bank/v1beta1/bank.ts | 15 +- .../output1/cosmos/bank/v1beta1/genesis.ts | 5 +- .../output1/cosmos/bank/v1beta1/query.ts | 39 +- .../output1/cosmos/bank/v1beta1/tx.ts | 9 +- .../output1/cosmos/base/abci/v1beta1/abci.ts | 21 +- .../output1/cosmos/base/kv/v1beta1/kv.ts | 5 +- .../cosmos/base/query/v1beta1/pagination.ts | 5 +- .../base/reflection/v1beta1/reflection.ts | 9 +- .../base/reflection/v2alpha1/reflection.ts | 53 +-- .../cosmos/base/snapshots/v1beta1/snapshot.ts | 19 +- .../cosmos/base/store/v1beta1/commit_info.ts | 7 +- .../cosmos/base/store/v1beta1/listening.ts | 3 +- .../cosmos/base/tendermint/v1beta1/query.ts | 31 +- .../output1/cosmos/base/v1beta1/coin.ts | 9 +- .../cosmos/capability/v1beta1/capability.ts | 7 +- .../cosmos/capability/v1beta1/genesis.ts | 5 +- .../output1/cosmos/crisis/v1beta1/genesis.ts | 3 +- .../output1/cosmos/crisis/v1beta1/tx.ts | 5 +- .../output1/cosmos/crypto/ed25519/keys.ts | 5 +- .../output1/cosmos/crypto/hd/v1/hd.ts | 3 +- .../cosmos/crypto/keyring/v1/record.ts | 11 +- .../output1/cosmos/crypto/multisig/keys.ts | 3 +- .../crypto/multisig/v1beta1/multisig.ts | 5 +- .../output1/cosmos/crypto/secp256k1/keys.ts | 5 +- .../output1/cosmos/crypto/secp256r1/keys.ts | 5 +- .../distribution/v1beta1/distribution.ts | 25 +- .../cosmos/distribution/v1beta1/genesis.ts | 17 +- .../cosmos/distribution/v1beta1/query.ts | 37 +- .../output1/cosmos/distribution/v1beta1/tx.ts | 17 +- .../cosmos/evidence/v1beta1/evidence.ts | 3 +- .../cosmos/evidence/v1beta1/genesis.ts | 3 +- .../output1/cosmos/evidence/v1beta1/query.ts | 9 +- .../output1/cosmos/evidence/v1beta1/tx.ts | 5 +- .../cosmos/feegrant/v1beta1/feegrant.ts | 9 +- .../cosmos/feegrant/v1beta1/genesis.ts | 3 +- .../output1/cosmos/feegrant/v1beta1/query.ts | 13 +- .../output1/cosmos/feegrant/v1beta1/tx.ts | 9 +- .../output1/cosmos/genutil/v1beta1/genesis.ts | 3 +- __fixtures__/output1/cosmos/gov/v1/genesis.ts | 3 +- __fixtures__/output1/cosmos/gov/v1/gov.ts | 17 +- __fixtures__/output1/cosmos/gov/v1/query.ts | 33 +- __fixtures__/output1/cosmos/gov/v1/tx.ts | 21 +- .../output1/cosmos/gov/v1beta1/genesis.ts | 3 +- .../output1/cosmos/gov/v1beta1/gov.ts | 19 +- .../output1/cosmos/gov/v1beta1/query.ts | 33 +- __fixtures__/output1/cosmos/gov/v1beta1/tx.ts | 17 +- .../output1/cosmos/group/v1/events.ts | 19 +- .../output1/cosmos/group/v1/genesis.ts | 3 +- __fixtures__/output1/cosmos/group/v1/query.ts | 53 +-- __fixtures__/output1/cosmos/group/v1/tx.ts | 57 +-- __fixtures__/output1/cosmos/group/v1/types.ts | 23 +- .../output1/cosmos/mint/v1beta1/genesis.ts | 3 +- .../output1/cosmos/mint/v1beta1/mint.ts | 5 +- .../output1/cosmos/mint/v1beta1/query.ts | 13 +- .../output1/cosmos/nft/v1beta1/event.ts | 7 +- .../output1/cosmos/nft/v1beta1/genesis.ts | 5 +- .../output1/cosmos/nft/v1beta1/nft.ts | 5 +- .../output1/cosmos/nft/v1beta1/query.ts | 29 +- __fixtures__/output1/cosmos/nft/v1beta1/tx.ts | 5 +- .../cosmos/orm/module/v1alpha1/module.ts | 3 +- __fixtures__/output1/cosmos/orm/v1/orm.ts | 9 +- .../output1/cosmos/orm/v1alpha1/schema.ts | 5 +- .../output1/cosmos/params/v1beta1/params.ts | 5 +- .../output1/cosmos/params/v1beta1/query.ts | 11 +- .../cosmos/slashing/v1beta1/genesis.ts | 9 +- .../output1/cosmos/slashing/v1beta1/query.ts | 13 +- .../cosmos/slashing/v1beta1/slashing.ts | 5 +- .../output1/cosmos/slashing/v1beta1/tx.ts | 5 +- .../output1/cosmos/staking/v1beta1/authz.ts | 5 +- .../output1/cosmos/staking/v1beta1/genesis.ts | 5 +- .../output1/cosmos/staking/v1beta1/query.ts | 57 +-- .../output1/cosmos/staking/v1beta1/staking.ts | 41 +- .../output1/cosmos/staking/v1beta1/tx.ts | 21 +- .../cosmos/tx/signing/v1beta1/signing.ts | 11 +- .../output1/cosmos/tx/v1beta1/service.ts | 21 +- __fixtures__/output1/cosmos/tx/v1beta1/tx.ts | 27 +- .../output1/cosmos/upgrade/v1beta1/query.ts | 21 +- .../output1/cosmos/upgrade/v1beta1/tx.ts | 9 +- .../output1/cosmos/upgrade/v1beta1/upgrade.ts | 9 +- .../output1/cosmos/vesting/v1beta1/tx.ts | 13 +- .../output1/cosmos/vesting/v1beta1/vesting.ts | 13 +- __fixtures__/output1/cosmos_proto/cosmos.ts | 5 +- .../output1/cosmwasm/wasm/v1/genesis.ts | 11 +- __fixtures__/output1/cosmwasm/wasm/v1/ibc.ts | 5 +- .../output1/cosmwasm/wasm/v1/proposal.ts | 19 +- .../output1/cosmwasm/wasm/v1/query.ts | 39 +- __fixtures__/output1/cosmwasm/wasm/v1/tx.ts | 25 +- .../output1/cosmwasm/wasm/v1/types.ts | 17 +- .../output1/evmos/claims/v1/claims.ts | 7 +- .../output1/evmos/claims/v1/genesis.ts | 5 +- __fixtures__/output1/evmos/claims/v1/query.ts | 17 +- .../output1/evmos/epochs/v1/genesis.ts | 5 +- __fixtures__/output1/evmos/epochs/v1/query.ts | 9 +- __fixtures__/output1/evmos/erc20/v1/erc20.ts | 9 +- .../output1/evmos/erc20/v1/genesis.ts | 5 +- __fixtures__/output1/evmos/erc20/v1/query.ts | 13 +- __fixtures__/output1/evmos/erc20/v1/tx.ts | 9 +- __fixtures__/output1/evmos/fees/v1/fees.ts | 3 +- __fixtures__/output1/evmos/fees/v1/genesis.ts | 5 +- __fixtures__/output1/evmos/fees/v1/query.ts | 17 +- __fixtures__/output1/evmos/fees/v1/tx.ts | 13 +- .../output1/evmos/incentives/v1/genesis.ts | 5 +- .../output1/evmos/incentives/v1/incentives.ts | 9 +- .../output1/evmos/incentives/v1/query.ts | 29 +- .../output1/evmos/inflation/v1/genesis.ts | 5 +- .../output1/evmos/inflation/v1/inflation.ts | 5 +- .../output1/evmos/inflation/v1/query.ts | 25 +- .../output1/evmos/recovery/v1/genesis.ts | 5 +- .../output1/evmos/recovery/v1/query.ts | 5 +- .../output1/evmos/vesting/v1/query.ts | 5 +- __fixtures__/output1/evmos/vesting/v1/tx.ts | 9 +- .../output1/evmos/vesting/v1/vesting.ts | 3 +- __fixtures__/output1/google/api/auth.ts | 13 +- __fixtures__/output1/google/api/backend.ts | 5 +- __fixtures__/output1/google/api/billing.ts | 5 +- .../output1/google/api/config_change.ts | 5 +- __fixtures__/output1/google/api/consumer.ts | 5 +- __fixtures__/output1/google/api/context.ts | 5 +- __fixtures__/output1/google/api/control.ts | 3 +- .../output1/google/api/distribution.ts | 15 +- .../output1/google/api/documentation.ts | 7 +- __fixtures__/output1/google/api/endpoint.ts | 3 +- .../v1alpha1/conformance_service.ts | 17 +- .../google/api/expr/v1alpha1/checked.ts | 27 +- .../output1/google/api/expr/v1alpha1/eval.ts | 11 +- .../google/api/expr/v1alpha1/explain.ts | 5 +- .../google/api/expr/v1alpha1/syntax.ts | 29 +- .../output1/google/api/expr/v1alpha1/value.ts | 11 +- .../output1/google/api/expr/v1beta1/decl.ts | 9 +- .../output1/google/api/expr/v1beta1/eval.ts | 13 +- .../output1/google/api/expr/v1beta1/expr.ts | 21 +- .../output1/google/api/expr/v1beta1/source.ts | 7 +- .../output1/google/api/expr/v1beta1/value.ts | 11 +- __fixtures__/output1/google/api/http.ts | 7 +- __fixtures__/output1/google/api/httpbody.ts | 3 +- __fixtures__/output1/google/api/label.ts | 3 +- __fixtures__/output1/google/api/log.ts | 3 +- __fixtures__/output1/google/api/logging.ts | 5 +- __fixtures__/output1/google/api/metric.ts | 9 +- .../output1/google/api/monitored_resource.ts | 11 +- __fixtures__/output1/google/api/monitoring.ts | 5 +- __fixtures__/output1/google/api/quota.ts | 11 +- __fixtures__/output1/google/api/resource.ts | 5 +- __fixtures__/output1/google/api/routing.ts | 5 +- __fixtures__/output1/google/api/service.ts | 3 +- .../api/servicecontrol/v1/check_error.ts | 3 +- .../api/servicecontrol/v1/distribution.ts | 9 +- .../api/servicecontrol/v1/http_request.ts | 3 +- .../google/api/servicecontrol/v1/log_entry.ts | 9 +- .../api/servicecontrol/v1/metric_value.ts | 7 +- .../google/api/servicecontrol/v1/operation.ts | 5 +- .../api/servicecontrol/v1/quota_controller.ts | 11 +- .../servicecontrol/v1/service_controller.ts | 15 +- .../servicecontrol/v2/service_controller.ts | 13 +- .../api/servicemanagement/v1/resources.ts | 25 +- .../servicemanagement/v1/servicemanager.ts | 39 +- .../google/api/serviceusage/v1/resources.ts | 7 +- .../api/serviceusage/v1/serviceusage.ts | 25 +- .../api/serviceusage/v1beta1/resources.ts | 27 +- .../api/serviceusage/v1beta1/serviceusage.ts | 73 ++-- .../output1/google/api/source_info.ts | 3 +- .../output1/google/api/system_parameter.ts | 7 +- __fixtures__/output1/google/api/usage.ts | 5 +- __fixtures__/output1/google/api/visibility.ts | 5 +- .../google/logging/type/http_request.ts | 3 +- .../output1/google/logging/v2/log_entry.ts | 11 +- .../output1/google/logging/v2/logging.ts | 31 +- .../google/logging/v2/logging_config.ts | 79 ++-- .../google/logging/v2/logging_metrics.ts | 17 +- .../output1/google/longrunning/operations.ts | 17 +- __fixtures__/output1/google/protobuf/any.ts | 3 +- __fixtures__/output1/google/protobuf/api.ts | 7 +- .../google/protobuf/compiler/plugin.ts | 9 +- .../output1/google/protobuf/descriptor.ts | 55 +-- .../output1/google/protobuf/duration.ts | 3 +- __fixtures__/output1/google/protobuf/empty.ts | 3 +- .../output1/google/protobuf/field_mask.ts | 3 +- .../output1/google/protobuf/source_context.ts | 3 +- .../output1/google/protobuf/struct.ts | 9 +- .../output1/google/protobuf/timestamp.ts | 3 +- __fixtures__/output1/google/protobuf/type.ts | 11 +- .../output1/google/protobuf/wrappers.ts | 19 +- .../google/rpc/context/attribute_context.ts | 25 +- .../output1/google/rpc/error_details.ts | 31 +- __fixtures__/output1/google/rpc/status.ts | 3 +- .../ibc/applications/transfer/v1/genesis.ts | 3 +- .../ibc/applications/transfer/v1/query.ts | 13 +- .../ibc/applications/transfer/v1/transfer.ts | 5 +- .../ibc/applications/transfer/v1/tx.ts | 5 +- .../ibc/applications/transfer/v2/packet.ts | 3 +- .../output1/ibc/core/channel/v1/channel.ts | 13 +- .../output1/ibc/core/channel/v1/genesis.ts | 5 +- .../output1/ibc/core/channel/v1/query.ts | 53 +-- .../output1/ibc/core/channel/v1/tx.ts | 41 +- .../output1/ibc/core/client/v1/client.ts | 15 +- .../output1/ibc/core/client/v1/genesis.ts | 7 +- .../output1/ibc/core/client/v1/query.ts | 33 +- __fixtures__/output1/ibc/core/client/v1/tx.ts | 17 +- .../ibc/core/commitment/v1/commitment.ts | 9 +- .../ibc/core/connection/v1/connection.ts | 15 +- .../output1/ibc/core/connection/v1/genesis.ts | 3 +- .../output1/ibc/core/connection/v1/query.ts | 21 +- .../output1/ibc/core/connection/v1/tx.ts | 17 +- .../output1/ibc/core/port/v1/query.ts | 5 +- .../output1/ibc/core/types/v1/genesis.ts | 3 +- .../lightclients/localhost/v1/localhost.ts | 3 +- .../solomachine/v1/solomachine.ts | 33 +- .../solomachine/v2/solomachine.ts | 33 +- .../lightclients/tendermint/v1/tendermint.ts | 11 +- __fixtures__/output1/index.ts | 3 +- __fixtures__/output1/json-safe.ts | 10 + .../output1/osmosis/claim/v1beta1/claim.ts | 3 +- .../output1/osmosis/claim/v1beta1/genesis.ts | 3 +- .../output1/osmosis/claim/v1beta1/params.ts | 3 +- .../output1/osmosis/claim/v1beta1/query.ts | 21 +- .../output1/osmosis/epochs/genesis.ts | 5 +- __fixtures__/output1/osmosis/epochs/query.ts | 9 +- .../gamm/pool-models/balancer/balancerPool.ts | 9 +- .../gamm/pool-models/balancer/tx/tx.ts | 5 +- .../pool-models/stableswap/stableswap_pool.ts | 5 +- .../osmosis/gamm/pool-models/stableswap/tx.ts | 9 +- .../output1/osmosis/gamm/v1beta1/genesis.ts | 5 +- .../output1/osmosis/gamm/v1beta1/query.ts | 61 +-- .../output1/osmosis/gamm/v1beta1/tx.ts | 37 +- __fixtures__/output1/osmosis/gamm/v2/query.ts | 5 +- .../osmosis/ibc-rate-limit/v1beta1/params.ts | 3 +- .../osmosis/ibc-rate-limit/v1beta1/query.ts | 5 +- .../output1/osmosis/incentives/gauge.ts | 5 +- .../output1/osmosis/incentives/genesis.ts | 3 +- .../output1/osmosis/incentives/params.ts | 3 +- .../output1/osmosis/incentives/query.ts | 37 +- __fixtures__/output1/osmosis/incentives/tx.ts | 9 +- .../output1/osmosis/lockup/genesis.ts | 3 +- __fixtures__/output1/osmosis/lockup/lock.ts | 7 +- __fixtures__/output1/osmosis/lockup/params.ts | 3 +- __fixtures__/output1/osmosis/lockup/query.ts | 69 ++-- __fixtures__/output1/osmosis/lockup/tx.ts | 21 +- .../output1/osmosis/mint/v1beta1/genesis.ts | 3 +- .../output1/osmosis/mint/v1beta1/mint.ts | 9 +- .../output1/osmosis/mint/v1beta1/query.ts | 9 +- .../pool-incentives/v1beta1/genesis.ts | 3 +- .../osmosis/pool-incentives/v1beta1/gov.ts | 5 +- .../pool-incentives/v1beta1/incentives.ts | 13 +- .../osmosis/pool-incentives/v1beta1/query.ts | 29 +- .../output1/osmosis/sumtree/v1beta1/tree.ts | 7 +- .../output1/osmosis/superfluid/genesis.ts | 3 +- .../output1/osmosis/superfluid/params.ts | 3 +- .../output1/osmosis/superfluid/query.ts | 65 +-- .../output1/osmosis/superfluid/superfluid.ts | 13 +- __fixtures__/output1/osmosis/superfluid/tx.ts | 21 +- .../output1/osmosis/superfluid/v1beta1/gov.ts | 7 +- .../tokenfactory/v1beta1/authorityMetadata.ts | 3 +- .../osmosis/tokenfactory/v1beta1/genesis.ts | 5 +- .../osmosis/tokenfactory/v1beta1/params.ts | 3 +- .../osmosis/tokenfactory/v1beta1/query.ts | 13 +- .../osmosis/tokenfactory/v1beta1/tx.ts | 21 +- .../output1/osmosis/twap/v1beta1/genesis.ts | 5 +- .../output1/osmosis/twap/v1beta1/query.ts | 13 +- .../osmosis/twap/v1beta1/twap_record.ts | 3 +- .../osmosis/txfees/v1beta1/feetoken.ts | 3 +- .../output1/osmosis/txfees/v1beta1/genesis.ts | 3 +- .../output1/osmosis/txfees/v1beta1/gov.ts | 3 +- .../output1/osmosis/txfees/v1beta1/query.ts | 17 +- __fixtures__/output1/tendermint/abci/types.ts | 89 +++-- .../output1/tendermint/crypto/keys.ts | 3 +- .../output1/tendermint/crypto/proof.ts | 11 +- .../output1/tendermint/libs/bits/types.ts | 3 +- __fixtures__/output1/tendermint/p2p/types.ts | 11 +- .../output1/tendermint/types/block.ts | 3 +- .../output1/tendermint/types/evidence.ts | 9 +- .../output1/tendermint/types/params.ts | 13 +- .../output1/tendermint/types/types.ts | 27 +- .../output1/tendermint/types/validator.ts | 7 +- .../output1/tendermint/version/types.ts | 5 +- .../output2/akash/audit/v1beta1/audit.ts | 17 +- .../output2/akash/audit/v1beta2/audit.ts | 17 +- .../output2/akash/audit/v1beta2/genesis.ts | 3 +- .../output2/akash/audit/v1beta2/query.ts | 13 +- .../output2/akash/base/v1beta1/attribute.ts | 7 +- .../output2/akash/base/v1beta1/endpoint.ts | 3 +- .../output2/akash/base/v1beta1/resource.ts | 9 +- .../akash/base/v1beta1/resourcevalue.ts | 3 +- .../output2/akash/base/v1beta2/attribute.ts | 7 +- .../output2/akash/base/v1beta2/endpoint.ts | 3 +- .../output2/akash/base/v1beta2/resource.ts | 7 +- .../akash/base/v1beta2/resourceunits.ts | 3 +- .../akash/base/v1beta2/resourcevalue.ts | 3 +- .../output2/akash/cert/v1beta2/cert.ts | 15 +- .../output2/akash/cert/v1beta2/genesis.ts | 5 +- .../output2/akash/cert/v1beta2/query.ts | 7 +- .../output2/akash/deployment/v1beta1/authz.ts | 3 +- .../akash/deployment/v1beta1/deployment.ts | 23 +- .../akash/deployment/v1beta1/genesis.ts | 5 +- .../output2/akash/deployment/v1beta1/group.ts | 21 +- .../akash/deployment/v1beta1/params.ts | 3 +- .../output2/akash/deployment/v1beta1/query.ts | 13 +- .../output2/akash/deployment/v1beta2/authz.ts | 3 +- .../akash/deployment/v1beta2/deployment.ts | 7 +- .../akash/deployment/v1beta2/deploymentmsg.ts | 17 +- .../akash/deployment/v1beta2/genesis.ts | 5 +- .../output2/akash/deployment/v1beta2/group.ts | 3 +- .../akash/deployment/v1beta2/groupid.ts | 3 +- .../akash/deployment/v1beta2/groupmsg.ts | 13 +- .../akash/deployment/v1beta2/groupspec.ts | 3 +- .../akash/deployment/v1beta2/params.ts | 3 +- .../output2/akash/deployment/v1beta2/query.ts | 13 +- .../akash/deployment/v1beta2/resource.ts | 3 +- .../output2/akash/escrow/v1beta1/genesis.ts | 3 +- .../output2/akash/escrow/v1beta1/query.ts | 9 +- .../output2/akash/escrow/v1beta1/types.ts | 7 +- .../output2/akash/escrow/v1beta2/genesis.ts | 3 +- .../output2/akash/escrow/v1beta2/query.ts | 9 +- .../output2/akash/escrow/v1beta2/types.ts | 7 +- .../akash/inflation/v1beta2/genesis.ts | 3 +- .../output2/akash/inflation/v1beta2/params.ts | 3 +- .../output2/akash/market/v1beta2/bid.ts | 15 +- .../output2/akash/market/v1beta2/genesis.ts | 3 +- .../output2/akash/market/v1beta2/lease.ts | 19 +- .../output2/akash/market/v1beta2/order.ts | 7 +- .../output2/akash/market/v1beta2/params.ts | 3 +- .../output2/akash/market/v1beta2/query.ts | 25 +- .../akash/provider/v1beta1/provider.ts | 17 +- .../output2/akash/provider/v1beta2/genesis.ts | 3 +- .../akash/provider/v1beta2/provider.ts | 17 +- .../output2/akash/provider/v1beta2/query.ts | 9 +- __fixtures__/output2/confio/proofs.ts | 27 +- .../output2/cosmos/app/v1alpha1/config.ts | 5 +- .../output2/cosmos/app/v1alpha1/module.ts | 7 +- .../output2/cosmos/app/v1alpha1/query.ts | 5 +- .../output2/cosmos/auth/v1beta1/auth.ts | 7 +- .../output2/cosmos/auth/v1beta1/genesis.ts | 3 +- .../output2/cosmos/auth/v1beta1/query.ts | 13 +- .../output2/cosmos/authz/v1beta1/authz.ts | 7 +- .../output2/cosmos/authz/v1beta1/genesis.ts | 3 +- .../output2/cosmos/authz/v1beta1/query.ts | 13 +- .../output2/cosmos/authz/v1beta1/tx.ts | 13 +- .../output2/cosmos/bank/v1beta1/authz.ts | 3 +- .../output2/cosmos/bank/v1beta1/bank.ts | 15 +- .../output2/cosmos/bank/v1beta1/genesis.ts | 5 +- .../output2/cosmos/bank/v1beta1/query.ts | 33 +- .../output2/cosmos/bank/v1beta1/tx.ts | 9 +- .../output2/cosmos/base/abci/v1beta1/abci.ts | 21 +- .../output2/cosmos/base/kv/v1beta1/kv.ts | 5 +- .../cosmos/base/query/v1beta1/pagination.ts | 5 +- .../base/reflection/v1beta1/reflection.ts | 9 +- .../cosmos/base/snapshots/v1beta1/snapshot.ts | 15 +- .../cosmos/base/store/v1beta1/commit_info.ts | 7 +- .../cosmos/base/store/v1beta1/listening.ts | 3 +- .../cosmos/base/tendermint/v1beta1/query.ts | 31 +- .../output2/cosmos/base/v1beta1/coin.ts | 9 +- .../cosmos/capability/v1beta1/capability.ts | 7 +- .../cosmos/capability/v1beta1/genesis.ts | 5 +- .../output2/cosmos/crisis/v1beta1/genesis.ts | 3 +- .../output2/cosmos/crisis/v1beta1/tx.ts | 5 +- .../output2/cosmos/crypto/ed25519/keys.ts | 5 +- .../output2/cosmos/crypto/hd/v1/hd.ts | 3 +- .../cosmos/crypto/keyring/v1/record.ts | 11 +- .../output2/cosmos/crypto/multisig/keys.ts | 3 +- .../crypto/multisig/v1beta1/multisig.ts | 5 +- .../output2/cosmos/crypto/secp256k1/keys.ts | 5 +- .../distribution/v1beta1/distribution.ts | 25 +- .../cosmos/distribution/v1beta1/genesis.ts | 17 +- .../cosmos/distribution/v1beta1/query.ts | 37 +- .../output2/cosmos/distribution/v1beta1/tx.ts | 17 +- .../cosmos/evidence/v1beta1/evidence.ts | 3 +- .../cosmos/evidence/v1beta1/genesis.ts | 3 +- .../output2/cosmos/evidence/v1beta1/query.ts | 9 +- .../output2/cosmos/evidence/v1beta1/tx.ts | 5 +- .../cosmos/feegrant/v1beta1/feegrant.ts | 9 +- .../cosmos/feegrant/v1beta1/genesis.ts | 3 +- .../output2/cosmos/feegrant/v1beta1/query.ts | 13 +- .../output2/cosmos/feegrant/v1beta1/tx.ts | 9 +- .../output2/cosmos/genutil/v1beta1/genesis.ts | 3 +- __fixtures__/output2/cosmos/gov/v1/genesis.ts | 3 +- __fixtures__/output2/cosmos/gov/v1/gov.ts | 17 +- __fixtures__/output2/cosmos/gov/v1/query.ts | 33 +- __fixtures__/output2/cosmos/gov/v1/tx.ts | 21 +- .../output2/cosmos/gov/v1beta1/genesis.ts | 3 +- .../output2/cosmos/gov/v1beta1/gov.ts | 19 +- .../output2/cosmos/gov/v1beta1/query.ts | 33 +- __fixtures__/output2/cosmos/gov/v1beta1/tx.ts | 17 +- .../output2/cosmos/group/v1/events.ts | 19 +- .../output2/cosmos/group/v1/genesis.ts | 3 +- __fixtures__/output2/cosmos/group/v1/query.ts | 53 +-- __fixtures__/output2/cosmos/group/v1/tx.ts | 57 +-- __fixtures__/output2/cosmos/group/v1/types.ts | 23 +- .../output2/cosmos/mint/v1beta1/genesis.ts | 3 +- .../output2/cosmos/mint/v1beta1/mint.ts | 5 +- .../output2/cosmos/mint/v1beta1/query.ts | 13 +- .../output2/cosmos/nft/v1beta1/event.ts | 7 +- .../output2/cosmos/nft/v1beta1/genesis.ts | 5 +- .../output2/cosmos/nft/v1beta1/nft.ts | 5 +- .../output2/cosmos/nft/v1beta1/query.ts | 29 +- __fixtures__/output2/cosmos/nft/v1beta1/tx.ts | 5 +- .../cosmos/orm/module/v1alpha1/module.ts | 3 +- __fixtures__/output2/cosmos/orm/v1/orm.ts | 9 +- .../output2/cosmos/orm/v1alpha1/schema.ts | 5 +- .../output2/cosmos/params/v1beta1/params.ts | 5 +- .../output2/cosmos/params/v1beta1/query.ts | 5 +- .../cosmos/slashing/v1beta1/genesis.ts | 9 +- .../output2/cosmos/slashing/v1beta1/query.ts | 13 +- .../cosmos/slashing/v1beta1/slashing.ts | 5 +- .../output2/cosmos/slashing/v1beta1/tx.ts | 5 +- .../output2/cosmos/staking/v1beta1/authz.ts | 5 +- .../output2/cosmos/staking/v1beta1/genesis.ts | 5 +- .../output2/cosmos/staking/v1beta1/query.ts | 57 +-- .../output2/cosmos/staking/v1beta1/staking.ts | 41 +- .../output2/cosmos/staking/v1beta1/tx.ts | 21 +- .../cosmos/tx/signing/v1beta1/signing.ts | 11 +- .../output2/cosmos/tx/v1beta1/service.ts | 21 +- __fixtures__/output2/cosmos/tx/v1beta1/tx.ts | 21 +- .../output2/cosmos/upgrade/v1beta1/query.ts | 17 +- .../output2/cosmos/upgrade/v1beta1/tx.ts | 9 +- .../output2/cosmos/upgrade/v1beta1/upgrade.ts | 9 +- .../output2/cosmos/vesting/v1beta1/tx.ts | 5 +- .../output2/cosmos/vesting/v1beta1/vesting.ts | 13 +- .../output2/cosmwasm/wasm/v1/genesis.ts | 11 +- __fixtures__/output2/cosmwasm/wasm/v1/ibc.ts | 5 +- .../output2/cosmwasm/wasm/v1/proposal.ts | 23 +- .../output2/cosmwasm/wasm/v1/query.ts | 39 +- __fixtures__/output2/cosmwasm/wasm/v1/tx.ts | 25 +- .../output2/cosmwasm/wasm/v1/types.ts | 17 +- .../output2/evmos/claims/v1/claims.ts | 7 +- .../output2/evmos/claims/v1/genesis.ts | 5 +- __fixtures__/output2/evmos/claims/v1/query.ts | 17 +- .../output2/evmos/epochs/v1/genesis.ts | 5 +- __fixtures__/output2/evmos/epochs/v1/query.ts | 9 +- __fixtures__/output2/evmos/erc20/v1/erc20.ts | 9 +- .../output2/evmos/erc20/v1/genesis.ts | 5 +- __fixtures__/output2/evmos/erc20/v1/query.ts | 13 +- __fixtures__/output2/evmos/erc20/v1/tx.ts | 9 +- __fixtures__/output2/evmos/fees/v1/fees.ts | 3 +- __fixtures__/output2/evmos/fees/v1/genesis.ts | 5 +- __fixtures__/output2/evmos/fees/v1/query.ts | 17 +- __fixtures__/output2/evmos/fees/v1/tx.ts | 13 +- .../output2/evmos/incentives/v1/genesis.ts | 5 +- .../output2/evmos/incentives/v1/incentives.ts | 9 +- .../output2/evmos/incentives/v1/query.ts | 29 +- .../output2/evmos/inflation/v1/genesis.ts | 5 +- .../output2/evmos/inflation/v1/inflation.ts | 5 +- .../output2/evmos/inflation/v1/query.ts | 25 +- .../output2/evmos/recovery/v1/genesis.ts | 5 +- .../output2/evmos/recovery/v1/query.ts | 5 +- .../output2/evmos/vesting/v1/query.ts | 5 +- __fixtures__/output2/evmos/vesting/v1/tx.ts | 9 +- .../output2/evmos/vesting/v1/vesting.ts | 3 +- __fixtures__/output2/google/api/auth.ts | 13 +- __fixtures__/output2/google/api/backend.ts | 5 +- __fixtures__/output2/google/api/billing.ts | 5 +- .../output2/google/api/config_change.ts | 5 +- __fixtures__/output2/google/api/consumer.ts | 5 +- __fixtures__/output2/google/api/context.ts | 5 +- __fixtures__/output2/google/api/control.ts | 3 +- .../output2/google/api/distribution.ts | 15 +- .../output2/google/api/documentation.ts | 7 +- __fixtures__/output2/google/api/endpoint.ts | 3 +- .../v1alpha1/conformance_service.ts | 17 +- .../google/api/expr/v1alpha1/checked.ts | 27 +- .../output2/google/api/expr/v1alpha1/eval.ts | 11 +- .../google/api/expr/v1alpha1/explain.ts | 5 +- .../google/api/expr/v1alpha1/syntax.ts | 29 +- .../output2/google/api/expr/v1alpha1/value.ts | 11 +- .../output2/google/api/expr/v1beta1/decl.ts | 9 +- .../output2/google/api/expr/v1beta1/eval.ts | 13 +- .../output2/google/api/expr/v1beta1/expr.ts | 21 +- .../output2/google/api/expr/v1beta1/source.ts | 7 +- .../output2/google/api/expr/v1beta1/value.ts | 11 +- __fixtures__/output2/google/api/http.ts | 7 +- __fixtures__/output2/google/api/label.ts | 3 +- __fixtures__/output2/google/api/log.ts | 3 +- __fixtures__/output2/google/api/logging.ts | 5 +- __fixtures__/output2/google/api/metric.ts | 9 +- .../output2/google/api/monitored_resource.ts | 11 +- __fixtures__/output2/google/api/monitoring.ts | 5 +- __fixtures__/output2/google/api/quota.ts | 11 +- __fixtures__/output2/google/api/resource.ts | 5 +- __fixtures__/output2/google/api/routing.ts | 5 +- __fixtures__/output2/google/api/service.ts | 3 +- .../api/servicecontrol/v1/check_error.ts | 3 +- .../api/servicecontrol/v1/distribution.ts | 9 +- .../api/servicecontrol/v1/http_request.ts | 3 +- .../google/api/servicecontrol/v1/log_entry.ts | 9 +- .../api/servicecontrol/v1/metric_value.ts | 7 +- .../google/api/servicecontrol/v1/operation.ts | 5 +- .../api/servicecontrol/v1/quota_controller.ts | 11 +- .../servicecontrol/v1/service_controller.ts | 15 +- .../servicecontrol/v2/service_controller.ts | 13 +- .../api/servicemanagement/v1/resources.ts | 25 +- .../servicemanagement/v1/servicemanager.ts | 39 +- .../google/api/serviceusage/v1/resources.ts | 7 +- .../api/serviceusage/v1/serviceusage.ts | 25 +- .../api/serviceusage/v1beta1/resources.ts | 27 +- .../api/serviceusage/v1beta1/serviceusage.ts | 73 ++-- .../output2/google/api/source_info.ts | 3 +- .../output2/google/api/system_parameter.ts | 7 +- __fixtures__/output2/google/api/usage.ts | 5 +- __fixtures__/output2/google/api/visibility.ts | 5 +- .../google/logging/type/http_request.ts | 3 +- .../output2/google/logging/v2/log_entry.ts | 11 +- .../output2/google/logging/v2/logging.ts | 31 +- .../google/logging/v2/logging_config.ts | 79 ++-- .../google/logging/v2/logging_metrics.ts | 17 +- .../output2/google/longrunning/operations.ts | 17 +- __fixtures__/output2/google/protobuf/any.ts | 3 +- __fixtures__/output2/google/protobuf/api.ts | 7 +- .../google/protobuf/compiler/plugin.ts | 9 +- .../output2/google/protobuf/descriptor.ts | 55 +-- .../output2/google/protobuf/duration.ts | 3 +- __fixtures__/output2/google/protobuf/empty.ts | 3 +- .../output2/google/protobuf/field_mask.ts | 3 +- .../output2/google/protobuf/source_context.ts | 3 +- .../output2/google/protobuf/struct.ts | 9 +- .../output2/google/protobuf/timestamp.ts | 3 +- __fixtures__/output2/google/protobuf/type.ts | 11 +- .../output2/google/protobuf/wrappers.ts | 19 +- .../google/rpc/context/attribute_context.ts | 25 +- .../output2/google/rpc/error_details.ts | 31 +- __fixtures__/output2/google/rpc/status.ts | 3 +- .../controller/v1/controller.ts | 3 +- .../controller/v1/query.ts | 5 +- .../interchain_accounts/host/v1/host.ts | 3 +- .../interchain_accounts/host/v1/query.ts | 5 +- .../interchain_accounts/v1/account.ts | 3 +- .../interchain_accounts/v1/genesis.ts | 11 +- .../interchain_accounts/v1/metadata.ts | 3 +- .../interchain_accounts/v1/packet.ts | 5 +- .../ibc/applications/transfer/v1/genesis.ts | 3 +- .../ibc/applications/transfer/v1/query.ts | 17 +- .../ibc/applications/transfer/v1/transfer.ts | 5 +- .../ibc/applications/transfer/v1/tx.ts | 5 +- .../ibc/applications/transfer/v2/packet.ts | 3 +- .../output2/ibc/core/channel/v1/channel.ts | 13 +- .../output2/ibc/core/channel/v1/genesis.ts | 5 +- .../output2/ibc/core/channel/v1/query.ts | 53 +-- .../output2/ibc/core/channel/v1/tx.ts | 41 +- .../output2/ibc/core/client/v1/client.ts | 15 +- .../output2/ibc/core/client/v1/genesis.ts | 7 +- .../output2/ibc/core/client/v1/query.ts | 33 +- __fixtures__/output2/ibc/core/client/v1/tx.ts | 17 +- .../ibc/core/commitment/v1/commitment.ts | 9 +- .../ibc/core/connection/v1/connection.ts | 15 +- .../output2/ibc/core/connection/v1/genesis.ts | 3 +- .../output2/ibc/core/connection/v1/query.ts | 21 +- .../output2/ibc/core/connection/v1/tx.ts | 17 +- .../output2/ibc/core/types/v1/genesis.ts | 3 +- .../lightclients/localhost/v1/localhost.ts | 3 +- .../solomachine/v1/solomachine.ts | 33 +- .../lightclients/tendermint/v1/tendermint.ts | 11 +- __fixtures__/output2/json-safe.ts | 12 + .../output2/osmosis/claim/v1beta1/claim.ts | 3 +- .../output2/osmosis/claim/v1beta1/genesis.ts | 3 +- .../output2/osmosis/claim/v1beta1/params.ts | 3 +- .../output2/osmosis/claim/v1beta1/query.ts | 21 +- .../output2/osmosis/epochs/genesis.ts | 5 +- __fixtures__/output2/osmosis/epochs/query.ts | 9 +- .../gamm/pool-models/balancer/balancerPool.ts | 9 +- .../gamm/pool-models/balancer/tx/tx.ts | 5 +- .../pool-models/stableswap/stableswap_pool.ts | 5 +- .../osmosis/gamm/pool-models/stableswap/tx.ts | 9 +- .../output2/osmosis/gamm/v1beta1/genesis.ts | 5 +- .../output2/osmosis/gamm/v1beta1/query.ts | 61 +-- .../output2/osmosis/gamm/v1beta1/tx.ts | 37 +- __fixtures__/output2/osmosis/gamm/v2/query.ts | 5 +- .../osmosis/ibc-rate-limit/v1beta1/params.ts | 3 +- .../osmosis/ibc-rate-limit/v1beta1/query.ts | 5 +- .../output2/osmosis/incentives/gauge.ts | 5 +- .../output2/osmosis/incentives/genesis.ts | 3 +- .../output2/osmosis/incentives/params.ts | 3 +- .../output2/osmosis/incentives/query.ts | 37 +- __fixtures__/output2/osmosis/incentives/tx.ts | 9 +- .../output2/osmosis/lockup/genesis.ts | 3 +- __fixtures__/output2/osmosis/lockup/lock.ts | 7 +- __fixtures__/output2/osmosis/lockup/params.ts | 3 +- __fixtures__/output2/osmosis/lockup/query.ts | 69 ++-- __fixtures__/output2/osmosis/lockup/tx.ts | 21 +- .../output2/osmosis/mint/v1beta1/genesis.ts | 3 +- .../output2/osmosis/mint/v1beta1/mint.ts | 9 +- .../output2/osmosis/mint/v1beta1/query.ts | 9 +- .../pool-incentives/v1beta1/genesis.ts | 3 +- .../osmosis/pool-incentives/v1beta1/gov.ts | 5 +- .../pool-incentives/v1beta1/incentives.ts | 13 +- .../osmosis/pool-incentives/v1beta1/query.ts | 29 +- .../output2/osmosis/sumtree/v1beta1/tree.ts | 7 +- .../output2/osmosis/superfluid/genesis.ts | 3 +- .../output2/osmosis/superfluid/params.ts | 3 +- .../output2/osmosis/superfluid/query.ts | 65 +-- .../output2/osmosis/superfluid/superfluid.ts | 13 +- __fixtures__/output2/osmosis/superfluid/tx.ts | 21 +- .../output2/osmosis/superfluid/v1beta1/gov.ts | 7 +- .../tokenfactory/v1beta1/authorityMetadata.ts | 3 +- .../osmosis/tokenfactory/v1beta1/genesis.ts | 5 +- .../osmosis/tokenfactory/v1beta1/params.ts | 3 +- .../osmosis/tokenfactory/v1beta1/query.ts | 13 +- .../osmosis/tokenfactory/v1beta1/tx.ts | 21 +- .../output2/osmosis/twap/v1beta1/genesis.ts | 5 +- .../output2/osmosis/twap/v1beta1/query.ts | 13 +- .../osmosis/twap/v1beta1/twap_record.ts | 3 +- .../osmosis/txfees/v1beta1/feetoken.ts | 3 +- .../output2/osmosis/txfees/v1beta1/genesis.ts | 3 +- .../output2/osmosis/txfees/v1beta1/gov.ts | 3 +- .../output2/osmosis/txfees/v1beta1/query.ts | 17 +- __fixtures__/output2/tendermint/abci/types.ts | 89 +++-- .../output2/tendermint/crypto/keys.ts | 3 +- .../output2/tendermint/crypto/proof.ts | 11 +- __fixtures__/output2/tendermint/p2p/types.ts | 9 +- .../output2/tendermint/types/block.ts | 3 +- .../output2/tendermint/types/evidence.ts | 9 +- .../output2/tendermint/types/params.ts | 13 +- .../output2/tendermint/types/types.ts | 27 +- .../output2/tendermint/types/validator.ts | 7 +- .../output2/tendermint/version/types.ts | 5 +- .../akash/audit/v1beta1/audit.ts | 17 +- .../akash/audit/v1beta2/audit.ts | 17 +- .../akash/audit/v1beta2/genesis.ts | 3 +- .../akash/audit/v1beta2/query.ts | 13 +- .../akash/base/v1beta1/attribute.ts | 7 +- .../akash/base/v1beta1/endpoint.ts | 3 +- .../akash/base/v1beta1/resource.ts | 9 +- .../akash/base/v1beta1/resourcevalue.ts | 3 +- .../akash/base/v1beta2/attribute.ts | 7 +- .../akash/base/v1beta2/endpoint.ts | 3 +- .../akash/base/v1beta2/resource.ts | 7 +- .../akash/base/v1beta2/resourceunits.ts | 3 +- .../akash/base/v1beta2/resourcevalue.ts | 3 +- .../akash/cert/v1beta2/cert.ts | 15 +- .../akash/cert/v1beta2/genesis.ts | 5 +- .../akash/cert/v1beta2/query.ts | 7 +- .../akash/deployment/v1beta1/authz.ts | 3 +- .../akash/deployment/v1beta1/deployment.ts | 23 +- .../akash/deployment/v1beta1/genesis.ts | 5 +- .../akash/deployment/v1beta1/group.ts | 21 +- .../akash/deployment/v1beta1/params.ts | 3 +- .../akash/deployment/v1beta1/query.ts | 13 +- .../akash/deployment/v1beta2/authz.ts | 3 +- .../akash/deployment/v1beta2/deployment.ts | 7 +- .../akash/deployment/v1beta2/deploymentmsg.ts | 17 +- .../akash/deployment/v1beta2/genesis.ts | 5 +- .../akash/deployment/v1beta2/group.ts | 3 +- .../akash/deployment/v1beta2/groupid.ts | 3 +- .../akash/deployment/v1beta2/groupmsg.ts | 13 +- .../akash/deployment/v1beta2/groupspec.ts | 3 +- .../akash/deployment/v1beta2/params.ts | 3 +- .../akash/deployment/v1beta2/query.ts | 13 +- .../akash/deployment/v1beta2/resource.ts | 3 +- .../akash/escrow/v1beta1/genesis.ts | 3 +- .../akash/escrow/v1beta1/query.ts | 9 +- .../akash/escrow/v1beta1/types.ts | 7 +- .../akash/escrow/v1beta2/genesis.ts | 3 +- .../akash/escrow/v1beta2/query.ts | 9 +- .../akash/escrow/v1beta2/types.ts | 7 +- .../akash/inflation/v1beta2/genesis.ts | 3 +- .../akash/inflation/v1beta2/params.ts | 3 +- .../akash/market/v1beta2/bid.ts | 15 +- .../akash/market/v1beta2/genesis.ts | 3 +- .../akash/market/v1beta2/lease.ts | 19 +- .../akash/market/v1beta2/order.ts | 7 +- .../akash/market/v1beta2/params.ts | 3 +- .../akash/market/v1beta2/query.ts | 25 +- .../akash/provider/v1beta1/provider.ts | 17 +- .../akash/provider/v1beta2/genesis.ts | 3 +- .../akash/provider/v1beta2/provider.ts | 17 +- .../akash/provider/v1beta2/query.ts | 9 +- .../v-next/outputinstantrpc/confio/proofs.ts | 27 +- .../cosmos/app/v1alpha1/config.ts | 5 +- .../cosmos/app/v1alpha1/module.ts | 7 +- .../cosmos/app/v1alpha1/query.ts | 5 +- .../cosmos/auth/v1beta1/auth.ts | 7 +- .../cosmos/auth/v1beta1/genesis.ts | 3 +- .../cosmos/auth/v1beta1/query.ts | 29 +- .../cosmos/authz/v1beta1/authz.ts | 9 +- .../cosmos/authz/v1beta1/genesis.ts | 3 +- .../cosmos/authz/v1beta1/query.ts | 13 +- .../cosmos/authz/v1beta1/tx.ts | 13 +- .../cosmos/bank/v1beta1/authz.ts | 3 +- .../cosmos/bank/v1beta1/bank.ts | 15 +- .../cosmos/bank/v1beta1/genesis.ts | 5 +- .../cosmos/bank/v1beta1/query.ts | 39 +- .../cosmos/bank/v1beta1/tx.ts | 9 +- .../cosmos/base/abci/v1beta1/abci.ts | 21 +- .../cosmos/base/kv/v1beta1/kv.ts | 5 +- .../cosmos/base/query/v1beta1/pagination.ts | 5 +- .../base/reflection/v1beta1/reflection.ts | 9 +- .../base/reflection/v2alpha1/reflection.ts | 53 +-- .../cosmos/base/snapshots/v1beta1/snapshot.ts | 19 +- .../cosmos/base/store/v1beta1/commit_info.ts | 7 +- .../cosmos/base/store/v1beta1/listening.ts | 3 +- .../cosmos/base/tendermint/v1beta1/query.ts | 31 +- .../cosmos/base/v1beta1/coin.ts | 9 +- .../cosmos/capability/v1beta1/capability.ts | 7 +- .../cosmos/capability/v1beta1/genesis.ts | 5 +- .../cosmos/crisis/v1beta1/genesis.ts | 3 +- .../cosmos/crisis/v1beta1/tx.ts | 5 +- .../cosmos/crypto/ed25519/keys.ts | 5 +- .../cosmos/crypto/hd/v1/hd.ts | 3 +- .../cosmos/crypto/keyring/v1/record.ts | 11 +- .../cosmos/crypto/multisig/keys.ts | 3 +- .../crypto/multisig/v1beta1/multisig.ts | 5 +- .../cosmos/crypto/secp256k1/keys.ts | 5 +- .../cosmos/crypto/secp256r1/keys.ts | 5 +- .../distribution/v1beta1/distribution.ts | 25 +- .../cosmos/distribution/v1beta1/genesis.ts | 17 +- .../cosmos/distribution/v1beta1/query.ts | 37 +- .../cosmos/distribution/v1beta1/tx.ts | 17 +- .../cosmos/evidence/v1beta1/evidence.ts | 3 +- .../cosmos/evidence/v1beta1/genesis.ts | 3 +- .../cosmos/evidence/v1beta1/query.ts | 9 +- .../cosmos/evidence/v1beta1/tx.ts | 5 +- .../cosmos/feegrant/v1beta1/feegrant.ts | 9 +- .../cosmos/feegrant/v1beta1/genesis.ts | 3 +- .../cosmos/feegrant/v1beta1/query.ts | 13 +- .../cosmos/feegrant/v1beta1/tx.ts | 9 +- .../cosmos/genutil/v1beta1/genesis.ts | 3 +- .../outputinstantrpc/cosmos/gov/v1/genesis.ts | 3 +- .../outputinstantrpc/cosmos/gov/v1/gov.ts | 17 +- .../outputinstantrpc/cosmos/gov/v1/query.ts | 33 +- .../outputinstantrpc/cosmos/gov/v1/tx.ts | 21 +- .../cosmos/gov/v1beta1/genesis.ts | 3 +- .../cosmos/gov/v1beta1/gov.ts | 19 +- .../cosmos/gov/v1beta1/query.ts | 33 +- .../outputinstantrpc/cosmos/gov/v1beta1/tx.ts | 17 +- .../cosmos/group/v1/events.ts | 19 +- .../cosmos/group/v1/genesis.ts | 3 +- .../outputinstantrpc/cosmos/group/v1/query.ts | 53 +-- .../outputinstantrpc/cosmos/group/v1/tx.ts | 57 +-- .../outputinstantrpc/cosmos/group/v1/types.ts | 23 +- .../cosmos/mint/v1beta1/genesis.ts | 3 +- .../cosmos/mint/v1beta1/mint.ts | 5 +- .../cosmos/mint/v1beta1/query.ts | 13 +- .../cosmos/nft/v1beta1/event.ts | 7 +- .../cosmos/nft/v1beta1/genesis.ts | 5 +- .../cosmos/nft/v1beta1/nft.ts | 5 +- .../cosmos/nft/v1beta1/query.ts | 29 +- .../outputinstantrpc/cosmos/nft/v1beta1/tx.ts | 5 +- .../cosmos/orm/module/v1alpha1/module.ts | 3 +- .../outputinstantrpc/cosmos/orm/v1/orm.ts | 9 +- .../cosmos/orm/v1alpha1/schema.ts | 5 +- .../cosmos/params/v1beta1/params.ts | 5 +- .../cosmos/params/v1beta1/query.ts | 11 +- .../cosmos/slashing/v1beta1/genesis.ts | 9 +- .../cosmos/slashing/v1beta1/query.ts | 13 +- .../cosmos/slashing/v1beta1/slashing.ts | 5 +- .../cosmos/slashing/v1beta1/tx.ts | 5 +- .../cosmos/staking/v1beta1/authz.ts | 5 +- .../cosmos/staking/v1beta1/genesis.ts | 5 +- .../cosmos/staking/v1beta1/query.ts | 57 +-- .../cosmos/staking/v1beta1/staking.ts | 41 +- .../cosmos/staking/v1beta1/tx.ts | 21 +- .../cosmos/tx/signing/v1beta1/signing.ts | 11 +- .../cosmos/tx/v1beta1/service.ts | 21 +- .../outputinstantrpc/cosmos/tx/v1beta1/tx.ts | 27 +- .../cosmos/upgrade/v1beta1/query.ts | 21 +- .../cosmos/upgrade/v1beta1/tx.ts | 9 +- .../cosmos/upgrade/v1beta1/upgrade.ts | 9 +- .../cosmos/vesting/v1beta1/tx.ts | 13 +- .../cosmos/vesting/v1beta1/vesting.ts | 13 +- .../outputinstantrpc/cosmos_proto/cosmos.ts | 5 +- .../cosmwasm/wasm/v1/genesis.ts | 11 +- .../outputinstantrpc/cosmwasm/wasm/v1/ibc.ts | 5 +- .../cosmwasm/wasm/v1/proposal.ts | 19 +- .../cosmwasm/wasm/v1/query.ts | 39 +- .../outputinstantrpc/cosmwasm/wasm/v1/tx.ts | 25 +- .../cosmwasm/wasm/v1/types.ts | 17 +- .../evmos/claims/v1/claims.ts | 7 +- .../evmos/claims/v1/genesis.ts | 5 +- .../outputinstantrpc/evmos/claims/v1/query.ts | 17 +- .../evmos/epochs/v1/genesis.ts | 5 +- .../outputinstantrpc/evmos/epochs/v1/query.ts | 9 +- .../outputinstantrpc/evmos/erc20/v1/erc20.ts | 9 +- .../evmos/erc20/v1/genesis.ts | 5 +- .../outputinstantrpc/evmos/erc20/v1/query.ts | 13 +- .../outputinstantrpc/evmos/erc20/v1/tx.ts | 9 +- .../outputinstantrpc/evmos/fees/v1/fees.ts | 3 +- .../outputinstantrpc/evmos/fees/v1/genesis.ts | 5 +- .../outputinstantrpc/evmos/fees/v1/query.ts | 17 +- .../outputinstantrpc/evmos/fees/v1/tx.ts | 13 +- .../evmos/incentives/v1/genesis.ts | 5 +- .../evmos/incentives/v1/incentives.ts | 9 +- .../evmos/incentives/v1/query.ts | 29 +- .../evmos/inflation/v1/genesis.ts | 5 +- .../evmos/inflation/v1/inflation.ts | 5 +- .../evmos/inflation/v1/query.ts | 25 +- .../evmos/recovery/v1/genesis.ts | 5 +- .../evmos/recovery/v1/query.ts | 5 +- .../evmos/vesting/v1/query.ts | 5 +- .../outputinstantrpc/evmos/vesting/v1/tx.ts | 9 +- .../evmos/vesting/v1/vesting.ts | 3 +- .../outputinstantrpc/google/api/auth.ts | 13 +- .../outputinstantrpc/google/api/backend.ts | 5 +- .../outputinstantrpc/google/api/billing.ts | 5 +- .../google/api/config_change.ts | 5 +- .../outputinstantrpc/google/api/consumer.ts | 5 +- .../outputinstantrpc/google/api/context.ts | 5 +- .../outputinstantrpc/google/api/control.ts | 3 +- .../google/api/distribution.ts | 15 +- .../google/api/documentation.ts | 7 +- .../outputinstantrpc/google/api/endpoint.ts | 3 +- .../v1alpha1/conformance_service.ts | 17 +- .../google/api/expr/v1alpha1/checked.ts | 27 +- .../google/api/expr/v1alpha1/eval.ts | 11 +- .../google/api/expr/v1alpha1/explain.ts | 5 +- .../google/api/expr/v1alpha1/syntax.ts | 29 +- .../google/api/expr/v1alpha1/value.ts | 11 +- .../google/api/expr/v1beta1/decl.ts | 9 +- .../google/api/expr/v1beta1/eval.ts | 13 +- .../google/api/expr/v1beta1/expr.ts | 21 +- .../google/api/expr/v1beta1/source.ts | 7 +- .../google/api/expr/v1beta1/value.ts | 11 +- .../outputinstantrpc/google/api/http.ts | 7 +- .../outputinstantrpc/google/api/httpbody.ts | 3 +- .../outputinstantrpc/google/api/label.ts | 3 +- .../v-next/outputinstantrpc/google/api/log.ts | 3 +- .../outputinstantrpc/google/api/logging.ts | 5 +- .../outputinstantrpc/google/api/metric.ts | 9 +- .../google/api/monitored_resource.ts | 11 +- .../outputinstantrpc/google/api/monitoring.ts | 5 +- .../outputinstantrpc/google/api/quota.ts | 11 +- .../outputinstantrpc/google/api/resource.ts | 5 +- .../outputinstantrpc/google/api/routing.ts | 5 +- .../outputinstantrpc/google/api/service.ts | 3 +- .../api/servicecontrol/v1/check_error.ts | 3 +- .../api/servicecontrol/v1/distribution.ts | 9 +- .../api/servicecontrol/v1/http_request.ts | 3 +- .../google/api/servicecontrol/v1/log_entry.ts | 9 +- .../api/servicecontrol/v1/metric_value.ts | 7 +- .../google/api/servicecontrol/v1/operation.ts | 5 +- .../api/servicecontrol/v1/quota_controller.ts | 11 +- .../servicecontrol/v1/service_controller.ts | 15 +- .../servicecontrol/v2/service_controller.ts | 13 +- .../api/servicemanagement/v1/resources.ts | 25 +- .../servicemanagement/v1/servicemanager.ts | 39 +- .../google/api/serviceusage/v1/resources.ts | 7 +- .../api/serviceusage/v1/serviceusage.ts | 25 +- .../api/serviceusage/v1beta1/resources.ts | 27 +- .../api/serviceusage/v1beta1/serviceusage.ts | 73 ++-- .../google/api/source_info.ts | 3 +- .../google/api/system_parameter.ts | 7 +- .../outputinstantrpc/google/api/usage.ts | 5 +- .../outputinstantrpc/google/api/visibility.ts | 5 +- .../google/logging/type/http_request.ts | 3 +- .../google/logging/v2/log_entry.ts | 11 +- .../google/logging/v2/logging.ts | 31 +- .../google/logging/v2/logging_config.ts | 79 ++-- .../google/logging/v2/logging_metrics.ts | 17 +- .../google/longrunning/operations.ts | 17 +- .../outputinstantrpc/google/protobuf/any.ts | 3 +- .../outputinstantrpc/google/protobuf/api.ts | 7 +- .../google/protobuf/compiler/plugin.ts | 9 +- .../google/protobuf/descriptor.ts | 55 +-- .../google/protobuf/duration.ts | 3 +- .../outputinstantrpc/google/protobuf/empty.ts | 3 +- .../google/protobuf/field_mask.ts | 3 +- .../google/protobuf/source_context.ts | 3 +- .../google/protobuf/struct.ts | 9 +- .../google/protobuf/timestamp.ts | 3 +- .../outputinstantrpc/google/protobuf/type.ts | 11 +- .../google/protobuf/wrappers.ts | 19 +- .../google/rpc/context/attribute_context.ts | 25 +- .../google/rpc/error_details.ts | 31 +- .../outputinstantrpc/google/rpc/status.ts | 3 +- .../ibc/applications/transfer/v1/genesis.ts | 3 +- .../ibc/applications/transfer/v1/query.ts | 13 +- .../ibc/applications/transfer/v1/transfer.ts | 5 +- .../ibc/applications/transfer/v1/tx.ts | 5 +- .../ibc/applications/transfer/v2/packet.ts | 3 +- .../ibc/core/channel/v1/channel.ts | 13 +- .../ibc/core/channel/v1/genesis.ts | 5 +- .../ibc/core/channel/v1/query.ts | 53 +-- .../ibc/core/channel/v1/tx.ts | 41 +- .../ibc/core/client/v1/client.ts | 15 +- .../ibc/core/client/v1/genesis.ts | 7 +- .../ibc/core/client/v1/query.ts | 33 +- .../outputinstantrpc/ibc/core/client/v1/tx.ts | 17 +- .../ibc/core/commitment/v1/commitment.ts | 9 +- .../ibc/core/connection/v1/connection.ts | 15 +- .../ibc/core/connection/v1/genesis.ts | 3 +- .../ibc/core/connection/v1/query.ts | 21 +- .../ibc/core/connection/v1/tx.ts | 17 +- .../ibc/core/port/v1/query.ts | 5 +- .../ibc/core/types/v1/genesis.ts | 3 +- .../lightclients/localhost/v1/localhost.ts | 3 +- .../solomachine/v1/solomachine.ts | 33 +- .../solomachine/v2/solomachine.ts | 33 +- .../lightclients/tendermint/v1/tendermint.ts | 11 +- __fixtures__/v-next/outputinstantrpc/index.ts | 1 + .../v-next/outputinstantrpc/json-safe.ts | 10 + .../osmosis/claim/v1beta1/claim.ts | 3 +- .../osmosis/claim/v1beta1/genesis.ts | 3 +- .../osmosis/claim/v1beta1/params.ts | 3 +- .../osmosis/claim/v1beta1/query.ts | 21 +- .../osmosis/epochs/genesis.ts | 5 +- .../outputinstantrpc/osmosis/epochs/query.ts | 9 +- .../gamm/pool-models/balancer/balancerPool.ts | 9 +- .../gamm/pool-models/balancer/tx/tx.ts | 5 +- .../pool-models/stableswap/stableswap_pool.ts | 5 +- .../osmosis/gamm/pool-models/stableswap/tx.ts | 9 +- .../osmosis/gamm/v1beta1/genesis.ts | 5 +- .../osmosis/gamm/v1beta1/query.ts | 61 +-- .../osmosis/gamm/v1beta1/tx.ts | 37 +- .../outputinstantrpc/osmosis/gamm/v2/query.ts | 5 +- .../osmosis/ibc-rate-limit/v1beta1/params.ts | 3 +- .../osmosis/ibc-rate-limit/v1beta1/query.ts | 5 +- .../osmosis/incentives/gauge.ts | 5 +- .../osmosis/incentives/genesis.ts | 3 +- .../osmosis/incentives/params.ts | 3 +- .../osmosis/incentives/query.ts | 37 +- .../outputinstantrpc/osmosis/incentives/tx.ts | 9 +- .../osmosis/lockup/genesis.ts | 3 +- .../outputinstantrpc/osmosis/lockup/lock.ts | 7 +- .../outputinstantrpc/osmosis/lockup/params.ts | 3 +- .../outputinstantrpc/osmosis/lockup/query.ts | 69 ++-- .../outputinstantrpc/osmosis/lockup/tx.ts | 21 +- .../osmosis/mint/v1beta1/genesis.ts | 3 +- .../osmosis/mint/v1beta1/mint.ts | 9 +- .../osmosis/mint/v1beta1/query.ts | 9 +- .../pool-incentives/v1beta1/genesis.ts | 3 +- .../osmosis/pool-incentives/v1beta1/gov.ts | 5 +- .../pool-incentives/v1beta1/incentives.ts | 13 +- .../osmosis/pool-incentives/v1beta1/query.ts | 29 +- .../osmosis/sumtree/v1beta1/tree.ts | 7 +- .../osmosis/superfluid/genesis.ts | 3 +- .../osmosis/superfluid/params.ts | 3 +- .../osmosis/superfluid/query.ts | 65 +-- .../osmosis/superfluid/superfluid.ts | 13 +- .../outputinstantrpc/osmosis/superfluid/tx.ts | 21 +- .../osmosis/superfluid/v1beta1/gov.ts | 7 +- .../tokenfactory/v1beta1/authorityMetadata.ts | 3 +- .../osmosis/tokenfactory/v1beta1/genesis.ts | 5 +- .../osmosis/tokenfactory/v1beta1/params.ts | 3 +- .../osmosis/tokenfactory/v1beta1/query.ts | 13 +- .../osmosis/tokenfactory/v1beta1/tx.ts | 21 +- .../osmosis/twap/v1beta1/genesis.ts | 5 +- .../osmosis/twap/v1beta1/query.ts | 13 +- .../osmosis/twap/v1beta1/twap_record.ts | 3 +- .../osmosis/txfees/v1beta1/feetoken.ts | 3 +- .../osmosis/txfees/v1beta1/genesis.ts | 3 +- .../osmosis/txfees/v1beta1/gov.ts | 3 +- .../osmosis/txfees/v1beta1/query.ts | 17 +- .../outputinstantrpc/tendermint/abci/types.ts | 89 +++-- .../tendermint/crypto/keys.ts | 3 +- .../tendermint/crypto/proof.ts | 11 +- .../tendermint/libs/bits/types.ts | 3 +- .../outputinstantrpc/tendermint/p2p/types.ts | 11 +- .../tendermint/types/block.ts | 3 +- .../tendermint/types/evidence.ts | 9 +- .../tendermint/types/params.ts | 13 +- .../tendermint/types/types.ts | 27 +- .../tendermint/types/validator.ts | 7 +- .../tendermint/version/types.ts | 5 +- .../outputosmojs/akash/audit/v1beta1/audit.ts | 17 +- .../outputosmojs/akash/audit/v1beta2/audit.ts | 17 +- .../akash/audit/v1beta2/genesis.ts | 3 +- .../outputosmojs/akash/audit/v1beta2/query.ts | 13 +- .../akash/base/v1beta1/attribute.ts | 7 +- .../akash/base/v1beta1/endpoint.ts | 3 +- .../akash/base/v1beta1/resource.ts | 9 +- .../akash/base/v1beta1/resourcevalue.ts | 3 +- .../akash/base/v1beta2/attribute.ts | 7 +- .../akash/base/v1beta2/endpoint.ts | 3 +- .../akash/base/v1beta2/resource.ts | 7 +- .../akash/base/v1beta2/resourceunits.ts | 3 +- .../akash/base/v1beta2/resourcevalue.ts | 3 +- .../outputosmojs/akash/cert/v1beta2/cert.ts | 15 +- .../akash/cert/v1beta2/genesis.ts | 5 +- .../outputosmojs/akash/cert/v1beta2/query.ts | 7 +- .../akash/deployment/v1beta1/authz.ts | 3 +- .../akash/deployment/v1beta1/deployment.ts | 23 +- .../akash/deployment/v1beta1/genesis.ts | 5 +- .../akash/deployment/v1beta1/group.ts | 21 +- .../akash/deployment/v1beta1/params.ts | 3 +- .../akash/deployment/v1beta1/query.ts | 13 +- .../akash/deployment/v1beta2/authz.ts | 3 +- .../akash/deployment/v1beta2/deployment.ts | 7 +- .../akash/deployment/v1beta2/deploymentmsg.ts | 17 +- .../akash/deployment/v1beta2/genesis.ts | 5 +- .../akash/deployment/v1beta2/group.ts | 3 +- .../akash/deployment/v1beta2/groupid.ts | 3 +- .../akash/deployment/v1beta2/groupmsg.ts | 13 +- .../akash/deployment/v1beta2/groupspec.ts | 3 +- .../akash/deployment/v1beta2/params.ts | 3 +- .../akash/deployment/v1beta2/query.ts | 13 +- .../akash/deployment/v1beta2/resource.ts | 3 +- .../akash/escrow/v1beta1/genesis.ts | 3 +- .../akash/escrow/v1beta1/query.ts | 9 +- .../akash/escrow/v1beta1/types.ts | 7 +- .../akash/escrow/v1beta2/genesis.ts | 3 +- .../akash/escrow/v1beta2/query.ts | 9 +- .../akash/escrow/v1beta2/types.ts | 7 +- .../akash/inflation/v1beta2/genesis.ts | 3 +- .../akash/inflation/v1beta2/params.ts | 3 +- .../outputosmojs/akash/market/v1beta2/bid.ts | 15 +- .../akash/market/v1beta2/genesis.ts | 3 +- .../akash/market/v1beta2/lease.ts | 19 +- .../akash/market/v1beta2/order.ts | 7 +- .../akash/market/v1beta2/params.ts | 3 +- .../akash/market/v1beta2/query.ts | 25 +- .../akash/provider/v1beta1/provider.ts | 17 +- .../akash/provider/v1beta2/genesis.ts | 3 +- .../akash/provider/v1beta2/provider.ts | 17 +- .../akash/provider/v1beta2/query.ts | 9 +- .../outputosmojs/capability/v1/capability.ts | 7 +- .../outputosmojs/capability/v1/genesis.ts | 5 +- .../v-next/outputosmojs/confio/proofs.ts | 27 +- .../cosmos/app/v1alpha1/config.ts | 5 +- .../cosmos/app/v1alpha1/module.ts | 7 +- .../outputosmojs/cosmos/app/v1alpha1/query.ts | 5 +- .../outputosmojs/cosmos/auth/v1beta1/auth.ts | 7 +- .../cosmos/auth/v1beta1/genesis.ts | 3 +- .../outputosmojs/cosmos/auth/v1beta1/query.ts | 29 +- .../cosmos/authz/v1beta1/authz.ts | 9 +- .../cosmos/authz/v1beta1/genesis.ts | 3 +- .../cosmos/authz/v1beta1/query.ts | 13 +- .../outputosmojs/cosmos/authz/v1beta1/tx.ts | 13 +- .../outputosmojs/cosmos/bank/v1beta1/authz.ts | 3 +- .../outputosmojs/cosmos/bank/v1beta1/bank.ts | 15 +- .../cosmos/bank/v1beta1/genesis.ts | 5 +- .../outputosmojs/cosmos/bank/v1beta1/query.ts | 39 +- .../outputosmojs/cosmos/bank/v1beta1/tx.ts | 9 +- .../cosmos/base/abci/v1beta1/abci.ts | 21 +- .../outputosmojs/cosmos/base/kv/v1beta1/kv.ts | 5 +- .../cosmos/base/node/v1beta1/query.ts | 5 +- .../cosmos/base/query/v1beta1/pagination.ts | 5 +- .../base/reflection/v1beta1/reflection.ts | 9 +- .../base/reflection/v2alpha1/reflection.ts | 53 +-- .../cosmos/base/snapshots/v1beta1/snapshot.ts | 19 +- .../cosmos/base/store/v1beta1/commit_info.ts | 7 +- .../cosmos/base/store/v1beta1/listening.ts | 3 +- .../cosmos/base/tendermint/v1beta1/query.ts | 31 +- .../outputosmojs/cosmos/base/v1beta1/coin.ts | 9 +- .../cosmos/capability/v1beta1/capability.ts | 7 +- .../cosmos/capability/v1beta1/genesis.ts | 5 +- .../cosmos/crisis/v1beta1/genesis.ts | 3 +- .../outputosmojs/cosmos/crisis/v1beta1/tx.ts | 5 +- .../cosmos/crypto/ed25519/keys.ts | 5 +- .../outputosmojs/cosmos/crypto/hd/v1/hd.ts | 3 +- .../cosmos/crypto/keyring/v1/record.ts | 11 +- .../cosmos/crypto/multisig/keys.ts | 3 +- .../crypto/multisig/v1beta1/multisig.ts | 5 +- .../cosmos/crypto/secp256k1/keys.ts | 5 +- .../cosmos/crypto/secp256r1/keys.ts | 5 +- .../distribution/v1beta1/distribution.ts | 25 +- .../cosmos/distribution/v1beta1/genesis.ts | 17 +- .../cosmos/distribution/v1beta1/query.ts | 37 +- .../cosmos/distribution/v1beta1/tx.ts | 17 +- .../cosmos/evidence/v1beta1/evidence.ts | 3 +- .../cosmos/evidence/v1beta1/genesis.ts | 3 +- .../cosmos/evidence/v1beta1/query.ts | 9 +- .../cosmos/evidence/v1beta1/tx.ts | 5 +- .../cosmos/feegrant/v1beta1/feegrant.ts | 9 +- .../cosmos/feegrant/v1beta1/genesis.ts | 3 +- .../cosmos/feegrant/v1beta1/query.ts | 13 +- .../cosmos/feegrant/v1beta1/tx.ts | 9 +- .../cosmos/genutil/v1beta1/genesis.ts | 3 +- .../outputosmojs/cosmos/gov/v1/genesis.ts | 3 +- .../v-next/outputosmojs/cosmos/gov/v1/gov.ts | 17 +- .../outputosmojs/cosmos/gov/v1/query.ts | 33 +- .../v-next/outputosmojs/cosmos/gov/v1/tx.ts | 21 +- .../cosmos/gov/v1beta1/genesis.ts | 3 +- .../outputosmojs/cosmos/gov/v1beta1/gov.ts | 19 +- .../outputosmojs/cosmos/gov/v1beta1/query.ts | 33 +- .../outputosmojs/cosmos/gov/v1beta1/tx.ts | 17 +- .../outputosmojs/cosmos/group/v1/events.ts | 19 +- .../outputosmojs/cosmos/group/v1/genesis.ts | 3 +- .../outputosmojs/cosmos/group/v1/query.ts | 53 +-- .../v-next/outputosmojs/cosmos/group/v1/tx.ts | 57 +-- .../outputosmojs/cosmos/group/v1/types.ts | 23 +- .../outputosmojs/cosmos/ics23/v1/proofs.ts | 27 +- .../cosmos/mint/v1beta1/genesis.ts | 3 +- .../outputosmojs/cosmos/mint/v1beta1/mint.ts | 5 +- .../outputosmojs/cosmos/mint/v1beta1/query.ts | 13 +- .../outputosmojs/cosmos/nft/v1beta1/event.ts | 7 +- .../cosmos/nft/v1beta1/genesis.ts | 5 +- .../outputosmojs/cosmos/nft/v1beta1/nft.ts | 5 +- .../outputosmojs/cosmos/nft/v1beta1/query.ts | 29 +- .../outputosmojs/cosmos/nft/v1beta1/tx.ts | 5 +- .../cosmos/orm/module/v1alpha1/module.ts | 3 +- .../v-next/outputosmojs/cosmos/orm/v1/orm.ts | 9 +- .../cosmos/orm/v1alpha1/schema.ts | 5 +- .../cosmos/params/v1beta1/params.ts | 5 +- .../cosmos/params/v1beta1/query.ts | 11 +- .../cosmos/slashing/v1beta1/genesis.ts | 9 +- .../cosmos/slashing/v1beta1/query.ts | 13 +- .../cosmos/slashing/v1beta1/slashing.ts | 5 +- .../cosmos/slashing/v1beta1/tx.ts | 5 +- .../cosmos/staking/v1beta1/authz.ts | 5 +- .../cosmos/staking/v1beta1/genesis.ts | 5 +- .../cosmos/staking/v1beta1/query.ts | 57 +-- .../cosmos/staking/v1beta1/staking.ts | 41 +- .../outputosmojs/cosmos/staking/v1beta1/tx.ts | 21 +- .../cosmos/tx/signing/v1beta1/signing.ts | 11 +- .../outputosmojs/cosmos/tx/v1beta1/service.ts | 21 +- .../outputosmojs/cosmos/tx/v1beta1/tx.ts | 27 +- .../cosmos/upgrade/v1beta1/query.ts | 21 +- .../outputosmojs/cosmos/upgrade/v1beta1/tx.ts | 9 +- .../cosmos/upgrade/v1beta1/upgrade.ts | 9 +- .../outputosmojs/cosmos/vesting/v1beta1/tx.ts | 13 +- .../cosmos/vesting/v1beta1/vesting.ts | 13 +- .../outputosmojs/cosmos_proto/cosmos.ts | 5 +- .../outputosmojs/cosmwasm/wasm/v1/authz.ts | 19 +- .../outputosmojs/cosmwasm/wasm/v1/genesis.ts | 11 +- .../outputosmojs/cosmwasm/wasm/v1/ibc.ts | 5 +- .../outputosmojs/cosmwasm/wasm/v1/proposal.ts | 19 +- .../outputosmojs/cosmwasm/wasm/v1/query.ts | 39 +- .../outputosmojs/cosmwasm/wasm/v1/tx.ts | 25 +- .../outputosmojs/cosmwasm/wasm/v1/types.ts | 17 +- .../outputosmojs/evmos/claims/v1/claims.ts | 7 +- .../outputosmojs/evmos/claims/v1/genesis.ts | 5 +- .../outputosmojs/evmos/claims/v1/query.ts | 17 +- .../outputosmojs/evmos/epochs/v1/genesis.ts | 5 +- .../outputosmojs/evmos/epochs/v1/query.ts | 9 +- .../outputosmojs/evmos/erc20/v1/erc20.ts | 9 +- .../outputosmojs/evmos/erc20/v1/genesis.ts | 5 +- .../outputosmojs/evmos/erc20/v1/query.ts | 13 +- .../v-next/outputosmojs/evmos/erc20/v1/tx.ts | 9 +- .../v-next/outputosmojs/evmos/fees/v1/fees.ts | 3 +- .../outputosmojs/evmos/fees/v1/genesis.ts | 5 +- .../outputosmojs/evmos/fees/v1/query.ts | 17 +- .../v-next/outputosmojs/evmos/fees/v1/tx.ts | 13 +- .../evmos/incentives/v1/genesis.ts | 5 +- .../evmos/incentives/v1/incentives.ts | 9 +- .../outputosmojs/evmos/incentives/v1/query.ts | 29 +- .../evmos/inflation/v1/genesis.ts | 5 +- .../evmos/inflation/v1/inflation.ts | 5 +- .../outputosmojs/evmos/inflation/v1/query.ts | 25 +- .../outputosmojs/evmos/recovery/v1/genesis.ts | 5 +- .../outputosmojs/evmos/recovery/v1/query.ts | 5 +- .../outputosmojs/evmos/vesting/v1/query.ts | 5 +- .../outputosmojs/evmos/vesting/v1/tx.ts | 9 +- .../outputosmojs/evmos/vesting/v1/vesting.ts | 3 +- .../v-next/outputosmojs/google/api/auth.ts | 13 +- .../v-next/outputosmojs/google/api/backend.ts | 5 +- .../v-next/outputosmojs/google/api/billing.ts | 5 +- .../outputosmojs/google/api/config_change.ts | 5 +- .../outputosmojs/google/api/consumer.ts | 5 +- .../v-next/outputosmojs/google/api/context.ts | 5 +- .../v-next/outputosmojs/google/api/control.ts | 3 +- .../outputosmojs/google/api/distribution.ts | 15 +- .../outputosmojs/google/api/documentation.ts | 7 +- .../outputosmojs/google/api/endpoint.ts | 3 +- .../v1alpha1/conformance_service.ts | 17 +- .../google/api/expr/v1alpha1/checked.ts | 27 +- .../google/api/expr/v1alpha1/eval.ts | 11 +- .../google/api/expr/v1alpha1/explain.ts | 5 +- .../google/api/expr/v1alpha1/syntax.ts | 29 +- .../google/api/expr/v1alpha1/value.ts | 11 +- .../google/api/expr/v1beta1/decl.ts | 9 +- .../google/api/expr/v1beta1/eval.ts | 13 +- .../google/api/expr/v1beta1/expr.ts | 21 +- .../google/api/expr/v1beta1/source.ts | 7 +- .../google/api/expr/v1beta1/value.ts | 11 +- .../v-next/outputosmojs/google/api/http.ts | 7 +- .../outputosmojs/google/api/httpbody.ts | 3 +- .../v-next/outputosmojs/google/api/label.ts | 3 +- .../v-next/outputosmojs/google/api/log.ts | 3 +- .../v-next/outputosmojs/google/api/logging.ts | 5 +- .../v-next/outputosmojs/google/api/metric.ts | 9 +- .../google/api/monitored_resource.ts | 11 +- .../outputosmojs/google/api/monitoring.ts | 5 +- .../v-next/outputosmojs/google/api/quota.ts | 11 +- .../outputosmojs/google/api/resource.ts | 5 +- .../v-next/outputosmojs/google/api/routing.ts | 5 +- .../v-next/outputosmojs/google/api/service.ts | 3 +- .../api/servicecontrol/v1/check_error.ts | 3 +- .../api/servicecontrol/v1/distribution.ts | 9 +- .../api/servicecontrol/v1/http_request.ts | 3 +- .../google/api/servicecontrol/v1/log_entry.ts | 9 +- .../api/servicecontrol/v1/metric_value.ts | 7 +- .../google/api/servicecontrol/v1/operation.ts | 5 +- .../api/servicecontrol/v1/quota_controller.ts | 11 +- .../servicecontrol/v1/service_controller.ts | 15 +- .../servicecontrol/v2/service_controller.ts | 13 +- .../api/servicemanagement/v1/resources.ts | 25 +- .../servicemanagement/v1/servicemanager.ts | 39 +- .../google/api/serviceusage/v1/resources.ts | 7 +- .../api/serviceusage/v1/serviceusage.ts | 25 +- .../api/serviceusage/v1beta1/resources.ts | 27 +- .../api/serviceusage/v1beta1/serviceusage.ts | 73 ++-- .../outputosmojs/google/api/source_info.ts | 3 +- .../google/api/system_parameter.ts | 7 +- .../v-next/outputosmojs/google/api/usage.ts | 5 +- .../outputosmojs/google/api/visibility.ts | 5 +- .../google/logging/type/http_request.ts | 3 +- .../google/logging/v2/log_entry.ts | 11 +- .../outputosmojs/google/logging/v2/logging.ts | 31 +- .../google/logging/v2/logging_config.ts | 79 ++-- .../google/logging/v2/logging_metrics.ts | 17 +- .../google/longrunning/operations.ts | 17 +- .../outputosmojs/google/protobuf/any.ts | 3 +- .../outputosmojs/google/protobuf/api.ts | 7 +- .../google/protobuf/compiler/plugin.ts | 9 +- .../google/protobuf/descriptor.ts | 55 +-- .../outputosmojs/google/protobuf/duration.ts | 3 +- .../outputosmojs/google/protobuf/empty.ts | 3 +- .../google/protobuf/field_mask.ts | 3 +- .../google/protobuf/source_context.ts | 3 +- .../outputosmojs/google/protobuf/struct.ts | 9 +- .../outputosmojs/google/protobuf/timestamp.ts | 3 +- .../outputosmojs/google/protobuf/type.ts | 11 +- .../outputosmojs/google/protobuf/wrappers.ts | 19 +- .../google/rpc/context/attribute_context.ts | 25 +- .../outputosmojs/google/rpc/error_details.ts | 31 +- .../v-next/outputosmojs/google/rpc/status.ts | 3 +- .../ibc/applications/fee/v1/ack.ts | 3 +- .../ibc/applications/fee/v1/fee.ts | 9 +- .../ibc/applications/fee/v1/genesis.ts | 11 +- .../ibc/applications/fee/v1/metadata.ts | 3 +- .../ibc/applications/fee/v1/query.ts | 41 +- .../ibc/applications/fee/v1/tx.ts | 17 +- .../controller/v1/controller.ts | 3 +- .../controller/v1/query.ts | 9 +- .../interchain_accounts/controller/v1/tx.ts | 9 +- .../interchain_accounts/genesis/v1/genesis.ts | 11 +- .../interchain_accounts/host/v1/host.ts | 3 +- .../interchain_accounts/host/v1/query.ts | 5 +- .../interchain_accounts/v1/account.ts | 3 +- .../interchain_accounts/v1/metadata.ts | 3 +- .../interchain_accounts/v1/packet.ts | 5 +- .../ibc/applications/transfer/v1/authz.ts | 5 +- .../ibc/applications/transfer/v1/genesis.ts | 3 +- .../ibc/applications/transfer/v1/query.ts | 13 +- .../ibc/applications/transfer/v1/transfer.ts | 5 +- .../ibc/applications/transfer/v1/tx.ts | 5 +- .../ibc/applications/transfer/v2/packet.ts | 3 +- .../ibc/core/channel/v1/channel.ts | 13 +- .../ibc/core/channel/v1/genesis.ts | 5 +- .../outputosmojs/ibc/core/channel/v1/query.ts | 53 +-- .../outputosmojs/ibc/core/channel/v1/tx.ts | 41 +- .../outputosmojs/ibc/core/client/v1/client.ts | 15 +- .../ibc/core/client/v1/genesis.ts | 7 +- .../outputosmojs/ibc/core/client/v1/query.ts | 33 +- .../outputosmojs/ibc/core/client/v1/tx.ts | 17 +- .../ibc/core/commitment/v1/commitment.ts | 9 +- .../ibc/core/connection/v1/connection.ts | 15 +- .../ibc/core/connection/v1/genesis.ts | 3 +- .../ibc/core/connection/v1/query.ts | 21 +- .../outputosmojs/ibc/core/connection/v1/tx.ts | 17 +- .../outputosmojs/ibc/core/port/v1/query.ts | 5 +- .../outputosmojs/ibc/core/types/v1/genesis.ts | 3 +- .../lightclients/localhost/v1/localhost.ts | 3 +- .../lightclients/localhost/v2/localhost.ts | 3 +- .../solomachine/v1/solomachine.ts | 33 +- .../solomachine/v2/solomachine.ts | 33 +- .../solomachine/v3/solomachine.ts | 17 +- .../lightclients/tendermint/v1/tendermint.ts | 11 +- __fixtures__/v-next/outputosmojs/index.ts | 1 + __fixtures__/v-next/outputosmojs/json-safe.ts | 10 + .../osmosis/accum/v1beta1/accum.ts | 7 +- .../osmosis/claim/v1beta1/claim.ts | 3 +- .../osmosis/claim/v1beta1/genesis.ts | 3 +- .../osmosis/claim/v1beta1/params.ts | 3 +- .../osmosis/claim/v1beta1/query.ts | 21 +- .../osmosis/concentrated-liquidity/genesis.ts | 9 +- .../incentive_record.ts | 5 +- .../osmosis/concentrated-liquidity/params.ts | 3 +- .../pool-model/query.ts | 33 +- .../concentrated-liquidity/pool-model/tx.ts | 5 +- .../osmosis/concentrated-liquidity/pool.ts | 3 +- .../concentrated-liquidity/position.ts | 5 +- .../concentrated-liquidity/tickInfo.ts | 5 +- .../osmosis/concentrated-liquidity/tx.ts | 25 +- .../osmosis/cosmwasmpool/v1beta1/genesis.ts | 5 +- .../cosmwasmpool/v1beta1/model/pool.ts | 3 +- .../osmosis/cosmwasmpool/v1beta1/model/tx.ts | 5 +- .../osmosis/cosmwasmpool/v1beta1/query.ts | 5 +- .../downtime-detector/v1beta1/genesis.ts | 5 +- .../downtime-detector/v1beta1/query.ts | 5 +- .../outputosmojs/osmosis/epochs/genesis.ts | 5 +- .../outputosmojs/osmosis/epochs/query.ts | 9 +- .../gamm/pool-models/balancer/balancerPool.ts | 9 +- .../gamm/pool-models/balancer/tx/tx.ts | 5 +- .../pool-models/stableswap/stableswap_pool.ts | 5 +- .../osmosis/gamm/pool-models/stableswap/tx.ts | 9 +- .../osmosis/gamm/v1beta1/genesis.ts | 5 +- .../outputosmojs/osmosis/gamm/v1beta1/gov.ts | 5 +- .../osmosis/gamm/v1beta1/query.ts | 61 +-- .../outputosmojs/osmosis/gamm/v1beta1/tx.ts | 37 +- .../outputosmojs/osmosis/gamm/v2/query.ts | 5 +- .../osmosis/ibc-rate-limit/v1beta1/genesis.ts | 3 +- .../osmosis/ibc-rate-limit/v1beta1/params.ts | 3 +- .../osmosis/ibc-rate-limit/v1beta1/query.ts | 5 +- .../outputosmojs/osmosis/incentives/gauge.ts | 5 +- .../osmosis/incentives/genesis.ts | 3 +- .../outputosmojs/osmosis/incentives/params.ts | 3 +- .../outputosmojs/osmosis/incentives/query.ts | 37 +- .../outputosmojs/osmosis/incentives/tx.ts | 9 +- .../outputosmojs/osmosis/lockup/genesis.ts | 3 +- .../outputosmojs/osmosis/lockup/lock.ts | 7 +- .../outputosmojs/osmosis/lockup/params.ts | 3 +- .../outputosmojs/osmosis/lockup/query.ts | 69 ++-- .../v-next/outputosmojs/osmosis/lockup/tx.ts | 21 +- .../osmosis/mint/v1beta1/genesis.ts | 3 +- .../outputosmojs/osmosis/mint/v1beta1/mint.ts | 9 +- .../osmosis/mint/v1beta1/query.ts | 9 +- .../pool-incentives/v1beta1/genesis.ts | 3 +- .../osmosis/pool-incentives/v1beta1/gov.ts | 5 +- .../pool-incentives/v1beta1/incentives.ts | 13 +- .../osmosis/pool-incentives/v1beta1/query.ts | 29 +- .../osmosis/poolmanager/v1beta1/genesis.ts | 5 +- .../poolmanager/v1beta1/module_route.ts | 3 +- .../osmosis/poolmanager/v1beta1/query.ts | 33 +- .../osmosis/poolmanager/v1beta1/swap_route.ts | 5 +- .../osmosis/poolmanager/v1beta1/tx.ts | 9 +- .../osmosis/protorev/v1beta1/genesis.ts | 3 +- .../osmosis/protorev/v1beta1/gov.ts | 5 +- .../osmosis/protorev/v1beta1/params.ts | 3 +- .../osmosis/protorev/v1beta1/protorev.ts | 13 +- .../osmosis/protorev/v1beta1/query.ts | 57 +-- .../osmosis/protorev/v1beta1/tx.ts | 25 +- .../osmosis/sumtree/v1beta1/tree.ts | 7 +- .../osmosis/superfluid/genesis.ts | 3 +- .../outputosmojs/osmosis/superfluid/params.ts | 3 +- .../outputosmojs/osmosis/superfluid/query.ts | 65 +-- .../osmosis/superfluid/superfluid.ts | 13 +- .../outputosmojs/osmosis/superfluid/tx.ts | 21 +- .../osmosis/superfluid/v1beta1/gov.ts | 7 +- .../tokenfactory/v1beta1/authorityMetadata.ts | 3 +- .../osmosis/tokenfactory/v1beta1/genesis.ts | 5 +- .../osmosis/tokenfactory/v1beta1/params.ts | 3 +- .../osmosis/tokenfactory/v1beta1/query.ts | 13 +- .../osmosis/tokenfactory/v1beta1/tx.ts | 21 +- .../osmosis/twap/v1beta1/genesis.ts | 5 +- .../osmosis/twap/v1beta1/query.ts | 13 +- .../osmosis/twap/v1beta1/twap_record.ts | 3 +- .../osmosis/txfees/v1beta1/feetoken.ts | 3 +- .../osmosis/txfees/v1beta1/genesis.ts | 3 +- .../osmosis/txfees/v1beta1/gov.ts | 3 +- .../osmosis/txfees/v1beta1/query.ts | 17 +- .../osmosis/valset-pref/v1beta1/query.ts | 5 +- .../osmosis/valset-pref/v1beta1/state.ts | 5 +- .../osmosis/valset-pref/v1beta1/tx.ts | 25 +- .../outputosmojs/tendermint/abci/types.ts | 89 +++-- .../outputosmojs/tendermint/crypto/keys.ts | 3 +- .../outputosmojs/tendermint/crypto/proof.ts | 11 +- .../tendermint/libs/bits/types.ts | 3 +- .../outputosmojs/tendermint/p2p/types.ts | 11 +- .../outputosmojs/tendermint/types/block.ts | 3 +- .../outputosmojs/tendermint/types/evidence.ts | 9 +- .../outputosmojs/tendermint/types/params.ts | 13 +- .../outputosmojs/tendermint/types/types.ts | 27 +- .../tendermint/types/validator.ts | 7 +- .../outputosmojs/tendermint/version/types.ts | 5 +- .../outputv2/akash/audit/v1beta1/audit.ts | 17 +- .../outputv2/akash/audit/v1beta2/audit.ts | 17 +- .../outputv2/akash/audit/v1beta2/genesis.ts | 3 +- .../outputv2/akash/audit/v1beta2/query.ts | 13 +- .../outputv2/akash/base/v1beta1/attribute.ts | 7 +- .../outputv2/akash/base/v1beta1/endpoint.ts | 3 +- .../outputv2/akash/base/v1beta1/resource.ts | 9 +- .../akash/base/v1beta1/resourcevalue.ts | 3 +- .../outputv2/akash/base/v1beta2/attribute.ts | 7 +- .../outputv2/akash/base/v1beta2/endpoint.ts | 3 +- .../outputv2/akash/base/v1beta2/resource.ts | 7 +- .../akash/base/v1beta2/resourceunits.ts | 3 +- .../akash/base/v1beta2/resourcevalue.ts | 3 +- .../outputv2/akash/cert/v1beta2/cert.ts | 15 +- .../outputv2/akash/cert/v1beta2/genesis.ts | 5 +- .../outputv2/akash/cert/v1beta2/query.ts | 7 +- .../akash/deployment/v1beta1/authz.ts | 3 +- .../akash/deployment/v1beta1/deployment.ts | 23 +- .../akash/deployment/v1beta1/genesis.ts | 5 +- .../akash/deployment/v1beta1/group.ts | 21 +- .../akash/deployment/v1beta1/params.ts | 3 +- .../akash/deployment/v1beta1/query.ts | 13 +- .../akash/deployment/v1beta2/authz.ts | 3 +- .../akash/deployment/v1beta2/deployment.ts | 7 +- .../akash/deployment/v1beta2/deploymentmsg.ts | 17 +- .../akash/deployment/v1beta2/genesis.ts | 5 +- .../akash/deployment/v1beta2/group.ts | 3 +- .../akash/deployment/v1beta2/groupid.ts | 3 +- .../akash/deployment/v1beta2/groupmsg.ts | 13 +- .../akash/deployment/v1beta2/groupspec.ts | 3 +- .../akash/deployment/v1beta2/params.ts | 3 +- .../akash/deployment/v1beta2/query.ts | 13 +- .../akash/deployment/v1beta2/resource.ts | 3 +- .../outputv2/akash/escrow/v1beta1/genesis.ts | 3 +- .../outputv2/akash/escrow/v1beta1/query.ts | 9 +- .../outputv2/akash/escrow/v1beta1/types.ts | 7 +- .../outputv2/akash/escrow/v1beta2/genesis.ts | 3 +- .../outputv2/akash/escrow/v1beta2/query.ts | 9 +- .../outputv2/akash/escrow/v1beta2/types.ts | 7 +- .../akash/inflation/v1beta2/genesis.ts | 3 +- .../akash/inflation/v1beta2/params.ts | 3 +- .../outputv2/akash/market/v1beta2/bid.ts | 15 +- .../outputv2/akash/market/v1beta2/genesis.ts | 3 +- .../outputv2/akash/market/v1beta2/lease.ts | 19 +- .../outputv2/akash/market/v1beta2/order.ts | 7 +- .../outputv2/akash/market/v1beta2/params.ts | 3 +- .../outputv2/akash/market/v1beta2/query.ts | 25 +- .../akash/provider/v1beta1/provider.ts | 17 +- .../akash/provider/v1beta2/genesis.ts | 3 +- .../akash/provider/v1beta2/provider.ts | 17 +- .../outputv2/akash/provider/v1beta2/query.ts | 9 +- __fixtures__/v-next/outputv2/confio/proofs.ts | 27 +- .../outputv2/cosmos/app/v1alpha1/config.ts | 5 +- .../outputv2/cosmos/app/v1alpha1/module.ts | 7 +- .../outputv2/cosmos/app/v1alpha1/query.ts | 5 +- .../outputv2/cosmos/auth/v1beta1/auth.ts | 7 +- .../outputv2/cosmos/auth/v1beta1/genesis.ts | 3 +- .../outputv2/cosmos/auth/v1beta1/query.ts | 29 +- .../outputv2/cosmos/authz/v1beta1/authz.ts | 9 +- .../outputv2/cosmos/authz/v1beta1/genesis.ts | 3 +- .../outputv2/cosmos/authz/v1beta1/query.ts | 13 +- .../outputv2/cosmos/authz/v1beta1/tx.ts | 13 +- .../outputv2/cosmos/bank/v1beta1/authz.ts | 3 +- .../outputv2/cosmos/bank/v1beta1/bank.ts | 15 +- .../outputv2/cosmos/bank/v1beta1/genesis.ts | 5 +- .../outputv2/cosmos/bank/v1beta1/query.ts | 39 +- .../v-next/outputv2/cosmos/bank/v1beta1/tx.ts | 9 +- .../outputv2/cosmos/base/abci/v1beta1/abci.ts | 21 +- .../outputv2/cosmos/base/kv/v1beta1/kv.ts | 5 +- .../cosmos/base/query/v1beta1/pagination.ts | 5 +- .../base/reflection/v1beta1/reflection.ts | 9 +- .../base/reflection/v2alpha1/reflection.ts | 53 +-- .../cosmos/base/snapshots/v1beta1/snapshot.ts | 19 +- .../cosmos/base/store/v1beta1/commit_info.ts | 7 +- .../cosmos/base/store/v1beta1/listening.ts | 3 +- .../cosmos/base/tendermint/v1beta1/query.ts | 31 +- .../outputv2/cosmos/base/v1beta1/coin.ts | 9 +- .../cosmos/capability/v1beta1/capability.ts | 7 +- .../cosmos/capability/v1beta1/genesis.ts | 5 +- .../outputv2/cosmos/crisis/v1beta1/genesis.ts | 3 +- .../outputv2/cosmos/crisis/v1beta1/tx.ts | 5 +- .../outputv2/cosmos/crypto/ed25519/keys.ts | 5 +- .../v-next/outputv2/cosmos/crypto/hd/v1/hd.ts | 3 +- .../cosmos/crypto/keyring/v1/record.ts | 11 +- .../outputv2/cosmos/crypto/multisig/keys.ts | 3 +- .../crypto/multisig/v1beta1/multisig.ts | 5 +- .../outputv2/cosmos/crypto/secp256k1/keys.ts | 5 +- .../outputv2/cosmos/crypto/secp256r1/keys.ts | 5 +- .../distribution/v1beta1/distribution.ts | 25 +- .../cosmos/distribution/v1beta1/genesis.ts | 17 +- .../cosmos/distribution/v1beta1/query.ts | 37 +- .../cosmos/distribution/v1beta1/tx.ts | 17 +- .../cosmos/evidence/v1beta1/evidence.ts | 3 +- .../cosmos/evidence/v1beta1/genesis.ts | 3 +- .../outputv2/cosmos/evidence/v1beta1/query.ts | 9 +- .../outputv2/cosmos/evidence/v1beta1/tx.ts | 5 +- .../cosmos/feegrant/v1beta1/feegrant.ts | 9 +- .../cosmos/feegrant/v1beta1/genesis.ts | 3 +- .../outputv2/cosmos/feegrant/v1beta1/query.ts | 13 +- .../outputv2/cosmos/feegrant/v1beta1/tx.ts | 9 +- .../cosmos/genutil/v1beta1/genesis.ts | 3 +- .../v-next/outputv2/cosmos/gov/v1/genesis.ts | 3 +- .../v-next/outputv2/cosmos/gov/v1/gov.ts | 17 +- .../v-next/outputv2/cosmos/gov/v1/query.ts | 33 +- .../v-next/outputv2/cosmos/gov/v1/tx.ts | 21 +- .../outputv2/cosmos/gov/v1beta1/genesis.ts | 3 +- .../v-next/outputv2/cosmos/gov/v1beta1/gov.ts | 19 +- .../outputv2/cosmos/gov/v1beta1/query.ts | 33 +- .../v-next/outputv2/cosmos/gov/v1beta1/tx.ts | 17 +- .../v-next/outputv2/cosmos/group/v1/events.ts | 19 +- .../outputv2/cosmos/group/v1/genesis.ts | 3 +- .../v-next/outputv2/cosmos/group/v1/query.ts | 53 +-- .../v-next/outputv2/cosmos/group/v1/tx.ts | 57 +-- .../v-next/outputv2/cosmos/group/v1/types.ts | 23 +- .../outputv2/cosmos/mint/v1beta1/genesis.ts | 3 +- .../outputv2/cosmos/mint/v1beta1/mint.ts | 5 +- .../outputv2/cosmos/mint/v1beta1/query.ts | 13 +- .../outputv2/cosmos/nft/v1beta1/event.ts | 7 +- .../outputv2/cosmos/nft/v1beta1/genesis.ts | 5 +- .../v-next/outputv2/cosmos/nft/v1beta1/nft.ts | 5 +- .../outputv2/cosmos/nft/v1beta1/query.ts | 29 +- .../v-next/outputv2/cosmos/nft/v1beta1/tx.ts | 5 +- .../cosmos/orm/module/v1alpha1/module.ts | 3 +- .../v-next/outputv2/cosmos/orm/v1/orm.ts | 9 +- .../outputv2/cosmos/orm/v1alpha1/schema.ts | 5 +- .../outputv2/cosmos/params/v1beta1/params.ts | 5 +- .../outputv2/cosmos/params/v1beta1/query.ts | 11 +- .../cosmos/slashing/v1beta1/genesis.ts | 9 +- .../outputv2/cosmos/slashing/v1beta1/query.ts | 13 +- .../cosmos/slashing/v1beta1/slashing.ts | 5 +- .../outputv2/cosmos/slashing/v1beta1/tx.ts | 5 +- .../outputv2/cosmos/staking/v1beta1/authz.ts | 5 +- .../cosmos/staking/v1beta1/genesis.ts | 5 +- .../outputv2/cosmos/staking/v1beta1/query.ts | 57 +-- .../cosmos/staking/v1beta1/staking.ts | 41 +- .../outputv2/cosmos/staking/v1beta1/tx.ts | 21 +- .../cosmos/tx/signing/v1beta1/signing.ts | 11 +- .../outputv2/cosmos/tx/v1beta1/service.ts | 21 +- .../v-next/outputv2/cosmos/tx/v1beta1/tx.ts | 27 +- .../outputv2/cosmos/upgrade/v1beta1/query.ts | 21 +- .../outputv2/cosmos/upgrade/v1beta1/tx.ts | 9 +- .../cosmos/upgrade/v1beta1/upgrade.ts | 9 +- .../outputv2/cosmos/vesting/v1beta1/tx.ts | 13 +- .../cosmos/vesting/v1beta1/vesting.ts | 13 +- .../v-next/outputv2/cosmos_proto/cosmos.ts | 5 +- .../outputv2/cosmwasm/wasm/v1/genesis.ts | 11 +- .../v-next/outputv2/cosmwasm/wasm/v1/ibc.ts | 5 +- .../outputv2/cosmwasm/wasm/v1/proposal.ts | 19 +- .../v-next/outputv2/cosmwasm/wasm/v1/query.ts | 39 +- .../v-next/outputv2/cosmwasm/wasm/v1/tx.ts | 25 +- .../v-next/outputv2/cosmwasm/wasm/v1/types.ts | 17 +- .../v-next/outputv2/evmos/claims/v1/claims.ts | 7 +- .../outputv2/evmos/claims/v1/genesis.ts | 5 +- .../v-next/outputv2/evmos/claims/v1/query.ts | 17 +- .../outputv2/evmos/epochs/v1/genesis.ts | 5 +- .../v-next/outputv2/evmos/epochs/v1/query.ts | 9 +- .../v-next/outputv2/evmos/erc20/v1/erc20.ts | 9 +- .../v-next/outputv2/evmos/erc20/v1/genesis.ts | 5 +- .../v-next/outputv2/evmos/erc20/v1/query.ts | 13 +- .../v-next/outputv2/evmos/erc20/v1/tx.ts | 9 +- .../v-next/outputv2/evmos/fees/v1/fees.ts | 3 +- .../v-next/outputv2/evmos/fees/v1/genesis.ts | 5 +- .../v-next/outputv2/evmos/fees/v1/query.ts | 17 +- .../v-next/outputv2/evmos/fees/v1/tx.ts | 13 +- .../outputv2/evmos/incentives/v1/genesis.ts | 5 +- .../evmos/incentives/v1/incentives.ts | 9 +- .../outputv2/evmos/incentives/v1/query.ts | 29 +- .../outputv2/evmos/inflation/v1/genesis.ts | 5 +- .../outputv2/evmos/inflation/v1/inflation.ts | 5 +- .../outputv2/evmos/inflation/v1/query.ts | 25 +- .../outputv2/evmos/recovery/v1/genesis.ts | 5 +- .../outputv2/evmos/recovery/v1/query.ts | 5 +- .../v-next/outputv2/evmos/vesting/v1/query.ts | 5 +- .../v-next/outputv2/evmos/vesting/v1/tx.ts | 9 +- .../outputv2/evmos/vesting/v1/vesting.ts | 3 +- .../v-next/outputv2/google/api/auth.ts | 13 +- .../v-next/outputv2/google/api/backend.ts | 5 +- .../v-next/outputv2/google/api/billing.ts | 5 +- .../outputv2/google/api/config_change.ts | 5 +- .../v-next/outputv2/google/api/consumer.ts | 5 +- .../v-next/outputv2/google/api/context.ts | 5 +- .../v-next/outputv2/google/api/control.ts | 3 +- .../outputv2/google/api/distribution.ts | 15 +- .../outputv2/google/api/documentation.ts | 7 +- .../v-next/outputv2/google/api/endpoint.ts | 3 +- .../v1alpha1/conformance_service.ts | 17 +- .../google/api/expr/v1alpha1/checked.ts | 27 +- .../outputv2/google/api/expr/v1alpha1/eval.ts | 11 +- .../google/api/expr/v1alpha1/explain.ts | 5 +- .../google/api/expr/v1alpha1/syntax.ts | 29 +- .../google/api/expr/v1alpha1/value.ts | 11 +- .../outputv2/google/api/expr/v1beta1/decl.ts | 9 +- .../outputv2/google/api/expr/v1beta1/eval.ts | 13 +- .../outputv2/google/api/expr/v1beta1/expr.ts | 21 +- .../google/api/expr/v1beta1/source.ts | 7 +- .../outputv2/google/api/expr/v1beta1/value.ts | 11 +- .../v-next/outputv2/google/api/http.ts | 7 +- .../v-next/outputv2/google/api/httpbody.ts | 3 +- .../v-next/outputv2/google/api/label.ts | 3 +- .../v-next/outputv2/google/api/log.ts | 3 +- .../v-next/outputv2/google/api/logging.ts | 5 +- .../v-next/outputv2/google/api/metric.ts | 9 +- .../outputv2/google/api/monitored_resource.ts | 11 +- .../v-next/outputv2/google/api/monitoring.ts | 5 +- .../v-next/outputv2/google/api/quota.ts | 11 +- .../v-next/outputv2/google/api/resource.ts | 5 +- .../v-next/outputv2/google/api/routing.ts | 5 +- .../v-next/outputv2/google/api/service.ts | 3 +- .../api/servicecontrol/v1/check_error.ts | 3 +- .../api/servicecontrol/v1/distribution.ts | 9 +- .../api/servicecontrol/v1/http_request.ts | 3 +- .../google/api/servicecontrol/v1/log_entry.ts | 9 +- .../api/servicecontrol/v1/metric_value.ts | 7 +- .../google/api/servicecontrol/v1/operation.ts | 5 +- .../api/servicecontrol/v1/quota_controller.ts | 11 +- .../servicecontrol/v1/service_controller.ts | 15 +- .../servicecontrol/v2/service_controller.ts | 13 +- .../api/servicemanagement/v1/resources.ts | 25 +- .../servicemanagement/v1/servicemanager.ts | 39 +- .../google/api/serviceusage/v1/resources.ts | 7 +- .../api/serviceusage/v1/serviceusage.ts | 25 +- .../api/serviceusage/v1beta1/resources.ts | 27 +- .../api/serviceusage/v1beta1/serviceusage.ts | 73 ++-- .../v-next/outputv2/google/api/source_info.ts | 3 +- .../outputv2/google/api/system_parameter.ts | 7 +- .../v-next/outputv2/google/api/usage.ts | 5 +- .../v-next/outputv2/google/api/visibility.ts | 5 +- .../google/logging/type/http_request.ts | 3 +- .../outputv2/google/logging/v2/log_entry.ts | 11 +- .../outputv2/google/logging/v2/logging.ts | 31 +- .../google/logging/v2/logging_config.ts | 79 ++-- .../google/logging/v2/logging_metrics.ts | 17 +- .../outputv2/google/longrunning/operations.ts | 17 +- .../v-next/outputv2/google/protobuf/any.ts | 3 +- .../v-next/outputv2/google/protobuf/api.ts | 7 +- .../google/protobuf/compiler/plugin.ts | 9 +- .../outputv2/google/protobuf/descriptor.ts | 55 +-- .../outputv2/google/protobuf/duration.ts | 3 +- .../v-next/outputv2/google/protobuf/empty.ts | 3 +- .../outputv2/google/protobuf/field_mask.ts | 3 +- .../google/protobuf/source_context.ts | 3 +- .../v-next/outputv2/google/protobuf/struct.ts | 9 +- .../outputv2/google/protobuf/timestamp.ts | 3 +- .../v-next/outputv2/google/protobuf/type.ts | 11 +- .../outputv2/google/protobuf/wrappers.ts | 19 +- .../google/rpc/context/attribute_context.ts | 25 +- .../outputv2/google/rpc/error_details.ts | 31 +- .../v-next/outputv2/google/rpc/status.ts | 3 +- .../ibc/applications/transfer/v1/genesis.ts | 3 +- .../ibc/applications/transfer/v1/query.ts | 13 +- .../ibc/applications/transfer/v1/transfer.ts | 5 +- .../ibc/applications/transfer/v1/tx.ts | 5 +- .../ibc/applications/transfer/v2/packet.ts | 3 +- .../outputv2/ibc/core/channel/v1/channel.ts | 13 +- .../outputv2/ibc/core/channel/v1/genesis.ts | 5 +- .../outputv2/ibc/core/channel/v1/query.ts | 53 +-- .../v-next/outputv2/ibc/core/channel/v1/tx.ts | 41 +- .../outputv2/ibc/core/client/v1/client.ts | 15 +- .../outputv2/ibc/core/client/v1/genesis.ts | 7 +- .../outputv2/ibc/core/client/v1/query.ts | 33 +- .../v-next/outputv2/ibc/core/client/v1/tx.ts | 17 +- .../ibc/core/commitment/v1/commitment.ts | 9 +- .../ibc/core/connection/v1/connection.ts | 15 +- .../ibc/core/connection/v1/genesis.ts | 3 +- .../outputv2/ibc/core/connection/v1/query.ts | 21 +- .../outputv2/ibc/core/connection/v1/tx.ts | 17 +- .../v-next/outputv2/ibc/core/port/v1/query.ts | 5 +- .../outputv2/ibc/core/types/v1/genesis.ts | 3 +- .../lightclients/localhost/v1/localhost.ts | 3 +- .../solomachine/v1/solomachine.ts | 33 +- .../solomachine/v2/solomachine.ts | 33 +- .../lightclients/tendermint/v1/tendermint.ts | 11 +- __fixtures__/v-next/outputv2/index.ts | 1 + __fixtures__/v-next/outputv2/json-safe.ts | 10 + .../outputv2/osmosis/claim/v1beta1/claim.ts | 3 +- .../outputv2/osmosis/claim/v1beta1/genesis.ts | 3 +- .../outputv2/osmosis/claim/v1beta1/params.ts | 3 +- .../outputv2/osmosis/claim/v1beta1/query.ts | 21 +- .../v-next/outputv2/osmosis/epochs/genesis.ts | 5 +- .../v-next/outputv2/osmosis/epochs/query.ts | 9 +- .../gamm/pool-models/balancer/balancerPool.ts | 9 +- .../gamm/pool-models/balancer/tx/tx.ts | 5 +- .../pool-models/stableswap/stableswap_pool.ts | 5 +- .../osmosis/gamm/pool-models/stableswap/tx.ts | 9 +- .../outputv2/osmosis/gamm/v1beta1/genesis.ts | 5 +- .../outputv2/osmosis/gamm/v1beta1/query.ts | 61 +-- .../outputv2/osmosis/gamm/v1beta1/tx.ts | 37 +- .../v-next/outputv2/osmosis/gamm/v2/query.ts | 5 +- .../osmosis/ibc-rate-limit/v1beta1/params.ts | 3 +- .../osmosis/ibc-rate-limit/v1beta1/query.ts | 5 +- .../outputv2/osmosis/incentives/gauge.ts | 5 +- .../outputv2/osmosis/incentives/genesis.ts | 3 +- .../outputv2/osmosis/incentives/params.ts | 3 +- .../outputv2/osmosis/incentives/query.ts | 37 +- .../v-next/outputv2/osmosis/incentives/tx.ts | 9 +- .../v-next/outputv2/osmosis/lockup/genesis.ts | 3 +- .../v-next/outputv2/osmosis/lockup/lock.ts | 7 +- .../v-next/outputv2/osmosis/lockup/params.ts | 3 +- .../v-next/outputv2/osmosis/lockup/query.ts | 69 ++-- .../v-next/outputv2/osmosis/lockup/tx.ts | 21 +- .../outputv2/osmosis/mint/v1beta1/genesis.ts | 3 +- .../outputv2/osmosis/mint/v1beta1/mint.ts | 9 +- .../outputv2/osmosis/mint/v1beta1/query.ts | 9 +- .../pool-incentives/v1beta1/genesis.ts | 3 +- .../osmosis/pool-incentives/v1beta1/gov.ts | 5 +- .../pool-incentives/v1beta1/incentives.ts | 13 +- .../osmosis/pool-incentives/v1beta1/query.ts | 29 +- .../outputv2/osmosis/sumtree/v1beta1/tree.ts | 7 +- .../outputv2/osmosis/superfluid/genesis.ts | 3 +- .../outputv2/osmosis/superfluid/params.ts | 3 +- .../outputv2/osmosis/superfluid/query.ts | 65 +-- .../outputv2/osmosis/superfluid/superfluid.ts | 13 +- .../v-next/outputv2/osmosis/superfluid/tx.ts | 21 +- .../tokenfactory/v1beta1/authorityMetadata.ts | 3 +- .../osmosis/tokenfactory/v1beta1/genesis.ts | 5 +- .../osmosis/tokenfactory/v1beta1/params.ts | 3 +- .../osmosis/tokenfactory/v1beta1/query.ts | 13 +- .../osmosis/tokenfactory/v1beta1/tx.ts | 21 +- .../outputv2/osmosis/twap/v1beta1/genesis.ts | 5 +- .../outputv2/osmosis/twap/v1beta1/query.ts | 13 +- .../osmosis/twap/v1beta1/twap_record.ts | 3 +- .../osmosis/txfees/v1beta1/feetoken.ts | 3 +- .../osmosis/txfees/v1beta1/genesis.ts | 3 +- .../outputv2/osmosis/txfees/v1beta1/gov.ts | 3 +- .../outputv2/osmosis/txfees/v1beta1/query.ts | 17 +- .../v-next/outputv2/tendermint/abci/types.ts | 89 +++-- .../v-next/outputv2/tendermint/crypto/keys.ts | 3 +- .../outputv2/tendermint/crypto/proof.ts | 11 +- .../outputv2/tendermint/libs/bits/types.ts | 3 +- .../v-next/outputv2/tendermint/p2p/types.ts | 11 +- .../v-next/outputv2/tendermint/types/block.ts | 3 +- .../outputv2/tendermint/types/evidence.ts | 9 +- .../outputv2/tendermint/types/params.ts | 13 +- .../v-next/outputv2/tendermint/types/types.ts | 27 +- .../outputv2/tendermint/types/validator.ts | 7 +- .../outputv2/tendermint/version/types.ts | 5 +- .../akash/audit/v1beta1/audit.registry.ts | 14 - .../outputv3/akash/audit/v1beta1/audit.ts | 76 ---- .../akash/audit/v1beta2/audit.registry.ts | 14 - .../outputv3/akash/audit/v1beta2/audit.ts | 76 ---- .../outputv3/akash/audit/v1beta2/genesis.ts | 10 - .../outputv3/akash/audit/v1beta2/query.ts | 40 -- .../outputv3/akash/base/v1beta1/attribute.ts | 31 -- .../outputv3/akash/base/v1beta1/endpoint.ts | 6 - .../outputv3/akash/base/v1beta1/resource.ts | 43 -- .../akash/base/v1beta1/resourcevalue.ts | 8 +- .../outputv3/akash/base/v1beta2/attribute.ts | 31 -- .../outputv3/akash/base/v1beta2/endpoint.ts | 7 - .../outputv3/akash/base/v1beta2/resource.ts | 32 -- .../akash/base/v1beta2/resourceunits.ts | 17 - .../akash/base/v1beta2/resourcevalue.ts | 8 +- .../akash/cert/v1beta2/cert.registry.ts | 14 - .../outputv3/akash/cert/v1beta2/cert.ts | 41 -- .../outputv3/akash/cert/v1beta2/genesis.ts | 16 - .../outputv3/akash/cert/v1beta2/query.ts | 23 -- .../akash/deployment/v1beta1/authz.ts | 6 - .../deployment/v1beta1/deployment.registry.ts | 44 -- .../akash/deployment/v1beta1/deployment.ts | 74 +--- .../akash/deployment/v1beta1/genesis.ts | 21 - .../akash/deployment/v1beta1/group.ts | 61 --- .../akash/deployment/v1beta1/params.ts | 6 - .../akash/deployment/v1beta1/query.ts | 43 -- .../akash/deployment/v1beta2/authz.ts | 6 - .../akash/deployment/v1beta2/deployment.ts | 22 - .../akash/deployment/v1beta2/deploymentmsg.ts | 50 +-- .../akash/deployment/v1beta2/genesis.ts | 21 - .../akash/deployment/v1beta2/group.ts | 9 - .../akash/deployment/v1beta2/groupid.ts | 8 - .../akash/deployment/v1beta2/groupmsg.ts | 28 -- .../akash/deployment/v1beta2/groupspec.ts | 12 - .../akash/deployment/v1beta2/params.ts | 6 - .../akash/deployment/v1beta2/query.ts | 43 -- .../akash/deployment/v1beta2/resource.ts | 8 - .../deployment/v1beta2/service.registry.ts | 44 -- .../outputv3/akash/escrow/v1beta1/genesis.ts | 15 - .../outputv3/akash/escrow/v1beta1/query.ts | 40 -- .../outputv3/akash/escrow/v1beta1/types.ts | 28 -- .../outputv3/akash/escrow/v1beta2/genesis.ts | 15 - .../outputv3/akash/escrow/v1beta2/query.ts | 40 -- .../outputv3/akash/escrow/v1beta2/types.ts | 30 -- .../akash/inflation/v1beta2/genesis.ts | 6 - .../akash/inflation/v1beta2/params.ts | 8 - .../outputv3/akash/market/v1beta2/bid.ts | 49 --- .../outputv3/akash/market/v1beta2/genesis.ts | 16 - .../outputv3/akash/market/v1beta2/lease.ts | 56 --- .../outputv3/akash/market/v1beta2/order.ts | 26 -- .../outputv3/akash/market/v1beta2/params.ts | 7 - .../outputv3/akash/market/v1beta2/query.ts | 81 ---- .../akash/market/v1beta2/service.registry.ts | 32 -- .../provider/v1beta1/provider.registry.ts | 20 - .../akash/provider/v1beta1/provider.ts | 60 --- .../akash/provider/v1beta2/genesis.ts | 10 - .../provider/v1beta2/provider.registry.ts | 20 - .../akash/provider/v1beta2/provider.ts | 60 --- .../outputv3/akash/provider/v1beta2/query.ts | 26 -- __fixtures__/v-next/outputv3/confio/proofs.ts | 122 +----- .../outputv3/cosmos/app/v1alpha1/config.ts | 16 - .../outputv3/cosmos/app/v1alpha1/module.ts | 27 -- .../outputv3/cosmos/app/v1alpha1/query.ts | 10 - .../outputv3/cosmos/auth/v1beta1/auth.ts | 29 -- .../outputv3/cosmos/auth/v1beta1/genesis.ts | 11 - .../outputv3/cosmos/auth/v1beta1/query.ts | 77 ---- .../outputv3/cosmos/authz/v1beta1/authz.ts | 29 -- .../outputv3/cosmos/authz/v1beta1/genesis.ts | 10 - .../outputv3/cosmos/authz/v1beta1/query.ts | 51 --- .../cosmos/authz/v1beta1/tx.registry.ts | 20 - .../outputv3/cosmos/authz/v1beta1/tx.ts | 42 -- .../outputv3/cosmos/bank/v1beta1/authz.ts | 10 - .../outputv3/cosmos/bank/v1beta1/bank.ts | 73 ---- .../outputv3/cosmos/bank/v1beta1/genesis.ts | 31 -- .../outputv3/cosmos/bank/v1beta1/query.ts | 125 ------ .../cosmos/bank/v1beta1/tx.registry.ts | 14 - .../v-next/outputv3/cosmos/bank/v1beta1/tx.ts | 34 -- .../outputv3/cosmos/base/abci/v1beta1/abci.ts | 115 ------ .../outputv3/cosmos/base/kv/v1beta1/kv.ts | 16 - .../cosmos/base/query/v1beta1/pagination.ts | 18 +- .../base/reflection/v1beta1/reflection.ts | 28 -- .../base/reflection/v2alpha1/reflection.ts | 172 -------- .../cosmos/base/snapshots/v1beta1/snapshot.ts | 70 +--- .../cosmos/base/store/v1beta1/commit_info.ts | 23 -- .../cosmos/base/store/v1beta1/listening.ts | 11 +- .../cosmos/base/tendermint/v1beta1/query.ts | 105 ----- .../outputv3/cosmos/base/v1beta1/coin.ts | 23 -- .../cosmos/capability/v1beta1/capability.ts | 21 - .../cosmos/capability/v1beta1/genesis.ts | 17 - .../outputv3/cosmos/crisis/v1beta1/genesis.ts | 6 - .../cosmos/crisis/v1beta1/tx.registry.ts | 8 - .../outputv3/cosmos/crisis/v1beta1/tx.ts | 12 - .../outputv3/cosmos/crypto/ed25519/keys.ts | 13 +- .../v-next/outputv3/cosmos/crypto/hd/v1/hd.ts | 10 - .../cosmos/crypto/keyring/v1/record.ts | 30 -- .../outputv3/cosmos/crypto/multisig/keys.ts | 11 - .../crypto/multisig/v1beta1/multisig.ts | 18 +- .../outputv3/cosmos/crypto/secp256k1/keys.ts | 13 +- .../outputv3/cosmos/crypto/secp256r1/keys.ts | 13 +- .../distribution/v1beta1/distribution.ts | 109 ----- .../cosmos/distribution/v1beta1/genesis.ts | 93 ----- .../cosmos/distribution/v1beta1/query.ts | 119 ------ .../distribution/v1beta1/tx.registry.ts | 26 -- .../cosmos/distribution/v1beta1/tx.ts | 54 --- .../cosmos/evidence/v1beta1/evidence.ts | 9 - .../cosmos/evidence/v1beta1/genesis.ts | 10 - .../outputv3/cosmos/evidence/v1beta1/query.ts | 28 +- .../cosmos/evidence/v1beta1/tx.registry.ts | 8 - .../outputv3/cosmos/evidence/v1beta1/tx.ts | 12 - .../cosmos/feegrant/v1beta1/feegrant.ts | 45 --- .../cosmos/feegrant/v1beta1/genesis.ts | 10 - .../outputv3/cosmos/feegrant/v1beta1/query.ts | 44 -- .../cosmos/feegrant/v1beta1/tx.registry.ts | 14 - .../outputv3/cosmos/feegrant/v1beta1/tx.ts | 22 - .../cosmos/genutil/v1beta1/genesis.ts | 12 +- .../v-next/outputv3/cosmos/gov/v1/genesis.ts | 24 -- .../v-next/outputv3/cosmos/gov/v1/gov.ts | 82 ---- .../v-next/outputv3/cosmos/gov/v1/query.ts | 105 ----- .../outputv3/cosmos/gov/v1/tx.registry.ts | 32 -- .../v-next/outputv3/cosmos/gov/v1/tx.ts | 75 ---- .../outputv3/cosmos/gov/v1beta1/genesis.ts | 24 -- .../v-next/outputv3/cosmos/gov/v1beta1/gov.ts | 83 ---- .../outputv3/cosmos/gov/v1beta1/query.ts | 105 ----- .../cosmos/gov/v1beta1/tx.registry.ts | 26 -- .../v-next/outputv3/cosmos/gov/v1beta1/tx.ts | 58 --- .../v-next/outputv3/cosmos/group/v1/events.ts | 48 --- .../outputv3/cosmos/group/v1/genesis.ts | 33 -- .../v-next/outputv3/cosmos/group/v1/query.ts | 180 --------- .../outputv3/cosmos/group/v1/tx.registry.ts | 86 ---- .../v-next/outputv3/cosmos/group/v1/tx.ts | 185 --------- .../v-next/outputv3/cosmos/group/v1/types.ts | 105 ----- .../outputv3/cosmos/mint/v1beta1/genesis.ts | 7 - .../outputv3/cosmos/mint/v1beta1/mint.ts | 17 - .../outputv3/cosmos/mint/v1beta1/query.ts | 28 -- .../outputv3/cosmos/nft/v1beta1/event.ts | 23 -- .../outputv3/cosmos/nft/v1beta1/genesis.ts | 25 -- .../v-next/outputv3/cosmos/nft/v1beta1/nft.ts | 21 - .../outputv3/cosmos/nft/v1beta1/query.ts | 86 ---- .../cosmos/nft/v1beta1/tx.registry.ts | 8 - .../v-next/outputv3/cosmos/nft/v1beta1/tx.ts | 13 - .../cosmos/orm/module/v1alpha1/module.ts | 5 - .../v-next/outputv3/cosmos/orm/v1/orm.ts | 30 -- .../outputv3/cosmos/orm/v1alpha1/schema.ts | 20 +- .../outputv3/cosmos/params/v1beta1/params.ts | 19 - .../outputv3/cosmos/params/v1beta1/query.ts | 35 -- .../cosmos/slashing/v1beta1/genesis.ts | 38 -- .../outputv3/cosmos/slashing/v1beta1/query.ts | 35 -- .../cosmos/slashing/v1beta1/slashing.ts | 20 - .../cosmos/slashing/v1beta1/tx.registry.ts | 8 - .../outputv3/cosmos/slashing/v1beta1/tx.ts | 10 - .../outputv3/cosmos/staking/v1beta1/authz.ts | 18 - .../cosmos/staking/v1beta1/genesis.ts | 41 +- .../outputv3/cosmos/staking/v1beta1/query.ts | 186 --------- .../cosmos/staking/v1beta1/staking.ts | 172 -------- .../cosmos/staking/v1beta1/tx.registry.ts | 32 -- .../outputv3/cosmos/staking/v1beta1/tx.ts | 64 --- .../cosmos/tx/signing/v1beta1/signing.ts | 39 -- .../outputv3/cosmos/tx/v1beta1/service.ts | 79 ---- .../v-next/outputv3/cosmos/tx/v1beta1/tx.ts | 133 +----- .../outputv3/cosmos/upgrade/v1beta1/query.ts | 53 --- .../cosmos/upgrade/v1beta1/tx.registry.ts | 14 - .../outputv3/cosmos/upgrade/v1beta1/tx.ts | 20 - .../cosmos/upgrade/v1beta1/upgrade.ts | 29 -- .../cosmos/vesting/v1beta1/tx.registry.ts | 20 - .../outputv3/cosmos/vesting/v1beta1/tx.ts | 49 --- .../cosmos/vesting/v1beta1/vesting.ts | 59 --- .../v-next/outputv3/cosmos_proto/cosmos.ts | 18 - .../outputv3/cosmwasm/wasm/v1/genesis.ts | 58 --- .../v-next/outputv3/cosmwasm/wasm/v1/ibc.ts | 16 +- .../outputv3/cosmwasm/wasm/v1/proposal.ts | 96 +---- .../v-next/outputv3/cosmwasm/wasm/v1/query.ts | 130 ------ .../outputv3/cosmwasm/wasm/v1/tx.registry.ts | 38 -- .../v-next/outputv3/cosmwasm/wasm/v1/tx.ts | 86 +--- .../v-next/outputv3/cosmwasm/wasm/v1/types.ts | 57 --- .../v-next/outputv3/evmos/claims/v1/claims.ts | 29 -- .../outputv3/evmos/claims/v1/genesis.ts | 30 -- .../v-next/outputv3/evmos/claims/v1/query.ts | 53 --- .../outputv3/evmos/epochs/v1/genesis.ts | 21 - .../v-next/outputv3/evmos/epochs/v1/query.ts | 26 -- .../v-next/outputv3/evmos/erc20/v1/erc20.ts | 30 -- .../v-next/outputv3/evmos/erc20/v1/genesis.ts | 17 - .../v-next/outputv3/evmos/erc20/v1/query.ts | 35 -- .../outputv3/evmos/erc20/v1/tx.registry.ts | 14 - .../v-next/outputv3/evmos/erc20/v1/tx.ts | 24 -- .../v-next/outputv3/evmos/fees/v1/fees.ts | 8 - .../v-next/outputv3/evmos/fees/v1/genesis.ts | 20 - .../v-next/outputv3/evmos/fees/v1/query.ts | 51 --- .../outputv3/evmos/fees/v1/tx.registry.ts | 20 - .../v-next/outputv3/evmos/fees/v1/tx.ts | 38 -- .../outputv3/evmos/incentives/v1/genesis.ts | 24 -- .../evmos/incentives/v1/incentives.ts | 41 -- .../outputv3/evmos/incentives/v1/query.ts | 87 ---- .../outputv3/evmos/inflation/v1/genesis.ts | 18 - .../outputv3/evmos/inflation/v1/inflation.ts | 17 - .../outputv3/evmos/inflation/v1/query.ts | 55 --- .../outputv3/evmos/recovery/v1/genesis.ts | 12 - .../outputv3/evmos/recovery/v1/query.ts | 10 - .../v-next/outputv3/evmos/vesting/v1/query.ts | 25 -- .../outputv3/evmos/vesting/v1/tx.registry.ts | 14 - .../v-next/outputv3/evmos/vesting/v1/tx.ts | 34 -- .../outputv3/evmos/vesting/v1/vesting.ts | 18 - .../v-next/outputv3/google/api/auth.ts | 59 --- .../v-next/outputv3/google/api/backend.ts | 23 -- .../v-next/outputv3/google/api/billing.ts | 20 - .../outputv3/google/api/config_change.ts | 19 - .../v-next/outputv3/google/api/consumer.ts | 17 - .../v-next/outputv3/google/api/context.ts | 35 -- .../v-next/outputv3/google/api/control.ts | 6 - .../outputv3/google/api/distribution.ts | 67 ---- .../outputv3/google/api/documentation.ts | 37 -- .../v-next/outputv3/google/api/endpoint.ts | 13 - .../v1alpha1/conformance_service.ts | 77 ---- .../google/api/expr/v1alpha1/checked.ts | 132 ------ .../outputv3/google/api/expr/v1alpha1/eval.ts | 46 --- .../google/api/expr/v1alpha1/explain.ts | 21 - .../google/api/expr/v1alpha1/syntax.ts | 140 ------- .../google/api/expr/v1alpha1/value.ts | 53 +-- .../outputv3/google/api/expr/v1beta1/decl.ts | 38 -- .../outputv3/google/api/expr/v1beta1/eval.ts | 51 --- .../outputv3/google/api/expr/v1beta1/expr.ts | 96 ----- .../google/api/expr/v1beta1/source.ts | 31 -- .../outputv3/google/api/expr/v1beta1/value.ts | 53 +-- .../v-next/outputv3/google/api/http.ts | 35 -- .../v-next/outputv3/google/api/httpbody.ts | 14 +- .../v-next/outputv3/google/api/label.ts | 8 - .../v-next/outputv3/google/api/log.ts | 13 - .../v-next/outputv3/google/api/logging.ts | 25 -- .../v-next/outputv3/google/api/metric.ts | 48 --- .../outputv3/google/api/monitored_resource.ts | 49 --- .../v-next/outputv3/google/api/monitoring.ts | 25 -- .../v-next/outputv3/google/api/quota.ts | 57 --- .../v-next/outputv3/google/api/resource.ts | 26 -- .../v-next/outputv3/google/api/routing.ts | 16 - .../v-next/outputv3/google/api/service.ts | 58 --- .../api/servicecontrol/v1/check_error.ts | 9 - .../api/servicecontrol/v1/distribution.ts | 46 --- .../api/servicecontrol/v1/http_request.ts | 20 - .../google/api/servicecontrol/v1/log_entry.ts | 43 -- .../api/servicecontrol/v1/metric_value.ts | 36 -- .../google/api/servicecontrol/v1/operation.ts | 38 -- .../api/servicecontrol/v1/quota_controller.ts | 57 --- .../servicecontrol/v1/service_controller.ts | 66 --- .../servicecontrol/v2/service_controller.ts | 55 --- .../api/servicemanagement/v1/resources.ts | 98 ----- .../servicemanagement/v1/servicemanager.ts | 138 ------- .../google/api/serviceusage/v1/resources.ts | 44 -- .../api/serviceusage/v1/serviceusage.ts | 95 ----- .../api/serviceusage/v1beta1/resources.ts | 154 ------- .../api/serviceusage/v1beta1/serviceusage.ts | 288 ------------- .../v-next/outputv3/google/api/source_info.ts | 10 - .../outputv3/google/api/system_parameter.ts | 27 -- .../v-next/outputv3/google/api/usage.ts | 23 -- .../v-next/outputv3/google/api/visibility.ts | 16 - .../google/logging/type/http_request.ts | 20 - .../outputv3/google/logging/v2/log_entry.ts | 55 --- .../outputv3/google/logging/v2/logging.ts | 143 ------- .../google/logging/v2/logging_config.ts | 295 -------------- .../google/logging/v2/logging_metrics.ts | 66 --- .../outputv3/google/longrunning/operations.ts | 55 --- .../v-next/outputv3/google/protobuf/any.ts | 9 +- .../v-next/outputv3/google/protobuf/api.ts | 45 --- .../google/protobuf/compiler/plugin.ts | 42 -- .../outputv3/google/protobuf/descriptor.ts | 377 ------------------ .../outputv3/google/protobuf/duration.ts | 7 - .../v-next/outputv3/google/protobuf/empty.ts | 5 - .../outputv3/google/protobuf/field_mask.ts | 10 - .../google/protobuf/source_context.ts | 6 - .../v-next/outputv3/google/protobuf/struct.ts | 36 -- .../outputv3/google/protobuf/timestamp.ts | 7 - .../v-next/outputv3/google/protobuf/type.ts | 75 ---- .../outputv3/google/protobuf/wrappers.ts | 46 --- .../google/rpc/context/attribute_context.ts | 147 ------- .../outputv3/google/rpc/error_details.ts | 115 ------ .../v-next/outputv3/google/rpc/status.ts | 12 - .../ibc/applications/transfer/v1/genesis.ts | 12 - .../ibc/applications/transfer/v1/query.ts | 35 -- .../ibc/applications/transfer/v1/transfer.ts | 13 - .../applications/transfer/v1/tx.registry.ts | 8 - .../ibc/applications/transfer/v1/tx.ts | 16 - .../ibc/applications/transfer/v2/packet.ts | 9 - .../outputv3/ibc/core/channel/v1/channel.ts | 61 --- .../outputv3/ibc/core/channel/v1/genesis.ts | 48 --- .../outputv3/ibc/core/channel/v1/query.ts | 214 ---------- .../ibc/core/channel/v1/tx.registry.ts | 62 --- .../v-next/outputv3/ibc/core/channel/v1/tx.ts | 131 ------ .../outputv3/ibc/core/client/v1/client.ts | 54 --- .../outputv3/ibc/core/client/v1/genesis.ts | 39 -- .../outputv3/ibc/core/client/v1/query.ts | 96 ----- .../ibc/core/client/v1/tx.registry.ts | 26 -- .../v-next/outputv3/ibc/core/client/v1/tx.ts | 48 --- .../ibc/core/commitment/v1/commitment.ts | 31 +- .../ibc/core/connection/v1/connection.ts | 69 ---- .../ibc/core/connection/v1/genesis.ts | 17 - .../outputv3/ibc/core/connection/v1/query.ts | 72 ---- .../ibc/core/connection/v1/tx.registry.ts | 26 -- .../outputv3/ibc/core/connection/v1/tx.ts | 68 ---- .../v-next/outputv3/ibc/core/port/v1/query.ts | 16 - .../outputv3/ibc/core/types/v1/genesis.ts | 8 - .../lightclients/localhost/v1/localhost.ts | 7 - .../solomachine/v1/solomachine.ts | 109 ----- .../solomachine/v2/solomachine.ts | 109 ----- .../lightclients/tendermint/v1/tendermint.ts | 52 --- __fixtures__/v-next/outputv3/index.ts | 1 - .../outputv3/osmosis/claim/v1beta1/claim.ts | 16 - .../outputv3/osmosis/claim/v1beta1/genesis.ts | 12 - .../outputv3/osmosis/claim/v1beta1/params.ts | 9 - .../outputv3/osmosis/claim/v1beta1/query.ts | 62 --- .../v-next/outputv3/osmosis/epochs/genesis.ts | 21 - .../v-next/outputv3/osmosis/epochs/query.ts | 24 -- .../gamm/pool-models/balancer/balancerPool.ts | 45 --- .../pool-models/balancer/tx/tx.registry.ts | 8 - .../gamm/pool-models/balancer/tx/tx.ts | 18 - .../pool-models/stableswap/stableswap_pool.ts | 27 -- .../pool-models/stableswap/tx.registry.ts | 14 - .../osmosis/gamm/pool-models/stableswap/tx.ts | 39 -- .../outputv3/osmosis/gamm/v1beta1/genesis.ts | 21 - .../outputv3/osmosis/gamm/v1beta1/query.ts | 214 ---------- .../osmosis/gamm/v1beta1/tx.registry.ts | 50 --- .../outputv3/osmosis/gamm/v1beta1/tx.ts | 144 ------- .../v-next/outputv3/osmosis/gamm/v2/query.ts | 13 - .../osmosis/ibc-rate-limit/v1beta1/params.ts | 6 - .../osmosis/ibc-rate-limit/v1beta1/query.ts | 10 - .../outputv3/osmosis/incentives/gauge.ts | 30 -- .../outputv3/osmosis/incentives/genesis.ts | 17 - .../outputv3/osmosis/incentives/params.ts | 6 - .../outputv3/osmosis/incentives/query.ts | 134 ------- .../osmosis/incentives/tx.registry.ts | 14 - .../v-next/outputv3/osmosis/incentives/tx.ts | 34 -- .../v-next/outputv3/osmosis/lockup/genesis.ts | 16 - .../v-next/outputv3/osmosis/lockup/lock.ts | 30 -- .../v-next/outputv3/osmosis/lockup/params.ts | 10 - .../v-next/outputv3/osmosis/lockup/query.ts | 235 ----------- .../outputv3/osmosis/lockup/tx.registry.ts | 32 -- .../v-next/outputv3/osmosis/lockup/tx.ts | 75 ---- .../outputv3/osmosis/mint/v1beta1/genesis.ts | 8 - .../outputv3/osmosis/mint/v1beta1/mint.ts | 36 -- .../outputv3/osmosis/mint/v1beta1/query.ts | 19 - .../pool-incentives/v1beta1/genesis.ts | 13 - .../osmosis/pool-incentives/v1beta1/gov.ts | 23 -- .../pool-incentives/v1beta1/incentives.ts | 47 --- .../osmosis/pool-incentives/v1beta1/query.ts | 86 ---- .../outputv3/osmosis/sumtree/v1beta1/tree.ts | 21 - .../outputv3/osmosis/superfluid/genesis.ts | 26 -- .../outputv3/osmosis/superfluid/params.ts | 6 - .../outputv3/osmosis/superfluid/query.ts | 235 ----------- .../outputv3/osmosis/superfluid/superfluid.ts | 44 -- .../osmosis/superfluid/tx.registry.ts | 32 -- .../v-next/outputv3/osmosis/superfluid/tx.ts | 63 --- .../osmosis/superfluid/v1beta1/gov.ts | 35 -- .../tokenfactory/v1beta1/authorityMetadata.ts | 6 - .../osmosis/tokenfactory/v1beta1/genesis.ts | 17 - .../osmosis/tokenfactory/v1beta1/params.ts | 10 - .../osmosis/tokenfactory/v1beta1/query.ts | 34 -- .../tokenfactory/v1beta1/tx.registry.ts | 32 -- .../osmosis/tokenfactory/v1beta1/tx.ts | 53 --- .../outputv3/osmosis/twap/v1beta1/genesis.ts | 17 - .../outputv3/osmosis/twap/v1beta1/query.ts | 37 -- .../osmosis/twap/v1beta1/twap_record.ts | 15 - .../osmosis/txfees/v1beta1/feetoken.ts | 7 - .../osmosis/txfees/v1beta1/genesis.ts | 11 - .../outputv3/osmosis/txfees/v1beta1/gov.ts | 8 - .../outputv3/osmosis/txfees/v1beta1/query.ts | 44 -- .../v-next/outputv3/tendermint/abci/types.ts | 375 ----------------- .../v-next/outputv3/tendermint/crypto/keys.ts | 9 +- .../outputv3/tendermint/crypto/proof.ts | 44 +- .../outputv3/tendermint/libs/bits/types.ts | 11 - .../v-next/outputv3/tendermint/p2p/types.ts | 45 --- .../v-next/outputv3/tendermint/types/block.ts | 9 - .../outputv3/tendermint/types/evidence.ts | 38 -- .../outputv3/tendermint/types/params.ts | 43 -- .../v-next/outputv3/tendermint/types/types.ts | 119 +----- .../outputv3/tendermint/types/validator.ts | 26 -- .../outputv3/tendermint/version/types.ts | 13 - .../telescope/__tests__/telescope-v3.test.ts | 4 +- packages/types/src/telescope.ts | 2 +- 2256 files changed, 12365 insertions(+), 26799 deletions(-) create mode 100644 __fixtures__/misc/output-impl-interfaces-gen/json-safe.ts create mode 100644 __fixtures__/misc/output-proto-amino/amino-interface-proto-optionality/json-safe.ts create mode 100644 __fixtures__/misc/output-proto-amino/amino-interface/json-safe.ts create mode 100644 __fixtures__/misc/output-proto-amino/amino-legacy/json-safe.ts create mode 100644 __fixtures__/misc/output-proto-amino/amino-msg-no-func/json-safe.ts create mode 100644 __fixtures__/misc/output-proto-amino/amino-msg-with-func/json-safe.ts create mode 100644 __fixtures__/misc/output-proto-amino/amino-no-msg-with-func/json-safe.ts create mode 100644 __fixtures__/misc/output-proto-amino/no-amino-legacy-no-proto/json-safe.ts create mode 100644 __fixtures__/misc/output-proto-amino/no-amino-legacy/json-safe.ts create mode 100644 __fixtures__/misc/output-proto-amino/no-amino-no-proto/json-safe.ts create mode 100644 __fixtures__/misc/output-proto-amino/no-amino/json-safe.ts create mode 100644 __fixtures__/misc/output-proto-amino/proto-only-legacy/json-safe.ts create mode 100644 __fixtures__/misc/output-proto-amino/proto-only/json-safe.ts create mode 100644 __fixtures__/misc/output/json-safe.ts create mode 100644 __fixtures__/output1/json-safe.ts create mode 100644 __fixtures__/output2/json-safe.ts create mode 100644 __fixtures__/v-next/outputinstantrpc/json-safe.ts create mode 100644 __fixtures__/v-next/outputosmojs/json-safe.ts create mode 100644 __fixtures__/v-next/outputv2/json-safe.ts diff --git a/__fixtures__/misc/output-impl-interfaces-gen/akash/deployment/v1beta1/authz.ts b/__fixtures__/misc/output-impl-interfaces-gen/akash/deployment/v1beta1/authz.ts index 0d56b06860..05f439fc95 100644 --- a/__fixtures__/misc/output-impl-interfaces-gen/akash/deployment/v1beta1/authz.ts +++ b/__fixtures__/misc/output-impl-interfaces-gen/akash/deployment/v1beta1/authz.ts @@ -1,6 +1,7 @@ import { Coin, CoinAmino, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../binary"; import { isSet, DeepPartial } from "../../../helpers"; +import { JsonSafe } from "../../../json-safe"; import { GlobalDecoderRegistry } from "../../../registry"; export const protobufPackage = "akash.deployment.v1beta1"; /** @@ -84,7 +85,7 @@ export const DepositDeploymentAuthorization = { if (isSet(object.spendLimit)) obj.spendLimit = Coin.fromJSON(object.spendLimit); return obj; }, - toJSON(message: DepositDeploymentAuthorization): unknown { + toJSON(message: DepositDeploymentAuthorization): JsonSafe { const obj: any = {}; message.spendLimit !== undefined && (obj.spendLimit = message.spendLimit ? Coin.toJSON(message.spendLimit) : undefined); return obj; diff --git a/__fixtures__/misc/output-impl-interfaces-gen/cosmos/authz/v1beta1/authz.ts b/__fixtures__/misc/output-impl-interfaces-gen/cosmos/authz/v1beta1/authz.ts index 1101cf344e..c0abaa0801 100644 --- a/__fixtures__/misc/output-impl-interfaces-gen/cosmos/authz/v1beta1/authz.ts +++ b/__fixtures__/misc/output-impl-interfaces-gen/cosmos/authz/v1beta1/authz.ts @@ -4,6 +4,7 @@ import { DepositDeploymentAuthorization, DepositDeploymentAuthorizationProtoMsg, import { SendAuthorization, SendAuthorizationProtoMsg, SendAuthorizationSDKType } from "../../bank/v1beta1/authz"; import { BinaryReader, BinaryWriter } from "../../../binary"; import { isSet, DeepPartial, toTimestamp, fromTimestamp } from "../../../helpers"; +import { JsonSafe } from "../../../json-safe"; import { GlobalDecoderRegistry } from "../../../registry"; export const protobufPackage = "cosmos.authz.v1beta1"; /** VoteOption enumerates the valid vote options for a given governance proposal. */ @@ -278,7 +279,7 @@ export const GenericAuthorization = { if (isSet(object.msg)) obj.msg = String(object.msg); return obj; }, - toJSON(message: GenericAuthorization): unknown { + toJSON(message: GenericAuthorization): JsonSafe { const obj: any = {}; message.msg !== undefined && (obj.msg = message.msg); return obj; @@ -416,7 +417,7 @@ export const Grant = { if (Array.isArray(object?.messages)) obj.messages = object.messages.map((e: any) => Any.fromJSON(e)); return obj; }, - toJSON(message: Grant): unknown { + toJSON(message: Grant): JsonSafe { const obj: any = {}; message.authorization !== undefined && (obj.authorization = message.authorization ? GlobalDecoderRegistry.toJSON(message.authorization) : undefined); message.expiration !== undefined && (obj.expiration = message.expiration.toISOString()); @@ -596,7 +597,7 @@ export const GrantAuthorization = { if (isSet(object.expiration)) obj.expiration = new Date(object.expiration); return obj; }, - toJSON(message: GrantAuthorization): unknown { + toJSON(message: GrantAuthorization): JsonSafe { const obj: any = {}; message.granter !== undefined && (obj.granter = message.granter); message.grantee !== undefined && (obj.grantee = message.grantee); @@ -731,7 +732,7 @@ export const GrantQueueItem = { if (Array.isArray(object?.msgTypeUrls)) obj.msgTypeUrls = object.msgTypeUrls.map((e: any) => String(e)); return obj; }, - toJSON(message: GrantQueueItem): unknown { + toJSON(message: GrantQueueItem): JsonSafe { const obj: any = {}; if (message.msgTypeUrls) { obj.msgTypeUrls = message.msgTypeUrls.map(e => e); @@ -847,7 +848,7 @@ export const Grants = { if (Array.isArray(object?.authorization)) obj.authorization = object.authorization.map((e: any) => GlobalDecoderRegistry.fromJSON(e)); return obj; }, - toJSON(message: Grants): unknown { + toJSON(message: Grants): JsonSafe { const obj: any = {}; if (message.authorization) { obj.authorization = message.authorization.map(e => e ? GlobalDecoderRegistry.toJSON(e) : undefined); diff --git a/__fixtures__/misc/output-impl-interfaces-gen/cosmos/authz/v1beta1/tx.ts b/__fixtures__/misc/output-impl-interfaces-gen/cosmos/authz/v1beta1/tx.ts index fe6e0be47c..fdf6057b37 100644 --- a/__fixtures__/misc/output-impl-interfaces-gen/cosmos/authz/v1beta1/tx.ts +++ b/__fixtures__/misc/output-impl-interfaces-gen/cosmos/authz/v1beta1/tx.ts @@ -2,6 +2,7 @@ import { Grant, GrantAmino, GrantSDKType } from "./authz"; import { Any, AnyProtoMsg, AnyAmino, AnySDKType } from "../../../google/protobuf/any"; import { BinaryReader, BinaryWriter } from "../../../binary"; import { isSet, DeepPartial, bytesFromBase64, base64FromBytes } from "../../../helpers"; +import { JsonSafe } from "../../../json-safe"; import { GlobalDecoderRegistry } from "../../../registry"; export const protobufPackage = "cosmos.authz.v1beta1"; /** @@ -236,7 +237,7 @@ export const MsgGrant = { if (isSet(object.grant)) obj.grant = Grant.fromJSON(object.grant); return obj; }, - toJSON(message: MsgGrant): unknown { + toJSON(message: MsgGrant): JsonSafe { const obj: any = {}; message.granter !== undefined && (obj.granter = message.granter); message.grantee !== undefined && (obj.grantee = message.grantee); @@ -362,7 +363,7 @@ export const MsgExecResponse = { if (Array.isArray(object?.results)) obj.results = object.results.map((e: any) => bytesFromBase64(e)); return obj; }, - toJSON(message: MsgExecResponse): unknown { + toJSON(message: MsgExecResponse): JsonSafe { const obj: any = {}; if (message.results) { obj.results = message.results.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); @@ -486,7 +487,7 @@ export const MsgExec = { if (Array.isArray(object?.msgs)) obj.msgs = object.msgs.map((e: any) => GlobalDecoderRegistry.fromJSON(e)); return obj; }, - toJSON(message: MsgExec): unknown { + toJSON(message: MsgExec): JsonSafe { const obj: any = {}; message.grantee !== undefined && (obj.grantee = message.grantee); if (message.msgs) { @@ -602,7 +603,7 @@ export const MsgGrantResponse = { const obj = createBaseMsgGrantResponse(); return obj; }, - toJSON(_: MsgGrantResponse): unknown { + toJSON(_: MsgGrantResponse): JsonSafe { const obj: any = {}; return obj; }, @@ -713,7 +714,7 @@ export const MsgRevoke = { if (isSet(object.msgTypeUrl)) obj.msgTypeUrl = String(object.msgTypeUrl); return obj; }, - toJSON(message: MsgRevoke): unknown { + toJSON(message: MsgRevoke): JsonSafe { const obj: any = {}; message.granter !== undefined && (obj.granter = message.granter); message.grantee !== undefined && (obj.grantee = message.grantee); @@ -828,7 +829,7 @@ export const MsgRevokeResponse = { const obj = createBaseMsgRevokeResponse(); return obj; }, - toJSON(_: MsgRevokeResponse): unknown { + toJSON(_: MsgRevokeResponse): JsonSafe { const obj: any = {}; return obj; }, diff --git a/__fixtures__/misc/output-impl-interfaces-gen/cosmos/bank/v1beta1/authz.ts b/__fixtures__/misc/output-impl-interfaces-gen/cosmos/bank/v1beta1/authz.ts index 5f5006af35..9b87702532 100644 --- a/__fixtures__/misc/output-impl-interfaces-gen/cosmos/bank/v1beta1/authz.ts +++ b/__fixtures__/misc/output-impl-interfaces-gen/cosmos/bank/v1beta1/authz.ts @@ -1,5 +1,6 @@ import { Coin, CoinAmino, CoinSDKType } from "../../base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../binary"; +import { JsonSafe } from "../../../json-safe"; import { DeepPartial } from "../../../helpers"; import { GlobalDecoderRegistry } from "../../../registry"; export const protobufPackage = "cosmos.bank.v1beta1"; @@ -83,7 +84,7 @@ export const SendAuthorization = { if (Array.isArray(object?.spendLimit)) obj.spendLimit = object.spendLimit.map((e: any) => Coin.fromJSON(e)); return obj; }, - toJSON(message: SendAuthorization): unknown { + toJSON(message: SendAuthorization): JsonSafe { const obj: any = {}; if (message.spendLimit) { obj.spendLimit = message.spendLimit.map(e => e ? Coin.toJSON(e) : undefined); diff --git a/__fixtures__/misc/output-impl-interfaces-gen/cosmos/bank/v1beta1/tx.ts b/__fixtures__/misc/output-impl-interfaces-gen/cosmos/bank/v1beta1/tx.ts index bb4f13137e..64c54fd056 100644 --- a/__fixtures__/misc/output-impl-interfaces-gen/cosmos/bank/v1beta1/tx.ts +++ b/__fixtures__/misc/output-impl-interfaces-gen/cosmos/bank/v1beta1/tx.ts @@ -1,6 +1,7 @@ import { Coin, CoinAmino, CoinSDKType } from "../../base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../binary"; import { isSet, bytesFromBase64, base64FromBytes, DeepPartial } from "../../../helpers"; +import { JsonSafe } from "../../../json-safe"; import { GlobalDecoderRegistry } from "../../../registry"; export const protobufPackage = "cosmos.bank.v1beta1"; /** @@ -159,7 +160,7 @@ export const MsgInstantiateContract2 = { if (Array.isArray(object?.aListOfBytes)) obj.aListOfBytes = object.aListOfBytes.map((e: any) => bytesFromBase64(e)); return obj; }, - toJSON(message: MsgInstantiateContract2): unknown { + toJSON(message: MsgInstantiateContract2): JsonSafe { const obj: any = {}; message.codeId !== undefined && (obj.codeId = (message.codeId || BigInt(0)).toString()); message.label !== undefined && (obj.label = message.label); diff --git a/__fixtures__/misc/output-impl-interfaces-gen/cosmos/base/v1beta1/coin.ts b/__fixtures__/misc/output-impl-interfaces-gen/cosmos/base/v1beta1/coin.ts index ea32198f46..d6dbb61ff0 100644 --- a/__fixtures__/misc/output-impl-interfaces-gen/cosmos/base/v1beta1/coin.ts +++ b/__fixtures__/misc/output-impl-interfaces-gen/cosmos/base/v1beta1/coin.ts @@ -1,5 +1,6 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; import { isSet, DeepPartial } from "../../../helpers"; +import { JsonSafe } from "../../../json-safe"; import { GlobalDecoderRegistry } from "../../../registry"; export const protobufPackage = "cosmos.base.v1beta1"; /** @@ -171,7 +172,7 @@ export const Coin = { if (isSet(object.amount)) obj.amount = String(object.amount); return obj; }, - toJSON(message: Coin): unknown { + toJSON(message: Coin): JsonSafe { const obj: any = {}; message.denom !== undefined && (obj.denom = message.denom); message.amount !== undefined && (obj.amount = message.amount); @@ -294,7 +295,7 @@ export const DecCoin = { if (isSet(object.amount)) obj.amount = String(object.amount); return obj; }, - toJSON(message: DecCoin): unknown { + toJSON(message: DecCoin): JsonSafe { const obj: any = {}; message.denom !== undefined && (obj.denom = message.denom); message.amount !== undefined && (obj.amount = message.amount); @@ -409,7 +410,7 @@ export const IntProto = { if (isSet(object.int)) obj.int = String(object.int); return obj; }, - toJSON(message: IntProto): unknown { + toJSON(message: IntProto): JsonSafe { const obj: any = {}; message.int !== undefined && (obj.int = message.int); return obj; @@ -515,7 +516,7 @@ export const DecProto = { if (isSet(object.dec)) obj.dec = String(object.dec); return obj; }, - toJSON(message: DecProto): unknown { + toJSON(message: DecProto): JsonSafe { const obj: any = {}; message.dec !== undefined && (obj.dec = message.dec); return obj; diff --git a/__fixtures__/misc/output-impl-interfaces-gen/cosmos_proto/cosmos.ts b/__fixtures__/misc/output-impl-interfaces-gen/cosmos_proto/cosmos.ts index dcef5229e6..9a86fccfdb 100644 --- a/__fixtures__/misc/output-impl-interfaces-gen/cosmos_proto/cosmos.ts +++ b/__fixtures__/misc/output-impl-interfaces-gen/cosmos_proto/cosmos.ts @@ -1,5 +1,6 @@ import { BinaryReader, BinaryWriter } from "../binary"; import { isSet, DeepPartial } from "../helpers"; +import { JsonSafe } from "../json-safe"; import { GlobalDecoderRegistry } from "../registry"; export const protobufPackage = "cosmos_proto"; export enum ScalarType { @@ -228,7 +229,7 @@ export const InterfaceDescriptor = { if (isSet(object.description)) obj.description = String(object.description); return obj; }, - toJSON(message: InterfaceDescriptor): unknown { + toJSON(message: InterfaceDescriptor): JsonSafe { const obj: any = {}; message.name !== undefined && (obj.name = message.name); message.description !== undefined && (obj.description = message.description); @@ -360,7 +361,7 @@ export const ScalarDescriptor = { if (Array.isArray(object?.fieldType)) obj.fieldType = object.fieldType.map((e: any) => scalarTypeFromJSON(e)); return obj; }, - toJSON(message: ScalarDescriptor): unknown { + toJSON(message: ScalarDescriptor): JsonSafe { const obj: any = {}; message.name !== undefined && (obj.name = message.name); message.description !== undefined && (obj.description = message.description); diff --git a/__fixtures__/misc/output-impl-interfaces-gen/google/protobuf/any.ts b/__fixtures__/misc/output-impl-interfaces-gen/google/protobuf/any.ts index fa4a092493..fa6f0a7061 100644 --- a/__fixtures__/misc/output-impl-interfaces-gen/google/protobuf/any.ts +++ b/__fixtures__/misc/output-impl-interfaces-gen/google/protobuf/any.ts @@ -1,5 +1,6 @@ import { BinaryReader, BinaryWriter } from "../../binary"; import { isSet, bytesFromBase64, base64FromBytes, DeepPartial } from "../../helpers"; +import { JsonSafe } from "../../json-safe"; export const protobufPackage = "google.protobuf"; /** * `Any` contains an arbitrary serialized protocol buffer message along with a @@ -376,7 +377,7 @@ export const Any = { if (isSet(object.value)) obj.value = bytesFromBase64(object.value); return obj; }, - toJSON(message: Any): unknown { + toJSON(message: Any): JsonSafe { const obj: any = {}; message.typeUrl !== undefined && (obj.typeUrl = message.typeUrl); message.value !== undefined && (obj.value = base64FromBytes(message.value !== undefined ? message.value : new Uint8Array())); diff --git a/__fixtures__/misc/output-impl-interfaces-gen/google/protobuf/descriptor.ts b/__fixtures__/misc/output-impl-interfaces-gen/google/protobuf/descriptor.ts index 6c05a6dd8c..cbba0c4e80 100644 --- a/__fixtures__/misc/output-impl-interfaces-gen/google/protobuf/descriptor.ts +++ b/__fixtures__/misc/output-impl-interfaces-gen/google/protobuf/descriptor.ts @@ -1,4 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../binary"; +import { JsonSafe } from "../../json-safe"; import { DeepPartial, isSet, bytesFromBase64, base64FromBytes } from "../../helpers"; import { GlobalDecoderRegistry } from "../../registry"; export const protobufPackage = "google.protobuf"; @@ -2242,7 +2243,7 @@ export const FileDescriptorSet = { if (Array.isArray(object?.file)) obj.file = object.file.map((e: any) => FileDescriptorProto.fromJSON(e)); return obj; }, - toJSON(message: FileDescriptorSet): unknown { + toJSON(message: FileDescriptorSet): JsonSafe { const obj: any = {}; if (message.file) { obj.file = message.file.map(e => e ? FileDescriptorProto.toJSON(e) : undefined); @@ -2456,7 +2457,7 @@ export const FileDescriptorProto = { if (isSet(object.syntax)) obj.syntax = String(object.syntax); return obj; }, - toJSON(message: FileDescriptorProto): unknown { + toJSON(message: FileDescriptorProto): JsonSafe { const obj: any = {}; message.name !== undefined && (obj.name = message.name); message.package !== undefined && (obj.package = message.package); @@ -2799,7 +2800,7 @@ export const DescriptorProto = { if (Array.isArray(object?.reservedName)) obj.reservedName = object.reservedName.map((e: any) => String(e)); return obj; }, - toJSON(message: DescriptorProto): unknown { + toJSON(message: DescriptorProto): JsonSafe { const obj: any = {}; message.name !== undefined && (obj.name = message.name); if (message.field) { @@ -3076,7 +3077,7 @@ export const DescriptorProto_ExtensionRange = { if (isSet(object.options)) obj.options = ExtensionRangeOptions.fromJSON(object.options); return obj; }, - toJSON(message: DescriptorProto_ExtensionRange): unknown { + toJSON(message: DescriptorProto_ExtensionRange): JsonSafe { const obj: any = {}; message.start !== undefined && (obj.start = Math.round(message.start)); message.end !== undefined && (obj.end = Math.round(message.end)); @@ -3202,7 +3203,7 @@ export const DescriptorProto_ReservedRange = { if (isSet(object.end)) obj.end = Number(object.end); return obj; }, - toJSON(message: DescriptorProto_ReservedRange): unknown { + toJSON(message: DescriptorProto_ReservedRange): JsonSafe { const obj: any = {}; message.start !== undefined && (obj.start = Math.round(message.start)); message.end !== undefined && (obj.end = Math.round(message.end)); @@ -3309,7 +3310,7 @@ export const ExtensionRangeOptions = { if (Array.isArray(object?.uninterpretedOption)) obj.uninterpretedOption = object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)); return obj; }, - toJSON(message: ExtensionRangeOptions): unknown { + toJSON(message: ExtensionRangeOptions): JsonSafe { const obj: any = {}; if (message.uninterpretedOption) { obj.uninterpretedOption = message.uninterpretedOption.map(e => e ? UninterpretedOption.toJSON(e) : undefined); @@ -3489,7 +3490,7 @@ export const FieldDescriptorProto = { if (isSet(object.options)) obj.options = FieldOptions.fromJSON(object.options); return obj; }, - toJSON(message: FieldDescriptorProto): unknown { + toJSON(message: FieldDescriptorProto): JsonSafe { const obj: any = {}; message.name !== undefined && (obj.name = message.name); message.number !== undefined && (obj.number = Math.round(message.number)); @@ -3678,7 +3679,7 @@ export const OneofDescriptorProto = { if (isSet(object.options)) obj.options = OneofOptions.fromJSON(object.options); return obj; }, - toJSON(message: OneofDescriptorProto): unknown { + toJSON(message: OneofDescriptorProto): JsonSafe { const obj: any = {}; message.name !== undefined && (obj.name = message.name); message.options !== undefined && (obj.options = message.options ? OneofOptions.toJSON(message.options) : undefined); @@ -3819,7 +3820,7 @@ export const EnumDescriptorProto = { if (Array.isArray(object?.reservedName)) obj.reservedName = object.reservedName.map((e: any) => String(e)); return obj; }, - toJSON(message: EnumDescriptorProto): unknown { + toJSON(message: EnumDescriptorProto): JsonSafe { const obj: any = {}; message.name !== undefined && (obj.name = message.name); if (message.value) { @@ -3993,7 +3994,7 @@ export const EnumDescriptorProto_EnumReservedRange = { if (isSet(object.end)) obj.end = Number(object.end); return obj; }, - toJSON(message: EnumDescriptorProto_EnumReservedRange): unknown { + toJSON(message: EnumDescriptorProto_EnumReservedRange): JsonSafe { const obj: any = {}; message.start !== undefined && (obj.start = Math.round(message.start)); message.end !== undefined && (obj.end = Math.round(message.end)); @@ -4116,7 +4117,7 @@ export const EnumValueDescriptorProto = { if (isSet(object.options)) obj.options = EnumValueOptions.fromJSON(object.options); return obj; }, - toJSON(message: EnumValueDescriptorProto): unknown { + toJSON(message: EnumValueDescriptorProto): JsonSafe { const obj: any = {}; message.name !== undefined && (obj.name = message.name); message.number !== undefined && (obj.number = Math.round(message.number)); @@ -4250,7 +4251,7 @@ export const ServiceDescriptorProto = { if (isSet(object.options)) obj.options = ServiceOptions.fromJSON(object.options); return obj; }, - toJSON(message: ServiceDescriptorProto): unknown { + toJSON(message: ServiceDescriptorProto): JsonSafe { const obj: any = {}; message.name !== undefined && (obj.name = message.name); if (message.method) { @@ -4418,7 +4419,7 @@ export const MethodDescriptorProto = { if (isSet(object.serverStreaming)) obj.serverStreaming = Boolean(object.serverStreaming); return obj; }, - toJSON(message: MethodDescriptorProto): unknown { + toJSON(message: MethodDescriptorProto): JsonSafe { const obj: any = {}; message.name !== undefined && (obj.name = message.name); message.inputType !== undefined && (obj.inputType = message.inputType); @@ -4723,7 +4724,7 @@ export const FileOptions = { if (Array.isArray(object?.uninterpretedOption)) obj.uninterpretedOption = object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)); return obj; }, - toJSON(message: FileOptions): unknown { + toJSON(message: FileOptions): JsonSafe { const obj: any = {}; message.javaPackage !== undefined && (obj.javaPackage = message.javaPackage); message.javaOuterClassname !== undefined && (obj.javaOuterClassname = message.javaOuterClassname); @@ -5043,7 +5044,7 @@ export const MessageOptions = { if (Array.isArray(object?.uninterpretedOption)) obj.uninterpretedOption = object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)); return obj; }, - toJSON(message: MessageOptions): unknown { + toJSON(message: MessageOptions): JsonSafe { const obj: any = {}; message.messageSetWireFormat !== undefined && (obj.messageSetWireFormat = message.messageSetWireFormat); message.noStandardDescriptorAccessor !== undefined && (obj.noStandardDescriptorAccessor = message.noStandardDescriptorAccessor); @@ -5235,7 +5236,7 @@ export const FieldOptions = { if (Array.isArray(object?.uninterpretedOption)) obj.uninterpretedOption = object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)); return obj; }, - toJSON(message: FieldOptions): unknown { + toJSON(message: FieldOptions): JsonSafe { const obj: any = {}; message.ctype !== undefined && (obj.ctype = fieldOptions_CTypeToJSON(message.ctype)); message.packed !== undefined && (obj.packed = message.packed); @@ -5397,7 +5398,7 @@ export const OneofOptions = { if (Array.isArray(object?.uninterpretedOption)) obj.uninterpretedOption = object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)); return obj; }, - toJSON(message: OneofOptions): unknown { + toJSON(message: OneofOptions): JsonSafe { const obj: any = {}; if (message.uninterpretedOption) { obj.uninterpretedOption = message.uninterpretedOption.map(e => e ? UninterpretedOption.toJSON(e) : undefined); @@ -5521,7 +5522,7 @@ export const EnumOptions = { if (Array.isArray(object?.uninterpretedOption)) obj.uninterpretedOption = object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)); return obj; }, - toJSON(message: EnumOptions): unknown { + toJSON(message: EnumOptions): JsonSafe { const obj: any = {}; message.allowAlias !== undefined && (obj.allowAlias = message.allowAlias); message.deprecated !== undefined && (obj.deprecated = message.deprecated); @@ -5655,7 +5656,7 @@ export const EnumValueOptions = { if (Array.isArray(object?.uninterpretedOption)) obj.uninterpretedOption = object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)); return obj; }, - toJSON(message: EnumValueOptions): unknown { + toJSON(message: EnumValueOptions): JsonSafe { const obj: any = {}; message.deprecated !== undefined && (obj.deprecated = message.deprecated); if (message.uninterpretedOption) { @@ -5780,7 +5781,7 @@ export const ServiceOptions = { if (Array.isArray(object?.uninterpretedOption)) obj.uninterpretedOption = object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)); return obj; }, - toJSON(message: ServiceOptions): unknown { + toJSON(message: ServiceOptions): JsonSafe { const obj: any = {}; message.deprecated !== undefined && (obj.deprecated = message.deprecated); if (message.uninterpretedOption) { @@ -5913,7 +5914,7 @@ export const MethodOptions = { if (Array.isArray(object?.uninterpretedOption)) obj.uninterpretedOption = object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)); return obj; }, - toJSON(message: MethodOptions): unknown { + toJSON(message: MethodOptions): JsonSafe { const obj: any = {}; message.deprecated !== undefined && (obj.deprecated = message.deprecated); message.idempotencyLevel !== undefined && (obj.idempotencyLevel = methodOptions_IdempotencyLevelToJSON(message.idempotencyLevel)); @@ -6087,7 +6088,7 @@ export const UninterpretedOption = { if (isSet(object.aggregateValue)) obj.aggregateValue = String(object.aggregateValue); return obj; }, - toJSON(message: UninterpretedOption): unknown { + toJSON(message: UninterpretedOption): JsonSafe { const obj: any = {}; if (message.name) { obj.name = message.name.map(e => e ? UninterpretedOption_NamePart.toJSON(e) : undefined); @@ -6261,7 +6262,7 @@ export const UninterpretedOption_NamePart = { if (isSet(object.isExtension)) obj.isExtension = Boolean(object.isExtension); return obj; }, - toJSON(message: UninterpretedOption_NamePart): unknown { + toJSON(message: UninterpretedOption_NamePart): JsonSafe { const obj: any = {}; message.namePart !== undefined && (obj.namePart = message.namePart); message.isExtension !== undefined && (obj.isExtension = message.isExtension); @@ -6368,7 +6369,7 @@ export const SourceCodeInfo = { if (Array.isArray(object?.location)) obj.location = object.location.map((e: any) => SourceCodeInfo_Location.fromJSON(e)); return obj; }, - toJSON(message: SourceCodeInfo): unknown { + toJSON(message: SourceCodeInfo): JsonSafe { const obj: any = {}; if (message.location) { obj.location = message.location.map(e => e ? SourceCodeInfo_Location.toJSON(e) : undefined); @@ -6526,7 +6527,7 @@ export const SourceCodeInfo_Location = { if (Array.isArray(object?.leadingDetachedComments)) obj.leadingDetachedComments = object.leadingDetachedComments.map((e: any) => String(e)); return obj; }, - toJSON(message: SourceCodeInfo_Location): unknown { + toJSON(message: SourceCodeInfo_Location): JsonSafe { const obj: any = {}; if (message.path) { obj.path = message.path.map(e => Math.round(e)); @@ -6690,7 +6691,7 @@ export const GeneratedCodeInfo = { if (Array.isArray(object?.annotation)) obj.annotation = object.annotation.map((e: any) => GeneratedCodeInfo_Annotation.fromJSON(e)); return obj; }, - toJSON(message: GeneratedCodeInfo): unknown { + toJSON(message: GeneratedCodeInfo): JsonSafe { const obj: any = {}; if (message.annotation) { obj.annotation = message.annotation.map(e => e ? GeneratedCodeInfo_Annotation.toJSON(e) : undefined); @@ -6831,7 +6832,7 @@ export const GeneratedCodeInfo_Annotation = { if (isSet(object.end)) obj.end = Number(object.end); return obj; }, - toJSON(message: GeneratedCodeInfo_Annotation): unknown { + toJSON(message: GeneratedCodeInfo_Annotation): JsonSafe { const obj: any = {}; if (message.path) { obj.path = message.path.map(e => Math.round(e)); diff --git a/__fixtures__/misc/output-impl-interfaces-gen/google/protobuf/timestamp.ts b/__fixtures__/misc/output-impl-interfaces-gen/google/protobuf/timestamp.ts index 0e4a89752a..53a172ba59 100644 --- a/__fixtures__/misc/output-impl-interfaces-gen/google/protobuf/timestamp.ts +++ b/__fixtures__/misc/output-impl-interfaces-gen/google/protobuf/timestamp.ts @@ -1,5 +1,6 @@ import { BinaryReader, BinaryWriter } from "../../binary"; import { isSet, DeepPartial, fromJsonTimestamp, fromTimestamp } from "../../helpers"; +import { JsonSafe } from "../../json-safe"; import { GlobalDecoderRegistry } from "../../registry"; export const protobufPackage = "google.protobuf"; /** @@ -334,7 +335,7 @@ export const Timestamp = { if (isSet(object.nanos)) obj.nanos = Number(object.nanos); return obj; }, - toJSON(message: Timestamp): unknown { + toJSON(message: Timestamp): JsonSafe { const obj: any = {}; message.seconds !== undefined && (obj.seconds = (message.seconds || BigInt(0)).toString()); message.nanos !== undefined && (obj.nanos = Math.round(message.nanos)); diff --git a/__fixtures__/misc/output-impl-interfaces-gen/index.ts b/__fixtures__/misc/output-impl-interfaces-gen/index.ts index 9f2cc24385..13a1dd1948 100644 --- a/__fixtures__/misc/output-impl-interfaces-gen/index.ts +++ b/__fixtures__/misc/output-impl-interfaces-gen/index.ts @@ -14,6 +14,7 @@ export * from "./extern"; export * from "./react-query"; export * from "./mobx"; export * from "./pinia-endpoint"; +export * from "./json-safe"; export * from "./varint"; export * from "./utf8"; export * from "./binary"; diff --git a/__fixtures__/misc/output-impl-interfaces-gen/json-safe.ts b/__fixtures__/misc/output-impl-interfaces-gen/json-safe.ts new file mode 100644 index 0000000000..7d46f89144 --- /dev/null +++ b/__fixtures__/misc/output-impl-interfaces-gen/json-safe.ts @@ -0,0 +1,10 @@ +/** +* This file and any referenced files were automatically generated by @cosmology/telescope@latest +* DO NOT MODIFY BY HAND. Instead, download the latest proto files for your chain +* and run the transpile command or npm scripts command that is used to regenerate this bundle. +*/ + + +export type JsonSafe = { + [Prop in keyof T]: T[Prop] extends Uint8Array ? string : T[Prop] extends bigint ? string : T[Prop]; +} diff --git a/__fixtures__/misc/output-proto-amino/amino-interface-proto-optionality/google/api/expr/v1alpha1/eval.ts b/__fixtures__/misc/output-proto-amino/amino-interface-proto-optionality/google/api/expr/v1alpha1/eval.ts index eb9d77b6fa..a6fc378487 100644 --- a/__fixtures__/misc/output-proto-amino/amino-interface-proto-optionality/google/api/expr/v1alpha1/eval.ts +++ b/__fixtures__/misc/output-proto-amino/amino-interface-proto-optionality/google/api/expr/v1alpha1/eval.ts @@ -1,4 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../../binary"; +import { JsonSafe } from "../../../../json-safe"; import { DeepPartial, isSet } from "../../../../helpers"; import { GlobalDecoderRegistry } from "../../../../registry"; export const protobufPackage = "google.api.expr.v1alpha1"; @@ -84,7 +85,7 @@ export const ExprValue = { if (Array.isArray(object?.exprs)) obj.exprs = object.exprs.map((e: any) => IdRef.fromJSON(e)); return obj; }, - toJSON(message: ExprValue): unknown { + toJSON(message: ExprValue): JsonSafe { const obj: any = {}; if (message.exprs) { obj.exprs = message.exprs.map(e => e ? IdRef.toJSON(e) : undefined); @@ -192,7 +193,7 @@ export const IdRef = { if (isSet(object.id)) obj.id = Number(object.id); return obj; }, - toJSON(message: IdRef): unknown { + toJSON(message: IdRef): JsonSafe { const obj: any = {}; message.id !== undefined && (obj.id = Math.round(message.id)); return obj; diff --git a/__fixtures__/misc/output-proto-amino/amino-interface-proto-optionality/google/protobuf/any.ts b/__fixtures__/misc/output-proto-amino/amino-interface-proto-optionality/google/protobuf/any.ts index 40c2c5a106..ee72f40971 100644 --- a/__fixtures__/misc/output-proto-amino/amino-interface-proto-optionality/google/protobuf/any.ts +++ b/__fixtures__/misc/output-proto-amino/amino-interface-proto-optionality/google/protobuf/any.ts @@ -1,5 +1,6 @@ import { BinaryReader, BinaryWriter } from "../../binary"; import { isSet, bytesFromBase64, base64FromBytes, DeepPartial } from "../../helpers"; +import { JsonSafe } from "../../json-safe"; export const protobufPackage = "google.protobuf"; /** * `Any` contains an arbitrary serialized protocol buffer message along with a @@ -379,7 +380,7 @@ export const Any = { if (isSet(object.value)) obj.value = bytesFromBase64(object.value); return obj; }, - toJSON(message: Any): unknown { + toJSON(message: Any): JsonSafe { const obj: any = {}; message.typeUrl !== undefined && (obj.typeUrl = message.typeUrl); message.value !== undefined && (obj.value = base64FromBytes(message.value !== undefined ? message.value : new Uint8Array())); diff --git a/__fixtures__/misc/output-proto-amino/amino-interface-proto-optionality/google/protobuf/descriptor.ts b/__fixtures__/misc/output-proto-amino/amino-interface-proto-optionality/google/protobuf/descriptor.ts index 434c3cefad..d0ab236df6 100644 --- a/__fixtures__/misc/output-proto-amino/amino-interface-proto-optionality/google/protobuf/descriptor.ts +++ b/__fixtures__/misc/output-proto-amino/amino-interface-proto-optionality/google/protobuf/descriptor.ts @@ -1,4 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../binary"; +import { JsonSafe } from "../../json-safe"; import { DeepPartial, isSet, bytesFromBase64, base64FromBytes } from "../../helpers"; import { GlobalDecoderRegistry } from "../../registry"; export const protobufPackage = "google.protobuf"; @@ -2303,7 +2304,7 @@ export const FileDescriptorSet = { if (Array.isArray(object?.file)) obj.file = object.file.map((e: any) => FileDescriptorProto.fromJSON(e)); return obj; }, - toJSON(message: FileDescriptorSet): unknown { + toJSON(message: FileDescriptorSet): JsonSafe { const obj: any = {}; if (message.file) { obj.file = message.file.map(e => e ? FileDescriptorProto.toJSON(e) : undefined); @@ -2517,7 +2518,7 @@ export const FileDescriptorProto = { if (isSet(object.syntax)) obj.syntax = String(object.syntax); return obj; }, - toJSON(message: FileDescriptorProto): unknown { + toJSON(message: FileDescriptorProto): JsonSafe { const obj: any = {}; message.name !== undefined && (obj.name = message.name); message.package !== undefined && (obj.package = message.package); @@ -2860,7 +2861,7 @@ export const DescriptorProto = { if (Array.isArray(object?.reservedName)) obj.reservedName = object.reservedName.map((e: any) => String(e)); return obj; }, - toJSON(message: DescriptorProto): unknown { + toJSON(message: DescriptorProto): JsonSafe { const obj: any = {}; message.name !== undefined && (obj.name = message.name); if (message.field) { @@ -3137,7 +3138,7 @@ export const DescriptorProto_ExtensionRange = { if (isSet(object.options)) obj.options = ExtensionRangeOptions.fromJSON(object.options); return obj; }, - toJSON(message: DescriptorProto_ExtensionRange): unknown { + toJSON(message: DescriptorProto_ExtensionRange): JsonSafe { const obj: any = {}; message.start !== undefined && (obj.start = Math.round(message.start)); message.end !== undefined && (obj.end = Math.round(message.end)); @@ -3263,7 +3264,7 @@ export const DescriptorProto_ReservedRange = { if (isSet(object.end)) obj.end = Number(object.end); return obj; }, - toJSON(message: DescriptorProto_ReservedRange): unknown { + toJSON(message: DescriptorProto_ReservedRange): JsonSafe { const obj: any = {}; message.start !== undefined && (obj.start = Math.round(message.start)); message.end !== undefined && (obj.end = Math.round(message.end)); @@ -3370,7 +3371,7 @@ export const ExtensionRangeOptions = { if (Array.isArray(object?.uninterpretedOption)) obj.uninterpretedOption = object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)); return obj; }, - toJSON(message: ExtensionRangeOptions): unknown { + toJSON(message: ExtensionRangeOptions): JsonSafe { const obj: any = {}; if (message.uninterpretedOption) { obj.uninterpretedOption = message.uninterpretedOption.map(e => e ? UninterpretedOption.toJSON(e) : undefined); @@ -3550,7 +3551,7 @@ export const FieldDescriptorProto = { if (isSet(object.options)) obj.options = FieldOptions.fromJSON(object.options); return obj; }, - toJSON(message: FieldDescriptorProto): unknown { + toJSON(message: FieldDescriptorProto): JsonSafe { const obj: any = {}; message.name !== undefined && (obj.name = message.name); message.number !== undefined && (obj.number = Math.round(message.number)); @@ -3739,7 +3740,7 @@ export const OneofDescriptorProto = { if (isSet(object.options)) obj.options = OneofOptions.fromJSON(object.options); return obj; }, - toJSON(message: OneofDescriptorProto): unknown { + toJSON(message: OneofDescriptorProto): JsonSafe { const obj: any = {}; message.name !== undefined && (obj.name = message.name); message.options !== undefined && (obj.options = message.options ? OneofOptions.toJSON(message.options) : undefined); @@ -3880,7 +3881,7 @@ export const EnumDescriptorProto = { if (Array.isArray(object?.reservedName)) obj.reservedName = object.reservedName.map((e: any) => String(e)); return obj; }, - toJSON(message: EnumDescriptorProto): unknown { + toJSON(message: EnumDescriptorProto): JsonSafe { const obj: any = {}; message.name !== undefined && (obj.name = message.name); if (message.value) { @@ -4054,7 +4055,7 @@ export const EnumDescriptorProto_EnumReservedRange = { if (isSet(object.end)) obj.end = Number(object.end); return obj; }, - toJSON(message: EnumDescriptorProto_EnumReservedRange): unknown { + toJSON(message: EnumDescriptorProto_EnumReservedRange): JsonSafe { const obj: any = {}; message.start !== undefined && (obj.start = Math.round(message.start)); message.end !== undefined && (obj.end = Math.round(message.end)); @@ -4177,7 +4178,7 @@ export const EnumValueDescriptorProto = { if (isSet(object.options)) obj.options = EnumValueOptions.fromJSON(object.options); return obj; }, - toJSON(message: EnumValueDescriptorProto): unknown { + toJSON(message: EnumValueDescriptorProto): JsonSafe { const obj: any = {}; message.name !== undefined && (obj.name = message.name); message.number !== undefined && (obj.number = Math.round(message.number)); @@ -4311,7 +4312,7 @@ export const ServiceDescriptorProto = { if (isSet(object.options)) obj.options = ServiceOptions.fromJSON(object.options); return obj; }, - toJSON(message: ServiceDescriptorProto): unknown { + toJSON(message: ServiceDescriptorProto): JsonSafe { const obj: any = {}; message.name !== undefined && (obj.name = message.name); if (message.method) { @@ -4479,7 +4480,7 @@ export const MethodDescriptorProto = { if (isSet(object.serverStreaming)) obj.serverStreaming = Boolean(object.serverStreaming); return obj; }, - toJSON(message: MethodDescriptorProto): unknown { + toJSON(message: MethodDescriptorProto): JsonSafe { const obj: any = {}; message.name !== undefined && (obj.name = message.name); message.inputType !== undefined && (obj.inputType = message.inputType); @@ -4784,7 +4785,7 @@ export const FileOptions = { if (Array.isArray(object?.uninterpretedOption)) obj.uninterpretedOption = object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)); return obj; }, - toJSON(message: FileOptions): unknown { + toJSON(message: FileOptions): JsonSafe { const obj: any = {}; message.javaPackage !== undefined && (obj.javaPackage = message.javaPackage); message.javaOuterClassname !== undefined && (obj.javaOuterClassname = message.javaOuterClassname); @@ -5104,7 +5105,7 @@ export const MessageOptions = { if (Array.isArray(object?.uninterpretedOption)) obj.uninterpretedOption = object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)); return obj; }, - toJSON(message: MessageOptions): unknown { + toJSON(message: MessageOptions): JsonSafe { const obj: any = {}; message.messageSetWireFormat !== undefined && (obj.messageSetWireFormat = message.messageSetWireFormat); message.noStandardDescriptorAccessor !== undefined && (obj.noStandardDescriptorAccessor = message.noStandardDescriptorAccessor); @@ -5296,7 +5297,7 @@ export const FieldOptions = { if (Array.isArray(object?.uninterpretedOption)) obj.uninterpretedOption = object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)); return obj; }, - toJSON(message: FieldOptions): unknown { + toJSON(message: FieldOptions): JsonSafe { const obj: any = {}; message.ctype !== undefined && (obj.ctype = fieldOptions_CTypeToJSON(message.ctype)); message.packed !== undefined && (obj.packed = message.packed); @@ -5458,7 +5459,7 @@ export const OneofOptions = { if (Array.isArray(object?.uninterpretedOption)) obj.uninterpretedOption = object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)); return obj; }, - toJSON(message: OneofOptions): unknown { + toJSON(message: OneofOptions): JsonSafe { const obj: any = {}; if (message.uninterpretedOption) { obj.uninterpretedOption = message.uninterpretedOption.map(e => e ? UninterpretedOption.toJSON(e) : undefined); @@ -5582,7 +5583,7 @@ export const EnumOptions = { if (Array.isArray(object?.uninterpretedOption)) obj.uninterpretedOption = object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)); return obj; }, - toJSON(message: EnumOptions): unknown { + toJSON(message: EnumOptions): JsonSafe { const obj: any = {}; message.allowAlias !== undefined && (obj.allowAlias = message.allowAlias); message.deprecated !== undefined && (obj.deprecated = message.deprecated); @@ -5716,7 +5717,7 @@ export const EnumValueOptions = { if (Array.isArray(object?.uninterpretedOption)) obj.uninterpretedOption = object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)); return obj; }, - toJSON(message: EnumValueOptions): unknown { + toJSON(message: EnumValueOptions): JsonSafe { const obj: any = {}; message.deprecated !== undefined && (obj.deprecated = message.deprecated); if (message.uninterpretedOption) { @@ -5841,7 +5842,7 @@ export const ServiceOptions = { if (Array.isArray(object?.uninterpretedOption)) obj.uninterpretedOption = object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)); return obj; }, - toJSON(message: ServiceOptions): unknown { + toJSON(message: ServiceOptions): JsonSafe { const obj: any = {}; message.deprecated !== undefined && (obj.deprecated = message.deprecated); if (message.uninterpretedOption) { @@ -5974,7 +5975,7 @@ export const MethodOptions = { if (Array.isArray(object?.uninterpretedOption)) obj.uninterpretedOption = object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)); return obj; }, - toJSON(message: MethodOptions): unknown { + toJSON(message: MethodOptions): JsonSafe { const obj: any = {}; message.deprecated !== undefined && (obj.deprecated = message.deprecated); message.idempotencyLevel !== undefined && (obj.idempotencyLevel = methodOptions_IdempotencyLevelToJSON(message.idempotencyLevel)); @@ -6148,7 +6149,7 @@ export const UninterpretedOption = { if (isSet(object.aggregateValue)) obj.aggregateValue = String(object.aggregateValue); return obj; }, - toJSON(message: UninterpretedOption): unknown { + toJSON(message: UninterpretedOption): JsonSafe { const obj: any = {}; if (message.name) { obj.name = message.name.map(e => e ? UninterpretedOption_NamePart.toJSON(e) : undefined); @@ -6322,7 +6323,7 @@ export const UninterpretedOption_NamePart = { if (isSet(object.isExtension)) obj.isExtension = Boolean(object.isExtension); return obj; }, - toJSON(message: UninterpretedOption_NamePart): unknown { + toJSON(message: UninterpretedOption_NamePart): JsonSafe { const obj: any = {}; message.namePart !== undefined && (obj.namePart = message.namePart); message.isExtension !== undefined && (obj.isExtension = message.isExtension); @@ -6429,7 +6430,7 @@ export const SourceCodeInfo = { if (Array.isArray(object?.location)) obj.location = object.location.map((e: any) => SourceCodeInfo_Location.fromJSON(e)); return obj; }, - toJSON(message: SourceCodeInfo): unknown { + toJSON(message: SourceCodeInfo): JsonSafe { const obj: any = {}; if (message.location) { obj.location = message.location.map(e => e ? SourceCodeInfo_Location.toJSON(e) : undefined); @@ -6587,7 +6588,7 @@ export const SourceCodeInfo_Location = { if (Array.isArray(object?.leadingDetachedComments)) obj.leadingDetachedComments = object.leadingDetachedComments.map((e: any) => String(e)); return obj; }, - toJSON(message: SourceCodeInfo_Location): unknown { + toJSON(message: SourceCodeInfo_Location): JsonSafe { const obj: any = {}; if (message.path) { obj.path = message.path.map(e => Math.round(e)); @@ -6751,7 +6752,7 @@ export const GeneratedCodeInfo = { if (Array.isArray(object?.annotation)) obj.annotation = object.annotation.map((e: any) => GeneratedCodeInfo_Annotation.fromJSON(e)); return obj; }, - toJSON(message: GeneratedCodeInfo): unknown { + toJSON(message: GeneratedCodeInfo): JsonSafe { const obj: any = {}; if (message.annotation) { obj.annotation = message.annotation.map(e => e ? GeneratedCodeInfo_Annotation.toJSON(e) : undefined); @@ -6892,7 +6893,7 @@ export const GeneratedCodeInfo_Annotation = { if (isSet(object.end)) obj.end = Number(object.end); return obj; }, - toJSON(message: GeneratedCodeInfo_Annotation): unknown { + toJSON(message: GeneratedCodeInfo_Annotation): JsonSafe { const obj: any = {}; if (message.path) { obj.path = message.path.map(e => Math.round(e)); @@ -7027,7 +7028,7 @@ export const FeatureSet = { if (isSet(object.utf8Validation)) obj.utf8Validation = featureSet_Utf8ValidationFromJSON(object.utf8Validation); return obj; }, - toJSON(message: FeatureSet): unknown { + toJSON(message: FeatureSet): JsonSafe { const obj: any = {}; message.utf8Validation !== undefined && (obj.utf8Validation = featureSet_Utf8ValidationToJSON(message.utf8Validation)); return obj; diff --git a/__fixtures__/misc/output-proto-amino/amino-interface-proto-optionality/google/protobuf/duration.ts b/__fixtures__/misc/output-proto-amino/amino-interface-proto-optionality/google/protobuf/duration.ts index a14bb9cdce..0d6de1ae46 100644 --- a/__fixtures__/misc/output-proto-amino/amino-interface-proto-optionality/google/protobuf/duration.ts +++ b/__fixtures__/misc/output-proto-amino/amino-interface-proto-optionality/google/protobuf/duration.ts @@ -1,5 +1,6 @@ import { BinaryReader, BinaryWriter } from "../../binary"; import { isSet, DeepPartial } from "../../helpers"; +import { JsonSafe } from "../../json-safe"; import { GlobalDecoderRegistry } from "../../registry"; export const protobufPackage = "google.protobuf"; /** @@ -264,7 +265,7 @@ export const Duration = { if (isSet(object.nanos)) obj.nanos = Number(object.nanos); return obj; }, - toJSON(message: Duration): unknown { + toJSON(message: Duration): JsonSafe { const obj: any = {}; message.seconds !== undefined && (obj.seconds = (message.seconds || BigInt(0)).toString()); message.nanos !== undefined && (obj.nanos = Math.round(message.nanos)); diff --git a/__fixtures__/misc/output-proto-amino/amino-interface-proto-optionality/google/protobuf/timestamp.ts b/__fixtures__/misc/output-proto-amino/amino-interface-proto-optionality/google/protobuf/timestamp.ts index 0e4a89752a..53a172ba59 100644 --- a/__fixtures__/misc/output-proto-amino/amino-interface-proto-optionality/google/protobuf/timestamp.ts +++ b/__fixtures__/misc/output-proto-amino/amino-interface-proto-optionality/google/protobuf/timestamp.ts @@ -1,5 +1,6 @@ import { BinaryReader, BinaryWriter } from "../../binary"; import { isSet, DeepPartial, fromJsonTimestamp, fromTimestamp } from "../../helpers"; +import { JsonSafe } from "../../json-safe"; import { GlobalDecoderRegistry } from "../../registry"; export const protobufPackage = "google.protobuf"; /** @@ -334,7 +335,7 @@ export const Timestamp = { if (isSet(object.nanos)) obj.nanos = Number(object.nanos); return obj; }, - toJSON(message: Timestamp): unknown { + toJSON(message: Timestamp): JsonSafe { const obj: any = {}; message.seconds !== undefined && (obj.seconds = (message.seconds || BigInt(0)).toString()); message.nanos !== undefined && (obj.nanos = Math.round(message.nanos)); diff --git a/__fixtures__/misc/output-proto-amino/amino-interface-proto-optionality/index.ts b/__fixtures__/misc/output-proto-amino/amino-interface-proto-optionality/index.ts index d06511f29e..8f82ffbfd7 100644 --- a/__fixtures__/misc/output-proto-amino/amino-interface-proto-optionality/index.ts +++ b/__fixtures__/misc/output-proto-amino/amino-interface-proto-optionality/index.ts @@ -12,6 +12,7 @@ export * from "./extern"; export * from "./react-query"; export * from "./mobx"; export * from "./pinia-endpoint"; +export * from "./json-safe"; export * from "./varint"; export * from "./utf8"; export * from "./binary"; diff --git a/__fixtures__/misc/output-proto-amino/amino-interface-proto-optionality/json-safe.ts b/__fixtures__/misc/output-proto-amino/amino-interface-proto-optionality/json-safe.ts new file mode 100644 index 0000000000..7d46f89144 --- /dev/null +++ b/__fixtures__/misc/output-proto-amino/amino-interface-proto-optionality/json-safe.ts @@ -0,0 +1,10 @@ +/** +* This file and any referenced files were automatically generated by @cosmology/telescope@latest +* DO NOT MODIFY BY HAND. Instead, download the latest proto files for your chain +* and run the transpile command or npm scripts command that is used to regenerate this bundle. +*/ + + +export type JsonSafe = { + [Prop in keyof T]: T[Prop] extends Uint8Array ? string : T[Prop] extends bigint ? string : T[Prop]; +} diff --git a/__fixtures__/misc/output-proto-amino/amino-interface-proto-optionality/misc/all_fields.ts b/__fixtures__/misc/output-proto-amino/amino-interface-proto-optionality/misc/all_fields.ts index eca657c32a..e614153e15 100644 --- a/__fixtures__/misc/output-proto-amino/amino-interface-proto-optionality/misc/all_fields.ts +++ b/__fixtures__/misc/output-proto-amino/amino-interface-proto-optionality/misc/all_fields.ts @@ -5,6 +5,7 @@ import { Timestamp, TimestampAmino, TimestampSDKType } from "../google/protobuf/ import { isSet, toTimestamp, fromTimestamp, bytesFromBase64, base64FromBytes, DeepPartial } from "../helpers"; import { BinaryReader, BinaryWriter } from "../binary"; import { Decimal } from "@cosmjs/math"; +import { JsonSafe } from "../json-safe"; import { toUtf8, fromBase64, fromUtf8, toBase64 } from "@cosmjs/encoding"; import { encodePubkey, decodePubkey } from "@cosmjs/proto-signing"; import { GlobalDecoderRegistry } from "../registry"; @@ -903,7 +904,7 @@ export const EncodingTestForDontOmit = { if (Array.isArray(object?.dODecs)) obj.dODecs = object.dODecs.map((e: any) => String(e)); return obj; }, - toJSON(message: EncodingTestForDontOmit): unknown { + toJSON(message: EncodingTestForDontOmit): JsonSafe { const obj: any = {}; message.str !== undefined && (obj.str = message.str); message.dOStr !== undefined && (obj.dOStr = message.dOStr); @@ -2077,7 +2078,7 @@ export const EncodingTestForOmit = { if (Array.isArray(object?.oDecs)) obj.oDecs = object.oDecs.map((e: any) => String(e)); return obj; }, - toJSON(message: EncodingTestForOmit): unknown { + toJSON(message: EncodingTestForOmit): JsonSafe { const obj: any = {}; message.str !== undefined && (obj.str = message.str); message.oStr !== undefined && (obj.oStr = message.oStr); diff --git a/__fixtures__/misc/output-proto-amino/amino-interface-proto-optionality/misc/eval_request.ts b/__fixtures__/misc/output-proto-amino/amino-interface-proto-optionality/misc/eval_request.ts index e6557fa7b8..6c4de8f42c 100644 --- a/__fixtures__/misc/output-proto-amino/amino-interface-proto-optionality/misc/eval_request.ts +++ b/__fixtures__/misc/output-proto-amino/amino-interface-proto-optionality/misc/eval_request.ts @@ -2,6 +2,7 @@ import { ExprValue, ExprValueAmino, ExprValueSDKType, IdRef, IdRefAmino, IdRefSD import { FeatureSet_Utf8Validation, featureSet_Utf8ValidationFromJSON, featureSet_Utf8ValidationToJSON } from "../google/protobuf/descriptor"; import { BinaryReader, BinaryWriter } from "../binary"; import { isSet, DeepPartial, isObject } from "../helpers"; +import { JsonSafe } from "../json-safe"; import { GlobalDecoderRegistry } from "../registry"; export const protobufPackage = "misc"; /** VoteOption enumerates the valid vote options for a given governance proposal. */ @@ -246,7 +247,7 @@ export const EvalRequest_BindingsEntry = { if (isSet(object.value)) obj.value = ExprValue.fromJSON(object.value); return obj; }, - toJSON(message: EvalRequest_BindingsEntry): unknown { + toJSON(message: EvalRequest_BindingsEntry): JsonSafe { const obj: any = {}; message.key !== undefined && (obj.key = message.key); message.value !== undefined && (obj.value = message.value ? ExprValue.toJSON(message.value) : undefined); @@ -346,7 +347,7 @@ export const EvalRequest_RefsEntry = { if (isSet(object.value)) obj.value = IdRef.fromJSON(object.value); return obj; }, - toJSON(message: EvalRequest_RefsEntry): unknown { + toJSON(message: EvalRequest_RefsEntry): JsonSafe { const obj: any = {}; message.key !== undefined && (obj.key = message.key); message.value !== undefined && (obj.value = message.value ? IdRef.toJSON(message.value) : undefined); @@ -542,7 +543,7 @@ export const EvalRequest = { if (isSet(object.opt)) obj.opt = featureSet_Utf8ValidationFromJSON(object.opt); return obj; }, - toJSON(message: EvalRequest): unknown { + toJSON(message: EvalRequest): JsonSafe { const obj: any = {}; obj.bindings = {}; if (message.bindings) { @@ -807,7 +808,7 @@ export const AccessConfig = { if (isSet(object.sender)) obj.sender = String(object.sender); return obj; }, - toJSON(message: AccessConfig): unknown { + toJSON(message: AccessConfig): JsonSafe { const obj: any = {}; message.sender !== undefined && (obj.sender = message.sender); return obj; @@ -906,7 +907,7 @@ export const GenericAuthorization = { if (isSet(object.msg)) obj.msg = String(object.msg); return obj; }, - toJSON(message: GenericAuthorization): unknown { + toJSON(message: GenericAuthorization): JsonSafe { const obj: any = {}; message.msg !== undefined && (obj.msg = message.msg); return obj; diff --git a/__fixtures__/misc/output-proto-amino/amino-interface-proto-optionality/misc/tx.ts b/__fixtures__/misc/output-proto-amino/amino-interface-proto-optionality/misc/tx.ts index ab5e05c6ec..22f98f8aaa 100644 --- a/__fixtures__/misc/output-proto-amino/amino-interface-proto-optionality/misc/tx.ts +++ b/__fixtures__/misc/output-proto-amino/amino-interface-proto-optionality/misc/tx.ts @@ -1,6 +1,7 @@ import { EncodingTestForDontOmit, EncodingTestForDontOmitAmino, EncodingTestForDontOmitSDKType, EncodingTestForOmit, EncodingTestForOmitAmino, EncodingTestForOmitSDKType } from "./all_fields"; import { BinaryReader, BinaryWriter } from "../binary"; import { isSet, DeepPartial } from "../helpers"; +import { JsonSafe } from "../json-safe"; import { GlobalDecoderRegistry } from "../registry"; export const protobufPackage = "misc"; /** @@ -101,7 +102,7 @@ export const InputMsg = { if (isSet(object.oTests)) obj.oTests = EncodingTestForOmit.fromJSON(object.oTests); return obj; }, - toJSON(message: InputMsg): unknown { + toJSON(message: InputMsg): JsonSafe { const obj: any = {}; message.dOTests !== undefined && (obj.dOTests = message.dOTests ? EncodingTestForDontOmit.toJSON(message.dOTests) : undefined); message.oTests !== undefined && (obj.oTests = message.oTests ? EncodingTestForOmit.toJSON(message.oTests) : undefined); @@ -203,7 +204,7 @@ export const MsgResponse = { const obj = createBaseMsgResponse(); return obj; }, - toJSON(_: MsgResponse): unknown { + toJSON(_: MsgResponse): JsonSafe { const obj: any = {}; return obj; }, diff --git a/__fixtures__/misc/output-proto-amino/amino-interface/google/api/expr/v1alpha1/eval.ts b/__fixtures__/misc/output-proto-amino/amino-interface/google/api/expr/v1alpha1/eval.ts index 4a1a836a78..9f4b3de2c0 100644 --- a/__fixtures__/misc/output-proto-amino/amino-interface/google/api/expr/v1alpha1/eval.ts +++ b/__fixtures__/misc/output-proto-amino/amino-interface/google/api/expr/v1alpha1/eval.ts @@ -1,4 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../../binary"; +import { JsonSafe } from "../../../../json-safe"; import { DeepPartial, isSet } from "../../../../helpers"; import { GlobalDecoderRegistry } from "../../../../registry"; export const protobufPackage = "google.api.expr.v1alpha1"; @@ -84,7 +85,7 @@ export const ExprValue = { if (Array.isArray(object?.exprs)) obj.exprs = object.exprs.map((e: any) => IdRef.fromJSON(e)); return obj; }, - toJSON(message: ExprValue): unknown { + toJSON(message: ExprValue): JsonSafe { const obj: any = {}; if (message.exprs) { obj.exprs = message.exprs.map(e => e ? IdRef.toJSON(e) : undefined); @@ -192,7 +193,7 @@ export const IdRef = { if (isSet(object.id)) obj.id = Number(object.id); return obj; }, - toJSON(message: IdRef): unknown { + toJSON(message: IdRef): JsonSafe { const obj: any = {}; message.id !== undefined && (obj.id = Math.round(message.id)); return obj; diff --git a/__fixtures__/misc/output-proto-amino/amino-interface/google/protobuf/any.ts b/__fixtures__/misc/output-proto-amino/amino-interface/google/protobuf/any.ts index 40c2c5a106..ee72f40971 100644 --- a/__fixtures__/misc/output-proto-amino/amino-interface/google/protobuf/any.ts +++ b/__fixtures__/misc/output-proto-amino/amino-interface/google/protobuf/any.ts @@ -1,5 +1,6 @@ import { BinaryReader, BinaryWriter } from "../../binary"; import { isSet, bytesFromBase64, base64FromBytes, DeepPartial } from "../../helpers"; +import { JsonSafe } from "../../json-safe"; export const protobufPackage = "google.protobuf"; /** * `Any` contains an arbitrary serialized protocol buffer message along with a @@ -379,7 +380,7 @@ export const Any = { if (isSet(object.value)) obj.value = bytesFromBase64(object.value); return obj; }, - toJSON(message: Any): unknown { + toJSON(message: Any): JsonSafe { const obj: any = {}; message.typeUrl !== undefined && (obj.typeUrl = message.typeUrl); message.value !== undefined && (obj.value = base64FromBytes(message.value !== undefined ? message.value : new Uint8Array())); diff --git a/__fixtures__/misc/output-proto-amino/amino-interface/google/protobuf/descriptor.ts b/__fixtures__/misc/output-proto-amino/amino-interface/google/protobuf/descriptor.ts index 008291a5a3..df7f0111b3 100644 --- a/__fixtures__/misc/output-proto-amino/amino-interface/google/protobuf/descriptor.ts +++ b/__fixtures__/misc/output-proto-amino/amino-interface/google/protobuf/descriptor.ts @@ -1,4 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../binary"; +import { JsonSafe } from "../../json-safe"; import { DeepPartial, isSet, bytesFromBase64, base64FromBytes } from "../../helpers"; import { GlobalDecoderRegistry } from "../../registry"; export const protobufPackage = "google.protobuf"; @@ -2303,7 +2304,7 @@ export const FileDescriptorSet = { if (Array.isArray(object?.file)) obj.file = object.file.map((e: any) => FileDescriptorProto.fromJSON(e)); return obj; }, - toJSON(message: FileDescriptorSet): unknown { + toJSON(message: FileDescriptorSet): JsonSafe { const obj: any = {}; if (message.file) { obj.file = message.file.map(e => e ? FileDescriptorProto.toJSON(e) : undefined); @@ -2517,7 +2518,7 @@ export const FileDescriptorProto = { if (isSet(object.syntax)) obj.syntax = String(object.syntax); return obj; }, - toJSON(message: FileDescriptorProto): unknown { + toJSON(message: FileDescriptorProto): JsonSafe { const obj: any = {}; message.name !== undefined && (obj.name = message.name); message.package !== undefined && (obj.package = message.package); @@ -2860,7 +2861,7 @@ export const DescriptorProto = { if (Array.isArray(object?.reservedName)) obj.reservedName = object.reservedName.map((e: any) => String(e)); return obj; }, - toJSON(message: DescriptorProto): unknown { + toJSON(message: DescriptorProto): JsonSafe { const obj: any = {}; message.name !== undefined && (obj.name = message.name); if (message.field) { @@ -3137,7 +3138,7 @@ export const DescriptorProto_ExtensionRange = { if (isSet(object.options)) obj.options = ExtensionRangeOptions.fromJSON(object.options); return obj; }, - toJSON(message: DescriptorProto_ExtensionRange): unknown { + toJSON(message: DescriptorProto_ExtensionRange): JsonSafe { const obj: any = {}; message.start !== undefined && (obj.start = Math.round(message.start)); message.end !== undefined && (obj.end = Math.round(message.end)); @@ -3263,7 +3264,7 @@ export const DescriptorProto_ReservedRange = { if (isSet(object.end)) obj.end = Number(object.end); return obj; }, - toJSON(message: DescriptorProto_ReservedRange): unknown { + toJSON(message: DescriptorProto_ReservedRange): JsonSafe { const obj: any = {}; message.start !== undefined && (obj.start = Math.round(message.start)); message.end !== undefined && (obj.end = Math.round(message.end)); @@ -3370,7 +3371,7 @@ export const ExtensionRangeOptions = { if (Array.isArray(object?.uninterpretedOption)) obj.uninterpretedOption = object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)); return obj; }, - toJSON(message: ExtensionRangeOptions): unknown { + toJSON(message: ExtensionRangeOptions): JsonSafe { const obj: any = {}; if (message.uninterpretedOption) { obj.uninterpretedOption = message.uninterpretedOption.map(e => e ? UninterpretedOption.toJSON(e) : undefined); @@ -3550,7 +3551,7 @@ export const FieldDescriptorProto = { if (isSet(object.options)) obj.options = FieldOptions.fromJSON(object.options); return obj; }, - toJSON(message: FieldDescriptorProto): unknown { + toJSON(message: FieldDescriptorProto): JsonSafe { const obj: any = {}; message.name !== undefined && (obj.name = message.name); message.number !== undefined && (obj.number = Math.round(message.number)); @@ -3739,7 +3740,7 @@ export const OneofDescriptorProto = { if (isSet(object.options)) obj.options = OneofOptions.fromJSON(object.options); return obj; }, - toJSON(message: OneofDescriptorProto): unknown { + toJSON(message: OneofDescriptorProto): JsonSafe { const obj: any = {}; message.name !== undefined && (obj.name = message.name); message.options !== undefined && (obj.options = message.options ? OneofOptions.toJSON(message.options) : undefined); @@ -3880,7 +3881,7 @@ export const EnumDescriptorProto = { if (Array.isArray(object?.reservedName)) obj.reservedName = object.reservedName.map((e: any) => String(e)); return obj; }, - toJSON(message: EnumDescriptorProto): unknown { + toJSON(message: EnumDescriptorProto): JsonSafe { const obj: any = {}; message.name !== undefined && (obj.name = message.name); if (message.value) { @@ -4054,7 +4055,7 @@ export const EnumDescriptorProto_EnumReservedRange = { if (isSet(object.end)) obj.end = Number(object.end); return obj; }, - toJSON(message: EnumDescriptorProto_EnumReservedRange): unknown { + toJSON(message: EnumDescriptorProto_EnumReservedRange): JsonSafe { const obj: any = {}; message.start !== undefined && (obj.start = Math.round(message.start)); message.end !== undefined && (obj.end = Math.round(message.end)); @@ -4177,7 +4178,7 @@ export const EnumValueDescriptorProto = { if (isSet(object.options)) obj.options = EnumValueOptions.fromJSON(object.options); return obj; }, - toJSON(message: EnumValueDescriptorProto): unknown { + toJSON(message: EnumValueDescriptorProto): JsonSafe { const obj: any = {}; message.name !== undefined && (obj.name = message.name); message.number !== undefined && (obj.number = Math.round(message.number)); @@ -4311,7 +4312,7 @@ export const ServiceDescriptorProto = { if (isSet(object.options)) obj.options = ServiceOptions.fromJSON(object.options); return obj; }, - toJSON(message: ServiceDescriptorProto): unknown { + toJSON(message: ServiceDescriptorProto): JsonSafe { const obj: any = {}; message.name !== undefined && (obj.name = message.name); if (message.method) { @@ -4479,7 +4480,7 @@ export const MethodDescriptorProto = { if (isSet(object.serverStreaming)) obj.serverStreaming = Boolean(object.serverStreaming); return obj; }, - toJSON(message: MethodDescriptorProto): unknown { + toJSON(message: MethodDescriptorProto): JsonSafe { const obj: any = {}; message.name !== undefined && (obj.name = message.name); message.inputType !== undefined && (obj.inputType = message.inputType); @@ -4784,7 +4785,7 @@ export const FileOptions = { if (Array.isArray(object?.uninterpretedOption)) obj.uninterpretedOption = object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)); return obj; }, - toJSON(message: FileOptions): unknown { + toJSON(message: FileOptions): JsonSafe { const obj: any = {}; message.javaPackage !== undefined && (obj.javaPackage = message.javaPackage); message.javaOuterClassname !== undefined && (obj.javaOuterClassname = message.javaOuterClassname); @@ -5104,7 +5105,7 @@ export const MessageOptions = { if (Array.isArray(object?.uninterpretedOption)) obj.uninterpretedOption = object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)); return obj; }, - toJSON(message: MessageOptions): unknown { + toJSON(message: MessageOptions): JsonSafe { const obj: any = {}; message.messageSetWireFormat !== undefined && (obj.messageSetWireFormat = message.messageSetWireFormat); message.noStandardDescriptorAccessor !== undefined && (obj.noStandardDescriptorAccessor = message.noStandardDescriptorAccessor); @@ -5296,7 +5297,7 @@ export const FieldOptions = { if (Array.isArray(object?.uninterpretedOption)) obj.uninterpretedOption = object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)); return obj; }, - toJSON(message: FieldOptions): unknown { + toJSON(message: FieldOptions): JsonSafe { const obj: any = {}; message.ctype !== undefined && (obj.ctype = fieldOptions_CTypeToJSON(message.ctype)); message.packed !== undefined && (obj.packed = message.packed); @@ -5458,7 +5459,7 @@ export const OneofOptions = { if (Array.isArray(object?.uninterpretedOption)) obj.uninterpretedOption = object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)); return obj; }, - toJSON(message: OneofOptions): unknown { + toJSON(message: OneofOptions): JsonSafe { const obj: any = {}; if (message.uninterpretedOption) { obj.uninterpretedOption = message.uninterpretedOption.map(e => e ? UninterpretedOption.toJSON(e) : undefined); @@ -5582,7 +5583,7 @@ export const EnumOptions = { if (Array.isArray(object?.uninterpretedOption)) obj.uninterpretedOption = object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)); return obj; }, - toJSON(message: EnumOptions): unknown { + toJSON(message: EnumOptions): JsonSafe { const obj: any = {}; message.allowAlias !== undefined && (obj.allowAlias = message.allowAlias); message.deprecated !== undefined && (obj.deprecated = message.deprecated); @@ -5716,7 +5717,7 @@ export const EnumValueOptions = { if (Array.isArray(object?.uninterpretedOption)) obj.uninterpretedOption = object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)); return obj; }, - toJSON(message: EnumValueOptions): unknown { + toJSON(message: EnumValueOptions): JsonSafe { const obj: any = {}; message.deprecated !== undefined && (obj.deprecated = message.deprecated); if (message.uninterpretedOption) { @@ -5841,7 +5842,7 @@ export const ServiceOptions = { if (Array.isArray(object?.uninterpretedOption)) obj.uninterpretedOption = object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)); return obj; }, - toJSON(message: ServiceOptions): unknown { + toJSON(message: ServiceOptions): JsonSafe { const obj: any = {}; message.deprecated !== undefined && (obj.deprecated = message.deprecated); if (message.uninterpretedOption) { @@ -5974,7 +5975,7 @@ export const MethodOptions = { if (Array.isArray(object?.uninterpretedOption)) obj.uninterpretedOption = object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)); return obj; }, - toJSON(message: MethodOptions): unknown { + toJSON(message: MethodOptions): JsonSafe { const obj: any = {}; message.deprecated !== undefined && (obj.deprecated = message.deprecated); message.idempotencyLevel !== undefined && (obj.idempotencyLevel = methodOptions_IdempotencyLevelToJSON(message.idempotencyLevel)); @@ -6148,7 +6149,7 @@ export const UninterpretedOption = { if (isSet(object.aggregateValue)) obj.aggregateValue = String(object.aggregateValue); return obj; }, - toJSON(message: UninterpretedOption): unknown { + toJSON(message: UninterpretedOption): JsonSafe { const obj: any = {}; if (message.name) { obj.name = message.name.map(e => e ? UninterpretedOption_NamePart.toJSON(e) : undefined); @@ -6322,7 +6323,7 @@ export const UninterpretedOption_NamePart = { if (isSet(object.isExtension)) obj.isExtension = Boolean(object.isExtension); return obj; }, - toJSON(message: UninterpretedOption_NamePart): unknown { + toJSON(message: UninterpretedOption_NamePart): JsonSafe { const obj: any = {}; message.namePart !== undefined && (obj.namePart = message.namePart); message.isExtension !== undefined && (obj.isExtension = message.isExtension); @@ -6429,7 +6430,7 @@ export const SourceCodeInfo = { if (Array.isArray(object?.location)) obj.location = object.location.map((e: any) => SourceCodeInfo_Location.fromJSON(e)); return obj; }, - toJSON(message: SourceCodeInfo): unknown { + toJSON(message: SourceCodeInfo): JsonSafe { const obj: any = {}; if (message.location) { obj.location = message.location.map(e => e ? SourceCodeInfo_Location.toJSON(e) : undefined); @@ -6587,7 +6588,7 @@ export const SourceCodeInfo_Location = { if (Array.isArray(object?.leadingDetachedComments)) obj.leadingDetachedComments = object.leadingDetachedComments.map((e: any) => String(e)); return obj; }, - toJSON(message: SourceCodeInfo_Location): unknown { + toJSON(message: SourceCodeInfo_Location): JsonSafe { const obj: any = {}; if (message.path) { obj.path = message.path.map(e => Math.round(e)); @@ -6751,7 +6752,7 @@ export const GeneratedCodeInfo = { if (Array.isArray(object?.annotation)) obj.annotation = object.annotation.map((e: any) => GeneratedCodeInfo_Annotation.fromJSON(e)); return obj; }, - toJSON(message: GeneratedCodeInfo): unknown { + toJSON(message: GeneratedCodeInfo): JsonSafe { const obj: any = {}; if (message.annotation) { obj.annotation = message.annotation.map(e => e ? GeneratedCodeInfo_Annotation.toJSON(e) : undefined); @@ -6892,7 +6893,7 @@ export const GeneratedCodeInfo_Annotation = { if (isSet(object.end)) obj.end = Number(object.end); return obj; }, - toJSON(message: GeneratedCodeInfo_Annotation): unknown { + toJSON(message: GeneratedCodeInfo_Annotation): JsonSafe { const obj: any = {}; if (message.path) { obj.path = message.path.map(e => Math.round(e)); @@ -7027,7 +7028,7 @@ export const FeatureSet = { if (isSet(object.utf8Validation)) obj.utf8Validation = featureSet_Utf8ValidationFromJSON(object.utf8Validation); return obj; }, - toJSON(message: FeatureSet): unknown { + toJSON(message: FeatureSet): JsonSafe { const obj: any = {}; message.utf8Validation !== undefined && (obj.utf8Validation = featureSet_Utf8ValidationToJSON(message.utf8Validation)); return obj; diff --git a/__fixtures__/misc/output-proto-amino/amino-interface/google/protobuf/duration.ts b/__fixtures__/misc/output-proto-amino/amino-interface/google/protobuf/duration.ts index a14bb9cdce..0d6de1ae46 100644 --- a/__fixtures__/misc/output-proto-amino/amino-interface/google/protobuf/duration.ts +++ b/__fixtures__/misc/output-proto-amino/amino-interface/google/protobuf/duration.ts @@ -1,5 +1,6 @@ import { BinaryReader, BinaryWriter } from "../../binary"; import { isSet, DeepPartial } from "../../helpers"; +import { JsonSafe } from "../../json-safe"; import { GlobalDecoderRegistry } from "../../registry"; export const protobufPackage = "google.protobuf"; /** @@ -264,7 +265,7 @@ export const Duration = { if (isSet(object.nanos)) obj.nanos = Number(object.nanos); return obj; }, - toJSON(message: Duration): unknown { + toJSON(message: Duration): JsonSafe { const obj: any = {}; message.seconds !== undefined && (obj.seconds = (message.seconds || BigInt(0)).toString()); message.nanos !== undefined && (obj.nanos = Math.round(message.nanos)); diff --git a/__fixtures__/misc/output-proto-amino/amino-interface/google/protobuf/timestamp.ts b/__fixtures__/misc/output-proto-amino/amino-interface/google/protobuf/timestamp.ts index 0e4a89752a..53a172ba59 100644 --- a/__fixtures__/misc/output-proto-amino/amino-interface/google/protobuf/timestamp.ts +++ b/__fixtures__/misc/output-proto-amino/amino-interface/google/protobuf/timestamp.ts @@ -1,5 +1,6 @@ import { BinaryReader, BinaryWriter } from "../../binary"; import { isSet, DeepPartial, fromJsonTimestamp, fromTimestamp } from "../../helpers"; +import { JsonSafe } from "../../json-safe"; import { GlobalDecoderRegistry } from "../../registry"; export const protobufPackage = "google.protobuf"; /** @@ -334,7 +335,7 @@ export const Timestamp = { if (isSet(object.nanos)) obj.nanos = Number(object.nanos); return obj; }, - toJSON(message: Timestamp): unknown { + toJSON(message: Timestamp): JsonSafe { const obj: any = {}; message.seconds !== undefined && (obj.seconds = (message.seconds || BigInt(0)).toString()); message.nanos !== undefined && (obj.nanos = Math.round(message.nanos)); diff --git a/__fixtures__/misc/output-proto-amino/amino-interface/index.ts b/__fixtures__/misc/output-proto-amino/amino-interface/index.ts index d06511f29e..8f82ffbfd7 100644 --- a/__fixtures__/misc/output-proto-amino/amino-interface/index.ts +++ b/__fixtures__/misc/output-proto-amino/amino-interface/index.ts @@ -12,6 +12,7 @@ export * from "./extern"; export * from "./react-query"; export * from "./mobx"; export * from "./pinia-endpoint"; +export * from "./json-safe"; export * from "./varint"; export * from "./utf8"; export * from "./binary"; diff --git a/__fixtures__/misc/output-proto-amino/amino-interface/json-safe.ts b/__fixtures__/misc/output-proto-amino/amino-interface/json-safe.ts new file mode 100644 index 0000000000..7d46f89144 --- /dev/null +++ b/__fixtures__/misc/output-proto-amino/amino-interface/json-safe.ts @@ -0,0 +1,10 @@ +/** +* This file and any referenced files were automatically generated by @cosmology/telescope@latest +* DO NOT MODIFY BY HAND. Instead, download the latest proto files for your chain +* and run the transpile command or npm scripts command that is used to regenerate this bundle. +*/ + + +export type JsonSafe = { + [Prop in keyof T]: T[Prop] extends Uint8Array ? string : T[Prop] extends bigint ? string : T[Prop]; +} diff --git a/__fixtures__/misc/output-proto-amino/amino-interface/misc/all_fields.ts b/__fixtures__/misc/output-proto-amino/amino-interface/misc/all_fields.ts index f8d70f7a95..003806edc7 100644 --- a/__fixtures__/misc/output-proto-amino/amino-interface/misc/all_fields.ts +++ b/__fixtures__/misc/output-proto-amino/amino-interface/misc/all_fields.ts @@ -5,6 +5,7 @@ import { Timestamp, TimestampAmino, TimestampSDKType } from "../google/protobuf/ import { isSet, toTimestamp, fromTimestamp, bytesFromBase64, base64FromBytes, DeepPartial } from "../helpers"; import { BinaryReader, BinaryWriter } from "../binary"; import { Decimal } from "@cosmjs/math"; +import { JsonSafe } from "../json-safe"; import { toUtf8, fromBase64, fromUtf8, toBase64 } from "@cosmjs/encoding"; import { encodePubkey, decodePubkey } from "@cosmjs/proto-signing"; import { GlobalDecoderRegistry } from "../registry"; @@ -903,7 +904,7 @@ export const EncodingTestForDontOmit = { if (Array.isArray(object?.dODecs)) obj.dODecs = object.dODecs.map((e: any) => String(e)); return obj; }, - toJSON(message: EncodingTestForDontOmit): unknown { + toJSON(message: EncodingTestForDontOmit): JsonSafe { const obj: any = {}; message.str !== undefined && (obj.str = message.str); message.dOStr !== undefined && (obj.dOStr = message.dOStr); @@ -2077,7 +2078,7 @@ export const EncodingTestForOmit = { if (Array.isArray(object?.oDecs)) obj.oDecs = object.oDecs.map((e: any) => String(e)); return obj; }, - toJSON(message: EncodingTestForOmit): unknown { + toJSON(message: EncodingTestForOmit): JsonSafe { const obj: any = {}; message.str !== undefined && (obj.str = message.str); message.oStr !== undefined && (obj.oStr = message.oStr); diff --git a/__fixtures__/misc/output-proto-amino/amino-interface/misc/eval_request.ts b/__fixtures__/misc/output-proto-amino/amino-interface/misc/eval_request.ts index e062b05be2..97f342ca8c 100644 --- a/__fixtures__/misc/output-proto-amino/amino-interface/misc/eval_request.ts +++ b/__fixtures__/misc/output-proto-amino/amino-interface/misc/eval_request.ts @@ -2,6 +2,7 @@ import { ExprValue, ExprValueAmino, ExprValueSDKType, IdRef, IdRefAmino, IdRefSD import { FeatureSet_Utf8Validation, featureSet_Utf8ValidationFromJSON, featureSet_Utf8ValidationToJSON } from "../google/protobuf/descriptor"; import { BinaryReader, BinaryWriter } from "../binary"; import { isSet, DeepPartial, isObject } from "../helpers"; +import { JsonSafe } from "../json-safe"; import { GlobalDecoderRegistry } from "../registry"; export const protobufPackage = "misc"; /** VoteOption enumerates the valid vote options for a given governance proposal. */ @@ -246,7 +247,7 @@ export const EvalRequest_BindingsEntry = { if (isSet(object.value)) obj.value = ExprValue.fromJSON(object.value); return obj; }, - toJSON(message: EvalRequest_BindingsEntry): unknown { + toJSON(message: EvalRequest_BindingsEntry): JsonSafe { const obj: any = {}; message.key !== undefined && (obj.key = message.key); message.value !== undefined && (obj.value = message.value ? ExprValue.toJSON(message.value) : undefined); @@ -346,7 +347,7 @@ export const EvalRequest_RefsEntry = { if (isSet(object.value)) obj.value = IdRef.fromJSON(object.value); return obj; }, - toJSON(message: EvalRequest_RefsEntry): unknown { + toJSON(message: EvalRequest_RefsEntry): JsonSafe { const obj: any = {}; message.key !== undefined && (obj.key = message.key); message.value !== undefined && (obj.value = message.value ? IdRef.toJSON(message.value) : undefined); @@ -542,7 +543,7 @@ export const EvalRequest = { if (isSet(object.opt)) obj.opt = featureSet_Utf8ValidationFromJSON(object.opt); return obj; }, - toJSON(message: EvalRequest): unknown { + toJSON(message: EvalRequest): JsonSafe { const obj: any = {}; obj.bindings = {}; if (message.bindings) { @@ -807,7 +808,7 @@ export const AccessConfig = { if (isSet(object.sender)) obj.sender = String(object.sender); return obj; }, - toJSON(message: AccessConfig): unknown { + toJSON(message: AccessConfig): JsonSafe { const obj: any = {}; message.sender !== undefined && (obj.sender = message.sender); return obj; @@ -906,7 +907,7 @@ export const GenericAuthorization = { if (isSet(object.msg)) obj.msg = String(object.msg); return obj; }, - toJSON(message: GenericAuthorization): unknown { + toJSON(message: GenericAuthorization): JsonSafe { const obj: any = {}; message.msg !== undefined && (obj.msg = message.msg); return obj; diff --git a/__fixtures__/misc/output-proto-amino/amino-interface/misc/tx.ts b/__fixtures__/misc/output-proto-amino/amino-interface/misc/tx.ts index b903e70f36..b902747e6d 100644 --- a/__fixtures__/misc/output-proto-amino/amino-interface/misc/tx.ts +++ b/__fixtures__/misc/output-proto-amino/amino-interface/misc/tx.ts @@ -1,6 +1,7 @@ import { EncodingTestForDontOmit, EncodingTestForDontOmitAmino, EncodingTestForDontOmitSDKType, EncodingTestForOmit, EncodingTestForOmitAmino, EncodingTestForOmitSDKType } from "./all_fields"; import { BinaryReader, BinaryWriter } from "../binary"; import { isSet, DeepPartial } from "../helpers"; +import { JsonSafe } from "../json-safe"; import { GlobalDecoderRegistry } from "../registry"; export const protobufPackage = "misc"; /** @@ -101,7 +102,7 @@ export const InputMsg = { if (isSet(object.oTests)) obj.oTests = EncodingTestForOmit.fromJSON(object.oTests); return obj; }, - toJSON(message: InputMsg): unknown { + toJSON(message: InputMsg): JsonSafe { const obj: any = {}; message.dOTests !== undefined && (obj.dOTests = message.dOTests ? EncodingTestForDontOmit.toJSON(message.dOTests) : undefined); message.oTests !== undefined && (obj.oTests = message.oTests ? EncodingTestForOmit.toJSON(message.oTests) : undefined); @@ -203,7 +204,7 @@ export const MsgResponse = { const obj = createBaseMsgResponse(); return obj; }, - toJSON(_: MsgResponse): unknown { + toJSON(_: MsgResponse): JsonSafe { const obj: any = {}; return obj; }, diff --git a/__fixtures__/misc/output-proto-amino/amino-legacy/google/api/expr/v1alpha1/eval.ts b/__fixtures__/misc/output-proto-amino/amino-legacy/google/api/expr/v1alpha1/eval.ts index 50b92187a5..600c68e4f1 100644 --- a/__fixtures__/misc/output-proto-amino/amino-legacy/google/api/expr/v1alpha1/eval.ts +++ b/__fixtures__/misc/output-proto-amino/amino-legacy/google/api/expr/v1alpha1/eval.ts @@ -1,4 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../../binary"; +import { JsonSafe } from "../../../../json-safe"; import { DeepPartial, isSet } from "../../../../helpers"; export const protobufPackage = "google.api.expr.v1alpha1"; export interface ExprValue { @@ -58,7 +59,7 @@ export const ExprValue = { if (Array.isArray(object?.exprs)) obj.exprs = object.exprs.map((e: any) => IdRef.fromJSON(e)); return obj; }, - toJSON(message: ExprValue): unknown { + toJSON(message: ExprValue): JsonSafe { const obj: any = {}; if (message.exprs) { obj.exprs = message.exprs.map(e => e ? IdRef.toJSON(e) : undefined); @@ -156,7 +157,7 @@ export const IdRef = { if (isSet(object.id)) obj.id = Number(object.id); return obj; }, - toJSON(message: IdRef): unknown { + toJSON(message: IdRef): JsonSafe { const obj: any = {}; message.id !== undefined && (obj.id = Math.round(message.id)); return obj; diff --git a/__fixtures__/misc/output-proto-amino/amino-legacy/google/protobuf/any.ts b/__fixtures__/misc/output-proto-amino/amino-legacy/google/protobuf/any.ts index d1c066a4df..0e7ea482a7 100644 --- a/__fixtures__/misc/output-proto-amino/amino-legacy/google/protobuf/any.ts +++ b/__fixtures__/misc/output-proto-amino/amino-legacy/google/protobuf/any.ts @@ -1,5 +1,6 @@ import { BinaryReader, BinaryWriter } from "../../binary"; import { isSet, bytesFromBase64, base64FromBytes, DeepPartial } from "../../helpers"; +import { JsonSafe } from "../../json-safe"; export const protobufPackage = "google.protobuf"; /** * `Any` contains an arbitrary serialized protocol buffer message along with a @@ -251,7 +252,7 @@ export const Any = { if (isSet(object.value)) obj.value = bytesFromBase64(object.value); return obj; }, - toJSON(message: Any): unknown { + toJSON(message: Any): JsonSafe { const obj: any = {}; message.typeUrl !== undefined && (obj.typeUrl = message.typeUrl); message.value !== undefined && (obj.value = base64FromBytes(message.value !== undefined ? message.value : new Uint8Array())); diff --git a/__fixtures__/misc/output-proto-amino/amino-legacy/google/protobuf/descriptor.ts b/__fixtures__/misc/output-proto-amino/amino-legacy/google/protobuf/descriptor.ts index 1f3671fd23..8315b68154 100644 --- a/__fixtures__/misc/output-proto-amino/amino-legacy/google/protobuf/descriptor.ts +++ b/__fixtures__/misc/output-proto-amino/amino-legacy/google/protobuf/descriptor.ts @@ -1,4 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../binary"; +import { JsonSafe } from "../../json-safe"; import { DeepPartial, isSet, bytesFromBase64, base64FromBytes } from "../../helpers"; export const protobufPackage = "google.protobuf"; export enum FieldDescriptorProto_Type { @@ -1474,7 +1475,7 @@ export const FileDescriptorSet = { if (Array.isArray(object?.file)) obj.file = object.file.map((e: any) => FileDescriptorProto.fromJSON(e)); return obj; }, - toJSON(message: FileDescriptorSet): unknown { + toJSON(message: FileDescriptorSet): JsonSafe { const obj: any = {}; if (message.file) { obj.file = message.file.map(e => e ? FileDescriptorProto.toJSON(e) : undefined); @@ -1678,7 +1679,7 @@ export const FileDescriptorProto = { if (isSet(object.syntax)) obj.syntax = String(object.syntax); return obj; }, - toJSON(message: FileDescriptorProto): unknown { + toJSON(message: FileDescriptorProto): JsonSafe { const obj: any = {}; message.name !== undefined && (obj.name = message.name); message.package !== undefined && (obj.package = message.package); @@ -2011,7 +2012,7 @@ export const DescriptorProto = { if (Array.isArray(object?.reservedName)) obj.reservedName = object.reservedName.map((e: any) => String(e)); return obj; }, - toJSON(message: DescriptorProto): unknown { + toJSON(message: DescriptorProto): JsonSafe { const obj: any = {}; message.name !== undefined && (obj.name = message.name); if (message.field) { @@ -2278,7 +2279,7 @@ export const DescriptorProto_ExtensionRange = { if (isSet(object.options)) obj.options = ExtensionRangeOptions.fromJSON(object.options); return obj; }, - toJSON(message: DescriptorProto_ExtensionRange): unknown { + toJSON(message: DescriptorProto_ExtensionRange): JsonSafe { const obj: any = {}; message.start !== undefined && (obj.start = Math.round(message.start)); message.end !== undefined && (obj.end = Math.round(message.end)); @@ -2394,7 +2395,7 @@ export const DescriptorProto_ReservedRange = { if (isSet(object.end)) obj.end = Number(object.end); return obj; }, - toJSON(message: DescriptorProto_ReservedRange): unknown { + toJSON(message: DescriptorProto_ReservedRange): JsonSafe { const obj: any = {}; message.start !== undefined && (obj.start = Math.round(message.start)); message.end !== undefined && (obj.end = Math.round(message.end)); @@ -2491,7 +2492,7 @@ export const ExtensionRangeOptions = { if (Array.isArray(object?.uninterpretedOption)) obj.uninterpretedOption = object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)); return obj; }, - toJSON(message: ExtensionRangeOptions): unknown { + toJSON(message: ExtensionRangeOptions): JsonSafe { const obj: any = {}; if (message.uninterpretedOption) { obj.uninterpretedOption = message.uninterpretedOption.map(e => e ? UninterpretedOption.toJSON(e) : undefined); @@ -2661,7 +2662,7 @@ export const FieldDescriptorProto = { if (isSet(object.options)) obj.options = FieldOptions.fromJSON(object.options); return obj; }, - toJSON(message: FieldDescriptorProto): unknown { + toJSON(message: FieldDescriptorProto): JsonSafe { const obj: any = {}; message.name !== undefined && (obj.name = message.name); message.number !== undefined && (obj.number = Math.round(message.number)); @@ -2840,7 +2841,7 @@ export const OneofDescriptorProto = { if (isSet(object.options)) obj.options = OneofOptions.fromJSON(object.options); return obj; }, - toJSON(message: OneofDescriptorProto): unknown { + toJSON(message: OneofDescriptorProto): JsonSafe { const obj: any = {}; message.name !== undefined && (obj.name = message.name); message.options !== undefined && (obj.options = message.options ? OneofOptions.toJSON(message.options) : undefined); @@ -2971,7 +2972,7 @@ export const EnumDescriptorProto = { if (Array.isArray(object?.reservedName)) obj.reservedName = object.reservedName.map((e: any) => String(e)); return obj; }, - toJSON(message: EnumDescriptorProto): unknown { + toJSON(message: EnumDescriptorProto): JsonSafe { const obj: any = {}; message.name !== undefined && (obj.name = message.name); if (message.value) { @@ -3135,7 +3136,7 @@ export const EnumDescriptorProto_EnumReservedRange = { if (isSet(object.end)) obj.end = Number(object.end); return obj; }, - toJSON(message: EnumDescriptorProto_EnumReservedRange): unknown { + toJSON(message: EnumDescriptorProto_EnumReservedRange): JsonSafe { const obj: any = {}; message.start !== undefined && (obj.start = Math.round(message.start)); message.end !== undefined && (obj.end = Math.round(message.end)); @@ -3248,7 +3249,7 @@ export const EnumValueDescriptorProto = { if (isSet(object.options)) obj.options = EnumValueOptions.fromJSON(object.options); return obj; }, - toJSON(message: EnumValueDescriptorProto): unknown { + toJSON(message: EnumValueDescriptorProto): JsonSafe { const obj: any = {}; message.name !== undefined && (obj.name = message.name); message.number !== undefined && (obj.number = Math.round(message.number)); @@ -3372,7 +3373,7 @@ export const ServiceDescriptorProto = { if (isSet(object.options)) obj.options = ServiceOptions.fromJSON(object.options); return obj; }, - toJSON(message: ServiceDescriptorProto): unknown { + toJSON(message: ServiceDescriptorProto): JsonSafe { const obj: any = {}; message.name !== undefined && (obj.name = message.name); if (message.method) { @@ -3530,7 +3531,7 @@ export const MethodDescriptorProto = { if (isSet(object.serverStreaming)) obj.serverStreaming = Boolean(object.serverStreaming); return obj; }, - toJSON(message: MethodDescriptorProto): unknown { + toJSON(message: MethodDescriptorProto): JsonSafe { const obj: any = {}; message.name !== undefined && (obj.name = message.name); message.inputType !== undefined && (obj.inputType = message.inputType); @@ -3825,7 +3826,7 @@ export const FileOptions = { if (Array.isArray(object?.uninterpretedOption)) obj.uninterpretedOption = object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)); return obj; }, - toJSON(message: FileOptions): unknown { + toJSON(message: FileOptions): JsonSafe { const obj: any = {}; message.javaPackage !== undefined && (obj.javaPackage = message.javaPackage); message.javaOuterClassname !== undefined && (obj.javaOuterClassname = message.javaOuterClassname); @@ -4135,7 +4136,7 @@ export const MessageOptions = { if (Array.isArray(object?.uninterpretedOption)) obj.uninterpretedOption = object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)); return obj; }, - toJSON(message: MessageOptions): unknown { + toJSON(message: MessageOptions): JsonSafe { const obj: any = {}; message.messageSetWireFormat !== undefined && (obj.messageSetWireFormat = message.messageSetWireFormat); message.noStandardDescriptorAccessor !== undefined && (obj.noStandardDescriptorAccessor = message.noStandardDescriptorAccessor); @@ -4317,7 +4318,7 @@ export const FieldOptions = { if (Array.isArray(object?.uninterpretedOption)) obj.uninterpretedOption = object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)); return obj; }, - toJSON(message: FieldOptions): unknown { + toJSON(message: FieldOptions): JsonSafe { const obj: any = {}; message.ctype !== undefined && (obj.ctype = fieldOptions_CTypeToJSON(message.ctype)); message.packed !== undefined && (obj.packed = message.packed); @@ -4469,7 +4470,7 @@ export const OneofOptions = { if (Array.isArray(object?.uninterpretedOption)) obj.uninterpretedOption = object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)); return obj; }, - toJSON(message: OneofOptions): unknown { + toJSON(message: OneofOptions): JsonSafe { const obj: any = {}; if (message.uninterpretedOption) { obj.uninterpretedOption = message.uninterpretedOption.map(e => e ? UninterpretedOption.toJSON(e) : undefined); @@ -4583,7 +4584,7 @@ export const EnumOptions = { if (Array.isArray(object?.uninterpretedOption)) obj.uninterpretedOption = object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)); return obj; }, - toJSON(message: EnumOptions): unknown { + toJSON(message: EnumOptions): JsonSafe { const obj: any = {}; message.allowAlias !== undefined && (obj.allowAlias = message.allowAlias); message.deprecated !== undefined && (obj.deprecated = message.deprecated); @@ -4707,7 +4708,7 @@ export const EnumValueOptions = { if (Array.isArray(object?.uninterpretedOption)) obj.uninterpretedOption = object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)); return obj; }, - toJSON(message: EnumValueOptions): unknown { + toJSON(message: EnumValueOptions): JsonSafe { const obj: any = {}; message.deprecated !== undefined && (obj.deprecated = message.deprecated); if (message.uninterpretedOption) { @@ -4822,7 +4823,7 @@ export const ServiceOptions = { if (Array.isArray(object?.uninterpretedOption)) obj.uninterpretedOption = object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)); return obj; }, - toJSON(message: ServiceOptions): unknown { + toJSON(message: ServiceOptions): JsonSafe { const obj: any = {}; message.deprecated !== undefined && (obj.deprecated = message.deprecated); if (message.uninterpretedOption) { @@ -4945,7 +4946,7 @@ export const MethodOptions = { if (Array.isArray(object?.uninterpretedOption)) obj.uninterpretedOption = object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)); return obj; }, - toJSON(message: MethodOptions): unknown { + toJSON(message: MethodOptions): JsonSafe { const obj: any = {}; message.deprecated !== undefined && (obj.deprecated = message.deprecated); message.idempotencyLevel !== undefined && (obj.idempotencyLevel = methodOptions_IdempotencyLevelToJSON(message.idempotencyLevel)); @@ -5109,7 +5110,7 @@ export const UninterpretedOption = { if (isSet(object.aggregateValue)) obj.aggregateValue = String(object.aggregateValue); return obj; }, - toJSON(message: UninterpretedOption): unknown { + toJSON(message: UninterpretedOption): JsonSafe { const obj: any = {}; if (message.name) { obj.name = message.name.map(e => e ? UninterpretedOption_NamePart.toJSON(e) : undefined); @@ -5273,7 +5274,7 @@ export const UninterpretedOption_NamePart = { if (isSet(object.isExtension)) obj.isExtension = Boolean(object.isExtension); return obj; }, - toJSON(message: UninterpretedOption_NamePart): unknown { + toJSON(message: UninterpretedOption_NamePart): JsonSafe { const obj: any = {}; message.namePart !== undefined && (obj.namePart = message.namePart); message.isExtension !== undefined && (obj.isExtension = message.isExtension); @@ -5370,7 +5371,7 @@ export const SourceCodeInfo = { if (Array.isArray(object?.location)) obj.location = object.location.map((e: any) => SourceCodeInfo_Location.fromJSON(e)); return obj; }, - toJSON(message: SourceCodeInfo): unknown { + toJSON(message: SourceCodeInfo): JsonSafe { const obj: any = {}; if (message.location) { obj.location = message.location.map(e => e ? SourceCodeInfo_Location.toJSON(e) : undefined); @@ -5518,7 +5519,7 @@ export const SourceCodeInfo_Location = { if (Array.isArray(object?.leadingDetachedComments)) obj.leadingDetachedComments = object.leadingDetachedComments.map((e: any) => String(e)); return obj; }, - toJSON(message: SourceCodeInfo_Location): unknown { + toJSON(message: SourceCodeInfo_Location): JsonSafe { const obj: any = {}; if (message.path) { obj.path = message.path.map(e => Math.round(e)); @@ -5672,7 +5673,7 @@ export const GeneratedCodeInfo = { if (Array.isArray(object?.annotation)) obj.annotation = object.annotation.map((e: any) => GeneratedCodeInfo_Annotation.fromJSON(e)); return obj; }, - toJSON(message: GeneratedCodeInfo): unknown { + toJSON(message: GeneratedCodeInfo): JsonSafe { const obj: any = {}; if (message.annotation) { obj.annotation = message.annotation.map(e => e ? GeneratedCodeInfo_Annotation.toJSON(e) : undefined); @@ -5803,7 +5804,7 @@ export const GeneratedCodeInfo_Annotation = { if (isSet(object.end)) obj.end = Number(object.end); return obj; }, - toJSON(message: GeneratedCodeInfo_Annotation): unknown { + toJSON(message: GeneratedCodeInfo_Annotation): JsonSafe { const obj: any = {}; if (message.path) { obj.path = message.path.map(e => Math.round(e)); @@ -5928,7 +5929,7 @@ export const FeatureSet = { if (isSet(object.utf8Validation)) obj.utf8Validation = featureSet_Utf8ValidationFromJSON(object.utf8Validation); return obj; }, - toJSON(message: FeatureSet): unknown { + toJSON(message: FeatureSet): JsonSafe { const obj: any = {}; message.utf8Validation !== undefined && (obj.utf8Validation = featureSet_Utf8ValidationToJSON(message.utf8Validation)); return obj; diff --git a/__fixtures__/misc/output-proto-amino/amino-legacy/google/protobuf/duration.ts b/__fixtures__/misc/output-proto-amino/amino-legacy/google/protobuf/duration.ts index 532fd9db20..2e1f1eb98b 100644 --- a/__fixtures__/misc/output-proto-amino/amino-legacy/google/protobuf/duration.ts +++ b/__fixtures__/misc/output-proto-amino/amino-legacy/google/protobuf/duration.ts @@ -1,5 +1,6 @@ import { BinaryReader, BinaryWriter } from "../../binary"; import { isSet, DeepPartial } from "../../helpers"; +import { JsonSafe } from "../../json-safe"; export const protobufPackage = "google.protobuf"; /** * A Duration represents a signed, fixed-length span of time represented @@ -189,7 +190,7 @@ export const Duration = { if (isSet(object.nanos)) obj.nanos = Number(object.nanos); return obj; }, - toJSON(message: Duration): unknown { + toJSON(message: Duration): JsonSafe { const obj: any = {}; message.seconds !== undefined && (obj.seconds = (message.seconds || BigInt(0)).toString()); message.nanos !== undefined && (obj.nanos = Math.round(message.nanos)); diff --git a/__fixtures__/misc/output-proto-amino/amino-legacy/google/protobuf/timestamp.ts b/__fixtures__/misc/output-proto-amino/amino-legacy/google/protobuf/timestamp.ts index 497d725979..c7adc874fd 100644 --- a/__fixtures__/misc/output-proto-amino/amino-legacy/google/protobuf/timestamp.ts +++ b/__fixtures__/misc/output-proto-amino/amino-legacy/google/protobuf/timestamp.ts @@ -1,5 +1,6 @@ import { BinaryReader, BinaryWriter } from "../../binary"; import { isSet, DeepPartial, fromJsonTimestamp, fromTimestamp } from "../../helpers"; +import { JsonSafe } from "../../json-safe"; export const protobufPackage = "google.protobuf"; /** * A Timestamp represents a point in time independent of any time zone or local @@ -235,7 +236,7 @@ export const Timestamp = { if (isSet(object.nanos)) obj.nanos = Number(object.nanos); return obj; }, - toJSON(message: Timestamp): unknown { + toJSON(message: Timestamp): JsonSafe { const obj: any = {}; message.seconds !== undefined && (obj.seconds = (message.seconds || BigInt(0)).toString()); message.nanos !== undefined && (obj.nanos = Math.round(message.nanos)); diff --git a/__fixtures__/misc/output-proto-amino/amino-legacy/index.ts b/__fixtures__/misc/output-proto-amino/amino-legacy/index.ts index 8c7bdc34cf..3757ae2467 100644 --- a/__fixtures__/misc/output-proto-amino/amino-legacy/index.ts +++ b/__fixtures__/misc/output-proto-amino/amino-legacy/index.ts @@ -12,6 +12,7 @@ export * from "./extern"; export * from "./react-query"; export * from "./mobx"; export * from "./pinia-endpoint"; +export * from "./json-safe"; export * from "./varint"; export * from "./utf8"; export * from "./binary"; \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/amino-legacy/json-safe.ts b/__fixtures__/misc/output-proto-amino/amino-legacy/json-safe.ts new file mode 100644 index 0000000000..7d46f89144 --- /dev/null +++ b/__fixtures__/misc/output-proto-amino/amino-legacy/json-safe.ts @@ -0,0 +1,10 @@ +/** +* This file and any referenced files were automatically generated by @cosmology/telescope@latest +* DO NOT MODIFY BY HAND. Instead, download the latest proto files for your chain +* and run the transpile command or npm scripts command that is used to regenerate this bundle. +*/ + + +export type JsonSafe = { + [Prop in keyof T]: T[Prop] extends Uint8Array ? string : T[Prop] extends bigint ? string : T[Prop]; +} diff --git a/__fixtures__/misc/output-proto-amino/amino-legacy/misc/all_fields.ts b/__fixtures__/misc/output-proto-amino/amino-legacy/misc/all_fields.ts index 4033db4742..c330fad445 100644 --- a/__fixtures__/misc/output-proto-amino/amino-legacy/misc/all_fields.ts +++ b/__fixtures__/misc/output-proto-amino/amino-legacy/misc/all_fields.ts @@ -5,6 +5,7 @@ import { Timestamp, TimestampSDKType } from "../google/protobuf/timestamp"; import { BinaryReader, BinaryWriter } from "../binary"; import { toTimestamp, fromTimestamp, isSet, bytesFromBase64, base64FromBytes, DeepPartial, padDecimal } from "../helpers"; import { Decimal } from "@cosmjs/math"; +import { JsonSafe } from "../json-safe"; import { toUtf8, fromBase64, fromUtf8, toBase64 } from "@cosmjs/encoding"; import { encodePubkey, decodePubkey } from "@cosmjs/proto-signing"; export const protobufPackage = "misc"; @@ -725,7 +726,7 @@ export const EncodingTestForDontOmit = { if (Array.isArray(object?.dODecs)) obj.dODecs = object.dODecs.map((e: any) => String(e)); return obj; }, - toJSON(message: EncodingTestForDontOmit): unknown { + toJSON(message: EncodingTestForDontOmit): JsonSafe { const obj: any = {}; message.str !== undefined && (obj.str = message.str); message.dOStr !== undefined && (obj.dOStr = message.dOStr); @@ -1886,7 +1887,7 @@ export const EncodingTestForOmit = { if (Array.isArray(object?.oDecs)) obj.oDecs = object.oDecs.map((e: any) => String(e)); return obj; }, - toJSON(message: EncodingTestForOmit): unknown { + toJSON(message: EncodingTestForOmit): JsonSafe { const obj: any = {}; message.str !== undefined && (obj.str = message.str); message.oStr !== undefined && (obj.oStr = message.oStr); diff --git a/__fixtures__/misc/output-proto-amino/amino-legacy/misc/eval_request.ts b/__fixtures__/misc/output-proto-amino/amino-legacy/misc/eval_request.ts index 03b8e7f7f7..e6cf4d68b4 100644 --- a/__fixtures__/misc/output-proto-amino/amino-legacy/misc/eval_request.ts +++ b/__fixtures__/misc/output-proto-amino/amino-legacy/misc/eval_request.ts @@ -2,6 +2,7 @@ import { ExprValue, ExprValueSDKType, IdRef, IdRefSDKType } from "../google/api/ import { FeatureSet_Utf8Validation, featureSet_Utf8ValidationFromJSON, featureSet_Utf8ValidationToJSON } from "../google/protobuf/descriptor"; import { BinaryReader, BinaryWriter } from "../binary"; import { isSet, DeepPartial, isObject } from "../helpers"; +import { JsonSafe } from "../json-safe"; export const protobufPackage = "misc"; /** VoteOption enumerates the valid vote options for a given governance proposal. */ export enum VoteOption { @@ -186,7 +187,7 @@ export const EvalRequest_BindingsEntry = { if (isSet(object.value)) obj.value = ExprValue.fromJSON(object.value); return obj; }, - toJSON(message: EvalRequest_BindingsEntry): unknown { + toJSON(message: EvalRequest_BindingsEntry): JsonSafe { const obj: any = {}; message.key !== undefined && (obj.key = message.key); message.value !== undefined && (obj.value = message.value ? ExprValue.toJSON(message.value) : undefined); @@ -286,7 +287,7 @@ export const EvalRequest_RefsEntry = { if (isSet(object.value)) obj.value = IdRef.fromJSON(object.value); return obj; }, - toJSON(message: EvalRequest_RefsEntry): unknown { + toJSON(message: EvalRequest_RefsEntry): JsonSafe { const obj: any = {}; message.key !== undefined && (obj.key = message.key); message.value !== undefined && (obj.value = message.value ? IdRef.toJSON(message.value) : undefined); @@ -473,7 +474,7 @@ export const EvalRequest = { if (isSet(object.opt)) obj.opt = featureSet_Utf8ValidationFromJSON(object.opt); return obj; }, - toJSON(message: EvalRequest): unknown { + toJSON(message: EvalRequest): JsonSafe { const obj: any = {}; obj.bindings = {}; if (message.bindings) { @@ -728,7 +729,7 @@ export const AccessConfig = { if (isSet(object.sender)) obj.sender = String(object.sender); return obj; }, - toJSON(message: AccessConfig): unknown { + toJSON(message: AccessConfig): JsonSafe { const obj: any = {}; message.sender !== undefined && (obj.sender = message.sender); return obj; @@ -816,7 +817,7 @@ export const GenericAuthorization = { if (isSet(object.msg)) obj.msg = String(object.msg); return obj; }, - toJSON(message: GenericAuthorization): unknown { + toJSON(message: GenericAuthorization): JsonSafe { const obj: any = {}; message.msg !== undefined && (obj.msg = message.msg); return obj; diff --git a/__fixtures__/misc/output-proto-amino/amino-legacy/misc/tx.ts b/__fixtures__/misc/output-proto-amino/amino-legacy/misc/tx.ts index 46645b2199..3b84ad93d2 100644 --- a/__fixtures__/misc/output-proto-amino/amino-legacy/misc/tx.ts +++ b/__fixtures__/misc/output-proto-amino/amino-legacy/misc/tx.ts @@ -1,6 +1,7 @@ import { EncodingTestForDontOmit, EncodingTestForDontOmitSDKType, EncodingTestForOmit, EncodingTestForOmitSDKType } from "./all_fields"; import { BinaryReader, BinaryWriter } from "../binary"; import { isSet, DeepPartial } from "../helpers"; +import { JsonSafe } from "../json-safe"; export const protobufPackage = "misc"; /** * MsgGrant is a request type for Grant method. It declares authorization to the grantee @@ -73,7 +74,7 @@ export const InputMsg = { if (isSet(object.oTests)) obj.oTests = EncodingTestForOmit.fromJSON(object.oTests); return obj; }, - toJSON(message: InputMsg): unknown { + toJSON(message: InputMsg): JsonSafe { const obj: any = {}; message.dOTests !== undefined && (obj.dOTests = message.dOTests ? EncodingTestForDontOmit.toJSON(message.dOTests) : undefined); message.oTests !== undefined && (obj.oTests = message.oTests ? EncodingTestForOmit.toJSON(message.oTests) : undefined); @@ -165,7 +166,7 @@ export const MsgResponse = { const obj = createBaseMsgResponse(); return obj; }, - toJSON(_: MsgResponse): unknown { + toJSON(_: MsgResponse): JsonSafe { const obj: any = {}; return obj; }, diff --git a/__fixtures__/misc/output-proto-amino/amino-msg-no-func/google/api/expr/v1alpha1/eval.ts b/__fixtures__/misc/output-proto-amino/amino-msg-no-func/google/api/expr/v1alpha1/eval.ts index 6902943167..d154618421 100644 --- a/__fixtures__/misc/output-proto-amino/amino-msg-no-func/google/api/expr/v1alpha1/eval.ts +++ b/__fixtures__/misc/output-proto-amino/amino-msg-no-func/google/api/expr/v1alpha1/eval.ts @@ -1,4 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../../binary"; +import { JsonSafe } from "../../../../json-safe"; import { DeepPartial, isSet } from "../../../../helpers"; export const protobufPackage = "google.api.expr.v1alpha1"; export interface ExprValue { @@ -74,7 +75,7 @@ export const ExprValue = { if (Array.isArray(object?.exprs)) obj.exprs = object.exprs.map((e: any) => IdRef.fromJSON(e)); return obj; }, - toJSON(message: ExprValue): unknown { + toJSON(message: ExprValue): JsonSafe { const obj: any = {}; if (message.exprs) { obj.exprs = message.exprs.map(e => e ? IdRef.toJSON(e) : undefined); @@ -172,7 +173,7 @@ export const IdRef = { if (isSet(object.id)) obj.id = Number(object.id); return obj; }, - toJSON(message: IdRef): unknown { + toJSON(message: IdRef): JsonSafe { const obj: any = {}; message.id !== undefined && (obj.id = Math.round(message.id)); return obj; diff --git a/__fixtures__/misc/output-proto-amino/amino-msg-no-func/google/protobuf/any.ts b/__fixtures__/misc/output-proto-amino/amino-msg-no-func/google/protobuf/any.ts index 31152a692c..3c85d6072b 100644 --- a/__fixtures__/misc/output-proto-amino/amino-msg-no-func/google/protobuf/any.ts +++ b/__fixtures__/misc/output-proto-amino/amino-msg-no-func/google/protobuf/any.ts @@ -1,5 +1,6 @@ import { BinaryReader, BinaryWriter } from "../../binary"; import { isSet, bytesFromBase64, base64FromBytes, DeepPartial } from "../../helpers"; +import { JsonSafe } from "../../json-safe"; export const protobufPackage = "google.protobuf"; /** * `Any` contains an arbitrary serialized protocol buffer message along with a @@ -370,7 +371,7 @@ export const Any = { if (isSet(object.value)) obj.value = bytesFromBase64(object.value); return obj; }, - toJSON(message: Any): unknown { + toJSON(message: Any): JsonSafe { const obj: any = {}; message.typeUrl !== undefined && (obj.typeUrl = message.typeUrl); message.value !== undefined && (obj.value = base64FromBytes(message.value !== undefined ? message.value : new Uint8Array())); diff --git a/__fixtures__/misc/output-proto-amino/amino-msg-no-func/google/protobuf/descriptor.ts b/__fixtures__/misc/output-proto-amino/amino-msg-no-func/google/protobuf/descriptor.ts index 610136558f..82c7fb96c4 100644 --- a/__fixtures__/misc/output-proto-amino/amino-msg-no-func/google/protobuf/descriptor.ts +++ b/__fixtures__/misc/output-proto-amino/amino-msg-no-func/google/protobuf/descriptor.ts @@ -1,4 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../binary"; +import { JsonSafe } from "../../json-safe"; import { DeepPartial, isSet, bytesFromBase64, base64FromBytes } from "../../helpers"; export const protobufPackage = "google.protobuf"; export enum FieldDescriptorProto_Type { @@ -2293,7 +2294,7 @@ export const FileDescriptorSet = { if (Array.isArray(object?.file)) obj.file = object.file.map((e: any) => FileDescriptorProto.fromJSON(e)); return obj; }, - toJSON(message: FileDescriptorSet): unknown { + toJSON(message: FileDescriptorSet): JsonSafe { const obj: any = {}; if (message.file) { obj.file = message.file.map(e => e ? FileDescriptorProto.toJSON(e) : undefined); @@ -2497,7 +2498,7 @@ export const FileDescriptorProto = { if (isSet(object.syntax)) obj.syntax = String(object.syntax); return obj; }, - toJSON(message: FileDescriptorProto): unknown { + toJSON(message: FileDescriptorProto): JsonSafe { const obj: any = {}; message.name !== undefined && (obj.name = message.name); message.package !== undefined && (obj.package = message.package); @@ -2830,7 +2831,7 @@ export const DescriptorProto = { if (Array.isArray(object?.reservedName)) obj.reservedName = object.reservedName.map((e: any) => String(e)); return obj; }, - toJSON(message: DescriptorProto): unknown { + toJSON(message: DescriptorProto): JsonSafe { const obj: any = {}; message.name !== undefined && (obj.name = message.name); if (message.field) { @@ -3097,7 +3098,7 @@ export const DescriptorProto_ExtensionRange = { if (isSet(object.options)) obj.options = ExtensionRangeOptions.fromJSON(object.options); return obj; }, - toJSON(message: DescriptorProto_ExtensionRange): unknown { + toJSON(message: DescriptorProto_ExtensionRange): JsonSafe { const obj: any = {}; message.start !== undefined && (obj.start = Math.round(message.start)); message.end !== undefined && (obj.end = Math.round(message.end)); @@ -3213,7 +3214,7 @@ export const DescriptorProto_ReservedRange = { if (isSet(object.end)) obj.end = Number(object.end); return obj; }, - toJSON(message: DescriptorProto_ReservedRange): unknown { + toJSON(message: DescriptorProto_ReservedRange): JsonSafe { const obj: any = {}; message.start !== undefined && (obj.start = Math.round(message.start)); message.end !== undefined && (obj.end = Math.round(message.end)); @@ -3310,7 +3311,7 @@ export const ExtensionRangeOptions = { if (Array.isArray(object?.uninterpretedOption)) obj.uninterpretedOption = object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)); return obj; }, - toJSON(message: ExtensionRangeOptions): unknown { + toJSON(message: ExtensionRangeOptions): JsonSafe { const obj: any = {}; if (message.uninterpretedOption) { obj.uninterpretedOption = message.uninterpretedOption.map(e => e ? UninterpretedOption.toJSON(e) : undefined); @@ -3480,7 +3481,7 @@ export const FieldDescriptorProto = { if (isSet(object.options)) obj.options = FieldOptions.fromJSON(object.options); return obj; }, - toJSON(message: FieldDescriptorProto): unknown { + toJSON(message: FieldDescriptorProto): JsonSafe { const obj: any = {}; message.name !== undefined && (obj.name = message.name); message.number !== undefined && (obj.number = Math.round(message.number)); @@ -3659,7 +3660,7 @@ export const OneofDescriptorProto = { if (isSet(object.options)) obj.options = OneofOptions.fromJSON(object.options); return obj; }, - toJSON(message: OneofDescriptorProto): unknown { + toJSON(message: OneofDescriptorProto): JsonSafe { const obj: any = {}; message.name !== undefined && (obj.name = message.name); message.options !== undefined && (obj.options = message.options ? OneofOptions.toJSON(message.options) : undefined); @@ -3790,7 +3791,7 @@ export const EnumDescriptorProto = { if (Array.isArray(object?.reservedName)) obj.reservedName = object.reservedName.map((e: any) => String(e)); return obj; }, - toJSON(message: EnumDescriptorProto): unknown { + toJSON(message: EnumDescriptorProto): JsonSafe { const obj: any = {}; message.name !== undefined && (obj.name = message.name); if (message.value) { @@ -3954,7 +3955,7 @@ export const EnumDescriptorProto_EnumReservedRange = { if (isSet(object.end)) obj.end = Number(object.end); return obj; }, - toJSON(message: EnumDescriptorProto_EnumReservedRange): unknown { + toJSON(message: EnumDescriptorProto_EnumReservedRange): JsonSafe { const obj: any = {}; message.start !== undefined && (obj.start = Math.round(message.start)); message.end !== undefined && (obj.end = Math.round(message.end)); @@ -4067,7 +4068,7 @@ export const EnumValueDescriptorProto = { if (isSet(object.options)) obj.options = EnumValueOptions.fromJSON(object.options); return obj; }, - toJSON(message: EnumValueDescriptorProto): unknown { + toJSON(message: EnumValueDescriptorProto): JsonSafe { const obj: any = {}; message.name !== undefined && (obj.name = message.name); message.number !== undefined && (obj.number = Math.round(message.number)); @@ -4191,7 +4192,7 @@ export const ServiceDescriptorProto = { if (isSet(object.options)) obj.options = ServiceOptions.fromJSON(object.options); return obj; }, - toJSON(message: ServiceDescriptorProto): unknown { + toJSON(message: ServiceDescriptorProto): JsonSafe { const obj: any = {}; message.name !== undefined && (obj.name = message.name); if (message.method) { @@ -4349,7 +4350,7 @@ export const MethodDescriptorProto = { if (isSet(object.serverStreaming)) obj.serverStreaming = Boolean(object.serverStreaming); return obj; }, - toJSON(message: MethodDescriptorProto): unknown { + toJSON(message: MethodDescriptorProto): JsonSafe { const obj: any = {}; message.name !== undefined && (obj.name = message.name); message.inputType !== undefined && (obj.inputType = message.inputType); @@ -4644,7 +4645,7 @@ export const FileOptions = { if (Array.isArray(object?.uninterpretedOption)) obj.uninterpretedOption = object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)); return obj; }, - toJSON(message: FileOptions): unknown { + toJSON(message: FileOptions): JsonSafe { const obj: any = {}; message.javaPackage !== undefined && (obj.javaPackage = message.javaPackage); message.javaOuterClassname !== undefined && (obj.javaOuterClassname = message.javaOuterClassname); @@ -4954,7 +4955,7 @@ export const MessageOptions = { if (Array.isArray(object?.uninterpretedOption)) obj.uninterpretedOption = object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)); return obj; }, - toJSON(message: MessageOptions): unknown { + toJSON(message: MessageOptions): JsonSafe { const obj: any = {}; message.messageSetWireFormat !== undefined && (obj.messageSetWireFormat = message.messageSetWireFormat); message.noStandardDescriptorAccessor !== undefined && (obj.noStandardDescriptorAccessor = message.noStandardDescriptorAccessor); @@ -5136,7 +5137,7 @@ export const FieldOptions = { if (Array.isArray(object?.uninterpretedOption)) obj.uninterpretedOption = object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)); return obj; }, - toJSON(message: FieldOptions): unknown { + toJSON(message: FieldOptions): JsonSafe { const obj: any = {}; message.ctype !== undefined && (obj.ctype = fieldOptions_CTypeToJSON(message.ctype)); message.packed !== undefined && (obj.packed = message.packed); @@ -5288,7 +5289,7 @@ export const OneofOptions = { if (Array.isArray(object?.uninterpretedOption)) obj.uninterpretedOption = object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)); return obj; }, - toJSON(message: OneofOptions): unknown { + toJSON(message: OneofOptions): JsonSafe { const obj: any = {}; if (message.uninterpretedOption) { obj.uninterpretedOption = message.uninterpretedOption.map(e => e ? UninterpretedOption.toJSON(e) : undefined); @@ -5402,7 +5403,7 @@ export const EnumOptions = { if (Array.isArray(object?.uninterpretedOption)) obj.uninterpretedOption = object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)); return obj; }, - toJSON(message: EnumOptions): unknown { + toJSON(message: EnumOptions): JsonSafe { const obj: any = {}; message.allowAlias !== undefined && (obj.allowAlias = message.allowAlias); message.deprecated !== undefined && (obj.deprecated = message.deprecated); @@ -5526,7 +5527,7 @@ export const EnumValueOptions = { if (Array.isArray(object?.uninterpretedOption)) obj.uninterpretedOption = object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)); return obj; }, - toJSON(message: EnumValueOptions): unknown { + toJSON(message: EnumValueOptions): JsonSafe { const obj: any = {}; message.deprecated !== undefined && (obj.deprecated = message.deprecated); if (message.uninterpretedOption) { @@ -5641,7 +5642,7 @@ export const ServiceOptions = { if (Array.isArray(object?.uninterpretedOption)) obj.uninterpretedOption = object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)); return obj; }, - toJSON(message: ServiceOptions): unknown { + toJSON(message: ServiceOptions): JsonSafe { const obj: any = {}; message.deprecated !== undefined && (obj.deprecated = message.deprecated); if (message.uninterpretedOption) { @@ -5764,7 +5765,7 @@ export const MethodOptions = { if (Array.isArray(object?.uninterpretedOption)) obj.uninterpretedOption = object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)); return obj; }, - toJSON(message: MethodOptions): unknown { + toJSON(message: MethodOptions): JsonSafe { const obj: any = {}; message.deprecated !== undefined && (obj.deprecated = message.deprecated); message.idempotencyLevel !== undefined && (obj.idempotencyLevel = methodOptions_IdempotencyLevelToJSON(message.idempotencyLevel)); @@ -5928,7 +5929,7 @@ export const UninterpretedOption = { if (isSet(object.aggregateValue)) obj.aggregateValue = String(object.aggregateValue); return obj; }, - toJSON(message: UninterpretedOption): unknown { + toJSON(message: UninterpretedOption): JsonSafe { const obj: any = {}; if (message.name) { obj.name = message.name.map(e => e ? UninterpretedOption_NamePart.toJSON(e) : undefined); @@ -6092,7 +6093,7 @@ export const UninterpretedOption_NamePart = { if (isSet(object.isExtension)) obj.isExtension = Boolean(object.isExtension); return obj; }, - toJSON(message: UninterpretedOption_NamePart): unknown { + toJSON(message: UninterpretedOption_NamePart): JsonSafe { const obj: any = {}; message.namePart !== undefined && (obj.namePart = message.namePart); message.isExtension !== undefined && (obj.isExtension = message.isExtension); @@ -6189,7 +6190,7 @@ export const SourceCodeInfo = { if (Array.isArray(object?.location)) obj.location = object.location.map((e: any) => SourceCodeInfo_Location.fromJSON(e)); return obj; }, - toJSON(message: SourceCodeInfo): unknown { + toJSON(message: SourceCodeInfo): JsonSafe { const obj: any = {}; if (message.location) { obj.location = message.location.map(e => e ? SourceCodeInfo_Location.toJSON(e) : undefined); @@ -6337,7 +6338,7 @@ export const SourceCodeInfo_Location = { if (Array.isArray(object?.leadingDetachedComments)) obj.leadingDetachedComments = object.leadingDetachedComments.map((e: any) => String(e)); return obj; }, - toJSON(message: SourceCodeInfo_Location): unknown { + toJSON(message: SourceCodeInfo_Location): JsonSafe { const obj: any = {}; if (message.path) { obj.path = message.path.map(e => Math.round(e)); @@ -6491,7 +6492,7 @@ export const GeneratedCodeInfo = { if (Array.isArray(object?.annotation)) obj.annotation = object.annotation.map((e: any) => GeneratedCodeInfo_Annotation.fromJSON(e)); return obj; }, - toJSON(message: GeneratedCodeInfo): unknown { + toJSON(message: GeneratedCodeInfo): JsonSafe { const obj: any = {}; if (message.annotation) { obj.annotation = message.annotation.map(e => e ? GeneratedCodeInfo_Annotation.toJSON(e) : undefined); @@ -6622,7 +6623,7 @@ export const GeneratedCodeInfo_Annotation = { if (isSet(object.end)) obj.end = Number(object.end); return obj; }, - toJSON(message: GeneratedCodeInfo_Annotation): unknown { + toJSON(message: GeneratedCodeInfo_Annotation): JsonSafe { const obj: any = {}; if (message.path) { obj.path = message.path.map(e => Math.round(e)); @@ -6747,7 +6748,7 @@ export const FeatureSet = { if (isSet(object.utf8Validation)) obj.utf8Validation = featureSet_Utf8ValidationFromJSON(object.utf8Validation); return obj; }, - toJSON(message: FeatureSet): unknown { + toJSON(message: FeatureSet): JsonSafe { const obj: any = {}; message.utf8Validation !== undefined && (obj.utf8Validation = featureSet_Utf8ValidationToJSON(message.utf8Validation)); return obj; diff --git a/__fixtures__/misc/output-proto-amino/amino-msg-no-func/google/protobuf/duration.ts b/__fixtures__/misc/output-proto-amino/amino-msg-no-func/google/protobuf/duration.ts index bc7498a6ae..d56729d709 100644 --- a/__fixtures__/misc/output-proto-amino/amino-msg-no-func/google/protobuf/duration.ts +++ b/__fixtures__/misc/output-proto-amino/amino-msg-no-func/google/protobuf/duration.ts @@ -1,5 +1,6 @@ import { BinaryReader, BinaryWriter } from "../../binary"; import { isSet, DeepPartial } from "../../helpers"; +import { JsonSafe } from "../../json-safe"; export const protobufPackage = "google.protobuf"; /** * A Duration represents a signed, fixed-length span of time represented @@ -254,7 +255,7 @@ export const Duration = { if (isSet(object.nanos)) obj.nanos = Number(object.nanos); return obj; }, - toJSON(message: Duration): unknown { + toJSON(message: Duration): JsonSafe { const obj: any = {}; message.seconds !== undefined && (obj.seconds = (message.seconds || BigInt(0)).toString()); message.nanos !== undefined && (obj.nanos = Math.round(message.nanos)); diff --git a/__fixtures__/misc/output-proto-amino/amino-msg-no-func/google/protobuf/timestamp.ts b/__fixtures__/misc/output-proto-amino/amino-msg-no-func/google/protobuf/timestamp.ts index 167352acdf..259ef92539 100644 --- a/__fixtures__/misc/output-proto-amino/amino-msg-no-func/google/protobuf/timestamp.ts +++ b/__fixtures__/misc/output-proto-amino/amino-msg-no-func/google/protobuf/timestamp.ts @@ -1,5 +1,6 @@ import { BinaryReader, BinaryWriter } from "../../binary"; import { isSet, DeepPartial, fromJsonTimestamp, fromTimestamp } from "../../helpers"; +import { JsonSafe } from "../../json-safe"; export const protobufPackage = "google.protobuf"; /** * A Timestamp represents a point in time independent of any time zone or local @@ -324,7 +325,7 @@ export const Timestamp = { if (isSet(object.nanos)) obj.nanos = Number(object.nanos); return obj; }, - toJSON(message: Timestamp): unknown { + toJSON(message: Timestamp): JsonSafe { const obj: any = {}; message.seconds !== undefined && (obj.seconds = (message.seconds || BigInt(0)).toString()); message.nanos !== undefined && (obj.nanos = Math.round(message.nanos)); diff --git a/__fixtures__/misc/output-proto-amino/amino-msg-no-func/index.ts b/__fixtures__/misc/output-proto-amino/amino-msg-no-func/index.ts index 8c7bdc34cf..3757ae2467 100644 --- a/__fixtures__/misc/output-proto-amino/amino-msg-no-func/index.ts +++ b/__fixtures__/misc/output-proto-amino/amino-msg-no-func/index.ts @@ -12,6 +12,7 @@ export * from "./extern"; export * from "./react-query"; export * from "./mobx"; export * from "./pinia-endpoint"; +export * from "./json-safe"; export * from "./varint"; export * from "./utf8"; export * from "./binary"; \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/amino-msg-no-func/json-safe.ts b/__fixtures__/misc/output-proto-amino/amino-msg-no-func/json-safe.ts new file mode 100644 index 0000000000..7d46f89144 --- /dev/null +++ b/__fixtures__/misc/output-proto-amino/amino-msg-no-func/json-safe.ts @@ -0,0 +1,10 @@ +/** +* This file and any referenced files were automatically generated by @cosmology/telescope@latest +* DO NOT MODIFY BY HAND. Instead, download the latest proto files for your chain +* and run the transpile command or npm scripts command that is used to regenerate this bundle. +*/ + + +export type JsonSafe = { + [Prop in keyof T]: T[Prop] extends Uint8Array ? string : T[Prop] extends bigint ? string : T[Prop]; +} diff --git a/__fixtures__/misc/output-proto-amino/amino-msg-no-func/misc/all_fields.ts b/__fixtures__/misc/output-proto-amino/amino-msg-no-func/misc/all_fields.ts index 77411e862b..915effc180 100644 --- a/__fixtures__/misc/output-proto-amino/amino-msg-no-func/misc/all_fields.ts +++ b/__fixtures__/misc/output-proto-amino/amino-msg-no-func/misc/all_fields.ts @@ -5,6 +5,7 @@ import { Timestamp, TimestampAmino, TimestampSDKType } from "../google/protobuf/ import { BinaryReader, BinaryWriter } from "../binary"; import { toTimestamp, fromTimestamp, isSet, bytesFromBase64, base64FromBytes, DeepPartial } from "../helpers"; import { Decimal } from "@cosmjs/math"; +import { JsonSafe } from "../json-safe"; import { toUtf8, fromBase64, fromUtf8, toBase64 } from "@cosmjs/encoding"; import { encodePubkey, decodePubkey } from "@cosmjs/proto-signing"; export const protobufPackage = "misc"; @@ -877,7 +878,7 @@ export const EncodingTestForDontOmit = { if (Array.isArray(object?.dODecs)) obj.dODecs = object.dODecs.map((e: any) => String(e)); return obj; }, - toJSON(message: EncodingTestForDontOmit): unknown { + toJSON(message: EncodingTestForDontOmit): JsonSafe { const obj: any = {}; message.str !== undefined && (obj.str = message.str); message.dOStr !== undefined && (obj.dOStr = message.dOStr); @@ -2038,7 +2039,7 @@ export const EncodingTestForOmit = { if (Array.isArray(object?.oDecs)) obj.oDecs = object.oDecs.map((e: any) => String(e)); return obj; }, - toJSON(message: EncodingTestForOmit): unknown { + toJSON(message: EncodingTestForOmit): JsonSafe { const obj: any = {}; message.str !== undefined && (obj.str = message.str); message.oStr !== undefined && (obj.oStr = message.oStr); diff --git a/__fixtures__/misc/output-proto-amino/amino-msg-no-func/misc/eval_request.ts b/__fixtures__/misc/output-proto-amino/amino-msg-no-func/misc/eval_request.ts index 5986338d71..1dfb74d155 100644 --- a/__fixtures__/misc/output-proto-amino/amino-msg-no-func/misc/eval_request.ts +++ b/__fixtures__/misc/output-proto-amino/amino-msg-no-func/misc/eval_request.ts @@ -2,6 +2,7 @@ import { ExprValue, ExprValueAmino, ExprValueSDKType, IdRef, IdRefAmino, IdRefSD import { FeatureSet_Utf8Validation, featureSet_Utf8ValidationFromJSON, featureSet_Utf8ValidationToJSON } from "../google/protobuf/descriptor"; import { BinaryReader, BinaryWriter } from "../binary"; import { isSet, DeepPartial, isObject } from "../helpers"; +import { JsonSafe } from "../json-safe"; export const protobufPackage = "misc"; /** VoteOption enumerates the valid vote options for a given governance proposal. */ export enum VoteOption { @@ -243,7 +244,7 @@ export const EvalRequest_BindingsEntry = { if (isSet(object.value)) obj.value = ExprValue.fromJSON(object.value); return obj; }, - toJSON(message: EvalRequest_BindingsEntry): unknown { + toJSON(message: EvalRequest_BindingsEntry): JsonSafe { const obj: any = {}; message.key !== undefined && (obj.key = message.key); message.value !== undefined && (obj.value = message.value ? ExprValue.toJSON(message.value) : undefined); @@ -343,7 +344,7 @@ export const EvalRequest_RefsEntry = { if (isSet(object.value)) obj.value = IdRef.fromJSON(object.value); return obj; }, - toJSON(message: EvalRequest_RefsEntry): unknown { + toJSON(message: EvalRequest_RefsEntry): JsonSafe { const obj: any = {}; message.key !== undefined && (obj.key = message.key); message.value !== undefined && (obj.value = message.value ? IdRef.toJSON(message.value) : undefined); @@ -530,7 +531,7 @@ export const EvalRequest = { if (isSet(object.opt)) obj.opt = featureSet_Utf8ValidationFromJSON(object.opt); return obj; }, - toJSON(message: EvalRequest): unknown { + toJSON(message: EvalRequest): JsonSafe { const obj: any = {}; obj.bindings = {}; if (message.bindings) { @@ -785,7 +786,7 @@ export const AccessConfig = { if (isSet(object.sender)) obj.sender = String(object.sender); return obj; }, - toJSON(message: AccessConfig): unknown { + toJSON(message: AccessConfig): JsonSafe { const obj: any = {}; message.sender !== undefined && (obj.sender = message.sender); return obj; @@ -873,7 +874,7 @@ export const GenericAuthorization = { if (isSet(object.msg)) obj.msg = String(object.msg); return obj; }, - toJSON(message: GenericAuthorization): unknown { + toJSON(message: GenericAuthorization): JsonSafe { const obj: any = {}; message.msg !== undefined && (obj.msg = message.msg); return obj; diff --git a/__fixtures__/misc/output-proto-amino/amino-msg-no-func/misc/tx.ts b/__fixtures__/misc/output-proto-amino/amino-msg-no-func/misc/tx.ts index 2a12eeedbf..5febb5a6f1 100644 --- a/__fixtures__/misc/output-proto-amino/amino-msg-no-func/misc/tx.ts +++ b/__fixtures__/misc/output-proto-amino/amino-msg-no-func/misc/tx.ts @@ -1,6 +1,7 @@ import { EncodingTestForDontOmit, EncodingTestForDontOmitAmino, EncodingTestForDontOmitSDKType, EncodingTestForOmit, EncodingTestForOmitAmino, EncodingTestForOmitSDKType } from "./all_fields"; import { BinaryReader, BinaryWriter } from "../binary"; import { isSet, DeepPartial } from "../helpers"; +import { JsonSafe } from "../json-safe"; export const protobufPackage = "misc"; /** * MsgGrant is a request type for Grant method. It declares authorization to the grantee @@ -91,7 +92,7 @@ export const InputMsg = { if (isSet(object.oTests)) obj.oTests = EncodingTestForOmit.fromJSON(object.oTests); return obj; }, - toJSON(message: InputMsg): unknown { + toJSON(message: InputMsg): JsonSafe { const obj: any = {}; message.dOTests !== undefined && (obj.dOTests = message.dOTests ? EncodingTestForDontOmit.toJSON(message.dOTests) : undefined); message.oTests !== undefined && (obj.oTests = message.oTests ? EncodingTestForOmit.toJSON(message.oTests) : undefined); @@ -183,7 +184,7 @@ export const MsgResponse = { const obj = createBaseMsgResponse(); return obj; }, - toJSON(_: MsgResponse): unknown { + toJSON(_: MsgResponse): JsonSafe { const obj: any = {}; return obj; }, diff --git a/__fixtures__/misc/output-proto-amino/amino-msg-with-func/google/api/expr/v1alpha1/eval.ts b/__fixtures__/misc/output-proto-amino/amino-msg-with-func/google/api/expr/v1alpha1/eval.ts index 6902943167..d154618421 100644 --- a/__fixtures__/misc/output-proto-amino/amino-msg-with-func/google/api/expr/v1alpha1/eval.ts +++ b/__fixtures__/misc/output-proto-amino/amino-msg-with-func/google/api/expr/v1alpha1/eval.ts @@ -1,4 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../../binary"; +import { JsonSafe } from "../../../../json-safe"; import { DeepPartial, isSet } from "../../../../helpers"; export const protobufPackage = "google.api.expr.v1alpha1"; export interface ExprValue { @@ -74,7 +75,7 @@ export const ExprValue = { if (Array.isArray(object?.exprs)) obj.exprs = object.exprs.map((e: any) => IdRef.fromJSON(e)); return obj; }, - toJSON(message: ExprValue): unknown { + toJSON(message: ExprValue): JsonSafe { const obj: any = {}; if (message.exprs) { obj.exprs = message.exprs.map(e => e ? IdRef.toJSON(e) : undefined); @@ -172,7 +173,7 @@ export const IdRef = { if (isSet(object.id)) obj.id = Number(object.id); return obj; }, - toJSON(message: IdRef): unknown { + toJSON(message: IdRef): JsonSafe { const obj: any = {}; message.id !== undefined && (obj.id = Math.round(message.id)); return obj; diff --git a/__fixtures__/misc/output-proto-amino/amino-msg-with-func/google/protobuf/any.ts b/__fixtures__/misc/output-proto-amino/amino-msg-with-func/google/protobuf/any.ts index 31152a692c..3c85d6072b 100644 --- a/__fixtures__/misc/output-proto-amino/amino-msg-with-func/google/protobuf/any.ts +++ b/__fixtures__/misc/output-proto-amino/amino-msg-with-func/google/protobuf/any.ts @@ -1,5 +1,6 @@ import { BinaryReader, BinaryWriter } from "../../binary"; import { isSet, bytesFromBase64, base64FromBytes, DeepPartial } from "../../helpers"; +import { JsonSafe } from "../../json-safe"; export const protobufPackage = "google.protobuf"; /** * `Any` contains an arbitrary serialized protocol buffer message along with a @@ -370,7 +371,7 @@ export const Any = { if (isSet(object.value)) obj.value = bytesFromBase64(object.value); return obj; }, - toJSON(message: Any): unknown { + toJSON(message: Any): JsonSafe { const obj: any = {}; message.typeUrl !== undefined && (obj.typeUrl = message.typeUrl); message.value !== undefined && (obj.value = base64FromBytes(message.value !== undefined ? message.value : new Uint8Array())); diff --git a/__fixtures__/misc/output-proto-amino/amino-msg-with-func/google/protobuf/descriptor.ts b/__fixtures__/misc/output-proto-amino/amino-msg-with-func/google/protobuf/descriptor.ts index 935bbd4426..6f80a4fe59 100644 --- a/__fixtures__/misc/output-proto-amino/amino-msg-with-func/google/protobuf/descriptor.ts +++ b/__fixtures__/misc/output-proto-amino/amino-msg-with-func/google/protobuf/descriptor.ts @@ -1,4 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../binary"; +import { JsonSafe } from "../../json-safe"; import { DeepPartial, isSet, bytesFromBase64, base64FromBytes } from "../../helpers"; export const protobufPackage = "google.protobuf"; export enum FieldDescriptorProto_Type { @@ -2293,7 +2294,7 @@ export const FileDescriptorSet = { if (Array.isArray(object?.file)) obj.file = object.file.map((e: any) => FileDescriptorProto.fromJSON(e)); return obj; }, - toJSON(message: FileDescriptorSet): unknown { + toJSON(message: FileDescriptorSet): JsonSafe { const obj: any = {}; if (message.file) { obj.file = message.file.map(e => e ? FileDescriptorProto.toJSON(e) : undefined); @@ -2497,7 +2498,7 @@ export const FileDescriptorProto = { if (isSet(object.syntax)) obj.syntax = String(object.syntax); return obj; }, - toJSON(message: FileDescriptorProto): unknown { + toJSON(message: FileDescriptorProto): JsonSafe { const obj: any = {}; message.name !== undefined && (obj.name = message.name); message.package !== undefined && (obj.package = message.package); @@ -2830,7 +2831,7 @@ export const DescriptorProto = { if (Array.isArray(object?.reservedName)) obj.reservedName = object.reservedName.map((e: any) => String(e)); return obj; }, - toJSON(message: DescriptorProto): unknown { + toJSON(message: DescriptorProto): JsonSafe { const obj: any = {}; message.name !== undefined && (obj.name = message.name); if (message.field) { @@ -3097,7 +3098,7 @@ export const DescriptorProto_ExtensionRange = { if (isSet(object.options)) obj.options = ExtensionRangeOptions.fromJSON(object.options); return obj; }, - toJSON(message: DescriptorProto_ExtensionRange): unknown { + toJSON(message: DescriptorProto_ExtensionRange): JsonSafe { const obj: any = {}; message.start !== undefined && (obj.start = Math.round(message.start)); message.end !== undefined && (obj.end = Math.round(message.end)); @@ -3213,7 +3214,7 @@ export const DescriptorProto_ReservedRange = { if (isSet(object.end)) obj.end = Number(object.end); return obj; }, - toJSON(message: DescriptorProto_ReservedRange): unknown { + toJSON(message: DescriptorProto_ReservedRange): JsonSafe { const obj: any = {}; message.start !== undefined && (obj.start = Math.round(message.start)); message.end !== undefined && (obj.end = Math.round(message.end)); @@ -3310,7 +3311,7 @@ export const ExtensionRangeOptions = { if (Array.isArray(object?.uninterpretedOption)) obj.uninterpretedOption = object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)); return obj; }, - toJSON(message: ExtensionRangeOptions): unknown { + toJSON(message: ExtensionRangeOptions): JsonSafe { const obj: any = {}; if (message.uninterpretedOption) { obj.uninterpretedOption = message.uninterpretedOption.map(e => e ? UninterpretedOption.toJSON(e) : undefined); @@ -3480,7 +3481,7 @@ export const FieldDescriptorProto = { if (isSet(object.options)) obj.options = FieldOptions.fromJSON(object.options); return obj; }, - toJSON(message: FieldDescriptorProto): unknown { + toJSON(message: FieldDescriptorProto): JsonSafe { const obj: any = {}; message.name !== undefined && (obj.name = message.name); message.number !== undefined && (obj.number = Math.round(message.number)); @@ -3659,7 +3660,7 @@ export const OneofDescriptorProto = { if (isSet(object.options)) obj.options = OneofOptions.fromJSON(object.options); return obj; }, - toJSON(message: OneofDescriptorProto): unknown { + toJSON(message: OneofDescriptorProto): JsonSafe { const obj: any = {}; message.name !== undefined && (obj.name = message.name); message.options !== undefined && (obj.options = message.options ? OneofOptions.toJSON(message.options) : undefined); @@ -3790,7 +3791,7 @@ export const EnumDescriptorProto = { if (Array.isArray(object?.reservedName)) obj.reservedName = object.reservedName.map((e: any) => String(e)); return obj; }, - toJSON(message: EnumDescriptorProto): unknown { + toJSON(message: EnumDescriptorProto): JsonSafe { const obj: any = {}; message.name !== undefined && (obj.name = message.name); if (message.value) { @@ -3954,7 +3955,7 @@ export const EnumDescriptorProto_EnumReservedRange = { if (isSet(object.end)) obj.end = Number(object.end); return obj; }, - toJSON(message: EnumDescriptorProto_EnumReservedRange): unknown { + toJSON(message: EnumDescriptorProto_EnumReservedRange): JsonSafe { const obj: any = {}; message.start !== undefined && (obj.start = Math.round(message.start)); message.end !== undefined && (obj.end = Math.round(message.end)); @@ -4067,7 +4068,7 @@ export const EnumValueDescriptorProto = { if (isSet(object.options)) obj.options = EnumValueOptions.fromJSON(object.options); return obj; }, - toJSON(message: EnumValueDescriptorProto): unknown { + toJSON(message: EnumValueDescriptorProto): JsonSafe { const obj: any = {}; message.name !== undefined && (obj.name = message.name); message.number !== undefined && (obj.number = Math.round(message.number)); @@ -4191,7 +4192,7 @@ export const ServiceDescriptorProto = { if (isSet(object.options)) obj.options = ServiceOptions.fromJSON(object.options); return obj; }, - toJSON(message: ServiceDescriptorProto): unknown { + toJSON(message: ServiceDescriptorProto): JsonSafe { const obj: any = {}; message.name !== undefined && (obj.name = message.name); if (message.method) { @@ -4349,7 +4350,7 @@ export const MethodDescriptorProto = { if (isSet(object.serverStreaming)) obj.serverStreaming = Boolean(object.serverStreaming); return obj; }, - toJSON(message: MethodDescriptorProto): unknown { + toJSON(message: MethodDescriptorProto): JsonSafe { const obj: any = {}; message.name !== undefined && (obj.name = message.name); message.inputType !== undefined && (obj.inputType = message.inputType); @@ -4644,7 +4645,7 @@ export const FileOptions = { if (Array.isArray(object?.uninterpretedOption)) obj.uninterpretedOption = object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)); return obj; }, - toJSON(message: FileOptions): unknown { + toJSON(message: FileOptions): JsonSafe { const obj: any = {}; message.javaPackage !== undefined && (obj.javaPackage = message.javaPackage); message.javaOuterClassname !== undefined && (obj.javaOuterClassname = message.javaOuterClassname); @@ -4954,7 +4955,7 @@ export const MessageOptions = { if (Array.isArray(object?.uninterpretedOption)) obj.uninterpretedOption = object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)); return obj; }, - toJSON(message: MessageOptions): unknown { + toJSON(message: MessageOptions): JsonSafe { const obj: any = {}; message.messageSetWireFormat !== undefined && (obj.messageSetWireFormat = message.messageSetWireFormat); message.noStandardDescriptorAccessor !== undefined && (obj.noStandardDescriptorAccessor = message.noStandardDescriptorAccessor); @@ -5136,7 +5137,7 @@ export const FieldOptions = { if (Array.isArray(object?.uninterpretedOption)) obj.uninterpretedOption = object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)); return obj; }, - toJSON(message: FieldOptions): unknown { + toJSON(message: FieldOptions): JsonSafe { const obj: any = {}; message.ctype !== undefined && (obj.ctype = fieldOptions_CTypeToJSON(message.ctype)); message.packed !== undefined && (obj.packed = message.packed); @@ -5288,7 +5289,7 @@ export const OneofOptions = { if (Array.isArray(object?.uninterpretedOption)) obj.uninterpretedOption = object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)); return obj; }, - toJSON(message: OneofOptions): unknown { + toJSON(message: OneofOptions): JsonSafe { const obj: any = {}; if (message.uninterpretedOption) { obj.uninterpretedOption = message.uninterpretedOption.map(e => e ? UninterpretedOption.toJSON(e) : undefined); @@ -5402,7 +5403,7 @@ export const EnumOptions = { if (Array.isArray(object?.uninterpretedOption)) obj.uninterpretedOption = object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)); return obj; }, - toJSON(message: EnumOptions): unknown { + toJSON(message: EnumOptions): JsonSafe { const obj: any = {}; message.allowAlias !== undefined && (obj.allowAlias = message.allowAlias); message.deprecated !== undefined && (obj.deprecated = message.deprecated); @@ -5526,7 +5527,7 @@ export const EnumValueOptions = { if (Array.isArray(object?.uninterpretedOption)) obj.uninterpretedOption = object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)); return obj; }, - toJSON(message: EnumValueOptions): unknown { + toJSON(message: EnumValueOptions): JsonSafe { const obj: any = {}; message.deprecated !== undefined && (obj.deprecated = message.deprecated); if (message.uninterpretedOption) { @@ -5641,7 +5642,7 @@ export const ServiceOptions = { if (Array.isArray(object?.uninterpretedOption)) obj.uninterpretedOption = object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)); return obj; }, - toJSON(message: ServiceOptions): unknown { + toJSON(message: ServiceOptions): JsonSafe { const obj: any = {}; message.deprecated !== undefined && (obj.deprecated = message.deprecated); if (message.uninterpretedOption) { @@ -5764,7 +5765,7 @@ export const MethodOptions = { if (Array.isArray(object?.uninterpretedOption)) obj.uninterpretedOption = object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)); return obj; }, - toJSON(message: MethodOptions): unknown { + toJSON(message: MethodOptions): JsonSafe { const obj: any = {}; message.deprecated !== undefined && (obj.deprecated = message.deprecated); message.idempotencyLevel !== undefined && (obj.idempotencyLevel = methodOptions_IdempotencyLevelToJSON(message.idempotencyLevel)); @@ -5928,7 +5929,7 @@ export const UninterpretedOption = { if (isSet(object.aggregateValue)) obj.aggregateValue = String(object.aggregateValue); return obj; }, - toJSON(message: UninterpretedOption): unknown { + toJSON(message: UninterpretedOption): JsonSafe { const obj: any = {}; if (message.name) { obj.name = message.name.map(e => e ? UninterpretedOption_NamePart.toJSON(e) : undefined); @@ -6092,7 +6093,7 @@ export const UninterpretedOption_NamePart = { if (isSet(object.isExtension)) obj.isExtension = Boolean(object.isExtension); return obj; }, - toJSON(message: UninterpretedOption_NamePart): unknown { + toJSON(message: UninterpretedOption_NamePart): JsonSafe { const obj: any = {}; message.namePart !== undefined && (obj.namePart = message.namePart); message.isExtension !== undefined && (obj.isExtension = message.isExtension); @@ -6189,7 +6190,7 @@ export const SourceCodeInfo = { if (Array.isArray(object?.location)) obj.location = object.location.map((e: any) => SourceCodeInfo_Location.fromJSON(e)); return obj; }, - toJSON(message: SourceCodeInfo): unknown { + toJSON(message: SourceCodeInfo): JsonSafe { const obj: any = {}; if (message.location) { obj.location = message.location.map(e => e ? SourceCodeInfo_Location.toJSON(e) : undefined); @@ -6337,7 +6338,7 @@ export const SourceCodeInfo_Location = { if (Array.isArray(object?.leadingDetachedComments)) obj.leadingDetachedComments = object.leadingDetachedComments.map((e: any) => String(e)); return obj; }, - toJSON(message: SourceCodeInfo_Location): unknown { + toJSON(message: SourceCodeInfo_Location): JsonSafe { const obj: any = {}; if (message.path) { obj.path = message.path.map(e => Math.round(e)); @@ -6491,7 +6492,7 @@ export const GeneratedCodeInfo = { if (Array.isArray(object?.annotation)) obj.annotation = object.annotation.map((e: any) => GeneratedCodeInfo_Annotation.fromJSON(e)); return obj; }, - toJSON(message: GeneratedCodeInfo): unknown { + toJSON(message: GeneratedCodeInfo): JsonSafe { const obj: any = {}; if (message.annotation) { obj.annotation = message.annotation.map(e => e ? GeneratedCodeInfo_Annotation.toJSON(e) : undefined); @@ -6622,7 +6623,7 @@ export const GeneratedCodeInfo_Annotation = { if (isSet(object.end)) obj.end = Number(object.end); return obj; }, - toJSON(message: GeneratedCodeInfo_Annotation): unknown { + toJSON(message: GeneratedCodeInfo_Annotation): JsonSafe { const obj: any = {}; if (message.path) { obj.path = message.path.map(e => Math.round(e)); @@ -6747,7 +6748,7 @@ export const FeatureSet = { if (isSet(object.utf8Validation)) obj.utf8Validation = featureSet_Utf8ValidationFromJSON(object.utf8Validation); return obj; }, - toJSON(message: FeatureSet): unknown { + toJSON(message: FeatureSet): JsonSafe { const obj: any = {}; message.utf8Validation !== undefined && (obj.utf8Validation = featureSet_Utf8ValidationToJSON(message.utf8Validation)); return obj; diff --git a/__fixtures__/misc/output-proto-amino/amino-msg-with-func/google/protobuf/duration.ts b/__fixtures__/misc/output-proto-amino/amino-msg-with-func/google/protobuf/duration.ts index bc7498a6ae..d56729d709 100644 --- a/__fixtures__/misc/output-proto-amino/amino-msg-with-func/google/protobuf/duration.ts +++ b/__fixtures__/misc/output-proto-amino/amino-msg-with-func/google/protobuf/duration.ts @@ -1,5 +1,6 @@ import { BinaryReader, BinaryWriter } from "../../binary"; import { isSet, DeepPartial } from "../../helpers"; +import { JsonSafe } from "../../json-safe"; export const protobufPackage = "google.protobuf"; /** * A Duration represents a signed, fixed-length span of time represented @@ -254,7 +255,7 @@ export const Duration = { if (isSet(object.nanos)) obj.nanos = Number(object.nanos); return obj; }, - toJSON(message: Duration): unknown { + toJSON(message: Duration): JsonSafe { const obj: any = {}; message.seconds !== undefined && (obj.seconds = (message.seconds || BigInt(0)).toString()); message.nanos !== undefined && (obj.nanos = Math.round(message.nanos)); diff --git a/__fixtures__/misc/output-proto-amino/amino-msg-with-func/google/protobuf/timestamp.ts b/__fixtures__/misc/output-proto-amino/amino-msg-with-func/google/protobuf/timestamp.ts index 167352acdf..259ef92539 100644 --- a/__fixtures__/misc/output-proto-amino/amino-msg-with-func/google/protobuf/timestamp.ts +++ b/__fixtures__/misc/output-proto-amino/amino-msg-with-func/google/protobuf/timestamp.ts @@ -1,5 +1,6 @@ import { BinaryReader, BinaryWriter } from "../../binary"; import { isSet, DeepPartial, fromJsonTimestamp, fromTimestamp } from "../../helpers"; +import { JsonSafe } from "../../json-safe"; export const protobufPackage = "google.protobuf"; /** * A Timestamp represents a point in time independent of any time zone or local @@ -324,7 +325,7 @@ export const Timestamp = { if (isSet(object.nanos)) obj.nanos = Number(object.nanos); return obj; }, - toJSON(message: Timestamp): unknown { + toJSON(message: Timestamp): JsonSafe { const obj: any = {}; message.seconds !== undefined && (obj.seconds = (message.seconds || BigInt(0)).toString()); message.nanos !== undefined && (obj.nanos = Math.round(message.nanos)); diff --git a/__fixtures__/misc/output-proto-amino/amino-msg-with-func/index.ts b/__fixtures__/misc/output-proto-amino/amino-msg-with-func/index.ts index 8c7bdc34cf..3757ae2467 100644 --- a/__fixtures__/misc/output-proto-amino/amino-msg-with-func/index.ts +++ b/__fixtures__/misc/output-proto-amino/amino-msg-with-func/index.ts @@ -12,6 +12,7 @@ export * from "./extern"; export * from "./react-query"; export * from "./mobx"; export * from "./pinia-endpoint"; +export * from "./json-safe"; export * from "./varint"; export * from "./utf8"; export * from "./binary"; \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/amino-msg-with-func/json-safe.ts b/__fixtures__/misc/output-proto-amino/amino-msg-with-func/json-safe.ts new file mode 100644 index 0000000000..7d46f89144 --- /dev/null +++ b/__fixtures__/misc/output-proto-amino/amino-msg-with-func/json-safe.ts @@ -0,0 +1,10 @@ +/** +* This file and any referenced files were automatically generated by @cosmology/telescope@latest +* DO NOT MODIFY BY HAND. Instead, download the latest proto files for your chain +* and run the transpile command or npm scripts command that is used to regenerate this bundle. +*/ + + +export type JsonSafe = { + [Prop in keyof T]: T[Prop] extends Uint8Array ? string : T[Prop] extends bigint ? string : T[Prop]; +} diff --git a/__fixtures__/misc/output-proto-amino/amino-msg-with-func/misc/all_fields.ts b/__fixtures__/misc/output-proto-amino/amino-msg-with-func/misc/all_fields.ts index 77411e862b..915effc180 100644 --- a/__fixtures__/misc/output-proto-amino/amino-msg-with-func/misc/all_fields.ts +++ b/__fixtures__/misc/output-proto-amino/amino-msg-with-func/misc/all_fields.ts @@ -5,6 +5,7 @@ import { Timestamp, TimestampAmino, TimestampSDKType } from "../google/protobuf/ import { BinaryReader, BinaryWriter } from "../binary"; import { toTimestamp, fromTimestamp, isSet, bytesFromBase64, base64FromBytes, DeepPartial } from "../helpers"; import { Decimal } from "@cosmjs/math"; +import { JsonSafe } from "../json-safe"; import { toUtf8, fromBase64, fromUtf8, toBase64 } from "@cosmjs/encoding"; import { encodePubkey, decodePubkey } from "@cosmjs/proto-signing"; export const protobufPackage = "misc"; @@ -877,7 +878,7 @@ export const EncodingTestForDontOmit = { if (Array.isArray(object?.dODecs)) obj.dODecs = object.dODecs.map((e: any) => String(e)); return obj; }, - toJSON(message: EncodingTestForDontOmit): unknown { + toJSON(message: EncodingTestForDontOmit): JsonSafe { const obj: any = {}; message.str !== undefined && (obj.str = message.str); message.dOStr !== undefined && (obj.dOStr = message.dOStr); @@ -2038,7 +2039,7 @@ export const EncodingTestForOmit = { if (Array.isArray(object?.oDecs)) obj.oDecs = object.oDecs.map((e: any) => String(e)); return obj; }, - toJSON(message: EncodingTestForOmit): unknown { + toJSON(message: EncodingTestForOmit): JsonSafe { const obj: any = {}; message.str !== undefined && (obj.str = message.str); message.oStr !== undefined && (obj.oStr = message.oStr); diff --git a/__fixtures__/misc/output-proto-amino/amino-msg-with-func/misc/eval_request.ts b/__fixtures__/misc/output-proto-amino/amino-msg-with-func/misc/eval_request.ts index 759067a726..cfedf86dcc 100644 --- a/__fixtures__/misc/output-proto-amino/amino-msg-with-func/misc/eval_request.ts +++ b/__fixtures__/misc/output-proto-amino/amino-msg-with-func/misc/eval_request.ts @@ -2,6 +2,7 @@ import { ExprValue, ExprValueAmino, ExprValueSDKType, IdRef, IdRefAmino, IdRefSD import { FeatureSet_Utf8Validation, featureSet_Utf8ValidationFromJSON, featureSet_Utf8ValidationToJSON } from "../google/protobuf/descriptor"; import { BinaryReader, BinaryWriter } from "../binary"; import { isSet, DeepPartial, isObject } from "../helpers"; +import { JsonSafe } from "../json-safe"; export const protobufPackage = "misc"; /** VoteOption enumerates the valid vote options for a given governance proposal. */ export enum VoteOption { @@ -243,7 +244,7 @@ export const EvalRequest_BindingsEntry = { if (isSet(object.value)) obj.value = ExprValue.fromJSON(object.value); return obj; }, - toJSON(message: EvalRequest_BindingsEntry): unknown { + toJSON(message: EvalRequest_BindingsEntry): JsonSafe { const obj: any = {}; message.key !== undefined && (obj.key = message.key); message.value !== undefined && (obj.value = message.value ? ExprValue.toJSON(message.value) : undefined); @@ -343,7 +344,7 @@ export const EvalRequest_RefsEntry = { if (isSet(object.value)) obj.value = IdRef.fromJSON(object.value); return obj; }, - toJSON(message: EvalRequest_RefsEntry): unknown { + toJSON(message: EvalRequest_RefsEntry): JsonSafe { const obj: any = {}; message.key !== undefined && (obj.key = message.key); message.value !== undefined && (obj.value = message.value ? IdRef.toJSON(message.value) : undefined); @@ -530,7 +531,7 @@ export const EvalRequest = { if (isSet(object.opt)) obj.opt = featureSet_Utf8ValidationFromJSON(object.opt); return obj; }, - toJSON(message: EvalRequest): unknown { + toJSON(message: EvalRequest): JsonSafe { const obj: any = {}; obj.bindings = {}; if (message.bindings) { @@ -785,7 +786,7 @@ export const AccessConfig = { if (isSet(object.sender)) obj.sender = String(object.sender); return obj; }, - toJSON(message: AccessConfig): unknown { + toJSON(message: AccessConfig): JsonSafe { const obj: any = {}; message.sender !== undefined && (obj.sender = message.sender); return obj; @@ -873,7 +874,7 @@ export const GenericAuthorization = { if (isSet(object.msg)) obj.msg = String(object.msg); return obj; }, - toJSON(message: GenericAuthorization): unknown { + toJSON(message: GenericAuthorization): JsonSafe { const obj: any = {}; message.msg !== undefined && (obj.msg = message.msg); return obj; diff --git a/__fixtures__/misc/output-proto-amino/amino-msg-with-func/misc/tx.ts b/__fixtures__/misc/output-proto-amino/amino-msg-with-func/misc/tx.ts index 2a12eeedbf..5febb5a6f1 100644 --- a/__fixtures__/misc/output-proto-amino/amino-msg-with-func/misc/tx.ts +++ b/__fixtures__/misc/output-proto-amino/amino-msg-with-func/misc/tx.ts @@ -1,6 +1,7 @@ import { EncodingTestForDontOmit, EncodingTestForDontOmitAmino, EncodingTestForDontOmitSDKType, EncodingTestForOmit, EncodingTestForOmitAmino, EncodingTestForOmitSDKType } from "./all_fields"; import { BinaryReader, BinaryWriter } from "../binary"; import { isSet, DeepPartial } from "../helpers"; +import { JsonSafe } from "../json-safe"; export const protobufPackage = "misc"; /** * MsgGrant is a request type for Grant method. It declares authorization to the grantee @@ -91,7 +92,7 @@ export const InputMsg = { if (isSet(object.oTests)) obj.oTests = EncodingTestForOmit.fromJSON(object.oTests); return obj; }, - toJSON(message: InputMsg): unknown { + toJSON(message: InputMsg): JsonSafe { const obj: any = {}; message.dOTests !== undefined && (obj.dOTests = message.dOTests ? EncodingTestForDontOmit.toJSON(message.dOTests) : undefined); message.oTests !== undefined && (obj.oTests = message.oTests ? EncodingTestForOmit.toJSON(message.oTests) : undefined); @@ -183,7 +184,7 @@ export const MsgResponse = { const obj = createBaseMsgResponse(); return obj; }, - toJSON(_: MsgResponse): unknown { + toJSON(_: MsgResponse): JsonSafe { const obj: any = {}; return obj; }, diff --git a/__fixtures__/misc/output-proto-amino/amino-no-msg-with-func/google/api/expr/v1alpha1/eval.ts b/__fixtures__/misc/output-proto-amino/amino-no-msg-with-func/google/api/expr/v1alpha1/eval.ts index 2ac91133b4..1d3aa73d90 100644 --- a/__fixtures__/misc/output-proto-amino/amino-no-msg-with-func/google/api/expr/v1alpha1/eval.ts +++ b/__fixtures__/misc/output-proto-amino/amino-no-msg-with-func/google/api/expr/v1alpha1/eval.ts @@ -1,4 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../../binary"; +import { JsonSafe } from "../../../../json-safe"; import { DeepPartial, isSet } from "../../../../helpers"; export const protobufPackage = "google.api.expr.v1alpha1"; export interface ExprValue { @@ -66,7 +67,7 @@ export const ExprValue = { if (Array.isArray(object?.exprs)) obj.exprs = object.exprs.map((e: any) => IdRef.fromJSON(e)); return obj; }, - toJSON(message: ExprValue): unknown { + toJSON(message: ExprValue): JsonSafe { const obj: any = {}; if (message.exprs) { obj.exprs = message.exprs.map(e => e ? IdRef.toJSON(e) : undefined); @@ -161,7 +162,7 @@ export const IdRef = { if (isSet(object.id)) obj.id = Number(object.id); return obj; }, - toJSON(message: IdRef): unknown { + toJSON(message: IdRef): JsonSafe { const obj: any = {}; message.id !== undefined && (obj.id = Math.round(message.id)); return obj; diff --git a/__fixtures__/misc/output-proto-amino/amino-no-msg-with-func/google/protobuf/any.ts b/__fixtures__/misc/output-proto-amino/amino-no-msg-with-func/google/protobuf/any.ts index 857dc2849c..69008be93d 100644 --- a/__fixtures__/misc/output-proto-amino/amino-no-msg-with-func/google/protobuf/any.ts +++ b/__fixtures__/misc/output-proto-amino/amino-no-msg-with-func/google/protobuf/any.ts @@ -1,5 +1,6 @@ import { BinaryReader, BinaryWriter } from "../../binary"; import { isSet, bytesFromBase64, base64FromBytes, DeepPartial } from "../../helpers"; +import { JsonSafe } from "../../json-safe"; export const protobufPackage = "google.protobuf"; /** * `Any` contains an arbitrary serialized protocol buffer message along with a @@ -366,7 +367,7 @@ export const Any = { if (isSet(object.value)) obj.value = bytesFromBase64(object.value); return obj; }, - toJSON(message: Any): unknown { + toJSON(message: Any): JsonSafe { const obj: any = {}; message.typeUrl !== undefined && (obj.typeUrl = message.typeUrl); message.value !== undefined && (obj.value = base64FromBytes(message.value !== undefined ? message.value : new Uint8Array())); diff --git a/__fixtures__/misc/output-proto-amino/amino-no-msg-with-func/google/protobuf/descriptor.ts b/__fixtures__/misc/output-proto-amino/amino-no-msg-with-func/google/protobuf/descriptor.ts index f1e37b28e4..c3e3b3a76d 100644 --- a/__fixtures__/misc/output-proto-amino/amino-no-msg-with-func/google/protobuf/descriptor.ts +++ b/__fixtures__/misc/output-proto-amino/amino-no-msg-with-func/google/protobuf/descriptor.ts @@ -1,4 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../binary"; +import { JsonSafe } from "../../json-safe"; import { DeepPartial, isSet, bytesFromBase64, base64FromBytes } from "../../helpers"; export const protobufPackage = "google.protobuf"; export enum FieldDescriptorProto_Type { @@ -2181,7 +2182,7 @@ export const FileDescriptorSet = { if (Array.isArray(object?.file)) obj.file = object.file.map((e: any) => FileDescriptorProto.fromJSON(e)); return obj; }, - toJSON(message: FileDescriptorSet): unknown { + toJSON(message: FileDescriptorSet): JsonSafe { const obj: any = {}; if (message.file) { obj.file = message.file.map(e => e ? FileDescriptorProto.toJSON(e) : undefined); @@ -2382,7 +2383,7 @@ export const FileDescriptorProto = { if (isSet(object.syntax)) obj.syntax = String(object.syntax); return obj; }, - toJSON(message: FileDescriptorProto): unknown { + toJSON(message: FileDescriptorProto): JsonSafe { const obj: any = {}; message.name !== undefined && (obj.name = message.name); message.package !== undefined && (obj.package = message.package); @@ -2712,7 +2713,7 @@ export const DescriptorProto = { if (Array.isArray(object?.reservedName)) obj.reservedName = object.reservedName.map((e: any) => String(e)); return obj; }, - toJSON(message: DescriptorProto): unknown { + toJSON(message: DescriptorProto): JsonSafe { const obj: any = {}; message.name !== undefined && (obj.name = message.name); if (message.field) { @@ -2976,7 +2977,7 @@ export const DescriptorProto_ExtensionRange = { if (isSet(object.options)) obj.options = ExtensionRangeOptions.fromJSON(object.options); return obj; }, - toJSON(message: DescriptorProto_ExtensionRange): unknown { + toJSON(message: DescriptorProto_ExtensionRange): JsonSafe { const obj: any = {}; message.start !== undefined && (obj.start = Math.round(message.start)); message.end !== undefined && (obj.end = Math.round(message.end)); @@ -3089,7 +3090,7 @@ export const DescriptorProto_ReservedRange = { if (isSet(object.end)) obj.end = Number(object.end); return obj; }, - toJSON(message: DescriptorProto_ReservedRange): unknown { + toJSON(message: DescriptorProto_ReservedRange): JsonSafe { const obj: any = {}; message.start !== undefined && (obj.start = Math.round(message.start)); message.end !== undefined && (obj.end = Math.round(message.end)); @@ -3183,7 +3184,7 @@ export const ExtensionRangeOptions = { if (Array.isArray(object?.uninterpretedOption)) obj.uninterpretedOption = object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)); return obj; }, - toJSON(message: ExtensionRangeOptions): unknown { + toJSON(message: ExtensionRangeOptions): JsonSafe { const obj: any = {}; if (message.uninterpretedOption) { obj.uninterpretedOption = message.uninterpretedOption.map(e => e ? UninterpretedOption.toJSON(e) : undefined); @@ -3350,7 +3351,7 @@ export const FieldDescriptorProto = { if (isSet(object.options)) obj.options = FieldOptions.fromJSON(object.options); return obj; }, - toJSON(message: FieldDescriptorProto): unknown { + toJSON(message: FieldDescriptorProto): JsonSafe { const obj: any = {}; message.name !== undefined && (obj.name = message.name); message.number !== undefined && (obj.number = Math.round(message.number)); @@ -3526,7 +3527,7 @@ export const OneofDescriptorProto = { if (isSet(object.options)) obj.options = OneofOptions.fromJSON(object.options); return obj; }, - toJSON(message: OneofDescriptorProto): unknown { + toJSON(message: OneofDescriptorProto): JsonSafe { const obj: any = {}; message.name !== undefined && (obj.name = message.name); message.options !== undefined && (obj.options = message.options ? OneofOptions.toJSON(message.options) : undefined); @@ -3654,7 +3655,7 @@ export const EnumDescriptorProto = { if (Array.isArray(object?.reservedName)) obj.reservedName = object.reservedName.map((e: any) => String(e)); return obj; }, - toJSON(message: EnumDescriptorProto): unknown { + toJSON(message: EnumDescriptorProto): JsonSafe { const obj: any = {}; message.name !== undefined && (obj.name = message.name); if (message.value) { @@ -3815,7 +3816,7 @@ export const EnumDescriptorProto_EnumReservedRange = { if (isSet(object.end)) obj.end = Number(object.end); return obj; }, - toJSON(message: EnumDescriptorProto_EnumReservedRange): unknown { + toJSON(message: EnumDescriptorProto_EnumReservedRange): JsonSafe { const obj: any = {}; message.start !== undefined && (obj.start = Math.round(message.start)); message.end !== undefined && (obj.end = Math.round(message.end)); @@ -3925,7 +3926,7 @@ export const EnumValueDescriptorProto = { if (isSet(object.options)) obj.options = EnumValueOptions.fromJSON(object.options); return obj; }, - toJSON(message: EnumValueDescriptorProto): unknown { + toJSON(message: EnumValueDescriptorProto): JsonSafe { const obj: any = {}; message.name !== undefined && (obj.name = message.name); message.number !== undefined && (obj.number = Math.round(message.number)); @@ -4046,7 +4047,7 @@ export const ServiceDescriptorProto = { if (isSet(object.options)) obj.options = ServiceOptions.fromJSON(object.options); return obj; }, - toJSON(message: ServiceDescriptorProto): unknown { + toJSON(message: ServiceDescriptorProto): JsonSafe { const obj: any = {}; message.name !== undefined && (obj.name = message.name); if (message.method) { @@ -4201,7 +4202,7 @@ export const MethodDescriptorProto = { if (isSet(object.serverStreaming)) obj.serverStreaming = Boolean(object.serverStreaming); return obj; }, - toJSON(message: MethodDescriptorProto): unknown { + toJSON(message: MethodDescriptorProto): JsonSafe { const obj: any = {}; message.name !== undefined && (obj.name = message.name); message.inputType !== undefined && (obj.inputType = message.inputType); @@ -4493,7 +4494,7 @@ export const FileOptions = { if (Array.isArray(object?.uninterpretedOption)) obj.uninterpretedOption = object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)); return obj; }, - toJSON(message: FileOptions): unknown { + toJSON(message: FileOptions): JsonSafe { const obj: any = {}; message.javaPackage !== undefined && (obj.javaPackage = message.javaPackage); message.javaOuterClassname !== undefined && (obj.javaOuterClassname = message.javaOuterClassname); @@ -4800,7 +4801,7 @@ export const MessageOptions = { if (Array.isArray(object?.uninterpretedOption)) obj.uninterpretedOption = object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)); return obj; }, - toJSON(message: MessageOptions): unknown { + toJSON(message: MessageOptions): JsonSafe { const obj: any = {}; message.messageSetWireFormat !== undefined && (obj.messageSetWireFormat = message.messageSetWireFormat); message.noStandardDescriptorAccessor !== undefined && (obj.noStandardDescriptorAccessor = message.noStandardDescriptorAccessor); @@ -4979,7 +4980,7 @@ export const FieldOptions = { if (Array.isArray(object?.uninterpretedOption)) obj.uninterpretedOption = object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)); return obj; }, - toJSON(message: FieldOptions): unknown { + toJSON(message: FieldOptions): JsonSafe { const obj: any = {}; message.ctype !== undefined && (obj.ctype = fieldOptions_CTypeToJSON(message.ctype)); message.packed !== undefined && (obj.packed = message.packed); @@ -5128,7 +5129,7 @@ export const OneofOptions = { if (Array.isArray(object?.uninterpretedOption)) obj.uninterpretedOption = object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)); return obj; }, - toJSON(message: OneofOptions): unknown { + toJSON(message: OneofOptions): JsonSafe { const obj: any = {}; if (message.uninterpretedOption) { obj.uninterpretedOption = message.uninterpretedOption.map(e => e ? UninterpretedOption.toJSON(e) : undefined); @@ -5239,7 +5240,7 @@ export const EnumOptions = { if (Array.isArray(object?.uninterpretedOption)) obj.uninterpretedOption = object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)); return obj; }, - toJSON(message: EnumOptions): unknown { + toJSON(message: EnumOptions): JsonSafe { const obj: any = {}; message.allowAlias !== undefined && (obj.allowAlias = message.allowAlias); message.deprecated !== undefined && (obj.deprecated = message.deprecated); @@ -5360,7 +5361,7 @@ export const EnumValueOptions = { if (Array.isArray(object?.uninterpretedOption)) obj.uninterpretedOption = object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)); return obj; }, - toJSON(message: EnumValueOptions): unknown { + toJSON(message: EnumValueOptions): JsonSafe { const obj: any = {}; message.deprecated !== undefined && (obj.deprecated = message.deprecated); if (message.uninterpretedOption) { @@ -5472,7 +5473,7 @@ export const ServiceOptions = { if (Array.isArray(object?.uninterpretedOption)) obj.uninterpretedOption = object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)); return obj; }, - toJSON(message: ServiceOptions): unknown { + toJSON(message: ServiceOptions): JsonSafe { const obj: any = {}; message.deprecated !== undefined && (obj.deprecated = message.deprecated); if (message.uninterpretedOption) { @@ -5592,7 +5593,7 @@ export const MethodOptions = { if (Array.isArray(object?.uninterpretedOption)) obj.uninterpretedOption = object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)); return obj; }, - toJSON(message: MethodOptions): unknown { + toJSON(message: MethodOptions): JsonSafe { const obj: any = {}; message.deprecated !== undefined && (obj.deprecated = message.deprecated); message.idempotencyLevel !== undefined && (obj.idempotencyLevel = methodOptions_IdempotencyLevelToJSON(message.idempotencyLevel)); @@ -5753,7 +5754,7 @@ export const UninterpretedOption = { if (isSet(object.aggregateValue)) obj.aggregateValue = String(object.aggregateValue); return obj; }, - toJSON(message: UninterpretedOption): unknown { + toJSON(message: UninterpretedOption): JsonSafe { const obj: any = {}; if (message.name) { obj.name = message.name.map(e => e ? UninterpretedOption_NamePart.toJSON(e) : undefined); @@ -5914,7 +5915,7 @@ export const UninterpretedOption_NamePart = { if (isSet(object.isExtension)) obj.isExtension = Boolean(object.isExtension); return obj; }, - toJSON(message: UninterpretedOption_NamePart): unknown { + toJSON(message: UninterpretedOption_NamePart): JsonSafe { const obj: any = {}; message.namePart !== undefined && (obj.namePart = message.namePart); message.isExtension !== undefined && (obj.isExtension = message.isExtension); @@ -6008,7 +6009,7 @@ export const SourceCodeInfo = { if (Array.isArray(object?.location)) obj.location = object.location.map((e: any) => SourceCodeInfo_Location.fromJSON(e)); return obj; }, - toJSON(message: SourceCodeInfo): unknown { + toJSON(message: SourceCodeInfo): JsonSafe { const obj: any = {}; if (message.location) { obj.location = message.location.map(e => e ? SourceCodeInfo_Location.toJSON(e) : undefined); @@ -6153,7 +6154,7 @@ export const SourceCodeInfo_Location = { if (Array.isArray(object?.leadingDetachedComments)) obj.leadingDetachedComments = object.leadingDetachedComments.map((e: any) => String(e)); return obj; }, - toJSON(message: SourceCodeInfo_Location): unknown { + toJSON(message: SourceCodeInfo_Location): JsonSafe { const obj: any = {}; if (message.path) { obj.path = message.path.map(e => Math.round(e)); @@ -6304,7 +6305,7 @@ export const GeneratedCodeInfo = { if (Array.isArray(object?.annotation)) obj.annotation = object.annotation.map((e: any) => GeneratedCodeInfo_Annotation.fromJSON(e)); return obj; }, - toJSON(message: GeneratedCodeInfo): unknown { + toJSON(message: GeneratedCodeInfo): JsonSafe { const obj: any = {}; if (message.annotation) { obj.annotation = message.annotation.map(e => e ? GeneratedCodeInfo_Annotation.toJSON(e) : undefined); @@ -6432,7 +6433,7 @@ export const GeneratedCodeInfo_Annotation = { if (isSet(object.end)) obj.end = Number(object.end); return obj; }, - toJSON(message: GeneratedCodeInfo_Annotation): unknown { + toJSON(message: GeneratedCodeInfo_Annotation): JsonSafe { const obj: any = {}; if (message.path) { obj.path = message.path.map(e => Math.round(e)); @@ -6554,7 +6555,7 @@ export const FeatureSet = { if (isSet(object.utf8Validation)) obj.utf8Validation = featureSet_Utf8ValidationFromJSON(object.utf8Validation); return obj; }, - toJSON(message: FeatureSet): unknown { + toJSON(message: FeatureSet): JsonSafe { const obj: any = {}; message.utf8Validation !== undefined && (obj.utf8Validation = featureSet_Utf8ValidationToJSON(message.utf8Validation)); return obj; diff --git a/__fixtures__/misc/output-proto-amino/amino-no-msg-with-func/google/protobuf/duration.ts b/__fixtures__/misc/output-proto-amino/amino-no-msg-with-func/google/protobuf/duration.ts index 8ff624cc83..c71d46f98d 100644 --- a/__fixtures__/misc/output-proto-amino/amino-no-msg-with-func/google/protobuf/duration.ts +++ b/__fixtures__/misc/output-proto-amino/amino-no-msg-with-func/google/protobuf/duration.ts @@ -1,5 +1,6 @@ import { BinaryReader, BinaryWriter } from "../../binary"; import { isSet, DeepPartial } from "../../helpers"; +import { JsonSafe } from "../../json-safe"; export const protobufPackage = "google.protobuf"; /** * A Duration represents a signed, fixed-length span of time represented @@ -250,7 +251,7 @@ export const Duration = { if (isSet(object.nanos)) obj.nanos = Number(object.nanos); return obj; }, - toJSON(message: Duration): unknown { + toJSON(message: Duration): JsonSafe { const obj: any = {}; message.seconds !== undefined && (obj.seconds = (message.seconds || BigInt(0)).toString()); message.nanos !== undefined && (obj.nanos = Math.round(message.nanos)); diff --git a/__fixtures__/misc/output-proto-amino/amino-no-msg-with-func/google/protobuf/timestamp.ts b/__fixtures__/misc/output-proto-amino/amino-no-msg-with-func/google/protobuf/timestamp.ts index 48f0bef30b..5aca9414fa 100644 --- a/__fixtures__/misc/output-proto-amino/amino-no-msg-with-func/google/protobuf/timestamp.ts +++ b/__fixtures__/misc/output-proto-amino/amino-no-msg-with-func/google/protobuf/timestamp.ts @@ -1,5 +1,6 @@ import { BinaryReader, BinaryWriter } from "../../binary"; import { isSet, DeepPartial, fromJsonTimestamp, fromTimestamp } from "../../helpers"; +import { JsonSafe } from "../../json-safe"; export const protobufPackage = "google.protobuf"; /** * A Timestamp represents a point in time independent of any time zone or local @@ -320,7 +321,7 @@ export const Timestamp = { if (isSet(object.nanos)) obj.nanos = Number(object.nanos); return obj; }, - toJSON(message: Timestamp): unknown { + toJSON(message: Timestamp): JsonSafe { const obj: any = {}; message.seconds !== undefined && (obj.seconds = (message.seconds || BigInt(0)).toString()); message.nanos !== undefined && (obj.nanos = Math.round(message.nanos)); diff --git a/__fixtures__/misc/output-proto-amino/amino-no-msg-with-func/index.ts b/__fixtures__/misc/output-proto-amino/amino-no-msg-with-func/index.ts index 8c7bdc34cf..3757ae2467 100644 --- a/__fixtures__/misc/output-proto-amino/amino-no-msg-with-func/index.ts +++ b/__fixtures__/misc/output-proto-amino/amino-no-msg-with-func/index.ts @@ -12,6 +12,7 @@ export * from "./extern"; export * from "./react-query"; export * from "./mobx"; export * from "./pinia-endpoint"; +export * from "./json-safe"; export * from "./varint"; export * from "./utf8"; export * from "./binary"; \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/amino-no-msg-with-func/json-safe.ts b/__fixtures__/misc/output-proto-amino/amino-no-msg-with-func/json-safe.ts new file mode 100644 index 0000000000..7d46f89144 --- /dev/null +++ b/__fixtures__/misc/output-proto-amino/amino-no-msg-with-func/json-safe.ts @@ -0,0 +1,10 @@ +/** +* This file and any referenced files were automatically generated by @cosmology/telescope@latest +* DO NOT MODIFY BY HAND. Instead, download the latest proto files for your chain +* and run the transpile command or npm scripts command that is used to regenerate this bundle. +*/ + + +export type JsonSafe = { + [Prop in keyof T]: T[Prop] extends Uint8Array ? string : T[Prop] extends bigint ? string : T[Prop]; +} diff --git a/__fixtures__/misc/output-proto-amino/amino-no-msg-with-func/misc/all_fields.ts b/__fixtures__/misc/output-proto-amino/amino-no-msg-with-func/misc/all_fields.ts index ea58b4b073..73acabaa5b 100644 --- a/__fixtures__/misc/output-proto-amino/amino-no-msg-with-func/misc/all_fields.ts +++ b/__fixtures__/misc/output-proto-amino/amino-no-msg-with-func/misc/all_fields.ts @@ -5,6 +5,7 @@ import { Timestamp, TimestampAmino, TimestampSDKType } from "../google/protobuf/ import { BinaryReader, BinaryWriter } from "../binary"; import { toTimestamp, fromTimestamp, isSet, bytesFromBase64, base64FromBytes, DeepPartial } from "../helpers"; import { Decimal } from "@cosmjs/math"; +import { JsonSafe } from "../json-safe"; import { toUtf8, fromBase64, fromUtf8, toBase64 } from "@cosmjs/encoding"; import { encodePubkey, decodePubkey } from "@cosmjs/proto-signing"; export const protobufPackage = "misc"; @@ -869,7 +870,7 @@ export const EncodingTestForDontOmit = { if (Array.isArray(object?.dODecs)) obj.dODecs = object.dODecs.map((e: any) => String(e)); return obj; }, - toJSON(message: EncodingTestForDontOmit): unknown { + toJSON(message: EncodingTestForDontOmit): JsonSafe { const obj: any = {}; message.str !== undefined && (obj.str = message.str); message.dOStr !== undefined && (obj.dOStr = message.dOStr); @@ -2027,7 +2028,7 @@ export const EncodingTestForOmit = { if (Array.isArray(object?.oDecs)) obj.oDecs = object.oDecs.map((e: any) => String(e)); return obj; }, - toJSON(message: EncodingTestForOmit): unknown { + toJSON(message: EncodingTestForOmit): JsonSafe { const obj: any = {}; message.str !== undefined && (obj.str = message.str); message.oStr !== undefined && (obj.oStr = message.oStr); diff --git a/__fixtures__/misc/output-proto-amino/amino-no-msg-with-func/misc/eval_request.ts b/__fixtures__/misc/output-proto-amino/amino-no-msg-with-func/misc/eval_request.ts index e705db5c39..4990df4d35 100644 --- a/__fixtures__/misc/output-proto-amino/amino-no-msg-with-func/misc/eval_request.ts +++ b/__fixtures__/misc/output-proto-amino/amino-no-msg-with-func/misc/eval_request.ts @@ -2,6 +2,7 @@ import { ExprValue, ExprValueAmino, ExprValueSDKType, IdRef, IdRefAmino, IdRefSD import { FeatureSet_Utf8Validation, featureSet_Utf8ValidationFromJSON, featureSet_Utf8ValidationToJSON } from "../google/protobuf/descriptor"; import { BinaryReader, BinaryWriter } from "../binary"; import { isSet, DeepPartial, isObject } from "../helpers"; +import { JsonSafe } from "../json-safe"; export const protobufPackage = "misc"; /** VoteOption enumerates the valid vote options for a given governance proposal. */ export enum VoteOption { @@ -223,7 +224,7 @@ export const EvalRequest_BindingsEntry = { if (isSet(object.value)) obj.value = ExprValue.fromJSON(object.value); return obj; }, - toJSON(message: EvalRequest_BindingsEntry): unknown { + toJSON(message: EvalRequest_BindingsEntry): JsonSafe { const obj: any = {}; message.key !== undefined && (obj.key = message.key); message.value !== undefined && (obj.value = message.value ? ExprValue.toJSON(message.value) : undefined); @@ -320,7 +321,7 @@ export const EvalRequest_RefsEntry = { if (isSet(object.value)) obj.value = IdRef.fromJSON(object.value); return obj; }, - toJSON(message: EvalRequest_RefsEntry): unknown { + toJSON(message: EvalRequest_RefsEntry): JsonSafe { const obj: any = {}; message.key !== undefined && (obj.key = message.key); message.value !== undefined && (obj.value = message.value ? IdRef.toJSON(message.value) : undefined); @@ -504,7 +505,7 @@ export const EvalRequest = { if (isSet(object.opt)) obj.opt = featureSet_Utf8ValidationFromJSON(object.opt); return obj; }, - toJSON(message: EvalRequest): unknown { + toJSON(message: EvalRequest): JsonSafe { const obj: any = {}; obj.bindings = {}; if (message.bindings) { @@ -756,7 +757,7 @@ export const AccessConfig = { if (isSet(object.sender)) obj.sender = String(object.sender); return obj; }, - toJSON(message: AccessConfig): unknown { + toJSON(message: AccessConfig): JsonSafe { const obj: any = {}; message.sender !== undefined && (obj.sender = message.sender); return obj; @@ -841,7 +842,7 @@ export const GenericAuthorization = { if (isSet(object.msg)) obj.msg = String(object.msg); return obj; }, - toJSON(message: GenericAuthorization): unknown { + toJSON(message: GenericAuthorization): JsonSafe { const obj: any = {}; message.msg !== undefined && (obj.msg = message.msg); return obj; diff --git a/__fixtures__/misc/output-proto-amino/amino-no-msg-with-func/misc/tx.ts b/__fixtures__/misc/output-proto-amino/amino-no-msg-with-func/misc/tx.ts index c3f45de473..c78c374010 100644 --- a/__fixtures__/misc/output-proto-amino/amino-no-msg-with-func/misc/tx.ts +++ b/__fixtures__/misc/output-proto-amino/amino-no-msg-with-func/misc/tx.ts @@ -1,6 +1,7 @@ import { EncodingTestForDontOmit, EncodingTestForDontOmitAmino, EncodingTestForDontOmitSDKType, EncodingTestForOmit, EncodingTestForOmitAmino, EncodingTestForOmitSDKType } from "./all_fields"; import { BinaryReader, BinaryWriter } from "../binary"; import { isSet, DeepPartial } from "../helpers"; +import { JsonSafe } from "../json-safe"; export const protobufPackage = "misc"; /** * MsgGrant is a request type for Grant method. It declares authorization to the grantee @@ -83,7 +84,7 @@ export const InputMsg = { if (isSet(object.oTests)) obj.oTests = EncodingTestForOmit.fromJSON(object.oTests); return obj; }, - toJSON(message: InputMsg): unknown { + toJSON(message: InputMsg): JsonSafe { const obj: any = {}; message.dOTests !== undefined && (obj.dOTests = message.dOTests ? EncodingTestForDontOmit.toJSON(message.dOTests) : undefined); message.oTests !== undefined && (obj.oTests = message.oTests ? EncodingTestForOmit.toJSON(message.oTests) : undefined); @@ -172,7 +173,7 @@ export const MsgResponse = { const obj = createBaseMsgResponse(); return obj; }, - toJSON(_: MsgResponse): unknown { + toJSON(_: MsgResponse): JsonSafe { const obj: any = {}; return obj; }, diff --git a/__fixtures__/misc/output-proto-amino/no-amino-legacy-no-proto/google/api/expr/v1alpha1/eval.ts b/__fixtures__/misc/output-proto-amino/no-amino-legacy-no-proto/google/api/expr/v1alpha1/eval.ts index dfd0ff7c3f..ae030870d2 100644 --- a/__fixtures__/misc/output-proto-amino/no-amino-legacy-no-proto/google/api/expr/v1alpha1/eval.ts +++ b/__fixtures__/misc/output-proto-amino/no-amino-legacy-no-proto/google/api/expr/v1alpha1/eval.ts @@ -1,4 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../../binary"; +import { JsonSafe } from "../../../../json-safe"; import { DeepPartial, isSet } from "../../../../helpers"; export const protobufPackage = "google.api.expr.v1alpha1"; export interface ExprValue { @@ -50,7 +51,7 @@ export const ExprValue = { if (Array.isArray(object?.exprs)) obj.exprs = object.exprs.map((e: any) => IdRef.fromJSON(e)); return obj; }, - toJSON(message: ExprValue): unknown { + toJSON(message: ExprValue): JsonSafe { const obj: any = {}; if (message.exprs) { obj.exprs = message.exprs.map(e => e ? IdRef.toJSON(e) : undefined); @@ -119,7 +120,7 @@ export const IdRef = { if (isSet(object.id)) obj.id = Number(object.id); return obj; }, - toJSON(message: IdRef): unknown { + toJSON(message: IdRef): JsonSafe { const obj: any = {}; message.id !== undefined && (obj.id = Math.round(message.id)); return obj; diff --git a/__fixtures__/misc/output-proto-amino/no-amino-legacy-no-proto/google/protobuf/any.ts b/__fixtures__/misc/output-proto-amino/no-amino-legacy-no-proto/google/protobuf/any.ts index 974cea2042..d0e9fb4312 100644 --- a/__fixtures__/misc/output-proto-amino/no-amino-legacy-no-proto/google/protobuf/any.ts +++ b/__fixtures__/misc/output-proto-amino/no-amino-legacy-no-proto/google/protobuf/any.ts @@ -1,5 +1,6 @@ import { BinaryReader, BinaryWriter } from "../../binary"; import { isSet, bytesFromBase64, base64FromBytes, DeepPartial } from "../../helpers"; +import { JsonSafe } from "../../json-safe"; export const protobufPackage = "google.protobuf"; /** * `Any` contains an arbitrary serialized protocol buffer message along with a @@ -247,7 +248,7 @@ export const Any = { if (isSet(object.value)) obj.value = bytesFromBase64(object.value); return obj; }, - toJSON(message: Any): unknown { + toJSON(message: Any): JsonSafe { const obj: any = {}; message.typeUrl !== undefined && (obj.typeUrl = message.typeUrl); message.value !== undefined && (obj.value = base64FromBytes(message.value !== undefined ? message.value : new Uint8Array())); diff --git a/__fixtures__/misc/output-proto-amino/no-amino-legacy-no-proto/google/protobuf/descriptor.ts b/__fixtures__/misc/output-proto-amino/no-amino-legacy-no-proto/google/protobuf/descriptor.ts index 5d7a09103e..434691c414 100644 --- a/__fixtures__/misc/output-proto-amino/no-amino-legacy-no-proto/google/protobuf/descriptor.ts +++ b/__fixtures__/misc/output-proto-amino/no-amino-legacy-no-proto/google/protobuf/descriptor.ts @@ -1,4 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../binary"; +import { JsonSafe } from "../../json-safe"; import { DeepPartial, isSet, bytesFromBase64, base64FromBytes } from "../../helpers"; export const protobufPackage = "google.protobuf"; export enum FieldDescriptorProto_Type { @@ -1362,7 +1363,7 @@ export const FileDescriptorSet = { if (Array.isArray(object?.file)) obj.file = object.file.map((e: any) => FileDescriptorProto.fromJSON(e)); return obj; }, - toJSON(message: FileDescriptorSet): unknown { + toJSON(message: FileDescriptorSet): JsonSafe { const obj: any = {}; if (message.file) { obj.file = message.file.map(e => e ? FileDescriptorProto.toJSON(e) : undefined); @@ -1537,7 +1538,7 @@ export const FileDescriptorProto = { if (isSet(object.syntax)) obj.syntax = String(object.syntax); return obj; }, - toJSON(message: FileDescriptorProto): unknown { + toJSON(message: FileDescriptorProto): JsonSafe { const obj: any = {}; message.name !== undefined && (obj.name = message.name); message.package !== undefined && (obj.package = message.package); @@ -1785,7 +1786,7 @@ export const DescriptorProto = { if (Array.isArray(object?.reservedName)) obj.reservedName = object.reservedName.map((e: any) => String(e)); return obj; }, - toJSON(message: DescriptorProto): unknown { + toJSON(message: DescriptorProto): JsonSafe { const obj: any = {}; message.name !== undefined && (obj.name = message.name); if (message.field) { @@ -1973,7 +1974,7 @@ export const DescriptorProto_ExtensionRange = { if (isSet(object.options)) obj.options = ExtensionRangeOptions.fromJSON(object.options); return obj; }, - toJSON(message: DescriptorProto_ExtensionRange): unknown { + toJSON(message: DescriptorProto_ExtensionRange): JsonSafe { const obj: any = {}; message.start !== undefined && (obj.start = Math.round(message.start)); message.end !== undefined && (obj.end = Math.round(message.end)); @@ -2054,7 +2055,7 @@ export const DescriptorProto_ReservedRange = { if (isSet(object.end)) obj.end = Number(object.end); return obj; }, - toJSON(message: DescriptorProto_ReservedRange): unknown { + toJSON(message: DescriptorProto_ReservedRange): JsonSafe { const obj: any = {}; message.start !== undefined && (obj.start = Math.round(message.start)); message.end !== undefined && (obj.end = Math.round(message.end)); @@ -2120,7 +2121,7 @@ export const ExtensionRangeOptions = { if (Array.isArray(object?.uninterpretedOption)) obj.uninterpretedOption = object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)); return obj; }, - toJSON(message: ExtensionRangeOptions): unknown { + toJSON(message: ExtensionRangeOptions): JsonSafe { const obj: any = {}; if (message.uninterpretedOption) { obj.uninterpretedOption = message.uninterpretedOption.map(e => e ? UninterpretedOption.toJSON(e) : undefined); @@ -2261,7 +2262,7 @@ export const FieldDescriptorProto = { if (isSet(object.options)) obj.options = FieldOptions.fromJSON(object.options); return obj; }, - toJSON(message: FieldDescriptorProto): unknown { + toJSON(message: FieldDescriptorProto): JsonSafe { const obj: any = {}; message.name !== undefined && (obj.name = message.name); message.number !== undefined && (obj.number = Math.round(message.number)); @@ -2377,7 +2378,7 @@ export const OneofDescriptorProto = { if (isSet(object.options)) obj.options = OneofOptions.fromJSON(object.options); return obj; }, - toJSON(message: OneofDescriptorProto): unknown { + toJSON(message: OneofDescriptorProto): JsonSafe { const obj: any = {}; message.name !== undefined && (obj.name = message.name); message.options !== undefined && (obj.options = message.options ? OneofOptions.toJSON(message.options) : undefined); @@ -2477,7 +2478,7 @@ export const EnumDescriptorProto = { if (Array.isArray(object?.reservedName)) obj.reservedName = object.reservedName.map((e: any) => String(e)); return obj; }, - toJSON(message: EnumDescriptorProto): unknown { + toJSON(message: EnumDescriptorProto): JsonSafe { const obj: any = {}; message.name !== undefined && (obj.name = message.name); if (message.value) { @@ -2592,7 +2593,7 @@ export const EnumDescriptorProto_EnumReservedRange = { if (isSet(object.end)) obj.end = Number(object.end); return obj; }, - toJSON(message: EnumDescriptorProto_EnumReservedRange): unknown { + toJSON(message: EnumDescriptorProto_EnumReservedRange): JsonSafe { const obj: any = {}; message.start !== undefined && (obj.start = Math.round(message.start)); message.end !== undefined && (obj.end = Math.round(message.end)); @@ -2674,7 +2675,7 @@ export const EnumValueDescriptorProto = { if (isSet(object.options)) obj.options = EnumValueOptions.fromJSON(object.options); return obj; }, - toJSON(message: EnumValueDescriptorProto): unknown { + toJSON(message: EnumValueDescriptorProto): JsonSafe { const obj: any = {}; message.name !== undefined && (obj.name = message.name); message.number !== undefined && (obj.number = Math.round(message.number)); @@ -2763,7 +2764,7 @@ export const ServiceDescriptorProto = { if (isSet(object.options)) obj.options = ServiceOptions.fromJSON(object.options); return obj; }, - toJSON(message: ServiceDescriptorProto): unknown { + toJSON(message: ServiceDescriptorProto): JsonSafe { const obj: any = {}; message.name !== undefined && (obj.name = message.name); if (message.method) { @@ -2884,7 +2885,7 @@ export const MethodDescriptorProto = { if (isSet(object.serverStreaming)) obj.serverStreaming = Boolean(object.serverStreaming); return obj; }, - toJSON(message: MethodDescriptorProto): unknown { + toJSON(message: MethodDescriptorProto): JsonSafe { const obj: any = {}; message.name !== undefined && (obj.name = message.name); message.inputType !== undefined && (obj.inputType = message.inputType); @@ -3132,7 +3133,7 @@ export const FileOptions = { if (Array.isArray(object?.uninterpretedOption)) obj.uninterpretedOption = object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)); return obj; }, - toJSON(message: FileOptions): unknown { + toJSON(message: FileOptions): JsonSafe { const obj: any = {}; message.javaPackage !== undefined && (obj.javaPackage = message.javaPackage); message.javaOuterClassname !== undefined && (obj.javaOuterClassname = message.javaOuterClassname); @@ -3333,7 +3334,7 @@ export const MessageOptions = { if (Array.isArray(object?.uninterpretedOption)) obj.uninterpretedOption = object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)); return obj; }, - toJSON(message: MessageOptions): unknown { + toJSON(message: MessageOptions): JsonSafe { const obj: any = {}; message.messageSetWireFormat !== undefined && (obj.messageSetWireFormat = message.messageSetWireFormat); message.noStandardDescriptorAccessor !== undefined && (obj.noStandardDescriptorAccessor = message.noStandardDescriptorAccessor); @@ -3470,7 +3471,7 @@ export const FieldOptions = { if (Array.isArray(object?.uninterpretedOption)) obj.uninterpretedOption = object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)); return obj; }, - toJSON(message: FieldOptions): unknown { + toJSON(message: FieldOptions): JsonSafe { const obj: any = {}; message.ctype !== undefined && (obj.ctype = fieldOptions_CTypeToJSON(message.ctype)); message.packed !== undefined && (obj.packed = message.packed); @@ -3569,7 +3570,7 @@ export const OneofOptions = { if (Array.isArray(object?.uninterpretedOption)) obj.uninterpretedOption = object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)); return obj; }, - toJSON(message: OneofOptions): unknown { + toJSON(message: OneofOptions): JsonSafe { const obj: any = {}; if (message.uninterpretedOption) { obj.uninterpretedOption = message.uninterpretedOption.map(e => e ? UninterpretedOption.toJSON(e) : undefined); @@ -3654,7 +3655,7 @@ export const EnumOptions = { if (Array.isArray(object?.uninterpretedOption)) obj.uninterpretedOption = object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)); return obj; }, - toJSON(message: EnumOptions): unknown { + toJSON(message: EnumOptions): JsonSafe { const obj: any = {}; message.allowAlias !== undefined && (obj.allowAlias = message.allowAlias); message.deprecated !== undefined && (obj.deprecated = message.deprecated); @@ -3741,7 +3742,7 @@ export const EnumValueOptions = { if (Array.isArray(object?.uninterpretedOption)) obj.uninterpretedOption = object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)); return obj; }, - toJSON(message: EnumValueOptions): unknown { + toJSON(message: EnumValueOptions): JsonSafe { const obj: any = {}; message.deprecated !== undefined && (obj.deprecated = message.deprecated); if (message.uninterpretedOption) { @@ -3823,7 +3824,7 @@ export const ServiceOptions = { if (Array.isArray(object?.uninterpretedOption)) obj.uninterpretedOption = object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)); return obj; }, - toJSON(message: ServiceOptions): unknown { + toJSON(message: ServiceOptions): JsonSafe { const obj: any = {}; message.deprecated !== undefined && (obj.deprecated = message.deprecated); if (message.uninterpretedOption) { @@ -3913,7 +3914,7 @@ export const MethodOptions = { if (Array.isArray(object?.uninterpretedOption)) obj.uninterpretedOption = object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)); return obj; }, - toJSON(message: MethodOptions): unknown { + toJSON(message: MethodOptions): JsonSafe { const obj: any = {}; message.deprecated !== undefined && (obj.deprecated = message.deprecated); message.idempotencyLevel !== undefined && (obj.idempotencyLevel = methodOptions_IdempotencyLevelToJSON(message.idempotencyLevel)); @@ -4040,7 +4041,7 @@ export const UninterpretedOption = { if (isSet(object.aggregateValue)) obj.aggregateValue = String(object.aggregateValue); return obj; }, - toJSON(message: UninterpretedOption): unknown { + toJSON(message: UninterpretedOption): JsonSafe { const obj: any = {}; if (message.name) { obj.name = message.name.map(e => e ? UninterpretedOption_NamePart.toJSON(e) : undefined); @@ -4151,7 +4152,7 @@ export const UninterpretedOption_NamePart = { if (isSet(object.isExtension)) obj.isExtension = Boolean(object.isExtension); return obj; }, - toJSON(message: UninterpretedOption_NamePart): unknown { + toJSON(message: UninterpretedOption_NamePart): JsonSafe { const obj: any = {}; message.namePart !== undefined && (obj.namePart = message.namePart); message.isExtension !== undefined && (obj.isExtension = message.isExtension); @@ -4217,7 +4218,7 @@ export const SourceCodeInfo = { if (Array.isArray(object?.location)) obj.location = object.location.map((e: any) => SourceCodeInfo_Location.fromJSON(e)); return obj; }, - toJSON(message: SourceCodeInfo): unknown { + toJSON(message: SourceCodeInfo): JsonSafe { const obj: any = {}; if (message.location) { obj.location = message.location.map(e => e ? SourceCodeInfo_Location.toJSON(e) : undefined); @@ -4336,7 +4337,7 @@ export const SourceCodeInfo_Location = { if (Array.isArray(object?.leadingDetachedComments)) obj.leadingDetachedComments = object.leadingDetachedComments.map((e: any) => String(e)); return obj; }, - toJSON(message: SourceCodeInfo_Location): unknown { + toJSON(message: SourceCodeInfo_Location): JsonSafe { const obj: any = {}; if (message.path) { obj.path = message.path.map(e => Math.round(e)); @@ -4441,7 +4442,7 @@ export const GeneratedCodeInfo = { if (Array.isArray(object?.annotation)) obj.annotation = object.annotation.map((e: any) => GeneratedCodeInfo_Annotation.fromJSON(e)); return obj; }, - toJSON(message: GeneratedCodeInfo): unknown { + toJSON(message: GeneratedCodeInfo): JsonSafe { const obj: any = {}; if (message.annotation) { obj.annotation = message.annotation.map(e => e ? GeneratedCodeInfo_Annotation.toJSON(e) : undefined); @@ -4543,7 +4544,7 @@ export const GeneratedCodeInfo_Annotation = { if (isSet(object.end)) obj.end = Number(object.end); return obj; }, - toJSON(message: GeneratedCodeInfo_Annotation): unknown { + toJSON(message: GeneratedCodeInfo_Annotation): JsonSafe { const obj: any = {}; if (message.path) { obj.path = message.path.map(e => Math.round(e)); @@ -4627,7 +4628,7 @@ export const FeatureSet = { if (isSet(object.utf8Validation)) obj.utf8Validation = featureSet_Utf8ValidationFromJSON(object.utf8Validation); return obj; }, - toJSON(message: FeatureSet): unknown { + toJSON(message: FeatureSet): JsonSafe { const obj: any = {}; message.utf8Validation !== undefined && (obj.utf8Validation = featureSet_Utf8ValidationToJSON(message.utf8Validation)); return obj; diff --git a/__fixtures__/misc/output-proto-amino/no-amino-legacy-no-proto/google/protobuf/duration.ts b/__fixtures__/misc/output-proto-amino/no-amino-legacy-no-proto/google/protobuf/duration.ts index b6ca657130..2d1eb2cc33 100644 --- a/__fixtures__/misc/output-proto-amino/no-amino-legacy-no-proto/google/protobuf/duration.ts +++ b/__fixtures__/misc/output-proto-amino/no-amino-legacy-no-proto/google/protobuf/duration.ts @@ -1,5 +1,6 @@ import { BinaryReader, BinaryWriter } from "../../binary"; import { isSet, DeepPartial } from "../../helpers"; +import { JsonSafe } from "../../json-safe"; export const protobufPackage = "google.protobuf"; /** * A Duration represents a signed, fixed-length span of time represented @@ -185,7 +186,7 @@ export const Duration = { if (isSet(object.nanos)) obj.nanos = Number(object.nanos); return obj; }, - toJSON(message: Duration): unknown { + toJSON(message: Duration): JsonSafe { const obj: any = {}; message.seconds !== undefined && (obj.seconds = (message.seconds || BigInt(0)).toString()); message.nanos !== undefined && (obj.nanos = Math.round(message.nanos)); diff --git a/__fixtures__/misc/output-proto-amino/no-amino-legacy-no-proto/google/protobuf/timestamp.ts b/__fixtures__/misc/output-proto-amino/no-amino-legacy-no-proto/google/protobuf/timestamp.ts index c7f4343aca..e3d1b0b2be 100644 --- a/__fixtures__/misc/output-proto-amino/no-amino-legacy-no-proto/google/protobuf/timestamp.ts +++ b/__fixtures__/misc/output-proto-amino/no-amino-legacy-no-proto/google/protobuf/timestamp.ts @@ -1,5 +1,6 @@ import { BinaryReader, BinaryWriter } from "../../binary"; import { isSet, DeepPartial } from "../../helpers"; +import { JsonSafe } from "../../json-safe"; export const protobufPackage = "google.protobuf"; /** * A Timestamp represents a point in time independent of any time zone or local @@ -231,7 +232,7 @@ export const Timestamp = { if (isSet(object.nanos)) obj.nanos = Number(object.nanos); return obj; }, - toJSON(message: Timestamp): unknown { + toJSON(message: Timestamp): JsonSafe { const obj: any = {}; message.seconds !== undefined && (obj.seconds = (message.seconds || BigInt(0)).toString()); message.nanos !== undefined && (obj.nanos = Math.round(message.nanos)); diff --git a/__fixtures__/misc/output-proto-amino/no-amino-legacy-no-proto/index.ts b/__fixtures__/misc/output-proto-amino/no-amino-legacy-no-proto/index.ts index b1c2ce4fad..8982aebc59 100644 --- a/__fixtures__/misc/output-proto-amino/no-amino-legacy-no-proto/index.ts +++ b/__fixtures__/misc/output-proto-amino/no-amino-legacy-no-proto/index.ts @@ -11,6 +11,7 @@ export * from "./extern"; export * from "./react-query"; export * from "./mobx"; export * from "./pinia-endpoint"; +export * from "./json-safe"; export * from "./varint"; export * from "./utf8"; export * from "./binary"; \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/no-amino-legacy-no-proto/json-safe.ts b/__fixtures__/misc/output-proto-amino/no-amino-legacy-no-proto/json-safe.ts new file mode 100644 index 0000000000..7d46f89144 --- /dev/null +++ b/__fixtures__/misc/output-proto-amino/no-amino-legacy-no-proto/json-safe.ts @@ -0,0 +1,10 @@ +/** +* This file and any referenced files were automatically generated by @cosmology/telescope@latest +* DO NOT MODIFY BY HAND. Instead, download the latest proto files for your chain +* and run the transpile command or npm scripts command that is used to regenerate this bundle. +*/ + + +export type JsonSafe = { + [Prop in keyof T]: T[Prop] extends Uint8Array ? string : T[Prop] extends bigint ? string : T[Prop]; +} diff --git a/__fixtures__/misc/output-proto-amino/no-amino-legacy-no-proto/misc/all_fields.ts b/__fixtures__/misc/output-proto-amino/no-amino-legacy-no-proto/misc/all_fields.ts index d0cbe0c51d..52dcea6eca 100644 --- a/__fixtures__/misc/output-proto-amino/no-amino-legacy-no-proto/misc/all_fields.ts +++ b/__fixtures__/misc/output-proto-amino/no-amino-legacy-no-proto/misc/all_fields.ts @@ -5,6 +5,7 @@ import { Timestamp, TimestampSDKType } from "../google/protobuf/timestamp"; import { BinaryReader, BinaryWriter } from "../binary"; import { toTimestamp, fromTimestamp, isSet, bytesFromBase64, base64FromBytes, DeepPartial } from "../helpers"; import { Decimal } from "@cosmjs/math"; +import { JsonSafe } from "../json-safe"; export const protobufPackage = "misc"; export interface EncodingTestForDontOmit { /** scalar */ @@ -715,7 +716,7 @@ export const EncodingTestForDontOmit = { if (Array.isArray(object?.dODecs)) obj.dODecs = object.dODecs.map((e: any) => String(e)); return obj; }, - toJSON(message: EncodingTestForDontOmit): unknown { + toJSON(message: EncodingTestForDontOmit): JsonSafe { const obj: any = {}; message.str !== undefined && (obj.str = message.str); message.dOStr !== undefined && (obj.dOStr = message.dOStr); @@ -1621,7 +1622,7 @@ export const EncodingTestForOmit = { if (Array.isArray(object?.oDecs)) obj.oDecs = object.oDecs.map((e: any) => String(e)); return obj; }, - toJSON(message: EncodingTestForOmit): unknown { + toJSON(message: EncodingTestForOmit): JsonSafe { const obj: any = {}; message.str !== undefined && (obj.str = message.str); message.oStr !== undefined && (obj.oStr = message.oStr); diff --git a/__fixtures__/misc/output-proto-amino/no-amino-legacy-no-proto/misc/eval_request.ts b/__fixtures__/misc/output-proto-amino/no-amino-legacy-no-proto/misc/eval_request.ts index 967ee84cd2..a6c0f6e71a 100644 --- a/__fixtures__/misc/output-proto-amino/no-amino-legacy-no-proto/misc/eval_request.ts +++ b/__fixtures__/misc/output-proto-amino/no-amino-legacy-no-proto/misc/eval_request.ts @@ -2,6 +2,7 @@ import { ExprValue, ExprValueSDKType, IdRef, IdRefSDKType } from "../google/api/ import { FeatureSet_Utf8Validation, featureSet_Utf8ValidationFromJSON, featureSet_Utf8ValidationToJSON } from "../google/protobuf/descriptor"; import { BinaryReader, BinaryWriter } from "../binary"; import { isSet, DeepPartial, isObject } from "../helpers"; +import { JsonSafe } from "../json-safe"; export const protobufPackage = "misc"; /** VoteOption enumerates the valid vote options for a given governance proposal. */ export enum VoteOption { @@ -166,7 +167,7 @@ export const EvalRequest_BindingsEntry = { if (isSet(object.value)) obj.value = ExprValue.fromJSON(object.value); return obj; }, - toJSON(message: EvalRequest_BindingsEntry): unknown { + toJSON(message: EvalRequest_BindingsEntry): JsonSafe { const obj: any = {}; message.key !== undefined && (obj.key = message.key); message.value !== undefined && (obj.value = message.value ? ExprValue.toJSON(message.value) : undefined); @@ -241,7 +242,7 @@ export const EvalRequest_RefsEntry = { if (isSet(object.value)) obj.value = IdRef.fromJSON(object.value); return obj; }, - toJSON(message: EvalRequest_RefsEntry): unknown { + toJSON(message: EvalRequest_RefsEntry): JsonSafe { const obj: any = {}; message.key !== undefined && (obj.key = message.key); message.value !== undefined && (obj.value = message.value ? IdRef.toJSON(message.value) : undefined); @@ -403,7 +404,7 @@ export const EvalRequest = { if (isSet(object.opt)) obj.opt = featureSet_Utf8ValidationFromJSON(object.opt); return obj; }, - toJSON(message: EvalRequest): unknown { + toJSON(message: EvalRequest): JsonSafe { const obj: any = {}; obj.bindings = {}; if (message.bindings) { @@ -573,7 +574,7 @@ export const AccessConfig = { if (isSet(object.sender)) obj.sender = String(object.sender); return obj; }, - toJSON(message: AccessConfig): unknown { + toJSON(message: AccessConfig): JsonSafe { const obj: any = {}; message.sender !== undefined && (obj.sender = message.sender); return obj; @@ -634,7 +635,7 @@ export const GenericAuthorization = { if (isSet(object.msg)) obj.msg = String(object.msg); return obj; }, - toJSON(message: GenericAuthorization): unknown { + toJSON(message: GenericAuthorization): JsonSafe { const obj: any = {}; message.msg !== undefined && (obj.msg = message.msg); return obj; diff --git a/__fixtures__/misc/output-proto-amino/no-amino-legacy-no-proto/misc/tx.ts b/__fixtures__/misc/output-proto-amino/no-amino-legacy-no-proto/misc/tx.ts index 711b4292af..8741e8f350 100644 --- a/__fixtures__/misc/output-proto-amino/no-amino-legacy-no-proto/misc/tx.ts +++ b/__fixtures__/misc/output-proto-amino/no-amino-legacy-no-proto/misc/tx.ts @@ -1,6 +1,7 @@ import { EncodingTestForDontOmit, EncodingTestForDontOmitSDKType, EncodingTestForOmit, EncodingTestForOmitSDKType } from "./all_fields"; import { BinaryReader, BinaryWriter } from "../binary"; import { isSet, DeepPartial } from "../helpers"; +import { JsonSafe } from "../json-safe"; export const protobufPackage = "misc"; /** * MsgGrant is a request type for Grant method. It declares authorization to the grantee @@ -65,7 +66,7 @@ export const InputMsg = { if (isSet(object.oTests)) obj.oTests = EncodingTestForOmit.fromJSON(object.oTests); return obj; }, - toJSON(message: InputMsg): unknown { + toJSON(message: InputMsg): JsonSafe { const obj: any = {}; message.dOTests !== undefined && (obj.dOTests = message.dOTests ? EncodingTestForDontOmit.toJSON(message.dOTests) : undefined); message.oTests !== undefined && (obj.oTests = message.oTests ? EncodingTestForOmit.toJSON(message.oTests) : undefined); @@ -126,7 +127,7 @@ export const MsgResponse = { const obj = createBaseMsgResponse(); return obj; }, - toJSON(_: MsgResponse): unknown { + toJSON(_: MsgResponse): JsonSafe { const obj: any = {}; return obj; }, diff --git a/__fixtures__/misc/output-proto-amino/no-amino-legacy/google/api/expr/v1alpha1/eval.ts b/__fixtures__/misc/output-proto-amino/no-amino-legacy/google/api/expr/v1alpha1/eval.ts index 50b92187a5..600c68e4f1 100644 --- a/__fixtures__/misc/output-proto-amino/no-amino-legacy/google/api/expr/v1alpha1/eval.ts +++ b/__fixtures__/misc/output-proto-amino/no-amino-legacy/google/api/expr/v1alpha1/eval.ts @@ -1,4 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../../binary"; +import { JsonSafe } from "../../../../json-safe"; import { DeepPartial, isSet } from "../../../../helpers"; export const protobufPackage = "google.api.expr.v1alpha1"; export interface ExprValue { @@ -58,7 +59,7 @@ export const ExprValue = { if (Array.isArray(object?.exprs)) obj.exprs = object.exprs.map((e: any) => IdRef.fromJSON(e)); return obj; }, - toJSON(message: ExprValue): unknown { + toJSON(message: ExprValue): JsonSafe { const obj: any = {}; if (message.exprs) { obj.exprs = message.exprs.map(e => e ? IdRef.toJSON(e) : undefined); @@ -156,7 +157,7 @@ export const IdRef = { if (isSet(object.id)) obj.id = Number(object.id); return obj; }, - toJSON(message: IdRef): unknown { + toJSON(message: IdRef): JsonSafe { const obj: any = {}; message.id !== undefined && (obj.id = Math.round(message.id)); return obj; diff --git a/__fixtures__/misc/output-proto-amino/no-amino-legacy/google/protobuf/any.ts b/__fixtures__/misc/output-proto-amino/no-amino-legacy/google/protobuf/any.ts index d1c066a4df..0e7ea482a7 100644 --- a/__fixtures__/misc/output-proto-amino/no-amino-legacy/google/protobuf/any.ts +++ b/__fixtures__/misc/output-proto-amino/no-amino-legacy/google/protobuf/any.ts @@ -1,5 +1,6 @@ import { BinaryReader, BinaryWriter } from "../../binary"; import { isSet, bytesFromBase64, base64FromBytes, DeepPartial } from "../../helpers"; +import { JsonSafe } from "../../json-safe"; export const protobufPackage = "google.protobuf"; /** * `Any` contains an arbitrary serialized protocol buffer message along with a @@ -251,7 +252,7 @@ export const Any = { if (isSet(object.value)) obj.value = bytesFromBase64(object.value); return obj; }, - toJSON(message: Any): unknown { + toJSON(message: Any): JsonSafe { const obj: any = {}; message.typeUrl !== undefined && (obj.typeUrl = message.typeUrl); message.value !== undefined && (obj.value = base64FromBytes(message.value !== undefined ? message.value : new Uint8Array())); diff --git a/__fixtures__/misc/output-proto-amino/no-amino-legacy/google/protobuf/descriptor.ts b/__fixtures__/misc/output-proto-amino/no-amino-legacy/google/protobuf/descriptor.ts index 1f3671fd23..8315b68154 100644 --- a/__fixtures__/misc/output-proto-amino/no-amino-legacy/google/protobuf/descriptor.ts +++ b/__fixtures__/misc/output-proto-amino/no-amino-legacy/google/protobuf/descriptor.ts @@ -1,4 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../binary"; +import { JsonSafe } from "../../json-safe"; import { DeepPartial, isSet, bytesFromBase64, base64FromBytes } from "../../helpers"; export const protobufPackage = "google.protobuf"; export enum FieldDescriptorProto_Type { @@ -1474,7 +1475,7 @@ export const FileDescriptorSet = { if (Array.isArray(object?.file)) obj.file = object.file.map((e: any) => FileDescriptorProto.fromJSON(e)); return obj; }, - toJSON(message: FileDescriptorSet): unknown { + toJSON(message: FileDescriptorSet): JsonSafe { const obj: any = {}; if (message.file) { obj.file = message.file.map(e => e ? FileDescriptorProto.toJSON(e) : undefined); @@ -1678,7 +1679,7 @@ export const FileDescriptorProto = { if (isSet(object.syntax)) obj.syntax = String(object.syntax); return obj; }, - toJSON(message: FileDescriptorProto): unknown { + toJSON(message: FileDescriptorProto): JsonSafe { const obj: any = {}; message.name !== undefined && (obj.name = message.name); message.package !== undefined && (obj.package = message.package); @@ -2011,7 +2012,7 @@ export const DescriptorProto = { if (Array.isArray(object?.reservedName)) obj.reservedName = object.reservedName.map((e: any) => String(e)); return obj; }, - toJSON(message: DescriptorProto): unknown { + toJSON(message: DescriptorProto): JsonSafe { const obj: any = {}; message.name !== undefined && (obj.name = message.name); if (message.field) { @@ -2278,7 +2279,7 @@ export const DescriptorProto_ExtensionRange = { if (isSet(object.options)) obj.options = ExtensionRangeOptions.fromJSON(object.options); return obj; }, - toJSON(message: DescriptorProto_ExtensionRange): unknown { + toJSON(message: DescriptorProto_ExtensionRange): JsonSafe { const obj: any = {}; message.start !== undefined && (obj.start = Math.round(message.start)); message.end !== undefined && (obj.end = Math.round(message.end)); @@ -2394,7 +2395,7 @@ export const DescriptorProto_ReservedRange = { if (isSet(object.end)) obj.end = Number(object.end); return obj; }, - toJSON(message: DescriptorProto_ReservedRange): unknown { + toJSON(message: DescriptorProto_ReservedRange): JsonSafe { const obj: any = {}; message.start !== undefined && (obj.start = Math.round(message.start)); message.end !== undefined && (obj.end = Math.round(message.end)); @@ -2491,7 +2492,7 @@ export const ExtensionRangeOptions = { if (Array.isArray(object?.uninterpretedOption)) obj.uninterpretedOption = object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)); return obj; }, - toJSON(message: ExtensionRangeOptions): unknown { + toJSON(message: ExtensionRangeOptions): JsonSafe { const obj: any = {}; if (message.uninterpretedOption) { obj.uninterpretedOption = message.uninterpretedOption.map(e => e ? UninterpretedOption.toJSON(e) : undefined); @@ -2661,7 +2662,7 @@ export const FieldDescriptorProto = { if (isSet(object.options)) obj.options = FieldOptions.fromJSON(object.options); return obj; }, - toJSON(message: FieldDescriptorProto): unknown { + toJSON(message: FieldDescriptorProto): JsonSafe { const obj: any = {}; message.name !== undefined && (obj.name = message.name); message.number !== undefined && (obj.number = Math.round(message.number)); @@ -2840,7 +2841,7 @@ export const OneofDescriptorProto = { if (isSet(object.options)) obj.options = OneofOptions.fromJSON(object.options); return obj; }, - toJSON(message: OneofDescriptorProto): unknown { + toJSON(message: OneofDescriptorProto): JsonSafe { const obj: any = {}; message.name !== undefined && (obj.name = message.name); message.options !== undefined && (obj.options = message.options ? OneofOptions.toJSON(message.options) : undefined); @@ -2971,7 +2972,7 @@ export const EnumDescriptorProto = { if (Array.isArray(object?.reservedName)) obj.reservedName = object.reservedName.map((e: any) => String(e)); return obj; }, - toJSON(message: EnumDescriptorProto): unknown { + toJSON(message: EnumDescriptorProto): JsonSafe { const obj: any = {}; message.name !== undefined && (obj.name = message.name); if (message.value) { @@ -3135,7 +3136,7 @@ export const EnumDescriptorProto_EnumReservedRange = { if (isSet(object.end)) obj.end = Number(object.end); return obj; }, - toJSON(message: EnumDescriptorProto_EnumReservedRange): unknown { + toJSON(message: EnumDescriptorProto_EnumReservedRange): JsonSafe { const obj: any = {}; message.start !== undefined && (obj.start = Math.round(message.start)); message.end !== undefined && (obj.end = Math.round(message.end)); @@ -3248,7 +3249,7 @@ export const EnumValueDescriptorProto = { if (isSet(object.options)) obj.options = EnumValueOptions.fromJSON(object.options); return obj; }, - toJSON(message: EnumValueDescriptorProto): unknown { + toJSON(message: EnumValueDescriptorProto): JsonSafe { const obj: any = {}; message.name !== undefined && (obj.name = message.name); message.number !== undefined && (obj.number = Math.round(message.number)); @@ -3372,7 +3373,7 @@ export const ServiceDescriptorProto = { if (isSet(object.options)) obj.options = ServiceOptions.fromJSON(object.options); return obj; }, - toJSON(message: ServiceDescriptorProto): unknown { + toJSON(message: ServiceDescriptorProto): JsonSafe { const obj: any = {}; message.name !== undefined && (obj.name = message.name); if (message.method) { @@ -3530,7 +3531,7 @@ export const MethodDescriptorProto = { if (isSet(object.serverStreaming)) obj.serverStreaming = Boolean(object.serverStreaming); return obj; }, - toJSON(message: MethodDescriptorProto): unknown { + toJSON(message: MethodDescriptorProto): JsonSafe { const obj: any = {}; message.name !== undefined && (obj.name = message.name); message.inputType !== undefined && (obj.inputType = message.inputType); @@ -3825,7 +3826,7 @@ export const FileOptions = { if (Array.isArray(object?.uninterpretedOption)) obj.uninterpretedOption = object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)); return obj; }, - toJSON(message: FileOptions): unknown { + toJSON(message: FileOptions): JsonSafe { const obj: any = {}; message.javaPackage !== undefined && (obj.javaPackage = message.javaPackage); message.javaOuterClassname !== undefined && (obj.javaOuterClassname = message.javaOuterClassname); @@ -4135,7 +4136,7 @@ export const MessageOptions = { if (Array.isArray(object?.uninterpretedOption)) obj.uninterpretedOption = object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)); return obj; }, - toJSON(message: MessageOptions): unknown { + toJSON(message: MessageOptions): JsonSafe { const obj: any = {}; message.messageSetWireFormat !== undefined && (obj.messageSetWireFormat = message.messageSetWireFormat); message.noStandardDescriptorAccessor !== undefined && (obj.noStandardDescriptorAccessor = message.noStandardDescriptorAccessor); @@ -4317,7 +4318,7 @@ export const FieldOptions = { if (Array.isArray(object?.uninterpretedOption)) obj.uninterpretedOption = object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)); return obj; }, - toJSON(message: FieldOptions): unknown { + toJSON(message: FieldOptions): JsonSafe { const obj: any = {}; message.ctype !== undefined && (obj.ctype = fieldOptions_CTypeToJSON(message.ctype)); message.packed !== undefined && (obj.packed = message.packed); @@ -4469,7 +4470,7 @@ export const OneofOptions = { if (Array.isArray(object?.uninterpretedOption)) obj.uninterpretedOption = object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)); return obj; }, - toJSON(message: OneofOptions): unknown { + toJSON(message: OneofOptions): JsonSafe { const obj: any = {}; if (message.uninterpretedOption) { obj.uninterpretedOption = message.uninterpretedOption.map(e => e ? UninterpretedOption.toJSON(e) : undefined); @@ -4583,7 +4584,7 @@ export const EnumOptions = { if (Array.isArray(object?.uninterpretedOption)) obj.uninterpretedOption = object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)); return obj; }, - toJSON(message: EnumOptions): unknown { + toJSON(message: EnumOptions): JsonSafe { const obj: any = {}; message.allowAlias !== undefined && (obj.allowAlias = message.allowAlias); message.deprecated !== undefined && (obj.deprecated = message.deprecated); @@ -4707,7 +4708,7 @@ export const EnumValueOptions = { if (Array.isArray(object?.uninterpretedOption)) obj.uninterpretedOption = object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)); return obj; }, - toJSON(message: EnumValueOptions): unknown { + toJSON(message: EnumValueOptions): JsonSafe { const obj: any = {}; message.deprecated !== undefined && (obj.deprecated = message.deprecated); if (message.uninterpretedOption) { @@ -4822,7 +4823,7 @@ export const ServiceOptions = { if (Array.isArray(object?.uninterpretedOption)) obj.uninterpretedOption = object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)); return obj; }, - toJSON(message: ServiceOptions): unknown { + toJSON(message: ServiceOptions): JsonSafe { const obj: any = {}; message.deprecated !== undefined && (obj.deprecated = message.deprecated); if (message.uninterpretedOption) { @@ -4945,7 +4946,7 @@ export const MethodOptions = { if (Array.isArray(object?.uninterpretedOption)) obj.uninterpretedOption = object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)); return obj; }, - toJSON(message: MethodOptions): unknown { + toJSON(message: MethodOptions): JsonSafe { const obj: any = {}; message.deprecated !== undefined && (obj.deprecated = message.deprecated); message.idempotencyLevel !== undefined && (obj.idempotencyLevel = methodOptions_IdempotencyLevelToJSON(message.idempotencyLevel)); @@ -5109,7 +5110,7 @@ export const UninterpretedOption = { if (isSet(object.aggregateValue)) obj.aggregateValue = String(object.aggregateValue); return obj; }, - toJSON(message: UninterpretedOption): unknown { + toJSON(message: UninterpretedOption): JsonSafe { const obj: any = {}; if (message.name) { obj.name = message.name.map(e => e ? UninterpretedOption_NamePart.toJSON(e) : undefined); @@ -5273,7 +5274,7 @@ export const UninterpretedOption_NamePart = { if (isSet(object.isExtension)) obj.isExtension = Boolean(object.isExtension); return obj; }, - toJSON(message: UninterpretedOption_NamePart): unknown { + toJSON(message: UninterpretedOption_NamePart): JsonSafe { const obj: any = {}; message.namePart !== undefined && (obj.namePart = message.namePart); message.isExtension !== undefined && (obj.isExtension = message.isExtension); @@ -5370,7 +5371,7 @@ export const SourceCodeInfo = { if (Array.isArray(object?.location)) obj.location = object.location.map((e: any) => SourceCodeInfo_Location.fromJSON(e)); return obj; }, - toJSON(message: SourceCodeInfo): unknown { + toJSON(message: SourceCodeInfo): JsonSafe { const obj: any = {}; if (message.location) { obj.location = message.location.map(e => e ? SourceCodeInfo_Location.toJSON(e) : undefined); @@ -5518,7 +5519,7 @@ export const SourceCodeInfo_Location = { if (Array.isArray(object?.leadingDetachedComments)) obj.leadingDetachedComments = object.leadingDetachedComments.map((e: any) => String(e)); return obj; }, - toJSON(message: SourceCodeInfo_Location): unknown { + toJSON(message: SourceCodeInfo_Location): JsonSafe { const obj: any = {}; if (message.path) { obj.path = message.path.map(e => Math.round(e)); @@ -5672,7 +5673,7 @@ export const GeneratedCodeInfo = { if (Array.isArray(object?.annotation)) obj.annotation = object.annotation.map((e: any) => GeneratedCodeInfo_Annotation.fromJSON(e)); return obj; }, - toJSON(message: GeneratedCodeInfo): unknown { + toJSON(message: GeneratedCodeInfo): JsonSafe { const obj: any = {}; if (message.annotation) { obj.annotation = message.annotation.map(e => e ? GeneratedCodeInfo_Annotation.toJSON(e) : undefined); @@ -5803,7 +5804,7 @@ export const GeneratedCodeInfo_Annotation = { if (isSet(object.end)) obj.end = Number(object.end); return obj; }, - toJSON(message: GeneratedCodeInfo_Annotation): unknown { + toJSON(message: GeneratedCodeInfo_Annotation): JsonSafe { const obj: any = {}; if (message.path) { obj.path = message.path.map(e => Math.round(e)); @@ -5928,7 +5929,7 @@ export const FeatureSet = { if (isSet(object.utf8Validation)) obj.utf8Validation = featureSet_Utf8ValidationFromJSON(object.utf8Validation); return obj; }, - toJSON(message: FeatureSet): unknown { + toJSON(message: FeatureSet): JsonSafe { const obj: any = {}; message.utf8Validation !== undefined && (obj.utf8Validation = featureSet_Utf8ValidationToJSON(message.utf8Validation)); return obj; diff --git a/__fixtures__/misc/output-proto-amino/no-amino-legacy/google/protobuf/duration.ts b/__fixtures__/misc/output-proto-amino/no-amino-legacy/google/protobuf/duration.ts index 532fd9db20..2e1f1eb98b 100644 --- a/__fixtures__/misc/output-proto-amino/no-amino-legacy/google/protobuf/duration.ts +++ b/__fixtures__/misc/output-proto-amino/no-amino-legacy/google/protobuf/duration.ts @@ -1,5 +1,6 @@ import { BinaryReader, BinaryWriter } from "../../binary"; import { isSet, DeepPartial } from "../../helpers"; +import { JsonSafe } from "../../json-safe"; export const protobufPackage = "google.protobuf"; /** * A Duration represents a signed, fixed-length span of time represented @@ -189,7 +190,7 @@ export const Duration = { if (isSet(object.nanos)) obj.nanos = Number(object.nanos); return obj; }, - toJSON(message: Duration): unknown { + toJSON(message: Duration): JsonSafe { const obj: any = {}; message.seconds !== undefined && (obj.seconds = (message.seconds || BigInt(0)).toString()); message.nanos !== undefined && (obj.nanos = Math.round(message.nanos)); diff --git a/__fixtures__/misc/output-proto-amino/no-amino-legacy/google/protobuf/timestamp.ts b/__fixtures__/misc/output-proto-amino/no-amino-legacy/google/protobuf/timestamp.ts index 497d725979..c7adc874fd 100644 --- a/__fixtures__/misc/output-proto-amino/no-amino-legacy/google/protobuf/timestamp.ts +++ b/__fixtures__/misc/output-proto-amino/no-amino-legacy/google/protobuf/timestamp.ts @@ -1,5 +1,6 @@ import { BinaryReader, BinaryWriter } from "../../binary"; import { isSet, DeepPartial, fromJsonTimestamp, fromTimestamp } from "../../helpers"; +import { JsonSafe } from "../../json-safe"; export const protobufPackage = "google.protobuf"; /** * A Timestamp represents a point in time independent of any time zone or local @@ -235,7 +236,7 @@ export const Timestamp = { if (isSet(object.nanos)) obj.nanos = Number(object.nanos); return obj; }, - toJSON(message: Timestamp): unknown { + toJSON(message: Timestamp): JsonSafe { const obj: any = {}; message.seconds !== undefined && (obj.seconds = (message.seconds || BigInt(0)).toString()); message.nanos !== undefined && (obj.nanos = Math.round(message.nanos)); diff --git a/__fixtures__/misc/output-proto-amino/no-amino-legacy/index.ts b/__fixtures__/misc/output-proto-amino/no-amino-legacy/index.ts index b1c2ce4fad..8982aebc59 100644 --- a/__fixtures__/misc/output-proto-amino/no-amino-legacy/index.ts +++ b/__fixtures__/misc/output-proto-amino/no-amino-legacy/index.ts @@ -11,6 +11,7 @@ export * from "./extern"; export * from "./react-query"; export * from "./mobx"; export * from "./pinia-endpoint"; +export * from "./json-safe"; export * from "./varint"; export * from "./utf8"; export * from "./binary"; \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/no-amino-legacy/json-safe.ts b/__fixtures__/misc/output-proto-amino/no-amino-legacy/json-safe.ts new file mode 100644 index 0000000000..7d46f89144 --- /dev/null +++ b/__fixtures__/misc/output-proto-amino/no-amino-legacy/json-safe.ts @@ -0,0 +1,10 @@ +/** +* This file and any referenced files were automatically generated by @cosmology/telescope@latest +* DO NOT MODIFY BY HAND. Instead, download the latest proto files for your chain +* and run the transpile command or npm scripts command that is used to regenerate this bundle. +*/ + + +export type JsonSafe = { + [Prop in keyof T]: T[Prop] extends Uint8Array ? string : T[Prop] extends bigint ? string : T[Prop]; +} diff --git a/__fixtures__/misc/output-proto-amino/no-amino-legacy/misc/all_fields.ts b/__fixtures__/misc/output-proto-amino/no-amino-legacy/misc/all_fields.ts index 7f5731ed7a..f42670b716 100644 --- a/__fixtures__/misc/output-proto-amino/no-amino-legacy/misc/all_fields.ts +++ b/__fixtures__/misc/output-proto-amino/no-amino-legacy/misc/all_fields.ts @@ -5,6 +5,7 @@ import { Timestamp, TimestampSDKType } from "../google/protobuf/timestamp"; import { BinaryReader, BinaryWriter } from "../binary"; import { toTimestamp, fromTimestamp, isSet, bytesFromBase64, base64FromBytes, DeepPartial } from "../helpers"; import { Decimal } from "@cosmjs/math"; +import { JsonSafe } from "../json-safe"; import { toUtf8, fromBase64, fromUtf8, toBase64 } from "@cosmjs/encoding"; import { encodePubkey, decodePubkey } from "@cosmjs/proto-signing"; export const protobufPackage = "misc"; @@ -725,7 +726,7 @@ export const EncodingTestForDontOmit = { if (Array.isArray(object?.dODecs)) obj.dODecs = object.dODecs.map((e: any) => String(e)); return obj; }, - toJSON(message: EncodingTestForDontOmit): unknown { + toJSON(message: EncodingTestForDontOmit): JsonSafe { const obj: any = {}; message.str !== undefined && (obj.str = message.str); message.dOStr !== undefined && (obj.dOStr = message.dOStr); @@ -1886,7 +1887,7 @@ export const EncodingTestForOmit = { if (Array.isArray(object?.oDecs)) obj.oDecs = object.oDecs.map((e: any) => String(e)); return obj; }, - toJSON(message: EncodingTestForOmit): unknown { + toJSON(message: EncodingTestForOmit): JsonSafe { const obj: any = {}; message.str !== undefined && (obj.str = message.str); message.oStr !== undefined && (obj.oStr = message.oStr); diff --git a/__fixtures__/misc/output-proto-amino/no-amino-legacy/misc/eval_request.ts b/__fixtures__/misc/output-proto-amino/no-amino-legacy/misc/eval_request.ts index 03b8e7f7f7..e6cf4d68b4 100644 --- a/__fixtures__/misc/output-proto-amino/no-amino-legacy/misc/eval_request.ts +++ b/__fixtures__/misc/output-proto-amino/no-amino-legacy/misc/eval_request.ts @@ -2,6 +2,7 @@ import { ExprValue, ExprValueSDKType, IdRef, IdRefSDKType } from "../google/api/ import { FeatureSet_Utf8Validation, featureSet_Utf8ValidationFromJSON, featureSet_Utf8ValidationToJSON } from "../google/protobuf/descriptor"; import { BinaryReader, BinaryWriter } from "../binary"; import { isSet, DeepPartial, isObject } from "../helpers"; +import { JsonSafe } from "../json-safe"; export const protobufPackage = "misc"; /** VoteOption enumerates the valid vote options for a given governance proposal. */ export enum VoteOption { @@ -186,7 +187,7 @@ export const EvalRequest_BindingsEntry = { if (isSet(object.value)) obj.value = ExprValue.fromJSON(object.value); return obj; }, - toJSON(message: EvalRequest_BindingsEntry): unknown { + toJSON(message: EvalRequest_BindingsEntry): JsonSafe { const obj: any = {}; message.key !== undefined && (obj.key = message.key); message.value !== undefined && (obj.value = message.value ? ExprValue.toJSON(message.value) : undefined); @@ -286,7 +287,7 @@ export const EvalRequest_RefsEntry = { if (isSet(object.value)) obj.value = IdRef.fromJSON(object.value); return obj; }, - toJSON(message: EvalRequest_RefsEntry): unknown { + toJSON(message: EvalRequest_RefsEntry): JsonSafe { const obj: any = {}; message.key !== undefined && (obj.key = message.key); message.value !== undefined && (obj.value = message.value ? IdRef.toJSON(message.value) : undefined); @@ -473,7 +474,7 @@ export const EvalRequest = { if (isSet(object.opt)) obj.opt = featureSet_Utf8ValidationFromJSON(object.opt); return obj; }, - toJSON(message: EvalRequest): unknown { + toJSON(message: EvalRequest): JsonSafe { const obj: any = {}; obj.bindings = {}; if (message.bindings) { @@ -728,7 +729,7 @@ export const AccessConfig = { if (isSet(object.sender)) obj.sender = String(object.sender); return obj; }, - toJSON(message: AccessConfig): unknown { + toJSON(message: AccessConfig): JsonSafe { const obj: any = {}; message.sender !== undefined && (obj.sender = message.sender); return obj; @@ -816,7 +817,7 @@ export const GenericAuthorization = { if (isSet(object.msg)) obj.msg = String(object.msg); return obj; }, - toJSON(message: GenericAuthorization): unknown { + toJSON(message: GenericAuthorization): JsonSafe { const obj: any = {}; message.msg !== undefined && (obj.msg = message.msg); return obj; diff --git a/__fixtures__/misc/output-proto-amino/no-amino-legacy/misc/tx.ts b/__fixtures__/misc/output-proto-amino/no-amino-legacy/misc/tx.ts index 46645b2199..3b84ad93d2 100644 --- a/__fixtures__/misc/output-proto-amino/no-amino-legacy/misc/tx.ts +++ b/__fixtures__/misc/output-proto-amino/no-amino-legacy/misc/tx.ts @@ -1,6 +1,7 @@ import { EncodingTestForDontOmit, EncodingTestForDontOmitSDKType, EncodingTestForOmit, EncodingTestForOmitSDKType } from "./all_fields"; import { BinaryReader, BinaryWriter } from "../binary"; import { isSet, DeepPartial } from "../helpers"; +import { JsonSafe } from "../json-safe"; export const protobufPackage = "misc"; /** * MsgGrant is a request type for Grant method. It declares authorization to the grantee @@ -73,7 +74,7 @@ export const InputMsg = { if (isSet(object.oTests)) obj.oTests = EncodingTestForOmit.fromJSON(object.oTests); return obj; }, - toJSON(message: InputMsg): unknown { + toJSON(message: InputMsg): JsonSafe { const obj: any = {}; message.dOTests !== undefined && (obj.dOTests = message.dOTests ? EncodingTestForDontOmit.toJSON(message.dOTests) : undefined); message.oTests !== undefined && (obj.oTests = message.oTests ? EncodingTestForOmit.toJSON(message.oTests) : undefined); @@ -165,7 +166,7 @@ export const MsgResponse = { const obj = createBaseMsgResponse(); return obj; }, - toJSON(_: MsgResponse): unknown { + toJSON(_: MsgResponse): JsonSafe { const obj: any = {}; return obj; }, diff --git a/__fixtures__/misc/output-proto-amino/no-amino-no-proto/google/api/expr/v1alpha1/eval.ts b/__fixtures__/misc/output-proto-amino/no-amino-no-proto/google/api/expr/v1alpha1/eval.ts index dfd0ff7c3f..ae030870d2 100644 --- a/__fixtures__/misc/output-proto-amino/no-amino-no-proto/google/api/expr/v1alpha1/eval.ts +++ b/__fixtures__/misc/output-proto-amino/no-amino-no-proto/google/api/expr/v1alpha1/eval.ts @@ -1,4 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../../binary"; +import { JsonSafe } from "../../../../json-safe"; import { DeepPartial, isSet } from "../../../../helpers"; export const protobufPackage = "google.api.expr.v1alpha1"; export interface ExprValue { @@ -50,7 +51,7 @@ export const ExprValue = { if (Array.isArray(object?.exprs)) obj.exprs = object.exprs.map((e: any) => IdRef.fromJSON(e)); return obj; }, - toJSON(message: ExprValue): unknown { + toJSON(message: ExprValue): JsonSafe { const obj: any = {}; if (message.exprs) { obj.exprs = message.exprs.map(e => e ? IdRef.toJSON(e) : undefined); @@ -119,7 +120,7 @@ export const IdRef = { if (isSet(object.id)) obj.id = Number(object.id); return obj; }, - toJSON(message: IdRef): unknown { + toJSON(message: IdRef): JsonSafe { const obj: any = {}; message.id !== undefined && (obj.id = Math.round(message.id)); return obj; diff --git a/__fixtures__/misc/output-proto-amino/no-amino-no-proto/google/protobuf/any.ts b/__fixtures__/misc/output-proto-amino/no-amino-no-proto/google/protobuf/any.ts index 974cea2042..d0e9fb4312 100644 --- a/__fixtures__/misc/output-proto-amino/no-amino-no-proto/google/protobuf/any.ts +++ b/__fixtures__/misc/output-proto-amino/no-amino-no-proto/google/protobuf/any.ts @@ -1,5 +1,6 @@ import { BinaryReader, BinaryWriter } from "../../binary"; import { isSet, bytesFromBase64, base64FromBytes, DeepPartial } from "../../helpers"; +import { JsonSafe } from "../../json-safe"; export const protobufPackage = "google.protobuf"; /** * `Any` contains an arbitrary serialized protocol buffer message along with a @@ -247,7 +248,7 @@ export const Any = { if (isSet(object.value)) obj.value = bytesFromBase64(object.value); return obj; }, - toJSON(message: Any): unknown { + toJSON(message: Any): JsonSafe { const obj: any = {}; message.typeUrl !== undefined && (obj.typeUrl = message.typeUrl); message.value !== undefined && (obj.value = base64FromBytes(message.value !== undefined ? message.value : new Uint8Array())); diff --git a/__fixtures__/misc/output-proto-amino/no-amino-no-proto/google/protobuf/descriptor.ts b/__fixtures__/misc/output-proto-amino/no-amino-no-proto/google/protobuf/descriptor.ts index 5d7a09103e..434691c414 100644 --- a/__fixtures__/misc/output-proto-amino/no-amino-no-proto/google/protobuf/descriptor.ts +++ b/__fixtures__/misc/output-proto-amino/no-amino-no-proto/google/protobuf/descriptor.ts @@ -1,4 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../binary"; +import { JsonSafe } from "../../json-safe"; import { DeepPartial, isSet, bytesFromBase64, base64FromBytes } from "../../helpers"; export const protobufPackage = "google.protobuf"; export enum FieldDescriptorProto_Type { @@ -1362,7 +1363,7 @@ export const FileDescriptorSet = { if (Array.isArray(object?.file)) obj.file = object.file.map((e: any) => FileDescriptorProto.fromJSON(e)); return obj; }, - toJSON(message: FileDescriptorSet): unknown { + toJSON(message: FileDescriptorSet): JsonSafe { const obj: any = {}; if (message.file) { obj.file = message.file.map(e => e ? FileDescriptorProto.toJSON(e) : undefined); @@ -1537,7 +1538,7 @@ export const FileDescriptorProto = { if (isSet(object.syntax)) obj.syntax = String(object.syntax); return obj; }, - toJSON(message: FileDescriptorProto): unknown { + toJSON(message: FileDescriptorProto): JsonSafe { const obj: any = {}; message.name !== undefined && (obj.name = message.name); message.package !== undefined && (obj.package = message.package); @@ -1785,7 +1786,7 @@ export const DescriptorProto = { if (Array.isArray(object?.reservedName)) obj.reservedName = object.reservedName.map((e: any) => String(e)); return obj; }, - toJSON(message: DescriptorProto): unknown { + toJSON(message: DescriptorProto): JsonSafe { const obj: any = {}; message.name !== undefined && (obj.name = message.name); if (message.field) { @@ -1973,7 +1974,7 @@ export const DescriptorProto_ExtensionRange = { if (isSet(object.options)) obj.options = ExtensionRangeOptions.fromJSON(object.options); return obj; }, - toJSON(message: DescriptorProto_ExtensionRange): unknown { + toJSON(message: DescriptorProto_ExtensionRange): JsonSafe { const obj: any = {}; message.start !== undefined && (obj.start = Math.round(message.start)); message.end !== undefined && (obj.end = Math.round(message.end)); @@ -2054,7 +2055,7 @@ export const DescriptorProto_ReservedRange = { if (isSet(object.end)) obj.end = Number(object.end); return obj; }, - toJSON(message: DescriptorProto_ReservedRange): unknown { + toJSON(message: DescriptorProto_ReservedRange): JsonSafe { const obj: any = {}; message.start !== undefined && (obj.start = Math.round(message.start)); message.end !== undefined && (obj.end = Math.round(message.end)); @@ -2120,7 +2121,7 @@ export const ExtensionRangeOptions = { if (Array.isArray(object?.uninterpretedOption)) obj.uninterpretedOption = object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)); return obj; }, - toJSON(message: ExtensionRangeOptions): unknown { + toJSON(message: ExtensionRangeOptions): JsonSafe { const obj: any = {}; if (message.uninterpretedOption) { obj.uninterpretedOption = message.uninterpretedOption.map(e => e ? UninterpretedOption.toJSON(e) : undefined); @@ -2261,7 +2262,7 @@ export const FieldDescriptorProto = { if (isSet(object.options)) obj.options = FieldOptions.fromJSON(object.options); return obj; }, - toJSON(message: FieldDescriptorProto): unknown { + toJSON(message: FieldDescriptorProto): JsonSafe { const obj: any = {}; message.name !== undefined && (obj.name = message.name); message.number !== undefined && (obj.number = Math.round(message.number)); @@ -2377,7 +2378,7 @@ export const OneofDescriptorProto = { if (isSet(object.options)) obj.options = OneofOptions.fromJSON(object.options); return obj; }, - toJSON(message: OneofDescriptorProto): unknown { + toJSON(message: OneofDescriptorProto): JsonSafe { const obj: any = {}; message.name !== undefined && (obj.name = message.name); message.options !== undefined && (obj.options = message.options ? OneofOptions.toJSON(message.options) : undefined); @@ -2477,7 +2478,7 @@ export const EnumDescriptorProto = { if (Array.isArray(object?.reservedName)) obj.reservedName = object.reservedName.map((e: any) => String(e)); return obj; }, - toJSON(message: EnumDescriptorProto): unknown { + toJSON(message: EnumDescriptorProto): JsonSafe { const obj: any = {}; message.name !== undefined && (obj.name = message.name); if (message.value) { @@ -2592,7 +2593,7 @@ export const EnumDescriptorProto_EnumReservedRange = { if (isSet(object.end)) obj.end = Number(object.end); return obj; }, - toJSON(message: EnumDescriptorProto_EnumReservedRange): unknown { + toJSON(message: EnumDescriptorProto_EnumReservedRange): JsonSafe { const obj: any = {}; message.start !== undefined && (obj.start = Math.round(message.start)); message.end !== undefined && (obj.end = Math.round(message.end)); @@ -2674,7 +2675,7 @@ export const EnumValueDescriptorProto = { if (isSet(object.options)) obj.options = EnumValueOptions.fromJSON(object.options); return obj; }, - toJSON(message: EnumValueDescriptorProto): unknown { + toJSON(message: EnumValueDescriptorProto): JsonSafe { const obj: any = {}; message.name !== undefined && (obj.name = message.name); message.number !== undefined && (obj.number = Math.round(message.number)); @@ -2763,7 +2764,7 @@ export const ServiceDescriptorProto = { if (isSet(object.options)) obj.options = ServiceOptions.fromJSON(object.options); return obj; }, - toJSON(message: ServiceDescriptorProto): unknown { + toJSON(message: ServiceDescriptorProto): JsonSafe { const obj: any = {}; message.name !== undefined && (obj.name = message.name); if (message.method) { @@ -2884,7 +2885,7 @@ export const MethodDescriptorProto = { if (isSet(object.serverStreaming)) obj.serverStreaming = Boolean(object.serverStreaming); return obj; }, - toJSON(message: MethodDescriptorProto): unknown { + toJSON(message: MethodDescriptorProto): JsonSafe { const obj: any = {}; message.name !== undefined && (obj.name = message.name); message.inputType !== undefined && (obj.inputType = message.inputType); @@ -3132,7 +3133,7 @@ export const FileOptions = { if (Array.isArray(object?.uninterpretedOption)) obj.uninterpretedOption = object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)); return obj; }, - toJSON(message: FileOptions): unknown { + toJSON(message: FileOptions): JsonSafe { const obj: any = {}; message.javaPackage !== undefined && (obj.javaPackage = message.javaPackage); message.javaOuterClassname !== undefined && (obj.javaOuterClassname = message.javaOuterClassname); @@ -3333,7 +3334,7 @@ export const MessageOptions = { if (Array.isArray(object?.uninterpretedOption)) obj.uninterpretedOption = object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)); return obj; }, - toJSON(message: MessageOptions): unknown { + toJSON(message: MessageOptions): JsonSafe { const obj: any = {}; message.messageSetWireFormat !== undefined && (obj.messageSetWireFormat = message.messageSetWireFormat); message.noStandardDescriptorAccessor !== undefined && (obj.noStandardDescriptorAccessor = message.noStandardDescriptorAccessor); @@ -3470,7 +3471,7 @@ export const FieldOptions = { if (Array.isArray(object?.uninterpretedOption)) obj.uninterpretedOption = object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)); return obj; }, - toJSON(message: FieldOptions): unknown { + toJSON(message: FieldOptions): JsonSafe { const obj: any = {}; message.ctype !== undefined && (obj.ctype = fieldOptions_CTypeToJSON(message.ctype)); message.packed !== undefined && (obj.packed = message.packed); @@ -3569,7 +3570,7 @@ export const OneofOptions = { if (Array.isArray(object?.uninterpretedOption)) obj.uninterpretedOption = object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)); return obj; }, - toJSON(message: OneofOptions): unknown { + toJSON(message: OneofOptions): JsonSafe { const obj: any = {}; if (message.uninterpretedOption) { obj.uninterpretedOption = message.uninterpretedOption.map(e => e ? UninterpretedOption.toJSON(e) : undefined); @@ -3654,7 +3655,7 @@ export const EnumOptions = { if (Array.isArray(object?.uninterpretedOption)) obj.uninterpretedOption = object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)); return obj; }, - toJSON(message: EnumOptions): unknown { + toJSON(message: EnumOptions): JsonSafe { const obj: any = {}; message.allowAlias !== undefined && (obj.allowAlias = message.allowAlias); message.deprecated !== undefined && (obj.deprecated = message.deprecated); @@ -3741,7 +3742,7 @@ export const EnumValueOptions = { if (Array.isArray(object?.uninterpretedOption)) obj.uninterpretedOption = object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)); return obj; }, - toJSON(message: EnumValueOptions): unknown { + toJSON(message: EnumValueOptions): JsonSafe { const obj: any = {}; message.deprecated !== undefined && (obj.deprecated = message.deprecated); if (message.uninterpretedOption) { @@ -3823,7 +3824,7 @@ export const ServiceOptions = { if (Array.isArray(object?.uninterpretedOption)) obj.uninterpretedOption = object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)); return obj; }, - toJSON(message: ServiceOptions): unknown { + toJSON(message: ServiceOptions): JsonSafe { const obj: any = {}; message.deprecated !== undefined && (obj.deprecated = message.deprecated); if (message.uninterpretedOption) { @@ -3913,7 +3914,7 @@ export const MethodOptions = { if (Array.isArray(object?.uninterpretedOption)) obj.uninterpretedOption = object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)); return obj; }, - toJSON(message: MethodOptions): unknown { + toJSON(message: MethodOptions): JsonSafe { const obj: any = {}; message.deprecated !== undefined && (obj.deprecated = message.deprecated); message.idempotencyLevel !== undefined && (obj.idempotencyLevel = methodOptions_IdempotencyLevelToJSON(message.idempotencyLevel)); @@ -4040,7 +4041,7 @@ export const UninterpretedOption = { if (isSet(object.aggregateValue)) obj.aggregateValue = String(object.aggregateValue); return obj; }, - toJSON(message: UninterpretedOption): unknown { + toJSON(message: UninterpretedOption): JsonSafe { const obj: any = {}; if (message.name) { obj.name = message.name.map(e => e ? UninterpretedOption_NamePart.toJSON(e) : undefined); @@ -4151,7 +4152,7 @@ export const UninterpretedOption_NamePart = { if (isSet(object.isExtension)) obj.isExtension = Boolean(object.isExtension); return obj; }, - toJSON(message: UninterpretedOption_NamePart): unknown { + toJSON(message: UninterpretedOption_NamePart): JsonSafe { const obj: any = {}; message.namePart !== undefined && (obj.namePart = message.namePart); message.isExtension !== undefined && (obj.isExtension = message.isExtension); @@ -4217,7 +4218,7 @@ export const SourceCodeInfo = { if (Array.isArray(object?.location)) obj.location = object.location.map((e: any) => SourceCodeInfo_Location.fromJSON(e)); return obj; }, - toJSON(message: SourceCodeInfo): unknown { + toJSON(message: SourceCodeInfo): JsonSafe { const obj: any = {}; if (message.location) { obj.location = message.location.map(e => e ? SourceCodeInfo_Location.toJSON(e) : undefined); @@ -4336,7 +4337,7 @@ export const SourceCodeInfo_Location = { if (Array.isArray(object?.leadingDetachedComments)) obj.leadingDetachedComments = object.leadingDetachedComments.map((e: any) => String(e)); return obj; }, - toJSON(message: SourceCodeInfo_Location): unknown { + toJSON(message: SourceCodeInfo_Location): JsonSafe { const obj: any = {}; if (message.path) { obj.path = message.path.map(e => Math.round(e)); @@ -4441,7 +4442,7 @@ export const GeneratedCodeInfo = { if (Array.isArray(object?.annotation)) obj.annotation = object.annotation.map((e: any) => GeneratedCodeInfo_Annotation.fromJSON(e)); return obj; }, - toJSON(message: GeneratedCodeInfo): unknown { + toJSON(message: GeneratedCodeInfo): JsonSafe { const obj: any = {}; if (message.annotation) { obj.annotation = message.annotation.map(e => e ? GeneratedCodeInfo_Annotation.toJSON(e) : undefined); @@ -4543,7 +4544,7 @@ export const GeneratedCodeInfo_Annotation = { if (isSet(object.end)) obj.end = Number(object.end); return obj; }, - toJSON(message: GeneratedCodeInfo_Annotation): unknown { + toJSON(message: GeneratedCodeInfo_Annotation): JsonSafe { const obj: any = {}; if (message.path) { obj.path = message.path.map(e => Math.round(e)); @@ -4627,7 +4628,7 @@ export const FeatureSet = { if (isSet(object.utf8Validation)) obj.utf8Validation = featureSet_Utf8ValidationFromJSON(object.utf8Validation); return obj; }, - toJSON(message: FeatureSet): unknown { + toJSON(message: FeatureSet): JsonSafe { const obj: any = {}; message.utf8Validation !== undefined && (obj.utf8Validation = featureSet_Utf8ValidationToJSON(message.utf8Validation)); return obj; diff --git a/__fixtures__/misc/output-proto-amino/no-amino-no-proto/google/protobuf/duration.ts b/__fixtures__/misc/output-proto-amino/no-amino-no-proto/google/protobuf/duration.ts index b6ca657130..2d1eb2cc33 100644 --- a/__fixtures__/misc/output-proto-amino/no-amino-no-proto/google/protobuf/duration.ts +++ b/__fixtures__/misc/output-proto-amino/no-amino-no-proto/google/protobuf/duration.ts @@ -1,5 +1,6 @@ import { BinaryReader, BinaryWriter } from "../../binary"; import { isSet, DeepPartial } from "../../helpers"; +import { JsonSafe } from "../../json-safe"; export const protobufPackage = "google.protobuf"; /** * A Duration represents a signed, fixed-length span of time represented @@ -185,7 +186,7 @@ export const Duration = { if (isSet(object.nanos)) obj.nanos = Number(object.nanos); return obj; }, - toJSON(message: Duration): unknown { + toJSON(message: Duration): JsonSafe { const obj: any = {}; message.seconds !== undefined && (obj.seconds = (message.seconds || BigInt(0)).toString()); message.nanos !== undefined && (obj.nanos = Math.round(message.nanos)); diff --git a/__fixtures__/misc/output-proto-amino/no-amino-no-proto/google/protobuf/timestamp.ts b/__fixtures__/misc/output-proto-amino/no-amino-no-proto/google/protobuf/timestamp.ts index c7f4343aca..e3d1b0b2be 100644 --- a/__fixtures__/misc/output-proto-amino/no-amino-no-proto/google/protobuf/timestamp.ts +++ b/__fixtures__/misc/output-proto-amino/no-amino-no-proto/google/protobuf/timestamp.ts @@ -1,5 +1,6 @@ import { BinaryReader, BinaryWriter } from "../../binary"; import { isSet, DeepPartial } from "../../helpers"; +import { JsonSafe } from "../../json-safe"; export const protobufPackage = "google.protobuf"; /** * A Timestamp represents a point in time independent of any time zone or local @@ -231,7 +232,7 @@ export const Timestamp = { if (isSet(object.nanos)) obj.nanos = Number(object.nanos); return obj; }, - toJSON(message: Timestamp): unknown { + toJSON(message: Timestamp): JsonSafe { const obj: any = {}; message.seconds !== undefined && (obj.seconds = (message.seconds || BigInt(0)).toString()); message.nanos !== undefined && (obj.nanos = Math.round(message.nanos)); diff --git a/__fixtures__/misc/output-proto-amino/no-amino-no-proto/index.ts b/__fixtures__/misc/output-proto-amino/no-amino-no-proto/index.ts index b1c2ce4fad..8982aebc59 100644 --- a/__fixtures__/misc/output-proto-amino/no-amino-no-proto/index.ts +++ b/__fixtures__/misc/output-proto-amino/no-amino-no-proto/index.ts @@ -11,6 +11,7 @@ export * from "./extern"; export * from "./react-query"; export * from "./mobx"; export * from "./pinia-endpoint"; +export * from "./json-safe"; export * from "./varint"; export * from "./utf8"; export * from "./binary"; \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/no-amino-no-proto/json-safe.ts b/__fixtures__/misc/output-proto-amino/no-amino-no-proto/json-safe.ts new file mode 100644 index 0000000000..7d46f89144 --- /dev/null +++ b/__fixtures__/misc/output-proto-amino/no-amino-no-proto/json-safe.ts @@ -0,0 +1,10 @@ +/** +* This file and any referenced files were automatically generated by @cosmology/telescope@latest +* DO NOT MODIFY BY HAND. Instead, download the latest proto files for your chain +* and run the transpile command or npm scripts command that is used to regenerate this bundle. +*/ + + +export type JsonSafe = { + [Prop in keyof T]: T[Prop] extends Uint8Array ? string : T[Prop] extends bigint ? string : T[Prop]; +} diff --git a/__fixtures__/misc/output-proto-amino/no-amino-no-proto/misc/all_fields.ts b/__fixtures__/misc/output-proto-amino/no-amino-no-proto/misc/all_fields.ts index d0cbe0c51d..52dcea6eca 100644 --- a/__fixtures__/misc/output-proto-amino/no-amino-no-proto/misc/all_fields.ts +++ b/__fixtures__/misc/output-proto-amino/no-amino-no-proto/misc/all_fields.ts @@ -5,6 +5,7 @@ import { Timestamp, TimestampSDKType } from "../google/protobuf/timestamp"; import { BinaryReader, BinaryWriter } from "../binary"; import { toTimestamp, fromTimestamp, isSet, bytesFromBase64, base64FromBytes, DeepPartial } from "../helpers"; import { Decimal } from "@cosmjs/math"; +import { JsonSafe } from "../json-safe"; export const protobufPackage = "misc"; export interface EncodingTestForDontOmit { /** scalar */ @@ -715,7 +716,7 @@ export const EncodingTestForDontOmit = { if (Array.isArray(object?.dODecs)) obj.dODecs = object.dODecs.map((e: any) => String(e)); return obj; }, - toJSON(message: EncodingTestForDontOmit): unknown { + toJSON(message: EncodingTestForDontOmit): JsonSafe { const obj: any = {}; message.str !== undefined && (obj.str = message.str); message.dOStr !== undefined && (obj.dOStr = message.dOStr); @@ -1621,7 +1622,7 @@ export const EncodingTestForOmit = { if (Array.isArray(object?.oDecs)) obj.oDecs = object.oDecs.map((e: any) => String(e)); return obj; }, - toJSON(message: EncodingTestForOmit): unknown { + toJSON(message: EncodingTestForOmit): JsonSafe { const obj: any = {}; message.str !== undefined && (obj.str = message.str); message.oStr !== undefined && (obj.oStr = message.oStr); diff --git a/__fixtures__/misc/output-proto-amino/no-amino-no-proto/misc/eval_request.ts b/__fixtures__/misc/output-proto-amino/no-amino-no-proto/misc/eval_request.ts index 967ee84cd2..a6c0f6e71a 100644 --- a/__fixtures__/misc/output-proto-amino/no-amino-no-proto/misc/eval_request.ts +++ b/__fixtures__/misc/output-proto-amino/no-amino-no-proto/misc/eval_request.ts @@ -2,6 +2,7 @@ import { ExprValue, ExprValueSDKType, IdRef, IdRefSDKType } from "../google/api/ import { FeatureSet_Utf8Validation, featureSet_Utf8ValidationFromJSON, featureSet_Utf8ValidationToJSON } from "../google/protobuf/descriptor"; import { BinaryReader, BinaryWriter } from "../binary"; import { isSet, DeepPartial, isObject } from "../helpers"; +import { JsonSafe } from "../json-safe"; export const protobufPackage = "misc"; /** VoteOption enumerates the valid vote options for a given governance proposal. */ export enum VoteOption { @@ -166,7 +167,7 @@ export const EvalRequest_BindingsEntry = { if (isSet(object.value)) obj.value = ExprValue.fromJSON(object.value); return obj; }, - toJSON(message: EvalRequest_BindingsEntry): unknown { + toJSON(message: EvalRequest_BindingsEntry): JsonSafe { const obj: any = {}; message.key !== undefined && (obj.key = message.key); message.value !== undefined && (obj.value = message.value ? ExprValue.toJSON(message.value) : undefined); @@ -241,7 +242,7 @@ export const EvalRequest_RefsEntry = { if (isSet(object.value)) obj.value = IdRef.fromJSON(object.value); return obj; }, - toJSON(message: EvalRequest_RefsEntry): unknown { + toJSON(message: EvalRequest_RefsEntry): JsonSafe { const obj: any = {}; message.key !== undefined && (obj.key = message.key); message.value !== undefined && (obj.value = message.value ? IdRef.toJSON(message.value) : undefined); @@ -403,7 +404,7 @@ export const EvalRequest = { if (isSet(object.opt)) obj.opt = featureSet_Utf8ValidationFromJSON(object.opt); return obj; }, - toJSON(message: EvalRequest): unknown { + toJSON(message: EvalRequest): JsonSafe { const obj: any = {}; obj.bindings = {}; if (message.bindings) { @@ -573,7 +574,7 @@ export const AccessConfig = { if (isSet(object.sender)) obj.sender = String(object.sender); return obj; }, - toJSON(message: AccessConfig): unknown { + toJSON(message: AccessConfig): JsonSafe { const obj: any = {}; message.sender !== undefined && (obj.sender = message.sender); return obj; @@ -634,7 +635,7 @@ export const GenericAuthorization = { if (isSet(object.msg)) obj.msg = String(object.msg); return obj; }, - toJSON(message: GenericAuthorization): unknown { + toJSON(message: GenericAuthorization): JsonSafe { const obj: any = {}; message.msg !== undefined && (obj.msg = message.msg); return obj; diff --git a/__fixtures__/misc/output-proto-amino/no-amino-no-proto/misc/tx.ts b/__fixtures__/misc/output-proto-amino/no-amino-no-proto/misc/tx.ts index 711b4292af..8741e8f350 100644 --- a/__fixtures__/misc/output-proto-amino/no-amino-no-proto/misc/tx.ts +++ b/__fixtures__/misc/output-proto-amino/no-amino-no-proto/misc/tx.ts @@ -1,6 +1,7 @@ import { EncodingTestForDontOmit, EncodingTestForDontOmitSDKType, EncodingTestForOmit, EncodingTestForOmitSDKType } from "./all_fields"; import { BinaryReader, BinaryWriter } from "../binary"; import { isSet, DeepPartial } from "../helpers"; +import { JsonSafe } from "../json-safe"; export const protobufPackage = "misc"; /** * MsgGrant is a request type for Grant method. It declares authorization to the grantee @@ -65,7 +66,7 @@ export const InputMsg = { if (isSet(object.oTests)) obj.oTests = EncodingTestForOmit.fromJSON(object.oTests); return obj; }, - toJSON(message: InputMsg): unknown { + toJSON(message: InputMsg): JsonSafe { const obj: any = {}; message.dOTests !== undefined && (obj.dOTests = message.dOTests ? EncodingTestForDontOmit.toJSON(message.dOTests) : undefined); message.oTests !== undefined && (obj.oTests = message.oTests ? EncodingTestForOmit.toJSON(message.oTests) : undefined); @@ -126,7 +127,7 @@ export const MsgResponse = { const obj = createBaseMsgResponse(); return obj; }, - toJSON(_: MsgResponse): unknown { + toJSON(_: MsgResponse): JsonSafe { const obj: any = {}; return obj; }, diff --git a/__fixtures__/misc/output-proto-amino/no-amino/google/api/expr/v1alpha1/eval.ts b/__fixtures__/misc/output-proto-amino/no-amino/google/api/expr/v1alpha1/eval.ts index 50b92187a5..600c68e4f1 100644 --- a/__fixtures__/misc/output-proto-amino/no-amino/google/api/expr/v1alpha1/eval.ts +++ b/__fixtures__/misc/output-proto-amino/no-amino/google/api/expr/v1alpha1/eval.ts @@ -1,4 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../../binary"; +import { JsonSafe } from "../../../../json-safe"; import { DeepPartial, isSet } from "../../../../helpers"; export const protobufPackage = "google.api.expr.v1alpha1"; export interface ExprValue { @@ -58,7 +59,7 @@ export const ExprValue = { if (Array.isArray(object?.exprs)) obj.exprs = object.exprs.map((e: any) => IdRef.fromJSON(e)); return obj; }, - toJSON(message: ExprValue): unknown { + toJSON(message: ExprValue): JsonSafe { const obj: any = {}; if (message.exprs) { obj.exprs = message.exprs.map(e => e ? IdRef.toJSON(e) : undefined); @@ -156,7 +157,7 @@ export const IdRef = { if (isSet(object.id)) obj.id = Number(object.id); return obj; }, - toJSON(message: IdRef): unknown { + toJSON(message: IdRef): JsonSafe { const obj: any = {}; message.id !== undefined && (obj.id = Math.round(message.id)); return obj; diff --git a/__fixtures__/misc/output-proto-amino/no-amino/google/protobuf/any.ts b/__fixtures__/misc/output-proto-amino/no-amino/google/protobuf/any.ts index d1c066a4df..0e7ea482a7 100644 --- a/__fixtures__/misc/output-proto-amino/no-amino/google/protobuf/any.ts +++ b/__fixtures__/misc/output-proto-amino/no-amino/google/protobuf/any.ts @@ -1,5 +1,6 @@ import { BinaryReader, BinaryWriter } from "../../binary"; import { isSet, bytesFromBase64, base64FromBytes, DeepPartial } from "../../helpers"; +import { JsonSafe } from "../../json-safe"; export const protobufPackage = "google.protobuf"; /** * `Any` contains an arbitrary serialized protocol buffer message along with a @@ -251,7 +252,7 @@ export const Any = { if (isSet(object.value)) obj.value = bytesFromBase64(object.value); return obj; }, - toJSON(message: Any): unknown { + toJSON(message: Any): JsonSafe { const obj: any = {}; message.typeUrl !== undefined && (obj.typeUrl = message.typeUrl); message.value !== undefined && (obj.value = base64FromBytes(message.value !== undefined ? message.value : new Uint8Array())); diff --git a/__fixtures__/misc/output-proto-amino/no-amino/google/protobuf/descriptor.ts b/__fixtures__/misc/output-proto-amino/no-amino/google/protobuf/descriptor.ts index 1f3671fd23..8315b68154 100644 --- a/__fixtures__/misc/output-proto-amino/no-amino/google/protobuf/descriptor.ts +++ b/__fixtures__/misc/output-proto-amino/no-amino/google/protobuf/descriptor.ts @@ -1,4 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../binary"; +import { JsonSafe } from "../../json-safe"; import { DeepPartial, isSet, bytesFromBase64, base64FromBytes } from "../../helpers"; export const protobufPackage = "google.protobuf"; export enum FieldDescriptorProto_Type { @@ -1474,7 +1475,7 @@ export const FileDescriptorSet = { if (Array.isArray(object?.file)) obj.file = object.file.map((e: any) => FileDescriptorProto.fromJSON(e)); return obj; }, - toJSON(message: FileDescriptorSet): unknown { + toJSON(message: FileDescriptorSet): JsonSafe { const obj: any = {}; if (message.file) { obj.file = message.file.map(e => e ? FileDescriptorProto.toJSON(e) : undefined); @@ -1678,7 +1679,7 @@ export const FileDescriptorProto = { if (isSet(object.syntax)) obj.syntax = String(object.syntax); return obj; }, - toJSON(message: FileDescriptorProto): unknown { + toJSON(message: FileDescriptorProto): JsonSafe { const obj: any = {}; message.name !== undefined && (obj.name = message.name); message.package !== undefined && (obj.package = message.package); @@ -2011,7 +2012,7 @@ export const DescriptorProto = { if (Array.isArray(object?.reservedName)) obj.reservedName = object.reservedName.map((e: any) => String(e)); return obj; }, - toJSON(message: DescriptorProto): unknown { + toJSON(message: DescriptorProto): JsonSafe { const obj: any = {}; message.name !== undefined && (obj.name = message.name); if (message.field) { @@ -2278,7 +2279,7 @@ export const DescriptorProto_ExtensionRange = { if (isSet(object.options)) obj.options = ExtensionRangeOptions.fromJSON(object.options); return obj; }, - toJSON(message: DescriptorProto_ExtensionRange): unknown { + toJSON(message: DescriptorProto_ExtensionRange): JsonSafe { const obj: any = {}; message.start !== undefined && (obj.start = Math.round(message.start)); message.end !== undefined && (obj.end = Math.round(message.end)); @@ -2394,7 +2395,7 @@ export const DescriptorProto_ReservedRange = { if (isSet(object.end)) obj.end = Number(object.end); return obj; }, - toJSON(message: DescriptorProto_ReservedRange): unknown { + toJSON(message: DescriptorProto_ReservedRange): JsonSafe { const obj: any = {}; message.start !== undefined && (obj.start = Math.round(message.start)); message.end !== undefined && (obj.end = Math.round(message.end)); @@ -2491,7 +2492,7 @@ export const ExtensionRangeOptions = { if (Array.isArray(object?.uninterpretedOption)) obj.uninterpretedOption = object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)); return obj; }, - toJSON(message: ExtensionRangeOptions): unknown { + toJSON(message: ExtensionRangeOptions): JsonSafe { const obj: any = {}; if (message.uninterpretedOption) { obj.uninterpretedOption = message.uninterpretedOption.map(e => e ? UninterpretedOption.toJSON(e) : undefined); @@ -2661,7 +2662,7 @@ export const FieldDescriptorProto = { if (isSet(object.options)) obj.options = FieldOptions.fromJSON(object.options); return obj; }, - toJSON(message: FieldDescriptorProto): unknown { + toJSON(message: FieldDescriptorProto): JsonSafe { const obj: any = {}; message.name !== undefined && (obj.name = message.name); message.number !== undefined && (obj.number = Math.round(message.number)); @@ -2840,7 +2841,7 @@ export const OneofDescriptorProto = { if (isSet(object.options)) obj.options = OneofOptions.fromJSON(object.options); return obj; }, - toJSON(message: OneofDescriptorProto): unknown { + toJSON(message: OneofDescriptorProto): JsonSafe { const obj: any = {}; message.name !== undefined && (obj.name = message.name); message.options !== undefined && (obj.options = message.options ? OneofOptions.toJSON(message.options) : undefined); @@ -2971,7 +2972,7 @@ export const EnumDescriptorProto = { if (Array.isArray(object?.reservedName)) obj.reservedName = object.reservedName.map((e: any) => String(e)); return obj; }, - toJSON(message: EnumDescriptorProto): unknown { + toJSON(message: EnumDescriptorProto): JsonSafe { const obj: any = {}; message.name !== undefined && (obj.name = message.name); if (message.value) { @@ -3135,7 +3136,7 @@ export const EnumDescriptorProto_EnumReservedRange = { if (isSet(object.end)) obj.end = Number(object.end); return obj; }, - toJSON(message: EnumDescriptorProto_EnumReservedRange): unknown { + toJSON(message: EnumDescriptorProto_EnumReservedRange): JsonSafe { const obj: any = {}; message.start !== undefined && (obj.start = Math.round(message.start)); message.end !== undefined && (obj.end = Math.round(message.end)); @@ -3248,7 +3249,7 @@ export const EnumValueDescriptorProto = { if (isSet(object.options)) obj.options = EnumValueOptions.fromJSON(object.options); return obj; }, - toJSON(message: EnumValueDescriptorProto): unknown { + toJSON(message: EnumValueDescriptorProto): JsonSafe { const obj: any = {}; message.name !== undefined && (obj.name = message.name); message.number !== undefined && (obj.number = Math.round(message.number)); @@ -3372,7 +3373,7 @@ export const ServiceDescriptorProto = { if (isSet(object.options)) obj.options = ServiceOptions.fromJSON(object.options); return obj; }, - toJSON(message: ServiceDescriptorProto): unknown { + toJSON(message: ServiceDescriptorProto): JsonSafe { const obj: any = {}; message.name !== undefined && (obj.name = message.name); if (message.method) { @@ -3530,7 +3531,7 @@ export const MethodDescriptorProto = { if (isSet(object.serverStreaming)) obj.serverStreaming = Boolean(object.serverStreaming); return obj; }, - toJSON(message: MethodDescriptorProto): unknown { + toJSON(message: MethodDescriptorProto): JsonSafe { const obj: any = {}; message.name !== undefined && (obj.name = message.name); message.inputType !== undefined && (obj.inputType = message.inputType); @@ -3825,7 +3826,7 @@ export const FileOptions = { if (Array.isArray(object?.uninterpretedOption)) obj.uninterpretedOption = object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)); return obj; }, - toJSON(message: FileOptions): unknown { + toJSON(message: FileOptions): JsonSafe { const obj: any = {}; message.javaPackage !== undefined && (obj.javaPackage = message.javaPackage); message.javaOuterClassname !== undefined && (obj.javaOuterClassname = message.javaOuterClassname); @@ -4135,7 +4136,7 @@ export const MessageOptions = { if (Array.isArray(object?.uninterpretedOption)) obj.uninterpretedOption = object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)); return obj; }, - toJSON(message: MessageOptions): unknown { + toJSON(message: MessageOptions): JsonSafe { const obj: any = {}; message.messageSetWireFormat !== undefined && (obj.messageSetWireFormat = message.messageSetWireFormat); message.noStandardDescriptorAccessor !== undefined && (obj.noStandardDescriptorAccessor = message.noStandardDescriptorAccessor); @@ -4317,7 +4318,7 @@ export const FieldOptions = { if (Array.isArray(object?.uninterpretedOption)) obj.uninterpretedOption = object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)); return obj; }, - toJSON(message: FieldOptions): unknown { + toJSON(message: FieldOptions): JsonSafe { const obj: any = {}; message.ctype !== undefined && (obj.ctype = fieldOptions_CTypeToJSON(message.ctype)); message.packed !== undefined && (obj.packed = message.packed); @@ -4469,7 +4470,7 @@ export const OneofOptions = { if (Array.isArray(object?.uninterpretedOption)) obj.uninterpretedOption = object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)); return obj; }, - toJSON(message: OneofOptions): unknown { + toJSON(message: OneofOptions): JsonSafe { const obj: any = {}; if (message.uninterpretedOption) { obj.uninterpretedOption = message.uninterpretedOption.map(e => e ? UninterpretedOption.toJSON(e) : undefined); @@ -4583,7 +4584,7 @@ export const EnumOptions = { if (Array.isArray(object?.uninterpretedOption)) obj.uninterpretedOption = object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)); return obj; }, - toJSON(message: EnumOptions): unknown { + toJSON(message: EnumOptions): JsonSafe { const obj: any = {}; message.allowAlias !== undefined && (obj.allowAlias = message.allowAlias); message.deprecated !== undefined && (obj.deprecated = message.deprecated); @@ -4707,7 +4708,7 @@ export const EnumValueOptions = { if (Array.isArray(object?.uninterpretedOption)) obj.uninterpretedOption = object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)); return obj; }, - toJSON(message: EnumValueOptions): unknown { + toJSON(message: EnumValueOptions): JsonSafe { const obj: any = {}; message.deprecated !== undefined && (obj.deprecated = message.deprecated); if (message.uninterpretedOption) { @@ -4822,7 +4823,7 @@ export const ServiceOptions = { if (Array.isArray(object?.uninterpretedOption)) obj.uninterpretedOption = object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)); return obj; }, - toJSON(message: ServiceOptions): unknown { + toJSON(message: ServiceOptions): JsonSafe { const obj: any = {}; message.deprecated !== undefined && (obj.deprecated = message.deprecated); if (message.uninterpretedOption) { @@ -4945,7 +4946,7 @@ export const MethodOptions = { if (Array.isArray(object?.uninterpretedOption)) obj.uninterpretedOption = object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)); return obj; }, - toJSON(message: MethodOptions): unknown { + toJSON(message: MethodOptions): JsonSafe { const obj: any = {}; message.deprecated !== undefined && (obj.deprecated = message.deprecated); message.idempotencyLevel !== undefined && (obj.idempotencyLevel = methodOptions_IdempotencyLevelToJSON(message.idempotencyLevel)); @@ -5109,7 +5110,7 @@ export const UninterpretedOption = { if (isSet(object.aggregateValue)) obj.aggregateValue = String(object.aggregateValue); return obj; }, - toJSON(message: UninterpretedOption): unknown { + toJSON(message: UninterpretedOption): JsonSafe { const obj: any = {}; if (message.name) { obj.name = message.name.map(e => e ? UninterpretedOption_NamePart.toJSON(e) : undefined); @@ -5273,7 +5274,7 @@ export const UninterpretedOption_NamePart = { if (isSet(object.isExtension)) obj.isExtension = Boolean(object.isExtension); return obj; }, - toJSON(message: UninterpretedOption_NamePart): unknown { + toJSON(message: UninterpretedOption_NamePart): JsonSafe { const obj: any = {}; message.namePart !== undefined && (obj.namePart = message.namePart); message.isExtension !== undefined && (obj.isExtension = message.isExtension); @@ -5370,7 +5371,7 @@ export const SourceCodeInfo = { if (Array.isArray(object?.location)) obj.location = object.location.map((e: any) => SourceCodeInfo_Location.fromJSON(e)); return obj; }, - toJSON(message: SourceCodeInfo): unknown { + toJSON(message: SourceCodeInfo): JsonSafe { const obj: any = {}; if (message.location) { obj.location = message.location.map(e => e ? SourceCodeInfo_Location.toJSON(e) : undefined); @@ -5518,7 +5519,7 @@ export const SourceCodeInfo_Location = { if (Array.isArray(object?.leadingDetachedComments)) obj.leadingDetachedComments = object.leadingDetachedComments.map((e: any) => String(e)); return obj; }, - toJSON(message: SourceCodeInfo_Location): unknown { + toJSON(message: SourceCodeInfo_Location): JsonSafe { const obj: any = {}; if (message.path) { obj.path = message.path.map(e => Math.round(e)); @@ -5672,7 +5673,7 @@ export const GeneratedCodeInfo = { if (Array.isArray(object?.annotation)) obj.annotation = object.annotation.map((e: any) => GeneratedCodeInfo_Annotation.fromJSON(e)); return obj; }, - toJSON(message: GeneratedCodeInfo): unknown { + toJSON(message: GeneratedCodeInfo): JsonSafe { const obj: any = {}; if (message.annotation) { obj.annotation = message.annotation.map(e => e ? GeneratedCodeInfo_Annotation.toJSON(e) : undefined); @@ -5803,7 +5804,7 @@ export const GeneratedCodeInfo_Annotation = { if (isSet(object.end)) obj.end = Number(object.end); return obj; }, - toJSON(message: GeneratedCodeInfo_Annotation): unknown { + toJSON(message: GeneratedCodeInfo_Annotation): JsonSafe { const obj: any = {}; if (message.path) { obj.path = message.path.map(e => Math.round(e)); @@ -5928,7 +5929,7 @@ export const FeatureSet = { if (isSet(object.utf8Validation)) obj.utf8Validation = featureSet_Utf8ValidationFromJSON(object.utf8Validation); return obj; }, - toJSON(message: FeatureSet): unknown { + toJSON(message: FeatureSet): JsonSafe { const obj: any = {}; message.utf8Validation !== undefined && (obj.utf8Validation = featureSet_Utf8ValidationToJSON(message.utf8Validation)); return obj; diff --git a/__fixtures__/misc/output-proto-amino/no-amino/google/protobuf/duration.ts b/__fixtures__/misc/output-proto-amino/no-amino/google/protobuf/duration.ts index 532fd9db20..2e1f1eb98b 100644 --- a/__fixtures__/misc/output-proto-amino/no-amino/google/protobuf/duration.ts +++ b/__fixtures__/misc/output-proto-amino/no-amino/google/protobuf/duration.ts @@ -1,5 +1,6 @@ import { BinaryReader, BinaryWriter } from "../../binary"; import { isSet, DeepPartial } from "../../helpers"; +import { JsonSafe } from "../../json-safe"; export const protobufPackage = "google.protobuf"; /** * A Duration represents a signed, fixed-length span of time represented @@ -189,7 +190,7 @@ export const Duration = { if (isSet(object.nanos)) obj.nanos = Number(object.nanos); return obj; }, - toJSON(message: Duration): unknown { + toJSON(message: Duration): JsonSafe { const obj: any = {}; message.seconds !== undefined && (obj.seconds = (message.seconds || BigInt(0)).toString()); message.nanos !== undefined && (obj.nanos = Math.round(message.nanos)); diff --git a/__fixtures__/misc/output-proto-amino/no-amino/google/protobuf/timestamp.ts b/__fixtures__/misc/output-proto-amino/no-amino/google/protobuf/timestamp.ts index 497d725979..c7adc874fd 100644 --- a/__fixtures__/misc/output-proto-amino/no-amino/google/protobuf/timestamp.ts +++ b/__fixtures__/misc/output-proto-amino/no-amino/google/protobuf/timestamp.ts @@ -1,5 +1,6 @@ import { BinaryReader, BinaryWriter } from "../../binary"; import { isSet, DeepPartial, fromJsonTimestamp, fromTimestamp } from "../../helpers"; +import { JsonSafe } from "../../json-safe"; export const protobufPackage = "google.protobuf"; /** * A Timestamp represents a point in time independent of any time zone or local @@ -235,7 +236,7 @@ export const Timestamp = { if (isSet(object.nanos)) obj.nanos = Number(object.nanos); return obj; }, - toJSON(message: Timestamp): unknown { + toJSON(message: Timestamp): JsonSafe { const obj: any = {}; message.seconds !== undefined && (obj.seconds = (message.seconds || BigInt(0)).toString()); message.nanos !== undefined && (obj.nanos = Math.round(message.nanos)); diff --git a/__fixtures__/misc/output-proto-amino/no-amino/index.ts b/__fixtures__/misc/output-proto-amino/no-amino/index.ts index b1c2ce4fad..8982aebc59 100644 --- a/__fixtures__/misc/output-proto-amino/no-amino/index.ts +++ b/__fixtures__/misc/output-proto-amino/no-amino/index.ts @@ -11,6 +11,7 @@ export * from "./extern"; export * from "./react-query"; export * from "./mobx"; export * from "./pinia-endpoint"; +export * from "./json-safe"; export * from "./varint"; export * from "./utf8"; export * from "./binary"; \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/no-amino/json-safe.ts b/__fixtures__/misc/output-proto-amino/no-amino/json-safe.ts new file mode 100644 index 0000000000..7d46f89144 --- /dev/null +++ b/__fixtures__/misc/output-proto-amino/no-amino/json-safe.ts @@ -0,0 +1,10 @@ +/** +* This file and any referenced files were automatically generated by @cosmology/telescope@latest +* DO NOT MODIFY BY HAND. Instead, download the latest proto files for your chain +* and run the transpile command or npm scripts command that is used to regenerate this bundle. +*/ + + +export type JsonSafe = { + [Prop in keyof T]: T[Prop] extends Uint8Array ? string : T[Prop] extends bigint ? string : T[Prop]; +} diff --git a/__fixtures__/misc/output-proto-amino/no-amino/misc/all_fields.ts b/__fixtures__/misc/output-proto-amino/no-amino/misc/all_fields.ts index 7f5731ed7a..f42670b716 100644 --- a/__fixtures__/misc/output-proto-amino/no-amino/misc/all_fields.ts +++ b/__fixtures__/misc/output-proto-amino/no-amino/misc/all_fields.ts @@ -5,6 +5,7 @@ import { Timestamp, TimestampSDKType } from "../google/protobuf/timestamp"; import { BinaryReader, BinaryWriter } from "../binary"; import { toTimestamp, fromTimestamp, isSet, bytesFromBase64, base64FromBytes, DeepPartial } from "../helpers"; import { Decimal } from "@cosmjs/math"; +import { JsonSafe } from "../json-safe"; import { toUtf8, fromBase64, fromUtf8, toBase64 } from "@cosmjs/encoding"; import { encodePubkey, decodePubkey } from "@cosmjs/proto-signing"; export const protobufPackage = "misc"; @@ -725,7 +726,7 @@ export const EncodingTestForDontOmit = { if (Array.isArray(object?.dODecs)) obj.dODecs = object.dODecs.map((e: any) => String(e)); return obj; }, - toJSON(message: EncodingTestForDontOmit): unknown { + toJSON(message: EncodingTestForDontOmit): JsonSafe { const obj: any = {}; message.str !== undefined && (obj.str = message.str); message.dOStr !== undefined && (obj.dOStr = message.dOStr); @@ -1886,7 +1887,7 @@ export const EncodingTestForOmit = { if (Array.isArray(object?.oDecs)) obj.oDecs = object.oDecs.map((e: any) => String(e)); return obj; }, - toJSON(message: EncodingTestForOmit): unknown { + toJSON(message: EncodingTestForOmit): JsonSafe { const obj: any = {}; message.str !== undefined && (obj.str = message.str); message.oStr !== undefined && (obj.oStr = message.oStr); diff --git a/__fixtures__/misc/output-proto-amino/no-amino/misc/eval_request.ts b/__fixtures__/misc/output-proto-amino/no-amino/misc/eval_request.ts index 03b8e7f7f7..e6cf4d68b4 100644 --- a/__fixtures__/misc/output-proto-amino/no-amino/misc/eval_request.ts +++ b/__fixtures__/misc/output-proto-amino/no-amino/misc/eval_request.ts @@ -2,6 +2,7 @@ import { ExprValue, ExprValueSDKType, IdRef, IdRefSDKType } from "../google/api/ import { FeatureSet_Utf8Validation, featureSet_Utf8ValidationFromJSON, featureSet_Utf8ValidationToJSON } from "../google/protobuf/descriptor"; import { BinaryReader, BinaryWriter } from "../binary"; import { isSet, DeepPartial, isObject } from "../helpers"; +import { JsonSafe } from "../json-safe"; export const protobufPackage = "misc"; /** VoteOption enumerates the valid vote options for a given governance proposal. */ export enum VoteOption { @@ -186,7 +187,7 @@ export const EvalRequest_BindingsEntry = { if (isSet(object.value)) obj.value = ExprValue.fromJSON(object.value); return obj; }, - toJSON(message: EvalRequest_BindingsEntry): unknown { + toJSON(message: EvalRequest_BindingsEntry): JsonSafe { const obj: any = {}; message.key !== undefined && (obj.key = message.key); message.value !== undefined && (obj.value = message.value ? ExprValue.toJSON(message.value) : undefined); @@ -286,7 +287,7 @@ export const EvalRequest_RefsEntry = { if (isSet(object.value)) obj.value = IdRef.fromJSON(object.value); return obj; }, - toJSON(message: EvalRequest_RefsEntry): unknown { + toJSON(message: EvalRequest_RefsEntry): JsonSafe { const obj: any = {}; message.key !== undefined && (obj.key = message.key); message.value !== undefined && (obj.value = message.value ? IdRef.toJSON(message.value) : undefined); @@ -473,7 +474,7 @@ export const EvalRequest = { if (isSet(object.opt)) obj.opt = featureSet_Utf8ValidationFromJSON(object.opt); return obj; }, - toJSON(message: EvalRequest): unknown { + toJSON(message: EvalRequest): JsonSafe { const obj: any = {}; obj.bindings = {}; if (message.bindings) { @@ -728,7 +729,7 @@ export const AccessConfig = { if (isSet(object.sender)) obj.sender = String(object.sender); return obj; }, - toJSON(message: AccessConfig): unknown { + toJSON(message: AccessConfig): JsonSafe { const obj: any = {}; message.sender !== undefined && (obj.sender = message.sender); return obj; @@ -816,7 +817,7 @@ export const GenericAuthorization = { if (isSet(object.msg)) obj.msg = String(object.msg); return obj; }, - toJSON(message: GenericAuthorization): unknown { + toJSON(message: GenericAuthorization): JsonSafe { const obj: any = {}; message.msg !== undefined && (obj.msg = message.msg); return obj; diff --git a/__fixtures__/misc/output-proto-amino/no-amino/misc/tx.ts b/__fixtures__/misc/output-proto-amino/no-amino/misc/tx.ts index 46645b2199..3b84ad93d2 100644 --- a/__fixtures__/misc/output-proto-amino/no-amino/misc/tx.ts +++ b/__fixtures__/misc/output-proto-amino/no-amino/misc/tx.ts @@ -1,6 +1,7 @@ import { EncodingTestForDontOmit, EncodingTestForDontOmitSDKType, EncodingTestForOmit, EncodingTestForOmitSDKType } from "./all_fields"; import { BinaryReader, BinaryWriter } from "../binary"; import { isSet, DeepPartial } from "../helpers"; +import { JsonSafe } from "../json-safe"; export const protobufPackage = "misc"; /** * MsgGrant is a request type for Grant method. It declares authorization to the grantee @@ -73,7 +74,7 @@ export const InputMsg = { if (isSet(object.oTests)) obj.oTests = EncodingTestForOmit.fromJSON(object.oTests); return obj; }, - toJSON(message: InputMsg): unknown { + toJSON(message: InputMsg): JsonSafe { const obj: any = {}; message.dOTests !== undefined && (obj.dOTests = message.dOTests ? EncodingTestForDontOmit.toJSON(message.dOTests) : undefined); message.oTests !== undefined && (obj.oTests = message.oTests ? EncodingTestForOmit.toJSON(message.oTests) : undefined); @@ -165,7 +166,7 @@ export const MsgResponse = { const obj = createBaseMsgResponse(); return obj; }, - toJSON(_: MsgResponse): unknown { + toJSON(_: MsgResponse): JsonSafe { const obj: any = {}; return obj; }, diff --git a/__fixtures__/misc/output-proto-amino/proto-only-legacy/google/api/expr/v1alpha1/eval.ts b/__fixtures__/misc/output-proto-amino/proto-only-legacy/google/api/expr/v1alpha1/eval.ts index dd686bde8a..3e6d655a22 100644 --- a/__fixtures__/misc/output-proto-amino/proto-only-legacy/google/api/expr/v1alpha1/eval.ts +++ b/__fixtures__/misc/output-proto-amino/proto-only-legacy/google/api/expr/v1alpha1/eval.ts @@ -1,4 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../../binary"; +import { JsonSafe } from "../../../../json-safe"; import { DeepPartial, isSet } from "../../../../helpers"; export const protobufPackage = "google.api.expr.v1alpha1"; export interface ExprValue { @@ -58,7 +59,7 @@ export const ExprValue = { if (Array.isArray(object?.exprs)) obj.exprs = object.exprs.map((e: any) => IdRef.fromJSON(e)); return obj; }, - toJSON(message: ExprValue): unknown { + toJSON(message: ExprValue): JsonSafe { const obj: any = {}; if (message.exprs) { obj.exprs = message.exprs.map(e => e ? IdRef.toJSON(e) : undefined); @@ -139,7 +140,7 @@ export const IdRef = { if (isSet(object.id)) obj.id = Number(object.id); return obj; }, - toJSON(message: IdRef): unknown { + toJSON(message: IdRef): JsonSafe { const obj: any = {}; message.id !== undefined && (obj.id = Math.round(message.id)); return obj; diff --git a/__fixtures__/misc/output-proto-amino/proto-only-legacy/google/protobuf/any.ts b/__fixtures__/misc/output-proto-amino/proto-only-legacy/google/protobuf/any.ts index ff3f9ce34c..7384700153 100644 --- a/__fixtures__/misc/output-proto-amino/proto-only-legacy/google/protobuf/any.ts +++ b/__fixtures__/misc/output-proto-amino/proto-only-legacy/google/protobuf/any.ts @@ -1,5 +1,6 @@ import { BinaryReader, BinaryWriter } from "../../binary"; import { isSet, bytesFromBase64, base64FromBytes, DeepPartial } from "../../helpers"; +import { JsonSafe } from "../../json-safe"; export const protobufPackage = "google.protobuf"; /** * `Any` contains an arbitrary serialized protocol buffer message along with a @@ -251,7 +252,7 @@ export const Any = { if (isSet(object.value)) obj.value = bytesFromBase64(object.value); return obj; }, - toJSON(message: Any): unknown { + toJSON(message: Any): JsonSafe { const obj: any = {}; message.typeUrl !== undefined && (obj.typeUrl = message.typeUrl); message.value !== undefined && (obj.value = base64FromBytes(message.value !== undefined ? message.value : new Uint8Array())); diff --git a/__fixtures__/misc/output-proto-amino/proto-only-legacy/google/protobuf/descriptor.ts b/__fixtures__/misc/output-proto-amino/proto-only-legacy/google/protobuf/descriptor.ts index 0d6c9f92f8..1a01cd1cd6 100644 --- a/__fixtures__/misc/output-proto-amino/proto-only-legacy/google/protobuf/descriptor.ts +++ b/__fixtures__/misc/output-proto-amino/proto-only-legacy/google/protobuf/descriptor.ts @@ -1,4 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../binary"; +import { JsonSafe } from "../../json-safe"; import { DeepPartial, isSet, bytesFromBase64, base64FromBytes } from "../../helpers"; export const protobufPackage = "google.protobuf"; export enum FieldDescriptorProto_Type { @@ -1474,7 +1475,7 @@ export const FileDescriptorSet = { if (Array.isArray(object?.file)) obj.file = object.file.map((e: any) => FileDescriptorProto.fromJSON(e)); return obj; }, - toJSON(message: FileDescriptorSet): unknown { + toJSON(message: FileDescriptorSet): JsonSafe { const obj: any = {}; if (message.file) { obj.file = message.file.map(e => e ? FileDescriptorProto.toJSON(e) : undefined); @@ -1661,7 +1662,7 @@ export const FileDescriptorProto = { if (isSet(object.syntax)) obj.syntax = String(object.syntax); return obj; }, - toJSON(message: FileDescriptorProto): unknown { + toJSON(message: FileDescriptorProto): JsonSafe { const obj: any = {}; message.name !== undefined && (obj.name = message.name); message.package !== undefined && (obj.package = message.package); @@ -1921,7 +1922,7 @@ export const DescriptorProto = { if (Array.isArray(object?.reservedName)) obj.reservedName = object.reservedName.map((e: any) => String(e)); return obj; }, - toJSON(message: DescriptorProto): unknown { + toJSON(message: DescriptorProto): JsonSafe { const obj: any = {}; message.name !== undefined && (obj.name = message.name); if (message.field) { @@ -2121,7 +2122,7 @@ export const DescriptorProto_ExtensionRange = { if (isSet(object.options)) obj.options = ExtensionRangeOptions.fromJSON(object.options); return obj; }, - toJSON(message: DescriptorProto_ExtensionRange): unknown { + toJSON(message: DescriptorProto_ExtensionRange): JsonSafe { const obj: any = {}; message.start !== undefined && (obj.start = Math.round(message.start)); message.end !== undefined && (obj.end = Math.round(message.end)); @@ -2214,7 +2215,7 @@ export const DescriptorProto_ReservedRange = { if (isSet(object.end)) obj.end = Number(object.end); return obj; }, - toJSON(message: DescriptorProto_ReservedRange): unknown { + toJSON(message: DescriptorProto_ReservedRange): JsonSafe { const obj: any = {}; message.start !== undefined && (obj.start = Math.round(message.start)); message.end !== undefined && (obj.end = Math.round(message.end)); @@ -2292,7 +2293,7 @@ export const ExtensionRangeOptions = { if (Array.isArray(object?.uninterpretedOption)) obj.uninterpretedOption = object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)); return obj; }, - toJSON(message: ExtensionRangeOptions): unknown { + toJSON(message: ExtensionRangeOptions): JsonSafe { const obj: any = {}; if (message.uninterpretedOption) { obj.uninterpretedOption = message.uninterpretedOption.map(e => e ? UninterpretedOption.toJSON(e) : undefined); @@ -2445,7 +2446,7 @@ export const FieldDescriptorProto = { if (isSet(object.options)) obj.options = FieldOptions.fromJSON(object.options); return obj; }, - toJSON(message: FieldDescriptorProto): unknown { + toJSON(message: FieldDescriptorProto): JsonSafe { const obj: any = {}; message.name !== undefined && (obj.name = message.name); message.number !== undefined && (obj.number = Math.round(message.number)); @@ -2573,7 +2574,7 @@ export const OneofDescriptorProto = { if (isSet(object.options)) obj.options = OneofOptions.fromJSON(object.options); return obj; }, - toJSON(message: OneofDescriptorProto): unknown { + toJSON(message: OneofDescriptorProto): JsonSafe { const obj: any = {}; message.name !== undefined && (obj.name = message.name); message.options !== undefined && (obj.options = message.options ? OneofOptions.toJSON(message.options) : undefined); @@ -2685,7 +2686,7 @@ export const EnumDescriptorProto = { if (Array.isArray(object?.reservedName)) obj.reservedName = object.reservedName.map((e: any) => String(e)); return obj; }, - toJSON(message: EnumDescriptorProto): unknown { + toJSON(message: EnumDescriptorProto): JsonSafe { const obj: any = {}; message.name !== undefined && (obj.name = message.name); if (message.value) { @@ -2812,7 +2813,7 @@ export const EnumDescriptorProto_EnumReservedRange = { if (isSet(object.end)) obj.end = Number(object.end); return obj; }, - toJSON(message: EnumDescriptorProto_EnumReservedRange): unknown { + toJSON(message: EnumDescriptorProto_EnumReservedRange): JsonSafe { const obj: any = {}; message.start !== undefined && (obj.start = Math.round(message.start)); message.end !== undefined && (obj.end = Math.round(message.end)); @@ -2906,7 +2907,7 @@ export const EnumValueDescriptorProto = { if (isSet(object.options)) obj.options = EnumValueOptions.fromJSON(object.options); return obj; }, - toJSON(message: EnumValueDescriptorProto): unknown { + toJSON(message: EnumValueDescriptorProto): JsonSafe { const obj: any = {}; message.name !== undefined && (obj.name = message.name); message.number !== undefined && (obj.number = Math.round(message.number)); @@ -3007,7 +3008,7 @@ export const ServiceDescriptorProto = { if (isSet(object.options)) obj.options = ServiceOptions.fromJSON(object.options); return obj; }, - toJSON(message: ServiceDescriptorProto): unknown { + toJSON(message: ServiceDescriptorProto): JsonSafe { const obj: any = {}; message.name !== undefined && (obj.name = message.name); if (message.method) { @@ -3140,7 +3141,7 @@ export const MethodDescriptorProto = { if (isSet(object.serverStreaming)) obj.serverStreaming = Boolean(object.serverStreaming); return obj; }, - toJSON(message: MethodDescriptorProto): unknown { + toJSON(message: MethodDescriptorProto): JsonSafe { const obj: any = {}; message.name !== undefined && (obj.name = message.name); message.inputType !== undefined && (obj.inputType = message.inputType); @@ -3400,7 +3401,7 @@ export const FileOptions = { if (Array.isArray(object?.uninterpretedOption)) obj.uninterpretedOption = object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)); return obj; }, - toJSON(message: FileOptions): unknown { + toJSON(message: FileOptions): JsonSafe { const obj: any = {}; message.javaPackage !== undefined && (obj.javaPackage = message.javaPackage); message.javaOuterClassname !== undefined && (obj.javaOuterClassname = message.javaOuterClassname); @@ -3613,7 +3614,7 @@ export const MessageOptions = { if (Array.isArray(object?.uninterpretedOption)) obj.uninterpretedOption = object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)); return obj; }, - toJSON(message: MessageOptions): unknown { + toJSON(message: MessageOptions): JsonSafe { const obj: any = {}; message.messageSetWireFormat !== undefined && (obj.messageSetWireFormat = message.messageSetWireFormat); message.noStandardDescriptorAccessor !== undefined && (obj.noStandardDescriptorAccessor = message.noStandardDescriptorAccessor); @@ -3762,7 +3763,7 @@ export const FieldOptions = { if (Array.isArray(object?.uninterpretedOption)) obj.uninterpretedOption = object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)); return obj; }, - toJSON(message: FieldOptions): unknown { + toJSON(message: FieldOptions): JsonSafe { const obj: any = {}; message.ctype !== undefined && (obj.ctype = fieldOptions_CTypeToJSON(message.ctype)); message.packed !== undefined && (obj.packed = message.packed); @@ -3873,7 +3874,7 @@ export const OneofOptions = { if (Array.isArray(object?.uninterpretedOption)) obj.uninterpretedOption = object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)); return obj; }, - toJSON(message: OneofOptions): unknown { + toJSON(message: OneofOptions): JsonSafe { const obj: any = {}; if (message.uninterpretedOption) { obj.uninterpretedOption = message.uninterpretedOption.map(e => e ? UninterpretedOption.toJSON(e) : undefined); @@ -3970,7 +3971,7 @@ export const EnumOptions = { if (Array.isArray(object?.uninterpretedOption)) obj.uninterpretedOption = object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)); return obj; }, - toJSON(message: EnumOptions): unknown { + toJSON(message: EnumOptions): JsonSafe { const obj: any = {}; message.allowAlias !== undefined && (obj.allowAlias = message.allowAlias); message.deprecated !== undefined && (obj.deprecated = message.deprecated); @@ -4069,7 +4070,7 @@ export const EnumValueOptions = { if (Array.isArray(object?.uninterpretedOption)) obj.uninterpretedOption = object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)); return obj; }, - toJSON(message: EnumValueOptions): unknown { + toJSON(message: EnumValueOptions): JsonSafe { const obj: any = {}; message.deprecated !== undefined && (obj.deprecated = message.deprecated); if (message.uninterpretedOption) { @@ -4163,7 +4164,7 @@ export const ServiceOptions = { if (Array.isArray(object?.uninterpretedOption)) obj.uninterpretedOption = object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)); return obj; }, - toJSON(message: ServiceOptions): unknown { + toJSON(message: ServiceOptions): JsonSafe { const obj: any = {}; message.deprecated !== undefined && (obj.deprecated = message.deprecated); if (message.uninterpretedOption) { @@ -4265,7 +4266,7 @@ export const MethodOptions = { if (Array.isArray(object?.uninterpretedOption)) obj.uninterpretedOption = object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)); return obj; }, - toJSON(message: MethodOptions): unknown { + toJSON(message: MethodOptions): JsonSafe { const obj: any = {}; message.deprecated !== undefined && (obj.deprecated = message.deprecated); message.idempotencyLevel !== undefined && (obj.idempotencyLevel = methodOptions_IdempotencyLevelToJSON(message.idempotencyLevel)); @@ -4404,7 +4405,7 @@ export const UninterpretedOption = { if (isSet(object.aggregateValue)) obj.aggregateValue = String(object.aggregateValue); return obj; }, - toJSON(message: UninterpretedOption): unknown { + toJSON(message: UninterpretedOption): JsonSafe { const obj: any = {}; if (message.name) { obj.name = message.name.map(e => e ? UninterpretedOption_NamePart.toJSON(e) : undefined); @@ -4527,7 +4528,7 @@ export const UninterpretedOption_NamePart = { if (isSet(object.isExtension)) obj.isExtension = Boolean(object.isExtension); return obj; }, - toJSON(message: UninterpretedOption_NamePart): unknown { + toJSON(message: UninterpretedOption_NamePart): JsonSafe { const obj: any = {}; message.namePart !== undefined && (obj.namePart = message.namePart); message.isExtension !== undefined && (obj.isExtension = message.isExtension); @@ -4605,7 +4606,7 @@ export const SourceCodeInfo = { if (Array.isArray(object?.location)) obj.location = object.location.map((e: any) => SourceCodeInfo_Location.fromJSON(e)); return obj; }, - toJSON(message: SourceCodeInfo): unknown { + toJSON(message: SourceCodeInfo): JsonSafe { const obj: any = {}; if (message.location) { obj.location = message.location.map(e => e ? SourceCodeInfo_Location.toJSON(e) : undefined); @@ -4736,7 +4737,7 @@ export const SourceCodeInfo_Location = { if (Array.isArray(object?.leadingDetachedComments)) obj.leadingDetachedComments = object.leadingDetachedComments.map((e: any) => String(e)); return obj; }, - toJSON(message: SourceCodeInfo_Location): unknown { + toJSON(message: SourceCodeInfo_Location): JsonSafe { const obj: any = {}; if (message.path) { obj.path = message.path.map(e => Math.round(e)); @@ -4853,7 +4854,7 @@ export const GeneratedCodeInfo = { if (Array.isArray(object?.annotation)) obj.annotation = object.annotation.map((e: any) => GeneratedCodeInfo_Annotation.fromJSON(e)); return obj; }, - toJSON(message: GeneratedCodeInfo): unknown { + toJSON(message: GeneratedCodeInfo): JsonSafe { const obj: any = {}; if (message.annotation) { obj.annotation = message.annotation.map(e => e ? GeneratedCodeInfo_Annotation.toJSON(e) : undefined); @@ -4967,7 +4968,7 @@ export const GeneratedCodeInfo_Annotation = { if (isSet(object.end)) obj.end = Number(object.end); return obj; }, - toJSON(message: GeneratedCodeInfo_Annotation): unknown { + toJSON(message: GeneratedCodeInfo_Annotation): JsonSafe { const obj: any = {}; if (message.path) { obj.path = message.path.map(e => Math.round(e)); @@ -5063,7 +5064,7 @@ export const FeatureSet = { if (isSet(object.utf8Validation)) obj.utf8Validation = featureSet_Utf8ValidationFromJSON(object.utf8Validation); return obj; }, - toJSON(message: FeatureSet): unknown { + toJSON(message: FeatureSet): JsonSafe { const obj: any = {}; message.utf8Validation !== undefined && (obj.utf8Validation = featureSet_Utf8ValidationToJSON(message.utf8Validation)); return obj; diff --git a/__fixtures__/misc/output-proto-amino/proto-only-legacy/google/protobuf/duration.ts b/__fixtures__/misc/output-proto-amino/proto-only-legacy/google/protobuf/duration.ts index da59405769..fb724c1091 100644 --- a/__fixtures__/misc/output-proto-amino/proto-only-legacy/google/protobuf/duration.ts +++ b/__fixtures__/misc/output-proto-amino/proto-only-legacy/google/protobuf/duration.ts @@ -1,5 +1,6 @@ import { BinaryReader, BinaryWriter } from "../../binary"; import { isSet, DeepPartial } from "../../helpers"; +import { JsonSafe } from "../../json-safe"; export const protobufPackage = "google.protobuf"; /** * A Duration represents a signed, fixed-length span of time represented @@ -189,7 +190,7 @@ export const Duration = { if (isSet(object.nanos)) obj.nanos = Number(object.nanos); return obj; }, - toJSON(message: Duration): unknown { + toJSON(message: Duration): JsonSafe { const obj: any = {}; message.seconds !== undefined && (obj.seconds = (message.seconds || BigInt(0)).toString()); message.nanos !== undefined && (obj.nanos = Math.round(message.nanos)); diff --git a/__fixtures__/misc/output-proto-amino/proto-only-legacy/google/protobuf/timestamp.ts b/__fixtures__/misc/output-proto-amino/proto-only-legacy/google/protobuf/timestamp.ts index 0a7812d4b8..ee7df3be54 100644 --- a/__fixtures__/misc/output-proto-amino/proto-only-legacy/google/protobuf/timestamp.ts +++ b/__fixtures__/misc/output-proto-amino/proto-only-legacy/google/protobuf/timestamp.ts @@ -1,5 +1,6 @@ import { BinaryReader, BinaryWriter } from "../../binary"; import { isSet, DeepPartial } from "../../helpers"; +import { JsonSafe } from "../../json-safe"; export const protobufPackage = "google.protobuf"; /** * A Timestamp represents a point in time independent of any time zone or local @@ -235,7 +236,7 @@ export const Timestamp = { if (isSet(object.nanos)) obj.nanos = Number(object.nanos); return obj; }, - toJSON(message: Timestamp): unknown { + toJSON(message: Timestamp): JsonSafe { const obj: any = {}; message.seconds !== undefined && (obj.seconds = (message.seconds || BigInt(0)).toString()); message.nanos !== undefined && (obj.nanos = Math.round(message.nanos)); diff --git a/__fixtures__/misc/output-proto-amino/proto-only-legacy/index.ts b/__fixtures__/misc/output-proto-amino/proto-only-legacy/index.ts index b1c2ce4fad..8982aebc59 100644 --- a/__fixtures__/misc/output-proto-amino/proto-only-legacy/index.ts +++ b/__fixtures__/misc/output-proto-amino/proto-only-legacy/index.ts @@ -11,6 +11,7 @@ export * from "./extern"; export * from "./react-query"; export * from "./mobx"; export * from "./pinia-endpoint"; +export * from "./json-safe"; export * from "./varint"; export * from "./utf8"; export * from "./binary"; \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/proto-only-legacy/json-safe.ts b/__fixtures__/misc/output-proto-amino/proto-only-legacy/json-safe.ts new file mode 100644 index 0000000000..7d46f89144 --- /dev/null +++ b/__fixtures__/misc/output-proto-amino/proto-only-legacy/json-safe.ts @@ -0,0 +1,10 @@ +/** +* This file and any referenced files were automatically generated by @cosmology/telescope@latest +* DO NOT MODIFY BY HAND. Instead, download the latest proto files for your chain +* and run the transpile command or npm scripts command that is used to regenerate this bundle. +*/ + + +export type JsonSafe = { + [Prop in keyof T]: T[Prop] extends Uint8Array ? string : T[Prop] extends bigint ? string : T[Prop]; +} diff --git a/__fixtures__/misc/output-proto-amino/proto-only-legacy/misc/all_fields.ts b/__fixtures__/misc/output-proto-amino/proto-only-legacy/misc/all_fields.ts index 5ec67ecc5c..7cfb0cdee3 100644 --- a/__fixtures__/misc/output-proto-amino/proto-only-legacy/misc/all_fields.ts +++ b/__fixtures__/misc/output-proto-amino/proto-only-legacy/misc/all_fields.ts @@ -5,6 +5,7 @@ import { Timestamp, TimestampSDKType } from "../google/protobuf/timestamp"; import { BinaryReader, BinaryWriter } from "../binary"; import { toTimestamp, fromTimestamp, isSet, bytesFromBase64, base64FromBytes, DeepPartial } from "../helpers"; import { Decimal } from "@cosmjs/math"; +import { JsonSafe } from "../json-safe"; export const protobufPackage = "misc"; export interface EncodingTestForDontOmit { /** scalar */ @@ -723,7 +724,7 @@ export const EncodingTestForDontOmit = { if (Array.isArray(object?.dODecs)) obj.dODecs = object.dODecs.map((e: any) => String(e)); return obj; }, - toJSON(message: EncodingTestForDontOmit): unknown { + toJSON(message: EncodingTestForDontOmit): JsonSafe { const obj: any = {}; message.str !== undefined && (obj.str = message.str); message.dOStr !== undefined && (obj.dOStr = message.dOStr); @@ -1641,7 +1642,7 @@ export const EncodingTestForOmit = { if (Array.isArray(object?.oDecs)) obj.oDecs = object.oDecs.map((e: any) => String(e)); return obj; }, - toJSON(message: EncodingTestForOmit): unknown { + toJSON(message: EncodingTestForOmit): JsonSafe { const obj: any = {}; message.str !== undefined && (obj.str = message.str); message.oStr !== undefined && (obj.oStr = message.oStr); diff --git a/__fixtures__/misc/output-proto-amino/proto-only-legacy/misc/eval_request.ts b/__fixtures__/misc/output-proto-amino/proto-only-legacy/misc/eval_request.ts index 52aea80ec9..ce27591827 100644 --- a/__fixtures__/misc/output-proto-amino/proto-only-legacy/misc/eval_request.ts +++ b/__fixtures__/misc/output-proto-amino/proto-only-legacy/misc/eval_request.ts @@ -2,6 +2,7 @@ import { ExprValue, ExprValueSDKType, IdRef, IdRefSDKType } from "../google/api/ import { FeatureSet_Utf8Validation, featureSet_Utf8ValidationFromJSON, featureSet_Utf8ValidationToJSON } from "../google/protobuf/descriptor"; import { BinaryReader, BinaryWriter } from "../binary"; import { isSet, DeepPartial, isObject } from "../helpers"; +import { JsonSafe } from "../json-safe"; export const protobufPackage = "misc"; /** VoteOption enumerates the valid vote options for a given governance proposal. */ export enum VoteOption { @@ -186,7 +187,7 @@ export const EvalRequest_BindingsEntry = { if (isSet(object.value)) obj.value = ExprValue.fromJSON(object.value); return obj; }, - toJSON(message: EvalRequest_BindingsEntry): unknown { + toJSON(message: EvalRequest_BindingsEntry): JsonSafe { const obj: any = {}; message.key !== undefined && (obj.key = message.key); message.value !== undefined && (obj.value = message.value ? ExprValue.toJSON(message.value) : undefined); @@ -267,7 +268,7 @@ export const EvalRequest_RefsEntry = { if (isSet(object.value)) obj.value = IdRef.fromJSON(object.value); return obj; }, - toJSON(message: EvalRequest_RefsEntry): unknown { + toJSON(message: EvalRequest_RefsEntry): JsonSafe { const obj: any = {}; message.key !== undefined && (obj.key = message.key); message.value !== undefined && (obj.value = message.value ? IdRef.toJSON(message.value) : undefined); @@ -435,7 +436,7 @@ export const EvalRequest = { if (isSet(object.opt)) obj.opt = featureSet_Utf8ValidationFromJSON(object.opt); return obj; }, - toJSON(message: EvalRequest): unknown { + toJSON(message: EvalRequest): JsonSafe { const obj: any = {}; obj.bindings = {}; if (message.bindings) { @@ -617,7 +618,7 @@ export const AccessConfig = { if (isSet(object.sender)) obj.sender = String(object.sender); return obj; }, - toJSON(message: AccessConfig): unknown { + toJSON(message: AccessConfig): JsonSafe { const obj: any = {}; message.sender !== undefined && (obj.sender = message.sender); return obj; @@ -690,7 +691,7 @@ export const GenericAuthorization = { if (isSet(object.msg)) obj.msg = String(object.msg); return obj; }, - toJSON(message: GenericAuthorization): unknown { + toJSON(message: GenericAuthorization): JsonSafe { const obj: any = {}; message.msg !== undefined && (obj.msg = message.msg); return obj; diff --git a/__fixtures__/misc/output-proto-amino/proto-only-legacy/misc/tx.ts b/__fixtures__/misc/output-proto-amino/proto-only-legacy/misc/tx.ts index 2102123f0b..c463035a43 100644 --- a/__fixtures__/misc/output-proto-amino/proto-only-legacy/misc/tx.ts +++ b/__fixtures__/misc/output-proto-amino/proto-only-legacy/misc/tx.ts @@ -1,6 +1,7 @@ import { EncodingTestForDontOmit, EncodingTestForDontOmitSDKType, EncodingTestForOmit, EncodingTestForOmitSDKType } from "./all_fields"; import { BinaryReader, BinaryWriter } from "../binary"; import { isSet, DeepPartial } from "../helpers"; +import { JsonSafe } from "../json-safe"; export const protobufPackage = "misc"; /** * MsgGrant is a request type for Grant method. It declares authorization to the grantee @@ -73,7 +74,7 @@ export const InputMsg = { if (isSet(object.oTests)) obj.oTests = EncodingTestForOmit.fromJSON(object.oTests); return obj; }, - toJSON(message: InputMsg): unknown { + toJSON(message: InputMsg): JsonSafe { const obj: any = {}; message.dOTests !== undefined && (obj.dOTests = message.dOTests ? EncodingTestForDontOmit.toJSON(message.dOTests) : undefined); message.oTests !== undefined && (obj.oTests = message.oTests ? EncodingTestForOmit.toJSON(message.oTests) : undefined); @@ -146,7 +147,7 @@ export const MsgResponse = { const obj = createBaseMsgResponse(); return obj; }, - toJSON(_: MsgResponse): unknown { + toJSON(_: MsgResponse): JsonSafe { const obj: any = {}; return obj; }, diff --git a/__fixtures__/misc/output-proto-amino/proto-only/google/api/expr/v1alpha1/eval.ts b/__fixtures__/misc/output-proto-amino/proto-only/google/api/expr/v1alpha1/eval.ts index dd686bde8a..3e6d655a22 100644 --- a/__fixtures__/misc/output-proto-amino/proto-only/google/api/expr/v1alpha1/eval.ts +++ b/__fixtures__/misc/output-proto-amino/proto-only/google/api/expr/v1alpha1/eval.ts @@ -1,4 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../../binary"; +import { JsonSafe } from "../../../../json-safe"; import { DeepPartial, isSet } from "../../../../helpers"; export const protobufPackage = "google.api.expr.v1alpha1"; export interface ExprValue { @@ -58,7 +59,7 @@ export const ExprValue = { if (Array.isArray(object?.exprs)) obj.exprs = object.exprs.map((e: any) => IdRef.fromJSON(e)); return obj; }, - toJSON(message: ExprValue): unknown { + toJSON(message: ExprValue): JsonSafe { const obj: any = {}; if (message.exprs) { obj.exprs = message.exprs.map(e => e ? IdRef.toJSON(e) : undefined); @@ -139,7 +140,7 @@ export const IdRef = { if (isSet(object.id)) obj.id = Number(object.id); return obj; }, - toJSON(message: IdRef): unknown { + toJSON(message: IdRef): JsonSafe { const obj: any = {}; message.id !== undefined && (obj.id = Math.round(message.id)); return obj; diff --git a/__fixtures__/misc/output-proto-amino/proto-only/google/protobuf/any.ts b/__fixtures__/misc/output-proto-amino/proto-only/google/protobuf/any.ts index ff3f9ce34c..7384700153 100644 --- a/__fixtures__/misc/output-proto-amino/proto-only/google/protobuf/any.ts +++ b/__fixtures__/misc/output-proto-amino/proto-only/google/protobuf/any.ts @@ -1,5 +1,6 @@ import { BinaryReader, BinaryWriter } from "../../binary"; import { isSet, bytesFromBase64, base64FromBytes, DeepPartial } from "../../helpers"; +import { JsonSafe } from "../../json-safe"; export const protobufPackage = "google.protobuf"; /** * `Any` contains an arbitrary serialized protocol buffer message along with a @@ -251,7 +252,7 @@ export const Any = { if (isSet(object.value)) obj.value = bytesFromBase64(object.value); return obj; }, - toJSON(message: Any): unknown { + toJSON(message: Any): JsonSafe { const obj: any = {}; message.typeUrl !== undefined && (obj.typeUrl = message.typeUrl); message.value !== undefined && (obj.value = base64FromBytes(message.value !== undefined ? message.value : new Uint8Array())); diff --git a/__fixtures__/misc/output-proto-amino/proto-only/google/protobuf/descriptor.ts b/__fixtures__/misc/output-proto-amino/proto-only/google/protobuf/descriptor.ts index 0d6c9f92f8..1a01cd1cd6 100644 --- a/__fixtures__/misc/output-proto-amino/proto-only/google/protobuf/descriptor.ts +++ b/__fixtures__/misc/output-proto-amino/proto-only/google/protobuf/descriptor.ts @@ -1,4 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../binary"; +import { JsonSafe } from "../../json-safe"; import { DeepPartial, isSet, bytesFromBase64, base64FromBytes } from "../../helpers"; export const protobufPackage = "google.protobuf"; export enum FieldDescriptorProto_Type { @@ -1474,7 +1475,7 @@ export const FileDescriptorSet = { if (Array.isArray(object?.file)) obj.file = object.file.map((e: any) => FileDescriptorProto.fromJSON(e)); return obj; }, - toJSON(message: FileDescriptorSet): unknown { + toJSON(message: FileDescriptorSet): JsonSafe { const obj: any = {}; if (message.file) { obj.file = message.file.map(e => e ? FileDescriptorProto.toJSON(e) : undefined); @@ -1661,7 +1662,7 @@ export const FileDescriptorProto = { if (isSet(object.syntax)) obj.syntax = String(object.syntax); return obj; }, - toJSON(message: FileDescriptorProto): unknown { + toJSON(message: FileDescriptorProto): JsonSafe { const obj: any = {}; message.name !== undefined && (obj.name = message.name); message.package !== undefined && (obj.package = message.package); @@ -1921,7 +1922,7 @@ export const DescriptorProto = { if (Array.isArray(object?.reservedName)) obj.reservedName = object.reservedName.map((e: any) => String(e)); return obj; }, - toJSON(message: DescriptorProto): unknown { + toJSON(message: DescriptorProto): JsonSafe { const obj: any = {}; message.name !== undefined && (obj.name = message.name); if (message.field) { @@ -2121,7 +2122,7 @@ export const DescriptorProto_ExtensionRange = { if (isSet(object.options)) obj.options = ExtensionRangeOptions.fromJSON(object.options); return obj; }, - toJSON(message: DescriptorProto_ExtensionRange): unknown { + toJSON(message: DescriptorProto_ExtensionRange): JsonSafe { const obj: any = {}; message.start !== undefined && (obj.start = Math.round(message.start)); message.end !== undefined && (obj.end = Math.round(message.end)); @@ -2214,7 +2215,7 @@ export const DescriptorProto_ReservedRange = { if (isSet(object.end)) obj.end = Number(object.end); return obj; }, - toJSON(message: DescriptorProto_ReservedRange): unknown { + toJSON(message: DescriptorProto_ReservedRange): JsonSafe { const obj: any = {}; message.start !== undefined && (obj.start = Math.round(message.start)); message.end !== undefined && (obj.end = Math.round(message.end)); @@ -2292,7 +2293,7 @@ export const ExtensionRangeOptions = { if (Array.isArray(object?.uninterpretedOption)) obj.uninterpretedOption = object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)); return obj; }, - toJSON(message: ExtensionRangeOptions): unknown { + toJSON(message: ExtensionRangeOptions): JsonSafe { const obj: any = {}; if (message.uninterpretedOption) { obj.uninterpretedOption = message.uninterpretedOption.map(e => e ? UninterpretedOption.toJSON(e) : undefined); @@ -2445,7 +2446,7 @@ export const FieldDescriptorProto = { if (isSet(object.options)) obj.options = FieldOptions.fromJSON(object.options); return obj; }, - toJSON(message: FieldDescriptorProto): unknown { + toJSON(message: FieldDescriptorProto): JsonSafe { const obj: any = {}; message.name !== undefined && (obj.name = message.name); message.number !== undefined && (obj.number = Math.round(message.number)); @@ -2573,7 +2574,7 @@ export const OneofDescriptorProto = { if (isSet(object.options)) obj.options = OneofOptions.fromJSON(object.options); return obj; }, - toJSON(message: OneofDescriptorProto): unknown { + toJSON(message: OneofDescriptorProto): JsonSafe { const obj: any = {}; message.name !== undefined && (obj.name = message.name); message.options !== undefined && (obj.options = message.options ? OneofOptions.toJSON(message.options) : undefined); @@ -2685,7 +2686,7 @@ export const EnumDescriptorProto = { if (Array.isArray(object?.reservedName)) obj.reservedName = object.reservedName.map((e: any) => String(e)); return obj; }, - toJSON(message: EnumDescriptorProto): unknown { + toJSON(message: EnumDescriptorProto): JsonSafe { const obj: any = {}; message.name !== undefined && (obj.name = message.name); if (message.value) { @@ -2812,7 +2813,7 @@ export const EnumDescriptorProto_EnumReservedRange = { if (isSet(object.end)) obj.end = Number(object.end); return obj; }, - toJSON(message: EnumDescriptorProto_EnumReservedRange): unknown { + toJSON(message: EnumDescriptorProto_EnumReservedRange): JsonSafe { const obj: any = {}; message.start !== undefined && (obj.start = Math.round(message.start)); message.end !== undefined && (obj.end = Math.round(message.end)); @@ -2906,7 +2907,7 @@ export const EnumValueDescriptorProto = { if (isSet(object.options)) obj.options = EnumValueOptions.fromJSON(object.options); return obj; }, - toJSON(message: EnumValueDescriptorProto): unknown { + toJSON(message: EnumValueDescriptorProto): JsonSafe { const obj: any = {}; message.name !== undefined && (obj.name = message.name); message.number !== undefined && (obj.number = Math.round(message.number)); @@ -3007,7 +3008,7 @@ export const ServiceDescriptorProto = { if (isSet(object.options)) obj.options = ServiceOptions.fromJSON(object.options); return obj; }, - toJSON(message: ServiceDescriptorProto): unknown { + toJSON(message: ServiceDescriptorProto): JsonSafe { const obj: any = {}; message.name !== undefined && (obj.name = message.name); if (message.method) { @@ -3140,7 +3141,7 @@ export const MethodDescriptorProto = { if (isSet(object.serverStreaming)) obj.serverStreaming = Boolean(object.serverStreaming); return obj; }, - toJSON(message: MethodDescriptorProto): unknown { + toJSON(message: MethodDescriptorProto): JsonSafe { const obj: any = {}; message.name !== undefined && (obj.name = message.name); message.inputType !== undefined && (obj.inputType = message.inputType); @@ -3400,7 +3401,7 @@ export const FileOptions = { if (Array.isArray(object?.uninterpretedOption)) obj.uninterpretedOption = object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)); return obj; }, - toJSON(message: FileOptions): unknown { + toJSON(message: FileOptions): JsonSafe { const obj: any = {}; message.javaPackage !== undefined && (obj.javaPackage = message.javaPackage); message.javaOuterClassname !== undefined && (obj.javaOuterClassname = message.javaOuterClassname); @@ -3613,7 +3614,7 @@ export const MessageOptions = { if (Array.isArray(object?.uninterpretedOption)) obj.uninterpretedOption = object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)); return obj; }, - toJSON(message: MessageOptions): unknown { + toJSON(message: MessageOptions): JsonSafe { const obj: any = {}; message.messageSetWireFormat !== undefined && (obj.messageSetWireFormat = message.messageSetWireFormat); message.noStandardDescriptorAccessor !== undefined && (obj.noStandardDescriptorAccessor = message.noStandardDescriptorAccessor); @@ -3762,7 +3763,7 @@ export const FieldOptions = { if (Array.isArray(object?.uninterpretedOption)) obj.uninterpretedOption = object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)); return obj; }, - toJSON(message: FieldOptions): unknown { + toJSON(message: FieldOptions): JsonSafe { const obj: any = {}; message.ctype !== undefined && (obj.ctype = fieldOptions_CTypeToJSON(message.ctype)); message.packed !== undefined && (obj.packed = message.packed); @@ -3873,7 +3874,7 @@ export const OneofOptions = { if (Array.isArray(object?.uninterpretedOption)) obj.uninterpretedOption = object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)); return obj; }, - toJSON(message: OneofOptions): unknown { + toJSON(message: OneofOptions): JsonSafe { const obj: any = {}; if (message.uninterpretedOption) { obj.uninterpretedOption = message.uninterpretedOption.map(e => e ? UninterpretedOption.toJSON(e) : undefined); @@ -3970,7 +3971,7 @@ export const EnumOptions = { if (Array.isArray(object?.uninterpretedOption)) obj.uninterpretedOption = object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)); return obj; }, - toJSON(message: EnumOptions): unknown { + toJSON(message: EnumOptions): JsonSafe { const obj: any = {}; message.allowAlias !== undefined && (obj.allowAlias = message.allowAlias); message.deprecated !== undefined && (obj.deprecated = message.deprecated); @@ -4069,7 +4070,7 @@ export const EnumValueOptions = { if (Array.isArray(object?.uninterpretedOption)) obj.uninterpretedOption = object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)); return obj; }, - toJSON(message: EnumValueOptions): unknown { + toJSON(message: EnumValueOptions): JsonSafe { const obj: any = {}; message.deprecated !== undefined && (obj.deprecated = message.deprecated); if (message.uninterpretedOption) { @@ -4163,7 +4164,7 @@ export const ServiceOptions = { if (Array.isArray(object?.uninterpretedOption)) obj.uninterpretedOption = object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)); return obj; }, - toJSON(message: ServiceOptions): unknown { + toJSON(message: ServiceOptions): JsonSafe { const obj: any = {}; message.deprecated !== undefined && (obj.deprecated = message.deprecated); if (message.uninterpretedOption) { @@ -4265,7 +4266,7 @@ export const MethodOptions = { if (Array.isArray(object?.uninterpretedOption)) obj.uninterpretedOption = object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)); return obj; }, - toJSON(message: MethodOptions): unknown { + toJSON(message: MethodOptions): JsonSafe { const obj: any = {}; message.deprecated !== undefined && (obj.deprecated = message.deprecated); message.idempotencyLevel !== undefined && (obj.idempotencyLevel = methodOptions_IdempotencyLevelToJSON(message.idempotencyLevel)); @@ -4404,7 +4405,7 @@ export const UninterpretedOption = { if (isSet(object.aggregateValue)) obj.aggregateValue = String(object.aggregateValue); return obj; }, - toJSON(message: UninterpretedOption): unknown { + toJSON(message: UninterpretedOption): JsonSafe { const obj: any = {}; if (message.name) { obj.name = message.name.map(e => e ? UninterpretedOption_NamePart.toJSON(e) : undefined); @@ -4527,7 +4528,7 @@ export const UninterpretedOption_NamePart = { if (isSet(object.isExtension)) obj.isExtension = Boolean(object.isExtension); return obj; }, - toJSON(message: UninterpretedOption_NamePart): unknown { + toJSON(message: UninterpretedOption_NamePart): JsonSafe { const obj: any = {}; message.namePart !== undefined && (obj.namePart = message.namePart); message.isExtension !== undefined && (obj.isExtension = message.isExtension); @@ -4605,7 +4606,7 @@ export const SourceCodeInfo = { if (Array.isArray(object?.location)) obj.location = object.location.map((e: any) => SourceCodeInfo_Location.fromJSON(e)); return obj; }, - toJSON(message: SourceCodeInfo): unknown { + toJSON(message: SourceCodeInfo): JsonSafe { const obj: any = {}; if (message.location) { obj.location = message.location.map(e => e ? SourceCodeInfo_Location.toJSON(e) : undefined); @@ -4736,7 +4737,7 @@ export const SourceCodeInfo_Location = { if (Array.isArray(object?.leadingDetachedComments)) obj.leadingDetachedComments = object.leadingDetachedComments.map((e: any) => String(e)); return obj; }, - toJSON(message: SourceCodeInfo_Location): unknown { + toJSON(message: SourceCodeInfo_Location): JsonSafe { const obj: any = {}; if (message.path) { obj.path = message.path.map(e => Math.round(e)); @@ -4853,7 +4854,7 @@ export const GeneratedCodeInfo = { if (Array.isArray(object?.annotation)) obj.annotation = object.annotation.map((e: any) => GeneratedCodeInfo_Annotation.fromJSON(e)); return obj; }, - toJSON(message: GeneratedCodeInfo): unknown { + toJSON(message: GeneratedCodeInfo): JsonSafe { const obj: any = {}; if (message.annotation) { obj.annotation = message.annotation.map(e => e ? GeneratedCodeInfo_Annotation.toJSON(e) : undefined); @@ -4967,7 +4968,7 @@ export const GeneratedCodeInfo_Annotation = { if (isSet(object.end)) obj.end = Number(object.end); return obj; }, - toJSON(message: GeneratedCodeInfo_Annotation): unknown { + toJSON(message: GeneratedCodeInfo_Annotation): JsonSafe { const obj: any = {}; if (message.path) { obj.path = message.path.map(e => Math.round(e)); @@ -5063,7 +5064,7 @@ export const FeatureSet = { if (isSet(object.utf8Validation)) obj.utf8Validation = featureSet_Utf8ValidationFromJSON(object.utf8Validation); return obj; }, - toJSON(message: FeatureSet): unknown { + toJSON(message: FeatureSet): JsonSafe { const obj: any = {}; message.utf8Validation !== undefined && (obj.utf8Validation = featureSet_Utf8ValidationToJSON(message.utf8Validation)); return obj; diff --git a/__fixtures__/misc/output-proto-amino/proto-only/google/protobuf/duration.ts b/__fixtures__/misc/output-proto-amino/proto-only/google/protobuf/duration.ts index da59405769..fb724c1091 100644 --- a/__fixtures__/misc/output-proto-amino/proto-only/google/protobuf/duration.ts +++ b/__fixtures__/misc/output-proto-amino/proto-only/google/protobuf/duration.ts @@ -1,5 +1,6 @@ import { BinaryReader, BinaryWriter } from "../../binary"; import { isSet, DeepPartial } from "../../helpers"; +import { JsonSafe } from "../../json-safe"; export const protobufPackage = "google.protobuf"; /** * A Duration represents a signed, fixed-length span of time represented @@ -189,7 +190,7 @@ export const Duration = { if (isSet(object.nanos)) obj.nanos = Number(object.nanos); return obj; }, - toJSON(message: Duration): unknown { + toJSON(message: Duration): JsonSafe { const obj: any = {}; message.seconds !== undefined && (obj.seconds = (message.seconds || BigInt(0)).toString()); message.nanos !== undefined && (obj.nanos = Math.round(message.nanos)); diff --git a/__fixtures__/misc/output-proto-amino/proto-only/google/protobuf/timestamp.ts b/__fixtures__/misc/output-proto-amino/proto-only/google/protobuf/timestamp.ts index 0a7812d4b8..ee7df3be54 100644 --- a/__fixtures__/misc/output-proto-amino/proto-only/google/protobuf/timestamp.ts +++ b/__fixtures__/misc/output-proto-amino/proto-only/google/protobuf/timestamp.ts @@ -1,5 +1,6 @@ import { BinaryReader, BinaryWriter } from "../../binary"; import { isSet, DeepPartial } from "../../helpers"; +import { JsonSafe } from "../../json-safe"; export const protobufPackage = "google.protobuf"; /** * A Timestamp represents a point in time independent of any time zone or local @@ -235,7 +236,7 @@ export const Timestamp = { if (isSet(object.nanos)) obj.nanos = Number(object.nanos); return obj; }, - toJSON(message: Timestamp): unknown { + toJSON(message: Timestamp): JsonSafe { const obj: any = {}; message.seconds !== undefined && (obj.seconds = (message.seconds || BigInt(0)).toString()); message.nanos !== undefined && (obj.nanos = Math.round(message.nanos)); diff --git a/__fixtures__/misc/output-proto-amino/proto-only/index.ts b/__fixtures__/misc/output-proto-amino/proto-only/index.ts index b1c2ce4fad..8982aebc59 100644 --- a/__fixtures__/misc/output-proto-amino/proto-only/index.ts +++ b/__fixtures__/misc/output-proto-amino/proto-only/index.ts @@ -11,6 +11,7 @@ export * from "./extern"; export * from "./react-query"; export * from "./mobx"; export * from "./pinia-endpoint"; +export * from "./json-safe"; export * from "./varint"; export * from "./utf8"; export * from "./binary"; \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/proto-only/json-safe.ts b/__fixtures__/misc/output-proto-amino/proto-only/json-safe.ts new file mode 100644 index 0000000000..7d46f89144 --- /dev/null +++ b/__fixtures__/misc/output-proto-amino/proto-only/json-safe.ts @@ -0,0 +1,10 @@ +/** +* This file and any referenced files were automatically generated by @cosmology/telescope@latest +* DO NOT MODIFY BY HAND. Instead, download the latest proto files for your chain +* and run the transpile command or npm scripts command that is used to regenerate this bundle. +*/ + + +export type JsonSafe = { + [Prop in keyof T]: T[Prop] extends Uint8Array ? string : T[Prop] extends bigint ? string : T[Prop]; +} diff --git a/__fixtures__/misc/output-proto-amino/proto-only/misc/all_fields.ts b/__fixtures__/misc/output-proto-amino/proto-only/misc/all_fields.ts index 5ec67ecc5c..7cfb0cdee3 100644 --- a/__fixtures__/misc/output-proto-amino/proto-only/misc/all_fields.ts +++ b/__fixtures__/misc/output-proto-amino/proto-only/misc/all_fields.ts @@ -5,6 +5,7 @@ import { Timestamp, TimestampSDKType } from "../google/protobuf/timestamp"; import { BinaryReader, BinaryWriter } from "../binary"; import { toTimestamp, fromTimestamp, isSet, bytesFromBase64, base64FromBytes, DeepPartial } from "../helpers"; import { Decimal } from "@cosmjs/math"; +import { JsonSafe } from "../json-safe"; export const protobufPackage = "misc"; export interface EncodingTestForDontOmit { /** scalar */ @@ -723,7 +724,7 @@ export const EncodingTestForDontOmit = { if (Array.isArray(object?.dODecs)) obj.dODecs = object.dODecs.map((e: any) => String(e)); return obj; }, - toJSON(message: EncodingTestForDontOmit): unknown { + toJSON(message: EncodingTestForDontOmit): JsonSafe { const obj: any = {}; message.str !== undefined && (obj.str = message.str); message.dOStr !== undefined && (obj.dOStr = message.dOStr); @@ -1641,7 +1642,7 @@ export const EncodingTestForOmit = { if (Array.isArray(object?.oDecs)) obj.oDecs = object.oDecs.map((e: any) => String(e)); return obj; }, - toJSON(message: EncodingTestForOmit): unknown { + toJSON(message: EncodingTestForOmit): JsonSafe { const obj: any = {}; message.str !== undefined && (obj.str = message.str); message.oStr !== undefined && (obj.oStr = message.oStr); diff --git a/__fixtures__/misc/output-proto-amino/proto-only/misc/eval_request.ts b/__fixtures__/misc/output-proto-amino/proto-only/misc/eval_request.ts index 52aea80ec9..ce27591827 100644 --- a/__fixtures__/misc/output-proto-amino/proto-only/misc/eval_request.ts +++ b/__fixtures__/misc/output-proto-amino/proto-only/misc/eval_request.ts @@ -2,6 +2,7 @@ import { ExprValue, ExprValueSDKType, IdRef, IdRefSDKType } from "../google/api/ import { FeatureSet_Utf8Validation, featureSet_Utf8ValidationFromJSON, featureSet_Utf8ValidationToJSON } from "../google/protobuf/descriptor"; import { BinaryReader, BinaryWriter } from "../binary"; import { isSet, DeepPartial, isObject } from "../helpers"; +import { JsonSafe } from "../json-safe"; export const protobufPackage = "misc"; /** VoteOption enumerates the valid vote options for a given governance proposal. */ export enum VoteOption { @@ -186,7 +187,7 @@ export const EvalRequest_BindingsEntry = { if (isSet(object.value)) obj.value = ExprValue.fromJSON(object.value); return obj; }, - toJSON(message: EvalRequest_BindingsEntry): unknown { + toJSON(message: EvalRequest_BindingsEntry): JsonSafe { const obj: any = {}; message.key !== undefined && (obj.key = message.key); message.value !== undefined && (obj.value = message.value ? ExprValue.toJSON(message.value) : undefined); @@ -267,7 +268,7 @@ export const EvalRequest_RefsEntry = { if (isSet(object.value)) obj.value = IdRef.fromJSON(object.value); return obj; }, - toJSON(message: EvalRequest_RefsEntry): unknown { + toJSON(message: EvalRequest_RefsEntry): JsonSafe { const obj: any = {}; message.key !== undefined && (obj.key = message.key); message.value !== undefined && (obj.value = message.value ? IdRef.toJSON(message.value) : undefined); @@ -435,7 +436,7 @@ export const EvalRequest = { if (isSet(object.opt)) obj.opt = featureSet_Utf8ValidationFromJSON(object.opt); return obj; }, - toJSON(message: EvalRequest): unknown { + toJSON(message: EvalRequest): JsonSafe { const obj: any = {}; obj.bindings = {}; if (message.bindings) { @@ -617,7 +618,7 @@ export const AccessConfig = { if (isSet(object.sender)) obj.sender = String(object.sender); return obj; }, - toJSON(message: AccessConfig): unknown { + toJSON(message: AccessConfig): JsonSafe { const obj: any = {}; message.sender !== undefined && (obj.sender = message.sender); return obj; @@ -690,7 +691,7 @@ export const GenericAuthorization = { if (isSet(object.msg)) obj.msg = String(object.msg); return obj; }, - toJSON(message: GenericAuthorization): unknown { + toJSON(message: GenericAuthorization): JsonSafe { const obj: any = {}; message.msg !== undefined && (obj.msg = message.msg); return obj; diff --git a/__fixtures__/misc/output-proto-amino/proto-only/misc/tx.ts b/__fixtures__/misc/output-proto-amino/proto-only/misc/tx.ts index 2102123f0b..c463035a43 100644 --- a/__fixtures__/misc/output-proto-amino/proto-only/misc/tx.ts +++ b/__fixtures__/misc/output-proto-amino/proto-only/misc/tx.ts @@ -1,6 +1,7 @@ import { EncodingTestForDontOmit, EncodingTestForDontOmitSDKType, EncodingTestForOmit, EncodingTestForOmitSDKType } from "./all_fields"; import { BinaryReader, BinaryWriter } from "../binary"; import { isSet, DeepPartial } from "../helpers"; +import { JsonSafe } from "../json-safe"; export const protobufPackage = "misc"; /** * MsgGrant is a request type for Grant method. It declares authorization to the grantee @@ -73,7 +74,7 @@ export const InputMsg = { if (isSet(object.oTests)) obj.oTests = EncodingTestForOmit.fromJSON(object.oTests); return obj; }, - toJSON(message: InputMsg): unknown { + toJSON(message: InputMsg): JsonSafe { const obj: any = {}; message.dOTests !== undefined && (obj.dOTests = message.dOTests ? EncodingTestForDontOmit.toJSON(message.dOTests) : undefined); message.oTests !== undefined && (obj.oTests = message.oTests ? EncodingTestForOmit.toJSON(message.oTests) : undefined); @@ -146,7 +147,7 @@ export const MsgResponse = { const obj = createBaseMsgResponse(); return obj; }, - toJSON(_: MsgResponse): unknown { + toJSON(_: MsgResponse): JsonSafe { const obj: any = {}; return obj; }, diff --git a/__fixtures__/misc/output/google/api/expr/v1alpha1/eval.ts b/__fixtures__/misc/output/google/api/expr/v1alpha1/eval.ts index 6902943167..d154618421 100644 --- a/__fixtures__/misc/output/google/api/expr/v1alpha1/eval.ts +++ b/__fixtures__/misc/output/google/api/expr/v1alpha1/eval.ts @@ -1,4 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../../binary"; +import { JsonSafe } from "../../../../json-safe"; import { DeepPartial, isSet } from "../../../../helpers"; export const protobufPackage = "google.api.expr.v1alpha1"; export interface ExprValue { @@ -74,7 +75,7 @@ export const ExprValue = { if (Array.isArray(object?.exprs)) obj.exprs = object.exprs.map((e: any) => IdRef.fromJSON(e)); return obj; }, - toJSON(message: ExprValue): unknown { + toJSON(message: ExprValue): JsonSafe { const obj: any = {}; if (message.exprs) { obj.exprs = message.exprs.map(e => e ? IdRef.toJSON(e) : undefined); @@ -172,7 +173,7 @@ export const IdRef = { if (isSet(object.id)) obj.id = Number(object.id); return obj; }, - toJSON(message: IdRef): unknown { + toJSON(message: IdRef): JsonSafe { const obj: any = {}; message.id !== undefined && (obj.id = Math.round(message.id)); return obj; diff --git a/__fixtures__/misc/output/google/protobuf/any.ts b/__fixtures__/misc/output/google/protobuf/any.ts index 31152a692c..3c85d6072b 100644 --- a/__fixtures__/misc/output/google/protobuf/any.ts +++ b/__fixtures__/misc/output/google/protobuf/any.ts @@ -1,5 +1,6 @@ import { BinaryReader, BinaryWriter } from "../../binary"; import { isSet, bytesFromBase64, base64FromBytes, DeepPartial } from "../../helpers"; +import { JsonSafe } from "../../json-safe"; export const protobufPackage = "google.protobuf"; /** * `Any` contains an arbitrary serialized protocol buffer message along with a @@ -370,7 +371,7 @@ export const Any = { if (isSet(object.value)) obj.value = bytesFromBase64(object.value); return obj; }, - toJSON(message: Any): unknown { + toJSON(message: Any): JsonSafe { const obj: any = {}; message.typeUrl !== undefined && (obj.typeUrl = message.typeUrl); message.value !== undefined && (obj.value = base64FromBytes(message.value !== undefined ? message.value : new Uint8Array())); diff --git a/__fixtures__/misc/output/google/protobuf/descriptor.ts b/__fixtures__/misc/output/google/protobuf/descriptor.ts index 610136558f..82c7fb96c4 100644 --- a/__fixtures__/misc/output/google/protobuf/descriptor.ts +++ b/__fixtures__/misc/output/google/protobuf/descriptor.ts @@ -1,4 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../binary"; +import { JsonSafe } from "../../json-safe"; import { DeepPartial, isSet, bytesFromBase64, base64FromBytes } from "../../helpers"; export const protobufPackage = "google.protobuf"; export enum FieldDescriptorProto_Type { @@ -2293,7 +2294,7 @@ export const FileDescriptorSet = { if (Array.isArray(object?.file)) obj.file = object.file.map((e: any) => FileDescriptorProto.fromJSON(e)); return obj; }, - toJSON(message: FileDescriptorSet): unknown { + toJSON(message: FileDescriptorSet): JsonSafe { const obj: any = {}; if (message.file) { obj.file = message.file.map(e => e ? FileDescriptorProto.toJSON(e) : undefined); @@ -2497,7 +2498,7 @@ export const FileDescriptorProto = { if (isSet(object.syntax)) obj.syntax = String(object.syntax); return obj; }, - toJSON(message: FileDescriptorProto): unknown { + toJSON(message: FileDescriptorProto): JsonSafe { const obj: any = {}; message.name !== undefined && (obj.name = message.name); message.package !== undefined && (obj.package = message.package); @@ -2830,7 +2831,7 @@ export const DescriptorProto = { if (Array.isArray(object?.reservedName)) obj.reservedName = object.reservedName.map((e: any) => String(e)); return obj; }, - toJSON(message: DescriptorProto): unknown { + toJSON(message: DescriptorProto): JsonSafe { const obj: any = {}; message.name !== undefined && (obj.name = message.name); if (message.field) { @@ -3097,7 +3098,7 @@ export const DescriptorProto_ExtensionRange = { if (isSet(object.options)) obj.options = ExtensionRangeOptions.fromJSON(object.options); return obj; }, - toJSON(message: DescriptorProto_ExtensionRange): unknown { + toJSON(message: DescriptorProto_ExtensionRange): JsonSafe { const obj: any = {}; message.start !== undefined && (obj.start = Math.round(message.start)); message.end !== undefined && (obj.end = Math.round(message.end)); @@ -3213,7 +3214,7 @@ export const DescriptorProto_ReservedRange = { if (isSet(object.end)) obj.end = Number(object.end); return obj; }, - toJSON(message: DescriptorProto_ReservedRange): unknown { + toJSON(message: DescriptorProto_ReservedRange): JsonSafe { const obj: any = {}; message.start !== undefined && (obj.start = Math.round(message.start)); message.end !== undefined && (obj.end = Math.round(message.end)); @@ -3310,7 +3311,7 @@ export const ExtensionRangeOptions = { if (Array.isArray(object?.uninterpretedOption)) obj.uninterpretedOption = object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)); return obj; }, - toJSON(message: ExtensionRangeOptions): unknown { + toJSON(message: ExtensionRangeOptions): JsonSafe { const obj: any = {}; if (message.uninterpretedOption) { obj.uninterpretedOption = message.uninterpretedOption.map(e => e ? UninterpretedOption.toJSON(e) : undefined); @@ -3480,7 +3481,7 @@ export const FieldDescriptorProto = { if (isSet(object.options)) obj.options = FieldOptions.fromJSON(object.options); return obj; }, - toJSON(message: FieldDescriptorProto): unknown { + toJSON(message: FieldDescriptorProto): JsonSafe { const obj: any = {}; message.name !== undefined && (obj.name = message.name); message.number !== undefined && (obj.number = Math.round(message.number)); @@ -3659,7 +3660,7 @@ export const OneofDescriptorProto = { if (isSet(object.options)) obj.options = OneofOptions.fromJSON(object.options); return obj; }, - toJSON(message: OneofDescriptorProto): unknown { + toJSON(message: OneofDescriptorProto): JsonSafe { const obj: any = {}; message.name !== undefined && (obj.name = message.name); message.options !== undefined && (obj.options = message.options ? OneofOptions.toJSON(message.options) : undefined); @@ -3790,7 +3791,7 @@ export const EnumDescriptorProto = { if (Array.isArray(object?.reservedName)) obj.reservedName = object.reservedName.map((e: any) => String(e)); return obj; }, - toJSON(message: EnumDescriptorProto): unknown { + toJSON(message: EnumDescriptorProto): JsonSafe { const obj: any = {}; message.name !== undefined && (obj.name = message.name); if (message.value) { @@ -3954,7 +3955,7 @@ export const EnumDescriptorProto_EnumReservedRange = { if (isSet(object.end)) obj.end = Number(object.end); return obj; }, - toJSON(message: EnumDescriptorProto_EnumReservedRange): unknown { + toJSON(message: EnumDescriptorProto_EnumReservedRange): JsonSafe { const obj: any = {}; message.start !== undefined && (obj.start = Math.round(message.start)); message.end !== undefined && (obj.end = Math.round(message.end)); @@ -4067,7 +4068,7 @@ export const EnumValueDescriptorProto = { if (isSet(object.options)) obj.options = EnumValueOptions.fromJSON(object.options); return obj; }, - toJSON(message: EnumValueDescriptorProto): unknown { + toJSON(message: EnumValueDescriptorProto): JsonSafe { const obj: any = {}; message.name !== undefined && (obj.name = message.name); message.number !== undefined && (obj.number = Math.round(message.number)); @@ -4191,7 +4192,7 @@ export const ServiceDescriptorProto = { if (isSet(object.options)) obj.options = ServiceOptions.fromJSON(object.options); return obj; }, - toJSON(message: ServiceDescriptorProto): unknown { + toJSON(message: ServiceDescriptorProto): JsonSafe { const obj: any = {}; message.name !== undefined && (obj.name = message.name); if (message.method) { @@ -4349,7 +4350,7 @@ export const MethodDescriptorProto = { if (isSet(object.serverStreaming)) obj.serverStreaming = Boolean(object.serverStreaming); return obj; }, - toJSON(message: MethodDescriptorProto): unknown { + toJSON(message: MethodDescriptorProto): JsonSafe { const obj: any = {}; message.name !== undefined && (obj.name = message.name); message.inputType !== undefined && (obj.inputType = message.inputType); @@ -4644,7 +4645,7 @@ export const FileOptions = { if (Array.isArray(object?.uninterpretedOption)) obj.uninterpretedOption = object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)); return obj; }, - toJSON(message: FileOptions): unknown { + toJSON(message: FileOptions): JsonSafe { const obj: any = {}; message.javaPackage !== undefined && (obj.javaPackage = message.javaPackage); message.javaOuterClassname !== undefined && (obj.javaOuterClassname = message.javaOuterClassname); @@ -4954,7 +4955,7 @@ export const MessageOptions = { if (Array.isArray(object?.uninterpretedOption)) obj.uninterpretedOption = object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)); return obj; }, - toJSON(message: MessageOptions): unknown { + toJSON(message: MessageOptions): JsonSafe { const obj: any = {}; message.messageSetWireFormat !== undefined && (obj.messageSetWireFormat = message.messageSetWireFormat); message.noStandardDescriptorAccessor !== undefined && (obj.noStandardDescriptorAccessor = message.noStandardDescriptorAccessor); @@ -5136,7 +5137,7 @@ export const FieldOptions = { if (Array.isArray(object?.uninterpretedOption)) obj.uninterpretedOption = object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)); return obj; }, - toJSON(message: FieldOptions): unknown { + toJSON(message: FieldOptions): JsonSafe { const obj: any = {}; message.ctype !== undefined && (obj.ctype = fieldOptions_CTypeToJSON(message.ctype)); message.packed !== undefined && (obj.packed = message.packed); @@ -5288,7 +5289,7 @@ export const OneofOptions = { if (Array.isArray(object?.uninterpretedOption)) obj.uninterpretedOption = object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)); return obj; }, - toJSON(message: OneofOptions): unknown { + toJSON(message: OneofOptions): JsonSafe { const obj: any = {}; if (message.uninterpretedOption) { obj.uninterpretedOption = message.uninterpretedOption.map(e => e ? UninterpretedOption.toJSON(e) : undefined); @@ -5402,7 +5403,7 @@ export const EnumOptions = { if (Array.isArray(object?.uninterpretedOption)) obj.uninterpretedOption = object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)); return obj; }, - toJSON(message: EnumOptions): unknown { + toJSON(message: EnumOptions): JsonSafe { const obj: any = {}; message.allowAlias !== undefined && (obj.allowAlias = message.allowAlias); message.deprecated !== undefined && (obj.deprecated = message.deprecated); @@ -5526,7 +5527,7 @@ export const EnumValueOptions = { if (Array.isArray(object?.uninterpretedOption)) obj.uninterpretedOption = object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)); return obj; }, - toJSON(message: EnumValueOptions): unknown { + toJSON(message: EnumValueOptions): JsonSafe { const obj: any = {}; message.deprecated !== undefined && (obj.deprecated = message.deprecated); if (message.uninterpretedOption) { @@ -5641,7 +5642,7 @@ export const ServiceOptions = { if (Array.isArray(object?.uninterpretedOption)) obj.uninterpretedOption = object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)); return obj; }, - toJSON(message: ServiceOptions): unknown { + toJSON(message: ServiceOptions): JsonSafe { const obj: any = {}; message.deprecated !== undefined && (obj.deprecated = message.deprecated); if (message.uninterpretedOption) { @@ -5764,7 +5765,7 @@ export const MethodOptions = { if (Array.isArray(object?.uninterpretedOption)) obj.uninterpretedOption = object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)); return obj; }, - toJSON(message: MethodOptions): unknown { + toJSON(message: MethodOptions): JsonSafe { const obj: any = {}; message.deprecated !== undefined && (obj.deprecated = message.deprecated); message.idempotencyLevel !== undefined && (obj.idempotencyLevel = methodOptions_IdempotencyLevelToJSON(message.idempotencyLevel)); @@ -5928,7 +5929,7 @@ export const UninterpretedOption = { if (isSet(object.aggregateValue)) obj.aggregateValue = String(object.aggregateValue); return obj; }, - toJSON(message: UninterpretedOption): unknown { + toJSON(message: UninterpretedOption): JsonSafe { const obj: any = {}; if (message.name) { obj.name = message.name.map(e => e ? UninterpretedOption_NamePart.toJSON(e) : undefined); @@ -6092,7 +6093,7 @@ export const UninterpretedOption_NamePart = { if (isSet(object.isExtension)) obj.isExtension = Boolean(object.isExtension); return obj; }, - toJSON(message: UninterpretedOption_NamePart): unknown { + toJSON(message: UninterpretedOption_NamePart): JsonSafe { const obj: any = {}; message.namePart !== undefined && (obj.namePart = message.namePart); message.isExtension !== undefined && (obj.isExtension = message.isExtension); @@ -6189,7 +6190,7 @@ export const SourceCodeInfo = { if (Array.isArray(object?.location)) obj.location = object.location.map((e: any) => SourceCodeInfo_Location.fromJSON(e)); return obj; }, - toJSON(message: SourceCodeInfo): unknown { + toJSON(message: SourceCodeInfo): JsonSafe { const obj: any = {}; if (message.location) { obj.location = message.location.map(e => e ? SourceCodeInfo_Location.toJSON(e) : undefined); @@ -6337,7 +6338,7 @@ export const SourceCodeInfo_Location = { if (Array.isArray(object?.leadingDetachedComments)) obj.leadingDetachedComments = object.leadingDetachedComments.map((e: any) => String(e)); return obj; }, - toJSON(message: SourceCodeInfo_Location): unknown { + toJSON(message: SourceCodeInfo_Location): JsonSafe { const obj: any = {}; if (message.path) { obj.path = message.path.map(e => Math.round(e)); @@ -6491,7 +6492,7 @@ export const GeneratedCodeInfo = { if (Array.isArray(object?.annotation)) obj.annotation = object.annotation.map((e: any) => GeneratedCodeInfo_Annotation.fromJSON(e)); return obj; }, - toJSON(message: GeneratedCodeInfo): unknown { + toJSON(message: GeneratedCodeInfo): JsonSafe { const obj: any = {}; if (message.annotation) { obj.annotation = message.annotation.map(e => e ? GeneratedCodeInfo_Annotation.toJSON(e) : undefined); @@ -6622,7 +6623,7 @@ export const GeneratedCodeInfo_Annotation = { if (isSet(object.end)) obj.end = Number(object.end); return obj; }, - toJSON(message: GeneratedCodeInfo_Annotation): unknown { + toJSON(message: GeneratedCodeInfo_Annotation): JsonSafe { const obj: any = {}; if (message.path) { obj.path = message.path.map(e => Math.round(e)); @@ -6747,7 +6748,7 @@ export const FeatureSet = { if (isSet(object.utf8Validation)) obj.utf8Validation = featureSet_Utf8ValidationFromJSON(object.utf8Validation); return obj; }, - toJSON(message: FeatureSet): unknown { + toJSON(message: FeatureSet): JsonSafe { const obj: any = {}; message.utf8Validation !== undefined && (obj.utf8Validation = featureSet_Utf8ValidationToJSON(message.utf8Validation)); return obj; diff --git a/__fixtures__/misc/output/google/protobuf/duration.ts b/__fixtures__/misc/output/google/protobuf/duration.ts index bc7498a6ae..d56729d709 100644 --- a/__fixtures__/misc/output/google/protobuf/duration.ts +++ b/__fixtures__/misc/output/google/protobuf/duration.ts @@ -1,5 +1,6 @@ import { BinaryReader, BinaryWriter } from "../../binary"; import { isSet, DeepPartial } from "../../helpers"; +import { JsonSafe } from "../../json-safe"; export const protobufPackage = "google.protobuf"; /** * A Duration represents a signed, fixed-length span of time represented @@ -254,7 +255,7 @@ export const Duration = { if (isSet(object.nanos)) obj.nanos = Number(object.nanos); return obj; }, - toJSON(message: Duration): unknown { + toJSON(message: Duration): JsonSafe { const obj: any = {}; message.seconds !== undefined && (obj.seconds = (message.seconds || BigInt(0)).toString()); message.nanos !== undefined && (obj.nanos = Math.round(message.nanos)); diff --git a/__fixtures__/misc/output/google/protobuf/timestamp.ts b/__fixtures__/misc/output/google/protobuf/timestamp.ts index 167352acdf..259ef92539 100644 --- a/__fixtures__/misc/output/google/protobuf/timestamp.ts +++ b/__fixtures__/misc/output/google/protobuf/timestamp.ts @@ -1,5 +1,6 @@ import { BinaryReader, BinaryWriter } from "../../binary"; import { isSet, DeepPartial, fromJsonTimestamp, fromTimestamp } from "../../helpers"; +import { JsonSafe } from "../../json-safe"; export const protobufPackage = "google.protobuf"; /** * A Timestamp represents a point in time independent of any time zone or local @@ -324,7 +325,7 @@ export const Timestamp = { if (isSet(object.nanos)) obj.nanos = Number(object.nanos); return obj; }, - toJSON(message: Timestamp): unknown { + toJSON(message: Timestamp): JsonSafe { const obj: any = {}; message.seconds !== undefined && (obj.seconds = (message.seconds || BigInt(0)).toString()); message.nanos !== undefined && (obj.nanos = Math.round(message.nanos)); diff --git a/__fixtures__/misc/output/index.ts b/__fixtures__/misc/output/index.ts index 8c7bdc34cf..3757ae2467 100644 --- a/__fixtures__/misc/output/index.ts +++ b/__fixtures__/misc/output/index.ts @@ -12,6 +12,7 @@ export * from "./extern"; export * from "./react-query"; export * from "./mobx"; export * from "./pinia-endpoint"; +export * from "./json-safe"; export * from "./varint"; export * from "./utf8"; export * from "./binary"; \ No newline at end of file diff --git a/__fixtures__/misc/output/json-safe.ts b/__fixtures__/misc/output/json-safe.ts new file mode 100644 index 0000000000..7d46f89144 --- /dev/null +++ b/__fixtures__/misc/output/json-safe.ts @@ -0,0 +1,10 @@ +/** +* This file and any referenced files were automatically generated by @cosmology/telescope@latest +* DO NOT MODIFY BY HAND. Instead, download the latest proto files for your chain +* and run the transpile command or npm scripts command that is used to regenerate this bundle. +*/ + + +export type JsonSafe = { + [Prop in keyof T]: T[Prop] extends Uint8Array ? string : T[Prop] extends bigint ? string : T[Prop]; +} diff --git a/__fixtures__/misc/output/misc/all_fields.ts b/__fixtures__/misc/output/misc/all_fields.ts index 77411e862b..915effc180 100644 --- a/__fixtures__/misc/output/misc/all_fields.ts +++ b/__fixtures__/misc/output/misc/all_fields.ts @@ -5,6 +5,7 @@ import { Timestamp, TimestampAmino, TimestampSDKType } from "../google/protobuf/ import { BinaryReader, BinaryWriter } from "../binary"; import { toTimestamp, fromTimestamp, isSet, bytesFromBase64, base64FromBytes, DeepPartial } from "../helpers"; import { Decimal } from "@cosmjs/math"; +import { JsonSafe } from "../json-safe"; import { toUtf8, fromBase64, fromUtf8, toBase64 } from "@cosmjs/encoding"; import { encodePubkey, decodePubkey } from "@cosmjs/proto-signing"; export const protobufPackage = "misc"; @@ -877,7 +878,7 @@ export const EncodingTestForDontOmit = { if (Array.isArray(object?.dODecs)) obj.dODecs = object.dODecs.map((e: any) => String(e)); return obj; }, - toJSON(message: EncodingTestForDontOmit): unknown { + toJSON(message: EncodingTestForDontOmit): JsonSafe { const obj: any = {}; message.str !== undefined && (obj.str = message.str); message.dOStr !== undefined && (obj.dOStr = message.dOStr); @@ -2038,7 +2039,7 @@ export const EncodingTestForOmit = { if (Array.isArray(object?.oDecs)) obj.oDecs = object.oDecs.map((e: any) => String(e)); return obj; }, - toJSON(message: EncodingTestForOmit): unknown { + toJSON(message: EncodingTestForOmit): JsonSafe { const obj: any = {}; message.str !== undefined && (obj.str = message.str); message.oStr !== undefined && (obj.oStr = message.oStr); diff --git a/__fixtures__/misc/output/misc/eval_request.ts b/__fixtures__/misc/output/misc/eval_request.ts index 5986338d71..1dfb74d155 100644 --- a/__fixtures__/misc/output/misc/eval_request.ts +++ b/__fixtures__/misc/output/misc/eval_request.ts @@ -2,6 +2,7 @@ import { ExprValue, ExprValueAmino, ExprValueSDKType, IdRef, IdRefAmino, IdRefSD import { FeatureSet_Utf8Validation, featureSet_Utf8ValidationFromJSON, featureSet_Utf8ValidationToJSON } from "../google/protobuf/descriptor"; import { BinaryReader, BinaryWriter } from "../binary"; import { isSet, DeepPartial, isObject } from "../helpers"; +import { JsonSafe } from "../json-safe"; export const protobufPackage = "misc"; /** VoteOption enumerates the valid vote options for a given governance proposal. */ export enum VoteOption { @@ -243,7 +244,7 @@ export const EvalRequest_BindingsEntry = { if (isSet(object.value)) obj.value = ExprValue.fromJSON(object.value); return obj; }, - toJSON(message: EvalRequest_BindingsEntry): unknown { + toJSON(message: EvalRequest_BindingsEntry): JsonSafe { const obj: any = {}; message.key !== undefined && (obj.key = message.key); message.value !== undefined && (obj.value = message.value ? ExprValue.toJSON(message.value) : undefined); @@ -343,7 +344,7 @@ export const EvalRequest_RefsEntry = { if (isSet(object.value)) obj.value = IdRef.fromJSON(object.value); return obj; }, - toJSON(message: EvalRequest_RefsEntry): unknown { + toJSON(message: EvalRequest_RefsEntry): JsonSafe { const obj: any = {}; message.key !== undefined && (obj.key = message.key); message.value !== undefined && (obj.value = message.value ? IdRef.toJSON(message.value) : undefined); @@ -530,7 +531,7 @@ export const EvalRequest = { if (isSet(object.opt)) obj.opt = featureSet_Utf8ValidationFromJSON(object.opt); return obj; }, - toJSON(message: EvalRequest): unknown { + toJSON(message: EvalRequest): JsonSafe { const obj: any = {}; obj.bindings = {}; if (message.bindings) { @@ -785,7 +786,7 @@ export const AccessConfig = { if (isSet(object.sender)) obj.sender = String(object.sender); return obj; }, - toJSON(message: AccessConfig): unknown { + toJSON(message: AccessConfig): JsonSafe { const obj: any = {}; message.sender !== undefined && (obj.sender = message.sender); return obj; @@ -873,7 +874,7 @@ export const GenericAuthorization = { if (isSet(object.msg)) obj.msg = String(object.msg); return obj; }, - toJSON(message: GenericAuthorization): unknown { + toJSON(message: GenericAuthorization): JsonSafe { const obj: any = {}; message.msg !== undefined && (obj.msg = message.msg); return obj; diff --git a/__fixtures__/misc/output/misc/tx.ts b/__fixtures__/misc/output/misc/tx.ts index 2a12eeedbf..5febb5a6f1 100644 --- a/__fixtures__/misc/output/misc/tx.ts +++ b/__fixtures__/misc/output/misc/tx.ts @@ -1,6 +1,7 @@ import { EncodingTestForDontOmit, EncodingTestForDontOmitAmino, EncodingTestForDontOmitSDKType, EncodingTestForOmit, EncodingTestForOmitAmino, EncodingTestForOmitSDKType } from "./all_fields"; import { BinaryReader, BinaryWriter } from "../binary"; import { isSet, DeepPartial } from "../helpers"; +import { JsonSafe } from "../json-safe"; export const protobufPackage = "misc"; /** * MsgGrant is a request type for Grant method. It declares authorization to the grantee @@ -91,7 +92,7 @@ export const InputMsg = { if (isSet(object.oTests)) obj.oTests = EncodingTestForOmit.fromJSON(object.oTests); return obj; }, - toJSON(message: InputMsg): unknown { + toJSON(message: InputMsg): JsonSafe { const obj: any = {}; message.dOTests !== undefined && (obj.dOTests = message.dOTests ? EncodingTestForDontOmit.toJSON(message.dOTests) : undefined); message.oTests !== undefined && (obj.oTests = message.oTests ? EncodingTestForOmit.toJSON(message.oTests) : undefined); @@ -183,7 +184,7 @@ export const MsgResponse = { const obj = createBaseMsgResponse(); return obj; }, - toJSON(_: MsgResponse): unknown { + toJSON(_: MsgResponse): JsonSafe { const obj: any = {}; return obj; }, diff --git a/__fixtures__/output1/akash/audit/v1beta1/audit.ts b/__fixtures__/output1/akash/audit/v1beta1/audit.ts index 33bfe753a5..abe2ba5453 100644 --- a/__fixtures__/output1/akash/audit/v1beta1/audit.ts +++ b/__fixtures__/output1/akash/audit/v1beta1/audit.ts @@ -1,6 +1,7 @@ import { Attribute, AttributeSDKType } from "../../base/v1beta1/attribute"; import * as _m0 from "protobufjs/minimal"; import { isSet, DeepPartial, Exact } from "../../../helpers"; +import { JsonSafe } from "../../../json-safe"; export const protobufPackage = "akash.audit.v1beta1"; /** Provider stores owner auditor and attributes details */ export interface Provider { @@ -126,7 +127,7 @@ export const Provider = { attributes: Array.isArray(object?.attributes) ? object.attributes.map((e: any) => Attribute.fromJSON(e)) : [] }; }, - toJSON(message: Provider): unknown { + toJSON(message: Provider): JsonSafe { const obj: any = {}; message.owner !== undefined && (obj.owner = message.owner); message.auditor !== undefined && (obj.auditor = message.auditor); @@ -213,7 +214,7 @@ export const AuditedAttributes = { attributes: Array.isArray(object?.attributes) ? object.attributes.map((e: any) => Attribute.fromJSON(e)) : [] }; }, - toJSON(message: AuditedAttributes): unknown { + toJSON(message: AuditedAttributes): JsonSafe { const obj: any = {}; message.owner !== undefined && (obj.owner = message.owner); message.auditor !== undefined && (obj.auditor = message.auditor); @@ -284,7 +285,7 @@ export const AttributesResponse = { attributes: Array.isArray(object?.attributes) ? object.attributes.map((e: any) => AuditedAttributes.fromJSON(e)) : [] }; }, - toJSON(message: AttributesResponse): unknown { + toJSON(message: AttributesResponse): JsonSafe { const obj: any = {}; if (message.attributes) { obj.attributes = message.attributes.map(e => e ? AuditedAttributes.toJSON(e) : undefined); @@ -355,7 +356,7 @@ export const AttributesFilters = { owners: Array.isArray(object?.owners) ? object.owners.map((e: any) => String(e)) : [] }; }, - toJSON(message: AttributesFilters): unknown { + toJSON(message: AttributesFilters): JsonSafe { const obj: any = {}; if (message.auditors) { obj.auditors = message.auditors.map(e => e); @@ -446,7 +447,7 @@ export const MsgSignProviderAttributes = { attributes: Array.isArray(object?.attributes) ? object.attributes.map((e: any) => Attribute.fromJSON(e)) : [] }; }, - toJSON(message: MsgSignProviderAttributes): unknown { + toJSON(message: MsgSignProviderAttributes): JsonSafe { const obj: any = {}; message.owner !== undefined && (obj.owner = message.owner); message.auditor !== undefined && (obj.auditor = message.auditor); @@ -507,7 +508,7 @@ export const MsgSignProviderAttributesResponse = { fromJSON(_: any): MsgSignProviderAttributesResponse { return {}; }, - toJSON(_: MsgSignProviderAttributesResponse): unknown { + toJSON(_: MsgSignProviderAttributesResponse): JsonSafe { const obj: any = {}; return obj; }, @@ -573,7 +574,7 @@ export const MsgDeleteProviderAttributes = { keys: Array.isArray(object?.keys) ? object.keys.map((e: any) => String(e)) : [] }; }, - toJSON(message: MsgDeleteProviderAttributes): unknown { + toJSON(message: MsgDeleteProviderAttributes): JsonSafe { const obj: any = {}; message.owner !== undefined && (obj.owner = message.owner); message.auditor !== undefined && (obj.auditor = message.auditor); @@ -634,7 +635,7 @@ export const MsgDeleteProviderAttributesResponse = { fromJSON(_: any): MsgDeleteProviderAttributesResponse { return {}; }, - toJSON(_: MsgDeleteProviderAttributesResponse): unknown { + toJSON(_: MsgDeleteProviderAttributesResponse): JsonSafe { const obj: any = {}; return obj; }, diff --git a/__fixtures__/output1/akash/audit/v1beta2/audit.ts b/__fixtures__/output1/akash/audit/v1beta2/audit.ts index e96a47ecdd..f2612f39ac 100644 --- a/__fixtures__/output1/akash/audit/v1beta2/audit.ts +++ b/__fixtures__/output1/akash/audit/v1beta2/audit.ts @@ -1,6 +1,7 @@ import { Attribute, AttributeSDKType } from "../../base/v1beta2/attribute"; import * as _m0 from "protobufjs/minimal"; import { isSet, DeepPartial, Exact } from "../../../helpers"; +import { JsonSafe } from "../../../json-safe"; export const protobufPackage = "akash.audit.v1beta2"; /** Provider stores owner auditor and attributes details */ export interface Provider { @@ -126,7 +127,7 @@ export const Provider = { attributes: Array.isArray(object?.attributes) ? object.attributes.map((e: any) => Attribute.fromJSON(e)) : [] }; }, - toJSON(message: Provider): unknown { + toJSON(message: Provider): JsonSafe { const obj: any = {}; message.owner !== undefined && (obj.owner = message.owner); message.auditor !== undefined && (obj.auditor = message.auditor); @@ -213,7 +214,7 @@ export const AuditedAttributes = { attributes: Array.isArray(object?.attributes) ? object.attributes.map((e: any) => Attribute.fromJSON(e)) : [] }; }, - toJSON(message: AuditedAttributes): unknown { + toJSON(message: AuditedAttributes): JsonSafe { const obj: any = {}; message.owner !== undefined && (obj.owner = message.owner); message.auditor !== undefined && (obj.auditor = message.auditor); @@ -284,7 +285,7 @@ export const AttributesResponse = { attributes: Array.isArray(object?.attributes) ? object.attributes.map((e: any) => AuditedAttributes.fromJSON(e)) : [] }; }, - toJSON(message: AttributesResponse): unknown { + toJSON(message: AttributesResponse): JsonSafe { const obj: any = {}; if (message.attributes) { obj.attributes = message.attributes.map(e => e ? AuditedAttributes.toJSON(e) : undefined); @@ -355,7 +356,7 @@ export const AttributesFilters = { owners: Array.isArray(object?.owners) ? object.owners.map((e: any) => String(e)) : [] }; }, - toJSON(message: AttributesFilters): unknown { + toJSON(message: AttributesFilters): JsonSafe { const obj: any = {}; if (message.auditors) { obj.auditors = message.auditors.map(e => e); @@ -446,7 +447,7 @@ export const MsgSignProviderAttributes = { attributes: Array.isArray(object?.attributes) ? object.attributes.map((e: any) => Attribute.fromJSON(e)) : [] }; }, - toJSON(message: MsgSignProviderAttributes): unknown { + toJSON(message: MsgSignProviderAttributes): JsonSafe { const obj: any = {}; message.owner !== undefined && (obj.owner = message.owner); message.auditor !== undefined && (obj.auditor = message.auditor); @@ -507,7 +508,7 @@ export const MsgSignProviderAttributesResponse = { fromJSON(_: any): MsgSignProviderAttributesResponse { return {}; }, - toJSON(_: MsgSignProviderAttributesResponse): unknown { + toJSON(_: MsgSignProviderAttributesResponse): JsonSafe { const obj: any = {}; return obj; }, @@ -573,7 +574,7 @@ export const MsgDeleteProviderAttributes = { keys: Array.isArray(object?.keys) ? object.keys.map((e: any) => String(e)) : [] }; }, - toJSON(message: MsgDeleteProviderAttributes): unknown { + toJSON(message: MsgDeleteProviderAttributes): JsonSafe { const obj: any = {}; message.owner !== undefined && (obj.owner = message.owner); message.auditor !== undefined && (obj.auditor = message.auditor); @@ -634,7 +635,7 @@ export const MsgDeleteProviderAttributesResponse = { fromJSON(_: any): MsgDeleteProviderAttributesResponse { return {}; }, - toJSON(_: MsgDeleteProviderAttributesResponse): unknown { + toJSON(_: MsgDeleteProviderAttributesResponse): JsonSafe { const obj: any = {}; return obj; }, diff --git a/__fixtures__/output1/akash/audit/v1beta2/genesis.ts b/__fixtures__/output1/akash/audit/v1beta2/genesis.ts index c2e5e884b0..23cb71e04a 100644 --- a/__fixtures__/output1/akash/audit/v1beta2/genesis.ts +++ b/__fixtures__/output1/akash/audit/v1beta2/genesis.ts @@ -1,5 +1,6 @@ import { AuditedAttributes, AuditedAttributesSDKType } from "./audit"; import * as _m0 from "protobufjs/minimal"; +import { JsonSafe } from "../../../json-safe"; import { DeepPartial, Exact } from "../../../helpers"; export const protobufPackage = "akash.audit.v1beta2"; /** GenesisState defines the basic genesis state used by audit module */ @@ -44,7 +45,7 @@ export const GenesisState = { attributes: Array.isArray(object?.attributes) ? object.attributes.map((e: any) => AuditedAttributes.fromJSON(e)) : [] }; }, - toJSON(message: GenesisState): unknown { + toJSON(message: GenesisState): JsonSafe { const obj: any = {}; if (message.attributes) { obj.attributes = message.attributes.map(e => e ? AuditedAttributes.toJSON(e) : undefined); diff --git a/__fixtures__/output1/akash/audit/v1beta2/query.ts b/__fixtures__/output1/akash/audit/v1beta2/query.ts index 47fc5f5ee8..4fa1842fc6 100644 --- a/__fixtures__/output1/akash/audit/v1beta2/query.ts +++ b/__fixtures__/output1/akash/audit/v1beta2/query.ts @@ -2,6 +2,7 @@ import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } fr import { Provider, ProviderSDKType } from "./audit"; import * as _m0 from "protobufjs/minimal"; import { isSet, DeepPartial, Exact } from "../../../helpers"; +import { JsonSafe } from "../../../json-safe"; export const protobufPackage = "akash.audit.v1beta2"; /** QueryProvidersResponse is response type for the Query/Providers RPC method */ export interface QueryProvidersResponse { @@ -103,7 +104,7 @@ export const QueryProvidersResponse = { pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined }; }, - toJSON(message: QueryProvidersResponse): unknown { + toJSON(message: QueryProvidersResponse): JsonSafe { const obj: any = {}; if (message.providers) { obj.providers = message.providers.map(e => e ? Provider.toJSON(e) : undefined); @@ -178,7 +179,7 @@ export const QueryProviderRequest = { owner: isSet(object.owner) ? String(object.owner) : "" }; }, - toJSON(message: QueryProviderRequest): unknown { + toJSON(message: QueryProviderRequest): JsonSafe { const obj: any = {}; message.auditor !== undefined && (obj.auditor = message.auditor); message.owner !== undefined && (obj.owner = message.owner); @@ -237,7 +238,7 @@ export const QueryAllProvidersAttributesRequest = { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; }, - toJSON(message: QueryAllProvidersAttributesRequest): unknown { + toJSON(message: QueryAllProvidersAttributesRequest): JsonSafe { const obj: any = {}; message.pagination !== undefined && (obj.pagination = message.pagination ? PageRequest.toJSON(message.pagination) : undefined); return obj; @@ -300,7 +301,7 @@ export const QueryProviderAttributesRequest = { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; }, - toJSON(message: QueryProviderAttributesRequest): unknown { + toJSON(message: QueryProviderAttributesRequest): JsonSafe { const obj: any = {}; message.owner !== undefined && (obj.owner = message.owner); message.pagination !== undefined && (obj.pagination = message.pagination ? PageRequest.toJSON(message.pagination) : undefined); @@ -367,7 +368,7 @@ export const QueryProviderAuditorRequest = { owner: isSet(object.owner) ? String(object.owner) : "" }; }, - toJSON(message: QueryProviderAuditorRequest): unknown { + toJSON(message: QueryProviderAuditorRequest): JsonSafe { const obj: any = {}; message.auditor !== undefined && (obj.auditor = message.auditor); message.owner !== undefined && (obj.owner = message.owner); @@ -434,7 +435,7 @@ export const QueryAuditorAttributesRequest = { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; }, - toJSON(message: QueryAuditorAttributesRequest): unknown { + toJSON(message: QueryAuditorAttributesRequest): JsonSafe { const obj: any = {}; message.auditor !== undefined && (obj.auditor = message.auditor); message.pagination !== undefined && (obj.pagination = message.pagination ? PageRequest.toJSON(message.pagination) : undefined); diff --git a/__fixtures__/output1/akash/base/v1beta1/attribute.ts b/__fixtures__/output1/akash/base/v1beta1/attribute.ts index 731957ba3e..3552997da4 100644 --- a/__fixtures__/output1/akash/base/v1beta1/attribute.ts +++ b/__fixtures__/output1/akash/base/v1beta1/attribute.ts @@ -1,5 +1,6 @@ import * as _m0 from "protobufjs/minimal"; import { isSet, DeepPartial, Exact } from "../../../helpers"; +import { JsonSafe } from "../../../json-safe"; export const protobufPackage = "akash.base.v1beta1"; /** Attribute represents key value pair */ export interface Attribute { @@ -87,7 +88,7 @@ export const Attribute = { value: isSet(object.value) ? String(object.value) : "" }; }, - toJSON(message: Attribute): unknown { + toJSON(message: Attribute): JsonSafe { const obj: any = {}; message.key !== undefined && (obj.key = message.key); message.value !== undefined && (obj.value = message.value); @@ -154,7 +155,7 @@ export const SignedBy = { anyOf: Array.isArray(object?.anyOf) ? object.anyOf.map((e: any) => String(e)) : [] }; }, - toJSON(message: SignedBy): unknown { + toJSON(message: SignedBy): JsonSafe { const obj: any = {}; if (message.allOf) { obj.allOf = message.allOf.map(e => e); @@ -237,7 +238,7 @@ export const PlacementRequirements = { attributes: Array.isArray(object?.attributes) ? object.attributes.map((e: any) => Attribute.fromJSON(e)) : [] }; }, - toJSON(message: PlacementRequirements): unknown { + toJSON(message: PlacementRequirements): JsonSafe { const obj: any = {}; message.signedBy !== undefined && (obj.signedBy = message.signedBy ? SignedBy.toJSON(message.signedBy) : undefined); if (message.attributes) { diff --git a/__fixtures__/output1/akash/base/v1beta1/endpoint.ts b/__fixtures__/output1/akash/base/v1beta1/endpoint.ts index cf61d40f2e..a5a7e8832a 100644 --- a/__fixtures__/output1/akash/base/v1beta1/endpoint.ts +++ b/__fixtures__/output1/akash/base/v1beta1/endpoint.ts @@ -1,5 +1,6 @@ import * as _m0 from "protobufjs/minimal"; import { isSet, DeepPartial, Exact } from "../../../helpers"; +import { JsonSafe } from "../../../json-safe"; export const protobufPackage = "akash.base.v1beta1"; /** This describes how the endpoint is implemented when the lease is deployed */ export enum Endpoint_Kind { @@ -77,7 +78,7 @@ export const Endpoint = { kind: isSet(object.kind) ? endpoint_KindFromJSON(object.kind) : -1 }; }, - toJSON(message: Endpoint): unknown { + toJSON(message: Endpoint): JsonSafe { const obj: any = {}; message.kind !== undefined && (obj.kind = endpoint_KindToJSON(message.kind)); return obj; diff --git a/__fixtures__/output1/akash/base/v1beta1/resource.ts b/__fixtures__/output1/akash/base/v1beta1/resource.ts index c69969bdca..f2a4d7983e 100644 --- a/__fixtures__/output1/akash/base/v1beta1/resource.ts +++ b/__fixtures__/output1/akash/base/v1beta1/resource.ts @@ -3,6 +3,7 @@ import { Attribute, AttributeSDKType } from "./attribute"; import { Endpoint, EndpointSDKType } from "./endpoint"; import * as _m0 from "protobufjs/minimal"; import { isSet, DeepPartial, Exact } from "../../../helpers"; +import { JsonSafe } from "../../../json-safe"; export const protobufPackage = "akash.base.v1beta1"; /** CPU stores resource units and cpu config attributes */ export interface CPU { @@ -96,7 +97,7 @@ export const CPU = { attributes: Array.isArray(object?.attributes) ? object.attributes.map((e: any) => Attribute.fromJSON(e)) : [] }; }, - toJSON(message: CPU): unknown { + toJSON(message: CPU): JsonSafe { const obj: any = {}; message.units !== undefined && (obj.units = message.units ? ResourceValue.toJSON(message.units) : undefined); if (message.attributes) { @@ -171,7 +172,7 @@ export const Memory = { attributes: Array.isArray(object?.attributes) ? object.attributes.map((e: any) => Attribute.fromJSON(e)) : [] }; }, - toJSON(message: Memory): unknown { + toJSON(message: Memory): JsonSafe { const obj: any = {}; message.quantity !== undefined && (obj.quantity = message.quantity ? ResourceValue.toJSON(message.quantity) : undefined); if (message.attributes) { @@ -246,7 +247,7 @@ export const Storage = { attributes: Array.isArray(object?.attributes) ? object.attributes.map((e: any) => Attribute.fromJSON(e)) : [] }; }, - toJSON(message: Storage): unknown { + toJSON(message: Storage): JsonSafe { const obj: any = {}; message.quantity !== undefined && (obj.quantity = message.quantity ? ResourceValue.toJSON(message.quantity) : undefined); if (message.attributes) { @@ -337,7 +338,7 @@ export const ResourceUnits = { endpoints: Array.isArray(object?.endpoints) ? object.endpoints.map((e: any) => Endpoint.fromJSON(e)) : [] }; }, - toJSON(message: ResourceUnits): unknown { + toJSON(message: ResourceUnits): JsonSafe { const obj: any = {}; message.cpu !== undefined && (obj.cpu = message.cpu ? CPU.toJSON(message.cpu) : undefined); message.memory !== undefined && (obj.memory = message.memory ? Memory.toJSON(message.memory) : undefined); diff --git a/__fixtures__/output1/akash/base/v1beta1/resourcevalue.ts b/__fixtures__/output1/akash/base/v1beta1/resourcevalue.ts index 7c49277bc1..ede7590111 100644 --- a/__fixtures__/output1/akash/base/v1beta1/resourcevalue.ts +++ b/__fixtures__/output1/akash/base/v1beta1/resourcevalue.ts @@ -1,5 +1,6 @@ import * as _m0 from "protobufjs/minimal"; import { isSet, bytesFromBase64, base64FromBytes, DeepPartial, Exact } from "../../../helpers"; +import { JsonSafe } from "../../../json-safe"; export const protobufPackage = "akash.base.v1beta1"; /** Unit stores cpu, memory and storage metrics */ export interface ResourceValue { @@ -43,7 +44,7 @@ export const ResourceValue = { val: isSet(object.val) ? bytesFromBase64(object.val) : new Uint8Array() }; }, - toJSON(message: ResourceValue): unknown { + toJSON(message: ResourceValue): JsonSafe { const obj: any = {}; message.val !== undefined && (obj.val = base64FromBytes(message.val !== undefined ? message.val : new Uint8Array())); return obj; diff --git a/__fixtures__/output1/akash/base/v1beta2/attribute.ts b/__fixtures__/output1/akash/base/v1beta2/attribute.ts index 957fdab810..6f762e2d25 100644 --- a/__fixtures__/output1/akash/base/v1beta2/attribute.ts +++ b/__fixtures__/output1/akash/base/v1beta2/attribute.ts @@ -1,5 +1,6 @@ import * as _m0 from "protobufjs/minimal"; import { isSet, DeepPartial, Exact } from "../../../helpers"; +import { JsonSafe } from "../../../json-safe"; export const protobufPackage = "akash.base.v1beta2"; /** Attribute represents key value pair */ export interface Attribute { @@ -87,7 +88,7 @@ export const Attribute = { value: isSet(object.value) ? String(object.value) : "" }; }, - toJSON(message: Attribute): unknown { + toJSON(message: Attribute): JsonSafe { const obj: any = {}; message.key !== undefined && (obj.key = message.key); message.value !== undefined && (obj.value = message.value); @@ -154,7 +155,7 @@ export const SignedBy = { anyOf: Array.isArray(object?.anyOf) ? object.anyOf.map((e: any) => String(e)) : [] }; }, - toJSON(message: SignedBy): unknown { + toJSON(message: SignedBy): JsonSafe { const obj: any = {}; if (message.allOf) { obj.allOf = message.allOf.map(e => e); @@ -237,7 +238,7 @@ export const PlacementRequirements = { attributes: Array.isArray(object?.attributes) ? object.attributes.map((e: any) => Attribute.fromJSON(e)) : [] }; }, - toJSON(message: PlacementRequirements): unknown { + toJSON(message: PlacementRequirements): JsonSafe { const obj: any = {}; message.signedBy !== undefined && (obj.signedBy = message.signedBy ? SignedBy.toJSON(message.signedBy) : undefined); if (message.attributes) { diff --git a/__fixtures__/output1/akash/base/v1beta2/endpoint.ts b/__fixtures__/output1/akash/base/v1beta2/endpoint.ts index 9b41329e8f..5fac61191e 100644 --- a/__fixtures__/output1/akash/base/v1beta2/endpoint.ts +++ b/__fixtures__/output1/akash/base/v1beta2/endpoint.ts @@ -1,5 +1,6 @@ import * as _m0 from "protobufjs/minimal"; import { isSet, DeepPartial, Exact } from "../../../helpers"; +import { JsonSafe } from "../../../json-safe"; export const protobufPackage = "akash.base.v1beta2"; /** This describes how the endpoint is implemented when the lease is deployed */ export enum Endpoint_Kind { @@ -94,7 +95,7 @@ export const Endpoint = { sequenceNumber: isSet(object.sequenceNumber) ? Number(object.sequenceNumber) : 0 }; }, - toJSON(message: Endpoint): unknown { + toJSON(message: Endpoint): JsonSafe { const obj: any = {}; message.kind !== undefined && (obj.kind = endpoint_KindToJSON(message.kind)); message.sequenceNumber !== undefined && (obj.sequenceNumber = Math.round(message.sequenceNumber)); diff --git a/__fixtures__/output1/akash/base/v1beta2/resource.ts b/__fixtures__/output1/akash/base/v1beta2/resource.ts index 4d2bb29431..e0271c8704 100644 --- a/__fixtures__/output1/akash/base/v1beta2/resource.ts +++ b/__fixtures__/output1/akash/base/v1beta2/resource.ts @@ -2,6 +2,7 @@ import { ResourceValue, ResourceValueSDKType } from "./resourcevalue"; import { Attribute, AttributeSDKType } from "./attribute"; import * as _m0 from "protobufjs/minimal"; import { isSet, DeepPartial, Exact } from "../../../helpers"; +import { JsonSafe } from "../../../json-safe"; export const protobufPackage = "akash.base.v1beta2"; /** CPU stores resource units and cpu config attributes */ export interface CPU { @@ -77,7 +78,7 @@ export const CPU = { attributes: Array.isArray(object?.attributes) ? object.attributes.map((e: any) => Attribute.fromJSON(e)) : [] }; }, - toJSON(message: CPU): unknown { + toJSON(message: CPU): JsonSafe { const obj: any = {}; message.units !== undefined && (obj.units = message.units ? ResourceValue.toJSON(message.units) : undefined); if (message.attributes) { @@ -152,7 +153,7 @@ export const Memory = { attributes: Array.isArray(object?.attributes) ? object.attributes.map((e: any) => Attribute.fromJSON(e)) : [] }; }, - toJSON(message: Memory): unknown { + toJSON(message: Memory): JsonSafe { const obj: any = {}; message.quantity !== undefined && (obj.quantity = message.quantity ? ResourceValue.toJSON(message.quantity) : undefined); if (message.attributes) { @@ -235,7 +236,7 @@ export const Storage = { attributes: Array.isArray(object?.attributes) ? object.attributes.map((e: any) => Attribute.fromJSON(e)) : [] }; }, - toJSON(message: Storage): unknown { + toJSON(message: Storage): JsonSafe { const obj: any = {}; message.name !== undefined && (obj.name = message.name); message.quantity !== undefined && (obj.quantity = message.quantity ? ResourceValue.toJSON(message.quantity) : undefined); diff --git a/__fixtures__/output1/akash/base/v1beta2/resourceunits.ts b/__fixtures__/output1/akash/base/v1beta2/resourceunits.ts index 00b3c3b5ef..0fdc0ea10e 100644 --- a/__fixtures__/output1/akash/base/v1beta2/resourceunits.ts +++ b/__fixtures__/output1/akash/base/v1beta2/resourceunits.ts @@ -2,6 +2,7 @@ import { CPU, CPUSDKType, Memory, MemorySDKType, Storage, StorageSDKType } from import { Endpoint, EndpointSDKType } from "./endpoint"; import * as _m0 from "protobufjs/minimal"; import { isSet, DeepPartial, Exact } from "../../../helpers"; +import { JsonSafe } from "../../../json-safe"; export const protobufPackage = "akash.base.v1beta2"; /** * ResourceUnits describes all available resources types for deployment/node etc @@ -81,7 +82,7 @@ export const ResourceUnits = { endpoints: Array.isArray(object?.endpoints) ? object.endpoints.map((e: any) => Endpoint.fromJSON(e)) : [] }; }, - toJSON(message: ResourceUnits): unknown { + toJSON(message: ResourceUnits): JsonSafe { const obj: any = {}; message.cpu !== undefined && (obj.cpu = message.cpu ? CPU.toJSON(message.cpu) : undefined); message.memory !== undefined && (obj.memory = message.memory ? Memory.toJSON(message.memory) : undefined); diff --git a/__fixtures__/output1/akash/base/v1beta2/resourcevalue.ts b/__fixtures__/output1/akash/base/v1beta2/resourcevalue.ts index c4ab49e53f..6198e1abc7 100644 --- a/__fixtures__/output1/akash/base/v1beta2/resourcevalue.ts +++ b/__fixtures__/output1/akash/base/v1beta2/resourcevalue.ts @@ -1,5 +1,6 @@ import * as _m0 from "protobufjs/minimal"; import { isSet, bytesFromBase64, base64FromBytes, DeepPartial, Exact } from "../../../helpers"; +import { JsonSafe } from "../../../json-safe"; export const protobufPackage = "akash.base.v1beta2"; /** Unit stores cpu, memory and storage metrics */ export interface ResourceValue { @@ -43,7 +44,7 @@ export const ResourceValue = { val: isSet(object.val) ? bytesFromBase64(object.val) : new Uint8Array() }; }, - toJSON(message: ResourceValue): unknown { + toJSON(message: ResourceValue): JsonSafe { const obj: any = {}; message.val !== undefined && (obj.val = base64FromBytes(message.val !== undefined ? message.val : new Uint8Array())); return obj; diff --git a/__fixtures__/output1/akash/cert/v1beta2/cert.ts b/__fixtures__/output1/akash/cert/v1beta2/cert.ts index 994c7273b0..b128783eb4 100644 --- a/__fixtures__/output1/akash/cert/v1beta2/cert.ts +++ b/__fixtures__/output1/akash/cert/v1beta2/cert.ts @@ -1,5 +1,6 @@ import * as _m0 from "protobufjs/minimal"; import { isSet, DeepPartial, Exact, bytesFromBase64, base64FromBytes } from "../../../helpers"; +import { JsonSafe } from "../../../json-safe"; export const protobufPackage = "akash.cert.v1beta2"; /** State is an enum which refers to state of deployment */ export enum Certificate_State { @@ -146,7 +147,7 @@ export const CertificateID = { serial: isSet(object.serial) ? String(object.serial) : "" }; }, - toJSON(message: CertificateID): unknown { + toJSON(message: CertificateID): JsonSafe { const obj: any = {}; message.owner !== undefined && (obj.owner = message.owner); message.serial !== undefined && (obj.serial = message.serial); @@ -221,7 +222,7 @@ export const Certificate = { pubkey: isSet(object.pubkey) ? bytesFromBase64(object.pubkey) : new Uint8Array() }; }, - toJSON(message: Certificate): unknown { + toJSON(message: Certificate): JsonSafe { const obj: any = {}; message.state !== undefined && (obj.state = certificate_StateToJSON(message.state)); message.cert !== undefined && (obj.cert = base64FromBytes(message.cert !== undefined ? message.cert : new Uint8Array())); @@ -300,7 +301,7 @@ export const CertificateFilter = { state: isSet(object.state) ? String(object.state) : "" }; }, - toJSON(message: CertificateFilter): unknown { + toJSON(message: CertificateFilter): JsonSafe { const obj: any = {}; message.owner !== undefined && (obj.owner = message.owner); message.serial !== undefined && (obj.serial = message.serial); @@ -379,7 +380,7 @@ export const MsgCreateCertificate = { pubkey: isSet(object.pubkey) ? bytesFromBase64(object.pubkey) : new Uint8Array() }; }, - toJSON(message: MsgCreateCertificate): unknown { + toJSON(message: MsgCreateCertificate): JsonSafe { const obj: any = {}; message.owner !== undefined && (obj.owner = message.owner); message.cert !== undefined && (obj.cert = base64FromBytes(message.cert !== undefined ? message.cert : new Uint8Array())); @@ -432,7 +433,7 @@ export const MsgCreateCertificateResponse = { fromJSON(_: any): MsgCreateCertificateResponse { return {}; }, - toJSON(_: MsgCreateCertificateResponse): unknown { + toJSON(_: MsgCreateCertificateResponse): JsonSafe { const obj: any = {}; return obj; }, @@ -482,7 +483,7 @@ export const MsgRevokeCertificate = { id: isSet(object.id) ? CertificateID.fromJSON(object.id) : undefined }; }, - toJSON(message: MsgRevokeCertificate): unknown { + toJSON(message: MsgRevokeCertificate): JsonSafe { const obj: any = {}; message.id !== undefined && (obj.id = message.id ? CertificateID.toJSON(message.id) : undefined); return obj; @@ -527,7 +528,7 @@ export const MsgRevokeCertificateResponse = { fromJSON(_: any): MsgRevokeCertificateResponse { return {}; }, - toJSON(_: MsgRevokeCertificateResponse): unknown { + toJSON(_: MsgRevokeCertificateResponse): JsonSafe { const obj: any = {}; return obj; }, diff --git a/__fixtures__/output1/akash/cert/v1beta2/genesis.ts b/__fixtures__/output1/akash/cert/v1beta2/genesis.ts index 4249664398..d942ee0514 100644 --- a/__fixtures__/output1/akash/cert/v1beta2/genesis.ts +++ b/__fixtures__/output1/akash/cert/v1beta2/genesis.ts @@ -1,6 +1,7 @@ import { Certificate, CertificateSDKType } from "./cert"; import * as _m0 from "protobufjs/minimal"; import { isSet, DeepPartial, Exact } from "../../../helpers"; +import { JsonSafe } from "../../../json-safe"; export const protobufPackage = "akash.cert.v1beta2"; /** GenesisCertificate defines certificate entry at genesis */ export interface GenesisCertificate { @@ -62,7 +63,7 @@ export const GenesisCertificate = { certificate: isSet(object.certificate) ? Certificate.fromJSON(object.certificate) : undefined }; }, - toJSON(message: GenesisCertificate): unknown { + toJSON(message: GenesisCertificate): JsonSafe { const obj: any = {}; message.owner !== undefined && (obj.owner = message.owner); message.certificate !== undefined && (obj.certificate = message.certificate ? Certificate.toJSON(message.certificate) : undefined); @@ -121,7 +122,7 @@ export const GenesisState = { certificates: Array.isArray(object?.certificates) ? object.certificates.map((e: any) => GenesisCertificate.fromJSON(e)) : [] }; }, - toJSON(message: GenesisState): unknown { + toJSON(message: GenesisState): JsonSafe { const obj: any = {}; if (message.certificates) { obj.certificates = message.certificates.map(e => e ? GenesisCertificate.toJSON(e) : undefined); diff --git a/__fixtures__/output1/akash/cert/v1beta2/query.ts b/__fixtures__/output1/akash/cert/v1beta2/query.ts index a0f8c8d7fc..71b0df177f 100644 --- a/__fixtures__/output1/akash/cert/v1beta2/query.ts +++ b/__fixtures__/output1/akash/cert/v1beta2/query.ts @@ -2,6 +2,7 @@ import { CertificateFilter, CertificateFilterSDKType, Certificate, CertificateSD import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../../cosmos/base/query/v1beta1/pagination"; import * as _m0 from "protobufjs/minimal"; import { isSet, DeepPartial, Exact } from "../../../helpers"; +import { JsonSafe } from "../../../json-safe"; export const protobufPackage = "akash.cert.v1beta2"; /** CertificateResponse contains a single X509 certificate and its serial number */ export interface CertificateResponse { @@ -75,7 +76,7 @@ export const CertificateResponse = { serial: isSet(object.serial) ? String(object.serial) : "" }; }, - toJSON(message: CertificateResponse): unknown { + toJSON(message: CertificateResponse): JsonSafe { const obj: any = {}; message.certificate !== undefined && (obj.certificate = message.certificate ? Certificate.toJSON(message.certificate) : undefined); message.serial !== undefined && (obj.serial = message.serial); @@ -142,7 +143,7 @@ export const QueryCertificatesRequest = { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; }, - toJSON(message: QueryCertificatesRequest): unknown { + toJSON(message: QueryCertificatesRequest): JsonSafe { const obj: any = {}; message.filter !== undefined && (obj.filter = message.filter ? CertificateFilter.toJSON(message.filter) : undefined); message.pagination !== undefined && (obj.pagination = message.pagination ? PageRequest.toJSON(message.pagination) : undefined); @@ -209,7 +210,7 @@ export const QueryCertificatesResponse = { pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined }; }, - toJSON(message: QueryCertificatesResponse): unknown { + toJSON(message: QueryCertificatesResponse): JsonSafe { const obj: any = {}; if (message.certificates) { obj.certificates = message.certificates.map(e => e ? CertificateResponse.toJSON(e) : undefined); diff --git a/__fixtures__/output1/akash/deployment/v1beta1/authz.ts b/__fixtures__/output1/akash/deployment/v1beta1/authz.ts index caae22d1d8..6aa9ac085b 100644 --- a/__fixtures__/output1/akash/deployment/v1beta1/authz.ts +++ b/__fixtures__/output1/akash/deployment/v1beta1/authz.ts @@ -1,6 +1,7 @@ import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import * as _m0 from "protobufjs/minimal"; import { isSet, Exact } from "../../../helpers"; +import { JsonSafe } from "../../../json-safe"; export const protobufPackage = "akash.deployment.v1beta1"; /** * DepositDeploymentAuthorization allows the grantee to deposit up to spend_limit coins from @@ -54,7 +55,7 @@ export const DepositDeploymentAuthorization = { spendLimit: isSet(object.spendLimit) ? Coin.fromJSON(object.spendLimit) : undefined }; }, - toJSON(message: DepositDeploymentAuthorization): unknown { + toJSON(message: DepositDeploymentAuthorization): JsonSafe { const obj: any = {}; message.spendLimit !== undefined && (obj.spendLimit = message.spendLimit ? Coin.toJSON(message.spendLimit) : undefined); return obj; diff --git a/__fixtures__/output1/akash/deployment/v1beta1/deployment.ts b/__fixtures__/output1/akash/deployment/v1beta1/deployment.ts index b8cf30a299..8b4f6126c9 100644 --- a/__fixtures__/output1/akash/deployment/v1beta1/deployment.ts +++ b/__fixtures__/output1/akash/deployment/v1beta1/deployment.ts @@ -4,6 +4,7 @@ import { GroupSpec, GroupSpecSDKType, GroupID, GroupIDSDKType } from "./group"; import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { Long, isSet, bytesFromBase64, base64FromBytes, Exact, Rpc } from "../../../helpers"; import * as _m0 from "protobufjs/minimal"; +import { JsonSafe } from "../../../json-safe"; export const protobufPackage = "akash.deployment.v1beta1"; /** State is an enum which refers to state of deployment */ export enum Deployment_State { @@ -200,7 +201,7 @@ export const MsgCreateDeployment = { deposit: isSet(object.deposit) ? Coin.fromJSON(object.deposit) : undefined }; }, - toJSON(message: MsgCreateDeployment): unknown { + toJSON(message: MsgCreateDeployment): JsonSafe { const obj: any = {}; message.id !== undefined && (obj.id = message.id ? DeploymentID.toJSON(message.id) : undefined); if (message.groups) { @@ -265,7 +266,7 @@ export const MsgCreateDeploymentResponse = { fromJSON(_: any): MsgCreateDeploymentResponse { return {}; }, - toJSON(_: MsgCreateDeploymentResponse): unknown { + toJSON(_: MsgCreateDeploymentResponse): JsonSafe { const obj: any = {}; return obj; }, @@ -323,7 +324,7 @@ export const MsgDepositDeployment = { amount: isSet(object.amount) ? Coin.fromJSON(object.amount) : undefined }; }, - toJSON(message: MsgDepositDeployment): unknown { + toJSON(message: MsgDepositDeployment): JsonSafe { const obj: any = {}; message.id !== undefined && (obj.id = message.id ? DeploymentID.toJSON(message.id) : undefined); message.amount !== undefined && (obj.amount = message.amount ? Coin.toJSON(message.amount) : undefined); @@ -372,7 +373,7 @@ export const MsgDepositDeploymentResponse = { fromJSON(_: any): MsgDepositDeploymentResponse { return {}; }, - toJSON(_: MsgDepositDeploymentResponse): unknown { + toJSON(_: MsgDepositDeploymentResponse): JsonSafe { const obj: any = {}; return obj; }, @@ -438,7 +439,7 @@ export const MsgUpdateDeployment = { version: isSet(object.version) ? bytesFromBase64(object.version) : new Uint8Array() }; }, - toJSON(message: MsgUpdateDeployment): unknown { + toJSON(message: MsgUpdateDeployment): JsonSafe { const obj: any = {}; message.id !== undefined && (obj.id = message.id ? DeploymentID.toJSON(message.id) : undefined); if (message.groups) { @@ -499,7 +500,7 @@ export const MsgUpdateDeploymentResponse = { fromJSON(_: any): MsgUpdateDeploymentResponse { return {}; }, - toJSON(_: MsgUpdateDeploymentResponse): unknown { + toJSON(_: MsgUpdateDeploymentResponse): JsonSafe { const obj: any = {}; return obj; }, @@ -549,7 +550,7 @@ export const MsgCloseDeployment = { id: isSet(object.id) ? DeploymentID.fromJSON(object.id) : undefined }; }, - toJSON(message: MsgCloseDeployment): unknown { + toJSON(message: MsgCloseDeployment): JsonSafe { const obj: any = {}; message.id !== undefined && (obj.id = message.id ? DeploymentID.toJSON(message.id) : undefined); return obj; @@ -594,7 +595,7 @@ export const MsgCloseDeploymentResponse = { fromJSON(_: any): MsgCloseDeploymentResponse { return {}; }, - toJSON(_: MsgCloseDeploymentResponse): unknown { + toJSON(_: MsgCloseDeploymentResponse): JsonSafe { const obj: any = {}; return obj; }, @@ -652,7 +653,7 @@ export const DeploymentID = { dseq: isSet(object.dseq) ? Long.fromValue(object.dseq) : Long.UZERO }; }, - toJSON(message: DeploymentID): unknown { + toJSON(message: DeploymentID): JsonSafe { const obj: any = {}; message.owner !== undefined && (obj.owner = message.owner); message.dseq !== undefined && (obj.dseq = (message.dseq || Long.UZERO).toString()); @@ -735,7 +736,7 @@ export const Deployment = { createdAt: isSet(object.createdAt) ? Long.fromValue(object.createdAt) : Long.ZERO }; }, - toJSON(message: Deployment): unknown { + toJSON(message: Deployment): JsonSafe { const obj: any = {}; message.deploymentId !== undefined && (obj.deploymentId = message.deploymentId ? DeploymentID.toJSON(message.deploymentId) : undefined); message.state !== undefined && (obj.state = deployment_StateToJSON(message.state)); @@ -818,7 +819,7 @@ export const DeploymentFilters = { state: isSet(object.state) ? String(object.state) : "" }; }, - toJSON(message: DeploymentFilters): unknown { + toJSON(message: DeploymentFilters): JsonSafe { const obj: any = {}; message.owner !== undefined && (obj.owner = message.owner); message.dseq !== undefined && (obj.dseq = (message.dseq || Long.UZERO).toString()); diff --git a/__fixtures__/output1/akash/deployment/v1beta1/genesis.ts b/__fixtures__/output1/akash/deployment/v1beta1/genesis.ts index ff96727911..773bd43ba1 100644 --- a/__fixtures__/output1/akash/deployment/v1beta1/genesis.ts +++ b/__fixtures__/output1/akash/deployment/v1beta1/genesis.ts @@ -3,6 +3,7 @@ import { Group, GroupSDKType } from "./group"; import { Params, ParamsSDKType } from "./params"; import * as _m0 from "protobufjs/minimal"; import { isSet, Exact } from "../../../helpers"; +import { JsonSafe } from "../../../json-safe"; export const protobufPackage = "akash.deployment.v1beta1"; /** GenesisDeployment defines the basic genesis state used by deployment module */ export interface GenesisDeployment { @@ -66,7 +67,7 @@ export const GenesisDeployment = { groups: Array.isArray(object?.groups) ? object.groups.map((e: any) => Group.fromJSON(e)) : [] }; }, - toJSON(message: GenesisDeployment): unknown { + toJSON(message: GenesisDeployment): JsonSafe { const obj: any = {}; message.deployment !== undefined && (obj.deployment = message.deployment ? Deployment.toJSON(message.deployment) : undefined); if (message.groups) { @@ -141,7 +142,7 @@ export const GenesisState = { params: isSet(object.params) ? Params.fromJSON(object.params) : undefined }; }, - toJSON(message: GenesisState): unknown { + toJSON(message: GenesisState): JsonSafe { const obj: any = {}; if (message.deployments) { obj.deployments = message.deployments.map(e => e ? GenesisDeployment.toJSON(e) : undefined); diff --git a/__fixtures__/output1/akash/deployment/v1beta1/group.ts b/__fixtures__/output1/akash/deployment/v1beta1/group.ts index be14a7b6de..cdf4204d17 100644 --- a/__fixtures__/output1/akash/deployment/v1beta1/group.ts +++ b/__fixtures__/output1/akash/deployment/v1beta1/group.ts @@ -3,6 +3,7 @@ import { ResourceUnits, ResourceUnitsSDKType } from "../../base/v1beta1/resource import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { Long, isSet, Exact } from "../../../helpers"; import * as _m0 from "protobufjs/minimal"; +import { JsonSafe } from "../../../json-safe"; export const protobufPackage = "akash.deployment.v1beta1"; /** State is an enum which refers to state of group */ export enum Group_State { @@ -179,7 +180,7 @@ export const MsgCloseGroup = { id: isSet(object.id) ? GroupID.fromJSON(object.id) : undefined }; }, - toJSON(message: MsgCloseGroup): unknown { + toJSON(message: MsgCloseGroup): JsonSafe { const obj: any = {}; message.id !== undefined && (obj.id = message.id ? GroupID.toJSON(message.id) : undefined); return obj; @@ -224,7 +225,7 @@ export const MsgCloseGroupResponse = { fromJSON(_: any): MsgCloseGroupResponse { return {}; }, - toJSON(_: MsgCloseGroupResponse): unknown { + toJSON(_: MsgCloseGroupResponse): JsonSafe { const obj: any = {}; return obj; }, @@ -274,7 +275,7 @@ export const MsgPauseGroup = { id: isSet(object.id) ? GroupID.fromJSON(object.id) : undefined }; }, - toJSON(message: MsgPauseGroup): unknown { + toJSON(message: MsgPauseGroup): JsonSafe { const obj: any = {}; message.id !== undefined && (obj.id = message.id ? GroupID.toJSON(message.id) : undefined); return obj; @@ -319,7 +320,7 @@ export const MsgPauseGroupResponse = { fromJSON(_: any): MsgPauseGroupResponse { return {}; }, - toJSON(_: MsgPauseGroupResponse): unknown { + toJSON(_: MsgPauseGroupResponse): JsonSafe { const obj: any = {}; return obj; }, @@ -369,7 +370,7 @@ export const MsgStartGroup = { id: isSet(object.id) ? GroupID.fromJSON(object.id) : undefined }; }, - toJSON(message: MsgStartGroup): unknown { + toJSON(message: MsgStartGroup): JsonSafe { const obj: any = {}; message.id !== undefined && (obj.id = message.id ? GroupID.toJSON(message.id) : undefined); return obj; @@ -414,7 +415,7 @@ export const MsgStartGroupResponse = { fromJSON(_: any): MsgStartGroupResponse { return {}; }, - toJSON(_: MsgStartGroupResponse): unknown { + toJSON(_: MsgStartGroupResponse): JsonSafe { const obj: any = {}; return obj; }, @@ -480,7 +481,7 @@ export const GroupID = { gseq: isSet(object.gseq) ? Number(object.gseq) : 0 }; }, - toJSON(message: GroupID): unknown { + toJSON(message: GroupID): JsonSafe { const obj: any = {}; message.owner !== undefined && (obj.owner = message.owner); message.dseq !== undefined && (obj.dseq = (message.dseq || Long.UZERO).toString()); @@ -559,7 +560,7 @@ export const GroupSpec = { resources: Array.isArray(object?.resources) ? object.resources.map((e: any) => Resource.fromJSON(e)) : [] }; }, - toJSON(message: GroupSpec): unknown { + toJSON(message: GroupSpec): JsonSafe { const obj: any = {}; message.name !== undefined && (obj.name = message.name); message.requirements !== undefined && (obj.requirements = message.requirements ? PlacementRequirements.toJSON(message.requirements) : undefined); @@ -654,7 +655,7 @@ export const Group = { createdAt: isSet(object.createdAt) ? Long.fromValue(object.createdAt) : Long.ZERO }; }, - toJSON(message: Group): unknown { + toJSON(message: Group): JsonSafe { const obj: any = {}; message.groupId !== undefined && (obj.groupId = message.groupId ? GroupID.toJSON(message.groupId) : undefined); message.state !== undefined && (obj.state = group_StateToJSON(message.state)); @@ -737,7 +738,7 @@ export const Resource = { price: isSet(object.price) ? Coin.fromJSON(object.price) : undefined }; }, - toJSON(message: Resource): unknown { + toJSON(message: Resource): JsonSafe { const obj: any = {}; message.resources !== undefined && (obj.resources = message.resources ? ResourceUnits.toJSON(message.resources) : undefined); message.count !== undefined && (obj.count = Math.round(message.count)); diff --git a/__fixtures__/output1/akash/deployment/v1beta1/params.ts b/__fixtures__/output1/akash/deployment/v1beta1/params.ts index abfd455b06..c57c6de11e 100644 --- a/__fixtures__/output1/akash/deployment/v1beta1/params.ts +++ b/__fixtures__/output1/akash/deployment/v1beta1/params.ts @@ -1,6 +1,7 @@ import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import * as _m0 from "protobufjs/minimal"; import { isSet, Exact } from "../../../helpers"; +import { JsonSafe } from "../../../json-safe"; export const protobufPackage = "akash.deployment.v1beta1"; /** Params defines the parameters for the x/deployment package */ export interface Params { @@ -44,7 +45,7 @@ export const Params = { deploymentMinDeposit: isSet(object.deploymentMinDeposit) ? Coin.fromJSON(object.deploymentMinDeposit) : undefined }; }, - toJSON(message: Params): unknown { + toJSON(message: Params): JsonSafe { const obj: any = {}; message.deploymentMinDeposit !== undefined && (obj.deploymentMinDeposit = message.deploymentMinDeposit ? Coin.toJSON(message.deploymentMinDeposit) : undefined); return obj; diff --git a/__fixtures__/output1/akash/deployment/v1beta1/query.ts b/__fixtures__/output1/akash/deployment/v1beta1/query.ts index 33914704d9..4eafa14fce 100644 --- a/__fixtures__/output1/akash/deployment/v1beta1/query.ts +++ b/__fixtures__/output1/akash/deployment/v1beta1/query.ts @@ -4,6 +4,7 @@ import { GroupID, GroupIDSDKType, Group, GroupSDKType } from "./group"; import { Account, AccountSDKType } from "../../escrow/v1beta1/types"; import * as _m0 from "protobufjs/minimal"; import { isSet, Exact, Rpc } from "../../../helpers"; +import { JsonSafe } from "../../../json-safe"; import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; export const protobufPackage = "akash.deployment.v1beta1"; /** QueryDeploymentsRequest is request type for the Query/Deployments RPC method */ @@ -104,7 +105,7 @@ export const QueryDeploymentsRequest = { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; }, - toJSON(message: QueryDeploymentsRequest): unknown { + toJSON(message: QueryDeploymentsRequest): JsonSafe { const obj: any = {}; message.filters !== undefined && (obj.filters = message.filters ? DeploymentFilters.toJSON(message.filters) : undefined); message.pagination !== undefined && (obj.pagination = message.pagination ? PageRequest.toJSON(message.pagination) : undefined); @@ -171,7 +172,7 @@ export const QueryDeploymentsResponse = { pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined }; }, - toJSON(message: QueryDeploymentsResponse): unknown { + toJSON(message: QueryDeploymentsResponse): JsonSafe { const obj: any = {}; if (message.deployments) { obj.deployments = message.deployments.map(e => e ? QueryDeploymentResponse.toJSON(e) : undefined); @@ -238,7 +239,7 @@ export const QueryDeploymentRequest = { id: isSet(object.id) ? DeploymentID.fromJSON(object.id) : undefined }; }, - toJSON(message: QueryDeploymentRequest): unknown { + toJSON(message: QueryDeploymentRequest): JsonSafe { const obj: any = {}; message.id !== undefined && (obj.id = message.id ? DeploymentID.toJSON(message.id) : undefined); return obj; @@ -309,7 +310,7 @@ export const QueryDeploymentResponse = { escrowAccount: isSet(object.escrowAccount) ? Account.fromJSON(object.escrowAccount) : undefined }; }, - toJSON(message: QueryDeploymentResponse): unknown { + toJSON(message: QueryDeploymentResponse): JsonSafe { const obj: any = {}; message.deployment !== undefined && (obj.deployment = message.deployment ? Deployment.toJSON(message.deployment) : undefined); if (message.groups) { @@ -380,7 +381,7 @@ export const QueryGroupRequest = { id: isSet(object.id) ? GroupID.fromJSON(object.id) : undefined }; }, - toJSON(message: QueryGroupRequest): unknown { + toJSON(message: QueryGroupRequest): JsonSafe { const obj: any = {}; message.id !== undefined && (obj.id = message.id ? GroupID.toJSON(message.id) : undefined); return obj; @@ -435,7 +436,7 @@ export const QueryGroupResponse = { group: isSet(object.group) ? Group.fromJSON(object.group) : undefined }; }, - toJSON(message: QueryGroupResponse): unknown { + toJSON(message: QueryGroupResponse): JsonSafe { const obj: any = {}; message.group !== undefined && (obj.group = message.group ? Group.toJSON(message.group) : undefined); return obj; diff --git a/__fixtures__/output1/akash/deployment/v1beta2/authz.ts b/__fixtures__/output1/akash/deployment/v1beta2/authz.ts index 7d06edf228..5e7f9caba1 100644 --- a/__fixtures__/output1/akash/deployment/v1beta2/authz.ts +++ b/__fixtures__/output1/akash/deployment/v1beta2/authz.ts @@ -1,6 +1,7 @@ import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import * as _m0 from "protobufjs/minimal"; import { isSet, DeepPartial, Exact } from "../../../helpers"; +import { JsonSafe } from "../../../json-safe"; export const protobufPackage = "akash.deployment.v1beta2"; /** * DepositDeploymentAuthorization allows the grantee to deposit up to spend_limit coins from @@ -54,7 +55,7 @@ export const DepositDeploymentAuthorization = { spendLimit: isSet(object.spendLimit) ? Coin.fromJSON(object.spendLimit) : undefined }; }, - toJSON(message: DepositDeploymentAuthorization): unknown { + toJSON(message: DepositDeploymentAuthorization): JsonSafe { const obj: any = {}; message.spendLimit !== undefined && (obj.spendLimit = message.spendLimit ? Coin.toJSON(message.spendLimit) : undefined); return obj; diff --git a/__fixtures__/output1/akash/deployment/v1beta2/deployment.ts b/__fixtures__/output1/akash/deployment/v1beta2/deployment.ts index 72adbfa891..fc12090ffa 100644 --- a/__fixtures__/output1/akash/deployment/v1beta2/deployment.ts +++ b/__fixtures__/output1/akash/deployment/v1beta2/deployment.ts @@ -1,5 +1,6 @@ import { Long, isSet, DeepPartial, Exact, bytesFromBase64, base64FromBytes } from "../../../helpers"; import * as _m0 from "protobufjs/minimal"; +import { JsonSafe } from "../../../json-safe"; export const protobufPackage = "akash.deployment.v1beta2"; /** State is an enum which refers to state of deployment */ export enum Deployment_State { @@ -120,7 +121,7 @@ export const DeploymentID = { dseq: isSet(object.dseq) ? Long.fromValue(object.dseq) : Long.UZERO }; }, - toJSON(message: DeploymentID): unknown { + toJSON(message: DeploymentID): JsonSafe { const obj: any = {}; message.owner !== undefined && (obj.owner = message.owner); message.dseq !== undefined && (obj.dseq = (message.dseq || Long.UZERO).toString()); @@ -203,7 +204,7 @@ export const Deployment = { createdAt: isSet(object.createdAt) ? Long.fromValue(object.createdAt) : Long.ZERO }; }, - toJSON(message: Deployment): unknown { + toJSON(message: Deployment): JsonSafe { const obj: any = {}; message.deploymentId !== undefined && (obj.deploymentId = message.deploymentId ? DeploymentID.toJSON(message.deploymentId) : undefined); message.state !== undefined && (obj.state = deployment_StateToJSON(message.state)); @@ -286,7 +287,7 @@ export const DeploymentFilters = { state: isSet(object.state) ? String(object.state) : "" }; }, - toJSON(message: DeploymentFilters): unknown { + toJSON(message: DeploymentFilters): JsonSafe { const obj: any = {}; message.owner !== undefined && (obj.owner = message.owner); message.dseq !== undefined && (obj.dseq = (message.dseq || Long.UZERO).toString()); diff --git a/__fixtures__/output1/akash/deployment/v1beta2/deploymentmsg.ts b/__fixtures__/output1/akash/deployment/v1beta2/deploymentmsg.ts index a58d72fd06..167c55ef3a 100644 --- a/__fixtures__/output1/akash/deployment/v1beta2/deploymentmsg.ts +++ b/__fixtures__/output1/akash/deployment/v1beta2/deploymentmsg.ts @@ -3,6 +3,7 @@ import { GroupSpec, GroupSpecSDKType } from "./groupspec"; import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import * as _m0 from "protobufjs/minimal"; import { isSet, bytesFromBase64, base64FromBytes, DeepPartial, Exact } from "../../../helpers"; +import { JsonSafe } from "../../../json-safe"; export const protobufPackage = "akash.deployment.v1beta2"; /** MsgCreateDeployment defines an SDK message for creating deployment */ export interface MsgCreateDeployment { @@ -134,7 +135,7 @@ export const MsgCreateDeployment = { depositor: isSet(object.depositor) ? String(object.depositor) : "" }; }, - toJSON(message: MsgCreateDeployment): unknown { + toJSON(message: MsgCreateDeployment): JsonSafe { const obj: any = {}; message.id !== undefined && (obj.id = message.id ? DeploymentID.toJSON(message.id) : undefined); if (message.groups) { @@ -203,7 +204,7 @@ export const MsgCreateDeploymentResponse = { fromJSON(_: any): MsgCreateDeploymentResponse { return {}; }, - toJSON(_: MsgCreateDeploymentResponse): unknown { + toJSON(_: MsgCreateDeploymentResponse): JsonSafe { const obj: any = {}; return obj; }, @@ -269,7 +270,7 @@ export const MsgDepositDeployment = { depositor: isSet(object.depositor) ? String(object.depositor) : "" }; }, - toJSON(message: MsgDepositDeployment): unknown { + toJSON(message: MsgDepositDeployment): JsonSafe { const obj: any = {}; message.id !== undefined && (obj.id = message.id ? DeploymentID.toJSON(message.id) : undefined); message.amount !== undefined && (obj.amount = message.amount ? Coin.toJSON(message.amount) : undefined); @@ -322,7 +323,7 @@ export const MsgDepositDeploymentResponse = { fromJSON(_: any): MsgDepositDeploymentResponse { return {}; }, - toJSON(_: MsgDepositDeploymentResponse): unknown { + toJSON(_: MsgDepositDeploymentResponse): JsonSafe { const obj: any = {}; return obj; }, @@ -380,7 +381,7 @@ export const MsgUpdateDeployment = { version: isSet(object.version) ? bytesFromBase64(object.version) : new Uint8Array() }; }, - toJSON(message: MsgUpdateDeployment): unknown { + toJSON(message: MsgUpdateDeployment): JsonSafe { const obj: any = {}; message.id !== undefined && (obj.id = message.id ? DeploymentID.toJSON(message.id) : undefined); message.version !== undefined && (obj.version = base64FromBytes(message.version !== undefined ? message.version : new Uint8Array())); @@ -429,7 +430,7 @@ export const MsgUpdateDeploymentResponse = { fromJSON(_: any): MsgUpdateDeploymentResponse { return {}; }, - toJSON(_: MsgUpdateDeploymentResponse): unknown { + toJSON(_: MsgUpdateDeploymentResponse): JsonSafe { const obj: any = {}; return obj; }, @@ -479,7 +480,7 @@ export const MsgCloseDeployment = { id: isSet(object.id) ? DeploymentID.fromJSON(object.id) : undefined }; }, - toJSON(message: MsgCloseDeployment): unknown { + toJSON(message: MsgCloseDeployment): JsonSafe { const obj: any = {}; message.id !== undefined && (obj.id = message.id ? DeploymentID.toJSON(message.id) : undefined); return obj; @@ -524,7 +525,7 @@ export const MsgCloseDeploymentResponse = { fromJSON(_: any): MsgCloseDeploymentResponse { return {}; }, - toJSON(_: MsgCloseDeploymentResponse): unknown { + toJSON(_: MsgCloseDeploymentResponse): JsonSafe { const obj: any = {}; return obj; }, diff --git a/__fixtures__/output1/akash/deployment/v1beta2/genesis.ts b/__fixtures__/output1/akash/deployment/v1beta2/genesis.ts index 19b3c799ba..6efeb626ce 100644 --- a/__fixtures__/output1/akash/deployment/v1beta2/genesis.ts +++ b/__fixtures__/output1/akash/deployment/v1beta2/genesis.ts @@ -3,6 +3,7 @@ import { Group, GroupSDKType } from "./group"; import { Params, ParamsSDKType } from "./params"; import * as _m0 from "protobufjs/minimal"; import { isSet, DeepPartial, Exact } from "../../../helpers"; +import { JsonSafe } from "../../../json-safe"; export const protobufPackage = "akash.deployment.v1beta2"; /** GenesisDeployment defines the basic genesis state used by deployment module */ export interface GenesisDeployment { @@ -66,7 +67,7 @@ export const GenesisDeployment = { groups: Array.isArray(object?.groups) ? object.groups.map((e: any) => Group.fromJSON(e)) : [] }; }, - toJSON(message: GenesisDeployment): unknown { + toJSON(message: GenesisDeployment): JsonSafe { const obj: any = {}; message.deployment !== undefined && (obj.deployment = message.deployment ? Deployment.toJSON(message.deployment) : undefined); if (message.groups) { @@ -141,7 +142,7 @@ export const GenesisState = { params: isSet(object.params) ? Params.fromJSON(object.params) : undefined }; }, - toJSON(message: GenesisState): unknown { + toJSON(message: GenesisState): JsonSafe { const obj: any = {}; if (message.deployments) { obj.deployments = message.deployments.map(e => e ? GenesisDeployment.toJSON(e) : undefined); diff --git a/__fixtures__/output1/akash/deployment/v1beta2/group.ts b/__fixtures__/output1/akash/deployment/v1beta2/group.ts index 5ce8148aa6..0759d7b847 100644 --- a/__fixtures__/output1/akash/deployment/v1beta2/group.ts +++ b/__fixtures__/output1/akash/deployment/v1beta2/group.ts @@ -2,6 +2,7 @@ import { GroupID, GroupIDSDKType } from "./groupid"; import { GroupSpec, GroupSpecSDKType } from "./groupspec"; import { Long, isSet, DeepPartial, Exact } from "../../../helpers"; import * as _m0 from "protobufjs/minimal"; +import { JsonSafe } from "../../../json-safe"; export const protobufPackage = "akash.deployment.v1beta2"; /** State is an enum which refers to state of group */ export enum Group_State { @@ -130,7 +131,7 @@ export const Group = { createdAt: isSet(object.createdAt) ? Long.fromValue(object.createdAt) : Long.ZERO }; }, - toJSON(message: Group): unknown { + toJSON(message: Group): JsonSafe { const obj: any = {}; message.groupId !== undefined && (obj.groupId = message.groupId ? GroupID.toJSON(message.groupId) : undefined); message.state !== undefined && (obj.state = group_StateToJSON(message.state)); diff --git a/__fixtures__/output1/akash/deployment/v1beta2/groupid.ts b/__fixtures__/output1/akash/deployment/v1beta2/groupid.ts index 2ddd6fd6f2..52ff1c90dc 100644 --- a/__fixtures__/output1/akash/deployment/v1beta2/groupid.ts +++ b/__fixtures__/output1/akash/deployment/v1beta2/groupid.ts @@ -1,5 +1,6 @@ import { Long, isSet, DeepPartial, Exact } from "../../../helpers"; import * as _m0 from "protobufjs/minimal"; +import { JsonSafe } from "../../../json-safe"; export const protobufPackage = "akash.deployment.v1beta2"; /** GroupID stores owner, deployment sequence number and group sequence number */ export interface GroupID { @@ -63,7 +64,7 @@ export const GroupID = { gseq: isSet(object.gseq) ? Number(object.gseq) : 0 }; }, - toJSON(message: GroupID): unknown { + toJSON(message: GroupID): JsonSafe { const obj: any = {}; message.owner !== undefined && (obj.owner = message.owner); message.dseq !== undefined && (obj.dseq = (message.dseq || Long.UZERO).toString()); diff --git a/__fixtures__/output1/akash/deployment/v1beta2/groupmsg.ts b/__fixtures__/output1/akash/deployment/v1beta2/groupmsg.ts index b4223a92c2..c6da8e621a 100644 --- a/__fixtures__/output1/akash/deployment/v1beta2/groupmsg.ts +++ b/__fixtures__/output1/akash/deployment/v1beta2/groupmsg.ts @@ -1,6 +1,7 @@ import { GroupID, GroupIDSDKType } from "./groupid"; import * as _m0 from "protobufjs/minimal"; import { isSet, DeepPartial, Exact } from "../../../helpers"; +import { JsonSafe } from "../../../json-safe"; export const protobufPackage = "akash.deployment.v1beta2"; /** MsgCloseGroup defines SDK message to close a single Group within a Deployment. */ export interface MsgCloseGroup { @@ -72,7 +73,7 @@ export const MsgCloseGroup = { id: isSet(object.id) ? GroupID.fromJSON(object.id) : undefined }; }, - toJSON(message: MsgCloseGroup): unknown { + toJSON(message: MsgCloseGroup): JsonSafe { const obj: any = {}; message.id !== undefined && (obj.id = message.id ? GroupID.toJSON(message.id) : undefined); return obj; @@ -117,7 +118,7 @@ export const MsgCloseGroupResponse = { fromJSON(_: any): MsgCloseGroupResponse { return {}; }, - toJSON(_: MsgCloseGroupResponse): unknown { + toJSON(_: MsgCloseGroupResponse): JsonSafe { const obj: any = {}; return obj; }, @@ -167,7 +168,7 @@ export const MsgPauseGroup = { id: isSet(object.id) ? GroupID.fromJSON(object.id) : undefined }; }, - toJSON(message: MsgPauseGroup): unknown { + toJSON(message: MsgPauseGroup): JsonSafe { const obj: any = {}; message.id !== undefined && (obj.id = message.id ? GroupID.toJSON(message.id) : undefined); return obj; @@ -212,7 +213,7 @@ export const MsgPauseGroupResponse = { fromJSON(_: any): MsgPauseGroupResponse { return {}; }, - toJSON(_: MsgPauseGroupResponse): unknown { + toJSON(_: MsgPauseGroupResponse): JsonSafe { const obj: any = {}; return obj; }, @@ -262,7 +263,7 @@ export const MsgStartGroup = { id: isSet(object.id) ? GroupID.fromJSON(object.id) : undefined }; }, - toJSON(message: MsgStartGroup): unknown { + toJSON(message: MsgStartGroup): JsonSafe { const obj: any = {}; message.id !== undefined && (obj.id = message.id ? GroupID.toJSON(message.id) : undefined); return obj; @@ -307,7 +308,7 @@ export const MsgStartGroupResponse = { fromJSON(_: any): MsgStartGroupResponse { return {}; }, - toJSON(_: MsgStartGroupResponse): unknown { + toJSON(_: MsgStartGroupResponse): JsonSafe { const obj: any = {}; return obj; }, diff --git a/__fixtures__/output1/akash/deployment/v1beta2/groupspec.ts b/__fixtures__/output1/akash/deployment/v1beta2/groupspec.ts index e3af8ed07a..5393c906c3 100644 --- a/__fixtures__/output1/akash/deployment/v1beta2/groupspec.ts +++ b/__fixtures__/output1/akash/deployment/v1beta2/groupspec.ts @@ -2,6 +2,7 @@ import { PlacementRequirements, PlacementRequirementsSDKType } from "../../base/ import { Resource, ResourceSDKType } from "./resource"; import * as _m0 from "protobufjs/minimal"; import { isSet, DeepPartial, Exact } from "../../../helpers"; +import { JsonSafe } from "../../../json-safe"; export const protobufPackage = "akash.deployment.v1beta2"; /** GroupSpec stores group specifications */ export interface GroupSpec { @@ -65,7 +66,7 @@ export const GroupSpec = { resources: Array.isArray(object?.resources) ? object.resources.map((e: any) => Resource.fromJSON(e)) : [] }; }, - toJSON(message: GroupSpec): unknown { + toJSON(message: GroupSpec): JsonSafe { const obj: any = {}; message.name !== undefined && (obj.name = message.name); message.requirements !== undefined && (obj.requirements = message.requirements ? PlacementRequirements.toJSON(message.requirements) : undefined); diff --git a/__fixtures__/output1/akash/deployment/v1beta2/params.ts b/__fixtures__/output1/akash/deployment/v1beta2/params.ts index d38490c0e3..c0e12d27a0 100644 --- a/__fixtures__/output1/akash/deployment/v1beta2/params.ts +++ b/__fixtures__/output1/akash/deployment/v1beta2/params.ts @@ -1,6 +1,7 @@ import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import * as _m0 from "protobufjs/minimal"; import { isSet, DeepPartial, Exact } from "../../../helpers"; +import { JsonSafe } from "../../../json-safe"; export const protobufPackage = "akash.deployment.v1beta2"; /** Params defines the parameters for the x/deployment package */ export interface Params { @@ -44,7 +45,7 @@ export const Params = { deploymentMinDeposit: isSet(object.deploymentMinDeposit) ? Coin.fromJSON(object.deploymentMinDeposit) : undefined }; }, - toJSON(message: Params): unknown { + toJSON(message: Params): JsonSafe { const obj: any = {}; message.deploymentMinDeposit !== undefined && (obj.deploymentMinDeposit = message.deploymentMinDeposit ? Coin.toJSON(message.deploymentMinDeposit) : undefined); return obj; diff --git a/__fixtures__/output1/akash/deployment/v1beta2/query.ts b/__fixtures__/output1/akash/deployment/v1beta2/query.ts index 8e4ab0648e..02e010e4f5 100644 --- a/__fixtures__/output1/akash/deployment/v1beta2/query.ts +++ b/__fixtures__/output1/akash/deployment/v1beta2/query.ts @@ -5,6 +5,7 @@ import { Group, GroupSDKType } from "./group"; import { Account, AccountSDKType } from "../../escrow/v1beta2/types"; import * as _m0 from "protobufjs/minimal"; import { isSet, DeepPartial, Exact } from "../../../helpers"; +import { JsonSafe } from "../../../json-safe"; export const protobufPackage = "akash.deployment.v1beta2"; /** QueryDeploymentsRequest is request type for the Query/Deployments RPC method */ export interface QueryDeploymentsRequest { @@ -104,7 +105,7 @@ export const QueryDeploymentsRequest = { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; }, - toJSON(message: QueryDeploymentsRequest): unknown { + toJSON(message: QueryDeploymentsRequest): JsonSafe { const obj: any = {}; message.filters !== undefined && (obj.filters = message.filters ? DeploymentFilters.toJSON(message.filters) : undefined); message.pagination !== undefined && (obj.pagination = message.pagination ? PageRequest.toJSON(message.pagination) : undefined); @@ -171,7 +172,7 @@ export const QueryDeploymentsResponse = { pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined }; }, - toJSON(message: QueryDeploymentsResponse): unknown { + toJSON(message: QueryDeploymentsResponse): JsonSafe { const obj: any = {}; if (message.deployments) { obj.deployments = message.deployments.map(e => e ? QueryDeploymentResponse.toJSON(e) : undefined); @@ -238,7 +239,7 @@ export const QueryDeploymentRequest = { id: isSet(object.id) ? DeploymentID.fromJSON(object.id) : undefined }; }, - toJSON(message: QueryDeploymentRequest): unknown { + toJSON(message: QueryDeploymentRequest): JsonSafe { const obj: any = {}; message.id !== undefined && (obj.id = message.id ? DeploymentID.toJSON(message.id) : undefined); return obj; @@ -309,7 +310,7 @@ export const QueryDeploymentResponse = { escrowAccount: isSet(object.escrowAccount) ? Account.fromJSON(object.escrowAccount) : undefined }; }, - toJSON(message: QueryDeploymentResponse): unknown { + toJSON(message: QueryDeploymentResponse): JsonSafe { const obj: any = {}; message.deployment !== undefined && (obj.deployment = message.deployment ? Deployment.toJSON(message.deployment) : undefined); if (message.groups) { @@ -380,7 +381,7 @@ export const QueryGroupRequest = { id: isSet(object.id) ? GroupID.fromJSON(object.id) : undefined }; }, - toJSON(message: QueryGroupRequest): unknown { + toJSON(message: QueryGroupRequest): JsonSafe { const obj: any = {}; message.id !== undefined && (obj.id = message.id ? GroupID.toJSON(message.id) : undefined); return obj; @@ -435,7 +436,7 @@ export const QueryGroupResponse = { group: isSet(object.group) ? Group.fromJSON(object.group) : undefined }; }, - toJSON(message: QueryGroupResponse): unknown { + toJSON(message: QueryGroupResponse): JsonSafe { const obj: any = {}; message.group !== undefined && (obj.group = message.group ? Group.toJSON(message.group) : undefined); return obj; diff --git a/__fixtures__/output1/akash/deployment/v1beta2/resource.ts b/__fixtures__/output1/akash/deployment/v1beta2/resource.ts index dc617cebd0..fecb95cdff 100644 --- a/__fixtures__/output1/akash/deployment/v1beta2/resource.ts +++ b/__fixtures__/output1/akash/deployment/v1beta2/resource.ts @@ -2,6 +2,7 @@ import { ResourceUnits, ResourceUnitsSDKType } from "../../base/v1beta2/resource import { DecCoin, DecCoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import * as _m0 from "protobufjs/minimal"; import { isSet, DeepPartial, Exact } from "../../../helpers"; +import { JsonSafe } from "../../../json-safe"; export const protobufPackage = "akash.deployment.v1beta2"; /** Resource stores unit, total count and price of resource */ export interface Resource { @@ -65,7 +66,7 @@ export const Resource = { price: isSet(object.price) ? DecCoin.fromJSON(object.price) : undefined }; }, - toJSON(message: Resource): unknown { + toJSON(message: Resource): JsonSafe { const obj: any = {}; message.resources !== undefined && (obj.resources = message.resources ? ResourceUnits.toJSON(message.resources) : undefined); message.count !== undefined && (obj.count = Math.round(message.count)); diff --git a/__fixtures__/output1/akash/escrow/v1beta1/genesis.ts b/__fixtures__/output1/akash/escrow/v1beta1/genesis.ts index fe6d344914..c964dbb6fa 100644 --- a/__fixtures__/output1/akash/escrow/v1beta1/genesis.ts +++ b/__fixtures__/output1/akash/escrow/v1beta1/genesis.ts @@ -1,5 +1,6 @@ import { Account, AccountSDKType, Payment, PaymentSDKType } from "./types"; import * as _m0 from "protobufjs/minimal"; +import { JsonSafe } from "../../../json-safe"; import { DeepPartial, Exact } from "../../../helpers"; export const protobufPackage = "akash.escrow.v1beta1"; /** GenesisState defines the basic genesis state used by escrow module */ @@ -54,7 +55,7 @@ export const GenesisState = { payments: Array.isArray(object?.payments) ? object.payments.map((e: any) => Payment.fromJSON(e)) : [] }; }, - toJSON(message: GenesisState): unknown { + toJSON(message: GenesisState): JsonSafe { const obj: any = {}; if (message.accounts) { obj.accounts = message.accounts.map(e => e ? Account.toJSON(e) : undefined); diff --git a/__fixtures__/output1/akash/escrow/v1beta1/query.ts b/__fixtures__/output1/akash/escrow/v1beta1/query.ts index ec828e776e..8faa2a9f1f 100644 --- a/__fixtures__/output1/akash/escrow/v1beta1/query.ts +++ b/__fixtures__/output1/akash/escrow/v1beta1/query.ts @@ -2,6 +2,7 @@ import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } fr import { Account, AccountSDKType, Payment, PaymentSDKType } from "./types"; import * as _m0 from "protobufjs/minimal"; import { isSet, DeepPartial, Exact } from "../../../helpers"; +import { JsonSafe } from "../../../json-safe"; export const protobufPackage = "akash.escrow.v1beta1"; /** QueryAccountRequest is request type for the Query/Account RPC method */ export interface QueryAccountsRequest { @@ -123,7 +124,7 @@ export const QueryAccountsRequest = { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; }, - toJSON(message: QueryAccountsRequest): unknown { + toJSON(message: QueryAccountsRequest): JsonSafe { const obj: any = {}; message.scope !== undefined && (obj.scope = message.scope); message.xid !== undefined && (obj.xid = message.xid); @@ -202,7 +203,7 @@ export const QueryAccountsResponse = { pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined }; }, - toJSON(message: QueryAccountsResponse): unknown { + toJSON(message: QueryAccountsResponse): JsonSafe { const obj: any = {}; if (message.accounts) { obj.accounts = message.accounts.map(e => e ? Account.toJSON(e) : undefined); @@ -309,7 +310,7 @@ export const QueryPaymentsRequest = { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; }, - toJSON(message: QueryPaymentsRequest): unknown { + toJSON(message: QueryPaymentsRequest): JsonSafe { const obj: any = {}; message.scope !== undefined && (obj.scope = message.scope); message.xid !== undefined && (obj.xid = message.xid); @@ -392,7 +393,7 @@ export const QueryPaymentsResponse = { pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined }; }, - toJSON(message: QueryPaymentsResponse): unknown { + toJSON(message: QueryPaymentsResponse): JsonSafe { const obj: any = {}; if (message.payments) { obj.payments = message.payments.map(e => e ? Payment.toJSON(e) : undefined); diff --git a/__fixtures__/output1/akash/escrow/v1beta1/types.ts b/__fixtures__/output1/akash/escrow/v1beta1/types.ts index e9a6892182..dfb40cd533 100644 --- a/__fixtures__/output1/akash/escrow/v1beta1/types.ts +++ b/__fixtures__/output1/akash/escrow/v1beta1/types.ts @@ -1,6 +1,7 @@ import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { Long, isSet, DeepPartial, Exact } from "../../../helpers"; import * as _m0 from "protobufjs/minimal"; +import { JsonSafe } from "../../../json-safe"; export const protobufPackage = "akash.escrow.v1beta1"; /** State stores state for an escrow account */ export enum Account_State { @@ -194,7 +195,7 @@ export const AccountID = { xid: isSet(object.xid) ? String(object.xid) : "" }; }, - toJSON(message: AccountID): unknown { + toJSON(message: AccountID): JsonSafe { const obj: any = {}; message.scope !== undefined && (obj.scope = message.scope); message.xid !== undefined && (obj.xid = message.xid); @@ -293,7 +294,7 @@ export const Account = { settledAt: isSet(object.settledAt) ? Long.fromValue(object.settledAt) : Long.ZERO }; }, - toJSON(message: Account): unknown { + toJSON(message: Account): JsonSafe { const obj: any = {}; message.id !== undefined && (obj.id = message.id ? AccountID.toJSON(message.id) : undefined); message.owner !== undefined && (obj.owner = message.owner); @@ -416,7 +417,7 @@ export const Payment = { withdrawn: isSet(object.withdrawn) ? Coin.fromJSON(object.withdrawn) : undefined }; }, - toJSON(message: Payment): unknown { + toJSON(message: Payment): JsonSafe { const obj: any = {}; message.accountId !== undefined && (obj.accountId = message.accountId ? AccountID.toJSON(message.accountId) : undefined); message.paymentId !== undefined && (obj.paymentId = message.paymentId); diff --git a/__fixtures__/output1/akash/escrow/v1beta2/genesis.ts b/__fixtures__/output1/akash/escrow/v1beta2/genesis.ts index 9a6e6b0958..88b125ed8b 100644 --- a/__fixtures__/output1/akash/escrow/v1beta2/genesis.ts +++ b/__fixtures__/output1/akash/escrow/v1beta2/genesis.ts @@ -1,5 +1,6 @@ import { Account, AccountSDKType, FractionalPayment, FractionalPaymentSDKType } from "./types"; import * as _m0 from "protobufjs/minimal"; +import { JsonSafe } from "../../../json-safe"; import { DeepPartial, Exact } from "../../../helpers"; export const protobufPackage = "akash.escrow.v1beta2"; /** GenesisState defines the basic genesis state used by escrow module */ @@ -54,7 +55,7 @@ export const GenesisState = { payments: Array.isArray(object?.payments) ? object.payments.map((e: any) => FractionalPayment.fromJSON(e)) : [] }; }, - toJSON(message: GenesisState): unknown { + toJSON(message: GenesisState): JsonSafe { const obj: any = {}; if (message.accounts) { obj.accounts = message.accounts.map(e => e ? Account.toJSON(e) : undefined); diff --git a/__fixtures__/output1/akash/escrow/v1beta2/query.ts b/__fixtures__/output1/akash/escrow/v1beta2/query.ts index 16ea4ac01b..bb4476a790 100644 --- a/__fixtures__/output1/akash/escrow/v1beta2/query.ts +++ b/__fixtures__/output1/akash/escrow/v1beta2/query.ts @@ -2,6 +2,7 @@ import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } fr import { Account, AccountSDKType, FractionalPayment, FractionalPaymentSDKType } from "./types"; import * as _m0 from "protobufjs/minimal"; import { isSet, DeepPartial, Exact } from "../../../helpers"; +import { JsonSafe } from "../../../json-safe"; export const protobufPackage = "akash.escrow.v1beta2"; /** QueryAccountRequest is request type for the Query/Account RPC method */ export interface QueryAccountsRequest { @@ -123,7 +124,7 @@ export const QueryAccountsRequest = { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; }, - toJSON(message: QueryAccountsRequest): unknown { + toJSON(message: QueryAccountsRequest): JsonSafe { const obj: any = {}; message.scope !== undefined && (obj.scope = message.scope); message.xid !== undefined && (obj.xid = message.xid); @@ -202,7 +203,7 @@ export const QueryAccountsResponse = { pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined }; }, - toJSON(message: QueryAccountsResponse): unknown { + toJSON(message: QueryAccountsResponse): JsonSafe { const obj: any = {}; if (message.accounts) { obj.accounts = message.accounts.map(e => e ? Account.toJSON(e) : undefined); @@ -309,7 +310,7 @@ export const QueryPaymentsRequest = { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; }, - toJSON(message: QueryPaymentsRequest): unknown { + toJSON(message: QueryPaymentsRequest): JsonSafe { const obj: any = {}; message.scope !== undefined && (obj.scope = message.scope); message.xid !== undefined && (obj.xid = message.xid); @@ -392,7 +393,7 @@ export const QueryPaymentsResponse = { pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined }; }, - toJSON(message: QueryPaymentsResponse): unknown { + toJSON(message: QueryPaymentsResponse): JsonSafe { const obj: any = {}; if (message.payments) { obj.payments = message.payments.map(e => e ? FractionalPayment.toJSON(e) : undefined); diff --git a/__fixtures__/output1/akash/escrow/v1beta2/types.ts b/__fixtures__/output1/akash/escrow/v1beta2/types.ts index 28061fed97..1fc7173060 100644 --- a/__fixtures__/output1/akash/escrow/v1beta2/types.ts +++ b/__fixtures__/output1/akash/escrow/v1beta2/types.ts @@ -1,6 +1,7 @@ import { DecCoin, DecCoinSDKType, Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { Long, isSet, DeepPartial, Exact } from "../../../helpers"; import * as _m0 from "protobufjs/minimal"; +import { JsonSafe } from "../../../json-safe"; export const protobufPackage = "akash.escrow.v1beta2"; /** State stores state for an escrow account */ export enum Account_State { @@ -207,7 +208,7 @@ export const AccountID = { xid: isSet(object.xid) ? String(object.xid) : "" }; }, - toJSON(message: AccountID): unknown { + toJSON(message: AccountID): JsonSafe { const obj: any = {}; message.scope !== undefined && (obj.scope = message.scope); message.xid !== undefined && (obj.xid = message.xid); @@ -322,7 +323,7 @@ export const Account = { funds: isSet(object.funds) ? DecCoin.fromJSON(object.funds) : undefined }; }, - toJSON(message: Account): unknown { + toJSON(message: Account): JsonSafe { const obj: any = {}; message.id !== undefined && (obj.id = message.id ? AccountID.toJSON(message.id) : undefined); message.owner !== undefined && (obj.owner = message.owner); @@ -453,7 +454,7 @@ export const FractionalPayment = { withdrawn: isSet(object.withdrawn) ? Coin.fromJSON(object.withdrawn) : undefined }; }, - toJSON(message: FractionalPayment): unknown { + toJSON(message: FractionalPayment): JsonSafe { const obj: any = {}; message.accountId !== undefined && (obj.accountId = message.accountId ? AccountID.toJSON(message.accountId) : undefined); message.paymentId !== undefined && (obj.paymentId = message.paymentId); diff --git a/__fixtures__/output1/akash/inflation/v1beta2/genesis.ts b/__fixtures__/output1/akash/inflation/v1beta2/genesis.ts index c8c94e8cbc..6ec4e6afe1 100644 --- a/__fixtures__/output1/akash/inflation/v1beta2/genesis.ts +++ b/__fixtures__/output1/akash/inflation/v1beta2/genesis.ts @@ -1,6 +1,7 @@ import { Params, ParamsSDKType } from "./params"; import * as _m0 from "protobufjs/minimal"; import { isSet, DeepPartial, Exact } from "../../../helpers"; +import { JsonSafe } from "../../../json-safe"; export const protobufPackage = "akash.inflation.v1beta2"; /** GenesisState stores slice of genesis deployment instance */ export interface GenesisState { @@ -44,7 +45,7 @@ export const GenesisState = { params: isSet(object.params) ? Params.fromJSON(object.params) : undefined }; }, - toJSON(message: GenesisState): unknown { + toJSON(message: GenesisState): JsonSafe { const obj: any = {}; message.params !== undefined && (obj.params = message.params ? Params.toJSON(message.params) : undefined); return obj; diff --git a/__fixtures__/output1/akash/inflation/v1beta2/params.ts b/__fixtures__/output1/akash/inflation/v1beta2/params.ts index 8ffc1900c0..477460a848 100644 --- a/__fixtures__/output1/akash/inflation/v1beta2/params.ts +++ b/__fixtures__/output1/akash/inflation/v1beta2/params.ts @@ -1,5 +1,6 @@ import * as _m0 from "protobufjs/minimal"; import { isSet, DeepPartial, Exact } from "../../../helpers"; +import { JsonSafe } from "../../../json-safe"; export const protobufPackage = "akash.inflation.v1beta2"; /** Params defines the parameters for the x/deployment package */ export interface Params { @@ -72,7 +73,7 @@ export const Params = { variance: isSet(object.variance) ? String(object.variance) : "" }; }, - toJSON(message: Params): unknown { + toJSON(message: Params): JsonSafe { const obj: any = {}; message.inflationDecayFactor !== undefined && (obj.inflationDecayFactor = message.inflationDecayFactor); message.initialInflation !== undefined && (obj.initialInflation = message.initialInflation); diff --git a/__fixtures__/output1/akash/market/v1beta2/bid.ts b/__fixtures__/output1/akash/market/v1beta2/bid.ts index b73bf667ee..b02aaf4a77 100644 --- a/__fixtures__/output1/akash/market/v1beta2/bid.ts +++ b/__fixtures__/output1/akash/market/v1beta2/bid.ts @@ -2,6 +2,7 @@ import { OrderID, OrderIDSDKType } from "./order"; import { DecCoin, DecCoinSDKType, Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { Long, isSet, DeepPartial, Exact } from "../../../helpers"; import * as _m0 from "protobufjs/minimal"; +import { JsonSafe } from "../../../json-safe"; export const protobufPackage = "akash.market.v1beta2"; /** State is an enum which refers to state of bid */ export enum Bid_State { @@ -200,7 +201,7 @@ export const MsgCreateBid = { deposit: isSet(object.deposit) ? Coin.fromJSON(object.deposit) : undefined }; }, - toJSON(message: MsgCreateBid): unknown { + toJSON(message: MsgCreateBid): JsonSafe { const obj: any = {}; message.order !== undefined && (obj.order = message.order ? OrderID.toJSON(message.order) : undefined); message.provider !== undefined && (obj.provider = message.provider); @@ -257,7 +258,7 @@ export const MsgCreateBidResponse = { fromJSON(_: any): MsgCreateBidResponse { return {}; }, - toJSON(_: MsgCreateBidResponse): unknown { + toJSON(_: MsgCreateBidResponse): JsonSafe { const obj: any = {}; return obj; }, @@ -307,7 +308,7 @@ export const MsgCloseBid = { bidId: isSet(object.bidId) ? BidID.fromJSON(object.bidId) : undefined }; }, - toJSON(message: MsgCloseBid): unknown { + toJSON(message: MsgCloseBid): JsonSafe { const obj: any = {}; message.bidId !== undefined && (obj.bidId = message.bidId ? BidID.toJSON(message.bidId) : undefined); return obj; @@ -352,7 +353,7 @@ export const MsgCloseBidResponse = { fromJSON(_: any): MsgCloseBidResponse { return {}; }, - toJSON(_: MsgCloseBidResponse): unknown { + toJSON(_: MsgCloseBidResponse): JsonSafe { const obj: any = {}; return obj; }, @@ -434,7 +435,7 @@ export const BidID = { provider: isSet(object.provider) ? String(object.provider) : "" }; }, - toJSON(message: BidID): unknown { + toJSON(message: BidID): JsonSafe { const obj: any = {}; message.owner !== undefined && (obj.owner = message.owner); message.dseq !== undefined && (obj.dseq = (message.dseq || Long.UZERO).toString()); @@ -529,7 +530,7 @@ export const Bid = { createdAt: isSet(object.createdAt) ? Long.fromValue(object.createdAt) : Long.ZERO }; }, - toJSON(message: Bid): unknown { + toJSON(message: Bid): JsonSafe { const obj: any = {}; message.bidId !== undefined && (obj.bidId = message.bidId ? BidID.toJSON(message.bidId) : undefined); message.state !== undefined && (obj.state = bid_StateToJSON(message.state)); @@ -636,7 +637,7 @@ export const BidFilters = { state: isSet(object.state) ? String(object.state) : "" }; }, - toJSON(message: BidFilters): unknown { + toJSON(message: BidFilters): JsonSafe { const obj: any = {}; message.owner !== undefined && (obj.owner = message.owner); message.dseq !== undefined && (obj.dseq = (message.dseq || Long.UZERO).toString()); diff --git a/__fixtures__/output1/akash/market/v1beta2/genesis.ts b/__fixtures__/output1/akash/market/v1beta2/genesis.ts index 5b806ace97..818eb58ac7 100644 --- a/__fixtures__/output1/akash/market/v1beta2/genesis.ts +++ b/__fixtures__/output1/akash/market/v1beta2/genesis.ts @@ -3,6 +3,7 @@ import { Lease, LeaseSDKType } from "./lease"; import { Params, ParamsSDKType } from "./params"; import * as _m0 from "protobufjs/minimal"; import { isSet, DeepPartial, Exact } from "../../../helpers"; +import { JsonSafe } from "../../../json-safe"; export const protobufPackage = "akash.market.v1beta2"; /** GenesisState defines the basic genesis state used by market module */ export interface GenesisState { @@ -66,7 +67,7 @@ export const GenesisState = { params: isSet(object.params) ? Params.fromJSON(object.params) : undefined }; }, - toJSON(message: GenesisState): unknown { + toJSON(message: GenesisState): JsonSafe { const obj: any = {}; if (message.orders) { obj.orders = message.orders.map(e => e ? Order.toJSON(e) : undefined); diff --git a/__fixtures__/output1/akash/market/v1beta2/lease.ts b/__fixtures__/output1/akash/market/v1beta2/lease.ts index a9042244ff..79c3d2f48b 100644 --- a/__fixtures__/output1/akash/market/v1beta2/lease.ts +++ b/__fixtures__/output1/akash/market/v1beta2/lease.ts @@ -2,6 +2,7 @@ import { DecCoin, DecCoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { BidID, BidIDSDKType } from "./bid"; import { Long, isSet, DeepPartial, Exact } from "../../../helpers"; import * as _m0 from "protobufjs/minimal"; +import { JsonSafe } from "../../../json-safe"; export const protobufPackage = "akash.market.v1beta2"; /** State is an enum which refers to state of lease */ export enum Lease_State { @@ -203,7 +204,7 @@ export const LeaseID = { provider: isSet(object.provider) ? String(object.provider) : "" }; }, - toJSON(message: LeaseID): unknown { + toJSON(message: LeaseID): JsonSafe { const obj: any = {}; message.owner !== undefined && (obj.owner = message.owner); message.dseq !== undefined && (obj.dseq = (message.dseq || Long.UZERO).toString()); @@ -306,7 +307,7 @@ export const Lease = { closedOn: isSet(object.closedOn) ? Long.fromValue(object.closedOn) : Long.ZERO }; }, - toJSON(message: Lease): unknown { + toJSON(message: Lease): JsonSafe { const obj: any = {}; message.leaseId !== undefined && (obj.leaseId = message.leaseId ? LeaseID.toJSON(message.leaseId) : undefined); message.state !== undefined && (obj.state = lease_StateToJSON(message.state)); @@ -417,7 +418,7 @@ export const LeaseFilters = { state: isSet(object.state) ? String(object.state) : "" }; }, - toJSON(message: LeaseFilters): unknown { + toJSON(message: LeaseFilters): JsonSafe { const obj: any = {}; message.owner !== undefined && (obj.owner = message.owner); message.dseq !== undefined && (obj.dseq = (message.dseq || Long.UZERO).toString()); @@ -492,7 +493,7 @@ export const MsgCreateLease = { bidId: isSet(object.bidId) ? BidID.fromJSON(object.bidId) : undefined }; }, - toJSON(message: MsgCreateLease): unknown { + toJSON(message: MsgCreateLease): JsonSafe { const obj: any = {}; message.bidId !== undefined && (obj.bidId = message.bidId ? BidID.toJSON(message.bidId) : undefined); return obj; @@ -537,7 +538,7 @@ export const MsgCreateLeaseResponse = { fromJSON(_: any): MsgCreateLeaseResponse { return {}; }, - toJSON(_: MsgCreateLeaseResponse): unknown { + toJSON(_: MsgCreateLeaseResponse): JsonSafe { const obj: any = {}; return obj; }, @@ -587,7 +588,7 @@ export const MsgWithdrawLease = { bidId: isSet(object.bidId) ? LeaseID.fromJSON(object.bidId) : undefined }; }, - toJSON(message: MsgWithdrawLease): unknown { + toJSON(message: MsgWithdrawLease): JsonSafe { const obj: any = {}; message.bidId !== undefined && (obj.bidId = message.bidId ? LeaseID.toJSON(message.bidId) : undefined); return obj; @@ -632,7 +633,7 @@ export const MsgWithdrawLeaseResponse = { fromJSON(_: any): MsgWithdrawLeaseResponse { return {}; }, - toJSON(_: MsgWithdrawLeaseResponse): unknown { + toJSON(_: MsgWithdrawLeaseResponse): JsonSafe { const obj: any = {}; return obj; }, @@ -682,7 +683,7 @@ export const MsgCloseLease = { leaseId: isSet(object.leaseId) ? LeaseID.fromJSON(object.leaseId) : undefined }; }, - toJSON(message: MsgCloseLease): unknown { + toJSON(message: MsgCloseLease): JsonSafe { const obj: any = {}; message.leaseId !== undefined && (obj.leaseId = message.leaseId ? LeaseID.toJSON(message.leaseId) : undefined); return obj; @@ -727,7 +728,7 @@ export const MsgCloseLeaseResponse = { fromJSON(_: any): MsgCloseLeaseResponse { return {}; }, - toJSON(_: MsgCloseLeaseResponse): unknown { + toJSON(_: MsgCloseLeaseResponse): JsonSafe { const obj: any = {}; return obj; }, diff --git a/__fixtures__/output1/akash/market/v1beta2/order.ts b/__fixtures__/output1/akash/market/v1beta2/order.ts index cee653dcc5..5a345c30bc 100644 --- a/__fixtures__/output1/akash/market/v1beta2/order.ts +++ b/__fixtures__/output1/akash/market/v1beta2/order.ts @@ -1,6 +1,7 @@ import { GroupSpec, GroupSpecSDKType } from "../../deployment/v1beta2/groupspec"; import { Long, isSet, DeepPartial, Exact } from "../../../helpers"; import * as _m0 from "protobufjs/minimal"; +import { JsonSafe } from "../../../json-safe"; export const protobufPackage = "akash.market.v1beta2"; /** State is an enum which refers to state of order */ export enum Order_State { @@ -152,7 +153,7 @@ export const OrderID = { oseq: isSet(object.oseq) ? Number(object.oseq) : 0 }; }, - toJSON(message: OrderID): unknown { + toJSON(message: OrderID): JsonSafe { const obj: any = {}; message.owner !== undefined && (obj.owner = message.owner); message.dseq !== undefined && (obj.dseq = (message.dseq || Long.UZERO).toString()); @@ -243,7 +244,7 @@ export const Order = { createdAt: isSet(object.createdAt) ? Long.fromValue(object.createdAt) : Long.ZERO }; }, - toJSON(message: Order): unknown { + toJSON(message: Order): JsonSafe { const obj: any = {}; message.orderId !== undefined && (obj.orderId = message.orderId ? OrderID.toJSON(message.orderId) : undefined); message.state !== undefined && (obj.state = order_StateToJSON(message.state)); @@ -342,7 +343,7 @@ export const OrderFilters = { state: isSet(object.state) ? String(object.state) : "" }; }, - toJSON(message: OrderFilters): unknown { + toJSON(message: OrderFilters): JsonSafe { const obj: any = {}; message.owner !== undefined && (obj.owner = message.owner); message.dseq !== undefined && (obj.dseq = (message.dseq || Long.UZERO).toString()); diff --git a/__fixtures__/output1/akash/market/v1beta2/params.ts b/__fixtures__/output1/akash/market/v1beta2/params.ts index d0fbbcd1f6..cfa360519c 100644 --- a/__fixtures__/output1/akash/market/v1beta2/params.ts +++ b/__fixtures__/output1/akash/market/v1beta2/params.ts @@ -1,6 +1,7 @@ import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import * as _m0 from "protobufjs/minimal"; import { isSet, DeepPartial, Exact } from "../../../helpers"; +import { JsonSafe } from "../../../json-safe"; export const protobufPackage = "akash.market.v1beta2"; /** Params is the params for the x/market module */ export interface Params { @@ -54,7 +55,7 @@ export const Params = { orderMaxBids: isSet(object.orderMaxBids) ? Number(object.orderMaxBids) : 0 }; }, - toJSON(message: Params): unknown { + toJSON(message: Params): JsonSafe { const obj: any = {}; message.bidMinDeposit !== undefined && (obj.bidMinDeposit = message.bidMinDeposit ? Coin.toJSON(message.bidMinDeposit) : undefined); message.orderMaxBids !== undefined && (obj.orderMaxBids = Math.round(message.orderMaxBids)); diff --git a/__fixtures__/output1/akash/market/v1beta2/query.ts b/__fixtures__/output1/akash/market/v1beta2/query.ts index 41942c5516..523a6f0c1c 100644 --- a/__fixtures__/output1/akash/market/v1beta2/query.ts +++ b/__fixtures__/output1/akash/market/v1beta2/query.ts @@ -5,6 +5,7 @@ import { LeaseFilters, LeaseFiltersSDKType, LeaseID, LeaseIDSDKType, Lease, Leas import { Account, AccountSDKType, FractionalPayment, FractionalPaymentSDKType } from "../../escrow/v1beta2/types"; import * as _m0 from "protobufjs/minimal"; import { isSet, DeepPartial, Exact } from "../../../helpers"; +import { JsonSafe } from "../../../json-safe"; export const protobufPackage = "akash.market.v1beta2"; /** QueryOrdersRequest is request type for the Query/Orders RPC method */ export interface QueryOrdersRequest { @@ -160,7 +161,7 @@ export const QueryOrdersRequest = { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; }, - toJSON(message: QueryOrdersRequest): unknown { + toJSON(message: QueryOrdersRequest): JsonSafe { const obj: any = {}; message.filters !== undefined && (obj.filters = message.filters ? OrderFilters.toJSON(message.filters) : undefined); message.pagination !== undefined && (obj.pagination = message.pagination ? PageRequest.toJSON(message.pagination) : undefined); @@ -227,7 +228,7 @@ export const QueryOrdersResponse = { pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined }; }, - toJSON(message: QueryOrdersResponse): unknown { + toJSON(message: QueryOrdersResponse): JsonSafe { const obj: any = {}; if (message.orders) { obj.orders = message.orders.map(e => e ? Order.toJSON(e) : undefined); @@ -294,7 +295,7 @@ export const QueryOrderRequest = { id: isSet(object.id) ? OrderID.fromJSON(object.id) : undefined }; }, - toJSON(message: QueryOrderRequest): unknown { + toJSON(message: QueryOrderRequest): JsonSafe { const obj: any = {}; message.id !== undefined && (obj.id = message.id ? OrderID.toJSON(message.id) : undefined); return obj; @@ -349,7 +350,7 @@ export const QueryOrderResponse = { order: isSet(object.order) ? Order.fromJSON(object.order) : undefined }; }, - toJSON(message: QueryOrderResponse): unknown { + toJSON(message: QueryOrderResponse): JsonSafe { const obj: any = {}; message.order !== undefined && (obj.order = message.order ? Order.toJSON(message.order) : undefined); return obj; @@ -412,7 +413,7 @@ export const QueryBidsRequest = { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; }, - toJSON(message: QueryBidsRequest): unknown { + toJSON(message: QueryBidsRequest): JsonSafe { const obj: any = {}; message.filters !== undefined && (obj.filters = message.filters ? BidFilters.toJSON(message.filters) : undefined); message.pagination !== undefined && (obj.pagination = message.pagination ? PageRequest.toJSON(message.pagination) : undefined); @@ -479,7 +480,7 @@ export const QueryBidsResponse = { pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined }; }, - toJSON(message: QueryBidsResponse): unknown { + toJSON(message: QueryBidsResponse): JsonSafe { const obj: any = {}; if (message.bids) { obj.bids = message.bids.map(e => e ? QueryBidResponse.toJSON(e) : undefined); @@ -546,7 +547,7 @@ export const QueryBidRequest = { id: isSet(object.id) ? BidID.fromJSON(object.id) : undefined }; }, - toJSON(message: QueryBidRequest): unknown { + toJSON(message: QueryBidRequest): JsonSafe { const obj: any = {}; message.id !== undefined && (obj.id = message.id ? BidID.toJSON(message.id) : undefined); return obj; @@ -609,7 +610,7 @@ export const QueryBidResponse = { escrowAccount: isSet(object.escrowAccount) ? Account.fromJSON(object.escrowAccount) : undefined }; }, - toJSON(message: QueryBidResponse): unknown { + toJSON(message: QueryBidResponse): JsonSafe { const obj: any = {}; message.bid !== undefined && (obj.bid = message.bid ? Bid.toJSON(message.bid) : undefined); message.escrowAccount !== undefined && (obj.escrowAccount = message.escrowAccount ? Account.toJSON(message.escrowAccount) : undefined); @@ -676,7 +677,7 @@ export const QueryLeasesRequest = { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; }, - toJSON(message: QueryLeasesRequest): unknown { + toJSON(message: QueryLeasesRequest): JsonSafe { const obj: any = {}; message.filters !== undefined && (obj.filters = message.filters ? LeaseFilters.toJSON(message.filters) : undefined); message.pagination !== undefined && (obj.pagination = message.pagination ? PageRequest.toJSON(message.pagination) : undefined); @@ -743,7 +744,7 @@ export const QueryLeasesResponse = { pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined }; }, - toJSON(message: QueryLeasesResponse): unknown { + toJSON(message: QueryLeasesResponse): JsonSafe { const obj: any = {}; if (message.leases) { obj.leases = message.leases.map(e => e ? QueryLeaseResponse.toJSON(e) : undefined); @@ -810,7 +811,7 @@ export const QueryLeaseRequest = { id: isSet(object.id) ? LeaseID.fromJSON(object.id) : undefined }; }, - toJSON(message: QueryLeaseRequest): unknown { + toJSON(message: QueryLeaseRequest): JsonSafe { const obj: any = {}; message.id !== undefined && (obj.id = message.id ? LeaseID.toJSON(message.id) : undefined); return obj; @@ -873,7 +874,7 @@ export const QueryLeaseResponse = { escrowPayment: isSet(object.escrowPayment) ? FractionalPayment.fromJSON(object.escrowPayment) : undefined }; }, - toJSON(message: QueryLeaseResponse): unknown { + toJSON(message: QueryLeaseResponse): JsonSafe { const obj: any = {}; message.lease !== undefined && (obj.lease = message.lease ? Lease.toJSON(message.lease) : undefined); message.escrowPayment !== undefined && (obj.escrowPayment = message.escrowPayment ? FractionalPayment.toJSON(message.escrowPayment) : undefined); diff --git a/__fixtures__/output1/akash/provider/v1beta1/provider.ts b/__fixtures__/output1/akash/provider/v1beta1/provider.ts index 2c004347dc..c9171a4844 100644 --- a/__fixtures__/output1/akash/provider/v1beta1/provider.ts +++ b/__fixtures__/output1/akash/provider/v1beta1/provider.ts @@ -1,6 +1,7 @@ import { Attribute, AttributeSDKType } from "../../base/v1beta1/attribute"; import * as _m0 from "protobufjs/minimal"; import { isSet, DeepPartial, Exact } from "../../../helpers"; +import { JsonSafe } from "../../../json-safe"; export const protobufPackage = "akash.provider.v1beta1"; /** ProviderInfo */ export interface ProviderInfo { @@ -116,7 +117,7 @@ export const ProviderInfo = { website: isSet(object.website) ? String(object.website) : "" }; }, - toJSON(message: ProviderInfo): unknown { + toJSON(message: ProviderInfo): JsonSafe { const obj: any = {}; message.email !== undefined && (obj.email = message.email); message.website !== undefined && (obj.website = message.website); @@ -199,7 +200,7 @@ export const MsgCreateProvider = { info: isSet(object.info) ? ProviderInfo.fromJSON(object.info) : undefined }; }, - toJSON(message: MsgCreateProvider): unknown { + toJSON(message: MsgCreateProvider): JsonSafe { const obj: any = {}; message.owner !== undefined && (obj.owner = message.owner); message.hostUri !== undefined && (obj.hostUri = message.hostUri); @@ -264,7 +265,7 @@ export const MsgCreateProviderResponse = { fromJSON(_: any): MsgCreateProviderResponse { return {}; }, - toJSON(_: MsgCreateProviderResponse): unknown { + toJSON(_: MsgCreateProviderResponse): JsonSafe { const obj: any = {}; return obj; }, @@ -338,7 +339,7 @@ export const MsgUpdateProvider = { info: isSet(object.info) ? ProviderInfo.fromJSON(object.info) : undefined }; }, - toJSON(message: MsgUpdateProvider): unknown { + toJSON(message: MsgUpdateProvider): JsonSafe { const obj: any = {}; message.owner !== undefined && (obj.owner = message.owner); message.hostUri !== undefined && (obj.hostUri = message.hostUri); @@ -403,7 +404,7 @@ export const MsgUpdateProviderResponse = { fromJSON(_: any): MsgUpdateProviderResponse { return {}; }, - toJSON(_: MsgUpdateProviderResponse): unknown { + toJSON(_: MsgUpdateProviderResponse): JsonSafe { const obj: any = {}; return obj; }, @@ -453,7 +454,7 @@ export const MsgDeleteProvider = { owner: isSet(object.owner) ? String(object.owner) : "" }; }, - toJSON(message: MsgDeleteProvider): unknown { + toJSON(message: MsgDeleteProvider): JsonSafe { const obj: any = {}; message.owner !== undefined && (obj.owner = message.owner); return obj; @@ -498,7 +499,7 @@ export const MsgDeleteProviderResponse = { fromJSON(_: any): MsgDeleteProviderResponse { return {}; }, - toJSON(_: MsgDeleteProviderResponse): unknown { + toJSON(_: MsgDeleteProviderResponse): JsonSafe { const obj: any = {}; return obj; }, @@ -572,7 +573,7 @@ export const Provider = { info: isSet(object.info) ? ProviderInfo.fromJSON(object.info) : undefined }; }, - toJSON(message: Provider): unknown { + toJSON(message: Provider): JsonSafe { const obj: any = {}; message.owner !== undefined && (obj.owner = message.owner); message.hostUri !== undefined && (obj.hostUri = message.hostUri); diff --git a/__fixtures__/output1/akash/provider/v1beta2/genesis.ts b/__fixtures__/output1/akash/provider/v1beta2/genesis.ts index 9c53fdb468..60c34a1a2a 100644 --- a/__fixtures__/output1/akash/provider/v1beta2/genesis.ts +++ b/__fixtures__/output1/akash/provider/v1beta2/genesis.ts @@ -1,5 +1,6 @@ import { Provider, ProviderSDKType } from "./provider"; import * as _m0 from "protobufjs/minimal"; +import { JsonSafe } from "../../../json-safe"; import { DeepPartial, Exact } from "../../../helpers"; export const protobufPackage = "akash.provider.v1beta2"; /** GenesisState defines the basic genesis state used by provider module */ @@ -44,7 +45,7 @@ export const GenesisState = { providers: Array.isArray(object?.providers) ? object.providers.map((e: any) => Provider.fromJSON(e)) : [] }; }, - toJSON(message: GenesisState): unknown { + toJSON(message: GenesisState): JsonSafe { const obj: any = {}; if (message.providers) { obj.providers = message.providers.map(e => e ? Provider.toJSON(e) : undefined); diff --git a/__fixtures__/output1/akash/provider/v1beta2/provider.ts b/__fixtures__/output1/akash/provider/v1beta2/provider.ts index c86f8fa188..28f312059a 100644 --- a/__fixtures__/output1/akash/provider/v1beta2/provider.ts +++ b/__fixtures__/output1/akash/provider/v1beta2/provider.ts @@ -1,6 +1,7 @@ import { Attribute, AttributeSDKType } from "../../base/v1beta2/attribute"; import * as _m0 from "protobufjs/minimal"; import { isSet, DeepPartial, Exact } from "../../../helpers"; +import { JsonSafe } from "../../../json-safe"; export const protobufPackage = "akash.provider.v1beta2"; /** ProviderInfo */ export interface ProviderInfo { @@ -116,7 +117,7 @@ export const ProviderInfo = { website: isSet(object.website) ? String(object.website) : "" }; }, - toJSON(message: ProviderInfo): unknown { + toJSON(message: ProviderInfo): JsonSafe { const obj: any = {}; message.email !== undefined && (obj.email = message.email); message.website !== undefined && (obj.website = message.website); @@ -199,7 +200,7 @@ export const MsgCreateProvider = { info: isSet(object.info) ? ProviderInfo.fromJSON(object.info) : undefined }; }, - toJSON(message: MsgCreateProvider): unknown { + toJSON(message: MsgCreateProvider): JsonSafe { const obj: any = {}; message.owner !== undefined && (obj.owner = message.owner); message.hostUri !== undefined && (obj.hostUri = message.hostUri); @@ -264,7 +265,7 @@ export const MsgCreateProviderResponse = { fromJSON(_: any): MsgCreateProviderResponse { return {}; }, - toJSON(_: MsgCreateProviderResponse): unknown { + toJSON(_: MsgCreateProviderResponse): JsonSafe { const obj: any = {}; return obj; }, @@ -338,7 +339,7 @@ export const MsgUpdateProvider = { info: isSet(object.info) ? ProviderInfo.fromJSON(object.info) : undefined }; }, - toJSON(message: MsgUpdateProvider): unknown { + toJSON(message: MsgUpdateProvider): JsonSafe { const obj: any = {}; message.owner !== undefined && (obj.owner = message.owner); message.hostUri !== undefined && (obj.hostUri = message.hostUri); @@ -403,7 +404,7 @@ export const MsgUpdateProviderResponse = { fromJSON(_: any): MsgUpdateProviderResponse { return {}; }, - toJSON(_: MsgUpdateProviderResponse): unknown { + toJSON(_: MsgUpdateProviderResponse): JsonSafe { const obj: any = {}; return obj; }, @@ -453,7 +454,7 @@ export const MsgDeleteProvider = { owner: isSet(object.owner) ? String(object.owner) : "" }; }, - toJSON(message: MsgDeleteProvider): unknown { + toJSON(message: MsgDeleteProvider): JsonSafe { const obj: any = {}; message.owner !== undefined && (obj.owner = message.owner); return obj; @@ -498,7 +499,7 @@ export const MsgDeleteProviderResponse = { fromJSON(_: any): MsgDeleteProviderResponse { return {}; }, - toJSON(_: MsgDeleteProviderResponse): unknown { + toJSON(_: MsgDeleteProviderResponse): JsonSafe { const obj: any = {}; return obj; }, @@ -572,7 +573,7 @@ export const Provider = { info: isSet(object.info) ? ProviderInfo.fromJSON(object.info) : undefined }; }, - toJSON(message: Provider): unknown { + toJSON(message: Provider): JsonSafe { const obj: any = {}; message.owner !== undefined && (obj.owner = message.owner); message.hostUri !== undefined && (obj.hostUri = message.hostUri); diff --git a/__fixtures__/output1/akash/provider/v1beta2/query.ts b/__fixtures__/output1/akash/provider/v1beta2/query.ts index 537831b38b..ce32c996ea 100644 --- a/__fixtures__/output1/akash/provider/v1beta2/query.ts +++ b/__fixtures__/output1/akash/provider/v1beta2/query.ts @@ -2,6 +2,7 @@ import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } fr import { Provider, ProviderSDKType } from "./provider"; import * as _m0 from "protobufjs/minimal"; import { isSet, DeepPartial, Exact } from "../../../helpers"; +import { JsonSafe } from "../../../json-safe"; export const protobufPackage = "akash.provider.v1beta2"; /** QueryProvidersRequest is request type for the Query/Providers RPC method */ export interface QueryProvidersRequest { @@ -71,7 +72,7 @@ export const QueryProvidersRequest = { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; }, - toJSON(message: QueryProvidersRequest): unknown { + toJSON(message: QueryProvidersRequest): JsonSafe { const obj: any = {}; message.pagination !== undefined && (obj.pagination = message.pagination ? PageRequest.toJSON(message.pagination) : undefined); return obj; @@ -134,7 +135,7 @@ export const QueryProvidersResponse = { pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined }; }, - toJSON(message: QueryProvidersResponse): unknown { + toJSON(message: QueryProvidersResponse): JsonSafe { const obj: any = {}; if (message.providers) { obj.providers = message.providers.map(e => e ? Provider.toJSON(e) : undefined); @@ -201,7 +202,7 @@ export const QueryProviderRequest = { owner: isSet(object.owner) ? String(object.owner) : "" }; }, - toJSON(message: QueryProviderRequest): unknown { + toJSON(message: QueryProviderRequest): JsonSafe { const obj: any = {}; message.owner !== undefined && (obj.owner = message.owner); return obj; @@ -256,7 +257,7 @@ export const QueryProviderResponse = { provider: isSet(object.provider) ? Provider.fromJSON(object.provider) : undefined }; }, - toJSON(message: QueryProviderResponse): unknown { + toJSON(message: QueryProviderResponse): JsonSafe { const obj: any = {}; message.provider !== undefined && (obj.provider = message.provider ? Provider.toJSON(message.provider) : undefined); return obj; diff --git a/__fixtures__/output1/confio/proofs.ts b/__fixtures__/output1/confio/proofs.ts index b1d6709b12..699548d225 100644 --- a/__fixtures__/output1/confio/proofs.ts +++ b/__fixtures__/output1/confio/proofs.ts @@ -1,5 +1,6 @@ import * as _m0 from "protobufjs/minimal"; import { isSet, bytesFromBase64, base64FromBytes, DeepPartial } from "../helpers"; +import { JsonSafe } from "../json-safe"; export const protobufPackage = "ics23"; export enum HashOp { /** NO_HASH - NO_HASH is the default if no data passed. Note this is an illegal argument some places. */ @@ -532,7 +533,7 @@ export const ExistenceProof = { path: Array.isArray(object?.path) ? object.path.map((e: any) => InnerOp.fromJSON(e)) : [] }; }, - toJSON(message: ExistenceProof): unknown { + toJSON(message: ExistenceProof): JsonSafe { const obj: any = {}; message.key !== undefined && (obj.key = base64FromBytes(message.key !== undefined ? message.key : new Uint8Array())); message.value !== undefined && (obj.value = base64FromBytes(message.value !== undefined ? message.value : new Uint8Array())); @@ -623,7 +624,7 @@ export const NonExistenceProof = { right: isSet(object.right) ? ExistenceProof.fromJSON(object.right) : undefined }; }, - toJSON(message: NonExistenceProof): unknown { + toJSON(message: NonExistenceProof): JsonSafe { const obj: any = {}; message.key !== undefined && (obj.key = base64FromBytes(message.key !== undefined ? message.key : new Uint8Array())); message.left !== undefined && (obj.left = message.left ? ExistenceProof.toJSON(message.left) : undefined); @@ -710,7 +711,7 @@ export const CommitmentProof = { compressed: isSet(object.compressed) ? CompressedBatchProof.fromJSON(object.compressed) : undefined }; }, - toJSON(message: CommitmentProof): unknown { + toJSON(message: CommitmentProof): JsonSafe { const obj: any = {}; message.exist !== undefined && (obj.exist = message.exist ? ExistenceProof.toJSON(message.exist) : undefined); message.nonexist !== undefined && (obj.nonexist = message.nonexist ? NonExistenceProof.toJSON(message.nonexist) : undefined); @@ -809,7 +810,7 @@ export const LeafOp = { prefix: isSet(object.prefix) ? bytesFromBase64(object.prefix) : new Uint8Array() }; }, - toJSON(message: LeafOp): unknown { + toJSON(message: LeafOp): JsonSafe { const obj: any = {}; message.hash !== undefined && (obj.hash = hashOpToJSON(message.hash)); message.prehashKey !== undefined && (obj.prehashKey = hashOpToJSON(message.prehashKey)); @@ -896,7 +897,7 @@ export const InnerOp = { suffix: isSet(object.suffix) ? bytesFromBase64(object.suffix) : new Uint8Array() }; }, - toJSON(message: InnerOp): unknown { + toJSON(message: InnerOp): JsonSafe { const obj: any = {}; message.hash !== undefined && (obj.hash = hashOpToJSON(message.hash)); message.prefix !== undefined && (obj.prefix = base64FromBytes(message.prefix !== undefined ? message.prefix : new Uint8Array())); @@ -983,7 +984,7 @@ export const ProofSpec = { minDepth: isSet(object.minDepth) ? Number(object.minDepth) : 0 }; }, - toJSON(message: ProofSpec): unknown { + toJSON(message: ProofSpec): JsonSafe { const obj: any = {}; message.leafSpec !== undefined && (obj.leafSpec = message.leafSpec ? LeafOp.toJSON(message.leafSpec) : undefined); message.innerSpec !== undefined && (obj.innerSpec = message.innerSpec ? InnerSpec.toJSON(message.innerSpec) : undefined); @@ -1099,7 +1100,7 @@ export const InnerSpec = { hash: isSet(object.hash) ? hashOpFromJSON(object.hash) : -1 }; }, - toJSON(message: InnerSpec): unknown { + toJSON(message: InnerSpec): JsonSafe { const obj: any = {}; if (message.childOrder) { obj.childOrder = message.childOrder.map(e => Math.round(e)); @@ -1182,7 +1183,7 @@ export const BatchProof = { entries: Array.isArray(object?.entries) ? object.entries.map((e: any) => BatchEntry.fromJSON(e)) : [] }; }, - toJSON(message: BatchProof): unknown { + toJSON(message: BatchProof): JsonSafe { const obj: any = {}; if (message.entries) { obj.entries = message.entries.map(e => e ? BatchEntry.toJSON(e) : undefined); @@ -1253,7 +1254,7 @@ export const BatchEntry = { nonexist: isSet(object.nonexist) ? NonExistenceProof.fromJSON(object.nonexist) : undefined }; }, - toJSON(message: BatchEntry): unknown { + toJSON(message: BatchEntry): JsonSafe { const obj: any = {}; message.exist !== undefined && (obj.exist = message.exist ? ExistenceProof.toJSON(message.exist) : undefined); message.nonexist !== undefined && (obj.nonexist = message.nonexist ? NonExistenceProof.toJSON(message.nonexist) : undefined); @@ -1320,7 +1321,7 @@ export const CompressedBatchProof = { lookupInners: Array.isArray(object?.lookupInners) ? object.lookupInners.map((e: any) => InnerOp.fromJSON(e)) : [] }; }, - toJSON(message: CompressedBatchProof): unknown { + toJSON(message: CompressedBatchProof): JsonSafe { const obj: any = {}; if (message.entries) { obj.entries = message.entries.map(e => e ? CompressedBatchEntry.toJSON(e) : undefined); @@ -1403,7 +1404,7 @@ export const CompressedBatchEntry = { nonexist: isSet(object.nonexist) ? CompressedNonExistenceProof.fromJSON(object.nonexist) : undefined }; }, - toJSON(message: CompressedBatchEntry): unknown { + toJSON(message: CompressedBatchEntry): JsonSafe { const obj: any = {}; message.exist !== undefined && (obj.exist = message.exist ? CompressedExistenceProof.toJSON(message.exist) : undefined); message.nonexist !== undefined && (obj.nonexist = message.nonexist ? CompressedNonExistenceProof.toJSON(message.nonexist) : undefined); @@ -1495,7 +1496,7 @@ export const CompressedExistenceProof = { path: Array.isArray(object?.path) ? object.path.map((e: any) => Number(e)) : [] }; }, - toJSON(message: CompressedExistenceProof): unknown { + toJSON(message: CompressedExistenceProof): JsonSafe { const obj: any = {}; message.key !== undefined && (obj.key = base64FromBytes(message.key !== undefined ? message.key : new Uint8Array())); message.value !== undefined && (obj.value = base64FromBytes(message.value !== undefined ? message.value : new Uint8Array())); @@ -1586,7 +1587,7 @@ export const CompressedNonExistenceProof = { right: isSet(object.right) ? CompressedExistenceProof.fromJSON(object.right) : undefined }; }, - toJSON(message: CompressedNonExistenceProof): unknown { + toJSON(message: CompressedNonExistenceProof): JsonSafe { const obj: any = {}; message.key !== undefined && (obj.key = base64FromBytes(message.key !== undefined ? message.key : new Uint8Array())); message.left !== undefined && (obj.left = message.left ? CompressedExistenceProof.toJSON(message.left) : undefined); diff --git a/__fixtures__/output1/cosmos/app/v1alpha1/config.ts b/__fixtures__/output1/cosmos/app/v1alpha1/config.ts index 0fcb362b9b..30ea8eee72 100644 --- a/__fixtures__/output1/cosmos/app/v1alpha1/config.ts +++ b/__fixtures__/output1/cosmos/app/v1alpha1/config.ts @@ -1,5 +1,6 @@ import { Any, AnySDKType } from "../../../google/protobuf/any"; import * as _m0 from "protobufjs/minimal"; +import { JsonSafe } from "../../../json-safe"; import { DeepPartial, isSet } from "../../../helpers"; export const protobufPackage = "cosmos.app.v1alpha1"; /** @@ -87,7 +88,7 @@ export const Config = { modules: Array.isArray(object?.modules) ? object.modules.map((e: any) => ModuleConfig.fromJSON(e)) : [] }; }, - toJSON(message: Config): unknown { + toJSON(message: Config): JsonSafe { const obj: any = {}; if (message.modules) { obj.modules = message.modules.map(e => e ? ModuleConfig.toJSON(e) : undefined); @@ -158,7 +159,7 @@ export const ModuleConfig = { config: isSet(object.config) ? Any.fromJSON(object.config) : undefined }; }, - toJSON(message: ModuleConfig): unknown { + toJSON(message: ModuleConfig): JsonSafe { const obj: any = {}; message.name !== undefined && (obj.name = message.name); message.config !== undefined && (obj.config = message.config ? Any.toJSON(message.config) : undefined); diff --git a/__fixtures__/output1/cosmos/app/v1alpha1/module.ts b/__fixtures__/output1/cosmos/app/v1alpha1/module.ts index 9094845ad3..74a69d2147 100644 --- a/__fixtures__/output1/cosmos/app/v1alpha1/module.ts +++ b/__fixtures__/output1/cosmos/app/v1alpha1/module.ts @@ -1,5 +1,6 @@ import * as _m0 from "protobufjs/minimal"; import { isSet, DeepPartial } from "../../../helpers"; +import { JsonSafe } from "../../../json-safe"; export const protobufPackage = "cosmos.app.v1alpha1"; /** ModuleDescriptor describes an app module. */ export interface ModuleDescriptor { @@ -151,7 +152,7 @@ export const ModuleDescriptor = { canMigrateFrom: Array.isArray(object?.canMigrateFrom) ? object.canMigrateFrom.map((e: any) => MigrateFromInfo.fromJSON(e)) : [] }; }, - toJSON(message: ModuleDescriptor): unknown { + toJSON(message: ModuleDescriptor): JsonSafe { const obj: any = {}; message.goImport !== undefined && (obj.goImport = message.goImport); if (message.usePackage) { @@ -238,7 +239,7 @@ export const PackageReference = { revision: isSet(object.revision) ? Number(object.revision) : 0 }; }, - toJSON(message: PackageReference): unknown { + toJSON(message: PackageReference): JsonSafe { const obj: any = {}; message.name !== undefined && (obj.name = message.name); message.revision !== undefined && (obj.revision = Math.round(message.revision)); @@ -297,7 +298,7 @@ export const MigrateFromInfo = { module: isSet(object.module) ? String(object.module) : "" }; }, - toJSON(message: MigrateFromInfo): unknown { + toJSON(message: MigrateFromInfo): JsonSafe { const obj: any = {}; message.module !== undefined && (obj.module = message.module); return obj; diff --git a/__fixtures__/output1/cosmos/app/v1alpha1/query.ts b/__fixtures__/output1/cosmos/app/v1alpha1/query.ts index b56c0c57ed..b9d789284e 100644 --- a/__fixtures__/output1/cosmos/app/v1alpha1/query.ts +++ b/__fixtures__/output1/cosmos/app/v1alpha1/query.ts @@ -1,5 +1,6 @@ import { Config, ConfigSDKType } from "./config"; import * as _m0 from "protobufjs/minimal"; +import { JsonSafe } from "../../../json-safe"; import { DeepPartial, isSet } from "../../../helpers"; export const protobufPackage = "cosmos.app.v1alpha1"; /** QueryConfigRequest is the Query/Config request type. */ @@ -39,7 +40,7 @@ export const QueryConfigRequest = { fromJSON(_: any): QueryConfigRequest { return {}; }, - toJSON(_: QueryConfigRequest): unknown { + toJSON(_: QueryConfigRequest): JsonSafe { const obj: any = {}; return obj; }, @@ -89,7 +90,7 @@ export const QueryConfigResponse = { config: isSet(object.config) ? Config.fromJSON(object.config) : undefined }; }, - toJSON(message: QueryConfigResponse): unknown { + toJSON(message: QueryConfigResponse): JsonSafe { const obj: any = {}; message.config !== undefined && (obj.config = message.config ? Config.toJSON(message.config) : undefined); return obj; diff --git a/__fixtures__/output1/cosmos/auth/v1beta1/auth.ts b/__fixtures__/output1/cosmos/auth/v1beta1/auth.ts index 7d4e6e95ed..778580a88b 100644 --- a/__fixtures__/output1/cosmos/auth/v1beta1/auth.ts +++ b/__fixtures__/output1/cosmos/auth/v1beta1/auth.ts @@ -1,6 +1,7 @@ import { Any, AnySDKType } from "../../../google/protobuf/any"; import { Long, isSet, DeepPartial } from "../../../helpers"; import * as _m0 from "protobufjs/minimal"; +import { JsonSafe } from "../../../json-safe"; export const protobufPackage = "cosmos.auth.v1beta1"; /** * BaseAccount defines a base account type. It contains all the necessary fields @@ -110,7 +111,7 @@ export const BaseAccount = { sequence: isSet(object.sequence) ? Long.fromValue(object.sequence) : Long.UZERO }; }, - toJSON(message: BaseAccount): unknown { + toJSON(message: BaseAccount): JsonSafe { const obj: any = {}; message.address !== undefined && (obj.address = message.address); message.pubKey !== undefined && (obj.pubKey = message.pubKey ? Any.toJSON(message.pubKey) : undefined); @@ -193,7 +194,7 @@ export const ModuleAccount = { permissions: Array.isArray(object?.permissions) ? object.permissions.map((e: any) => String(e)) : [] }; }, - toJSON(message: ModuleAccount): unknown { + toJSON(message: ModuleAccount): JsonSafe { const obj: any = {}; message.baseAccount !== undefined && (obj.baseAccount = message.baseAccount ? BaseAccount.toJSON(message.baseAccount) : undefined); message.name !== undefined && (obj.name = message.name); @@ -296,7 +297,7 @@ export const Params = { sigVerifyCostSecp256k1: isSet(object.sigVerifyCostSecp256k1) ? Long.fromValue(object.sigVerifyCostSecp256k1) : Long.UZERO }; }, - toJSON(message: Params): unknown { + toJSON(message: Params): JsonSafe { const obj: any = {}; message.maxMemoCharacters !== undefined && (obj.maxMemoCharacters = (message.maxMemoCharacters || Long.UZERO).toString()); message.txSigLimit !== undefined && (obj.txSigLimit = (message.txSigLimit || Long.UZERO).toString()); diff --git a/__fixtures__/output1/cosmos/auth/v1beta1/genesis.ts b/__fixtures__/output1/cosmos/auth/v1beta1/genesis.ts index 6c17fc555b..a4782c8cd5 100644 --- a/__fixtures__/output1/cosmos/auth/v1beta1/genesis.ts +++ b/__fixtures__/output1/cosmos/auth/v1beta1/genesis.ts @@ -2,6 +2,7 @@ import { Params, ParamsSDKType } from "./auth"; import { Any, AnySDKType } from "../../../google/protobuf/any"; import * as _m0 from "protobufjs/minimal"; import { isSet, DeepPartial } from "../../../helpers"; +import { JsonSafe } from "../../../json-safe"; export const protobufPackage = "cosmos.auth.v1beta1"; /** GenesisState defines the auth module's genesis state. */ export interface GenesisState { @@ -57,7 +58,7 @@ export const GenesisState = { accounts: Array.isArray(object?.accounts) ? object.accounts.map((e: any) => Any.fromJSON(e)) : [] }; }, - toJSON(message: GenesisState): unknown { + toJSON(message: GenesisState): JsonSafe { const obj: any = {}; message.params !== undefined && (obj.params = message.params ? Params.toJSON(message.params) : undefined); if (message.accounts) { diff --git a/__fixtures__/output1/cosmos/auth/v1beta1/query.ts b/__fixtures__/output1/cosmos/auth/v1beta1/query.ts index 34ad1a05e6..847ee6c64e 100644 --- a/__fixtures__/output1/cosmos/auth/v1beta1/query.ts +++ b/__fixtures__/output1/cosmos/auth/v1beta1/query.ts @@ -3,6 +3,7 @@ import { Any, AnySDKType } from "../../../google/protobuf/any"; import { Params, ParamsSDKType } from "./auth"; import * as _m0 from "protobufjs/minimal"; import { isSet, DeepPartial, bytesFromBase64, base64FromBytes } from "../../../helpers"; +import { JsonSafe } from "../../../json-safe"; export const protobufPackage = "cosmos.auth.v1beta1"; /** * QueryAccountsRequest is the request type for the Query/Accounts RPC method. @@ -162,7 +163,7 @@ export const QueryAccountsRequest = { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; }, - toJSON(message: QueryAccountsRequest): unknown { + toJSON(message: QueryAccountsRequest): JsonSafe { const obj: any = {}; message.pagination !== undefined && (obj.pagination = message.pagination ? PageRequest.toJSON(message.pagination) : undefined); return obj; @@ -225,7 +226,7 @@ export const QueryAccountsResponse = { pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined }; }, - toJSON(message: QueryAccountsResponse): unknown { + toJSON(message: QueryAccountsResponse): JsonSafe { const obj: any = {}; if (message.accounts) { obj.accounts = message.accounts.map(e => e ? Any.toJSON(e) : undefined); @@ -292,7 +293,7 @@ export const QueryAccountRequest = { address: isSet(object.address) ? String(object.address) : "" }; }, - toJSON(message: QueryAccountRequest): unknown { + toJSON(message: QueryAccountRequest): JsonSafe { const obj: any = {}; message.address !== undefined && (obj.address = message.address); return obj; @@ -337,7 +338,7 @@ export const QueryModuleAccountsRequest = { fromJSON(_: any): QueryModuleAccountsRequest { return {}; }, - toJSON(_: QueryModuleAccountsRequest): unknown { + toJSON(_: QueryModuleAccountsRequest): JsonSafe { const obj: any = {}; return obj; }, @@ -387,7 +388,7 @@ export const QueryParamsResponse = { params: isSet(object.params) ? Params.fromJSON(object.params) : undefined }; }, - toJSON(message: QueryParamsResponse): unknown { + toJSON(message: QueryParamsResponse): JsonSafe { const obj: any = {}; message.params !== undefined && (obj.params = message.params ? Params.toJSON(message.params) : undefined); return obj; @@ -442,7 +443,7 @@ export const QueryAccountResponse = { account: isSet(object.account) ? Any.fromJSON(object.account) : undefined }; }, - toJSON(message: QueryAccountResponse): unknown { + toJSON(message: QueryAccountResponse): JsonSafe { const obj: any = {}; message.account !== undefined && (obj.account = message.account ? Any.toJSON(message.account) : undefined); return obj; @@ -487,7 +488,7 @@ export const QueryParamsRequest = { fromJSON(_: any): QueryParamsRequest { return {}; }, - toJSON(_: QueryParamsRequest): unknown { + toJSON(_: QueryParamsRequest): JsonSafe { const obj: any = {}; return obj; }, @@ -537,7 +538,7 @@ export const QueryModuleAccountsResponse = { accounts: Array.isArray(object?.accounts) ? object.accounts.map((e: any) => Any.fromJSON(e)) : [] }; }, - toJSON(message: QueryModuleAccountsResponse): unknown { + toJSON(message: QueryModuleAccountsResponse): JsonSafe { const obj: any = {}; if (message.accounts) { obj.accounts = message.accounts.map(e => e ? Any.toJSON(e) : undefined); @@ -590,7 +591,7 @@ export const Bech32PrefixRequest = { fromJSON(_: any): Bech32PrefixRequest { return {}; }, - toJSON(_: Bech32PrefixRequest): unknown { + toJSON(_: Bech32PrefixRequest): JsonSafe { const obj: any = {}; return obj; }, @@ -640,7 +641,7 @@ export const Bech32PrefixResponse = { bech32Prefix: isSet(object.bech32Prefix) ? String(object.bech32Prefix) : "" }; }, - toJSON(message: Bech32PrefixResponse): unknown { + toJSON(message: Bech32PrefixResponse): JsonSafe { const obj: any = {}; message.bech32Prefix !== undefined && (obj.bech32Prefix = message.bech32Prefix); return obj; @@ -695,7 +696,7 @@ export const AddressBytesToStringRequest = { addressBytes: isSet(object.addressBytes) ? bytesFromBase64(object.addressBytes) : new Uint8Array() }; }, - toJSON(message: AddressBytesToStringRequest): unknown { + toJSON(message: AddressBytesToStringRequest): JsonSafe { const obj: any = {}; message.addressBytes !== undefined && (obj.addressBytes = base64FromBytes(message.addressBytes !== undefined ? message.addressBytes : new Uint8Array())); return obj; @@ -750,7 +751,7 @@ export const AddressBytesToStringResponse = { addressString: isSet(object.addressString) ? String(object.addressString) : "" }; }, - toJSON(message: AddressBytesToStringResponse): unknown { + toJSON(message: AddressBytesToStringResponse): JsonSafe { const obj: any = {}; message.addressString !== undefined && (obj.addressString = message.addressString); return obj; @@ -805,7 +806,7 @@ export const AddressStringToBytesRequest = { addressString: isSet(object.addressString) ? String(object.addressString) : "" }; }, - toJSON(message: AddressStringToBytesRequest): unknown { + toJSON(message: AddressStringToBytesRequest): JsonSafe { const obj: any = {}; message.addressString !== undefined && (obj.addressString = message.addressString); return obj; @@ -860,7 +861,7 @@ export const AddressStringToBytesResponse = { addressBytes: isSet(object.addressBytes) ? bytesFromBase64(object.addressBytes) : new Uint8Array() }; }, - toJSON(message: AddressStringToBytesResponse): unknown { + toJSON(message: AddressStringToBytesResponse): JsonSafe { const obj: any = {}; message.addressBytes !== undefined && (obj.addressBytes = base64FromBytes(message.addressBytes !== undefined ? message.addressBytes : new Uint8Array())); return obj; diff --git a/__fixtures__/output1/cosmos/authz/v1beta1/authz.ts b/__fixtures__/output1/cosmos/authz/v1beta1/authz.ts index dfe97a4a4a..82e776b48f 100644 --- a/__fixtures__/output1/cosmos/authz/v1beta1/authz.ts +++ b/__fixtures__/output1/cosmos/authz/v1beta1/authz.ts @@ -2,6 +2,7 @@ import { Any, AnySDKType } from "../../../google/protobuf/any"; import { Timestamp, TimestampSDKType } from "../../../google/protobuf/timestamp"; import * as _m0 from "protobufjs/minimal"; import { isSet, DeepPartial, toTimestamp, fromTimestamp, fromJsonTimestamp } from "../../../helpers"; +import { JsonSafe } from "../../../json-safe"; export const protobufPackage = "cosmos.authz.v1beta1"; /** * GenericAuthorization gives the grantee unrestricted permissions to execute @@ -102,7 +103,7 @@ export const GenericAuthorization = { msg: isSet(object.msg) ? String(object.msg) : "" }; }, - toJSON(message: GenericAuthorization): unknown { + toJSON(message: GenericAuthorization): JsonSafe { const obj: any = {}; message.msg !== undefined && (obj.msg = message.msg); return obj; @@ -165,7 +166,7 @@ export const Grant = { expiration: isSet(object.expiration) ? fromJsonTimestamp(object.expiration) : undefined }; }, - toJSON(message: Grant): unknown { + toJSON(message: Grant): JsonSafe { const obj: any = {}; message.authorization !== undefined && (obj.authorization = message.authorization ? Any.toJSON(message.authorization) : undefined); message.expiration !== undefined && (obj.expiration = message.expiration.toISOString()); @@ -248,7 +249,7 @@ export const GrantAuthorization = { expiration: isSet(object.expiration) ? fromJsonTimestamp(object.expiration) : undefined }; }, - toJSON(message: GrantAuthorization): unknown { + toJSON(message: GrantAuthorization): JsonSafe { const obj: any = {}; message.granter !== undefined && (obj.granter = message.granter); message.grantee !== undefined && (obj.grantee = message.grantee); @@ -315,7 +316,7 @@ export const GrantQueueItem = { msgTypeUrls: Array.isArray(object?.msgTypeUrls) ? object.msgTypeUrls.map((e: any) => String(e)) : [] }; }, - toJSON(message: GrantQueueItem): unknown { + toJSON(message: GrantQueueItem): JsonSafe { const obj: any = {}; if (message.msgTypeUrls) { obj.msgTypeUrls = message.msgTypeUrls.map(e => e); diff --git a/__fixtures__/output1/cosmos/authz/v1beta1/genesis.ts b/__fixtures__/output1/cosmos/authz/v1beta1/genesis.ts index 78f37453b5..241e5cda72 100644 --- a/__fixtures__/output1/cosmos/authz/v1beta1/genesis.ts +++ b/__fixtures__/output1/cosmos/authz/v1beta1/genesis.ts @@ -1,5 +1,6 @@ import { GrantAuthorization, GrantAuthorizationSDKType } from "./authz"; import * as _m0 from "protobufjs/minimal"; +import { JsonSafe } from "../../../json-safe"; import { DeepPartial } from "../../../helpers"; export const protobufPackage = "cosmos.authz.v1beta1"; /** GenesisState defines the authz module's genesis state. */ @@ -44,7 +45,7 @@ export const GenesisState = { authorization: Array.isArray(object?.authorization) ? object.authorization.map((e: any) => GrantAuthorization.fromJSON(e)) : [] }; }, - toJSON(message: GenesisState): unknown { + toJSON(message: GenesisState): JsonSafe { const obj: any = {}; if (message.authorization) { obj.authorization = message.authorization.map(e => e ? GrantAuthorization.toJSON(e) : undefined); diff --git a/__fixtures__/output1/cosmos/authz/v1beta1/query.ts b/__fixtures__/output1/cosmos/authz/v1beta1/query.ts index d7981b8865..857d67f79f 100644 --- a/__fixtures__/output1/cosmos/authz/v1beta1/query.ts +++ b/__fixtures__/output1/cosmos/authz/v1beta1/query.ts @@ -2,6 +2,7 @@ import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } fr import { Grant, GrantSDKType, GrantAuthorization, GrantAuthorizationSDKType } from "./authz"; import * as _m0 from "protobufjs/minimal"; import { isSet, DeepPartial } from "../../../helpers"; +import { JsonSafe } from "../../../json-safe"; export const protobufPackage = "cosmos.authz.v1beta1"; /** QueryGrantsRequest is the request type for the Query/Grants RPC method. */ export interface QueryGrantsRequest { @@ -135,7 +136,7 @@ export const QueryGrantsRequest = { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; }, - toJSON(message: QueryGrantsRequest): unknown { + toJSON(message: QueryGrantsRequest): JsonSafe { const obj: any = {}; message.granter !== undefined && (obj.granter = message.granter); message.grantee !== undefined && (obj.grantee = message.grantee); @@ -210,7 +211,7 @@ export const QueryGrantsResponse = { pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined }; }, - toJSON(message: QueryGrantsResponse): unknown { + toJSON(message: QueryGrantsResponse): JsonSafe { const obj: any = {}; if (message.grants) { obj.grants = message.grants.map(e => e ? Grant.toJSON(e) : undefined); @@ -285,7 +286,7 @@ export const QueryGranterGrantsRequest = { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; }, - toJSON(message: QueryGranterGrantsRequest): unknown { + toJSON(message: QueryGranterGrantsRequest): JsonSafe { const obj: any = {}; message.granter !== undefined && (obj.granter = message.granter); message.pagination !== undefined && (obj.pagination = message.pagination ? PageRequest.toJSON(message.pagination) : undefined); @@ -352,7 +353,7 @@ export const QueryGranterGrantsResponse = { pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined }; }, - toJSON(message: QueryGranterGrantsResponse): unknown { + toJSON(message: QueryGranterGrantsResponse): JsonSafe { const obj: any = {}; if (message.grants) { obj.grants = message.grants.map(e => e ? GrantAuthorization.toJSON(e) : undefined); @@ -427,7 +428,7 @@ export const QueryGranteeGrantsRequest = { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; }, - toJSON(message: QueryGranteeGrantsRequest): unknown { + toJSON(message: QueryGranteeGrantsRequest): JsonSafe { const obj: any = {}; message.grantee !== undefined && (obj.grantee = message.grantee); message.pagination !== undefined && (obj.pagination = message.pagination ? PageRequest.toJSON(message.pagination) : undefined); @@ -494,7 +495,7 @@ export const QueryGranteeGrantsResponse = { pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined }; }, - toJSON(message: QueryGranteeGrantsResponse): unknown { + toJSON(message: QueryGranteeGrantsResponse): JsonSafe { const obj: any = {}; if (message.grants) { obj.grants = message.grants.map(e => e ? GrantAuthorization.toJSON(e) : undefined); diff --git a/__fixtures__/output1/cosmos/authz/v1beta1/tx.ts b/__fixtures__/output1/cosmos/authz/v1beta1/tx.ts index 4f8184b81d..7a6cfdf773 100644 --- a/__fixtures__/output1/cosmos/authz/v1beta1/tx.ts +++ b/__fixtures__/output1/cosmos/authz/v1beta1/tx.ts @@ -2,6 +2,7 @@ import { Grant, GrantSDKType } from "./authz"; import { Any, AnySDKType } from "../../../google/protobuf/any"; import * as _m0 from "protobufjs/minimal"; import { isSet, DeepPartial, bytesFromBase64, base64FromBytes } from "../../../helpers"; +import { JsonSafe } from "../../../json-safe"; export const protobufPackage = "cosmos.authz.v1beta1"; /** * MsgGrant is a request type for Grant method. It declares authorization to the grantee @@ -128,7 +129,7 @@ export const MsgGrant = { grant: isSet(object.grant) ? Grant.fromJSON(object.grant) : undefined }; }, - toJSON(message: MsgGrant): unknown { + toJSON(message: MsgGrant): JsonSafe { const obj: any = {}; message.granter !== undefined && (obj.granter = message.granter); message.grantee !== undefined && (obj.grantee = message.grantee); @@ -191,7 +192,7 @@ export const MsgExecResponse = { results: Array.isArray(object?.results) ? object.results.map((e: any) => bytesFromBase64(e)) : [] }; }, - toJSON(message: MsgExecResponse): unknown { + toJSON(message: MsgExecResponse): JsonSafe { const obj: any = {}; if (message.results) { obj.results = message.results.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); @@ -262,7 +263,7 @@ export const MsgExec = { msgs: Array.isArray(object?.msgs) ? object.msgs.map((e: any) => Any.fromJSON(e)) : [] }; }, - toJSON(message: MsgExec): unknown { + toJSON(message: MsgExec): JsonSafe { const obj: any = {}; message.grantee !== undefined && (obj.grantee = message.grantee); if (message.msgs) { @@ -319,7 +320,7 @@ export const MsgGrantResponse = { fromJSON(_: any): MsgGrantResponse { return {}; }, - toJSON(_: MsgGrantResponse): unknown { + toJSON(_: MsgGrantResponse): JsonSafe { const obj: any = {}; return obj; }, @@ -385,7 +386,7 @@ export const MsgRevoke = { msgTypeUrl: isSet(object.msgTypeUrl) ? String(object.msgTypeUrl) : "" }; }, - toJSON(message: MsgRevoke): unknown { + toJSON(message: MsgRevoke): JsonSafe { const obj: any = {}; message.granter !== undefined && (obj.granter = message.granter); message.grantee !== undefined && (obj.grantee = message.grantee); @@ -438,7 +439,7 @@ export const MsgRevokeResponse = { fromJSON(_: any): MsgRevokeResponse { return {}; }, - toJSON(_: MsgRevokeResponse): unknown { + toJSON(_: MsgRevokeResponse): JsonSafe { const obj: any = {}; return obj; }, diff --git a/__fixtures__/output1/cosmos/bank/v1beta1/authz.ts b/__fixtures__/output1/cosmos/bank/v1beta1/authz.ts index e979026c49..cc33f92beb 100644 --- a/__fixtures__/output1/cosmos/bank/v1beta1/authz.ts +++ b/__fixtures__/output1/cosmos/bank/v1beta1/authz.ts @@ -1,5 +1,6 @@ import { Coin, CoinSDKType } from "../../base/v1beta1/coin"; import * as _m0 from "protobufjs/minimal"; +import { JsonSafe } from "../../../json-safe"; import { DeepPartial } from "../../../helpers"; export const protobufPackage = "cosmos.bank.v1beta1"; /** @@ -54,7 +55,7 @@ export const SendAuthorization = { spendLimit: Array.isArray(object?.spendLimit) ? object.spendLimit.map((e: any) => Coin.fromJSON(e)) : [] }; }, - toJSON(message: SendAuthorization): unknown { + toJSON(message: SendAuthorization): JsonSafe { const obj: any = {}; if (message.spendLimit) { obj.spendLimit = message.spendLimit.map(e => e ? Coin.toJSON(e) : undefined); diff --git a/__fixtures__/output1/cosmos/bank/v1beta1/bank.ts b/__fixtures__/output1/cosmos/bank/v1beta1/bank.ts index 89c4142310..e0d4f242af 100644 --- a/__fixtures__/output1/cosmos/bank/v1beta1/bank.ts +++ b/__fixtures__/output1/cosmos/bank/v1beta1/bank.ts @@ -1,6 +1,7 @@ import { Coin, CoinSDKType } from "../../base/v1beta1/coin"; import * as _m0 from "protobufjs/minimal"; import { isSet, DeepPartial } from "../../../helpers"; +import { JsonSafe } from "../../../json-safe"; export const protobufPackage = "cosmos.bank.v1beta1"; /** Params defines the parameters for the bank module. */ export interface Params { @@ -191,7 +192,7 @@ export const Params = { defaultSendEnabled: isSet(object.defaultSendEnabled) ? Boolean(object.defaultSendEnabled) : false }; }, - toJSON(message: Params): unknown { + toJSON(message: Params): JsonSafe { const obj: any = {}; if (message.sendEnabled) { obj.sendEnabled = message.sendEnabled.map(e => e ? SendEnabled.toJSON(e) : undefined); @@ -266,7 +267,7 @@ export const SendEnabled = { enabled: isSet(object.enabled) ? Boolean(object.enabled) : false }; }, - toJSON(message: SendEnabled): unknown { + toJSON(message: SendEnabled): JsonSafe { const obj: any = {}; message.denom !== undefined && (obj.denom = message.denom); message.enabled !== undefined && (obj.enabled = message.enabled); @@ -333,7 +334,7 @@ export const Input = { coins: Array.isArray(object?.coins) ? object.coins.map((e: any) => Coin.fromJSON(e)) : [] }; }, - toJSON(message: Input): unknown { + toJSON(message: Input): JsonSafe { const obj: any = {}; message.address !== undefined && (obj.address = message.address); if (message.coins) { @@ -408,7 +409,7 @@ export const Output = { coins: Array.isArray(object?.coins) ? object.coins.map((e: any) => Coin.fromJSON(e)) : [] }; }, - toJSON(message: Output): unknown { + toJSON(message: Output): JsonSafe { const obj: any = {}; message.address !== undefined && (obj.address = message.address); if (message.coins) { @@ -475,7 +476,7 @@ export const Supply = { total: Array.isArray(object?.total) ? object.total.map((e: any) => Coin.fromJSON(e)) : [] }; }, - toJSON(message: Supply): unknown { + toJSON(message: Supply): JsonSafe { const obj: any = {}; if (message.total) { obj.total = message.total.map(e => e ? Coin.toJSON(e) : undefined); @@ -554,7 +555,7 @@ export const DenomUnit = { aliases: Array.isArray(object?.aliases) ? object.aliases.map((e: any) => String(e)) : [] }; }, - toJSON(message: DenomUnit): unknown { + toJSON(message: DenomUnit): JsonSafe { const obj: any = {}; message.denom !== undefined && (obj.denom = message.denom); message.exponent !== undefined && (obj.exponent = Math.round(message.exponent)); @@ -681,7 +682,7 @@ export const Metadata = { uriHash: isSet(object.uriHash) ? String(object.uriHash) : "" }; }, - toJSON(message: Metadata): unknown { + toJSON(message: Metadata): JsonSafe { const obj: any = {}; message.description !== undefined && (obj.description = message.description); if (message.denomUnits) { diff --git a/__fixtures__/output1/cosmos/bank/v1beta1/genesis.ts b/__fixtures__/output1/cosmos/bank/v1beta1/genesis.ts index 2aa6579299..9a77dbdf3e 100644 --- a/__fixtures__/output1/cosmos/bank/v1beta1/genesis.ts +++ b/__fixtures__/output1/cosmos/bank/v1beta1/genesis.ts @@ -2,6 +2,7 @@ import { Params, ParamsSDKType, Metadata, MetadataSDKType } from "./bank"; import { Coin, CoinSDKType } from "../../base/v1beta1/coin"; import * as _m0 from "protobufjs/minimal"; import { isSet, DeepPartial } from "../../../helpers"; +import { JsonSafe } from "../../../json-safe"; export const protobufPackage = "cosmos.bank.v1beta1"; /** GenesisState defines the bank module's genesis state. */ export interface GenesisState { @@ -100,7 +101,7 @@ export const GenesisState = { denomMetadata: Array.isArray(object?.denomMetadata) ? object.denomMetadata.map((e: any) => Metadata.fromJSON(e)) : [] }; }, - toJSON(message: GenesisState): unknown { + toJSON(message: GenesisState): JsonSafe { const obj: any = {}; message.params !== undefined && (obj.params = message.params ? Params.toJSON(message.params) : undefined); if (message.balances) { @@ -199,7 +200,7 @@ export const Balance = { coins: Array.isArray(object?.coins) ? object.coins.map((e: any) => Coin.fromJSON(e)) : [] }; }, - toJSON(message: Balance): unknown { + toJSON(message: Balance): JsonSafe { const obj: any = {}; message.address !== undefined && (obj.address = message.address); if (message.coins) { diff --git a/__fixtures__/output1/cosmos/bank/v1beta1/query.ts b/__fixtures__/output1/cosmos/bank/v1beta1/query.ts index bbd01b1ec9..fbec8c5f26 100644 --- a/__fixtures__/output1/cosmos/bank/v1beta1/query.ts +++ b/__fixtures__/output1/cosmos/bank/v1beta1/query.ts @@ -3,6 +3,7 @@ import { Coin, CoinSDKType } from "../../base/v1beta1/coin"; import { Params, ParamsSDKType, Metadata, MetadataSDKType } from "./bank"; import * as _m0 from "protobufjs/minimal"; import { isSet, DeepPartial } from "../../../helpers"; +import { JsonSafe } from "../../../json-safe"; export const protobufPackage = "cosmos.bank.v1beta1"; /** QueryBalanceRequest is the request type for the Query/Balance RPC method. */ export interface QueryBalanceRequest { @@ -306,7 +307,7 @@ export const QueryBalanceRequest = { denom: isSet(object.denom) ? String(object.denom) : "" }; }, - toJSON(message: QueryBalanceRequest): unknown { + toJSON(message: QueryBalanceRequest): JsonSafe { const obj: any = {}; message.address !== undefined && (obj.address = message.address); message.denom !== undefined && (obj.denom = message.denom); @@ -365,7 +366,7 @@ export const QueryBalanceResponse = { balance: isSet(object.balance) ? Coin.fromJSON(object.balance) : undefined }; }, - toJSON(message: QueryBalanceResponse): unknown { + toJSON(message: QueryBalanceResponse): JsonSafe { const obj: any = {}; message.balance !== undefined && (obj.balance = message.balance ? Coin.toJSON(message.balance) : undefined); return obj; @@ -428,7 +429,7 @@ export const QueryAllBalancesRequest = { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; }, - toJSON(message: QueryAllBalancesRequest): unknown { + toJSON(message: QueryAllBalancesRequest): JsonSafe { const obj: any = {}; message.address !== undefined && (obj.address = message.address); message.pagination !== undefined && (obj.pagination = message.pagination ? PageRequest.toJSON(message.pagination) : undefined); @@ -495,7 +496,7 @@ export const QueryAllBalancesResponse = { pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined }; }, - toJSON(message: QueryAllBalancesResponse): unknown { + toJSON(message: QueryAllBalancesResponse): JsonSafe { const obj: any = {}; if (message.balances) { obj.balances = message.balances.map(e => e ? Coin.toJSON(e) : undefined); @@ -570,7 +571,7 @@ export const QuerySpendableBalancesRequest = { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; }, - toJSON(message: QuerySpendableBalancesRequest): unknown { + toJSON(message: QuerySpendableBalancesRequest): JsonSafe { const obj: any = {}; message.address !== undefined && (obj.address = message.address); message.pagination !== undefined && (obj.pagination = message.pagination ? PageRequest.toJSON(message.pagination) : undefined); @@ -637,7 +638,7 @@ export const QuerySpendableBalancesResponse = { pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined }; }, - toJSON(message: QuerySpendableBalancesResponse): unknown { + toJSON(message: QuerySpendableBalancesResponse): JsonSafe { const obj: any = {}; if (message.balances) { obj.balances = message.balances.map(e => e ? Coin.toJSON(e) : undefined); @@ -704,7 +705,7 @@ export const QueryTotalSupplyRequest = { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; }, - toJSON(message: QueryTotalSupplyRequest): unknown { + toJSON(message: QueryTotalSupplyRequest): JsonSafe { const obj: any = {}; message.pagination !== undefined && (obj.pagination = message.pagination ? PageRequest.toJSON(message.pagination) : undefined); return obj; @@ -767,7 +768,7 @@ export const QueryTotalSupplyResponse = { pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined }; }, - toJSON(message: QueryTotalSupplyResponse): unknown { + toJSON(message: QueryTotalSupplyResponse): JsonSafe { const obj: any = {}; if (message.supply) { obj.supply = message.supply.map(e => e ? Coin.toJSON(e) : undefined); @@ -834,7 +835,7 @@ export const QuerySupplyOfRequest = { denom: isSet(object.denom) ? String(object.denom) : "" }; }, - toJSON(message: QuerySupplyOfRequest): unknown { + toJSON(message: QuerySupplyOfRequest): JsonSafe { const obj: any = {}; message.denom !== undefined && (obj.denom = message.denom); return obj; @@ -889,7 +890,7 @@ export const QuerySupplyOfResponse = { amount: isSet(object.amount) ? Coin.fromJSON(object.amount) : undefined }; }, - toJSON(message: QuerySupplyOfResponse): unknown { + toJSON(message: QuerySupplyOfResponse): JsonSafe { const obj: any = {}; message.amount !== undefined && (obj.amount = message.amount ? Coin.toJSON(message.amount) : undefined); return obj; @@ -934,7 +935,7 @@ export const QueryParamsRequest = { fromJSON(_: any): QueryParamsRequest { return {}; }, - toJSON(_: QueryParamsRequest): unknown { + toJSON(_: QueryParamsRequest): JsonSafe { const obj: any = {}; return obj; }, @@ -984,7 +985,7 @@ export const QueryParamsResponse = { params: isSet(object.params) ? Params.fromJSON(object.params) : undefined }; }, - toJSON(message: QueryParamsResponse): unknown { + toJSON(message: QueryParamsResponse): JsonSafe { const obj: any = {}; message.params !== undefined && (obj.params = message.params ? Params.toJSON(message.params) : undefined); return obj; @@ -1039,7 +1040,7 @@ export const QueryDenomsMetadataRequest = { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; }, - toJSON(message: QueryDenomsMetadataRequest): unknown { + toJSON(message: QueryDenomsMetadataRequest): JsonSafe { const obj: any = {}; message.pagination !== undefined && (obj.pagination = message.pagination ? PageRequest.toJSON(message.pagination) : undefined); return obj; @@ -1102,7 +1103,7 @@ export const QueryDenomsMetadataResponse = { pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined }; }, - toJSON(message: QueryDenomsMetadataResponse): unknown { + toJSON(message: QueryDenomsMetadataResponse): JsonSafe { const obj: any = {}; if (message.metadatas) { obj.metadatas = message.metadatas.map(e => e ? Metadata.toJSON(e) : undefined); @@ -1169,7 +1170,7 @@ export const QueryDenomMetadataRequest = { denom: isSet(object.denom) ? String(object.denom) : "" }; }, - toJSON(message: QueryDenomMetadataRequest): unknown { + toJSON(message: QueryDenomMetadataRequest): JsonSafe { const obj: any = {}; message.denom !== undefined && (obj.denom = message.denom); return obj; @@ -1224,7 +1225,7 @@ export const QueryDenomMetadataResponse = { metadata: isSet(object.metadata) ? Metadata.fromJSON(object.metadata) : undefined }; }, - toJSON(message: QueryDenomMetadataResponse): unknown { + toJSON(message: QueryDenomMetadataResponse): JsonSafe { const obj: any = {}; message.metadata !== undefined && (obj.metadata = message.metadata ? Metadata.toJSON(message.metadata) : undefined); return obj; @@ -1287,7 +1288,7 @@ export const QueryDenomOwnersRequest = { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; }, - toJSON(message: QueryDenomOwnersRequest): unknown { + toJSON(message: QueryDenomOwnersRequest): JsonSafe { const obj: any = {}; message.denom !== undefined && (obj.denom = message.denom); message.pagination !== undefined && (obj.pagination = message.pagination ? PageRequest.toJSON(message.pagination) : undefined); @@ -1354,7 +1355,7 @@ export const DenomOwner = { balance: isSet(object.balance) ? Coin.fromJSON(object.balance) : undefined }; }, - toJSON(message: DenomOwner): unknown { + toJSON(message: DenomOwner): JsonSafe { const obj: any = {}; message.address !== undefined && (obj.address = message.address); message.balance !== undefined && (obj.balance = message.balance ? Coin.toJSON(message.balance) : undefined); @@ -1421,7 +1422,7 @@ export const QueryDenomOwnersResponse = { pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined }; }, - toJSON(message: QueryDenomOwnersResponse): unknown { + toJSON(message: QueryDenomOwnersResponse): JsonSafe { const obj: any = {}; if (message.denomOwners) { obj.denomOwners = message.denomOwners.map(e => e ? DenomOwner.toJSON(e) : undefined); diff --git a/__fixtures__/output1/cosmos/bank/v1beta1/tx.ts b/__fixtures__/output1/cosmos/bank/v1beta1/tx.ts index 9da662b168..7bad530d4a 100644 --- a/__fixtures__/output1/cosmos/bank/v1beta1/tx.ts +++ b/__fixtures__/output1/cosmos/bank/v1beta1/tx.ts @@ -2,6 +2,7 @@ import { Coin, CoinSDKType } from "../../base/v1beta1/coin"; import { Input, InputSDKType, Output, OutputSDKType } from "./bank"; import * as _m0 from "protobufjs/minimal"; import { isSet, DeepPartial } from "../../../helpers"; +import { JsonSafe } from "../../../json-safe"; export const protobufPackage = "cosmos.bank.v1beta1"; /** MsgSend represents a message to send coins from one account to another. */ export interface MsgSend { @@ -83,7 +84,7 @@ export const MsgSend = { amount: Array.isArray(object?.amount) ? object.amount.map((e: any) => Coin.fromJSON(e)) : [] }; }, - toJSON(message: MsgSend): unknown { + toJSON(message: MsgSend): JsonSafe { const obj: any = {}; message.fromAddress !== undefined && (obj.fromAddress = message.fromAddress); message.toAddress !== undefined && (obj.toAddress = message.toAddress); @@ -144,7 +145,7 @@ export const MsgSendResponse = { fromJSON(_: any): MsgSendResponse { return {}; }, - toJSON(_: MsgSendResponse): unknown { + toJSON(_: MsgSendResponse): JsonSafe { const obj: any = {}; return obj; }, @@ -202,7 +203,7 @@ export const MsgMultiSend = { outputs: Array.isArray(object?.outputs) ? object.outputs.map((e: any) => Output.fromJSON(e)) : [] }; }, - toJSON(message: MsgMultiSend): unknown { + toJSON(message: MsgMultiSend): JsonSafe { const obj: any = {}; if (message.inputs) { obj.inputs = message.inputs.map(e => e ? Input.toJSON(e) : undefined); @@ -267,7 +268,7 @@ export const MsgMultiSendResponse = { fromJSON(_: any): MsgMultiSendResponse { return {}; }, - toJSON(_: MsgMultiSendResponse): unknown { + toJSON(_: MsgMultiSendResponse): JsonSafe { const obj: any = {}; return obj; }, diff --git a/__fixtures__/output1/cosmos/base/abci/v1beta1/abci.ts b/__fixtures__/output1/cosmos/base/abci/v1beta1/abci.ts index 05f1d0fa0e..4e95ecccf8 100644 --- a/__fixtures__/output1/cosmos/base/abci/v1beta1/abci.ts +++ b/__fixtures__/output1/cosmos/base/abci/v1beta1/abci.ts @@ -2,6 +2,7 @@ import { Any, AnySDKType } from "../../../../google/protobuf/any"; import { Event, EventSDKType } from "../../../../tendermint/abci/types"; import { Long, isSet, DeepPartial, bytesFromBase64, base64FromBytes } from "../../../../helpers"; import * as _m0 from "protobufjs/minimal"; +import { JsonSafe } from "../../../../json-safe"; export const protobufPackage = "cosmos.base.abci.v1beta1"; /** * TxResponse defines a structure containing relevant tx data and metadata. The @@ -372,7 +373,7 @@ export const TxResponse = { events: Array.isArray(object?.events) ? object.events.map((e: any) => Event.fromJSON(e)) : [] }; }, - toJSON(message: TxResponse): unknown { + toJSON(message: TxResponse): JsonSafe { const obj: any = {}; message.height !== undefined && (obj.height = (message.height || Long.ZERO).toString()); message.txhash !== undefined && (obj.txhash = message.txhash); @@ -507,7 +508,7 @@ export const ABCIMessageLog = { events: Array.isArray(object?.events) ? object.events.map((e: any) => StringEvent.fromJSON(e)) : [] }; }, - toJSON(message: ABCIMessageLog): unknown { + toJSON(message: ABCIMessageLog): JsonSafe { const obj: any = {}; message.msgIndex !== undefined && (obj.msgIndex = Math.round(message.msgIndex)); message.log !== undefined && (obj.log = message.log); @@ -586,7 +587,7 @@ export const StringEvent = { attributes: Array.isArray(object?.attributes) ? object.attributes.map((e: any) => Attribute.fromJSON(e)) : [] }; }, - toJSON(message: StringEvent): unknown { + toJSON(message: StringEvent): JsonSafe { const obj: any = {}; message.type !== undefined && (obj.type = message.type); if (message.attributes) { @@ -661,7 +662,7 @@ export const Attribute = { value: isSet(object.value) ? String(object.value) : "" }; }, - toJSON(message: Attribute): unknown { + toJSON(message: Attribute): JsonSafe { const obj: any = {}; message.key !== undefined && (obj.key = message.key); message.value !== undefined && (obj.value = message.value); @@ -728,7 +729,7 @@ export const GasInfo = { gasUsed: isSet(object.gasUsed) ? Long.fromValue(object.gasUsed) : Long.UZERO }; }, - toJSON(message: GasInfo): unknown { + toJSON(message: GasInfo): JsonSafe { const obj: any = {}; message.gasWanted !== undefined && (obj.gasWanted = (message.gasWanted || Long.UZERO).toString()); message.gasUsed !== undefined && (obj.gasUsed = (message.gasUsed || Long.UZERO).toString()); @@ -811,7 +812,7 @@ export const Result = { msgResponses: Array.isArray(object?.msgResponses) ? object.msgResponses.map((e: any) => Any.fromJSON(e)) : [] }; }, - toJSON(message: Result): unknown { + toJSON(message: Result): JsonSafe { const obj: any = {}; message.data !== undefined && (obj.data = base64FromBytes(message.data !== undefined ? message.data : new Uint8Array())); message.log !== undefined && (obj.log = message.log); @@ -902,7 +903,7 @@ export const SimulationResponse = { result: isSet(object.result) ? Result.fromJSON(object.result) : undefined }; }, - toJSON(message: SimulationResponse): unknown { + toJSON(message: SimulationResponse): JsonSafe { const obj: any = {}; message.gasInfo !== undefined && (obj.gasInfo = message.gasInfo ? GasInfo.toJSON(message.gasInfo) : undefined); message.result !== undefined && (obj.result = message.result ? Result.toJSON(message.result) : undefined); @@ -969,7 +970,7 @@ export const MsgData = { data: isSet(object.data) ? bytesFromBase64(object.data) : new Uint8Array() }; }, - toJSON(message: MsgData): unknown { + toJSON(message: MsgData): JsonSafe { const obj: any = {}; message.msgType !== undefined && (obj.msgType = message.msgType); message.data !== undefined && (obj.data = base64FromBytes(message.data !== undefined ? message.data : new Uint8Array())); @@ -1036,7 +1037,7 @@ export const TxMsgData = { msgResponses: Array.isArray(object?.msgResponses) ? object.msgResponses.map((e: any) => Any.fromJSON(e)) : [] }; }, - toJSON(message: TxMsgData): unknown { + toJSON(message: TxMsgData): JsonSafe { const obj: any = {}; if (message.data) { obj.data = message.data.map(e => e ? MsgData.toJSON(e) : undefined); @@ -1151,7 +1152,7 @@ export const SearchTxsResult = { txs: Array.isArray(object?.txs) ? object.txs.map((e: any) => TxResponse.fromJSON(e)) : [] }; }, - toJSON(message: SearchTxsResult): unknown { + toJSON(message: SearchTxsResult): JsonSafe { const obj: any = {}; message.totalCount !== undefined && (obj.totalCount = (message.totalCount || Long.UZERO).toString()); message.count !== undefined && (obj.count = (message.count || Long.UZERO).toString()); diff --git a/__fixtures__/output1/cosmos/base/kv/v1beta1/kv.ts b/__fixtures__/output1/cosmos/base/kv/v1beta1/kv.ts index a3b8d2715b..33222b163a 100644 --- a/__fixtures__/output1/cosmos/base/kv/v1beta1/kv.ts +++ b/__fixtures__/output1/cosmos/base/kv/v1beta1/kv.ts @@ -1,4 +1,5 @@ import * as _m0 from "protobufjs/minimal"; +import { JsonSafe } from "../../../../json-safe"; import { DeepPartial, isSet, bytesFromBase64, base64FromBytes } from "../../../../helpers"; export const protobufPackage = "cosmos.base.kv.v1beta1"; /** Pairs defines a repeated slice of Pair objects. */ @@ -53,7 +54,7 @@ export const Pairs = { pairs: Array.isArray(object?.pairs) ? object.pairs.map((e: any) => Pair.fromJSON(e)) : [] }; }, - toJSON(message: Pairs): unknown { + toJSON(message: Pairs): JsonSafe { const obj: any = {}; if (message.pairs) { obj.pairs = message.pairs.map(e => e ? Pair.toJSON(e) : undefined); @@ -124,7 +125,7 @@ export const Pair = { value: isSet(object.value) ? bytesFromBase64(object.value) : new Uint8Array() }; }, - toJSON(message: Pair): unknown { + toJSON(message: Pair): JsonSafe { const obj: any = {}; message.key !== undefined && (obj.key = base64FromBytes(message.key !== undefined ? message.key : new Uint8Array())); message.value !== undefined && (obj.value = base64FromBytes(message.value !== undefined ? message.value : new Uint8Array())); diff --git a/__fixtures__/output1/cosmos/base/query/v1beta1/pagination.ts b/__fixtures__/output1/cosmos/base/query/v1beta1/pagination.ts index 895763bd79..cb8ed5e81d 100644 --- a/__fixtures__/output1/cosmos/base/query/v1beta1/pagination.ts +++ b/__fixtures__/output1/cosmos/base/query/v1beta1/pagination.ts @@ -1,5 +1,6 @@ import { Long, isSet, bytesFromBase64, base64FromBytes, DeepPartial } from "../../../../helpers"; import * as _m0 from "protobufjs/minimal"; +import { JsonSafe } from "../../../../json-safe"; export const protobufPackage = "cosmos.base.query.v1beta1"; /** * PageRequest is to be embedded in gRPC request messages for efficient @@ -159,7 +160,7 @@ export const PageRequest = { reverse: isSet(object.reverse) ? Boolean(object.reverse) : false }; }, - toJSON(message: PageRequest): unknown { + toJSON(message: PageRequest): JsonSafe { const obj: any = {}; message.key !== undefined && (obj.key = base64FromBytes(message.key !== undefined ? message.key : new Uint8Array())); message.offset !== undefined && (obj.offset = (message.offset || Long.UZERO).toString()); @@ -238,7 +239,7 @@ export const PageResponse = { total: isSet(object.total) ? Long.fromValue(object.total) : Long.UZERO }; }, - toJSON(message: PageResponse): unknown { + toJSON(message: PageResponse): JsonSafe { const obj: any = {}; message.nextKey !== undefined && (obj.nextKey = base64FromBytes(message.nextKey !== undefined ? message.nextKey : new Uint8Array())); message.total !== undefined && (obj.total = (message.total || Long.UZERO).toString()); diff --git a/__fixtures__/output1/cosmos/base/reflection/v1beta1/reflection.ts b/__fixtures__/output1/cosmos/base/reflection/v1beta1/reflection.ts index 1c6bf54c93..fe6b0b0dcc 100644 --- a/__fixtures__/output1/cosmos/base/reflection/v1beta1/reflection.ts +++ b/__fixtures__/output1/cosmos/base/reflection/v1beta1/reflection.ts @@ -1,4 +1,5 @@ import * as _m0 from "protobufjs/minimal"; +import { JsonSafe } from "../../../../json-safe"; import { DeepPartial, isSet } from "../../../../helpers"; export const protobufPackage = "cosmos.base.reflection.v1beta1"; /** ListAllInterfacesRequest is the request type of the ListAllInterfaces RPC. */ @@ -67,7 +68,7 @@ export const ListAllInterfacesRequest = { fromJSON(_: any): ListAllInterfacesRequest { return {}; }, - toJSON(_: ListAllInterfacesRequest): unknown { + toJSON(_: ListAllInterfacesRequest): JsonSafe { const obj: any = {}; return obj; }, @@ -117,7 +118,7 @@ export const ListAllInterfacesResponse = { interfaceNames: Array.isArray(object?.interfaceNames) ? object.interfaceNames.map((e: any) => String(e)) : [] }; }, - toJSON(message: ListAllInterfacesResponse): unknown { + toJSON(message: ListAllInterfacesResponse): JsonSafe { const obj: any = {}; if (message.interfaceNames) { obj.interfaceNames = message.interfaceNames.map(e => e); @@ -180,7 +181,7 @@ export const ListImplementationsRequest = { interfaceName: isSet(object.interfaceName) ? String(object.interfaceName) : "" }; }, - toJSON(message: ListImplementationsRequest): unknown { + toJSON(message: ListImplementationsRequest): JsonSafe { const obj: any = {}; message.interfaceName !== undefined && (obj.interfaceName = message.interfaceName); return obj; @@ -235,7 +236,7 @@ export const ListImplementationsResponse = { implementationMessageNames: Array.isArray(object?.implementationMessageNames) ? object.implementationMessageNames.map((e: any) => String(e)) : [] }; }, - toJSON(message: ListImplementationsResponse): unknown { + toJSON(message: ListImplementationsResponse): JsonSafe { const obj: any = {}; if (message.implementationMessageNames) { obj.implementationMessageNames = message.implementationMessageNames.map(e => e); diff --git a/__fixtures__/output1/cosmos/base/reflection/v2alpha1/reflection.ts b/__fixtures__/output1/cosmos/base/reflection/v2alpha1/reflection.ts index 9a2a0e1652..dd5338c177 100644 --- a/__fixtures__/output1/cosmos/base/reflection/v2alpha1/reflection.ts +++ b/__fixtures__/output1/cosmos/base/reflection/v2alpha1/reflection.ts @@ -1,5 +1,6 @@ import * as _m0 from "protobufjs/minimal"; import { isSet, DeepPartial } from "../../../../helpers"; +import { JsonSafe } from "../../../../json-safe"; export const protobufPackage = "cosmos.base.reflection.v2alpha1"; /** AppDescriptor describes a cosmos-sdk based application */ export interface AppDescriptor { @@ -382,7 +383,7 @@ export const AppDescriptor = { tx: isSet(object.tx) ? TxDescriptor.fromJSON(object.tx) : undefined }; }, - toJSON(message: AppDescriptor): unknown { + toJSON(message: AppDescriptor): JsonSafe { const obj: any = {}; message.authn !== undefined && (obj.authn = message.authn ? AuthnDescriptor.toJSON(message.authn) : undefined); message.chain !== undefined && (obj.chain = message.chain ? ChainDescriptor.toJSON(message.chain) : undefined); @@ -465,7 +466,7 @@ export const TxDescriptor = { msgs: Array.isArray(object?.msgs) ? object.msgs.map((e: any) => MsgDescriptor.fromJSON(e)) : [] }; }, - toJSON(message: TxDescriptor): unknown { + toJSON(message: TxDescriptor): JsonSafe { const obj: any = {}; message.fullname !== undefined && (obj.fullname = message.fullname); if (message.msgs) { @@ -532,7 +533,7 @@ export const AuthnDescriptor = { signModes: Array.isArray(object?.signModes) ? object.signModes.map((e: any) => SigningModeDescriptor.fromJSON(e)) : [] }; }, - toJSON(message: AuthnDescriptor): unknown { + toJSON(message: AuthnDescriptor): JsonSafe { const obj: any = {}; if (message.signModes) { obj.signModes = message.signModes.map(e => e ? SigningModeDescriptor.toJSON(e) : undefined); @@ -611,7 +612,7 @@ export const SigningModeDescriptor = { authnInfoProviderMethodFullname: isSet(object.authnInfoProviderMethodFullname) ? String(object.authnInfoProviderMethodFullname) : "" }; }, - toJSON(message: SigningModeDescriptor): unknown { + toJSON(message: SigningModeDescriptor): JsonSafe { const obj: any = {}; message.name !== undefined && (obj.name = message.name); message.number !== undefined && (obj.number = Math.round(message.number)); @@ -674,7 +675,7 @@ export const ChainDescriptor = { id: isSet(object.id) ? String(object.id) : "" }; }, - toJSON(message: ChainDescriptor): unknown { + toJSON(message: ChainDescriptor): JsonSafe { const obj: any = {}; message.id !== undefined && (obj.id = message.id); return obj; @@ -729,7 +730,7 @@ export const CodecDescriptor = { interfaces: Array.isArray(object?.interfaces) ? object.interfaces.map((e: any) => InterfaceDescriptor.fromJSON(e)) : [] }; }, - toJSON(message: CodecDescriptor): unknown { + toJSON(message: CodecDescriptor): JsonSafe { const obj: any = {}; if (message.interfaces) { obj.interfaces = message.interfaces.map(e => e ? InterfaceDescriptor.toJSON(e) : undefined); @@ -808,7 +809,7 @@ export const InterfaceDescriptor = { interfaceImplementers: Array.isArray(object?.interfaceImplementers) ? object.interfaceImplementers.map((e: any) => InterfaceImplementerDescriptor.fromJSON(e)) : [] }; }, - toJSON(message: InterfaceDescriptor): unknown { + toJSON(message: InterfaceDescriptor): JsonSafe { const obj: any = {}; message.fullname !== undefined && (obj.fullname = message.fullname); if (message.interfaceAcceptingMessages) { @@ -895,7 +896,7 @@ export const InterfaceImplementerDescriptor = { typeUrl: isSet(object.typeUrl) ? String(object.typeUrl) : "" }; }, - toJSON(message: InterfaceImplementerDescriptor): unknown { + toJSON(message: InterfaceImplementerDescriptor): JsonSafe { const obj: any = {}; message.fullname !== undefined && (obj.fullname = message.fullname); message.typeUrl !== undefined && (obj.typeUrl = message.typeUrl); @@ -962,7 +963,7 @@ export const InterfaceAcceptingMessageDescriptor = { fieldDescriptorNames: Array.isArray(object?.fieldDescriptorNames) ? object.fieldDescriptorNames.map((e: any) => String(e)) : [] }; }, - toJSON(message: InterfaceAcceptingMessageDescriptor): unknown { + toJSON(message: InterfaceAcceptingMessageDescriptor): JsonSafe { const obj: any = {}; message.fullname !== undefined && (obj.fullname = message.fullname); if (message.fieldDescriptorNames) { @@ -1029,7 +1030,7 @@ export const ConfigurationDescriptor = { bech32AccountAddressPrefix: isSet(object.bech32AccountAddressPrefix) ? String(object.bech32AccountAddressPrefix) : "" }; }, - toJSON(message: ConfigurationDescriptor): unknown { + toJSON(message: ConfigurationDescriptor): JsonSafe { const obj: any = {}; message.bech32AccountAddressPrefix !== undefined && (obj.bech32AccountAddressPrefix = message.bech32AccountAddressPrefix); return obj; @@ -1084,7 +1085,7 @@ export const MsgDescriptor = { msgTypeUrl: isSet(object.msgTypeUrl) ? String(object.msgTypeUrl) : "" }; }, - toJSON(message: MsgDescriptor): unknown { + toJSON(message: MsgDescriptor): JsonSafe { const obj: any = {}; message.msgTypeUrl !== undefined && (obj.msgTypeUrl = message.msgTypeUrl); return obj; @@ -1129,7 +1130,7 @@ export const GetAuthnDescriptorRequest = { fromJSON(_: any): GetAuthnDescriptorRequest { return {}; }, - toJSON(_: GetAuthnDescriptorRequest): unknown { + toJSON(_: GetAuthnDescriptorRequest): JsonSafe { const obj: any = {}; return obj; }, @@ -1179,7 +1180,7 @@ export const GetAuthnDescriptorResponse = { authn: isSet(object.authn) ? AuthnDescriptor.fromJSON(object.authn) : undefined }; }, - toJSON(message: GetAuthnDescriptorResponse): unknown { + toJSON(message: GetAuthnDescriptorResponse): JsonSafe { const obj: any = {}; message.authn !== undefined && (obj.authn = message.authn ? AuthnDescriptor.toJSON(message.authn) : undefined); return obj; @@ -1224,7 +1225,7 @@ export const GetChainDescriptorRequest = { fromJSON(_: any): GetChainDescriptorRequest { return {}; }, - toJSON(_: GetChainDescriptorRequest): unknown { + toJSON(_: GetChainDescriptorRequest): JsonSafe { const obj: any = {}; return obj; }, @@ -1274,7 +1275,7 @@ export const GetChainDescriptorResponse = { chain: isSet(object.chain) ? ChainDescriptor.fromJSON(object.chain) : undefined }; }, - toJSON(message: GetChainDescriptorResponse): unknown { + toJSON(message: GetChainDescriptorResponse): JsonSafe { const obj: any = {}; message.chain !== undefined && (obj.chain = message.chain ? ChainDescriptor.toJSON(message.chain) : undefined); return obj; @@ -1319,7 +1320,7 @@ export const GetCodecDescriptorRequest = { fromJSON(_: any): GetCodecDescriptorRequest { return {}; }, - toJSON(_: GetCodecDescriptorRequest): unknown { + toJSON(_: GetCodecDescriptorRequest): JsonSafe { const obj: any = {}; return obj; }, @@ -1369,7 +1370,7 @@ export const GetCodecDescriptorResponse = { codec: isSet(object.codec) ? CodecDescriptor.fromJSON(object.codec) : undefined }; }, - toJSON(message: GetCodecDescriptorResponse): unknown { + toJSON(message: GetCodecDescriptorResponse): JsonSafe { const obj: any = {}; message.codec !== undefined && (obj.codec = message.codec ? CodecDescriptor.toJSON(message.codec) : undefined); return obj; @@ -1414,7 +1415,7 @@ export const GetConfigurationDescriptorRequest = { fromJSON(_: any): GetConfigurationDescriptorRequest { return {}; }, - toJSON(_: GetConfigurationDescriptorRequest): unknown { + toJSON(_: GetConfigurationDescriptorRequest): JsonSafe { const obj: any = {}; return obj; }, @@ -1464,7 +1465,7 @@ export const GetConfigurationDescriptorResponse = { config: isSet(object.config) ? ConfigurationDescriptor.fromJSON(object.config) : undefined }; }, - toJSON(message: GetConfigurationDescriptorResponse): unknown { + toJSON(message: GetConfigurationDescriptorResponse): JsonSafe { const obj: any = {}; message.config !== undefined && (obj.config = message.config ? ConfigurationDescriptor.toJSON(message.config) : undefined); return obj; @@ -1509,7 +1510,7 @@ export const GetQueryServicesDescriptorRequest = { fromJSON(_: any): GetQueryServicesDescriptorRequest { return {}; }, - toJSON(_: GetQueryServicesDescriptorRequest): unknown { + toJSON(_: GetQueryServicesDescriptorRequest): JsonSafe { const obj: any = {}; return obj; }, @@ -1559,7 +1560,7 @@ export const GetQueryServicesDescriptorResponse = { queries: isSet(object.queries) ? QueryServicesDescriptor.fromJSON(object.queries) : undefined }; }, - toJSON(message: GetQueryServicesDescriptorResponse): unknown { + toJSON(message: GetQueryServicesDescriptorResponse): JsonSafe { const obj: any = {}; message.queries !== undefined && (obj.queries = message.queries ? QueryServicesDescriptor.toJSON(message.queries) : undefined); return obj; @@ -1604,7 +1605,7 @@ export const GetTxDescriptorRequest = { fromJSON(_: any): GetTxDescriptorRequest { return {}; }, - toJSON(_: GetTxDescriptorRequest): unknown { + toJSON(_: GetTxDescriptorRequest): JsonSafe { const obj: any = {}; return obj; }, @@ -1654,7 +1655,7 @@ export const GetTxDescriptorResponse = { tx: isSet(object.tx) ? TxDescriptor.fromJSON(object.tx) : undefined }; }, - toJSON(message: GetTxDescriptorResponse): unknown { + toJSON(message: GetTxDescriptorResponse): JsonSafe { const obj: any = {}; message.tx !== undefined && (obj.tx = message.tx ? TxDescriptor.toJSON(message.tx) : undefined); return obj; @@ -1709,7 +1710,7 @@ export const QueryServicesDescriptor = { queryServices: Array.isArray(object?.queryServices) ? object.queryServices.map((e: any) => QueryServiceDescriptor.fromJSON(e)) : [] }; }, - toJSON(message: QueryServicesDescriptor): unknown { + toJSON(message: QueryServicesDescriptor): JsonSafe { const obj: any = {}; if (message.queryServices) { obj.queryServices = message.queryServices.map(e => e ? QueryServiceDescriptor.toJSON(e) : undefined); @@ -1788,7 +1789,7 @@ export const QueryServiceDescriptor = { methods: Array.isArray(object?.methods) ? object.methods.map((e: any) => QueryMethodDescriptor.fromJSON(e)) : [] }; }, - toJSON(message: QueryServiceDescriptor): unknown { + toJSON(message: QueryServiceDescriptor): JsonSafe { const obj: any = {}; message.fullname !== undefined && (obj.fullname = message.fullname); message.isModule !== undefined && (obj.isModule = message.isModule); @@ -1867,7 +1868,7 @@ export const QueryMethodDescriptor = { fullQueryPath: isSet(object.fullQueryPath) ? String(object.fullQueryPath) : "" }; }, - toJSON(message: QueryMethodDescriptor): unknown { + toJSON(message: QueryMethodDescriptor): JsonSafe { const obj: any = {}; message.name !== undefined && (obj.name = message.name); message.fullQueryPath !== undefined && (obj.fullQueryPath = message.fullQueryPath); diff --git a/__fixtures__/output1/cosmos/base/snapshots/v1beta1/snapshot.ts b/__fixtures__/output1/cosmos/base/snapshots/v1beta1/snapshot.ts index da6ee2c319..52b2d650a0 100644 --- a/__fixtures__/output1/cosmos/base/snapshots/v1beta1/snapshot.ts +++ b/__fixtures__/output1/cosmos/base/snapshots/v1beta1/snapshot.ts @@ -1,5 +1,6 @@ import { Long, isSet, bytesFromBase64, base64FromBytes, DeepPartial } from "../../../../helpers"; import * as _m0 from "protobufjs/minimal"; +import { JsonSafe } from "../../../../json-safe"; export const protobufPackage = "cosmos.base.snapshots.v1beta1"; /** Snapshot contains Tendermint state sync snapshot info. */ export interface Snapshot { @@ -170,7 +171,7 @@ export const Snapshot = { metadata: isSet(object.metadata) ? Metadata.fromJSON(object.metadata) : undefined }; }, - toJSON(message: Snapshot): unknown { + toJSON(message: Snapshot): JsonSafe { const obj: any = {}; message.height !== undefined && (obj.height = (message.height || Long.UZERO).toString()); message.format !== undefined && (obj.format = Math.round(message.format)); @@ -241,7 +242,7 @@ export const Metadata = { chunkHashes: Array.isArray(object?.chunkHashes) ? object.chunkHashes.map((e: any) => bytesFromBase64(e)) : [] }; }, - toJSON(message: Metadata): unknown { + toJSON(message: Metadata): JsonSafe { const obj: any = {}; if (message.chunkHashes) { obj.chunkHashes = message.chunkHashes.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); @@ -344,7 +345,7 @@ export const SnapshotItem = { schema: isSet(object.schema) ? SnapshotSchema.fromJSON(object.schema) : undefined }; }, - toJSON(message: SnapshotItem): unknown { + toJSON(message: SnapshotItem): JsonSafe { const obj: any = {}; message.store !== undefined && (obj.store = message.store ? SnapshotStoreItem.toJSON(message.store) : undefined); message.iavl !== undefined && (obj.iavl = message.iavl ? SnapshotIAVLItem.toJSON(message.iavl) : undefined); @@ -419,7 +420,7 @@ export const SnapshotStoreItem = { name: isSet(object.name) ? String(object.name) : "" }; }, - toJSON(message: SnapshotStoreItem): unknown { + toJSON(message: SnapshotStoreItem): JsonSafe { const obj: any = {}; message.name !== undefined && (obj.name = message.name); return obj; @@ -498,7 +499,7 @@ export const SnapshotIAVLItem = { height: isSet(object.height) ? Number(object.height) : 0 }; }, - toJSON(message: SnapshotIAVLItem): unknown { + toJSON(message: SnapshotIAVLItem): JsonSafe { const obj: any = {}; message.key !== undefined && (obj.key = base64FromBytes(message.key !== undefined ? message.key : new Uint8Array())); message.value !== undefined && (obj.value = base64FromBytes(message.value !== undefined ? message.value : new Uint8Array())); @@ -573,7 +574,7 @@ export const SnapshotExtensionMeta = { format: isSet(object.format) ? Number(object.format) : 0 }; }, - toJSON(message: SnapshotExtensionMeta): unknown { + toJSON(message: SnapshotExtensionMeta): JsonSafe { const obj: any = {}; message.name !== undefined && (obj.name = message.name); message.format !== undefined && (obj.format = Math.round(message.format)); @@ -632,7 +633,7 @@ export const SnapshotExtensionPayload = { payload: isSet(object.payload) ? bytesFromBase64(object.payload) : new Uint8Array() }; }, - toJSON(message: SnapshotExtensionPayload): unknown { + toJSON(message: SnapshotExtensionPayload): JsonSafe { const obj: any = {}; message.payload !== undefined && (obj.payload = base64FromBytes(message.payload !== undefined ? message.payload : new Uint8Array())); return obj; @@ -695,7 +696,7 @@ export const SnapshotKVItem = { value: isSet(object.value) ? bytesFromBase64(object.value) : new Uint8Array() }; }, - toJSON(message: SnapshotKVItem): unknown { + toJSON(message: SnapshotKVItem): JsonSafe { const obj: any = {}; message.key !== undefined && (obj.key = base64FromBytes(message.key !== undefined ? message.key : new Uint8Array())); message.value !== undefined && (obj.value = base64FromBytes(message.value !== undefined ? message.value : new Uint8Array())); @@ -754,7 +755,7 @@ export const SnapshotSchema = { keys: Array.isArray(object?.keys) ? object.keys.map((e: any) => bytesFromBase64(e)) : [] }; }, - toJSON(message: SnapshotSchema): unknown { + toJSON(message: SnapshotSchema): JsonSafe { const obj: any = {}; if (message.keys) { obj.keys = message.keys.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); diff --git a/__fixtures__/output1/cosmos/base/store/v1beta1/commit_info.ts b/__fixtures__/output1/cosmos/base/store/v1beta1/commit_info.ts index b58c957b88..9dc4ce043d 100644 --- a/__fixtures__/output1/cosmos/base/store/v1beta1/commit_info.ts +++ b/__fixtures__/output1/cosmos/base/store/v1beta1/commit_info.ts @@ -1,5 +1,6 @@ import { Long, isSet, DeepPartial, bytesFromBase64, base64FromBytes } from "../../../../helpers"; import * as _m0 from "protobufjs/minimal"; +import { JsonSafe } from "../../../../json-safe"; export const protobufPackage = "cosmos.base.store.v1beta1"; /** * CommitInfo defines commit information used by the multi-store when committing @@ -91,7 +92,7 @@ export const CommitInfo = { storeInfos: Array.isArray(object?.storeInfos) ? object.storeInfos.map((e: any) => StoreInfo.fromJSON(e)) : [] }; }, - toJSON(message: CommitInfo): unknown { + toJSON(message: CommitInfo): JsonSafe { const obj: any = {}; message.version !== undefined && (obj.version = (message.version || Long.ZERO).toString()); if (message.storeInfos) { @@ -166,7 +167,7 @@ export const StoreInfo = { commitId: isSet(object.commitId) ? CommitID.fromJSON(object.commitId) : undefined }; }, - toJSON(message: StoreInfo): unknown { + toJSON(message: StoreInfo): JsonSafe { const obj: any = {}; message.name !== undefined && (obj.name = message.name); message.commitId !== undefined && (obj.commitId = message.commitId ? CommitID.toJSON(message.commitId) : undefined); @@ -233,7 +234,7 @@ export const CommitID = { hash: isSet(object.hash) ? bytesFromBase64(object.hash) : new Uint8Array() }; }, - toJSON(message: CommitID): unknown { + toJSON(message: CommitID): JsonSafe { const obj: any = {}; message.version !== undefined && (obj.version = (message.version || Long.ZERO).toString()); message.hash !== undefined && (obj.hash = base64FromBytes(message.hash !== undefined ? message.hash : new Uint8Array())); diff --git a/__fixtures__/output1/cosmos/base/store/v1beta1/listening.ts b/__fixtures__/output1/cosmos/base/store/v1beta1/listening.ts index 7f431f9ece..a1b4237af7 100644 --- a/__fixtures__/output1/cosmos/base/store/v1beta1/listening.ts +++ b/__fixtures__/output1/cosmos/base/store/v1beta1/listening.ts @@ -1,5 +1,6 @@ import * as _m0 from "protobufjs/minimal"; import { isSet, bytesFromBase64, base64FromBytes, DeepPartial } from "../../../../helpers"; +import { JsonSafe } from "../../../../json-safe"; export const protobufPackage = "cosmos.base.store.v1beta1"; /** * StoreKVPair is a KVStore KVPair used for listening to state changes (Sets and Deletes) @@ -87,7 +88,7 @@ export const StoreKVPair = { value: isSet(object.value) ? bytesFromBase64(object.value) : new Uint8Array() }; }, - toJSON(message: StoreKVPair): unknown { + toJSON(message: StoreKVPair): JsonSafe { const obj: any = {}; message.storeKey !== undefined && (obj.storeKey = message.storeKey); message.delete !== undefined && (obj.delete = message.delete); diff --git a/__fixtures__/output1/cosmos/base/tendermint/v1beta1/query.ts b/__fixtures__/output1/cosmos/base/tendermint/v1beta1/query.ts index 7b50ea6686..1e72fa6712 100644 --- a/__fixtures__/output1/cosmos/base/tendermint/v1beta1/query.ts +++ b/__fixtures__/output1/cosmos/base/tendermint/v1beta1/query.ts @@ -5,6 +5,7 @@ import { Block, BlockSDKType } from "../../../../tendermint/types/block"; import { NodeInfo, NodeInfoSDKType } from "../../../../tendermint/p2p/types"; import { Long, isSet, DeepPartial } from "../../../../helpers"; import * as _m0 from "protobufjs/minimal"; +import { JsonSafe } from "../../../../json-safe"; export const protobufPackage = "cosmos.base.tendermint.v1beta1"; /** GetValidatorSetByHeightRequest is the request type for the Query/GetValidatorSetByHeight RPC method. */ export interface GetValidatorSetByHeightRequest { @@ -204,7 +205,7 @@ export const GetValidatorSetByHeightRequest = { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; }, - toJSON(message: GetValidatorSetByHeightRequest): unknown { + toJSON(message: GetValidatorSetByHeightRequest): JsonSafe { const obj: any = {}; message.height !== undefined && (obj.height = (message.height || Long.ZERO).toString()); message.pagination !== undefined && (obj.pagination = message.pagination ? PageRequest.toJSON(message.pagination) : undefined); @@ -279,7 +280,7 @@ export const GetValidatorSetByHeightResponse = { pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined }; }, - toJSON(message: GetValidatorSetByHeightResponse): unknown { + toJSON(message: GetValidatorSetByHeightResponse): JsonSafe { const obj: any = {}; message.blockHeight !== undefined && (obj.blockHeight = (message.blockHeight || Long.ZERO).toString()); if (message.validators) { @@ -350,7 +351,7 @@ export const GetLatestValidatorSetRequest = { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; }, - toJSON(message: GetLatestValidatorSetRequest): unknown { + toJSON(message: GetLatestValidatorSetRequest): JsonSafe { const obj: any = {}; message.pagination !== undefined && (obj.pagination = message.pagination ? PageRequest.toJSON(message.pagination) : undefined); return obj; @@ -421,7 +422,7 @@ export const GetLatestValidatorSetResponse = { pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined }; }, - toJSON(message: GetLatestValidatorSetResponse): unknown { + toJSON(message: GetLatestValidatorSetResponse): JsonSafe { const obj: any = {}; message.blockHeight !== undefined && (obj.blockHeight = (message.blockHeight || Long.ZERO).toString()); if (message.validators) { @@ -516,7 +517,7 @@ export const Validator = { proposerPriority: isSet(object.proposerPriority) ? Long.fromValue(object.proposerPriority) : Long.ZERO }; }, - toJSON(message: Validator): unknown { + toJSON(message: Validator): JsonSafe { const obj: any = {}; message.address !== undefined && (obj.address = message.address); message.pubKey !== undefined && (obj.pubKey = message.pubKey ? Any.toJSON(message.pubKey) : undefined); @@ -583,7 +584,7 @@ export const GetBlockByHeightRequest = { height: isSet(object.height) ? Long.fromValue(object.height) : Long.ZERO }; }, - toJSON(message: GetBlockByHeightRequest): unknown { + toJSON(message: GetBlockByHeightRequest): JsonSafe { const obj: any = {}; message.height !== undefined && (obj.height = (message.height || Long.ZERO).toString()); return obj; @@ -646,7 +647,7 @@ export const GetBlockByHeightResponse = { block: isSet(object.block) ? Block.fromJSON(object.block) : undefined }; }, - toJSON(message: GetBlockByHeightResponse): unknown { + toJSON(message: GetBlockByHeightResponse): JsonSafe { const obj: any = {}; message.blockId !== undefined && (obj.blockId = message.blockId ? BlockID.toJSON(message.blockId) : undefined); message.block !== undefined && (obj.block = message.block ? Block.toJSON(message.block) : undefined); @@ -695,7 +696,7 @@ export const GetLatestBlockRequest = { fromJSON(_: any): GetLatestBlockRequest { return {}; }, - toJSON(_: GetLatestBlockRequest): unknown { + toJSON(_: GetLatestBlockRequest): JsonSafe { const obj: any = {}; return obj; }, @@ -753,7 +754,7 @@ export const GetLatestBlockResponse = { block: isSet(object.block) ? Block.fromJSON(object.block) : undefined }; }, - toJSON(message: GetLatestBlockResponse): unknown { + toJSON(message: GetLatestBlockResponse): JsonSafe { const obj: any = {}; message.blockId !== undefined && (obj.blockId = message.blockId ? BlockID.toJSON(message.blockId) : undefined); message.block !== undefined && (obj.block = message.block ? Block.toJSON(message.block) : undefined); @@ -802,7 +803,7 @@ export const GetSyncingRequest = { fromJSON(_: any): GetSyncingRequest { return {}; }, - toJSON(_: GetSyncingRequest): unknown { + toJSON(_: GetSyncingRequest): JsonSafe { const obj: any = {}; return obj; }, @@ -852,7 +853,7 @@ export const GetSyncingResponse = { syncing: isSet(object.syncing) ? Boolean(object.syncing) : false }; }, - toJSON(message: GetSyncingResponse): unknown { + toJSON(message: GetSyncingResponse): JsonSafe { const obj: any = {}; message.syncing !== undefined && (obj.syncing = message.syncing); return obj; @@ -897,7 +898,7 @@ export const GetNodeInfoRequest = { fromJSON(_: any): GetNodeInfoRequest { return {}; }, - toJSON(_: GetNodeInfoRequest): unknown { + toJSON(_: GetNodeInfoRequest): JsonSafe { const obj: any = {}; return obj; }, @@ -955,7 +956,7 @@ export const GetNodeInfoResponse = { applicationVersion: isSet(object.applicationVersion) ? VersionInfo.fromJSON(object.applicationVersion) : undefined }; }, - toJSON(message: GetNodeInfoResponse): unknown { + toJSON(message: GetNodeInfoResponse): JsonSafe { const obj: any = {}; message.nodeInfo !== undefined && (obj.nodeInfo = message.nodeInfo ? NodeInfo.toJSON(message.nodeInfo) : undefined); message.applicationVersion !== undefined && (obj.applicationVersion = message.applicationVersion ? VersionInfo.toJSON(message.applicationVersion) : undefined); @@ -1070,7 +1071,7 @@ export const VersionInfo = { cosmosSdkVersion: isSet(object.cosmosSdkVersion) ? String(object.cosmosSdkVersion) : "" }; }, - toJSON(message: VersionInfo): unknown { + toJSON(message: VersionInfo): JsonSafe { const obj: any = {}; message.name !== undefined && (obj.name = message.name); message.appName !== undefined && (obj.appName = message.appName); @@ -1177,7 +1178,7 @@ export const Module = { sum: isSet(object.sum) ? String(object.sum) : "" }; }, - toJSON(message: Module): unknown { + toJSON(message: Module): JsonSafe { const obj: any = {}; message.path !== undefined && (obj.path = message.path); message.version !== undefined && (obj.version = message.version); diff --git a/__fixtures__/output1/cosmos/base/v1beta1/coin.ts b/__fixtures__/output1/cosmos/base/v1beta1/coin.ts index e476d6898b..9d16e101ea 100644 --- a/__fixtures__/output1/cosmos/base/v1beta1/coin.ts +++ b/__fixtures__/output1/cosmos/base/v1beta1/coin.ts @@ -1,5 +1,6 @@ import * as _m0 from "protobufjs/minimal"; import { isSet, DeepPartial } from "../../../helpers"; +import { JsonSafe } from "../../../json-safe"; export const protobufPackage = "cosmos.base.v1beta1"; /** * Coin defines a token with a denomination and an amount. @@ -99,7 +100,7 @@ export const Coin = { amount: isSet(object.amount) ? String(object.amount) : "" }; }, - toJSON(message: Coin): unknown { + toJSON(message: Coin): JsonSafe { const obj: any = {}; message.denom !== undefined && (obj.denom = message.denom); message.amount !== undefined && (obj.amount = message.amount); @@ -166,7 +167,7 @@ export const DecCoin = { amount: isSet(object.amount) ? String(object.amount) : "" }; }, - toJSON(message: DecCoin): unknown { + toJSON(message: DecCoin): JsonSafe { const obj: any = {}; message.denom !== undefined && (obj.denom = message.denom); message.amount !== undefined && (obj.amount = message.amount); @@ -225,7 +226,7 @@ export const IntProto = { int: isSet(object.int) ? String(object.int) : "" }; }, - toJSON(message: IntProto): unknown { + toJSON(message: IntProto): JsonSafe { const obj: any = {}; message.int !== undefined && (obj.int = message.int); return obj; @@ -280,7 +281,7 @@ export const DecProto = { dec: isSet(object.dec) ? String(object.dec) : "" }; }, - toJSON(message: DecProto): unknown { + toJSON(message: DecProto): JsonSafe { const obj: any = {}; message.dec !== undefined && (obj.dec = message.dec); return obj; diff --git a/__fixtures__/output1/cosmos/capability/v1beta1/capability.ts b/__fixtures__/output1/cosmos/capability/v1beta1/capability.ts index 5b452dbf9d..551a11153f 100644 --- a/__fixtures__/output1/cosmos/capability/v1beta1/capability.ts +++ b/__fixtures__/output1/cosmos/capability/v1beta1/capability.ts @@ -1,5 +1,6 @@ import { Long, isSet, DeepPartial } from "../../../helpers"; import * as _m0 from "protobufjs/minimal"; +import { JsonSafe } from "../../../json-safe"; export const protobufPackage = "cosmos.capability.v1beta1"; /** * Capability defines an implementation of an object capability. The index @@ -79,7 +80,7 @@ export const Capability = { index: isSet(object.index) ? Long.fromValue(object.index) : Long.UZERO }; }, - toJSON(message: Capability): unknown { + toJSON(message: Capability): JsonSafe { const obj: any = {}; message.index !== undefined && (obj.index = (message.index || Long.UZERO).toString()); return obj; @@ -142,7 +143,7 @@ export const Owner = { name: isSet(object.name) ? String(object.name) : "" }; }, - toJSON(message: Owner): unknown { + toJSON(message: Owner): JsonSafe { const obj: any = {}; message.module !== undefined && (obj.module = message.module); message.name !== undefined && (obj.name = message.name); @@ -201,7 +202,7 @@ export const CapabilityOwners = { owners: Array.isArray(object?.owners) ? object.owners.map((e: any) => Owner.fromJSON(e)) : [] }; }, - toJSON(message: CapabilityOwners): unknown { + toJSON(message: CapabilityOwners): JsonSafe { const obj: any = {}; if (message.owners) { obj.owners = message.owners.map(e => e ? Owner.toJSON(e) : undefined); diff --git a/__fixtures__/output1/cosmos/capability/v1beta1/genesis.ts b/__fixtures__/output1/cosmos/capability/v1beta1/genesis.ts index 05ebc16c45..d4c183b99e 100644 --- a/__fixtures__/output1/cosmos/capability/v1beta1/genesis.ts +++ b/__fixtures__/output1/cosmos/capability/v1beta1/genesis.ts @@ -1,6 +1,7 @@ import { CapabilityOwners, CapabilityOwnersSDKType } from "./capability"; import { Long, isSet, DeepPartial } from "../../../helpers"; import * as _m0 from "protobufjs/minimal"; +import { JsonSafe } from "../../../json-safe"; export const protobufPackage = "cosmos.capability.v1beta1"; /** GenesisOwners defines the capability owners with their corresponding index. */ export interface GenesisOwners { @@ -71,7 +72,7 @@ export const GenesisOwners = { indexOwners: isSet(object.indexOwners) ? CapabilityOwners.fromJSON(object.indexOwners) : undefined }; }, - toJSON(message: GenesisOwners): unknown { + toJSON(message: GenesisOwners): JsonSafe { const obj: any = {}; message.index !== undefined && (obj.index = (message.index || Long.UZERO).toString()); message.indexOwners !== undefined && (obj.indexOwners = message.indexOwners ? CapabilityOwners.toJSON(message.indexOwners) : undefined); @@ -138,7 +139,7 @@ export const GenesisState = { owners: Array.isArray(object?.owners) ? object.owners.map((e: any) => GenesisOwners.fromJSON(e)) : [] }; }, - toJSON(message: GenesisState): unknown { + toJSON(message: GenesisState): JsonSafe { const obj: any = {}; message.index !== undefined && (obj.index = (message.index || Long.UZERO).toString()); if (message.owners) { diff --git a/__fixtures__/output1/cosmos/crisis/v1beta1/genesis.ts b/__fixtures__/output1/cosmos/crisis/v1beta1/genesis.ts index b9349e4c4e..9bcb50a0f1 100644 --- a/__fixtures__/output1/cosmos/crisis/v1beta1/genesis.ts +++ b/__fixtures__/output1/cosmos/crisis/v1beta1/genesis.ts @@ -1,6 +1,7 @@ import { Coin, CoinSDKType } from "../../base/v1beta1/coin"; import * as _m0 from "protobufjs/minimal"; import { isSet, DeepPartial } from "../../../helpers"; +import { JsonSafe } from "../../../json-safe"; export const protobufPackage = "cosmos.crisis.v1beta1"; /** GenesisState defines the crisis module's genesis state. */ export interface GenesisState { @@ -48,7 +49,7 @@ export const GenesisState = { constantFee: isSet(object.constantFee) ? Coin.fromJSON(object.constantFee) : undefined }; }, - toJSON(message: GenesisState): unknown { + toJSON(message: GenesisState): JsonSafe { const obj: any = {}; message.constantFee !== undefined && (obj.constantFee = message.constantFee ? Coin.toJSON(message.constantFee) : undefined); return obj; diff --git a/__fixtures__/output1/cosmos/crisis/v1beta1/tx.ts b/__fixtures__/output1/cosmos/crisis/v1beta1/tx.ts index 48e251ac07..e67a93f6c1 100644 --- a/__fixtures__/output1/cosmos/crisis/v1beta1/tx.ts +++ b/__fixtures__/output1/cosmos/crisis/v1beta1/tx.ts @@ -1,5 +1,6 @@ import * as _m0 from "protobufjs/minimal"; import { isSet, DeepPartial } from "../../../helpers"; +import { JsonSafe } from "../../../json-safe"; export const protobufPackage = "cosmos.crisis.v1beta1"; /** MsgVerifyInvariant represents a message to verify a particular invariance. */ export interface MsgVerifyInvariant { @@ -67,7 +68,7 @@ export const MsgVerifyInvariant = { invariantRoute: isSet(object.invariantRoute) ? String(object.invariantRoute) : "" }; }, - toJSON(message: MsgVerifyInvariant): unknown { + toJSON(message: MsgVerifyInvariant): JsonSafe { const obj: any = {}; message.sender !== undefined && (obj.sender = message.sender); message.invariantModuleName !== undefined && (obj.invariantModuleName = message.invariantModuleName); @@ -120,7 +121,7 @@ export const MsgVerifyInvariantResponse = { fromJSON(_: any): MsgVerifyInvariantResponse { return {}; }, - toJSON(_: MsgVerifyInvariantResponse): unknown { + toJSON(_: MsgVerifyInvariantResponse): JsonSafe { const obj: any = {}; return obj; }, diff --git a/__fixtures__/output1/cosmos/crypto/ed25519/keys.ts b/__fixtures__/output1/cosmos/crypto/ed25519/keys.ts index eadde225f1..d54d168e81 100644 --- a/__fixtures__/output1/cosmos/crypto/ed25519/keys.ts +++ b/__fixtures__/output1/cosmos/crypto/ed25519/keys.ts @@ -1,5 +1,6 @@ import * as _m0 from "protobufjs/minimal"; import { isSet, bytesFromBase64, base64FromBytes, DeepPartial } from "../../../helpers"; +import { JsonSafe } from "../../../json-safe"; export const protobufPackage = "cosmos.crypto.ed25519"; /** * PubKey is an ed25519 public key for handling Tendermint keys in SDK. @@ -69,7 +70,7 @@ export const PubKey = { key: isSet(object.key) ? bytesFromBase64(object.key) : new Uint8Array() }; }, - toJSON(message: PubKey): unknown { + toJSON(message: PubKey): JsonSafe { const obj: any = {}; message.key !== undefined && (obj.key = base64FromBytes(message.key !== undefined ? message.key : new Uint8Array())); return obj; @@ -124,7 +125,7 @@ export const PrivKey = { key: isSet(object.key) ? bytesFromBase64(object.key) : new Uint8Array() }; }, - toJSON(message: PrivKey): unknown { + toJSON(message: PrivKey): JsonSafe { const obj: any = {}; message.key !== undefined && (obj.key = base64FromBytes(message.key !== undefined ? message.key : new Uint8Array())); return obj; diff --git a/__fixtures__/output1/cosmos/crypto/hd/v1/hd.ts b/__fixtures__/output1/cosmos/crypto/hd/v1/hd.ts index 4a4624d6b7..36d9ef0f3a 100644 --- a/__fixtures__/output1/cosmos/crypto/hd/v1/hd.ts +++ b/__fixtures__/output1/cosmos/crypto/hd/v1/hd.ts @@ -1,5 +1,6 @@ import * as _m0 from "protobufjs/minimal"; import { isSet, DeepPartial } from "../../../../helpers"; +import { JsonSafe } from "../../../../json-safe"; export const protobufPackage = "cosmos.crypto.hd.v1"; /** BIP44Params is used as path field in ledger item in Record. */ export interface BIP44Params { @@ -91,7 +92,7 @@ export const BIP44Params = { addressIndex: isSet(object.addressIndex) ? Number(object.addressIndex) : 0 }; }, - toJSON(message: BIP44Params): unknown { + toJSON(message: BIP44Params): JsonSafe { const obj: any = {}; message.purpose !== undefined && (obj.purpose = Math.round(message.purpose)); message.coinType !== undefined && (obj.coinType = Math.round(message.coinType)); diff --git a/__fixtures__/output1/cosmos/crypto/keyring/v1/record.ts b/__fixtures__/output1/cosmos/crypto/keyring/v1/record.ts index 2f57c172cc..9a203411b7 100644 --- a/__fixtures__/output1/cosmos/crypto/keyring/v1/record.ts +++ b/__fixtures__/output1/cosmos/crypto/keyring/v1/record.ts @@ -2,6 +2,7 @@ import { Any, AnySDKType } from "../../../../google/protobuf/any"; import { BIP44Params, BIP44ParamsSDKType } from "../../hd/v1/hd"; import * as _m0 from "protobufjs/minimal"; import { isSet, DeepPartial } from "../../../../helpers"; +import { JsonSafe } from "../../../../json-safe"; export const protobufPackage = "cosmos.crypto.keyring.v1"; /** Record is used for representing a key in the keyring. */ export interface Record { @@ -133,7 +134,7 @@ export const Record = { offline: isSet(object.offline) ? Record_Offline.fromJSON(object.offline) : undefined }; }, - toJSON(message: Record): unknown { + toJSON(message: Record): JsonSafe { const obj: any = {}; message.name !== undefined && (obj.name = message.name); message.pubKey !== undefined && (obj.pubKey = message.pubKey ? Any.toJSON(message.pubKey) : undefined); @@ -216,7 +217,7 @@ export const Record_Local = { privKeyType: isSet(object.privKeyType) ? String(object.privKeyType) : "" }; }, - toJSON(message: Record_Local): unknown { + toJSON(message: Record_Local): JsonSafe { const obj: any = {}; message.privKey !== undefined && (obj.privKey = message.privKey ? Any.toJSON(message.privKey) : undefined); message.privKeyType !== undefined && (obj.privKeyType = message.privKeyType); @@ -275,7 +276,7 @@ export const Record_Ledger = { path: isSet(object.path) ? BIP44Params.fromJSON(object.path) : undefined }; }, - toJSON(message: Record_Ledger): unknown { + toJSON(message: Record_Ledger): JsonSafe { const obj: any = {}; message.path !== undefined && (obj.path = message.path ? BIP44Params.toJSON(message.path) : undefined); return obj; @@ -320,7 +321,7 @@ export const Record_Multi = { fromJSON(_: any): Record_Multi { return {}; }, - toJSON(_: Record_Multi): unknown { + toJSON(_: Record_Multi): JsonSafe { const obj: any = {}; return obj; }, @@ -360,7 +361,7 @@ export const Record_Offline = { fromJSON(_: any): Record_Offline { return {}; }, - toJSON(_: Record_Offline): unknown { + toJSON(_: Record_Offline): JsonSafe { const obj: any = {}; return obj; }, diff --git a/__fixtures__/output1/cosmos/crypto/multisig/keys.ts b/__fixtures__/output1/cosmos/crypto/multisig/keys.ts index c18c7e4b75..a7caeadb4c 100644 --- a/__fixtures__/output1/cosmos/crypto/multisig/keys.ts +++ b/__fixtures__/output1/cosmos/crypto/multisig/keys.ts @@ -1,6 +1,7 @@ import { Any, AnySDKType } from "../../../google/protobuf/any"; import * as _m0 from "protobufjs/minimal"; import { isSet, DeepPartial } from "../../../helpers"; +import { JsonSafe } from "../../../json-safe"; export const protobufPackage = "cosmos.crypto.multisig"; /** * LegacyAminoPubKey specifies a public key type @@ -62,7 +63,7 @@ export const LegacyAminoPubKey = { publicKeys: Array.isArray(object?.publicKeys) ? object.publicKeys.map((e: any) => Any.fromJSON(e)) : [] }; }, - toJSON(message: LegacyAminoPubKey): unknown { + toJSON(message: LegacyAminoPubKey): JsonSafe { const obj: any = {}; message.threshold !== undefined && (obj.threshold = Math.round(message.threshold)); if (message.publicKeys) { diff --git a/__fixtures__/output1/cosmos/crypto/multisig/v1beta1/multisig.ts b/__fixtures__/output1/cosmos/crypto/multisig/v1beta1/multisig.ts index cc9c658da1..ace83917a5 100644 --- a/__fixtures__/output1/cosmos/crypto/multisig/v1beta1/multisig.ts +++ b/__fixtures__/output1/cosmos/crypto/multisig/v1beta1/multisig.ts @@ -1,5 +1,6 @@ import * as _m0 from "protobufjs/minimal"; import { bytesFromBase64, base64FromBytes, DeepPartial, isSet } from "../../../../helpers"; +import { JsonSafe } from "../../../../json-safe"; export const protobufPackage = "cosmos.crypto.multisig.v1beta1"; /** * MultiSignature wraps the signatures from a multisig.LegacyAminoPubKey. @@ -71,7 +72,7 @@ export const MultiSignature = { signatures: Array.isArray(object?.signatures) ? object.signatures.map((e: any) => bytesFromBase64(e)) : [] }; }, - toJSON(message: MultiSignature): unknown { + toJSON(message: MultiSignature): JsonSafe { const obj: any = {}; if (message.signatures) { obj.signatures = message.signatures.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); @@ -142,7 +143,7 @@ export const CompactBitArray = { elems: isSet(object.elems) ? bytesFromBase64(object.elems) : new Uint8Array() }; }, - toJSON(message: CompactBitArray): unknown { + toJSON(message: CompactBitArray): JsonSafe { const obj: any = {}; message.extraBitsStored !== undefined && (obj.extraBitsStored = Math.round(message.extraBitsStored)); message.elems !== undefined && (obj.elems = base64FromBytes(message.elems !== undefined ? message.elems : new Uint8Array())); diff --git a/__fixtures__/output1/cosmos/crypto/secp256k1/keys.ts b/__fixtures__/output1/cosmos/crypto/secp256k1/keys.ts index 329b6f3efc..02e90878c8 100644 --- a/__fixtures__/output1/cosmos/crypto/secp256k1/keys.ts +++ b/__fixtures__/output1/cosmos/crypto/secp256k1/keys.ts @@ -1,5 +1,6 @@ import * as _m0 from "protobufjs/minimal"; import { isSet, bytesFromBase64, base64FromBytes, DeepPartial } from "../../../helpers"; +import { JsonSafe } from "../../../json-safe"; export const protobufPackage = "cosmos.crypto.secp256k1"; /** * PubKey defines a secp256k1 public key @@ -63,7 +64,7 @@ export const PubKey = { key: isSet(object.key) ? bytesFromBase64(object.key) : new Uint8Array() }; }, - toJSON(message: PubKey): unknown { + toJSON(message: PubKey): JsonSafe { const obj: any = {}; message.key !== undefined && (obj.key = base64FromBytes(message.key !== undefined ? message.key : new Uint8Array())); return obj; @@ -118,7 +119,7 @@ export const PrivKey = { key: isSet(object.key) ? bytesFromBase64(object.key) : new Uint8Array() }; }, - toJSON(message: PrivKey): unknown { + toJSON(message: PrivKey): JsonSafe { const obj: any = {}; message.key !== undefined && (obj.key = base64FromBytes(message.key !== undefined ? message.key : new Uint8Array())); return obj; diff --git a/__fixtures__/output1/cosmos/crypto/secp256r1/keys.ts b/__fixtures__/output1/cosmos/crypto/secp256r1/keys.ts index 9cfc693169..74afb2201c 100644 --- a/__fixtures__/output1/cosmos/crypto/secp256r1/keys.ts +++ b/__fixtures__/output1/cosmos/crypto/secp256r1/keys.ts @@ -1,5 +1,6 @@ import * as _m0 from "protobufjs/minimal"; import { isSet, bytesFromBase64, base64FromBytes, DeepPartial } from "../../../helpers"; +import { JsonSafe } from "../../../json-safe"; export const protobufPackage = "cosmos.crypto.secp256r1"; /** PubKey defines a secp256r1 ECDSA public key. */ export interface PubKey { @@ -56,7 +57,7 @@ export const PubKey = { key: isSet(object.key) ? bytesFromBase64(object.key) : new Uint8Array() }; }, - toJSON(message: PubKey): unknown { + toJSON(message: PubKey): JsonSafe { const obj: any = {}; message.key !== undefined && (obj.key = base64FromBytes(message.key !== undefined ? message.key : new Uint8Array())); return obj; @@ -111,7 +112,7 @@ export const PrivKey = { secret: isSet(object.secret) ? bytesFromBase64(object.secret) : new Uint8Array() }; }, - toJSON(message: PrivKey): unknown { + toJSON(message: PrivKey): JsonSafe { const obj: any = {}; message.secret !== undefined && (obj.secret = base64FromBytes(message.secret !== undefined ? message.secret : new Uint8Array())); return obj; diff --git a/__fixtures__/output1/cosmos/distribution/v1beta1/distribution.ts b/__fixtures__/output1/cosmos/distribution/v1beta1/distribution.ts index 641d840ae1..a1275893f5 100644 --- a/__fixtures__/output1/cosmos/distribution/v1beta1/distribution.ts +++ b/__fixtures__/output1/cosmos/distribution/v1beta1/distribution.ts @@ -1,6 +1,7 @@ import { DecCoin, DecCoinSDKType, Coin, CoinSDKType } from "../../base/v1beta1/coin"; import { Long, isSet, DeepPartial } from "../../../helpers"; import * as _m0 from "protobufjs/minimal"; +import { JsonSafe } from "../../../json-safe"; export const protobufPackage = "cosmos.distribution.v1beta1"; /** Params defines the set of params for the distribution module. */ export interface Params { @@ -278,7 +279,7 @@ export const Params = { withdrawAddrEnabled: isSet(object.withdrawAddrEnabled) ? Boolean(object.withdrawAddrEnabled) : false }; }, - toJSON(message: Params): unknown { + toJSON(message: Params): JsonSafe { const obj: any = {}; message.communityTax !== undefined && (obj.communityTax = message.communityTax); message.baseProposerReward !== undefined && (obj.baseProposerReward = message.baseProposerReward); @@ -353,7 +354,7 @@ export const ValidatorHistoricalRewards = { referenceCount: isSet(object.referenceCount) ? Number(object.referenceCount) : 0 }; }, - toJSON(message: ValidatorHistoricalRewards): unknown { + toJSON(message: ValidatorHistoricalRewards): JsonSafe { const obj: any = {}; if (message.cumulativeRewardRatio) { obj.cumulativeRewardRatio = message.cumulativeRewardRatio.map(e => e ? DecCoin.toJSON(e) : undefined); @@ -428,7 +429,7 @@ export const ValidatorCurrentRewards = { period: isSet(object.period) ? Long.fromValue(object.period) : Long.UZERO }; }, - toJSON(message: ValidatorCurrentRewards): unknown { + toJSON(message: ValidatorCurrentRewards): JsonSafe { const obj: any = {}; if (message.rewards) { obj.rewards = message.rewards.map(e => e ? DecCoin.toJSON(e) : undefined); @@ -495,7 +496,7 @@ export const ValidatorAccumulatedCommission = { commission: Array.isArray(object?.commission) ? object.commission.map((e: any) => DecCoin.fromJSON(e)) : [] }; }, - toJSON(message: ValidatorAccumulatedCommission): unknown { + toJSON(message: ValidatorAccumulatedCommission): JsonSafe { const obj: any = {}; if (message.commission) { obj.commission = message.commission.map(e => e ? DecCoin.toJSON(e) : undefined); @@ -558,7 +559,7 @@ export const ValidatorOutstandingRewards = { rewards: Array.isArray(object?.rewards) ? object.rewards.map((e: any) => DecCoin.fromJSON(e)) : [] }; }, - toJSON(message: ValidatorOutstandingRewards): unknown { + toJSON(message: ValidatorOutstandingRewards): JsonSafe { const obj: any = {}; if (message.rewards) { obj.rewards = message.rewards.map(e => e ? DecCoin.toJSON(e) : undefined); @@ -629,7 +630,7 @@ export const ValidatorSlashEvent = { fraction: isSet(object.fraction) ? String(object.fraction) : "" }; }, - toJSON(message: ValidatorSlashEvent): unknown { + toJSON(message: ValidatorSlashEvent): JsonSafe { const obj: any = {}; message.validatorPeriod !== undefined && (obj.validatorPeriod = (message.validatorPeriod || Long.UZERO).toString()); message.fraction !== undefined && (obj.fraction = message.fraction); @@ -688,7 +689,7 @@ export const ValidatorSlashEvents = { validatorSlashEvents: Array.isArray(object?.validatorSlashEvents) ? object.validatorSlashEvents.map((e: any) => ValidatorSlashEvent.fromJSON(e)) : [] }; }, - toJSON(message: ValidatorSlashEvents): unknown { + toJSON(message: ValidatorSlashEvents): JsonSafe { const obj: any = {}; if (message.validatorSlashEvents) { obj.validatorSlashEvents = message.validatorSlashEvents.map(e => e ? ValidatorSlashEvent.toJSON(e) : undefined); @@ -751,7 +752,7 @@ export const FeePool = { communityPool: Array.isArray(object?.communityPool) ? object.communityPool.map((e: any) => DecCoin.fromJSON(e)) : [] }; }, - toJSON(message: FeePool): unknown { + toJSON(message: FeePool): JsonSafe { const obj: any = {}; if (message.communityPool) { obj.communityPool = message.communityPool.map(e => e ? DecCoin.toJSON(e) : undefined); @@ -838,7 +839,7 @@ export const CommunityPoolSpendProposal = { amount: Array.isArray(object?.amount) ? object.amount.map((e: any) => Coin.fromJSON(e)) : [] }; }, - toJSON(message: CommunityPoolSpendProposal): unknown { + toJSON(message: CommunityPoolSpendProposal): JsonSafe { const obj: any = {}; message.title !== undefined && (obj.title = message.title); message.description !== undefined && (obj.description = message.description); @@ -929,7 +930,7 @@ export const DelegatorStartingInfo = { height: isSet(object.height) ? Long.fromValue(object.height) : Long.UZERO }; }, - toJSON(message: DelegatorStartingInfo): unknown { + toJSON(message: DelegatorStartingInfo): JsonSafe { const obj: any = {}; message.previousPeriod !== undefined && (obj.previousPeriod = (message.previousPeriod || Long.UZERO).toString()); message.stake !== undefined && (obj.stake = message.stake); @@ -1000,7 +1001,7 @@ export const DelegationDelegatorReward = { reward: Array.isArray(object?.reward) ? object.reward.map((e: any) => DecCoin.fromJSON(e)) : [] }; }, - toJSON(message: DelegationDelegatorReward): unknown { + toJSON(message: DelegationDelegatorReward): JsonSafe { const obj: any = {}; message.validatorAddress !== undefined && (obj.validatorAddress = message.validatorAddress); if (message.reward) { @@ -1099,7 +1100,7 @@ export const CommunityPoolSpendProposalWithDeposit = { deposit: isSet(object.deposit) ? String(object.deposit) : "" }; }, - toJSON(message: CommunityPoolSpendProposalWithDeposit): unknown { + toJSON(message: CommunityPoolSpendProposalWithDeposit): JsonSafe { const obj: any = {}; message.title !== undefined && (obj.title = message.title); message.description !== undefined && (obj.description = message.description); diff --git a/__fixtures__/output1/cosmos/distribution/v1beta1/genesis.ts b/__fixtures__/output1/cosmos/distribution/v1beta1/genesis.ts index 5601c1fcf6..893b928dbb 100644 --- a/__fixtures__/output1/cosmos/distribution/v1beta1/genesis.ts +++ b/__fixtures__/output1/cosmos/distribution/v1beta1/genesis.ts @@ -2,6 +2,7 @@ import { DecCoin, DecCoinSDKType } from "../../base/v1beta1/coin"; import { ValidatorAccumulatedCommission, ValidatorAccumulatedCommissionSDKType, ValidatorHistoricalRewards, ValidatorHistoricalRewardsSDKType, ValidatorCurrentRewards, ValidatorCurrentRewardsSDKType, DelegatorStartingInfo, DelegatorStartingInfoSDKType, ValidatorSlashEvent, ValidatorSlashEventSDKType, Params, ParamsSDKType, FeePool, FeePoolSDKType } from "./distribution"; import { Long, isSet, DeepPartial } from "../../../helpers"; import * as _m0 from "protobufjs/minimal"; +import { JsonSafe } from "../../../json-safe"; export const protobufPackage = "cosmos.distribution.v1beta1"; /** * DelegatorWithdrawInfo is the address for where distributions rewards are @@ -197,7 +198,7 @@ export const DelegatorWithdrawInfo = { withdrawAddress: isSet(object.withdrawAddress) ? String(object.withdrawAddress) : "" }; }, - toJSON(message: DelegatorWithdrawInfo): unknown { + toJSON(message: DelegatorWithdrawInfo): JsonSafe { const obj: any = {}; message.delegatorAddress !== undefined && (obj.delegatorAddress = message.delegatorAddress); message.withdrawAddress !== undefined && (obj.withdrawAddress = message.withdrawAddress); @@ -264,7 +265,7 @@ export const ValidatorOutstandingRewardsRecord = { outstandingRewards: Array.isArray(object?.outstandingRewards) ? object.outstandingRewards.map((e: any) => DecCoin.fromJSON(e)) : [] }; }, - toJSON(message: ValidatorOutstandingRewardsRecord): unknown { + toJSON(message: ValidatorOutstandingRewardsRecord): JsonSafe { const obj: any = {}; message.validatorAddress !== undefined && (obj.validatorAddress = message.validatorAddress); if (message.outstandingRewards) { @@ -339,7 +340,7 @@ export const ValidatorAccumulatedCommissionRecord = { accumulated: isSet(object.accumulated) ? ValidatorAccumulatedCommission.fromJSON(object.accumulated) : undefined }; }, - toJSON(message: ValidatorAccumulatedCommissionRecord): unknown { + toJSON(message: ValidatorAccumulatedCommissionRecord): JsonSafe { const obj: any = {}; message.validatorAddress !== undefined && (obj.validatorAddress = message.validatorAddress); message.accumulated !== undefined && (obj.accumulated = message.accumulated ? ValidatorAccumulatedCommission.toJSON(message.accumulated) : undefined); @@ -414,7 +415,7 @@ export const ValidatorHistoricalRewardsRecord = { rewards: isSet(object.rewards) ? ValidatorHistoricalRewards.fromJSON(object.rewards) : undefined }; }, - toJSON(message: ValidatorHistoricalRewardsRecord): unknown { + toJSON(message: ValidatorHistoricalRewardsRecord): JsonSafe { const obj: any = {}; message.validatorAddress !== undefined && (obj.validatorAddress = message.validatorAddress); message.period !== undefined && (obj.period = (message.period || Long.UZERO).toString()); @@ -485,7 +486,7 @@ export const ValidatorCurrentRewardsRecord = { rewards: isSet(object.rewards) ? ValidatorCurrentRewards.fromJSON(object.rewards) : undefined }; }, - toJSON(message: ValidatorCurrentRewardsRecord): unknown { + toJSON(message: ValidatorCurrentRewardsRecord): JsonSafe { const obj: any = {}; message.validatorAddress !== undefined && (obj.validatorAddress = message.validatorAddress); message.rewards !== undefined && (obj.rewards = message.rewards ? ValidatorCurrentRewards.toJSON(message.rewards) : undefined); @@ -560,7 +561,7 @@ export const DelegatorStartingInfoRecord = { startingInfo: isSet(object.startingInfo) ? DelegatorStartingInfo.fromJSON(object.startingInfo) : undefined }; }, - toJSON(message: DelegatorStartingInfoRecord): unknown { + toJSON(message: DelegatorStartingInfoRecord): JsonSafe { const obj: any = {}; message.delegatorAddress !== undefined && (obj.delegatorAddress = message.delegatorAddress); message.validatorAddress !== undefined && (obj.validatorAddress = message.validatorAddress); @@ -647,7 +648,7 @@ export const ValidatorSlashEventRecord = { validatorSlashEvent: isSet(object.validatorSlashEvent) ? ValidatorSlashEvent.fromJSON(object.validatorSlashEvent) : undefined }; }, - toJSON(message: ValidatorSlashEventRecord): unknown { + toJSON(message: ValidatorSlashEventRecord): JsonSafe { const obj: any = {}; message.validatorAddress !== undefined && (obj.validatorAddress = message.validatorAddress); message.height !== undefined && (obj.height = (message.height || Long.UZERO).toString()); @@ -786,7 +787,7 @@ export const GenesisState = { validatorSlashEvents: Array.isArray(object?.validatorSlashEvents) ? object.validatorSlashEvents.map((e: any) => ValidatorSlashEventRecord.fromJSON(e)) : [] }; }, - toJSON(message: GenesisState): unknown { + toJSON(message: GenesisState): JsonSafe { const obj: any = {}; message.params !== undefined && (obj.params = message.params ? Params.toJSON(message.params) : undefined); message.feePool !== undefined && (obj.feePool = message.feePool ? FeePool.toJSON(message.feePool) : undefined); diff --git a/__fixtures__/output1/cosmos/distribution/v1beta1/query.ts b/__fixtures__/output1/cosmos/distribution/v1beta1/query.ts index a51c1b5d50..d75f59787c 100644 --- a/__fixtures__/output1/cosmos/distribution/v1beta1/query.ts +++ b/__fixtures__/output1/cosmos/distribution/v1beta1/query.ts @@ -3,6 +3,7 @@ import { Params, ParamsSDKType, ValidatorOutstandingRewards, ValidatorOutstandin import { DecCoin, DecCoinSDKType } from "../../base/v1beta1/coin"; import { Long, DeepPartial, isSet } from "../../../helpers"; import * as _m0 from "protobufjs/minimal"; +import { JsonSafe } from "../../../json-safe"; export const protobufPackage = "cosmos.distribution.v1beta1"; /** QueryParamsRequest is the request type for the Query/Params RPC method. */ export interface QueryParamsRequest {} @@ -293,7 +294,7 @@ export const QueryParamsRequest = { fromJSON(_: any): QueryParamsRequest { return {}; }, - toJSON(_: QueryParamsRequest): unknown { + toJSON(_: QueryParamsRequest): JsonSafe { const obj: any = {}; return obj; }, @@ -343,7 +344,7 @@ export const QueryParamsResponse = { params: isSet(object.params) ? Params.fromJSON(object.params) : undefined }; }, - toJSON(message: QueryParamsResponse): unknown { + toJSON(message: QueryParamsResponse): JsonSafe { const obj: any = {}; message.params !== undefined && (obj.params = message.params ? Params.toJSON(message.params) : undefined); return obj; @@ -398,7 +399,7 @@ export const QueryValidatorOutstandingRewardsRequest = { validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "" }; }, - toJSON(message: QueryValidatorOutstandingRewardsRequest): unknown { + toJSON(message: QueryValidatorOutstandingRewardsRequest): JsonSafe { const obj: any = {}; message.validatorAddress !== undefined && (obj.validatorAddress = message.validatorAddress); return obj; @@ -453,7 +454,7 @@ export const QueryValidatorOutstandingRewardsResponse = { rewards: isSet(object.rewards) ? ValidatorOutstandingRewards.fromJSON(object.rewards) : undefined }; }, - toJSON(message: QueryValidatorOutstandingRewardsResponse): unknown { + toJSON(message: QueryValidatorOutstandingRewardsResponse): JsonSafe { const obj: any = {}; message.rewards !== undefined && (obj.rewards = message.rewards ? ValidatorOutstandingRewards.toJSON(message.rewards) : undefined); return obj; @@ -508,7 +509,7 @@ export const QueryValidatorCommissionRequest = { validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "" }; }, - toJSON(message: QueryValidatorCommissionRequest): unknown { + toJSON(message: QueryValidatorCommissionRequest): JsonSafe { const obj: any = {}; message.validatorAddress !== undefined && (obj.validatorAddress = message.validatorAddress); return obj; @@ -563,7 +564,7 @@ export const QueryValidatorCommissionResponse = { commission: isSet(object.commission) ? ValidatorAccumulatedCommission.fromJSON(object.commission) : undefined }; }, - toJSON(message: QueryValidatorCommissionResponse): unknown { + toJSON(message: QueryValidatorCommissionResponse): JsonSafe { const obj: any = {}; message.commission !== undefined && (obj.commission = message.commission ? ValidatorAccumulatedCommission.toJSON(message.commission) : undefined); return obj; @@ -642,7 +643,7 @@ export const QueryValidatorSlashesRequest = { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; }, - toJSON(message: QueryValidatorSlashesRequest): unknown { + toJSON(message: QueryValidatorSlashesRequest): JsonSafe { const obj: any = {}; message.validatorAddress !== undefined && (obj.validatorAddress = message.validatorAddress); message.startingHeight !== undefined && (obj.startingHeight = (message.startingHeight || Long.UZERO).toString()); @@ -717,7 +718,7 @@ export const QueryValidatorSlashesResponse = { pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined }; }, - toJSON(message: QueryValidatorSlashesResponse): unknown { + toJSON(message: QueryValidatorSlashesResponse): JsonSafe { const obj: any = {}; if (message.slashes) { obj.slashes = message.slashes.map(e => e ? ValidatorSlashEvent.toJSON(e) : undefined); @@ -792,7 +793,7 @@ export const QueryDelegationRewardsRequest = { validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "" }; }, - toJSON(message: QueryDelegationRewardsRequest): unknown { + toJSON(message: QueryDelegationRewardsRequest): JsonSafe { const obj: any = {}; message.delegatorAddress !== undefined && (obj.delegatorAddress = message.delegatorAddress); message.validatorAddress !== undefined && (obj.validatorAddress = message.validatorAddress); @@ -851,7 +852,7 @@ export const QueryDelegationRewardsResponse = { rewards: Array.isArray(object?.rewards) ? object.rewards.map((e: any) => DecCoin.fromJSON(e)) : [] }; }, - toJSON(message: QueryDelegationRewardsResponse): unknown { + toJSON(message: QueryDelegationRewardsResponse): JsonSafe { const obj: any = {}; if (message.rewards) { obj.rewards = message.rewards.map(e => e ? DecCoin.toJSON(e) : undefined); @@ -914,7 +915,7 @@ export const QueryDelegationTotalRewardsRequest = { delegatorAddress: isSet(object.delegatorAddress) ? String(object.delegatorAddress) : "" }; }, - toJSON(message: QueryDelegationTotalRewardsRequest): unknown { + toJSON(message: QueryDelegationTotalRewardsRequest): JsonSafe { const obj: any = {}; message.delegatorAddress !== undefined && (obj.delegatorAddress = message.delegatorAddress); return obj; @@ -977,7 +978,7 @@ export const QueryDelegationTotalRewardsResponse = { total: Array.isArray(object?.total) ? object.total.map((e: any) => DecCoin.fromJSON(e)) : [] }; }, - toJSON(message: QueryDelegationTotalRewardsResponse): unknown { + toJSON(message: QueryDelegationTotalRewardsResponse): JsonSafe { const obj: any = {}; if (message.rewards) { obj.rewards = message.rewards.map(e => e ? DelegationDelegatorReward.toJSON(e) : undefined); @@ -1052,7 +1053,7 @@ export const QueryDelegatorValidatorsRequest = { delegatorAddress: isSet(object.delegatorAddress) ? String(object.delegatorAddress) : "" }; }, - toJSON(message: QueryDelegatorValidatorsRequest): unknown { + toJSON(message: QueryDelegatorValidatorsRequest): JsonSafe { const obj: any = {}; message.delegatorAddress !== undefined && (obj.delegatorAddress = message.delegatorAddress); return obj; @@ -1107,7 +1108,7 @@ export const QueryDelegatorValidatorsResponse = { validators: Array.isArray(object?.validators) ? object.validators.map((e: any) => String(e)) : [] }; }, - toJSON(message: QueryDelegatorValidatorsResponse): unknown { + toJSON(message: QueryDelegatorValidatorsResponse): JsonSafe { const obj: any = {}; if (message.validators) { obj.validators = message.validators.map(e => e); @@ -1170,7 +1171,7 @@ export const QueryDelegatorWithdrawAddressRequest = { delegatorAddress: isSet(object.delegatorAddress) ? String(object.delegatorAddress) : "" }; }, - toJSON(message: QueryDelegatorWithdrawAddressRequest): unknown { + toJSON(message: QueryDelegatorWithdrawAddressRequest): JsonSafe { const obj: any = {}; message.delegatorAddress !== undefined && (obj.delegatorAddress = message.delegatorAddress); return obj; @@ -1225,7 +1226,7 @@ export const QueryDelegatorWithdrawAddressResponse = { withdrawAddress: isSet(object.withdrawAddress) ? String(object.withdrawAddress) : "" }; }, - toJSON(message: QueryDelegatorWithdrawAddressResponse): unknown { + toJSON(message: QueryDelegatorWithdrawAddressResponse): JsonSafe { const obj: any = {}; message.withdrawAddress !== undefined && (obj.withdrawAddress = message.withdrawAddress); return obj; @@ -1270,7 +1271,7 @@ export const QueryCommunityPoolRequest = { fromJSON(_: any): QueryCommunityPoolRequest { return {}; }, - toJSON(_: QueryCommunityPoolRequest): unknown { + toJSON(_: QueryCommunityPoolRequest): JsonSafe { const obj: any = {}; return obj; }, @@ -1320,7 +1321,7 @@ export const QueryCommunityPoolResponse = { pool: Array.isArray(object?.pool) ? object.pool.map((e: any) => DecCoin.fromJSON(e)) : [] }; }, - toJSON(message: QueryCommunityPoolResponse): unknown { + toJSON(message: QueryCommunityPoolResponse): JsonSafe { const obj: any = {}; if (message.pool) { obj.pool = message.pool.map(e => e ? DecCoin.toJSON(e) : undefined); diff --git a/__fixtures__/output1/cosmos/distribution/v1beta1/tx.ts b/__fixtures__/output1/cosmos/distribution/v1beta1/tx.ts index 323f05493c..99472a4440 100644 --- a/__fixtures__/output1/cosmos/distribution/v1beta1/tx.ts +++ b/__fixtures__/output1/cosmos/distribution/v1beta1/tx.ts @@ -1,6 +1,7 @@ import { Coin, CoinSDKType } from "../../base/v1beta1/coin"; import * as _m0 from "protobufjs/minimal"; import { isSet, DeepPartial } from "../../../helpers"; +import { JsonSafe } from "../../../json-safe"; export const protobufPackage = "cosmos.distribution.v1beta1"; /** * MsgSetWithdrawAddress sets the withdraw address for @@ -130,7 +131,7 @@ export const MsgSetWithdrawAddress = { withdrawAddress: isSet(object.withdrawAddress) ? String(object.withdrawAddress) : "" }; }, - toJSON(message: MsgSetWithdrawAddress): unknown { + toJSON(message: MsgSetWithdrawAddress): JsonSafe { const obj: any = {}; message.delegatorAddress !== undefined && (obj.delegatorAddress = message.delegatorAddress); message.withdrawAddress !== undefined && (obj.withdrawAddress = message.withdrawAddress); @@ -179,7 +180,7 @@ export const MsgSetWithdrawAddressResponse = { fromJSON(_: any): MsgSetWithdrawAddressResponse { return {}; }, - toJSON(_: MsgSetWithdrawAddressResponse): unknown { + toJSON(_: MsgSetWithdrawAddressResponse): JsonSafe { const obj: any = {}; return obj; }, @@ -237,7 +238,7 @@ export const MsgWithdrawDelegatorReward = { validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "" }; }, - toJSON(message: MsgWithdrawDelegatorReward): unknown { + toJSON(message: MsgWithdrawDelegatorReward): JsonSafe { const obj: any = {}; message.delegatorAddress !== undefined && (obj.delegatorAddress = message.delegatorAddress); message.validatorAddress !== undefined && (obj.validatorAddress = message.validatorAddress); @@ -296,7 +297,7 @@ export const MsgWithdrawDelegatorRewardResponse = { amount: Array.isArray(object?.amount) ? object.amount.map((e: any) => Coin.fromJSON(e)) : [] }; }, - toJSON(message: MsgWithdrawDelegatorRewardResponse): unknown { + toJSON(message: MsgWithdrawDelegatorRewardResponse): JsonSafe { const obj: any = {}; if (message.amount) { obj.amount = message.amount.map(e => e ? Coin.toJSON(e) : undefined); @@ -359,7 +360,7 @@ export const MsgWithdrawValidatorCommission = { validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "" }; }, - toJSON(message: MsgWithdrawValidatorCommission): unknown { + toJSON(message: MsgWithdrawValidatorCommission): JsonSafe { const obj: any = {}; message.validatorAddress !== undefined && (obj.validatorAddress = message.validatorAddress); return obj; @@ -414,7 +415,7 @@ export const MsgWithdrawValidatorCommissionResponse = { amount: Array.isArray(object?.amount) ? object.amount.map((e: any) => Coin.fromJSON(e)) : [] }; }, - toJSON(message: MsgWithdrawValidatorCommissionResponse): unknown { + toJSON(message: MsgWithdrawValidatorCommissionResponse): JsonSafe { const obj: any = {}; if (message.amount) { obj.amount = message.amount.map(e => e ? Coin.toJSON(e) : undefined); @@ -485,7 +486,7 @@ export const MsgFundCommunityPool = { depositor: isSet(object.depositor) ? String(object.depositor) : "" }; }, - toJSON(message: MsgFundCommunityPool): unknown { + toJSON(message: MsgFundCommunityPool): JsonSafe { const obj: any = {}; if (message.amount) { obj.amount = message.amount.map(e => e ? Coin.toJSON(e) : undefined); @@ -542,7 +543,7 @@ export const MsgFundCommunityPoolResponse = { fromJSON(_: any): MsgFundCommunityPoolResponse { return {}; }, - toJSON(_: MsgFundCommunityPoolResponse): unknown { + toJSON(_: MsgFundCommunityPoolResponse): JsonSafe { const obj: any = {}; return obj; }, diff --git a/__fixtures__/output1/cosmos/evidence/v1beta1/evidence.ts b/__fixtures__/output1/cosmos/evidence/v1beta1/evidence.ts index 2834e36685..61f422e1ac 100644 --- a/__fixtures__/output1/cosmos/evidence/v1beta1/evidence.ts +++ b/__fixtures__/output1/cosmos/evidence/v1beta1/evidence.ts @@ -1,6 +1,7 @@ import { Timestamp, TimestampSDKType } from "../../../google/protobuf/timestamp"; import { Long, toTimestamp, fromTimestamp, isSet, fromJsonTimestamp, DeepPartial } from "../../../helpers"; import * as _m0 from "protobufjs/minimal"; +import { JsonSafe } from "../../../json-safe"; export const protobufPackage = "cosmos.evidence.v1beta1"; /** * Equivocation implements the Evidence interface and defines evidence of double @@ -80,7 +81,7 @@ export const Equivocation = { consensusAddress: isSet(object.consensusAddress) ? String(object.consensusAddress) : "" }; }, - toJSON(message: Equivocation): unknown { + toJSON(message: Equivocation): JsonSafe { const obj: any = {}; message.height !== undefined && (obj.height = (message.height || Long.ZERO).toString()); message.time !== undefined && (obj.time = message.time.toISOString()); diff --git a/__fixtures__/output1/cosmos/evidence/v1beta1/genesis.ts b/__fixtures__/output1/cosmos/evidence/v1beta1/genesis.ts index 9e52cb82cf..3263338863 100644 --- a/__fixtures__/output1/cosmos/evidence/v1beta1/genesis.ts +++ b/__fixtures__/output1/cosmos/evidence/v1beta1/genesis.ts @@ -1,5 +1,6 @@ import { Any, AnySDKType } from "../../../google/protobuf/any"; import * as _m0 from "protobufjs/minimal"; +import { JsonSafe } from "../../../json-safe"; import { DeepPartial } from "../../../helpers"; export const protobufPackage = "cosmos.evidence.v1beta1"; /** GenesisState defines the evidence module's genesis state. */ @@ -45,7 +46,7 @@ export const GenesisState = { evidence: Array.isArray(object?.evidence) ? object.evidence.map((e: any) => Any.fromJSON(e)) : [] }; }, - toJSON(message: GenesisState): unknown { + toJSON(message: GenesisState): JsonSafe { const obj: any = {}; if (message.evidence) { obj.evidence = message.evidence.map(e => e ? Any.toJSON(e) : undefined); diff --git a/__fixtures__/output1/cosmos/evidence/v1beta1/query.ts b/__fixtures__/output1/cosmos/evidence/v1beta1/query.ts index 4390f04b94..a1f264f76d 100644 --- a/__fixtures__/output1/cosmos/evidence/v1beta1/query.ts +++ b/__fixtures__/output1/cosmos/evidence/v1beta1/query.ts @@ -2,6 +2,7 @@ import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } fr import { Any, AnySDKType } from "../../../google/protobuf/any"; import * as _m0 from "protobufjs/minimal"; import { isSet, bytesFromBase64, base64FromBytes, DeepPartial } from "../../../helpers"; +import { JsonSafe } from "../../../json-safe"; export const protobufPackage = "cosmos.evidence.v1beta1"; /** QueryEvidenceRequest is the request type for the Query/Evidence RPC method. */ export interface QueryEvidenceRequest { @@ -88,7 +89,7 @@ export const QueryEvidenceRequest = { evidenceHash: isSet(object.evidenceHash) ? bytesFromBase64(object.evidenceHash) : new Uint8Array() }; }, - toJSON(message: QueryEvidenceRequest): unknown { + toJSON(message: QueryEvidenceRequest): JsonSafe { const obj: any = {}; message.evidenceHash !== undefined && (obj.evidenceHash = base64FromBytes(message.evidenceHash !== undefined ? message.evidenceHash : new Uint8Array())); return obj; @@ -143,7 +144,7 @@ export const QueryEvidenceResponse = { evidence: isSet(object.evidence) ? Any.fromJSON(object.evidence) : undefined }; }, - toJSON(message: QueryEvidenceResponse): unknown { + toJSON(message: QueryEvidenceResponse): JsonSafe { const obj: any = {}; message.evidence !== undefined && (obj.evidence = message.evidence ? Any.toJSON(message.evidence) : undefined); return obj; @@ -198,7 +199,7 @@ export const QueryAllEvidenceRequest = { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; }, - toJSON(message: QueryAllEvidenceRequest): unknown { + toJSON(message: QueryAllEvidenceRequest): JsonSafe { const obj: any = {}; message.pagination !== undefined && (obj.pagination = message.pagination ? PageRequest.toJSON(message.pagination) : undefined); return obj; @@ -261,7 +262,7 @@ export const QueryAllEvidenceResponse = { pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined }; }, - toJSON(message: QueryAllEvidenceResponse): unknown { + toJSON(message: QueryAllEvidenceResponse): JsonSafe { const obj: any = {}; if (message.evidence) { obj.evidence = message.evidence.map(e => e ? Any.toJSON(e) : undefined); diff --git a/__fixtures__/output1/cosmos/evidence/v1beta1/tx.ts b/__fixtures__/output1/cosmos/evidence/v1beta1/tx.ts index 28b9e5c0d8..8005848a24 100644 --- a/__fixtures__/output1/cosmos/evidence/v1beta1/tx.ts +++ b/__fixtures__/output1/cosmos/evidence/v1beta1/tx.ts @@ -1,6 +1,7 @@ import { Any, AnySDKType } from "../../../google/protobuf/any"; import * as _m0 from "protobufjs/minimal"; import { isSet, DeepPartial, bytesFromBase64, base64FromBytes } from "../../../helpers"; +import { JsonSafe } from "../../../json-safe"; export const protobufPackage = "cosmos.evidence.v1beta1"; /** * MsgSubmitEvidence represents a message that supports submitting arbitrary @@ -69,7 +70,7 @@ export const MsgSubmitEvidence = { evidence: isSet(object.evidence) ? Any.fromJSON(object.evidence) : undefined }; }, - toJSON(message: MsgSubmitEvidence): unknown { + toJSON(message: MsgSubmitEvidence): JsonSafe { const obj: any = {}; message.submitter !== undefined && (obj.submitter = message.submitter); message.evidence !== undefined && (obj.evidence = message.evidence ? Any.toJSON(message.evidence) : undefined); @@ -128,7 +129,7 @@ export const MsgSubmitEvidenceResponse = { hash: isSet(object.hash) ? bytesFromBase64(object.hash) : new Uint8Array() }; }, - toJSON(message: MsgSubmitEvidenceResponse): unknown { + toJSON(message: MsgSubmitEvidenceResponse): JsonSafe { const obj: any = {}; message.hash !== undefined && (obj.hash = base64FromBytes(message.hash !== undefined ? message.hash : new Uint8Array())); return obj; diff --git a/__fixtures__/output1/cosmos/feegrant/v1beta1/feegrant.ts b/__fixtures__/output1/cosmos/feegrant/v1beta1/feegrant.ts index 042ab1d571..7800cf337b 100644 --- a/__fixtures__/output1/cosmos/feegrant/v1beta1/feegrant.ts +++ b/__fixtures__/output1/cosmos/feegrant/v1beta1/feegrant.ts @@ -4,6 +4,7 @@ import { Duration, DurationSDKType } from "../../../google/protobuf/duration"; import { Any, AnySDKType } from "../../../google/protobuf/any"; import * as _m0 from "protobufjs/minimal"; import { toTimestamp, fromTimestamp, isSet, fromJsonTimestamp, DeepPartial } from "../../../helpers"; +import { JsonSafe } from "../../../json-safe"; export const protobufPackage = "cosmos.feegrant.v1beta1"; /** * BasicAllowance implements Allowance with a one-time grant of tokens @@ -133,7 +134,7 @@ export const BasicAllowance = { expiration: isSet(object.expiration) ? fromJsonTimestamp(object.expiration) : undefined }; }, - toJSON(message: BasicAllowance): unknown { + toJSON(message: BasicAllowance): JsonSafe { const obj: any = {}; if (message.spendLimit) { obj.spendLimit = message.spendLimit.map(e => e ? Coin.toJSON(e) : undefined); @@ -232,7 +233,7 @@ export const PeriodicAllowance = { periodReset: isSet(object.periodReset) ? fromJsonTimestamp(object.periodReset) : undefined }; }, - toJSON(message: PeriodicAllowance): unknown { + toJSON(message: PeriodicAllowance): JsonSafe { const obj: any = {}; message.basic !== undefined && (obj.basic = message.basic ? BasicAllowance.toJSON(message.basic) : undefined); message.period !== undefined && (obj.period = message.period ? Duration.toJSON(message.period) : undefined); @@ -327,7 +328,7 @@ export const AllowedMsgAllowance = { allowedMessages: Array.isArray(object?.allowedMessages) ? object.allowedMessages.map((e: any) => String(e)) : [] }; }, - toJSON(message: AllowedMsgAllowance): unknown { + toJSON(message: AllowedMsgAllowance): JsonSafe { const obj: any = {}; message.allowance !== undefined && (obj.allowance = message.allowance ? Any.toJSON(message.allowance) : undefined); if (message.allowedMessages) { @@ -410,7 +411,7 @@ export const Grant = { allowance: isSet(object.allowance) ? Any.fromJSON(object.allowance) : undefined }; }, - toJSON(message: Grant): unknown { + toJSON(message: Grant): JsonSafe { const obj: any = {}; message.granter !== undefined && (obj.granter = message.granter); message.grantee !== undefined && (obj.grantee = message.grantee); diff --git a/__fixtures__/output1/cosmos/feegrant/v1beta1/genesis.ts b/__fixtures__/output1/cosmos/feegrant/v1beta1/genesis.ts index 6edea4f130..26453a46f2 100644 --- a/__fixtures__/output1/cosmos/feegrant/v1beta1/genesis.ts +++ b/__fixtures__/output1/cosmos/feegrant/v1beta1/genesis.ts @@ -1,5 +1,6 @@ import { Grant, GrantSDKType } from "./feegrant"; import * as _m0 from "protobufjs/minimal"; +import { JsonSafe } from "../../../json-safe"; import { DeepPartial } from "../../../helpers"; export const protobufPackage = "cosmos.feegrant.v1beta1"; /** GenesisState contains a set of fee allowances, persisted from the store */ @@ -44,7 +45,7 @@ export const GenesisState = { allowances: Array.isArray(object?.allowances) ? object.allowances.map((e: any) => Grant.fromJSON(e)) : [] }; }, - toJSON(message: GenesisState): unknown { + toJSON(message: GenesisState): JsonSafe { const obj: any = {}; if (message.allowances) { obj.allowances = message.allowances.map(e => e ? Grant.toJSON(e) : undefined); diff --git a/__fixtures__/output1/cosmos/feegrant/v1beta1/query.ts b/__fixtures__/output1/cosmos/feegrant/v1beta1/query.ts index ce1a870451..3115b0227d 100644 --- a/__fixtures__/output1/cosmos/feegrant/v1beta1/query.ts +++ b/__fixtures__/output1/cosmos/feegrant/v1beta1/query.ts @@ -2,6 +2,7 @@ import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } fr import { Grant, GrantSDKType } from "./feegrant"; import * as _m0 from "protobufjs/minimal"; import { isSet, DeepPartial } from "../../../helpers"; +import { JsonSafe } from "../../../json-safe"; export const protobufPackage = "cosmos.feegrant.v1beta1"; /** QueryAllowanceRequest is the request type for the Query/Allowance RPC method. */ export interface QueryAllowanceRequest { @@ -112,7 +113,7 @@ export const QueryAllowanceRequest = { grantee: isSet(object.grantee) ? String(object.grantee) : "" }; }, - toJSON(message: QueryAllowanceRequest): unknown { + toJSON(message: QueryAllowanceRequest): JsonSafe { const obj: any = {}; message.granter !== undefined && (obj.granter = message.granter); message.grantee !== undefined && (obj.grantee = message.grantee); @@ -171,7 +172,7 @@ export const QueryAllowanceResponse = { allowance: isSet(object.allowance) ? Grant.fromJSON(object.allowance) : undefined }; }, - toJSON(message: QueryAllowanceResponse): unknown { + toJSON(message: QueryAllowanceResponse): JsonSafe { const obj: any = {}; message.allowance !== undefined && (obj.allowance = message.allowance ? Grant.toJSON(message.allowance) : undefined); return obj; @@ -234,7 +235,7 @@ export const QueryAllowancesRequest = { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; }, - toJSON(message: QueryAllowancesRequest): unknown { + toJSON(message: QueryAllowancesRequest): JsonSafe { const obj: any = {}; message.grantee !== undefined && (obj.grantee = message.grantee); message.pagination !== undefined && (obj.pagination = message.pagination ? PageRequest.toJSON(message.pagination) : undefined); @@ -301,7 +302,7 @@ export const QueryAllowancesResponse = { pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined }; }, - toJSON(message: QueryAllowancesResponse): unknown { + toJSON(message: QueryAllowancesResponse): JsonSafe { const obj: any = {}; if (message.allowances) { obj.allowances = message.allowances.map(e => e ? Grant.toJSON(e) : undefined); @@ -376,7 +377,7 @@ export const QueryAllowancesByGranterRequest = { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; }, - toJSON(message: QueryAllowancesByGranterRequest): unknown { + toJSON(message: QueryAllowancesByGranterRequest): JsonSafe { const obj: any = {}; message.granter !== undefined && (obj.granter = message.granter); message.pagination !== undefined && (obj.pagination = message.pagination ? PageRequest.toJSON(message.pagination) : undefined); @@ -443,7 +444,7 @@ export const QueryAllowancesByGranterResponse = { pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined }; }, - toJSON(message: QueryAllowancesByGranterResponse): unknown { + toJSON(message: QueryAllowancesByGranterResponse): JsonSafe { const obj: any = {}; if (message.allowances) { obj.allowances = message.allowances.map(e => e ? Grant.toJSON(e) : undefined); diff --git a/__fixtures__/output1/cosmos/feegrant/v1beta1/tx.ts b/__fixtures__/output1/cosmos/feegrant/v1beta1/tx.ts index bba56f93ec..91534aeb52 100644 --- a/__fixtures__/output1/cosmos/feegrant/v1beta1/tx.ts +++ b/__fixtures__/output1/cosmos/feegrant/v1beta1/tx.ts @@ -1,6 +1,7 @@ import { Any, AnySDKType } from "../../../google/protobuf/any"; import * as _m0 from "protobufjs/minimal"; import { isSet, DeepPartial } from "../../../helpers"; +import { JsonSafe } from "../../../json-safe"; export const protobufPackage = "cosmos.feegrant.v1beta1"; /** * MsgGrantAllowance adds permission for Grantee to spend up to Allowance @@ -93,7 +94,7 @@ export const MsgGrantAllowance = { allowance: isSet(object.allowance) ? Any.fromJSON(object.allowance) : undefined }; }, - toJSON(message: MsgGrantAllowance): unknown { + toJSON(message: MsgGrantAllowance): JsonSafe { const obj: any = {}; message.granter !== undefined && (obj.granter = message.granter); message.grantee !== undefined && (obj.grantee = message.grantee); @@ -146,7 +147,7 @@ export const MsgGrantAllowanceResponse = { fromJSON(_: any): MsgGrantAllowanceResponse { return {}; }, - toJSON(_: MsgGrantAllowanceResponse): unknown { + toJSON(_: MsgGrantAllowanceResponse): JsonSafe { const obj: any = {}; return obj; }, @@ -204,7 +205,7 @@ export const MsgRevokeAllowance = { grantee: isSet(object.grantee) ? String(object.grantee) : "" }; }, - toJSON(message: MsgRevokeAllowance): unknown { + toJSON(message: MsgRevokeAllowance): JsonSafe { const obj: any = {}; message.granter !== undefined && (obj.granter = message.granter); message.grantee !== undefined && (obj.grantee = message.grantee); @@ -253,7 +254,7 @@ export const MsgRevokeAllowanceResponse = { fromJSON(_: any): MsgRevokeAllowanceResponse { return {}; }, - toJSON(_: MsgRevokeAllowanceResponse): unknown { + toJSON(_: MsgRevokeAllowanceResponse): JsonSafe { const obj: any = {}; return obj; }, diff --git a/__fixtures__/output1/cosmos/genutil/v1beta1/genesis.ts b/__fixtures__/output1/cosmos/genutil/v1beta1/genesis.ts index 462f888047..720b226544 100644 --- a/__fixtures__/output1/cosmos/genutil/v1beta1/genesis.ts +++ b/__fixtures__/output1/cosmos/genutil/v1beta1/genesis.ts @@ -1,5 +1,6 @@ import * as _m0 from "protobufjs/minimal"; import { bytesFromBase64, base64FromBytes, DeepPartial } from "../../../helpers"; +import { JsonSafe } from "../../../json-safe"; export const protobufPackage = "cosmos.genutil.v1beta1"; /** GenesisState defines the raw genesis transaction in JSON. */ export interface GenesisState { @@ -44,7 +45,7 @@ export const GenesisState = { genTxs: Array.isArray(object?.genTxs) ? object.genTxs.map((e: any) => bytesFromBase64(e)) : [] }; }, - toJSON(message: GenesisState): unknown { + toJSON(message: GenesisState): JsonSafe { const obj: any = {}; if (message.genTxs) { obj.genTxs = message.genTxs.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); diff --git a/__fixtures__/output1/cosmos/gov/v1/genesis.ts b/__fixtures__/output1/cosmos/gov/v1/genesis.ts index 880a03c971..03cc6d771f 100644 --- a/__fixtures__/output1/cosmos/gov/v1/genesis.ts +++ b/__fixtures__/output1/cosmos/gov/v1/genesis.ts @@ -1,6 +1,7 @@ import { Deposit, DepositSDKType, Vote, VoteSDKType, Proposal, ProposalSDKType, DepositParams, DepositParamsSDKType, VotingParams, VotingParamsSDKType, TallyParams, TallyParamsSDKType } from "./gov"; import { Long, isSet, DeepPartial } from "../../../helpers"; import * as _m0 from "protobufjs/minimal"; +import { JsonSafe } from "../../../json-safe"; export const protobufPackage = "cosmos.gov.v1"; /** GenesisState defines the gov module's genesis state. */ export interface GenesisState { @@ -111,7 +112,7 @@ export const GenesisState = { tallyParams: isSet(object.tallyParams) ? TallyParams.fromJSON(object.tallyParams) : undefined }; }, - toJSON(message: GenesisState): unknown { + toJSON(message: GenesisState): JsonSafe { const obj: any = {}; message.startingProposalId !== undefined && (obj.startingProposalId = (message.startingProposalId || Long.UZERO).toString()); if (message.deposits) { diff --git a/__fixtures__/output1/cosmos/gov/v1/gov.ts b/__fixtures__/output1/cosmos/gov/v1/gov.ts index 93bea9d055..c18d432fd0 100644 --- a/__fixtures__/output1/cosmos/gov/v1/gov.ts +++ b/__fixtures__/output1/cosmos/gov/v1/gov.ts @@ -4,6 +4,7 @@ import { Timestamp, TimestampSDKType } from "../../../google/protobuf/timestamp" import { Duration, DurationSDKType } from "../../../google/protobuf/duration"; import { Long, isSet, DeepPartial, toTimestamp, fromTimestamp, fromJsonTimestamp } from "../../../helpers"; import * as _m0 from "protobufjs/minimal"; +import { JsonSafe } from "../../../json-safe"; export const protobufPackage = "cosmos.gov.v1"; /** VoteOption enumerates the valid vote options for a given governance proposal. */ export enum VoteOption { @@ -319,7 +320,7 @@ export const WeightedVoteOption = { weight: isSet(object.weight) ? String(object.weight) : "" }; }, - toJSON(message: WeightedVoteOption): unknown { + toJSON(message: WeightedVoteOption): JsonSafe { const obj: any = {}; message.option !== undefined && (obj.option = voteOptionToJSON(message.option)); message.weight !== undefined && (obj.weight = message.weight); @@ -394,7 +395,7 @@ export const Deposit = { amount: Array.isArray(object?.amount) ? object.amount.map((e: any) => Coin.fromJSON(e)) : [] }; }, - toJSON(message: Deposit): unknown { + toJSON(message: Deposit): JsonSafe { const obj: any = {}; message.proposalId !== undefined && (obj.proposalId = (message.proposalId || Long.UZERO).toString()); message.depositor !== undefined && (obj.depositor = message.depositor); @@ -537,7 +538,7 @@ export const Proposal = { metadata: isSet(object.metadata) ? String(object.metadata) : "" }; }, - toJSON(message: Proposal): unknown { + toJSON(message: Proposal): JsonSafe { const obj: any = {}; message.id !== undefined && (obj.id = (message.id || Long.UZERO).toString()); if (message.messages) { @@ -668,7 +669,7 @@ export const TallyResult = { noWithVetoCount: isSet(object.noWithVetoCount) ? String(object.noWithVetoCount) : "" }; }, - toJSON(message: TallyResult): unknown { + toJSON(message: TallyResult): JsonSafe { const obj: any = {}; message.yesCount !== undefined && (obj.yesCount = message.yesCount); message.abstainCount !== undefined && (obj.abstainCount = message.abstainCount); @@ -759,7 +760,7 @@ export const Vote = { metadata: isSet(object.metadata) ? String(object.metadata) : "" }; }, - toJSON(message: Vote): unknown { + toJSON(message: Vote): JsonSafe { const obj: any = {}; message.proposalId !== undefined && (obj.proposalId = (message.proposalId || Long.UZERO).toString()); message.voter !== undefined && (obj.voter = message.voter); @@ -842,7 +843,7 @@ export const DepositParams = { maxDepositPeriod: isSet(object.maxDepositPeriod) ? Duration.fromJSON(object.maxDepositPeriod) : undefined }; }, - toJSON(message: DepositParams): unknown { + toJSON(message: DepositParams): JsonSafe { const obj: any = {}; if (message.minDeposit) { obj.minDeposit = message.minDeposit.map(e => e ? Coin.toJSON(e) : undefined); @@ -909,7 +910,7 @@ export const VotingParams = { votingPeriod: isSet(object.votingPeriod) ? Duration.fromJSON(object.votingPeriod) : undefined }; }, - toJSON(message: VotingParams): unknown { + toJSON(message: VotingParams): JsonSafe { const obj: any = {}; message.votingPeriod !== undefined && (obj.votingPeriod = message.votingPeriod ? Duration.toJSON(message.votingPeriod) : undefined); return obj; @@ -980,7 +981,7 @@ export const TallyParams = { vetoThreshold: isSet(object.vetoThreshold) ? String(object.vetoThreshold) : "" }; }, - toJSON(message: TallyParams): unknown { + toJSON(message: TallyParams): JsonSafe { const obj: any = {}; message.quorum !== undefined && (obj.quorum = message.quorum); message.threshold !== undefined && (obj.threshold = message.threshold); diff --git a/__fixtures__/output1/cosmos/gov/v1/query.ts b/__fixtures__/output1/cosmos/gov/v1/query.ts index bc73774442..6f4f093b7d 100644 --- a/__fixtures__/output1/cosmos/gov/v1/query.ts +++ b/__fixtures__/output1/cosmos/gov/v1/query.ts @@ -2,6 +2,7 @@ import { ProposalStatus, ProposalStatusSDKType, Proposal, ProposalSDKType, Vote, import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../base/query/v1beta1/pagination"; import { Long, isSet, DeepPartial } from "../../../helpers"; import * as _m0 from "protobufjs/minimal"; +import { JsonSafe } from "../../../json-safe"; export const protobufPackage = "cosmos.gov.v1"; /** QueryProposalRequest is the request type for the Query/Proposal RPC method. */ export interface QueryProposalRequest { @@ -223,7 +224,7 @@ export const QueryProposalRequest = { proposalId: isSet(object.proposalId) ? Long.fromValue(object.proposalId) : Long.UZERO }; }, - toJSON(message: QueryProposalRequest): unknown { + toJSON(message: QueryProposalRequest): JsonSafe { const obj: any = {}; message.proposalId !== undefined && (obj.proposalId = (message.proposalId || Long.UZERO).toString()); return obj; @@ -278,7 +279,7 @@ export const QueryProposalResponse = { proposal: isSet(object.proposal) ? Proposal.fromJSON(object.proposal) : undefined }; }, - toJSON(message: QueryProposalResponse): unknown { + toJSON(message: QueryProposalResponse): JsonSafe { const obj: any = {}; message.proposal !== undefined && (obj.proposal = message.proposal ? Proposal.toJSON(message.proposal) : undefined); return obj; @@ -357,7 +358,7 @@ export const QueryProposalsRequest = { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; }, - toJSON(message: QueryProposalsRequest): unknown { + toJSON(message: QueryProposalsRequest): JsonSafe { const obj: any = {}; message.proposalStatus !== undefined && (obj.proposalStatus = proposalStatusToJSON(message.proposalStatus)); message.voter !== undefined && (obj.voter = message.voter); @@ -432,7 +433,7 @@ export const QueryProposalsResponse = { pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined }; }, - toJSON(message: QueryProposalsResponse): unknown { + toJSON(message: QueryProposalsResponse): JsonSafe { const obj: any = {}; if (message.proposals) { obj.proposals = message.proposals.map(e => e ? Proposal.toJSON(e) : undefined); @@ -507,7 +508,7 @@ export const QueryVoteRequest = { voter: isSet(object.voter) ? String(object.voter) : "" }; }, - toJSON(message: QueryVoteRequest): unknown { + toJSON(message: QueryVoteRequest): JsonSafe { const obj: any = {}; message.proposalId !== undefined && (obj.proposalId = (message.proposalId || Long.UZERO).toString()); message.voter !== undefined && (obj.voter = message.voter); @@ -566,7 +567,7 @@ export const QueryVoteResponse = { vote: isSet(object.vote) ? Vote.fromJSON(object.vote) : undefined }; }, - toJSON(message: QueryVoteResponse): unknown { + toJSON(message: QueryVoteResponse): JsonSafe { const obj: any = {}; message.vote !== undefined && (obj.vote = message.vote ? Vote.toJSON(message.vote) : undefined); return obj; @@ -629,7 +630,7 @@ export const QueryVotesRequest = { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; }, - toJSON(message: QueryVotesRequest): unknown { + toJSON(message: QueryVotesRequest): JsonSafe { const obj: any = {}; message.proposalId !== undefined && (obj.proposalId = (message.proposalId || Long.UZERO).toString()); message.pagination !== undefined && (obj.pagination = message.pagination ? PageRequest.toJSON(message.pagination) : undefined); @@ -696,7 +697,7 @@ export const QueryVotesResponse = { pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined }; }, - toJSON(message: QueryVotesResponse): unknown { + toJSON(message: QueryVotesResponse): JsonSafe { const obj: any = {}; if (message.votes) { obj.votes = message.votes.map(e => e ? Vote.toJSON(e) : undefined); @@ -763,7 +764,7 @@ export const QueryParamsRequest = { paramsType: isSet(object.paramsType) ? String(object.paramsType) : "" }; }, - toJSON(message: QueryParamsRequest): unknown { + toJSON(message: QueryParamsRequest): JsonSafe { const obj: any = {}; message.paramsType !== undefined && (obj.paramsType = message.paramsType); return obj; @@ -834,7 +835,7 @@ export const QueryParamsResponse = { tallyParams: isSet(object.tallyParams) ? TallyParams.fromJSON(object.tallyParams) : undefined }; }, - toJSON(message: QueryParamsResponse): unknown { + toJSON(message: QueryParamsResponse): JsonSafe { const obj: any = {}; message.votingParams !== undefined && (obj.votingParams = message.votingParams ? VotingParams.toJSON(message.votingParams) : undefined); message.depositParams !== undefined && (obj.depositParams = message.depositParams ? DepositParams.toJSON(message.depositParams) : undefined); @@ -905,7 +906,7 @@ export const QueryDepositRequest = { depositor: isSet(object.depositor) ? String(object.depositor) : "" }; }, - toJSON(message: QueryDepositRequest): unknown { + toJSON(message: QueryDepositRequest): JsonSafe { const obj: any = {}; message.proposalId !== undefined && (obj.proposalId = (message.proposalId || Long.UZERO).toString()); message.depositor !== undefined && (obj.depositor = message.depositor); @@ -964,7 +965,7 @@ export const QueryDepositResponse = { deposit: isSet(object.deposit) ? Deposit.fromJSON(object.deposit) : undefined }; }, - toJSON(message: QueryDepositResponse): unknown { + toJSON(message: QueryDepositResponse): JsonSafe { const obj: any = {}; message.deposit !== undefined && (obj.deposit = message.deposit ? Deposit.toJSON(message.deposit) : undefined); return obj; @@ -1027,7 +1028,7 @@ export const QueryDepositsRequest = { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; }, - toJSON(message: QueryDepositsRequest): unknown { + toJSON(message: QueryDepositsRequest): JsonSafe { const obj: any = {}; message.proposalId !== undefined && (obj.proposalId = (message.proposalId || Long.UZERO).toString()); message.pagination !== undefined && (obj.pagination = message.pagination ? PageRequest.toJSON(message.pagination) : undefined); @@ -1094,7 +1095,7 @@ export const QueryDepositsResponse = { pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined }; }, - toJSON(message: QueryDepositsResponse): unknown { + toJSON(message: QueryDepositsResponse): JsonSafe { const obj: any = {}; if (message.deposits) { obj.deposits = message.deposits.map(e => e ? Deposit.toJSON(e) : undefined); @@ -1161,7 +1162,7 @@ export const QueryTallyResultRequest = { proposalId: isSet(object.proposalId) ? Long.fromValue(object.proposalId) : Long.UZERO }; }, - toJSON(message: QueryTallyResultRequest): unknown { + toJSON(message: QueryTallyResultRequest): JsonSafe { const obj: any = {}; message.proposalId !== undefined && (obj.proposalId = (message.proposalId || Long.UZERO).toString()); return obj; @@ -1216,7 +1217,7 @@ export const QueryTallyResultResponse = { tally: isSet(object.tally) ? TallyResult.fromJSON(object.tally) : undefined }; }, - toJSON(message: QueryTallyResultResponse): unknown { + toJSON(message: QueryTallyResultResponse): JsonSafe { const obj: any = {}; message.tally !== undefined && (obj.tally = message.tally ? TallyResult.toJSON(message.tally) : undefined); return obj; diff --git a/__fixtures__/output1/cosmos/gov/v1/tx.ts b/__fixtures__/output1/cosmos/gov/v1/tx.ts index 688417cc84..1d1e41c7f4 100644 --- a/__fixtures__/output1/cosmos/gov/v1/tx.ts +++ b/__fixtures__/output1/cosmos/gov/v1/tx.ts @@ -3,6 +3,7 @@ import { Coin, CoinSDKType } from "../../base/v1beta1/coin"; import { VoteOption, VoteOptionSDKType, WeightedVoteOption, WeightedVoteOptionSDKType, voteOptionFromJSON, voteOptionToJSON } from "./gov"; import { Long, isSet, DeepPartial } from "../../../helpers"; import * as _m0 from "protobufjs/minimal"; +import { JsonSafe } from "../../../json-safe"; export const protobufPackage = "cosmos.gov.v1"; /** * MsgSubmitProposal defines an sdk.Msg type that supports submitting arbitrary @@ -165,7 +166,7 @@ export const MsgSubmitProposal = { metadata: isSet(object.metadata) ? String(object.metadata) : "" }; }, - toJSON(message: MsgSubmitProposal): unknown { + toJSON(message: MsgSubmitProposal): JsonSafe { const obj: any = {}; if (message.messages) { obj.messages = message.messages.map(e => e ? Any.toJSON(e) : undefined); @@ -248,7 +249,7 @@ export const MsgSubmitProposalResponse = { proposalId: isSet(object.proposalId) ? Long.fromValue(object.proposalId) : Long.UZERO }; }, - toJSON(message: MsgSubmitProposalResponse): unknown { + toJSON(message: MsgSubmitProposalResponse): JsonSafe { const obj: any = {}; message.proposalId !== undefined && (obj.proposalId = (message.proposalId || Long.UZERO).toString()); return obj; @@ -311,7 +312,7 @@ export const MsgExecLegacyContent = { authority: isSet(object.authority) ? String(object.authority) : "" }; }, - toJSON(message: MsgExecLegacyContent): unknown { + toJSON(message: MsgExecLegacyContent): JsonSafe { const obj: any = {}; message.content !== undefined && (obj.content = message.content ? Any.toJSON(message.content) : undefined); message.authority !== undefined && (obj.authority = message.authority); @@ -360,7 +361,7 @@ export const MsgExecLegacyContentResponse = { fromJSON(_: any): MsgExecLegacyContentResponse { return {}; }, - toJSON(_: MsgExecLegacyContentResponse): unknown { + toJSON(_: MsgExecLegacyContentResponse): JsonSafe { const obj: any = {}; return obj; }, @@ -434,7 +435,7 @@ export const MsgVote = { metadata: isSet(object.metadata) ? String(object.metadata) : "" }; }, - toJSON(message: MsgVote): unknown { + toJSON(message: MsgVote): JsonSafe { const obj: any = {}; message.proposalId !== undefined && (obj.proposalId = (message.proposalId || Long.UZERO).toString()); message.voter !== undefined && (obj.voter = message.voter); @@ -491,7 +492,7 @@ export const MsgVoteResponse = { fromJSON(_: any): MsgVoteResponse { return {}; }, - toJSON(_: MsgVoteResponse): unknown { + toJSON(_: MsgVoteResponse): JsonSafe { const obj: any = {}; return obj; }, @@ -565,7 +566,7 @@ export const MsgVoteWeighted = { metadata: isSet(object.metadata) ? String(object.metadata) : "" }; }, - toJSON(message: MsgVoteWeighted): unknown { + toJSON(message: MsgVoteWeighted): JsonSafe { const obj: any = {}; message.proposalId !== undefined && (obj.proposalId = (message.proposalId || Long.UZERO).toString()); message.voter !== undefined && (obj.voter = message.voter); @@ -630,7 +631,7 @@ export const MsgVoteWeightedResponse = { fromJSON(_: any): MsgVoteWeightedResponse { return {}; }, - toJSON(_: MsgVoteWeightedResponse): unknown { + toJSON(_: MsgVoteWeightedResponse): JsonSafe { const obj: any = {}; return obj; }, @@ -696,7 +697,7 @@ export const MsgDeposit = { amount: Array.isArray(object?.amount) ? object.amount.map((e: any) => Coin.fromJSON(e)) : [] }; }, - toJSON(message: MsgDeposit): unknown { + toJSON(message: MsgDeposit): JsonSafe { const obj: any = {}; message.proposalId !== undefined && (obj.proposalId = (message.proposalId || Long.UZERO).toString()); message.depositor !== undefined && (obj.depositor = message.depositor); @@ -757,7 +758,7 @@ export const MsgDepositResponse = { fromJSON(_: any): MsgDepositResponse { return {}; }, - toJSON(_: MsgDepositResponse): unknown { + toJSON(_: MsgDepositResponse): JsonSafe { const obj: any = {}; return obj; }, diff --git a/__fixtures__/output1/cosmos/gov/v1beta1/genesis.ts b/__fixtures__/output1/cosmos/gov/v1beta1/genesis.ts index e89ae6ea68..16779bc681 100644 --- a/__fixtures__/output1/cosmos/gov/v1beta1/genesis.ts +++ b/__fixtures__/output1/cosmos/gov/v1beta1/genesis.ts @@ -1,6 +1,7 @@ import { Deposit, DepositSDKType, Vote, VoteSDKType, Proposal, ProposalSDKType, DepositParams, DepositParamsSDKType, VotingParams, VotingParamsSDKType, TallyParams, TallyParamsSDKType } from "./gov"; import { Long, isSet, DeepPartial } from "../../../helpers"; import * as _m0 from "protobufjs/minimal"; +import { JsonSafe } from "../../../json-safe"; export const protobufPackage = "cosmos.gov.v1beta1"; /** GenesisState defines the gov module's genesis state. */ export interface GenesisState { @@ -111,7 +112,7 @@ export const GenesisState = { tallyParams: isSet(object.tallyParams) ? TallyParams.fromJSON(object.tallyParams) : undefined }; }, - toJSON(message: GenesisState): unknown { + toJSON(message: GenesisState): JsonSafe { const obj: any = {}; message.startingProposalId !== undefined && (obj.startingProposalId = (message.startingProposalId || Long.UZERO).toString()); if (message.deposits) { diff --git a/__fixtures__/output1/cosmos/gov/v1beta1/gov.ts b/__fixtures__/output1/cosmos/gov/v1beta1/gov.ts index 6dcc51e7ac..0c4c05a558 100644 --- a/__fixtures__/output1/cosmos/gov/v1beta1/gov.ts +++ b/__fixtures__/output1/cosmos/gov/v1beta1/gov.ts @@ -4,6 +4,7 @@ import { Timestamp, TimestampSDKType } from "../../../google/protobuf/timestamp" import { Duration, DurationSDKType } from "../../../google/protobuf/duration"; import { Long, isSet, DeepPartial, toTimestamp, fromTimestamp, fromJsonTimestamp, bytesFromBase64, base64FromBytes } from "../../../helpers"; import * as _m0 from "protobufjs/minimal"; +import { JsonSafe } from "../../../json-safe"; export const protobufPackage = "cosmos.gov.v1beta1"; /** VoteOption enumerates the valid vote options for a given governance proposal. */ export enum VoteOption { @@ -347,7 +348,7 @@ export const WeightedVoteOption = { weight: isSet(object.weight) ? String(object.weight) : "" }; }, - toJSON(message: WeightedVoteOption): unknown { + toJSON(message: WeightedVoteOption): JsonSafe { const obj: any = {}; message.option !== undefined && (obj.option = voteOptionToJSON(message.option)); message.weight !== undefined && (obj.weight = message.weight); @@ -414,7 +415,7 @@ export const TextProposal = { description: isSet(object.description) ? String(object.description) : "" }; }, - toJSON(message: TextProposal): unknown { + toJSON(message: TextProposal): JsonSafe { const obj: any = {}; message.title !== undefined && (obj.title = message.title); message.description !== undefined && (obj.description = message.description); @@ -489,7 +490,7 @@ export const Deposit = { amount: Array.isArray(object?.amount) ? object.amount.map((e: any) => Coin.fromJSON(e)) : [] }; }, - toJSON(message: Deposit): unknown { + toJSON(message: Deposit): JsonSafe { const obj: any = {}; message.proposalId !== undefined && (obj.proposalId = (message.proposalId || Long.UZERO).toString()); message.depositor !== undefined && (obj.depositor = message.depositor); @@ -624,7 +625,7 @@ export const Proposal = { votingEndTime: isSet(object.votingEndTime) ? fromJsonTimestamp(object.votingEndTime) : undefined }; }, - toJSON(message: Proposal): unknown { + toJSON(message: Proposal): JsonSafe { const obj: any = {}; message.proposalId !== undefined && (obj.proposalId = (message.proposalId || Long.UZERO).toString()); message.content !== undefined && (obj.content = message.content ? Any.toJSON(message.content) : undefined); @@ -743,7 +744,7 @@ export const TallyResult = { noWithVeto: isSet(object.noWithVeto) ? String(object.noWithVeto) : "" }; }, - toJSON(message: TallyResult): unknown { + toJSON(message: TallyResult): JsonSafe { const obj: any = {}; message.yes !== undefined && (obj.yes = message.yes); message.abstain !== undefined && (obj.abstain = message.abstain); @@ -834,7 +835,7 @@ export const Vote = { options: Array.isArray(object?.options) ? object.options.map((e: any) => WeightedVoteOption.fromJSON(e)) : [] }; }, - toJSON(message: Vote): unknown { + toJSON(message: Vote): JsonSafe { const obj: any = {}; message.proposalId !== undefined && (obj.proposalId = (message.proposalId || Long.UZERO).toString()); message.voter !== undefined && (obj.voter = message.voter); @@ -917,7 +918,7 @@ export const DepositParams = { maxDepositPeriod: isSet(object.maxDepositPeriod) ? Duration.fromJSON(object.maxDepositPeriod) : undefined }; }, - toJSON(message: DepositParams): unknown { + toJSON(message: DepositParams): JsonSafe { const obj: any = {}; if (message.minDeposit) { obj.minDeposit = message.minDeposit.map(e => e ? Coin.toJSON(e) : undefined); @@ -984,7 +985,7 @@ export const VotingParams = { votingPeriod: isSet(object.votingPeriod) ? Duration.fromJSON(object.votingPeriod) : undefined }; }, - toJSON(message: VotingParams): unknown { + toJSON(message: VotingParams): JsonSafe { const obj: any = {}; message.votingPeriod !== undefined && (obj.votingPeriod = message.votingPeriod ? Duration.toJSON(message.votingPeriod) : undefined); return obj; @@ -1055,7 +1056,7 @@ export const TallyParams = { vetoThreshold: isSet(object.vetoThreshold) ? bytesFromBase64(object.vetoThreshold) : new Uint8Array() }; }, - toJSON(message: TallyParams): unknown { + toJSON(message: TallyParams): JsonSafe { const obj: any = {}; message.quorum !== undefined && (obj.quorum = base64FromBytes(message.quorum !== undefined ? message.quorum : new Uint8Array())); message.threshold !== undefined && (obj.threshold = base64FromBytes(message.threshold !== undefined ? message.threshold : new Uint8Array())); diff --git a/__fixtures__/output1/cosmos/gov/v1beta1/query.ts b/__fixtures__/output1/cosmos/gov/v1beta1/query.ts index dca47b2934..0acd59c563 100644 --- a/__fixtures__/output1/cosmos/gov/v1beta1/query.ts +++ b/__fixtures__/output1/cosmos/gov/v1beta1/query.ts @@ -2,6 +2,7 @@ import { ProposalStatus, ProposalStatusSDKType, Proposal, ProposalSDKType, Vote, import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../base/query/v1beta1/pagination"; import { Long, isSet, DeepPartial } from "../../../helpers"; import * as _m0 from "protobufjs/minimal"; +import { JsonSafe } from "../../../json-safe"; export const protobufPackage = "cosmos.gov.v1beta1"; /** QueryProposalRequest is the request type for the Query/Proposal RPC method. */ export interface QueryProposalRequest { @@ -223,7 +224,7 @@ export const QueryProposalRequest = { proposalId: isSet(object.proposalId) ? Long.fromValue(object.proposalId) : Long.UZERO }; }, - toJSON(message: QueryProposalRequest): unknown { + toJSON(message: QueryProposalRequest): JsonSafe { const obj: any = {}; message.proposalId !== undefined && (obj.proposalId = (message.proposalId || Long.UZERO).toString()); return obj; @@ -278,7 +279,7 @@ export const QueryProposalResponse = { proposal: isSet(object.proposal) ? Proposal.fromJSON(object.proposal) : undefined }; }, - toJSON(message: QueryProposalResponse): unknown { + toJSON(message: QueryProposalResponse): JsonSafe { const obj: any = {}; message.proposal !== undefined && (obj.proposal = message.proposal ? Proposal.toJSON(message.proposal) : undefined); return obj; @@ -357,7 +358,7 @@ export const QueryProposalsRequest = { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; }, - toJSON(message: QueryProposalsRequest): unknown { + toJSON(message: QueryProposalsRequest): JsonSafe { const obj: any = {}; message.proposalStatus !== undefined && (obj.proposalStatus = proposalStatusToJSON(message.proposalStatus)); message.voter !== undefined && (obj.voter = message.voter); @@ -432,7 +433,7 @@ export const QueryProposalsResponse = { pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined }; }, - toJSON(message: QueryProposalsResponse): unknown { + toJSON(message: QueryProposalsResponse): JsonSafe { const obj: any = {}; if (message.proposals) { obj.proposals = message.proposals.map(e => e ? Proposal.toJSON(e) : undefined); @@ -507,7 +508,7 @@ export const QueryVoteRequest = { voter: isSet(object.voter) ? String(object.voter) : "" }; }, - toJSON(message: QueryVoteRequest): unknown { + toJSON(message: QueryVoteRequest): JsonSafe { const obj: any = {}; message.proposalId !== undefined && (obj.proposalId = (message.proposalId || Long.UZERO).toString()); message.voter !== undefined && (obj.voter = message.voter); @@ -566,7 +567,7 @@ export const QueryVoteResponse = { vote: isSet(object.vote) ? Vote.fromJSON(object.vote) : undefined }; }, - toJSON(message: QueryVoteResponse): unknown { + toJSON(message: QueryVoteResponse): JsonSafe { const obj: any = {}; message.vote !== undefined && (obj.vote = message.vote ? Vote.toJSON(message.vote) : undefined); return obj; @@ -629,7 +630,7 @@ export const QueryVotesRequest = { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; }, - toJSON(message: QueryVotesRequest): unknown { + toJSON(message: QueryVotesRequest): JsonSafe { const obj: any = {}; message.proposalId !== undefined && (obj.proposalId = (message.proposalId || Long.UZERO).toString()); message.pagination !== undefined && (obj.pagination = message.pagination ? PageRequest.toJSON(message.pagination) : undefined); @@ -696,7 +697,7 @@ export const QueryVotesResponse = { pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined }; }, - toJSON(message: QueryVotesResponse): unknown { + toJSON(message: QueryVotesResponse): JsonSafe { const obj: any = {}; if (message.votes) { obj.votes = message.votes.map(e => e ? Vote.toJSON(e) : undefined); @@ -763,7 +764,7 @@ export const QueryParamsRequest = { paramsType: isSet(object.paramsType) ? String(object.paramsType) : "" }; }, - toJSON(message: QueryParamsRequest): unknown { + toJSON(message: QueryParamsRequest): JsonSafe { const obj: any = {}; message.paramsType !== undefined && (obj.paramsType = message.paramsType); return obj; @@ -834,7 +835,7 @@ export const QueryParamsResponse = { tallyParams: isSet(object.tallyParams) ? TallyParams.fromJSON(object.tallyParams) : undefined }; }, - toJSON(message: QueryParamsResponse): unknown { + toJSON(message: QueryParamsResponse): JsonSafe { const obj: any = {}; message.votingParams !== undefined && (obj.votingParams = message.votingParams ? VotingParams.toJSON(message.votingParams) : undefined); message.depositParams !== undefined && (obj.depositParams = message.depositParams ? DepositParams.toJSON(message.depositParams) : undefined); @@ -905,7 +906,7 @@ export const QueryDepositRequest = { depositor: isSet(object.depositor) ? String(object.depositor) : "" }; }, - toJSON(message: QueryDepositRequest): unknown { + toJSON(message: QueryDepositRequest): JsonSafe { const obj: any = {}; message.proposalId !== undefined && (obj.proposalId = (message.proposalId || Long.UZERO).toString()); message.depositor !== undefined && (obj.depositor = message.depositor); @@ -964,7 +965,7 @@ export const QueryDepositResponse = { deposit: isSet(object.deposit) ? Deposit.fromJSON(object.deposit) : undefined }; }, - toJSON(message: QueryDepositResponse): unknown { + toJSON(message: QueryDepositResponse): JsonSafe { const obj: any = {}; message.deposit !== undefined && (obj.deposit = message.deposit ? Deposit.toJSON(message.deposit) : undefined); return obj; @@ -1027,7 +1028,7 @@ export const QueryDepositsRequest = { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; }, - toJSON(message: QueryDepositsRequest): unknown { + toJSON(message: QueryDepositsRequest): JsonSafe { const obj: any = {}; message.proposalId !== undefined && (obj.proposalId = (message.proposalId || Long.UZERO).toString()); message.pagination !== undefined && (obj.pagination = message.pagination ? PageRequest.toJSON(message.pagination) : undefined); @@ -1094,7 +1095,7 @@ export const QueryDepositsResponse = { pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined }; }, - toJSON(message: QueryDepositsResponse): unknown { + toJSON(message: QueryDepositsResponse): JsonSafe { const obj: any = {}; if (message.deposits) { obj.deposits = message.deposits.map(e => e ? Deposit.toJSON(e) : undefined); @@ -1161,7 +1162,7 @@ export const QueryTallyResultRequest = { proposalId: isSet(object.proposalId) ? Long.fromValue(object.proposalId) : Long.UZERO }; }, - toJSON(message: QueryTallyResultRequest): unknown { + toJSON(message: QueryTallyResultRequest): JsonSafe { const obj: any = {}; message.proposalId !== undefined && (obj.proposalId = (message.proposalId || Long.UZERO).toString()); return obj; @@ -1216,7 +1217,7 @@ export const QueryTallyResultResponse = { tally: isSet(object.tally) ? TallyResult.fromJSON(object.tally) : undefined }; }, - toJSON(message: QueryTallyResultResponse): unknown { + toJSON(message: QueryTallyResultResponse): JsonSafe { const obj: any = {}; message.tally !== undefined && (obj.tally = message.tally ? TallyResult.toJSON(message.tally) : undefined); return obj; diff --git a/__fixtures__/output1/cosmos/gov/v1beta1/tx.ts b/__fixtures__/output1/cosmos/gov/v1beta1/tx.ts index 9366ddb956..37f5d056b4 100644 --- a/__fixtures__/output1/cosmos/gov/v1beta1/tx.ts +++ b/__fixtures__/output1/cosmos/gov/v1beta1/tx.ts @@ -3,6 +3,7 @@ import { Coin, CoinSDKType } from "../../base/v1beta1/coin"; import { VoteOption, VoteOptionSDKType, WeightedVoteOption, WeightedVoteOptionSDKType, voteOptionFromJSON, voteOptionToJSON } from "./gov"; import { Long, isSet, DeepPartial } from "../../../helpers"; import * as _m0 from "protobufjs/minimal"; +import { JsonSafe } from "../../../json-safe"; export const protobufPackage = "cosmos.gov.v1beta1"; /** * MsgSubmitProposal defines an sdk.Msg type that supports submitting arbitrary @@ -144,7 +145,7 @@ export const MsgSubmitProposal = { proposer: isSet(object.proposer) ? String(object.proposer) : "" }; }, - toJSON(message: MsgSubmitProposal): unknown { + toJSON(message: MsgSubmitProposal): JsonSafe { const obj: any = {}; message.content !== undefined && (obj.content = message.content ? Any.toJSON(message.content) : undefined); if (message.initialDeposit) { @@ -215,7 +216,7 @@ export const MsgSubmitProposalResponse = { proposalId: isSet(object.proposalId) ? Long.fromValue(object.proposalId) : Long.UZERO }; }, - toJSON(message: MsgSubmitProposalResponse): unknown { + toJSON(message: MsgSubmitProposalResponse): JsonSafe { const obj: any = {}; message.proposalId !== undefined && (obj.proposalId = (message.proposalId || Long.UZERO).toString()); return obj; @@ -286,7 +287,7 @@ export const MsgVote = { option: isSet(object.option) ? voteOptionFromJSON(object.option) : -1 }; }, - toJSON(message: MsgVote): unknown { + toJSON(message: MsgVote): JsonSafe { const obj: any = {}; message.proposalId !== undefined && (obj.proposalId = (message.proposalId || Long.UZERO).toString()); message.voter !== undefined && (obj.voter = message.voter); @@ -339,7 +340,7 @@ export const MsgVoteResponse = { fromJSON(_: any): MsgVoteResponse { return {}; }, - toJSON(_: MsgVoteResponse): unknown { + toJSON(_: MsgVoteResponse): JsonSafe { const obj: any = {}; return obj; }, @@ -405,7 +406,7 @@ export const MsgVoteWeighted = { options: Array.isArray(object?.options) ? object.options.map((e: any) => WeightedVoteOption.fromJSON(e)) : [] }; }, - toJSON(message: MsgVoteWeighted): unknown { + toJSON(message: MsgVoteWeighted): JsonSafe { const obj: any = {}; message.proposalId !== undefined && (obj.proposalId = (message.proposalId || Long.UZERO).toString()); message.voter !== undefined && (obj.voter = message.voter); @@ -466,7 +467,7 @@ export const MsgVoteWeightedResponse = { fromJSON(_: any): MsgVoteWeightedResponse { return {}; }, - toJSON(_: MsgVoteWeightedResponse): unknown { + toJSON(_: MsgVoteWeightedResponse): JsonSafe { const obj: any = {}; return obj; }, @@ -532,7 +533,7 @@ export const MsgDeposit = { amount: Array.isArray(object?.amount) ? object.amount.map((e: any) => Coin.fromJSON(e)) : [] }; }, - toJSON(message: MsgDeposit): unknown { + toJSON(message: MsgDeposit): JsonSafe { const obj: any = {}; message.proposalId !== undefined && (obj.proposalId = (message.proposalId || Long.UZERO).toString()); message.depositor !== undefined && (obj.depositor = message.depositor); @@ -593,7 +594,7 @@ export const MsgDepositResponse = { fromJSON(_: any): MsgDepositResponse { return {}; }, - toJSON(_: MsgDepositResponse): unknown { + toJSON(_: MsgDepositResponse): JsonSafe { const obj: any = {}; return obj; }, diff --git a/__fixtures__/output1/cosmos/group/v1/events.ts b/__fixtures__/output1/cosmos/group/v1/events.ts index 6afb3ce761..fdde67c9e4 100644 --- a/__fixtures__/output1/cosmos/group/v1/events.ts +++ b/__fixtures__/output1/cosmos/group/v1/events.ts @@ -1,6 +1,7 @@ import { ProposalExecutorResult, ProposalExecutorResultSDKType, proposalExecutorResultFromJSON, proposalExecutorResultToJSON } from "./types"; import { Long, isSet, DeepPartial } from "../../../helpers"; import * as _m0 from "protobufjs/minimal"; +import { JsonSafe } from "../../../json-safe"; export const protobufPackage = "cosmos.group.v1"; /** EventCreateGroup is an event emitted when a group is created. */ export interface EventCreateGroup { @@ -123,7 +124,7 @@ export const EventCreateGroup = { groupId: isSet(object.groupId) ? Long.fromValue(object.groupId) : Long.UZERO }; }, - toJSON(message: EventCreateGroup): unknown { + toJSON(message: EventCreateGroup): JsonSafe { const obj: any = {}; message.groupId !== undefined && (obj.groupId = (message.groupId || Long.UZERO).toString()); return obj; @@ -178,7 +179,7 @@ export const EventUpdateGroup = { groupId: isSet(object.groupId) ? Long.fromValue(object.groupId) : Long.UZERO }; }, - toJSON(message: EventUpdateGroup): unknown { + toJSON(message: EventUpdateGroup): JsonSafe { const obj: any = {}; message.groupId !== undefined && (obj.groupId = (message.groupId || Long.UZERO).toString()); return obj; @@ -233,7 +234,7 @@ export const EventCreateGroupPolicy = { address: isSet(object.address) ? String(object.address) : "" }; }, - toJSON(message: EventCreateGroupPolicy): unknown { + toJSON(message: EventCreateGroupPolicy): JsonSafe { const obj: any = {}; message.address !== undefined && (obj.address = message.address); return obj; @@ -288,7 +289,7 @@ export const EventUpdateGroupPolicy = { address: isSet(object.address) ? String(object.address) : "" }; }, - toJSON(message: EventUpdateGroupPolicy): unknown { + toJSON(message: EventUpdateGroupPolicy): JsonSafe { const obj: any = {}; message.address !== undefined && (obj.address = message.address); return obj; @@ -343,7 +344,7 @@ export const EventSubmitProposal = { proposalId: isSet(object.proposalId) ? Long.fromValue(object.proposalId) : Long.UZERO }; }, - toJSON(message: EventSubmitProposal): unknown { + toJSON(message: EventSubmitProposal): JsonSafe { const obj: any = {}; message.proposalId !== undefined && (obj.proposalId = (message.proposalId || Long.UZERO).toString()); return obj; @@ -398,7 +399,7 @@ export const EventWithdrawProposal = { proposalId: isSet(object.proposalId) ? Long.fromValue(object.proposalId) : Long.UZERO }; }, - toJSON(message: EventWithdrawProposal): unknown { + toJSON(message: EventWithdrawProposal): JsonSafe { const obj: any = {}; message.proposalId !== undefined && (obj.proposalId = (message.proposalId || Long.UZERO).toString()); return obj; @@ -453,7 +454,7 @@ export const EventVote = { proposalId: isSet(object.proposalId) ? Long.fromValue(object.proposalId) : Long.UZERO }; }, - toJSON(message: EventVote): unknown { + toJSON(message: EventVote): JsonSafe { const obj: any = {}; message.proposalId !== undefined && (obj.proposalId = (message.proposalId || Long.UZERO).toString()); return obj; @@ -516,7 +517,7 @@ export const EventExec = { result: isSet(object.result) ? proposalExecutorResultFromJSON(object.result) : -1 }; }, - toJSON(message: EventExec): unknown { + toJSON(message: EventExec): JsonSafe { const obj: any = {}; message.proposalId !== undefined && (obj.proposalId = (message.proposalId || Long.UZERO).toString()); message.result !== undefined && (obj.result = proposalExecutorResultToJSON(message.result)); @@ -583,7 +584,7 @@ export const EventLeaveGroup = { address: isSet(object.address) ? String(object.address) : "" }; }, - toJSON(message: EventLeaveGroup): unknown { + toJSON(message: EventLeaveGroup): JsonSafe { const obj: any = {}; message.groupId !== undefined && (obj.groupId = (message.groupId || Long.UZERO).toString()); message.address !== undefined && (obj.address = message.address); diff --git a/__fixtures__/output1/cosmos/group/v1/genesis.ts b/__fixtures__/output1/cosmos/group/v1/genesis.ts index 43b895df24..87d3276c10 100644 --- a/__fixtures__/output1/cosmos/group/v1/genesis.ts +++ b/__fixtures__/output1/cosmos/group/v1/genesis.ts @@ -1,6 +1,7 @@ import { GroupInfo, GroupInfoSDKType, GroupMember, GroupMemberSDKType, GroupPolicyInfo, GroupPolicyInfoSDKType, Proposal, ProposalSDKType, Vote, VoteSDKType } from "./types"; import { Long, isSet, DeepPartial } from "../../../helpers"; import * as _m0 from "protobufjs/minimal"; +import { JsonSafe } from "../../../json-safe"; export const protobufPackage = "cosmos.group.v1"; /** GenesisState defines the group module's genesis state. */ export interface GenesisState { @@ -131,7 +132,7 @@ export const GenesisState = { votes: Array.isArray(object?.votes) ? object.votes.map((e: any) => Vote.fromJSON(e)) : [] }; }, - toJSON(message: GenesisState): unknown { + toJSON(message: GenesisState): JsonSafe { const obj: any = {}; message.groupSeq !== undefined && (obj.groupSeq = (message.groupSeq || Long.UZERO).toString()); if (message.groups) { diff --git a/__fixtures__/output1/cosmos/group/v1/query.ts b/__fixtures__/output1/cosmos/group/v1/query.ts index 235d2caca8..21823c9883 100644 --- a/__fixtures__/output1/cosmos/group/v1/query.ts +++ b/__fixtures__/output1/cosmos/group/v1/query.ts @@ -2,6 +2,7 @@ import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } fr import { GroupInfo, GroupInfoSDKType, GroupPolicyInfo, GroupPolicyInfoSDKType, GroupMember, GroupMemberSDKType, Proposal, ProposalSDKType, Vote, VoteSDKType, TallyResult, TallyResultSDKType } from "./types"; import { Long, isSet, DeepPartial } from "../../../helpers"; import * as _m0 from "protobufjs/minimal"; +import { JsonSafe } from "../../../json-safe"; export const protobufPackage = "cosmos.group.v1"; /** QueryGroupInfoRequest is the Query/GroupInfo request type. */ export interface QueryGroupInfoRequest { @@ -322,7 +323,7 @@ export const QueryGroupInfoRequest = { groupId: isSet(object.groupId) ? Long.fromValue(object.groupId) : Long.UZERO }; }, - toJSON(message: QueryGroupInfoRequest): unknown { + toJSON(message: QueryGroupInfoRequest): JsonSafe { const obj: any = {}; message.groupId !== undefined && (obj.groupId = (message.groupId || Long.UZERO).toString()); return obj; @@ -377,7 +378,7 @@ export const QueryGroupInfoResponse = { info: isSet(object.info) ? GroupInfo.fromJSON(object.info) : undefined }; }, - toJSON(message: QueryGroupInfoResponse): unknown { + toJSON(message: QueryGroupInfoResponse): JsonSafe { const obj: any = {}; message.info !== undefined && (obj.info = message.info ? GroupInfo.toJSON(message.info) : undefined); return obj; @@ -432,7 +433,7 @@ export const QueryGroupPolicyInfoRequest = { address: isSet(object.address) ? String(object.address) : "" }; }, - toJSON(message: QueryGroupPolicyInfoRequest): unknown { + toJSON(message: QueryGroupPolicyInfoRequest): JsonSafe { const obj: any = {}; message.address !== undefined && (obj.address = message.address); return obj; @@ -487,7 +488,7 @@ export const QueryGroupPolicyInfoResponse = { info: isSet(object.info) ? GroupPolicyInfo.fromJSON(object.info) : undefined }; }, - toJSON(message: QueryGroupPolicyInfoResponse): unknown { + toJSON(message: QueryGroupPolicyInfoResponse): JsonSafe { const obj: any = {}; message.info !== undefined && (obj.info = message.info ? GroupPolicyInfo.toJSON(message.info) : undefined); return obj; @@ -550,7 +551,7 @@ export const QueryGroupMembersRequest = { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; }, - toJSON(message: QueryGroupMembersRequest): unknown { + toJSON(message: QueryGroupMembersRequest): JsonSafe { const obj: any = {}; message.groupId !== undefined && (obj.groupId = (message.groupId || Long.UZERO).toString()); message.pagination !== undefined && (obj.pagination = message.pagination ? PageRequest.toJSON(message.pagination) : undefined); @@ -617,7 +618,7 @@ export const QueryGroupMembersResponse = { pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined }; }, - toJSON(message: QueryGroupMembersResponse): unknown { + toJSON(message: QueryGroupMembersResponse): JsonSafe { const obj: any = {}; if (message.members) { obj.members = message.members.map(e => e ? GroupMember.toJSON(e) : undefined); @@ -692,7 +693,7 @@ export const QueryGroupsByAdminRequest = { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; }, - toJSON(message: QueryGroupsByAdminRequest): unknown { + toJSON(message: QueryGroupsByAdminRequest): JsonSafe { const obj: any = {}; message.admin !== undefined && (obj.admin = message.admin); message.pagination !== undefined && (obj.pagination = message.pagination ? PageRequest.toJSON(message.pagination) : undefined); @@ -759,7 +760,7 @@ export const QueryGroupsByAdminResponse = { pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined }; }, - toJSON(message: QueryGroupsByAdminResponse): unknown { + toJSON(message: QueryGroupsByAdminResponse): JsonSafe { const obj: any = {}; if (message.groups) { obj.groups = message.groups.map(e => e ? GroupInfo.toJSON(e) : undefined); @@ -834,7 +835,7 @@ export const QueryGroupPoliciesByGroupRequest = { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; }, - toJSON(message: QueryGroupPoliciesByGroupRequest): unknown { + toJSON(message: QueryGroupPoliciesByGroupRequest): JsonSafe { const obj: any = {}; message.groupId !== undefined && (obj.groupId = (message.groupId || Long.UZERO).toString()); message.pagination !== undefined && (obj.pagination = message.pagination ? PageRequest.toJSON(message.pagination) : undefined); @@ -901,7 +902,7 @@ export const QueryGroupPoliciesByGroupResponse = { pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined }; }, - toJSON(message: QueryGroupPoliciesByGroupResponse): unknown { + toJSON(message: QueryGroupPoliciesByGroupResponse): JsonSafe { const obj: any = {}; if (message.groupPolicies) { obj.groupPolicies = message.groupPolicies.map(e => e ? GroupPolicyInfo.toJSON(e) : undefined); @@ -976,7 +977,7 @@ export const QueryGroupPoliciesByAdminRequest = { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; }, - toJSON(message: QueryGroupPoliciesByAdminRequest): unknown { + toJSON(message: QueryGroupPoliciesByAdminRequest): JsonSafe { const obj: any = {}; message.admin !== undefined && (obj.admin = message.admin); message.pagination !== undefined && (obj.pagination = message.pagination ? PageRequest.toJSON(message.pagination) : undefined); @@ -1043,7 +1044,7 @@ export const QueryGroupPoliciesByAdminResponse = { pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined }; }, - toJSON(message: QueryGroupPoliciesByAdminResponse): unknown { + toJSON(message: QueryGroupPoliciesByAdminResponse): JsonSafe { const obj: any = {}; if (message.groupPolicies) { obj.groupPolicies = message.groupPolicies.map(e => e ? GroupPolicyInfo.toJSON(e) : undefined); @@ -1110,7 +1111,7 @@ export const QueryProposalRequest = { proposalId: isSet(object.proposalId) ? Long.fromValue(object.proposalId) : Long.UZERO }; }, - toJSON(message: QueryProposalRequest): unknown { + toJSON(message: QueryProposalRequest): JsonSafe { const obj: any = {}; message.proposalId !== undefined && (obj.proposalId = (message.proposalId || Long.UZERO).toString()); return obj; @@ -1165,7 +1166,7 @@ export const QueryProposalResponse = { proposal: isSet(object.proposal) ? Proposal.fromJSON(object.proposal) : undefined }; }, - toJSON(message: QueryProposalResponse): unknown { + toJSON(message: QueryProposalResponse): JsonSafe { const obj: any = {}; message.proposal !== undefined && (obj.proposal = message.proposal ? Proposal.toJSON(message.proposal) : undefined); return obj; @@ -1228,7 +1229,7 @@ export const QueryProposalsByGroupPolicyRequest = { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; }, - toJSON(message: QueryProposalsByGroupPolicyRequest): unknown { + toJSON(message: QueryProposalsByGroupPolicyRequest): JsonSafe { const obj: any = {}; message.address !== undefined && (obj.address = message.address); message.pagination !== undefined && (obj.pagination = message.pagination ? PageRequest.toJSON(message.pagination) : undefined); @@ -1295,7 +1296,7 @@ export const QueryProposalsByGroupPolicyResponse = { pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined }; }, - toJSON(message: QueryProposalsByGroupPolicyResponse): unknown { + toJSON(message: QueryProposalsByGroupPolicyResponse): JsonSafe { const obj: any = {}; if (message.proposals) { obj.proposals = message.proposals.map(e => e ? Proposal.toJSON(e) : undefined); @@ -1370,7 +1371,7 @@ export const QueryVoteByProposalVoterRequest = { voter: isSet(object.voter) ? String(object.voter) : "" }; }, - toJSON(message: QueryVoteByProposalVoterRequest): unknown { + toJSON(message: QueryVoteByProposalVoterRequest): JsonSafe { const obj: any = {}; message.proposalId !== undefined && (obj.proposalId = (message.proposalId || Long.UZERO).toString()); message.voter !== undefined && (obj.voter = message.voter); @@ -1429,7 +1430,7 @@ export const QueryVoteByProposalVoterResponse = { vote: isSet(object.vote) ? Vote.fromJSON(object.vote) : undefined }; }, - toJSON(message: QueryVoteByProposalVoterResponse): unknown { + toJSON(message: QueryVoteByProposalVoterResponse): JsonSafe { const obj: any = {}; message.vote !== undefined && (obj.vote = message.vote ? Vote.toJSON(message.vote) : undefined); return obj; @@ -1492,7 +1493,7 @@ export const QueryVotesByProposalRequest = { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; }, - toJSON(message: QueryVotesByProposalRequest): unknown { + toJSON(message: QueryVotesByProposalRequest): JsonSafe { const obj: any = {}; message.proposalId !== undefined && (obj.proposalId = (message.proposalId || Long.UZERO).toString()); message.pagination !== undefined && (obj.pagination = message.pagination ? PageRequest.toJSON(message.pagination) : undefined); @@ -1559,7 +1560,7 @@ export const QueryVotesByProposalResponse = { pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined }; }, - toJSON(message: QueryVotesByProposalResponse): unknown { + toJSON(message: QueryVotesByProposalResponse): JsonSafe { const obj: any = {}; if (message.votes) { obj.votes = message.votes.map(e => e ? Vote.toJSON(e) : undefined); @@ -1634,7 +1635,7 @@ export const QueryVotesByVoterRequest = { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; }, - toJSON(message: QueryVotesByVoterRequest): unknown { + toJSON(message: QueryVotesByVoterRequest): JsonSafe { const obj: any = {}; message.voter !== undefined && (obj.voter = message.voter); message.pagination !== undefined && (obj.pagination = message.pagination ? PageRequest.toJSON(message.pagination) : undefined); @@ -1701,7 +1702,7 @@ export const QueryVotesByVoterResponse = { pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined }; }, - toJSON(message: QueryVotesByVoterResponse): unknown { + toJSON(message: QueryVotesByVoterResponse): JsonSafe { const obj: any = {}; if (message.votes) { obj.votes = message.votes.map(e => e ? Vote.toJSON(e) : undefined); @@ -1776,7 +1777,7 @@ export const QueryGroupsByMemberRequest = { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; }, - toJSON(message: QueryGroupsByMemberRequest): unknown { + toJSON(message: QueryGroupsByMemberRequest): JsonSafe { const obj: any = {}; message.address !== undefined && (obj.address = message.address); message.pagination !== undefined && (obj.pagination = message.pagination ? PageRequest.toJSON(message.pagination) : undefined); @@ -1843,7 +1844,7 @@ export const QueryGroupsByMemberResponse = { pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined }; }, - toJSON(message: QueryGroupsByMemberResponse): unknown { + toJSON(message: QueryGroupsByMemberResponse): JsonSafe { const obj: any = {}; if (message.groups) { obj.groups = message.groups.map(e => e ? GroupInfo.toJSON(e) : undefined); @@ -1910,7 +1911,7 @@ export const QueryTallyResultRequest = { proposalId: isSet(object.proposalId) ? Long.fromValue(object.proposalId) : Long.UZERO }; }, - toJSON(message: QueryTallyResultRequest): unknown { + toJSON(message: QueryTallyResultRequest): JsonSafe { const obj: any = {}; message.proposalId !== undefined && (obj.proposalId = (message.proposalId || Long.UZERO).toString()); return obj; @@ -1965,7 +1966,7 @@ export const QueryTallyResultResponse = { tally: isSet(object.tally) ? TallyResult.fromJSON(object.tally) : undefined }; }, - toJSON(message: QueryTallyResultResponse): unknown { + toJSON(message: QueryTallyResultResponse): JsonSafe { const obj: any = {}; message.tally !== undefined && (obj.tally = message.tally ? TallyResult.toJSON(message.tally) : undefined); return obj; diff --git a/__fixtures__/output1/cosmos/group/v1/tx.ts b/__fixtures__/output1/cosmos/group/v1/tx.ts index 51c79aeef4..8d83d394cb 100644 --- a/__fixtures__/output1/cosmos/group/v1/tx.ts +++ b/__fixtures__/output1/cosmos/group/v1/tx.ts @@ -2,6 +2,7 @@ import { Member, MemberSDKType, VoteOption, VoteOptionSDKType, voteOptionFromJSO import { Any, AnySDKType } from "../../../google/protobuf/any"; import { Long, isSet, DeepPartial } from "../../../helpers"; import * as _m0 from "protobufjs/minimal"; +import { JsonSafe } from "../../../json-safe"; export const protobufPackage = "cosmos.group.v1"; /** Exec defines modes of execution of a proposal on creation or on new vote. */ export enum Exec { @@ -412,7 +413,7 @@ export const MsgCreateGroup = { metadata: isSet(object.metadata) ? String(object.metadata) : "" }; }, - toJSON(message: MsgCreateGroup): unknown { + toJSON(message: MsgCreateGroup): JsonSafe { const obj: any = {}; message.admin !== undefined && (obj.admin = message.admin); if (message.members) { @@ -483,7 +484,7 @@ export const MsgCreateGroupResponse = { groupId: isSet(object.groupId) ? Long.fromValue(object.groupId) : Long.UZERO }; }, - toJSON(message: MsgCreateGroupResponse): unknown { + toJSON(message: MsgCreateGroupResponse): JsonSafe { const obj: any = {}; message.groupId !== undefined && (obj.groupId = (message.groupId || Long.UZERO).toString()); return obj; @@ -554,7 +555,7 @@ export const MsgUpdateGroupMembers = { memberUpdates: Array.isArray(object?.memberUpdates) ? object.memberUpdates.map((e: any) => Member.fromJSON(e)) : [] }; }, - toJSON(message: MsgUpdateGroupMembers): unknown { + toJSON(message: MsgUpdateGroupMembers): JsonSafe { const obj: any = {}; message.admin !== undefined && (obj.admin = message.admin); message.groupId !== undefined && (obj.groupId = (message.groupId || Long.UZERO).toString()); @@ -615,7 +616,7 @@ export const MsgUpdateGroupMembersResponse = { fromJSON(_: any): MsgUpdateGroupMembersResponse { return {}; }, - toJSON(_: MsgUpdateGroupMembersResponse): unknown { + toJSON(_: MsgUpdateGroupMembersResponse): JsonSafe { const obj: any = {}; return obj; }, @@ -681,7 +682,7 @@ export const MsgUpdateGroupAdmin = { newAdmin: isSet(object.newAdmin) ? String(object.newAdmin) : "" }; }, - toJSON(message: MsgUpdateGroupAdmin): unknown { + toJSON(message: MsgUpdateGroupAdmin): JsonSafe { const obj: any = {}; message.admin !== undefined && (obj.admin = message.admin); message.groupId !== undefined && (obj.groupId = (message.groupId || Long.UZERO).toString()); @@ -734,7 +735,7 @@ export const MsgUpdateGroupAdminResponse = { fromJSON(_: any): MsgUpdateGroupAdminResponse { return {}; }, - toJSON(_: MsgUpdateGroupAdminResponse): unknown { + toJSON(_: MsgUpdateGroupAdminResponse): JsonSafe { const obj: any = {}; return obj; }, @@ -800,7 +801,7 @@ export const MsgUpdateGroupMetadata = { metadata: isSet(object.metadata) ? String(object.metadata) : "" }; }, - toJSON(message: MsgUpdateGroupMetadata): unknown { + toJSON(message: MsgUpdateGroupMetadata): JsonSafe { const obj: any = {}; message.admin !== undefined && (obj.admin = message.admin); message.groupId !== undefined && (obj.groupId = (message.groupId || Long.UZERO).toString()); @@ -853,7 +854,7 @@ export const MsgUpdateGroupMetadataResponse = { fromJSON(_: any): MsgUpdateGroupMetadataResponse { return {}; }, - toJSON(_: MsgUpdateGroupMetadataResponse): unknown { + toJSON(_: MsgUpdateGroupMetadataResponse): JsonSafe { const obj: any = {}; return obj; }, @@ -927,7 +928,7 @@ export const MsgCreateGroupPolicy = { decisionPolicy: isSet(object.decisionPolicy) ? Any.fromJSON(object.decisionPolicy) : undefined }; }, - toJSON(message: MsgCreateGroupPolicy): unknown { + toJSON(message: MsgCreateGroupPolicy): JsonSafe { const obj: any = {}; message.admin !== undefined && (obj.admin = message.admin); message.groupId !== undefined && (obj.groupId = (message.groupId || Long.UZERO).toString()); @@ -994,7 +995,7 @@ export const MsgCreateGroupPolicyResponse = { address: isSet(object.address) ? String(object.address) : "" }; }, - toJSON(message: MsgCreateGroupPolicyResponse): unknown { + toJSON(message: MsgCreateGroupPolicyResponse): JsonSafe { const obj: any = {}; message.address !== undefined && (obj.address = message.address); return obj; @@ -1065,7 +1066,7 @@ export const MsgUpdateGroupPolicyAdmin = { newAdmin: isSet(object.newAdmin) ? String(object.newAdmin) : "" }; }, - toJSON(message: MsgUpdateGroupPolicyAdmin): unknown { + toJSON(message: MsgUpdateGroupPolicyAdmin): JsonSafe { const obj: any = {}; message.admin !== undefined && (obj.admin = message.admin); message.address !== undefined && (obj.address = message.address); @@ -1168,7 +1169,7 @@ export const MsgCreateGroupWithPolicy = { decisionPolicy: isSet(object.decisionPolicy) ? Any.fromJSON(object.decisionPolicy) : undefined }; }, - toJSON(message: MsgCreateGroupWithPolicy): unknown { + toJSON(message: MsgCreateGroupWithPolicy): JsonSafe { const obj: any = {}; message.admin !== undefined && (obj.admin = message.admin); if (message.members) { @@ -1259,7 +1260,7 @@ export const MsgCreateGroupWithPolicyResponse = { groupPolicyAddress: isSet(object.groupPolicyAddress) ? String(object.groupPolicyAddress) : "" }; }, - toJSON(message: MsgCreateGroupWithPolicyResponse): unknown { + toJSON(message: MsgCreateGroupWithPolicyResponse): JsonSafe { const obj: any = {}; message.groupId !== undefined && (obj.groupId = (message.groupId || Long.UZERO).toString()); message.groupPolicyAddress !== undefined && (obj.groupPolicyAddress = message.groupPolicyAddress); @@ -1308,7 +1309,7 @@ export const MsgUpdateGroupPolicyAdminResponse = { fromJSON(_: any): MsgUpdateGroupPolicyAdminResponse { return {}; }, - toJSON(_: MsgUpdateGroupPolicyAdminResponse): unknown { + toJSON(_: MsgUpdateGroupPolicyAdminResponse): JsonSafe { const obj: any = {}; return obj; }, @@ -1374,7 +1375,7 @@ export const MsgUpdateGroupPolicyDecisionPolicy = { decisionPolicy: isSet(object.decisionPolicy) ? Any.fromJSON(object.decisionPolicy) : undefined }; }, - toJSON(message: MsgUpdateGroupPolicyDecisionPolicy): unknown { + toJSON(message: MsgUpdateGroupPolicyDecisionPolicy): JsonSafe { const obj: any = {}; message.admin !== undefined && (obj.admin = message.admin); message.address !== undefined && (obj.address = message.address); @@ -1427,7 +1428,7 @@ export const MsgUpdateGroupPolicyDecisionPolicyResponse = { fromJSON(_: any): MsgUpdateGroupPolicyDecisionPolicyResponse { return {}; }, - toJSON(_: MsgUpdateGroupPolicyDecisionPolicyResponse): unknown { + toJSON(_: MsgUpdateGroupPolicyDecisionPolicyResponse): JsonSafe { const obj: any = {}; return obj; }, @@ -1493,7 +1494,7 @@ export const MsgUpdateGroupPolicyMetadata = { metadata: isSet(object.metadata) ? String(object.metadata) : "" }; }, - toJSON(message: MsgUpdateGroupPolicyMetadata): unknown { + toJSON(message: MsgUpdateGroupPolicyMetadata): JsonSafe { const obj: any = {}; message.admin !== undefined && (obj.admin = message.admin); message.address !== undefined && (obj.address = message.address); @@ -1546,7 +1547,7 @@ export const MsgUpdateGroupPolicyMetadataResponse = { fromJSON(_: any): MsgUpdateGroupPolicyMetadataResponse { return {}; }, - toJSON(_: MsgUpdateGroupPolicyMetadataResponse): unknown { + toJSON(_: MsgUpdateGroupPolicyMetadataResponse): JsonSafe { const obj: any = {}; return obj; }, @@ -1628,7 +1629,7 @@ export const MsgSubmitProposal = { exec: isSet(object.exec) ? execFromJSON(object.exec) : -1 }; }, - toJSON(message: MsgSubmitProposal): unknown { + toJSON(message: MsgSubmitProposal): JsonSafe { const obj: any = {}; message.address !== undefined && (obj.address = message.address); if (message.proposers) { @@ -1715,7 +1716,7 @@ export const MsgSubmitProposalResponse = { proposalId: isSet(object.proposalId) ? Long.fromValue(object.proposalId) : Long.UZERO }; }, - toJSON(message: MsgSubmitProposalResponse): unknown { + toJSON(message: MsgSubmitProposalResponse): JsonSafe { const obj: any = {}; message.proposalId !== undefined && (obj.proposalId = (message.proposalId || Long.UZERO).toString()); return obj; @@ -1778,7 +1779,7 @@ export const MsgWithdrawProposal = { address: isSet(object.address) ? String(object.address) : "" }; }, - toJSON(message: MsgWithdrawProposal): unknown { + toJSON(message: MsgWithdrawProposal): JsonSafe { const obj: any = {}; message.proposalId !== undefined && (obj.proposalId = (message.proposalId || Long.UZERO).toString()); message.address !== undefined && (obj.address = message.address); @@ -1827,7 +1828,7 @@ export const MsgWithdrawProposalResponse = { fromJSON(_: any): MsgWithdrawProposalResponse { return {}; }, - toJSON(_: MsgWithdrawProposalResponse): unknown { + toJSON(_: MsgWithdrawProposalResponse): JsonSafe { const obj: any = {}; return obj; }, @@ -1909,7 +1910,7 @@ export const MsgVote = { exec: isSet(object.exec) ? execFromJSON(object.exec) : -1 }; }, - toJSON(message: MsgVote): unknown { + toJSON(message: MsgVote): JsonSafe { const obj: any = {}; message.proposalId !== undefined && (obj.proposalId = (message.proposalId || Long.UZERO).toString()); message.voter !== undefined && (obj.voter = message.voter); @@ -1970,7 +1971,7 @@ export const MsgVoteResponse = { fromJSON(_: any): MsgVoteResponse { return {}; }, - toJSON(_: MsgVoteResponse): unknown { + toJSON(_: MsgVoteResponse): JsonSafe { const obj: any = {}; return obj; }, @@ -2028,7 +2029,7 @@ export const MsgExec = { signer: isSet(object.signer) ? String(object.signer) : "" }; }, - toJSON(message: MsgExec): unknown { + toJSON(message: MsgExec): JsonSafe { const obj: any = {}; message.proposalId !== undefined && (obj.proposalId = (message.proposalId || Long.UZERO).toString()); message.signer !== undefined && (obj.signer = message.signer); @@ -2077,7 +2078,7 @@ export const MsgExecResponse = { fromJSON(_: any): MsgExecResponse { return {}; }, - toJSON(_: MsgExecResponse): unknown { + toJSON(_: MsgExecResponse): JsonSafe { const obj: any = {}; return obj; }, @@ -2135,7 +2136,7 @@ export const MsgLeaveGroup = { groupId: isSet(object.groupId) ? Long.fromValue(object.groupId) : Long.UZERO }; }, - toJSON(message: MsgLeaveGroup): unknown { + toJSON(message: MsgLeaveGroup): JsonSafe { const obj: any = {}; message.address !== undefined && (obj.address = message.address); message.groupId !== undefined && (obj.groupId = (message.groupId || Long.UZERO).toString()); @@ -2184,7 +2185,7 @@ export const MsgLeaveGroupResponse = { fromJSON(_: any): MsgLeaveGroupResponse { return {}; }, - toJSON(_: MsgLeaveGroupResponse): unknown { + toJSON(_: MsgLeaveGroupResponse): JsonSafe { const obj: any = {}; return obj; }, diff --git a/__fixtures__/output1/cosmos/group/v1/types.ts b/__fixtures__/output1/cosmos/group/v1/types.ts index 3b9155c8bc..780c319825 100644 --- a/__fixtures__/output1/cosmos/group/v1/types.ts +++ b/__fixtures__/output1/cosmos/group/v1/types.ts @@ -3,6 +3,7 @@ import { Duration, DurationSDKType } from "../../../google/protobuf/duration"; import { Any, AnySDKType } from "../../../google/protobuf/any"; import { Long, toTimestamp, fromTimestamp, isSet, fromJsonTimestamp, DeepPartial } from "../../../helpers"; import * as _m0 from "protobufjs/minimal"; +import { JsonSafe } from "../../../json-safe"; export const protobufPackage = "cosmos.group.v1"; /** VoteOption enumerates the valid vote options for a given proposal. */ export enum VoteOption { @@ -540,7 +541,7 @@ export const Member = { addedAt: isSet(object.addedAt) ? fromJsonTimestamp(object.addedAt) : undefined }; }, - toJSON(message: Member): unknown { + toJSON(message: Member): JsonSafe { const obj: any = {}; message.address !== undefined && (obj.address = message.address); message.weight !== undefined && (obj.weight = message.weight); @@ -607,7 +608,7 @@ export const Members = { members: Array.isArray(object?.members) ? object.members.map((e: any) => Member.fromJSON(e)) : [] }; }, - toJSON(message: Members): unknown { + toJSON(message: Members): JsonSafe { const obj: any = {}; if (message.members) { obj.members = message.members.map(e => e ? Member.toJSON(e) : undefined); @@ -678,7 +679,7 @@ export const ThresholdDecisionPolicy = { windows: isSet(object.windows) ? DecisionPolicyWindows.fromJSON(object.windows) : undefined }; }, - toJSON(message: ThresholdDecisionPolicy): unknown { + toJSON(message: ThresholdDecisionPolicy): JsonSafe { const obj: any = {}; message.threshold !== undefined && (obj.threshold = message.threshold); message.windows !== undefined && (obj.windows = message.windows ? DecisionPolicyWindows.toJSON(message.windows) : undefined); @@ -745,7 +746,7 @@ export const PercentageDecisionPolicy = { windows: isSet(object.windows) ? DecisionPolicyWindows.fromJSON(object.windows) : undefined }; }, - toJSON(message: PercentageDecisionPolicy): unknown { + toJSON(message: PercentageDecisionPolicy): JsonSafe { const obj: any = {}; message.percentage !== undefined && (obj.percentage = message.percentage); message.windows !== undefined && (obj.windows = message.windows ? DecisionPolicyWindows.toJSON(message.windows) : undefined); @@ -812,7 +813,7 @@ export const DecisionPolicyWindows = { minExecutionPeriod: isSet(object.minExecutionPeriod) ? Duration.fromJSON(object.minExecutionPeriod) : undefined }; }, - toJSON(message: DecisionPolicyWindows): unknown { + toJSON(message: DecisionPolicyWindows): JsonSafe { const obj: any = {}; message.votingPeriod !== undefined && (obj.votingPeriod = message.votingPeriod ? Duration.toJSON(message.votingPeriod) : undefined); message.minExecutionPeriod !== undefined && (obj.minExecutionPeriod = message.minExecutionPeriod ? Duration.toJSON(message.minExecutionPeriod) : undefined); @@ -911,7 +912,7 @@ export const GroupInfo = { createdAt: isSet(object.createdAt) ? fromJsonTimestamp(object.createdAt) : undefined }; }, - toJSON(message: GroupInfo): unknown { + toJSON(message: GroupInfo): JsonSafe { const obj: any = {}; message.id !== undefined && (obj.id = (message.id || Long.UZERO).toString()); message.admin !== undefined && (obj.admin = message.admin); @@ -994,7 +995,7 @@ export const GroupMember = { member: isSet(object.member) ? Member.fromJSON(object.member) : undefined }; }, - toJSON(message: GroupMember): unknown { + toJSON(message: GroupMember): JsonSafe { const obj: any = {}; message.groupId !== undefined && (obj.groupId = (message.groupId || Long.UZERO).toString()); message.member !== undefined && (obj.member = message.member ? Member.toJSON(message.member) : undefined); @@ -1101,7 +1102,7 @@ export const GroupPolicyInfo = { createdAt: isSet(object.createdAt) ? fromJsonTimestamp(object.createdAt) : undefined }; }, - toJSON(message: GroupPolicyInfo): unknown { + toJSON(message: GroupPolicyInfo): JsonSafe { const obj: any = {}; message.address !== undefined && (obj.address = message.address); message.groupId !== undefined && (obj.groupId = (message.groupId || Long.UZERO).toString()); @@ -1276,7 +1277,7 @@ export const Proposal = { messages: Array.isArray(object?.messages) ? object.messages.map((e: any) => Any.fromJSON(e)) : [] }; }, - toJSON(message: Proposal): unknown { + toJSON(message: Proposal): JsonSafe { const obj: any = {}; message.id !== undefined && (obj.id = (message.id || Long.UZERO).toString()); message.address !== undefined && (obj.address = message.address); @@ -1419,7 +1420,7 @@ export const TallyResult = { noWithVetoCount: isSet(object.noWithVetoCount) ? String(object.noWithVetoCount) : "" }; }, - toJSON(message: TallyResult): unknown { + toJSON(message: TallyResult): JsonSafe { const obj: any = {}; message.yesCount !== undefined && (obj.yesCount = message.yesCount); message.abstainCount !== undefined && (obj.abstainCount = message.abstainCount); @@ -1518,7 +1519,7 @@ export const Vote = { submitTime: isSet(object.submitTime) ? fromJsonTimestamp(object.submitTime) : undefined }; }, - toJSON(message: Vote): unknown { + toJSON(message: Vote): JsonSafe { const obj: any = {}; message.proposalId !== undefined && (obj.proposalId = (message.proposalId || Long.UZERO).toString()); message.voter !== undefined && (obj.voter = message.voter); diff --git a/__fixtures__/output1/cosmos/mint/v1beta1/genesis.ts b/__fixtures__/output1/cosmos/mint/v1beta1/genesis.ts index 251a794bb0..ede9f474e4 100644 --- a/__fixtures__/output1/cosmos/mint/v1beta1/genesis.ts +++ b/__fixtures__/output1/cosmos/mint/v1beta1/genesis.ts @@ -1,6 +1,7 @@ import { Minter, MinterSDKType, Params, ParamsSDKType } from "./mint"; import * as _m0 from "protobufjs/minimal"; import { isSet, DeepPartial } from "../../../helpers"; +import { JsonSafe } from "../../../json-safe"; export const protobufPackage = "cosmos.mint.v1beta1"; /** GenesisState defines the mint module's genesis state. */ export interface GenesisState { @@ -56,7 +57,7 @@ export const GenesisState = { params: isSet(object.params) ? Params.fromJSON(object.params) : undefined }; }, - toJSON(message: GenesisState): unknown { + toJSON(message: GenesisState): JsonSafe { const obj: any = {}; message.minter !== undefined && (obj.minter = message.minter ? Minter.toJSON(message.minter) : undefined); message.params !== undefined && (obj.params = message.params ? Params.toJSON(message.params) : undefined); diff --git a/__fixtures__/output1/cosmos/mint/v1beta1/mint.ts b/__fixtures__/output1/cosmos/mint/v1beta1/mint.ts index aa3d24f36d..412591b8f9 100644 --- a/__fixtures__/output1/cosmos/mint/v1beta1/mint.ts +++ b/__fixtures__/output1/cosmos/mint/v1beta1/mint.ts @@ -1,5 +1,6 @@ import { Long, isSet, DeepPartial } from "../../../helpers"; import * as _m0 from "protobufjs/minimal"; +import { JsonSafe } from "../../../json-safe"; export const protobufPackage = "cosmos.mint.v1beta1"; /** Minter represents the minting state. */ export interface Minter { @@ -79,7 +80,7 @@ export const Minter = { annualProvisions: isSet(object.annualProvisions) ? String(object.annualProvisions) : "" }; }, - toJSON(message: Minter): unknown { + toJSON(message: Minter): JsonSafe { const obj: any = {}; message.inflation !== undefined && (obj.inflation = message.inflation); message.annualProvisions !== undefined && (obj.annualProvisions = message.annualProvisions); @@ -178,7 +179,7 @@ export const Params = { blocksPerYear: isSet(object.blocksPerYear) ? Long.fromValue(object.blocksPerYear) : Long.UZERO }; }, - toJSON(message: Params): unknown { + toJSON(message: Params): JsonSafe { const obj: any = {}; message.mintDenom !== undefined && (obj.mintDenom = message.mintDenom); message.inflationRateChange !== undefined && (obj.inflationRateChange = message.inflationRateChange); diff --git a/__fixtures__/output1/cosmos/mint/v1beta1/query.ts b/__fixtures__/output1/cosmos/mint/v1beta1/query.ts index 31584dfa0e..f14a28c38f 100644 --- a/__fixtures__/output1/cosmos/mint/v1beta1/query.ts +++ b/__fixtures__/output1/cosmos/mint/v1beta1/query.ts @@ -1,5 +1,6 @@ import { Params, ParamsSDKType } from "./mint"; import * as _m0 from "protobufjs/minimal"; +import { JsonSafe } from "../../../json-safe"; import { DeepPartial, isSet, bytesFromBase64, base64FromBytes } from "../../../helpers"; export const protobufPackage = "cosmos.mint.v1beta1"; /** QueryParamsRequest is the request type for the Query/Params RPC method. */ @@ -83,7 +84,7 @@ export const QueryParamsRequest = { fromJSON(_: any): QueryParamsRequest { return {}; }, - toJSON(_: QueryParamsRequest): unknown { + toJSON(_: QueryParamsRequest): JsonSafe { const obj: any = {}; return obj; }, @@ -133,7 +134,7 @@ export const QueryParamsResponse = { params: isSet(object.params) ? Params.fromJSON(object.params) : undefined }; }, - toJSON(message: QueryParamsResponse): unknown { + toJSON(message: QueryParamsResponse): JsonSafe { const obj: any = {}; message.params !== undefined && (obj.params = message.params ? Params.toJSON(message.params) : undefined); return obj; @@ -178,7 +179,7 @@ export const QueryInflationRequest = { fromJSON(_: any): QueryInflationRequest { return {}; }, - toJSON(_: QueryInflationRequest): unknown { + toJSON(_: QueryInflationRequest): JsonSafe { const obj: any = {}; return obj; }, @@ -228,7 +229,7 @@ export const QueryInflationResponse = { inflation: isSet(object.inflation) ? bytesFromBase64(object.inflation) : new Uint8Array() }; }, - toJSON(message: QueryInflationResponse): unknown { + toJSON(message: QueryInflationResponse): JsonSafe { const obj: any = {}; message.inflation !== undefined && (obj.inflation = base64FromBytes(message.inflation !== undefined ? message.inflation : new Uint8Array())); return obj; @@ -273,7 +274,7 @@ export const QueryAnnualProvisionsRequest = { fromJSON(_: any): QueryAnnualProvisionsRequest { return {}; }, - toJSON(_: QueryAnnualProvisionsRequest): unknown { + toJSON(_: QueryAnnualProvisionsRequest): JsonSafe { const obj: any = {}; return obj; }, @@ -323,7 +324,7 @@ export const QueryAnnualProvisionsResponse = { annualProvisions: isSet(object.annualProvisions) ? bytesFromBase64(object.annualProvisions) : new Uint8Array() }; }, - toJSON(message: QueryAnnualProvisionsResponse): unknown { + toJSON(message: QueryAnnualProvisionsResponse): JsonSafe { const obj: any = {}; message.annualProvisions !== undefined && (obj.annualProvisions = base64FromBytes(message.annualProvisions !== undefined ? message.annualProvisions : new Uint8Array())); return obj; diff --git a/__fixtures__/output1/cosmos/nft/v1beta1/event.ts b/__fixtures__/output1/cosmos/nft/v1beta1/event.ts index 41b6dd4199..e3a2c49f13 100644 --- a/__fixtures__/output1/cosmos/nft/v1beta1/event.ts +++ b/__fixtures__/output1/cosmos/nft/v1beta1/event.ts @@ -1,5 +1,6 @@ import * as _m0 from "protobufjs/minimal"; import { isSet, DeepPartial } from "../../../helpers"; +import { JsonSafe } from "../../../json-safe"; export const protobufPackage = "cosmos.nft.v1beta1"; /** EventSend is emitted on Msg/Send */ export interface EventSend { @@ -97,7 +98,7 @@ export const EventSend = { receiver: isSet(object.receiver) ? String(object.receiver) : "" }; }, - toJSON(message: EventSend): unknown { + toJSON(message: EventSend): JsonSafe { const obj: any = {}; message.classId !== undefined && (obj.classId = message.classId); message.id !== undefined && (obj.id = message.id); @@ -180,7 +181,7 @@ export const EventMint = { owner: isSet(object.owner) ? String(object.owner) : "" }; }, - toJSON(message: EventMint): unknown { + toJSON(message: EventMint): JsonSafe { const obj: any = {}; message.classId !== undefined && (obj.classId = message.classId); message.id !== undefined && (obj.id = message.id); @@ -259,7 +260,7 @@ export const EventBurn = { owner: isSet(object.owner) ? String(object.owner) : "" }; }, - toJSON(message: EventBurn): unknown { + toJSON(message: EventBurn): JsonSafe { const obj: any = {}; message.classId !== undefined && (obj.classId = message.classId); message.id !== undefined && (obj.id = message.id); diff --git a/__fixtures__/output1/cosmos/nft/v1beta1/genesis.ts b/__fixtures__/output1/cosmos/nft/v1beta1/genesis.ts index c27f9b6561..cd80c44bac 100644 --- a/__fixtures__/output1/cosmos/nft/v1beta1/genesis.ts +++ b/__fixtures__/output1/cosmos/nft/v1beta1/genesis.ts @@ -1,5 +1,6 @@ import { Class, ClassSDKType, NFT, NFTSDKType } from "./nft"; import * as _m0 from "protobufjs/minimal"; +import { JsonSafe } from "../../../json-safe"; import { DeepPartial, isSet } from "../../../helpers"; export const protobufPackage = "cosmos.nft.v1beta1"; /** GenesisState defines the nft module's genesis state. */ @@ -67,7 +68,7 @@ export const GenesisState = { entries: Array.isArray(object?.entries) ? object.entries.map((e: any) => Entry.fromJSON(e)) : [] }; }, - toJSON(message: GenesisState): unknown { + toJSON(message: GenesisState): JsonSafe { const obj: any = {}; if (message.classes) { obj.classes = message.classes.map(e => e ? Class.toJSON(e) : undefined); @@ -150,7 +151,7 @@ export const Entry = { nfts: Array.isArray(object?.nfts) ? object.nfts.map((e: any) => NFT.fromJSON(e)) : [] }; }, - toJSON(message: Entry): unknown { + toJSON(message: Entry): JsonSafe { const obj: any = {}; message.owner !== undefined && (obj.owner = message.owner); if (message.nfts) { diff --git a/__fixtures__/output1/cosmos/nft/v1beta1/nft.ts b/__fixtures__/output1/cosmos/nft/v1beta1/nft.ts index 16c336c410..203607e7a6 100644 --- a/__fixtures__/output1/cosmos/nft/v1beta1/nft.ts +++ b/__fixtures__/output1/cosmos/nft/v1beta1/nft.ts @@ -1,6 +1,7 @@ import { Any, AnySDKType } from "../../../google/protobuf/any"; import * as _m0 from "protobufjs/minimal"; import { isSet, DeepPartial } from "../../../helpers"; +import { JsonSafe } from "../../../json-safe"; export const protobufPackage = "cosmos.nft.v1beta1"; /** Class defines the class of the nft type. */ export interface Class { @@ -132,7 +133,7 @@ export const Class = { data: isSet(object.data) ? Any.fromJSON(object.data) : undefined }; }, - toJSON(message: Class): unknown { + toJSON(message: Class): JsonSafe { const obj: any = {}; message.id !== undefined && (obj.id = message.id); message.name !== undefined && (obj.name = message.name); @@ -243,7 +244,7 @@ export const NFT = { data: isSet(object.data) ? Any.fromJSON(object.data) : undefined }; }, - toJSON(message: NFT): unknown { + toJSON(message: NFT): JsonSafe { const obj: any = {}; message.classId !== undefined && (obj.classId = message.classId); message.id !== undefined && (obj.id = message.id); diff --git a/__fixtures__/output1/cosmos/nft/v1beta1/query.ts b/__fixtures__/output1/cosmos/nft/v1beta1/query.ts index 1e175cfaae..8fac825fc7 100644 --- a/__fixtures__/output1/cosmos/nft/v1beta1/query.ts +++ b/__fixtures__/output1/cosmos/nft/v1beta1/query.ts @@ -2,6 +2,7 @@ import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } fr import { NFT, NFTSDKType, Class, ClassSDKType } from "./nft"; import { Long, isSet, DeepPartial } from "../../../helpers"; import * as _m0 from "protobufjs/minimal"; +import { JsonSafe } from "../../../json-safe"; export const protobufPackage = "cosmos.nft.v1beta1"; /** QueryBalanceRequest is the request type for the Query/Balance RPC method */ export interface QueryBalanceRequest { @@ -172,7 +173,7 @@ export const QueryBalanceRequest = { owner: isSet(object.owner) ? String(object.owner) : "" }; }, - toJSON(message: QueryBalanceRequest): unknown { + toJSON(message: QueryBalanceRequest): JsonSafe { const obj: any = {}; message.classId !== undefined && (obj.classId = message.classId); message.owner !== undefined && (obj.owner = message.owner); @@ -231,7 +232,7 @@ export const QueryBalanceResponse = { amount: isSet(object.amount) ? Long.fromValue(object.amount) : Long.UZERO }; }, - toJSON(message: QueryBalanceResponse): unknown { + toJSON(message: QueryBalanceResponse): JsonSafe { const obj: any = {}; message.amount !== undefined && (obj.amount = (message.amount || Long.UZERO).toString()); return obj; @@ -294,7 +295,7 @@ export const QueryOwnerRequest = { id: isSet(object.id) ? String(object.id) : "" }; }, - toJSON(message: QueryOwnerRequest): unknown { + toJSON(message: QueryOwnerRequest): JsonSafe { const obj: any = {}; message.classId !== undefined && (obj.classId = message.classId); message.id !== undefined && (obj.id = message.id); @@ -353,7 +354,7 @@ export const QueryOwnerResponse = { owner: isSet(object.owner) ? String(object.owner) : "" }; }, - toJSON(message: QueryOwnerResponse): unknown { + toJSON(message: QueryOwnerResponse): JsonSafe { const obj: any = {}; message.owner !== undefined && (obj.owner = message.owner); return obj; @@ -408,7 +409,7 @@ export const QuerySupplyRequest = { classId: isSet(object.classId) ? String(object.classId) : "" }; }, - toJSON(message: QuerySupplyRequest): unknown { + toJSON(message: QuerySupplyRequest): JsonSafe { const obj: any = {}; message.classId !== undefined && (obj.classId = message.classId); return obj; @@ -463,7 +464,7 @@ export const QuerySupplyResponse = { amount: isSet(object.amount) ? Long.fromValue(object.amount) : Long.UZERO }; }, - toJSON(message: QuerySupplyResponse): unknown { + toJSON(message: QuerySupplyResponse): JsonSafe { const obj: any = {}; message.amount !== undefined && (obj.amount = (message.amount || Long.UZERO).toString()); return obj; @@ -534,7 +535,7 @@ export const QueryNFTsRequest = { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; }, - toJSON(message: QueryNFTsRequest): unknown { + toJSON(message: QueryNFTsRequest): JsonSafe { const obj: any = {}; message.classId !== undefined && (obj.classId = message.classId); message.owner !== undefined && (obj.owner = message.owner); @@ -605,7 +606,7 @@ export const QueryNFTsResponse = { pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined }; }, - toJSON(message: QueryNFTsResponse): unknown { + toJSON(message: QueryNFTsResponse): JsonSafe { const obj: any = {}; if (message.nfts) { obj.nfts = message.nfts.map(e => e ? NFT.toJSON(e) : undefined); @@ -680,7 +681,7 @@ export const QueryNFTRequest = { id: isSet(object.id) ? String(object.id) : "" }; }, - toJSON(message: QueryNFTRequest): unknown { + toJSON(message: QueryNFTRequest): JsonSafe { const obj: any = {}; message.classId !== undefined && (obj.classId = message.classId); message.id !== undefined && (obj.id = message.id); @@ -739,7 +740,7 @@ export const QueryNFTResponse = { nft: isSet(object.nft) ? NFT.fromJSON(object.nft) : undefined }; }, - toJSON(message: QueryNFTResponse): unknown { + toJSON(message: QueryNFTResponse): JsonSafe { const obj: any = {}; message.nft !== undefined && (obj.nft = message.nft ? NFT.toJSON(message.nft) : undefined); return obj; @@ -794,7 +795,7 @@ export const QueryClassRequest = { classId: isSet(object.classId) ? String(object.classId) : "" }; }, - toJSON(message: QueryClassRequest): unknown { + toJSON(message: QueryClassRequest): JsonSafe { const obj: any = {}; message.classId !== undefined && (obj.classId = message.classId); return obj; @@ -849,7 +850,7 @@ export const QueryClassResponse = { class: isSet(object.class) ? Class.fromJSON(object.class) : undefined }; }, - toJSON(message: QueryClassResponse): unknown { + toJSON(message: QueryClassResponse): JsonSafe { const obj: any = {}; message.class !== undefined && (obj.class = message.class ? Class.toJSON(message.class) : undefined); return obj; @@ -904,7 +905,7 @@ export const QueryClassesRequest = { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; }, - toJSON(message: QueryClassesRequest): unknown { + toJSON(message: QueryClassesRequest): JsonSafe { const obj: any = {}; message.pagination !== undefined && (obj.pagination = message.pagination ? PageRequest.toJSON(message.pagination) : undefined); return obj; @@ -967,7 +968,7 @@ export const QueryClassesResponse = { pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined }; }, - toJSON(message: QueryClassesResponse): unknown { + toJSON(message: QueryClassesResponse): JsonSafe { const obj: any = {}; if (message.classes) { obj.classes = message.classes.map(e => e ? Class.toJSON(e) : undefined); diff --git a/__fixtures__/output1/cosmos/nft/v1beta1/tx.ts b/__fixtures__/output1/cosmos/nft/v1beta1/tx.ts index 5aeaa3f679..bf11c23034 100644 --- a/__fixtures__/output1/cosmos/nft/v1beta1/tx.ts +++ b/__fixtures__/output1/cosmos/nft/v1beta1/tx.ts @@ -1,5 +1,6 @@ import * as _m0 from "protobufjs/minimal"; import { isSet, DeepPartial } from "../../../helpers"; +import { JsonSafe } from "../../../json-safe"; export const protobufPackage = "cosmos.nft.v1beta1"; /** MsgSend represents a message to send a nft from one account to another account. */ export interface MsgSend { @@ -81,7 +82,7 @@ export const MsgSend = { receiver: isSet(object.receiver) ? String(object.receiver) : "" }; }, - toJSON(message: MsgSend): unknown { + toJSON(message: MsgSend): JsonSafe { const obj: any = {}; message.classId !== undefined && (obj.classId = message.classId); message.id !== undefined && (obj.id = message.id); @@ -138,7 +139,7 @@ export const MsgSendResponse = { fromJSON(_: any): MsgSendResponse { return {}; }, - toJSON(_: MsgSendResponse): unknown { + toJSON(_: MsgSendResponse): JsonSafe { const obj: any = {}; return obj; }, diff --git a/__fixtures__/output1/cosmos/orm/module/v1alpha1/module.ts b/__fixtures__/output1/cosmos/orm/module/v1alpha1/module.ts index 848e0150aa..fd0c53c205 100644 --- a/__fixtures__/output1/cosmos/orm/module/v1alpha1/module.ts +++ b/__fixtures__/output1/cosmos/orm/module/v1alpha1/module.ts @@ -1,4 +1,5 @@ import * as _m0 from "protobufjs/minimal"; +import { JsonSafe } from "../../../../json-safe"; import { DeepPartial } from "../../../../helpers"; export const protobufPackage = "cosmos.orm.module.v1alpha1"; /** @@ -37,7 +38,7 @@ export const Module = { fromJSON(_: any): Module { return {}; }, - toJSON(_: Module): unknown { + toJSON(_: Module): JsonSafe { const obj: any = {}; return obj; }, diff --git a/__fixtures__/output1/cosmos/orm/v1/orm.ts b/__fixtures__/output1/cosmos/orm/v1/orm.ts index 1479164580..e88646a69b 100644 --- a/__fixtures__/output1/cosmos/orm/v1/orm.ts +++ b/__fixtures__/output1/cosmos/orm/v1/orm.ts @@ -1,5 +1,6 @@ import * as _m0 from "protobufjs/minimal"; import { isSet, DeepPartial } from "../../../helpers"; +import { JsonSafe } from "../../../json-safe"; export const protobufPackage = "cosmos.orm.v1"; /** TableDescriptor describes an ORM table. */ export interface TableDescriptor { @@ -159,7 +160,7 @@ export const TableDescriptor = { id: isSet(object.id) ? Number(object.id) : 0 }; }, - toJSON(message: TableDescriptor): unknown { + toJSON(message: TableDescriptor): JsonSafe { const obj: any = {}; message.primaryKey !== undefined && (obj.primaryKey = message.primaryKey ? PrimaryKeyDescriptor.toJSON(message.primaryKey) : undefined); if (message.index) { @@ -238,7 +239,7 @@ export const PrimaryKeyDescriptor = { autoIncrement: isSet(object.autoIncrement) ? Boolean(object.autoIncrement) : false }; }, - toJSON(message: PrimaryKeyDescriptor): unknown { + toJSON(message: PrimaryKeyDescriptor): JsonSafe { const obj: any = {}; message.fields !== undefined && (obj.fields = message.fields); message.autoIncrement !== undefined && (obj.autoIncrement = message.autoIncrement); @@ -313,7 +314,7 @@ export const SecondaryIndexDescriptor = { unique: isSet(object.unique) ? Boolean(object.unique) : false }; }, - toJSON(message: SecondaryIndexDescriptor): unknown { + toJSON(message: SecondaryIndexDescriptor): JsonSafe { const obj: any = {}; message.fields !== undefined && (obj.fields = message.fields); message.id !== undefined && (obj.id = Math.round(message.id)); @@ -376,7 +377,7 @@ export const SingletonDescriptor = { id: isSet(object.id) ? Number(object.id) : 0 }; }, - toJSON(message: SingletonDescriptor): unknown { + toJSON(message: SingletonDescriptor): JsonSafe { const obj: any = {}; message.id !== undefined && (obj.id = Math.round(message.id)); return obj; diff --git a/__fixtures__/output1/cosmos/orm/v1alpha1/schema.ts b/__fixtures__/output1/cosmos/orm/v1alpha1/schema.ts index 44e2f98fd4..805dbeaea2 100644 --- a/__fixtures__/output1/cosmos/orm/v1alpha1/schema.ts +++ b/__fixtures__/output1/cosmos/orm/v1alpha1/schema.ts @@ -1,5 +1,6 @@ import * as _m0 from "protobufjs/minimal"; import { isSet, bytesFromBase64, base64FromBytes, DeepPartial } from "../../../helpers"; +import { JsonSafe } from "../../../json-safe"; export const protobufPackage = "cosmos.orm.v1alpha1"; /** StorageType */ export enum StorageType { @@ -167,7 +168,7 @@ export const ModuleSchemaDescriptor = { prefix: isSet(object.prefix) ? bytesFromBase64(object.prefix) : new Uint8Array() }; }, - toJSON(message: ModuleSchemaDescriptor): unknown { + toJSON(message: ModuleSchemaDescriptor): JsonSafe { const obj: any = {}; if (message.schemaFile) { obj.schemaFile = message.schemaFile.map(e => e ? ModuleSchemaDescriptor_FileEntry.toJSON(e) : undefined); @@ -250,7 +251,7 @@ export const ModuleSchemaDescriptor_FileEntry = { storageType: isSet(object.storageType) ? storageTypeFromJSON(object.storageType) : -1 }; }, - toJSON(message: ModuleSchemaDescriptor_FileEntry): unknown { + toJSON(message: ModuleSchemaDescriptor_FileEntry): JsonSafe { const obj: any = {}; message.id !== undefined && (obj.id = Math.round(message.id)); message.protoFileName !== undefined && (obj.protoFileName = message.protoFileName); diff --git a/__fixtures__/output1/cosmos/params/v1beta1/params.ts b/__fixtures__/output1/cosmos/params/v1beta1/params.ts index fd081b1f8d..6753a5d17a 100644 --- a/__fixtures__/output1/cosmos/params/v1beta1/params.ts +++ b/__fixtures__/output1/cosmos/params/v1beta1/params.ts @@ -1,5 +1,6 @@ import * as _m0 from "protobufjs/minimal"; import { isSet, DeepPartial } from "../../../helpers"; +import { JsonSafe } from "../../../json-safe"; export const protobufPackage = "cosmos.params.v1beta1"; /** ParameterChangeProposal defines a proposal to change one or more parameters. */ export interface ParameterChangeProposal { @@ -81,7 +82,7 @@ export const ParameterChangeProposal = { changes: Array.isArray(object?.changes) ? object.changes.map((e: any) => ParamChange.fromJSON(e)) : [] }; }, - toJSON(message: ParameterChangeProposal): unknown { + toJSON(message: ParameterChangeProposal): JsonSafe { const obj: any = {}; message.title !== undefined && (obj.title = message.title); message.description !== undefined && (obj.description = message.description); @@ -168,7 +169,7 @@ export const ParamChange = { value: isSet(object.value) ? String(object.value) : "" }; }, - toJSON(message: ParamChange): unknown { + toJSON(message: ParamChange): JsonSafe { const obj: any = {}; message.subspace !== undefined && (obj.subspace = message.subspace); message.key !== undefined && (obj.key = message.key); diff --git a/__fixtures__/output1/cosmos/params/v1beta1/query.ts b/__fixtures__/output1/cosmos/params/v1beta1/query.ts index 021e8dac0d..519a5ccecd 100644 --- a/__fixtures__/output1/cosmos/params/v1beta1/query.ts +++ b/__fixtures__/output1/cosmos/params/v1beta1/query.ts @@ -1,6 +1,7 @@ import { ParamChange, ParamChangeSDKType } from "./params"; import * as _m0 from "protobufjs/minimal"; import { isSet, DeepPartial } from "../../../helpers"; +import { JsonSafe } from "../../../json-safe"; export const protobufPackage = "cosmos.params.v1beta1"; /** QueryParamsRequest is request type for the Query/Params RPC method. */ export interface QueryParamsRequest { @@ -105,7 +106,7 @@ export const QueryParamsRequest = { key: isSet(object.key) ? String(object.key) : "" }; }, - toJSON(message: QueryParamsRequest): unknown { + toJSON(message: QueryParamsRequest): JsonSafe { const obj: any = {}; message.subspace !== undefined && (obj.subspace = message.subspace); message.key !== undefined && (obj.key = message.key); @@ -164,7 +165,7 @@ export const QueryParamsResponse = { param: isSet(object.param) ? ParamChange.fromJSON(object.param) : undefined }; }, - toJSON(message: QueryParamsResponse): unknown { + toJSON(message: QueryParamsResponse): JsonSafe { const obj: any = {}; message.param !== undefined && (obj.param = message.param ? ParamChange.toJSON(message.param) : undefined); return obj; @@ -209,7 +210,7 @@ export const QuerySubspacesRequest = { fromJSON(_: any): QuerySubspacesRequest { return {}; }, - toJSON(_: QuerySubspacesRequest): unknown { + toJSON(_: QuerySubspacesRequest): JsonSafe { const obj: any = {}; return obj; }, @@ -259,7 +260,7 @@ export const QuerySubspacesResponse = { subspaces: Array.isArray(object?.subspaces) ? object.subspaces.map((e: any) => Subspace.fromJSON(e)) : [] }; }, - toJSON(message: QuerySubspacesResponse): unknown { + toJSON(message: QuerySubspacesResponse): JsonSafe { const obj: any = {}; if (message.subspaces) { obj.subspaces = message.subspaces.map(e => e ? Subspace.toJSON(e) : undefined); @@ -330,7 +331,7 @@ export const Subspace = { keys: Array.isArray(object?.keys) ? object.keys.map((e: any) => String(e)) : [] }; }, - toJSON(message: Subspace): unknown { + toJSON(message: Subspace): JsonSafe { const obj: any = {}; message.subspace !== undefined && (obj.subspace = message.subspace); if (message.keys) { diff --git a/__fixtures__/output1/cosmos/slashing/v1beta1/genesis.ts b/__fixtures__/output1/cosmos/slashing/v1beta1/genesis.ts index fabd2f69ca..8445b41ff5 100644 --- a/__fixtures__/output1/cosmos/slashing/v1beta1/genesis.ts +++ b/__fixtures__/output1/cosmos/slashing/v1beta1/genesis.ts @@ -1,6 +1,7 @@ import { Params, ParamsSDKType, ValidatorSigningInfo, ValidatorSigningInfoSDKType } from "./slashing"; import { Long, isSet, DeepPartial } from "../../../helpers"; import * as _m0 from "protobufjs/minimal"; +import { JsonSafe } from "../../../json-safe"; export const protobufPackage = "cosmos.slashing.v1beta1"; /** GenesisState defines the slashing module's genesis state. */ export interface GenesisState { @@ -115,7 +116,7 @@ export const GenesisState = { missedBlocks: Array.isArray(object?.missedBlocks) ? object.missedBlocks.map((e: any) => ValidatorMissedBlocks.fromJSON(e)) : [] }; }, - toJSON(message: GenesisState): unknown { + toJSON(message: GenesisState): JsonSafe { const obj: any = {}; message.params !== undefined && (obj.params = message.params ? Params.toJSON(message.params) : undefined); if (message.signingInfos) { @@ -202,7 +203,7 @@ export const SigningInfo = { validatorSigningInfo: isSet(object.validatorSigningInfo) ? ValidatorSigningInfo.fromJSON(object.validatorSigningInfo) : undefined }; }, - toJSON(message: SigningInfo): unknown { + toJSON(message: SigningInfo): JsonSafe { const obj: any = {}; message.address !== undefined && (obj.address = message.address); message.validatorSigningInfo !== undefined && (obj.validatorSigningInfo = message.validatorSigningInfo ? ValidatorSigningInfo.toJSON(message.validatorSigningInfo) : undefined); @@ -269,7 +270,7 @@ export const ValidatorMissedBlocks = { missedBlocks: Array.isArray(object?.missedBlocks) ? object.missedBlocks.map((e: any) => MissedBlock.fromJSON(e)) : [] }; }, - toJSON(message: ValidatorMissedBlocks): unknown { + toJSON(message: ValidatorMissedBlocks): JsonSafe { const obj: any = {}; message.address !== undefined && (obj.address = message.address); if (message.missedBlocks) { @@ -344,7 +345,7 @@ export const MissedBlock = { missed: isSet(object.missed) ? Boolean(object.missed) : false }; }, - toJSON(message: MissedBlock): unknown { + toJSON(message: MissedBlock): JsonSafe { const obj: any = {}; message.index !== undefined && (obj.index = (message.index || Long.ZERO).toString()); message.missed !== undefined && (obj.missed = message.missed); diff --git a/__fixtures__/output1/cosmos/slashing/v1beta1/query.ts b/__fixtures__/output1/cosmos/slashing/v1beta1/query.ts index cc9f34e01a..bb18fc26ca 100644 --- a/__fixtures__/output1/cosmos/slashing/v1beta1/query.ts +++ b/__fixtures__/output1/cosmos/slashing/v1beta1/query.ts @@ -1,6 +1,7 @@ import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../base/query/v1beta1/pagination"; import { Params, ParamsSDKType, ValidatorSigningInfo, ValidatorSigningInfoSDKType } from "./slashing"; import * as _m0 from "protobufjs/minimal"; +import { JsonSafe } from "../../../json-safe"; import { DeepPartial, isSet } from "../../../helpers"; export const protobufPackage = "cosmos.slashing.v1beta1"; /** QueryParamsRequest is the request type for the Query/Params RPC method */ @@ -100,7 +101,7 @@ export const QueryParamsRequest = { fromJSON(_: any): QueryParamsRequest { return {}; }, - toJSON(_: QueryParamsRequest): unknown { + toJSON(_: QueryParamsRequest): JsonSafe { const obj: any = {}; return obj; }, @@ -150,7 +151,7 @@ export const QueryParamsResponse = { params: isSet(object.params) ? Params.fromJSON(object.params) : undefined }; }, - toJSON(message: QueryParamsResponse): unknown { + toJSON(message: QueryParamsResponse): JsonSafe { const obj: any = {}; message.params !== undefined && (obj.params = message.params ? Params.toJSON(message.params) : undefined); return obj; @@ -205,7 +206,7 @@ export const QuerySigningInfoRequest = { consAddress: isSet(object.consAddress) ? String(object.consAddress) : "" }; }, - toJSON(message: QuerySigningInfoRequest): unknown { + toJSON(message: QuerySigningInfoRequest): JsonSafe { const obj: any = {}; message.consAddress !== undefined && (obj.consAddress = message.consAddress); return obj; @@ -260,7 +261,7 @@ export const QuerySigningInfoResponse = { valSigningInfo: isSet(object.valSigningInfo) ? ValidatorSigningInfo.fromJSON(object.valSigningInfo) : undefined }; }, - toJSON(message: QuerySigningInfoResponse): unknown { + toJSON(message: QuerySigningInfoResponse): JsonSafe { const obj: any = {}; message.valSigningInfo !== undefined && (obj.valSigningInfo = message.valSigningInfo ? ValidatorSigningInfo.toJSON(message.valSigningInfo) : undefined); return obj; @@ -315,7 +316,7 @@ export const QuerySigningInfosRequest = { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; }, - toJSON(message: QuerySigningInfosRequest): unknown { + toJSON(message: QuerySigningInfosRequest): JsonSafe { const obj: any = {}; message.pagination !== undefined && (obj.pagination = message.pagination ? PageRequest.toJSON(message.pagination) : undefined); return obj; @@ -378,7 +379,7 @@ export const QuerySigningInfosResponse = { pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined }; }, - toJSON(message: QuerySigningInfosResponse): unknown { + toJSON(message: QuerySigningInfosResponse): JsonSafe { const obj: any = {}; if (message.info) { obj.info = message.info.map(e => e ? ValidatorSigningInfo.toJSON(e) : undefined); diff --git a/__fixtures__/output1/cosmos/slashing/v1beta1/slashing.ts b/__fixtures__/output1/cosmos/slashing/v1beta1/slashing.ts index 4cc6d6f51c..e08fb77e00 100644 --- a/__fixtures__/output1/cosmos/slashing/v1beta1/slashing.ts +++ b/__fixtures__/output1/cosmos/slashing/v1beta1/slashing.ts @@ -2,6 +2,7 @@ import { Timestamp, TimestampSDKType } from "../../../google/protobuf/timestamp" import { Duration, DurationSDKType } from "../../../google/protobuf/duration"; import { Long, toTimestamp, fromTimestamp, isSet, fromJsonTimestamp, DeepPartial, bytesFromBase64, base64FromBytes } from "../../../helpers"; import * as _m0 from "protobufjs/minimal"; +import { JsonSafe } from "../../../json-safe"; export const protobufPackage = "cosmos.slashing.v1beta1"; /** * ValidatorSigningInfo defines a validator's signing info for monitoring their @@ -132,7 +133,7 @@ export const ValidatorSigningInfo = { missedBlocksCounter: isSet(object.missedBlocksCounter) ? Long.fromValue(object.missedBlocksCounter) : Long.ZERO }; }, - toJSON(message: ValidatorSigningInfo): unknown { + toJSON(message: ValidatorSigningInfo): JsonSafe { const obj: any = {}; message.address !== undefined && (obj.address = message.address); message.startHeight !== undefined && (obj.startHeight = (message.startHeight || Long.ZERO).toString()); @@ -239,7 +240,7 @@ export const Params = { slashFractionDowntime: isSet(object.slashFractionDowntime) ? bytesFromBase64(object.slashFractionDowntime) : new Uint8Array() }; }, - toJSON(message: Params): unknown { + toJSON(message: Params): JsonSafe { const obj: any = {}; message.signedBlocksWindow !== undefined && (obj.signedBlocksWindow = (message.signedBlocksWindow || Long.ZERO).toString()); message.minSignedPerWindow !== undefined && (obj.minSignedPerWindow = base64FromBytes(message.minSignedPerWindow !== undefined ? message.minSignedPerWindow : new Uint8Array())); diff --git a/__fixtures__/output1/cosmos/slashing/v1beta1/tx.ts b/__fixtures__/output1/cosmos/slashing/v1beta1/tx.ts index 2878cf9603..cc2dbbf884 100644 --- a/__fixtures__/output1/cosmos/slashing/v1beta1/tx.ts +++ b/__fixtures__/output1/cosmos/slashing/v1beta1/tx.ts @@ -1,5 +1,6 @@ import * as _m0 from "protobufjs/minimal"; import { isSet, DeepPartial } from "../../../helpers"; +import { JsonSafe } from "../../../json-safe"; export const protobufPackage = "cosmos.slashing.v1beta1"; /** MsgUnjail defines the Msg/Unjail request type */ export interface MsgUnjail { @@ -47,7 +48,7 @@ export const MsgUnjail = { validatorAddr: isSet(object.validatorAddr) ? String(object.validatorAddr) : "" }; }, - toJSON(message: MsgUnjail): unknown { + toJSON(message: MsgUnjail): JsonSafe { const obj: any = {}; message.validatorAddr !== undefined && (obj.validatorAddr = message.validatorAddr); return obj; @@ -92,7 +93,7 @@ export const MsgUnjailResponse = { fromJSON(_: any): MsgUnjailResponse { return {}; }, - toJSON(_: MsgUnjailResponse): unknown { + toJSON(_: MsgUnjailResponse): JsonSafe { const obj: any = {}; return obj; }, diff --git a/__fixtures__/output1/cosmos/staking/v1beta1/authz.ts b/__fixtures__/output1/cosmos/staking/v1beta1/authz.ts index bd006ea62c..9342116b30 100644 --- a/__fixtures__/output1/cosmos/staking/v1beta1/authz.ts +++ b/__fixtures__/output1/cosmos/staking/v1beta1/authz.ts @@ -1,6 +1,7 @@ import { Coin, CoinSDKType } from "../../base/v1beta1/coin"; import * as _m0 from "protobufjs/minimal"; import { isSet, DeepPartial } from "../../../helpers"; +import { JsonSafe } from "../../../json-safe"; export const protobufPackage = "cosmos.staking.v1beta1"; /** * AuthorizationType defines the type of staking module authorization type @@ -152,7 +153,7 @@ export const StakeAuthorization = { authorizationType: isSet(object.authorizationType) ? authorizationTypeFromJSON(object.authorizationType) : -1 }; }, - toJSON(message: StakeAuthorization): unknown { + toJSON(message: StakeAuthorization): JsonSafe { const obj: any = {}; message.maxTokens !== undefined && (obj.maxTokens = message.maxTokens ? Coin.toJSON(message.maxTokens) : undefined); message.allowList !== undefined && (obj.allowList = message.allowList ? StakeAuthorization_Validators.toJSON(message.allowList) : undefined); @@ -219,7 +220,7 @@ export const StakeAuthorization_Validators = { address: Array.isArray(object?.address) ? object.address.map((e: any) => String(e)) : [] }; }, - toJSON(message: StakeAuthorization_Validators): unknown { + toJSON(message: StakeAuthorization_Validators): JsonSafe { const obj: any = {}; if (message.address) { obj.address = message.address.map(e => e); diff --git a/__fixtures__/output1/cosmos/staking/v1beta1/genesis.ts b/__fixtures__/output1/cosmos/staking/v1beta1/genesis.ts index 24209f64cc..3e6c114198 100644 --- a/__fixtures__/output1/cosmos/staking/v1beta1/genesis.ts +++ b/__fixtures__/output1/cosmos/staking/v1beta1/genesis.ts @@ -1,6 +1,7 @@ import { Params, ParamsSDKType, Validator, ValidatorSDKType, Delegation, DelegationSDKType, UnbondingDelegation, UnbondingDelegationSDKType, Redelegation, RedelegationSDKType } from "./staking"; import { Long, isSet, bytesFromBase64, base64FromBytes, DeepPartial } from "../../../helpers"; import * as _m0 from "protobufjs/minimal"; +import { JsonSafe } from "../../../json-safe"; export const protobufPackage = "cosmos.staking.v1beta1"; /** GenesisState defines the staking module's genesis state. */ export interface GenesisState { @@ -139,7 +140,7 @@ export const GenesisState = { exported: isSet(object.exported) ? Boolean(object.exported) : false }; }, - toJSON(message: GenesisState): unknown { + toJSON(message: GenesisState): JsonSafe { const obj: any = {}; message.params !== undefined && (obj.params = message.params ? Params.toJSON(message.params) : undefined); message.lastTotalPower !== undefined && (obj.lastTotalPower = base64FromBytes(message.lastTotalPower !== undefined ? message.lastTotalPower : new Uint8Array())); @@ -270,7 +271,7 @@ export const LastValidatorPower = { power: isSet(object.power) ? Long.fromValue(object.power) : Long.ZERO }; }, - toJSON(message: LastValidatorPower): unknown { + toJSON(message: LastValidatorPower): JsonSafe { const obj: any = {}; message.address !== undefined && (obj.address = message.address); message.power !== undefined && (obj.power = (message.power || Long.ZERO).toString()); diff --git a/__fixtures__/output1/cosmos/staking/v1beta1/query.ts b/__fixtures__/output1/cosmos/staking/v1beta1/query.ts index cc07a52fbe..b47acedf58 100644 --- a/__fixtures__/output1/cosmos/staking/v1beta1/query.ts +++ b/__fixtures__/output1/cosmos/staking/v1beta1/query.ts @@ -2,6 +2,7 @@ import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } fr import { Validator, ValidatorSDKType, DelegationResponse, DelegationResponseSDKType, UnbondingDelegation, UnbondingDelegationSDKType, RedelegationResponse, RedelegationResponseSDKType, HistoricalInfo, HistoricalInfoSDKType, Pool, PoolSDKType, Params, ParamsSDKType } from "./staking"; import { Long, isSet, DeepPartial } from "../../../helpers"; import * as _m0 from "protobufjs/minimal"; +import { JsonSafe } from "../../../json-safe"; export const protobufPackage = "cosmos.staking.v1beta1"; /** QueryValidatorsRequest is request type for Query/Validators RPC method. */ export interface QueryValidatorsRequest { @@ -448,7 +449,7 @@ export const QueryValidatorsRequest = { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; }, - toJSON(message: QueryValidatorsRequest): unknown { + toJSON(message: QueryValidatorsRequest): JsonSafe { const obj: any = {}; message.status !== undefined && (obj.status = message.status); message.pagination !== undefined && (obj.pagination = message.pagination ? PageRequest.toJSON(message.pagination) : undefined); @@ -515,7 +516,7 @@ export const QueryValidatorsResponse = { pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined }; }, - toJSON(message: QueryValidatorsResponse): unknown { + toJSON(message: QueryValidatorsResponse): JsonSafe { const obj: any = {}; if (message.validators) { obj.validators = message.validators.map(e => e ? Validator.toJSON(e) : undefined); @@ -582,7 +583,7 @@ export const QueryValidatorRequest = { validatorAddr: isSet(object.validatorAddr) ? String(object.validatorAddr) : "" }; }, - toJSON(message: QueryValidatorRequest): unknown { + toJSON(message: QueryValidatorRequest): JsonSafe { const obj: any = {}; message.validatorAddr !== undefined && (obj.validatorAddr = message.validatorAddr); return obj; @@ -637,7 +638,7 @@ export const QueryValidatorResponse = { validator: isSet(object.validator) ? Validator.fromJSON(object.validator) : undefined }; }, - toJSON(message: QueryValidatorResponse): unknown { + toJSON(message: QueryValidatorResponse): JsonSafe { const obj: any = {}; message.validator !== undefined && (obj.validator = message.validator ? Validator.toJSON(message.validator) : undefined); return obj; @@ -700,7 +701,7 @@ export const QueryValidatorDelegationsRequest = { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; }, - toJSON(message: QueryValidatorDelegationsRequest): unknown { + toJSON(message: QueryValidatorDelegationsRequest): JsonSafe { const obj: any = {}; message.validatorAddr !== undefined && (obj.validatorAddr = message.validatorAddr); message.pagination !== undefined && (obj.pagination = message.pagination ? PageRequest.toJSON(message.pagination) : undefined); @@ -767,7 +768,7 @@ export const QueryValidatorDelegationsResponse = { pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined }; }, - toJSON(message: QueryValidatorDelegationsResponse): unknown { + toJSON(message: QueryValidatorDelegationsResponse): JsonSafe { const obj: any = {}; if (message.delegationResponses) { obj.delegationResponses = message.delegationResponses.map(e => e ? DelegationResponse.toJSON(e) : undefined); @@ -842,7 +843,7 @@ export const QueryValidatorUnbondingDelegationsRequest = { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; }, - toJSON(message: QueryValidatorUnbondingDelegationsRequest): unknown { + toJSON(message: QueryValidatorUnbondingDelegationsRequest): JsonSafe { const obj: any = {}; message.validatorAddr !== undefined && (obj.validatorAddr = message.validatorAddr); message.pagination !== undefined && (obj.pagination = message.pagination ? PageRequest.toJSON(message.pagination) : undefined); @@ -909,7 +910,7 @@ export const QueryValidatorUnbondingDelegationsResponse = { pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined }; }, - toJSON(message: QueryValidatorUnbondingDelegationsResponse): unknown { + toJSON(message: QueryValidatorUnbondingDelegationsResponse): JsonSafe { const obj: any = {}; if (message.unbondingResponses) { obj.unbondingResponses = message.unbondingResponses.map(e => e ? UnbondingDelegation.toJSON(e) : undefined); @@ -984,7 +985,7 @@ export const QueryDelegationRequest = { validatorAddr: isSet(object.validatorAddr) ? String(object.validatorAddr) : "" }; }, - toJSON(message: QueryDelegationRequest): unknown { + toJSON(message: QueryDelegationRequest): JsonSafe { const obj: any = {}; message.delegatorAddr !== undefined && (obj.delegatorAddr = message.delegatorAddr); message.validatorAddr !== undefined && (obj.validatorAddr = message.validatorAddr); @@ -1043,7 +1044,7 @@ export const QueryDelegationResponse = { delegationResponse: isSet(object.delegationResponse) ? DelegationResponse.fromJSON(object.delegationResponse) : undefined }; }, - toJSON(message: QueryDelegationResponse): unknown { + toJSON(message: QueryDelegationResponse): JsonSafe { const obj: any = {}; message.delegationResponse !== undefined && (obj.delegationResponse = message.delegationResponse ? DelegationResponse.toJSON(message.delegationResponse) : undefined); return obj; @@ -1106,7 +1107,7 @@ export const QueryUnbondingDelegationRequest = { validatorAddr: isSet(object.validatorAddr) ? String(object.validatorAddr) : "" }; }, - toJSON(message: QueryUnbondingDelegationRequest): unknown { + toJSON(message: QueryUnbondingDelegationRequest): JsonSafe { const obj: any = {}; message.delegatorAddr !== undefined && (obj.delegatorAddr = message.delegatorAddr); message.validatorAddr !== undefined && (obj.validatorAddr = message.validatorAddr); @@ -1165,7 +1166,7 @@ export const QueryUnbondingDelegationResponse = { unbond: isSet(object.unbond) ? UnbondingDelegation.fromJSON(object.unbond) : undefined }; }, - toJSON(message: QueryUnbondingDelegationResponse): unknown { + toJSON(message: QueryUnbondingDelegationResponse): JsonSafe { const obj: any = {}; message.unbond !== undefined && (obj.unbond = message.unbond ? UnbondingDelegation.toJSON(message.unbond) : undefined); return obj; @@ -1228,7 +1229,7 @@ export const QueryDelegatorDelegationsRequest = { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; }, - toJSON(message: QueryDelegatorDelegationsRequest): unknown { + toJSON(message: QueryDelegatorDelegationsRequest): JsonSafe { const obj: any = {}; message.delegatorAddr !== undefined && (obj.delegatorAddr = message.delegatorAddr); message.pagination !== undefined && (obj.pagination = message.pagination ? PageRequest.toJSON(message.pagination) : undefined); @@ -1295,7 +1296,7 @@ export const QueryDelegatorDelegationsResponse = { pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined }; }, - toJSON(message: QueryDelegatorDelegationsResponse): unknown { + toJSON(message: QueryDelegatorDelegationsResponse): JsonSafe { const obj: any = {}; if (message.delegationResponses) { obj.delegationResponses = message.delegationResponses.map(e => e ? DelegationResponse.toJSON(e) : undefined); @@ -1370,7 +1371,7 @@ export const QueryDelegatorUnbondingDelegationsRequest = { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; }, - toJSON(message: QueryDelegatorUnbondingDelegationsRequest): unknown { + toJSON(message: QueryDelegatorUnbondingDelegationsRequest): JsonSafe { const obj: any = {}; message.delegatorAddr !== undefined && (obj.delegatorAddr = message.delegatorAddr); message.pagination !== undefined && (obj.pagination = message.pagination ? PageRequest.toJSON(message.pagination) : undefined); @@ -1437,7 +1438,7 @@ export const QueryDelegatorUnbondingDelegationsResponse = { pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined }; }, - toJSON(message: QueryDelegatorUnbondingDelegationsResponse): unknown { + toJSON(message: QueryDelegatorUnbondingDelegationsResponse): JsonSafe { const obj: any = {}; if (message.unbondingResponses) { obj.unbondingResponses = message.unbondingResponses.map(e => e ? UnbondingDelegation.toJSON(e) : undefined); @@ -1528,7 +1529,7 @@ export const QueryRedelegationsRequest = { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; }, - toJSON(message: QueryRedelegationsRequest): unknown { + toJSON(message: QueryRedelegationsRequest): JsonSafe { const obj: any = {}; message.delegatorAddr !== undefined && (obj.delegatorAddr = message.delegatorAddr); message.srcValidatorAddr !== undefined && (obj.srcValidatorAddr = message.srcValidatorAddr); @@ -1603,7 +1604,7 @@ export const QueryRedelegationsResponse = { pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined }; }, - toJSON(message: QueryRedelegationsResponse): unknown { + toJSON(message: QueryRedelegationsResponse): JsonSafe { const obj: any = {}; if (message.redelegationResponses) { obj.redelegationResponses = message.redelegationResponses.map(e => e ? RedelegationResponse.toJSON(e) : undefined); @@ -1678,7 +1679,7 @@ export const QueryDelegatorValidatorsRequest = { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; }, - toJSON(message: QueryDelegatorValidatorsRequest): unknown { + toJSON(message: QueryDelegatorValidatorsRequest): JsonSafe { const obj: any = {}; message.delegatorAddr !== undefined && (obj.delegatorAddr = message.delegatorAddr); message.pagination !== undefined && (obj.pagination = message.pagination ? PageRequest.toJSON(message.pagination) : undefined); @@ -1745,7 +1746,7 @@ export const QueryDelegatorValidatorsResponse = { pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined }; }, - toJSON(message: QueryDelegatorValidatorsResponse): unknown { + toJSON(message: QueryDelegatorValidatorsResponse): JsonSafe { const obj: any = {}; if (message.validators) { obj.validators = message.validators.map(e => e ? Validator.toJSON(e) : undefined); @@ -1820,7 +1821,7 @@ export const QueryDelegatorValidatorRequest = { validatorAddr: isSet(object.validatorAddr) ? String(object.validatorAddr) : "" }; }, - toJSON(message: QueryDelegatorValidatorRequest): unknown { + toJSON(message: QueryDelegatorValidatorRequest): JsonSafe { const obj: any = {}; message.delegatorAddr !== undefined && (obj.delegatorAddr = message.delegatorAddr); message.validatorAddr !== undefined && (obj.validatorAddr = message.validatorAddr); @@ -1879,7 +1880,7 @@ export const QueryDelegatorValidatorResponse = { validator: isSet(object.validator) ? Validator.fromJSON(object.validator) : undefined }; }, - toJSON(message: QueryDelegatorValidatorResponse): unknown { + toJSON(message: QueryDelegatorValidatorResponse): JsonSafe { const obj: any = {}; message.validator !== undefined && (obj.validator = message.validator ? Validator.toJSON(message.validator) : undefined); return obj; @@ -1934,7 +1935,7 @@ export const QueryHistoricalInfoRequest = { height: isSet(object.height) ? Long.fromValue(object.height) : Long.ZERO }; }, - toJSON(message: QueryHistoricalInfoRequest): unknown { + toJSON(message: QueryHistoricalInfoRequest): JsonSafe { const obj: any = {}; message.height !== undefined && (obj.height = (message.height || Long.ZERO).toString()); return obj; @@ -1989,7 +1990,7 @@ export const QueryHistoricalInfoResponse = { hist: isSet(object.hist) ? HistoricalInfo.fromJSON(object.hist) : undefined }; }, - toJSON(message: QueryHistoricalInfoResponse): unknown { + toJSON(message: QueryHistoricalInfoResponse): JsonSafe { const obj: any = {}; message.hist !== undefined && (obj.hist = message.hist ? HistoricalInfo.toJSON(message.hist) : undefined); return obj; @@ -2034,7 +2035,7 @@ export const QueryPoolRequest = { fromJSON(_: any): QueryPoolRequest { return {}; }, - toJSON(_: QueryPoolRequest): unknown { + toJSON(_: QueryPoolRequest): JsonSafe { const obj: any = {}; return obj; }, @@ -2084,7 +2085,7 @@ export const QueryPoolResponse = { pool: isSet(object.pool) ? Pool.fromJSON(object.pool) : undefined }; }, - toJSON(message: QueryPoolResponse): unknown { + toJSON(message: QueryPoolResponse): JsonSafe { const obj: any = {}; message.pool !== undefined && (obj.pool = message.pool ? Pool.toJSON(message.pool) : undefined); return obj; @@ -2129,7 +2130,7 @@ export const QueryParamsRequest = { fromJSON(_: any): QueryParamsRequest { return {}; }, - toJSON(_: QueryParamsRequest): unknown { + toJSON(_: QueryParamsRequest): JsonSafe { const obj: any = {}; return obj; }, @@ -2179,7 +2180,7 @@ export const QueryParamsResponse = { params: isSet(object.params) ? Params.fromJSON(object.params) : undefined }; }, - toJSON(message: QueryParamsResponse): unknown { + toJSON(message: QueryParamsResponse): JsonSafe { const obj: any = {}; message.params !== undefined && (obj.params = message.params ? Params.toJSON(message.params) : undefined); return obj; diff --git a/__fixtures__/output1/cosmos/staking/v1beta1/staking.ts b/__fixtures__/output1/cosmos/staking/v1beta1/staking.ts index 4ca7937406..90a6bdbdb2 100644 --- a/__fixtures__/output1/cosmos/staking/v1beta1/staking.ts +++ b/__fixtures__/output1/cosmos/staking/v1beta1/staking.ts @@ -5,6 +5,7 @@ import { Duration, DurationSDKType } from "../../../google/protobuf/duration"; import { Coin, CoinSDKType } from "../../base/v1beta1/coin"; import { Long, isSet, DeepPartial, toTimestamp, fromTimestamp, fromJsonTimestamp } from "../../../helpers"; import * as _m0 from "protobufjs/minimal"; +import { JsonSafe } from "../../../json-safe"; export const protobufPackage = "cosmos.staking.v1beta1"; /** BondStatus is the status of a validator. */ export enum BondStatus { @@ -487,7 +488,7 @@ export const HistoricalInfo = { valset: Array.isArray(object?.valset) ? object.valset.map((e: any) => Validator.fromJSON(e)) : [] }; }, - toJSON(message: HistoricalInfo): unknown { + toJSON(message: HistoricalInfo): JsonSafe { const obj: any = {}; message.header !== undefined && (obj.header = message.header ? Header.toJSON(message.header) : undefined); if (message.valset) { @@ -570,7 +571,7 @@ export const CommissionRates = { maxChangeRate: isSet(object.maxChangeRate) ? String(object.maxChangeRate) : "" }; }, - toJSON(message: CommissionRates): unknown { + toJSON(message: CommissionRates): JsonSafe { const obj: any = {}; message.rate !== undefined && (obj.rate = message.rate); message.maxRate !== undefined && (obj.maxRate = message.maxRate); @@ -641,7 +642,7 @@ export const Commission = { updateTime: isSet(object.updateTime) ? fromJsonTimestamp(object.updateTime) : undefined }; }, - toJSON(message: Commission): unknown { + toJSON(message: Commission): JsonSafe { const obj: any = {}; message.commissionRates !== undefined && (obj.commissionRates = message.commissionRates ? CommissionRates.toJSON(message.commissionRates) : undefined); message.updateTime !== undefined && (obj.updateTime = message.updateTime.toISOString()); @@ -732,7 +733,7 @@ export const Description = { details: isSet(object.details) ? String(object.details) : "" }; }, - toJSON(message: Description): unknown { + toJSON(message: Description): JsonSafe { const obj: any = {}; message.moniker !== undefined && (obj.moniker = message.moniker); message.identity !== undefined && (obj.identity = message.identity); @@ -883,7 +884,7 @@ export const Validator = { minSelfDelegation: isSet(object.minSelfDelegation) ? String(object.minSelfDelegation) : "" }; }, - toJSON(message: Validator): unknown { + toJSON(message: Validator): JsonSafe { const obj: any = {}; message.operatorAddress !== undefined && (obj.operatorAddress = message.operatorAddress); message.consensusPubkey !== undefined && (obj.consensusPubkey = message.consensusPubkey ? Any.toJSON(message.consensusPubkey) : undefined); @@ -978,7 +979,7 @@ export const ValAddresses = { addresses: Array.isArray(object?.addresses) ? object.addresses.map((e: any) => String(e)) : [] }; }, - toJSON(message: ValAddresses): unknown { + toJSON(message: ValAddresses): JsonSafe { const obj: any = {}; if (message.addresses) { obj.addresses = message.addresses.map(e => e); @@ -1049,7 +1050,7 @@ export const DVPair = { validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "" }; }, - toJSON(message: DVPair): unknown { + toJSON(message: DVPair): JsonSafe { const obj: any = {}; message.delegatorAddress !== undefined && (obj.delegatorAddress = message.delegatorAddress); message.validatorAddress !== undefined && (obj.validatorAddress = message.validatorAddress); @@ -1108,7 +1109,7 @@ export const DVPairs = { pairs: Array.isArray(object?.pairs) ? object.pairs.map((e: any) => DVPair.fromJSON(e)) : [] }; }, - toJSON(message: DVPairs): unknown { + toJSON(message: DVPairs): JsonSafe { const obj: any = {}; if (message.pairs) { obj.pairs = message.pairs.map(e => e ? DVPair.toJSON(e) : undefined); @@ -1187,7 +1188,7 @@ export const DVVTriplet = { validatorDstAddress: isSet(object.validatorDstAddress) ? String(object.validatorDstAddress) : "" }; }, - toJSON(message: DVVTriplet): unknown { + toJSON(message: DVVTriplet): JsonSafe { const obj: any = {}; message.delegatorAddress !== undefined && (obj.delegatorAddress = message.delegatorAddress); message.validatorSrcAddress !== undefined && (obj.validatorSrcAddress = message.validatorSrcAddress); @@ -1250,7 +1251,7 @@ export const DVVTriplets = { triplets: Array.isArray(object?.triplets) ? object.triplets.map((e: any) => DVVTriplet.fromJSON(e)) : [] }; }, - toJSON(message: DVVTriplets): unknown { + toJSON(message: DVVTriplets): JsonSafe { const obj: any = {}; if (message.triplets) { obj.triplets = message.triplets.map(e => e ? DVVTriplet.toJSON(e) : undefined); @@ -1329,7 +1330,7 @@ export const Delegation = { shares: isSet(object.shares) ? String(object.shares) : "" }; }, - toJSON(message: Delegation): unknown { + toJSON(message: Delegation): JsonSafe { const obj: any = {}; message.delegatorAddress !== undefined && (obj.delegatorAddress = message.delegatorAddress); message.validatorAddress !== undefined && (obj.validatorAddress = message.validatorAddress); @@ -1408,7 +1409,7 @@ export const UnbondingDelegation = { entries: Array.isArray(object?.entries) ? object.entries.map((e: any) => UnbondingDelegationEntry.fromJSON(e)) : [] }; }, - toJSON(message: UnbondingDelegation): unknown { + toJSON(message: UnbondingDelegation): JsonSafe { const obj: any = {}; message.delegatorAddress !== undefined && (obj.delegatorAddress = message.delegatorAddress); message.validatorAddress !== undefined && (obj.validatorAddress = message.validatorAddress); @@ -1503,7 +1504,7 @@ export const UnbondingDelegationEntry = { balance: isSet(object.balance) ? String(object.balance) : "" }; }, - toJSON(message: UnbondingDelegationEntry): unknown { + toJSON(message: UnbondingDelegationEntry): JsonSafe { const obj: any = {}; message.creationHeight !== undefined && (obj.creationHeight = (message.creationHeight || Long.ZERO).toString()); message.completionTime !== undefined && (obj.completionTime = message.completionTime.toISOString()); @@ -1594,7 +1595,7 @@ export const RedelegationEntry = { sharesDst: isSet(object.sharesDst) ? String(object.sharesDst) : "" }; }, - toJSON(message: RedelegationEntry): unknown { + toJSON(message: RedelegationEntry): JsonSafe { const obj: any = {}; message.creationHeight !== undefined && (obj.creationHeight = (message.creationHeight || Long.ZERO).toString()); message.completionTime !== undefined && (obj.completionTime = message.completionTime.toISOString()); @@ -1685,7 +1686,7 @@ export const Redelegation = { entries: Array.isArray(object?.entries) ? object.entries.map((e: any) => RedelegationEntry.fromJSON(e)) : [] }; }, - toJSON(message: Redelegation): unknown { + toJSON(message: Redelegation): JsonSafe { const obj: any = {}; message.delegatorAddress !== undefined && (obj.delegatorAddress = message.delegatorAddress); message.validatorSrcAddress !== undefined && (obj.validatorSrcAddress = message.validatorSrcAddress); @@ -1800,7 +1801,7 @@ export const Params = { minCommissionRate: isSet(object.minCommissionRate) ? String(object.minCommissionRate) : "" }; }, - toJSON(message: Params): unknown { + toJSON(message: Params): JsonSafe { const obj: any = {}; message.unbondingTime !== undefined && (obj.unbondingTime = message.unbondingTime ? Duration.toJSON(message.unbondingTime) : undefined); message.maxValidators !== undefined && (obj.maxValidators = Math.round(message.maxValidators)); @@ -1883,7 +1884,7 @@ export const DelegationResponse = { balance: isSet(object.balance) ? Coin.fromJSON(object.balance) : undefined }; }, - toJSON(message: DelegationResponse): unknown { + toJSON(message: DelegationResponse): JsonSafe { const obj: any = {}; message.delegation !== undefined && (obj.delegation = message.delegation ? Delegation.toJSON(message.delegation) : undefined); message.balance !== undefined && (obj.balance = message.balance ? Coin.toJSON(message.balance) : undefined); @@ -1950,7 +1951,7 @@ export const RedelegationEntryResponse = { balance: isSet(object.balance) ? String(object.balance) : "" }; }, - toJSON(message: RedelegationEntryResponse): unknown { + toJSON(message: RedelegationEntryResponse): JsonSafe { const obj: any = {}; message.redelegationEntry !== undefined && (obj.redelegationEntry = message.redelegationEntry ? RedelegationEntry.toJSON(message.redelegationEntry) : undefined); message.balance !== undefined && (obj.balance = message.balance); @@ -2017,7 +2018,7 @@ export const RedelegationResponse = { entries: Array.isArray(object?.entries) ? object.entries.map((e: any) => RedelegationEntryResponse.fromJSON(e)) : [] }; }, - toJSON(message: RedelegationResponse): unknown { + toJSON(message: RedelegationResponse): JsonSafe { const obj: any = {}; message.redelegation !== undefined && (obj.redelegation = message.redelegation ? Redelegation.toJSON(message.redelegation) : undefined); if (message.entries) { @@ -2092,7 +2093,7 @@ export const Pool = { bondedTokens: isSet(object.bondedTokens) ? String(object.bondedTokens) : "" }; }, - toJSON(message: Pool): unknown { + toJSON(message: Pool): JsonSafe { const obj: any = {}; message.notBondedTokens !== undefined && (obj.notBondedTokens = message.notBondedTokens); message.bondedTokens !== undefined && (obj.bondedTokens = message.bondedTokens); diff --git a/__fixtures__/output1/cosmos/staking/v1beta1/tx.ts b/__fixtures__/output1/cosmos/staking/v1beta1/tx.ts index 6160cad7df..0bb6a6fb50 100644 --- a/__fixtures__/output1/cosmos/staking/v1beta1/tx.ts +++ b/__fixtures__/output1/cosmos/staking/v1beta1/tx.ts @@ -4,6 +4,7 @@ import { Coin, CoinSDKType } from "../../base/v1beta1/coin"; import { Timestamp, TimestampSDKType } from "../../../google/protobuf/timestamp"; import * as _m0 from "protobufjs/minimal"; import { isSet, DeepPartial, toTimestamp, fromTimestamp, fromJsonTimestamp } from "../../../helpers"; +import { JsonSafe } from "../../../json-safe"; export const protobufPackage = "cosmos.staking.v1beta1"; /** MsgCreateValidator defines a SDK message for creating a new validator. */ export interface MsgCreateValidator { @@ -211,7 +212,7 @@ export const MsgCreateValidator = { value: isSet(object.value) ? Coin.fromJSON(object.value) : undefined }; }, - toJSON(message: MsgCreateValidator): unknown { + toJSON(message: MsgCreateValidator): JsonSafe { const obj: any = {}; message.description !== undefined && (obj.description = message.description ? Description.toJSON(message.description) : undefined); message.commission !== undefined && (obj.commission = message.commission ? CommissionRates.toJSON(message.commission) : undefined); @@ -280,7 +281,7 @@ export const MsgCreateValidatorResponse = { fromJSON(_: any): MsgCreateValidatorResponse { return {}; }, - toJSON(_: MsgCreateValidatorResponse): unknown { + toJSON(_: MsgCreateValidatorResponse): JsonSafe { const obj: any = {}; return obj; }, @@ -354,7 +355,7 @@ export const MsgEditValidator = { minSelfDelegation: isSet(object.minSelfDelegation) ? String(object.minSelfDelegation) : "" }; }, - toJSON(message: MsgEditValidator): unknown { + toJSON(message: MsgEditValidator): JsonSafe { const obj: any = {}; message.description !== undefined && (obj.description = message.description ? Description.toJSON(message.description) : undefined); message.validatorAddress !== undefined && (obj.validatorAddress = message.validatorAddress); @@ -411,7 +412,7 @@ export const MsgEditValidatorResponse = { fromJSON(_: any): MsgEditValidatorResponse { return {}; }, - toJSON(_: MsgEditValidatorResponse): unknown { + toJSON(_: MsgEditValidatorResponse): JsonSafe { const obj: any = {}; return obj; }, @@ -477,7 +478,7 @@ export const MsgDelegate = { amount: isSet(object.amount) ? Coin.fromJSON(object.amount) : undefined }; }, - toJSON(message: MsgDelegate): unknown { + toJSON(message: MsgDelegate): JsonSafe { const obj: any = {}; message.delegatorAddress !== undefined && (obj.delegatorAddress = message.delegatorAddress); message.validatorAddress !== undefined && (obj.validatorAddress = message.validatorAddress); @@ -530,7 +531,7 @@ export const MsgDelegateResponse = { fromJSON(_: any): MsgDelegateResponse { return {}; }, - toJSON(_: MsgDelegateResponse): unknown { + toJSON(_: MsgDelegateResponse): JsonSafe { const obj: any = {}; return obj; }, @@ -604,7 +605,7 @@ export const MsgBeginRedelegate = { amount: isSet(object.amount) ? Coin.fromJSON(object.amount) : undefined }; }, - toJSON(message: MsgBeginRedelegate): unknown { + toJSON(message: MsgBeginRedelegate): JsonSafe { const obj: any = {}; message.delegatorAddress !== undefined && (obj.delegatorAddress = message.delegatorAddress); message.validatorSrcAddress !== undefined && (obj.validatorSrcAddress = message.validatorSrcAddress); @@ -671,7 +672,7 @@ export const MsgBeginRedelegateResponse = { completionTime: isSet(object.completionTime) ? fromJsonTimestamp(object.completionTime) : undefined }; }, - toJSON(message: MsgBeginRedelegateResponse): unknown { + toJSON(message: MsgBeginRedelegateResponse): JsonSafe { const obj: any = {}; message.completionTime !== undefined && (obj.completionTime = message.completionTime.toISOString()); return obj; @@ -742,7 +743,7 @@ export const MsgUndelegate = { amount: isSet(object.amount) ? Coin.fromJSON(object.amount) : undefined }; }, - toJSON(message: MsgUndelegate): unknown { + toJSON(message: MsgUndelegate): JsonSafe { const obj: any = {}; message.delegatorAddress !== undefined && (obj.delegatorAddress = message.delegatorAddress); message.validatorAddress !== undefined && (obj.validatorAddress = message.validatorAddress); @@ -805,7 +806,7 @@ export const MsgUndelegateResponse = { completionTime: isSet(object.completionTime) ? fromJsonTimestamp(object.completionTime) : undefined }; }, - toJSON(message: MsgUndelegateResponse): unknown { + toJSON(message: MsgUndelegateResponse): JsonSafe { const obj: any = {}; message.completionTime !== undefined && (obj.completionTime = message.completionTime.toISOString()); return obj; diff --git a/__fixtures__/output1/cosmos/tx/signing/v1beta1/signing.ts b/__fixtures__/output1/cosmos/tx/signing/v1beta1/signing.ts index a7f8a541b4..7d1b3313be 100644 --- a/__fixtures__/output1/cosmos/tx/signing/v1beta1/signing.ts +++ b/__fixtures__/output1/cosmos/tx/signing/v1beta1/signing.ts @@ -2,6 +2,7 @@ import { CompactBitArray, CompactBitArraySDKType } from "../../../crypto/multisi import { Any, AnySDKType } from "../../../../google/protobuf/any"; import { Long, DeepPartial, isSet, bytesFromBase64, base64FromBytes } from "../../../../helpers"; import * as _m0 from "protobufjs/minimal"; +import { JsonSafe } from "../../../../json-safe"; export const protobufPackage = "cosmos.tx.signing.v1beta1"; /** * SignMode represents a signing mode with its own security guarantees. @@ -194,7 +195,7 @@ export const SignatureDescriptors = { signatures: Array.isArray(object?.signatures) ? object.signatures.map((e: any) => SignatureDescriptor.fromJSON(e)) : [] }; }, - toJSON(message: SignatureDescriptors): unknown { + toJSON(message: SignatureDescriptors): JsonSafe { const obj: any = {}; if (message.signatures) { obj.signatures = message.signatures.map(e => e ? SignatureDescriptor.toJSON(e) : undefined); @@ -273,7 +274,7 @@ export const SignatureDescriptor = { sequence: isSet(object.sequence) ? Long.fromValue(object.sequence) : Long.UZERO }; }, - toJSON(message: SignatureDescriptor): unknown { + toJSON(message: SignatureDescriptor): JsonSafe { const obj: any = {}; message.publicKey !== undefined && (obj.publicKey = message.publicKey ? Any.toJSON(message.publicKey) : undefined); message.data !== undefined && (obj.data = message.data ? SignatureDescriptor_Data.toJSON(message.data) : undefined); @@ -344,7 +345,7 @@ export const SignatureDescriptor_Data = { multi: isSet(object.multi) ? SignatureDescriptor_Data_Multi.fromJSON(object.multi) : undefined }; }, - toJSON(message: SignatureDescriptor_Data): unknown { + toJSON(message: SignatureDescriptor_Data): JsonSafe { const obj: any = {}; message.single !== undefined && (obj.single = message.single ? SignatureDescriptor_Data_Single.toJSON(message.single) : undefined); message.multi !== undefined && (obj.multi = message.multi ? SignatureDescriptor_Data_Multi.toJSON(message.multi) : undefined); @@ -411,7 +412,7 @@ export const SignatureDescriptor_Data_Single = { signature: isSet(object.signature) ? bytesFromBase64(object.signature) : new Uint8Array() }; }, - toJSON(message: SignatureDescriptor_Data_Single): unknown { + toJSON(message: SignatureDescriptor_Data_Single): JsonSafe { const obj: any = {}; message.mode !== undefined && (obj.mode = signModeToJSON(message.mode)); message.signature !== undefined && (obj.signature = base64FromBytes(message.signature !== undefined ? message.signature : new Uint8Array())); @@ -478,7 +479,7 @@ export const SignatureDescriptor_Data_Multi = { signatures: Array.isArray(object?.signatures) ? object.signatures.map((e: any) => SignatureDescriptor_Data.fromJSON(e)) : [] }; }, - toJSON(message: SignatureDescriptor_Data_Multi): unknown { + toJSON(message: SignatureDescriptor_Data_Multi): JsonSafe { const obj: any = {}; message.bitarray !== undefined && (obj.bitarray = message.bitarray ? CompactBitArray.toJSON(message.bitarray) : undefined); if (message.signatures) { diff --git a/__fixtures__/output1/cosmos/tx/v1beta1/service.ts b/__fixtures__/output1/cosmos/tx/v1beta1/service.ts index 42fc78ba32..b7a073b765 100644 --- a/__fixtures__/output1/cosmos/tx/v1beta1/service.ts +++ b/__fixtures__/output1/cosmos/tx/v1beta1/service.ts @@ -5,6 +5,7 @@ import { BlockID, BlockIDSDKType } from "../../../tendermint/types/types"; import { Block, BlockSDKType } from "../../../tendermint/types/block"; import { Long, isSet, DeepPartial, bytesFromBase64, base64FromBytes } from "../../../helpers"; import * as _m0 from "protobufjs/minimal"; +import { JsonSafe } from "../../../json-safe"; export const protobufPackage = "cosmos.tx.v1beta1"; /** OrderBy defines the sorting order */ export enum OrderBy { @@ -345,7 +346,7 @@ export const GetTxsEventRequest = { orderBy: isSet(object.orderBy) ? orderByFromJSON(object.orderBy) : -1 }; }, - toJSON(message: GetTxsEventRequest): unknown { + toJSON(message: GetTxsEventRequest): JsonSafe { const obj: any = {}; if (message.events) { obj.events = message.events.map(e => e); @@ -432,7 +433,7 @@ export const GetTxsEventResponse = { pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined }; }, - toJSON(message: GetTxsEventResponse): unknown { + toJSON(message: GetTxsEventResponse): JsonSafe { const obj: any = {}; if (message.txs) { obj.txs = message.txs.map(e => e ? Tx.toJSON(e) : undefined); @@ -519,7 +520,7 @@ export const BroadcastTxRequest = { mode: isSet(object.mode) ? broadcastModeFromJSON(object.mode) : -1 }; }, - toJSON(message: BroadcastTxRequest): unknown { + toJSON(message: BroadcastTxRequest): JsonSafe { const obj: any = {}; message.txBytes !== undefined && (obj.txBytes = base64FromBytes(message.txBytes !== undefined ? message.txBytes : new Uint8Array())); message.mode !== undefined && (obj.mode = broadcastModeToJSON(message.mode)); @@ -578,7 +579,7 @@ export const BroadcastTxResponse = { txResponse: isSet(object.txResponse) ? TxResponse.fromJSON(object.txResponse) : undefined }; }, - toJSON(message: BroadcastTxResponse): unknown { + toJSON(message: BroadcastTxResponse): JsonSafe { const obj: any = {}; message.txResponse !== undefined && (obj.txResponse = message.txResponse ? TxResponse.toJSON(message.txResponse) : undefined); return obj; @@ -641,7 +642,7 @@ export const SimulateRequest = { txBytes: isSet(object.txBytes) ? bytesFromBase64(object.txBytes) : new Uint8Array() }; }, - toJSON(message: SimulateRequest): unknown { + toJSON(message: SimulateRequest): JsonSafe { const obj: any = {}; message.tx !== undefined && (obj.tx = message.tx ? Tx.toJSON(message.tx) : undefined); message.txBytes !== undefined && (obj.txBytes = base64FromBytes(message.txBytes !== undefined ? message.txBytes : new Uint8Array())); @@ -708,7 +709,7 @@ export const SimulateResponse = { result: isSet(object.result) ? Result.fromJSON(object.result) : undefined }; }, - toJSON(message: SimulateResponse): unknown { + toJSON(message: SimulateResponse): JsonSafe { const obj: any = {}; message.gasInfo !== undefined && (obj.gasInfo = message.gasInfo ? GasInfo.toJSON(message.gasInfo) : undefined); message.result !== undefined && (obj.result = message.result ? Result.toJSON(message.result) : undefined); @@ -767,7 +768,7 @@ export const GetTxRequest = { hash: isSet(object.hash) ? String(object.hash) : "" }; }, - toJSON(message: GetTxRequest): unknown { + toJSON(message: GetTxRequest): JsonSafe { const obj: any = {}; message.hash !== undefined && (obj.hash = message.hash); return obj; @@ -830,7 +831,7 @@ export const GetTxResponse = { txResponse: isSet(object.txResponse) ? TxResponse.fromJSON(object.txResponse) : undefined }; }, - toJSON(message: GetTxResponse): unknown { + toJSON(message: GetTxResponse): JsonSafe { const obj: any = {}; message.tx !== undefined && (obj.tx = message.tx ? Tx.toJSON(message.tx) : undefined); message.txResponse !== undefined && (obj.txResponse = message.txResponse ? TxResponse.toJSON(message.txResponse) : undefined); @@ -897,7 +898,7 @@ export const GetBlockWithTxsRequest = { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; }, - toJSON(message: GetBlockWithTxsRequest): unknown { + toJSON(message: GetBlockWithTxsRequest): JsonSafe { const obj: any = {}; message.height !== undefined && (obj.height = (message.height || Long.ZERO).toString()); message.pagination !== undefined && (obj.pagination = message.pagination ? PageRequest.toJSON(message.pagination) : undefined); @@ -980,7 +981,7 @@ export const GetBlockWithTxsResponse = { pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined }; }, - toJSON(message: GetBlockWithTxsResponse): unknown { + toJSON(message: GetBlockWithTxsResponse): JsonSafe { const obj: any = {}; if (message.txs) { obj.txs = message.txs.map(e => e ? Tx.toJSON(e) : undefined); diff --git a/__fixtures__/output1/cosmos/tx/v1beta1/tx.ts b/__fixtures__/output1/cosmos/tx/v1beta1/tx.ts index 74b0513e2f..99f17c7c7c 100644 --- a/__fixtures__/output1/cosmos/tx/v1beta1/tx.ts +++ b/__fixtures__/output1/cosmos/tx/v1beta1/tx.ts @@ -4,6 +4,7 @@ import { CompactBitArray, CompactBitArraySDKType } from "../../crypto/multisig/v import { Coin, CoinSDKType } from "../../base/v1beta1/coin"; import { Long, isSet, bytesFromBase64, base64FromBytes, DeepPartial } from "../../../helpers"; import * as _m0 from "protobufjs/minimal"; +import { JsonSafe } from "../../../json-safe"; export const protobufPackage = "cosmos.tx.v1beta1"; /** Tx is the standard type used for broadcasting transactions. */ export interface Tx { @@ -438,7 +439,7 @@ export const Tx = { signatures: Array.isArray(object?.signatures) ? object.signatures.map((e: any) => bytesFromBase64(e)) : [] }; }, - toJSON(message: Tx): unknown { + toJSON(message: Tx): JsonSafe { const obj: any = {}; message.body !== undefined && (obj.body = message.body ? TxBody.toJSON(message.body) : undefined); message.authInfo !== undefined && (obj.authInfo = message.authInfo ? AuthInfo.toJSON(message.authInfo) : undefined); @@ -525,7 +526,7 @@ export const TxRaw = { signatures: Array.isArray(object?.signatures) ? object.signatures.map((e: any) => bytesFromBase64(e)) : [] }; }, - toJSON(message: TxRaw): unknown { + toJSON(message: TxRaw): JsonSafe { const obj: any = {}; message.bodyBytes !== undefined && (obj.bodyBytes = base64FromBytes(message.bodyBytes !== undefined ? message.bodyBytes : new Uint8Array())); message.authInfoBytes !== undefined && (obj.authInfoBytes = base64FromBytes(message.authInfoBytes !== undefined ? message.authInfoBytes : new Uint8Array())); @@ -620,7 +621,7 @@ export const SignDoc = { accountNumber: isSet(object.accountNumber) ? Long.fromValue(object.accountNumber) : Long.UZERO }; }, - toJSON(message: SignDoc): unknown { + toJSON(message: SignDoc): JsonSafe { const obj: any = {}; message.bodyBytes !== undefined && (obj.bodyBytes = base64FromBytes(message.bodyBytes !== undefined ? message.bodyBytes : new Uint8Array())); message.authInfoBytes !== undefined && (obj.authInfoBytes = base64FromBytes(message.authInfoBytes !== undefined ? message.authInfoBytes : new Uint8Array())); @@ -727,7 +728,7 @@ export const SignDocDirectAux = { tip: isSet(object.tip) ? Tip.fromJSON(object.tip) : undefined }; }, - toJSON(message: SignDocDirectAux): unknown { + toJSON(message: SignDocDirectAux): JsonSafe { const obj: any = {}; message.bodyBytes !== undefined && (obj.bodyBytes = base64FromBytes(message.bodyBytes !== undefined ? message.bodyBytes : new Uint8Array())); message.publicKey !== undefined && (obj.publicKey = message.publicKey ? Any.toJSON(message.publicKey) : undefined); @@ -834,7 +835,7 @@ export const TxBody = { nonCriticalExtensionOptions: Array.isArray(object?.nonCriticalExtensionOptions) ? object.nonCriticalExtensionOptions.map((e: any) => Any.fromJSON(e)) : [] }; }, - toJSON(message: TxBody): unknown { + toJSON(message: TxBody): JsonSafe { const obj: any = {}; if (message.messages) { obj.messages = message.messages.map(e => e ? Any.toJSON(e) : undefined); @@ -945,7 +946,7 @@ export const AuthInfo = { tip: isSet(object.tip) ? Tip.fromJSON(object.tip) : undefined }; }, - toJSON(message: AuthInfo): unknown { + toJSON(message: AuthInfo): JsonSafe { const obj: any = {}; if (message.signerInfos) { obj.signerInfos = message.signerInfos.map(e => e ? SignerInfo.toJSON(e) : undefined); @@ -1032,7 +1033,7 @@ export const SignerInfo = { sequence: isSet(object.sequence) ? Long.fromValue(object.sequence) : Long.UZERO }; }, - toJSON(message: SignerInfo): unknown { + toJSON(message: SignerInfo): JsonSafe { const obj: any = {}; message.publicKey !== undefined && (obj.publicKey = message.publicKey ? Any.toJSON(message.publicKey) : undefined); message.modeInfo !== undefined && (obj.modeInfo = message.modeInfo ? ModeInfo.toJSON(message.modeInfo) : undefined); @@ -1103,7 +1104,7 @@ export const ModeInfo = { multi: isSet(object.multi) ? ModeInfo_Multi.fromJSON(object.multi) : undefined }; }, - toJSON(message: ModeInfo): unknown { + toJSON(message: ModeInfo): JsonSafe { const obj: any = {}; message.single !== undefined && (obj.single = message.single ? ModeInfo_Single.toJSON(message.single) : undefined); message.multi !== undefined && (obj.multi = message.multi ? ModeInfo_Multi.toJSON(message.multi) : undefined); @@ -1162,7 +1163,7 @@ export const ModeInfo_Single = { mode: isSet(object.mode) ? signModeFromJSON(object.mode) : -1 }; }, - toJSON(message: ModeInfo_Single): unknown { + toJSON(message: ModeInfo_Single): JsonSafe { const obj: any = {}; message.mode !== undefined && (obj.mode = signModeToJSON(message.mode)); return obj; @@ -1225,7 +1226,7 @@ export const ModeInfo_Multi = { modeInfos: Array.isArray(object?.modeInfos) ? object.modeInfos.map((e: any) => ModeInfo.fromJSON(e)) : [] }; }, - toJSON(message: ModeInfo_Multi): unknown { + toJSON(message: ModeInfo_Multi): JsonSafe { const obj: any = {}; message.bitarray !== undefined && (obj.bitarray = message.bitarray ? CompactBitArray.toJSON(message.bitarray) : undefined); if (message.modeInfos) { @@ -1316,7 +1317,7 @@ export const Fee = { granter: isSet(object.granter) ? String(object.granter) : "" }; }, - toJSON(message: Fee): unknown { + toJSON(message: Fee): JsonSafe { const obj: any = {}; if (message.amount) { obj.amount = message.amount.map(e => e ? Coin.toJSON(e) : undefined); @@ -1399,7 +1400,7 @@ export const Tip = { tipper: isSet(object.tipper) ? String(object.tipper) : "" }; }, - toJSON(message: Tip): unknown { + toJSON(message: Tip): JsonSafe { const obj: any = {}; if (message.amount) { obj.amount = message.amount.map(e => e ? Coin.toJSON(e) : undefined); @@ -1490,7 +1491,7 @@ export const AuxSignerData = { sig: isSet(object.sig) ? bytesFromBase64(object.sig) : new Uint8Array() }; }, - toJSON(message: AuxSignerData): unknown { + toJSON(message: AuxSignerData): JsonSafe { const obj: any = {}; message.address !== undefined && (obj.address = message.address); message.signDoc !== undefined && (obj.signDoc = message.signDoc ? SignDocDirectAux.toJSON(message.signDoc) : undefined); diff --git a/__fixtures__/output1/cosmos/upgrade/v1beta1/query.ts b/__fixtures__/output1/cosmos/upgrade/v1beta1/query.ts index ffc59b102a..f17a0706fc 100644 --- a/__fixtures__/output1/cosmos/upgrade/v1beta1/query.ts +++ b/__fixtures__/output1/cosmos/upgrade/v1beta1/query.ts @@ -1,6 +1,7 @@ import { Plan, PlanSDKType, ModuleVersion, ModuleVersionSDKType } from "./upgrade"; import { Long, DeepPartial, isSet, bytesFromBase64, base64FromBytes } from "../../../helpers"; import * as _m0 from "protobufjs/minimal"; +import { JsonSafe } from "../../../json-safe"; export const protobufPackage = "cosmos.upgrade.v1beta1"; /** * QueryCurrentPlanRequest is the request type for the Query/CurrentPlan RPC @@ -188,7 +189,7 @@ export const QueryCurrentPlanRequest = { fromJSON(_: any): QueryCurrentPlanRequest { return {}; }, - toJSON(_: QueryCurrentPlanRequest): unknown { + toJSON(_: QueryCurrentPlanRequest): JsonSafe { const obj: any = {}; return obj; }, @@ -238,7 +239,7 @@ export const QueryCurrentPlanResponse = { plan: isSet(object.plan) ? Plan.fromJSON(object.plan) : undefined }; }, - toJSON(message: QueryCurrentPlanResponse): unknown { + toJSON(message: QueryCurrentPlanResponse): JsonSafe { const obj: any = {}; message.plan !== undefined && (obj.plan = message.plan ? Plan.toJSON(message.plan) : undefined); return obj; @@ -293,7 +294,7 @@ export const QueryAppliedPlanRequest = { name: isSet(object.name) ? String(object.name) : "" }; }, - toJSON(message: QueryAppliedPlanRequest): unknown { + toJSON(message: QueryAppliedPlanRequest): JsonSafe { const obj: any = {}; message.name !== undefined && (obj.name = message.name); return obj; @@ -348,7 +349,7 @@ export const QueryAppliedPlanResponse = { height: isSet(object.height) ? Long.fromValue(object.height) : Long.ZERO }; }, - toJSON(message: QueryAppliedPlanResponse): unknown { + toJSON(message: QueryAppliedPlanResponse): JsonSafe { const obj: any = {}; message.height !== undefined && (obj.height = (message.height || Long.ZERO).toString()); return obj; @@ -403,7 +404,7 @@ export const QueryUpgradedConsensusStateRequest = { lastHeight: isSet(object.lastHeight) ? Long.fromValue(object.lastHeight) : Long.ZERO }; }, - toJSON(message: QueryUpgradedConsensusStateRequest): unknown { + toJSON(message: QueryUpgradedConsensusStateRequest): JsonSafe { const obj: any = {}; message.lastHeight !== undefined && (obj.lastHeight = (message.lastHeight || Long.ZERO).toString()); return obj; @@ -458,7 +459,7 @@ export const QueryUpgradedConsensusStateResponse = { upgradedConsensusState: isSet(object.upgradedConsensusState) ? bytesFromBase64(object.upgradedConsensusState) : new Uint8Array() }; }, - toJSON(message: QueryUpgradedConsensusStateResponse): unknown { + toJSON(message: QueryUpgradedConsensusStateResponse): JsonSafe { const obj: any = {}; message.upgradedConsensusState !== undefined && (obj.upgradedConsensusState = base64FromBytes(message.upgradedConsensusState !== undefined ? message.upgradedConsensusState : new Uint8Array())); return obj; @@ -513,7 +514,7 @@ export const QueryModuleVersionsRequest = { moduleName: isSet(object.moduleName) ? String(object.moduleName) : "" }; }, - toJSON(message: QueryModuleVersionsRequest): unknown { + toJSON(message: QueryModuleVersionsRequest): JsonSafe { const obj: any = {}; message.moduleName !== undefined && (obj.moduleName = message.moduleName); return obj; @@ -568,7 +569,7 @@ export const QueryModuleVersionsResponse = { moduleVersions: Array.isArray(object?.moduleVersions) ? object.moduleVersions.map((e: any) => ModuleVersion.fromJSON(e)) : [] }; }, - toJSON(message: QueryModuleVersionsResponse): unknown { + toJSON(message: QueryModuleVersionsResponse): JsonSafe { const obj: any = {}; if (message.moduleVersions) { obj.moduleVersions = message.moduleVersions.map(e => e ? ModuleVersion.toJSON(e) : undefined); @@ -621,7 +622,7 @@ export const QueryAuthorityRequest = { fromJSON(_: any): QueryAuthorityRequest { return {}; }, - toJSON(_: QueryAuthorityRequest): unknown { + toJSON(_: QueryAuthorityRequest): JsonSafe { const obj: any = {}; return obj; }, @@ -671,7 +672,7 @@ export const QueryAuthorityResponse = { address: isSet(object.address) ? String(object.address) : "" }; }, - toJSON(message: QueryAuthorityResponse): unknown { + toJSON(message: QueryAuthorityResponse): JsonSafe { const obj: any = {}; message.address !== undefined && (obj.address = message.address); return obj; diff --git a/__fixtures__/output1/cosmos/upgrade/v1beta1/tx.ts b/__fixtures__/output1/cosmos/upgrade/v1beta1/tx.ts index 9ba2521096..e2f71cd5b6 100644 --- a/__fixtures__/output1/cosmos/upgrade/v1beta1/tx.ts +++ b/__fixtures__/output1/cosmos/upgrade/v1beta1/tx.ts @@ -1,6 +1,7 @@ import { Plan, PlanSDKType } from "./upgrade"; import * as _m0 from "protobufjs/minimal"; import { isSet, DeepPartial } from "../../../helpers"; +import { JsonSafe } from "../../../json-safe"; export const protobufPackage = "cosmos.upgrade.v1beta1"; /** * MsgSoftwareUpgrade is the Msg/SoftwareUpgrade request type. @@ -105,7 +106,7 @@ export const MsgSoftwareUpgrade = { plan: isSet(object.plan) ? Plan.fromJSON(object.plan) : undefined }; }, - toJSON(message: MsgSoftwareUpgrade): unknown { + toJSON(message: MsgSoftwareUpgrade): JsonSafe { const obj: any = {}; message.authority !== undefined && (obj.authority = message.authority); message.plan !== undefined && (obj.plan = message.plan ? Plan.toJSON(message.plan) : undefined); @@ -154,7 +155,7 @@ export const MsgSoftwareUpgradeResponse = { fromJSON(_: any): MsgSoftwareUpgradeResponse { return {}; }, - toJSON(_: MsgSoftwareUpgradeResponse): unknown { + toJSON(_: MsgSoftwareUpgradeResponse): JsonSafe { const obj: any = {}; return obj; }, @@ -204,7 +205,7 @@ export const MsgCancelUpgrade = { authority: isSet(object.authority) ? String(object.authority) : "" }; }, - toJSON(message: MsgCancelUpgrade): unknown { + toJSON(message: MsgCancelUpgrade): JsonSafe { const obj: any = {}; message.authority !== undefined && (obj.authority = message.authority); return obj; @@ -249,7 +250,7 @@ export const MsgCancelUpgradeResponse = { fromJSON(_: any): MsgCancelUpgradeResponse { return {}; }, - toJSON(_: MsgCancelUpgradeResponse): unknown { + toJSON(_: MsgCancelUpgradeResponse): JsonSafe { const obj: any = {}; return obj; }, diff --git a/__fixtures__/output1/cosmos/upgrade/v1beta1/upgrade.ts b/__fixtures__/output1/cosmos/upgrade/v1beta1/upgrade.ts index 345a5269bb..dc5564b61f 100644 --- a/__fixtures__/output1/cosmos/upgrade/v1beta1/upgrade.ts +++ b/__fixtures__/output1/cosmos/upgrade/v1beta1/upgrade.ts @@ -2,6 +2,7 @@ import { Timestamp, TimestampSDKType } from "../../../google/protobuf/timestamp" import { Any, AnySDKType } from "../../../google/protobuf/any"; import { Long, toTimestamp, fromTimestamp, isSet, fromJsonTimestamp, DeepPartial } from "../../../helpers"; import * as _m0 from "protobufjs/minimal"; +import { JsonSafe } from "../../../json-safe"; export const protobufPackage = "cosmos.upgrade.v1beta1"; /** Plan specifies information about a planned upgrade and when it should occur. */ export interface Plan { @@ -182,7 +183,7 @@ export const Plan = { upgradedClientState: isSet(object.upgradedClientState) ? Any.fromJSON(object.upgradedClientState) : undefined }; }, - toJSON(message: Plan): unknown { + toJSON(message: Plan): JsonSafe { const obj: any = {}; message.name !== undefined && (obj.name = message.name); message.time !== undefined && (obj.time = message.time.toISOString()); @@ -269,7 +270,7 @@ export const SoftwareUpgradeProposal = { plan: isSet(object.plan) ? Plan.fromJSON(object.plan) : undefined }; }, - toJSON(message: SoftwareUpgradeProposal): unknown { + toJSON(message: SoftwareUpgradeProposal): JsonSafe { const obj: any = {}; message.title !== undefined && (obj.title = message.title); message.description !== undefined && (obj.description = message.description); @@ -340,7 +341,7 @@ export const CancelSoftwareUpgradeProposal = { description: isSet(object.description) ? String(object.description) : "" }; }, - toJSON(message: CancelSoftwareUpgradeProposal): unknown { + toJSON(message: CancelSoftwareUpgradeProposal): JsonSafe { const obj: any = {}; message.title !== undefined && (obj.title = message.title); message.description !== undefined && (obj.description = message.description); @@ -407,7 +408,7 @@ export const ModuleVersion = { version: isSet(object.version) ? Long.fromValue(object.version) : Long.UZERO }; }, - toJSON(message: ModuleVersion): unknown { + toJSON(message: ModuleVersion): JsonSafe { const obj: any = {}; message.name !== undefined && (obj.name = message.name); message.version !== undefined && (obj.version = (message.version || Long.UZERO).toString()); diff --git a/__fixtures__/output1/cosmos/vesting/v1beta1/tx.ts b/__fixtures__/output1/cosmos/vesting/v1beta1/tx.ts index 8f39a05cdb..94b65ce6fb 100644 --- a/__fixtures__/output1/cosmos/vesting/v1beta1/tx.ts +++ b/__fixtures__/output1/cosmos/vesting/v1beta1/tx.ts @@ -2,6 +2,7 @@ import { Coin, CoinSDKType } from "../../base/v1beta1/coin"; import { Period, PeriodSDKType } from "./vesting"; import { Long, isSet, DeepPartial } from "../../../helpers"; import * as _m0 from "protobufjs/minimal"; +import { JsonSafe } from "../../../json-safe"; export const protobufPackage = "cosmos.vesting.v1beta1"; /** * MsgCreateVestingAccount defines a message that enables creating a vesting @@ -147,7 +148,7 @@ export const MsgCreateVestingAccount = { delayed: isSet(object.delayed) ? Boolean(object.delayed) : false }; }, - toJSON(message: MsgCreateVestingAccount): unknown { + toJSON(message: MsgCreateVestingAccount): JsonSafe { const obj: any = {}; message.fromAddress !== undefined && (obj.fromAddress = message.fromAddress); message.toAddress !== undefined && (obj.toAddress = message.toAddress); @@ -216,7 +217,7 @@ export const MsgCreateVestingAccountResponse = { fromJSON(_: any): MsgCreateVestingAccountResponse { return {}; }, - toJSON(_: MsgCreateVestingAccountResponse): unknown { + toJSON(_: MsgCreateVestingAccountResponse): JsonSafe { const obj: any = {}; return obj; }, @@ -282,7 +283,7 @@ export const MsgCreatePermanentLockedAccount = { amount: Array.isArray(object?.amount) ? object.amount.map((e: any) => Coin.fromJSON(e)) : [] }; }, - toJSON(message: MsgCreatePermanentLockedAccount): unknown { + toJSON(message: MsgCreatePermanentLockedAccount): JsonSafe { const obj: any = {}; message.fromAddress !== undefined && (obj.fromAddress = message.fromAddress); message.toAddress !== undefined && (obj.toAddress = message.toAddress); @@ -343,7 +344,7 @@ export const MsgCreatePermanentLockedAccountResponse = { fromJSON(_: any): MsgCreatePermanentLockedAccountResponse { return {}; }, - toJSON(_: MsgCreatePermanentLockedAccountResponse): unknown { + toJSON(_: MsgCreatePermanentLockedAccountResponse): JsonSafe { const obj: any = {}; return obj; }, @@ -417,7 +418,7 @@ export const MsgCreatePeriodicVestingAccount = { vestingPeriods: Array.isArray(object?.vestingPeriods) ? object.vestingPeriods.map((e: any) => Period.fromJSON(e)) : [] }; }, - toJSON(message: MsgCreatePeriodicVestingAccount): unknown { + toJSON(message: MsgCreatePeriodicVestingAccount): JsonSafe { const obj: any = {}; message.fromAddress !== undefined && (obj.fromAddress = message.fromAddress); message.toAddress !== undefined && (obj.toAddress = message.toAddress); @@ -482,7 +483,7 @@ export const MsgCreatePeriodicVestingAccountResponse = { fromJSON(_: any): MsgCreatePeriodicVestingAccountResponse { return {}; }, - toJSON(_: MsgCreatePeriodicVestingAccountResponse): unknown { + toJSON(_: MsgCreatePeriodicVestingAccountResponse): JsonSafe { const obj: any = {}; return obj; }, diff --git a/__fixtures__/output1/cosmos/vesting/v1beta1/vesting.ts b/__fixtures__/output1/cosmos/vesting/v1beta1/vesting.ts index f9839a1c9b..7d9735a012 100644 --- a/__fixtures__/output1/cosmos/vesting/v1beta1/vesting.ts +++ b/__fixtures__/output1/cosmos/vesting/v1beta1/vesting.ts @@ -2,6 +2,7 @@ import { BaseAccount, BaseAccountSDKType } from "../../auth/v1beta1/auth"; import { Coin, CoinSDKType } from "../../base/v1beta1/coin"; import { Long, isSet, DeepPartial } from "../../../helpers"; import * as _m0 from "protobufjs/minimal"; +import { JsonSafe } from "../../../json-safe"; export const protobufPackage = "cosmos.vesting.v1beta1"; /** * BaseVestingAccount implements the VestingAccount interface. It contains all @@ -171,7 +172,7 @@ export const BaseVestingAccount = { endTime: isSet(object.endTime) ? Long.fromValue(object.endTime) : Long.ZERO }; }, - toJSON(message: BaseVestingAccount): unknown { + toJSON(message: BaseVestingAccount): JsonSafe { const obj: any = {}; message.baseAccount !== undefined && (obj.baseAccount = message.baseAccount ? BaseAccount.toJSON(message.baseAccount) : undefined); if (message.originalVesting) { @@ -274,7 +275,7 @@ export const ContinuousVestingAccount = { startTime: isSet(object.startTime) ? Long.fromValue(object.startTime) : Long.ZERO }; }, - toJSON(message: ContinuousVestingAccount): unknown { + toJSON(message: ContinuousVestingAccount): JsonSafe { const obj: any = {}; message.baseVestingAccount !== undefined && (obj.baseVestingAccount = message.baseVestingAccount ? BaseVestingAccount.toJSON(message.baseVestingAccount) : undefined); message.startTime !== undefined && (obj.startTime = (message.startTime || Long.ZERO).toString()); @@ -333,7 +334,7 @@ export const DelayedVestingAccount = { baseVestingAccount: isSet(object.baseVestingAccount) ? BaseVestingAccount.fromJSON(object.baseVestingAccount) : undefined }; }, - toJSON(message: DelayedVestingAccount): unknown { + toJSON(message: DelayedVestingAccount): JsonSafe { const obj: any = {}; message.baseVestingAccount !== undefined && (obj.baseVestingAccount = message.baseVestingAccount ? BaseVestingAccount.toJSON(message.baseVestingAccount) : undefined); return obj; @@ -396,7 +397,7 @@ export const Period = { amount: Array.isArray(object?.amount) ? object.amount.map((e: any) => Coin.fromJSON(e)) : [] }; }, - toJSON(message: Period): unknown { + toJSON(message: Period): JsonSafe { const obj: any = {}; message.length !== undefined && (obj.length = (message.length || Long.ZERO).toString()); if (message.amount) { @@ -479,7 +480,7 @@ export const PeriodicVestingAccount = { vestingPeriods: Array.isArray(object?.vestingPeriods) ? object.vestingPeriods.map((e: any) => Period.fromJSON(e)) : [] }; }, - toJSON(message: PeriodicVestingAccount): unknown { + toJSON(message: PeriodicVestingAccount): JsonSafe { const obj: any = {}; message.baseVestingAccount !== undefined && (obj.baseVestingAccount = message.baseVestingAccount ? BaseVestingAccount.toJSON(message.baseVestingAccount) : undefined); message.startTime !== undefined && (obj.startTime = (message.startTime || Long.ZERO).toString()); @@ -550,7 +551,7 @@ export const PermanentLockedAccount = { baseVestingAccount: isSet(object.baseVestingAccount) ? BaseVestingAccount.fromJSON(object.baseVestingAccount) : undefined }; }, - toJSON(message: PermanentLockedAccount): unknown { + toJSON(message: PermanentLockedAccount): JsonSafe { const obj: any = {}; message.baseVestingAccount !== undefined && (obj.baseVestingAccount = message.baseVestingAccount ? BaseVestingAccount.toJSON(message.baseVestingAccount) : undefined); return obj; diff --git a/__fixtures__/output1/cosmos_proto/cosmos.ts b/__fixtures__/output1/cosmos_proto/cosmos.ts index 239dedfe45..5f40eef5a9 100644 --- a/__fixtures__/output1/cosmos_proto/cosmos.ts +++ b/__fixtures__/output1/cosmos_proto/cosmos.ts @@ -1,5 +1,6 @@ import * as _m0 from "protobufjs/minimal"; import { isSet, DeepPartial } from "../helpers"; +import { JsonSafe } from "../json-safe"; export const protobufPackage = "cosmos_proto"; export enum ScalarType { SCALAR_TYPE_UNSPECIFIED = 0, @@ -151,7 +152,7 @@ export const InterfaceDescriptor = { description: isSet(object.description) ? String(object.description) : "" }; }, - toJSON(message: InterfaceDescriptor): unknown { + toJSON(message: InterfaceDescriptor): JsonSafe { const obj: any = {}; message.name !== undefined && (obj.name = message.name); message.description !== undefined && (obj.description = message.description); @@ -235,7 +236,7 @@ export const ScalarDescriptor = { fieldType: Array.isArray(object?.fieldType) ? object.fieldType.map((e: any) => scalarTypeFromJSON(e)) : [] }; }, - toJSON(message: ScalarDescriptor): unknown { + toJSON(message: ScalarDescriptor): JsonSafe { const obj: any = {}; message.name !== undefined && (obj.name = message.name); message.description !== undefined && (obj.description = message.description); diff --git a/__fixtures__/output1/cosmwasm/wasm/v1/genesis.ts b/__fixtures__/output1/cosmwasm/wasm/v1/genesis.ts index 5016229337..57539563a8 100644 --- a/__fixtures__/output1/cosmwasm/wasm/v1/genesis.ts +++ b/__fixtures__/output1/cosmwasm/wasm/v1/genesis.ts @@ -2,6 +2,7 @@ import { MsgStoreCode, MsgStoreCodeSDKType, MsgInstantiateContract, MsgInstantia import { Params, ParamsSDKType, CodeInfo, CodeInfoSDKType, ContractInfo, ContractInfoSDKType, Model, ModelSDKType } from "./types"; import { Long, isSet, DeepPartial, bytesFromBase64, base64FromBytes } from "../../../helpers"; import * as _m0 from "protobufjs/minimal"; +import { JsonSafe } from "../../../json-safe"; export const protobufPackage = "cosmwasm.wasm.v1"; /** GenesisState - genesis state of x/wasm */ export interface GenesisState { @@ -140,7 +141,7 @@ export const GenesisState = { genMsgs: Array.isArray(object?.genMsgs) ? object.genMsgs.map((e: any) => GenesisState_GenMsgs.fromJSON(e)) : [] }; }, - toJSON(message: GenesisState): unknown { + toJSON(message: GenesisState): JsonSafe { const obj: any = {}; message.params !== undefined && (obj.params = message.params ? Params.toJSON(message.params) : undefined); if (message.codes) { @@ -259,7 +260,7 @@ export const GenesisState_GenMsgs = { executeContract: isSet(object.executeContract) ? MsgExecuteContract.fromJSON(object.executeContract) : undefined }; }, - toJSON(message: GenesisState_GenMsgs): unknown { + toJSON(message: GenesisState_GenMsgs): JsonSafe { const obj: any = {}; message.storeCode !== undefined && (obj.storeCode = message.storeCode ? MsgStoreCode.toJSON(message.storeCode) : undefined); message.instantiateContract !== undefined && (obj.instantiateContract = message.instantiateContract ? MsgInstantiateContract.toJSON(message.instantiateContract) : undefined); @@ -346,7 +347,7 @@ export const Code = { pinned: isSet(object.pinned) ? Boolean(object.pinned) : false }; }, - toJSON(message: Code): unknown { + toJSON(message: Code): JsonSafe { const obj: any = {}; message.codeId !== undefined && (obj.codeId = (message.codeId || Long.UZERO).toString()); message.codeInfo !== undefined && (obj.codeInfo = message.codeInfo ? CodeInfo.toJSON(message.codeInfo) : undefined); @@ -429,7 +430,7 @@ export const Contract = { contractState: Array.isArray(object?.contractState) ? object.contractState.map((e: any) => Model.fromJSON(e)) : [] }; }, - toJSON(message: Contract): unknown { + toJSON(message: Contract): JsonSafe { const obj: any = {}; message.contractAddress !== undefined && (obj.contractAddress = message.contractAddress); message.contractInfo !== undefined && (obj.contractInfo = message.contractInfo ? ContractInfo.toJSON(message.contractInfo) : undefined); @@ -508,7 +509,7 @@ export const Sequence = { value: isSet(object.value) ? Long.fromValue(object.value) : Long.UZERO }; }, - toJSON(message: Sequence): unknown { + toJSON(message: Sequence): JsonSafe { const obj: any = {}; message.idKey !== undefined && (obj.idKey = base64FromBytes(message.idKey !== undefined ? message.idKey : new Uint8Array())); message.value !== undefined && (obj.value = (message.value || Long.UZERO).toString()); diff --git a/__fixtures__/output1/cosmwasm/wasm/v1/ibc.ts b/__fixtures__/output1/cosmwasm/wasm/v1/ibc.ts index bce16de7b7..27d2d3a260 100644 --- a/__fixtures__/output1/cosmwasm/wasm/v1/ibc.ts +++ b/__fixtures__/output1/cosmwasm/wasm/v1/ibc.ts @@ -1,5 +1,6 @@ import { Long, isSet, bytesFromBase64, base64FromBytes, DeepPartial } from "../../../helpers"; import * as _m0 from "protobufjs/minimal"; +import { JsonSafe } from "../../../json-safe"; export const protobufPackage = "cosmwasm.wasm.v1"; /** MsgIBCSend */ export interface MsgIBCSend { @@ -94,7 +95,7 @@ export const MsgIBCSend = { data: isSet(object.data) ? bytesFromBase64(object.data) : new Uint8Array() }; }, - toJSON(message: MsgIBCSend): unknown { + toJSON(message: MsgIBCSend): JsonSafe { const obj: any = {}; message.channel !== undefined && (obj.channel = message.channel); message.timeoutHeight !== undefined && (obj.timeoutHeight = (message.timeoutHeight || Long.UZERO).toString()); @@ -161,7 +162,7 @@ export const MsgIBCCloseChannel = { channel: isSet(object.channel) ? String(object.channel) : "" }; }, - toJSON(message: MsgIBCCloseChannel): unknown { + toJSON(message: MsgIBCCloseChannel): JsonSafe { const obj: any = {}; message.channel !== undefined && (obj.channel = message.channel); return obj; diff --git a/__fixtures__/output1/cosmwasm/wasm/v1/proposal.ts b/__fixtures__/output1/cosmwasm/wasm/v1/proposal.ts index 182ca5302b..90492e394a 100644 --- a/__fixtures__/output1/cosmwasm/wasm/v1/proposal.ts +++ b/__fixtures__/output1/cosmwasm/wasm/v1/proposal.ts @@ -2,6 +2,7 @@ import { AccessConfig, AccessConfigSDKType } from "./types"; import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { Long, isSet, bytesFromBase64, base64FromBytes, DeepPartial } from "../../../helpers"; import * as _m0 from "protobufjs/minimal"; +import { JsonSafe } from "../../../json-safe"; export const protobufPackage = "cosmwasm.wasm.v1"; /** StoreCodeProposal gov proposal content type to submit WASM code to the system */ export interface StoreCodeProposal { @@ -276,7 +277,7 @@ export const StoreCodeProposal = { instantiatePermission: isSet(object.instantiatePermission) ? AccessConfig.fromJSON(object.instantiatePermission) : undefined }; }, - toJSON(message: StoreCodeProposal): unknown { + toJSON(message: StoreCodeProposal): JsonSafe { const obj: any = {}; message.title !== undefined && (obj.title = message.title); message.description !== undefined && (obj.description = message.description); @@ -403,7 +404,7 @@ export const InstantiateContractProposal = { funds: Array.isArray(object?.funds) ? object.funds.map((e: any) => Coin.fromJSON(e)) : [] }; }, - toJSON(message: InstantiateContractProposal): unknown { + toJSON(message: InstantiateContractProposal): JsonSafe { const obj: any = {}; message.title !== undefined && (obj.title = message.title); message.description !== undefined && (obj.description = message.description); @@ -526,7 +527,7 @@ export const MigrateContractProposal = { msg: isSet(object.msg) ? bytesFromBase64(object.msg) : new Uint8Array() }; }, - toJSON(message: MigrateContractProposal): unknown { + toJSON(message: MigrateContractProposal): JsonSafe { const obj: any = {}; message.title !== undefined && (obj.title = message.title); message.description !== undefined && (obj.description = message.description); @@ -621,7 +622,7 @@ export const SudoContractProposal = { msg: isSet(object.msg) ? bytesFromBase64(object.msg) : new Uint8Array() }; }, - toJSON(message: SudoContractProposal): unknown { + toJSON(message: SudoContractProposal): JsonSafe { const obj: any = {}; message.title !== undefined && (obj.title = message.title); message.description !== undefined && (obj.description = message.description); @@ -728,7 +729,7 @@ export const ExecuteContractProposal = { funds: Array.isArray(object?.funds) ? object.funds.map((e: any) => Coin.fromJSON(e)) : [] }; }, - toJSON(message: ExecuteContractProposal): unknown { + toJSON(message: ExecuteContractProposal): JsonSafe { const obj: any = {}; message.title !== undefined && (obj.title = message.title); message.description !== undefined && (obj.description = message.description); @@ -835,7 +836,7 @@ export const UpdateAdminProposal = { contract: isSet(object.contract) ? String(object.contract) : "" }; }, - toJSON(message: UpdateAdminProposal): unknown { + toJSON(message: UpdateAdminProposal): JsonSafe { const obj: any = {}; message.title !== undefined && (obj.title = message.title); message.description !== undefined && (obj.description = message.description); @@ -918,7 +919,7 @@ export const ClearAdminProposal = { contract: isSet(object.contract) ? String(object.contract) : "" }; }, - toJSON(message: ClearAdminProposal): unknown { + toJSON(message: ClearAdminProposal): JsonSafe { const obj: any = {}; message.title !== undefined && (obj.title = message.title); message.description !== undefined && (obj.description = message.description); @@ -1006,7 +1007,7 @@ export const PinCodesProposal = { codeIds: Array.isArray(object?.codeIds) ? object.codeIds.map((e: any) => Long.fromValue(e)) : [] }; }, - toJSON(message: PinCodesProposal): unknown { + toJSON(message: PinCodesProposal): JsonSafe { const obj: any = {}; message.title !== undefined && (obj.title = message.title); message.description !== undefined && (obj.description = message.description); @@ -1102,7 +1103,7 @@ export const UnpinCodesProposal = { codeIds: Array.isArray(object?.codeIds) ? object.codeIds.map((e: any) => Long.fromValue(e)) : [] }; }, - toJSON(message: UnpinCodesProposal): unknown { + toJSON(message: UnpinCodesProposal): JsonSafe { const obj: any = {}; message.title !== undefined && (obj.title = message.title); message.description !== undefined && (obj.description = message.description); diff --git a/__fixtures__/output1/cosmwasm/wasm/v1/query.ts b/__fixtures__/output1/cosmwasm/wasm/v1/query.ts index d3995079ec..9ccb6efcb9 100644 --- a/__fixtures__/output1/cosmwasm/wasm/v1/query.ts +++ b/__fixtures__/output1/cosmwasm/wasm/v1/query.ts @@ -2,6 +2,7 @@ import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } fr import { ContractInfo, ContractInfoSDKType, ContractCodeHistoryEntry, ContractCodeHistoryEntrySDKType, Model, ModelSDKType } from "./types"; import { Long, isSet, DeepPartial, bytesFromBase64, base64FromBytes } from "../../../helpers"; import * as _m0 from "protobufjs/minimal"; +import { JsonSafe } from "../../../json-safe"; export const protobufPackage = "cosmwasm.wasm.v1"; /** * QueryContractInfoRequest is the request type for the Query/ContractInfo RPC @@ -325,7 +326,7 @@ export const QueryContractInfoRequest = { address: isSet(object.address) ? String(object.address) : "" }; }, - toJSON(message: QueryContractInfoRequest): unknown { + toJSON(message: QueryContractInfoRequest): JsonSafe { const obj: any = {}; message.address !== undefined && (obj.address = message.address); return obj; @@ -388,7 +389,7 @@ export const QueryContractInfoResponse = { contractInfo: isSet(object.contractInfo) ? ContractInfo.fromJSON(object.contractInfo) : undefined }; }, - toJSON(message: QueryContractInfoResponse): unknown { + toJSON(message: QueryContractInfoResponse): JsonSafe { const obj: any = {}; message.address !== undefined && (obj.address = message.address); message.contractInfo !== undefined && (obj.contractInfo = message.contractInfo ? ContractInfo.toJSON(message.contractInfo) : undefined); @@ -455,7 +456,7 @@ export const QueryContractHistoryRequest = { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; }, - toJSON(message: QueryContractHistoryRequest): unknown { + toJSON(message: QueryContractHistoryRequest): JsonSafe { const obj: any = {}; message.address !== undefined && (obj.address = message.address); message.pagination !== undefined && (obj.pagination = message.pagination ? PageRequest.toJSON(message.pagination) : undefined); @@ -522,7 +523,7 @@ export const QueryContractHistoryResponse = { pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined }; }, - toJSON(message: QueryContractHistoryResponse): unknown { + toJSON(message: QueryContractHistoryResponse): JsonSafe { const obj: any = {}; if (message.entries) { obj.entries = message.entries.map(e => e ? ContractCodeHistoryEntry.toJSON(e) : undefined); @@ -597,7 +598,7 @@ export const QueryContractsByCodeRequest = { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; }, - toJSON(message: QueryContractsByCodeRequest): unknown { + toJSON(message: QueryContractsByCodeRequest): JsonSafe { const obj: any = {}; message.codeId !== undefined && (obj.codeId = (message.codeId || Long.UZERO).toString()); message.pagination !== undefined && (obj.pagination = message.pagination ? PageRequest.toJSON(message.pagination) : undefined); @@ -664,7 +665,7 @@ export const QueryContractsByCodeResponse = { pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined }; }, - toJSON(message: QueryContractsByCodeResponse): unknown { + toJSON(message: QueryContractsByCodeResponse): JsonSafe { const obj: any = {}; if (message.contracts) { obj.contracts = message.contracts.map(e => e); @@ -739,7 +740,7 @@ export const QueryAllContractStateRequest = { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; }, - toJSON(message: QueryAllContractStateRequest): unknown { + toJSON(message: QueryAllContractStateRequest): JsonSafe { const obj: any = {}; message.address !== undefined && (obj.address = message.address); message.pagination !== undefined && (obj.pagination = message.pagination ? PageRequest.toJSON(message.pagination) : undefined); @@ -806,7 +807,7 @@ export const QueryAllContractStateResponse = { pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined }; }, - toJSON(message: QueryAllContractStateResponse): unknown { + toJSON(message: QueryAllContractStateResponse): JsonSafe { const obj: any = {}; if (message.models) { obj.models = message.models.map(e => e ? Model.toJSON(e) : undefined); @@ -881,7 +882,7 @@ export const QueryRawContractStateRequest = { queryData: isSet(object.queryData) ? bytesFromBase64(object.queryData) : new Uint8Array() }; }, - toJSON(message: QueryRawContractStateRequest): unknown { + toJSON(message: QueryRawContractStateRequest): JsonSafe { const obj: any = {}; message.address !== undefined && (obj.address = message.address); message.queryData !== undefined && (obj.queryData = base64FromBytes(message.queryData !== undefined ? message.queryData : new Uint8Array())); @@ -940,7 +941,7 @@ export const QueryRawContractStateResponse = { data: isSet(object.data) ? bytesFromBase64(object.data) : new Uint8Array() }; }, - toJSON(message: QueryRawContractStateResponse): unknown { + toJSON(message: QueryRawContractStateResponse): JsonSafe { const obj: any = {}; message.data !== undefined && (obj.data = base64FromBytes(message.data !== undefined ? message.data : new Uint8Array())); return obj; @@ -1003,7 +1004,7 @@ export const QuerySmartContractStateRequest = { queryData: isSet(object.queryData) ? bytesFromBase64(object.queryData) : new Uint8Array() }; }, - toJSON(message: QuerySmartContractStateRequest): unknown { + toJSON(message: QuerySmartContractStateRequest): JsonSafe { const obj: any = {}; message.address !== undefined && (obj.address = message.address); message.queryData !== undefined && (obj.queryData = base64FromBytes(message.queryData !== undefined ? message.queryData : new Uint8Array())); @@ -1062,7 +1063,7 @@ export const QuerySmartContractStateResponse = { data: isSet(object.data) ? bytesFromBase64(object.data) : new Uint8Array() }; }, - toJSON(message: QuerySmartContractStateResponse): unknown { + toJSON(message: QuerySmartContractStateResponse): JsonSafe { const obj: any = {}; message.data !== undefined && (obj.data = base64FromBytes(message.data !== undefined ? message.data : new Uint8Array())); return obj; @@ -1117,7 +1118,7 @@ export const QueryCodeRequest = { codeId: isSet(object.codeId) ? Long.fromValue(object.codeId) : Long.UZERO }; }, - toJSON(message: QueryCodeRequest): unknown { + toJSON(message: QueryCodeRequest): JsonSafe { const obj: any = {}; message.codeId !== undefined && (obj.codeId = (message.codeId || Long.UZERO).toString()); return obj; @@ -1188,7 +1189,7 @@ export const CodeInfoResponse = { dataHash: isSet(object.dataHash) ? bytesFromBase64(object.dataHash) : new Uint8Array() }; }, - toJSON(message: CodeInfoResponse): unknown { + toJSON(message: CodeInfoResponse): JsonSafe { const obj: any = {}; message.codeId !== undefined && (obj.codeId = (message.codeId || Long.UZERO).toString()); message.creator !== undefined && (obj.creator = message.creator); @@ -1259,7 +1260,7 @@ export const QueryCodeResponse = { data: isSet(object.data) ? bytesFromBase64(object.data) : new Uint8Array() }; }, - toJSON(message: QueryCodeResponse): unknown { + toJSON(message: QueryCodeResponse): JsonSafe { const obj: any = {}; message.codeInfo !== undefined && (obj.codeInfo = message.codeInfo ? CodeInfoResponse.toJSON(message.codeInfo) : undefined); message.data !== undefined && (obj.data = base64FromBytes(message.data !== undefined ? message.data : new Uint8Array())); @@ -1318,7 +1319,7 @@ export const QueryCodesRequest = { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; }, - toJSON(message: QueryCodesRequest): unknown { + toJSON(message: QueryCodesRequest): JsonSafe { const obj: any = {}; message.pagination !== undefined && (obj.pagination = message.pagination ? PageRequest.toJSON(message.pagination) : undefined); return obj; @@ -1381,7 +1382,7 @@ export const QueryCodesResponse = { pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined }; }, - toJSON(message: QueryCodesResponse): unknown { + toJSON(message: QueryCodesResponse): JsonSafe { const obj: any = {}; if (message.codeInfos) { obj.codeInfos = message.codeInfos.map(e => e ? CodeInfoResponse.toJSON(e) : undefined); @@ -1448,7 +1449,7 @@ export const QueryPinnedCodesRequest = { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; }, - toJSON(message: QueryPinnedCodesRequest): unknown { + toJSON(message: QueryPinnedCodesRequest): JsonSafe { const obj: any = {}; message.pagination !== undefined && (obj.pagination = message.pagination ? PageRequest.toJSON(message.pagination) : undefined); return obj; @@ -1520,7 +1521,7 @@ export const QueryPinnedCodesResponse = { pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined }; }, - toJSON(message: QueryPinnedCodesResponse): unknown { + toJSON(message: QueryPinnedCodesResponse): JsonSafe { const obj: any = {}; if (message.codeIds) { obj.codeIds = message.codeIds.map(e => (e || Long.UZERO).toString()); diff --git a/__fixtures__/output1/cosmwasm/wasm/v1/tx.ts b/__fixtures__/output1/cosmwasm/wasm/v1/tx.ts index c6bf8f6e27..ed3a363fac 100644 --- a/__fixtures__/output1/cosmwasm/wasm/v1/tx.ts +++ b/__fixtures__/output1/cosmwasm/wasm/v1/tx.ts @@ -2,6 +2,7 @@ import { AccessConfig, AccessConfigSDKType } from "./types"; import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { Long, isSet, bytesFromBase64, base64FromBytes, DeepPartial } from "../../../helpers"; import * as _m0 from "protobufjs/minimal"; +import { JsonSafe } from "../../../json-safe"; export const protobufPackage = "cosmwasm.wasm.v1"; /** MsgStoreCode submit Wasm code to the system */ export interface MsgStoreCode { @@ -214,7 +215,7 @@ export const MsgStoreCode = { instantiatePermission: isSet(object.instantiatePermission) ? AccessConfig.fromJSON(object.instantiatePermission) : undefined }; }, - toJSON(message: MsgStoreCode): unknown { + toJSON(message: MsgStoreCode): JsonSafe { const obj: any = {}; message.sender !== undefined && (obj.sender = message.sender); message.wasmByteCode !== undefined && (obj.wasmByteCode = base64FromBytes(message.wasmByteCode !== undefined ? message.wasmByteCode : new Uint8Array())); @@ -277,7 +278,7 @@ export const MsgStoreCodeResponse = { codeId: isSet(object.codeId) ? Long.fromValue(object.codeId) : Long.UZERO }; }, - toJSON(message: MsgStoreCodeResponse): unknown { + toJSON(message: MsgStoreCodeResponse): JsonSafe { const obj: any = {}; message.codeId !== undefined && (obj.codeId = (message.codeId || Long.UZERO).toString()); return obj; @@ -372,7 +373,7 @@ export const MsgInstantiateContract = { funds: Array.isArray(object?.funds) ? object.funds.map((e: any) => Coin.fromJSON(e)) : [] }; }, - toJSON(message: MsgInstantiateContract): unknown { + toJSON(message: MsgInstantiateContract): JsonSafe { const obj: any = {}; message.sender !== undefined && (obj.sender = message.sender); message.admin !== undefined && (obj.admin = message.admin); @@ -463,7 +464,7 @@ export const MsgInstantiateContractResponse = { data: isSet(object.data) ? bytesFromBase64(object.data) : new Uint8Array() }; }, - toJSON(message: MsgInstantiateContractResponse): unknown { + toJSON(message: MsgInstantiateContractResponse): JsonSafe { const obj: any = {}; message.address !== undefined && (obj.address = message.address); message.data !== undefined && (obj.data = base64FromBytes(message.data !== undefined ? message.data : new Uint8Array())); @@ -546,7 +547,7 @@ export const MsgExecuteContract = { funds: Array.isArray(object?.funds) ? object.funds.map((e: any) => Coin.fromJSON(e)) : [] }; }, - toJSON(message: MsgExecuteContract): unknown { + toJSON(message: MsgExecuteContract): JsonSafe { const obj: any = {}; message.sender !== undefined && (obj.sender = message.sender); message.contract !== undefined && (obj.contract = message.contract); @@ -621,7 +622,7 @@ export const MsgExecuteContractResponse = { data: isSet(object.data) ? bytesFromBase64(object.data) : new Uint8Array() }; }, - toJSON(message: MsgExecuteContractResponse): unknown { + toJSON(message: MsgExecuteContractResponse): JsonSafe { const obj: any = {}; message.data !== undefined && (obj.data = base64FromBytes(message.data !== undefined ? message.data : new Uint8Array())); return obj; @@ -700,7 +701,7 @@ export const MsgMigrateContract = { msg: isSet(object.msg) ? bytesFromBase64(object.msg) : new Uint8Array() }; }, - toJSON(message: MsgMigrateContract): unknown { + toJSON(message: MsgMigrateContract): JsonSafe { const obj: any = {}; message.sender !== undefined && (obj.sender = message.sender); message.contract !== undefined && (obj.contract = message.contract); @@ -767,7 +768,7 @@ export const MsgMigrateContractResponse = { data: isSet(object.data) ? bytesFromBase64(object.data) : new Uint8Array() }; }, - toJSON(message: MsgMigrateContractResponse): unknown { + toJSON(message: MsgMigrateContractResponse): JsonSafe { const obj: any = {}; message.data !== undefined && (obj.data = base64FromBytes(message.data !== undefined ? message.data : new Uint8Array())); return obj; @@ -838,7 +839,7 @@ export const MsgUpdateAdmin = { contract: isSet(object.contract) ? String(object.contract) : "" }; }, - toJSON(message: MsgUpdateAdmin): unknown { + toJSON(message: MsgUpdateAdmin): JsonSafe { const obj: any = {}; message.sender !== undefined && (obj.sender = message.sender); message.newAdmin !== undefined && (obj.newAdmin = message.newAdmin); @@ -891,7 +892,7 @@ export const MsgUpdateAdminResponse = { fromJSON(_: any): MsgUpdateAdminResponse { return {}; }, - toJSON(_: MsgUpdateAdminResponse): unknown { + toJSON(_: MsgUpdateAdminResponse): JsonSafe { const obj: any = {}; return obj; }, @@ -949,7 +950,7 @@ export const MsgClearAdmin = { contract: isSet(object.contract) ? String(object.contract) : "" }; }, - toJSON(message: MsgClearAdmin): unknown { + toJSON(message: MsgClearAdmin): JsonSafe { const obj: any = {}; message.sender !== undefined && (obj.sender = message.sender); message.contract !== undefined && (obj.contract = message.contract); @@ -998,7 +999,7 @@ export const MsgClearAdminResponse = { fromJSON(_: any): MsgClearAdminResponse { return {}; }, - toJSON(_: MsgClearAdminResponse): unknown { + toJSON(_: MsgClearAdminResponse): JsonSafe { const obj: any = {}; return obj; }, diff --git a/__fixtures__/output1/cosmwasm/wasm/v1/types.ts b/__fixtures__/output1/cosmwasm/wasm/v1/types.ts index 3b29dcec90..ba3a2ebb76 100644 --- a/__fixtures__/output1/cosmwasm/wasm/v1/types.ts +++ b/__fixtures__/output1/cosmwasm/wasm/v1/types.ts @@ -1,6 +1,7 @@ import { Any, AnySDKType } from "../../../google/protobuf/any"; import { Long, isSet, DeepPartial, bytesFromBase64, base64FromBytes } from "../../../helpers"; import * as _m0 from "protobufjs/minimal"; +import { JsonSafe } from "../../../json-safe"; export const protobufPackage = "cosmwasm.wasm.v1"; /** AccessType permission types */ export enum AccessType { @@ -259,7 +260,7 @@ export const AccessTypeParam = { value: isSet(object.value) ? accessTypeFromJSON(object.value) : -1 }; }, - toJSON(message: AccessTypeParam): unknown { + toJSON(message: AccessTypeParam): JsonSafe { const obj: any = {}; message.value !== undefined && (obj.value = accessTypeToJSON(message.value)); return obj; @@ -322,7 +323,7 @@ export const AccessConfig = { address: isSet(object.address) ? String(object.address) : "" }; }, - toJSON(message: AccessConfig): unknown { + toJSON(message: AccessConfig): JsonSafe { const obj: any = {}; message.permission !== undefined && (obj.permission = accessTypeToJSON(message.permission)); message.address !== undefined && (obj.address = message.address); @@ -397,7 +398,7 @@ export const Params = { maxWasmCodeSize: isSet(object.maxWasmCodeSize) ? Long.fromValue(object.maxWasmCodeSize) : Long.UZERO }; }, - toJSON(message: Params): unknown { + toJSON(message: Params): JsonSafe { const obj: any = {}; message.codeUploadAccess !== undefined && (obj.codeUploadAccess = message.codeUploadAccess ? AccessConfig.toJSON(message.codeUploadAccess) : undefined); message.instantiateDefaultPermission !== undefined && (obj.instantiateDefaultPermission = accessTypeToJSON(message.instantiateDefaultPermission)); @@ -476,7 +477,7 @@ export const CodeInfo = { instantiateConfig: isSet(object.instantiateConfig) ? AccessConfig.fromJSON(object.instantiateConfig) : undefined }; }, - toJSON(message: CodeInfo): unknown { + toJSON(message: CodeInfo): JsonSafe { const obj: any = {}; message.codeHash !== undefined && (obj.codeHash = base64FromBytes(message.codeHash !== undefined ? message.codeHash : new Uint8Array())); message.creator !== undefined && (obj.creator = message.creator); @@ -587,7 +588,7 @@ export const ContractInfo = { extension: isSet(object.extension) ? Any.fromJSON(object.extension) : undefined }; }, - toJSON(message: ContractInfo): unknown { + toJSON(message: ContractInfo): JsonSafe { const obj: any = {}; message.codeId !== undefined && (obj.codeId = (message.codeId || Long.UZERO).toString()); message.creator !== undefined && (obj.creator = message.creator); @@ -690,7 +691,7 @@ export const ContractCodeHistoryEntry = { msg: isSet(object.msg) ? bytesFromBase64(object.msg) : new Uint8Array() }; }, - toJSON(message: ContractCodeHistoryEntry): unknown { + toJSON(message: ContractCodeHistoryEntry): JsonSafe { const obj: any = {}; message.operation !== undefined && (obj.operation = contractCodeHistoryOperationTypeToJSON(message.operation)); message.codeId !== undefined && (obj.codeId = (message.codeId || Long.UZERO).toString()); @@ -765,7 +766,7 @@ export const AbsoluteTxPosition = { txIndex: isSet(object.txIndex) ? Long.fromValue(object.txIndex) : Long.UZERO }; }, - toJSON(message: AbsoluteTxPosition): unknown { + toJSON(message: AbsoluteTxPosition): JsonSafe { const obj: any = {}; message.blockHeight !== undefined && (obj.blockHeight = (message.blockHeight || Long.UZERO).toString()); message.txIndex !== undefined && (obj.txIndex = (message.txIndex || Long.UZERO).toString()); @@ -832,7 +833,7 @@ export const Model = { value: isSet(object.value) ? bytesFromBase64(object.value) : new Uint8Array() }; }, - toJSON(message: Model): unknown { + toJSON(message: Model): JsonSafe { const obj: any = {}; message.key !== undefined && (obj.key = base64FromBytes(message.key !== undefined ? message.key : new Uint8Array())); message.value !== undefined && (obj.value = base64FromBytes(message.value !== undefined ? message.value : new Uint8Array())); diff --git a/__fixtures__/output1/evmos/claims/v1/claims.ts b/__fixtures__/output1/evmos/claims/v1/claims.ts index 5b44f76973..b4988c45e6 100644 --- a/__fixtures__/output1/evmos/claims/v1/claims.ts +++ b/__fixtures__/output1/evmos/claims/v1/claims.ts @@ -1,5 +1,6 @@ import * as _m0 from "protobufjs/minimal"; import { isSet, DeepPartial } from "../../../helpers"; +import { JsonSafe } from "../../../json-safe"; export const protobufPackage = "evmos.claims.v1"; /** Action defines the list of available actions to claim the airdrop tokens. */ export enum Action { @@ -160,7 +161,7 @@ export const Claim = { claimableAmount: isSet(object.claimableAmount) ? String(object.claimableAmount) : "" }; }, - toJSON(message: Claim): unknown { + toJSON(message: Claim): JsonSafe { const obj: any = {}; message.action !== undefined && (obj.action = actionToJSON(message.action)); message.completed !== undefined && (obj.completed = message.completed); @@ -248,7 +249,7 @@ export const ClaimsRecordAddress = { actionsCompleted: Array.isArray(object?.actionsCompleted) ? object.actionsCompleted.map((e: any) => Boolean(e)) : [] }; }, - toJSON(message: ClaimsRecordAddress): unknown { + toJSON(message: ClaimsRecordAddress): JsonSafe { const obj: any = {}; message.address !== undefined && (obj.address = message.address); message.initialClaimableAmount !== undefined && (obj.initialClaimableAmount = message.initialClaimableAmount); @@ -336,7 +337,7 @@ export const ClaimsRecord = { actionsCompleted: Array.isArray(object?.actionsCompleted) ? object.actionsCompleted.map((e: any) => Boolean(e)) : [] }; }, - toJSON(message: ClaimsRecord): unknown { + toJSON(message: ClaimsRecord): JsonSafe { const obj: any = {}; message.initialClaimableAmount !== undefined && (obj.initialClaimableAmount = message.initialClaimableAmount); if (message.actionsCompleted) { diff --git a/__fixtures__/output1/evmos/claims/v1/genesis.ts b/__fixtures__/output1/evmos/claims/v1/genesis.ts index 563c37b370..fe95447d24 100644 --- a/__fixtures__/output1/evmos/claims/v1/genesis.ts +++ b/__fixtures__/output1/evmos/claims/v1/genesis.ts @@ -3,6 +3,7 @@ import { Timestamp, TimestampSDKType } from "../../../google/protobuf/timestamp" import { Duration, DurationSDKType } from "../../../google/protobuf/duration"; import * as _m0 from "protobufjs/minimal"; import { isSet, DeepPartial, toTimestamp, fromTimestamp, fromJsonTimestamp } from "../../../helpers"; +import { JsonSafe } from "../../../json-safe"; export const protobufPackage = "evmos.claims.v1"; /** GenesisState define the claims module's genesis state. */ export interface GenesisState { @@ -88,7 +89,7 @@ export const GenesisState = { claimsRecords: Array.isArray(object?.claimsRecords) ? object.claimsRecords.map((e: any) => ClaimsRecordAddress.fromJSON(e)) : [] }; }, - toJSON(message: GenesisState): unknown { + toJSON(message: GenesisState): JsonSafe { const obj: any = {}; message.params !== undefined && (obj.params = message.params ? Params.toJSON(message.params) : undefined); if (message.claimsRecords) { @@ -203,7 +204,7 @@ export const Params = { evmChannels: Array.isArray(object?.evmChannels) ? object.evmChannels.map((e: any) => String(e)) : [] }; }, - toJSON(message: Params): unknown { + toJSON(message: Params): JsonSafe { const obj: any = {}; message.enableClaims !== undefined && (obj.enableClaims = message.enableClaims); message.airdropStartTime !== undefined && (obj.airdropStartTime = message.airdropStartTime.toISOString()); diff --git a/__fixtures__/output1/evmos/claims/v1/query.ts b/__fixtures__/output1/evmos/claims/v1/query.ts index f437fe5cab..a5c367ccf1 100644 --- a/__fixtures__/output1/evmos/claims/v1/query.ts +++ b/__fixtures__/output1/evmos/claims/v1/query.ts @@ -3,6 +3,7 @@ import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { Params, ParamsSDKType } from "./genesis"; import { ClaimsRecordAddress, ClaimsRecordAddressSDKType, Claim, ClaimSDKType } from "./claims"; import * as _m0 from "protobufjs/minimal"; +import { JsonSafe } from "../../../json-safe"; import { DeepPartial, isSet } from "../../../helpers"; export const protobufPackage = "evmos.claims.v1"; /** @@ -133,7 +134,7 @@ export const QueryTotalUnclaimedRequest = { fromJSON(_: any): QueryTotalUnclaimedRequest { return {}; }, - toJSON(_: QueryTotalUnclaimedRequest): unknown { + toJSON(_: QueryTotalUnclaimedRequest): JsonSafe { const obj: any = {}; return obj; }, @@ -183,7 +184,7 @@ export const QueryTotalUnclaimedResponse = { coins: Array.isArray(object?.coins) ? object.coins.map((e: any) => Coin.fromJSON(e)) : [] }; }, - toJSON(message: QueryTotalUnclaimedResponse): unknown { + toJSON(message: QueryTotalUnclaimedResponse): JsonSafe { const obj: any = {}; if (message.coins) { obj.coins = message.coins.map(e => e ? Coin.toJSON(e) : undefined); @@ -236,7 +237,7 @@ export const QueryParamsRequest = { fromJSON(_: any): QueryParamsRequest { return {}; }, - toJSON(_: QueryParamsRequest): unknown { + toJSON(_: QueryParamsRequest): JsonSafe { const obj: any = {}; return obj; }, @@ -286,7 +287,7 @@ export const QueryParamsResponse = { params: isSet(object.params) ? Params.fromJSON(object.params) : undefined }; }, - toJSON(message: QueryParamsResponse): unknown { + toJSON(message: QueryParamsResponse): JsonSafe { const obj: any = {}; message.params !== undefined && (obj.params = message.params ? Params.toJSON(message.params) : undefined); return obj; @@ -341,7 +342,7 @@ export const QueryClaimsRecordsRequest = { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; }, - toJSON(message: QueryClaimsRecordsRequest): unknown { + toJSON(message: QueryClaimsRecordsRequest): JsonSafe { const obj: any = {}; message.pagination !== undefined && (obj.pagination = message.pagination ? PageRequest.toJSON(message.pagination) : undefined); return obj; @@ -404,7 +405,7 @@ export const QueryClaimsRecordsResponse = { pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined }; }, - toJSON(message: QueryClaimsRecordsResponse): unknown { + toJSON(message: QueryClaimsRecordsResponse): JsonSafe { const obj: any = {}; if (message.claims) { obj.claims = message.claims.map(e => e ? ClaimsRecordAddress.toJSON(e) : undefined); @@ -471,7 +472,7 @@ export const QueryClaimsRecordRequest = { address: isSet(object.address) ? String(object.address) : "" }; }, - toJSON(message: QueryClaimsRecordRequest): unknown { + toJSON(message: QueryClaimsRecordRequest): JsonSafe { const obj: any = {}; message.address !== undefined && (obj.address = message.address); return obj; @@ -534,7 +535,7 @@ export const QueryClaimsRecordResponse = { claims: Array.isArray(object?.claims) ? object.claims.map((e: any) => Claim.fromJSON(e)) : [] }; }, - toJSON(message: QueryClaimsRecordResponse): unknown { + toJSON(message: QueryClaimsRecordResponse): JsonSafe { const obj: any = {}; message.initialClaimableAmount !== undefined && (obj.initialClaimableAmount = message.initialClaimableAmount); if (message.claims) { diff --git a/__fixtures__/output1/evmos/epochs/v1/genesis.ts b/__fixtures__/output1/evmos/epochs/v1/genesis.ts index 7a5e99c33f..c29de872f4 100644 --- a/__fixtures__/output1/evmos/epochs/v1/genesis.ts +++ b/__fixtures__/output1/evmos/epochs/v1/genesis.ts @@ -2,6 +2,7 @@ import { Timestamp, TimestampSDKType } from "../../../google/protobuf/timestamp" import { Duration, DurationSDKType } from "../../../google/protobuf/duration"; import { Long, toTimestamp, fromTimestamp, isSet, fromJsonTimestamp, DeepPartial } from "../../../helpers"; import * as _m0 from "protobufjs/minimal"; +import { JsonSafe } from "../../../json-safe"; export const protobufPackage = "evmos.epochs.v1"; export interface EpochInfo { identifier: string; @@ -111,7 +112,7 @@ export const EpochInfo = { currentEpochStartHeight: isSet(object.currentEpochStartHeight) ? Long.fromValue(object.currentEpochStartHeight) : Long.ZERO }; }, - toJSON(message: EpochInfo): unknown { + toJSON(message: EpochInfo): JsonSafe { const obj: any = {}; message.identifier !== undefined && (obj.identifier = message.identifier); message.startTime !== undefined && (obj.startTime = message.startTime.toISOString()); @@ -190,7 +191,7 @@ export const GenesisState = { epochs: Array.isArray(object?.epochs) ? object.epochs.map((e: any) => EpochInfo.fromJSON(e)) : [] }; }, - toJSON(message: GenesisState): unknown { + toJSON(message: GenesisState): JsonSafe { const obj: any = {}; if (message.epochs) { obj.epochs = message.epochs.map(e => e ? EpochInfo.toJSON(e) : undefined); diff --git a/__fixtures__/output1/evmos/epochs/v1/query.ts b/__fixtures__/output1/evmos/epochs/v1/query.ts index 6be783ca38..a7553c5d6c 100644 --- a/__fixtures__/output1/evmos/epochs/v1/query.ts +++ b/__fixtures__/output1/evmos/epochs/v1/query.ts @@ -2,6 +2,7 @@ import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } fr import { EpochInfo, EpochInfoSDKType } from "./genesis"; import { Long, isSet, DeepPartial } from "../../../helpers"; import * as _m0 from "protobufjs/minimal"; +import { JsonSafe } from "../../../json-safe"; export const protobufPackage = "evmos.epochs.v1"; export interface QueryEpochsInfoRequest { pagination?: PageRequest; @@ -63,7 +64,7 @@ export const QueryEpochsInfoRequest = { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; }, - toJSON(message: QueryEpochsInfoRequest): unknown { + toJSON(message: QueryEpochsInfoRequest): JsonSafe { const obj: any = {}; message.pagination !== undefined && (obj.pagination = message.pagination ? PageRequest.toJSON(message.pagination) : undefined); return obj; @@ -126,7 +127,7 @@ export const QueryEpochsInfoResponse = { pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined }; }, - toJSON(message: QueryEpochsInfoResponse): unknown { + toJSON(message: QueryEpochsInfoResponse): JsonSafe { const obj: any = {}; if (message.epochs) { obj.epochs = message.epochs.map(e => e ? EpochInfo.toJSON(e) : undefined); @@ -193,7 +194,7 @@ export const QueryCurrentEpochRequest = { identifier: isSet(object.identifier) ? String(object.identifier) : "" }; }, - toJSON(message: QueryCurrentEpochRequest): unknown { + toJSON(message: QueryCurrentEpochRequest): JsonSafe { const obj: any = {}; message.identifier !== undefined && (obj.identifier = message.identifier); return obj; @@ -248,7 +249,7 @@ export const QueryCurrentEpochResponse = { currentEpoch: isSet(object.currentEpoch) ? Long.fromValue(object.currentEpoch) : Long.ZERO }; }, - toJSON(message: QueryCurrentEpochResponse): unknown { + toJSON(message: QueryCurrentEpochResponse): JsonSafe { const obj: any = {}; message.currentEpoch !== undefined && (obj.currentEpoch = (message.currentEpoch || Long.ZERO).toString()); return obj; diff --git a/__fixtures__/output1/evmos/erc20/v1/erc20.ts b/__fixtures__/output1/evmos/erc20/v1/erc20.ts index 2f9cd63e10..cc534cc241 100644 --- a/__fixtures__/output1/evmos/erc20/v1/erc20.ts +++ b/__fixtures__/output1/evmos/erc20/v1/erc20.ts @@ -1,6 +1,7 @@ import { Metadata, MetadataSDKType } from "../../../cosmos/bank/v1beta1/bank"; import * as _m0 from "protobufjs/minimal"; import { isSet, DeepPartial } from "../../../helpers"; +import { JsonSafe } from "../../../json-safe"; export const protobufPackage = "evmos.erc20.v1"; /** Owner enumerates the ownership of a ERC20 contract. */ export enum Owner { @@ -191,7 +192,7 @@ export const TokenPair = { contractOwner: isSet(object.contractOwner) ? ownerFromJSON(object.contractOwner) : -1 }; }, - toJSON(message: TokenPair): unknown { + toJSON(message: TokenPair): JsonSafe { const obj: any = {}; message.erc20Address !== undefined && (obj.erc20Address = message.erc20Address); message.denom !== undefined && (obj.denom = message.denom); @@ -274,7 +275,7 @@ export const RegisterCoinProposal = { metadata: isSet(object.metadata) ? Metadata.fromJSON(object.metadata) : undefined }; }, - toJSON(message: RegisterCoinProposal): unknown { + toJSON(message: RegisterCoinProposal): JsonSafe { const obj: any = {}; message.title !== undefined && (obj.title = message.title); message.description !== undefined && (obj.description = message.description); @@ -353,7 +354,7 @@ export const RegisterERC20Proposal = { erc20address: isSet(object.erc20address) ? String(object.erc20address) : "" }; }, - toJSON(message: RegisterERC20Proposal): unknown { + toJSON(message: RegisterERC20Proposal): JsonSafe { const obj: any = {}; message.title !== undefined && (obj.title = message.title); message.description !== undefined && (obj.description = message.description); @@ -432,7 +433,7 @@ export const ToggleTokenConversionProposal = { token: isSet(object.token) ? String(object.token) : "" }; }, - toJSON(message: ToggleTokenConversionProposal): unknown { + toJSON(message: ToggleTokenConversionProposal): JsonSafe { const obj: any = {}; message.title !== undefined && (obj.title = message.title); message.description !== undefined && (obj.description = message.description); diff --git a/__fixtures__/output1/evmos/erc20/v1/genesis.ts b/__fixtures__/output1/evmos/erc20/v1/genesis.ts index 66da512b86..77e72aaa6d 100644 --- a/__fixtures__/output1/evmos/erc20/v1/genesis.ts +++ b/__fixtures__/output1/evmos/erc20/v1/genesis.ts @@ -1,6 +1,7 @@ import { TokenPair, TokenPairSDKType } from "./erc20"; import * as _m0 from "protobufjs/minimal"; import { isSet, DeepPartial } from "../../../helpers"; +import { JsonSafe } from "../../../json-safe"; export const protobufPackage = "evmos.erc20.v1"; /** GenesisState defines the module's genesis state. */ export interface GenesisState { @@ -72,7 +73,7 @@ export const GenesisState = { tokenPairs: Array.isArray(object?.tokenPairs) ? object.tokenPairs.map((e: any) => TokenPair.fromJSON(e)) : [] }; }, - toJSON(message: GenesisState): unknown { + toJSON(message: GenesisState): JsonSafe { const obj: any = {}; message.params !== undefined && (obj.params = message.params ? Params.toJSON(message.params) : undefined); if (message.tokenPairs) { @@ -147,7 +148,7 @@ export const Params = { enableEvmHook: isSet(object.enableEvmHook) ? Boolean(object.enableEvmHook) : false }; }, - toJSON(message: Params): unknown { + toJSON(message: Params): JsonSafe { const obj: any = {}; message.enableErc20 !== undefined && (obj.enableErc20 = message.enableErc20); message.enableEvmHook !== undefined && (obj.enableEvmHook = message.enableEvmHook); diff --git a/__fixtures__/output1/evmos/erc20/v1/query.ts b/__fixtures__/output1/evmos/erc20/v1/query.ts index 967ea18f82..3ec3fe2950 100644 --- a/__fixtures__/output1/evmos/erc20/v1/query.ts +++ b/__fixtures__/output1/evmos/erc20/v1/query.ts @@ -3,6 +3,7 @@ import { TokenPair, TokenPairSDKType } from "./erc20"; import { Params, ParamsSDKType } from "./genesis"; import * as _m0 from "protobufjs/minimal"; import { isSet, DeepPartial } from "../../../helpers"; +import { JsonSafe } from "../../../json-safe"; export const protobufPackage = "evmos.erc20.v1"; /** * QueryTokenPairsRequest is the request type for the Query/TokenPairs RPC @@ -114,7 +115,7 @@ export const QueryTokenPairsRequest = { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; }, - toJSON(message: QueryTokenPairsRequest): unknown { + toJSON(message: QueryTokenPairsRequest): JsonSafe { const obj: any = {}; message.pagination !== undefined && (obj.pagination = message.pagination ? PageRequest.toJSON(message.pagination) : undefined); return obj; @@ -177,7 +178,7 @@ export const QueryTokenPairsResponse = { pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined }; }, - toJSON(message: QueryTokenPairsResponse): unknown { + toJSON(message: QueryTokenPairsResponse): JsonSafe { const obj: any = {}; if (message.tokenPairs) { obj.tokenPairs = message.tokenPairs.map(e => e ? TokenPair.toJSON(e) : undefined); @@ -244,7 +245,7 @@ export const QueryTokenPairRequest = { token: isSet(object.token) ? String(object.token) : "" }; }, - toJSON(message: QueryTokenPairRequest): unknown { + toJSON(message: QueryTokenPairRequest): JsonSafe { const obj: any = {}; message.token !== undefined && (obj.token = message.token); return obj; @@ -299,7 +300,7 @@ export const QueryTokenPairResponse = { tokenPair: isSet(object.tokenPair) ? TokenPair.fromJSON(object.tokenPair) : undefined }; }, - toJSON(message: QueryTokenPairResponse): unknown { + toJSON(message: QueryTokenPairResponse): JsonSafe { const obj: any = {}; message.tokenPair !== undefined && (obj.tokenPair = message.tokenPair ? TokenPair.toJSON(message.tokenPair) : undefined); return obj; @@ -344,7 +345,7 @@ export const QueryParamsRequest = { fromJSON(_: any): QueryParamsRequest { return {}; }, - toJSON(_: QueryParamsRequest): unknown { + toJSON(_: QueryParamsRequest): JsonSafe { const obj: any = {}; return obj; }, @@ -394,7 +395,7 @@ export const QueryParamsResponse = { params: isSet(object.params) ? Params.fromJSON(object.params) : undefined }; }, - toJSON(message: QueryParamsResponse): unknown { + toJSON(message: QueryParamsResponse): JsonSafe { const obj: any = {}; message.params !== undefined && (obj.params = message.params ? Params.toJSON(message.params) : undefined); return obj; diff --git a/__fixtures__/output1/evmos/erc20/v1/tx.ts b/__fixtures__/output1/evmos/erc20/v1/tx.ts index 22474e2304..d4d8aaf949 100644 --- a/__fixtures__/output1/evmos/erc20/v1/tx.ts +++ b/__fixtures__/output1/evmos/erc20/v1/tx.ts @@ -1,6 +1,7 @@ import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import * as _m0 from "protobufjs/minimal"; import { isSet, DeepPartial } from "../../../helpers"; +import { JsonSafe } from "../../../json-safe"; export const protobufPackage = "evmos.erc20.v1"; /** MsgConvertCoin defines a Msg to convert a native Cosmos coin to a ERC20 token */ export interface MsgConvertCoin { @@ -102,7 +103,7 @@ export const MsgConvertCoin = { sender: isSet(object.sender) ? String(object.sender) : "" }; }, - toJSON(message: MsgConvertCoin): unknown { + toJSON(message: MsgConvertCoin): JsonSafe { const obj: any = {}; message.coin !== undefined && (obj.coin = message.coin ? Coin.toJSON(message.coin) : undefined); message.receiver !== undefined && (obj.receiver = message.receiver); @@ -155,7 +156,7 @@ export const MsgConvertCoinResponse = { fromJSON(_: any): MsgConvertCoinResponse { return {}; }, - toJSON(_: MsgConvertCoinResponse): unknown { + toJSON(_: MsgConvertCoinResponse): JsonSafe { const obj: any = {}; return obj; }, @@ -229,7 +230,7 @@ export const MsgConvertERC20 = { sender: isSet(object.sender) ? String(object.sender) : "" }; }, - toJSON(message: MsgConvertERC20): unknown { + toJSON(message: MsgConvertERC20): JsonSafe { const obj: any = {}; message.contractAddress !== undefined && (obj.contractAddress = message.contractAddress); message.amount !== undefined && (obj.amount = message.amount); @@ -286,7 +287,7 @@ export const MsgConvertERC20Response = { fromJSON(_: any): MsgConvertERC20Response { return {}; }, - toJSON(_: MsgConvertERC20Response): unknown { + toJSON(_: MsgConvertERC20Response): JsonSafe { const obj: any = {}; return obj; }, diff --git a/__fixtures__/output1/evmos/fees/v1/fees.ts b/__fixtures__/output1/evmos/fees/v1/fees.ts index 9f09f5f2c4..c429ceffad 100644 --- a/__fixtures__/output1/evmos/fees/v1/fees.ts +++ b/__fixtures__/output1/evmos/fees/v1/fees.ts @@ -1,5 +1,6 @@ import * as _m0 from "protobufjs/minimal"; import { isSet, DeepPartial } from "../../../helpers"; +import { JsonSafe } from "../../../json-safe"; export const protobufPackage = "evmos.fees.v1"; /** * DevFeeInfo defines an instance that organizes fee distribution conditions @@ -75,7 +76,7 @@ export const DevFeeInfo = { withdrawAddress: isSet(object.withdrawAddress) ? String(object.withdrawAddress) : "" }; }, - toJSON(message: DevFeeInfo): unknown { + toJSON(message: DevFeeInfo): JsonSafe { const obj: any = {}; message.contractAddress !== undefined && (obj.contractAddress = message.contractAddress); message.deployerAddress !== undefined && (obj.deployerAddress = message.deployerAddress); diff --git a/__fixtures__/output1/evmos/fees/v1/genesis.ts b/__fixtures__/output1/evmos/fees/v1/genesis.ts index 347363b95c..4dd8a5176f 100644 --- a/__fixtures__/output1/evmos/fees/v1/genesis.ts +++ b/__fixtures__/output1/evmos/fees/v1/genesis.ts @@ -1,6 +1,7 @@ import { DevFeeInfo, DevFeeInfoSDKType } from "./fees"; import { Long, isSet, DeepPartial } from "../../../helpers"; import * as _m0 from "protobufjs/minimal"; +import { JsonSafe } from "../../../json-safe"; export const protobufPackage = "evmos.fees.v1"; /** GenesisState defines the module's genesis state. */ export interface GenesisState { @@ -86,7 +87,7 @@ export const GenesisState = { devFeeInfos: Array.isArray(object?.devFeeInfos) ? object.devFeeInfos.map((e: any) => DevFeeInfo.fromJSON(e)) : [] }; }, - toJSON(message: GenesisState): unknown { + toJSON(message: GenesisState): JsonSafe { const obj: any = {}; message.params !== undefined && (obj.params = message.params ? Params.toJSON(message.params) : undefined); if (message.devFeeInfos) { @@ -185,7 +186,7 @@ export const Params = { minGasPrice: isSet(object.minGasPrice) ? String(object.minGasPrice) : "" }; }, - toJSON(message: Params): unknown { + toJSON(message: Params): JsonSafe { const obj: any = {}; message.enableFees !== undefined && (obj.enableFees = message.enableFees); message.developerShares !== undefined && (obj.developerShares = message.developerShares); diff --git a/__fixtures__/output1/evmos/fees/v1/query.ts b/__fixtures__/output1/evmos/fees/v1/query.ts index 0755e99d7e..27ce140968 100644 --- a/__fixtures__/output1/evmos/fees/v1/query.ts +++ b/__fixtures__/output1/evmos/fees/v1/query.ts @@ -3,6 +3,7 @@ import { DevFeeInfo, DevFeeInfoSDKType } from "./fees"; import { Params, ParamsSDKType } from "./genesis"; import * as _m0 from "protobufjs/minimal"; import { isSet, DeepPartial } from "../../../helpers"; +import { JsonSafe } from "../../../json-safe"; export const protobufPackage = "evmos.fees.v1"; /** * QueryDevFeeInfosRequest is the request type for the Query/DevFeeInfos RPC @@ -152,7 +153,7 @@ export const QueryDevFeeInfosRequest = { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; }, - toJSON(message: QueryDevFeeInfosRequest): unknown { + toJSON(message: QueryDevFeeInfosRequest): JsonSafe { const obj: any = {}; message.pagination !== undefined && (obj.pagination = message.pagination ? PageRequest.toJSON(message.pagination) : undefined); return obj; @@ -215,7 +216,7 @@ export const QueryDevFeeInfosResponse = { pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined }; }, - toJSON(message: QueryDevFeeInfosResponse): unknown { + toJSON(message: QueryDevFeeInfosResponse): JsonSafe { const obj: any = {}; if (message.fees) { obj.fees = message.fees.map(e => e ? DevFeeInfo.toJSON(e) : undefined); @@ -282,7 +283,7 @@ export const QueryDevFeeInfoRequest = { contractAddress: isSet(object.contractAddress) ? String(object.contractAddress) : "" }; }, - toJSON(message: QueryDevFeeInfoRequest): unknown { + toJSON(message: QueryDevFeeInfoRequest): JsonSafe { const obj: any = {}; message.contractAddress !== undefined && (obj.contractAddress = message.contractAddress); return obj; @@ -337,7 +338,7 @@ export const QueryDevFeeInfoResponse = { fee: isSet(object.fee) ? DevFeeInfo.fromJSON(object.fee) : undefined }; }, - toJSON(message: QueryDevFeeInfoResponse): unknown { + toJSON(message: QueryDevFeeInfoResponse): JsonSafe { const obj: any = {}; message.fee !== undefined && (obj.fee = message.fee ? DevFeeInfo.toJSON(message.fee) : undefined); return obj; @@ -382,7 +383,7 @@ export const QueryParamsRequest = { fromJSON(_: any): QueryParamsRequest { return {}; }, - toJSON(_: QueryParamsRequest): unknown { + toJSON(_: QueryParamsRequest): JsonSafe { const obj: any = {}; return obj; }, @@ -432,7 +433,7 @@ export const QueryParamsResponse = { params: isSet(object.params) ? Params.fromJSON(object.params) : undefined }; }, - toJSON(message: QueryParamsResponse): unknown { + toJSON(message: QueryParamsResponse): JsonSafe { const obj: any = {}; message.params !== undefined && (obj.params = message.params ? Params.toJSON(message.params) : undefined); return obj; @@ -495,7 +496,7 @@ export const QueryDevFeeInfosPerDeployerRequest = { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; }, - toJSON(message: QueryDevFeeInfosPerDeployerRequest): unknown { + toJSON(message: QueryDevFeeInfosPerDeployerRequest): JsonSafe { const obj: any = {}; message.deployerAddress !== undefined && (obj.deployerAddress = message.deployerAddress); message.pagination !== undefined && (obj.pagination = message.pagination ? PageRequest.toJSON(message.pagination) : undefined); @@ -562,7 +563,7 @@ export const QueryDevFeeInfosPerDeployerResponse = { pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined }; }, - toJSON(message: QueryDevFeeInfosPerDeployerResponse): unknown { + toJSON(message: QueryDevFeeInfosPerDeployerResponse): JsonSafe { const obj: any = {}; if (message.fees) { obj.fees = message.fees.map(e => e ? DevFeeInfo.toJSON(e) : undefined); diff --git a/__fixtures__/output1/evmos/fees/v1/tx.ts b/__fixtures__/output1/evmos/fees/v1/tx.ts index f54ccc3515..6f9b187fb0 100644 --- a/__fixtures__/output1/evmos/fees/v1/tx.ts +++ b/__fixtures__/output1/evmos/fees/v1/tx.ts @@ -1,5 +1,6 @@ import { Long, isSet, DeepPartial } from "../../../helpers"; import * as _m0 from "protobufjs/minimal"; +import { JsonSafe } from "../../../json-safe"; export const protobufPackage = "evmos.fees.v1"; /** MsgRegisterFeesContract defines a message that registers a DevFeeInfo */ export interface MsgRegisterDevFeeInfo { @@ -150,7 +151,7 @@ export const MsgRegisterDevFeeInfo = { nonces: Array.isArray(object?.nonces) ? object.nonces.map((e: any) => Long.fromValue(e)) : [] }; }, - toJSON(message: MsgRegisterDevFeeInfo): unknown { + toJSON(message: MsgRegisterDevFeeInfo): JsonSafe { const obj: any = {}; message.contractAddress !== undefined && (obj.contractAddress = message.contractAddress); message.deployerAddress !== undefined && (obj.deployerAddress = message.deployerAddress); @@ -215,7 +216,7 @@ export const MsgRegisterDevFeeInfoResponse = { fromJSON(_: any): MsgRegisterDevFeeInfoResponse { return {}; }, - toJSON(_: MsgRegisterDevFeeInfoResponse): unknown { + toJSON(_: MsgRegisterDevFeeInfoResponse): JsonSafe { const obj: any = {}; return obj; }, @@ -273,7 +274,7 @@ export const MsgCancelDevFeeInfo = { deployerAddress: isSet(object.deployerAddress) ? String(object.deployerAddress) : "" }; }, - toJSON(message: MsgCancelDevFeeInfo): unknown { + toJSON(message: MsgCancelDevFeeInfo): JsonSafe { const obj: any = {}; message.contractAddress !== undefined && (obj.contractAddress = message.contractAddress); message.deployerAddress !== undefined && (obj.deployerAddress = message.deployerAddress); @@ -322,7 +323,7 @@ export const MsgCancelDevFeeInfoResponse = { fromJSON(_: any): MsgCancelDevFeeInfoResponse { return {}; }, - toJSON(_: MsgCancelDevFeeInfoResponse): unknown { + toJSON(_: MsgCancelDevFeeInfoResponse): JsonSafe { const obj: any = {}; return obj; }, @@ -388,7 +389,7 @@ export const MsgUpdateDevFeeInfo = { withdrawAddress: isSet(object.withdrawAddress) ? String(object.withdrawAddress) : "" }; }, - toJSON(message: MsgUpdateDevFeeInfo): unknown { + toJSON(message: MsgUpdateDevFeeInfo): JsonSafe { const obj: any = {}; message.contractAddress !== undefined && (obj.contractAddress = message.contractAddress); message.deployerAddress !== undefined && (obj.deployerAddress = message.deployerAddress); @@ -441,7 +442,7 @@ export const MsgUpdateDevFeeInfoResponse = { fromJSON(_: any): MsgUpdateDevFeeInfoResponse { return {}; }, - toJSON(_: MsgUpdateDevFeeInfoResponse): unknown { + toJSON(_: MsgUpdateDevFeeInfoResponse): JsonSafe { const obj: any = {}; return obj; }, diff --git a/__fixtures__/output1/evmos/incentives/v1/genesis.ts b/__fixtures__/output1/evmos/incentives/v1/genesis.ts index 4c6136d275..54331a7c56 100644 --- a/__fixtures__/output1/evmos/incentives/v1/genesis.ts +++ b/__fixtures__/output1/evmos/incentives/v1/genesis.ts @@ -1,6 +1,7 @@ import { Incentive, IncentiveSDKType, GasMeter, GasMeterSDKType } from "./incentives"; import * as _m0 from "protobufjs/minimal"; import { isSet, DeepPartial } from "../../../helpers"; +import { JsonSafe } from "../../../json-safe"; export const protobufPackage = "evmos.incentives.v1"; /** GenesisState defines the module's genesis state. */ export interface GenesisState { @@ -85,7 +86,7 @@ export const GenesisState = { gasMeters: Array.isArray(object?.gasMeters) ? object.gasMeters.map((e: any) => GasMeter.fromJSON(e)) : [] }; }, - toJSON(message: GenesisState): unknown { + toJSON(message: GenesisState): JsonSafe { const obj: any = {}; message.params !== undefined && (obj.params = message.params ? Params.toJSON(message.params) : undefined); if (message.incentives) { @@ -188,7 +189,7 @@ export const Params = { rewardScaler: isSet(object.rewardScaler) ? String(object.rewardScaler) : "" }; }, - toJSON(message: Params): unknown { + toJSON(message: Params): JsonSafe { const obj: any = {}; message.enableIncentives !== undefined && (obj.enableIncentives = message.enableIncentives); message.allocationLimit !== undefined && (obj.allocationLimit = message.allocationLimit); diff --git a/__fixtures__/output1/evmos/incentives/v1/incentives.ts b/__fixtures__/output1/evmos/incentives/v1/incentives.ts index d24a3ae851..e7974166c1 100644 --- a/__fixtures__/output1/evmos/incentives/v1/incentives.ts +++ b/__fixtures__/output1/evmos/incentives/v1/incentives.ts @@ -2,6 +2,7 @@ import { DecCoin, DecCoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { Timestamp, TimestampSDKType } from "../../../google/protobuf/timestamp"; import { Long, toTimestamp, fromTimestamp, isSet, fromJsonTimestamp, DeepPartial } from "../../../helpers"; import * as _m0 from "protobufjs/minimal"; +import { JsonSafe } from "../../../json-safe"; export const protobufPackage = "evmos.incentives.v1"; /** * Incentive defines an instance that organizes distribution conditions for a @@ -147,7 +148,7 @@ export const Incentive = { totalGas: isSet(object.totalGas) ? Long.fromValue(object.totalGas) : Long.UZERO }; }, - toJSON(message: Incentive): unknown { + toJSON(message: Incentive): JsonSafe { const obj: any = {}; message.contract !== undefined && (obj.contract = message.contract); if (message.allocations) { @@ -242,7 +243,7 @@ export const GasMeter = { cumulativeGas: isSet(object.cumulativeGas) ? Long.fromValue(object.cumulativeGas) : Long.UZERO }; }, - toJSON(message: GasMeter): unknown { + toJSON(message: GasMeter): JsonSafe { const obj: any = {}; message.contract !== undefined && (obj.contract = message.contract); message.participant !== undefined && (obj.participant = message.participant); @@ -337,7 +338,7 @@ export const RegisterIncentiveProposal = { epochs: isSet(object.epochs) ? Number(object.epochs) : 0 }; }, - toJSON(message: RegisterIncentiveProposal): unknown { + toJSON(message: RegisterIncentiveProposal): JsonSafe { const obj: any = {}; message.title !== undefined && (obj.title = message.title); message.description !== undefined && (obj.description = message.description); @@ -432,7 +433,7 @@ export const CancelIncentiveProposal = { contract: isSet(object.contract) ? String(object.contract) : "" }; }, - toJSON(message: CancelIncentiveProposal): unknown { + toJSON(message: CancelIncentiveProposal): JsonSafe { const obj: any = {}; message.title !== undefined && (obj.title = message.title); message.description !== undefined && (obj.description = message.description); diff --git a/__fixtures__/output1/evmos/incentives/v1/query.ts b/__fixtures__/output1/evmos/incentives/v1/query.ts index 8d1de72466..a4df01c9bd 100644 --- a/__fixtures__/output1/evmos/incentives/v1/query.ts +++ b/__fixtures__/output1/evmos/incentives/v1/query.ts @@ -4,6 +4,7 @@ import { DecCoin, DecCoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { Params, ParamsSDKType } from "./genesis"; import { Long, isSet, DeepPartial } from "../../../helpers"; import * as _m0 from "protobufjs/minimal"; +import { JsonSafe } from "../../../json-safe"; export const protobufPackage = "evmos.incentives.v1"; /** * QueryIncentivesRequest is the request type for the Query/Incentives RPC @@ -238,7 +239,7 @@ export const QueryIncentivesRequest = { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; }, - toJSON(message: QueryIncentivesRequest): unknown { + toJSON(message: QueryIncentivesRequest): JsonSafe { const obj: any = {}; message.pagination !== undefined && (obj.pagination = message.pagination ? PageRequest.toJSON(message.pagination) : undefined); return obj; @@ -301,7 +302,7 @@ export const QueryIncentivesResponse = { pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined }; }, - toJSON(message: QueryIncentivesResponse): unknown { + toJSON(message: QueryIncentivesResponse): JsonSafe { const obj: any = {}; if (message.incentives) { obj.incentives = message.incentives.map(e => e ? Incentive.toJSON(e) : undefined); @@ -368,7 +369,7 @@ export const QueryIncentiveRequest = { contract: isSet(object.contract) ? String(object.contract) : "" }; }, - toJSON(message: QueryIncentiveRequest): unknown { + toJSON(message: QueryIncentiveRequest): JsonSafe { const obj: any = {}; message.contract !== undefined && (obj.contract = message.contract); return obj; @@ -423,7 +424,7 @@ export const QueryIncentiveResponse = { incentive: isSet(object.incentive) ? Incentive.fromJSON(object.incentive) : undefined }; }, - toJSON(message: QueryIncentiveResponse): unknown { + toJSON(message: QueryIncentiveResponse): JsonSafe { const obj: any = {}; message.incentive !== undefined && (obj.incentive = message.incentive ? Incentive.toJSON(message.incentive) : undefined); return obj; @@ -486,7 +487,7 @@ export const QueryGasMetersRequest = { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; }, - toJSON(message: QueryGasMetersRequest): unknown { + toJSON(message: QueryGasMetersRequest): JsonSafe { const obj: any = {}; message.contract !== undefined && (obj.contract = message.contract); message.pagination !== undefined && (obj.pagination = message.pagination ? PageRequest.toJSON(message.pagination) : undefined); @@ -553,7 +554,7 @@ export const QueryGasMetersResponse = { pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined }; }, - toJSON(message: QueryGasMetersResponse): unknown { + toJSON(message: QueryGasMetersResponse): JsonSafe { const obj: any = {}; if (message.gasMeters) { obj.gasMeters = message.gasMeters.map(e => e ? GasMeter.toJSON(e) : undefined); @@ -628,7 +629,7 @@ export const QueryGasMeterRequest = { participant: isSet(object.participant) ? String(object.participant) : "" }; }, - toJSON(message: QueryGasMeterRequest): unknown { + toJSON(message: QueryGasMeterRequest): JsonSafe { const obj: any = {}; message.contract !== undefined && (obj.contract = message.contract); message.participant !== undefined && (obj.participant = message.participant); @@ -687,7 +688,7 @@ export const QueryGasMeterResponse = { gasMeter: isSet(object.gasMeter) ? Long.fromValue(object.gasMeter) : Long.UZERO }; }, - toJSON(message: QueryGasMeterResponse): unknown { + toJSON(message: QueryGasMeterResponse): JsonSafe { const obj: any = {}; message.gasMeter !== undefined && (obj.gasMeter = (message.gasMeter || Long.UZERO).toString()); return obj; @@ -742,7 +743,7 @@ export const QueryAllocationMetersRequest = { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; }, - toJSON(message: QueryAllocationMetersRequest): unknown { + toJSON(message: QueryAllocationMetersRequest): JsonSafe { const obj: any = {}; message.pagination !== undefined && (obj.pagination = message.pagination ? PageRequest.toJSON(message.pagination) : undefined); return obj; @@ -805,7 +806,7 @@ export const QueryAllocationMetersResponse = { pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined }; }, - toJSON(message: QueryAllocationMetersResponse): unknown { + toJSON(message: QueryAllocationMetersResponse): JsonSafe { const obj: any = {}; if (message.allocationMeters) { obj.allocationMeters = message.allocationMeters.map(e => e ? DecCoin.toJSON(e) : undefined); @@ -872,7 +873,7 @@ export const QueryAllocationMeterRequest = { denom: isSet(object.denom) ? String(object.denom) : "" }; }, - toJSON(message: QueryAllocationMeterRequest): unknown { + toJSON(message: QueryAllocationMeterRequest): JsonSafe { const obj: any = {}; message.denom !== undefined && (obj.denom = message.denom); return obj; @@ -927,7 +928,7 @@ export const QueryAllocationMeterResponse = { allocationMeter: isSet(object.allocationMeter) ? DecCoin.fromJSON(object.allocationMeter) : undefined }; }, - toJSON(message: QueryAllocationMeterResponse): unknown { + toJSON(message: QueryAllocationMeterResponse): JsonSafe { const obj: any = {}; message.allocationMeter !== undefined && (obj.allocationMeter = message.allocationMeter ? DecCoin.toJSON(message.allocationMeter) : undefined); return obj; @@ -972,7 +973,7 @@ export const QueryParamsRequest = { fromJSON(_: any): QueryParamsRequest { return {}; }, - toJSON(_: QueryParamsRequest): unknown { + toJSON(_: QueryParamsRequest): JsonSafe { const obj: any = {}; return obj; }, @@ -1022,7 +1023,7 @@ export const QueryParamsResponse = { params: isSet(object.params) ? Params.fromJSON(object.params) : undefined }; }, - toJSON(message: QueryParamsResponse): unknown { + toJSON(message: QueryParamsResponse): JsonSafe { const obj: any = {}; message.params !== undefined && (obj.params = message.params ? Params.toJSON(message.params) : undefined); return obj; diff --git a/__fixtures__/output1/evmos/inflation/v1/genesis.ts b/__fixtures__/output1/evmos/inflation/v1/genesis.ts index acb606135a..55d62242b5 100644 --- a/__fixtures__/output1/evmos/inflation/v1/genesis.ts +++ b/__fixtures__/output1/evmos/inflation/v1/genesis.ts @@ -1,6 +1,7 @@ import { ExponentialCalculation, ExponentialCalculationSDKType, InflationDistribution, InflationDistributionSDKType } from "./inflation"; import { Long, isSet, DeepPartial } from "../../../helpers"; import * as _m0 from "protobufjs/minimal"; +import { JsonSafe } from "../../../json-safe"; export const protobufPackage = "evmos.inflation.v1"; /** GenesisState defines the inflation module's genesis state. */ export interface GenesisState { @@ -107,7 +108,7 @@ export const GenesisState = { skippedEpochs: isSet(object.skippedEpochs) ? Long.fromValue(object.skippedEpochs) : Long.UZERO }; }, - toJSON(message: GenesisState): unknown { + toJSON(message: GenesisState): JsonSafe { const obj: any = {}; message.params !== undefined && (obj.params = message.params ? Params.toJSON(message.params) : undefined); message.period !== undefined && (obj.period = (message.period || Long.UZERO).toString()); @@ -202,7 +203,7 @@ export const Params = { enableInflation: isSet(object.enableInflation) ? Boolean(object.enableInflation) : false }; }, - toJSON(message: Params): unknown { + toJSON(message: Params): JsonSafe { const obj: any = {}; message.mintDenom !== undefined && (obj.mintDenom = message.mintDenom); message.exponentialCalculation !== undefined && (obj.exponentialCalculation = message.exponentialCalculation ? ExponentialCalculation.toJSON(message.exponentialCalculation) : undefined); diff --git a/__fixtures__/output1/evmos/inflation/v1/inflation.ts b/__fixtures__/output1/evmos/inflation/v1/inflation.ts index 2cce1236f1..c7b3b220ba 100644 --- a/__fixtures__/output1/evmos/inflation/v1/inflation.ts +++ b/__fixtures__/output1/evmos/inflation/v1/inflation.ts @@ -1,5 +1,6 @@ import * as _m0 from "protobufjs/minimal"; import { isSet, DeepPartial } from "../../../helpers"; +import { JsonSafe } from "../../../json-safe"; export const protobufPackage = "evmos.inflation.v1"; /** * InflationDistribution defines the distribution in which inflation is @@ -124,7 +125,7 @@ export const InflationDistribution = { communityPool: isSet(object.communityPool) ? String(object.communityPool) : "" }; }, - toJSON(message: InflationDistribution): unknown { + toJSON(message: InflationDistribution): JsonSafe { const obj: any = {}; message.stakingRewards !== undefined && (obj.stakingRewards = message.stakingRewards); message.usageIncentives !== undefined && (obj.usageIncentives = message.usageIncentives); @@ -219,7 +220,7 @@ export const ExponentialCalculation = { maxVariance: isSet(object.maxVariance) ? String(object.maxVariance) : "" }; }, - toJSON(message: ExponentialCalculation): unknown { + toJSON(message: ExponentialCalculation): JsonSafe { const obj: any = {}; message.a !== undefined && (obj.a = message.a); message.r !== undefined && (obj.r = message.r); diff --git a/__fixtures__/output1/evmos/inflation/v1/query.ts b/__fixtures__/output1/evmos/inflation/v1/query.ts index ed92dd0c08..dbccf6d7d0 100644 --- a/__fixtures__/output1/evmos/inflation/v1/query.ts +++ b/__fixtures__/output1/evmos/inflation/v1/query.ts @@ -2,6 +2,7 @@ import { DecCoin, DecCoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { Params, ParamsSDKType } from "./genesis"; import { Long, DeepPartial, isSet } from "../../../helpers"; import * as _m0 from "protobufjs/minimal"; +import { JsonSafe } from "../../../json-safe"; export const protobufPackage = "evmos.inflation.v1"; /** QueryPeriodRequest is the request type for the Query/Period RPC method. */ export interface QueryPeriodRequest {} @@ -153,7 +154,7 @@ export const QueryPeriodRequest = { fromJSON(_: any): QueryPeriodRequest { return {}; }, - toJSON(_: QueryPeriodRequest): unknown { + toJSON(_: QueryPeriodRequest): JsonSafe { const obj: any = {}; return obj; }, @@ -203,7 +204,7 @@ export const QueryPeriodResponse = { period: isSet(object.period) ? Long.fromValue(object.period) : Long.UZERO }; }, - toJSON(message: QueryPeriodResponse): unknown { + toJSON(message: QueryPeriodResponse): JsonSafe { const obj: any = {}; message.period !== undefined && (obj.period = (message.period || Long.UZERO).toString()); return obj; @@ -248,7 +249,7 @@ export const QueryEpochMintProvisionRequest = { fromJSON(_: any): QueryEpochMintProvisionRequest { return {}; }, - toJSON(_: QueryEpochMintProvisionRequest): unknown { + toJSON(_: QueryEpochMintProvisionRequest): JsonSafe { const obj: any = {}; return obj; }, @@ -298,7 +299,7 @@ export const QueryEpochMintProvisionResponse = { epochMintProvision: isSet(object.epochMintProvision) ? DecCoin.fromJSON(object.epochMintProvision) : undefined }; }, - toJSON(message: QueryEpochMintProvisionResponse): unknown { + toJSON(message: QueryEpochMintProvisionResponse): JsonSafe { const obj: any = {}; message.epochMintProvision !== undefined && (obj.epochMintProvision = message.epochMintProvision ? DecCoin.toJSON(message.epochMintProvision) : undefined); return obj; @@ -343,7 +344,7 @@ export const QuerySkippedEpochsRequest = { fromJSON(_: any): QuerySkippedEpochsRequest { return {}; }, - toJSON(_: QuerySkippedEpochsRequest): unknown { + toJSON(_: QuerySkippedEpochsRequest): JsonSafe { const obj: any = {}; return obj; }, @@ -393,7 +394,7 @@ export const QuerySkippedEpochsResponse = { skippedEpochs: isSet(object.skippedEpochs) ? Long.fromValue(object.skippedEpochs) : Long.UZERO }; }, - toJSON(message: QuerySkippedEpochsResponse): unknown { + toJSON(message: QuerySkippedEpochsResponse): JsonSafe { const obj: any = {}; message.skippedEpochs !== undefined && (obj.skippedEpochs = (message.skippedEpochs || Long.UZERO).toString()); return obj; @@ -438,7 +439,7 @@ export const QueryCirculatingSupplyRequest = { fromJSON(_: any): QueryCirculatingSupplyRequest { return {}; }, - toJSON(_: QueryCirculatingSupplyRequest): unknown { + toJSON(_: QueryCirculatingSupplyRequest): JsonSafe { const obj: any = {}; return obj; }, @@ -488,7 +489,7 @@ export const QueryCirculatingSupplyResponse = { circulatingSupply: isSet(object.circulatingSupply) ? DecCoin.fromJSON(object.circulatingSupply) : undefined }; }, - toJSON(message: QueryCirculatingSupplyResponse): unknown { + toJSON(message: QueryCirculatingSupplyResponse): JsonSafe { const obj: any = {}; message.circulatingSupply !== undefined && (obj.circulatingSupply = message.circulatingSupply ? DecCoin.toJSON(message.circulatingSupply) : undefined); return obj; @@ -533,7 +534,7 @@ export const QueryInflationRateRequest = { fromJSON(_: any): QueryInflationRateRequest { return {}; }, - toJSON(_: QueryInflationRateRequest): unknown { + toJSON(_: QueryInflationRateRequest): JsonSafe { const obj: any = {}; return obj; }, @@ -583,7 +584,7 @@ export const QueryInflationRateResponse = { inflationRate: isSet(object.inflationRate) ? String(object.inflationRate) : "" }; }, - toJSON(message: QueryInflationRateResponse): unknown { + toJSON(message: QueryInflationRateResponse): JsonSafe { const obj: any = {}; message.inflationRate !== undefined && (obj.inflationRate = message.inflationRate); return obj; @@ -628,7 +629,7 @@ export const QueryParamsRequest = { fromJSON(_: any): QueryParamsRequest { return {}; }, - toJSON(_: QueryParamsRequest): unknown { + toJSON(_: QueryParamsRequest): JsonSafe { const obj: any = {}; return obj; }, @@ -678,7 +679,7 @@ export const QueryParamsResponse = { params: isSet(object.params) ? Params.fromJSON(object.params) : undefined }; }, - toJSON(message: QueryParamsResponse): unknown { + toJSON(message: QueryParamsResponse): JsonSafe { const obj: any = {}; message.params !== undefined && (obj.params = message.params ? Params.toJSON(message.params) : undefined); return obj; diff --git a/__fixtures__/output1/evmos/recovery/v1/genesis.ts b/__fixtures__/output1/evmos/recovery/v1/genesis.ts index a34898c523..dcf51b9e73 100644 --- a/__fixtures__/output1/evmos/recovery/v1/genesis.ts +++ b/__fixtures__/output1/evmos/recovery/v1/genesis.ts @@ -1,6 +1,7 @@ import { Duration, DurationSDKType } from "../../../google/protobuf/duration"; import * as _m0 from "protobufjs/minimal"; import { isSet, DeepPartial } from "../../../helpers"; +import { JsonSafe } from "../../../json-safe"; export const protobufPackage = "evmos.recovery.v1"; /** GenesisState defines the recovery module's genesis state. */ export interface GenesisState { @@ -57,7 +58,7 @@ export const GenesisState = { params: isSet(object.params) ? Params.fromJSON(object.params) : undefined }; }, - toJSON(message: GenesisState): unknown { + toJSON(message: GenesisState): JsonSafe { const obj: any = {}; message.params !== undefined && (obj.params = message.params ? Params.toJSON(message.params) : undefined); return obj; @@ -120,7 +121,7 @@ export const Params = { packetTimeoutDuration: isSet(object.packetTimeoutDuration) ? Duration.fromJSON(object.packetTimeoutDuration) : undefined }; }, - toJSON(message: Params): unknown { + toJSON(message: Params): JsonSafe { const obj: any = {}; message.enableRecovery !== undefined && (obj.enableRecovery = message.enableRecovery); message.packetTimeoutDuration !== undefined && (obj.packetTimeoutDuration = message.packetTimeoutDuration ? Duration.toJSON(message.packetTimeoutDuration) : undefined); diff --git a/__fixtures__/output1/evmos/recovery/v1/query.ts b/__fixtures__/output1/evmos/recovery/v1/query.ts index 6b872fb18e..86c1e0921f 100644 --- a/__fixtures__/output1/evmos/recovery/v1/query.ts +++ b/__fixtures__/output1/evmos/recovery/v1/query.ts @@ -1,5 +1,6 @@ import { Params, ParamsSDKType } from "./genesis"; import * as _m0 from "protobufjs/minimal"; +import { JsonSafe } from "../../../json-safe"; import { DeepPartial, isSet } from "../../../helpers"; export const protobufPackage = "evmos.recovery.v1"; /** QueryParamsRequest is the request type for the Query/Params RPC method. */ @@ -39,7 +40,7 @@ export const QueryParamsRequest = { fromJSON(_: any): QueryParamsRequest { return {}; }, - toJSON(_: QueryParamsRequest): unknown { + toJSON(_: QueryParamsRequest): JsonSafe { const obj: any = {}; return obj; }, @@ -89,7 +90,7 @@ export const QueryParamsResponse = { params: isSet(object.params) ? Params.fromJSON(object.params) : undefined }; }, - toJSON(message: QueryParamsResponse): unknown { + toJSON(message: QueryParamsResponse): JsonSafe { const obj: any = {}; message.params !== undefined && (obj.params = message.params ? Params.toJSON(message.params) : undefined); return obj; diff --git a/__fixtures__/output1/evmos/vesting/v1/query.ts b/__fixtures__/output1/evmos/vesting/v1/query.ts index 4758a0bf3e..c5633e959e 100644 --- a/__fixtures__/output1/evmos/vesting/v1/query.ts +++ b/__fixtures__/output1/evmos/vesting/v1/query.ts @@ -1,6 +1,7 @@ import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import * as _m0 from "protobufjs/minimal"; import { isSet, DeepPartial } from "../../../helpers"; +import { JsonSafe } from "../../../json-safe"; export const protobufPackage = "evmos.vesting.v1"; /** QueryBalancesRequest is the request type for the Query/Balances RPC method. */ export interface QueryBalancesRequest { @@ -66,7 +67,7 @@ export const QueryBalancesRequest = { address: isSet(object.address) ? String(object.address) : "" }; }, - toJSON(message: QueryBalancesRequest): unknown { + toJSON(message: QueryBalancesRequest): JsonSafe { const obj: any = {}; message.address !== undefined && (obj.address = message.address); return obj; @@ -137,7 +138,7 @@ export const QueryBalancesResponse = { vested: Array.isArray(object?.vested) ? object.vested.map((e: any) => Coin.fromJSON(e)) : [] }; }, - toJSON(message: QueryBalancesResponse): unknown { + toJSON(message: QueryBalancesResponse): JsonSafe { const obj: any = {}; if (message.locked) { obj.locked = message.locked.map(e => e ? Coin.toJSON(e) : undefined); diff --git a/__fixtures__/output1/evmos/vesting/v1/tx.ts b/__fixtures__/output1/evmos/vesting/v1/tx.ts index 9762d48d96..cd2aeefeed 100644 --- a/__fixtures__/output1/evmos/vesting/v1/tx.ts +++ b/__fixtures__/output1/evmos/vesting/v1/tx.ts @@ -2,6 +2,7 @@ import { Timestamp, TimestampSDKType } from "../../../google/protobuf/timestamp" import { Period, PeriodSDKType } from "../../../cosmos/vesting/v1beta1/vesting"; import * as _m0 from "protobufjs/minimal"; import { toTimestamp, fromTimestamp, isSet, fromJsonTimestamp, DeepPartial } from "../../../helpers"; +import { JsonSafe } from "../../../json-safe"; export const protobufPackage = "evmos.vesting.v1"; /** MsgCreateClawbackVestingAccount defines a message that enables creating a ClawbackVestingAccount. */ export interface MsgCreateClawbackVestingAccount { @@ -149,7 +150,7 @@ export const MsgCreateClawbackVestingAccount = { merge: isSet(object.merge) ? Boolean(object.merge) : false }; }, - toJSON(message: MsgCreateClawbackVestingAccount): unknown { + toJSON(message: MsgCreateClawbackVestingAccount): JsonSafe { const obj: any = {}; message.fromAddress !== undefined && (obj.fromAddress = message.fromAddress); message.toAddress !== undefined && (obj.toAddress = message.toAddress); @@ -230,7 +231,7 @@ export const MsgCreateClawbackVestingAccountResponse = { fromJSON(_: any): MsgCreateClawbackVestingAccountResponse { return {}; }, - toJSON(_: MsgCreateClawbackVestingAccountResponse): unknown { + toJSON(_: MsgCreateClawbackVestingAccountResponse): JsonSafe { const obj: any = {}; return obj; }, @@ -296,7 +297,7 @@ export const MsgClawback = { destAddress: isSet(object.destAddress) ? String(object.destAddress) : "" }; }, - toJSON(message: MsgClawback): unknown { + toJSON(message: MsgClawback): JsonSafe { const obj: any = {}; message.funderAddress !== undefined && (obj.funderAddress = message.funderAddress); message.accountAddress !== undefined && (obj.accountAddress = message.accountAddress); @@ -349,7 +350,7 @@ export const MsgClawbackResponse = { fromJSON(_: any): MsgClawbackResponse { return {}; }, - toJSON(_: MsgClawbackResponse): unknown { + toJSON(_: MsgClawbackResponse): JsonSafe { const obj: any = {}; return obj; }, diff --git a/__fixtures__/output1/evmos/vesting/v1/vesting.ts b/__fixtures__/output1/evmos/vesting/v1/vesting.ts index fd554da1a5..20e37cff88 100644 --- a/__fixtures__/output1/evmos/vesting/v1/vesting.ts +++ b/__fixtures__/output1/evmos/vesting/v1/vesting.ts @@ -2,6 +2,7 @@ import { BaseVestingAccount, BaseVestingAccountSDKType, Period, PeriodSDKType } import { Timestamp, TimestampSDKType } from "../../../google/protobuf/timestamp"; import * as _m0 from "protobufjs/minimal"; import { toTimestamp, fromTimestamp, isSet, fromJsonTimestamp, DeepPartial } from "../../../helpers"; +import { JsonSafe } from "../../../json-safe"; export const protobufPackage = "evmos.vesting.v1"; /** * ClawbackVestingAccount implements the VestingAccount interface. It provides @@ -103,7 +104,7 @@ export const ClawbackVestingAccount = { vestingPeriods: Array.isArray(object?.vestingPeriods) ? object.vestingPeriods.map((e: any) => Period.fromJSON(e)) : [] }; }, - toJSON(message: ClawbackVestingAccount): unknown { + toJSON(message: ClawbackVestingAccount): JsonSafe { const obj: any = {}; message.baseVestingAccount !== undefined && (obj.baseVestingAccount = message.baseVestingAccount ? BaseVestingAccount.toJSON(message.baseVestingAccount) : undefined); message.funderAddress !== undefined && (obj.funderAddress = message.funderAddress); diff --git a/__fixtures__/output1/google/api/auth.ts b/__fixtures__/output1/google/api/auth.ts index 9a4e551a23..c0fcc2eaa6 100644 --- a/__fixtures__/output1/google/api/auth.ts +++ b/__fixtures__/output1/google/api/auth.ts @@ -1,4 +1,5 @@ import * as _m0 from "protobufjs/minimal"; +import { JsonSafe } from "../../json-safe"; import { DeepPartial, isSet } from "../../helpers"; export const protobufPackage = "google.api"; /** @@ -360,7 +361,7 @@ export const Authentication = { providers: Array.isArray(object?.providers) ? object.providers.map((e: any) => AuthProvider.fromJSON(e)) : [] }; }, - toJSON(message: Authentication): unknown { + toJSON(message: Authentication): JsonSafe { const obj: any = {}; if (message.rules) { obj.rules = message.rules.map(e => e ? AuthenticationRule.toJSON(e) : undefined); @@ -459,7 +460,7 @@ export const AuthenticationRule = { requirements: Array.isArray(object?.requirements) ? object.requirements.map((e: any) => AuthRequirement.fromJSON(e)) : [] }; }, - toJSON(message: AuthenticationRule): unknown { + toJSON(message: AuthenticationRule): JsonSafe { const obj: any = {}; message.selector !== undefined && (obj.selector = message.selector); message.oauth !== undefined && (obj.oauth = message.oauth ? OAuthRequirements.toJSON(message.oauth) : undefined); @@ -550,7 +551,7 @@ export const JwtLocation = { valuePrefix: isSet(object.valuePrefix) ? String(object.valuePrefix) : "" }; }, - toJSON(message: JwtLocation): unknown { + toJSON(message: JwtLocation): JsonSafe { const obj: any = {}; message.header !== undefined && (obj.header = message.header); message.query !== undefined && (obj.query = message.query); @@ -653,7 +654,7 @@ export const AuthProvider = { jwtLocations: Array.isArray(object?.jwtLocations) ? object.jwtLocations.map((e: any) => JwtLocation.fromJSON(e)) : [] }; }, - toJSON(message: AuthProvider): unknown { + toJSON(message: AuthProvider): JsonSafe { const obj: any = {}; message.id !== undefined && (obj.id = message.id); message.issuer !== undefined && (obj.issuer = message.issuer); @@ -736,7 +737,7 @@ export const OAuthRequirements = { canonicalScopes: isSet(object.canonicalScopes) ? String(object.canonicalScopes) : "" }; }, - toJSON(message: OAuthRequirements): unknown { + toJSON(message: OAuthRequirements): JsonSafe { const obj: any = {}; message.canonicalScopes !== undefined && (obj.canonicalScopes = message.canonicalScopes); return obj; @@ -799,7 +800,7 @@ export const AuthRequirement = { audiences: isSet(object.audiences) ? String(object.audiences) : "" }; }, - toJSON(message: AuthRequirement): unknown { + toJSON(message: AuthRequirement): JsonSafe { const obj: any = {}; message.providerId !== undefined && (obj.providerId = message.providerId); message.audiences !== undefined && (obj.audiences = message.audiences); diff --git a/__fixtures__/output1/google/api/backend.ts b/__fixtures__/output1/google/api/backend.ts index 44fea9fac9..921b276364 100644 --- a/__fixtures__/output1/google/api/backend.ts +++ b/__fixtures__/output1/google/api/backend.ts @@ -1,4 +1,5 @@ import * as _m0 from "protobufjs/minimal"; +import { JsonSafe } from "../../json-safe"; import { DeepPartial, isSet } from "../../helpers"; export const protobufPackage = "google.api"; /** @@ -237,7 +238,7 @@ export const Backend = { rules: Array.isArray(object?.rules) ? object.rules.map((e: any) => BackendRule.fromJSON(e)) : [] }; }, - toJSON(message: Backend): unknown { + toJSON(message: Backend): JsonSafe { const obj: any = {}; if (message.rules) { obj.rules = message.rules.map(e => e ? BackendRule.toJSON(e) : undefined); @@ -364,7 +365,7 @@ export const BackendRule = { protocol: isSet(object.protocol) ? String(object.protocol) : "" }; }, - toJSON(message: BackendRule): unknown { + toJSON(message: BackendRule): JsonSafe { const obj: any = {}; message.selector !== undefined && (obj.selector = message.selector); message.address !== undefined && (obj.address = message.address); diff --git a/__fixtures__/output1/google/api/billing.ts b/__fixtures__/output1/google/api/billing.ts index 45f910e21d..25409ce18a 100644 --- a/__fixtures__/output1/google/api/billing.ts +++ b/__fixtures__/output1/google/api/billing.ts @@ -1,4 +1,5 @@ import * as _m0 from "protobufjs/minimal"; +import { JsonSafe } from "../../json-safe"; import { DeepPartial, isSet } from "../../helpers"; export const protobufPackage = "google.api"; /** @@ -139,7 +140,7 @@ export const Billing = { consumerDestinations: Array.isArray(object?.consumerDestinations) ? object.consumerDestinations.map((e: any) => Billing_BillingDestination.fromJSON(e)) : [] }; }, - toJSON(message: Billing): unknown { + toJSON(message: Billing): JsonSafe { const obj: any = {}; if (message.consumerDestinations) { obj.consumerDestinations = message.consumerDestinations.map(e => e ? Billing_BillingDestination.toJSON(e) : undefined); @@ -210,7 +211,7 @@ export const Billing_BillingDestination = { metrics: Array.isArray(object?.metrics) ? object.metrics.map((e: any) => String(e)) : [] }; }, - toJSON(message: Billing_BillingDestination): unknown { + toJSON(message: Billing_BillingDestination): JsonSafe { const obj: any = {}; message.monitoredResource !== undefined && (obj.monitoredResource = message.monitoredResource); if (message.metrics) { diff --git a/__fixtures__/output1/google/api/config_change.ts b/__fixtures__/output1/google/api/config_change.ts index e546c135e0..88f9e2c2c0 100644 --- a/__fixtures__/output1/google/api/config_change.ts +++ b/__fixtures__/output1/google/api/config_change.ts @@ -1,5 +1,6 @@ import * as _m0 from "protobufjs/minimal"; import { isSet, DeepPartial } from "../../helpers"; +import { JsonSafe } from "../../json-safe"; export const protobufPackage = "google.api"; /** * Classifies set of possible modifications to an object in the service @@ -199,7 +200,7 @@ export const ConfigChange = { advices: Array.isArray(object?.advices) ? object.advices.map((e: any) => Advice.fromJSON(e)) : [] }; }, - toJSON(message: ConfigChange): unknown { + toJSON(message: ConfigChange): JsonSafe { const obj: any = {}; message.element !== undefined && (obj.element = message.element); message.oldValue !== undefined && (obj.oldValue = message.oldValue); @@ -278,7 +279,7 @@ export const Advice = { description: isSet(object.description) ? String(object.description) : "" }; }, - toJSON(message: Advice): unknown { + toJSON(message: Advice): JsonSafe { const obj: any = {}; message.description !== undefined && (obj.description = message.description); return obj; diff --git a/__fixtures__/output1/google/api/consumer.ts b/__fixtures__/output1/google/api/consumer.ts index df569be4f6..fc62fb9883 100644 --- a/__fixtures__/output1/google/api/consumer.ts +++ b/__fixtures__/output1/google/api/consumer.ts @@ -1,4 +1,5 @@ import * as _m0 from "protobufjs/minimal"; +import { JsonSafe } from "../../json-safe"; import { DeepPartial, isSet } from "../../helpers"; export const protobufPackage = "google.api"; /** Supported data type of the property values */ @@ -170,7 +171,7 @@ export const ProjectProperties = { properties: Array.isArray(object?.properties) ? object.properties.map((e: any) => Property.fromJSON(e)) : [] }; }, - toJSON(message: ProjectProperties): unknown { + toJSON(message: ProjectProperties): JsonSafe { const obj: any = {}; if (message.properties) { obj.properties = message.properties.map(e => e ? Property.toJSON(e) : undefined); @@ -249,7 +250,7 @@ export const Property = { description: isSet(object.description) ? String(object.description) : "" }; }, - toJSON(message: Property): unknown { + toJSON(message: Property): JsonSafe { const obj: any = {}; message.name !== undefined && (obj.name = message.name); message.type !== undefined && (obj.type = property_PropertyTypeToJSON(message.type)); diff --git a/__fixtures__/output1/google/api/context.ts b/__fixtures__/output1/google/api/context.ts index e94210e5e0..36bc33cfc1 100644 --- a/__fixtures__/output1/google/api/context.ts +++ b/__fixtures__/output1/google/api/context.ts @@ -1,4 +1,5 @@ import * as _m0 from "protobufjs/minimal"; +import { JsonSafe } from "../../json-safe"; import { DeepPartial, isSet } from "../../helpers"; export const protobufPackage = "google.api"; /** @@ -159,7 +160,7 @@ export const Context = { rules: Array.isArray(object?.rules) ? object.rules.map((e: any) => ContextRule.fromJSON(e)) : [] }; }, - toJSON(message: Context): unknown { + toJSON(message: Context): JsonSafe { const obj: any = {}; if (message.rules) { obj.rules = message.rules.map(e => e ? ContextRule.toJSON(e) : undefined); @@ -254,7 +255,7 @@ export const ContextRule = { allowedResponseExtensions: Array.isArray(object?.allowedResponseExtensions) ? object.allowedResponseExtensions.map((e: any) => String(e)) : [] }; }, - toJSON(message: ContextRule): unknown { + toJSON(message: ContextRule): JsonSafe { const obj: any = {}; message.selector !== undefined && (obj.selector = message.selector); if (message.requested) { diff --git a/__fixtures__/output1/google/api/control.ts b/__fixtures__/output1/google/api/control.ts index 0ba650dae6..3b305097c4 100644 --- a/__fixtures__/output1/google/api/control.ts +++ b/__fixtures__/output1/google/api/control.ts @@ -1,5 +1,6 @@ import * as _m0 from "protobufjs/minimal"; import { isSet, DeepPartial } from "../../helpers"; +import { JsonSafe } from "../../json-safe"; export const protobufPackage = "google.api"; /** * Selects and configures the service controller used by the service. The @@ -55,7 +56,7 @@ export const Control = { environment: isSet(object.environment) ? String(object.environment) : "" }; }, - toJSON(message: Control): unknown { + toJSON(message: Control): JsonSafe { const obj: any = {}; message.environment !== undefined && (obj.environment = message.environment); return obj; diff --git a/__fixtures__/output1/google/api/distribution.ts b/__fixtures__/output1/google/api/distribution.ts index f0e53f6557..9e6780d63e 100644 --- a/__fixtures__/output1/google/api/distribution.ts +++ b/__fixtures__/output1/google/api/distribution.ts @@ -2,6 +2,7 @@ import { Timestamp, TimestampSDKType } from "../protobuf/timestamp"; import { Any, AnySDKType } from "../protobuf/any"; import { Long, isSet, DeepPartial, toTimestamp, fromTimestamp, fromJsonTimestamp } from "../../helpers"; import * as _m0 from "protobufjs/minimal"; +import { JsonSafe } from "../../json-safe"; export const protobufPackage = "google.api"; /** * `Distribution` contains summary statistics for a population of values. It @@ -394,7 +395,7 @@ export const Distribution = { exemplars: Array.isArray(object?.exemplars) ? object.exemplars.map((e: any) => Distribution_Exemplar.fromJSON(e)) : [] }; }, - toJSON(message: Distribution): unknown { + toJSON(message: Distribution): JsonSafe { const obj: any = {}; message.count !== undefined && (obj.count = (message.count || Long.ZERO).toString()); message.mean !== undefined && (obj.mean = message.mean); @@ -497,7 +498,7 @@ export const Distribution_Range = { max: isSet(object.max) ? Number(object.max) : 0 }; }, - toJSON(message: Distribution_Range): unknown { + toJSON(message: Distribution_Range): JsonSafe { const obj: any = {}; message.min !== undefined && (obj.min = message.min); message.max !== undefined && (obj.max = message.max); @@ -572,7 +573,7 @@ export const Distribution_BucketOptions = { explicitBuckets: isSet(object.explicitBuckets) ? Distribution_BucketOptions_Explicit.fromJSON(object.explicitBuckets) : undefined }; }, - toJSON(message: Distribution_BucketOptions): unknown { + toJSON(message: Distribution_BucketOptions): JsonSafe { const obj: any = {}; message.linearBuckets !== undefined && (obj.linearBuckets = message.linearBuckets ? Distribution_BucketOptions_Linear.toJSON(message.linearBuckets) : undefined); message.exponentialBuckets !== undefined && (obj.exponentialBuckets = message.exponentialBuckets ? Distribution_BucketOptions_Exponential.toJSON(message.exponentialBuckets) : undefined); @@ -651,7 +652,7 @@ export const Distribution_BucketOptions_Linear = { offset: isSet(object.offset) ? Number(object.offset) : 0 }; }, - toJSON(message: Distribution_BucketOptions_Linear): unknown { + toJSON(message: Distribution_BucketOptions_Linear): JsonSafe { const obj: any = {}; message.numFiniteBuckets !== undefined && (obj.numFiniteBuckets = Math.round(message.numFiniteBuckets)); message.width !== undefined && (obj.width = message.width); @@ -730,7 +731,7 @@ export const Distribution_BucketOptions_Exponential = { scale: isSet(object.scale) ? Number(object.scale) : 0 }; }, - toJSON(message: Distribution_BucketOptions_Exponential): unknown { + toJSON(message: Distribution_BucketOptions_Exponential): JsonSafe { const obj: any = {}; message.numFiniteBuckets !== undefined && (obj.numFiniteBuckets = Math.round(message.numFiniteBuckets)); message.growthFactor !== undefined && (obj.growthFactor = message.growthFactor); @@ -802,7 +803,7 @@ export const Distribution_BucketOptions_Explicit = { bounds: Array.isArray(object?.bounds) ? object.bounds.map((e: any) => Number(e)) : [] }; }, - toJSON(message: Distribution_BucketOptions_Explicit): unknown { + toJSON(message: Distribution_BucketOptions_Explicit): JsonSafe { const obj: any = {}; if (message.bounds) { obj.bounds = message.bounds.map(e => e); @@ -881,7 +882,7 @@ export const Distribution_Exemplar = { attachments: Array.isArray(object?.attachments) ? object.attachments.map((e: any) => Any.fromJSON(e)) : [] }; }, - toJSON(message: Distribution_Exemplar): unknown { + toJSON(message: Distribution_Exemplar): JsonSafe { const obj: any = {}; message.value !== undefined && (obj.value = message.value); message.timestamp !== undefined && (obj.timestamp = message.timestamp.toISOString()); diff --git a/__fixtures__/output1/google/api/documentation.ts b/__fixtures__/output1/google/api/documentation.ts index 8ddacd703e..5dd8dc8df2 100644 --- a/__fixtures__/output1/google/api/documentation.ts +++ b/__fixtures__/output1/google/api/documentation.ts @@ -1,5 +1,6 @@ import * as _m0 from "protobufjs/minimal"; import { isSet, DeepPartial } from "../../helpers"; +import { JsonSafe } from "../../json-safe"; export const protobufPackage = "google.api"; /** * `Documentation` provides the information for describing a service. @@ -304,7 +305,7 @@ export const Documentation = { overview: isSet(object.overview) ? String(object.overview) : "" }; }, - toJSON(message: Documentation): unknown { + toJSON(message: Documentation): JsonSafe { const obj: any = {}; message.summary !== undefined && (obj.summary = message.summary); if (message.pages) { @@ -411,7 +412,7 @@ export const DocumentationRule = { deprecationDescription: isSet(object.deprecationDescription) ? String(object.deprecationDescription) : "" }; }, - toJSON(message: DocumentationRule): unknown { + toJSON(message: DocumentationRule): JsonSafe { const obj: any = {}; message.selector !== undefined && (obj.selector = message.selector); message.description !== undefined && (obj.description = message.description); @@ -490,7 +491,7 @@ export const Page = { subpages: Array.isArray(object?.subpages) ? object.subpages.map((e: any) => Page.fromJSON(e)) : [] }; }, - toJSON(message: Page): unknown { + toJSON(message: Page): JsonSafe { const obj: any = {}; message.name !== undefined && (obj.name = message.name); message.content !== undefined && (obj.content = message.content); diff --git a/__fixtures__/output1/google/api/endpoint.ts b/__fixtures__/output1/google/api/endpoint.ts index b75dfa4bec..a97d6dce12 100644 --- a/__fixtures__/output1/google/api/endpoint.ts +++ b/__fixtures__/output1/google/api/endpoint.ts @@ -1,5 +1,6 @@ import * as _m0 from "protobufjs/minimal"; import { isSet, DeepPartial } from "../../helpers"; +import { JsonSafe } from "../../json-safe"; export const protobufPackage = "google.api"; /** * `Endpoint` describes a network endpoint of a service that serves a set of @@ -134,7 +135,7 @@ export const Endpoint = { allowCors: isSet(object.allowCors) ? Boolean(object.allowCors) : false }; }, - toJSON(message: Endpoint): unknown { + toJSON(message: Endpoint): JsonSafe { const obj: any = {}; message.name !== undefined && (obj.name = message.name); if (message.aliases) { diff --git a/__fixtures__/output1/google/api/expr/conformance/v1alpha1/conformance_service.ts b/__fixtures__/output1/google/api/expr/conformance/v1alpha1/conformance_service.ts index 55636c139c..2b4e208d98 100644 --- a/__fixtures__/output1/google/api/expr/conformance/v1alpha1/conformance_service.ts +++ b/__fixtures__/output1/google/api/expr/conformance/v1alpha1/conformance_service.ts @@ -4,6 +4,7 @@ import { ExprValue, ExprValueSDKType } from "../../v1alpha1/eval"; import { Status, StatusSDKType } from "../../../../rpc/status"; import { Long, isSet, DeepPartial, isObject } from "../../../../../helpers"; import * as _m0 from "protobufjs/minimal"; +import { JsonSafe } from "../../../../../json-safe"; export const protobufPackage = "google.api.expr.conformance.v1alpha1"; /** Severities of issues. */ export enum IssueDetails_Severity { @@ -258,7 +259,7 @@ export const ParseRequest = { disableMacros: isSet(object.disableMacros) ? Boolean(object.disableMacros) : false }; }, - toJSON(message: ParseRequest): unknown { + toJSON(message: ParseRequest): JsonSafe { const obj: any = {}; message.celSource !== undefined && (obj.celSource = message.celSource); message.syntaxVersion !== undefined && (obj.syntaxVersion = message.syntaxVersion); @@ -333,7 +334,7 @@ export const ParseResponse = { issues: Array.isArray(object?.issues) ? object.issues.map((e: any) => Status.fromJSON(e)) : [] }; }, - toJSON(message: ParseResponse): unknown { + toJSON(message: ParseResponse): JsonSafe { const obj: any = {}; message.parsedExpr !== undefined && (obj.parsedExpr = message.parsedExpr ? ParsedExpr.toJSON(message.parsedExpr) : undefined); if (message.issues) { @@ -424,7 +425,7 @@ export const CheckRequest = { noStdEnv: isSet(object.noStdEnv) ? Boolean(object.noStdEnv) : false }; }, - toJSON(message: CheckRequest): unknown { + toJSON(message: CheckRequest): JsonSafe { const obj: any = {}; message.parsedExpr !== undefined && (obj.parsedExpr = message.parsedExpr ? ParsedExpr.toJSON(message.parsedExpr) : undefined); if (message.typeEnv) { @@ -507,7 +508,7 @@ export const CheckResponse = { issues: Array.isArray(object?.issues) ? object.issues.map((e: any) => Status.fromJSON(e)) : [] }; }, - toJSON(message: CheckResponse): unknown { + toJSON(message: CheckResponse): JsonSafe { const obj: any = {}; message.checkedExpr !== undefined && (obj.checkedExpr = message.checkedExpr ? CheckedExpr.toJSON(message.checkedExpr) : undefined); if (message.issues) { @@ -582,7 +583,7 @@ export const EvalRequest_BindingsEntry = { value: isSet(object.value) ? ExprValue.fromJSON(object.value) : undefined }; }, - toJSON(message: EvalRequest_BindingsEntry): unknown { + toJSON(message: EvalRequest_BindingsEntry): JsonSafe { const obj: any = {}; message.key !== undefined && (obj.key = message.key); message.value !== undefined && (obj.value = message.value ? ExprValue.toJSON(message.value) : undefined); @@ -676,7 +677,7 @@ export const EvalRequest = { container: isSet(object.container) ? String(object.container) : "" }; }, - toJSON(message: EvalRequest): unknown { + toJSON(message: EvalRequest): JsonSafe { const obj: any = {}; message.parsedExpr !== undefined && (obj.parsedExpr = message.parsedExpr ? ParsedExpr.toJSON(message.parsedExpr) : undefined); message.checkedExpr !== undefined && (obj.checkedExpr = message.checkedExpr ? CheckedExpr.toJSON(message.checkedExpr) : undefined); @@ -773,7 +774,7 @@ export const EvalResponse = { issues: Array.isArray(object?.issues) ? object.issues.map((e: any) => Status.fromJSON(e)) : [] }; }, - toJSON(message: EvalResponse): unknown { + toJSON(message: EvalResponse): JsonSafe { const obj: any = {}; message.result !== undefined && (obj.result = message.result ? ExprValue.toJSON(message.result) : undefined); if (message.issues) { @@ -856,7 +857,7 @@ export const IssueDetails = { id: isSet(object.id) ? Long.fromValue(object.id) : Long.ZERO }; }, - toJSON(message: IssueDetails): unknown { + toJSON(message: IssueDetails): JsonSafe { const obj: any = {}; message.severity !== undefined && (obj.severity = issueDetails_SeverityToJSON(message.severity)); message.position !== undefined && (obj.position = message.position ? SourcePosition.toJSON(message.position) : undefined); diff --git a/__fixtures__/output1/google/api/expr/v1alpha1/checked.ts b/__fixtures__/output1/google/api/expr/v1alpha1/checked.ts index f623e6ab76..bcc69f4c67 100644 --- a/__fixtures__/output1/google/api/expr/v1alpha1/checked.ts +++ b/__fixtures__/output1/google/api/expr/v1alpha1/checked.ts @@ -3,6 +3,7 @@ import { Empty, EmptySDKType } from "../../../protobuf/empty"; import { NullValue, NullValueSDKType, nullValueFromJSON, nullValueToJSON } from "../../../protobuf/struct"; import { Long, isSet, DeepPartial, isObject } from "../../../../helpers"; import * as _m0 from "protobufjs/minimal"; +import { JsonSafe } from "../../../../json-safe"; export const protobufPackage = "google.api.expr.v1alpha1"; /** CEL primitive types. */ export enum Type_PrimitiveType { @@ -565,7 +566,7 @@ export const CheckedExpr_ReferenceMapEntry = { value: isSet(object.value) ? Reference.fromJSON(object.value) : undefined }; }, - toJSON(message: CheckedExpr_ReferenceMapEntry): unknown { + toJSON(message: CheckedExpr_ReferenceMapEntry): JsonSafe { const obj: any = {}; message.key !== undefined && (obj.key = (message.key || Long.ZERO).toString()); message.value !== undefined && (obj.value = message.value ? Reference.toJSON(message.value) : undefined); @@ -632,7 +633,7 @@ export const CheckedExpr_TypeMapEntry = { value: isSet(object.value) ? Type.fromJSON(object.value) : undefined }; }, - toJSON(message: CheckedExpr_TypeMapEntry): unknown { + toJSON(message: CheckedExpr_TypeMapEntry): JsonSafe { const obj: any = {}; message.key !== undefined && (obj.key = (message.key || Long.ZERO).toString()); message.value !== undefined && (obj.value = message.value ? Type.toJSON(message.value) : undefined); @@ -745,7 +746,7 @@ export const CheckedExpr = { expr: isSet(object.expr) ? Expr.fromJSON(object.expr) : undefined }; }, - toJSON(message: CheckedExpr): unknown { + toJSON(message: CheckedExpr): JsonSafe { const obj: any = {}; obj.referenceMap = {}; if (message.referenceMap) { @@ -956,7 +957,7 @@ export const Type = { abstractType: isSet(object.abstractType) ? Type_AbstractType.fromJSON(object.abstractType) : undefined }; }, - toJSON(message: Type): unknown { + toJSON(message: Type): JsonSafe { const obj: any = {}; message.dyn !== undefined && (obj.dyn = message.dyn ? Empty.toJSON(message.dyn) : undefined); message.null !== undefined && (obj.null = nullValueToJSON(message.null)); @@ -1059,7 +1060,7 @@ export const Type_ListType = { elemType: isSet(object.elemType) ? Type.fromJSON(object.elemType) : undefined }; }, - toJSON(message: Type_ListType): unknown { + toJSON(message: Type_ListType): JsonSafe { const obj: any = {}; message.elemType !== undefined && (obj.elemType = message.elemType ? Type.toJSON(message.elemType) : undefined); return obj; @@ -1122,7 +1123,7 @@ export const Type_MapType = { valueType: isSet(object.valueType) ? Type.fromJSON(object.valueType) : undefined }; }, - toJSON(message: Type_MapType): unknown { + toJSON(message: Type_MapType): JsonSafe { const obj: any = {}; message.keyType !== undefined && (obj.keyType = message.keyType ? Type.toJSON(message.keyType) : undefined); message.valueType !== undefined && (obj.valueType = message.valueType ? Type.toJSON(message.valueType) : undefined); @@ -1189,7 +1190,7 @@ export const Type_FunctionType = { argTypes: Array.isArray(object?.argTypes) ? object.argTypes.map((e: any) => Type.fromJSON(e)) : [] }; }, - toJSON(message: Type_FunctionType): unknown { + toJSON(message: Type_FunctionType): JsonSafe { const obj: any = {}; message.resultType !== undefined && (obj.resultType = message.resultType ? Type.toJSON(message.resultType) : undefined); if (message.argTypes) { @@ -1264,7 +1265,7 @@ export const Type_AbstractType = { parameterTypes: Array.isArray(object?.parameterTypes) ? object.parameterTypes.map((e: any) => Type.fromJSON(e)) : [] }; }, - toJSON(message: Type_AbstractType): unknown { + toJSON(message: Type_AbstractType): JsonSafe { const obj: any = {}; message.name !== undefined && (obj.name = message.name); if (message.parameterTypes) { @@ -1347,7 +1348,7 @@ export const Decl = { function: isSet(object.function) ? Decl_FunctionDecl.fromJSON(object.function) : undefined }; }, - toJSON(message: Decl): unknown { + toJSON(message: Decl): JsonSafe { const obj: any = {}; message.name !== undefined && (obj.name = message.name); message.ident !== undefined && (obj.ident = message.ident ? Decl_IdentDecl.toJSON(message.ident) : undefined); @@ -1426,7 +1427,7 @@ export const Decl_IdentDecl = { doc: isSet(object.doc) ? String(object.doc) : "" }; }, - toJSON(message: Decl_IdentDecl): unknown { + toJSON(message: Decl_IdentDecl): JsonSafe { const obj: any = {}; message.type !== undefined && (obj.type = message.type ? Type.toJSON(message.type) : undefined); message.value !== undefined && (obj.value = message.value ? Constant.toJSON(message.value) : undefined); @@ -1489,7 +1490,7 @@ export const Decl_FunctionDecl = { overloads: Array.isArray(object?.overloads) ? object.overloads.map((e: any) => Decl_FunctionDecl_Overload.fromJSON(e)) : [] }; }, - toJSON(message: Decl_FunctionDecl): unknown { + toJSON(message: Decl_FunctionDecl): JsonSafe { const obj: any = {}; if (message.overloads) { obj.overloads = message.overloads.map(e => e ? Decl_FunctionDecl_Overload.toJSON(e) : undefined); @@ -1592,7 +1593,7 @@ export const Decl_FunctionDecl_Overload = { doc: isSet(object.doc) ? String(object.doc) : "" }; }, - toJSON(message: Decl_FunctionDecl_Overload): unknown { + toJSON(message: Decl_FunctionDecl_Overload): JsonSafe { const obj: any = {}; message.overloadId !== undefined && (obj.overloadId = message.overloadId); if (message.params) { @@ -1699,7 +1700,7 @@ export const Reference = { value: isSet(object.value) ? Constant.fromJSON(object.value) : undefined }; }, - toJSON(message: Reference): unknown { + toJSON(message: Reference): JsonSafe { const obj: any = {}; message.name !== undefined && (obj.name = message.name); if (message.overloadId) { diff --git a/__fixtures__/output1/google/api/expr/v1alpha1/eval.ts b/__fixtures__/output1/google/api/expr/v1alpha1/eval.ts index 9590785871..54302a9303 100644 --- a/__fixtures__/output1/google/api/expr/v1alpha1/eval.ts +++ b/__fixtures__/output1/google/api/expr/v1alpha1/eval.ts @@ -2,6 +2,7 @@ import { Value, ValueSDKType } from "./value"; import { Status, StatusSDKType } from "../../../rpc/status"; import { Long, DeepPartial, isSet } from "../../../../helpers"; import * as _m0 from "protobufjs/minimal"; +import { JsonSafe } from "../../../../json-safe"; export const protobufPackage = "google.api.expr.v1alpha1"; /** * The state of an evaluation. @@ -173,7 +174,7 @@ export const EvalState = { results: Array.isArray(object?.results) ? object.results.map((e: any) => EvalState_Result.fromJSON(e)) : [] }; }, - toJSON(message: EvalState): unknown { + toJSON(message: EvalState): JsonSafe { const obj: any = {}; if (message.values) { obj.values = message.values.map(e => e ? ExprValue.toJSON(e) : undefined); @@ -256,7 +257,7 @@ export const EvalState_Result = { value: isSet(object.value) ? Long.fromValue(object.value) : Long.ZERO }; }, - toJSON(message: EvalState_Result): unknown { + toJSON(message: EvalState_Result): JsonSafe { const obj: any = {}; message.expr !== undefined && (obj.expr = (message.expr || Long.ZERO).toString()); message.value !== undefined && (obj.value = (message.value || Long.ZERO).toString()); @@ -331,7 +332,7 @@ export const ExprValue = { unknown: isSet(object.unknown) ? UnknownSet.fromJSON(object.unknown) : undefined }; }, - toJSON(message: ExprValue): unknown { + toJSON(message: ExprValue): JsonSafe { const obj: any = {}; message.value !== undefined && (obj.value = message.value ? Value.toJSON(message.value) : undefined); message.error !== undefined && (obj.error = message.error ? ErrorSet.toJSON(message.error) : undefined); @@ -394,7 +395,7 @@ export const ErrorSet = { errors: Array.isArray(object?.errors) ? object.errors.map((e: any) => Status.fromJSON(e)) : [] }; }, - toJSON(message: ErrorSet): unknown { + toJSON(message: ErrorSet): JsonSafe { const obj: any = {}; if (message.errors) { obj.errors = message.errors.map(e => e ? Status.toJSON(e) : undefined); @@ -466,7 +467,7 @@ export const UnknownSet = { exprs: Array.isArray(object?.exprs) ? object.exprs.map((e: any) => Long.fromValue(e)) : [] }; }, - toJSON(message: UnknownSet): unknown { + toJSON(message: UnknownSet): JsonSafe { const obj: any = {}; if (message.exprs) { obj.exprs = message.exprs.map(e => (e || Long.ZERO).toString()); diff --git a/__fixtures__/output1/google/api/expr/v1alpha1/explain.ts b/__fixtures__/output1/google/api/expr/v1alpha1/explain.ts index 975f8dd15e..91c352c5fc 100644 --- a/__fixtures__/output1/google/api/expr/v1alpha1/explain.ts +++ b/__fixtures__/output1/google/api/expr/v1alpha1/explain.ts @@ -1,6 +1,7 @@ import { Value, ValueSDKType } from "./value"; import { Long, DeepPartial, isSet } from "../../../../helpers"; import * as _m0 from "protobufjs/minimal"; +import { JsonSafe } from "../../../../json-safe"; export const protobufPackage = "google.api.expr.v1alpha1"; /** * Values of intermediate expressions produced when evaluating expression. @@ -87,7 +88,7 @@ export const Explain = { exprSteps: Array.isArray(object?.exprSteps) ? object.exprSteps.map((e: any) => Explain_ExprStep.fromJSON(e)) : [] }; }, - toJSON(message: Explain): unknown { + toJSON(message: Explain): JsonSafe { const obj: any = {}; if (message.values) { obj.values = message.values.map(e => e ? Value.toJSON(e) : undefined); @@ -170,7 +171,7 @@ export const Explain_ExprStep = { valueIndex: isSet(object.valueIndex) ? Number(object.valueIndex) : 0 }; }, - toJSON(message: Explain_ExprStep): unknown { + toJSON(message: Explain_ExprStep): JsonSafe { const obj: any = {}; message.id !== undefined && (obj.id = (message.id || Long.ZERO).toString()); message.valueIndex !== undefined && (obj.valueIndex = Math.round(message.valueIndex)); diff --git a/__fixtures__/output1/google/api/expr/v1alpha1/syntax.ts b/__fixtures__/output1/google/api/expr/v1alpha1/syntax.ts index 418d1efd47..3458bc47aa 100644 --- a/__fixtures__/output1/google/api/expr/v1alpha1/syntax.ts +++ b/__fixtures__/output1/google/api/expr/v1alpha1/syntax.ts @@ -3,6 +3,7 @@ import { Duration, DurationSDKType } from "../../../protobuf/duration"; import { Timestamp, TimestampSDKType } from "../../../protobuf/timestamp"; import { Long, isSet, DeepPartial, toTimestamp, fromTimestamp, bytesFromBase64, fromJsonTimestamp, base64FromBytes, isObject } from "../../../../helpers"; import * as _m0 from "protobufjs/minimal"; +import { JsonSafe } from "../../../../json-safe"; export const protobufPackage = "google.api.expr.v1alpha1"; /** An expression together with source information as returned by the parser. */ export interface ParsedExpr { @@ -522,7 +523,7 @@ export const ParsedExpr = { sourceInfo: isSet(object.sourceInfo) ? SourceInfo.fromJSON(object.sourceInfo) : undefined }; }, - toJSON(message: ParsedExpr): unknown { + toJSON(message: ParsedExpr): JsonSafe { const obj: any = {}; message.expr !== undefined && (obj.expr = message.expr ? Expr.toJSON(message.expr) : undefined); message.sourceInfo !== undefined && (obj.sourceInfo = message.sourceInfo ? SourceInfo.toJSON(message.sourceInfo) : undefined); @@ -637,7 +638,7 @@ export const Expr = { comprehensionExpr: isSet(object.comprehensionExpr) ? Expr_Comprehension.fromJSON(object.comprehensionExpr) : undefined }; }, - toJSON(message: Expr): unknown { + toJSON(message: Expr): JsonSafe { const obj: any = {}; message.id !== undefined && (obj.id = (message.id || Long.ZERO).toString()); message.constExpr !== undefined && (obj.constExpr = message.constExpr ? Constant.toJSON(message.constExpr) : undefined); @@ -720,7 +721,7 @@ export const Expr_Ident = { name: isSet(object.name) ? String(object.name) : "" }; }, - toJSON(message: Expr_Ident): unknown { + toJSON(message: Expr_Ident): JsonSafe { const obj: any = {}; message.name !== undefined && (obj.name = message.name); return obj; @@ -791,7 +792,7 @@ export const Expr_Select = { testOnly: isSet(object.testOnly) ? Boolean(object.testOnly) : false }; }, - toJSON(message: Expr_Select): unknown { + toJSON(message: Expr_Select): JsonSafe { const obj: any = {}; message.operand !== undefined && (obj.operand = message.operand ? Expr.toJSON(message.operand) : undefined); message.field !== undefined && (obj.field = message.field); @@ -870,7 +871,7 @@ export const Expr_Call = { args: Array.isArray(object?.args) ? object.args.map((e: any) => Expr.fromJSON(e)) : [] }; }, - toJSON(message: Expr_Call): unknown { + toJSON(message: Expr_Call): JsonSafe { const obj: any = {}; message.target !== undefined && (obj.target = message.target ? Expr.toJSON(message.target) : undefined); message.function !== undefined && (obj.function = message.function); @@ -941,7 +942,7 @@ export const Expr_CreateList = { elements: Array.isArray(object?.elements) ? object.elements.map((e: any) => Expr.fromJSON(e)) : [] }; }, - toJSON(message: Expr_CreateList): unknown { + toJSON(message: Expr_CreateList): JsonSafe { const obj: any = {}; if (message.elements) { obj.elements = message.elements.map(e => e ? Expr.toJSON(e) : undefined); @@ -1012,7 +1013,7 @@ export const Expr_CreateStruct = { entries: Array.isArray(object?.entries) ? object.entries.map((e: any) => Expr_CreateStruct_Entry.fromJSON(e)) : [] }; }, - toJSON(message: Expr_CreateStruct): unknown { + toJSON(message: Expr_CreateStruct): JsonSafe { const obj: any = {}; message.messageName !== undefined && (obj.messageName = message.messageName); if (message.entries) { @@ -1103,7 +1104,7 @@ export const Expr_CreateStruct_Entry = { value: isSet(object.value) ? Expr.fromJSON(object.value) : undefined }; }, - toJSON(message: Expr_CreateStruct_Entry): unknown { + toJSON(message: Expr_CreateStruct_Entry): JsonSafe { const obj: any = {}; message.id !== undefined && (obj.id = (message.id || Long.ZERO).toString()); message.fieldKey !== undefined && (obj.fieldKey = message.fieldKey); @@ -1218,7 +1219,7 @@ export const Expr_Comprehension = { result: isSet(object.result) ? Expr.fromJSON(object.result) : undefined }; }, - toJSON(message: Expr_Comprehension): unknown { + toJSON(message: Expr_Comprehension): JsonSafe { const obj: any = {}; message.iterVar !== undefined && (obj.iterVar = message.iterVar); message.iterRange !== undefined && (obj.iterRange = message.iterRange ? Expr.toJSON(message.iterRange) : undefined); @@ -1361,7 +1362,7 @@ export const Constant = { timestampValue: isSet(object.timestampValue) ? fromJsonTimestamp(object.timestampValue) : undefined }; }, - toJSON(message: Constant): unknown { + toJSON(message: Constant): JsonSafe { const obj: any = {}; message.nullValue !== undefined && (obj.nullValue = nullValueToJSON(message.nullValue)); message.boolValue !== undefined && (obj.boolValue = message.boolValue); @@ -1460,7 +1461,7 @@ export const SourceInfo_PositionsEntry = { value: isSet(object.value) ? Number(object.value) : 0 }; }, - toJSON(message: SourceInfo_PositionsEntry): unknown { + toJSON(message: SourceInfo_PositionsEntry): JsonSafe { const obj: any = {}; message.key !== undefined && (obj.key = (message.key || Long.ZERO).toString()); message.value !== undefined && (obj.value = Math.round(message.value)); @@ -1527,7 +1528,7 @@ export const SourceInfo_MacroCallsEntry = { value: isSet(object.value) ? Expr.fromJSON(object.value) : undefined }; }, - toJSON(message: SourceInfo_MacroCallsEntry): unknown { + toJSON(message: SourceInfo_MacroCallsEntry): JsonSafe { const obj: any = {}; message.key !== undefined && (obj.key = (message.key || Long.ZERO).toString()); message.value !== undefined && (obj.value = message.value ? Expr.toJSON(message.value) : undefined); @@ -1649,7 +1650,7 @@ export const SourceInfo = { }, {}) : {} }; }, - toJSON(message: SourceInfo): unknown { + toJSON(message: SourceInfo): JsonSafe { const obj: any = {}; message.syntaxVersion !== undefined && (obj.syntaxVersion = message.syntaxVersion); message.location !== undefined && (obj.location = message.location); @@ -1796,7 +1797,7 @@ export const SourcePosition = { column: isSet(object.column) ? Number(object.column) : 0 }; }, - toJSON(message: SourcePosition): unknown { + toJSON(message: SourcePosition): JsonSafe { const obj: any = {}; message.location !== undefined && (obj.location = message.location); message.offset !== undefined && (obj.offset = Math.round(message.offset)); diff --git a/__fixtures__/output1/google/api/expr/v1alpha1/value.ts b/__fixtures__/output1/google/api/expr/v1alpha1/value.ts index 2e8326f5e5..0e833f6b9a 100644 --- a/__fixtures__/output1/google/api/expr/v1alpha1/value.ts +++ b/__fixtures__/output1/google/api/expr/v1alpha1/value.ts @@ -2,6 +2,7 @@ import { NullValue, NullValueSDKType, nullValueFromJSON, nullValueToJSON } from import { Any, AnySDKType } from "../../../protobuf/any"; import { Long, isSet, bytesFromBase64, base64FromBytes, DeepPartial } from "../../../../helpers"; import * as _m0 from "protobufjs/minimal"; +import { JsonSafe } from "../../../../json-safe"; export const protobufPackage = "google.api.expr.v1alpha1"; /** * Represents a CEL value. @@ -249,7 +250,7 @@ export const Value = { typeValue: isSet(object.typeValue) ? String(object.typeValue) : undefined }; }, - toJSON(message: Value): unknown { + toJSON(message: Value): JsonSafe { const obj: any = {}; message.nullValue !== undefined && (obj.nullValue = nullValueToJSON(message.nullValue)); message.boolValue !== undefined && (obj.boolValue = message.boolValue); @@ -360,7 +361,7 @@ export const EnumValue = { value: isSet(object.value) ? Number(object.value) : 0 }; }, - toJSON(message: EnumValue): unknown { + toJSON(message: EnumValue): JsonSafe { const obj: any = {}; message.type !== undefined && (obj.type = message.type); message.value !== undefined && (obj.value = Math.round(message.value)); @@ -419,7 +420,7 @@ export const ListValue = { values: Array.isArray(object?.values) ? object.values.map((e: any) => Value.fromJSON(e)) : [] }; }, - toJSON(message: ListValue): unknown { + toJSON(message: ListValue): JsonSafe { const obj: any = {}; if (message.values) { obj.values = message.values.map(e => e ? Value.toJSON(e) : undefined); @@ -482,7 +483,7 @@ export const MapValue = { entries: Array.isArray(object?.entries) ? object.entries.map((e: any) => MapValue_Entry.fromJSON(e)) : [] }; }, - toJSON(message: MapValue): unknown { + toJSON(message: MapValue): JsonSafe { const obj: any = {}; if (message.entries) { obj.entries = message.entries.map(e => e ? MapValue_Entry.toJSON(e) : undefined); @@ -553,7 +554,7 @@ export const MapValue_Entry = { value: isSet(object.value) ? Value.fromJSON(object.value) : undefined }; }, - toJSON(message: MapValue_Entry): unknown { + toJSON(message: MapValue_Entry): JsonSafe { const obj: any = {}; message.key !== undefined && (obj.key = message.key ? Value.toJSON(message.key) : undefined); message.value !== undefined && (obj.value = message.value ? Value.toJSON(message.value) : undefined); diff --git a/__fixtures__/output1/google/api/expr/v1beta1/decl.ts b/__fixtures__/output1/google/api/expr/v1beta1/decl.ts index 57de71beaa..eb2ae7a8f0 100644 --- a/__fixtures__/output1/google/api/expr/v1beta1/decl.ts +++ b/__fixtures__/output1/google/api/expr/v1beta1/decl.ts @@ -1,6 +1,7 @@ import { Expr, ExprSDKType } from "./expr"; import * as _m0 from "protobufjs/minimal"; import { isSet, DeepPartial } from "../../../../helpers"; +import { JsonSafe } from "../../../../json-safe"; export const protobufPackage = "google.api.expr.v1beta1"; /** A declaration. */ export interface Decl { @@ -144,7 +145,7 @@ export const Decl = { function: isSet(object.function) ? FunctionDecl.fromJSON(object.function) : undefined }; }, - toJSON(message: Decl): unknown { + toJSON(message: Decl): JsonSafe { const obj: any = {}; message.id !== undefined && (obj.id = Math.round(message.id)); message.name !== undefined && (obj.name = message.name); @@ -231,7 +232,7 @@ export const DeclType = { typeParams: Array.isArray(object?.typeParams) ? object.typeParams.map((e: any) => DeclType.fromJSON(e)) : [] }; }, - toJSON(message: DeclType): unknown { + toJSON(message: DeclType): JsonSafe { const obj: any = {}; message.id !== undefined && (obj.id = Math.round(message.id)); message.type !== undefined && (obj.type = message.type); @@ -310,7 +311,7 @@ export const IdentDecl = { value: isSet(object.value) ? Expr.fromJSON(object.value) : undefined }; }, - toJSON(message: IdentDecl): unknown { + toJSON(message: IdentDecl): JsonSafe { const obj: any = {}; message.type !== undefined && (obj.type = message.type ? DeclType.toJSON(message.type) : undefined); message.value !== undefined && (obj.value = message.value ? Expr.toJSON(message.value) : undefined); @@ -385,7 +386,7 @@ export const FunctionDecl = { receiverFunction: isSet(object.receiverFunction) ? Boolean(object.receiverFunction) : false }; }, - toJSON(message: FunctionDecl): unknown { + toJSON(message: FunctionDecl): JsonSafe { const obj: any = {}; if (message.args) { obj.args = message.args.map(e => e ? IdentDecl.toJSON(e) : undefined); diff --git a/__fixtures__/output1/google/api/expr/v1beta1/eval.ts b/__fixtures__/output1/google/api/expr/v1beta1/eval.ts index 0709b49381..0e42dca794 100644 --- a/__fixtures__/output1/google/api/expr/v1beta1/eval.ts +++ b/__fixtures__/output1/google/api/expr/v1beta1/eval.ts @@ -1,6 +1,7 @@ import { Value, ValueSDKType } from "./value"; import { Status, StatusSDKType } from "../../../rpc/status"; import * as _m0 from "protobufjs/minimal"; +import { JsonSafe } from "../../../../json-safe"; import { DeepPartial, isSet } from "../../../../helpers"; export const protobufPackage = "google.api.expr.v1beta1"; /** @@ -182,7 +183,7 @@ export const EvalState = { results: Array.isArray(object?.results) ? object.results.map((e: any) => EvalState_Result.fromJSON(e)) : [] }; }, - toJSON(message: EvalState): unknown { + toJSON(message: EvalState): JsonSafe { const obj: any = {}; if (message.values) { obj.values = message.values.map(e => e ? ExprValue.toJSON(e) : undefined); @@ -265,7 +266,7 @@ export const EvalState_Result = { value: isSet(object.value) ? Number(object.value) : 0 }; }, - toJSON(message: EvalState_Result): unknown { + toJSON(message: EvalState_Result): JsonSafe { const obj: any = {}; message.expr !== undefined && (obj.expr = message.expr ? IdRef.toJSON(message.expr) : undefined); message.value !== undefined && (obj.value = Math.round(message.value)); @@ -340,7 +341,7 @@ export const ExprValue = { unknown: isSet(object.unknown) ? UnknownSet.fromJSON(object.unknown) : undefined }; }, - toJSON(message: ExprValue): unknown { + toJSON(message: ExprValue): JsonSafe { const obj: any = {}; message.value !== undefined && (obj.value = message.value ? Value.toJSON(message.value) : undefined); message.error !== undefined && (obj.error = message.error ? ErrorSet.toJSON(message.error) : undefined); @@ -403,7 +404,7 @@ export const ErrorSet = { errors: Array.isArray(object?.errors) ? object.errors.map((e: any) => Status.fromJSON(e)) : [] }; }, - toJSON(message: ErrorSet): unknown { + toJSON(message: ErrorSet): JsonSafe { const obj: any = {}; if (message.errors) { obj.errors = message.errors.map(e => e ? Status.toJSON(e) : undefined); @@ -466,7 +467,7 @@ export const UnknownSet = { exprs: Array.isArray(object?.exprs) ? object.exprs.map((e: any) => IdRef.fromJSON(e)) : [] }; }, - toJSON(message: UnknownSet): unknown { + toJSON(message: UnknownSet): JsonSafe { const obj: any = {}; if (message.exprs) { obj.exprs = message.exprs.map(e => e ? IdRef.toJSON(e) : undefined); @@ -529,7 +530,7 @@ export const IdRef = { id: isSet(object.id) ? Number(object.id) : 0 }; }, - toJSON(message: IdRef): unknown { + toJSON(message: IdRef): JsonSafe { const obj: any = {}; message.id !== undefined && (obj.id = Math.round(message.id)); return obj; diff --git a/__fixtures__/output1/google/api/expr/v1beta1/expr.ts b/__fixtures__/output1/google/api/expr/v1beta1/expr.ts index 6134590e0e..3e7d9b6ca3 100644 --- a/__fixtures__/output1/google/api/expr/v1beta1/expr.ts +++ b/__fixtures__/output1/google/api/expr/v1beta1/expr.ts @@ -2,6 +2,7 @@ import { SourceInfo, SourceInfoSDKType } from "./source"; import { NullValue, NullValueSDKType, nullValueFromJSON, nullValueToJSON } from "../../../protobuf/struct"; import { Long, isSet, DeepPartial, bytesFromBase64, base64FromBytes } from "../../../../helpers"; import * as _m0 from "protobufjs/minimal"; +import { JsonSafe } from "../../../../json-safe"; export const protobufPackage = "google.api.expr.v1beta1"; /** An expression together with source information as returned by the parser. */ export interface ParsedExpr { @@ -416,7 +417,7 @@ export const ParsedExpr = { syntaxVersion: isSet(object.syntaxVersion) ? String(object.syntaxVersion) : "" }; }, - toJSON(message: ParsedExpr): unknown { + toJSON(message: ParsedExpr): JsonSafe { const obj: any = {}; message.expr !== undefined && (obj.expr = message.expr ? Expr.toJSON(message.expr) : undefined); message.sourceInfo !== undefined && (obj.sourceInfo = message.sourceInfo ? SourceInfo.toJSON(message.sourceInfo) : undefined); @@ -535,7 +536,7 @@ export const Expr = { comprehensionExpr: isSet(object.comprehensionExpr) ? Expr_Comprehension.fromJSON(object.comprehensionExpr) : undefined }; }, - toJSON(message: Expr): unknown { + toJSON(message: Expr): JsonSafe { const obj: any = {}; message.id !== undefined && (obj.id = Math.round(message.id)); message.literalExpr !== undefined && (obj.literalExpr = message.literalExpr ? Literal.toJSON(message.literalExpr) : undefined); @@ -618,7 +619,7 @@ export const Expr_Ident = { name: isSet(object.name) ? String(object.name) : "" }; }, - toJSON(message: Expr_Ident): unknown { + toJSON(message: Expr_Ident): JsonSafe { const obj: any = {}; message.name !== undefined && (obj.name = message.name); return obj; @@ -689,7 +690,7 @@ export const Expr_Select = { testOnly: isSet(object.testOnly) ? Boolean(object.testOnly) : false }; }, - toJSON(message: Expr_Select): unknown { + toJSON(message: Expr_Select): JsonSafe { const obj: any = {}; message.operand !== undefined && (obj.operand = message.operand ? Expr.toJSON(message.operand) : undefined); message.field !== undefined && (obj.field = message.field); @@ -768,7 +769,7 @@ export const Expr_Call = { args: Array.isArray(object?.args) ? object.args.map((e: any) => Expr.fromJSON(e)) : [] }; }, - toJSON(message: Expr_Call): unknown { + toJSON(message: Expr_Call): JsonSafe { const obj: any = {}; message.target !== undefined && (obj.target = message.target ? Expr.toJSON(message.target) : undefined); message.function !== undefined && (obj.function = message.function); @@ -839,7 +840,7 @@ export const Expr_CreateList = { elements: Array.isArray(object?.elements) ? object.elements.map((e: any) => Expr.fromJSON(e)) : [] }; }, - toJSON(message: Expr_CreateList): unknown { + toJSON(message: Expr_CreateList): JsonSafe { const obj: any = {}; if (message.elements) { obj.elements = message.elements.map(e => e ? Expr.toJSON(e) : undefined); @@ -910,7 +911,7 @@ export const Expr_CreateStruct = { entries: Array.isArray(object?.entries) ? object.entries.map((e: any) => Expr_CreateStruct_Entry.fromJSON(e)) : [] }; }, - toJSON(message: Expr_CreateStruct): unknown { + toJSON(message: Expr_CreateStruct): JsonSafe { const obj: any = {}; message.type !== undefined && (obj.type = message.type); if (message.entries) { @@ -1001,7 +1002,7 @@ export const Expr_CreateStruct_Entry = { value: isSet(object.value) ? Expr.fromJSON(object.value) : undefined }; }, - toJSON(message: Expr_CreateStruct_Entry): unknown { + toJSON(message: Expr_CreateStruct_Entry): JsonSafe { const obj: any = {}; message.id !== undefined && (obj.id = Math.round(message.id)); message.fieldKey !== undefined && (obj.fieldKey = message.fieldKey); @@ -1116,7 +1117,7 @@ export const Expr_Comprehension = { result: isSet(object.result) ? Expr.fromJSON(object.result) : undefined }; }, - toJSON(message: Expr_Comprehension): unknown { + toJSON(message: Expr_Comprehension): JsonSafe { const obj: any = {}; message.iterVar !== undefined && (obj.iterVar = message.iterVar); message.iterRange !== undefined && (obj.iterRange = message.iterRange ? Expr.toJSON(message.iterRange) : undefined); @@ -1243,7 +1244,7 @@ export const Literal = { bytesValue: isSet(object.bytesValue) ? bytesFromBase64(object.bytesValue) : undefined }; }, - toJSON(message: Literal): unknown { + toJSON(message: Literal): JsonSafe { const obj: any = {}; message.nullValue !== undefined && (obj.nullValue = nullValueToJSON(message.nullValue)); message.boolValue !== undefined && (obj.boolValue = message.boolValue); diff --git a/__fixtures__/output1/google/api/expr/v1beta1/source.ts b/__fixtures__/output1/google/api/expr/v1beta1/source.ts index ba5f20ac4e..0d794603b9 100644 --- a/__fixtures__/output1/google/api/expr/v1beta1/source.ts +++ b/__fixtures__/output1/google/api/expr/v1beta1/source.ts @@ -1,5 +1,6 @@ import * as _m0 from "protobufjs/minimal"; import { isSet, DeepPartial, isObject } from "../../../../helpers"; +import { JsonSafe } from "../../../../json-safe"; export const protobufPackage = "google.api.expr.v1beta1"; export interface SourceInfo_PositionsEntry { key: number; @@ -109,7 +110,7 @@ export const SourceInfo_PositionsEntry = { value: isSet(object.value) ? Number(object.value) : 0 }; }, - toJSON(message: SourceInfo_PositionsEntry): unknown { + toJSON(message: SourceInfo_PositionsEntry): JsonSafe { const obj: any = {}; message.key !== undefined && (obj.key = Math.round(message.key)); message.value !== undefined && (obj.value = Math.round(message.value)); @@ -204,7 +205,7 @@ export const SourceInfo = { }, {}) : {} }; }, - toJSON(message: SourceInfo): unknown { + toJSON(message: SourceInfo): JsonSafe { const obj: any = {}; message.location !== undefined && (obj.location = message.location); if (message.lineOffsets) { @@ -321,7 +322,7 @@ export const SourcePosition = { column: isSet(object.column) ? Number(object.column) : 0 }; }, - toJSON(message: SourcePosition): unknown { + toJSON(message: SourcePosition): JsonSafe { const obj: any = {}; message.location !== undefined && (obj.location = message.location); message.offset !== undefined && (obj.offset = Math.round(message.offset)); diff --git a/__fixtures__/output1/google/api/expr/v1beta1/value.ts b/__fixtures__/output1/google/api/expr/v1beta1/value.ts index 9a58449ce6..f3807594ce 100644 --- a/__fixtures__/output1/google/api/expr/v1beta1/value.ts +++ b/__fixtures__/output1/google/api/expr/v1beta1/value.ts @@ -2,6 +2,7 @@ import { NullValue, NullValueSDKType, nullValueFromJSON, nullValueToJSON } from import { Any, AnySDKType } from "../../../protobuf/any"; import { Long, isSet, bytesFromBase64, base64FromBytes, DeepPartial } from "../../../../helpers"; import * as _m0 from "protobufjs/minimal"; +import { JsonSafe } from "../../../../json-safe"; export const protobufPackage = "google.api.expr.v1beta1"; /** * Represents a CEL value. @@ -249,7 +250,7 @@ export const Value = { typeValue: isSet(object.typeValue) ? String(object.typeValue) : undefined }; }, - toJSON(message: Value): unknown { + toJSON(message: Value): JsonSafe { const obj: any = {}; message.nullValue !== undefined && (obj.nullValue = nullValueToJSON(message.nullValue)); message.boolValue !== undefined && (obj.boolValue = message.boolValue); @@ -360,7 +361,7 @@ export const EnumValue = { value: isSet(object.value) ? Number(object.value) : 0 }; }, - toJSON(message: EnumValue): unknown { + toJSON(message: EnumValue): JsonSafe { const obj: any = {}; message.type !== undefined && (obj.type = message.type); message.value !== undefined && (obj.value = Math.round(message.value)); @@ -419,7 +420,7 @@ export const ListValue = { values: Array.isArray(object?.values) ? object.values.map((e: any) => Value.fromJSON(e)) : [] }; }, - toJSON(message: ListValue): unknown { + toJSON(message: ListValue): JsonSafe { const obj: any = {}; if (message.values) { obj.values = message.values.map(e => e ? Value.toJSON(e) : undefined); @@ -482,7 +483,7 @@ export const MapValue = { entries: Array.isArray(object?.entries) ? object.entries.map((e: any) => MapValue_Entry.fromJSON(e)) : [] }; }, - toJSON(message: MapValue): unknown { + toJSON(message: MapValue): JsonSafe { const obj: any = {}; if (message.entries) { obj.entries = message.entries.map(e => e ? MapValue_Entry.toJSON(e) : undefined); @@ -553,7 +554,7 @@ export const MapValue_Entry = { value: isSet(object.value) ? Value.fromJSON(object.value) : undefined }; }, - toJSON(message: MapValue_Entry): unknown { + toJSON(message: MapValue_Entry): JsonSafe { const obj: any = {}; message.key !== undefined && (obj.key = message.key ? Value.toJSON(message.key) : undefined); message.value !== undefined && (obj.value = message.value ? Value.toJSON(message.value) : undefined); diff --git a/__fixtures__/output1/google/api/http.ts b/__fixtures__/output1/google/api/http.ts index adadde1630..a97408d6a5 100644 --- a/__fixtures__/output1/google/api/http.ts +++ b/__fixtures__/output1/google/api/http.ts @@ -1,5 +1,6 @@ import * as _m0 from "protobufjs/minimal"; import { isSet, DeepPartial } from "../../helpers"; +import { JsonSafe } from "../../json-safe"; export const protobufPackage = "google.api"; /** * Defines the HTTP configuration for an API service. It contains a list of @@ -692,7 +693,7 @@ export const Http = { fullyDecodeReservedExpansion: isSet(object.fullyDecodeReservedExpansion) ? Boolean(object.fullyDecodeReservedExpansion) : false }; }, - toJSON(message: Http): unknown { + toJSON(message: Http): JsonSafe { const obj: any = {}; if (message.rules) { obj.rules = message.rules.map(e => e ? HttpRule.toJSON(e) : undefined); @@ -831,7 +832,7 @@ export const HttpRule = { additionalBindings: Array.isArray(object?.additionalBindings) ? object.additionalBindings.map((e: any) => HttpRule.fromJSON(e)) : [] }; }, - toJSON(message: HttpRule): unknown { + toJSON(message: HttpRule): JsonSafe { const obj: any = {}; message.selector !== undefined && (obj.selector = message.selector); message.get !== undefined && (obj.get = message.get); @@ -938,7 +939,7 @@ export const CustomHttpPattern = { path: isSet(object.path) ? String(object.path) : "" }; }, - toJSON(message: CustomHttpPattern): unknown { + toJSON(message: CustomHttpPattern): JsonSafe { const obj: any = {}; message.kind !== undefined && (obj.kind = message.kind); message.path !== undefined && (obj.path = message.path); diff --git a/__fixtures__/output1/google/api/httpbody.ts b/__fixtures__/output1/google/api/httpbody.ts index e7038a594a..05738d1106 100644 --- a/__fixtures__/output1/google/api/httpbody.ts +++ b/__fixtures__/output1/google/api/httpbody.ts @@ -1,6 +1,7 @@ import { Any, AnySDKType } from "../protobuf/any"; import * as _m0 from "protobufjs/minimal"; import { isSet, bytesFromBase64, base64FromBytes, DeepPartial } from "../../helpers"; +import { JsonSafe } from "../../json-safe"; export const protobufPackage = "google.api"; /** * Message that represents an arbitrary HTTP body. It should only be used for @@ -158,7 +159,7 @@ export const HttpBody = { extensions: Array.isArray(object?.extensions) ? object.extensions.map((e: any) => Any.fromJSON(e)) : [] }; }, - toJSON(message: HttpBody): unknown { + toJSON(message: HttpBody): JsonSafe { const obj: any = {}; message.contentType !== undefined && (obj.contentType = message.contentType); message.data !== undefined && (obj.data = base64FromBytes(message.data !== undefined ? message.data : new Uint8Array())); diff --git a/__fixtures__/output1/google/api/label.ts b/__fixtures__/output1/google/api/label.ts index f5e6dd05ad..8e04703b4e 100644 --- a/__fixtures__/output1/google/api/label.ts +++ b/__fixtures__/output1/google/api/label.ts @@ -1,5 +1,6 @@ import * as _m0 from "protobufjs/minimal"; import { isSet, DeepPartial } from "../../helpers"; +import { JsonSafe } from "../../json-safe"; export const protobufPackage = "google.api"; /** Value types that can be used as label values. */ export enum LabelDescriptor_ValueType { @@ -107,7 +108,7 @@ export const LabelDescriptor = { description: isSet(object.description) ? String(object.description) : "" }; }, - toJSON(message: LabelDescriptor): unknown { + toJSON(message: LabelDescriptor): JsonSafe { const obj: any = {}; message.key !== undefined && (obj.key = message.key); message.valueType !== undefined && (obj.valueType = labelDescriptor_ValueTypeToJSON(message.valueType)); diff --git a/__fixtures__/output1/google/api/log.ts b/__fixtures__/output1/google/api/log.ts index 8e1341f092..9dfad37409 100644 --- a/__fixtures__/output1/google/api/log.ts +++ b/__fixtures__/output1/google/api/log.ts @@ -1,6 +1,7 @@ import { LabelDescriptor, LabelDescriptorSDKType } from "./label"; import * as _m0 from "protobufjs/minimal"; import { isSet, DeepPartial } from "../../helpers"; +import { JsonSafe } from "../../json-safe"; export const protobufPackage = "google.api"; /** * A description of a log type. Example in YAML format: @@ -111,7 +112,7 @@ export const LogDescriptor = { displayName: isSet(object.displayName) ? String(object.displayName) : "" }; }, - toJSON(message: LogDescriptor): unknown { + toJSON(message: LogDescriptor): JsonSafe { const obj: any = {}; message.name !== undefined && (obj.name = message.name); if (message.labels) { diff --git a/__fixtures__/output1/google/api/logging.ts b/__fixtures__/output1/google/api/logging.ts index 3f139b4f86..24cba35d57 100644 --- a/__fixtures__/output1/google/api/logging.ts +++ b/__fixtures__/output1/google/api/logging.ts @@ -1,4 +1,5 @@ import * as _m0 from "protobufjs/minimal"; +import { JsonSafe } from "../../json-safe"; import { DeepPartial, isSet } from "../../helpers"; export const protobufPackage = "google.api"; /** @@ -151,7 +152,7 @@ export const Logging = { consumerDestinations: Array.isArray(object?.consumerDestinations) ? object.consumerDestinations.map((e: any) => Logging_LoggingDestination.fromJSON(e)) : [] }; }, - toJSON(message: Logging): unknown { + toJSON(message: Logging): JsonSafe { const obj: any = {}; if (message.producerDestinations) { obj.producerDestinations = message.producerDestinations.map(e => e ? Logging_LoggingDestination.toJSON(e) : undefined); @@ -234,7 +235,7 @@ export const Logging_LoggingDestination = { logs: Array.isArray(object?.logs) ? object.logs.map((e: any) => String(e)) : [] }; }, - toJSON(message: Logging_LoggingDestination): unknown { + toJSON(message: Logging_LoggingDestination): JsonSafe { const obj: any = {}; message.monitoredResource !== undefined && (obj.monitoredResource = message.monitoredResource); if (message.logs) { diff --git a/__fixtures__/output1/google/api/metric.ts b/__fixtures__/output1/google/api/metric.ts index 3b9a8a4275..2e51cf569e 100644 --- a/__fixtures__/output1/google/api/metric.ts +++ b/__fixtures__/output1/google/api/metric.ts @@ -3,6 +3,7 @@ import { Duration, DurationSDKType } from "../protobuf/duration"; import { LabelDescriptor, LabelDescriptorSDKType } from "./label"; import * as _m0 from "protobufjs/minimal"; import { isSet, DeepPartial, isObject } from "../../helpers"; +import { JsonSafe } from "../../json-safe"; export const protobufPackage = "google.api"; /** * The kind of measurement. It describes how the data is reported. @@ -496,7 +497,7 @@ export const MetricDescriptor = { monitoredResourceTypes: Array.isArray(object?.monitoredResourceTypes) ? object.monitoredResourceTypes.map((e: any) => String(e)) : [] }; }, - toJSON(message: MetricDescriptor): unknown { + toJSON(message: MetricDescriptor): JsonSafe { const obj: any = {}; message.name !== undefined && (obj.name = message.name); message.type !== undefined && (obj.type = message.type); @@ -623,7 +624,7 @@ export const MetricDescriptor_MetricDescriptorMetadata = { ingestDelay: isSet(object.ingestDelay) ? Duration.fromJSON(object.ingestDelay) : undefined }; }, - toJSON(message: MetricDescriptor_MetricDescriptorMetadata): unknown { + toJSON(message: MetricDescriptor_MetricDescriptorMetadata): JsonSafe { const obj: any = {}; message.launchStage !== undefined && (obj.launchStage = launchStageToJSON(message.launchStage)); message.samplePeriod !== undefined && (obj.samplePeriod = message.samplePeriod ? Duration.toJSON(message.samplePeriod) : undefined); @@ -694,7 +695,7 @@ export const Metric_LabelsEntry = { value: isSet(object.value) ? String(object.value) : "" }; }, - toJSON(message: Metric_LabelsEntry): unknown { + toJSON(message: Metric_LabelsEntry): JsonSafe { const obj: any = {}; message.key !== undefined && (obj.key = message.key); message.value !== undefined && (obj.value = message.value); @@ -772,7 +773,7 @@ export const Metric = { }, {}) : {} }; }, - toJSON(message: Metric): unknown { + toJSON(message: Metric): JsonSafe { const obj: any = {}; message.type !== undefined && (obj.type = message.type); obj.labels = {}; diff --git a/__fixtures__/output1/google/api/monitored_resource.ts b/__fixtures__/output1/google/api/monitored_resource.ts index f2ad370947..a03b6135f7 100644 --- a/__fixtures__/output1/google/api/monitored_resource.ts +++ b/__fixtures__/output1/google/api/monitored_resource.ts @@ -3,6 +3,7 @@ import { LaunchStage, LaunchStageSDKType, launchStageFromJSON, launchStageToJSON import { Struct, StructSDKType } from "../protobuf/struct"; import * as _m0 from "protobufjs/minimal"; import { isSet, DeepPartial, isObject } from "../../helpers"; +import { JsonSafe } from "../../json-safe"; export const protobufPackage = "google.api"; /** * An object that describes the schema of a [MonitoredResource][google.api.MonitoredResource] object using a @@ -253,7 +254,7 @@ export const MonitoredResourceDescriptor = { launchStage: isSet(object.launchStage) ? launchStageFromJSON(object.launchStage) : -1 }; }, - toJSON(message: MonitoredResourceDescriptor): unknown { + toJSON(message: MonitoredResourceDescriptor): JsonSafe { const obj: any = {}; message.name !== undefined && (obj.name = message.name); message.type !== undefined && (obj.type = message.type); @@ -344,7 +345,7 @@ export const MonitoredResource_LabelsEntry = { value: isSet(object.value) ? String(object.value) : "" }; }, - toJSON(message: MonitoredResource_LabelsEntry): unknown { + toJSON(message: MonitoredResource_LabelsEntry): JsonSafe { const obj: any = {}; message.key !== undefined && (obj.key = message.key); message.value !== undefined && (obj.value = message.value); @@ -422,7 +423,7 @@ export const MonitoredResource = { }, {}) : {} }; }, - toJSON(message: MonitoredResource): unknown { + toJSON(message: MonitoredResource): JsonSafe { const obj: any = {}; message.type !== undefined && (obj.type = message.type); obj.labels = {}; @@ -511,7 +512,7 @@ export const MonitoredResourceMetadata_UserLabelsEntry = { value: isSet(object.value) ? String(object.value) : "" }; }, - toJSON(message: MonitoredResourceMetadata_UserLabelsEntry): unknown { + toJSON(message: MonitoredResourceMetadata_UserLabelsEntry): JsonSafe { const obj: any = {}; message.key !== undefined && (obj.key = message.key); message.value !== undefined && (obj.value = message.value); @@ -589,7 +590,7 @@ export const MonitoredResourceMetadata = { }, {}) : {} }; }, - toJSON(message: MonitoredResourceMetadata): unknown { + toJSON(message: MonitoredResourceMetadata): JsonSafe { const obj: any = {}; message.systemLabels !== undefined && (obj.systemLabels = message.systemLabels ? Struct.toJSON(message.systemLabels) : undefined); obj.userLabels = {}; diff --git a/__fixtures__/output1/google/api/monitoring.ts b/__fixtures__/output1/google/api/monitoring.ts index 234ea76709..643590b327 100644 --- a/__fixtures__/output1/google/api/monitoring.ts +++ b/__fixtures__/output1/google/api/monitoring.ts @@ -1,4 +1,5 @@ import * as _m0 from "protobufjs/minimal"; +import { JsonSafe } from "../../json-safe"; import { DeepPartial, isSet } from "../../helpers"; export const protobufPackage = "google.api"; /** @@ -199,7 +200,7 @@ export const Monitoring = { consumerDestinations: Array.isArray(object?.consumerDestinations) ? object.consumerDestinations.map((e: any) => Monitoring_MonitoringDestination.fromJSON(e)) : [] }; }, - toJSON(message: Monitoring): unknown { + toJSON(message: Monitoring): JsonSafe { const obj: any = {}; if (message.producerDestinations) { obj.producerDestinations = message.producerDestinations.map(e => e ? Monitoring_MonitoringDestination.toJSON(e) : undefined); @@ -282,7 +283,7 @@ export const Monitoring_MonitoringDestination = { metrics: Array.isArray(object?.metrics) ? object.metrics.map((e: any) => String(e)) : [] }; }, - toJSON(message: Monitoring_MonitoringDestination): unknown { + toJSON(message: Monitoring_MonitoringDestination): JsonSafe { const obj: any = {}; message.monitoredResource !== undefined && (obj.monitoredResource = message.monitoredResource); if (message.metrics) { diff --git a/__fixtures__/output1/google/api/quota.ts b/__fixtures__/output1/google/api/quota.ts index 801ab975c7..2acd5f1267 100644 --- a/__fixtures__/output1/google/api/quota.ts +++ b/__fixtures__/output1/google/api/quota.ts @@ -1,5 +1,6 @@ import { Long, DeepPartial, isSet, isObject } from "../../helpers"; import * as _m0 from "protobufjs/minimal"; +import { JsonSafe } from "../../json-safe"; export const protobufPackage = "google.api"; /** * Quota configuration helps to achieve fairness and budgeting in service @@ -323,7 +324,7 @@ export const Quota = { metricRules: Array.isArray(object?.metricRules) ? object.metricRules.map((e: any) => MetricRule.fromJSON(e)) : [] }; }, - toJSON(message: Quota): unknown { + toJSON(message: Quota): JsonSafe { const obj: any = {}; if (message.limits) { obj.limits = message.limits.map(e => e ? QuotaLimit.toJSON(e) : undefined); @@ -406,7 +407,7 @@ export const MetricRule_MetricCostsEntry = { value: isSet(object.value) ? Long.fromValue(object.value) : Long.ZERO }; }, - toJSON(message: MetricRule_MetricCostsEntry): unknown { + toJSON(message: MetricRule_MetricCostsEntry): JsonSafe { const obj: any = {}; message.key !== undefined && (obj.key = message.key); message.value !== undefined && (obj.value = (message.value || Long.ZERO).toString()); @@ -484,7 +485,7 @@ export const MetricRule = { }, {}) : {} }; }, - toJSON(message: MetricRule): unknown { + toJSON(message: MetricRule): JsonSafe { const obj: any = {}; message.selector !== undefined && (obj.selector = message.selector); obj.metricCosts = {}; @@ -573,7 +574,7 @@ export const QuotaLimit_ValuesEntry = { value: isSet(object.value) ? Long.fromValue(object.value) : Long.ZERO }; }, - toJSON(message: QuotaLimit_ValuesEntry): unknown { + toJSON(message: QuotaLimit_ValuesEntry): JsonSafe { const obj: any = {}; message.key !== undefined && (obj.key = message.key); message.value !== undefined && (obj.value = (message.value || Long.ZERO).toString()); @@ -715,7 +716,7 @@ export const QuotaLimit = { displayName: isSet(object.displayName) ? String(object.displayName) : "" }; }, - toJSON(message: QuotaLimit): unknown { + toJSON(message: QuotaLimit): JsonSafe { const obj: any = {}; message.name !== undefined && (obj.name = message.name); message.description !== undefined && (obj.description = message.description); diff --git a/__fixtures__/output1/google/api/resource.ts b/__fixtures__/output1/google/api/resource.ts index 21b19b1263..bbeb79b9d2 100644 --- a/__fixtures__/output1/google/api/resource.ts +++ b/__fixtures__/output1/google/api/resource.ts @@ -1,5 +1,6 @@ import * as _m0 from "protobufjs/minimal"; import { isSet, DeepPartial } from "../../helpers"; +import { JsonSafe } from "../../json-safe"; export const protobufPackage = "google.api"; /** * A description of the historical or future-looking state of the @@ -427,7 +428,7 @@ export const ResourceDescriptor = { style: Array.isArray(object?.style) ? object.style.map((e: any) => resourceDescriptor_StyleFromJSON(e)) : [] }; }, - toJSON(message: ResourceDescriptor): unknown { + toJSON(message: ResourceDescriptor): JsonSafe { const obj: any = {}; message.type !== undefined && (obj.type = message.type); if (message.pattern) { @@ -530,7 +531,7 @@ export const ResourceReference = { childType: isSet(object.childType) ? String(object.childType) : "" }; }, - toJSON(message: ResourceReference): unknown { + toJSON(message: ResourceReference): JsonSafe { const obj: any = {}; message.type !== undefined && (obj.type = message.type); message.childType !== undefined && (obj.childType = message.childType); diff --git a/__fixtures__/output1/google/api/routing.ts b/__fixtures__/output1/google/api/routing.ts index 117759381c..8b34e1f609 100644 --- a/__fixtures__/output1/google/api/routing.ts +++ b/__fixtures__/output1/google/api/routing.ts @@ -1,4 +1,5 @@ import * as _m0 from "protobufjs/minimal"; +import { JsonSafe } from "../../json-safe"; import { DeepPartial, isSet } from "../../helpers"; export const protobufPackage = "google.api"; /** @@ -838,7 +839,7 @@ export const RoutingRule = { routingParameters: Array.isArray(object?.routingParameters) ? object.routingParameters.map((e: any) => RoutingParameter.fromJSON(e)) : [] }; }, - toJSON(message: RoutingRule): unknown { + toJSON(message: RoutingRule): JsonSafe { const obj: any = {}; if (message.routingParameters) { obj.routingParameters = message.routingParameters.map(e => e ? RoutingParameter.toJSON(e) : undefined); @@ -909,7 +910,7 @@ export const RoutingParameter = { pathTemplate: isSet(object.pathTemplate) ? String(object.pathTemplate) : "" }; }, - toJSON(message: RoutingParameter): unknown { + toJSON(message: RoutingParameter): JsonSafe { const obj: any = {}; message.field !== undefined && (obj.field = message.field); message.pathTemplate !== undefined && (obj.pathTemplate = message.pathTemplate); diff --git a/__fixtures__/output1/google/api/service.ts b/__fixtures__/output1/google/api/service.ts index 4bb5b74c08..cfa49eb7d8 100644 --- a/__fixtures__/output1/google/api/service.ts +++ b/__fixtures__/output1/google/api/service.ts @@ -20,6 +20,7 @@ import { SourceInfo, SourceInfoSDKType } from "./source_info"; import { UInt32Value, UInt32ValueSDKType } from "../protobuf/wrappers"; import * as _m0 from "protobufjs/minimal"; import { isSet, DeepPartial } from "../../helpers"; +import { JsonSafe } from "../../json-safe"; export const protobufPackage = "google.api"; /** * `Service` is the root object of Google service configuration schema. It @@ -421,7 +422,7 @@ export const Service = { configVersion: isSet(object.configVersion) ? UInt32Value.fromJSON(object.configVersion) : undefined }; }, - toJSON(message: Service): unknown { + toJSON(message: Service): JsonSafe { const obj: any = {}; message.name !== undefined && (obj.name = message.name); message.title !== undefined && (obj.title = message.title); diff --git a/__fixtures__/output1/google/api/servicecontrol/v1/check_error.ts b/__fixtures__/output1/google/api/servicecontrol/v1/check_error.ts index ee99eb97e1..23734350d2 100644 --- a/__fixtures__/output1/google/api/servicecontrol/v1/check_error.ts +++ b/__fixtures__/output1/google/api/servicecontrol/v1/check_error.ts @@ -1,6 +1,7 @@ import { Status, StatusSDKType } from "../../../rpc/status"; import * as _m0 from "protobufjs/minimal"; import { isSet, DeepPartial } from "../../../../helpers"; +import { JsonSafe } from "../../../../json-safe"; export const protobufPackage = "google.api.servicecontrol.v1"; /** Error codes for Check responses. */ export enum CheckError_Code { @@ -283,7 +284,7 @@ export const CheckError = { status: isSet(object.status) ? Status.fromJSON(object.status) : undefined }; }, - toJSON(message: CheckError): unknown { + toJSON(message: CheckError): JsonSafe { const obj: any = {}; message.code !== undefined && (obj.code = checkError_CodeToJSON(message.code)); message.subject !== undefined && (obj.subject = message.subject); diff --git a/__fixtures__/output1/google/api/servicecontrol/v1/distribution.ts b/__fixtures__/output1/google/api/servicecontrol/v1/distribution.ts index ca7e8b06af..ae6c4fe614 100644 --- a/__fixtures__/output1/google/api/servicecontrol/v1/distribution.ts +++ b/__fixtures__/output1/google/api/servicecontrol/v1/distribution.ts @@ -1,6 +1,7 @@ import { Distribution_Exemplar } from "../../distribution"; import { Long, isSet, DeepPartial } from "../../../../helpers"; import * as _m0 from "protobufjs/minimal"; +import { JsonSafe } from "../../../../json-safe"; export const protobufPackage = "google.api.servicecontrol.v1"; /** * Distribution represents a frequency distribution of double-valued sample @@ -273,7 +274,7 @@ export const Distribution = { exemplars: Array.isArray(object?.exemplars) ? object.exemplars.map((e: any) => Distribution_Exemplar.fromJSON(e)) : [] }; }, - toJSON(message: Distribution): unknown { + toJSON(message: Distribution): JsonSafe { const obj: any = {}; message.count !== undefined && (obj.count = (message.count || Long.ZERO).toString()); message.mean !== undefined && (obj.mean = message.mean); @@ -396,7 +397,7 @@ export const Distribution_LinearBuckets = { offset: isSet(object.offset) ? Number(object.offset) : 0 }; }, - toJSON(message: Distribution_LinearBuckets): unknown { + toJSON(message: Distribution_LinearBuckets): JsonSafe { const obj: any = {}; message.numFiniteBuckets !== undefined && (obj.numFiniteBuckets = Math.round(message.numFiniteBuckets)); message.width !== undefined && (obj.width = message.width); @@ -475,7 +476,7 @@ export const Distribution_ExponentialBuckets = { scale: isSet(object.scale) ? Number(object.scale) : 0 }; }, - toJSON(message: Distribution_ExponentialBuckets): unknown { + toJSON(message: Distribution_ExponentialBuckets): JsonSafe { const obj: any = {}; message.numFiniteBuckets !== undefined && (obj.numFiniteBuckets = Math.round(message.numFiniteBuckets)); message.growthFactor !== undefined && (obj.growthFactor = message.growthFactor); @@ -547,7 +548,7 @@ export const Distribution_ExplicitBuckets = { bounds: Array.isArray(object?.bounds) ? object.bounds.map((e: any) => Number(e)) : [] }; }, - toJSON(message: Distribution_ExplicitBuckets): unknown { + toJSON(message: Distribution_ExplicitBuckets): JsonSafe { const obj: any = {}; if (message.bounds) { obj.bounds = message.bounds.map(e => e); diff --git a/__fixtures__/output1/google/api/servicecontrol/v1/http_request.ts b/__fixtures__/output1/google/api/servicecontrol/v1/http_request.ts index 1628e72ac7..a4f5b8a000 100644 --- a/__fixtures__/output1/google/api/servicecontrol/v1/http_request.ts +++ b/__fixtures__/output1/google/api/servicecontrol/v1/http_request.ts @@ -1,6 +1,7 @@ import { Duration, DurationSDKType } from "../../../protobuf/duration"; import { Long, isSet, DeepPartial } from "../../../../helpers"; import * as _m0 from "protobufjs/minimal"; +import { JsonSafe } from "../../../../json-safe"; export const protobufPackage = "google.api.servicecontrol.v1"; /** * A common proto for logging HTTP requests. Only contains semantics @@ -247,7 +248,7 @@ export const HttpRequest = { protocol: isSet(object.protocol) ? String(object.protocol) : "" }; }, - toJSON(message: HttpRequest): unknown { + toJSON(message: HttpRequest): JsonSafe { const obj: any = {}; message.requestMethod !== undefined && (obj.requestMethod = message.requestMethod); message.requestUrl !== undefined && (obj.requestUrl = message.requestUrl); diff --git a/__fixtures__/output1/google/api/servicecontrol/v1/log_entry.ts b/__fixtures__/output1/google/api/servicecontrol/v1/log_entry.ts index 2d25048c70..553a47837e 100644 --- a/__fixtures__/output1/google/api/servicecontrol/v1/log_entry.ts +++ b/__fixtures__/output1/google/api/servicecontrol/v1/log_entry.ts @@ -5,6 +5,7 @@ import { Any, AnySDKType } from "../../../protobuf/any"; import { Struct, StructSDKType } from "../../../protobuf/struct"; import { Long, isSet, DeepPartial, toTimestamp, fromTimestamp, fromJsonTimestamp, isObject } from "../../../../helpers"; import * as _m0 from "protobufjs/minimal"; +import { JsonSafe } from "../../../../json-safe"; export const protobufPackage = "google.api.servicecontrol.v1"; export interface LogEntry_LabelsEntry { key: string; @@ -203,7 +204,7 @@ export const LogEntry_LabelsEntry = { value: isSet(object.value) ? String(object.value) : "" }; }, - toJSON(message: LogEntry_LabelsEntry): unknown { + toJSON(message: LogEntry_LabelsEntry): JsonSafe { const obj: any = {}; message.key !== undefined && (obj.key = message.key); message.value !== undefined && (obj.value = message.value); @@ -361,7 +362,7 @@ export const LogEntry = { sourceLocation: isSet(object.sourceLocation) ? LogEntrySourceLocation.fromJSON(object.sourceLocation) : undefined }; }, - toJSON(message: LogEntry): unknown { + toJSON(message: LogEntry): JsonSafe { const obj: any = {}; message.name !== undefined && (obj.name = message.name); message.timestamp !== undefined && (obj.timestamp = message.timestamp.toISOString()); @@ -506,7 +507,7 @@ export const LogEntryOperation = { last: isSet(object.last) ? Boolean(object.last) : false }; }, - toJSON(message: LogEntryOperation): unknown { + toJSON(message: LogEntryOperation): JsonSafe { const obj: any = {}; message.id !== undefined && (obj.id = message.id); message.producer !== undefined && (obj.producer = message.producer); @@ -589,7 +590,7 @@ export const LogEntrySourceLocation = { function: isSet(object.function) ? String(object.function) : "" }; }, - toJSON(message: LogEntrySourceLocation): unknown { + toJSON(message: LogEntrySourceLocation): JsonSafe { const obj: any = {}; message.file !== undefined && (obj.file = message.file); message.line !== undefined && (obj.line = (message.line || Long.ZERO).toString()); diff --git a/__fixtures__/output1/google/api/servicecontrol/v1/metric_value.ts b/__fixtures__/output1/google/api/servicecontrol/v1/metric_value.ts index 43abd99198..bab52c2a8c 100644 --- a/__fixtures__/output1/google/api/servicecontrol/v1/metric_value.ts +++ b/__fixtures__/output1/google/api/servicecontrol/v1/metric_value.ts @@ -2,6 +2,7 @@ import { Timestamp, TimestampSDKType } from "../../../protobuf/timestamp"; import { Distribution, DistributionSDKType } from "./distribution"; import { Long, isSet, DeepPartial, toTimestamp, fromTimestamp, isObject, fromJsonTimestamp } from "../../../../helpers"; import * as _m0 from "protobufjs/minimal"; +import { JsonSafe } from "../../../../json-safe"; export const protobufPackage = "google.api.servicecontrol.v1"; export interface MetricValue_LabelsEntry { key: string; @@ -122,7 +123,7 @@ export const MetricValue_LabelsEntry = { value: isSet(object.value) ? String(object.value) : "" }; }, - toJSON(message: MetricValue_LabelsEntry): unknown { + toJSON(message: MetricValue_LabelsEntry): JsonSafe { const obj: any = {}; message.key !== undefined && (obj.key = message.key); message.value !== undefined && (obj.value = message.value); @@ -248,7 +249,7 @@ export const MetricValue = { distributionValue: isSet(object.distributionValue) ? Distribution.fromJSON(object.distributionValue) : undefined }; }, - toJSON(message: MetricValue): unknown { + toJSON(message: MetricValue): JsonSafe { const obj: any = {}; obj.labels = {}; if (message.labels) { @@ -363,7 +364,7 @@ export const MetricValueSet = { metricValues: Array.isArray(object?.metricValues) ? object.metricValues.map((e: any) => MetricValue.fromJSON(e)) : [] }; }, - toJSON(message: MetricValueSet): unknown { + toJSON(message: MetricValueSet): JsonSafe { const obj: any = {}; message.metricName !== undefined && (obj.metricName = message.metricName); if (message.metricValues) { diff --git a/__fixtures__/output1/google/api/servicecontrol/v1/operation.ts b/__fixtures__/output1/google/api/servicecontrol/v1/operation.ts index bc78617faf..612d87cb0d 100644 --- a/__fixtures__/output1/google/api/servicecontrol/v1/operation.ts +++ b/__fixtures__/output1/google/api/servicecontrol/v1/operation.ts @@ -4,6 +4,7 @@ import { LogEntry, LogEntrySDKType } from "./log_entry"; import { Any, AnySDKType } from "../../../protobuf/any"; import * as _m0 from "protobufjs/minimal"; import { isSet, DeepPartial, toTimestamp, fromTimestamp, fromJsonTimestamp, isObject } from "../../../../helpers"; +import { JsonSafe } from "../../../../json-safe"; export const protobufPackage = "google.api.servicecontrol.v1"; /** Defines the importance of the data contained in the operation. */ export enum Operation_Importance { @@ -193,7 +194,7 @@ export const Operation_LabelsEntry = { value: isSet(object.value) ? String(object.value) : "" }; }, - toJSON(message: Operation_LabelsEntry): unknown { + toJSON(message: Operation_LabelsEntry): JsonSafe { const obj: any = {}; message.key !== undefined && (obj.key = message.key); message.value !== undefined && (obj.value = message.value); @@ -335,7 +336,7 @@ export const Operation = { extensions: Array.isArray(object?.extensions) ? object.extensions.map((e: any) => Any.fromJSON(e)) : [] }; }, - toJSON(message: Operation): unknown { + toJSON(message: Operation): JsonSafe { const obj: any = {}; message.operationId !== undefined && (obj.operationId = message.operationId); message.operationName !== undefined && (obj.operationName = message.operationName); diff --git a/__fixtures__/output1/google/api/servicecontrol/v1/quota_controller.ts b/__fixtures__/output1/google/api/servicecontrol/v1/quota_controller.ts index 0ff818dd7d..c6d743671a 100644 --- a/__fixtures__/output1/google/api/servicecontrol/v1/quota_controller.ts +++ b/__fixtures__/output1/google/api/servicecontrol/v1/quota_controller.ts @@ -2,6 +2,7 @@ import { MetricValueSet, MetricValueSetSDKType } from "./metric_value"; import { Status, StatusSDKType } from "../../../rpc/status"; import * as _m0 from "protobufjs/minimal"; import { isSet, DeepPartial, isObject } from "../../../../helpers"; +import { JsonSafe } from "../../../../json-safe"; export const protobufPackage = "google.api.servicecontrol.v1"; /** Supported quota modes. */ export enum QuotaOperation_QuotaMode { @@ -380,7 +381,7 @@ export const AllocateQuotaRequest = { serviceConfigId: isSet(object.serviceConfigId) ? String(object.serviceConfigId) : "" }; }, - toJSON(message: AllocateQuotaRequest): unknown { + toJSON(message: AllocateQuotaRequest): JsonSafe { const obj: any = {}; message.serviceName !== undefined && (obj.serviceName = message.serviceName); message.allocateOperation !== undefined && (obj.allocateOperation = message.allocateOperation ? QuotaOperation.toJSON(message.allocateOperation) : undefined); @@ -451,7 +452,7 @@ export const QuotaOperation_LabelsEntry = { value: isSet(object.value) ? String(object.value) : "" }; }, - toJSON(message: QuotaOperation_LabelsEntry): unknown { + toJSON(message: QuotaOperation_LabelsEntry): JsonSafe { const obj: any = {}; message.key !== undefined && (obj.key = message.key); message.value !== undefined && (obj.value = message.value); @@ -561,7 +562,7 @@ export const QuotaOperation = { quotaMode: isSet(object.quotaMode) ? quotaOperation_QuotaModeFromJSON(object.quotaMode) : -1 }; }, - toJSON(message: QuotaOperation): unknown { + toJSON(message: QuotaOperation): JsonSafe { const obj: any = {}; message.operationId !== undefined && (obj.operationId = message.operationId); message.methodName !== undefined && (obj.methodName = message.methodName); @@ -690,7 +691,7 @@ export const AllocateQuotaResponse = { serviceConfigId: isSet(object.serviceConfigId) ? String(object.serviceConfigId) : "" }; }, - toJSON(message: AllocateQuotaResponse): unknown { + toJSON(message: AllocateQuotaResponse): JsonSafe { const obj: any = {}; message.operationId !== undefined && (obj.operationId = message.operationId); if (message.allocateErrors) { @@ -797,7 +798,7 @@ export const QuotaError = { status: isSet(object.status) ? Status.fromJSON(object.status) : undefined }; }, - toJSON(message: QuotaError): unknown { + toJSON(message: QuotaError): JsonSafe { const obj: any = {}; message.code !== undefined && (obj.code = quotaError_CodeToJSON(message.code)); message.subject !== undefined && (obj.subject = message.subject); diff --git a/__fixtures__/output1/google/api/servicecontrol/v1/service_controller.ts b/__fixtures__/output1/google/api/servicecontrol/v1/service_controller.ts index 9fddbc7cb7..602106f94e 100644 --- a/__fixtures__/output1/google/api/servicecontrol/v1/service_controller.ts +++ b/__fixtures__/output1/google/api/servicecontrol/v1/service_controller.ts @@ -3,6 +3,7 @@ import { CheckError, CheckErrorSDKType } from "./check_error"; import { Status, StatusSDKType } from "../../../rpc/status"; import { Long, isSet, DeepPartial } from "../../../../helpers"; import * as _m0 from "protobufjs/minimal"; +import { JsonSafe } from "../../../../json-safe"; export const protobufPackage = "google.api.servicecontrol.v1"; /** * The type of the consumer as defined in @@ -314,7 +315,7 @@ export const CheckRequest = { serviceConfigId: isSet(object.serviceConfigId) ? String(object.serviceConfigId) : "" }; }, - toJSON(message: CheckRequest): unknown { + toJSON(message: CheckRequest): JsonSafe { const obj: any = {}; message.serviceName !== undefined && (obj.serviceName = message.serviceName); message.operation !== undefined && (obj.operation = message.operation ? Operation.toJSON(message.operation) : undefined); @@ -409,7 +410,7 @@ export const CheckResponse = { checkInfo: isSet(object.checkInfo) ? CheckResponse_CheckInfo.fromJSON(object.checkInfo) : undefined }; }, - toJSON(message: CheckResponse): unknown { + toJSON(message: CheckResponse): JsonSafe { const obj: any = {}; message.operationId !== undefined && (obj.operationId = message.operationId); if (message.checkErrors) { @@ -496,7 +497,7 @@ export const CheckResponse_CheckInfo = { consumerInfo: isSet(object.consumerInfo) ? CheckResponse_ConsumerInfo.fromJSON(object.consumerInfo) : undefined }; }, - toJSON(message: CheckResponse_CheckInfo): unknown { + toJSON(message: CheckResponse_CheckInfo): JsonSafe { const obj: any = {}; if (message.unusedArguments) { obj.unusedArguments = message.unusedArguments.map(e => e); @@ -579,7 +580,7 @@ export const CheckResponse_ConsumerInfo = { consumerNumber: isSet(object.consumerNumber) ? Long.fromValue(object.consumerNumber) : Long.ZERO }; }, - toJSON(message: CheckResponse_ConsumerInfo): unknown { + toJSON(message: CheckResponse_ConsumerInfo): JsonSafe { const obj: any = {}; message.projectNumber !== undefined && (obj.projectNumber = (message.projectNumber || Long.ZERO).toString()); message.type !== undefined && (obj.type = checkResponse_ConsumerInfo_ConsumerTypeToJSON(message.type)); @@ -658,7 +659,7 @@ export const ReportRequest = { serviceConfigId: isSet(object.serviceConfigId) ? String(object.serviceConfigId) : "" }; }, - toJSON(message: ReportRequest): unknown { + toJSON(message: ReportRequest): JsonSafe { const obj: any = {}; message.serviceName !== undefined && (obj.serviceName = message.serviceName); if (message.operations) { @@ -745,7 +746,7 @@ export const ReportResponse = { serviceRolloutId: isSet(object.serviceRolloutId) ? String(object.serviceRolloutId) : "" }; }, - toJSON(message: ReportResponse): unknown { + toJSON(message: ReportResponse): JsonSafe { const obj: any = {}; if (message.reportErrors) { obj.reportErrors = message.reportErrors.map(e => e ? ReportResponse_ReportError.toJSON(e) : undefined); @@ -824,7 +825,7 @@ export const ReportResponse_ReportError = { status: isSet(object.status) ? Status.fromJSON(object.status) : undefined }; }, - toJSON(message: ReportResponse_ReportError): unknown { + toJSON(message: ReportResponse_ReportError): JsonSafe { const obj: any = {}; message.operationId !== undefined && (obj.operationId = message.operationId); message.status !== undefined && (obj.status = message.status ? Status.toJSON(message.status) : undefined); diff --git a/__fixtures__/output1/google/api/servicecontrol/v2/service_controller.ts b/__fixtures__/output1/google/api/servicecontrol/v2/service_controller.ts index 0beb40b173..494aafc18d 100644 --- a/__fixtures__/output1/google/api/servicecontrol/v2/service_controller.ts +++ b/__fixtures__/output1/google/api/servicecontrol/v2/service_controller.ts @@ -2,6 +2,7 @@ import { AttributeContext, AttributeContextSDKType } from "../../../rpc/context/ import { Status, StatusSDKType } from "../../../rpc/status"; import * as _m0 from "protobufjs/minimal"; import { isSet, DeepPartial, isObject } from "../../../../helpers"; +import { JsonSafe } from "../../../../json-safe"; export const protobufPackage = "google.api.servicecontrol.v2"; /** Request message for the Check method. */ export interface CheckRequest { @@ -206,7 +207,7 @@ export const CheckRequest = { flags: isSet(object.flags) ? String(object.flags) : "" }; }, - toJSON(message: CheckRequest): unknown { + toJSON(message: CheckRequest): JsonSafe { const obj: any = {}; message.serviceName !== undefined && (obj.serviceName = message.serviceName); message.serviceConfigId !== undefined && (obj.serviceConfigId = message.serviceConfigId); @@ -317,7 +318,7 @@ export const ResourceInfo = { location: isSet(object.location) ? String(object.location) : "" }; }, - toJSON(message: ResourceInfo): unknown { + toJSON(message: ResourceInfo): JsonSafe { const obj: any = {}; message.name !== undefined && (obj.name = message.name); message.type !== undefined && (obj.type = message.type); @@ -396,7 +397,7 @@ export const CheckResponse_HeadersEntry = { value: isSet(object.value) ? String(object.value) : "" }; }, - toJSON(message: CheckResponse_HeadersEntry): unknown { + toJSON(message: CheckResponse_HeadersEntry): JsonSafe { const obj: any = {}; message.key !== undefined && (obj.key = message.key); message.value !== undefined && (obj.value = message.value); @@ -474,7 +475,7 @@ export const CheckResponse = { }, {}) : {} }; }, - toJSON(message: CheckResponse): unknown { + toJSON(message: CheckResponse): JsonSafe { const obj: any = {}; message.status !== undefined && (obj.status = message.status ? Status.toJSON(message.status) : undefined); obj.headers = {}; @@ -571,7 +572,7 @@ export const ReportRequest = { operations: Array.isArray(object?.operations) ? object.operations.map((e: any) => AttributeContext.fromJSON(e)) : [] }; }, - toJSON(message: ReportRequest): unknown { + toJSON(message: ReportRequest): JsonSafe { const obj: any = {}; message.serviceName !== undefined && (obj.serviceName = message.serviceName); message.serviceConfigId !== undefined && (obj.serviceConfigId = message.serviceConfigId); @@ -632,7 +633,7 @@ export const ReportResponse = { fromJSON(_: any): ReportResponse { return {}; }, - toJSON(_: ReportResponse): unknown { + toJSON(_: ReportResponse): JsonSafe { const obj: any = {}; return obj; }, diff --git a/__fixtures__/output1/google/api/servicemanagement/v1/resources.ts b/__fixtures__/output1/google/api/servicemanagement/v1/resources.ts index 71c45ce417..93f44e7042 100644 --- a/__fixtures__/output1/google/api/servicemanagement/v1/resources.ts +++ b/__fixtures__/output1/google/api/servicemanagement/v1/resources.ts @@ -2,6 +2,7 @@ import { Timestamp, TimestampSDKType } from "../../../protobuf/timestamp"; import { ConfigChange, ConfigChangeSDKType } from "../../config_change"; import * as _m0 from "protobufjs/minimal"; import { isSet, DeepPartial, toTimestamp, fromTimestamp, fromJsonTimestamp, bytesFromBase64, base64FromBytes, isObject } from "../../../../helpers"; +import { JsonSafe } from "../../../../json-safe"; export const protobufPackage = "google.api.servicemanagement.v1"; /** Code describes the status of the operation (or one of its steps). */ export enum OperationMetadata_Status { @@ -591,7 +592,7 @@ export const ManagedService = { producerProjectId: isSet(object.producerProjectId) ? String(object.producerProjectId) : "" }; }, - toJSON(message: ManagedService): unknown { + toJSON(message: ManagedService): JsonSafe { const obj: any = {}; message.serviceName !== undefined && (obj.serviceName = message.serviceName); message.producerProjectId !== undefined && (obj.producerProjectId = message.producerProjectId); @@ -674,7 +675,7 @@ export const OperationMetadata = { startTime: isSet(object.startTime) ? fromJsonTimestamp(object.startTime) : undefined }; }, - toJSON(message: OperationMetadata): unknown { + toJSON(message: OperationMetadata): JsonSafe { const obj: any = {}; if (message.resourceNames) { obj.resourceNames = message.resourceNames.map(e => e); @@ -765,7 +766,7 @@ export const OperationMetadata_Step = { status: isSet(object.status) ? operationMetadata_StatusFromJSON(object.status) : -1 }; }, - toJSON(message: OperationMetadata_Step): unknown { + toJSON(message: OperationMetadata_Step): JsonSafe { const obj: any = {}; message.description !== undefined && (obj.description = message.description); message.status !== undefined && (obj.status = operationMetadata_StatusToJSON(message.status)); @@ -840,7 +841,7 @@ export const Diagnostic = { message: isSet(object.message) ? String(object.message) : "" }; }, - toJSON(message: Diagnostic): unknown { + toJSON(message: Diagnostic): JsonSafe { const obj: any = {}; message.location !== undefined && (obj.location = message.location); message.kind !== undefined && (obj.kind = diagnostic_KindToJSON(message.kind)); @@ -911,7 +912,7 @@ export const ConfigSource = { files: Array.isArray(object?.files) ? object.files.map((e: any) => ConfigFile.fromJSON(e)) : [] }; }, - toJSON(message: ConfigSource): unknown { + toJSON(message: ConfigSource): JsonSafe { const obj: any = {}; message.id !== undefined && (obj.id = message.id); if (message.files) { @@ -994,7 +995,7 @@ export const ConfigFile = { fileType: isSet(object.fileType) ? configFile_FileTypeFromJSON(object.fileType) : -1 }; }, - toJSON(message: ConfigFile): unknown { + toJSON(message: ConfigFile): JsonSafe { const obj: any = {}; message.filePath !== undefined && (obj.filePath = message.filePath); message.fileContents !== undefined && (obj.fileContents = base64FromBytes(message.fileContents !== undefined ? message.fileContents : new Uint8Array())); @@ -1057,7 +1058,7 @@ export const ConfigRef = { name: isSet(object.name) ? String(object.name) : "" }; }, - toJSON(message: ConfigRef): unknown { + toJSON(message: ConfigRef): JsonSafe { const obj: any = {}; message.name !== undefined && (obj.name = message.name); return obj; @@ -1112,7 +1113,7 @@ export const ChangeReport = { configChanges: Array.isArray(object?.configChanges) ? object.configChanges.map((e: any) => ConfigChange.fromJSON(e)) : [] }; }, - toJSON(message: ChangeReport): unknown { + toJSON(message: ChangeReport): JsonSafe { const obj: any = {}; if (message.configChanges) { obj.configChanges = message.configChanges.map(e => e ? ConfigChange.toJSON(e) : undefined); @@ -1223,7 +1224,7 @@ export const Rollout = { serviceName: isSet(object.serviceName) ? String(object.serviceName) : "" }; }, - toJSON(message: Rollout): unknown { + toJSON(message: Rollout): JsonSafe { const obj: any = {}; message.rolloutId !== undefined && (obj.rolloutId = message.rolloutId); message.createTime !== undefined && (obj.createTime = message.createTime.toISOString()); @@ -1310,7 +1311,7 @@ export const Rollout_TrafficPercentStrategy_PercentagesEntry = { value: isSet(object.value) ? Number(object.value) : 0 }; }, - toJSON(message: Rollout_TrafficPercentStrategy_PercentagesEntry): unknown { + toJSON(message: Rollout_TrafficPercentStrategy_PercentagesEntry): JsonSafe { const obj: any = {}; message.key !== undefined && (obj.key = message.key); message.value !== undefined && (obj.value = message.value); @@ -1380,7 +1381,7 @@ export const Rollout_TrafficPercentStrategy = { }, {}) : {} }; }, - toJSON(message: Rollout_TrafficPercentStrategy): unknown { + toJSON(message: Rollout_TrafficPercentStrategy): JsonSafe { const obj: any = {}; obj.percentages = {}; if (message.percentages) { @@ -1447,7 +1448,7 @@ export const Rollout_DeleteServiceStrategy = { fromJSON(_: any): Rollout_DeleteServiceStrategy { return {}; }, - toJSON(_: Rollout_DeleteServiceStrategy): unknown { + toJSON(_: Rollout_DeleteServiceStrategy): JsonSafe { const obj: any = {}; return obj; }, diff --git a/__fixtures__/output1/google/api/servicemanagement/v1/servicemanager.ts b/__fixtures__/output1/google/api/servicemanagement/v1/servicemanager.ts index e955e03405..673f1ebcbd 100644 --- a/__fixtures__/output1/google/api/servicemanagement/v1/servicemanager.ts +++ b/__fixtures__/output1/google/api/servicemanagement/v1/servicemanager.ts @@ -3,6 +3,7 @@ import { Service, ServiceSDKType } from "../../service"; import { Any, AnySDKType } from "../../../protobuf/any"; import * as _m0 from "protobufjs/minimal"; import { isSet, DeepPartial } from "../../../../helpers"; +import { JsonSafe } from "../../../../json-safe"; export const protobufPackage = "google.api.servicemanagement.v1"; export enum GetServiceConfigRequest_ConfigView { /** BASIC - Server response includes all fields except SourceInfo. */ @@ -427,7 +428,7 @@ export const ListServicesRequest = { consumerId: isSet(object.consumerId) ? String(object.consumerId) : "" }; }, - toJSON(message: ListServicesRequest): unknown { + toJSON(message: ListServicesRequest): JsonSafe { const obj: any = {}; message.producerProjectId !== undefined && (obj.producerProjectId = message.producerProjectId); message.pageSize !== undefined && (obj.pageSize = Math.round(message.pageSize)); @@ -502,7 +503,7 @@ export const ListServicesResponse = { nextPageToken: isSet(object.nextPageToken) ? String(object.nextPageToken) : "" }; }, - toJSON(message: ListServicesResponse): unknown { + toJSON(message: ListServicesResponse): JsonSafe { const obj: any = {}; if (message.services) { obj.services = message.services.map(e => e ? ManagedService.toJSON(e) : undefined); @@ -569,7 +570,7 @@ export const GetServiceRequest = { serviceName: isSet(object.serviceName) ? String(object.serviceName) : "" }; }, - toJSON(message: GetServiceRequest): unknown { + toJSON(message: GetServiceRequest): JsonSafe { const obj: any = {}; message.serviceName !== undefined && (obj.serviceName = message.serviceName); return obj; @@ -624,7 +625,7 @@ export const CreateServiceRequest = { service: isSet(object.service) ? ManagedService.fromJSON(object.service) : undefined }; }, - toJSON(message: CreateServiceRequest): unknown { + toJSON(message: CreateServiceRequest): JsonSafe { const obj: any = {}; message.service !== undefined && (obj.service = message.service ? ManagedService.toJSON(message.service) : undefined); return obj; @@ -679,7 +680,7 @@ export const DeleteServiceRequest = { serviceName: isSet(object.serviceName) ? String(object.serviceName) : "" }; }, - toJSON(message: DeleteServiceRequest): unknown { + toJSON(message: DeleteServiceRequest): JsonSafe { const obj: any = {}; message.serviceName !== undefined && (obj.serviceName = message.serviceName); return obj; @@ -734,7 +735,7 @@ export const UndeleteServiceRequest = { serviceName: isSet(object.serviceName) ? String(object.serviceName) : "" }; }, - toJSON(message: UndeleteServiceRequest): unknown { + toJSON(message: UndeleteServiceRequest): JsonSafe { const obj: any = {}; message.serviceName !== undefined && (obj.serviceName = message.serviceName); return obj; @@ -789,7 +790,7 @@ export const UndeleteServiceResponse = { service: isSet(object.service) ? ManagedService.fromJSON(object.service) : undefined }; }, - toJSON(message: UndeleteServiceResponse): unknown { + toJSON(message: UndeleteServiceResponse): JsonSafe { const obj: any = {}; message.service !== undefined && (obj.service = message.service ? ManagedService.toJSON(message.service) : undefined); return obj; @@ -860,7 +861,7 @@ export const GetServiceConfigRequest = { view: isSet(object.view) ? getServiceConfigRequest_ConfigViewFromJSON(object.view) : -1 }; }, - toJSON(message: GetServiceConfigRequest): unknown { + toJSON(message: GetServiceConfigRequest): JsonSafe { const obj: any = {}; message.serviceName !== undefined && (obj.serviceName = message.serviceName); message.configId !== undefined && (obj.configId = message.configId); @@ -939,7 +940,7 @@ export const ListServiceConfigsRequest = { pageSize: isSet(object.pageSize) ? Number(object.pageSize) : 0 }; }, - toJSON(message: ListServiceConfigsRequest): unknown { + toJSON(message: ListServiceConfigsRequest): JsonSafe { const obj: any = {}; message.serviceName !== undefined && (obj.serviceName = message.serviceName); message.pageToken !== undefined && (obj.pageToken = message.pageToken); @@ -1010,7 +1011,7 @@ export const ListServiceConfigsResponse = { nextPageToken: isSet(object.nextPageToken) ? String(object.nextPageToken) : "" }; }, - toJSON(message: ListServiceConfigsResponse): unknown { + toJSON(message: ListServiceConfigsResponse): JsonSafe { const obj: any = {}; if (message.serviceConfigs) { obj.serviceConfigs = message.serviceConfigs.map(e => e ? Service.toJSON(e) : undefined); @@ -1085,7 +1086,7 @@ export const CreateServiceConfigRequest = { serviceConfig: isSet(object.serviceConfig) ? Service.fromJSON(object.serviceConfig) : undefined }; }, - toJSON(message: CreateServiceConfigRequest): unknown { + toJSON(message: CreateServiceConfigRequest): JsonSafe { const obj: any = {}; message.serviceName !== undefined && (obj.serviceName = message.serviceName); message.serviceConfig !== undefined && (obj.serviceConfig = message.serviceConfig ? Service.toJSON(message.serviceConfig) : undefined); @@ -1160,7 +1161,7 @@ export const SubmitConfigSourceRequest = { validateOnly: isSet(object.validateOnly) ? Boolean(object.validateOnly) : false }; }, - toJSON(message: SubmitConfigSourceRequest): unknown { + toJSON(message: SubmitConfigSourceRequest): JsonSafe { const obj: any = {}; message.serviceName !== undefined && (obj.serviceName = message.serviceName); message.configSource !== undefined && (obj.configSource = message.configSource ? ConfigSource.toJSON(message.configSource) : undefined); @@ -1223,7 +1224,7 @@ export const SubmitConfigSourceResponse = { serviceConfig: isSet(object.serviceConfig) ? Service.fromJSON(object.serviceConfig) : undefined }; }, - toJSON(message: SubmitConfigSourceResponse): unknown { + toJSON(message: SubmitConfigSourceResponse): JsonSafe { const obj: any = {}; message.serviceConfig !== undefined && (obj.serviceConfig = message.serviceConfig ? Service.toJSON(message.serviceConfig) : undefined); return obj; @@ -1286,7 +1287,7 @@ export const CreateServiceRolloutRequest = { rollout: isSet(object.rollout) ? Rollout.fromJSON(object.rollout) : undefined }; }, - toJSON(message: CreateServiceRolloutRequest): unknown { + toJSON(message: CreateServiceRolloutRequest): JsonSafe { const obj: any = {}; message.serviceName !== undefined && (obj.serviceName = message.serviceName); message.rollout !== undefined && (obj.rollout = message.rollout ? Rollout.toJSON(message.rollout) : undefined); @@ -1369,7 +1370,7 @@ export const ListServiceRolloutsRequest = { filter: isSet(object.filter) ? String(object.filter) : "" }; }, - toJSON(message: ListServiceRolloutsRequest): unknown { + toJSON(message: ListServiceRolloutsRequest): JsonSafe { const obj: any = {}; message.serviceName !== undefined && (obj.serviceName = message.serviceName); message.pageToken !== undefined && (obj.pageToken = message.pageToken); @@ -1444,7 +1445,7 @@ export const ListServiceRolloutsResponse = { nextPageToken: isSet(object.nextPageToken) ? String(object.nextPageToken) : "" }; }, - toJSON(message: ListServiceRolloutsResponse): unknown { + toJSON(message: ListServiceRolloutsResponse): JsonSafe { const obj: any = {}; if (message.rollouts) { obj.rollouts = message.rollouts.map(e => e ? Rollout.toJSON(e) : undefined); @@ -1519,7 +1520,7 @@ export const GetServiceRolloutRequest = { rolloutId: isSet(object.rolloutId) ? String(object.rolloutId) : "" }; }, - toJSON(message: GetServiceRolloutRequest): unknown { + toJSON(message: GetServiceRolloutRequest): JsonSafe { const obj: any = {}; message.serviceName !== undefined && (obj.serviceName = message.serviceName); message.rolloutId !== undefined && (obj.rolloutId = message.rolloutId); @@ -1586,7 +1587,7 @@ export const GenerateConfigReportRequest = { oldConfig: isSet(object.oldConfig) ? Any.fromJSON(object.oldConfig) : undefined }; }, - toJSON(message: GenerateConfigReportRequest): unknown { + toJSON(message: GenerateConfigReportRequest): JsonSafe { const obj: any = {}; message.newConfig !== undefined && (obj.newConfig = message.newConfig ? Any.toJSON(message.newConfig) : undefined); message.oldConfig !== undefined && (obj.oldConfig = message.oldConfig ? Any.toJSON(message.oldConfig) : undefined); @@ -1669,7 +1670,7 @@ export const GenerateConfigReportResponse = { diagnostics: Array.isArray(object?.diagnostics) ? object.diagnostics.map((e: any) => Diagnostic.fromJSON(e)) : [] }; }, - toJSON(message: GenerateConfigReportResponse): unknown { + toJSON(message: GenerateConfigReportResponse): JsonSafe { const obj: any = {}; message.serviceName !== undefined && (obj.serviceName = message.serviceName); message.id !== undefined && (obj.id = message.id); diff --git a/__fixtures__/output1/google/api/serviceusage/v1/resources.ts b/__fixtures__/output1/google/api/serviceusage/v1/resources.ts index 0bb5079e74..812d387dd0 100644 --- a/__fixtures__/output1/google/api/serviceusage/v1/resources.ts +++ b/__fixtures__/output1/google/api/serviceusage/v1/resources.ts @@ -8,6 +8,7 @@ import { MonitoredResourceDescriptor, MonitoredResourceDescriptorSDKType } from import { Monitoring, MonitoringSDKType } from "../../monitoring"; import * as _m0 from "protobufjs/minimal"; import { isSet, DeepPartial } from "../../../../helpers"; +import { JsonSafe } from "../../../../json-safe"; export const protobufPackage = "google.api.serviceusage.v1"; /** Whether or not a service has been enabled for use by a consumer. */ export enum State { @@ -216,7 +217,7 @@ export const Service = { state: isSet(object.state) ? stateFromJSON(object.state) : -1 }; }, - toJSON(message: Service): unknown { + toJSON(message: Service): JsonSafe { const obj: any = {}; message.name !== undefined && (obj.name = message.name); message.parent !== undefined && (obj.parent = message.parent); @@ -355,7 +356,7 @@ export const ServiceConfig = { monitoring: isSet(object.monitoring) ? Monitoring.fromJSON(object.monitoring) : undefined }; }, - toJSON(message: ServiceConfig): unknown { + toJSON(message: ServiceConfig): JsonSafe { const obj: any = {}; message.name !== undefined && (obj.name = message.name); message.title !== undefined && (obj.title = message.title); @@ -470,7 +471,7 @@ export const OperationMetadata = { resourceNames: Array.isArray(object?.resourceNames) ? object.resourceNames.map((e: any) => String(e)) : [] }; }, - toJSON(message: OperationMetadata): unknown { + toJSON(message: OperationMetadata): JsonSafe { const obj: any = {}; if (message.resourceNames) { obj.resourceNames = message.resourceNames.map(e => e); diff --git a/__fixtures__/output1/google/api/serviceusage/v1/serviceusage.ts b/__fixtures__/output1/google/api/serviceusage/v1/serviceusage.ts index 909dc20268..e02ca6a054 100644 --- a/__fixtures__/output1/google/api/serviceusage/v1/serviceusage.ts +++ b/__fixtures__/output1/google/api/serviceusage/v1/serviceusage.ts @@ -1,6 +1,7 @@ import { Service, ServiceSDKType } from "./resources"; import * as _m0 from "protobufjs/minimal"; import { isSet, DeepPartial } from "../../../../helpers"; +import { JsonSafe } from "../../../../json-safe"; export const protobufPackage = "google.api.serviceusage.v1"; /** * Enum to determine if service usage should be checked when disabling a @@ -331,7 +332,7 @@ export const EnableServiceRequest = { name: isSet(object.name) ? String(object.name) : "" }; }, - toJSON(message: EnableServiceRequest): unknown { + toJSON(message: EnableServiceRequest): JsonSafe { const obj: any = {}; message.name !== undefined && (obj.name = message.name); return obj; @@ -386,7 +387,7 @@ export const EnableServiceResponse = { service: isSet(object.service) ? Service.fromJSON(object.service) : undefined }; }, - toJSON(message: EnableServiceResponse): unknown { + toJSON(message: EnableServiceResponse): JsonSafe { const obj: any = {}; message.service !== undefined && (obj.service = message.service ? Service.toJSON(message.service) : undefined); return obj; @@ -457,7 +458,7 @@ export const DisableServiceRequest = { checkIfServiceHasUsage: isSet(object.checkIfServiceHasUsage) ? disableServiceRequest_CheckIfServiceHasUsageFromJSON(object.checkIfServiceHasUsage) : -1 }; }, - toJSON(message: DisableServiceRequest): unknown { + toJSON(message: DisableServiceRequest): JsonSafe { const obj: any = {}; message.name !== undefined && (obj.name = message.name); message.disableDependentServices !== undefined && (obj.disableDependentServices = message.disableDependentServices); @@ -520,7 +521,7 @@ export const DisableServiceResponse = { service: isSet(object.service) ? Service.fromJSON(object.service) : undefined }; }, - toJSON(message: DisableServiceResponse): unknown { + toJSON(message: DisableServiceResponse): JsonSafe { const obj: any = {}; message.service !== undefined && (obj.service = message.service ? Service.toJSON(message.service) : undefined); return obj; @@ -575,7 +576,7 @@ export const GetServiceRequest = { name: isSet(object.name) ? String(object.name) : "" }; }, - toJSON(message: GetServiceRequest): unknown { + toJSON(message: GetServiceRequest): JsonSafe { const obj: any = {}; message.name !== undefined && (obj.name = message.name); return obj; @@ -654,7 +655,7 @@ export const ListServicesRequest = { filter: isSet(object.filter) ? String(object.filter) : "" }; }, - toJSON(message: ListServicesRequest): unknown { + toJSON(message: ListServicesRequest): JsonSafe { const obj: any = {}; message.parent !== undefined && (obj.parent = message.parent); message.pageSize !== undefined && (obj.pageSize = Math.round(message.pageSize)); @@ -729,7 +730,7 @@ export const ListServicesResponse = { nextPageToken: isSet(object.nextPageToken) ? String(object.nextPageToken) : "" }; }, - toJSON(message: ListServicesResponse): unknown { + toJSON(message: ListServicesResponse): JsonSafe { const obj: any = {}; if (message.services) { obj.services = message.services.map(e => e ? Service.toJSON(e) : undefined); @@ -804,7 +805,7 @@ export const BatchEnableServicesRequest = { serviceIds: Array.isArray(object?.serviceIds) ? object.serviceIds.map((e: any) => String(e)) : [] }; }, - toJSON(message: BatchEnableServicesRequest): unknown { + toJSON(message: BatchEnableServicesRequest): JsonSafe { const obj: any = {}; message.parent !== undefined && (obj.parent = message.parent); if (message.serviceIds) { @@ -879,7 +880,7 @@ export const BatchEnableServicesResponse = { failures: Array.isArray(object?.failures) ? object.failures.map((e: any) => BatchEnableServicesResponse_EnableFailure.fromJSON(e)) : [] }; }, - toJSON(message: BatchEnableServicesResponse): unknown { + toJSON(message: BatchEnableServicesResponse): JsonSafe { const obj: any = {}; if (message.services) { obj.services = message.services.map(e => e ? Service.toJSON(e) : undefined); @@ -962,7 +963,7 @@ export const BatchEnableServicesResponse_EnableFailure = { errorMessage: isSet(object.errorMessage) ? String(object.errorMessage) : "" }; }, - toJSON(message: BatchEnableServicesResponse_EnableFailure): unknown { + toJSON(message: BatchEnableServicesResponse_EnableFailure): JsonSafe { const obj: any = {}; message.serviceId !== undefined && (obj.serviceId = message.serviceId); message.errorMessage !== undefined && (obj.errorMessage = message.errorMessage); @@ -1029,7 +1030,7 @@ export const BatchGetServicesRequest = { names: Array.isArray(object?.names) ? object.names.map((e: any) => String(e)) : [] }; }, - toJSON(message: BatchGetServicesRequest): unknown { + toJSON(message: BatchGetServicesRequest): JsonSafe { const obj: any = {}; message.parent !== undefined && (obj.parent = message.parent); if (message.names) { @@ -1096,7 +1097,7 @@ export const BatchGetServicesResponse = { services: Array.isArray(object?.services) ? object.services.map((e: any) => Service.fromJSON(e)) : [] }; }, - toJSON(message: BatchGetServicesResponse): unknown { + toJSON(message: BatchGetServicesResponse): JsonSafe { const obj: any = {}; if (message.services) { obj.services = message.services.map(e => e ? Service.toJSON(e) : undefined); diff --git a/__fixtures__/output1/google/api/serviceusage/v1beta1/resources.ts b/__fixtures__/output1/google/api/serviceusage/v1beta1/resources.ts index 3425a9dbc8..05f25708d7 100644 --- a/__fixtures__/output1/google/api/serviceusage/v1beta1/resources.ts +++ b/__fixtures__/output1/google/api/serviceusage/v1beta1/resources.ts @@ -8,6 +8,7 @@ import { MonitoredResourceDescriptor, MonitoredResourceDescriptorSDKType } from import { Monitoring, MonitoringSDKType } from "../../monitoring"; import { Long, isSet, DeepPartial, isObject } from "../../../../helpers"; import * as _m0 from "protobufjs/minimal"; +import { JsonSafe } from "../../../../json-safe"; export const protobufPackage = "google.api.serviceusage.v1beta1"; /** Whether or not a service has been enabled for use by a consumer. */ export enum State { @@ -670,7 +671,7 @@ export const Service = { state: isSet(object.state) ? stateFromJSON(object.state) : -1 }; }, - toJSON(message: Service): unknown { + toJSON(message: Service): JsonSafe { const obj: any = {}; message.name !== undefined && (obj.name = message.name); message.parent !== undefined && (obj.parent = message.parent); @@ -809,7 +810,7 @@ export const ServiceConfig = { monitoring: isSet(object.monitoring) ? Monitoring.fromJSON(object.monitoring) : undefined }; }, - toJSON(message: ServiceConfig): unknown { + toJSON(message: ServiceConfig): JsonSafe { const obj: any = {}; message.name !== undefined && (obj.name = message.name); message.title !== undefined && (obj.title = message.title); @@ -924,7 +925,7 @@ export const OperationMetadata = { resourceNames: Array.isArray(object?.resourceNames) ? object.resourceNames.map((e: any) => String(e)) : [] }; }, - toJSON(message: OperationMetadata): unknown { + toJSON(message: OperationMetadata): JsonSafe { const obj: any = {}; if (message.resourceNames) { obj.resourceNames = message.resourceNames.map(e => e); @@ -1027,7 +1028,7 @@ export const ConsumerQuotaMetric = { unit: isSet(object.unit) ? String(object.unit) : "" }; }, - toJSON(message: ConsumerQuotaMetric): unknown { + toJSON(message: ConsumerQuotaMetric): JsonSafe { const obj: any = {}; message.name !== undefined && (obj.name = message.name); message.metric !== undefined && (obj.metric = message.metric); @@ -1158,7 +1159,7 @@ export const ConsumerQuotaLimit = { quotaBuckets: Array.isArray(object?.quotaBuckets) ? object.quotaBuckets.map((e: any) => QuotaBucket.fromJSON(e)) : [] }; }, - toJSON(message: ConsumerQuotaLimit): unknown { + toJSON(message: ConsumerQuotaLimit): JsonSafe { const obj: any = {}; message.name !== undefined && (obj.name = message.name); message.metric !== undefined && (obj.metric = message.metric); @@ -1249,7 +1250,7 @@ export const QuotaBucket_DimensionsEntry = { value: isSet(object.value) ? String(object.value) : "" }; }, - toJSON(message: QuotaBucket_DimensionsEntry): unknown { + toJSON(message: QuotaBucket_DimensionsEntry): JsonSafe { const obj: any = {}; message.key !== undefined && (obj.key = message.key); message.value !== undefined && (obj.value = message.value); @@ -1359,7 +1360,7 @@ export const QuotaBucket = { }, {}) : {} }; }, - toJSON(message: QuotaBucket): unknown { + toJSON(message: QuotaBucket): JsonSafe { const obj: any = {}; message.effectiveLimit !== undefined && (obj.effectiveLimit = (message.effectiveLimit || Long.ZERO).toString()); message.defaultLimit !== undefined && (obj.defaultLimit = (message.defaultLimit || Long.ZERO).toString()); @@ -1464,7 +1465,7 @@ export const QuotaOverride_DimensionsEntry = { value: isSet(object.value) ? String(object.value) : "" }; }, - toJSON(message: QuotaOverride_DimensionsEntry): unknown { + toJSON(message: QuotaOverride_DimensionsEntry): JsonSafe { const obj: any = {}; message.key !== undefined && (obj.key = message.key); message.value !== undefined && (obj.value = message.value); @@ -1574,7 +1575,7 @@ export const QuotaOverride = { adminOverrideAncestor: isSet(object.adminOverrideAncestor) ? String(object.adminOverrideAncestor) : "" }; }, - toJSON(message: QuotaOverride): unknown { + toJSON(message: QuotaOverride): JsonSafe { const obj: any = {}; message.name !== undefined && (obj.name = message.name); message.overrideValue !== undefined && (obj.overrideValue = (message.overrideValue || Long.ZERO).toString()); @@ -1671,7 +1672,7 @@ export const OverrideInlineSource = { overrides: Array.isArray(object?.overrides) ? object.overrides.map((e: any) => QuotaOverride.fromJSON(e)) : [] }; }, - toJSON(message: OverrideInlineSource): unknown { + toJSON(message: OverrideInlineSource): JsonSafe { const obj: any = {}; if (message.overrides) { obj.overrides = message.overrides.map(e => e ? QuotaOverride.toJSON(e) : undefined); @@ -1742,7 +1743,7 @@ export const AdminQuotaPolicy_DimensionsEntry = { value: isSet(object.value) ? String(object.value) : "" }; }, - toJSON(message: AdminQuotaPolicy_DimensionsEntry): unknown { + toJSON(message: AdminQuotaPolicy_DimensionsEntry): JsonSafe { const obj: any = {}; message.key !== undefined && (obj.key = message.key); message.value !== undefined && (obj.value = message.value); @@ -1852,7 +1853,7 @@ export const AdminQuotaPolicy = { container: isSet(object.container) ? String(object.container) : "" }; }, - toJSON(message: AdminQuotaPolicy): unknown { + toJSON(message: AdminQuotaPolicy): JsonSafe { const obj: any = {}; message.name !== undefined && (obj.name = message.name); message.policyValue !== undefined && (obj.policyValue = (message.policyValue || Long.ZERO).toString()); @@ -1957,7 +1958,7 @@ export const ServiceIdentity = { uniqueId: isSet(object.uniqueId) ? String(object.uniqueId) : "" }; }, - toJSON(message: ServiceIdentity): unknown { + toJSON(message: ServiceIdentity): JsonSafe { const obj: any = {}; message.email !== undefined && (obj.email = message.email); message.uniqueId !== undefined && (obj.uniqueId = message.uniqueId); diff --git a/__fixtures__/output1/google/api/serviceusage/v1beta1/serviceusage.ts b/__fixtures__/output1/google/api/serviceusage/v1beta1/serviceusage.ts index 290f05ecf8..6eb2108ad0 100644 --- a/__fixtures__/output1/google/api/serviceusage/v1beta1/serviceusage.ts +++ b/__fixtures__/output1/google/api/serviceusage/v1beta1/serviceusage.ts @@ -2,6 +2,7 @@ import { QuotaView, QuotaViewSDKType, QuotaOverride, QuotaOverrideSDKType, Quota import { FieldMask, FieldMaskSDKType } from "../../../protobuf/field_mask"; import * as _m0 from "protobufjs/minimal"; import { isSet, DeepPartial } from "../../../../helpers"; +import { JsonSafe } from "../../../../json-safe"; export const protobufPackage = "google.api.serviceusage.v1beta1"; /** Enum for service identity state. */ export enum GetServiceIdentityResponse_IdentityState { @@ -790,7 +791,7 @@ export const EnableServiceRequest = { name: isSet(object.name) ? String(object.name) : "" }; }, - toJSON(message: EnableServiceRequest): unknown { + toJSON(message: EnableServiceRequest): JsonSafe { const obj: any = {}; message.name !== undefined && (obj.name = message.name); return obj; @@ -845,7 +846,7 @@ export const DisableServiceRequest = { name: isSet(object.name) ? String(object.name) : "" }; }, - toJSON(message: DisableServiceRequest): unknown { + toJSON(message: DisableServiceRequest): JsonSafe { const obj: any = {}; message.name !== undefined && (obj.name = message.name); return obj; @@ -900,7 +901,7 @@ export const GetServiceRequest = { name: isSet(object.name) ? String(object.name) : "" }; }, - toJSON(message: GetServiceRequest): unknown { + toJSON(message: GetServiceRequest): JsonSafe { const obj: any = {}; message.name !== undefined && (obj.name = message.name); return obj; @@ -979,7 +980,7 @@ export const ListServicesRequest = { filter: isSet(object.filter) ? String(object.filter) : "" }; }, - toJSON(message: ListServicesRequest): unknown { + toJSON(message: ListServicesRequest): JsonSafe { const obj: any = {}; message.parent !== undefined && (obj.parent = message.parent); message.pageSize !== undefined && (obj.pageSize = Math.round(message.pageSize)); @@ -1054,7 +1055,7 @@ export const ListServicesResponse = { nextPageToken: isSet(object.nextPageToken) ? String(object.nextPageToken) : "" }; }, - toJSON(message: ListServicesResponse): unknown { + toJSON(message: ListServicesResponse): JsonSafe { const obj: any = {}; if (message.services) { obj.services = message.services.map(e => e ? Service.toJSON(e) : undefined); @@ -1129,7 +1130,7 @@ export const BatchEnableServicesRequest = { serviceIds: Array.isArray(object?.serviceIds) ? object.serviceIds.map((e: any) => String(e)) : [] }; }, - toJSON(message: BatchEnableServicesRequest): unknown { + toJSON(message: BatchEnableServicesRequest): JsonSafe { const obj: any = {}; message.parent !== undefined && (obj.parent = message.parent); if (message.serviceIds) { @@ -1220,7 +1221,7 @@ export const ListConsumerQuotaMetricsRequest = { view: isSet(object.view) ? quotaViewFromJSON(object.view) : -1 }; }, - toJSON(message: ListConsumerQuotaMetricsRequest): unknown { + toJSON(message: ListConsumerQuotaMetricsRequest): JsonSafe { const obj: any = {}; message.parent !== undefined && (obj.parent = message.parent); message.pageSize !== undefined && (obj.pageSize = Math.round(message.pageSize)); @@ -1295,7 +1296,7 @@ export const ListConsumerQuotaMetricsResponse = { nextPageToken: isSet(object.nextPageToken) ? String(object.nextPageToken) : "" }; }, - toJSON(message: ListConsumerQuotaMetricsResponse): unknown { + toJSON(message: ListConsumerQuotaMetricsResponse): JsonSafe { const obj: any = {}; if (message.metrics) { obj.metrics = message.metrics.map(e => e ? ConsumerQuotaMetric.toJSON(e) : undefined); @@ -1370,7 +1371,7 @@ export const GetConsumerQuotaMetricRequest = { view: isSet(object.view) ? quotaViewFromJSON(object.view) : -1 }; }, - toJSON(message: GetConsumerQuotaMetricRequest): unknown { + toJSON(message: GetConsumerQuotaMetricRequest): JsonSafe { const obj: any = {}; message.name !== undefined && (obj.name = message.name); message.view !== undefined && (obj.view = quotaViewToJSON(message.view)); @@ -1437,7 +1438,7 @@ export const GetConsumerQuotaLimitRequest = { view: isSet(object.view) ? quotaViewFromJSON(object.view) : -1 }; }, - toJSON(message: GetConsumerQuotaLimitRequest): unknown { + toJSON(message: GetConsumerQuotaLimitRequest): JsonSafe { const obj: any = {}; message.name !== undefined && (obj.name = message.name); message.view !== undefined && (obj.view = quotaViewToJSON(message.view)); @@ -1529,7 +1530,7 @@ export const CreateAdminOverrideRequest = { forceOnly: Array.isArray(object?.forceOnly) ? object.forceOnly.map((e: any) => quotaSafetyCheckFromJSON(e)) : [] }; }, - toJSON(message: CreateAdminOverrideRequest): unknown { + toJSON(message: CreateAdminOverrideRequest): JsonSafe { const obj: any = {}; message.parent !== undefined && (obj.parent = message.parent); message.override !== undefined && (obj.override = message.override ? QuotaOverride.toJSON(message.override) : undefined); @@ -1645,7 +1646,7 @@ export const UpdateAdminOverrideRequest = { forceOnly: Array.isArray(object?.forceOnly) ? object.forceOnly.map((e: any) => quotaSafetyCheckFromJSON(e)) : [] }; }, - toJSON(message: UpdateAdminOverrideRequest): unknown { + toJSON(message: UpdateAdminOverrideRequest): JsonSafe { const obj: any = {}; message.name !== undefined && (obj.name = message.name); message.override !== undefined && (obj.override = message.override ? QuotaOverride.toJSON(message.override) : undefined); @@ -1749,7 +1750,7 @@ export const DeleteAdminOverrideRequest = { forceOnly: Array.isArray(object?.forceOnly) ? object.forceOnly.map((e: any) => quotaSafetyCheckFromJSON(e)) : [] }; }, - toJSON(message: DeleteAdminOverrideRequest): unknown { + toJSON(message: DeleteAdminOverrideRequest): JsonSafe { const obj: any = {}; message.name !== undefined && (obj.name = message.name); message.force !== undefined && (obj.force = message.force); @@ -1836,7 +1837,7 @@ export const ListAdminOverridesRequest = { pageToken: isSet(object.pageToken) ? String(object.pageToken) : "" }; }, - toJSON(message: ListAdminOverridesRequest): unknown { + toJSON(message: ListAdminOverridesRequest): JsonSafe { const obj: any = {}; message.parent !== undefined && (obj.parent = message.parent); message.pageSize !== undefined && (obj.pageSize = Math.round(message.pageSize)); @@ -1907,7 +1908,7 @@ export const ListAdminOverridesResponse = { nextPageToken: isSet(object.nextPageToken) ? String(object.nextPageToken) : "" }; }, - toJSON(message: ListAdminOverridesResponse): unknown { + toJSON(message: ListAdminOverridesResponse): JsonSafe { const obj: any = {}; if (message.overrides) { obj.overrides = message.overrides.map(e => e ? QuotaOverride.toJSON(e) : undefined); @@ -1974,7 +1975,7 @@ export const BatchCreateAdminOverridesResponse = { overrides: Array.isArray(object?.overrides) ? object.overrides.map((e: any) => QuotaOverride.fromJSON(e)) : [] }; }, - toJSON(message: BatchCreateAdminOverridesResponse): unknown { + toJSON(message: BatchCreateAdminOverridesResponse): JsonSafe { const obj: any = {}; if (message.overrides) { obj.overrides = message.overrides.map(e => e ? QuotaOverride.toJSON(e) : undefined); @@ -2070,7 +2071,7 @@ export const ImportAdminOverridesRequest = { forceOnly: Array.isArray(object?.forceOnly) ? object.forceOnly.map((e: any) => quotaSafetyCheckFromJSON(e)) : [] }; }, - toJSON(message: ImportAdminOverridesRequest): unknown { + toJSON(message: ImportAdminOverridesRequest): JsonSafe { const obj: any = {}; message.parent !== undefined && (obj.parent = message.parent); message.inlineSource !== undefined && (obj.inlineSource = message.inlineSource ? OverrideInlineSource.toJSON(message.inlineSource) : undefined); @@ -2145,7 +2146,7 @@ export const ImportAdminOverridesResponse = { overrides: Array.isArray(object?.overrides) ? object.overrides.map((e: any) => QuotaOverride.fromJSON(e)) : [] }; }, - toJSON(message: ImportAdminOverridesResponse): unknown { + toJSON(message: ImportAdminOverridesResponse): JsonSafe { const obj: any = {}; if (message.overrides) { obj.overrides = message.overrides.map(e => e ? QuotaOverride.toJSON(e) : undefined); @@ -2198,7 +2199,7 @@ export const ImportAdminOverridesMetadata = { fromJSON(_: any): ImportAdminOverridesMetadata { return {}; }, - toJSON(_: ImportAdminOverridesMetadata): unknown { + toJSON(_: ImportAdminOverridesMetadata): JsonSafe { const obj: any = {}; return obj; }, @@ -2281,7 +2282,7 @@ export const CreateConsumerOverrideRequest = { forceOnly: Array.isArray(object?.forceOnly) ? object.forceOnly.map((e: any) => quotaSafetyCheckFromJSON(e)) : [] }; }, - toJSON(message: CreateConsumerOverrideRequest): unknown { + toJSON(message: CreateConsumerOverrideRequest): JsonSafe { const obj: any = {}; message.parent !== undefined && (obj.parent = message.parent); message.override !== undefined && (obj.override = message.override ? QuotaOverride.toJSON(message.override) : undefined); @@ -2397,7 +2398,7 @@ export const UpdateConsumerOverrideRequest = { forceOnly: Array.isArray(object?.forceOnly) ? object.forceOnly.map((e: any) => quotaSafetyCheckFromJSON(e)) : [] }; }, - toJSON(message: UpdateConsumerOverrideRequest): unknown { + toJSON(message: UpdateConsumerOverrideRequest): JsonSafe { const obj: any = {}; message.name !== undefined && (obj.name = message.name); message.override !== undefined && (obj.override = message.override ? QuotaOverride.toJSON(message.override) : undefined); @@ -2501,7 +2502,7 @@ export const DeleteConsumerOverrideRequest = { forceOnly: Array.isArray(object?.forceOnly) ? object.forceOnly.map((e: any) => quotaSafetyCheckFromJSON(e)) : [] }; }, - toJSON(message: DeleteConsumerOverrideRequest): unknown { + toJSON(message: DeleteConsumerOverrideRequest): JsonSafe { const obj: any = {}; message.name !== undefined && (obj.name = message.name); message.force !== undefined && (obj.force = message.force); @@ -2588,7 +2589,7 @@ export const ListConsumerOverridesRequest = { pageToken: isSet(object.pageToken) ? String(object.pageToken) : "" }; }, - toJSON(message: ListConsumerOverridesRequest): unknown { + toJSON(message: ListConsumerOverridesRequest): JsonSafe { const obj: any = {}; message.parent !== undefined && (obj.parent = message.parent); message.pageSize !== undefined && (obj.pageSize = Math.round(message.pageSize)); @@ -2659,7 +2660,7 @@ export const ListConsumerOverridesResponse = { nextPageToken: isSet(object.nextPageToken) ? String(object.nextPageToken) : "" }; }, - toJSON(message: ListConsumerOverridesResponse): unknown { + toJSON(message: ListConsumerOverridesResponse): JsonSafe { const obj: any = {}; if (message.overrides) { obj.overrides = message.overrides.map(e => e ? QuotaOverride.toJSON(e) : undefined); @@ -2726,7 +2727,7 @@ export const BatchCreateConsumerOverridesResponse = { overrides: Array.isArray(object?.overrides) ? object.overrides.map((e: any) => QuotaOverride.fromJSON(e)) : [] }; }, - toJSON(message: BatchCreateConsumerOverridesResponse): unknown { + toJSON(message: BatchCreateConsumerOverridesResponse): JsonSafe { const obj: any = {}; if (message.overrides) { obj.overrides = message.overrides.map(e => e ? QuotaOverride.toJSON(e) : undefined); @@ -2822,7 +2823,7 @@ export const ImportConsumerOverridesRequest = { forceOnly: Array.isArray(object?.forceOnly) ? object.forceOnly.map((e: any) => quotaSafetyCheckFromJSON(e)) : [] }; }, - toJSON(message: ImportConsumerOverridesRequest): unknown { + toJSON(message: ImportConsumerOverridesRequest): JsonSafe { const obj: any = {}; message.parent !== undefined && (obj.parent = message.parent); message.inlineSource !== undefined && (obj.inlineSource = message.inlineSource ? OverrideInlineSource.toJSON(message.inlineSource) : undefined); @@ -2897,7 +2898,7 @@ export const ImportConsumerOverridesResponse = { overrides: Array.isArray(object?.overrides) ? object.overrides.map((e: any) => QuotaOverride.fromJSON(e)) : [] }; }, - toJSON(message: ImportConsumerOverridesResponse): unknown { + toJSON(message: ImportConsumerOverridesResponse): JsonSafe { const obj: any = {}; if (message.overrides) { obj.overrides = message.overrides.map(e => e ? QuotaOverride.toJSON(e) : undefined); @@ -2950,7 +2951,7 @@ export const ImportConsumerOverridesMetadata = { fromJSON(_: any): ImportConsumerOverridesMetadata { return {}; }, - toJSON(_: ImportConsumerOverridesMetadata): unknown { + toJSON(_: ImportConsumerOverridesMetadata): JsonSafe { const obj: any = {}; return obj; }, @@ -3000,7 +3001,7 @@ export const ImportAdminQuotaPoliciesResponse = { policies: Array.isArray(object?.policies) ? object.policies.map((e: any) => AdminQuotaPolicy.fromJSON(e)) : [] }; }, - toJSON(message: ImportAdminQuotaPoliciesResponse): unknown { + toJSON(message: ImportAdminQuotaPoliciesResponse): JsonSafe { const obj: any = {}; if (message.policies) { obj.policies = message.policies.map(e => e ? AdminQuotaPolicy.toJSON(e) : undefined); @@ -3053,7 +3054,7 @@ export const ImportAdminQuotaPoliciesMetadata = { fromJSON(_: any): ImportAdminQuotaPoliciesMetadata { return {}; }, - toJSON(_: ImportAdminQuotaPoliciesMetadata): unknown { + toJSON(_: ImportAdminQuotaPoliciesMetadata): JsonSafe { const obj: any = {}; return obj; }, @@ -3093,7 +3094,7 @@ export const CreateAdminQuotaPolicyMetadata = { fromJSON(_: any): CreateAdminQuotaPolicyMetadata { return {}; }, - toJSON(_: CreateAdminQuotaPolicyMetadata): unknown { + toJSON(_: CreateAdminQuotaPolicyMetadata): JsonSafe { const obj: any = {}; return obj; }, @@ -3133,7 +3134,7 @@ export const UpdateAdminQuotaPolicyMetadata = { fromJSON(_: any): UpdateAdminQuotaPolicyMetadata { return {}; }, - toJSON(_: UpdateAdminQuotaPolicyMetadata): unknown { + toJSON(_: UpdateAdminQuotaPolicyMetadata): JsonSafe { const obj: any = {}; return obj; }, @@ -3173,7 +3174,7 @@ export const DeleteAdminQuotaPolicyMetadata = { fromJSON(_: any): DeleteAdminQuotaPolicyMetadata { return {}; }, - toJSON(_: DeleteAdminQuotaPolicyMetadata): unknown { + toJSON(_: DeleteAdminQuotaPolicyMetadata): JsonSafe { const obj: any = {}; return obj; }, @@ -3223,7 +3224,7 @@ export const GenerateServiceIdentityRequest = { parent: isSet(object.parent) ? String(object.parent) : "" }; }, - toJSON(message: GenerateServiceIdentityRequest): unknown { + toJSON(message: GenerateServiceIdentityRequest): JsonSafe { const obj: any = {}; message.parent !== undefined && (obj.parent = message.parent); return obj; @@ -3286,7 +3287,7 @@ export const GetServiceIdentityResponse = { state: isSet(object.state) ? getServiceIdentityResponse_IdentityStateFromJSON(object.state) : -1 }; }, - toJSON(message: GetServiceIdentityResponse): unknown { + toJSON(message: GetServiceIdentityResponse): JsonSafe { const obj: any = {}; message.identity !== undefined && (obj.identity = message.identity ? ServiceIdentity.toJSON(message.identity) : undefined); message.state !== undefined && (obj.state = getServiceIdentityResponse_IdentityStateToJSON(message.state)); @@ -3335,7 +3336,7 @@ export const GetServiceIdentityMetadata = { fromJSON(_: any): GetServiceIdentityMetadata { return {}; }, - toJSON(_: GetServiceIdentityMetadata): unknown { + toJSON(_: GetServiceIdentityMetadata): JsonSafe { const obj: any = {}; return obj; }, diff --git a/__fixtures__/output1/google/api/source_info.ts b/__fixtures__/output1/google/api/source_info.ts index cfc103d519..47e400a669 100644 --- a/__fixtures__/output1/google/api/source_info.ts +++ b/__fixtures__/output1/google/api/source_info.ts @@ -1,5 +1,6 @@ import { Any, AnySDKType } from "../protobuf/any"; import * as _m0 from "protobufjs/minimal"; +import { JsonSafe } from "../../json-safe"; import { DeepPartial } from "../../helpers"; export const protobufPackage = "google.api"; /** Source information used to create a Service Config */ @@ -45,7 +46,7 @@ export const SourceInfo = { sourceFiles: Array.isArray(object?.sourceFiles) ? object.sourceFiles.map((e: any) => Any.fromJSON(e)) : [] }; }, - toJSON(message: SourceInfo): unknown { + toJSON(message: SourceInfo): JsonSafe { const obj: any = {}; if (message.sourceFiles) { obj.sourceFiles = message.sourceFiles.map(e => e ? Any.toJSON(e) : undefined); diff --git a/__fixtures__/output1/google/api/system_parameter.ts b/__fixtures__/output1/google/api/system_parameter.ts index f5ce621944..f3d85a1225 100644 --- a/__fixtures__/output1/google/api/system_parameter.ts +++ b/__fixtures__/output1/google/api/system_parameter.ts @@ -1,4 +1,5 @@ import * as _m0 from "protobufjs/minimal"; +import { JsonSafe } from "../../json-safe"; import { DeepPartial, isSet } from "../../helpers"; export const protobufPackage = "google.api"; /** @@ -146,7 +147,7 @@ export const SystemParameters = { rules: Array.isArray(object?.rules) ? object.rules.map((e: any) => SystemParameterRule.fromJSON(e)) : [] }; }, - toJSON(message: SystemParameters): unknown { + toJSON(message: SystemParameters): JsonSafe { const obj: any = {}; if (message.rules) { obj.rules = message.rules.map(e => e ? SystemParameterRule.toJSON(e) : undefined); @@ -217,7 +218,7 @@ export const SystemParameterRule = { parameters: Array.isArray(object?.parameters) ? object.parameters.map((e: any) => SystemParameter.fromJSON(e)) : [] }; }, - toJSON(message: SystemParameterRule): unknown { + toJSON(message: SystemParameterRule): JsonSafe { const obj: any = {}; message.selector !== undefined && (obj.selector = message.selector); if (message.parameters) { @@ -300,7 +301,7 @@ export const SystemParameter = { urlQueryParameter: isSet(object.urlQueryParameter) ? String(object.urlQueryParameter) : "" }; }, - toJSON(message: SystemParameter): unknown { + toJSON(message: SystemParameter): JsonSafe { const obj: any = {}; message.name !== undefined && (obj.name = message.name); message.httpHeader !== undefined && (obj.httpHeader = message.httpHeader); diff --git a/__fixtures__/output1/google/api/usage.ts b/__fixtures__/output1/google/api/usage.ts index 5aee8ed9b0..0664f1331b 100644 --- a/__fixtures__/output1/google/api/usage.ts +++ b/__fixtures__/output1/google/api/usage.ts @@ -1,5 +1,6 @@ import * as _m0 from "protobufjs/minimal"; import { isSet, DeepPartial } from "../../helpers"; +import { JsonSafe } from "../../json-safe"; export const protobufPackage = "google.api"; /** Configuration controlling usage of a service. */ export interface Usage { @@ -169,7 +170,7 @@ export const Usage = { producerNotificationChannel: isSet(object.producerNotificationChannel) ? String(object.producerNotificationChannel) : "" }; }, - toJSON(message: Usage): unknown { + toJSON(message: Usage): JsonSafe { const obj: any = {}; if (message.requirements) { obj.requirements = message.requirements.map(e => e); @@ -264,7 +265,7 @@ export const UsageRule = { skipServiceControl: isSet(object.skipServiceControl) ? Boolean(object.skipServiceControl) : false }; }, - toJSON(message: UsageRule): unknown { + toJSON(message: UsageRule): JsonSafe { const obj: any = {}; message.selector !== undefined && (obj.selector = message.selector); message.allowUnregisteredCalls !== undefined && (obj.allowUnregisteredCalls = message.allowUnregisteredCalls); diff --git a/__fixtures__/output1/google/api/visibility.ts b/__fixtures__/output1/google/api/visibility.ts index 7a0b3b88c3..ea5586d192 100644 --- a/__fixtures__/output1/google/api/visibility.ts +++ b/__fixtures__/output1/google/api/visibility.ts @@ -1,4 +1,5 @@ import * as _m0 from "protobufjs/minimal"; +import { JsonSafe } from "../../json-safe"; import { DeepPartial, isSet } from "../../helpers"; export const protobufPackage = "google.api"; /** @@ -132,7 +133,7 @@ export const Visibility = { rules: Array.isArray(object?.rules) ? object.rules.map((e: any) => VisibilityRule.fromJSON(e)) : [] }; }, - toJSON(message: Visibility): unknown { + toJSON(message: Visibility): JsonSafe { const obj: any = {}; if (message.rules) { obj.rules = message.rules.map(e => e ? VisibilityRule.toJSON(e) : undefined); @@ -203,7 +204,7 @@ export const VisibilityRule = { restriction: isSet(object.restriction) ? String(object.restriction) : "" }; }, - toJSON(message: VisibilityRule): unknown { + toJSON(message: VisibilityRule): JsonSafe { const obj: any = {}; message.selector !== undefined && (obj.selector = message.selector); message.restriction !== undefined && (obj.restriction = message.restriction); diff --git a/__fixtures__/output1/google/logging/type/http_request.ts b/__fixtures__/output1/google/logging/type/http_request.ts index 9a80946086..cfd845cc21 100644 --- a/__fixtures__/output1/google/logging/type/http_request.ts +++ b/__fixtures__/output1/google/logging/type/http_request.ts @@ -1,6 +1,7 @@ import { Duration, DurationSDKType } from "../../protobuf/duration"; import { Long, isSet, DeepPartial } from "../../../helpers"; import * as _m0 from "protobufjs/minimal"; +import { JsonSafe } from "../../../json-safe"; export const protobufPackage = "google.logging.type"; /** * A common proto for logging HTTP requests. Only contains semantics @@ -249,7 +250,7 @@ export const HttpRequest = { protocol: isSet(object.protocol) ? String(object.protocol) : "" }; }, - toJSON(message: HttpRequest): unknown { + toJSON(message: HttpRequest): JsonSafe { const obj: any = {}; message.requestMethod !== undefined && (obj.requestMethod = message.requestMethod); message.requestUrl !== undefined && (obj.requestUrl = message.requestUrl); diff --git a/__fixtures__/output1/google/logging/v2/log_entry.ts b/__fixtures__/output1/google/logging/v2/log_entry.ts index 35f3b4ce09..7f3f2299b4 100644 --- a/__fixtures__/output1/google/logging/v2/log_entry.ts +++ b/__fixtures__/output1/google/logging/v2/log_entry.ts @@ -6,6 +6,7 @@ import { LogSeverity, LogSeveritySDKType, logSeverityFromJSON, logSeverityToJSON import { HttpRequest, HttpRequestSDKType } from "../type/http_request"; import { Long, isSet, DeepPartial, toTimestamp, fromTimestamp, fromJsonTimestamp, isObject } from "../../../helpers"; import * as _m0 from "protobufjs/minimal"; +import { JsonSafe } from "../../../json-safe"; export const protobufPackage = "google.logging.v2"; export interface LogEntry_LabelsEntry { key: string; @@ -323,7 +324,7 @@ export const LogEntry_LabelsEntry = { value: isSet(object.value) ? String(object.value) : "" }; }, - toJSON(message: LogEntry_LabelsEntry): unknown { + toJSON(message: LogEntry_LabelsEntry): JsonSafe { const obj: any = {}; message.key !== undefined && (obj.key = message.key); message.value !== undefined && (obj.value = message.value); @@ -521,7 +522,7 @@ export const LogEntry = { split: isSet(object.split) ? LogSplit.fromJSON(object.split) : undefined }; }, - toJSON(message: LogEntry): unknown { + toJSON(message: LogEntry): JsonSafe { const obj: any = {}; message.logName !== undefined && (obj.logName = message.logName); message.resource !== undefined && (obj.resource = message.resource ? MonitoredResource.toJSON(message.resource) : undefined); @@ -686,7 +687,7 @@ export const LogEntryOperation = { last: isSet(object.last) ? Boolean(object.last) : false }; }, - toJSON(message: LogEntryOperation): unknown { + toJSON(message: LogEntryOperation): JsonSafe { const obj: any = {}; message.id !== undefined && (obj.id = message.id); message.producer !== undefined && (obj.producer = message.producer); @@ -769,7 +770,7 @@ export const LogEntrySourceLocation = { function: isSet(object.function) ? String(object.function) : "" }; }, - toJSON(message: LogEntrySourceLocation): unknown { + toJSON(message: LogEntrySourceLocation): JsonSafe { const obj: any = {}; message.file !== undefined && (obj.file = message.file); message.line !== undefined && (obj.line = (message.line || Long.ZERO).toString()); @@ -848,7 +849,7 @@ export const LogSplit = { totalSplits: isSet(object.totalSplits) ? Number(object.totalSplits) : 0 }; }, - toJSON(message: LogSplit): unknown { + toJSON(message: LogSplit): JsonSafe { const obj: any = {}; message.uid !== undefined && (obj.uid = message.uid); message.index !== undefined && (obj.index = Math.round(message.index)); diff --git a/__fixtures__/output1/google/logging/v2/logging.ts b/__fixtures__/output1/google/logging/v2/logging.ts index fcf63062e9..7fa6ac5a95 100644 --- a/__fixtures__/output1/google/logging/v2/logging.ts +++ b/__fixtures__/output1/google/logging/v2/logging.ts @@ -4,6 +4,7 @@ import { Duration, DurationSDKType } from "../../protobuf/duration"; import { Status, StatusSDKType } from "../../rpc/status"; import * as _m0 from "protobufjs/minimal"; import { isSet, DeepPartial, isObject } from "../../../helpers"; +import { JsonSafe } from "../../../json-safe"; export const protobufPackage = "google.logging.v2"; /** An indicator of why entries were omitted. */ export enum TailLogEntriesResponse_SuppressionInfo_Reason { @@ -517,7 +518,7 @@ export const DeleteLogRequest = { logName: isSet(object.logName) ? String(object.logName) : "" }; }, - toJSON(message: DeleteLogRequest): unknown { + toJSON(message: DeleteLogRequest): JsonSafe { const obj: any = {}; message.logName !== undefined && (obj.logName = message.logName); return obj; @@ -580,7 +581,7 @@ export const WriteLogEntriesRequest_LabelsEntry = { value: isSet(object.value) ? String(object.value) : "" }; }, - toJSON(message: WriteLogEntriesRequest_LabelsEntry): unknown { + toJSON(message: WriteLogEntriesRequest_LabelsEntry): JsonSafe { const obj: any = {}; message.key !== undefined && (obj.key = message.key); message.value !== undefined && (obj.value = message.value); @@ -690,7 +691,7 @@ export const WriteLogEntriesRequest = { dryRun: isSet(object.dryRun) ? Boolean(object.dryRun) : false }; }, - toJSON(message: WriteLogEntriesRequest): unknown { + toJSON(message: WriteLogEntriesRequest): JsonSafe { const obj: any = {}; message.logName !== undefined && (obj.logName = message.logName); message.resource !== undefined && (obj.resource = message.resource ? MonitoredResource.toJSON(message.resource) : undefined); @@ -785,7 +786,7 @@ export const WriteLogEntriesResponse = { fromJSON(_: any): WriteLogEntriesResponse { return {}; }, - toJSON(_: WriteLogEntriesResponse): unknown { + toJSON(_: WriteLogEntriesResponse): JsonSafe { const obj: any = {}; return obj; }, @@ -843,7 +844,7 @@ export const WriteLogEntriesPartialErrors_LogEntryErrorsEntry = { value: isSet(object.value) ? Status.fromJSON(object.value) : undefined }; }, - toJSON(message: WriteLogEntriesPartialErrors_LogEntryErrorsEntry): unknown { + toJSON(message: WriteLogEntriesPartialErrors_LogEntryErrorsEntry): JsonSafe { const obj: any = {}; message.key !== undefined && (obj.key = Math.round(message.key)); message.value !== undefined && (obj.value = message.value ? Status.toJSON(message.value) : undefined); @@ -913,7 +914,7 @@ export const WriteLogEntriesPartialErrors = { }, {}) : {} }; }, - toJSON(message: WriteLogEntriesPartialErrors): unknown { + toJSON(message: WriteLogEntriesPartialErrors): JsonSafe { const obj: any = {}; obj.logEntryErrors = {}; if (message.logEntryErrors) { @@ -1022,7 +1023,7 @@ export const ListLogEntriesRequest = { pageToken: isSet(object.pageToken) ? String(object.pageToken) : "" }; }, - toJSON(message: ListLogEntriesRequest): unknown { + toJSON(message: ListLogEntriesRequest): JsonSafe { const obj: any = {}; if (message.resourceNames) { obj.resourceNames = message.resourceNames.map(e => e); @@ -1109,7 +1110,7 @@ export const ListLogEntriesResponse = { nextPageToken: isSet(object.nextPageToken) ? String(object.nextPageToken) : "" }; }, - toJSON(message: ListLogEntriesResponse): unknown { + toJSON(message: ListLogEntriesResponse): JsonSafe { const obj: any = {}; if (message.entries) { obj.entries = message.entries.map(e => e ? LogEntry.toJSON(e) : undefined); @@ -1184,7 +1185,7 @@ export const ListMonitoredResourceDescriptorsRequest = { pageToken: isSet(object.pageToken) ? String(object.pageToken) : "" }; }, - toJSON(message: ListMonitoredResourceDescriptorsRequest): unknown { + toJSON(message: ListMonitoredResourceDescriptorsRequest): JsonSafe { const obj: any = {}; message.pageSize !== undefined && (obj.pageSize = Math.round(message.pageSize)); message.pageToken !== undefined && (obj.pageToken = message.pageToken); @@ -1251,7 +1252,7 @@ export const ListMonitoredResourceDescriptorsResponse = { nextPageToken: isSet(object.nextPageToken) ? String(object.nextPageToken) : "" }; }, - toJSON(message: ListMonitoredResourceDescriptorsResponse): unknown { + toJSON(message: ListMonitoredResourceDescriptorsResponse): JsonSafe { const obj: any = {}; if (message.resourceDescriptors) { obj.resourceDescriptors = message.resourceDescriptors.map(e => e ? MonitoredResourceDescriptor.toJSON(e) : undefined); @@ -1342,7 +1343,7 @@ export const ListLogsRequest = { resourceNames: Array.isArray(object?.resourceNames) ? object.resourceNames.map((e: any) => String(e)) : [] }; }, - toJSON(message: ListLogsRequest): unknown { + toJSON(message: ListLogsRequest): JsonSafe { const obj: any = {}; message.parent !== undefined && (obj.parent = message.parent); message.pageSize !== undefined && (obj.pageSize = Math.round(message.pageSize)); @@ -1425,7 +1426,7 @@ export const ListLogsResponse = { nextPageToken: isSet(object.nextPageToken) ? String(object.nextPageToken) : "" }; }, - toJSON(message: ListLogsResponse): unknown { + toJSON(message: ListLogsResponse): JsonSafe { const obj: any = {}; if (message.logNames) { obj.logNames = message.logNames.map(e => e); @@ -1508,7 +1509,7 @@ export const TailLogEntriesRequest = { bufferWindow: isSet(object.bufferWindow) ? Duration.fromJSON(object.bufferWindow) : undefined }; }, - toJSON(message: TailLogEntriesRequest): unknown { + toJSON(message: TailLogEntriesRequest): JsonSafe { const obj: any = {}; if (message.resourceNames) { obj.resourceNames = message.resourceNames.map(e => e); @@ -1587,7 +1588,7 @@ export const TailLogEntriesResponse = { suppressionInfo: Array.isArray(object?.suppressionInfo) ? object.suppressionInfo.map((e: any) => TailLogEntriesResponse_SuppressionInfo.fromJSON(e)) : [] }; }, - toJSON(message: TailLogEntriesResponse): unknown { + toJSON(message: TailLogEntriesResponse): JsonSafe { const obj: any = {}; if (message.entries) { obj.entries = message.entries.map(e => e ? LogEntry.toJSON(e) : undefined); @@ -1670,7 +1671,7 @@ export const TailLogEntriesResponse_SuppressionInfo = { suppressedCount: isSet(object.suppressedCount) ? Number(object.suppressedCount) : 0 }; }, - toJSON(message: TailLogEntriesResponse_SuppressionInfo): unknown { + toJSON(message: TailLogEntriesResponse_SuppressionInfo): JsonSafe { const obj: any = {}; message.reason !== undefined && (obj.reason = tailLogEntriesResponse_SuppressionInfo_ReasonToJSON(message.reason)); message.suppressedCount !== undefined && (obj.suppressedCount = Math.round(message.suppressedCount)); diff --git a/__fixtures__/output1/google/logging/v2/logging_config.ts b/__fixtures__/output1/google/logging/v2/logging_config.ts index b8cfae76aa..b564530327 100644 --- a/__fixtures__/output1/google/logging/v2/logging_config.ts +++ b/__fixtures__/output1/google/logging/v2/logging_config.ts @@ -2,6 +2,7 @@ import { FieldMask, FieldMaskSDKType } from "../../protobuf/field_mask"; import { Timestamp, TimestampSDKType } from "../../protobuf/timestamp"; import { Long, toTimestamp, fromTimestamp, isSet, fromJsonTimestamp, DeepPartial } from "../../../helpers"; import * as _m0 from "protobufjs/minimal"; +import { JsonSafe } from "../../../json-safe"; export const protobufPackage = "google.logging.v2"; /** Deprecated. This is unused. */ export enum LogSink_VersionFormat { @@ -1683,7 +1684,7 @@ export const LogBucket = { cmekSettings: isSet(object.cmekSettings) ? CmekSettings.fromJSON(object.cmekSettings) : undefined }; }, - toJSON(message: LogBucket): unknown { + toJSON(message: LogBucket): JsonSafe { const obj: any = {}; message.name !== undefined && (obj.name = message.name); message.description !== undefined && (obj.description = message.description); @@ -1810,7 +1811,7 @@ export const LogView = { filter: isSet(object.filter) ? String(object.filter) : "" }; }, - toJSON(message: LogView): unknown { + toJSON(message: LogView): JsonSafe { const obj: any = {}; message.name !== undefined && (obj.name = message.name); message.description !== undefined && (obj.description = message.description); @@ -1969,7 +1970,7 @@ export const LogSink = { updateTime: isSet(object.updateTime) ? fromJsonTimestamp(object.updateTime) : undefined }; }, - toJSON(message: LogSink): unknown { + toJSON(message: LogSink): JsonSafe { const obj: any = {}; message.name !== undefined && (obj.name = message.name); message.destination !== undefined && (obj.destination = message.destination); @@ -2084,7 +2085,7 @@ export const BigQueryOptions = { usesTimestampColumnPartitioning: isSet(object.usesTimestampColumnPartitioning) ? Boolean(object.usesTimestampColumnPartitioning) : false }; }, - toJSON(message: BigQueryOptions): unknown { + toJSON(message: BigQueryOptions): JsonSafe { const obj: any = {}; message.usePartitionedTables !== undefined && (obj.usePartitionedTables = message.usePartitionedTables); message.usesTimestampColumnPartitioning !== undefined && (obj.usesTimestampColumnPartitioning = message.usesTimestampColumnPartitioning); @@ -2159,7 +2160,7 @@ export const ListBucketsRequest = { pageSize: isSet(object.pageSize) ? Number(object.pageSize) : 0 }; }, - toJSON(message: ListBucketsRequest): unknown { + toJSON(message: ListBucketsRequest): JsonSafe { const obj: any = {}; message.parent !== undefined && (obj.parent = message.parent); message.pageToken !== undefined && (obj.pageToken = message.pageToken); @@ -2230,7 +2231,7 @@ export const ListBucketsResponse = { nextPageToken: isSet(object.nextPageToken) ? String(object.nextPageToken) : "" }; }, - toJSON(message: ListBucketsResponse): unknown { + toJSON(message: ListBucketsResponse): JsonSafe { const obj: any = {}; if (message.buckets) { obj.buckets = message.buckets.map(e => e ? LogBucket.toJSON(e) : undefined); @@ -2313,7 +2314,7 @@ export const CreateBucketRequest = { bucket: isSet(object.bucket) ? LogBucket.fromJSON(object.bucket) : undefined }; }, - toJSON(message: CreateBucketRequest): unknown { + toJSON(message: CreateBucketRequest): JsonSafe { const obj: any = {}; message.parent !== undefined && (obj.parent = message.parent); message.bucketId !== undefined && (obj.bucketId = message.bucketId); @@ -2392,7 +2393,7 @@ export const UpdateBucketRequest = { updateMask: isSet(object.updateMask) ? FieldMask.fromJSON(object.updateMask) : undefined }; }, - toJSON(message: UpdateBucketRequest): unknown { + toJSON(message: UpdateBucketRequest): JsonSafe { const obj: any = {}; message.name !== undefined && (obj.name = message.name); message.bucket !== undefined && (obj.bucket = message.bucket ? LogBucket.toJSON(message.bucket) : undefined); @@ -2455,7 +2456,7 @@ export const GetBucketRequest = { name: isSet(object.name) ? String(object.name) : "" }; }, - toJSON(message: GetBucketRequest): unknown { + toJSON(message: GetBucketRequest): JsonSafe { const obj: any = {}; message.name !== undefined && (obj.name = message.name); return obj; @@ -2510,7 +2511,7 @@ export const DeleteBucketRequest = { name: isSet(object.name) ? String(object.name) : "" }; }, - toJSON(message: DeleteBucketRequest): unknown { + toJSON(message: DeleteBucketRequest): JsonSafe { const obj: any = {}; message.name !== undefined && (obj.name = message.name); return obj; @@ -2565,7 +2566,7 @@ export const UndeleteBucketRequest = { name: isSet(object.name) ? String(object.name) : "" }; }, - toJSON(message: UndeleteBucketRequest): unknown { + toJSON(message: UndeleteBucketRequest): JsonSafe { const obj: any = {}; message.name !== undefined && (obj.name = message.name); return obj; @@ -2636,7 +2637,7 @@ export const ListViewsRequest = { pageSize: isSet(object.pageSize) ? Number(object.pageSize) : 0 }; }, - toJSON(message: ListViewsRequest): unknown { + toJSON(message: ListViewsRequest): JsonSafe { const obj: any = {}; message.parent !== undefined && (obj.parent = message.parent); message.pageToken !== undefined && (obj.pageToken = message.pageToken); @@ -2707,7 +2708,7 @@ export const ListViewsResponse = { nextPageToken: isSet(object.nextPageToken) ? String(object.nextPageToken) : "" }; }, - toJSON(message: ListViewsResponse): unknown { + toJSON(message: ListViewsResponse): JsonSafe { const obj: any = {}; if (message.views) { obj.views = message.views.map(e => e ? LogView.toJSON(e) : undefined); @@ -2790,7 +2791,7 @@ export const CreateViewRequest = { view: isSet(object.view) ? LogView.fromJSON(object.view) : undefined }; }, - toJSON(message: CreateViewRequest): unknown { + toJSON(message: CreateViewRequest): JsonSafe { const obj: any = {}; message.parent !== undefined && (obj.parent = message.parent); message.viewId !== undefined && (obj.viewId = message.viewId); @@ -2869,7 +2870,7 @@ export const UpdateViewRequest = { updateMask: isSet(object.updateMask) ? FieldMask.fromJSON(object.updateMask) : undefined }; }, - toJSON(message: UpdateViewRequest): unknown { + toJSON(message: UpdateViewRequest): JsonSafe { const obj: any = {}; message.name !== undefined && (obj.name = message.name); message.view !== undefined && (obj.view = message.view ? LogView.toJSON(message.view) : undefined); @@ -2932,7 +2933,7 @@ export const GetViewRequest = { name: isSet(object.name) ? String(object.name) : "" }; }, - toJSON(message: GetViewRequest): unknown { + toJSON(message: GetViewRequest): JsonSafe { const obj: any = {}; message.name !== undefined && (obj.name = message.name); return obj; @@ -2987,7 +2988,7 @@ export const DeleteViewRequest = { name: isSet(object.name) ? String(object.name) : "" }; }, - toJSON(message: DeleteViewRequest): unknown { + toJSON(message: DeleteViewRequest): JsonSafe { const obj: any = {}; message.name !== undefined && (obj.name = message.name); return obj; @@ -3058,7 +3059,7 @@ export const ListSinksRequest = { pageSize: isSet(object.pageSize) ? Number(object.pageSize) : 0 }; }, - toJSON(message: ListSinksRequest): unknown { + toJSON(message: ListSinksRequest): JsonSafe { const obj: any = {}; message.parent !== undefined && (obj.parent = message.parent); message.pageToken !== undefined && (obj.pageToken = message.pageToken); @@ -3129,7 +3130,7 @@ export const ListSinksResponse = { nextPageToken: isSet(object.nextPageToken) ? String(object.nextPageToken) : "" }; }, - toJSON(message: ListSinksResponse): unknown { + toJSON(message: ListSinksResponse): JsonSafe { const obj: any = {}; if (message.sinks) { obj.sinks = message.sinks.map(e => e ? LogSink.toJSON(e) : undefined); @@ -3196,7 +3197,7 @@ export const GetSinkRequest = { sinkName: isSet(object.sinkName) ? String(object.sinkName) : "" }; }, - toJSON(message: GetSinkRequest): unknown { + toJSON(message: GetSinkRequest): JsonSafe { const obj: any = {}; message.sinkName !== undefined && (obj.sinkName = message.sinkName); return obj; @@ -3267,7 +3268,7 @@ export const CreateSinkRequest = { uniqueWriterIdentity: isSet(object.uniqueWriterIdentity) ? Boolean(object.uniqueWriterIdentity) : false }; }, - toJSON(message: CreateSinkRequest): unknown { + toJSON(message: CreateSinkRequest): JsonSafe { const obj: any = {}; message.parent !== undefined && (obj.parent = message.parent); message.sink !== undefined && (obj.sink = message.sink ? LogSink.toJSON(message.sink) : undefined); @@ -3354,7 +3355,7 @@ export const UpdateSinkRequest = { updateMask: isSet(object.updateMask) ? FieldMask.fromJSON(object.updateMask) : undefined }; }, - toJSON(message: UpdateSinkRequest): unknown { + toJSON(message: UpdateSinkRequest): JsonSafe { const obj: any = {}; message.sinkName !== undefined && (obj.sinkName = message.sinkName); message.sink !== undefined && (obj.sink = message.sink ? LogSink.toJSON(message.sink) : undefined); @@ -3421,7 +3422,7 @@ export const DeleteSinkRequest = { sinkName: isSet(object.sinkName) ? String(object.sinkName) : "" }; }, - toJSON(message: DeleteSinkRequest): unknown { + toJSON(message: DeleteSinkRequest): JsonSafe { const obj: any = {}; message.sinkName !== undefined && (obj.sinkName = message.sinkName); return obj; @@ -3516,7 +3517,7 @@ export const LogExclusion = { updateTime: isSet(object.updateTime) ? fromJsonTimestamp(object.updateTime) : undefined }; }, - toJSON(message: LogExclusion): unknown { + toJSON(message: LogExclusion): JsonSafe { const obj: any = {}; message.name !== undefined && (obj.name = message.name); message.description !== undefined && (obj.description = message.description); @@ -3607,7 +3608,7 @@ export const ListExclusionsRequest = { pageSize: isSet(object.pageSize) ? Number(object.pageSize) : 0 }; }, - toJSON(message: ListExclusionsRequest): unknown { + toJSON(message: ListExclusionsRequest): JsonSafe { const obj: any = {}; message.parent !== undefined && (obj.parent = message.parent); message.pageToken !== undefined && (obj.pageToken = message.pageToken); @@ -3678,7 +3679,7 @@ export const ListExclusionsResponse = { nextPageToken: isSet(object.nextPageToken) ? String(object.nextPageToken) : "" }; }, - toJSON(message: ListExclusionsResponse): unknown { + toJSON(message: ListExclusionsResponse): JsonSafe { const obj: any = {}; if (message.exclusions) { obj.exclusions = message.exclusions.map(e => e ? LogExclusion.toJSON(e) : undefined); @@ -3745,7 +3746,7 @@ export const GetExclusionRequest = { name: isSet(object.name) ? String(object.name) : "" }; }, - toJSON(message: GetExclusionRequest): unknown { + toJSON(message: GetExclusionRequest): JsonSafe { const obj: any = {}; message.name !== undefined && (obj.name = message.name); return obj; @@ -3808,7 +3809,7 @@ export const CreateExclusionRequest = { exclusion: isSet(object.exclusion) ? LogExclusion.fromJSON(object.exclusion) : undefined }; }, - toJSON(message: CreateExclusionRequest): unknown { + toJSON(message: CreateExclusionRequest): JsonSafe { const obj: any = {}; message.parent !== undefined && (obj.parent = message.parent); message.exclusion !== undefined && (obj.exclusion = message.exclusion ? LogExclusion.toJSON(message.exclusion) : undefined); @@ -3883,7 +3884,7 @@ export const UpdateExclusionRequest = { updateMask: isSet(object.updateMask) ? FieldMask.fromJSON(object.updateMask) : undefined }; }, - toJSON(message: UpdateExclusionRequest): unknown { + toJSON(message: UpdateExclusionRequest): JsonSafe { const obj: any = {}; message.name !== undefined && (obj.name = message.name); message.exclusion !== undefined && (obj.exclusion = message.exclusion ? LogExclusion.toJSON(message.exclusion) : undefined); @@ -3946,7 +3947,7 @@ export const DeleteExclusionRequest = { name: isSet(object.name) ? String(object.name) : "" }; }, - toJSON(message: DeleteExclusionRequest): unknown { + toJSON(message: DeleteExclusionRequest): JsonSafe { const obj: any = {}; message.name !== undefined && (obj.name = message.name); return obj; @@ -4001,7 +4002,7 @@ export const GetCmekSettingsRequest = { name: isSet(object.name) ? String(object.name) : "" }; }, - toJSON(message: GetCmekSettingsRequest): unknown { + toJSON(message: GetCmekSettingsRequest): JsonSafe { const obj: any = {}; message.name !== undefined && (obj.name = message.name); return obj; @@ -4072,7 +4073,7 @@ export const UpdateCmekSettingsRequest = { updateMask: isSet(object.updateMask) ? FieldMask.fromJSON(object.updateMask) : undefined }; }, - toJSON(message: UpdateCmekSettingsRequest): unknown { + toJSON(message: UpdateCmekSettingsRequest): JsonSafe { const obj: any = {}; message.name !== undefined && (obj.name = message.name); message.cmekSettings !== undefined && (obj.cmekSettings = message.cmekSettings ? CmekSettings.toJSON(message.cmekSettings) : undefined); @@ -4151,7 +4152,7 @@ export const CmekSettings = { serviceAccountId: isSet(object.serviceAccountId) ? String(object.serviceAccountId) : "" }; }, - toJSON(message: CmekSettings): unknown { + toJSON(message: CmekSettings): JsonSafe { const obj: any = {}; message.name !== undefined && (obj.name = message.name); message.kmsKeyName !== undefined && (obj.kmsKeyName = message.kmsKeyName); @@ -4214,7 +4215,7 @@ export const GetSettingsRequest = { name: isSet(object.name) ? String(object.name) : "" }; }, - toJSON(message: GetSettingsRequest): unknown { + toJSON(message: GetSettingsRequest): JsonSafe { const obj: any = {}; message.name !== undefined && (obj.name = message.name); return obj; @@ -4285,7 +4286,7 @@ export const UpdateSettingsRequest = { updateMask: isSet(object.updateMask) ? FieldMask.fromJSON(object.updateMask) : undefined }; }, - toJSON(message: UpdateSettingsRequest): unknown { + toJSON(message: UpdateSettingsRequest): JsonSafe { const obj: any = {}; message.name !== undefined && (obj.name = message.name); message.settings !== undefined && (obj.settings = message.settings ? Settings.toJSON(message.settings) : undefined); @@ -4380,7 +4381,7 @@ export const Settings = { disableDefaultSink: isSet(object.disableDefaultSink) ? Boolean(object.disableDefaultSink) : false }; }, - toJSON(message: Settings): unknown { + toJSON(message: Settings): JsonSafe { const obj: any = {}; message.name !== undefined && (obj.name = message.name); message.kmsKeyName !== undefined && (obj.kmsKeyName = message.kmsKeyName); @@ -4467,7 +4468,7 @@ export const CopyLogEntriesRequest = { destination: isSet(object.destination) ? String(object.destination) : "" }; }, - toJSON(message: CopyLogEntriesRequest): unknown { + toJSON(message: CopyLogEntriesRequest): JsonSafe { const obj: any = {}; message.name !== undefined && (obj.name = message.name); message.filter !== undefined && (obj.filter = message.filter); @@ -4578,7 +4579,7 @@ export const CopyLogEntriesMetadata = { writerIdentity: isSet(object.writerIdentity) ? String(object.writerIdentity) : "" }; }, - toJSON(message: CopyLogEntriesMetadata): unknown { + toJSON(message: CopyLogEntriesMetadata): JsonSafe { const obj: any = {}; message.startTime !== undefined && (obj.startTime = message.startTime.toISOString()); message.endTime !== undefined && (obj.endTime = message.endTime.toISOString()); @@ -4657,7 +4658,7 @@ export const CopyLogEntriesResponse = { logEntriesCopiedCount: isSet(object.logEntriesCopiedCount) ? Long.fromValue(object.logEntriesCopiedCount) : Long.ZERO }; }, - toJSON(message: CopyLogEntriesResponse): unknown { + toJSON(message: CopyLogEntriesResponse): JsonSafe { const obj: any = {}; message.logEntriesCopiedCount !== undefined && (obj.logEntriesCopiedCount = (message.logEntriesCopiedCount || Long.ZERO).toString()); return obj; diff --git a/__fixtures__/output1/google/logging/v2/logging_metrics.ts b/__fixtures__/output1/google/logging/v2/logging_metrics.ts index 83d7374491..f79072d1ac 100644 --- a/__fixtures__/output1/google/logging/v2/logging_metrics.ts +++ b/__fixtures__/output1/google/logging/v2/logging_metrics.ts @@ -3,6 +3,7 @@ import { Distribution_BucketOptions } from "../../api/distribution"; import { Timestamp, TimestampSDKType } from "../../protobuf/timestamp"; import * as _m0 from "protobufjs/minimal"; import { isSet, DeepPartial, toTimestamp, fromTimestamp, isObject, fromJsonTimestamp } from "../../../helpers"; +import { JsonSafe } from "../../../json-safe"; export const protobufPackage = "google.logging.v2"; /** Logging API version. */ export enum LogMetric_ApiVersion { @@ -360,7 +361,7 @@ export const LogMetric_LabelExtractorsEntry = { value: isSet(object.value) ? String(object.value) : "" }; }, - toJSON(message: LogMetric_LabelExtractorsEntry): unknown { + toJSON(message: LogMetric_LabelExtractorsEntry): JsonSafe { const obj: any = {}; message.key !== undefined && (obj.key = message.key); message.value !== undefined && (obj.value = message.value); @@ -510,7 +511,7 @@ export const LogMetric = { version: isSet(object.version) ? logMetric_ApiVersionFromJSON(object.version) : -1 }; }, - toJSON(message: LogMetric): unknown { + toJSON(message: LogMetric): JsonSafe { const obj: any = {}; message.name !== undefined && (obj.name = message.name); message.description !== undefined && (obj.description = message.description); @@ -643,7 +644,7 @@ export const ListLogMetricsRequest = { pageSize: isSet(object.pageSize) ? Number(object.pageSize) : 0 }; }, - toJSON(message: ListLogMetricsRequest): unknown { + toJSON(message: ListLogMetricsRequest): JsonSafe { const obj: any = {}; message.parent !== undefined && (obj.parent = message.parent); message.pageToken !== undefined && (obj.pageToken = message.pageToken); @@ -714,7 +715,7 @@ export const ListLogMetricsResponse = { nextPageToken: isSet(object.nextPageToken) ? String(object.nextPageToken) : "" }; }, - toJSON(message: ListLogMetricsResponse): unknown { + toJSON(message: ListLogMetricsResponse): JsonSafe { const obj: any = {}; if (message.metrics) { obj.metrics = message.metrics.map(e => e ? LogMetric.toJSON(e) : undefined); @@ -781,7 +782,7 @@ export const GetLogMetricRequest = { metricName: isSet(object.metricName) ? String(object.metricName) : "" }; }, - toJSON(message: GetLogMetricRequest): unknown { + toJSON(message: GetLogMetricRequest): JsonSafe { const obj: any = {}; message.metricName !== undefined && (obj.metricName = message.metricName); return obj; @@ -844,7 +845,7 @@ export const CreateLogMetricRequest = { metric: isSet(object.metric) ? LogMetric.fromJSON(object.metric) : undefined }; }, - toJSON(message: CreateLogMetricRequest): unknown { + toJSON(message: CreateLogMetricRequest): JsonSafe { const obj: any = {}; message.parent !== undefined && (obj.parent = message.parent); message.metric !== undefined && (obj.metric = message.metric ? LogMetric.toJSON(message.metric) : undefined); @@ -911,7 +912,7 @@ export const UpdateLogMetricRequest = { metric: isSet(object.metric) ? LogMetric.fromJSON(object.metric) : undefined }; }, - toJSON(message: UpdateLogMetricRequest): unknown { + toJSON(message: UpdateLogMetricRequest): JsonSafe { const obj: any = {}; message.metricName !== undefined && (obj.metricName = message.metricName); message.metric !== undefined && (obj.metric = message.metric ? LogMetric.toJSON(message.metric) : undefined); @@ -970,7 +971,7 @@ export const DeleteLogMetricRequest = { metricName: isSet(object.metricName) ? String(object.metricName) : "" }; }, - toJSON(message: DeleteLogMetricRequest): unknown { + toJSON(message: DeleteLogMetricRequest): JsonSafe { const obj: any = {}; message.metricName !== undefined && (obj.metricName = message.metricName); return obj; diff --git a/__fixtures__/output1/google/longrunning/operations.ts b/__fixtures__/output1/google/longrunning/operations.ts index 56d09966b0..4bdaf3665a 100644 --- a/__fixtures__/output1/google/longrunning/operations.ts +++ b/__fixtures__/output1/google/longrunning/operations.ts @@ -3,6 +3,7 @@ import { Any, AnySDKType } from "../protobuf/any"; import { Status, StatusSDKType } from "../rpc/status"; import * as _m0 from "protobufjs/minimal"; import { isSet, DeepPartial } from "../../helpers"; +import { JsonSafe } from "../../json-safe"; export const protobufPackage = "google.longrunning"; /** * This resource represents a long-running operation that is the result of a @@ -245,7 +246,7 @@ export const Operation = { response: isSet(object.response) ? Any.fromJSON(object.response) : undefined }; }, - toJSON(message: Operation): unknown { + toJSON(message: Operation): JsonSafe { const obj: any = {}; message.name !== undefined && (obj.name = message.name); message.metadata !== undefined && (obj.metadata = message.metadata ? Any.toJSON(message.metadata) : undefined); @@ -316,7 +317,7 @@ export const GetOperationRequest = { name: isSet(object.name) ? String(object.name) : "" }; }, - toJSON(message: GetOperationRequest): unknown { + toJSON(message: GetOperationRequest): JsonSafe { const obj: any = {}; message.name !== undefined && (obj.name = message.name); return obj; @@ -395,7 +396,7 @@ export const ListOperationsRequest = { pageToken: isSet(object.pageToken) ? String(object.pageToken) : "" }; }, - toJSON(message: ListOperationsRequest): unknown { + toJSON(message: ListOperationsRequest): JsonSafe { const obj: any = {}; message.name !== undefined && (obj.name = message.name); message.filter !== undefined && (obj.filter = message.filter); @@ -470,7 +471,7 @@ export const ListOperationsResponse = { nextPageToken: isSet(object.nextPageToken) ? String(object.nextPageToken) : "" }; }, - toJSON(message: ListOperationsResponse): unknown { + toJSON(message: ListOperationsResponse): JsonSafe { const obj: any = {}; if (message.operations) { obj.operations = message.operations.map(e => e ? Operation.toJSON(e) : undefined); @@ -537,7 +538,7 @@ export const CancelOperationRequest = { name: isSet(object.name) ? String(object.name) : "" }; }, - toJSON(message: CancelOperationRequest): unknown { + toJSON(message: CancelOperationRequest): JsonSafe { const obj: any = {}; message.name !== undefined && (obj.name = message.name); return obj; @@ -592,7 +593,7 @@ export const DeleteOperationRequest = { name: isSet(object.name) ? String(object.name) : "" }; }, - toJSON(message: DeleteOperationRequest): unknown { + toJSON(message: DeleteOperationRequest): JsonSafe { const obj: any = {}; message.name !== undefined && (obj.name = message.name); return obj; @@ -655,7 +656,7 @@ export const WaitOperationRequest = { timeout: isSet(object.timeout) ? Duration.fromJSON(object.timeout) : undefined }; }, - toJSON(message: WaitOperationRequest): unknown { + toJSON(message: WaitOperationRequest): JsonSafe { const obj: any = {}; message.name !== undefined && (obj.name = message.name); message.timeout !== undefined && (obj.timeout = message.timeout ? Duration.toJSON(message.timeout) : undefined); @@ -722,7 +723,7 @@ export const OperationInfo = { metadataType: isSet(object.metadataType) ? String(object.metadataType) : "" }; }, - toJSON(message: OperationInfo): unknown { + toJSON(message: OperationInfo): JsonSafe { const obj: any = {}; message.responseType !== undefined && (obj.responseType = message.responseType); message.metadataType !== undefined && (obj.metadataType = message.metadataType); diff --git a/__fixtures__/output1/google/protobuf/any.ts b/__fixtures__/output1/google/protobuf/any.ts index d46948d6b2..c834b2f82e 100644 --- a/__fixtures__/output1/google/protobuf/any.ts +++ b/__fixtures__/output1/google/protobuf/any.ts @@ -1,5 +1,6 @@ import * as _m0 from "protobufjs/minimal"; import { isSet, bytesFromBase64, base64FromBytes, DeepPartial } from "../../helpers"; +import { JsonSafe } from "../../json-safe"; export const protobufPackage = "google.protobuf"; /** * `Any` contains an arbitrary serialized protocol buffer message along with a @@ -243,7 +244,7 @@ export const Any = { value: isSet(object.value) ? bytesFromBase64(object.value) : new Uint8Array() }; }, - toJSON(message: Any): unknown { + toJSON(message: Any): JsonSafe { const obj: any = {}; message.typeUrl !== undefined && (obj.typeUrl = message.typeUrl); message.value !== undefined && (obj.value = base64FromBytes(message.value !== undefined ? message.value : new Uint8Array())); diff --git a/__fixtures__/output1/google/protobuf/api.ts b/__fixtures__/output1/google/protobuf/api.ts index 9d81594435..08d9416baf 100644 --- a/__fixtures__/output1/google/protobuf/api.ts +++ b/__fixtures__/output1/google/protobuf/api.ts @@ -2,6 +2,7 @@ import { Option, OptionSDKType, Syntax, SyntaxSDKType, syntaxFromJSON, syntaxToJ import { SourceContext, SourceContextSDKType } from "./source_context"; import * as _m0 from "protobufjs/minimal"; import { isSet, DeepPartial } from "../../helpers"; +import { JsonSafe } from "../../json-safe"; export const protobufPackage = "google.protobuf"; /** * Api is a light-weight descriptor for an API Interface. @@ -358,7 +359,7 @@ export const Api = { syntax: isSet(object.syntax) ? syntaxFromJSON(object.syntax) : -1 }; }, - toJSON(message: Api): unknown { + toJSON(message: Api): JsonSafe { const obj: any = {}; message.name !== undefined && (obj.name = message.name); if (message.methods) { @@ -509,7 +510,7 @@ export const Method = { syntax: isSet(object.syntax) ? syntaxFromJSON(object.syntax) : -1 }; }, - toJSON(message: Method): unknown { + toJSON(message: Method): JsonSafe { const obj: any = {}; message.name !== undefined && (obj.name = message.name); message.requestTypeUrl !== undefined && (obj.requestTypeUrl = message.requestTypeUrl); @@ -604,7 +605,7 @@ export const Mixin = { root: isSet(object.root) ? String(object.root) : "" }; }, - toJSON(message: Mixin): unknown { + toJSON(message: Mixin): JsonSafe { const obj: any = {}; message.name !== undefined && (obj.name = message.name); message.root !== undefined && (obj.root = message.root); diff --git a/__fixtures__/output1/google/protobuf/compiler/plugin.ts b/__fixtures__/output1/google/protobuf/compiler/plugin.ts index 447132d0ca..300ec15d06 100644 --- a/__fixtures__/output1/google/protobuf/compiler/plugin.ts +++ b/__fixtures__/output1/google/protobuf/compiler/plugin.ts @@ -1,6 +1,7 @@ import { FileDescriptorProto, FileDescriptorProtoSDKType } from "../descriptor"; import * as _m0 from "protobufjs/minimal"; import { isSet, DeepPartial } from "../../../helpers"; +import { JsonSafe } from "../../../json-safe"; export const protobufPackage = "google.protobuf.compiler"; /** The version number of protocol compiler. */ export interface Version { @@ -200,7 +201,7 @@ export const Version = { suffix: isSet(object.suffix) ? String(object.suffix) : "" }; }, - toJSON(message: Version): unknown { + toJSON(message: Version): JsonSafe { const obj: any = {}; message.major !== undefined && (obj.major = Math.round(message.major)); message.minor !== undefined && (obj.minor = Math.round(message.minor)); @@ -291,7 +292,7 @@ export const CodeGeneratorRequest = { compilerVersion: isSet(object.compilerVersion) ? Version.fromJSON(object.compilerVersion) : undefined }; }, - toJSON(message: CodeGeneratorRequest): unknown { + toJSON(message: CodeGeneratorRequest): JsonSafe { const obj: any = {}; if (message.fileToGenerate) { obj.fileToGenerate = message.fileToGenerate.map(e => e); @@ -382,7 +383,7 @@ export const CodeGeneratorResponse = { file: Array.isArray(object?.file) ? object.file.map((e: any) => CodeGeneratorResponse_File.fromJSON(e)) : [] }; }, - toJSON(message: CodeGeneratorResponse): unknown { + toJSON(message: CodeGeneratorResponse): JsonSafe { const obj: any = {}; message.error !== undefined && (obj.error = message.error); if (message.file) { @@ -465,7 +466,7 @@ export const CodeGeneratorResponse_File = { content: isSet(object.content) ? String(object.content) : "" }; }, - toJSON(message: CodeGeneratorResponse_File): unknown { + toJSON(message: CodeGeneratorResponse_File): JsonSafe { const obj: any = {}; message.name !== undefined && (obj.name = message.name); message.insertionPoint !== undefined && (obj.insertionPoint = message.insertionPoint); diff --git a/__fixtures__/output1/google/protobuf/descriptor.ts b/__fixtures__/output1/google/protobuf/descriptor.ts index 83827f74bb..671f68d619 100644 --- a/__fixtures__/output1/google/protobuf/descriptor.ts +++ b/__fixtures__/output1/google/protobuf/descriptor.ts @@ -1,5 +1,6 @@ import { Long, DeepPartial, isSet, bytesFromBase64, base64FromBytes } from "../../helpers"; import * as _m0 from "protobufjs/minimal"; +import { JsonSafe } from "../../json-safe"; export const protobufPackage = "google.protobuf"; export enum FieldDescriptorProto_Type { /** @@ -1312,7 +1313,7 @@ export const FileDescriptorSet = { file: Array.isArray(object?.file) ? object.file.map((e: any) => FileDescriptorProto.fromJSON(e)) : [] }; }, - toJSON(message: FileDescriptorSet): unknown { + toJSON(message: FileDescriptorSet): JsonSafe { const obj: any = {}; if (message.file) { obj.file = message.file.map(e => e ? FileDescriptorProto.toJSON(e) : undefined); @@ -1481,7 +1482,7 @@ export const FileDescriptorProto = { syntax: isSet(object.syntax) ? String(object.syntax) : "" }; }, - toJSON(message: FileDescriptorProto): unknown { + toJSON(message: FileDescriptorProto): JsonSafe { const obj: any = {}; message.name !== undefined && (obj.name = message.name); message.package !== undefined && (obj.package = message.package); @@ -1708,7 +1709,7 @@ export const DescriptorProto = { reservedName: Array.isArray(object?.reservedName) ? object.reservedName.map((e: any) => String(e)) : [] }; }, - toJSON(message: DescriptorProto): unknown { + toJSON(message: DescriptorProto): JsonSafe { const obj: any = {}; message.name !== undefined && (obj.name = message.name); if (message.field) { @@ -1879,7 +1880,7 @@ export const DescriptorProto_ExtensionRange = { options: isSet(object.options) ? ExtensionRangeOptions.fromJSON(object.options) : undefined }; }, - toJSON(message: DescriptorProto_ExtensionRange): unknown { + toJSON(message: DescriptorProto_ExtensionRange): JsonSafe { const obj: any = {}; message.start !== undefined && (obj.start = Math.round(message.start)); message.end !== undefined && (obj.end = Math.round(message.end)); @@ -1950,7 +1951,7 @@ export const DescriptorProto_ReservedRange = { end: isSet(object.end) ? Number(object.end) : 0 }; }, - toJSON(message: DescriptorProto_ReservedRange): unknown { + toJSON(message: DescriptorProto_ReservedRange): JsonSafe { const obj: any = {}; message.start !== undefined && (obj.start = Math.round(message.start)); message.end !== undefined && (obj.end = Math.round(message.end)); @@ -2009,7 +2010,7 @@ export const ExtensionRangeOptions = { uninterpretedOption: Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [] }; }, - toJSON(message: ExtensionRangeOptions): unknown { + toJSON(message: ExtensionRangeOptions): JsonSafe { const obj: any = {}; if (message.uninterpretedOption) { obj.uninterpretedOption = message.uninterpretedOption.map(e => e ? UninterpretedOption.toJSON(e) : undefined); @@ -2144,7 +2145,7 @@ export const FieldDescriptorProto = { options: isSet(object.options) ? FieldOptions.fromJSON(object.options) : undefined }; }, - toJSON(message: FieldDescriptorProto): unknown { + toJSON(message: FieldDescriptorProto): JsonSafe { const obj: any = {}; message.name !== undefined && (obj.name = message.name); message.number !== undefined && (obj.number = Math.round(message.number)); @@ -2243,7 +2244,7 @@ export const OneofDescriptorProto = { options: isSet(object.options) ? OneofOptions.fromJSON(object.options) : undefined }; }, - toJSON(message: OneofDescriptorProto): unknown { + toJSON(message: OneofDescriptorProto): JsonSafe { const obj: any = {}; message.name !== undefined && (obj.name = message.name); message.options !== undefined && (obj.options = message.options ? OneofOptions.toJSON(message.options) : undefined); @@ -2334,7 +2335,7 @@ export const EnumDescriptorProto = { reservedName: Array.isArray(object?.reservedName) ? object.reservedName.map((e: any) => String(e)) : [] }; }, - toJSON(message: EnumDescriptorProto): unknown { + toJSON(message: EnumDescriptorProto): JsonSafe { const obj: any = {}; message.name !== undefined && (obj.name = message.name); if (message.value) { @@ -2437,7 +2438,7 @@ export const EnumDescriptorProto_EnumReservedRange = { end: isSet(object.end) ? Number(object.end) : 0 }; }, - toJSON(message: EnumDescriptorProto_EnumReservedRange): unknown { + toJSON(message: EnumDescriptorProto_EnumReservedRange): JsonSafe { const obj: any = {}; message.start !== undefined && (obj.start = Math.round(message.start)); message.end !== undefined && (obj.end = Math.round(message.end)); @@ -2512,7 +2513,7 @@ export const EnumValueDescriptorProto = { options: isSet(object.options) ? EnumValueOptions.fromJSON(object.options) : undefined }; }, - toJSON(message: EnumValueDescriptorProto): unknown { + toJSON(message: EnumValueDescriptorProto): JsonSafe { const obj: any = {}; message.name !== undefined && (obj.name = message.name); message.number !== undefined && (obj.number = Math.round(message.number)); @@ -2591,7 +2592,7 @@ export const ServiceDescriptorProto = { options: isSet(object.options) ? ServiceOptions.fromJSON(object.options) : undefined }; }, - toJSON(message: ServiceDescriptorProto): unknown { + toJSON(message: ServiceDescriptorProto): JsonSafe { const obj: any = {}; message.name !== undefined && (obj.name = message.name); if (message.method) { @@ -2702,7 +2703,7 @@ export const MethodDescriptorProto = { serverStreaming: isSet(object.serverStreaming) ? Boolean(object.serverStreaming) : false }; }, - toJSON(message: MethodDescriptorProto): unknown { + toJSON(message: MethodDescriptorProto): JsonSafe { const obj: any = {}; message.name !== undefined && (obj.name = message.name); message.inputType !== undefined && (obj.inputType = message.inputType); @@ -2937,7 +2938,7 @@ export const FileOptions = { uninterpretedOption: Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [] }; }, - toJSON(message: FileOptions): unknown { + toJSON(message: FileOptions): JsonSafe { const obj: any = {}; message.javaPackage !== undefined && (obj.javaPackage = message.javaPackage); message.javaOuterClassname !== undefined && (obj.javaOuterClassname = message.javaOuterClassname); @@ -3112,7 +3113,7 @@ export const MessageOptions = { uninterpretedOption: Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [] }; }, - toJSON(message: MessageOptions): unknown { + toJSON(message: MessageOptions): JsonSafe { const obj: any = {}; message.messageSetWireFormat !== undefined && (obj.messageSetWireFormat = message.messageSetWireFormat); message.noStandardDescriptorAccessor !== undefined && (obj.noStandardDescriptorAccessor = message.noStandardDescriptorAccessor); @@ -3239,7 +3240,7 @@ export const FieldOptions = { uninterpretedOption: Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [] }; }, - toJSON(message: FieldOptions): unknown { + toJSON(message: FieldOptions): JsonSafe { const obj: any = {}; message.ctype !== undefined && (obj.ctype = fieldOptions_CTypeToJSON(message.ctype)); message.packed !== undefined && (obj.packed = message.packed); @@ -3326,7 +3327,7 @@ export const OneofOptions = { uninterpretedOption: Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [] }; }, - toJSON(message: OneofOptions): unknown { + toJSON(message: OneofOptions): JsonSafe { const obj: any = {}; if (message.uninterpretedOption) { obj.uninterpretedOption = message.uninterpretedOption.map(e => e ? UninterpretedOption.toJSON(e) : undefined); @@ -3405,7 +3406,7 @@ export const EnumOptions = { uninterpretedOption: Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [] }; }, - toJSON(message: EnumOptions): unknown { + toJSON(message: EnumOptions): JsonSafe { const obj: any = {}; message.allowAlias !== undefined && (obj.allowAlias = message.allowAlias); message.deprecated !== undefined && (obj.deprecated = message.deprecated); @@ -3484,7 +3485,7 @@ export const EnumValueOptions = { uninterpretedOption: Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [] }; }, - toJSON(message: EnumValueOptions): unknown { + toJSON(message: EnumValueOptions): JsonSafe { const obj: any = {}; message.deprecated !== undefined && (obj.deprecated = message.deprecated); if (message.uninterpretedOption) { @@ -3559,7 +3560,7 @@ export const ServiceOptions = { uninterpretedOption: Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [] }; }, - toJSON(message: ServiceOptions): unknown { + toJSON(message: ServiceOptions): JsonSafe { const obj: any = {}; message.deprecated !== undefined && (obj.deprecated = message.deprecated); if (message.uninterpretedOption) { @@ -3642,7 +3643,7 @@ export const MethodOptions = { uninterpretedOption: Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [] }; }, - toJSON(message: MethodOptions): unknown { + toJSON(message: MethodOptions): JsonSafe { const obj: any = {}; message.deprecated !== undefined && (obj.deprecated = message.deprecated); message.idempotencyLevel !== undefined && (obj.idempotencyLevel = methodOptions_IdempotencyLevelToJSON(message.idempotencyLevel)); @@ -3761,7 +3762,7 @@ export const UninterpretedOption = { aggregateValue: isSet(object.aggregateValue) ? String(object.aggregateValue) : "" }; }, - toJSON(message: UninterpretedOption): unknown { + toJSON(message: UninterpretedOption): JsonSafe { const obj: any = {}; if (message.name) { obj.name = message.name.map(e => e ? UninterpretedOption_NamePart.toJSON(e) : undefined); @@ -3856,7 +3857,7 @@ export const UninterpretedOption_NamePart = { isExtension: isSet(object.isExtension) ? Boolean(object.isExtension) : false }; }, - toJSON(message: UninterpretedOption_NamePart): unknown { + toJSON(message: UninterpretedOption_NamePart): JsonSafe { const obj: any = {}; message.namePart !== undefined && (obj.namePart = message.namePart); message.isExtension !== undefined && (obj.isExtension = message.isExtension); @@ -3915,7 +3916,7 @@ export const SourceCodeInfo = { location: Array.isArray(object?.location) ? object.location.map((e: any) => SourceCodeInfo_Location.fromJSON(e)) : [] }; }, - toJSON(message: SourceCodeInfo): unknown { + toJSON(message: SourceCodeInfo): JsonSafe { const obj: any = {}; if (message.location) { obj.location = message.location.map(e => e ? SourceCodeInfo_Location.toJSON(e) : undefined); @@ -4028,7 +4029,7 @@ export const SourceCodeInfo_Location = { leadingDetachedComments: Array.isArray(object?.leadingDetachedComments) ? object.leadingDetachedComments.map((e: any) => String(e)) : [] }; }, - toJSON(message: SourceCodeInfo_Location): unknown { + toJSON(message: SourceCodeInfo_Location): JsonSafe { const obj: any = {}; if (message.path) { obj.path = message.path.map(e => Math.round(e)); @@ -4123,7 +4124,7 @@ export const GeneratedCodeInfo = { annotation: Array.isArray(object?.annotation) ? object.annotation.map((e: any) => GeneratedCodeInfo_Annotation.fromJSON(e)) : [] }; }, - toJSON(message: GeneratedCodeInfo): unknown { + toJSON(message: GeneratedCodeInfo): JsonSafe { const obj: any = {}; if (message.annotation) { obj.annotation = message.annotation.map(e => e ? GeneratedCodeInfo_Annotation.toJSON(e) : undefined); @@ -4219,7 +4220,7 @@ export const GeneratedCodeInfo_Annotation = { end: isSet(object.end) ? Number(object.end) : 0 }; }, - toJSON(message: GeneratedCodeInfo_Annotation): unknown { + toJSON(message: GeneratedCodeInfo_Annotation): JsonSafe { const obj: any = {}; if (message.path) { obj.path = message.path.map(e => Math.round(e)); diff --git a/__fixtures__/output1/google/protobuf/duration.ts b/__fixtures__/output1/google/protobuf/duration.ts index 8b6f506f54..33ab0d8c09 100644 --- a/__fixtures__/output1/google/protobuf/duration.ts +++ b/__fixtures__/output1/google/protobuf/duration.ts @@ -1,5 +1,6 @@ import { Long, isSet, DeepPartial } from "../../helpers"; import * as _m0 from "protobufjs/minimal"; +import { JsonSafe } from "../../json-safe"; export const protobufPackage = "google.protobuf"; /** * A Duration represents a signed, fixed-length span of time represented @@ -184,7 +185,7 @@ export const Duration = { nanos: isSet(object.nanos) ? Number(object.nanos) : 0 }; }, - toJSON(message: Duration): unknown { + toJSON(message: Duration): JsonSafe { const obj: any = {}; message.seconds !== undefined && (obj.seconds = (message.seconds || Long.ZERO).toString()); message.nanos !== undefined && (obj.nanos = Math.round(message.nanos)); diff --git a/__fixtures__/output1/google/protobuf/empty.ts b/__fixtures__/output1/google/protobuf/empty.ts index 5aa58ad577..bfaae09741 100644 --- a/__fixtures__/output1/google/protobuf/empty.ts +++ b/__fixtures__/output1/google/protobuf/empty.ts @@ -1,4 +1,5 @@ import * as _m0 from "protobufjs/minimal"; +import { JsonSafe } from "../../json-safe"; import { DeepPartial } from "../../helpers"; export const protobufPackage = "google.protobuf"; /** @@ -49,7 +50,7 @@ export const Empty = { fromJSON(_: any): Empty { return {}; }, - toJSON(_: Empty): unknown { + toJSON(_: Empty): JsonSafe { const obj: any = {}; return obj; }, diff --git a/__fixtures__/output1/google/protobuf/field_mask.ts b/__fixtures__/output1/google/protobuf/field_mask.ts index b8130e057d..886f361c52 100644 --- a/__fixtures__/output1/google/protobuf/field_mask.ts +++ b/__fixtures__/output1/google/protobuf/field_mask.ts @@ -1,4 +1,5 @@ import * as _m0 from "protobufjs/minimal"; +import { JsonSafe } from "../../json-safe"; import { DeepPartial } from "../../helpers"; export const protobufPackage = "google.protobuf"; /** @@ -444,7 +445,7 @@ export const FieldMask = { paths: Array.isArray(object?.paths) ? object.paths.map((e: any) => String(e)) : [] }; }, - toJSON(message: FieldMask): unknown { + toJSON(message: FieldMask): JsonSafe { const obj: any = {}; if (message.paths) { obj.paths = message.paths.map(e => e); diff --git a/__fixtures__/output1/google/protobuf/source_context.ts b/__fixtures__/output1/google/protobuf/source_context.ts index 2ba88a6523..459ae1f144 100644 --- a/__fixtures__/output1/google/protobuf/source_context.ts +++ b/__fixtures__/output1/google/protobuf/source_context.ts @@ -1,5 +1,6 @@ import * as _m0 from "protobufjs/minimal"; import { isSet, DeepPartial } from "../../helpers"; +import { JsonSafe } from "../../json-safe"; export const protobufPackage = "google.protobuf"; /** * `SourceContext` represents information about the source of a @@ -53,7 +54,7 @@ export const SourceContext = { fileName: isSet(object.fileName) ? String(object.fileName) : "" }; }, - toJSON(message: SourceContext): unknown { + toJSON(message: SourceContext): JsonSafe { const obj: any = {}; message.fileName !== undefined && (obj.fileName = message.fileName); return obj; diff --git a/__fixtures__/output1/google/protobuf/struct.ts b/__fixtures__/output1/google/protobuf/struct.ts index 3ec120c446..af9e8ef865 100644 --- a/__fixtures__/output1/google/protobuf/struct.ts +++ b/__fixtures__/output1/google/protobuf/struct.ts @@ -1,5 +1,6 @@ import * as _m0 from "protobufjs/minimal"; import { isSet, DeepPartial, isObject } from "../../helpers"; +import { JsonSafe } from "../../json-safe"; export const protobufPackage = "google.protobuf"; /** * `NullValue` is a singleton enumeration to represent the null value for the @@ -169,7 +170,7 @@ export const Struct_FieldsEntry = { value: isSet(object.value) ? Value.fromJSON(object.value) : undefined }; }, - toJSON(message: Struct_FieldsEntry): unknown { + toJSON(message: Struct_FieldsEntry): JsonSafe { const obj: any = {}; message.key !== undefined && (obj.key = message.key); message.value !== undefined && (obj.value = message.value ? Value.toJSON(message.value) : undefined); @@ -239,7 +240,7 @@ export const Struct = { }, {}) : {} }; }, - toJSON(message: Struct): unknown { + toJSON(message: Struct): JsonSafe { const obj: any = {}; obj.fields = {}; if (message.fields) { @@ -356,7 +357,7 @@ export const Value = { listValue: isSet(object.listValue) ? ListValue.fromJSON(object.listValue) : undefined }; }, - toJSON(message: Value): unknown { + toJSON(message: Value): JsonSafe { const obj: any = {}; message.nullValue !== undefined && (obj.nullValue = nullValueToJSON(message.nullValue)); message.numberValue !== undefined && (obj.numberValue = message.numberValue); @@ -431,7 +432,7 @@ export const ListValue = { values: Array.isArray(object?.values) ? object.values.map((e: any) => Value.fromJSON(e)) : [] }; }, - toJSON(message: ListValue): unknown { + toJSON(message: ListValue): JsonSafe { const obj: any = {}; if (message.values) { obj.values = message.values.map(e => e ? Value.toJSON(e) : undefined); diff --git a/__fixtures__/output1/google/protobuf/timestamp.ts b/__fixtures__/output1/google/protobuf/timestamp.ts index 4e369c9a74..34b82c92a6 100644 --- a/__fixtures__/output1/google/protobuf/timestamp.ts +++ b/__fixtures__/output1/google/protobuf/timestamp.ts @@ -1,5 +1,6 @@ import { Long, isSet, DeepPartial } from "../../helpers"; import * as _m0 from "protobufjs/minimal"; +import { JsonSafe } from "../../json-safe"; export const protobufPackage = "google.protobuf"; /** * A Timestamp represents a point in time independent of any time zone or local @@ -230,7 +231,7 @@ export const Timestamp = { nanos: isSet(object.nanos) ? Number(object.nanos) : 0 }; }, - toJSON(message: Timestamp): unknown { + toJSON(message: Timestamp): JsonSafe { const obj: any = {}; message.seconds !== undefined && (obj.seconds = (message.seconds || Long.ZERO).toString()); message.nanos !== undefined && (obj.nanos = Math.round(message.nanos)); diff --git a/__fixtures__/output1/google/protobuf/type.ts b/__fixtures__/output1/google/protobuf/type.ts index 5aef44f442..c8eb8eb4df 100644 --- a/__fixtures__/output1/google/protobuf/type.ts +++ b/__fixtures__/output1/google/protobuf/type.ts @@ -2,6 +2,7 @@ import { SourceContext, SourceContextSDKType } from "./source_context"; import { Any, AnySDKType } from "./any"; import * as _m0 from "protobufjs/minimal"; import { isSet, DeepPartial } from "../../helpers"; +import { JsonSafe } from "../../json-safe"; export const protobufPackage = "google.protobuf"; /** Basic field types. */ export enum Field_Kind { @@ -442,7 +443,7 @@ export const Type = { syntax: isSet(object.syntax) ? syntaxFromJSON(object.syntax) : -1 }; }, - toJSON(message: Type): unknown { + toJSON(message: Type): JsonSafe { const obj: any = {}; message.name !== undefined && (obj.name = message.name); if (message.fields) { @@ -613,7 +614,7 @@ export const Field = { defaultValue: isSet(object.defaultValue) ? String(object.defaultValue) : "" }; }, - toJSON(message: Field): unknown { + toJSON(message: Field): JsonSafe { const obj: any = {}; message.kind !== undefined && (obj.kind = field_KindToJSON(message.kind)); message.cardinality !== undefined && (obj.cardinality = field_CardinalityToJSON(message.cardinality)); @@ -744,7 +745,7 @@ export const Enum = { syntax: isSet(object.syntax) ? syntaxFromJSON(object.syntax) : -1 }; }, - toJSON(message: Enum): unknown { + toJSON(message: Enum): JsonSafe { const obj: any = {}; message.name !== undefined && (obj.name = message.name); if (message.enumvalue) { @@ -847,7 +848,7 @@ export const EnumValue = { options: Array.isArray(object?.options) ? object.options.map((e: any) => Option.fromJSON(e)) : [] }; }, - toJSON(message: EnumValue): unknown { + toJSON(message: EnumValue): JsonSafe { const obj: any = {}; message.name !== undefined && (obj.name = message.name); message.number !== undefined && (obj.number = Math.round(message.number)); @@ -926,7 +927,7 @@ export const Option = { value: isSet(object.value) ? Any.fromJSON(object.value) : undefined }; }, - toJSON(message: Option): unknown { + toJSON(message: Option): JsonSafe