@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
|
@@ -36,7 +36,9 @@ 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");
|
|
41
|
+
var FirmaUtil_1 = require("../sdk/FirmaUtil");
|
|
40
42
|
var config_test_1 = require("./config_test");
|
|
41
43
|
describe('[13. Staking Query Test]', function () {
|
|
42
44
|
var firma;
|
|
@@ -50,6 +52,7 @@ describe('[13. Staking Query Test]', function () {
|
|
|
50
52
|
case 0: return [4 /*yield*/, firma.Staking.getValidatorList()];
|
|
51
53
|
case 1:
|
|
52
54
|
result = _a.sent();
|
|
55
|
+
chai_1.expect(result.dataList.length > 0).to.be.equal(true);
|
|
53
56
|
return [2 /*return*/];
|
|
54
57
|
}
|
|
55
58
|
});
|
|
@@ -64,6 +67,7 @@ describe('[13. Staking Query Test]', function () {
|
|
|
64
67
|
return [4 /*yield*/, firma.Staking.getValidator(validatorList[0].operator_address)];
|
|
65
68
|
case 2:
|
|
66
69
|
result = _a.sent();
|
|
70
|
+
chai_1.expect(FirmaUtil_1.FirmaUtil.isValidAddress(result.operator_address)).to.be.equal(true);
|
|
67
71
|
return [2 /*return*/];
|
|
68
72
|
}
|
|
69
73
|
});
|
|
@@ -78,6 +82,12 @@ describe('[13. Staking Query Test]', function () {
|
|
|
78
82
|
return [4 /*yield*/, firma.Staking.getDelegationListFromValidator(validatorList[0].operator_address)];
|
|
79
83
|
case 2:
|
|
80
84
|
result = _a.sent();
|
|
85
|
+
if (result.dataList.length > 0) {
|
|
86
|
+
chai_1.expect(result.dataList[0].balance).to.not.equal("");
|
|
87
|
+
}
|
|
88
|
+
else {
|
|
89
|
+
chai_1.expect(true).to.be.equal(true);
|
|
90
|
+
}
|
|
81
91
|
return [2 /*return*/];
|
|
82
92
|
}
|
|
83
93
|
});
|
|
@@ -92,6 +102,12 @@ describe('[13. Staking Query Test]', function () {
|
|
|
92
102
|
return [4 /*yield*/, firma.Staking.getUndelegationListFromValidator(validatorList[0].operator_address)];
|
|
93
103
|
case 2:
|
|
94
104
|
result = _a.sent();
|
|
105
|
+
if (result.dataList.length > 0) {
|
|
106
|
+
chai_1.expect(FirmaUtil_1.FirmaUtil.isValidAddress(result.dataList[0].delegator_address)).to.be.equal(true);
|
|
107
|
+
}
|
|
108
|
+
else {
|
|
109
|
+
chai_1.expect(true).to.be.equal(true);
|
|
110
|
+
}
|
|
95
111
|
return [2 /*return*/];
|
|
96
112
|
}
|
|
97
113
|
});
|
|
@@ -104,6 +120,7 @@ describe('[13. Staking Query Test]', function () {
|
|
|
104
120
|
case 0: return [4 /*yield*/, firma.Staking.getPool()];
|
|
105
121
|
case 1:
|
|
106
122
|
result = _a.sent();
|
|
123
|
+
chai_1.expect(result.bonded_tokens).to.not.equal("");
|
|
107
124
|
return [2 /*return*/];
|
|
108
125
|
}
|
|
109
126
|
});
|
|
@@ -115,6 +132,7 @@ describe('[13. Staking Query Test]', function () {
|
|
|
115
132
|
case 0: return [4 /*yield*/, firma.Staking.getParams()];
|
|
116
133
|
case 1:
|
|
117
134
|
result = _a.sent();
|
|
135
|
+
chai_1.expect(result.max_validators).to.not.equal(0);
|
|
118
136
|
return [2 /*return*/];
|
|
119
137
|
}
|
|
120
138
|
});
|
|
@@ -132,6 +150,12 @@ describe('[13. Staking Query Test]', function () {
|
|
|
132
150
|
case 2: return [4 /*yield*/, _b.apply(_a, [_c.sent()])];
|
|
133
151
|
case 3:
|
|
134
152
|
result = _c.sent();
|
|
153
|
+
if (result.dataList.length > 0) {
|
|
154
|
+
chai_1.expect(result.dataList[0].balance).to.not.equal("");
|
|
155
|
+
}
|
|
156
|
+
else {
|
|
157
|
+
chai_1.expect(true).to.be.equal(true);
|
|
158
|
+
}
|
|
135
159
|
return [2 /*return*/];
|
|
136
160
|
}
|
|
137
161
|
});
|
|
@@ -148,6 +172,12 @@ describe('[13. Staking Query Test]', function () {
|
|
|
148
172
|
case 2: return [4 /*yield*/, _b.apply(_a, [_c.sent()])];
|
|
149
173
|
case 3:
|
|
150
174
|
result = _c.sent();
|
|
175
|
+
if (result.length > 0) {
|
|
176
|
+
chai_1.expect(FirmaUtil_1.FirmaUtil.isValidAddress(result[0].redelegation.delegator_address)).to.be.equal(true);
|
|
177
|
+
}
|
|
178
|
+
else {
|
|
179
|
+
chai_1.expect(true).to.be.equal(true);
|
|
180
|
+
}
|
|
151
181
|
return [2 /*return*/];
|
|
152
182
|
}
|
|
153
183
|
});
|
|
@@ -164,31 +194,46 @@ describe('[13. Staking Query Test]', function () {
|
|
|
164
194
|
case 2: return [4 /*yield*/, _b.apply(_a, [_c.sent()])];
|
|
165
195
|
case 3:
|
|
166
196
|
result = _c.sent();
|
|
197
|
+
if (result.length > 0) {
|
|
198
|
+
chai_1.expect(FirmaUtil_1.FirmaUtil.isValidAddress(result[0].delegator_address)).to.be.equal(true);
|
|
199
|
+
}
|
|
200
|
+
else {
|
|
201
|
+
chai_1.expect(true).to.be.equal(true);
|
|
202
|
+
}
|
|
167
203
|
return [2 /*return*/];
|
|
168
204
|
}
|
|
169
205
|
});
|
|
170
206
|
}); });
|
|
171
207
|
it('10.get userside getDelegationInfoFromValidator', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
172
|
-
var
|
|
208
|
+
var wallet, validatorList, result, _a, _b, error_1;
|
|
173
209
|
return __generator(this, function (_c) {
|
|
174
210
|
switch (_c.label) {
|
|
175
|
-
case 0: return [4 /*yield*/, firma.
|
|
211
|
+
case 0: return [4 /*yield*/, firma.Wallet.fromMnemonic(config_test_1.aliceMnemonic)];
|
|
176
212
|
case 1:
|
|
177
|
-
validatorList = (_c.sent()).dataList;
|
|
178
|
-
return [4 /*yield*/, firma.Wallet.fromMnemonic(config_test_1.aliceMnemonic)];
|
|
179
|
-
case 2:
|
|
180
213
|
wallet = _c.sent();
|
|
214
|
+
return [4 /*yield*/, firma.Staking.getValidatorList()];
|
|
215
|
+
case 2:
|
|
216
|
+
validatorList = (_c.sent()).dataList;
|
|
217
|
+
_c.label = 3;
|
|
218
|
+
case 3:
|
|
219
|
+
_c.trys.push([3, 6, , 7]);
|
|
181
220
|
_b = (_a = firma.Staking).getDelegationInfoFromValidator;
|
|
182
221
|
return [4 /*yield*/, wallet.getAddress()];
|
|
183
|
-
case
|
|
184
|
-
case
|
|
222
|
+
case 4: return [4 /*yield*/, _b.apply(_a, [_c.sent(), validatorList[0].operator_address])];
|
|
223
|
+
case 5:
|
|
185
224
|
result = _c.sent();
|
|
186
|
-
|
|
225
|
+
chai_1.expect(result.balance).to.not.equal("");
|
|
226
|
+
return [3 /*break*/, 7];
|
|
227
|
+
case 6:
|
|
228
|
+
error_1 = _c.sent();
|
|
229
|
+
chai_1.expect(false).to.not.equal(true);
|
|
230
|
+
return [3 /*break*/, 7];
|
|
231
|
+
case 7: return [2 /*return*/];
|
|
187
232
|
}
|
|
188
233
|
});
|
|
189
234
|
}); });
|
|
190
235
|
it('11.get userside getUndelegationInfoFromValidator', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
191
|
-
var validatorList, wallet, result, _a, _b;
|
|
236
|
+
var validatorList, wallet, result, _a, _b, error_2;
|
|
192
237
|
return __generator(this, function (_c) {
|
|
193
238
|
switch (_c.label) {
|
|
194
239
|
case 0: return [4 /*yield*/, firma.Staking.getValidatorList()];
|
|
@@ -197,12 +242,21 @@ describe('[13. Staking Query Test]', function () {
|
|
|
197
242
|
return [4 /*yield*/, firma.Wallet.fromMnemonic(config_test_1.aliceMnemonic)];
|
|
198
243
|
case 2:
|
|
199
244
|
wallet = _c.sent();
|
|
245
|
+
_c.label = 3;
|
|
246
|
+
case 3:
|
|
247
|
+
_c.trys.push([3, 6, , 7]);
|
|
200
248
|
_b = (_a = firma.Staking).getUndelegationInfoFromValidator;
|
|
201
249
|
return [4 /*yield*/, wallet.getAddress()];
|
|
202
|
-
case
|
|
203
|
-
case
|
|
250
|
+
case 4: return [4 /*yield*/, _b.apply(_a, [_c.sent(), validatorList[0].operator_address])];
|
|
251
|
+
case 5:
|
|
204
252
|
result = _c.sent();
|
|
205
|
-
|
|
253
|
+
chai_1.expect(FirmaUtil_1.FirmaUtil.isValidAddress(result.delegator_address)).to.be.equal(true);
|
|
254
|
+
return [3 /*break*/, 7];
|
|
255
|
+
case 6:
|
|
256
|
+
error_2 = _c.sent();
|
|
257
|
+
chai_1.expect(false).to.not.equal(true);
|
|
258
|
+
return [3 /*break*/, 7];
|
|
259
|
+
case 7: return [2 /*return*/];
|
|
206
260
|
}
|
|
207
261
|
});
|
|
208
262
|
}); });
|
|
@@ -42,66 +42,83 @@ var FirmaSDK_1 = require("../sdk/FirmaSDK");
|
|
|
42
42
|
var config_test_1 = require("./config_test");
|
|
43
43
|
describe('[14. Distribution Tx Test]', function () {
|
|
44
44
|
var firma;
|
|
45
|
+
var aliceWallet;
|
|
46
|
+
var aliceAddress;
|
|
47
|
+
var bobWallet;
|
|
48
|
+
var bobAddress;
|
|
49
|
+
var validatorWallet;
|
|
50
|
+
var validatorAddress;
|
|
51
|
+
var valOperAddress;
|
|
45
52
|
beforeEach(function () {
|
|
46
|
-
|
|
53
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
54
|
+
return __generator(this, function (_a) {
|
|
55
|
+
switch (_a.label) {
|
|
56
|
+
case 0:
|
|
57
|
+
firma = new FirmaSDK_1.FirmaSDK(config_test_1.TestChainConfig);
|
|
58
|
+
return [4 /*yield*/, firma.Wallet.fromMnemonic(config_test_1.aliceMnemonic)];
|
|
59
|
+
case 1:
|
|
60
|
+
aliceWallet = _a.sent();
|
|
61
|
+
return [4 /*yield*/, aliceWallet.getAddress()];
|
|
62
|
+
case 2:
|
|
63
|
+
aliceAddress = _a.sent();
|
|
64
|
+
return [4 /*yield*/, firma.Wallet.fromMnemonic(config_test_1.bobMnemonic)];
|
|
65
|
+
case 3:
|
|
66
|
+
bobWallet = _a.sent();
|
|
67
|
+
return [4 /*yield*/, bobWallet.getAddress()];
|
|
68
|
+
case 4:
|
|
69
|
+
bobAddress = _a.sent();
|
|
70
|
+
return [4 /*yield*/, firma.Wallet.fromMnemonic(config_test_1.validatorMnemonic)];
|
|
71
|
+
case 5:
|
|
72
|
+
validatorWallet = _a.sent();
|
|
73
|
+
return [4 /*yield*/, validatorWallet.getAddress()];
|
|
74
|
+
case 6:
|
|
75
|
+
validatorAddress = _a.sent();
|
|
76
|
+
valOperAddress = __1.FirmaUtil.getValOperAddressFromAccAddress(validatorAddress);
|
|
77
|
+
return [2 /*return*/];
|
|
78
|
+
}
|
|
79
|
+
});
|
|
80
|
+
});
|
|
47
81
|
});
|
|
48
82
|
it('withdrawAllRewards for delegator side', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
49
|
-
var
|
|
50
|
-
return __generator(this, function (
|
|
51
|
-
switch (
|
|
52
|
-
case 0: return [4 /*yield*/, firma.
|
|
83
|
+
var delegationList, validatorAddress, result;
|
|
84
|
+
return __generator(this, function (_a) {
|
|
85
|
+
switch (_a.label) {
|
|
86
|
+
case 0: return [4 /*yield*/, firma.Staking.getTotalDelegationInfo(aliceAddress)];
|
|
53
87
|
case 1:
|
|
54
|
-
|
|
55
|
-
_b = (_a = firma.Staking).getTotalDelegationInfo;
|
|
56
|
-
return [4 /*yield*/, wallet.getAddress()];
|
|
57
|
-
case 2: return [4 /*yield*/, _b.apply(_a, [_c.sent()])];
|
|
58
|
-
case 3:
|
|
59
|
-
delegationList = (_c.sent()).dataList;
|
|
88
|
+
delegationList = (_a.sent()).dataList;
|
|
60
89
|
validatorAddress = delegationList[0].delegation.validator_address;
|
|
61
|
-
return [4 /*yield*/, firma.Distribution.withdrawAllRewards(
|
|
62
|
-
case
|
|
63
|
-
result =
|
|
90
|
+
return [4 /*yield*/, firma.Distribution.withdrawAllRewards(aliceWallet, validatorAddress)];
|
|
91
|
+
case 2:
|
|
92
|
+
result = _a.sent();
|
|
64
93
|
chai_1.expect(result.code).to.equal(0);
|
|
65
94
|
return [2 /*return*/];
|
|
66
95
|
}
|
|
67
96
|
});
|
|
68
97
|
}); });
|
|
69
98
|
it('withdrawAllRewards for All Validators', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
70
|
-
var
|
|
71
|
-
return __generator(this, function (
|
|
72
|
-
switch (
|
|
73
|
-
case 0: return [4 /*yield*/, firma.
|
|
99
|
+
var delegationList, gasEstimation, result;
|
|
100
|
+
return __generator(this, function (_a) {
|
|
101
|
+
switch (_a.label) {
|
|
102
|
+
case 0: return [4 /*yield*/, firma.Staking.getTotalDelegationInfo(aliceAddress)];
|
|
74
103
|
case 1:
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
104
|
+
delegationList = (_a.sent()).dataList;
|
|
105
|
+
return [4 /*yield*/, firma.Distribution.getGasEstimationWithdrawAllRewardsFromAllValidator(aliceWallet, delegationList)];
|
|
106
|
+
case 2:
|
|
107
|
+
gasEstimation = _a.sent();
|
|
108
|
+
return [4 /*yield*/, firma.Distribution.withdrawAllRewardsFromAllValidator(aliceWallet, delegationList, { gas: gasEstimation, fee: gasEstimation })];
|
|
79
109
|
case 3:
|
|
80
|
-
|
|
81
|
-
return [4 /*yield*/, firma.Distribution.getGasEstimationWithdrawAllRewardsFromAllValidator(wallet, delegationList)];
|
|
82
|
-
case 4:
|
|
83
|
-
gasEstimation = _c.sent();
|
|
84
|
-
return [4 /*yield*/, firma.Distribution.withdrawAllRewardsFromAllValidator(wallet, delegationList, { gas: gasEstimation, fee: gasEstimation })];
|
|
85
|
-
case 5:
|
|
86
|
-
result = _c.sent();
|
|
110
|
+
result = _a.sent();
|
|
87
111
|
chai_1.expect(result.code).to.equal(0);
|
|
88
112
|
return [2 /*return*/];
|
|
89
113
|
}
|
|
90
114
|
});
|
|
91
115
|
}); });
|
|
92
116
|
it('withdrawAllRewards for validator side', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
93
|
-
var
|
|
117
|
+
var result;
|
|
94
118
|
return __generator(this, function (_a) {
|
|
95
119
|
switch (_a.label) {
|
|
96
|
-
case 0: return [4 /*yield*/, firma.
|
|
120
|
+
case 0: return [4 /*yield*/, firma.Distribution.withdrawAllRewards(validatorWallet, valOperAddress)];
|
|
97
121
|
case 1:
|
|
98
|
-
wallet = _a.sent();
|
|
99
|
-
return [4 /*yield*/, wallet.getAddress()];
|
|
100
|
-
case 2:
|
|
101
|
-
address = _a.sent();
|
|
102
|
-
validatorAddress = __1.FirmaUtil.getValOperAddressFromAccAddress(address);
|
|
103
|
-
return [4 /*yield*/, firma.Distribution.withdrawAllRewards(wallet, validatorAddress)];
|
|
104
|
-
case 3:
|
|
105
122
|
result = _a.sent();
|
|
106
123
|
chai_1.expect(result.code).to.equal(0);
|
|
107
124
|
return [2 /*return*/];
|
|
@@ -109,18 +126,11 @@ describe('[14. Distribution Tx Test]', function () {
|
|
|
109
126
|
});
|
|
110
127
|
}); });
|
|
111
128
|
it('WithdrawValidatorCommission OK', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
112
|
-
var
|
|
129
|
+
var result;
|
|
113
130
|
return __generator(this, function (_a) {
|
|
114
131
|
switch (_a.label) {
|
|
115
|
-
case 0: return [4 /*yield*/, firma.
|
|
132
|
+
case 0: return [4 /*yield*/, firma.Distribution.withdrawValidatorCommission(validatorWallet, valOperAddress)];
|
|
116
133
|
case 1:
|
|
117
|
-
wallet = _a.sent();
|
|
118
|
-
return [4 /*yield*/, wallet.getAddress()];
|
|
119
|
-
case 2:
|
|
120
|
-
address = _a.sent();
|
|
121
|
-
validatorAddress = __1.FirmaUtil.getValOperAddressFromAccAddress(address);
|
|
122
|
-
return [4 /*yield*/, firma.Distribution.withdrawValidatorCommission(wallet, validatorAddress)];
|
|
123
|
-
case 3:
|
|
124
134
|
result = _a.sent();
|
|
125
135
|
chai_1.expect(result.code).to.equal(0);
|
|
126
136
|
return [2 /*return*/];
|
|
@@ -128,15 +138,13 @@ describe('[14. Distribution Tx Test]', function () {
|
|
|
128
138
|
});
|
|
129
139
|
}); });
|
|
130
140
|
it('FundCommunityPool OK', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
131
|
-
var
|
|
141
|
+
var amount, result;
|
|
132
142
|
return __generator(this, function (_a) {
|
|
133
143
|
switch (_a.label) {
|
|
134
|
-
case 0:
|
|
135
|
-
case 1:
|
|
136
|
-
wallet = _a.sent();
|
|
144
|
+
case 0:
|
|
137
145
|
amount = 1;
|
|
138
|
-
return [4 /*yield*/, firma.Distribution.fundCommunityPool(
|
|
139
|
-
case
|
|
146
|
+
return [4 /*yield*/, firma.Distribution.fundCommunityPool(aliceWallet, amount)];
|
|
147
|
+
case 1:
|
|
140
148
|
result = _a.sent();
|
|
141
149
|
chai_1.expect(result.code).to.equal(0);
|
|
142
150
|
return [2 /*return*/];
|
|
@@ -144,33 +152,16 @@ describe('[14. Distribution Tx Test]', function () {
|
|
|
144
152
|
});
|
|
145
153
|
}); });
|
|
146
154
|
it('SetWithdrawAddress OK', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
147
|
-
var
|
|
148
|
-
return __generator(this, function (
|
|
149
|
-
switch (
|
|
150
|
-
case 0: return [4 /*yield*/, firma.
|
|
155
|
+
var result, result1;
|
|
156
|
+
return __generator(this, function (_a) {
|
|
157
|
+
switch (_a.label) {
|
|
158
|
+
case 0: return [4 /*yield*/, firma.Distribution.setWithdrawAddress(aliceWallet, bobAddress)];
|
|
151
159
|
case 1:
|
|
152
|
-
|
|
153
|
-
return [4 /*yield*/, firma.Wallet.fromMnemonic(config_test_1.bobMnemonic)];
|
|
154
|
-
case 2:
|
|
155
|
-
bobWallet = _f.sent();
|
|
156
|
-
_b = (_a = firma.Distribution).setWithdrawAddress;
|
|
157
|
-
_c = [aliceWallet];
|
|
158
|
-
return [4 /*yield*/, bobWallet.getAddress()];
|
|
159
|
-
case 3: return [4 /*yield*/, _b.apply(_a, _c.concat([_f.sent()]))];
|
|
160
|
-
case 4:
|
|
161
|
-
result = _f.sent();
|
|
160
|
+
result = _a.sent();
|
|
162
161
|
chai_1.expect(result.code).to.equal(0);
|
|
163
|
-
return [4 /*yield*/, firma.
|
|
164
|
-
case
|
|
165
|
-
|
|
166
|
-
_e = (_d = __1.FirmaUtil).getValOperAddressFromAccAddress;
|
|
167
|
-
return [4 /*yield*/, validatorWallet.getAddress()];
|
|
168
|
-
case 6:
|
|
169
|
-
validatorAddress = _e.apply(_d, [_f.sent()]);
|
|
170
|
-
return [4 /*yield*/, firma.Distribution.withdrawAllRewards(aliceWallet, validatorAddress)];
|
|
171
|
-
case 7:
|
|
172
|
-
result1 = _f.sent();
|
|
173
|
-
//console.log(result1);
|
|
162
|
+
return [4 /*yield*/, firma.Distribution.withdrawAllRewards(aliceWallet, valOperAddress)];
|
|
163
|
+
case 2:
|
|
164
|
+
result1 = _a.sent();
|
|
174
165
|
chai_1.expect(result1.code).to.equal(0);
|
|
175
166
|
return [2 /*return*/];
|
|
176
167
|
}
|
|
@@ -42,8 +42,24 @@ var FirmaSDK_1 = require("../sdk/FirmaSDK");
|
|
|
42
42
|
var config_test_1 = require("./config_test");
|
|
43
43
|
describe('[15. Distribution Query Test]', function () {
|
|
44
44
|
var firma;
|
|
45
|
+
var aliceWallet;
|
|
46
|
+
var aliceAddress;
|
|
45
47
|
beforeEach(function () {
|
|
46
|
-
|
|
48
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
49
|
+
return __generator(this, function (_a) {
|
|
50
|
+
switch (_a.label) {
|
|
51
|
+
case 0:
|
|
52
|
+
firma = new FirmaSDK_1.FirmaSDK(config_test_1.TestChainConfig);
|
|
53
|
+
return [4 /*yield*/, firma.Wallet.fromMnemonic(config_test_1.aliceMnemonic)];
|
|
54
|
+
case 1:
|
|
55
|
+
aliceWallet = _a.sent();
|
|
56
|
+
return [4 /*yield*/, aliceWallet.getAddress()];
|
|
57
|
+
case 2:
|
|
58
|
+
aliceAddress = _a.sent();
|
|
59
|
+
return [2 /*return*/];
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
});
|
|
47
63
|
});
|
|
48
64
|
it('get communityPool', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
49
65
|
var poolAmount;
|
|
@@ -52,6 +68,7 @@ describe('[15. Distribution Query Test]', function () {
|
|
|
52
68
|
case 0: return [4 /*yield*/, firma.Distribution.getCommunityPool()];
|
|
53
69
|
case 1:
|
|
54
70
|
poolAmount = _a.sent();
|
|
71
|
+
chai_1.expect(poolAmount).to.not.equal("");
|
|
55
72
|
return [2 /*return*/];
|
|
56
73
|
}
|
|
57
74
|
});
|
|
@@ -67,6 +84,12 @@ describe('[15. Distribution Query Test]', function () {
|
|
|
67
84
|
return [4 /*yield*/, firma.Distribution.getValidatorCommission(validatorAddress)];
|
|
68
85
|
case 2:
|
|
69
86
|
result = _a.sent();
|
|
87
|
+
if (result.length > 0) {
|
|
88
|
+
chai_1.expect(result[0].amount).to.not.equal("");
|
|
89
|
+
}
|
|
90
|
+
else {
|
|
91
|
+
chai_1.expect(true).to.be.equal(true);
|
|
92
|
+
}
|
|
70
93
|
return [2 /*return*/];
|
|
71
94
|
}
|
|
72
95
|
});
|
|
@@ -82,6 +105,12 @@ describe('[15. Distribution Query Test]', function () {
|
|
|
82
105
|
return [4 /*yield*/, firma.Distribution.getValidatorOutStandingReward(validatorAddress)];
|
|
83
106
|
case 2:
|
|
84
107
|
result = _a.sent();
|
|
108
|
+
if (result.length > 0) {
|
|
109
|
+
chai_1.expect(result[0].amount).to.not.equal("");
|
|
110
|
+
}
|
|
111
|
+
else {
|
|
112
|
+
chai_1.expect(true).to.be.equal(true);
|
|
113
|
+
}
|
|
85
114
|
return [2 /*return*/];
|
|
86
115
|
}
|
|
87
116
|
});
|
|
@@ -98,6 +127,7 @@ describe('[15. Distribution Query Test]', function () {
|
|
|
98
127
|
return [4 /*yield*/, firma.Distribution.getTotalRewardInfo(address)];
|
|
99
128
|
case 2:
|
|
100
129
|
result = _a.sent();
|
|
130
|
+
chai_1.expect(result.rewards).to.not.equal("");
|
|
101
131
|
return [2 /*return*/];
|
|
102
132
|
}
|
|
103
133
|
});
|
|
@@ -115,6 +145,7 @@ describe('[15. Distribution Query Test]', function () {
|
|
|
115
145
|
return [4 /*yield*/, firma.Distribution.getValidatorCommission(newValidatorAddress)];
|
|
116
146
|
case 2:
|
|
117
147
|
commission = _a.sent();
|
|
148
|
+
chai_1.expect(commission.length).to.not.equal(0);
|
|
118
149
|
return [2 /*return*/];
|
|
119
150
|
}
|
|
120
151
|
});
|
|
@@ -122,77 +153,69 @@ describe('[15. Distribution Query Test]', function () {
|
|
|
122
153
|
// Total Reward based user side
|
|
123
154
|
// Additionally, rewards for each validator data are included. On the list.
|
|
124
155
|
it('get getTotalRewardInfo', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
125
|
-
var
|
|
126
|
-
return __generator(this, function (
|
|
127
|
-
switch (
|
|
128
|
-
case 0: return [4 /*yield*/, firma.
|
|
156
|
+
var result;
|
|
157
|
+
return __generator(this, function (_a) {
|
|
158
|
+
switch (_a.label) {
|
|
159
|
+
case 0: return [4 /*yield*/, firma.Distribution.getTotalRewardInfo(aliceAddress)];
|
|
129
160
|
case 1:
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
for (i = 0; i < result.rewards.length; i++) {
|
|
137
|
-
//console.log("validator_address: " + result.rewards[i].validator_address);
|
|
138
|
-
//console.log("reward: " + result.rewards[i].amount);
|
|
161
|
+
result = _a.sent();
|
|
162
|
+
if (result.rewards.length === 0) {
|
|
163
|
+
chai_1.expect(result.total).to.be.equal('');
|
|
164
|
+
}
|
|
165
|
+
else {
|
|
166
|
+
chai_1.expect(result.total).to.not.equal('');
|
|
139
167
|
}
|
|
140
|
-
totalReward = result.total;
|
|
141
168
|
return [2 /*return*/];
|
|
142
169
|
}
|
|
143
170
|
});
|
|
144
171
|
}); });
|
|
145
172
|
// reward per validator
|
|
146
173
|
it('get getRewardInfo', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
147
|
-
var
|
|
148
|
-
return __generator(this, function (
|
|
149
|
-
switch (
|
|
150
|
-
case 0: return [4 /*yield*/, firma.
|
|
174
|
+
var totalReward, validatorAddress, amount;
|
|
175
|
+
return __generator(this, function (_a) {
|
|
176
|
+
switch (_a.label) {
|
|
177
|
+
case 0: return [4 /*yield*/, firma.Distribution.getTotalRewardInfo(aliceAddress)];
|
|
151
178
|
case 1:
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
return [4 /*yield*/, wallet.getAddress()];
|
|
155
|
-
case 2: return [4 /*yield*/, _b.apply(_a, [_e.sent()])];
|
|
156
|
-
case 3:
|
|
157
|
-
totalReward = _e.sent();
|
|
179
|
+
totalReward = _a.sent();
|
|
180
|
+
if (!(totalReward.rewards.length > 0)) return [3 /*break*/, 3];
|
|
158
181
|
validatorAddress = totalReward.rewards[0].validator_address;
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
182
|
+
return [4 /*yield*/, firma.Distribution.getRewardInfo(aliceAddress, validatorAddress)];
|
|
183
|
+
case 2:
|
|
184
|
+
amount = _a.sent();
|
|
185
|
+
chai_1.expect(amount).to.not.equal('');
|
|
186
|
+
return [3 /*break*/, 4];
|
|
187
|
+
case 3:
|
|
188
|
+
chai_1.expect(true).to.be.equal(false);
|
|
189
|
+
_a.label = 4;
|
|
190
|
+
case 4: return [2 /*return*/];
|
|
165
191
|
}
|
|
166
192
|
});
|
|
167
193
|
}); });
|
|
168
194
|
it('get withdrawAddress', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
169
|
-
var
|
|
170
|
-
return __generator(this, function (
|
|
171
|
-
switch (
|
|
172
|
-
case 0: return [4 /*yield*/, firma.
|
|
195
|
+
var withdrawAddress;
|
|
196
|
+
return __generator(this, function (_a) {
|
|
197
|
+
switch (_a.label) {
|
|
198
|
+
case 0: return [4 /*yield*/, firma.Distribution.getWithdrawAddress(aliceAddress)];
|
|
173
199
|
case 1:
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
return [4 /*yield*/, wallet.getAddress()];
|
|
177
|
-
case 2: return [4 /*yield*/, _b.apply(_a, [_c.sent()])];
|
|
178
|
-
case 3:
|
|
179
|
-
withdrawAddress = _c.sent();
|
|
200
|
+
withdrawAddress = _a.sent();
|
|
201
|
+
chai_1.expect(__1.FirmaUtil.isValidAddress(withdrawAddress)).to.be.equal(true);
|
|
180
202
|
return [2 /*return*/];
|
|
181
203
|
}
|
|
182
204
|
});
|
|
183
205
|
}); });
|
|
184
206
|
it('get getTotalRewardInfo from no balance user', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
185
|
-
var
|
|
186
|
-
return __generator(this, function (
|
|
187
|
-
switch (
|
|
207
|
+
var newWallet, newAddress, result;
|
|
208
|
+
return __generator(this, function (_a) {
|
|
209
|
+
switch (_a.label) {
|
|
188
210
|
case 0: return [4 /*yield*/, firma.Wallet.newWallet()];
|
|
189
211
|
case 1:
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
212
|
+
newWallet = _a.sent();
|
|
213
|
+
return [4 /*yield*/, newWallet.getAddress()];
|
|
214
|
+
case 2:
|
|
215
|
+
newAddress = _a.sent();
|
|
216
|
+
return [4 /*yield*/, firma.Distribution.getTotalRewardInfo(newAddress)];
|
|
194
217
|
case 3:
|
|
195
|
-
result =
|
|
218
|
+
result = _a.sent();
|
|
196
219
|
chai_1.expect(result.total).to.equal("");
|
|
197
220
|
return [2 /*return*/];
|
|
198
221
|
}
|
|
@@ -200,17 +223,18 @@ describe('[15. Distribution Query Test]', function () {
|
|
|
200
223
|
}); });
|
|
201
224
|
// reward per validator
|
|
202
225
|
it('get getRewardInfo from no balance user', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
203
|
-
var
|
|
204
|
-
return __generator(this, function (
|
|
205
|
-
switch (
|
|
226
|
+
var newWallet, newAddress, totalReward;
|
|
227
|
+
return __generator(this, function (_a) {
|
|
228
|
+
switch (_a.label) {
|
|
206
229
|
case 0: return [4 /*yield*/, firma.Wallet.newWallet()];
|
|
207
230
|
case 1:
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
231
|
+
newWallet = _a.sent();
|
|
232
|
+
return [4 /*yield*/, newWallet.getAddress()];
|
|
233
|
+
case 2:
|
|
234
|
+
newAddress = _a.sent();
|
|
235
|
+
return [4 /*yield*/, firma.Distribution.getTotalRewardInfo(newAddress)];
|
|
212
236
|
case 3:
|
|
213
|
-
totalReward =
|
|
237
|
+
totalReward = _a.sent();
|
|
214
238
|
chai_1.expect(totalReward.rewards.length).to.equal(0);
|
|
215
239
|
return [2 /*return*/];
|
|
216
240
|
}
|