@firmachain/firma-js 0.3.7-beta3 → 0.3.8
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.
|
@@ -322,28 +322,38 @@ var FirmaDistributionService = /** @class */ (function () {
|
|
|
322
322
|
FirmaDistributionService.prototype.getSignedTxwithdrawAllRewardsFromAllValidator = function (wallet, delegationList, txMisc) {
|
|
323
323
|
if (txMisc === void 0) { txMisc = FirmaUtil_1.DefaultTxMisc; }
|
|
324
324
|
return __awaiter(this, void 0, void 0, function () {
|
|
325
|
-
var address, txClient, messageList, i, validatorAddress, message, error_13;
|
|
325
|
+
var address, txClient, messageList, totalRewardInfo_1, filteredDelegationList, i, validatorAddress, message, error_13;
|
|
326
326
|
return __generator(this, function (_a) {
|
|
327
327
|
switch (_a.label) {
|
|
328
328
|
case 0:
|
|
329
|
-
_a.trys.push([0,
|
|
329
|
+
_a.trys.push([0, 4, , 5]);
|
|
330
330
|
return [4 /*yield*/, wallet.getAddress()];
|
|
331
331
|
case 1:
|
|
332
332
|
address = _a.sent();
|
|
333
333
|
txClient = new distribution_1.DistributionTxClient(wallet, this.config.rpcAddress);
|
|
334
334
|
messageList = [];
|
|
335
|
-
|
|
336
|
-
|
|
335
|
+
return [4 /*yield*/, this.getTotalRewardInfo(address)];
|
|
336
|
+
case 2:
|
|
337
|
+
totalRewardInfo_1 = _a.sent();
|
|
338
|
+
filteredDelegationList = delegationList.filter(function (delegation) {
|
|
339
|
+
var hasReward = totalRewardInfo_1.rewards.some(function (reward) { return reward.validator_address === delegation.delegation.validator_address; });
|
|
340
|
+
if (!hasReward) {
|
|
341
|
+
FirmaUtil_1.FirmaUtil.printLog("Validator filtered. Will not request to withdraw reward from zero reward validator: ".concat(delegation.delegation.validator_address, ", delegation amount=").concat(delegation.balance.amount));
|
|
342
|
+
}
|
|
343
|
+
return hasReward;
|
|
344
|
+
});
|
|
345
|
+
for (i = 0; i < filteredDelegationList.length; i++) {
|
|
346
|
+
validatorAddress = filteredDelegationList[i].delegation.validator_address;
|
|
337
347
|
message = distribution_1.DistributionTxClient.msgWithdrawDelegatorReward({ delegatorAddress: address, validatorAddress: validatorAddress });
|
|
338
348
|
messageList.push(message);
|
|
339
349
|
}
|
|
340
350
|
return [4 /*yield*/, txClient.sign(messageList, (0, FirmaUtil_1.getSignAndBroadcastOption)(this.config.denom, txMisc))];
|
|
341
|
-
case
|
|
342
|
-
case
|
|
351
|
+
case 3: return [2 /*return*/, _a.sent()];
|
|
352
|
+
case 4:
|
|
343
353
|
error_13 = _a.sent();
|
|
344
354
|
FirmaUtil_1.FirmaUtil.printLog(error_13);
|
|
345
355
|
throw error_13;
|
|
346
|
-
case
|
|
356
|
+
case 5: return [2 /*return*/];
|
|
347
357
|
}
|
|
348
358
|
});
|
|
349
359
|
});
|
|
@@ -129,17 +129,20 @@ var FirmaGovService = /** @class */ (function () {
|
|
|
129
129
|
if (metadata === void 0) { metadata = ""; }
|
|
130
130
|
if (txMisc === void 0) { txMisc = FirmaUtil_1.DefaultTxMisc; }
|
|
131
131
|
return __awaiter(this, void 0, void 0, function () {
|
|
132
|
-
var message, txRaw, error_3;
|
|
132
|
+
var msgObj, message, txRaw, error_3;
|
|
133
133
|
return __generator(this, function (_a) {
|
|
134
134
|
switch (_a.label) {
|
|
135
135
|
case 0:
|
|
136
136
|
_a.trys.push([0, 3, , 4]);
|
|
137
|
+
msgObj = tx_3.MsgSoftwareUpgrade.fromPartial({
|
|
138
|
+
authority: FirmaGovService.GOV_AUTHORITY,
|
|
139
|
+
plan: plan
|
|
140
|
+
});
|
|
141
|
+
// Remove time field from the plan to avoid encoding deprecated field
|
|
142
|
+
delete msgObj.plan.time;
|
|
137
143
|
message = {
|
|
138
144
|
typeUrl: "/cosmos.upgrade.v1beta1.MsgSoftwareUpgrade",
|
|
139
|
-
value: tx_3.MsgSoftwareUpgrade.encode(
|
|
140
|
-
authority: FirmaGovService.GOV_AUTHORITY,
|
|
141
|
-
plan: plan
|
|
142
|
-
})).finish()
|
|
145
|
+
value: tx_3.MsgSoftwareUpgrade.encode(msgObj).finish()
|
|
143
146
|
};
|
|
144
147
|
return [4 /*yield*/, this.getSignedTxSubmitSoftwareUpgradeProposal(wallet, title, summary, initialDepositFCT, [message], metadata, txMisc)];
|
|
145
148
|
case 1:
|
|
@@ -505,17 +508,20 @@ var FirmaGovService = /** @class */ (function () {
|
|
|
505
508
|
if (metadata === void 0) { metadata = ""; }
|
|
506
509
|
if (txMisc === void 0) { txMisc = FirmaUtil_1.DefaultTxMisc; }
|
|
507
510
|
return __awaiter(this, void 0, void 0, function () {
|
|
508
|
-
var message, txRaw, txClient, error_14;
|
|
511
|
+
var msgObj, message, txRaw, txClient, error_14;
|
|
509
512
|
return __generator(this, function (_a) {
|
|
510
513
|
switch (_a.label) {
|
|
511
514
|
case 0:
|
|
512
515
|
_a.trys.push([0, 3, , 4]);
|
|
516
|
+
msgObj = tx_3.MsgSoftwareUpgrade.fromPartial({
|
|
517
|
+
authority: FirmaGovService.GOV_AUTHORITY,
|
|
518
|
+
plan: plan
|
|
519
|
+
});
|
|
520
|
+
// Remove time field from the plan to avoid encoding deprecated field
|
|
521
|
+
delete msgObj.plan.time;
|
|
513
522
|
message = {
|
|
514
523
|
typeUrl: "/cosmos.upgrade.v1beta1.MsgSoftwareUpgrade",
|
|
515
|
-
value: tx_3.MsgSoftwareUpgrade.encode(
|
|
516
|
-
authority: FirmaGovService.GOV_AUTHORITY,
|
|
517
|
-
plan: plan
|
|
518
|
-
})).finish()
|
|
524
|
+
value: tx_3.MsgSoftwareUpgrade.encode(msgObj).finish()
|
|
519
525
|
};
|
|
520
526
|
return [4 /*yield*/, this.getSignedTxSubmitSoftwareUpgradeProposal(wallet, title, summary, initialDepositFCT, [message], metadata, txMisc)];
|
|
521
527
|
case 1:
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { FirmaConfig } from '../sdk/FirmaConfig';
|
|
2
2
|
export declare let TestChainConfig: FirmaConfig;
|
|
3
3
|
export declare const validatorMnemonic = "";
|
|
4
|
-
export declare const aliceMnemonic = "";
|
|
5
|
-
export declare const bobMnemonic = "";
|
|
4
|
+
export declare const aliceMnemonic = "ribbon cross anchor sudden smile shrug enact tourist door found farm injury mango cancel wine supreme toy breeze spread type lyrics broom latin apple";
|
|
5
|
+
export declare const bobMnemonic = "certain bean eager measure crawl cliff innocent practice gas ladder board aspect fish link sweet raccoon staff long crumble skin special width click plastic";
|
|
6
6
|
export declare const feeMnemonic = "";
|
|
7
7
|
export declare const firmaFeeMnemonic = "";
|
|
8
8
|
export declare const signerMnemonic1 = "";
|
package/dist/test/config_test.js
CHANGED
|
@@ -1,11 +1,23 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.signerMnemonic4 = exports.signerMnemonic3 = exports.signerMnemonic2 = exports.signerMnemonic1 = exports.firmaFeeMnemonic = exports.feeMnemonic = exports.bobMnemonic = exports.aliceMnemonic = exports.validatorMnemonic = exports.TestChainConfig = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
exports.TestChainConfig = {
|
|
5
|
+
chainID: "roma-1",
|
|
6
|
+
rpcAddress: "http://192.168.30.45:26657",
|
|
7
|
+
restApiAddress: "http://192.168.30.47:1317",
|
|
8
|
+
ipfsNodeAddress: "http://192.168.30.47:5001",
|
|
9
|
+
ipfsNodePort: 5001,
|
|
10
|
+
ipfsWebApiAddress: "http://192.168.30.45:8080",
|
|
11
|
+
hdPath: "m/44'/7777777'/",
|
|
12
|
+
prefix: "firma",
|
|
13
|
+
denom: "ufct",
|
|
14
|
+
defaultFee: 30000,
|
|
15
|
+
defaultGas: 300000,
|
|
16
|
+
isShowLog: false,
|
|
17
|
+
};
|
|
6
18
|
exports.validatorMnemonic = "";
|
|
7
|
-
exports.aliceMnemonic = "";
|
|
8
|
-
exports.bobMnemonic = "";
|
|
19
|
+
exports.aliceMnemonic = "ribbon cross anchor sudden smile shrug enact tourist door found farm injury mango cancel wine supreme toy breeze spread type lyrics broom latin apple";
|
|
20
|
+
exports.bobMnemonic = "certain bean eager measure crawl cliff innocent practice gas ladder board aspect fish link sweet raccoon staff long crumble skin special width click plastic";
|
|
9
21
|
exports.feeMnemonic = "";
|
|
10
22
|
exports.firmaFeeMnemonic = "";
|
|
11
23
|
exports.signerMnemonic1 = "";
|