Skip to content

Commit

Permalink
Merge pull request #330 from Zetazzz/fix-type-mismatch
Browse files Browse the repository at this point in the history
Fix type mismatch
  • Loading branch information
pyramation authored Mar 28, 2023
2 parents 9ebdfdd + 184e898 commit 1dd0044
Show file tree
Hide file tree
Showing 496 changed files with 17,630 additions and 1,306 deletions.
14 changes: 7 additions & 7 deletions __fixtures__/v-next/outputv2/cosmos/authz/v1beta1/authz.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { DepositDeploymentAuthorizationSDKType as DepositDeploymentAuthorization
import { SendAuthorization, SendAuthorizationProtoMsg, SendAuthorizationSDKType } from "../../bank/v1beta1/authz";
import { StakeAuthorization, StakeAuthorizationProtoMsg, StakeAuthorizationSDKType } from "../../staking/v1beta1/authz";
import * as _m0 from "protobufjs/minimal";
import { isSet, DeepPartial, toTimestamp, fromTimestamp, fromJsonTimestamp } from "../../../helpers";
import { isSet, DeepPartial, toTimestamp, fromTimestamp } from "../../../helpers";
export const protobufPackage = "cosmos.authz.v1beta1";

/**
Expand Down Expand Up @@ -327,7 +327,7 @@ export const Grant = {
fromJSON(object: any): Grant {
return {
authorization: isSet(object.authorization) ? Any.fromJSON(object.authorization) : undefined,
expiration: isSet(object.expiration) ? fromJsonTimestamp(object.expiration) : undefined
expiration: isSet(object.expiration) ? new Date(object.expiration) : undefined
};
},

Expand All @@ -348,14 +348,14 @@ export const Grant = {
fromSDK(object: GrantSDKType): Grant {
return {
authorization: object.authorization ? Any.fromSDK(object.authorization) : undefined,
expiration: object.expiration ? Timestamp.fromSDK(object.expiration) : undefined
expiration: object.expiration ?? undefined
};
},

toSDK(message: Grant): GrantSDKType {
const obj: any = {};
message.authorization !== undefined && (obj.authorization = message.authorization ? Any.toSDK(message.authorization) : undefined);
message.expiration !== undefined && (obj.expiration = message.expiration ? Timestamp.toSDK(message.expiration) : undefined);
message.expiration !== undefined && (obj.expiration = message.expiration ?? undefined);
return obj;
},

Expand Down Expand Up @@ -473,7 +473,7 @@ export const GrantAuthorization = {
granter: isSet(object.granter) ? String(object.granter) : "",
grantee: isSet(object.grantee) ? String(object.grantee) : "",
authorization: isSet(object.authorization) ? Any.fromJSON(object.authorization) : undefined,
expiration: isSet(object.expiration) ? fromJsonTimestamp(object.expiration) : undefined
expiration: isSet(object.expiration) ? new Date(object.expiration) : undefined
};
},

Expand All @@ -500,7 +500,7 @@ export const GrantAuthorization = {
granter: object?.granter,
grantee: object?.grantee,
authorization: object.authorization ? Any.fromSDK(object.authorization) : undefined,
expiration: object.expiration ? Timestamp.fromSDK(object.expiration) : undefined
expiration: object.expiration ?? undefined
};
},

Expand All @@ -509,7 +509,7 @@ export const GrantAuthorization = {
obj.granter = message.granter;
obj.grantee = message.grantee;
message.authorization !== undefined && (obj.authorization = message.authorization ? Any.toSDK(message.authorization) : undefined);
message.expiration !== undefined && (obj.expiration = message.expiration ? Timestamp.toSDK(message.expiration) : undefined);
message.expiration !== undefined && (obj.expiration = message.expiration ?? undefined);
return obj;
},

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Timestamp, TimestampAmino, TimestampSDKType } from "../../../google/protobuf/timestamp";
import { Long, toTimestamp, fromTimestamp, isSet, fromJsonTimestamp, DeepPartial } from "../../../helpers";
import { Long, toTimestamp, fromTimestamp, isSet, DeepPartial } from "../../../helpers";
import * as _m0 from "protobufjs/minimal";
export const protobufPackage = "cosmos.evidence.v1beta1";

Expand Down Expand Up @@ -114,7 +114,7 @@ export const Equivocation = {
fromJSON(object: any): Equivocation {
return {
height: isSet(object.height) ? Long.fromValue(object.height) : Long.ZERO,
time: isSet(object.time) ? fromJsonTimestamp(object.time) : undefined,
time: isSet(object.time) ? new Date(object.time) : undefined,
power: isSet(object.power) ? Long.fromValue(object.power) : Long.ZERO,
consensusAddress: isSet(object.consensusAddress) ? String(object.consensusAddress) : ""
};
Expand All @@ -141,7 +141,7 @@ export const Equivocation = {
fromSDK(object: EquivocationSDKType): Equivocation {
return {
height: object?.height,
time: object.time ? Timestamp.fromSDK(object.time) : undefined,
time: object.time ?? undefined,
power: object?.power,
consensusAddress: object?.consensus_address
};
Expand All @@ -150,7 +150,7 @@ export const Equivocation = {
toSDK(message: Equivocation): EquivocationSDKType {
const obj: any = {};
obj.height = message.height;
message.time !== undefined && (obj.time = message.time ? Timestamp.toSDK(message.time) : undefined);
message.time !== undefined && (obj.time = message.time ?? undefined);
obj.power = message.power;
obj.consensus_address = message.consensusAddress;
return obj;
Expand Down
14 changes: 7 additions & 7 deletions __fixtures__/v-next/outputv2/cosmos/feegrant/v1beta1/feegrant.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { Timestamp, TimestampAmino, TimestampSDKType } from "../../../google/pro
import { Duration, DurationAmino, DurationSDKType } from "../../../google/protobuf/duration";
import { Any, AnyProtoMsg, AnyAmino, AnySDKType } from "../../../google/protobuf/any";
import * as _m0 from "protobufjs/minimal";
import { toTimestamp, fromTimestamp, isSet, fromJsonTimestamp, DeepPartial } from "../../../helpers";
import { toTimestamp, fromTimestamp, isSet, DeepPartial } from "../../../helpers";
export const protobufPackage = "cosmos.feegrant.v1beta1";

/**
Expand Down Expand Up @@ -268,7 +268,7 @@ export const BasicAllowance = {
fromJSON(object: any): BasicAllowance {
return {
spendLimit: Array.isArray(object?.spendLimit) ? object.spendLimit.map((e: any) => Coin.fromJSON(e)) : [],
expiration: isSet(object.expiration) ? fromJsonTimestamp(object.expiration) : undefined
expiration: isSet(object.expiration) ? new Date(object.expiration) : undefined
};
},

Expand All @@ -295,7 +295,7 @@ export const BasicAllowance = {
fromSDK(object: BasicAllowanceSDKType): BasicAllowance {
return {
spendLimit: Array.isArray(object?.spend_limit) ? object.spend_limit.map((e: any) => Coin.fromSDK(e)) : [],
expiration: object.expiration ? Timestamp.fromSDK(object.expiration) : undefined
expiration: object.expiration ?? undefined
};
},

Expand All @@ -308,7 +308,7 @@ export const BasicAllowance = {
obj.spend_limit = [];
}

message.expiration !== undefined && (obj.expiration = message.expiration ? Timestamp.toSDK(message.expiration) : undefined);
message.expiration !== undefined && (obj.expiration = message.expiration ?? undefined);
return obj;
},

Expand Down Expand Up @@ -442,7 +442,7 @@ export const PeriodicAllowance = {
period: isSet(object.period) ? Duration.fromJSON(object.period) : undefined,
periodSpendLimit: Array.isArray(object?.periodSpendLimit) ? object.periodSpendLimit.map((e: any) => Coin.fromJSON(e)) : [],
periodCanSpend: Array.isArray(object?.periodCanSpend) ? object.periodCanSpend.map((e: any) => Coin.fromJSON(e)) : [],
periodReset: isSet(object.periodReset) ? fromJsonTimestamp(object.periodReset) : undefined
periodReset: isSet(object.periodReset) ? new Date(object.periodReset) : undefined
};
},

Expand Down Expand Up @@ -483,7 +483,7 @@ export const PeriodicAllowance = {
period: object.period ? Duration.fromSDK(object.period) : undefined,
periodSpendLimit: Array.isArray(object?.period_spend_limit) ? object.period_spend_limit.map((e: any) => Coin.fromSDK(e)) : [],
periodCanSpend: Array.isArray(object?.period_can_spend) ? object.period_can_spend.map((e: any) => Coin.fromSDK(e)) : [],
periodReset: object.period_reset ? Timestamp.fromSDK(object.period_reset) : undefined
periodReset: object.period_reset ?? undefined
};
},

Expand All @@ -504,7 +504,7 @@ export const PeriodicAllowance = {
obj.period_can_spend = [];
}

message.periodReset !== undefined && (obj.period_reset = message.periodReset ? Timestamp.toSDK(message.periodReset) : undefined);
message.periodReset !== undefined && (obj.period_reset = message.periodReset ?? undefined);
return obj;
},

Expand Down
26 changes: 13 additions & 13 deletions __fixtures__/v-next/outputv2/cosmos/gov/v1/gov.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { Any, AnyProtoMsg, AnyAmino, AnySDKType } from "../../../google/protobuf
import { Timestamp, TimestampAmino, TimestampSDKType } from "../../../google/protobuf/timestamp";
import { Duration, DurationAmino, DurationSDKType } from "../../../google/protobuf/duration";
import * as _m0 from "protobufjs/minimal";
import { isSet, DeepPartial, Long, toTimestamp, fromTimestamp, fromJsonTimestamp } from "../../../helpers";
import { isSet, DeepPartial, Long, toTimestamp, fromTimestamp } from "../../../helpers";
export const protobufPackage = "cosmos.gov.v1";

/** VoteOption enumerates the valid vote options for a given governance proposal. */
Expand Down Expand Up @@ -907,11 +907,11 @@ export const Proposal = {
messages: Array.isArray(object?.messages) ? object.messages.map((e: any) => Any.fromJSON(e)) : [],
status: isSet(object.status) ? proposalStatusFromJSON(object.status) : 0,
finalTallyResult: isSet(object.finalTallyResult) ? TallyResult.fromJSON(object.finalTallyResult) : undefined,
submitTime: isSet(object.submitTime) ? fromJsonTimestamp(object.submitTime) : undefined,
depositEndTime: isSet(object.depositEndTime) ? fromJsonTimestamp(object.depositEndTime) : undefined,
submitTime: isSet(object.submitTime) ? new Date(object.submitTime) : undefined,
depositEndTime: isSet(object.depositEndTime) ? new Date(object.depositEndTime) : undefined,
totalDeposit: Array.isArray(object?.totalDeposit) ? object.totalDeposit.map((e: any) => Coin.fromJSON(e)) : [],
votingStartTime: isSet(object.votingStartTime) ? fromJsonTimestamp(object.votingStartTime) : undefined,
votingEndTime: isSet(object.votingEndTime) ? fromJsonTimestamp(object.votingEndTime) : undefined,
votingStartTime: isSet(object.votingStartTime) ? new Date(object.votingStartTime) : undefined,
votingEndTime: isSet(object.votingEndTime) ? new Date(object.votingEndTime) : undefined,
metadata: isSet(object.metadata) ? String(object.metadata) : ""
};
},
Expand Down Expand Up @@ -964,11 +964,11 @@ export const Proposal = {
messages: Array.isArray(object?.messages) ? object.messages.map((e: any) => Any.fromSDK(e)) : [],
status: isSet(object.status) ? proposalStatusFromJSON(object.status) : 0,
finalTallyResult: object.final_tally_result ? TallyResult.fromSDK(object.final_tally_result) : undefined,
submitTime: object.submit_time ? Timestamp.fromSDK(object.submit_time) : undefined,
depositEndTime: object.deposit_end_time ? Timestamp.fromSDK(object.deposit_end_time) : undefined,
submitTime: object.submit_time ?? undefined,
depositEndTime: object.deposit_end_time ?? undefined,
totalDeposit: Array.isArray(object?.total_deposit) ? object.total_deposit.map((e: any) => Coin.fromSDK(e)) : [],
votingStartTime: object.voting_start_time ? Timestamp.fromSDK(object.voting_start_time) : undefined,
votingEndTime: object.voting_end_time ? Timestamp.fromSDK(object.voting_end_time) : undefined,
votingStartTime: object.voting_start_time ?? undefined,
votingEndTime: object.voting_end_time ?? undefined,
metadata: object?.metadata
};
},
Expand All @@ -985,17 +985,17 @@ export const Proposal = {

message.status !== undefined && (obj.status = proposalStatusToJSON(message.status));
message.finalTallyResult !== undefined && (obj.final_tally_result = message.finalTallyResult ? TallyResult.toSDK(message.finalTallyResult) : undefined);
message.submitTime !== undefined && (obj.submit_time = message.submitTime ? Timestamp.toSDK(message.submitTime) : undefined);
message.depositEndTime !== undefined && (obj.deposit_end_time = message.depositEndTime ? Timestamp.toSDK(message.depositEndTime) : undefined);
message.submitTime !== undefined && (obj.submit_time = message.submitTime ?? undefined);
message.depositEndTime !== undefined && (obj.deposit_end_time = message.depositEndTime ?? undefined);

if (message.totalDeposit) {
obj.total_deposit = message.totalDeposit.map(e => e ? Coin.toSDK(e) : undefined);
} else {
obj.total_deposit = [];
}

message.votingStartTime !== undefined && (obj.voting_start_time = message.votingStartTime ? Timestamp.toSDK(message.votingStartTime) : undefined);
message.votingEndTime !== undefined && (obj.voting_end_time = message.votingEndTime ? Timestamp.toSDK(message.votingEndTime) : undefined);
message.votingStartTime !== undefined && (obj.voting_start_time = message.votingStartTime ?? undefined);
message.votingEndTime !== undefined && (obj.voting_end_time = message.votingEndTime ?? undefined);
obj.metadata = message.metadata;
return obj;
},
Expand Down
26 changes: 13 additions & 13 deletions __fixtures__/v-next/outputv2/cosmos/gov/v1beta1/gov.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { ReplacePoolIncentivesProposal, ReplacePoolIncentivesProposalProtoMsg, R
import { SetSuperfluidAssetsProposal, SetSuperfluidAssetsProposalProtoMsg, SetSuperfluidAssetsProposalSDKType, RemoveSuperfluidAssetsProposal, RemoveSuperfluidAssetsProposalProtoMsg, RemoveSuperfluidAssetsProposalSDKType, UpdateUnpoolWhiteListProposal, UpdateUnpoolWhiteListProposalProtoMsg, UpdateUnpoolWhiteListProposalSDKType } from "../../../osmosis/superfluid/v1beta1/gov";
import { UpdateFeeTokenProposal, UpdateFeeTokenProposalProtoMsg, UpdateFeeTokenProposalSDKType } from "../../../osmosis/txfees/v1beta1/gov";
import * as _m0 from "protobufjs/minimal";
import { isSet, DeepPartial, Long, toTimestamp, fromTimestamp, fromJsonTimestamp, bytesFromBase64, base64FromBytes } from "../../../helpers";
import { isSet, DeepPartial, Long, toTimestamp, fromTimestamp, bytesFromBase64, base64FromBytes } from "../../../helpers";
export const protobufPackage = "cosmos.gov.v1beta1";

/** VoteOption enumerates the valid vote options for a given governance proposal. */
Expand Down Expand Up @@ -1090,11 +1090,11 @@ export const Proposal = {
content: isSet(object.content) ? Any.fromJSON(object.content) : undefined,
status: isSet(object.status) ? proposalStatusFromJSON(object.status) : 0,
finalTallyResult: isSet(object.finalTallyResult) ? TallyResult.fromJSON(object.finalTallyResult) : undefined,
submitTime: isSet(object.submitTime) ? fromJsonTimestamp(object.submitTime) : undefined,
depositEndTime: isSet(object.depositEndTime) ? fromJsonTimestamp(object.depositEndTime) : undefined,
submitTime: isSet(object.submitTime) ? new Date(object.submitTime) : undefined,
depositEndTime: isSet(object.depositEndTime) ? new Date(object.depositEndTime) : undefined,
totalDeposit: Array.isArray(object?.totalDeposit) ? object.totalDeposit.map((e: any) => Coin.fromJSON(e)) : [],
votingStartTime: isSet(object.votingStartTime) ? fromJsonTimestamp(object.votingStartTime) : undefined,
votingEndTime: isSet(object.votingEndTime) ? fromJsonTimestamp(object.votingEndTime) : undefined
votingStartTime: isSet(object.votingStartTime) ? new Date(object.votingStartTime) : undefined,
votingEndTime: isSet(object.votingEndTime) ? new Date(object.votingEndTime) : undefined
};
},

