Merge pull request #1329 from cosmos/cosmjs-types-0.6

Upgrade cosmjs-types to 0.6 🔭
This commit is contained in:
Simon Warta 2022-12-08 16:14:21 +01:00 committed by GitHub
commit d6c962b3eb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 38 additions and 61 deletions

16
.pnp.cjs generated
View File

@ -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"]\
],\

Binary file not shown.

BIN
.yarn/cache/cosmjs-types-npm-0.6.0-4ad2730ce2-06000f10d9.zip (Stored with Git LFS) vendored Normal file

Binary file not shown.

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

@ -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",

View File

@ -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"
},

View File

@ -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>): 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>): 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({

View File

@ -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": {

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

@ -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"

View File

@ -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);

View File

@ -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>): 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>): 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({

View File

@ -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