Remove fromJSON/toJSON from TsProtoGeneratedType

This commit is contained in:
Simon Warta 2022-12-08 15:54:10 +01:00
parent 15270548e4
commit 490f44512e
4 changed files with 7 additions and 34 deletions

View File

@ -22,11 +22,15 @@ and this project adheres to
`createStakingAminoConverters`. This made `prefix` in
`SigningCosmWasmClientOptions` and `SigningStargateClientOptions` obsolete, so
this was also deleted. ([#1291])
- @cosmjs/proto-signing: Remove `fromJSON`/`toJSON` from `TsProtoGeneratedType`
such that generated types are not required to generate those anymore. The
methods were provided by ts-proto but we never needed them. ([#1329])
[#1002]: https://github.com/cosmos/cosmjs/issues/1002
[#1240]: https://github.com/cosmos/cosmjs/pull/1240
[#1289]: https://github.com/cosmos/cosmjs/issues/1289
[#1291]: https://github.com/cosmos/cosmjs/issues/1291
[#1329]: https://github.com/cosmos/cosmjs/pull/1329
[#1341]: https://github.com/cosmos/cosmjs/issues/1341
## [0.29.5] - 2022-12-07

View File

@ -879,10 +879,6 @@ describe("SigningCosmWasmClient", () => {
throw new Error("decode method should not be required");
},
fromJSON(): CustomMsgDelegate {
throw new Error("fromJSON method should not be required");
},
fromPartial(object: DeepPartial<CustomMsgDelegate>): CustomMsgDelegate {
const message = { ...baseCustomMsgDelegate } as CustomMsgDelegate;
if (object.customDelegatorAddress !== undefined && object.customDelegatorAddress !== null) {
@ -902,10 +898,6 @@ describe("SigningCosmWasmClient", () => {
}
return message;
},
toJSON(): unknown {
throw new Error("toJSON method should not be required");
},
};
customRegistry.register(msgDelegateTypeUrl, CustomMsgDelegate);
const customAminoTypes = new AminoTypes({
@ -1178,10 +1170,6 @@ describe("SigningCosmWasmClient", () => {
throw new Error("decode method should not be required");
},
fromJSON(): CustomMsgDelegate {
throw new Error("fromJSON method should not be required");
},
fromPartial(object: DeepPartial<CustomMsgDelegate>): CustomMsgDelegate {
const message = { ...baseCustomMsgDelegate } as CustomMsgDelegate;
if (object.customDelegatorAddress !== undefined && object.customDelegatorAddress !== null) {
@ -1201,10 +1189,6 @@ describe("SigningCosmWasmClient", () => {
}
return message;
},
toJSON(): unknown {
throw new Error("toJSON method should not be required");
},
};
customRegistry.register(msgDelegateTypeUrl, CustomMsgDelegate);
const customAminoTypes = new AminoTypes({

View File

@ -12,9 +12,10 @@ import type protobuf from "protobufjs";
export interface TsProtoGeneratedType {
readonly encode: (message: any | { [k: string]: any }, writer?: protobuf.Writer) => protobuf.Writer;
readonly decode: (input: Uint8Array | protobuf.Reader, length?: number) => any;
readonly fromJSON: (object: any) => any;
readonly fromPartial: (object: any) => any;
readonly toJSON: (message: any | { [k: string]: any }) => unknown;
// Methods from ts-proto types we don't need
// readonly fromJSON: (object: any) => any;
// readonly toJSON: (message: any | { [k: string]: any }) => unknown;
}
/**

View File

@ -542,10 +542,6 @@ describe("SigningStargateClient", () => {
throw new Error("decode method should not be required");
},
fromJSON(): CustomMsgDelegate {
throw new Error("fromJSON method should not be required");
},
fromPartial(object: DeepPartial<CustomMsgDelegate>): CustomMsgDelegate {
const message = { ...baseCustomMsgDelegate } as CustomMsgDelegate;
if (object.customDelegatorAddress !== undefined && object.customDelegatorAddress !== null) {
@ -565,10 +561,6 @@ describe("SigningStargateClient", () => {
}
return message;
},
toJSON(): unknown {
throw new Error("toJSON method should not be required");
},
};
customRegistry.register(msgDelegateTypeUrl, CustomMsgDelegate);
const customAminoTypes = new AminoTypes({
@ -830,10 +822,6 @@ describe("SigningStargateClient", () => {
throw new Error("decode method should not be required");
},
fromJSON(): CustomMsgDelegate {
throw new Error("fromJSON method should not be required");
},
fromPartial(object: DeepPartial<CustomMsgDelegate>): CustomMsgDelegate {
const message = { ...baseCustomMsgDelegate } as CustomMsgDelegate;
if (object.customDelegatorAddress !== undefined && object.customDelegatorAddress !== null) {
@ -853,10 +841,6 @@ describe("SigningStargateClient", () => {
}
return message;
},
toJSON(): unknown {
throw new Error("toJSON method should not be required");
},
};
customRegistry.register(msgDelegateTypeUrl, CustomMsgDelegate);
const customAminoTypes = new AminoTypes({