decentralcardgame-cardchain-client-ts 0.0.26-rc1 → 0.0.26
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/DecentralCardGame.cardchain.cardchain/module.js +364 -338
- package/DecentralCardGame.cardchain.cardchain/module.ts +530 -495
- package/DecentralCardGame.cardchain.cardchain/registry.js +66 -64
- package/DecentralCardGame.cardchain.cardchain/registry.ts +66 -64
- package/DecentralCardGame.cardchain.cardchain/rest.js +31 -17
- package/DecentralCardGame.cardchain.cardchain/rest.ts +138 -94
- package/DecentralCardGame.cardchain.cardchain/types/DecentralCardGame/cardchain/cardchain/card.js +287 -106
- package/DecentralCardGame.cardchain.cardchain/types/DecentralCardGame/cardchain/cardchain/card.ts +326 -107
- package/DecentralCardGame.cardchain.cardchain/types/DecentralCardGame/cardchain/cardchain/copyright_proposal.js +38 -14
- package/DecentralCardGame.cardchain.cardchain/types/DecentralCardGame/cardchain/cardchain/copyright_proposal.ts +45 -17
- package/DecentralCardGame.cardchain.cardchain/types/DecentralCardGame/cardchain/cardchain/council.js +104 -47
- package/DecentralCardGame.cardchain.cardchain/types/DecentralCardGame/cardchain/cardchain/council.ts +122 -50
- package/DecentralCardGame.cardchain.cardchain/types/DecentralCardGame/cardchain/cardchain/genesis.js +92 -74
- package/DecentralCardGame.cardchain.cardchain/types/DecentralCardGame/cardchain/cardchain/genesis.ts +109 -66
- package/DecentralCardGame.cardchain.cardchain/types/DecentralCardGame/cardchain/cardchain/image.js +25 -17
- package/DecentralCardGame.cardchain.cardchain/types/DecentralCardGame/cardchain/cardchain/image.ts +29 -20
- package/DecentralCardGame.cardchain.cardchain/types/DecentralCardGame/cardchain/cardchain/match.js +107 -51
- package/DecentralCardGame.cardchain.cardchain/types/DecentralCardGame/cardchain/cardchain/match.ts +130 -50
- package/DecentralCardGame.cardchain.cardchain/types/DecentralCardGame/cardchain/cardchain/match_reporter_proposal.js +29 -10
- package/DecentralCardGame.cardchain.cardchain/types/DecentralCardGame/cardchain/cardchain/match_reporter_proposal.ts +32 -10
- package/DecentralCardGame.cardchain.cardchain/types/DecentralCardGame/cardchain/cardchain/num.js +17 -8
- package/DecentralCardGame.cardchain.cardchain/types/DecentralCardGame/cardchain/cardchain/num.ts +21 -11
- package/DecentralCardGame.cardchain.cardchain/types/DecentralCardGame/cardchain/cardchain/params.js +178 -57
- package/DecentralCardGame.cardchain.cardchain/types/DecentralCardGame/cardchain/cardchain/params.ts +205 -60
- package/DecentralCardGame.cardchain.cardchain/types/DecentralCardGame/cardchain/cardchain/query.js +666 -446
- package/DecentralCardGame.cardchain.cardchain/types/DecentralCardGame/cardchain/cardchain/query.ts +764 -459
- package/DecentralCardGame.cardchain.cardchain/types/DecentralCardGame/cardchain/cardchain/running_average.js +17 -14
- package/DecentralCardGame.cardchain.cardchain/types/DecentralCardGame/cardchain/cardchain/running_average.ts +24 -15
- package/DecentralCardGame.cardchain.cardchain/types/DecentralCardGame/cardchain/cardchain/sell_offer.js +45 -16
- package/DecentralCardGame.cardchain.cardchain/types/DecentralCardGame/cardchain/cardchain/sell_offer.ts +53 -19
- package/DecentralCardGame.cardchain.cardchain/types/DecentralCardGame/cardchain/cardchain/server.js +31 -12
- package/DecentralCardGame.cardchain.cardchain/types/DecentralCardGame/cardchain/cardchain/server.ts +37 -15
- package/DecentralCardGame.cardchain.cardchain/types/DecentralCardGame/cardchain/cardchain/set.js +138 -62
- package/DecentralCardGame.cardchain.cardchain/types/DecentralCardGame/cardchain/cardchain/set.ts +173 -67
- package/DecentralCardGame.cardchain.cardchain/types/DecentralCardGame/cardchain/cardchain/set_proposal.js +31 -12
- package/DecentralCardGame.cardchain.cardchain/types/DecentralCardGame/cardchain/cardchain/set_proposal.ts +37 -15
- package/DecentralCardGame.cardchain.cardchain/types/DecentralCardGame/cardchain/cardchain/tx.js +1609 -1024
- package/DecentralCardGame.cardchain.cardchain/types/DecentralCardGame/cardchain/cardchain/tx.ts +1821 -1153
- package/DecentralCardGame.cardchain.cardchain/types/DecentralCardGame/cardchain/cardchain/user.js +207 -98
- package/DecentralCardGame.cardchain.cardchain/types/DecentralCardGame/cardchain/cardchain/user.ts +261 -96
- package/DecentralCardGame.cardchain.cardchain/types/DecentralCardGame/cardchain/cardchain/voting.js +178 -108
- package/DecentralCardGame.cardchain.cardchain/types/DecentralCardGame/cardchain/cardchain/voting.ts +200 -123
- package/DecentralCardGame.cardchain.cardchain/types/amino/amino.ts +1 -0
- package/DecentralCardGame.cardchain.cardchain/types/cardchain/cardchain/card.js +86 -0
- package/DecentralCardGame.cardchain.cardchain/types/cardchain/cardchain/card.ts +90 -0
- package/DecentralCardGame.cardchain.cardchain/types/cardchain/cardchain/query.js +219 -114
- package/DecentralCardGame.cardchain.cardchain/types/cardchain/cardchain/query.ts +265 -120
- package/DecentralCardGame.cardchain.cardchain/types/cardchain/cardchain/set.js +186 -0
- package/DecentralCardGame.cardchain.cardchain/types/cardchain/cardchain/set.ts +210 -0
- package/DecentralCardGame.cardchain.cardchain/types/cardchain/cardchain/tx.js +91 -0
- package/DecentralCardGame.cardchain.cardchain/types/cardchain/cardchain/tx.ts +113 -0
- package/DecentralCardGame.cardchain.cardchain/types.js +3 -1
- package/DecentralCardGame.cardchain.cardchain/types.ts +4 -0
- package/DecentralCardGame.cardchain.featureflag/rest.ts +6 -6
- package/DecentralCardGame.cardchain.featureflag/types/DecentralCardGame/cardchain/featureflag/flag.js +86 -0
- package/DecentralCardGame.cardchain.featureflag/types/DecentralCardGame/cardchain/featureflag/flag.ts +114 -0
- package/DecentralCardGame.cardchain.featureflag/types/DecentralCardGame/cardchain/featureflag/genesis.js +164 -0
- package/DecentralCardGame.cardchain.featureflag/types/DecentralCardGame/cardchain/featureflag/genesis.ts +205 -0
- package/DecentralCardGame.cardchain.featureflag/types/DecentralCardGame/cardchain/featureflag/params.js +40 -0
- package/DecentralCardGame.cardchain.featureflag/types/DecentralCardGame/cardchain/featureflag/params.ts +62 -0
- package/DecentralCardGame.cardchain.featureflag/types/DecentralCardGame/cardchain/featureflag/proposal.js +100 -0
- package/DecentralCardGame.cardchain.featureflag/types/DecentralCardGame/cardchain/featureflag/proposal.ts +130 -0
- package/DecentralCardGame.cardchain.featureflag/types/DecentralCardGame/cardchain/featureflag/query.js +325 -0
- package/DecentralCardGame.cardchain.featureflag/types/DecentralCardGame/cardchain/featureflag/query.ts +424 -0
- package/DecentralCardGame.cardchain.featureflag/types/DecentralCardGame/cardchain/featureflag/tx.js +9 -0
- package/DecentralCardGame.cardchain.featureflag/types/DecentralCardGame/cardchain/featureflag/tx.ts +21 -0
- package/client.js +3 -9
- package/client.ts +154 -167
- package/cosmos.auth.v1beta1/rest.ts +21 -21
- package/cosmos.authz.v1beta1/module.js +17 -17
- package/cosmos.authz.v1beta1/module.ts +25 -25
- package/cosmos.authz.v1beta1/registry.js +4 -4
- package/cosmos.authz.v1beta1/registry.ts +4 -4
- package/cosmos.authz.v1beta1/rest.ts +75 -75
- package/cosmos.bank.v1beta1/rest.ts +9 -9
- package/cosmos.distribution.v1beta1/module.js +27 -27
- package/cosmos.distribution.v1beta1/module.ts +42 -42
- package/cosmos.distribution.v1beta1/registry.js +4 -4
- package/cosmos.distribution.v1beta1/registry.ts +4 -4
- package/cosmos.distribution.v1beta1/rest.ts +20 -20
- package/cosmos.gov.v1/module.js +24 -24
- package/cosmos.gov.v1/module.ts +36 -36
- package/cosmos.gov.v1/registry.js +4 -4
- package/cosmos.gov.v1/registry.ts +4 -4
- package/cosmos.gov.v1/rest.ts +90 -90
- package/cosmos.gov.v1beta1/module.js +27 -27
- package/cosmos.gov.v1beta1/module.ts +42 -42
- package/cosmos.gov.v1beta1/registry.js +4 -4
- package/cosmos.gov.v1beta1/registry.ts +4 -4
- package/cosmos.gov.v1beta1/rest.ts +152 -152
- package/cosmos.group.v1/module.js +108 -108
- package/cosmos.group.v1/module.ts +164 -164
- package/cosmos.group.v1/registry.js +18 -18
- package/cosmos.group.v1/registry.ts +18 -18
- package/cosmos.group.v1/rest.js +5 -5
- package/cosmos.group.v1/rest.ts +214 -214
- package/cosmos.mint.v1beta1/rest.ts +13 -13
- package/cosmos.nft.v1beta1/rest.ts +132 -132
- package/cosmos.slashing.v1beta1/rest.ts +19 -19
- package/cosmos.staking.v1beta1/module.js +39 -39
- package/cosmos.staking.v1beta1/module.ts +59 -59
- package/cosmos.staking.v1beta1/registry.js +6 -6
- package/cosmos.staking.v1beta1/registry.ts +6 -6
- package/cosmos.staking.v1beta1/rest.ts +95 -95
- package/cosmos.upgrade.v1beta1/module.js +16 -16
- package/cosmos.upgrade.v1beta1/module.ts +24 -24
- package/cosmos.upgrade.v1beta1/registry.js +2 -2
- package/cosmos.upgrade.v1beta1/registry.ts +2 -2
- package/ibc.applications.interchain_accounts.controller.v1/rest.ts +10 -10
- package/ibc.applications.interchain_accounts.host.v1/rest.ts +13 -13
- package/ibc.applications.transfer.v1/rest.ts +3 -3
- package/ibc.core.channel.v1/rest.ts +44 -44
- package/package.json +1 -1
package/cosmos.gov.v1/module.js
CHANGED
|
@@ -3,10 +3,10 @@ import { SigningStargateClient } from "@cosmjs/stargate";
|
|
|
3
3
|
import { Registry } from "@cosmjs/proto-signing";
|
|
4
4
|
import { msgTypes } from './registry';
|
|
5
5
|
import { Api } from "./rest";
|
|
6
|
+
import { MsgSubmitProposal } from "./types/cosmos/gov/v1/tx";
|
|
6
7
|
import { MsgVote } from "./types/cosmos/gov/v1/tx";
|
|
7
|
-
import { MsgVoteWeighted } from "./types/cosmos/gov/v1/tx";
|
|
8
8
|
import { MsgDeposit } from "./types/cosmos/gov/v1/tx";
|
|
9
|
-
import {
|
|
9
|
+
import { MsgVoteWeighted } from "./types/cosmos/gov/v1/tx";
|
|
10
10
|
import { WeightedVoteOption as typeWeightedVoteOption } from "./types";
|
|
11
11
|
import { Deposit as typeDeposit } from "./types";
|
|
12
12
|
import { Proposal as typeProposal } from "./types";
|
|
@@ -15,7 +15,7 @@ import { Vote as typeVote } from "./types";
|
|
|
15
15
|
import { DepositParams as typeDepositParams } from "./types";
|
|
16
16
|
import { VotingParams as typeVotingParams } from "./types";
|
|
17
17
|
import { TallyParams as typeTallyParams } from "./types";
|
|
18
|
-
export {
|
|
18
|
+
export { MsgSubmitProposal, MsgVote, MsgDeposit, MsgVoteWeighted };
|
|
19
19
|
export const registry = new Registry(msgTypes);
|
|
20
20
|
function getStructure(template) {
|
|
21
21
|
const structure = { fields: [] };
|
|
@@ -31,32 +31,32 @@ const defaultFee = {
|
|
|
31
31
|
};
|
|
32
32
|
export const txClient = ({ signer, prefix, addr } = { addr: "http://localhost:26657", prefix: "cosmos" }) => {
|
|
33
33
|
return {
|
|
34
|
-
async
|
|
34
|
+
async sendMsgSubmitProposal({ value, fee, memo }) {
|
|
35
35
|
if (!signer) {
|
|
36
|
-
throw new Error('TxClient:
|
|
36
|
+
throw new Error('TxClient:sendMsgSubmitProposal: Unable to sign Tx. Signer is not present.');
|
|
37
37
|
}
|
|
38
38
|
try {
|
|
39
39
|
const { address } = (await signer.getAccounts())[0];
|
|
40
40
|
const signingClient = await SigningStargateClient.connectWithSigner(addr, signer, { registry, prefix });
|
|
41
|
-
let msg = this.
|
|
41
|
+
let msg = this.msgSubmitProposal({ value: MsgSubmitProposal.fromPartial(value) });
|
|
42
42
|
return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo);
|
|
43
43
|
}
|
|
44
44
|
catch (e) {
|
|
45
|
-
throw new Error('TxClient:
|
|
45
|
+
throw new Error('TxClient:sendMsgSubmitProposal: Could not broadcast Tx: ' + e.message);
|
|
46
46
|
}
|
|
47
47
|
},
|
|
48
|
-
async
|
|
48
|
+
async sendMsgVote({ value, fee, memo }) {
|
|
49
49
|
if (!signer) {
|
|
50
|
-
throw new Error('TxClient:
|
|
50
|
+
throw new Error('TxClient:sendMsgVote: Unable to sign Tx. Signer is not present.');
|
|
51
51
|
}
|
|
52
52
|
try {
|
|
53
53
|
const { address } = (await signer.getAccounts())[0];
|
|
54
54
|
const signingClient = await SigningStargateClient.connectWithSigner(addr, signer, { registry, prefix });
|
|
55
|
-
let msg = this.
|
|
55
|
+
let msg = this.msgVote({ value: MsgVote.fromPartial(value) });
|
|
56
56
|
return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo);
|
|
57
57
|
}
|
|
58
58
|
catch (e) {
|
|
59
|
-
throw new Error('TxClient:
|
|
59
|
+
throw new Error('TxClient:sendMsgVote: Could not broadcast Tx: ' + e.message);
|
|
60
60
|
}
|
|
61
61
|
},
|
|
62
62
|
async sendMsgDeposit({ value, fee, memo }) {
|
|
@@ -73,34 +73,34 @@ export const txClient = ({ signer, prefix, addr } = { addr: "http://localhost:26
|
|
|
73
73
|
throw new Error('TxClient:sendMsgDeposit: Could not broadcast Tx: ' + e.message);
|
|
74
74
|
}
|
|
75
75
|
},
|
|
76
|
-
async
|
|
76
|
+
async sendMsgVoteWeighted({ value, fee, memo }) {
|
|
77
77
|
if (!signer) {
|
|
78
|
-
throw new Error('TxClient:
|
|
78
|
+
throw new Error('TxClient:sendMsgVoteWeighted: Unable to sign Tx. Signer is not present.');
|
|
79
79
|
}
|
|
80
80
|
try {
|
|
81
81
|
const { address } = (await signer.getAccounts())[0];
|
|
82
82
|
const signingClient = await SigningStargateClient.connectWithSigner(addr, signer, { registry, prefix });
|
|
83
|
-
let msg = this.
|
|
83
|
+
let msg = this.msgVoteWeighted({ value: MsgVoteWeighted.fromPartial(value) });
|
|
84
84
|
return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo);
|
|
85
85
|
}
|
|
86
86
|
catch (e) {
|
|
87
|
-
throw new Error('TxClient:
|
|
87
|
+
throw new Error('TxClient:sendMsgVoteWeighted: Could not broadcast Tx: ' + e.message);
|
|
88
88
|
}
|
|
89
89
|
},
|
|
90
|
-
|
|
90
|
+
msgSubmitProposal({ value }) {
|
|
91
91
|
try {
|
|
92
|
-
return { typeUrl: "/cosmos.gov.v1.
|
|
92
|
+
return { typeUrl: "/cosmos.gov.v1.MsgSubmitProposal", value: MsgSubmitProposal.fromPartial(value) };
|
|
93
93
|
}
|
|
94
94
|
catch (e) {
|
|
95
|
-
throw new Error('TxClient:
|
|
95
|
+
throw new Error('TxClient:MsgSubmitProposal: Could not create message: ' + e.message);
|
|
96
96
|
}
|
|
97
97
|
},
|
|
98
|
-
|
|
98
|
+
msgVote({ value }) {
|
|
99
99
|
try {
|
|
100
|
-
return { typeUrl: "/cosmos.gov.v1.
|
|
100
|
+
return { typeUrl: "/cosmos.gov.v1.MsgVote", value: MsgVote.fromPartial(value) };
|
|
101
101
|
}
|
|
102
102
|
catch (e) {
|
|
103
|
-
throw new Error('TxClient:
|
|
103
|
+
throw new Error('TxClient:MsgVote: Could not create message: ' + e.message);
|
|
104
104
|
}
|
|
105
105
|
},
|
|
106
106
|
msgDeposit({ value }) {
|
|
@@ -111,12 +111,12 @@ export const txClient = ({ signer, prefix, addr } = { addr: "http://localhost:26
|
|
|
111
111
|
throw new Error('TxClient:MsgDeposit: Could not create message: ' + e.message);
|
|
112
112
|
}
|
|
113
113
|
},
|
|
114
|
-
|
|
114
|
+
msgVoteWeighted({ value }) {
|
|
115
115
|
try {
|
|
116
|
-
return { typeUrl: "/cosmos.gov.v1.
|
|
116
|
+
return { typeUrl: "/cosmos.gov.v1.MsgVoteWeighted", value: MsgVoteWeighted.fromPartial(value) };
|
|
117
117
|
}
|
|
118
118
|
catch (e) {
|
|
119
|
-
throw new Error('TxClient:
|
|
119
|
+
throw new Error('TxClient:MsgVoteWeighted: Could not create message: ' + e.message);
|
|
120
120
|
}
|
|
121
121
|
},
|
|
122
122
|
};
|
package/cosmos.gov.v1/module.ts
CHANGED
|
@@ -7,10 +7,10 @@ import { msgTypes } from './registry';
|
|
|
7
7
|
import { IgniteClient } from "../client"
|
|
8
8
|
import { MissingWalletError } from "../helpers"
|
|
9
9
|
import { Api } from "./rest";
|
|
10
|
+
import { MsgSubmitProposal } from "./types/cosmos/gov/v1/tx";
|
|
10
11
|
import { MsgVote } from "./types/cosmos/gov/v1/tx";
|
|
11
|
-
import { MsgVoteWeighted } from "./types/cosmos/gov/v1/tx";
|
|
12
12
|
import { MsgDeposit } from "./types/cosmos/gov/v1/tx";
|
|
13
|
-
import {
|
|
13
|
+
import { MsgVoteWeighted } from "./types/cosmos/gov/v1/tx";
|
|
14
14
|
|
|
15
15
|
import { WeightedVoteOption as typeWeightedVoteOption} from "./types"
|
|
16
16
|
import { Deposit as typeDeposit} from "./types"
|
|
@@ -21,16 +21,16 @@ import { DepositParams as typeDepositParams} from "./types"
|
|
|
21
21
|
import { VotingParams as typeVotingParams} from "./types"
|
|
22
22
|
import { TallyParams as typeTallyParams} from "./types"
|
|
23
23
|
|
|
24
|
-
export {
|
|
24
|
+
export { MsgSubmitProposal, MsgVote, MsgDeposit, MsgVoteWeighted };
|
|
25
25
|
|
|
26
|
-
type
|
|
27
|
-
value:
|
|
26
|
+
type sendMsgSubmitProposalParams = {
|
|
27
|
+
value: MsgSubmitProposal,
|
|
28
28
|
fee?: StdFee,
|
|
29
29
|
memo?: string
|
|
30
30
|
};
|
|
31
31
|
|
|
32
|
-
type
|
|
33
|
-
value:
|
|
32
|
+
type sendMsgVoteParams = {
|
|
33
|
+
value: MsgVote,
|
|
34
34
|
fee?: StdFee,
|
|
35
35
|
memo?: string
|
|
36
36
|
};
|
|
@@ -41,27 +41,27 @@ type sendMsgDepositParams = {
|
|
|
41
41
|
memo?: string
|
|
42
42
|
};
|
|
43
43
|
|
|
44
|
-
type
|
|
45
|
-
value:
|
|
44
|
+
type sendMsgVoteWeightedParams = {
|
|
45
|
+
value: MsgVoteWeighted,
|
|
46
46
|
fee?: StdFee,
|
|
47
47
|
memo?: string
|
|
48
48
|
};
|
|
49
49
|
|
|
50
50
|
|
|
51
|
-
type
|
|
52
|
-
value:
|
|
51
|
+
type msgSubmitProposalParams = {
|
|
52
|
+
value: MsgSubmitProposal,
|
|
53
53
|
};
|
|
54
54
|
|
|
55
|
-
type
|
|
56
|
-
value:
|
|
55
|
+
type msgVoteParams = {
|
|
56
|
+
value: MsgVote,
|
|
57
57
|
};
|
|
58
58
|
|
|
59
59
|
type msgDepositParams = {
|
|
60
60
|
value: MsgDeposit,
|
|
61
61
|
};
|
|
62
62
|
|
|
63
|
-
type
|
|
64
|
-
value:
|
|
63
|
+
type msgVoteWeightedParams = {
|
|
64
|
+
value: MsgVoteWeighted,
|
|
65
65
|
};
|
|
66
66
|
|
|
67
67
|
|
|
@@ -94,31 +94,31 @@ export const txClient = ({ signer, prefix, addr }: TxClientOptions = { addr: "ht
|
|
|
94
94
|
|
|
95
95
|
return {
|
|
96
96
|
|
|
97
|
-
async
|
|
97
|
+
async sendMsgSubmitProposal({ value, fee, memo }: sendMsgSubmitProposalParams): Promise<DeliverTxResponse> {
|
|
98
98
|
if (!signer) {
|
|
99
|
-
throw new Error('TxClient:
|
|
99
|
+
throw new Error('TxClient:sendMsgSubmitProposal: Unable to sign Tx. Signer is not present.')
|
|
100
100
|
}
|
|
101
101
|
try {
|
|
102
102
|
const { address } = (await signer.getAccounts())[0];
|
|
103
103
|
const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry, prefix});
|
|
104
|
-
let msg = this.
|
|
104
|
+
let msg = this.msgSubmitProposal({ value: MsgSubmitProposal.fromPartial(value) })
|
|
105
105
|
return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo)
|
|
106
106
|
} catch (e: any) {
|
|
107
|
-
throw new Error('TxClient:
|
|
107
|
+
throw new Error('TxClient:sendMsgSubmitProposal: Could not broadcast Tx: '+ e.message)
|
|
108
108
|
}
|
|
109
109
|
},
|
|
110
110
|
|
|
111
|
-
async
|
|
111
|
+
async sendMsgVote({ value, fee, memo }: sendMsgVoteParams): Promise<DeliverTxResponse> {
|
|
112
112
|
if (!signer) {
|
|
113
|
-
throw new Error('TxClient:
|
|
113
|
+
throw new Error('TxClient:sendMsgVote: Unable to sign Tx. Signer is not present.')
|
|
114
114
|
}
|
|
115
115
|
try {
|
|
116
116
|
const { address } = (await signer.getAccounts())[0];
|
|
117
117
|
const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry, prefix});
|
|
118
|
-
let msg = this.
|
|
118
|
+
let msg = this.msgVote({ value: MsgVote.fromPartial(value) })
|
|
119
119
|
return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo)
|
|
120
120
|
} catch (e: any) {
|
|
121
|
-
throw new Error('TxClient:
|
|
121
|
+
throw new Error('TxClient:sendMsgVote: Could not broadcast Tx: '+ e.message)
|
|
122
122
|
}
|
|
123
123
|
},
|
|
124
124
|
|
|
@@ -136,34 +136,34 @@ export const txClient = ({ signer, prefix, addr }: TxClientOptions = { addr: "ht
|
|
|
136
136
|
}
|
|
137
137
|
},
|
|
138
138
|
|
|
139
|
-
async
|
|
139
|
+
async sendMsgVoteWeighted({ value, fee, memo }: sendMsgVoteWeightedParams): Promise<DeliverTxResponse> {
|
|
140
140
|
if (!signer) {
|
|
141
|
-
throw new Error('TxClient:
|
|
141
|
+
throw new Error('TxClient:sendMsgVoteWeighted: Unable to sign Tx. Signer is not present.')
|
|
142
142
|
}
|
|
143
143
|
try {
|
|
144
144
|
const { address } = (await signer.getAccounts())[0];
|
|
145
145
|
const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry, prefix});
|
|
146
|
-
let msg = this.
|
|
146
|
+
let msg = this.msgVoteWeighted({ value: MsgVoteWeighted.fromPartial(value) })
|
|
147
147
|
return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo)
|
|
148
148
|
} catch (e: any) {
|
|
149
|
-
throw new Error('TxClient:
|
|
149
|
+
throw new Error('TxClient:sendMsgVoteWeighted: Could not broadcast Tx: '+ e.message)
|
|
150
150
|
}
|
|
151
151
|
},
|
|
152
152
|
|
|
153
153
|
|
|
154
|
-
|
|
154
|
+
msgSubmitProposal({ value }: msgSubmitProposalParams): EncodeObject {
|
|
155
155
|
try {
|
|
156
|
-
return { typeUrl: "/cosmos.gov.v1.
|
|
156
|
+
return { typeUrl: "/cosmos.gov.v1.MsgSubmitProposal", value: MsgSubmitProposal.fromPartial( value ) }
|
|
157
157
|
} catch (e: any) {
|
|
158
|
-
throw new Error('TxClient:
|
|
158
|
+
throw new Error('TxClient:MsgSubmitProposal: Could not create message: ' + e.message)
|
|
159
159
|
}
|
|
160
160
|
},
|
|
161
161
|
|
|
162
|
-
|
|
162
|
+
msgVote({ value }: msgVoteParams): EncodeObject {
|
|
163
163
|
try {
|
|
164
|
-
return { typeUrl: "/cosmos.gov.v1.
|
|
164
|
+
return { typeUrl: "/cosmos.gov.v1.MsgVote", value: MsgVote.fromPartial( value ) }
|
|
165
165
|
} catch (e: any) {
|
|
166
|
-
throw new Error('TxClient:
|
|
166
|
+
throw new Error('TxClient:MsgVote: Could not create message: ' + e.message)
|
|
167
167
|
}
|
|
168
168
|
},
|
|
169
169
|
|
|
@@ -175,11 +175,11 @@ export const txClient = ({ signer, prefix, addr }: TxClientOptions = { addr: "ht
|
|
|
175
175
|
}
|
|
176
176
|
},
|
|
177
177
|
|
|
178
|
-
|
|
178
|
+
msgVoteWeighted({ value }: msgVoteWeightedParams): EncodeObject {
|
|
179
179
|
try {
|
|
180
|
-
return { typeUrl: "/cosmos.gov.v1.
|
|
180
|
+
return { typeUrl: "/cosmos.gov.v1.MsgVoteWeighted", value: MsgVoteWeighted.fromPartial( value ) }
|
|
181
181
|
} catch (e: any) {
|
|
182
|
-
throw new Error('TxClient:
|
|
182
|
+
throw new Error('TxClient:MsgVoteWeighted: Could not create message: ' + e.message)
|
|
183
183
|
}
|
|
184
184
|
},
|
|
185
185
|
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
+
import { MsgSubmitProposal } from "./types/cosmos/gov/v1/tx";
|
|
1
2
|
import { MsgVote } from "./types/cosmos/gov/v1/tx";
|
|
2
|
-
import { MsgVoteWeighted } from "./types/cosmos/gov/v1/tx";
|
|
3
3
|
import { MsgDeposit } from "./types/cosmos/gov/v1/tx";
|
|
4
|
-
import {
|
|
4
|
+
import { MsgVoteWeighted } from "./types/cosmos/gov/v1/tx";
|
|
5
5
|
const msgTypes = [
|
|
6
|
+
["/cosmos.gov.v1.MsgSubmitProposal", MsgSubmitProposal],
|
|
6
7
|
["/cosmos.gov.v1.MsgVote", MsgVote],
|
|
7
|
-
["/cosmos.gov.v1.MsgVoteWeighted", MsgVoteWeighted],
|
|
8
8
|
["/cosmos.gov.v1.MsgDeposit", MsgDeposit],
|
|
9
|
-
["/cosmos.gov.v1.
|
|
9
|
+
["/cosmos.gov.v1.MsgVoteWeighted", MsgVoteWeighted],
|
|
10
10
|
];
|
|
11
11
|
export { msgTypes };
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { GeneratedType } from "@cosmjs/proto-signing";
|
|
2
|
+
import { MsgSubmitProposal } from "./types/cosmos/gov/v1/tx";
|
|
2
3
|
import { MsgVote } from "./types/cosmos/gov/v1/tx";
|
|
3
|
-
import { MsgVoteWeighted } from "./types/cosmos/gov/v1/tx";
|
|
4
4
|
import { MsgDeposit } from "./types/cosmos/gov/v1/tx";
|
|
5
|
-
import {
|
|
5
|
+
import { MsgVoteWeighted } from "./types/cosmos/gov/v1/tx";
|
|
6
6
|
|
|
7
7
|
const msgTypes: Array<[string, GeneratedType]> = [
|
|
8
|
+
["/cosmos.gov.v1.MsgSubmitProposal", MsgSubmitProposal],
|
|
8
9
|
["/cosmos.gov.v1.MsgVote", MsgVote],
|
|
9
|
-
["/cosmos.gov.v1.MsgVoteWeighted", MsgVoteWeighted],
|
|
10
10
|
["/cosmos.gov.v1.MsgDeposit", MsgDeposit],
|
|
11
|
-
["/cosmos.gov.v1.
|
|
11
|
+
["/cosmos.gov.v1.MsgVoteWeighted", MsgVoteWeighted],
|
|
12
12
|
|
|
13
13
|
];
|
|
14
14
|
|
package/cosmos.gov.v1/rest.ts
CHANGED
|
@@ -9,6 +9,89 @@
|
|
|
9
9
|
* ---------------------------------------------------------------
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
|
+
/**
|
|
13
|
+
* Deposit defines an amount deposited by an account address to an active
|
|
14
|
+
proposal.
|
|
15
|
+
*/
|
|
16
|
+
export interface Govv1Deposit {
|
|
17
|
+
/** @format uint64 */
|
|
18
|
+
proposal_id?: string;
|
|
19
|
+
depositor?: string;
|
|
20
|
+
amount?: V1Beta1Coin[];
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Proposal defines the core field members of a governance proposal.
|
|
25
|
+
*/
|
|
26
|
+
export interface Govv1Proposal {
|
|
27
|
+
/** @format uint64 */
|
|
28
|
+
id?: string;
|
|
29
|
+
messages?: ProtobufAny[];
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* ProposalStatus enumerates the valid statuses of a proposal.
|
|
33
|
+
*
|
|
34
|
+
* - PROPOSAL_STATUS_UNSPECIFIED: PROPOSAL_STATUS_UNSPECIFIED defines the default proposal status.
|
|
35
|
+
* - PROPOSAL_STATUS_DEPOSIT_PERIOD: PROPOSAL_STATUS_DEPOSIT_PERIOD defines a proposal status during the deposit
|
|
36
|
+
* period.
|
|
37
|
+
* - PROPOSAL_STATUS_VOTING_PERIOD: PROPOSAL_STATUS_VOTING_PERIOD defines a proposal status during the voting
|
|
38
|
+
* - PROPOSAL_STATUS_PASSED: PROPOSAL_STATUS_PASSED defines a proposal status of a proposal that has
|
|
39
|
+
* passed.
|
|
40
|
+
* - PROPOSAL_STATUS_REJECTED: PROPOSAL_STATUS_REJECTED defines a proposal status of a proposal that has
|
|
41
|
+
* been rejected.
|
|
42
|
+
* - PROPOSAL_STATUS_FAILED: PROPOSAL_STATUS_FAILED defines a proposal status of a proposal that has
|
|
43
|
+
* failed.
|
|
44
|
+
*/
|
|
45
|
+
status?: V1ProposalStatus;
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* final_tally_result is the final tally result of the proposal. When
|
|
49
|
+
* querying a proposal via gRPC, this field is not populated until the
|
|
50
|
+
* proposal's voting period has ended.
|
|
51
|
+
*/
|
|
52
|
+
final_tally_result?: Govv1TallyResult;
|
|
53
|
+
|
|
54
|
+
/** @format date-time */
|
|
55
|
+
submit_time?: string;
|
|
56
|
+
|
|
57
|
+
/** @format date-time */
|
|
58
|
+
deposit_end_time?: string;
|
|
59
|
+
total_deposit?: V1Beta1Coin[];
|
|
60
|
+
|
|
61
|
+
/** @format date-time */
|
|
62
|
+
voting_start_time?: string;
|
|
63
|
+
|
|
64
|
+
/** @format date-time */
|
|
65
|
+
voting_end_time?: string;
|
|
66
|
+
|
|
67
|
+
/** metadata is any arbitrary metadata attached to the proposal. */
|
|
68
|
+
metadata?: string;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* TallyResult defines a standard tally for a governance proposal.
|
|
73
|
+
*/
|
|
74
|
+
export interface Govv1TallyResult {
|
|
75
|
+
yes_count?: string;
|
|
76
|
+
abstain_count?: string;
|
|
77
|
+
no_count?: string;
|
|
78
|
+
no_with_veto_count?: string;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* Vote defines a vote on a governance proposal.
|
|
83
|
+
A Vote consists of a proposal ID, the voter, and the vote option.
|
|
84
|
+
*/
|
|
85
|
+
export interface Govv1Vote {
|
|
86
|
+
/** @format uint64 */
|
|
87
|
+
proposal_id?: string;
|
|
88
|
+
voter?: string;
|
|
89
|
+
options?: V1WeightedVoteOption[];
|
|
90
|
+
|
|
91
|
+
/** metadata is any arbitrary metadata to attached to the vote. */
|
|
92
|
+
metadata?: string;
|
|
93
|
+
}
|
|
94
|
+
|
|
12
95
|
/**
|
|
13
96
|
* `Any` contains an arbitrary serialized protocol buffer message along with a
|
|
14
97
|
URL that describes the type of the serialized message.
|
|
@@ -130,17 +213,6 @@ export interface RpcStatus {
|
|
|
130
213
|
details?: ProtobufAny[];
|
|
131
214
|
}
|
|
132
215
|
|
|
133
|
-
/**
|
|
134
|
-
* Deposit defines an amount deposited by an account address to an active
|
|
135
|
-
proposal.
|
|
136
|
-
*/
|
|
137
|
-
export interface V1Deposit {
|
|
138
|
-
/** @format uint64 */
|
|
139
|
-
proposal_id?: string;
|
|
140
|
-
depositor?: string;
|
|
141
|
-
amount?: V1Beta1Coin[];
|
|
142
|
-
}
|
|
143
|
-
|
|
144
216
|
/**
|
|
145
217
|
* DepositParams defines the params for deposits on governance proposals.
|
|
146
218
|
*/
|
|
@@ -183,54 +255,6 @@ export type V1MsgVoteResponse = object;
|
|
|
183
255
|
*/
|
|
184
256
|
export type V1MsgVoteWeightedResponse = object;
|
|
185
257
|
|
|
186
|
-
/**
|
|
187
|
-
* Proposal defines the core field members of a governance proposal.
|
|
188
|
-
*/
|
|
189
|
-
export interface V1Proposal {
|
|
190
|
-
/** @format uint64 */
|
|
191
|
-
id?: string;
|
|
192
|
-
messages?: ProtobufAny[];
|
|
193
|
-
|
|
194
|
-
/**
|
|
195
|
-
* ProposalStatus enumerates the valid statuses of a proposal.
|
|
196
|
-
*
|
|
197
|
-
* - PROPOSAL_STATUS_UNSPECIFIED: PROPOSAL_STATUS_UNSPECIFIED defines the default proposal status.
|
|
198
|
-
* - PROPOSAL_STATUS_DEPOSIT_PERIOD: PROPOSAL_STATUS_DEPOSIT_PERIOD defines a proposal status during the deposit
|
|
199
|
-
* period.
|
|
200
|
-
* - PROPOSAL_STATUS_VOTING_PERIOD: PROPOSAL_STATUS_VOTING_PERIOD defines a proposal status during the voting
|
|
201
|
-
* - PROPOSAL_STATUS_PASSED: PROPOSAL_STATUS_PASSED defines a proposal status of a proposal that has
|
|
202
|
-
* passed.
|
|
203
|
-
* - PROPOSAL_STATUS_REJECTED: PROPOSAL_STATUS_REJECTED defines a proposal status of a proposal that has
|
|
204
|
-
* been rejected.
|
|
205
|
-
* - PROPOSAL_STATUS_FAILED: PROPOSAL_STATUS_FAILED defines a proposal status of a proposal that has
|
|
206
|
-
* failed.
|
|
207
|
-
*/
|
|
208
|
-
status?: V1ProposalStatus;
|
|
209
|
-
|
|
210
|
-
/**
|
|
211
|
-
* final_tally_result is the final tally result of the proposal. When
|
|
212
|
-
* querying a proposal via gRPC, this field is not populated until the
|
|
213
|
-
* proposal's voting period has ended.
|
|
214
|
-
*/
|
|
215
|
-
final_tally_result?: V1TallyResult;
|
|
216
|
-
|
|
217
|
-
/** @format date-time */
|
|
218
|
-
submit_time?: string;
|
|
219
|
-
|
|
220
|
-
/** @format date-time */
|
|
221
|
-
deposit_end_time?: string;
|
|
222
|
-
total_deposit?: V1Beta1Coin[];
|
|
223
|
-
|
|
224
|
-
/** @format date-time */
|
|
225
|
-
voting_start_time?: string;
|
|
226
|
-
|
|
227
|
-
/** @format date-time */
|
|
228
|
-
voting_end_time?: string;
|
|
229
|
-
|
|
230
|
-
/** metadata is any arbitrary metadata attached to the proposal. */
|
|
231
|
-
metadata?: string;
|
|
232
|
-
}
|
|
233
|
-
|
|
234
258
|
/**
|
|
235
259
|
* ProposalStatus enumerates the valid statuses of a proposal.
|
|
236
260
|
|
|
@@ -260,14 +284,14 @@ export enum V1ProposalStatus {
|
|
|
260
284
|
*/
|
|
261
285
|
export interface V1QueryDepositResponse {
|
|
262
286
|
/** deposit defines the requested deposit. */
|
|
263
|
-
deposit?:
|
|
287
|
+
deposit?: Govv1Deposit;
|
|
264
288
|
}
|
|
265
289
|
|
|
266
290
|
/**
|
|
267
291
|
* QueryDepositsResponse is the response type for the Query/Deposits RPC method.
|
|
268
292
|
*/
|
|
269
293
|
export interface V1QueryDepositsResponse {
|
|
270
|
-
deposits?:
|
|
294
|
+
deposits?: Govv1Deposit[];
|
|
271
295
|
|
|
272
296
|
/** pagination defines the pagination in the response. */
|
|
273
297
|
pagination?: V1Beta1PageResponse;
|
|
@@ -292,7 +316,7 @@ export interface V1QueryParamsResponse {
|
|
|
292
316
|
*/
|
|
293
317
|
export interface V1QueryProposalResponse {
|
|
294
318
|
/** Proposal defines the core field members of a governance proposal. */
|
|
295
|
-
proposal?:
|
|
319
|
+
proposal?: Govv1Proposal;
|
|
296
320
|
}
|
|
297
321
|
|
|
298
322
|
/**
|
|
@@ -300,7 +324,7 @@ export interface V1QueryProposalResponse {
|
|
|
300
324
|
method.
|
|
301
325
|
*/
|
|
302
326
|
export interface V1QueryProposalsResponse {
|
|
303
|
-
proposals?:
|
|
327
|
+
proposals?: Govv1Proposal[];
|
|
304
328
|
|
|
305
329
|
/** pagination defines the pagination in the response. */
|
|
306
330
|
pagination?: V1Beta1PageResponse;
|
|
@@ -311,7 +335,7 @@ export interface V1QueryProposalsResponse {
|
|
|
311
335
|
*/
|
|
312
336
|
export interface V1QueryTallyResultResponse {
|
|
313
337
|
/** tally defines the requested tally. */
|
|
314
|
-
tally?:
|
|
338
|
+
tally?: Govv1TallyResult;
|
|
315
339
|
}
|
|
316
340
|
|
|
317
341
|
/**
|
|
@@ -319,7 +343,7 @@ export interface V1QueryTallyResultResponse {
|
|
|
319
343
|
*/
|
|
320
344
|
export interface V1QueryVoteResponse {
|
|
321
345
|
/** vote defined the queried vote. */
|
|
322
|
-
vote?:
|
|
346
|
+
vote?: Govv1Vote;
|
|
323
347
|
}
|
|
324
348
|
|
|
325
349
|
/**
|
|
@@ -327,7 +351,7 @@ export interface V1QueryVoteResponse {
|
|
|
327
351
|
*/
|
|
328
352
|
export interface V1QueryVotesResponse {
|
|
329
353
|
/** votes defined the queried votes. */
|
|
330
|
-
votes?:
|
|
354
|
+
votes?: Govv1Vote[];
|
|
331
355
|
|
|
332
356
|
/** pagination defines the pagination in the response. */
|
|
333
357
|
pagination?: V1Beta1PageResponse;
|
|
@@ -353,30 +377,6 @@ export interface V1TallyParams {
|
|
|
353
377
|
veto_threshold?: string;
|
|
354
378
|
}
|
|
355
379
|
|
|
356
|
-
/**
|
|
357
|
-
* TallyResult defines a standard tally for a governance proposal.
|
|
358
|
-
*/
|
|
359
|
-
export interface V1TallyResult {
|
|
360
|
-
yes_count?: string;
|
|
361
|
-
abstain_count?: string;
|
|
362
|
-
no_count?: string;
|
|
363
|
-
no_with_veto_count?: string;
|
|
364
|
-
}
|
|
365
|
-
|
|
366
|
-
/**
|
|
367
|
-
* Vote defines a vote on a governance proposal.
|
|
368
|
-
A Vote consists of a proposal ID, the voter, and the vote option.
|
|
369
|
-
*/
|
|
370
|
-
export interface V1Vote {
|
|
371
|
-
/** @format uint64 */
|
|
372
|
-
proposal_id?: string;
|
|
373
|
-
voter?: string;
|
|
374
|
-
options?: V1WeightedVoteOption[];
|
|
375
|
-
|
|
376
|
-
/** metadata is any arbitrary metadata to attached to the vote. */
|
|
377
|
-
metadata?: string;
|
|
378
|
-
}
|
|
379
|
-
|
|
380
380
|
/**
|
|
381
381
|
* VoteOption enumerates the valid vote options for a given governance proposal.
|
|
382
382
|
|