diff --git a/.pnp.cjs b/.pnp.cjs index 0421c3bcae..215bbb266d 100755 --- a/.pnp.cjs +++ b/.pnp.cjs @@ -1036,7 +1036,7 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) { ],\ [\ "cosmjs-types",\ - "npm:0.5.2"\ + "npm:0.6.0"\ ],\ [\ "cross-spawn",\ @@ -3232,7 +3232,7 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) { ["axios", "npm:0.21.4"],\ ["babylon", "npm:6.18.0"],\ ["chalk", "npm:4.1.2"],\ - ["cosmjs-types", "npm:0.5.2"],\ + ["cosmjs-types", "npm:0.6.0"],\ ["diff", "npm:4.0.2"],\ ["eslint", "npm:7.26.0"],\ ["eslint-config-prettier", "virtual:4f1584ad4aba8733a24be7c8aebbffafef25607f2d00f4b314cf96717145c692763628a31c2b85d4686fbb091ff21ebffa3cc337399c042c19a32b9bdb786464#npm:8.3.0"],\ @@ -3278,7 +3278,7 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) { ["@types/pako", "npm:1.0.1"],\ ["@typescript-eslint/eslint-plugin", "virtual:4f1584ad4aba8733a24be7c8aebbffafef25607f2d00f4b314cf96717145c692763628a31c2b85d4686fbb091ff21ebffa3cc337399c042c19a32b9bdb786464#npm:5.13.0"],\ ["@typescript-eslint/parser", "virtual:4f1584ad4aba8733a24be7c8aebbffafef25607f2d00f4b314cf96717145c692763628a31c2b85d4686fbb091ff21ebffa3cc337399c042c19a32b9bdb786464#npm:5.13.0"],\ - ["cosmjs-types", "npm:0.5.2"],\ + ["cosmjs-types", "npm:0.6.0"],\ ["eslint", "npm:7.26.0"],\ ["eslint-config-prettier", "virtual:4f1584ad4aba8733a24be7c8aebbffafef25607f2d00f4b314cf96717145c692763628a31c2b85d4686fbb091ff21ebffa3cc337399c042c19a32b9bdb786464#npm:8.3.0"],\ ["eslint-import-resolver-node", "npm:0.3.4"],\ @@ -3651,7 +3651,7 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) { ["@types/node", "npm:15.9.0"],\ ["@typescript-eslint/eslint-plugin", "virtual:4f1584ad4aba8733a24be7c8aebbffafef25607f2d00f4b314cf96717145c692763628a31c2b85d4686fbb091ff21ebffa3cc337399c042c19a32b9bdb786464#npm:5.13.0"],\ ["@typescript-eslint/parser", "virtual:4f1584ad4aba8733a24be7c8aebbffafef25607f2d00f4b314cf96717145c692763628a31c2b85d4686fbb091ff21ebffa3cc337399c042c19a32b9bdb786464#npm:5.13.0"],\ - ["cosmjs-types", "npm:0.5.2"],\ + ["cosmjs-types", "npm:0.6.0"],\ ["eslint", "npm:7.26.0"],\ ["eslint-config-prettier", "virtual:4f1584ad4aba8733a24be7c8aebbffafef25607f2d00f4b314cf96717145c692763628a31c2b85d4686fbb091ff21ebffa3cc337399c042c19a32b9bdb786464#npm:8.3.0"],\ ["eslint-import-resolver-node", "npm:0.3.4"],\ @@ -3752,7 +3752,7 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) { ["@types/node", "npm:15.9.0"],\ ["@typescript-eslint/eslint-plugin", "virtual:4f1584ad4aba8733a24be7c8aebbffafef25607f2d00f4b314cf96717145c692763628a31c2b85d4686fbb091ff21ebffa3cc337399c042c19a32b9bdb786464#npm:5.13.0"],\ ["@typescript-eslint/parser", "virtual:4f1584ad4aba8733a24be7c8aebbffafef25607f2d00f4b314cf96717145c692763628a31c2b85d4686fbb091ff21ebffa3cc337399c042c19a32b9bdb786464#npm:5.13.0"],\ - ["cosmjs-types", "npm:0.5.2"],\ + ["cosmjs-types", "npm:0.6.0"],\ ["eslint", "npm:7.26.0"],\ ["eslint-config-prettier", "virtual:4f1584ad4aba8733a24be7c8aebbffafef25607f2d00f4b314cf96717145c692763628a31c2b85d4686fbb091ff21ebffa3cc337399c042c19a32b9bdb786464#npm:8.3.0"],\ ["eslint-import-resolver-node", "npm:0.3.4"],\ @@ -6919,10 +6919,10 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) { }]\ ]],\ ["cosmjs-types", [\ - ["npm:0.5.2", {\ - "packageLocation": "./.yarn/cache/cosmjs-types-npm-0.5.2-cf7bc203f4-0362cb2136.zip/node_modules/cosmjs-types/",\ + ["npm:0.6.0", {\ + "packageLocation": "./.yarn/cache/cosmjs-types-npm-0.6.0-4ad2730ce2-06000f10d9.zip/node_modules/cosmjs-types/",\ "packageDependencies": [\ - ["cosmjs-types", "npm:0.5.2"],\ + ["cosmjs-types", "npm:0.6.0"],\ ["long", "npm:4.0.0"],\ ["protobufjs", "npm:6.11.3"]\ ],\ diff --git a/.yarn/cache/cosmjs-types-npm-0.5.2-cf7bc203f4-0362cb2136.zip b/.yarn/cache/cosmjs-types-npm-0.5.2-cf7bc203f4-0362cb2136.zip deleted file mode 100644 index b0deca0454..0000000000 --- a/.yarn/cache/cosmjs-types-npm-0.5.2-cf7bc203f4-0362cb2136.zip +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:280e5b09cb88ffb16c89e8dc357810c9578d42abd3e730c1014b04de8a75756f -size 1116655 diff --git a/.yarn/cache/cosmjs-types-npm-0.6.0-4ad2730ce2-06000f10d9.zip b/.yarn/cache/cosmjs-types-npm-0.6.0-4ad2730ce2-06000f10d9.zip new file mode 100644 index 0000000000..b6ae462ed8 --- /dev/null +++ b/.yarn/cache/cosmjs-types-npm-0.6.0-4ad2730ce2-06000f10d9.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:481f034b96a9167980596c7db0958e8058782276b6ef965462ecdc127ab24a4f +size 939388 diff --git a/CHANGELOG.md b/CHANGELOG.md index d82201ed2e..465110ae9d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/packages/cli/package.json b/packages/cli/package.json index cfdd2924a0..4f37d7cb3b 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -53,7 +53,7 @@ "axios": "^0.21.2", "babylon": "^6.18.0", "chalk": "^4", - "cosmjs-types": "^0.5.2", + "cosmjs-types": "^0.6.0", "diff": "^4", "recast": "^0.20", "ts-node": "^8", diff --git a/packages/cosmwasm-stargate/package.json b/packages/cosmwasm-stargate/package.json index e2721bf08c..3272bc67a6 100644 --- a/packages/cosmwasm-stargate/package.json +++ b/packages/cosmwasm-stargate/package.json @@ -46,7 +46,7 @@ "@cosmjs/stargate": "workspace:^", "@cosmjs/tendermint-rpc": "workspace:^", "@cosmjs/utils": "workspace:^", - "cosmjs-types": "^0.5.2", + "cosmjs-types": "^0.6.0", "long": "^4.0.0", "pako": "^2.0.2" }, diff --git a/packages/cosmwasm-stargate/src/signingcosmwasmclient.spec.ts b/packages/cosmwasm-stargate/src/signingcosmwasmclient.spec.ts index 20ef4702ec..fac9198078 100644 --- a/packages/cosmwasm-stargate/src/signingcosmwasmclient.spec.ts +++ b/packages/cosmwasm-stargate/src/signingcosmwasmclient.spec.ts @@ -14,7 +14,8 @@ import { MsgSendEncodeObject, } from "@cosmjs/stargate"; import { assert, sleep } from "@cosmjs/utils"; -import { DeepPartial, MsgSend } from "cosmjs-types/cosmos/bank/v1beta1/tx"; +import { DeepPartial } from "cosmjs-types"; +import { MsgSend } from "cosmjs-types/cosmos/bank/v1beta1/tx"; import { Coin } from "cosmjs-types/cosmos/base/v1beta1/coin"; import { MsgDelegate } from "cosmjs-types/cosmos/staking/v1beta1/tx"; import { AuthInfo, TxBody, TxRaw } from "cosmjs-types/cosmos/tx/v1beta1/tx"; @@ -878,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 { const message = { ...baseCustomMsgDelegate } as CustomMsgDelegate; if (object.customDelegatorAddress !== undefined && object.customDelegatorAddress !== null) { @@ -901,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({ @@ -1177,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 { const message = { ...baseCustomMsgDelegate } as CustomMsgDelegate; if (object.customDelegatorAddress !== undefined && object.customDelegatorAddress !== null) { @@ -1200,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({ diff --git a/packages/proto-signing/package.json b/packages/proto-signing/package.json index 4af55f14f2..fef1d589f3 100644 --- a/packages/proto-signing/package.json +++ b/packages/proto-signing/package.json @@ -44,7 +44,7 @@ "@cosmjs/encoding": "workspace:^", "@cosmjs/math": "workspace:^", "@cosmjs/utils": "workspace:^", - "cosmjs-types": "^0.5.2", + "cosmjs-types": "^0.6.0", "long": "^4.0.0" }, "devDependencies": { diff --git a/packages/proto-signing/src/registry.ts b/packages/proto-signing/src/registry.ts index 5be89db54f..503f7abe7d 100644 --- a/packages/proto-signing/src/registry.ts +++ b/packages/proto-signing/src/registry.ts @@ -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; } /** diff --git a/packages/stargate/package.json b/packages/stargate/package.json index 2a9ef6ecf3..d749e6df70 100644 --- a/packages/stargate/package.json +++ b/packages/stargate/package.json @@ -46,7 +46,7 @@ "@cosmjs/stream": "workspace:^", "@cosmjs/tendermint-rpc": "workspace:^", "@cosmjs/utils": "workspace:^", - "cosmjs-types": "^0.5.2", + "cosmjs-types": "^0.6.0", "long": "^4.0.0", "protobufjs": "~6.11.3", "xstream": "^11.14.0" diff --git a/packages/stargate/src/accounts.spec.ts b/packages/stargate/src/accounts.spec.ts index f4010d2e09..62d604436b 100644 --- a/packages/stargate/src/accounts.spec.ts +++ b/packages/stargate/src/accounts.spec.ts @@ -1,3 +1,4 @@ +import { fromBase64 } from "@cosmjs/encoding"; import { Any } from "cosmjs-types/google/protobuf/any"; import { accountFromAny } from "./accounts"; @@ -6,10 +7,11 @@ describe("accounts", () => { describe("accountFromAny", () => { it("works for PeriodicVestingAccount", () => { // Queried from chain via `packages/cli/examples/get_akash_vesting_account.ts`. - const any = Any.fromJSON({ + const any = Any.fromPartial({ typeUrl: "/cosmos.vesting.v1beta1.PeriodicVestingAccount", - value: + value: fromBase64( "CsMBCnoKLGFrYXNoMXF5MHZ1cjNmbDJ1Y3p0cHpjcmZlYTdtYzhqd3o4eGptdnE3cXZ5EkYKHy9jb3Ntb3MuY3J5cHRvLnNlY3AyNTZrMS5QdWJLZXkSIwohA/XsdhwSIKU73TltD9STcaS07FNw0szR4a+oDLr6vikaGDggGxIUCgR1YWt0EgwxNjY2NjY2NzAwMDAaEwoEdWFrdBILMzcxOTAzMzAwMDAiFAoEdWFrdBIMMTY2NjY2NjcwMDAwKOC9wZkGEODvt/sFGhoIgOeEDxITCgR1YWt0Egs4MzMzMzMzNTAwMBoaCIC/ugcSEwoEdWFrdBILNDE2NjY2Njc1MDAaGgiAqMoHEhMKBHVha3QSCzQxNjY2NjY3NTAw", + ), }); const account = accountFromAny(any); diff --git a/packages/stargate/src/signingstargateclient.spec.ts b/packages/stargate/src/signingstargateclient.spec.ts index a138e3e40a..e0a58e2b8e 100644 --- a/packages/stargate/src/signingstargateclient.spec.ts +++ b/packages/stargate/src/signingstargateclient.spec.ts @@ -10,11 +10,12 @@ import { } from "@cosmjs/proto-signing"; import { Tendermint34Client } from "@cosmjs/tendermint-rpc"; import { assert, sleep } from "@cosmjs/utils"; +import { DeepPartial } from "cosmjs-types"; import { MsgSend } from "cosmjs-types/cosmos/bank/v1beta1/tx"; import { Coin } from "cosmjs-types/cosmos/base/v1beta1/coin"; import { BasicAllowance } from "cosmjs-types/cosmos/feegrant/v1beta1/feegrant"; import { MsgGrantAllowance } from "cosmjs-types/cosmos/feegrant/v1beta1/tx"; -import { DeepPartial, MsgDelegate } from "cosmjs-types/cosmos/staking/v1beta1/tx"; +import { MsgDelegate } from "cosmjs-types/cosmos/staking/v1beta1/tx"; import { AuthInfo, TxBody, TxRaw } from "cosmjs-types/cosmos/tx/v1beta1/tx"; import { Any } from "cosmjs-types/google/protobuf/any"; import Long from "long"; @@ -541,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 { const message = { ...baseCustomMsgDelegate } as CustomMsgDelegate; if (object.customDelegatorAddress !== undefined && object.customDelegatorAddress !== null) { @@ -564,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({ @@ -829,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 { const message = { ...baseCustomMsgDelegate } as CustomMsgDelegate; if (object.customDelegatorAddress !== undefined && object.customDelegatorAddress !== null) { @@ -852,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({ diff --git a/yarn.lock b/yarn.lock index e017631232..bb20339ff6 100644 --- a/yarn.lock +++ b/yarn.lock @@ -362,7 +362,7 @@ __metadata: axios: ^0.21.2 babylon: ^6.18.0 chalk: ^4 - cosmjs-types: ^0.5.2 + cosmjs-types: ^0.6.0 diff: ^4 eslint: ^7.5 eslint-config-prettier: ^8.3.0 @@ -408,7 +408,7 @@ __metadata: "@types/pako": ^1.0.1 "@typescript-eslint/eslint-plugin": ^5.13.0 "@typescript-eslint/parser": ^5.13.0 - cosmjs-types: ^0.5.2 + cosmjs-types: ^0.6.0 eslint: ^7.5 eslint-config-prettier: ^8.3.0 eslint-import-resolver-node: ^0.3.4 @@ -767,7 +767,7 @@ __metadata: "@types/node": ^15.0.1 "@typescript-eslint/eslint-plugin": ^5.13.0 "@typescript-eslint/parser": ^5.13.0 - cosmjs-types: ^0.5.2 + cosmjs-types: ^0.6.0 eslint: ^7.5 eslint-config-prettier: ^8.3.0 eslint-import-resolver-node: ^0.3.4 @@ -864,7 +864,7 @@ __metadata: "@types/node": ^15.0.1 "@typescript-eslint/eslint-plugin": ^5.13.0 "@typescript-eslint/parser": ^5.13.0 - cosmjs-types: ^0.5.2 + cosmjs-types: ^0.6.0 eslint: ^7.5 eslint-config-prettier: ^8.3.0 eslint-import-resolver-node: ^0.3.4 @@ -2929,13 +2929,13 @@ __metadata: languageName: unknown linkType: soft -"cosmjs-types@npm:^0.5.2": - version: 0.5.2 - resolution: "cosmjs-types@npm:0.5.2" +"cosmjs-types@npm:^0.6.0": + version: 0.6.0 + resolution: "cosmjs-types@npm:0.6.0" dependencies: long: ^4.0.0 protobufjs: ~6.11.2 - checksum: 0362cb2136a17c0f91f0727a55a1f49058bb56665136cf88e4502febf6da59fa2d4ce91ed75bc55907571b9f1cd99546d594002509781b69fe71fe972dbfe4c1 + checksum: 06000f10d931bbd23381a2303337f6c203add988d2e4e63307a0b920b2c317197d3e17d4fc535e55e7fdc211e472ee3dff18847bb7f42704d194370a1c6ed581 languageName: node linkType: hard