@firmachain/firma-js 0.3.0-beta1 → 0.3.1
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/README.md +0 -3
- package/dist/sdk/FirmaGovService.d.ts +20 -12
- package/dist/sdk/FirmaGovService.js +185 -140
- package/dist/sdk/firmachain/gov/GovQueryClient.d.ts +13 -1
- package/dist/sdk/firmachain/gov/GovQueryClient.js +9 -2
- package/dist/sdk/firmachain/gov/GovTxClient.d.ts +6 -0
- package/dist/sdk/firmachain/gov/GovTxClient.js +7 -2
- package/dist/sdk/firmachain/staking/StakingQueryClient.d.ts +1 -0
- package/dist/test/08.gas_estimate.test.js +86 -28
- package/dist/test/16.gov_tx.test.js +127 -58
- package/dist/test/config_test.js +2 -4
- package/dist/test/config_test.sample.d.ts +6 -0
- package/dist/test/config_test.sample.js +7 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -9,9 +9,6 @@ The Javascript & TypeScript SDK for FirmaChain
|
|
|
9
9
|
|
|
10
10
|
Firma-js is a SDK for writing applications based on javascript & typescript. You can use it client web app or Node.js. This SDK is created inspired by cosmjs and several sdk. All functions of the FirmaChain can be accessed at the service level.
|
|
11
11
|
|
|
12
|
-
⚠️ We wanted to let you know that the governance module is not accessible at the moment. It requires a patch to become fully operational, which we're actively preparing. We plan to release this patch soon as part of version 0.3.1, at which point the governance module will be enabled.
|
|
13
|
-
A patch is planned soon to enable the governance module in version 0.3.1.
|
|
14
|
-
|
|
15
12
|
## Features
|
|
16
13
|
Most cosmos sdk features are supported
|
|
17
14
|
- Wallet / Bank
|
|
@@ -1,30 +1,38 @@
|
|
|
1
|
-
import { TxMisc,
|
|
1
|
+
import { TxMisc, VotingOption, ProposalInfo, ProposalStatus, ProposalParam, CurrentVoteInfo } from "./firmachain/gov";
|
|
2
2
|
import { FirmaWalletService } from "./FirmaWalletService";
|
|
3
3
|
import { FirmaConfig } from "./FirmaConfig";
|
|
4
4
|
import { DeliverTxResponse } from "./firmachain/common/stargateclient";
|
|
5
|
+
import { Plan } from "cosmjs-types/cosmos/upgrade/v1beta1/upgrade";
|
|
6
|
+
import { Coin } from "cosmjs-types/cosmos/base/v1beta1/coin";
|
|
7
|
+
import { Params as StakingParams } from "cosmjs-types/cosmos/staking/v1beta1/staking";
|
|
8
|
+
import { Params as GovParams } from "cosmjs-types/cosmos/gov/v1/gov";
|
|
5
9
|
export declare class FirmaGovService {
|
|
6
10
|
private readonly config;
|
|
11
|
+
static readonly GOV_AUTHORITY = "firma10d07y265gmmuvt4z0w9aw880jnsr700j53mj8f";
|
|
7
12
|
constructor(config: FirmaConfig);
|
|
8
13
|
getGasEstimationVote(wallet: FirmaWalletService, proposalId: number, option: VotingOption, txMisc?: TxMisc): Promise<number>;
|
|
9
14
|
getGasEstimationDeposit(wallet: FirmaWalletService, proposalId: number, amount: number, txMisc?: TxMisc): Promise<number>;
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
getGasEstimationSubmitCommunityPoolSpendProposal(wallet: FirmaWalletService, title: string,
|
|
15
|
+
getGasEstimationSubmitSoftwareUpgradeProposal(wallet: FirmaWalletService, title: string, summary: string, initialDepositFCT: number, plan: Plan, metadata?: string, txMisc?: TxMisc): Promise<number>;
|
|
16
|
+
getGasEstimationSubmitStakingParamsUpdateProposal(wallet: FirmaWalletService, title: string, summary: string, initialDepositFCT: number, params: StakingParams, metadata?: string, txMisc?: TxMisc): Promise<number>;
|
|
17
|
+
getGasEstimationSubmitGovParamsUpdateProposal(wallet: FirmaWalletService, title: string, summary: string, initialDepositFCT: number, params: GovParams, metadata?: string, txMisc?: TxMisc): Promise<number>;
|
|
18
|
+
getGasEstimationSubmitCommunityPoolSpendProposal(wallet: FirmaWalletService, title: string, summary: string, initialDepositFCT: number, amountFCT: number, recipient: string, txMisc?: TxMisc): Promise<number>;
|
|
14
19
|
getGasEstimationSubmitTextProposal(wallet: FirmaWalletService, title: string, description: string, initialDepositFCT: number, txMisc?: TxMisc): Promise<number>;
|
|
15
20
|
getGasEstimationCancelProposal(wallet: FirmaWalletService, proposalId: number, txMisc?: TxMisc): Promise<number>;
|
|
16
21
|
private getSignedTxSubmitTextProposal;
|
|
17
|
-
private getSignedTxSubmitCancelSoftwareUpgradeProposal;
|
|
18
22
|
private getSignedTxSubmitSoftwareUpgradeProposal;
|
|
19
|
-
private
|
|
23
|
+
private getSignedTxSubmitStakingParamsUpdateProposal;
|
|
24
|
+
private getSignedTxSubmitGovParamsUpdateProposal;
|
|
20
25
|
private getSignedTxSubmitCommunityPoolSpendProposal;
|
|
21
26
|
private getSignedTxCancelProposal;
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
submitCommunityPoolSpendProposal(wallet: FirmaWalletService, title: string, description: string, initialDeposit: number, amount: number, recipient: string, txMisc?: TxMisc): Promise<DeliverTxResponse>;
|
|
27
|
+
submitSoftwareUpgradeProposal(wallet: FirmaWalletService, title: string, summary: string, initialDepositFCT: number, plan: Plan, metadata?: string, txMisc?: TxMisc): Promise<DeliverTxResponse>;
|
|
28
|
+
submitStakingParamsUpdateProposal(wallet: FirmaWalletService, title: string, summary: string, initialDepositFCT: number, params: StakingParams, metadata?: string, txMisc?: TxMisc): Promise<DeliverTxResponse>;
|
|
29
|
+
submitGovParamsUpdateProposal(wallet: FirmaWalletService, title: string, summary: string, initialDepositFCT: number, params: GovParams, metadata?: string, txmisc?: TxMisc): Promise<DeliverTxResponse>;
|
|
30
|
+
submitCommunityPoolSpendProposal(wallet: FirmaWalletService, title: string, summary: string, initialDepositFCT: number, amountFCT: number, recipient: string, metadata?: string, txMisc?: TxMisc): Promise<DeliverTxResponse>;
|
|
27
31
|
submitTextProposal(wallet: FirmaWalletService, title: string, description: string, initialDeposit: number, txMisc?: TxMisc): Promise<DeliverTxResponse>;
|
|
32
|
+
submitGenericProposal(wallet: FirmaWalletService, title: string, summary: string, initialDeposit: Coin[], metadata: string, msgs: {
|
|
33
|
+
typeUrl?: string | undefined;
|
|
34
|
+
value?: Uint8Array | undefined;
|
|
35
|
+
}[] | undefined, txMisc?: TxMisc): Promise<DeliverTxResponse>;
|
|
28
36
|
cancelProposal(wallet: FirmaWalletService, proposalId: number, txMisc?: TxMisc): Promise<DeliverTxResponse>;
|
|
29
37
|
private getSignedTxVote;
|
|
30
38
|
vote(wallet: FirmaWalletService, proposalId: number, option: VotingOption, txMisc?: TxMisc): Promise<DeliverTxResponse>;
|
|
@@ -41,10 +41,11 @@ var gov_1 = require("./firmachain/gov");
|
|
|
41
41
|
var FirmaUtil_1 = require("./FirmaUtil");
|
|
42
42
|
var any_1 = require("./firmachain/google/protobuf/any");
|
|
43
43
|
var gov_2 = require("cosmjs-types/cosmos/gov/v1beta1/gov");
|
|
44
|
-
var distribution_1 = require("cosmjs-types/cosmos/distribution/v1beta1/distribution");
|
|
45
|
-
var params_1 = require("cosmjs-types/cosmos/params/v1beta1/params");
|
|
46
|
-
var upgrade_1 = require("cosmjs-types/cosmos/upgrade/v1beta1/upgrade");
|
|
47
44
|
var tx_1 = require("@kintsugi-tech/cosmjs-types/cosmos/gov/v1/tx");
|
|
45
|
+
var tx_2 = require("@kintsugi-tech/cosmjs-types/cosmos/upgrade/v1beta1/tx");
|
|
46
|
+
var tx_3 = require("@kintsugi-tech/cosmjs-types/cosmos/distribution/v1beta1/tx");
|
|
47
|
+
var tx_4 = require("cosmjs-types/cosmos/staking/v1beta1/tx");
|
|
48
|
+
var tx_5 = require("cosmjs-types/cosmos/gov/v1/tx");
|
|
48
49
|
var FirmaGovService = /** @class */ (function () {
|
|
49
50
|
function FirmaGovService(config) {
|
|
50
51
|
this.config = config;
|
|
@@ -95,15 +96,23 @@ var FirmaGovService = /** @class */ (function () {
|
|
|
95
96
|
});
|
|
96
97
|
});
|
|
97
98
|
};
|
|
98
|
-
FirmaGovService.prototype.
|
|
99
|
+
FirmaGovService.prototype.getGasEstimationSubmitSoftwareUpgradeProposal = function (wallet, title, summary, initialDepositFCT, plan, metadata, txMisc) {
|
|
100
|
+
if (metadata === void 0) { metadata = ""; }
|
|
99
101
|
if (txMisc === void 0) { txMisc = FirmaUtil_1.DefaultTxMisc; }
|
|
100
102
|
return __awaiter(this, void 0, void 0, function () {
|
|
101
|
-
var txRaw, error_3;
|
|
103
|
+
var message, txRaw, error_3;
|
|
102
104
|
return __generator(this, function (_a) {
|
|
103
105
|
switch (_a.label) {
|
|
104
106
|
case 0:
|
|
105
107
|
_a.trys.push([0, 3, , 4]);
|
|
106
|
-
|
|
108
|
+
message = {
|
|
109
|
+
typeUrl: "/cosmos.upgrade.v1beta1.MsgSoftwareUpgrade",
|
|
110
|
+
value: tx_2.MsgSoftwareUpgrade.encode(tx_2.MsgSoftwareUpgrade.fromPartial({
|
|
111
|
+
authority: FirmaGovService.GOV_AUTHORITY,
|
|
112
|
+
plan: plan
|
|
113
|
+
})).finish()
|
|
114
|
+
};
|
|
115
|
+
return [4 /*yield*/, this.getSignedTxSubmitSoftwareUpgradeProposal(wallet, title, summary, initialDepositFCT, [message], metadata, txMisc)];
|
|
107
116
|
case 1:
|
|
108
117
|
txRaw = _a.sent();
|
|
109
118
|
return [4 /*yield*/, FirmaUtil_1.FirmaUtil.estimateGas(txRaw)];
|
|
@@ -117,23 +126,23 @@ var FirmaGovService = /** @class */ (function () {
|
|
|
117
126
|
});
|
|
118
127
|
});
|
|
119
128
|
};
|
|
120
|
-
FirmaGovService.prototype.
|
|
129
|
+
FirmaGovService.prototype.getGasEstimationSubmitStakingParamsUpdateProposal = function (wallet, title, summary, initialDepositFCT, params, metadata, txMisc) {
|
|
130
|
+
if (metadata === void 0) { metadata = ""; }
|
|
121
131
|
if (txMisc === void 0) { txMisc = FirmaUtil_1.DefaultTxMisc; }
|
|
122
132
|
return __awaiter(this, void 0, void 0, function () {
|
|
123
|
-
var
|
|
133
|
+
var message, txRaw, error_4;
|
|
124
134
|
return __generator(this, function (_a) {
|
|
125
135
|
switch (_a.label) {
|
|
126
136
|
case 0:
|
|
127
137
|
_a.trys.push([0, 3, , 4]);
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
upgradedClientState: undefined
|
|
138
|
+
message = {
|
|
139
|
+
typeUrl: "/cosmos.staking.v1beta1.MsgUpdateParams",
|
|
140
|
+
value: tx_4.MsgUpdateParams.encode(tx_4.MsgUpdateParams.fromPartial({
|
|
141
|
+
authority: FirmaGovService.GOV_AUTHORITY,
|
|
142
|
+
params: params
|
|
143
|
+
})).finish()
|
|
135
144
|
};
|
|
136
|
-
return [4 /*yield*/, this.
|
|
145
|
+
return [4 /*yield*/, this.getSignedTxSubmitStakingParamsUpdateProposal(wallet, title, summary, initialDepositFCT, [message], metadata, txMisc)];
|
|
137
146
|
case 1:
|
|
138
147
|
txRaw = _a.sent();
|
|
139
148
|
return [4 /*yield*/, FirmaUtil_1.FirmaUtil.estimateGas(txRaw)];
|
|
@@ -147,15 +156,23 @@ var FirmaGovService = /** @class */ (function () {
|
|
|
147
156
|
});
|
|
148
157
|
});
|
|
149
158
|
};
|
|
150
|
-
FirmaGovService.prototype.
|
|
159
|
+
FirmaGovService.prototype.getGasEstimationSubmitGovParamsUpdateProposal = function (wallet, title, summary, initialDepositFCT, params, metadata, txMisc) {
|
|
160
|
+
if (metadata === void 0) { metadata = ""; }
|
|
151
161
|
if (txMisc === void 0) { txMisc = FirmaUtil_1.DefaultTxMisc; }
|
|
152
162
|
return __awaiter(this, void 0, void 0, function () {
|
|
153
|
-
var txRaw, error_5;
|
|
163
|
+
var message, txRaw, error_5;
|
|
154
164
|
return __generator(this, function (_a) {
|
|
155
165
|
switch (_a.label) {
|
|
156
166
|
case 0:
|
|
157
167
|
_a.trys.push([0, 3, , 4]);
|
|
158
|
-
|
|
168
|
+
message = {
|
|
169
|
+
typeUrl: "/cosmos.gov.v1.MsgUpdateParams",
|
|
170
|
+
value: tx_5.MsgUpdateParams.encode(tx_5.MsgUpdateParams.fromPartial({
|
|
171
|
+
authority: FirmaGovService.GOV_AUTHORITY,
|
|
172
|
+
params: params
|
|
173
|
+
})).finish()
|
|
174
|
+
};
|
|
175
|
+
return [4 /*yield*/, this.getSignedTxSubmitStakingParamsUpdateProposal(wallet, title, summary, initialDepositFCT, [message], metadata, txMisc)];
|
|
159
176
|
case 1:
|
|
160
177
|
txRaw = _a.sent();
|
|
161
178
|
return [4 /*yield*/, FirmaUtil_1.FirmaUtil.estimateGas(txRaw)];
|
|
@@ -169,15 +186,27 @@ var FirmaGovService = /** @class */ (function () {
|
|
|
169
186
|
});
|
|
170
187
|
});
|
|
171
188
|
};
|
|
172
|
-
FirmaGovService.prototype.getGasEstimationSubmitCommunityPoolSpendProposal = function (wallet, title,
|
|
189
|
+
FirmaGovService.prototype.getGasEstimationSubmitCommunityPoolSpendProposal = function (wallet, title, summary, initialDepositFCT, amountFCT, recipient, txMisc) {
|
|
173
190
|
if (txMisc === void 0) { txMisc = FirmaUtil_1.DefaultTxMisc; }
|
|
174
191
|
return __awaiter(this, void 0, void 0, function () {
|
|
175
|
-
var txRaw, error_6;
|
|
192
|
+
var amount, message, txRaw, error_6;
|
|
176
193
|
return __generator(this, function (_a) {
|
|
177
194
|
switch (_a.label) {
|
|
178
195
|
case 0:
|
|
179
196
|
_a.trys.push([0, 3, , 4]);
|
|
180
|
-
|
|
197
|
+
amount = FirmaUtil_1.FirmaUtil.getUFCTStringFromFCT(amountFCT);
|
|
198
|
+
message = {
|
|
199
|
+
typeUrl: "/cosmos.distribution.v1beta1.MsgCommunityPoolSpend",
|
|
200
|
+
value: Uint8Array.from(tx_3.MsgCommunityPoolSpend.encode(tx_3.MsgCommunityPoolSpend.fromPartial({
|
|
201
|
+
authority: FirmaGovService.GOV_AUTHORITY,
|
|
202
|
+
recipient: recipient,
|
|
203
|
+
amount: [{
|
|
204
|
+
denom: this.config.denom,
|
|
205
|
+
amount: amount.toString()
|
|
206
|
+
}]
|
|
207
|
+
})).finish())
|
|
208
|
+
};
|
|
209
|
+
return [4 /*yield*/, this.getSignedTxSubmitCommunityPoolSpendProposal(wallet, title, summary, initialDepositFCT, [message], recipient, txMisc)];
|
|
181
210
|
case 1:
|
|
182
211
|
txRaw = _a.sent();
|
|
183
212
|
return [4 /*yield*/, FirmaUtil_1.FirmaUtil.estimateGas(txRaw)];
|
|
@@ -268,34 +297,30 @@ var FirmaGovService = /** @class */ (function () {
|
|
|
268
297
|
});
|
|
269
298
|
});
|
|
270
299
|
};
|
|
271
|
-
FirmaGovService.prototype.
|
|
300
|
+
FirmaGovService.prototype.getSignedTxSubmitSoftwareUpgradeProposal = function (wallet, title, summary, initialDepositFCT, messages, metadata, txMisc) {
|
|
301
|
+
if (metadata === void 0) { metadata = ""; }
|
|
272
302
|
if (txMisc === void 0) { txMisc = FirmaUtil_1.DefaultTxMisc; }
|
|
273
303
|
return __awaiter(this, void 0, void 0, function () {
|
|
274
|
-
var
|
|
304
|
+
var proposer, initialDeposit, message, txClient, error_10;
|
|
275
305
|
return __generator(this, function (_a) {
|
|
276
306
|
switch (_a.label) {
|
|
277
307
|
case 0:
|
|
278
308
|
_a.trys.push([0, 3, , 4]);
|
|
279
|
-
initialDepositAmount = {
|
|
280
|
-
denom: this.config.denom,
|
|
281
|
-
amount: FirmaUtil_1.FirmaUtil.getUFCTStringFromFCT(initialDepositFCT)
|
|
282
|
-
};
|
|
283
|
-
proposal = upgrade_1.CancelSoftwareUpgradeProposal.fromPartial({
|
|
284
|
-
title: title,
|
|
285
|
-
description: description,
|
|
286
|
-
});
|
|
287
|
-
content = any_1.Any.fromPartial({
|
|
288
|
-
typeUrl: "/cosmos.upgrade.v1beta1.CancelSoftwareUpgradeProposal",
|
|
289
|
-
value: Uint8Array.from(upgrade_1.CancelSoftwareUpgradeProposal.encode(proposal).finish()),
|
|
290
|
-
});
|
|
291
309
|
return [4 /*yield*/, wallet.getAddress()];
|
|
292
310
|
case 1:
|
|
293
311
|
proposer = _a.sent();
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
312
|
+
initialDeposit = [{ amount: FirmaUtil_1.FirmaUtil.getUFCTStringFromFCT(initialDepositFCT), denom: this.config.denom }];
|
|
313
|
+
message = {
|
|
314
|
+
typeUrl: "/cosmos.gov.v1.MsgSubmitProposal",
|
|
315
|
+
value: tx_1.MsgSubmitProposal.fromPartial({
|
|
316
|
+
title: title,
|
|
317
|
+
summary: summary,
|
|
318
|
+
metadata: metadata,
|
|
319
|
+
messages: messages,
|
|
320
|
+
proposer: proposer,
|
|
321
|
+
initialDeposit: initialDeposit
|
|
322
|
+
})
|
|
323
|
+
};
|
|
299
324
|
txClient = new gov_1.GovTxClient(wallet, this.config.rpcAddress);
|
|
300
325
|
return [4 /*yield*/, txClient.sign([message], FirmaUtil_1.getSignAndBroadcastOption(this.config.denom, txMisc))];
|
|
301
326
|
case 2: return [2 /*return*/, _a.sent()];
|
|
@@ -308,35 +333,30 @@ var FirmaGovService = /** @class */ (function () {
|
|
|
308
333
|
});
|
|
309
334
|
});
|
|
310
335
|
};
|
|
311
|
-
FirmaGovService.prototype.
|
|
336
|
+
FirmaGovService.prototype.getSignedTxSubmitStakingParamsUpdateProposal = function (wallet, title, summary, initialDepositFCT, messages, metadata, txMisc) {
|
|
337
|
+
if (metadata === void 0) { metadata = ""; }
|
|
312
338
|
if (txMisc === void 0) { txMisc = FirmaUtil_1.DefaultTxMisc; }
|
|
313
339
|
return __awaiter(this, void 0, void 0, function () {
|
|
314
|
-
var
|
|
340
|
+
var proposer, initialDeposit, message, txClient, error_11;
|
|
315
341
|
return __generator(this, function (_a) {
|
|
316
342
|
switch (_a.label) {
|
|
317
343
|
case 0:
|
|
318
344
|
_a.trys.push([0, 3, , 4]);
|
|
319
|
-
initialDepositAmount = {
|
|
320
|
-
denom: this.config.denom,
|
|
321
|
-
amount: FirmaUtil_1.FirmaUtil.getUFCTStringFromFCT(initialDepositFCT)
|
|
322
|
-
};
|
|
323
|
-
proposal = upgrade_1.SoftwareUpgradeProposal.fromPartial({
|
|
324
|
-
title: title,
|
|
325
|
-
description: description,
|
|
326
|
-
plan: plan,
|
|
327
|
-
});
|
|
328
|
-
content = any_1.Any.fromPartial({
|
|
329
|
-
typeUrl: "/cosmos.upgrade.v1beta1.SoftwareUpgradeProposal",
|
|
330
|
-
value: Uint8Array.from(upgrade_1.SoftwareUpgradeProposal.encode(proposal).finish()),
|
|
331
|
-
});
|
|
332
345
|
return [4 /*yield*/, wallet.getAddress()];
|
|
333
346
|
case 1:
|
|
334
347
|
proposer = _a.sent();
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
348
|
+
initialDeposit = [{ amount: FirmaUtil_1.FirmaUtil.getUFCTStringFromFCT(initialDepositFCT), denom: this.config.denom }];
|
|
349
|
+
message = {
|
|
350
|
+
typeUrl: "/cosmos.gov.v1.MsgSubmitProposal",
|
|
351
|
+
value: tx_1.MsgSubmitProposal.fromPartial({
|
|
352
|
+
title: title,
|
|
353
|
+
summary: summary,
|
|
354
|
+
metadata: metadata,
|
|
355
|
+
messages: messages,
|
|
356
|
+
proposer: proposer,
|
|
357
|
+
initialDeposit: initialDeposit
|
|
358
|
+
})
|
|
359
|
+
};
|
|
340
360
|
txClient = new gov_1.GovTxClient(wallet, this.config.rpcAddress);
|
|
341
361
|
return [4 /*yield*/, txClient.sign([message], FirmaUtil_1.getSignAndBroadcastOption(this.config.denom, txMisc))];
|
|
342
362
|
case 2: return [2 /*return*/, _a.sent()];
|
|
@@ -349,35 +369,30 @@ var FirmaGovService = /** @class */ (function () {
|
|
|
349
369
|
});
|
|
350
370
|
});
|
|
351
371
|
};
|
|
352
|
-
FirmaGovService.prototype.
|
|
372
|
+
FirmaGovService.prototype.getSignedTxSubmitGovParamsUpdateProposal = function (wallet, title, summary, initialDepositFCT, messages, metadata, txMisc) {
|
|
373
|
+
if (metadata === void 0) { metadata = ""; }
|
|
353
374
|
if (txMisc === void 0) { txMisc = FirmaUtil_1.DefaultTxMisc; }
|
|
354
375
|
return __awaiter(this, void 0, void 0, function () {
|
|
355
|
-
var
|
|
376
|
+
var proposer, initialDeposit, message, txClient, error_12;
|
|
356
377
|
return __generator(this, function (_a) {
|
|
357
378
|
switch (_a.label) {
|
|
358
379
|
case 0:
|
|
359
380
|
_a.trys.push([0, 3, , 4]);
|
|
360
|
-
initialDepositAmount = {
|
|
361
|
-
denom: this.config.denom,
|
|
362
|
-
amount: FirmaUtil_1.FirmaUtil.getUFCTStringFromFCT(initialDepositFCT)
|
|
363
|
-
};
|
|
364
|
-
proposal = params_1.ParameterChangeProposal.fromPartial({
|
|
365
|
-
title: title,
|
|
366
|
-
description: description,
|
|
367
|
-
changes: paramList,
|
|
368
|
-
});
|
|
369
|
-
content = any_1.Any.fromPartial({
|
|
370
|
-
typeUrl: "/cosmos.params.v1beta1.ParameterChangeProposal",
|
|
371
|
-
value: Uint8Array.from(params_1.ParameterChangeProposal.encode(proposal).finish()),
|
|
372
|
-
});
|
|
373
381
|
return [4 /*yield*/, wallet.getAddress()];
|
|
374
382
|
case 1:
|
|
375
383
|
proposer = _a.sent();
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
384
|
+
initialDeposit = [{ amount: FirmaUtil_1.FirmaUtil.getUFCTStringFromFCT(initialDepositFCT), denom: this.config.denom }];
|
|
385
|
+
message = {
|
|
386
|
+
typeUrl: "/cosmos.gov.v1.MsgSubmitProposal",
|
|
387
|
+
value: tx_1.MsgSubmitProposal.fromPartial({
|
|
388
|
+
title: title,
|
|
389
|
+
summary: summary,
|
|
390
|
+
metadata: metadata,
|
|
391
|
+
messages: messages,
|
|
392
|
+
proposer: proposer,
|
|
393
|
+
initialDeposit: initialDeposit
|
|
394
|
+
})
|
|
395
|
+
};
|
|
381
396
|
txClient = new gov_1.GovTxClient(wallet, this.config.rpcAddress);
|
|
382
397
|
return [4 /*yield*/, txClient.sign([message], FirmaUtil_1.getSignAndBroadcastOption(this.config.denom, txMisc))];
|
|
383
398
|
case 2: return [2 /*return*/, _a.sent()];
|
|
@@ -390,37 +405,30 @@ var FirmaGovService = /** @class */ (function () {
|
|
|
390
405
|
});
|
|
391
406
|
});
|
|
392
407
|
};
|
|
393
|
-
FirmaGovService.prototype.getSignedTxSubmitCommunityPoolSpendProposal = function (wallet, title,
|
|
408
|
+
FirmaGovService.prototype.getSignedTxSubmitCommunityPoolSpendProposal = function (wallet, title, summary, initialDepositFCT, messages, metadata, txMisc) {
|
|
409
|
+
if (metadata === void 0) { metadata = ""; }
|
|
394
410
|
if (txMisc === void 0) { txMisc = FirmaUtil_1.DefaultTxMisc; }
|
|
395
411
|
return __awaiter(this, void 0, void 0, function () {
|
|
396
|
-
var
|
|
412
|
+
var proposer, initialDeposit, message, txClient, error_13;
|
|
397
413
|
return __generator(this, function (_a) {
|
|
398
414
|
switch (_a.label) {
|
|
399
415
|
case 0:
|
|
400
416
|
_a.trys.push([0, 3, , 4]);
|
|
401
|
-
initialDepositAmount = {
|
|
402
|
-
denom: this.config.denom,
|
|
403
|
-
amount: FirmaUtil_1.FirmaUtil.getUFCTStringFromFCT(initialDepositFCT)
|
|
404
|
-
};
|
|
405
|
-
sendAmount = { denom: this.config.denom, amount: FirmaUtil_1.FirmaUtil.getUFCTStringFromFCT(amount) };
|
|
406
|
-
proposal = distribution_1.CommunityPoolSpendProposal.fromPartial({
|
|
407
|
-
title: title,
|
|
408
|
-
description: description,
|
|
409
|
-
recipient: recipient,
|
|
410
|
-
amount: [sendAmount]
|
|
411
|
-
});
|
|
412
|
-
content = any_1.Any.fromPartial({
|
|
413
|
-
typeUrl: "/cosmos.distribution.v1beta1.CommunityPoolSpendProposal",
|
|
414
|
-
value: Uint8Array.from(distribution_1.CommunityPoolSpendProposal.encode(proposal).finish()),
|
|
415
|
-
});
|
|
416
417
|
return [4 /*yield*/, wallet.getAddress()];
|
|
417
418
|
case 1:
|
|
418
419
|
proposer = _a.sent();
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
420
|
+
initialDeposit = [{ amount: FirmaUtil_1.FirmaUtil.getUFCTStringFromFCT(initialDepositFCT), denom: this.config.denom }];
|
|
421
|
+
message = {
|
|
422
|
+
typeUrl: "/cosmos.gov.v1.MsgSubmitProposal",
|
|
423
|
+
value: tx_1.MsgSubmitProposal.fromPartial({
|
|
424
|
+
title: title,
|
|
425
|
+
summary: summary,
|
|
426
|
+
metadata: metadata,
|
|
427
|
+
messages: messages,
|
|
428
|
+
proposer: proposer,
|
|
429
|
+
initialDeposit: initialDeposit,
|
|
430
|
+
})
|
|
431
|
+
};
|
|
424
432
|
txClient = new gov_1.GovTxClient(wallet, this.config.rpcAddress);
|
|
425
433
|
return [4 /*yield*/, txClient.sign([message], FirmaUtil_1.getSignAndBroadcastOption(this.config.denom, txMisc))];
|
|
426
434
|
case 2: return [2 /*return*/, _a.sent()];
|
|
@@ -456,15 +464,23 @@ var FirmaGovService = /** @class */ (function () {
|
|
|
456
464
|
});
|
|
457
465
|
});
|
|
458
466
|
};
|
|
459
|
-
FirmaGovService.prototype.
|
|
467
|
+
FirmaGovService.prototype.submitSoftwareUpgradeProposal = function (wallet, title, summary, initialDepositFCT, plan, metadata, txMisc) {
|
|
468
|
+
if (metadata === void 0) { metadata = ""; }
|
|
460
469
|
if (txMisc === void 0) { txMisc = FirmaUtil_1.DefaultTxMisc; }
|
|
461
470
|
return __awaiter(this, void 0, void 0, function () {
|
|
462
|
-
var txRaw, txClient, error_14;
|
|
471
|
+
var message, txRaw, txClient, error_14;
|
|
463
472
|
return __generator(this, function (_a) {
|
|
464
473
|
switch (_a.label) {
|
|
465
474
|
case 0:
|
|
466
475
|
_a.trys.push([0, 3, , 4]);
|
|
467
|
-
|
|
476
|
+
message = {
|
|
477
|
+
typeUrl: "/cosmos.upgrade.v1beta1.MsgSoftwareUpgrade",
|
|
478
|
+
value: tx_2.MsgSoftwareUpgrade.encode(tx_2.MsgSoftwareUpgrade.fromPartial({
|
|
479
|
+
authority: FirmaGovService.GOV_AUTHORITY,
|
|
480
|
+
plan: plan
|
|
481
|
+
})).finish()
|
|
482
|
+
};
|
|
483
|
+
return [4 /*yield*/, this.getSignedTxSubmitSoftwareUpgradeProposal(wallet, title, summary, initialDepositFCT, [message], metadata, txMisc)];
|
|
468
484
|
case 1:
|
|
469
485
|
txRaw = _a.sent();
|
|
470
486
|
txClient = new gov_1.GovTxClient(wallet, this.config.rpcAddress);
|
|
@@ -479,23 +495,23 @@ var FirmaGovService = /** @class */ (function () {
|
|
|
479
495
|
});
|
|
480
496
|
});
|
|
481
497
|
};
|
|
482
|
-
FirmaGovService.prototype.
|
|
498
|
+
FirmaGovService.prototype.submitStakingParamsUpdateProposal = function (wallet, title, summary, initialDepositFCT, params, metadata, txMisc) {
|
|
499
|
+
if (metadata === void 0) { metadata = ""; }
|
|
483
500
|
if (txMisc === void 0) { txMisc = FirmaUtil_1.DefaultTxMisc; }
|
|
484
501
|
return __awaiter(this, void 0, void 0, function () {
|
|
485
|
-
var
|
|
502
|
+
var message, txRaw, txClient, error_15;
|
|
486
503
|
return __generator(this, function (_a) {
|
|
487
504
|
switch (_a.label) {
|
|
488
505
|
case 0:
|
|
489
506
|
_a.trys.push([0, 3, , 4]);
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
upgradedClientState: undefined
|
|
507
|
+
message = {
|
|
508
|
+
typeUrl: "/cosmos.staking.v1beta1.MsgUpdateParams",
|
|
509
|
+
value: tx_4.MsgUpdateParams.encode(tx_4.MsgUpdateParams.fromPartial({
|
|
510
|
+
authority: FirmaGovService.GOV_AUTHORITY,
|
|
511
|
+
params: params
|
|
512
|
+
})).finish()
|
|
497
513
|
};
|
|
498
|
-
return [4 /*yield*/, this.
|
|
514
|
+
return [4 /*yield*/, this.getSignedTxSubmitStakingParamsUpdateProposal(wallet, title, summary, initialDepositFCT, [message], metadata, txMisc)];
|
|
499
515
|
case 1:
|
|
500
516
|
txRaw = _a.sent();
|
|
501
517
|
txClient = new gov_1.GovTxClient(wallet, this.config.rpcAddress);
|
|
@@ -510,22 +526,23 @@ var FirmaGovService = /** @class */ (function () {
|
|
|
510
526
|
});
|
|
511
527
|
});
|
|
512
528
|
};
|
|
513
|
-
FirmaGovService.prototype.
|
|
514
|
-
if (
|
|
529
|
+
FirmaGovService.prototype.submitGovParamsUpdateProposal = function (wallet, title, summary, initialDepositFCT, params, metadata, txmisc) {
|
|
530
|
+
if (metadata === void 0) { metadata = ""; }
|
|
531
|
+
if (txmisc === void 0) { txmisc = FirmaUtil_1.DefaultTxMisc; }
|
|
515
532
|
return __awaiter(this, void 0, void 0, function () {
|
|
516
|
-
var
|
|
533
|
+
var message, txRaw, txClient, error_16;
|
|
517
534
|
return __generator(this, function (_a) {
|
|
518
535
|
switch (_a.label) {
|
|
519
536
|
case 0:
|
|
520
537
|
_a.trys.push([0, 3, , 4]);
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
538
|
+
message = {
|
|
539
|
+
typeUrl: "/cosmos.gov.v1.MsgUpdateParams",
|
|
540
|
+
value: tx_5.MsgUpdateParams.encode(tx_5.MsgUpdateParams.fromPartial({
|
|
541
|
+
authority: FirmaGovService.GOV_AUTHORITY,
|
|
542
|
+
params: params
|
|
543
|
+
})).finish()
|
|
527
544
|
};
|
|
528
|
-
return [4 /*yield*/, this.
|
|
545
|
+
return [4 /*yield*/, this.getSignedTxSubmitGovParamsUpdateProposal(wallet, title, summary, initialDepositFCT, [message], metadata, txmisc)];
|
|
529
546
|
case 1:
|
|
530
547
|
txRaw = _a.sent();
|
|
531
548
|
txClient = new gov_1.GovTxClient(wallet, this.config.rpcAddress);
|
|
@@ -540,15 +557,28 @@ var FirmaGovService = /** @class */ (function () {
|
|
|
540
557
|
});
|
|
541
558
|
});
|
|
542
559
|
};
|
|
543
|
-
FirmaGovService.prototype.
|
|
560
|
+
FirmaGovService.prototype.submitCommunityPoolSpendProposal = function (wallet, title, summary, initialDepositFCT, amountFCT, recipient, metadata, txMisc) {
|
|
561
|
+
if (metadata === void 0) { metadata = ""; }
|
|
544
562
|
if (txMisc === void 0) { txMisc = FirmaUtil_1.DefaultTxMisc; }
|
|
545
563
|
return __awaiter(this, void 0, void 0, function () {
|
|
546
|
-
var txRaw, txClient, error_17;
|
|
564
|
+
var amount, message, txRaw, txClient, error_17;
|
|
547
565
|
return __generator(this, function (_a) {
|
|
548
566
|
switch (_a.label) {
|
|
549
567
|
case 0:
|
|
550
568
|
_a.trys.push([0, 3, , 4]);
|
|
551
|
-
|
|
569
|
+
amount = FirmaUtil_1.FirmaUtil.getUFCTStringFromFCT(amountFCT);
|
|
570
|
+
message = {
|
|
571
|
+
typeUrl: "/cosmos.distribution.v1beta1.MsgCommunityPoolSpend",
|
|
572
|
+
value: Uint8Array.from(tx_3.MsgCommunityPoolSpend.encode(tx_3.MsgCommunityPoolSpend.fromPartial({
|
|
573
|
+
authority: FirmaGovService.GOV_AUTHORITY,
|
|
574
|
+
recipient: recipient,
|
|
575
|
+
amount: [{
|
|
576
|
+
denom: this.config.denom,
|
|
577
|
+
amount: amount.toString()
|
|
578
|
+
}]
|
|
579
|
+
})).finish())
|
|
580
|
+
};
|
|
581
|
+
return [4 /*yield*/, this.getSignedTxSubmitCommunityPoolSpendProposal(wallet, title, summary, initialDepositFCT, [message], metadata, txMisc)];
|
|
552
582
|
case 1:
|
|
553
583
|
txRaw = _a.sent();
|
|
554
584
|
txClient = new gov_1.GovTxClient(wallet, this.config.rpcAddress);
|
|
@@ -563,7 +593,7 @@ var FirmaGovService = /** @class */ (function () {
|
|
|
563
593
|
});
|
|
564
594
|
});
|
|
565
595
|
};
|
|
566
|
-
FirmaGovService.prototype.
|
|
596
|
+
FirmaGovService.prototype.submitTextProposal = function (wallet, title, description, initialDeposit, txMisc) {
|
|
567
597
|
if (txMisc === void 0) { txMisc = FirmaUtil_1.DefaultTxMisc; }
|
|
568
598
|
return __awaiter(this, void 0, void 0, function () {
|
|
569
599
|
var txRaw, txClient, error_18;
|
|
@@ -571,7 +601,7 @@ var FirmaGovService = /** @class */ (function () {
|
|
|
571
601
|
switch (_a.label) {
|
|
572
602
|
case 0:
|
|
573
603
|
_a.trys.push([0, 3, , 4]);
|
|
574
|
-
return [4 /*yield*/, this.
|
|
604
|
+
return [4 /*yield*/, this.getSignedTxSubmitTextProposal(wallet, title, description, initialDeposit, txMisc)];
|
|
575
605
|
case 1:
|
|
576
606
|
txRaw = _a.sent();
|
|
577
607
|
txClient = new gov_1.GovTxClient(wallet, this.config.rpcAddress);
|
|
@@ -586,25 +616,39 @@ var FirmaGovService = /** @class */ (function () {
|
|
|
586
616
|
});
|
|
587
617
|
});
|
|
588
618
|
};
|
|
589
|
-
FirmaGovService.prototype.
|
|
619
|
+
FirmaGovService.prototype.submitGenericProposal = function (wallet, title, summary, initialDeposit, metadata, msgs, txMisc) {
|
|
590
620
|
if (txMisc === void 0) { txMisc = FirmaUtil_1.DefaultTxMisc; }
|
|
591
621
|
return __awaiter(this, void 0, void 0, function () {
|
|
592
|
-
var
|
|
622
|
+
var proposer, message, txClient, signed, error_19;
|
|
593
623
|
return __generator(this, function (_a) {
|
|
594
624
|
switch (_a.label) {
|
|
595
625
|
case 0:
|
|
596
|
-
_a.trys.push([0,
|
|
597
|
-
return [4 /*yield*/,
|
|
626
|
+
_a.trys.push([0, 4, , 5]);
|
|
627
|
+
return [4 /*yield*/, wallet.getAddress()];
|
|
598
628
|
case 1:
|
|
599
|
-
|
|
629
|
+
proposer = _a.sent();
|
|
630
|
+
message = {
|
|
631
|
+
typeUrl: "/cosmos.gov.v1.MsgSubmitProposal",
|
|
632
|
+
value: tx_1.MsgSubmitProposal.fromPartial({
|
|
633
|
+
title: title,
|
|
634
|
+
summary: summary,
|
|
635
|
+
metadata: metadata,
|
|
636
|
+
messages: msgs,
|
|
637
|
+
proposer: proposer,
|
|
638
|
+
initialDeposit: initialDeposit,
|
|
639
|
+
})
|
|
640
|
+
};
|
|
600
641
|
txClient = new gov_1.GovTxClient(wallet, this.config.rpcAddress);
|
|
601
|
-
return [4 /*yield*/, txClient.
|
|
602
|
-
case 2:
|
|
603
|
-
|
|
642
|
+
return [4 /*yield*/, txClient.sign([message], FirmaUtil_1.getSignAndBroadcastOption(this.config.denom, txMisc))];
|
|
643
|
+
case 2:
|
|
644
|
+
signed = _a.sent();
|
|
645
|
+
return [4 /*yield*/, txClient.broadcast(signed)];
|
|
646
|
+
case 3: return [2 /*return*/, _a.sent()];
|
|
647
|
+
case 4:
|
|
604
648
|
error_19 = _a.sent();
|
|
605
649
|
FirmaUtil_1.FirmaUtil.printLog(error_19);
|
|
606
650
|
throw error_19;
|
|
607
|
-
case
|
|
651
|
+
case 5: return [2 /*return*/];
|
|
608
652
|
}
|
|
609
653
|
});
|
|
610
654
|
});
|
|
@@ -835,6 +879,7 @@ var FirmaGovService = /** @class */ (function () {
|
|
|
835
879
|
});
|
|
836
880
|
});
|
|
837
881
|
};
|
|
882
|
+
FirmaGovService.GOV_AUTHORITY = "firma10d07y265gmmuvt4z0w9aw880jnsr700j53mj8f";
|
|
838
883
|
return FirmaGovService;
|
|
839
884
|
}());
|
|
840
885
|
exports.FirmaGovService = FirmaGovService;
|
|
@@ -7,7 +7,9 @@ export declare enum ProposalStatus {
|
|
|
7
7
|
PROPOSAL_STATUS_FAILED = 5
|
|
8
8
|
}
|
|
9
9
|
export interface ProposalParam {
|
|
10
|
-
|
|
10
|
+
voting_params: {
|
|
11
|
+
voting_period: string;
|
|
12
|
+
};
|
|
11
13
|
deposit_params: {
|
|
12
14
|
min_deposit: {
|
|
13
15
|
denom: string;
|
|
@@ -20,6 +22,16 @@ export interface ProposalParam {
|
|
|
20
22
|
threshold: string;
|
|
21
23
|
veto_threshold: string;
|
|
22
24
|
};
|
|
25
|
+
min_initial_deposit_ratio: string;
|
|
26
|
+
burn_vote_quorum: boolean;
|
|
27
|
+
burn_proposal_deposit_prevote: boolean;
|
|
28
|
+
burn_vote_veto: boolean;
|
|
29
|
+
expedited_voting_period: string;
|
|
30
|
+
expedited_threshold: string;
|
|
31
|
+
expedited_min_deposit: {
|
|
32
|
+
denom: string;
|
|
33
|
+
amount: string;
|
|
34
|
+
}[];
|
|
23
35
|
}
|
|
24
36
|
export interface CurrentVoteInfo {
|
|
25
37
|
yes: string;
|
|
@@ -94,9 +94,16 @@ var GovQueryClient = /** @class */ (function () {
|
|
|
94
94
|
case 3:
|
|
95
95
|
tallyingResult = _a.sent();
|
|
96
96
|
return [2 /*return*/, {
|
|
97
|
-
|
|
97
|
+
voting_params: votingResult.data.voting_params,
|
|
98
98
|
deposit_params: depositResult.data.deposit_params,
|
|
99
|
-
tally_params: tallyingResult.data.tally_params
|
|
99
|
+
tally_params: tallyingResult.data.tally_params,
|
|
100
|
+
min_initial_deposit_ratio: votingResult.data.min_initial_deposit_ratio,
|
|
101
|
+
burn_vote_quorum: votingResult.data.burn_vote_quorum,
|
|
102
|
+
burn_proposal_deposit_prevote: votingResult.data.burn_proposal_deposit_prevote,
|
|
103
|
+
burn_vote_veto: votingResult.data.burn_vote_veto,
|
|
104
|
+
expedited_voting_period: votingResult.data.expedited_voting_period,
|
|
105
|
+
expedited_threshold: votingResult.data.expedited_threshold,
|
|
106
|
+
expedited_min_deposit: votingResult.data.expedited_min_deposit
|
|
100
107
|
}];
|
|
101
108
|
}
|
|
102
109
|
});
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Registry, EncodeObject } from "@cosmjs/proto-signing";
|
|
2
2
|
import { MsgDeposit, MsgSubmitProposal, MsgVote } from "cosmjs-types/cosmos/gov/v1beta1/tx";
|
|
3
|
+
import { MsgSubmitProposal as MsgSubmitGenericProposal } from "cosmjs-types/cosmos/gov/v1/tx";
|
|
3
4
|
import { MsgCancelProposal } from "@kintsugi-tech/cosmjs-types/cosmos/gov/v1/tx";
|
|
4
5
|
import { FirmaWalletService } from "../../FirmaWalletService";
|
|
5
6
|
import { ITxClient } from "../common/ITxClient";
|
|
@@ -11,6 +12,10 @@ export interface MsgSubmitProposalEncodeObject extends EncodeObject {
|
|
|
11
12
|
readonly typeUrl: "/cosmos.gov.v1beta1.MsgSubmitProposal";
|
|
12
13
|
readonly value: Partial<MsgSubmitProposal>;
|
|
13
14
|
}
|
|
15
|
+
export interface MsgSubmitGenericProposalEncodeObject extends EncodeObject {
|
|
16
|
+
readonly typeUrl: "/cosmos.gov.v1.MsgSubmitProposal";
|
|
17
|
+
readonly value: Partial<MsgSubmitGenericProposal>;
|
|
18
|
+
}
|
|
14
19
|
export interface MsgVoteEncodeObject extends EncodeObject {
|
|
15
20
|
readonly typeUrl: "/cosmos.gov.v1beta1.MsgVote";
|
|
16
21
|
readonly value: Partial<MsgVote>;
|
|
@@ -24,6 +29,7 @@ export declare class GovTxClient extends ITxClient {
|
|
|
24
29
|
static getRegistry(): Registry;
|
|
25
30
|
static msgDeposit(data: MsgDeposit): MsgDepositEncodeObject;
|
|
26
31
|
static msgSubmitProposal(data: MsgSubmitProposal): MsgSubmitProposalEncodeObject;
|
|
32
|
+
static msgSubmitGenericProposal(data: MsgSubmitGenericProposal): MsgSubmitGenericProposalEncodeObject;
|
|
27
33
|
static msgVote(data: MsgVote): MsgVoteEncodeObject;
|
|
28
34
|
static msgCancelProposal(data: MsgCancelProposal): MsgCancelProposalEncodeObject;
|
|
29
35
|
}
|
|
@@ -18,13 +18,15 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
18
18
|
exports.GovTxClient = void 0;
|
|
19
19
|
var proto_signing_1 = require("@cosmjs/proto-signing");
|
|
20
20
|
var tx_1 = require("cosmjs-types/cosmos/gov/v1beta1/tx");
|
|
21
|
-
var tx_2 = require("
|
|
21
|
+
var tx_2 = require("cosmjs-types/cosmos/gov/v1/tx");
|
|
22
|
+
var tx_3 = require("@kintsugi-tech/cosmjs-types/cosmos/gov/v1/tx");
|
|
22
23
|
var ITxClient_1 = require("../common/ITxClient");
|
|
23
24
|
var types = [
|
|
24
25
|
["/cosmos.gov.v1beta1.MsgDeposit", tx_1.MsgDeposit],
|
|
25
26
|
["/cosmos.gov.v1beta1.MsgSubmitProposal", tx_1.MsgSubmitProposal],
|
|
27
|
+
["/cosmos.gov.v1.MsgSubmitProposal", tx_2.MsgSubmitProposal],
|
|
26
28
|
["/cosmos.gov.v1beta1.MsgVote", tx_1.MsgVote],
|
|
27
|
-
["/cosmos.gov.v1.MsgCancelProposal",
|
|
29
|
+
["/cosmos.gov.v1.MsgCancelProposal", tx_3.MsgCancelProposal],
|
|
28
30
|
];
|
|
29
31
|
var registry = new proto_signing_1.Registry(types);
|
|
30
32
|
var GovTxClient = /** @class */ (function (_super) {
|
|
@@ -41,6 +43,9 @@ var GovTxClient = /** @class */ (function (_super) {
|
|
|
41
43
|
GovTxClient.msgSubmitProposal = function (data) {
|
|
42
44
|
return { typeUrl: "/cosmos.gov.v1beta1.MsgSubmitProposal", value: data };
|
|
43
45
|
};
|
|
46
|
+
GovTxClient.msgSubmitGenericProposal = function (data) {
|
|
47
|
+
return { typeUrl: "/cosmos.gov.v1.MsgSubmitProposal", value: data };
|
|
48
|
+
};
|
|
44
49
|
GovTxClient.msgVote = function (data) {
|
|
45
50
|
return { typeUrl: "/cosmos.gov.v1beta1.MsgVote", value: data };
|
|
46
51
|
};
|
|
@@ -465,17 +465,17 @@ describe('[08. Gas Estimation Test]', function () {
|
|
|
465
465
|
}
|
|
466
466
|
});
|
|
467
467
|
}); });
|
|
468
|
-
it
|
|
469
|
-
var initialDepositFCT, title,
|
|
468
|
+
it("7-2. Gov submitCommunityPoolSpendProposal gas estimation", function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
469
|
+
var initialDepositFCT, title, summary, amountFCT, recipient, gas;
|
|
470
470
|
return __generator(this, function (_a) {
|
|
471
471
|
switch (_a.label) {
|
|
472
472
|
case 0:
|
|
473
473
|
initialDepositFCT = 2500;
|
|
474
474
|
title = "Community spend proposal";
|
|
475
|
-
|
|
475
|
+
summary = "Proposal to spend from community pool";
|
|
476
476
|
amountFCT = 1000;
|
|
477
477
|
recipient = bobAddress;
|
|
478
|
-
return [4 /*yield*/, firma.Gov.getGasEstimationSubmitCommunityPoolSpendProposal(aliceWallet, title,
|
|
478
|
+
return [4 /*yield*/, firma.Gov.getGasEstimationSubmitCommunityPoolSpendProposal(aliceWallet, title, summary, initialDepositFCT, amountFCT, recipient)];
|
|
479
479
|
case 1:
|
|
480
480
|
gas = _a.sent();
|
|
481
481
|
chai_1.expect(gas).to.not.equal(0);
|
|
@@ -483,54 +483,112 @@ describe('[08. Gas Estimation Test]', function () {
|
|
|
483
483
|
}
|
|
484
484
|
});
|
|
485
485
|
}); });
|
|
486
|
-
it
|
|
487
|
-
|
|
486
|
+
it("7-3. Gov submitStakingParamsUpdateProposal gas estimation", function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
487
|
+
function toDec18String(decimal) {
|
|
488
|
+
return BigInt(parseFloat(decimal) * 1e18).toString();
|
|
489
|
+
}
|
|
490
|
+
function parseDuration(durationStr) {
|
|
491
|
+
var match = /^(\d+)(\.(\d+))?s$/.exec(durationStr);
|
|
492
|
+
if (!match)
|
|
493
|
+
throw new Error("Invalid duration string: " + durationStr);
|
|
494
|
+
var seconds = BigInt(match[1]);
|
|
495
|
+
var fractionalPart = match[3] || "";
|
|
496
|
+
var padded = (fractionalPart + "000000000").slice(0, 9);
|
|
497
|
+
var nanos = Number(padded);
|
|
498
|
+
return { seconds: seconds, nanos: nanos };
|
|
499
|
+
}
|
|
500
|
+
var initialDepositFCT, title, summary, stakingParmas, changeValue, unbondingData, changeStakingParams, metadata, gas;
|
|
488
501
|
return __generator(this, function (_a) {
|
|
489
502
|
switch (_a.label) {
|
|
490
503
|
case 0:
|
|
491
|
-
initialDepositFCT =
|
|
492
|
-
title = "
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
subspace: "staking",
|
|
496
|
-
key: "MaxValidators",
|
|
497
|
-
value: "100",
|
|
498
|
-
}];
|
|
499
|
-
return [4 /*yield*/, firma.Gov.getGasEstimationSubmitParameterChangeProposal(aliceWallet, title, description, initialDepositFCT, changeParamList)];
|
|
504
|
+
initialDepositFCT = 5000;
|
|
505
|
+
title = "Staking parameter change proposal";
|
|
506
|
+
summary = "This is a Staking parameter change proposal";
|
|
507
|
+
return [4 /*yield*/, firma.Staking.getParams()];
|
|
500
508
|
case 1:
|
|
509
|
+
stakingParmas = _a.sent();
|
|
510
|
+
changeValue = 100;
|
|
511
|
+
unbondingData = parseDuration(stakingParmas.unbonding_time);
|
|
512
|
+
changeStakingParams = {
|
|
513
|
+
unbondingTime: { seconds: BigInt(unbondingData.seconds), nanos: unbondingData.nanos },
|
|
514
|
+
maxValidators: changeValue,
|
|
515
|
+
maxEntries: stakingParmas.max_entries,
|
|
516
|
+
historicalEntries: stakingParmas.historical_entries,
|
|
517
|
+
bondDenom: stakingParmas.bond_denom,
|
|
518
|
+
minCommissionRate: toDec18String(stakingParmas.min_commission_rate)
|
|
519
|
+
};
|
|
520
|
+
metadata = "";
|
|
521
|
+
return [4 /*yield*/, firma.Gov.getGasEstimationSubmitStakingParamsUpdateProposal(aliceWallet, title, summary, initialDepositFCT, changeStakingParams, metadata)];
|
|
522
|
+
case 2:
|
|
501
523
|
gas = _a.sent();
|
|
502
524
|
chai_1.expect(gas).to.not.equal(0);
|
|
503
525
|
return [2 /*return*/];
|
|
504
526
|
}
|
|
505
527
|
});
|
|
506
528
|
}); });
|
|
507
|
-
it
|
|
508
|
-
|
|
529
|
+
it("7-4, Gov submitGovParamsUpdateProposal gas estimation", function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
530
|
+
function parseDuration(durationStr) {
|
|
531
|
+
var match = /^(\d+)(\.(\d+))?s$/.exec(durationStr);
|
|
532
|
+
if (!match)
|
|
533
|
+
throw new Error("Invalid duration string: " + durationStr);
|
|
534
|
+
var seconds = BigInt(match[1]);
|
|
535
|
+
var fractionalPart = match[3] || "";
|
|
536
|
+
var padded = (fractionalPart + "000000000").slice(0, 9);
|
|
537
|
+
var nanos = Number(padded);
|
|
538
|
+
return { seconds: seconds, nanos: nanos };
|
|
539
|
+
}
|
|
540
|
+
var initialDepositFCT, title, summary, govParams, convertMaxDepositPeriod, convertVotingPeriod, changeGovParams, metadata, gas;
|
|
509
541
|
return __generator(this, function (_a) {
|
|
510
542
|
switch (_a.label) {
|
|
511
543
|
case 0:
|
|
512
|
-
initialDepositFCT =
|
|
513
|
-
title = "
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
upgradeHeight = 20000000;
|
|
517
|
-
return [4 /*yield*/, firma.Gov.getGasEstimationSubmitSoftwareUpgradeProposalByHeight(aliceWallet, title, description, initialDepositFCT, upgradeName, upgradeHeight)];
|
|
544
|
+
initialDepositFCT = 5000;
|
|
545
|
+
title = "Gov parameter change proposal";
|
|
546
|
+
summary = "This is a Gov parameter change proposal";
|
|
547
|
+
return [4 /*yield*/, firma.Gov.getParam()];
|
|
518
548
|
case 1:
|
|
549
|
+
govParams = _a.sent();
|
|
550
|
+
convertMaxDepositPeriod = parseDuration(govParams.deposit_params.max_deposit_period);
|
|
551
|
+
convertVotingPeriod = parseDuration(govParams.voting_params.voting_period);
|
|
552
|
+
changeGovParams = {
|
|
553
|
+
minDeposit: govParams.deposit_params.min_deposit,
|
|
554
|
+
maxDepositPeriod: convertMaxDepositPeriod,
|
|
555
|
+
votingPeriod: convertVotingPeriod,
|
|
556
|
+
quorum: govParams.tally_params.quorum,
|
|
557
|
+
threshold: govParams.tally_params.threshold,
|
|
558
|
+
vetoThreshold: govParams.tally_params.veto_threshold,
|
|
559
|
+
minInitialDepositRatio: govParams.min_initial_deposit_ratio,
|
|
560
|
+
burnVoteQuorum: govParams.burn_vote_quorum,
|
|
561
|
+
burnProposalDepositPrevote: govParams.burn_proposal_deposit_prevote,
|
|
562
|
+
burnVoteVeto: govParams.burn_vote_veto
|
|
563
|
+
};
|
|
564
|
+
metadata = "";
|
|
565
|
+
return [4 /*yield*/, firma.Gov.getGasEstimationSubmitGovParamsUpdateProposal(aliceWallet, title, summary, initialDepositFCT, changeGovParams, metadata)];
|
|
566
|
+
case 2:
|
|
519
567
|
gas = _a.sent();
|
|
520
568
|
chai_1.expect(gas).to.not.equal(0);
|
|
521
569
|
return [2 /*return*/];
|
|
522
570
|
}
|
|
523
571
|
});
|
|
524
572
|
}); });
|
|
525
|
-
it
|
|
526
|
-
var initialDepositFCT, title,
|
|
573
|
+
it("7-5. Gov submitSoftwareUpgradeProposal gas estimation", function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
574
|
+
var initialDepositFCT, title, summary, plan, metadata, gas;
|
|
527
575
|
return __generator(this, function (_a) {
|
|
528
576
|
switch (_a.label) {
|
|
529
577
|
case 0:
|
|
530
|
-
initialDepositFCT =
|
|
578
|
+
initialDepositFCT = 5000;
|
|
531
579
|
title = "Software Upgrade proposal1";
|
|
532
|
-
|
|
533
|
-
|
|
580
|
+
summary = "This is a software upgrade proposal";
|
|
581
|
+
plan = {
|
|
582
|
+
name: 'v0.5.1',
|
|
583
|
+
time: {
|
|
584
|
+
seconds: BigInt(0),
|
|
585
|
+
nanos: 0
|
|
586
|
+
},
|
|
587
|
+
height: BigInt(1050000),
|
|
588
|
+
info: ''
|
|
589
|
+
};
|
|
590
|
+
metadata = "";
|
|
591
|
+
return [4 /*yield*/, firma.Gov.getGasEstimationSubmitSoftwareUpgradeProposal(aliceWallet, title, summary, initialDepositFCT, plan, metadata)];
|
|
534
592
|
case 1:
|
|
535
593
|
gas = _a.sent();
|
|
536
594
|
chai_1.expect(gas).to.not.equal(0);
|
|
@@ -134,17 +134,17 @@ describe('[16. Gov Tx Test]', function () {
|
|
|
134
134
|
}
|
|
135
135
|
});
|
|
136
136
|
}); });
|
|
137
|
-
it
|
|
138
|
-
var initialDepositFCT, title,
|
|
137
|
+
it('SubmitCommunityPoolSpendProposal Test', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
138
|
+
var initialDepositFCT, title, summary, amountFCT, recipient, result;
|
|
139
139
|
return __generator(this, function (_a) {
|
|
140
140
|
switch (_a.label) {
|
|
141
141
|
case 0:
|
|
142
|
-
initialDepositFCT =
|
|
142
|
+
initialDepositFCT = 2500;
|
|
143
143
|
title = "Community spend proposal1";
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
recipient =
|
|
147
|
-
return [4 /*yield*/, firma.Gov.submitCommunityPoolSpendProposal(aliceWallet, title,
|
|
144
|
+
summary = "This is a community spend proposal";
|
|
145
|
+
amountFCT = 1000;
|
|
146
|
+
recipient = aliceAddress;
|
|
147
|
+
return [4 /*yield*/, firma.Gov.submitCommunityPoolSpendProposal(aliceWallet, title, summary, initialDepositFCT, amountFCT, recipient)];
|
|
148
148
|
case 1:
|
|
149
149
|
result = _a.sent();
|
|
150
150
|
chai_1.expect(result.code).to.equal(0);
|
|
@@ -152,43 +152,86 @@ describe('[16. Gov Tx Test]', function () {
|
|
|
152
152
|
}
|
|
153
153
|
});
|
|
154
154
|
}); });
|
|
155
|
-
it
|
|
156
|
-
|
|
155
|
+
it('SubmitStakingParamsUpdateProposal Test', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
156
|
+
function toDec18String(decimal) {
|
|
157
|
+
return BigInt(parseFloat(decimal) * 1e18).toString();
|
|
158
|
+
}
|
|
159
|
+
function parseDuration(durationStr) {
|
|
160
|
+
var match = /^(\d+)(\.(\d+))?s$/.exec(durationStr);
|
|
161
|
+
if (!match)
|
|
162
|
+
throw new Error("Invalid duration string: " + durationStr);
|
|
163
|
+
var seconds = BigInt(match[1]);
|
|
164
|
+
var fractionalPart = match[3] || "";
|
|
165
|
+
var padded = (fractionalPart + "000000000").slice(0, 9);
|
|
166
|
+
var nanos = Number(padded);
|
|
167
|
+
return { seconds: seconds, nanos: nanos };
|
|
168
|
+
}
|
|
169
|
+
var title, summary, initialDepositFCT, stakingParmas, changeValue, unbondingData, changeStakingParams, metadata, result;
|
|
157
170
|
return __generator(this, function (_a) {
|
|
158
171
|
switch (_a.label) {
|
|
159
172
|
case 0:
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
subspace: "staking",
|
|
165
|
-
key: "MaxValidators",
|
|
166
|
-
value: "100",
|
|
167
|
-
}];
|
|
168
|
-
return [4 /*yield*/, firma.Gov.submitParameterChangeProposal(aliceWallet, title, description, initialDepositFCT, changeParamList)];
|
|
173
|
+
title = "Staking Parameter Change proposal";
|
|
174
|
+
summary = "This is a Staking Parameter change proposal";
|
|
175
|
+
initialDepositFCT = 2500;
|
|
176
|
+
return [4 /*yield*/, firma.Staking.getParams()];
|
|
169
177
|
case 1:
|
|
178
|
+
stakingParmas = _a.sent();
|
|
179
|
+
changeValue = 100;
|
|
180
|
+
unbondingData = parseDuration(stakingParmas.unbonding_time);
|
|
181
|
+
changeStakingParams = {
|
|
182
|
+
unbondingTime: { seconds: BigInt(unbondingData.seconds), nanos: unbondingData.nanos },
|
|
183
|
+
maxValidators: changeValue,
|
|
184
|
+
maxEntries: stakingParmas.max_entries,
|
|
185
|
+
historicalEntries: stakingParmas.historical_entries,
|
|
186
|
+
bondDenom: stakingParmas.bond_denom,
|
|
187
|
+
minCommissionRate: toDec18String(stakingParmas.min_commission_rate)
|
|
188
|
+
};
|
|
189
|
+
metadata = "";
|
|
190
|
+
return [4 /*yield*/, firma.Gov.submitStakingParamsUpdateProposal(aliceWallet, title, summary, initialDepositFCT, changeStakingParams, metadata)];
|
|
191
|
+
case 2:
|
|
170
192
|
result = _a.sent();
|
|
171
193
|
chai_1.expect(result.code).to.equal(0);
|
|
172
194
|
return [2 /*return*/];
|
|
173
195
|
}
|
|
174
196
|
});
|
|
175
197
|
}); });
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
198
|
+
it('SubmitGovParamsUpdateProposal Test', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
199
|
+
function parseDuration(durationStr) {
|
|
200
|
+
var match = /^(\d+)(\.(\d+))?s$/.exec(durationStr);
|
|
201
|
+
if (!match)
|
|
202
|
+
throw new Error("Invalid duration string: " + durationStr);
|
|
203
|
+
var seconds = BigInt(match[1]);
|
|
204
|
+
var fractionalPart = match[3] || "";
|
|
205
|
+
var padded = (fractionalPart + "000000000").slice(0, 9);
|
|
206
|
+
var nanos = Number(padded);
|
|
207
|
+
return { seconds: seconds, nanos: nanos };
|
|
208
|
+
}
|
|
209
|
+
var title, summary, initialDepositFCT, govParams, convertMaxDepositPeriod, convertVotingPeriod, changeGovParams, metadata, result;
|
|
179
210
|
return __generator(this, function (_a) {
|
|
180
211
|
switch (_a.label) {
|
|
181
212
|
case 0:
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
upgradeHeight = 558800;
|
|
187
|
-
return [4 /*yield*/, firma.Gov.getGasEstimationSubmitSoftwareUpgradeProposalByHeight(aliceWallet, title, description, initialDepositFCT, upgradeName, upgradeHeight)];
|
|
213
|
+
title = "Staking Parameter Change proposal";
|
|
214
|
+
summary = "This is a Staking Parameter change proposal";
|
|
215
|
+
initialDepositFCT = 2500;
|
|
216
|
+
return [4 /*yield*/, firma.Gov.getParam()];
|
|
188
217
|
case 1:
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
218
|
+
govParams = _a.sent();
|
|
219
|
+
convertMaxDepositPeriod = parseDuration(govParams.deposit_params.max_deposit_period);
|
|
220
|
+
convertVotingPeriod = parseDuration(govParams.voting_params.voting_period);
|
|
221
|
+
changeGovParams = {
|
|
222
|
+
minDeposit: govParams.deposit_params.min_deposit,
|
|
223
|
+
maxDepositPeriod: convertMaxDepositPeriod,
|
|
224
|
+
votingPeriod: convertVotingPeriod,
|
|
225
|
+
quorum: govParams.tally_params.quorum,
|
|
226
|
+
threshold: govParams.tally_params.threshold,
|
|
227
|
+
vetoThreshold: govParams.tally_params.veto_threshold,
|
|
228
|
+
minInitialDepositRatio: govParams.min_initial_deposit_ratio,
|
|
229
|
+
burnVoteQuorum: govParams.burn_vote_quorum,
|
|
230
|
+
burnProposalDepositPrevote: govParams.burn_proposal_deposit_prevote,
|
|
231
|
+
burnVoteVeto: govParams.burn_vote_veto
|
|
232
|
+
};
|
|
233
|
+
metadata = "";
|
|
234
|
+
return [4 /*yield*/, firma.Gov.submitGovParamsUpdateProposal(aliceWallet, title, summary, initialDepositFCT, changeGovParams, metadata)];
|
|
192
235
|
case 2:
|
|
193
236
|
result = _a.sent();
|
|
194
237
|
chai_1.expect(result.code).to.equal(0);
|
|
@@ -196,19 +239,32 @@ describe('[16. Gov Tx Test]', function () {
|
|
|
196
239
|
}
|
|
197
240
|
});
|
|
198
241
|
}); });
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
var initialDepositFCT, title, description, result;
|
|
242
|
+
it('SubmitSoftwareUpgradeProposal Test', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
243
|
+
var initialDeposit, title, summary, plan, metadata, gas, fee, result;
|
|
202
244
|
return __generator(this, function (_a) {
|
|
203
245
|
switch (_a.label) {
|
|
204
246
|
case 0:
|
|
205
|
-
|
|
206
|
-
title = "
|
|
207
|
-
|
|
208
|
-
|
|
247
|
+
initialDeposit = 5000;
|
|
248
|
+
title = "CancelProposal test proposal";
|
|
249
|
+
summary = "This is a Text & CancelProposal";
|
|
250
|
+
plan = {
|
|
251
|
+
name: 'v0.5.1',
|
|
252
|
+
time: {
|
|
253
|
+
seconds: BigInt(0),
|
|
254
|
+
nanos: 0
|
|
255
|
+
},
|
|
256
|
+
height: BigInt(1050000),
|
|
257
|
+
info: ''
|
|
258
|
+
};
|
|
259
|
+
metadata = "";
|
|
260
|
+
return [4 /*yield*/, firma.Gov.getGasEstimationSubmitSoftwareUpgradeProposal(aliceWallet, title, summary, initialDeposit, plan, metadata)];
|
|
209
261
|
case 1:
|
|
262
|
+
gas = _a.sent();
|
|
263
|
+
fee = Math.ceil(gas * 0.1);
|
|
264
|
+
return [4 /*yield*/, firma.Gov.submitSoftwareUpgradeProposal(aliceWallet, title, summary, initialDeposit, plan, metadata, { gas: gas, fee: fee })];
|
|
265
|
+
case 2:
|
|
210
266
|
result = _a.sent();
|
|
211
|
-
chai_1.expect(result.code).to.equal(0);
|
|
267
|
+
chai_1.expect(result.code).to.be.equal(0);
|
|
212
268
|
return [2 /*return*/];
|
|
213
269
|
}
|
|
214
270
|
});
|
|
@@ -243,27 +299,8 @@ describe('[16. Gov Tx Test]', function () {
|
|
|
243
299
|
}
|
|
244
300
|
});
|
|
245
301
|
}); });
|
|
246
|
-
// NOTICE: time-based upgrades have been deprecated in the SDK: invalid request
|
|
247
|
-
/*it.skip('SubmitSoftwareUpgradeProposalByTime Test', async () => {
|
|
248
|
-
|
|
249
|
-
const initialDepositFCT = 8;
|
|
250
|
-
const title = "Software Upgrade proposal2";
|
|
251
|
-
const description = "This is a software upgrade proposal";
|
|
252
|
-
|
|
253
|
-
const expirationDate = new Date();
|
|
254
|
-
expirationDate.setMinutes(expirationDate.getMinutes() + 3);
|
|
255
|
-
|
|
256
|
-
const upgradeName = "v0.2.4";
|
|
257
|
-
const upgradeTime = expirationDate;
|
|
258
|
-
const upgradeInfo = "info?";
|
|
259
|
-
|
|
260
|
-
var result = await firma.Gov.SubmitSoftwareUpgradeProposalByTime(aliceWallet, title, description, initialDepositFCT, upgradeName, upgradeTime);
|
|
261
|
-
|
|
262
|
-
console.log(result);
|
|
263
|
-
expect(result.code).to.equal(0);
|
|
264
|
-
});*/
|
|
265
302
|
// TODO: get recent gov proposal list and then set proposalId for below case
|
|
266
|
-
var tempProposalId =
|
|
303
|
+
var tempProposalId = 1;
|
|
267
304
|
// more deposit after initial deposit case
|
|
268
305
|
it.skip('Deposit OK', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
269
306
|
var proposalId, amount, result;
|
|
@@ -308,4 +345,36 @@ describe('[16. Gov Tx Test]', function () {
|
|
|
308
345
|
}
|
|
309
346
|
});
|
|
310
347
|
}); });
|
|
348
|
+
it('SubmitCommunityPoolSpendProposal & Deposit & Vote scenario test', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
349
|
+
var initialDepositFCT, title, summary, amountFCT, recipient, result, proposalId, addDepositAmount;
|
|
350
|
+
return __generator(this, function (_a) {
|
|
351
|
+
switch (_a.label) {
|
|
352
|
+
case 0:
|
|
353
|
+
initialDepositFCT = 2500;
|
|
354
|
+
title = "Community spend proposal1";
|
|
355
|
+
summary = "This is a community spend proposal";
|
|
356
|
+
amountFCT = 1000;
|
|
357
|
+
recipient = aliceAddress;
|
|
358
|
+
return [4 /*yield*/, firma.Gov.submitCommunityPoolSpendProposal(aliceWallet, title, summary, initialDepositFCT, amountFCT, recipient)];
|
|
359
|
+
case 1:
|
|
360
|
+
result = _a.sent();
|
|
361
|
+
chai_1.expect(result.code).to.equal(0);
|
|
362
|
+
proposalId = extractValue(result.events, "submit_proposal", "proposal_id");
|
|
363
|
+
addDepositAmount = 2500;
|
|
364
|
+
return [4 /*yield*/, firma.Gov.deposit(aliceWallet, proposalId, addDepositAmount)];
|
|
365
|
+
case 2:
|
|
366
|
+
result = _a.sent();
|
|
367
|
+
chai_1.expect(result.code).to.equal(0);
|
|
368
|
+
return [4 /*yield*/, firma.Gov.vote(aliceWallet, proposalId, common_1.VotingOption.VOTE_OPTION_YES)];
|
|
369
|
+
case 3:
|
|
370
|
+
result = _a.sent();
|
|
371
|
+
chai_1.expect(result.code).to.equal(0);
|
|
372
|
+
return [4 /*yield*/, firma.Gov.vote(aliceWallet, proposalId, common_1.VotingOption.VOTE_OPTION_NO)];
|
|
373
|
+
case 4:
|
|
374
|
+
result = _a.sent();
|
|
375
|
+
chai_1.expect(result.code).to.equal(0);
|
|
376
|
+
return [2 /*return*/];
|
|
377
|
+
}
|
|
378
|
+
});
|
|
379
|
+
}); });
|
|
311
380
|
});
|
package/dist/test/config_test.js
CHANGED
|
@@ -16,10 +16,8 @@ exports.TestChainConfig = {
|
|
|
16
16
|
isShowLog: false,
|
|
17
17
|
};
|
|
18
18
|
exports.validatorMnemonic = "angry water bunker where iron absurd cruise deliver clutch unique creek pyramid arch express flush pill lens concert absent enemy boring mom nuclear rose";
|
|
19
|
-
exports.aliceMnemonic = "immune flavor record sphere foam planet faint grid disorder flag minute eternal beef sea camp surge extra scorpion pistol plastic happy siren juice found";
|
|
20
|
-
|
|
21
|
-
exports.bobMnemonic = "innocent enforce visit tilt job kitten actual glory flash feed wonder license rubber outer drum sun fuel relax roof universe enrich pulse fine grid"; // BOB REAL
|
|
22
|
-
// export const bobMnemonic = "immune flavor record sphere foam planet faint grid disorder flag minute eternal beef sea camp surge extra scorpion pistol plastic happy siren juice found"; // FAKE
|
|
19
|
+
exports.aliceMnemonic = "immune flavor record sphere foam planet faint grid disorder flag minute eternal beef sea camp surge extra scorpion pistol plastic happy siren juice found";
|
|
20
|
+
exports.bobMnemonic = "innocent enforce visit tilt job kitten actual glory flash feed wonder license rubber outer drum sun fuel relax roof universe enrich pulse fine grid";
|
|
23
21
|
exports.feeMnemonic = "long shallow crumble clown truth book oval render seed canal buffalo assist sadness elbow afraid catalog brother trade food subject must luggage bread neither";
|
|
24
22
|
exports.firmaFeeMnemonic = "arrest dynamic typical lunch original glare truth narrow stairs clip canyon space alley chat drive sudden music bubble time mesh color office minor draft";
|
|
25
23
|
// export const firmaFeeMnemonic = "child material talent property foot sign talent congress cargo pistol suspect screen leader owner type style patch amused stable flame sure fluid april acoustic";
|
|
@@ -3,3 +3,9 @@ export declare let TestChainConfig: FirmaConfig;
|
|
|
3
3
|
export declare const validatorMnemonic = "";
|
|
4
4
|
export declare const aliceMnemonic = "";
|
|
5
5
|
export declare const bobMnemonic = "";
|
|
6
|
+
export declare const feeMnemonic = "";
|
|
7
|
+
export declare const firmaFeeMnemonic = "";
|
|
8
|
+
export declare const signerMnemonic1 = "";
|
|
9
|
+
export declare const signerMnemonic2 = "";
|
|
10
|
+
export declare const signerMnemonic3 = "";
|
|
11
|
+
export declare const signerMnemonic4 = "";
|
|
@@ -1,8 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.bobMnemonic = exports.aliceMnemonic = exports.validatorMnemonic = exports.TestChainConfig = void 0;
|
|
3
|
+
exports.signerMnemonic4 = exports.signerMnemonic3 = exports.signerMnemonic2 = exports.signerMnemonic1 = exports.firmaFeeMnemonic = exports.feeMnemonic = exports.bobMnemonic = exports.aliceMnemonic = exports.validatorMnemonic = exports.TestChainConfig = void 0;
|
|
4
4
|
var FirmaConfig_1 = require("../sdk/FirmaConfig");
|
|
5
5
|
exports.TestChainConfig = FirmaConfig_1.FirmaConfig.TestNetConfig;
|
|
6
6
|
exports.validatorMnemonic = "";
|
|
7
7
|
exports.aliceMnemonic = "";
|
|
8
8
|
exports.bobMnemonic = "";
|
|
9
|
+
exports.feeMnemonic = "";
|
|
10
|
+
exports.firmaFeeMnemonic = "";
|
|
11
|
+
exports.signerMnemonic1 = "";
|
|
12
|
+
exports.signerMnemonic2 = "";
|
|
13
|
+
exports.signerMnemonic3 = "";
|
|
14
|
+
exports.signerMnemonic4 = "";
|