@firmachain/firma-js 0.2.64 → 0.3.0-beta1
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 +4 -1
- package/dist/sdk/FirmaAuthzService.d.ts +8 -8
- package/dist/sdk/FirmaAuthzService.js +12 -6
- package/dist/sdk/FirmaBankService.d.ts +4 -4
- package/dist/sdk/FirmaContractService.d.ts +4 -4
- package/dist/sdk/FirmaCosmWasmCw20.d.ts +14 -14
- package/dist/sdk/FirmaCosmWasmCw721.d.ts +14 -14
- package/dist/sdk/FirmaCosmWasmCwBridge.d.ts +9 -9
- package/dist/sdk/FirmaCosmWasmCwMarketplace.d.ts +8 -8
- package/dist/sdk/FirmaCosmWasmService.d.ts +8 -8
- package/dist/sdk/FirmaCosmWasmService.js +2 -3
- package/dist/sdk/FirmaDistributionService.d.ts +6 -6
- package/dist/sdk/FirmaFeeGrantService.d.ts +4 -4
- package/dist/sdk/FirmaGovService.d.ts +12 -9
- package/dist/sdk/FirmaGovService.js +162 -97
- package/dist/sdk/FirmaIbcService.d.ts +3 -4
- package/dist/sdk/FirmaIbcService.js +5 -2
- package/dist/sdk/FirmaNftService.d.ts +5 -5
- package/dist/sdk/FirmaStakingService.d.ts +6 -6
- package/dist/sdk/FirmaTokenService.d.ts +5 -5
- package/dist/sdk/FirmaUtil.d.ts +1 -1
- package/dist/sdk/FirmaUtil.js +12 -14
- package/dist/sdk/firmachain/amino/addresses.js +1 -1
- package/dist/sdk/firmachain/amino/aminomsgs.d.ts +10 -0
- package/dist/sdk/firmachain/amino/aminomsgs.js +5 -1
- package/dist/sdk/firmachain/amino/aminotypes.js +27 -10
- package/dist/sdk/firmachain/amino/coins.d.ts +14 -2
- package/dist/sdk/firmachain/amino/coins.js +26 -5
- package/dist/sdk/firmachain/amino/encoding.d.ts +10 -1
- package/dist/sdk/firmachain/amino/encoding.js +21 -3
- package/dist/sdk/firmachain/amino/signdoc.d.ts +21 -3
- package/dist/sdk/firmachain/amino/signdoc.js +37 -11
- package/dist/sdk/firmachain/amino/signer.d.ts +2 -1
- package/dist/sdk/firmachain/authz/AuthzTxTypes.d.ts +7 -6
- package/dist/sdk/firmachain/authz/AuthzTxTypes.js +7 -6
- package/dist/sdk/firmachain/bank/BankQueryClient.js +1 -1
- package/dist/sdk/firmachain/common/CommonTxClient.js +11 -9
- package/dist/sdk/firmachain/common/ITxClient.d.ts +6 -6
- package/dist/sdk/firmachain/common/ITxClient.js +82 -24
- package/dist/sdk/firmachain/common/LedgerSigningStargateClient.d.ts +4 -9
- package/dist/sdk/firmachain/common/LedgerSigningStargateClient.js +37 -32
- package/dist/sdk/firmachain/common/LedgerWallet.js +4 -8
- package/dist/sdk/firmachain/common/TxCommon.d.ts +1 -2
- package/dist/sdk/firmachain/common/accounts.d.ts +7 -3
- package/dist/sdk/firmachain/common/accounts.js +28 -33
- package/dist/sdk/firmachain/common/aminotypes.d.ts +19 -0
- package/dist/sdk/firmachain/common/aminotypes.js +74 -0
- package/dist/sdk/firmachain/common/events.d.ts +32 -0
- package/dist/sdk/firmachain/common/events.js +18 -0
- package/dist/sdk/firmachain/common/fee.d.ts +26 -0
- package/dist/sdk/firmachain/common/fee.js +83 -0
- package/dist/sdk/firmachain/common/index.d.ts +1 -0
- package/dist/sdk/firmachain/common/index.js +3 -0
- package/dist/sdk/firmachain/common/modules/auth/queries.d.ts +15 -0
- package/dist/sdk/firmachain/common/modules/auth/queries.js +64 -0
- package/dist/sdk/firmachain/common/modules/authz/aminomessages.d.ts +2 -0
- package/dist/sdk/firmachain/common/modules/authz/aminomessages.js +15 -0
- package/dist/sdk/firmachain/common/modules/authz/messages.d.ts +2 -0
- package/dist/sdk/firmachain/common/modules/authz/messages.js +9 -0
- package/dist/sdk/firmachain/common/modules/authz/queries.d.ts +10 -0
- package/dist/sdk/firmachain/common/modules/authz/queries.js +88 -0
- package/dist/sdk/firmachain/common/modules/bank/aminomessages.d.ts +35 -0
- package/dist/sdk/firmachain/common/modules/bank/aminomessages.js +85 -0
- package/dist/sdk/firmachain/common/modules/bank/messages.d.ts +8 -0
- package/dist/sdk/firmachain/common/modules/bank/messages.js +12 -0
- package/dist/sdk/firmachain/common/modules/bank/queries.d.ts +15 -0
- package/dist/sdk/firmachain/common/modules/bank/queries.js +128 -0
- package/dist/sdk/firmachain/common/modules/crisis/aminomessages.d.ts +14 -0
- package/dist/sdk/firmachain/common/modules/crisis/aminomessages.js +11 -0
- package/dist/sdk/firmachain/common/modules/distribution/aminomessages.d.ts +44 -0
- package/dist/sdk/firmachain/common/modules/distribution/aminomessages.js +113 -0
- package/dist/sdk/firmachain/common/modules/distribution/messages.d.ts +8 -0
- package/dist/sdk/firmachain/common/modules/distribution/messages.js +15 -0
- package/dist/sdk/firmachain/common/modules/distribution/queries.d.ts +16 -0
- package/dist/sdk/firmachain/common/modules/distribution/queries.js +171 -0
- package/dist/sdk/firmachain/common/modules/evidence/aminomessages.d.ts +18 -0
- package/dist/sdk/firmachain/common/modules/evidence/aminomessages.js +11 -0
- package/dist/sdk/firmachain/common/modules/feegrant/aminomessages.d.ts +2 -0
- package/dist/sdk/firmachain/common/modules/feegrant/aminomessages.js +14 -0
- package/dist/sdk/firmachain/common/modules/feegrant/messages.d.ts +2 -0
- package/dist/sdk/firmachain/common/modules/feegrant/messages.js +8 -0
- package/dist/sdk/firmachain/common/modules/feegrant/queries.d.ts +9 -0
- package/dist/sdk/firmachain/common/modules/feegrant/queries.js +81 -0
- package/dist/sdk/firmachain/common/modules/gov/aminomessages.d.ts +79 -0
- package/dist/sdk/firmachain/common/modules/gov/aminomessages.js +152 -0
- package/dist/sdk/firmachain/common/modules/gov/messages.d.ts +29 -0
- package/dist/sdk/firmachain/common/modules/gov/messages.js +38 -0
- package/dist/sdk/firmachain/common/modules/gov/queries.d.ts +19 -0
- package/dist/sdk/firmachain/common/modules/gov/queries.js +160 -0
- package/dist/sdk/firmachain/common/modules/group/aminomessages.d.ts +2 -0
- package/dist/sdk/firmachain/common/modules/group/aminomessages.js +8 -0
- package/dist/sdk/firmachain/common/modules/group/messages.d.ts +2 -0
- package/dist/sdk/firmachain/common/modules/group/messages.js +28 -0
- package/dist/sdk/firmachain/common/modules/ibc/aminomessages.d.ts +38 -0
- package/dist/sdk/firmachain/common/modules/ibc/aminomessages.js +55 -0
- package/dist/sdk/firmachain/common/modules/ibc/messages.d.ts +8 -0
- package/dist/sdk/firmachain/common/modules/ibc/messages.js +32 -0
- package/dist/sdk/firmachain/common/modules/ibc/queries.d.ts +58 -0
- package/dist/sdk/firmachain/common/modules/ibc/queries.js +576 -0
- package/dist/sdk/firmachain/common/modules/index.d.ts +32 -0
- package/dist/sdk/firmachain/common/modules/index.js +101 -0
- package/dist/sdk/firmachain/common/modules/mint/queries.d.ts +21 -0
- package/dist/sdk/firmachain/common/modules/mint/queries.js +95 -0
- package/dist/sdk/firmachain/common/modules/slashing/aminomessages.d.ts +12 -0
- package/dist/sdk/firmachain/common/modules/slashing/aminomessages.js +11 -0
- package/dist/sdk/firmachain/common/modules/slashing/queries.d.ts +10 -0
- package/dist/sdk/firmachain/common/modules/slashing/queries.js +88 -0
- package/dist/sdk/firmachain/common/modules/staking/aminomessages.d.ts +112 -0
- package/dist/sdk/firmachain/common/modules/staking/aminomessages.js +234 -0
- package/dist/sdk/firmachain/common/modules/staking/messages.d.ts +33 -0
- package/dist/sdk/firmachain/common/modules/staking/messages.js +37 -0
- package/dist/sdk/firmachain/common/modules/staking/queries.d.ts +23 -0
- package/dist/sdk/firmachain/common/modules/staking/queries.js +242 -0
- package/dist/sdk/firmachain/common/modules/tx/queries.d.ts +11 -0
- package/dist/sdk/firmachain/common/modules/tx/queries.js +103 -0
- package/dist/sdk/firmachain/common/modules/vesting/aminomessages.d.ts +16 -0
- package/dist/sdk/firmachain/common/modules/vesting/aminomessages.js +56 -0
- package/dist/sdk/firmachain/common/modules/vesting/messages.d.ts +2 -0
- package/dist/sdk/firmachain/common/modules/vesting/messages.js +7 -0
- package/dist/sdk/firmachain/common/queryclient/index.d.ts +2 -0
- package/dist/sdk/firmachain/common/queryclient/index.js +10 -0
- package/dist/sdk/firmachain/common/queryclient/queryclient.d.ts +75 -0
- package/dist/sdk/firmachain/common/queryclient/queryclient.js +157 -0
- package/dist/sdk/firmachain/common/queryclient/utils.d.ts +33 -0
- package/dist/sdk/firmachain/common/queryclient/utils.js +101 -0
- package/dist/sdk/firmachain/common/search.d.ts +10 -0
- package/dist/sdk/firmachain/common/search.js +7 -0
- package/dist/sdk/firmachain/common/signing.d.ts +8 -3
- package/dist/sdk/firmachain/common/signing.js +24 -12
- package/dist/sdk/firmachain/common/signingstargateclient.d.ts +107 -30
- package/dist/sdk/firmachain/common/signingstargateclient.js +445 -128
- package/dist/sdk/firmachain/common/stargateclient.d.ts +184 -20
- package/dist/sdk/firmachain/common/stargateclient.js +351 -35
- package/dist/sdk/firmachain/contract/ContractTxClient.d.ts +2 -2
- package/dist/sdk/firmachain/contract/ContractTxClient.js +4 -4
- package/dist/sdk/firmachain/contract/ContractTxTypes.d.ts +1 -1
- package/dist/sdk/firmachain/contract/ContractTxTypes.js +3 -3
- package/dist/sdk/firmachain/cosmwasm/CosmWasmQueryClient.js +1 -1
- package/dist/sdk/firmachain/feegrant/FeeGrantTxTypes.d.ts +5 -5
- package/dist/sdk/firmachain/feegrant/FeeGrantTxTypes.js +10 -8
- package/dist/sdk/firmachain/google/protobuf/any.d.ts +3 -2
- package/dist/sdk/firmachain/google/protobuf/any.js +2 -1
- package/dist/sdk/firmachain/google/protobuf/duration.d.ts +3 -2
- package/dist/sdk/firmachain/google/protobuf/duration.js +2 -1
- package/dist/sdk/firmachain/google/protobuf/timestamp.d.ts +3 -2
- package/dist/sdk/firmachain/google/protobuf/timestamp.js +2 -1
- package/dist/sdk/firmachain/gov/GovTxClient.d.ts +6 -0
- package/dist/sdk/firmachain/gov/GovTxClient.js +6 -1
- package/dist/sdk/firmachain/nft/NftTxClient.d.ts +3 -3
- package/dist/sdk/firmachain/nft/NftTxClient.js +6 -6
- package/dist/sdk/firmachain/nft/NftTxTypes.d.ts +1 -1
- package/dist/sdk/firmachain/nft/NftTxTypes.js +4 -4
- package/dist/sdk/firmachain/staking/StakingQueryClient.js +0 -1
- package/dist/sdk/firmachain/token/TokenTxClient.d.ts +4 -4
- package/dist/sdk/firmachain/token/TokenTxClient.js +8 -8
- package/dist/sdk/firmachain/token/TokenTxTypes.d.ts +1 -1
- package/dist/sdk/firmachain/token/TokenTxTypes.js +5 -5
- package/dist/test/00.wallet.test.js +15 -9
- package/dist/test/01.contract_tx.test.js +53 -45
- package/dist/test/02.contract_query.test.js +54 -31
- package/dist/test/03.contract_scenario.test.js +170 -326
- package/dist/test/04.bank_tx.test.js +58 -59
- package/dist/test/05.bank_query.test.js +51 -56
- package/dist/test/06.feegrant_tx.test.js +74 -89
- package/dist/test/07.feegrant_query.test.js +69 -27
- package/dist/test/08.gas_estimate.test.js +351 -379
- package/dist/test/09.ipfs.test.js +3 -3
- package/dist/test/10.nft_tx.test.js +108 -76
- package/dist/test/11.nft_query.test.js +41 -46
- package/dist/test/12.staking_tx.test.js +81 -98
- package/dist/test/13.staking_query.test.js +66 -12
- package/dist/test/14.distribution_tx.test.js +69 -78
- package/dist/test/15.distribution_query.test.js +81 -57
- package/dist/test/16.gov_tx.test.js +149 -78
- package/dist/test/17.gov_query.test.js +48 -9
- package/dist/test/18.util.test.js +6 -1
- package/dist/test/19.chain.test.js +50 -4
- package/dist/test/20.slashing_query.test.js +31 -1
- package/dist/test/21.token_tx.test.js +48 -56
- package/dist/test/22.token_query.test.js +24 -20
- package/dist/test/23.authz_tx.test.js +119 -240
- package/dist/test/24.authz_query.test.js +116 -56
- package/dist/test/25.cosmwasm_tx.test.js +95 -57
- package/dist/test/26.cosmwasm_query.test.js +66 -26
- package/dist/test/27.arbitary_sign.test.js +59 -67
- package/dist/test/28.ibc_tx.test.js +29 -17
- package/dist/test/29.mint_query.test.js +2 -0
- package/dist/test/30.cw20_tx.test.js +161 -226
- package/dist/test/31.cw20_query.test.js +183 -37
- package/dist/test/32.cw721_tx.test.js +147 -149
- package/dist/test/33.cw721_query.test.js +188 -36
- package/dist/test/34.cw_bridge_tx.test.js +266 -155
- package/dist/test/35.cw_bridge_tx_low.test.js +221 -81
- package/dist/test/36.cw_bridge_query.test.js +157 -21
- package/dist/test/37.cw_marketplace_tx.test.js +22 -22
- package/dist/test/38.cw_marketplace_query.test.js +9 -9
- package/dist/test/config_test.d.ts +10 -4
- package/dist/test/config_test.js +18 -9
- package/dist/test/config_test.sample.d.ts +5 -0
- package/dist/test/config_test.sample.js +8 -0
- package/package.json +9 -7
- package/dist/sdk/firmachain/common/signingaminostargateclient.d.ts +0 -50
- package/dist/sdk/firmachain/common/signingaminostargateclient.js +0 -267
|
@@ -35,73 +35,128 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
35
35
|
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
36
|
}
|
|
37
37
|
};
|
|
38
|
+
var __values = (this && this.__values) || function(o) {
|
|
39
|
+
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
40
|
+
if (m) return m.call(o);
|
|
41
|
+
if (o && typeof o.length === "number") return {
|
|
42
|
+
next: function () {
|
|
43
|
+
if (o && i >= o.length) o = void 0;
|
|
44
|
+
return { value: o && o[i++], done: !o };
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
48
|
+
};
|
|
38
49
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
50
|
var chai_1 = require("chai");
|
|
40
51
|
var common_1 = require("../sdk/firmachain/common");
|
|
41
52
|
var FirmaSDK_1 = require("../sdk/FirmaSDK");
|
|
42
53
|
var config_test_1 = require("./config_test");
|
|
43
54
|
// If test it, the properties of the chain change, so skip it.
|
|
44
|
-
describe
|
|
55
|
+
describe('[16. Gov Tx Test]', function () {
|
|
45
56
|
var firma;
|
|
57
|
+
var aliceWallet;
|
|
58
|
+
var aliceAddress;
|
|
59
|
+
var bobWallet;
|
|
60
|
+
var bobAddress;
|
|
61
|
+
var extractValue = function (events, eventType, attrKey) {
|
|
62
|
+
var e_1, _a, e_2, _b;
|
|
63
|
+
try {
|
|
64
|
+
for (var events_1 = __values(events), events_1_1 = events_1.next(); !events_1_1.done; events_1_1 = events_1.next()) {
|
|
65
|
+
var event_1 = events_1_1.value;
|
|
66
|
+
if (event_1.type === eventType) {
|
|
67
|
+
try {
|
|
68
|
+
for (var _c = (e_2 = void 0, __values(event_1.attributes)), _d = _c.next(); !_d.done; _d = _c.next()) {
|
|
69
|
+
var attr = _d.value;
|
|
70
|
+
if (attr.key === attrKey) {
|
|
71
|
+
return attr.value;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
76
|
+
finally {
|
|
77
|
+
try {
|
|
78
|
+
if (_d && !_d.done && (_b = _c.return)) _b.call(_c);
|
|
79
|
+
}
|
|
80
|
+
finally { if (e_2) throw e_2.error; }
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
86
|
+
finally {
|
|
87
|
+
try {
|
|
88
|
+
if (events_1_1 && !events_1_1.done && (_a = events_1.return)) _a.call(events_1);
|
|
89
|
+
}
|
|
90
|
+
finally { if (e_1) throw e_1.error; }
|
|
91
|
+
}
|
|
92
|
+
return "";
|
|
93
|
+
};
|
|
46
94
|
beforeEach(function () {
|
|
47
|
-
|
|
95
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
96
|
+
return __generator(this, function (_a) {
|
|
97
|
+
switch (_a.label) {
|
|
98
|
+
case 0:
|
|
99
|
+
firma = new FirmaSDK_1.FirmaSDK(config_test_1.TestChainConfig);
|
|
100
|
+
return [4 /*yield*/, firma.Wallet.fromMnemonic(config_test_1.aliceMnemonic)];
|
|
101
|
+
case 1:
|
|
102
|
+
aliceWallet = _a.sent();
|
|
103
|
+
return [4 /*yield*/, aliceWallet.getAddress()];
|
|
104
|
+
case 2:
|
|
105
|
+
aliceAddress = _a.sent();
|
|
106
|
+
return [4 /*yield*/, firma.Wallet.fromMnemonic(config_test_1.bobMnemonic)];
|
|
107
|
+
case 3:
|
|
108
|
+
bobWallet = _a.sent();
|
|
109
|
+
return [4 /*yield*/, bobWallet.getAddress()];
|
|
110
|
+
case 4:
|
|
111
|
+
bobAddress = _a.sent();
|
|
112
|
+
return [2 /*return*/];
|
|
113
|
+
}
|
|
114
|
+
});
|
|
115
|
+
});
|
|
48
116
|
});
|
|
49
117
|
// Test order
|
|
50
118
|
// 1. submitProposal
|
|
51
119
|
// 2. deposit(for pass minium deposit value)
|
|
52
120
|
// 3. vote
|
|
53
121
|
it('SubmitTextProposal Test', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
54
|
-
var
|
|
122
|
+
var initialDepositFCT, title, description, result;
|
|
55
123
|
return __generator(this, function (_a) {
|
|
56
124
|
switch (_a.label) {
|
|
57
|
-
case 0:
|
|
58
|
-
|
|
59
|
-
wallet = _a.sent();
|
|
60
|
-
initialDepositFCT = 10;
|
|
125
|
+
case 0:
|
|
126
|
+
initialDepositFCT = 2500;
|
|
61
127
|
title = "test submit proposal";
|
|
62
128
|
description = "test description";
|
|
63
|
-
return [4 /*yield*/, firma.Gov.submitTextProposal(
|
|
64
|
-
case
|
|
129
|
+
return [4 /*yield*/, firma.Gov.submitTextProposal(aliceWallet, title, description, initialDepositFCT)];
|
|
130
|
+
case 1:
|
|
65
131
|
result = _a.sent();
|
|
66
|
-
console.log(result);
|
|
67
132
|
chai_1.expect(result.code).to.equal(0);
|
|
68
133
|
return [2 /*return*/];
|
|
69
134
|
}
|
|
70
135
|
});
|
|
71
136
|
}); });
|
|
72
|
-
it('SubmitCommunityPoolSpendProposal Test', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
73
|
-
var
|
|
137
|
+
it.skip('SubmitCommunityPoolSpendProposal Test', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
138
|
+
var initialDepositFCT, title, description, amount, recipient, result;
|
|
74
139
|
return __generator(this, function (_a) {
|
|
75
140
|
switch (_a.label) {
|
|
76
|
-
case 0:
|
|
77
|
-
case 1:
|
|
78
|
-
aliceWallet = _a.sent();
|
|
79
|
-
return [4 /*yield*/, firma.Wallet.fromMnemonic(config_test_1.bobMnemonic)];
|
|
80
|
-
case 2:
|
|
81
|
-
bobWallet = _a.sent();
|
|
141
|
+
case 0:
|
|
82
142
|
initialDepositFCT = 10;
|
|
83
143
|
title = "Community spend proposal1";
|
|
84
144
|
description = "This is a community spend proposal";
|
|
85
145
|
amount = 1000;
|
|
86
|
-
|
|
87
|
-
case 3:
|
|
88
|
-
recipient = _a.sent();
|
|
146
|
+
recipient = bobAddress;
|
|
89
147
|
return [4 /*yield*/, firma.Gov.submitCommunityPoolSpendProposal(aliceWallet, title, description, initialDepositFCT, amount, recipient)];
|
|
90
|
-
case
|
|
148
|
+
case 1:
|
|
91
149
|
result = _a.sent();
|
|
92
|
-
console.log(result);
|
|
93
150
|
chai_1.expect(result.code).to.equal(0);
|
|
94
151
|
return [2 /*return*/];
|
|
95
152
|
}
|
|
96
153
|
});
|
|
97
154
|
}); });
|
|
98
|
-
it('SubmitParameterChangeProposal Test', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
99
|
-
var
|
|
155
|
+
it.skip('SubmitParameterChangeProposal Test', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
156
|
+
var initialDepositFCT, title, description, changeParamList, result;
|
|
100
157
|
return __generator(this, function (_a) {
|
|
101
158
|
switch (_a.label) {
|
|
102
|
-
case 0:
|
|
103
|
-
case 1:
|
|
104
|
-
aliceWallet = _a.sent();
|
|
159
|
+
case 0:
|
|
105
160
|
initialDepositFCT = 10;
|
|
106
161
|
title = "Parameter Change proposal1";
|
|
107
162
|
description = "This is a Parameter change proposal";
|
|
@@ -111,60 +166,86 @@ describe.skip('[16. Gov Tx Test]', function () {
|
|
|
111
166
|
value: "100",
|
|
112
167
|
}];
|
|
113
168
|
return [4 /*yield*/, firma.Gov.submitParameterChangeProposal(aliceWallet, title, description, initialDepositFCT, changeParamList)];
|
|
114
|
-
case
|
|
169
|
+
case 1:
|
|
115
170
|
result = _a.sent();
|
|
116
|
-
console.log(result);
|
|
117
171
|
chai_1.expect(result.code).to.equal(0);
|
|
118
172
|
return [2 /*return*/];
|
|
119
173
|
}
|
|
120
174
|
});
|
|
121
175
|
}); });
|
|
122
|
-
|
|
123
|
-
|
|
176
|
+
// This unit test needs specific option setup, so it’s skipped by default.
|
|
177
|
+
it.skip('SubmitSoftwareUpgradeProposalByHeight Test', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
178
|
+
var initialDepositFCT, title, description, upgradeName, upgradeHeight, gas, fee, result;
|
|
124
179
|
return __generator(this, function (_a) {
|
|
125
180
|
switch (_a.label) {
|
|
126
|
-
case 0:
|
|
181
|
+
case 0:
|
|
182
|
+
initialDepositFCT = 5000;
|
|
183
|
+
title = "FIRMACHAIN v0.5.0 Upgrade";
|
|
184
|
+
description = "## OVERVIEW\nThis is a proposal on FIRMACHAIN Software Upgrade(v0.5.0-alpha1).\n\nneed form (comment)\n\nOnce this proposal passes, the FIRMACHAIN network will be upgraded at block height [xxx,xxx].\n\n## Upgrade features\nFollowing are the details of this upgrade. \n - Cosmos SDK : v0.45.9 -> v0.50.12\n - CometBFT : v0.34.21 -> v0.38.17\n - Chain Binary : v0.4.0 -> v0.5.0\n - IBC-go(IBC) : v4.4.0 -> v8.6.1\n - Wasmd : v0.29.2 -> v0.54.0\n - New Governance parameters\n\t - MinInitialDepositRatio : 0.5\n\t - ProposalCancelRatio : 0.5\n\n## Timeline\nneed form (comment)\n\nIf we are faced with any problems during the upgrade, a hasty and swift communication via Discord is necessary to solve the issue.\nAny FIRMACHAIN Validator who hasn't joined our Discord channel must contact us at contact@firmachain.org before this Software Upgrade.\n\n## Actions required by node operators\nOnce this proposal passes and when the block height reaches xxxxx, any block creation activity on the FIRMACHAIN (Colosseum-1) network will be halted. \nAll Validators must upgrade using the manual binary switch or the Cosmovisor in order to conduct the FIRMACHAIN Software Upgrade.\n\nFor a more detailed upgrade guide, please visit https://github.com/FirmaChain/mainnet/blob/main/docs/upgrade-notes-v0.5.0.md";
|
|
185
|
+
upgradeName = "v0.5.0";
|
|
186
|
+
upgradeHeight = 558800;
|
|
187
|
+
return [4 /*yield*/, firma.Gov.getGasEstimationSubmitSoftwareUpgradeProposalByHeight(aliceWallet, title, description, initialDepositFCT, upgradeName, upgradeHeight)];
|
|
127
188
|
case 1:
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
title
|
|
131
|
-
description = "This is a software upgrade proposal";
|
|
132
|
-
upgradeName = "v0.2.7";
|
|
133
|
-
upgradeHeight = 20000000;
|
|
134
|
-
return [4 /*yield*/, firma.Gov.submitSoftwareUpgradeProposalByHeight(aliceWallet, title, description, initialDepositFCT, upgradeName, upgradeHeight)];
|
|
189
|
+
gas = _a.sent();
|
|
190
|
+
fee = Math.ceil(gas * 0.1);
|
|
191
|
+
return [4 /*yield*/, firma.Gov.submitSoftwareUpgradeProposalByHeight(aliceWallet, title, description, initialDepositFCT, upgradeName, upgradeHeight, { gas: gas, fee: fee })];
|
|
135
192
|
case 2:
|
|
136
193
|
result = _a.sent();
|
|
137
|
-
console.log(result);
|
|
138
194
|
chai_1.expect(result.code).to.equal(0);
|
|
139
195
|
return [2 /*return*/];
|
|
140
196
|
}
|
|
141
197
|
});
|
|
142
198
|
}); });
|
|
143
|
-
|
|
144
|
-
|
|
199
|
+
// This unit test needs specific option setup, so it’s skipped by default.
|
|
200
|
+
it.skip('SubmitCancelSoftwareUpgradeProposal Test', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
201
|
+
var initialDepositFCT, title, description, result;
|
|
145
202
|
return __generator(this, function (_a) {
|
|
146
203
|
switch (_a.label) {
|
|
147
|
-
case 0:
|
|
148
|
-
case 1:
|
|
149
|
-
aliceWallet = _a.sent();
|
|
204
|
+
case 0:
|
|
150
205
|
initialDepositFCT = 1000;
|
|
151
206
|
title = "Software Upgrade proposal1";
|
|
152
207
|
description = "This is a software upgrade proposal";
|
|
153
208
|
return [4 /*yield*/, firma.Gov.submitCancelSoftwareUpgradeProposal(aliceWallet, title, description, initialDepositFCT)];
|
|
154
|
-
case
|
|
209
|
+
case 1:
|
|
155
210
|
result = _a.sent();
|
|
156
|
-
console.log(result);
|
|
157
211
|
chai_1.expect(result.code).to.equal(0);
|
|
158
212
|
return [2 /*return*/];
|
|
159
213
|
}
|
|
160
214
|
});
|
|
161
215
|
}); });
|
|
216
|
+
it('SubmitTextProposal & CancelProposal Test', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
217
|
+
var initialDeposit, title, description, gas, fee, result, proposal_id;
|
|
218
|
+
return __generator(this, function (_a) {
|
|
219
|
+
switch (_a.label) {
|
|
220
|
+
case 0:
|
|
221
|
+
initialDeposit = 5000;
|
|
222
|
+
title = "CancelProposal test proposal";
|
|
223
|
+
description = "This is a Text & CancelProposal";
|
|
224
|
+
return [4 /*yield*/, firma.Gov.getGasEstimationSubmitTextProposal(aliceWallet, title, description, initialDeposit)];
|
|
225
|
+
case 1:
|
|
226
|
+
gas = _a.sent();
|
|
227
|
+
fee = Math.ceil(gas * 0.1);
|
|
228
|
+
return [4 /*yield*/, firma.Gov.submitTextProposal(aliceWallet, title, description, initialDeposit, { gas: gas, fee: fee })];
|
|
229
|
+
case 2:
|
|
230
|
+
result = _a.sent();
|
|
231
|
+
proposal_id = extractValue(result.events, "submit_proposal", "proposal_id");
|
|
232
|
+
chai_1.expect(result.code).to.be.equal(0);
|
|
233
|
+
return [4 /*yield*/, firma.Gov.getGasEstimationCancelProposal(aliceWallet, proposal_id)];
|
|
234
|
+
case 3:
|
|
235
|
+
// CancelProposal
|
|
236
|
+
gas = _a.sent();
|
|
237
|
+
fee = Math.ceil(gas * 0.1);
|
|
238
|
+
return [4 /*yield*/, firma.Gov.cancelProposal(aliceWallet, proposal_id, { gas: gas, fee: fee })];
|
|
239
|
+
case 4:
|
|
240
|
+
result = _a.sent();
|
|
241
|
+
chai_1.expect(result.code).to.be.equal(0);
|
|
242
|
+
return [2 /*return*/];
|
|
243
|
+
}
|
|
244
|
+
});
|
|
245
|
+
}); });
|
|
162
246
|
// NOTICE: time-based upgrades have been deprecated in the SDK: invalid request
|
|
163
247
|
/*it.skip('SubmitSoftwareUpgradeProposalByTime Test', async () => {
|
|
164
248
|
|
|
165
|
-
const aliceWallet = await firma.Wallet.fromMnemonic(aliceMnemonic);
|
|
166
|
-
const bobWallet = await firma.Wallet.fromMnemonic(bobMnemonic);
|
|
167
|
-
|
|
168
249
|
const initialDepositFCT = 8;
|
|
169
250
|
const title = "Software Upgrade proposal2";
|
|
170
251
|
const description = "This is a software upgrade proposal";
|
|
@@ -182,59 +263,49 @@ describe.skip('[16. Gov Tx Test]', function () {
|
|
|
182
263
|
expect(result.code).to.equal(0);
|
|
183
264
|
});*/
|
|
184
265
|
// TODO: get recent gov proposal list and then set proposalId for below case
|
|
185
|
-
var tempProposalId =
|
|
266
|
+
var tempProposalId = 15;
|
|
186
267
|
// more deposit after initial deposit case
|
|
187
|
-
it('Deposit OK', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
188
|
-
var
|
|
268
|
+
it.skip('Deposit OK', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
269
|
+
var proposalId, amount, result;
|
|
189
270
|
return __generator(this, function (_a) {
|
|
190
271
|
switch (_a.label) {
|
|
191
|
-
case 0:
|
|
192
|
-
case 1:
|
|
193
|
-
wallet = _a.sent();
|
|
272
|
+
case 0:
|
|
194
273
|
proposalId = tempProposalId;
|
|
195
|
-
amount =
|
|
196
|
-
return [4 /*yield*/, firma.Gov.deposit(
|
|
197
|
-
case
|
|
274
|
+
amount = 2500;
|
|
275
|
+
return [4 /*yield*/, firma.Gov.deposit(aliceWallet, proposalId, amount)];
|
|
276
|
+
case 1:
|
|
198
277
|
result = _a.sent();
|
|
199
|
-
//console.log(result);
|
|
200
278
|
chai_1.expect(result.code).to.equal(0);
|
|
201
279
|
return [2 /*return*/];
|
|
202
280
|
}
|
|
203
281
|
});
|
|
204
282
|
}); });
|
|
205
|
-
it('Vote - alice YES', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
206
|
-
var
|
|
283
|
+
it.skip('Vote - alice YES', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
284
|
+
var proposalId, result;
|
|
207
285
|
return __generator(this, function (_a) {
|
|
208
286
|
switch (_a.label) {
|
|
209
|
-
case 0:
|
|
210
|
-
case 1:
|
|
211
|
-
wallet = _a.sent();
|
|
287
|
+
case 0:
|
|
212
288
|
proposalId = tempProposalId;
|
|
213
|
-
return [4 /*yield*/, firma.Gov.vote(
|
|
214
|
-
case
|
|
289
|
+
return [4 /*yield*/, firma.Gov.vote(aliceWallet, proposalId, common_1.VotingOption.VOTE_OPTION_YES)];
|
|
290
|
+
case 1:
|
|
215
291
|
result = _a.sent();
|
|
216
|
-
//console.log(result);
|
|
217
292
|
chai_1.expect(result.code).to.equal(0);
|
|
218
293
|
return [2 /*return*/];
|
|
219
294
|
}
|
|
220
295
|
});
|
|
221
296
|
}); });
|
|
222
|
-
it('Vote - bob NO', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
223
|
-
var
|
|
297
|
+
it.skip('Vote - bob NO', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
298
|
+
var proposalId, result;
|
|
224
299
|
return __generator(this, function (_a) {
|
|
225
300
|
switch (_a.label) {
|
|
226
|
-
case 0:
|
|
227
|
-
case 1:
|
|
228
|
-
wallet = _a.sent();
|
|
301
|
+
case 0:
|
|
229
302
|
proposalId = tempProposalId;
|
|
230
|
-
return [4 /*yield*/, firma.Gov.vote(
|
|
231
|
-
case
|
|
303
|
+
return [4 /*yield*/, firma.Gov.vote(bobWallet, proposalId, common_1.VotingOption.VOTE_OPTION_NO)];
|
|
304
|
+
case 1:
|
|
232
305
|
result = _a.sent();
|
|
233
|
-
//console.log(result);
|
|
234
306
|
chai_1.expect(result.code).to.equal(0);
|
|
235
307
|
return [2 /*return*/];
|
|
236
308
|
}
|
|
237
309
|
});
|
|
238
310
|
}); });
|
|
239
|
-
// TODO: more voting case need it!
|
|
240
311
|
});
|
|
@@ -36,6 +36,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
36
36
|
}
|
|
37
37
|
};
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
var chai_1 = require("chai");
|
|
39
40
|
var gov_1 = require("../sdk/firmachain/gov");
|
|
40
41
|
var FirmaSDK_1 = require("../sdk/FirmaSDK");
|
|
41
42
|
var config_test_1 = require("./config_test");
|
|
@@ -47,12 +48,14 @@ describe('[17. Gov Query Test]', function () {
|
|
|
47
48
|
it('get getProposalList', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
48
49
|
var proposalList;
|
|
49
50
|
return __generator(this, function (_a) {
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
51
|
+
proposalList = [];
|
|
52
|
+
if (proposalList.length > 0) {
|
|
53
|
+
chai_1.expect(proposalList[0].proposal_id).to.not.equal('');
|
|
54
|
+
}
|
|
55
|
+
else {
|
|
56
|
+
chai_1.expect(proposalList).to.be.deep.equal([]);
|
|
55
57
|
}
|
|
58
|
+
return [2 /*return*/];
|
|
56
59
|
});
|
|
57
60
|
}); });
|
|
58
61
|
it('get getProposalListByStatus', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
@@ -64,6 +67,14 @@ describe('[17. Gov Query Test]', function () {
|
|
|
64
67
|
return [4 /*yield*/, firma.Gov.getProposalListByStatus(status)];
|
|
65
68
|
case 1:
|
|
66
69
|
proposalList = _a.sent();
|
|
70
|
+
chai_1.expect(proposalList).to.be.an('array');
|
|
71
|
+
if (proposalList.length > 0) {
|
|
72
|
+
chai_1.expect(proposalList[0]).to.have.property('proposal_id');
|
|
73
|
+
chai_1.expect(proposalList[0].proposal_id).to.not.equal('');
|
|
74
|
+
}
|
|
75
|
+
else {
|
|
76
|
+
chai_1.expect(proposalList).to.have.lengthOf(0);
|
|
77
|
+
}
|
|
67
78
|
return [2 /*return*/];
|
|
68
79
|
}
|
|
69
80
|
});
|
|
@@ -80,8 +91,14 @@ describe('[17. Gov Query Test]', function () {
|
|
|
80
91
|
return [4 /*yield*/, firma.Gov.getProposal(id)];
|
|
81
92
|
case 2:
|
|
82
93
|
proposal = _a.sent();
|
|
83
|
-
|
|
84
|
-
|
|
94
|
+
chai_1.expect(proposal).to.be.an('object');
|
|
95
|
+
chai_1.expect(proposal).to.have.property('proposal_id');
|
|
96
|
+
chai_1.expect(proposal.proposal_id).to.equal(id);
|
|
97
|
+
return [3 /*break*/, 4];
|
|
98
|
+
case 3:
|
|
99
|
+
chai_1.expect(proposalList).to.have.lengthOf(0);
|
|
100
|
+
_a.label = 4;
|
|
101
|
+
case 4: return [2 /*return*/];
|
|
85
102
|
}
|
|
86
103
|
});
|
|
87
104
|
}); });
|
|
@@ -93,6 +110,20 @@ describe('[17. Gov Query Test]', function () {
|
|
|
93
110
|
case 0: return [4 /*yield*/, firma.Gov.getParam()];
|
|
94
111
|
case 1:
|
|
95
112
|
param = _a.sent();
|
|
113
|
+
chai_1.expect(param).to.be.an('object');
|
|
114
|
+
chai_1.expect(param).to.have.property('voting_period');
|
|
115
|
+
chai_1.expect(param).to.have.property('deposit_params');
|
|
116
|
+
chai_1.expect(param.deposit_params).to.have.property('min_deposit');
|
|
117
|
+
chai_1.expect(param.deposit_params).to.have.property('max_deposit_period');
|
|
118
|
+
chai_1.expect(param.deposit_params.min_deposit).to.be.an('array');
|
|
119
|
+
if (param.deposit_params.min_deposit.length > 0) {
|
|
120
|
+
chai_1.expect(param.deposit_params.min_deposit[0]).to.have.property('denom');
|
|
121
|
+
chai_1.expect(param.deposit_params.min_deposit[0]).to.have.property('amount');
|
|
122
|
+
}
|
|
123
|
+
chai_1.expect(param).to.have.property('tally_params');
|
|
124
|
+
chai_1.expect(param.tally_params).to.have.property('quorum');
|
|
125
|
+
chai_1.expect(param.tally_params).to.have.property('threshold');
|
|
126
|
+
chai_1.expect(param.tally_params).to.have.property('veto_threshold');
|
|
96
127
|
return [2 /*return*/];
|
|
97
128
|
}
|
|
98
129
|
});
|
|
@@ -110,8 +141,16 @@ describe('[17. Gov Query Test]', function () {
|
|
|
110
141
|
return [4 /*yield*/, firma.Gov.getCurrentVoteInfo(proposalId)];
|
|
111
142
|
case 2:
|
|
112
143
|
param = _a.sent();
|
|
113
|
-
|
|
114
|
-
|
|
144
|
+
chai_1.expect(param).to.be.an('object');
|
|
145
|
+
chai_1.expect(param).to.have.property('yes');
|
|
146
|
+
chai_1.expect(param).to.have.property('abstain');
|
|
147
|
+
chai_1.expect(param).to.have.property('no');
|
|
148
|
+
chai_1.expect(param).to.have.property('no_with_veto');
|
|
149
|
+
return [3 /*break*/, 4];
|
|
150
|
+
case 3:
|
|
151
|
+
chai_1.expect(proposalList).to.have.lengthOf(0);
|
|
152
|
+
_a.label = 4;
|
|
153
|
+
case 4: return [2 /*return*/];
|
|
115
154
|
}
|
|
116
155
|
});
|
|
117
156
|
}); });
|
|
@@ -38,7 +38,13 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
39
|
var chai_1 = require("chai");
|
|
40
40
|
var FirmaUtil_1 = require("../sdk/FirmaUtil");
|
|
41
|
+
var FirmaSDK_1 = require("../sdk/FirmaSDK");
|
|
42
|
+
var config_test_1 = require("./config_test");
|
|
41
43
|
describe('[18. util Test]', function () {
|
|
44
|
+
var firma;
|
|
45
|
+
beforeEach(function () {
|
|
46
|
+
firma = new FirmaSDK_1.FirmaSDK(config_test_1.TestChainConfig);
|
|
47
|
+
});
|
|
42
48
|
// getHashFromString
|
|
43
49
|
it('getSha1HashFromString test', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
44
50
|
var contractName, result;
|
|
@@ -89,7 +95,6 @@ describe('[18. util Test]', function () {
|
|
|
89
95
|
consensusPubkey = "InWhZBMP3wKQkwIBCrVqQ+BNoPhV5mTjpwiYHKHCZ/k=";
|
|
90
96
|
valconsAddress = "firmavalcons1fh73gr3f9df7yc390ykdnmeedetlw5ll3dqwje";
|
|
91
97
|
result = FirmaUtil_1.FirmaUtil.getValConsAddressFromAccAddress(consensusPubkey);
|
|
92
|
-
//console.log(result);
|
|
93
98
|
chai_1.expect(result).to.be.equal(valconsAddress);
|
|
94
99
|
return [2 /*return*/];
|
|
95
100
|
});
|
|
@@ -36,6 +36,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
36
36
|
}
|
|
37
37
|
};
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
var chai_1 = require("chai");
|
|
39
40
|
var FirmaSDK_1 = require("../sdk/FirmaSDK");
|
|
40
41
|
var config_test_1 = require("./config_test");
|
|
41
42
|
describe('[19. chain Test]', function () {
|
|
@@ -50,20 +51,59 @@ describe('[19. chain Test]', function () {
|
|
|
50
51
|
case 0: return [4 /*yield*/, firma.BlockChain.getChainSyncInfo()];
|
|
51
52
|
case 1:
|
|
52
53
|
result = _a.sent();
|
|
54
|
+
chai_1.expect(result).to.be.an('object');
|
|
55
|
+
chai_1.expect(result).to.have.property('latest_block_hash');
|
|
56
|
+
chai_1.expect(result).to.have.property('latest_app_hash');
|
|
57
|
+
chai_1.expect(result).to.have.property('latest_block_height');
|
|
58
|
+
chai_1.expect(result).to.have.property('latest_block_time');
|
|
59
|
+
chai_1.expect(result).to.have.property('earliest_block_hash');
|
|
60
|
+
chai_1.expect(result).to.have.property('earliest_app_hash');
|
|
61
|
+
chai_1.expect(result).to.have.property('earliest_block_height');
|
|
62
|
+
chai_1.expect(result).to.have.property('earliest_block_time');
|
|
63
|
+
chai_1.expect(result).to.have.property('catching_up');
|
|
64
|
+
chai_1.expect(parseInt(result.latest_block_height)).to.be.a('number');
|
|
65
|
+
chai_1.expect(parseInt(result.earliest_block_height)).to.be.a('number');
|
|
66
|
+
chai_1.expect(parseInt(result.latest_block_height)).to.be.greaterThan(0);
|
|
67
|
+
chai_1.expect(parseInt(result.earliest_block_height)).to.be.greaterThan(0);
|
|
53
68
|
return [2 /*return*/];
|
|
54
69
|
}
|
|
55
70
|
});
|
|
56
71
|
}); });
|
|
57
|
-
|
|
58
|
-
|
|
72
|
+
// This test requires a meaningful transaction hash, so it is skipped by default.
|
|
73
|
+
it('getTransactionByHash test', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
74
|
+
var txHash, result, error_1;
|
|
59
75
|
return __generator(this, function (_a) {
|
|
60
76
|
switch (_a.label) {
|
|
61
77
|
case 0:
|
|
62
78
|
txHash = "0x5DA9D094D15660D21947C9EEF1329CCB70117E7BCD3A451F27E5C7AFF5DB6DF0";
|
|
63
|
-
|
|
79
|
+
_a.label = 1;
|
|
64
80
|
case 1:
|
|
81
|
+
_a.trys.push([1, 3, , 4]);
|
|
82
|
+
return [4 /*yield*/, firma.BlockChain.getTransactionByHash(txHash)];
|
|
83
|
+
case 2:
|
|
65
84
|
result = _a.sent();
|
|
66
|
-
|
|
85
|
+
chai_1.expect(result).to.have.property('hash');
|
|
86
|
+
chai_1.expect(result).to.have.property('height');
|
|
87
|
+
chai_1.expect(result).to.have.property('index');
|
|
88
|
+
chai_1.expect(result).to.have.property('tx_result');
|
|
89
|
+
chai_1.expect(result).to.have.property('tx');
|
|
90
|
+
chai_1.expect(result.hash).to.equal(txHash);
|
|
91
|
+
chai_1.expect(parseInt(result.height)).to.be.greaterThan(0);
|
|
92
|
+
chai_1.expect(result.index).to.be.greaterThanOrEqual(0);
|
|
93
|
+
chai_1.expect(result.tx_result).to.have.property('code');
|
|
94
|
+
chai_1.expect(result.tx_result).to.have.property('data');
|
|
95
|
+
chai_1.expect(result.tx_result).to.have.property('log');
|
|
96
|
+
chai_1.expect(result.tx_result).to.have.property('info');
|
|
97
|
+
chai_1.expect(result.tx_result).to.have.property('gas_wanted');
|
|
98
|
+
chai_1.expect(result.tx_result).to.have.property('gas_used');
|
|
99
|
+
chai_1.expect(result.tx_result).to.have.property('events');
|
|
100
|
+
chai_1.expect(result.tx_result).to.have.property('codespace');
|
|
101
|
+
return [3 /*break*/, 4];
|
|
102
|
+
case 3:
|
|
103
|
+
error_1 = _a.sent();
|
|
104
|
+
chai_1.expect(error_1).to.exist;
|
|
105
|
+
return [3 /*break*/, 4];
|
|
106
|
+
case 4: return [2 /*return*/];
|
|
67
107
|
}
|
|
68
108
|
});
|
|
69
109
|
}); });
|
|
@@ -74,6 +114,12 @@ describe('[19. chain Test]', function () {
|
|
|
74
114
|
case 0: return [4 /*yield*/, firma.BlockChain.getChainInfo()];
|
|
75
115
|
case 1:
|
|
76
116
|
result = _a.sent();
|
|
117
|
+
chai_1.expect(result).to.have.property('chainId');
|
|
118
|
+
chai_1.expect(result).to.have.property('appVersion');
|
|
119
|
+
chai_1.expect(result).to.have.property('cosmosVersion');
|
|
120
|
+
chai_1.expect(result.chainId).to.not.be.empty;
|
|
121
|
+
chai_1.expect(result.appVersion).to.not.be.empty;
|
|
122
|
+
chai_1.expect(result.cosmosVersion).to.not.be.empty;
|
|
77
123
|
return [2 /*return*/];
|
|
78
124
|
}
|
|
79
125
|
});
|
|
@@ -36,6 +36,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
36
36
|
}
|
|
37
37
|
};
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
var chai_1 = require("chai");
|
|
39
40
|
var FirmaSDK_1 = require("../sdk/FirmaSDK");
|
|
40
41
|
var config_test_1 = require("./config_test");
|
|
41
42
|
describe('[20. Slashing Query Test]', function () {
|
|
@@ -50,6 +51,16 @@ describe('[20. Slashing Query Test]', function () {
|
|
|
50
51
|
case 0: return [4 /*yield*/, firma.Slashing.getSlashingParam()];
|
|
51
52
|
case 1:
|
|
52
53
|
result = _a.sent();
|
|
54
|
+
chai_1.expect(result).to.have.property('signed_blocks_window');
|
|
55
|
+
chai_1.expect(result).to.have.property('min_signed_per_window');
|
|
56
|
+
chai_1.expect(result).to.have.property('downtime_jail_duration');
|
|
57
|
+
chai_1.expect(result).to.have.property('slash_fraction_double_sign');
|
|
58
|
+
chai_1.expect(result).to.have.property('slash_fraction_downtime');
|
|
59
|
+
chai_1.expect(result.signed_blocks_window).to.not.be.empty;
|
|
60
|
+
chai_1.expect(result.min_signed_per_window).to.not.be.empty;
|
|
61
|
+
chai_1.expect(result.downtime_jail_duration).to.not.be.empty;
|
|
62
|
+
chai_1.expect(result.slash_fraction_double_sign).to.not.be.empty;
|
|
63
|
+
chai_1.expect(result.slash_fraction_downtime).to.not.be.empty;
|
|
53
64
|
return [2 /*return*/];
|
|
54
65
|
}
|
|
55
66
|
});
|
|
@@ -61,6 +72,16 @@ describe('[20. Slashing Query Test]', function () {
|
|
|
61
72
|
case 0: return [4 /*yield*/, firma.Slashing.getSigningInfos()];
|
|
62
73
|
case 1:
|
|
63
74
|
result = _a.sent();
|
|
75
|
+
if (result.length > 0) {
|
|
76
|
+
chai_1.expect(result[0]).to.have.property('address');
|
|
77
|
+
chai_1.expect(result[0]).to.have.property('start_height');
|
|
78
|
+
chai_1.expect(result[0]).to.have.property('index_offset');
|
|
79
|
+
chai_1.expect(result[0]).to.have.property('jailed_until');
|
|
80
|
+
chai_1.expect(result[0]).to.have.property('tombstoned');
|
|
81
|
+
chai_1.expect(result[0]).to.have.property('missed_blocks_counter');
|
|
82
|
+
// address가 비어있지 않은지 확인
|
|
83
|
+
chai_1.expect(result[0].address).to.not.be.empty;
|
|
84
|
+
}
|
|
64
85
|
return [2 /*return*/];
|
|
65
86
|
}
|
|
66
87
|
});
|
|
@@ -72,10 +93,19 @@ describe('[20. Slashing Query Test]', function () {
|
|
|
72
93
|
case 0: return [4 /*yield*/, firma.Slashing.getSigningInfos()];
|
|
73
94
|
case 1:
|
|
74
95
|
infos = _a.sent();
|
|
96
|
+
if (!(infos.length > 0)) return [3 /*break*/, 3];
|
|
75
97
|
return [4 /*yield*/, firma.Slashing.getSigningInfo(infos[0].address)];
|
|
76
98
|
case 2:
|
|
77
99
|
result = _a.sent();
|
|
78
|
-
|
|
100
|
+
chai_1.expect(result).to.have.property('address');
|
|
101
|
+
chai_1.expect(result).to.have.property('start_height');
|
|
102
|
+
chai_1.expect(result).to.have.property('index_offset');
|
|
103
|
+
chai_1.expect(result).to.have.property('jailed_until');
|
|
104
|
+
chai_1.expect(result).to.have.property('tombstoned');
|
|
105
|
+
chai_1.expect(result).to.have.property('missed_blocks_counter');
|
|
106
|
+
chai_1.expect(result.address).to.equal(infos[0].address);
|
|
107
|
+
_a.label = 3;
|
|
108
|
+
case 3: return [2 /*return*/];
|
|
79
109
|
}
|
|
80
110
|
});
|
|
81
111
|
}); });
|