Upgrade cosmjs-types to 0.3.0 and adapt code

This commit is contained in:
Simon Warta 2021-11-18 09:57:29 +01:00
parent f8bd2e3783
commit 09b94d77dc
10 changed files with 37 additions and 35 deletions

16
.pnp.js generated
View File

@ -1032,7 +1032,7 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) {
],
[
"cosmjs-types",
"npm:0.2.1"
"npm:0.3.0"
],
[
"create-hash",
@ -3276,7 +3276,7 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) {
["axios", "npm:0.21.4"],
["babylon", "npm:6.18.0"],
["colors", "npm:1.4.0"],
["cosmjs-types", "npm:0.2.1"],
["cosmjs-types", "npm:0.3.0"],
["diff", "npm:4.0.2"],
["eslint", "npm:7.26.0"],
["eslint-config-prettier", "virtual:4f1584ad4aba8733a24be7c8aebbffafef25607f2d00f4b314cf96717145c692763628a31c2b85d4686fbb091ff21ebffa3cc337399c042c19a32b9bdb786464#npm:8.3.0"],
@ -3322,7 +3322,7 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) {
["@types/pako", "npm:1.0.1"],
["@typescript-eslint/eslint-plugin", "virtual:4f1584ad4aba8733a24be7c8aebbffafef25607f2d00f4b314cf96717145c692763628a31c2b85d4686fbb091ff21ebffa3cc337399c042c19a32b9bdb786464#npm:4.28.4"],
["@typescript-eslint/parser", "virtual:4f1584ad4aba8733a24be7c8aebbffafef25607f2d00f4b314cf96717145c692763628a31c2b85d4686fbb091ff21ebffa3cc337399c042c19a32b9bdb786464#npm:4.28.4"],
["cosmjs-types", "npm:0.2.1"],
["cosmjs-types", "npm:0.3.0"],
["eslint", "npm:7.26.0"],
["eslint-config-prettier", "virtual:4f1584ad4aba8733a24be7c8aebbffafef25607f2d00f4b314cf96717145c692763628a31c2b85d4686fbb091ff21ebffa3cc337399c042c19a32b9bdb786464#npm:8.3.0"],
["eslint-import-resolver-node", "npm:0.3.4"],
@ -3760,7 +3760,7 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) {
["@types/node", "npm:15.3.1"],
["@typescript-eslint/eslint-plugin", "virtual:4f1584ad4aba8733a24be7c8aebbffafef25607f2d00f4b314cf96717145c692763628a31c2b85d4686fbb091ff21ebffa3cc337399c042c19a32b9bdb786464#npm:4.28.4"],
["@typescript-eslint/parser", "virtual:4f1584ad4aba8733a24be7c8aebbffafef25607f2d00f4b314cf96717145c692763628a31c2b85d4686fbb091ff21ebffa3cc337399c042c19a32b9bdb786464#npm:4.28.4"],
["cosmjs-types", "npm:0.2.1"],
["cosmjs-types", "npm:0.3.0"],
["eslint", "npm:7.26.0"],
["eslint-config-prettier", "virtual:4f1584ad4aba8733a24be7c8aebbffafef25607f2d00f4b314cf96717145c692763628a31c2b85d4686fbb091ff21ebffa3cc337399c042c19a32b9bdb786464#npm:8.3.0"],
["eslint-import-resolver-node", "npm:0.3.4"],
@ -3864,7 +3864,7 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) {
["@types/node", "npm:15.3.1"],
["@typescript-eslint/eslint-plugin", "virtual:4f1584ad4aba8733a24be7c8aebbffafef25607f2d00f4b314cf96717145c692763628a31c2b85d4686fbb091ff21ebffa3cc337399c042c19a32b9bdb786464#npm:4.28.4"],
["@typescript-eslint/parser", "virtual:4f1584ad4aba8733a24be7c8aebbffafef25607f2d00f4b314cf96717145c692763628a31c2b85d4686fbb091ff21ebffa3cc337399c042c19a32b9bdb786464#npm:4.28.4"],
["cosmjs-types", "npm:0.2.1"],
["cosmjs-types", "npm:0.3.0"],
["eslint", "npm:7.26.0"],
["eslint-config-prettier", "virtual:4f1584ad4aba8733a24be7c8aebbffafef25607f2d00f4b314cf96717145c692763628a31c2b85d4686fbb091ff21ebffa3cc337399c042c19a32b9bdb786464#npm:8.3.0"],
["eslint-import-resolver-node", "npm:0.3.4"],
@ -6990,10 +6990,10 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) {
}]
]],
["cosmjs-types", [
["npm:0.2.1", {
"packageLocation": "./.yarn/cache/cosmjs-types-npm-0.2.1-484eba1129-01baa0822f.zip/node_modules/cosmjs-types/",
["npm:0.3.0", {
"packageLocation": "./.yarn/cache/cosmjs-types-npm-0.3.0-7e874d3092-1587522225.zip/node_modules/cosmjs-types/",
"packageDependencies": [
["cosmjs-types", "npm:0.2.1"],
["cosmjs-types", "npm:0.3.0"],
["long", "npm:4.0.0"],
["protobufjs", "npm:6.11.2"]
],

Binary file not shown.

BIN
.yarn/cache/cosmjs-types-npm-0.3.0-7e874d3092-1587522225.zip (Stored with Git LFS) vendored Normal file

Binary file not shown.

View File

@ -54,7 +54,7 @@
"axios": "^0.21.2",
"babylon": "^6.18.0",
"colors": "^1.3.3",
"cosmjs-types": "^0.2.0",
"cosmjs-types": "^0.3.0",
"diff": "^4",
"recast": "^0.20",
"ts-node": "^8",

View File

@ -46,7 +46,7 @@
"@cosmjs/stargate": "workspace:packages/stargate",
"@cosmjs/tendermint-rpc": "workspace:packages/tendermint-rpc",
"@cosmjs/utils": "workspace:packages/utils",
"cosmjs-types": "^0.2.0",
"cosmjs-types": "^0.3.0",
"long": "^4.0.0",
"pako": "^2.0.2",
"protobufjs": "~6.10.2"

View File

@ -42,7 +42,7 @@
"@cosmjs/amino": "workspace:packages/amino",
"@cosmjs/crypto": "workspace:packages/crypto",
"@cosmjs/math": "workspace:packages/math",
"cosmjs-types": "^0.2.0",
"cosmjs-types": "^0.3.0",
"long": "^4.0.0",
"protobufjs": "~6.10.2"
},

View File

@ -46,7 +46,7 @@
"@cosmjs/stream": "workspace:packages/stream",
"@cosmjs/tendermint-rpc": "workspace:packages/tendermint-rpc",
"@cosmjs/utils": "workspace:packages/utils",
"cosmjs-types": "^0.2.0",
"cosmjs-types": "^0.3.0",
"long": "^4.0.0",
"protobufjs": "~6.10.2",
"xstream": "^11.14.0"

View File

@ -3,7 +3,7 @@ import { toAscii } from "@cosmjs/encoding";
import { DirectSecp256k1HdWallet } from "@cosmjs/proto-signing";
import { Tendermint34Client } from "@cosmjs/tendermint-rpc";
import { assert, sleep } from "@cosmjs/utils";
import { ProposalStatus, TextProposal, VoteOption } from "cosmjs-types/cosmos/gov/v1beta1/gov";
import { ProposalStatus, TextProposal, Vote, VoteOption } from "cosmjs-types/cosmos/gov/v1beta1/gov";
import { Any } from "cosmjs-types/google/protobuf/any";
import Long from "long";
@ -328,16 +328,16 @@ describe("GovExtension", () => {
const response = await client.gov.votes(proposalId);
expect(response.votes).toEqual([
// why is vote 2 first?
{
Vote.fromPartial({
proposalId: longify(proposalId),
voter: voter2Address,
option: VoteOption.VOTE_OPTION_NO_WITH_VETO,
},
{
}),
Vote.fromPartial({
proposalId: longify(proposalId),
voter: voter1Address,
option: VoteOption.VOTE_OPTION_YES,
},
}),
]);
tmClient.disconnect();
@ -351,11 +351,13 @@ describe("GovExtension", () => {
const [client, tmClient] = await makeClientWithGov(simapp.tendermintUrl);
const response = await client.gov.vote(proposalId, voter1Address);
expect(response.vote).toEqual({
voter: voter1Address,
proposalId: longify(proposalId),
option: VoteOption.VOTE_OPTION_YES,
});
expect(response.vote).toEqual(
Vote.fromPartial({
voter: voter1Address,
proposalId: longify(proposalId),
option: VoteOption.VOTE_OPTION_YES,
}),
);
tmClient.disconnect();
});

View File

@ -23,12 +23,12 @@ export function toAccAddress(address: string): Uint8Array {
*/
export function createPagination(paginationKey?: Uint8Array): PageRequest | undefined {
return paginationKey
? {
? PageRequest.fromPartial({
key: paginationKey,
offset: Long.fromNumber(0, true),
limit: Long.fromNumber(0, true),
countTotal: false,
}
})
: undefined;
}

View File

@ -367,7 +367,7 @@ __metadata:
axios: ^0.21.2
babylon: ^6.18.0
colors: ^1.3.3
cosmjs-types: ^0.2.0
cosmjs-types: ^0.3.0
diff: ^4
eslint: ^7.5
eslint-config-prettier: ^8.3.0
@ -413,7 +413,7 @@ __metadata:
"@types/pako": ^1.0.1
"@typescript-eslint/eslint-plugin": ^4.28
"@typescript-eslint/parser": ^4.28
cosmjs-types: ^0.2.0
cosmjs-types: ^0.3.0
eslint: ^7.5
eslint-config-prettier: ^8.3.0
eslint-import-resolver-node: ^0.3.4
@ -835,7 +835,7 @@ __metadata:
"@types/node": ^15.0.1
"@typescript-eslint/eslint-plugin": ^4.28
"@typescript-eslint/parser": ^4.28
cosmjs-types: ^0.2.0
cosmjs-types: ^0.3.0
eslint: ^7.5
eslint-config-prettier: ^8.3.0
eslint-import-resolver-node: ^0.3.4
@ -935,7 +935,7 @@ __metadata:
"@types/node": ^15.0.1
"@typescript-eslint/eslint-plugin": ^4.28
"@typescript-eslint/parser": ^4.28
cosmjs-types: ^0.2.0
cosmjs-types: ^0.3.0
eslint: ^7.5
eslint-config-prettier: ^8.3.0
eslint-import-resolver-node: ^0.3.4
@ -3011,13 +3011,13 @@ __metadata:
languageName: unknown
linkType: soft
"cosmjs-types@npm:^0.2.0":
version: 0.2.1
resolution: "cosmjs-types@npm:0.2.1"
"cosmjs-types@npm:^0.3.0":
version: 0.3.0
resolution: "cosmjs-types@npm:0.3.0"
dependencies:
long: ^4.0.0
protobufjs: ~6.11.2
checksum: 01baa0822fa2409ac6f87b682784b9aa3408cdd028c5da6215719f6ea2329ff473c9731e19cf5cbea06b1a18905f03a352830d933b0e261c285ffa6de98fb0db
checksum: 15875222256af17bb1e88d2dad5d189e2c2288821587459c3b099c15139170b4083fbebb47d1e8e0ebcee128edc3f233ee2f2470eb85c3752fde69d459db0773
languageName: node
linkType: hard