Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade cosmjs-types to 0.6 🔭 #1329

Merged
merged 4 commits into from
Dec 8, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions .pnp.cjs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions .yarn/cache/cosmjs-types-npm-0.5.2-cf7bc203f4-0362cb2136.zip

This file was deleted.

3 changes: 3 additions & 0 deletions .yarn/cache/cosmjs-types-npm-0.6.0-4ad2730ce2-06000f10d9.zip
Git LFS file not shown
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion packages/cosmwasm-stargate/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
},
Expand Down
19 changes: 2 additions & 17 deletions packages/cosmwasm-stargate/src/signingcosmwasmclient.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -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) {
Expand All @@ -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({
Expand Down Expand Up @@ -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) {
Expand All @@ -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({
Expand Down
2 changes: 1 addition & 1 deletion packages/proto-signing/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
5 changes: 3 additions & 2 deletions packages/proto-signing/src/registry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

/**
Expand Down
2 changes: 1 addition & 1 deletion packages/stargate/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
6 changes: 4 additions & 2 deletions packages/stargate/src/accounts.spec.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { fromBase64 } from "@cosmjs/encoding";
import { Any } from "cosmjs-types/google/protobuf/any";

import { accountFromAny } from "./accounts";
Expand All @@ -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);
Expand Down
19 changes: 2 additions & 17 deletions packages/stargate/src/signingstargateclient.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -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) {
Expand All @@ -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({
Expand Down Expand Up @@ -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) {
Expand All @@ -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({
Expand Down
16 changes: 8 additions & 8 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand Down