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
+1 -1
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",
+1 -1
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"
+1 -1
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"
},
+1 -1
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"
+12 -10
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();
});
+2 -2
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;
}