Expand Down Expand Up @@ -1138,11 +1138,11 @@ export const Proposal = {
content: object.content ? Any.fromSDK(object.content) : undefined,
status: isSet(object.status) ? proposalStatusFromJSON(object.status) : 0,
finalTallyResult: object.final_tally_result ? TallyResult.fromSDK(object.final_tally_result) : undefined,
submitTime: object.submit_time ? Timestamp.fromSDK(object.submit_time) : undefined,
depositEndTime: object.deposit_end_time ? Timestamp.fromSDK(object.deposit_end_time) : undefined,
submitTime: object.submit_time ?? undefined,
depositEndTime: object.deposit_end_time ?? undefined,
totalDeposit: Array.isArray(object?.total_deposit) ? object.total_deposit.map((e: any) => Coin.fromSDK(e)) : [],
votingStartTime: object.voting_start_time ? Timestamp.fromSDK(object.voting_start_time) : undefined,
votingEndTime: object.voting_end_time ? Timestamp.fromSDK(object.voting_end_time) : undefined
votingStartTime: object.voting_start_time ?? undefined,
votingEndTime: object.voting_end_time ?? undefined
};
},

Expand All @@ -1152,17 +1152,17 @@ export const Proposal = {
message.content !== undefined && (obj.content = message.content ? Any.toSDK(message.content) : undefined);
message.status !== undefined && (obj.status = proposalStatusToJSON(message.status));
message.finalTallyResult !== undefined && (obj.final_tally_result = message.finalTallyResult ? TallyResult.toSDK(message.finalTallyResult) : undefined);
message.submitTime !== undefined && (obj.submit_time = message.submitTime ? Timestamp.toSDK(message.submitTime) : undefined);
message.depositEndTime !== undefined && (obj.deposit_end_time = message.depositEndTime ? Timestamp.toSDK(message.depositEndTime) : undefined);
message.submitTime !== undefined && (obj.submit_time = message.submitTime ?? undefined);
message.depositEndTime !== undefined && (obj.deposit_end_time = message.depositEndTime ?? undefined);

if (message.totalDeposit) {
obj.total_deposit = message.totalDeposit.map(e => e ? Coin.toSDK(e) : undefined);
} else {
obj.total_deposit = [];
}

message.votingStartTime !== undefined && (obj.voting_start_time = message.votingStartTime ? Timestamp.toSDK(message.votingStartTime) : undefined);
message.votingEndTime !== undefined && (obj.voting_end_time = message.votingEndTime ? Timestamp.toSDK(message.votingEndTime) : undefined);
message.votingStartTime !== undefined && (obj.voting_start_time = message.votingStartTime ?? undefined);
message.votingEndTime !== undefined && (obj.voting_end_time = message.votingEndTime ?? undefined);
return obj;
},

Expand Down
Loading

0 comments on commit 1dd0044

Please sign in to comment.