decentralcardgame-cardchain-client-ts 0.0.29 → 0.0.30
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 +420 -452
- package/DecentralCardGame.cardchain.cardchain/module.ts +1495 -1570
- package/DecentralCardGame.cardchain.cardchain/registry.js +78 -70
- package/DecentralCardGame.cardchain.cardchain/registry.ts +78 -70
- package/DecentralCardGame.cardchain.cardchain/rest.js +71 -0
- package/DecentralCardGame.cardchain.cardchain/rest.ts +132 -0
- package/DecentralCardGame.cardchain.cardchain/types/cardchain/cardchain/card.js +6 -0
- package/DecentralCardGame.cardchain.cardchain/types/cardchain/cardchain/card.ts +6 -0
- package/DecentralCardGame.cardchain.cardchain/types/cardchain/cardchain/early_access_proposal.js +81 -0
- package/DecentralCardGame.cardchain.cardchain/types/cardchain/cardchain/early_access_proposal.ts +106 -0
- package/DecentralCardGame.cardchain.cardchain/types/cardchain/cardchain/encounters.js +295 -0
- package/DecentralCardGame.cardchain.cardchain/types/cardchain/cardchain/encounters.ts +354 -0
- package/DecentralCardGame.cardchain.cardchain/types/cardchain/cardchain/genesis.js +16 -0
- package/DecentralCardGame.cardchain.cardchain/types/cardchain/cardchain/genesis.ts +19 -1
- package/DecentralCardGame.cardchain.cardchain/types/cardchain/cardchain/query.js +447 -0
- package/DecentralCardGame.cardchain.cardchain/types/cardchain/cardchain/query.ts +570 -0
- package/DecentralCardGame.cardchain.cardchain/types/cardchain/cardchain/tx.js +504 -0
- package/DecentralCardGame.cardchain.cardchain/types/cardchain/cardchain/tx.ts +613 -0
- package/DecentralCardGame.cardchain.cardchain/types/cardchain/cardchain/user.js +50 -0
- package/DecentralCardGame.cardchain.cardchain/types/cardchain/cardchain/user.ts +48 -0
- package/DecentralCardGame.cardchain.cardchain/types/cardchain/cardchain/zealy.js +58 -0
- package/DecentralCardGame.cardchain.cardchain/types/cardchain/cardchain/zealy.ts +82 -0
- package/DecentralCardGame.cardchain.cardchain/types.js +5 -1
- package/DecentralCardGame.cardchain.cardchain/types.ts +8 -0
- package/DecentralCardGame.cardchain.featureflag/module.js +9 -7
- package/DecentralCardGame.cardchain.featureflag/module.ts +69 -65
- package/client.js +2 -5
- package/client.ts +164 -162
- package/cosmos.authz.v1beta1/module.js +33 -22
- package/cosmos.authz.v1beta1/module.ts +220 -148
- package/cosmos.distribution.v1beta1/module.js +65 -35
- package/cosmos.distribution.v1beta1/module.ts +354 -200
- package/cosmos.evidence.v1beta1/module.js +21 -13
- package/cosmos.evidence.v1beta1/module.ts +115 -86
- package/cosmos.gov.v1/module.js +48 -29
- package/cosmos.gov.v1/module.ts +275 -178
- package/cosmos.mint.v1beta1/module.js +9 -7
- package/cosmos.mint.v1beta1/module.ts +67 -63
- package/cosmos.nft.v1beta1/module.js +9 -7
- package/cosmos.nft.v1beta1/module.ts +75 -71
- package/cosmos.tx.v1beta1/module.js +9 -7
- package/cosmos.tx.v1beta1/module.ts +89 -85
- package/cosmos.vesting.v1beta1/module.js +52 -29
- package/cosmos.vesting.v1beta1/module.ts +249 -149
- package/ibc.applications.interchain_accounts.controller.v1/module.js +9 -7
- package/ibc.applications.interchain_accounts.controller.v1/module.ts +65 -61
- package/ibc.applications.transfer.v1/module.js +17 -12
- package/ibc.applications.transfer.v1/module.ts +114 -88
- package/ibc.core.channel.v1/module.js +1 -4
- package/ibc.core.channel.v1/module.ts +79 -81
- package/ibc.core.client.v1/module.js +1 -4
- package/ibc.core.client.v1/module.ts +81 -83
- package/ibc.core.connection.v1/module.js +6 -7
- package/ibc.core.connection.v1/module.ts +88 -84
- package/package.json +1 -1
- package/tsconfig.json +1 -1
|
@@ -2,93 +2,101 @@
|
|
|
2
2
|
|
|
3
3
|
import { StdFee } from "@cosmjs/amino";
|
|
4
4
|
import { SigningStargateClient, DeliverTxResponse } from "@cosmjs/stargate";
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
import {
|
|
6
|
+
EncodeObject,
|
|
7
|
+
GeneratedType,
|
|
8
|
+
OfflineSigner,
|
|
9
|
+
Registry,
|
|
10
|
+
} from "@cosmjs/proto-signing";
|
|
11
|
+
import { msgTypes } from "./registry";
|
|
12
|
+
import { IgniteClient } from "../client";
|
|
13
|
+
import { MissingWalletError } from "../helpers";
|
|
9
14
|
import { Api } from "./rest";
|
|
10
15
|
import { MsgWithdrawDelegatorReward } from "./types/cosmos/distribution/v1beta1/tx";
|
|
11
16
|
import { MsgWithdrawValidatorCommission } from "./types/cosmos/distribution/v1beta1/tx";
|
|
12
17
|
import { MsgFundCommunityPool } from "./types/cosmos/distribution/v1beta1/tx";
|
|
13
18
|
import { MsgSetWithdrawAddress } from "./types/cosmos/distribution/v1beta1/tx";
|
|
14
19
|
|
|
15
|
-
import { Params as typeParams} from "./types"
|
|
16
|
-
import { ValidatorHistoricalRewards as typeValidatorHistoricalRewards} from "./types"
|
|
17
|
-
import { ValidatorCurrentRewards as typeValidatorCurrentRewards} from "./types"
|
|
18
|
-
import { ValidatorAccumulatedCommission as typeValidatorAccumulatedCommission} from "./types"
|
|
19
|
-
import { ValidatorOutstandingRewards as typeValidatorOutstandingRewards} from "./types"
|
|
20
|
-
import { ValidatorSlashEvent as typeValidatorSlashEvent} from "./types"
|
|
21
|
-
import { ValidatorSlashEvents as typeValidatorSlashEvents} from "./types"
|
|
22
|
-
import { FeePool as typeFeePool} from "./types"
|
|
23
|
-
import { CommunityPoolSpendProposal as typeCommunityPoolSpendProposal} from "./types"
|
|
24
|
-
import { DelegatorStartingInfo as typeDelegatorStartingInfo} from "./types"
|
|
25
|
-
import { DelegationDelegatorReward as typeDelegationDelegatorReward} from "./types"
|
|
26
|
-
import { CommunityPoolSpendProposalWithDeposit as typeCommunityPoolSpendProposalWithDeposit} from "./types"
|
|
27
|
-
import { DelegatorWithdrawInfo as typeDelegatorWithdrawInfo} from "./types"
|
|
28
|
-
import { ValidatorOutstandingRewardsRecord as typeValidatorOutstandingRewardsRecord} from "./types"
|
|
29
|
-
import { ValidatorAccumulatedCommissionRecord as typeValidatorAccumulatedCommissionRecord} from "./types"
|
|
30
|
-
import { ValidatorHistoricalRewardsRecord as typeValidatorHistoricalRewardsRecord} from "./types"
|
|
31
|
-
import { ValidatorCurrentRewardsRecord as typeValidatorCurrentRewardsRecord} from "./types"
|
|
32
|
-
import { DelegatorStartingInfoRecord as typeDelegatorStartingInfoRecord} from "./types"
|
|
33
|
-
import { ValidatorSlashEventRecord as typeValidatorSlashEventRecord} from "./types"
|
|
20
|
+
import { Params as typeParams } from "./types";
|
|
21
|
+
import { ValidatorHistoricalRewards as typeValidatorHistoricalRewards } from "./types";
|
|
22
|
+
import { ValidatorCurrentRewards as typeValidatorCurrentRewards } from "./types";
|
|
23
|
+
import { ValidatorAccumulatedCommission as typeValidatorAccumulatedCommission } from "./types";
|
|
24
|
+
import { ValidatorOutstandingRewards as typeValidatorOutstandingRewards } from "./types";
|
|
25
|
+
import { ValidatorSlashEvent as typeValidatorSlashEvent } from "./types";
|
|
26
|
+
import { ValidatorSlashEvents as typeValidatorSlashEvents } from "./types";
|
|
27
|
+
import { FeePool as typeFeePool } from "./types";
|
|
28
|
+
import { CommunityPoolSpendProposal as typeCommunityPoolSpendProposal } from "./types";
|
|
29
|
+
import { DelegatorStartingInfo as typeDelegatorStartingInfo } from "./types";
|
|
30
|
+
import { DelegationDelegatorReward as typeDelegationDelegatorReward } from "./types";
|
|
31
|
+
import { CommunityPoolSpendProposalWithDeposit as typeCommunityPoolSpendProposalWithDeposit } from "./types";
|
|
32
|
+
import { DelegatorWithdrawInfo as typeDelegatorWithdrawInfo } from "./types";
|
|
33
|
+
import { ValidatorOutstandingRewardsRecord as typeValidatorOutstandingRewardsRecord } from "./types";
|
|
34
|
+
import { ValidatorAccumulatedCommissionRecord as typeValidatorAccumulatedCommissionRecord } from "./types";
|
|
35
|
+
import { ValidatorHistoricalRewardsRecord as typeValidatorHistoricalRewardsRecord } from "./types";
|
|
36
|
+
import { ValidatorCurrentRewardsRecord as typeValidatorCurrentRewardsRecord } from "./types";
|
|
37
|
+
import { DelegatorStartingInfoRecord as typeDelegatorStartingInfoRecord } from "./types";
|
|
38
|
+
import { ValidatorSlashEventRecord as typeValidatorSlashEventRecord } from "./types";
|
|
34
39
|
|
|
35
|
-
export {
|
|
40
|
+
export {
|
|
41
|
+
MsgWithdrawDelegatorReward,
|
|
42
|
+
MsgWithdrawValidatorCommission,
|
|
43
|
+
MsgFundCommunityPool,
|
|
44
|
+
MsgSetWithdrawAddress,
|
|
45
|
+
};
|
|
36
46
|
|
|
37
47
|
type sendMsgWithdrawDelegatorRewardParams = {
|
|
38
|
-
value: MsgWithdrawDelegatorReward
|
|
39
|
-
fee?: StdFee
|
|
40
|
-
memo?: string
|
|
48
|
+
value: MsgWithdrawDelegatorReward;
|
|
49
|
+
fee?: StdFee;
|
|
50
|
+
memo?: string;
|
|
41
51
|
};
|
|
42
52
|
|
|
43
53
|
type sendMsgWithdrawValidatorCommissionParams = {
|
|
44
|
-
value: MsgWithdrawValidatorCommission
|
|
45
|
-
fee?: StdFee
|
|
46
|
-
memo?: string
|
|
54
|
+
value: MsgWithdrawValidatorCommission;
|
|
55
|
+
fee?: StdFee;
|
|
56
|
+
memo?: string;
|
|
47
57
|
};
|
|
48
58
|
|
|
49
59
|
type sendMsgFundCommunityPoolParams = {
|
|
50
|
-
value: MsgFundCommunityPool
|
|
51
|
-
fee?: StdFee
|
|
52
|
-
memo?: string
|
|
60
|
+
value: MsgFundCommunityPool;
|
|
61
|
+
fee?: StdFee;
|
|
62
|
+
memo?: string;
|
|
53
63
|
};
|
|
54
64
|
|
|
55
65
|
type sendMsgSetWithdrawAddressParams = {
|
|
56
|
-
value: MsgSetWithdrawAddress
|
|
57
|
-
fee?: StdFee
|
|
58
|
-
memo?: string
|
|
66
|
+
value: MsgSetWithdrawAddress;
|
|
67
|
+
fee?: StdFee;
|
|
68
|
+
memo?: string;
|
|
59
69
|
};
|
|
60
70
|
|
|
61
|
-
|
|
62
71
|
type msgWithdrawDelegatorRewardParams = {
|
|
63
|
-
value: MsgWithdrawDelegatorReward
|
|
72
|
+
value: MsgWithdrawDelegatorReward;
|
|
64
73
|
};
|
|
65
74
|
|
|
66
75
|
type msgWithdrawValidatorCommissionParams = {
|
|
67
|
-
value: MsgWithdrawValidatorCommission
|
|
76
|
+
value: MsgWithdrawValidatorCommission;
|
|
68
77
|
};
|
|
69
78
|
|
|
70
79
|
type msgFundCommunityPoolParams = {
|
|
71
|
-
value: MsgFundCommunityPool
|
|
80
|
+
value: MsgFundCommunityPool;
|
|
72
81
|
};
|
|
73
82
|
|
|
74
83
|
type msgSetWithdrawAddressParams = {
|
|
75
|
-
value: MsgSetWithdrawAddress
|
|
84
|
+
value: MsgSetWithdrawAddress;
|
|
76
85
|
};
|
|
77
86
|
|
|
78
|
-
|
|
79
87
|
export const registry = new Registry(msgTypes);
|
|
80
88
|
|
|
81
89
|
type Field = {
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
}
|
|
90
|
+
name: string;
|
|
91
|
+
type: unknown;
|
|
92
|
+
};
|
|
85
93
|
function getStructure(template) {
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
94
|
+
const structure: { fields: Field[] } = { fields: [] };
|
|
95
|
+
for (let [key, value] of Object.entries(template)) {
|
|
96
|
+
let field = { name: key, type: typeof value };
|
|
97
|
+
structure.fields.push(field);
|
|
98
|
+
}
|
|
99
|
+
return structure;
|
|
92
100
|
}
|
|
93
101
|
const defaultFee = {
|
|
94
102
|
amount: [],
|
|
@@ -96,171 +104,317 @@ const defaultFee = {
|
|
|
96
104
|
};
|
|
97
105
|
|
|
98
106
|
interface TxClientOptions {
|
|
99
|
-
addr: string
|
|
100
|
-
|
|
101
|
-
|
|
107
|
+
addr: string;
|
|
108
|
+
prefix: string;
|
|
109
|
+
signer?: OfflineSigner;
|
|
102
110
|
}
|
|
103
111
|
|
|
104
|
-
export const txClient = (
|
|
105
|
-
|
|
112
|
+
export const txClient = (
|
|
113
|
+
{ signer, prefix, addr }: TxClientOptions = {
|
|
114
|
+
addr: "http://localhost:26657",
|
|
115
|
+
prefix: "cosmos",
|
|
116
|
+
},
|
|
117
|
+
) => {
|
|
106
118
|
return {
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
119
|
+
async sendMsgWithdrawDelegatorReward({
|
|
120
|
+
value,
|
|
121
|
+
fee,
|
|
122
|
+
memo,
|
|
123
|
+
}: sendMsgWithdrawDelegatorRewardParams): Promise<DeliverTxResponse> {
|
|
124
|
+
if (!signer) {
|
|
125
|
+
throw new Error(
|
|
126
|
+
"TxClient:sendMsgWithdrawDelegatorReward: Unable to sign Tx. Signer is not present.",
|
|
127
|
+
);
|
|
128
|
+
}
|
|
129
|
+
try {
|
|
130
|
+
const { address } = (await signer.getAccounts())[0];
|
|
131
|
+
const signingClient = await SigningStargateClient.connectWithSigner(
|
|
132
|
+
addr,
|
|
133
|
+
signer,
|
|
134
|
+
{ registry, prefix },
|
|
135
|
+
);
|
|
136
|
+
let msg = this.msgWithdrawDelegatorReward({
|
|
137
|
+
value: MsgWithdrawDelegatorReward.fromPartial(value),
|
|
138
|
+
});
|
|
139
|
+
return await signingClient.signAndBroadcast(
|
|
140
|
+
address,
|
|
141
|
+
[msg],
|
|
142
|
+
fee ? fee : defaultFee,
|
|
143
|
+
memo,
|
|
144
|
+
);
|
|
145
|
+
} catch (e: any) {
|
|
146
|
+
throw new Error(
|
|
147
|
+
"TxClient:sendMsgWithdrawDelegatorReward: Could not broadcast Tx: " +
|
|
148
|
+
e.message,
|
|
149
|
+
);
|
|
150
|
+
}
|
|
151
|
+
},
|
|
152
|
+
|
|
153
|
+
async sendMsgWithdrawValidatorCommission({
|
|
154
|
+
value,
|
|
155
|
+
fee,
|
|
156
|
+
memo,
|
|
157
|
+
}: sendMsgWithdrawValidatorCommissionParams): Promise<DeliverTxResponse> {
|
|
158
|
+
if (!signer) {
|
|
159
|
+
throw new Error(
|
|
160
|
+
"TxClient:sendMsgWithdrawValidatorCommission: Unable to sign Tx. Signer is not present.",
|
|
161
|
+
);
|
|
162
|
+
}
|
|
163
|
+
try {
|
|
164
|
+
const { address } = (await signer.getAccounts())[0];
|
|
165
|
+
const signingClient = await SigningStargateClient.connectWithSigner(
|
|
166
|
+
addr,
|
|
167
|
+
signer,
|
|
168
|
+
{ registry, prefix },
|
|
169
|
+
);
|
|
170
|
+
let msg = this.msgWithdrawValidatorCommission({
|
|
171
|
+
value: MsgWithdrawValidatorCommission.fromPartial(value),
|
|
172
|
+
});
|
|
173
|
+
return await signingClient.signAndBroadcast(
|
|
174
|
+
address,
|
|
175
|
+
[msg],
|
|
176
|
+
fee ? fee : defaultFee,
|
|
177
|
+
memo,
|
|
178
|
+
);
|
|
179
|
+
} catch (e: any) {
|
|
180
|
+
throw new Error(
|
|
181
|
+
"TxClient:sendMsgWithdrawValidatorCommission: Could not broadcast Tx: " +
|
|
182
|
+
e.message,
|
|
183
|
+
);
|
|
184
|
+
}
|
|
185
|
+
},
|
|
186
|
+
|
|
187
|
+
async sendMsgFundCommunityPool({
|
|
188
|
+
value,
|
|
189
|
+
fee,
|
|
190
|
+
memo,
|
|
191
|
+
}: sendMsgFundCommunityPoolParams): Promise<DeliverTxResponse> {
|
|
192
|
+
if (!signer) {
|
|
193
|
+
throw new Error(
|
|
194
|
+
"TxClient:sendMsgFundCommunityPool: Unable to sign Tx. Signer is not present.",
|
|
195
|
+
);
|
|
196
|
+
}
|
|
197
|
+
try {
|
|
198
|
+
const { address } = (await signer.getAccounts())[0];
|
|
199
|
+
const signingClient = await SigningStargateClient.connectWithSigner(
|
|
200
|
+
addr,
|
|
201
|
+
signer,
|
|
202
|
+
{ registry, prefix },
|
|
203
|
+
);
|
|
204
|
+
let msg = this.msgFundCommunityPool({
|
|
205
|
+
value: MsgFundCommunityPool.fromPartial(value),
|
|
206
|
+
});
|
|
207
|
+
return await signingClient.signAndBroadcast(
|
|
208
|
+
address,
|
|
209
|
+
[msg],
|
|
210
|
+
fee ? fee : defaultFee,
|
|
211
|
+
memo,
|
|
212
|
+
);
|
|
213
|
+
} catch (e: any) {
|
|
214
|
+
throw new Error(
|
|
215
|
+
"TxClient:sendMsgFundCommunityPool: Could not broadcast Tx: " +
|
|
216
|
+
e.message,
|
|
217
|
+
);
|
|
218
|
+
}
|
|
219
|
+
},
|
|
220
|
+
|
|
221
|
+
async sendMsgSetWithdrawAddress({
|
|
222
|
+
value,
|
|
223
|
+
fee,
|
|
224
|
+
memo,
|
|
225
|
+
}: sendMsgSetWithdrawAddressParams): Promise<DeliverTxResponse> {
|
|
226
|
+
if (!signer) {
|
|
227
|
+
throw new Error(
|
|
228
|
+
"TxClient:sendMsgSetWithdrawAddress: Unable to sign Tx. Signer is not present.",
|
|
229
|
+
);
|
|
230
|
+
}
|
|
231
|
+
try {
|
|
232
|
+
const { address } = (await signer.getAccounts())[0];
|
|
233
|
+
const signingClient = await SigningStargateClient.connectWithSigner(
|
|
234
|
+
addr,
|
|
235
|
+
signer,
|
|
236
|
+
{ registry, prefix },
|
|
237
|
+
);
|
|
238
|
+
let msg = this.msgSetWithdrawAddress({
|
|
239
|
+
value: MsgSetWithdrawAddress.fromPartial(value),
|
|
240
|
+
});
|
|
241
|
+
return await signingClient.signAndBroadcast(
|
|
242
|
+
address,
|
|
243
|
+
[msg],
|
|
244
|
+
fee ? fee : defaultFee,
|
|
245
|
+
memo,
|
|
246
|
+
);
|
|
247
|
+
} catch (e: any) {
|
|
248
|
+
throw new Error(
|
|
249
|
+
"TxClient:sendMsgSetWithdrawAddress: Could not broadcast Tx: " +
|
|
250
|
+
e.message,
|
|
251
|
+
);
|
|
252
|
+
}
|
|
253
|
+
},
|
|
254
|
+
|
|
255
|
+
msgWithdrawDelegatorReward({
|
|
256
|
+
value,
|
|
257
|
+
}: msgWithdrawDelegatorRewardParams): EncodeObject {
|
|
258
|
+
try {
|
|
259
|
+
return {
|
|
260
|
+
typeUrl: "/cosmos.distribution.v1beta1.MsgWithdrawDelegatorReward",
|
|
261
|
+
value: MsgWithdrawDelegatorReward.fromPartial(value),
|
|
262
|
+
};
|
|
263
|
+
} catch (e: any) {
|
|
264
|
+
throw new Error(
|
|
265
|
+
"TxClient:MsgWithdrawDelegatorReward: Could not create message: " +
|
|
266
|
+
e.message,
|
|
267
|
+
);
|
|
268
|
+
}
|
|
269
|
+
},
|
|
270
|
+
|
|
271
|
+
msgWithdrawValidatorCommission({
|
|
272
|
+
value,
|
|
273
|
+
}: msgWithdrawValidatorCommissionParams): EncodeObject {
|
|
274
|
+
try {
|
|
275
|
+
return {
|
|
276
|
+
typeUrl:
|
|
277
|
+
"/cosmos.distribution.v1beta1.MsgWithdrawValidatorCommission",
|
|
278
|
+
value: MsgWithdrawValidatorCommission.fromPartial(value),
|
|
279
|
+
};
|
|
280
|
+
} catch (e: any) {
|
|
281
|
+
throw new Error(
|
|
282
|
+
"TxClient:MsgWithdrawValidatorCommission: Could not create message: " +
|
|
283
|
+
e.message,
|
|
284
|
+
);
|
|
285
|
+
}
|
|
286
|
+
},
|
|
287
|
+
|
|
288
|
+
msgFundCommunityPool({ value }: msgFundCommunityPoolParams): EncodeObject {
|
|
289
|
+
try {
|
|
290
|
+
return {
|
|
291
|
+
typeUrl: "/cosmos.distribution.v1beta1.MsgFundCommunityPool",
|
|
292
|
+
value: MsgFundCommunityPool.fromPartial(value),
|
|
293
|
+
};
|
|
294
|
+
} catch (e: any) {
|
|
295
|
+
throw new Error(
|
|
296
|
+
"TxClient:MsgFundCommunityPool: Could not create message: " +
|
|
297
|
+
e.message,
|
|
298
|
+
);
|
|
299
|
+
}
|
|
300
|
+
},
|
|
301
|
+
|
|
302
|
+
msgSetWithdrawAddress({
|
|
303
|
+
value,
|
|
304
|
+
}: msgSetWithdrawAddressParams): EncodeObject {
|
|
305
|
+
try {
|
|
306
|
+
return {
|
|
307
|
+
typeUrl: "/cosmos.distribution.v1beta1.MsgSetWithdrawAddress",
|
|
308
|
+
value: MsgSetWithdrawAddress.fromPartial(value),
|
|
309
|
+
};
|
|
310
|
+
} catch (e: any) {
|
|
311
|
+
throw new Error(
|
|
312
|
+
"TxClient:MsgSetWithdrawAddress: Could not create message: " +
|
|
313
|
+
e.message,
|
|
314
|
+
);
|
|
315
|
+
}
|
|
316
|
+
},
|
|
317
|
+
};
|
|
198
318
|
};
|
|
199
319
|
|
|
200
320
|
interface QueryClientOptions {
|
|
201
|
-
addr: string
|
|
321
|
+
addr: string;
|
|
202
322
|
}
|
|
203
323
|
|
|
204
|
-
export const queryClient = (
|
|
324
|
+
export const queryClient = (
|
|
325
|
+
{ addr: addr }: QueryClientOptions = { addr: "http://localhost:1317" },
|
|
326
|
+
) => {
|
|
205
327
|
return new Api({ baseURL: addr });
|
|
206
328
|
};
|
|
207
329
|
|
|
208
330
|
class SDKModule {
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
331
|
+
public query: ReturnType<typeof queryClient>;
|
|
332
|
+
public tx: ReturnType<typeof txClient>;
|
|
333
|
+
public structure: Record<string, unknown>;
|
|
334
|
+
public registry: Array<[string, GeneratedType]> = [];
|
|
213
335
|
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
336
|
+
constructor(client: IgniteClient) {
|
|
337
|
+
this.query = queryClient({ addr: client.env.apiURL });
|
|
338
|
+
this.updateTX(client);
|
|
339
|
+
this.structure = {
|
|
340
|
+
Params: getStructure(typeParams.fromPartial({})),
|
|
341
|
+
ValidatorHistoricalRewards: getStructure(
|
|
342
|
+
typeValidatorHistoricalRewards.fromPartial({}),
|
|
343
|
+
),
|
|
344
|
+
ValidatorCurrentRewards: getStructure(
|
|
345
|
+
typeValidatorCurrentRewards.fromPartial({}),
|
|
346
|
+
),
|
|
347
|
+
ValidatorAccumulatedCommission: getStructure(
|
|
348
|
+
typeValidatorAccumulatedCommission.fromPartial({}),
|
|
349
|
+
),
|
|
350
|
+
ValidatorOutstandingRewards: getStructure(
|
|
351
|
+
typeValidatorOutstandingRewards.fromPartial({}),
|
|
352
|
+
),
|
|
353
|
+
ValidatorSlashEvent: getStructure(
|
|
354
|
+
typeValidatorSlashEvent.fromPartial({}),
|
|
355
|
+
),
|
|
356
|
+
ValidatorSlashEvents: getStructure(
|
|
357
|
+
typeValidatorSlashEvents.fromPartial({}),
|
|
358
|
+
),
|
|
359
|
+
FeePool: getStructure(typeFeePool.fromPartial({})),
|
|
360
|
+
CommunityPoolSpendProposal: getStructure(
|
|
361
|
+
typeCommunityPoolSpendProposal.fromPartial({}),
|
|
362
|
+
),
|
|
363
|
+
DelegatorStartingInfo: getStructure(
|
|
364
|
+
typeDelegatorStartingInfo.fromPartial({}),
|
|
365
|
+
),
|
|
366
|
+
DelegationDelegatorReward: getStructure(
|
|
367
|
+
typeDelegationDelegatorReward.fromPartial({}),
|
|
368
|
+
),
|
|
369
|
+
CommunityPoolSpendProposalWithDeposit: getStructure(
|
|
370
|
+
typeCommunityPoolSpendProposalWithDeposit.fromPartial({}),
|
|
371
|
+
),
|
|
372
|
+
DelegatorWithdrawInfo: getStructure(
|
|
373
|
+
typeDelegatorWithdrawInfo.fromPartial({}),
|
|
374
|
+
),
|
|
375
|
+
ValidatorOutstandingRewardsRecord: getStructure(
|
|
376
|
+
typeValidatorOutstandingRewardsRecord.fromPartial({}),
|
|
377
|
+
),
|
|
378
|
+
ValidatorAccumulatedCommissionRecord: getStructure(
|
|
379
|
+
typeValidatorAccumulatedCommissionRecord.fromPartial({}),
|
|
380
|
+
),
|
|
381
|
+
ValidatorHistoricalRewardsRecord: getStructure(
|
|
382
|
+
typeValidatorHistoricalRewardsRecord.fromPartial({}),
|
|
383
|
+
),
|
|
384
|
+
ValidatorCurrentRewardsRecord: getStructure(
|
|
385
|
+
typeValidatorCurrentRewardsRecord.fromPartial({}),
|
|
386
|
+
),
|
|
387
|
+
DelegatorStartingInfoRecord: getStructure(
|
|
388
|
+
typeDelegatorStartingInfoRecord.fromPartial({}),
|
|
389
|
+
),
|
|
390
|
+
ValidatorSlashEventRecord: getStructure(
|
|
391
|
+
typeValidatorSlashEventRecord.fromPartial({}),
|
|
392
|
+
),
|
|
393
|
+
};
|
|
394
|
+
client.on("signer-changed", (signer) => {
|
|
395
|
+
this.updateTX(client);
|
|
396
|
+
});
|
|
397
|
+
}
|
|
398
|
+
updateTX(client: IgniteClient) {
|
|
245
399
|
const methods = txClient({
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
})
|
|
250
|
-
|
|
400
|
+
signer: client.signer,
|
|
401
|
+
addr: client.env.rpcURL,
|
|
402
|
+
prefix: client.env.prefix ?? "cosmos",
|
|
403
|
+
});
|
|
404
|
+
|
|
251
405
|
this.tx = methods;
|
|
252
406
|
for (let m in methods) {
|
|
253
|
-
|
|
407
|
+
this.tx[m] = methods[m].bind(this.tx);
|
|
254
408
|
}
|
|
255
|
-
}
|
|
256
|
-
};
|
|
257
|
-
|
|
258
|
-
const Module = (test: IgniteClient) => {
|
|
259
|
-
return {
|
|
260
|
-
module: {
|
|
261
|
-
CosmosDistributionV1Beta1: new SDKModule(test)
|
|
262
|
-
},
|
|
263
|
-
registry: msgTypes
|
|
264
409
|
}
|
|
265
410
|
}
|
|
266
|
-
|
|
411
|
+
|
|
412
|
+
const Module = (test: IgniteClient) => {
|
|
413
|
+
return {
|
|
414
|
+
module: {
|
|
415
|
+
CosmosDistributionV1Beta1: new SDKModule(test),
|
|
416
|
+
},
|
|
417
|
+
registry: msgTypes,
|
|
418
|
+
};
|
|
419
|
+
};
|
|
420
|
+
export default Module;
|