Skip to content

Commit

Permalink
default JsonSafe for toJSON
Browse files Browse the repository at this point in the history
  • Loading branch information
pyramation committed May 25, 2024
1 parent 543146c commit 8c8306a
Show file tree
Hide file tree
Showing 2,256 changed files with 12,365 additions and 26,799 deletions.
Original file line number Diff line number Diff line change
@@ -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";
/**
Expand Down Expand Up @@ -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<DepositDeploymentAuthorization> {
const obj: any = {};
message.spendLimit !== undefined && (obj.spendLimit = message.spendLimit ? Coin.toJSON(message.spendLimit) : undefined);
return obj;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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. */
Expand Down Expand Up @@ -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<GenericAuthorization> {
const obj: any = {};
message.msg !== undefined && (obj.msg = message.msg);
return obj;
Expand Down Expand Up @@ -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<Grant> {
const obj: any = {};
message.authorization !== undefined && (obj.authorization = message.authorization ? GlobalDecoderRegistry.toJSON(message.authorization) : undefined);
message.expiration !== undefined && (obj.expiration = message.expiration.toISOString());
Expand Down Expand Up @@ -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<GrantAuthorization> {
const obj: any = {};
message.granter !== undefined && (obj.granter = message.granter);
message.grantee !== undefined && (obj.grantee = message.grantee);
Expand Down Expand Up @@ -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<GrantQueueItem> {
const obj: any = {};
if (message.msgTypeUrls) {
obj.msgTypeUrls = message.msgTypeUrls.map(e => e);
Expand Down Expand Up @@ -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<Grants> {
const obj: any = {};
if (message.authorization) {
obj.authorization = message.authorization.map(e => e ? GlobalDecoderRegistry.toJSON(e) : undefined);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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";
/**
Expand Down Expand Up @@ -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<MsgGrant> {
const obj: any = {};
message.granter !== undefined && (obj.granter = message.granter);
message.grantee !== undefined && (obj.grantee = message.grantee);
Expand Down Expand Up @@ -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<MsgExecResponse> {
const obj: any = {};
if (message.results) {
obj.results = message.results.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array()));
Expand Down Expand Up @@ -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<MsgExec> {
const obj: any = {};
message.grantee !== undefined && (obj.grantee = message.grantee);
if (message.msgs) {
Expand Down Expand Up @@ -602,7 +603,7 @@ export const MsgGrantResponse = {
const obj = createBaseMsgGrantResponse();
return obj;
},
toJSON(_: MsgGrantResponse): unknown {
toJSON(_: MsgGrantResponse): JsonSafe<MsgGrantResponse> {
const obj: any = {};
return obj;
},
Expand Down Expand Up @@ -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<MsgRevoke> {
const obj: any = {};
message.granter !== undefined && (obj.granter = message.granter);
message.grantee !== undefined && (obj.grantee = message.grantee);
Expand Down Expand Up @@ -828,7 +829,7 @@ export const MsgRevokeResponse = {
const obj = createBaseMsgRevokeResponse();
return obj;
},
toJSON(_: MsgRevokeResponse): unknown {
toJSON(_: MsgRevokeResponse): JsonSafe<MsgRevokeResponse> {
const obj: any = {};
return obj;
},
Expand Down
Original file line number Diff line number Diff line change
@@ -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";
Expand Down Expand Up @@ -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<SendAuthorization> {
const obj: any = {};
if (message.spendLimit) {
obj.spendLimit = message.spendLimit.map(e => e ? Coin.toJSON(e) : undefined);
Expand Down
Original file line number Diff line number Diff line change
@@ -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";
/**
Expand Down Expand Up @@ -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<MsgInstantiateContract2> {
const obj: any = {};
message.codeId !== undefined && (obj.codeId = (message.codeId || BigInt(0)).toString());
message.label !== undefined && (obj.label = message.label);
Expand Down
Original file line number Diff line number Diff line change
@@ -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";
/**
Expand Down Expand Up @@ -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<Coin> {
const obj: any = {};
message.denom !== undefined && (obj.denom = message.denom);
message.amount !== undefined && (obj.amount = message.amount);
Expand Down Expand Up @@ -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<DecCoin> {
const obj: any = {};
message.denom !== undefined && (obj.denom = message.denom);
message.amount !== undefined && (obj.amount = message.amount);
Expand Down Expand Up @@ -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<IntProto> {
const obj: any = {};
message.int !== undefined && (obj.int = message.int);
return obj;
Expand Down Expand Up @@ -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<DecProto> {
const obj: any = {};
message.dec !== undefined && (obj.dec = message.dec);
return obj;
Expand Down
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down Expand Up @@ -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<InterfaceDescriptor> {
const obj: any = {};
message.name !== undefined && (obj.name = message.name);
message.description !== undefined && (obj.description = message.description);
Expand Down Expand Up @@ -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<ScalarDescriptor> {
const obj: any = {};
message.name !== undefined && (obj.name = message.name);
message.description !== undefined && (obj.description = message.description);
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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<Any> {
const obj: any = {};
message.typeUrl !== undefined && (obj.typeUrl = message.typeUrl);
message.value !== undefined && (obj.value = base64FromBytes(message.value !== undefined ? message.value : new Uint8Array()));
Expand Down
Loading

0 comments on commit 8c8306a

Please sign in to comment.