decentralcardgame-cardchain-client-ts 0.0.25 → 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
|
@@ -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 { MsgDeposit } from "./types/cosmos/gov/v1beta1/tx";
|
|
7
6
|
import { MsgSubmitProposal } from "./types/cosmos/gov/v1beta1/tx";
|
|
8
|
-
import {
|
|
7
|
+
import { MsgDeposit } from "./types/cosmos/gov/v1beta1/tx";
|
|
9
8
|
import { MsgVoteWeighted } from "./types/cosmos/gov/v1beta1/tx";
|
|
9
|
+
import { MsgVote } from "./types/cosmos/gov/v1beta1/tx";
|
|
10
10
|
import { WeightedVoteOption as typeWeightedVoteOption } from "./types";
|
|
11
11
|
import { TextProposal as typeTextProposal } from "./types";
|
|
12
12
|
import { Deposit as typeDeposit } from "./types";
|
|
@@ -16,7 +16,7 @@ import { Vote as typeVote } from "./types";
|
|
|
16
16
|
import { DepositParams as typeDepositParams } from "./types";
|
|
17
17
|
import { VotingParams as typeVotingParams } from "./types";
|
|
18
18
|
import { TallyParams as typeTallyParams } from "./types";
|
|
19
|
-
export { MsgDeposit,
|
|
19
|
+
export { MsgSubmitProposal, MsgDeposit, MsgVoteWeighted, MsgVote };
|
|
20
20
|
export const registry = new Registry(msgTypes);
|
|
21
21
|
function getStructure(template) {
|
|
22
22
|
const structure = { fields: [] };
|
|
@@ -32,20 +32,6 @@ const defaultFee = {
|
|
|
32
32
|
};
|
|
33
33
|
export const txClient = ({ signer, prefix, addr } = { addr: "http://localhost:26657", prefix: "cosmos" }) => {
|
|
34
34
|
return {
|
|
35
|
-
async sendMsgDeposit({ value, fee, memo }) {
|
|
36
|
-
if (!signer) {
|
|
37
|
-
throw new Error('TxClient:sendMsgDeposit: Unable to sign Tx. Signer is not present.');
|
|
38
|
-
}
|
|
39
|
-
try {
|
|
40
|
-
const { address } = (await signer.getAccounts())[0];
|
|
41
|
-
const signingClient = await SigningStargateClient.connectWithSigner(addr, signer, { registry, prefix });
|
|
42
|
-
let msg = this.msgDeposit({ value: MsgDeposit.fromPartial(value) });
|
|
43
|
-
return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo);
|
|
44
|
-
}
|
|
45
|
-
catch (e) {
|
|
46
|
-
throw new Error('TxClient:sendMsgDeposit: Could not broadcast Tx: ' + e.message);
|
|
47
|
-
}
|
|
48
|
-
},
|
|
49
35
|
async sendMsgSubmitProposal({ value, fee, memo }) {
|
|
50
36
|
if (!signer) {
|
|
51
37
|
throw new Error('TxClient:sendMsgSubmitProposal: Unable to sign Tx. Signer is not present.');
|
|
@@ -60,18 +46,18 @@ export const txClient = ({ signer, prefix, addr } = { addr: "http://localhost:26
|
|
|
60
46
|
throw new Error('TxClient:sendMsgSubmitProposal: Could not broadcast Tx: ' + e.message);
|
|
61
47
|
}
|
|
62
48
|
},
|
|
63
|
-
async
|
|
49
|
+
async sendMsgDeposit({ value, fee, memo }) {
|
|
64
50
|
if (!signer) {
|
|
65
|
-
throw new Error('TxClient:
|
|
51
|
+
throw new Error('TxClient:sendMsgDeposit: Unable to sign Tx. Signer is not present.');
|
|
66
52
|
}
|
|
67
53
|
try {
|
|
68
54
|
const { address } = (await signer.getAccounts())[0];
|
|
69
55
|
const signingClient = await SigningStargateClient.connectWithSigner(addr, signer, { registry, prefix });
|
|
70
|
-
let msg = this.
|
|
56
|
+
let msg = this.msgDeposit({ value: MsgDeposit.fromPartial(value) });
|
|
71
57
|
return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo);
|
|
72
58
|
}
|
|
73
59
|
catch (e) {
|
|
74
|
-
throw new Error('TxClient:
|
|
60
|
+
throw new Error('TxClient:sendMsgDeposit: Could not broadcast Tx: ' + e.message);
|
|
75
61
|
}
|
|
76
62
|
},
|
|
77
63
|
async sendMsgVoteWeighted({ value, fee, memo }) {
|
|
@@ -88,12 +74,18 @@ export const txClient = ({ signer, prefix, addr } = { addr: "http://localhost:26
|
|
|
88
74
|
throw new Error('TxClient:sendMsgVoteWeighted: Could not broadcast Tx: ' + e.message);
|
|
89
75
|
}
|
|
90
76
|
},
|
|
91
|
-
|
|
77
|
+
async sendMsgVote({ value, fee, memo }) {
|
|
78
|
+
if (!signer) {
|
|
79
|
+
throw new Error('TxClient:sendMsgVote: Unable to sign Tx. Signer is not present.');
|
|
80
|
+
}
|
|
92
81
|
try {
|
|
93
|
-
|
|
82
|
+
const { address } = (await signer.getAccounts())[0];
|
|
83
|
+
const signingClient = await SigningStargateClient.connectWithSigner(addr, signer, { registry, prefix });
|
|
84
|
+
let msg = this.msgVote({ value: MsgVote.fromPartial(value) });
|
|
85
|
+
return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo);
|
|
94
86
|
}
|
|
95
87
|
catch (e) {
|
|
96
|
-
throw new Error('TxClient:
|
|
88
|
+
throw new Error('TxClient:sendMsgVote: Could not broadcast Tx: ' + e.message);
|
|
97
89
|
}
|
|
98
90
|
},
|
|
99
91
|
msgSubmitProposal({ value }) {
|
|
@@ -104,12 +96,12 @@ export const txClient = ({ signer, prefix, addr } = { addr: "http://localhost:26
|
|
|
104
96
|
throw new Error('TxClient:MsgSubmitProposal: Could not create message: ' + e.message);
|
|
105
97
|
}
|
|
106
98
|
},
|
|
107
|
-
|
|
99
|
+
msgDeposit({ value }) {
|
|
108
100
|
try {
|
|
109
|
-
return { typeUrl: "/cosmos.gov.v1beta1.
|
|
101
|
+
return { typeUrl: "/cosmos.gov.v1beta1.MsgDeposit", value: MsgDeposit.fromPartial(value) };
|
|
110
102
|
}
|
|
111
103
|
catch (e) {
|
|
112
|
-
throw new Error('TxClient:
|
|
104
|
+
throw new Error('TxClient:MsgDeposit: Could not create message: ' + e.message);
|
|
113
105
|
}
|
|
114
106
|
},
|
|
115
107
|
msgVoteWeighted({ value }) {
|
|
@@ -120,6 +112,14 @@ export const txClient = ({ signer, prefix, addr } = { addr: "http://localhost:26
|
|
|
120
112
|
throw new Error('TxClient:MsgVoteWeighted: Could not create message: ' + e.message);
|
|
121
113
|
}
|
|
122
114
|
},
|
|
115
|
+
msgVote({ value }) {
|
|
116
|
+
try {
|
|
117
|
+
return { typeUrl: "/cosmos.gov.v1beta1.MsgVote", value: MsgVote.fromPartial(value) };
|
|
118
|
+
}
|
|
119
|
+
catch (e) {
|
|
120
|
+
throw new Error('TxClient:MsgVote: Could not create message: ' + e.message);
|
|
121
|
+
}
|
|
122
|
+
},
|
|
123
123
|
};
|
|
124
124
|
};
|
|
125
125
|
export const queryClient = ({ addr: addr } = { addr: "http://localhost:1317" }) => {
|
|
@@ -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 { MsgDeposit } from "./types/cosmos/gov/v1beta1/tx";
|
|
11
10
|
import { MsgSubmitProposal } from "./types/cosmos/gov/v1beta1/tx";
|
|
12
|
-
import {
|
|
11
|
+
import { MsgDeposit } from "./types/cosmos/gov/v1beta1/tx";
|
|
13
12
|
import { MsgVoteWeighted } from "./types/cosmos/gov/v1beta1/tx";
|
|
13
|
+
import { MsgVote } from "./types/cosmos/gov/v1beta1/tx";
|
|
14
14
|
|
|
15
15
|
import { WeightedVoteOption as typeWeightedVoteOption} from "./types"
|
|
16
16
|
import { TextProposal as typeTextProposal} from "./types"
|
|
@@ -22,13 +22,7 @@ import { DepositParams as typeDepositParams} from "./types"
|
|
|
22
22
|
import { VotingParams as typeVotingParams} from "./types"
|
|
23
23
|
import { TallyParams as typeTallyParams} from "./types"
|
|
24
24
|
|
|
25
|
-
export { MsgDeposit,
|
|
26
|
-
|
|
27
|
-
type sendMsgDepositParams = {
|
|
28
|
-
value: MsgDeposit,
|
|
29
|
-
fee?: StdFee,
|
|
30
|
-
memo?: string
|
|
31
|
-
};
|
|
25
|
+
export { MsgSubmitProposal, MsgDeposit, MsgVoteWeighted, MsgVote };
|
|
32
26
|
|
|
33
27
|
type sendMsgSubmitProposalParams = {
|
|
34
28
|
value: MsgSubmitProposal,
|
|
@@ -36,8 +30,8 @@ type sendMsgSubmitProposalParams = {
|
|
|
36
30
|
memo?: string
|
|
37
31
|
};
|
|
38
32
|
|
|
39
|
-
type
|
|
40
|
-
value:
|
|
33
|
+
type sendMsgDepositParams = {
|
|
34
|
+
value: MsgDeposit,
|
|
41
35
|
fee?: StdFee,
|
|
42
36
|
memo?: string
|
|
43
37
|
};
|
|
@@ -48,23 +42,29 @@ type sendMsgVoteWeightedParams = {
|
|
|
48
42
|
memo?: string
|
|
49
43
|
};
|
|
50
44
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
45
|
+
type sendMsgVoteParams = {
|
|
46
|
+
value: MsgVote,
|
|
47
|
+
fee?: StdFee,
|
|
48
|
+
memo?: string
|
|
54
49
|
};
|
|
55
50
|
|
|
51
|
+
|
|
56
52
|
type msgSubmitProposalParams = {
|
|
57
53
|
value: MsgSubmitProposal,
|
|
58
54
|
};
|
|
59
55
|
|
|
60
|
-
type
|
|
61
|
-
value:
|
|
56
|
+
type msgDepositParams = {
|
|
57
|
+
value: MsgDeposit,
|
|
62
58
|
};
|
|
63
59
|
|
|
64
60
|
type msgVoteWeightedParams = {
|
|
65
61
|
value: MsgVoteWeighted,
|
|
66
62
|
};
|
|
67
63
|
|
|
64
|
+
type msgVoteParams = {
|
|
65
|
+
value: MsgVote,
|
|
66
|
+
};
|
|
67
|
+
|
|
68
68
|
|
|
69
69
|
export const registry = new Registry(msgTypes);
|
|
70
70
|
|
|
@@ -95,20 +95,6 @@ export const txClient = ({ signer, prefix, addr }: TxClientOptions = { addr: "ht
|
|
|
95
95
|
|
|
96
96
|
return {
|
|
97
97
|
|
|
98
|
-
async sendMsgDeposit({ value, fee, memo }: sendMsgDepositParams): Promise<DeliverTxResponse> {
|
|
99
|
-
if (!signer) {
|
|
100
|
-
throw new Error('TxClient:sendMsgDeposit: Unable to sign Tx. Signer is not present.')
|
|
101
|
-
}
|
|
102
|
-
try {
|
|
103
|
-
const { address } = (await signer.getAccounts())[0];
|
|
104
|
-
const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry, prefix});
|
|
105
|
-
let msg = this.msgDeposit({ value: MsgDeposit.fromPartial(value) })
|
|
106
|
-
return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo)
|
|
107
|
-
} catch (e: any) {
|
|
108
|
-
throw new Error('TxClient:sendMsgDeposit: Could not broadcast Tx: '+ e.message)
|
|
109
|
-
}
|
|
110
|
-
},
|
|
111
|
-
|
|
112
98
|
async sendMsgSubmitProposal({ value, fee, memo }: sendMsgSubmitProposalParams): Promise<DeliverTxResponse> {
|
|
113
99
|
if (!signer) {
|
|
114
100
|
throw new Error('TxClient:sendMsgSubmitProposal: Unable to sign Tx. Signer is not present.')
|
|
@@ -123,17 +109,17 @@ export const txClient = ({ signer, prefix, addr }: TxClientOptions = { addr: "ht
|
|
|
123
109
|
}
|
|
124
110
|
},
|
|
125
111
|
|
|
126
|
-
async
|
|
112
|
+
async sendMsgDeposit({ value, fee, memo }: sendMsgDepositParams): Promise<DeliverTxResponse> {
|
|
127
113
|
if (!signer) {
|
|
128
|
-
throw new Error('TxClient:
|
|
114
|
+
throw new Error('TxClient:sendMsgDeposit: Unable to sign Tx. Signer is not present.')
|
|
129
115
|
}
|
|
130
116
|
try {
|
|
131
117
|
const { address } = (await signer.getAccounts())[0];
|
|
132
118
|
const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry, prefix});
|
|
133
|
-
let msg = this.
|
|
119
|
+
let msg = this.msgDeposit({ value: MsgDeposit.fromPartial(value) })
|
|
134
120
|
return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo)
|
|
135
121
|
} catch (e: any) {
|
|
136
|
-
throw new Error('TxClient:
|
|
122
|
+
throw new Error('TxClient:sendMsgDeposit: Could not broadcast Tx: '+ e.message)
|
|
137
123
|
}
|
|
138
124
|
},
|
|
139
125
|
|
|
@@ -151,15 +137,21 @@ export const txClient = ({ signer, prefix, addr }: TxClientOptions = { addr: "ht
|
|
|
151
137
|
}
|
|
152
138
|
},
|
|
153
139
|
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
140
|
+
async sendMsgVote({ value, fee, memo }: sendMsgVoteParams): Promise<DeliverTxResponse> {
|
|
141
|
+
if (!signer) {
|
|
142
|
+
throw new Error('TxClient:sendMsgVote: Unable to sign Tx. Signer is not present.')
|
|
143
|
+
}
|
|
144
|
+
try {
|
|
145
|
+
const { address } = (await signer.getAccounts())[0];
|
|
146
|
+
const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry, prefix});
|
|
147
|
+
let msg = this.msgVote({ value: MsgVote.fromPartial(value) })
|
|
148
|
+
return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo)
|
|
158
149
|
} catch (e: any) {
|
|
159
|
-
throw new Error('TxClient:
|
|
150
|
+
throw new Error('TxClient:sendMsgVote: Could not broadcast Tx: '+ e.message)
|
|
160
151
|
}
|
|
161
152
|
},
|
|
162
153
|
|
|
154
|
+
|
|
163
155
|
msgSubmitProposal({ value }: msgSubmitProposalParams): EncodeObject {
|
|
164
156
|
try {
|
|
165
157
|
return { typeUrl: "/cosmos.gov.v1beta1.MsgSubmitProposal", value: MsgSubmitProposal.fromPartial( value ) }
|
|
@@ -168,11 +160,11 @@ export const txClient = ({ signer, prefix, addr }: TxClientOptions = { addr: "ht
|
|
|
168
160
|
}
|
|
169
161
|
},
|
|
170
162
|
|
|
171
|
-
|
|
163
|
+
msgDeposit({ value }: msgDepositParams): EncodeObject {
|
|
172
164
|
try {
|
|
173
|
-
return { typeUrl: "/cosmos.gov.v1beta1.
|
|
165
|
+
return { typeUrl: "/cosmos.gov.v1beta1.MsgDeposit", value: MsgDeposit.fromPartial( value ) }
|
|
174
166
|
} catch (e: any) {
|
|
175
|
-
throw new Error('TxClient:
|
|
167
|
+
throw new Error('TxClient:MsgDeposit: Could not create message: ' + e.message)
|
|
176
168
|
}
|
|
177
169
|
},
|
|
178
170
|
|
|
@@ -184,6 +176,14 @@ export const txClient = ({ signer, prefix, addr }: TxClientOptions = { addr: "ht
|
|
|
184
176
|
}
|
|
185
177
|
},
|
|
186
178
|
|
|
179
|
+
msgVote({ value }: msgVoteParams): EncodeObject {
|
|
180
|
+
try {
|
|
181
|
+
return { typeUrl: "/cosmos.gov.v1beta1.MsgVote", value: MsgVote.fromPartial( value ) }
|
|
182
|
+
} catch (e: any) {
|
|
183
|
+
throw new Error('TxClient:MsgVote: Could not create message: ' + e.message)
|
|
184
|
+
}
|
|
185
|
+
},
|
|
186
|
+
|
|
187
187
|
}
|
|
188
188
|
};
|
|
189
189
|
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { MsgDeposit } from "./types/cosmos/gov/v1beta1/tx";
|
|
2
1
|
import { MsgSubmitProposal } from "./types/cosmos/gov/v1beta1/tx";
|
|
3
|
-
import {
|
|
2
|
+
import { MsgDeposit } from "./types/cosmos/gov/v1beta1/tx";
|
|
4
3
|
import { MsgVoteWeighted } from "./types/cosmos/gov/v1beta1/tx";
|
|
4
|
+
import { MsgVote } from "./types/cosmos/gov/v1beta1/tx";
|
|
5
5
|
const msgTypes = [
|
|
6
|
-
["/cosmos.gov.v1beta1.MsgDeposit", MsgDeposit],
|
|
7
6
|
["/cosmos.gov.v1beta1.MsgSubmitProposal", MsgSubmitProposal],
|
|
8
|
-
["/cosmos.gov.v1beta1.
|
|
7
|
+
["/cosmos.gov.v1beta1.MsgDeposit", MsgDeposit],
|
|
9
8
|
["/cosmos.gov.v1beta1.MsgVoteWeighted", MsgVoteWeighted],
|
|
9
|
+
["/cosmos.gov.v1beta1.MsgVote", MsgVote],
|
|
10
10
|
];
|
|
11
11
|
export { msgTypes };
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { GeneratedType } from "@cosmjs/proto-signing";
|
|
2
|
-
import { MsgDeposit } from "./types/cosmos/gov/v1beta1/tx";
|
|
3
2
|
import { MsgSubmitProposal } from "./types/cosmos/gov/v1beta1/tx";
|
|
4
|
-
import {
|
|
3
|
+
import { MsgDeposit } from "./types/cosmos/gov/v1beta1/tx";
|
|
5
4
|
import { MsgVoteWeighted } from "./types/cosmos/gov/v1beta1/tx";
|
|
5
|
+
import { MsgVote } from "./types/cosmos/gov/v1beta1/tx";
|
|
6
6
|
|
|
7
7
|
const msgTypes: Array<[string, GeneratedType]> = [
|
|
8
|
-
["/cosmos.gov.v1beta1.MsgDeposit", MsgDeposit],
|
|
9
8
|
["/cosmos.gov.v1beta1.MsgSubmitProposal", MsgSubmitProposal],
|
|
10
|
-
["/cosmos.gov.v1beta1.
|
|
9
|
+
["/cosmos.gov.v1beta1.MsgDeposit", MsgDeposit],
|
|
11
10
|
["/cosmos.gov.v1beta1.MsgVoteWeighted", MsgVoteWeighted],
|
|
11
|
+
["/cosmos.gov.v1beta1.MsgVote", MsgVote],
|
|
12
12
|
|
|
13
13
|
];
|
|
14
14
|
|