@firmachain/firma-js 0.2.5 → 0.2.6
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/dist/sdk/FirmaBankService.d.ts +5 -5
- package/dist/sdk/FirmaBankService.js +30 -30
- package/dist/sdk/FirmaConfig.d.ts +3 -3
- package/dist/sdk/FirmaContractService.d.ts +5 -5
- package/dist/sdk/FirmaContractService.js +19 -19
- package/dist/sdk/FirmaDistributionService.d.ts +10 -6
- package/dist/sdk/FirmaDistributionService.js +159 -75
- package/dist/sdk/FirmaFeeGrantService.d.ts +8 -5
- package/dist/sdk/FirmaFeeGrantService.js +125 -50
- package/dist/sdk/FirmaGovService.d.ts +16 -10
- package/dist/sdk/FirmaGovService.js +296 -127
- package/dist/sdk/FirmaIpfsService.d.ts +4 -4
- package/dist/sdk/FirmaIpfsService.js +14 -14
- package/dist/sdk/FirmaNftService.d.ts +4 -4
- package/dist/sdk/FirmaNftService.js +18 -20
- package/dist/sdk/FirmaSDK.js +2 -1
- package/dist/sdk/FirmaStakingService.d.ts +7 -6
- package/dist/sdk/FirmaStakingService.js +141 -103
- package/dist/sdk/FirmaUtil.d.ts +3 -2
- package/dist/sdk/FirmaUtil.js +16 -11
- package/dist/sdk/FirmaWalletService.d.ts +6 -6
- package/dist/sdk/FirmaWalletService.js +22 -22
- package/dist/sdk/firmachain/bank/BankQueryClient.d.ts +1 -1
- package/dist/sdk/firmachain/bank/BankQueryClient.js +4 -4
- package/dist/sdk/firmachain/bank/BankTxClient.d.ts +3 -4
- package/dist/sdk/firmachain/bank/BankTxClient.js +2 -2
- package/dist/sdk/firmachain/common/ITxClient.d.ts +5 -5
- package/dist/sdk/firmachain/common/ITxClient.js +7 -7
- package/dist/sdk/firmachain/common/TendermintQueryClient.d.ts +1 -1
- package/dist/sdk/firmachain/common/TendermintQueryClient.js +5 -4
- package/dist/sdk/firmachain/common/accounts.js +25 -20
- package/dist/sdk/firmachain/common/signingstargateclient.js +3 -3
- package/dist/sdk/firmachain/contract/ContractQueryClient.d.ts +2 -2
- package/dist/sdk/firmachain/contract/ContractQueryClient.js +17 -11
- package/dist/sdk/firmachain/contract/ContractTxClient.d.ts +3 -4
- package/dist/sdk/firmachain/contract/ContractTxClient.js +3 -3
- package/dist/sdk/firmachain/distribution/DistributionQueryClient.d.ts +2 -1
- package/dist/sdk/firmachain/distribution/DistributionQueryClient.js +30 -15
- package/dist/sdk/firmachain/distribution/DistributionTxClient.d.ts +5 -6
- package/dist/sdk/firmachain/distribution/DistributionTxClient.js +3 -3
- package/dist/sdk/firmachain/feegrant/FeeGrantQueryClient.d.ts +2 -2
- package/dist/sdk/firmachain/feegrant/FeeGrantQueryClient.js +4 -4
- package/dist/sdk/firmachain/feegrant/FeeGrantTxClient.d.ts +3 -4
- package/dist/sdk/firmachain/feegrant/FeeGrantTxClient.js +2 -2
- package/dist/sdk/firmachain/gov/GovQueryClient.d.ts +1 -1
- package/dist/sdk/firmachain/gov/GovQueryClient.js +8 -8
- package/dist/sdk/firmachain/gov/GovTxClient.d.ts +4 -5
- package/dist/sdk/firmachain/gov/GovTxClient.js +3 -3
- package/dist/sdk/firmachain/nft/NftQueryClient.d.ts +2 -2
- package/dist/sdk/firmachain/nft/NftQueryClient.js +11 -8
- package/dist/sdk/firmachain/nft/NftTxClient.d.ts +4 -5
- package/dist/sdk/firmachain/nft/NftTxClient.js +3 -3
- package/dist/sdk/firmachain/staking/StakingQueryClient.d.ts +1 -1
- package/dist/sdk/firmachain/staking/StakingQueryClient.js +20 -20
- package/dist/sdk/firmachain/staking/StakingTxClient.d.ts +6 -7
- package/dist/sdk/firmachain/staking/StakingTxClient.js +2 -2
- package/package.json +1 -1
|
@@ -40,10 +40,10 @@ exports.FirmaDistributionService = void 0;
|
|
|
40
40
|
var distribution_1 = require("./firmachain/distribution");
|
|
41
41
|
var FirmaUtil_1 = require("./FirmaUtil");
|
|
42
42
|
var FirmaDistributionService = /** @class */ (function () {
|
|
43
|
-
function FirmaDistributionService(
|
|
44
|
-
this.
|
|
43
|
+
function FirmaDistributionService(config) {
|
|
44
|
+
this.config = config;
|
|
45
45
|
}
|
|
46
|
-
FirmaDistributionService.prototype.
|
|
46
|
+
FirmaDistributionService.prototype.getGasEstimationSetWithdrawAddress = function (wallet, withdrawAddress, txMisc) {
|
|
47
47
|
if (txMisc === void 0) { txMisc = distribution_1.DefaultTxMisc; }
|
|
48
48
|
return __awaiter(this, void 0, void 0, function () {
|
|
49
49
|
var txRaw, error_1;
|
|
@@ -51,7 +51,7 @@ var FirmaDistributionService = /** @class */ (function () {
|
|
|
51
51
|
switch (_a.label) {
|
|
52
52
|
case 0:
|
|
53
53
|
_a.trys.push([0, 3, , 4]);
|
|
54
|
-
return [4 /*yield*/, this.
|
|
54
|
+
return [4 /*yield*/, this.getSignedTxSetWithdrawAddress(wallet, withdrawAddress, txMisc)];
|
|
55
55
|
case 1:
|
|
56
56
|
txRaw = _a.sent();
|
|
57
57
|
return [4 /*yield*/, FirmaUtil_1.FirmaUtil.estimateGas(txRaw)];
|
|
@@ -65,20 +65,18 @@ var FirmaDistributionService = /** @class */ (function () {
|
|
|
65
65
|
});
|
|
66
66
|
});
|
|
67
67
|
};
|
|
68
|
-
FirmaDistributionService.prototype.
|
|
68
|
+
FirmaDistributionService.prototype.getGasEstimationFundCommunityPool = function (wallet, amount, txMisc) {
|
|
69
69
|
if (txMisc === void 0) { txMisc = distribution_1.DefaultTxMisc; }
|
|
70
70
|
return __awaiter(this, void 0, void 0, function () {
|
|
71
|
-
var
|
|
71
|
+
var txRaw, error_2;
|
|
72
72
|
return __generator(this, function (_a) {
|
|
73
73
|
switch (_a.label) {
|
|
74
74
|
case 0:
|
|
75
75
|
_a.trys.push([0, 3, , 4]);
|
|
76
|
-
|
|
77
|
-
return [4 /*yield*/, wallet.getAddress()];
|
|
76
|
+
return [4 /*yield*/, this.getSignedTxFundCommunityPool(wallet, amount, txMisc)];
|
|
78
77
|
case 1:
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
return [4 /*yield*/, txClient.sign([message], distribution_1.getSignAndBroadcastOption(this._config.denom, txMisc))];
|
|
78
|
+
txRaw = _a.sent();
|
|
79
|
+
return [4 /*yield*/, FirmaUtil_1.FirmaUtil.estimateGas(txRaw)];
|
|
82
80
|
case 2: return [2 /*return*/, _a.sent()];
|
|
83
81
|
case 3:
|
|
84
82
|
error_2 = _a.sent();
|
|
@@ -89,20 +87,18 @@ var FirmaDistributionService = /** @class */ (function () {
|
|
|
89
87
|
});
|
|
90
88
|
});
|
|
91
89
|
};
|
|
92
|
-
FirmaDistributionService.prototype.
|
|
90
|
+
FirmaDistributionService.prototype.getGasEstimationWithdrawValidatorCommission = function (wallet, validatorAddress, txMisc) {
|
|
93
91
|
if (txMisc === void 0) { txMisc = distribution_1.DefaultTxMisc; }
|
|
94
92
|
return __awaiter(this, void 0, void 0, function () {
|
|
95
|
-
var
|
|
93
|
+
var txRaw, error_3;
|
|
96
94
|
return __generator(this, function (_a) {
|
|
97
95
|
switch (_a.label) {
|
|
98
96
|
case 0:
|
|
99
97
|
_a.trys.push([0, 3, , 4]);
|
|
100
|
-
|
|
101
|
-
return [4 /*yield*/, wallet.getAddress()];
|
|
98
|
+
return [4 /*yield*/, this.getSignedTxWithdrawValidatorCommission(wallet, validatorAddress, txMisc)];
|
|
102
99
|
case 1:
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
return [4 /*yield*/, txClient.sign([message], distribution_1.getSignAndBroadcastOption(this._config.denom, txMisc))];
|
|
100
|
+
txRaw = _a.sent();
|
|
101
|
+
return [4 /*yield*/, FirmaUtil_1.FirmaUtil.estimateGas(txRaw)];
|
|
106
102
|
case 2: return [2 /*return*/, _a.sent()];
|
|
107
103
|
case 3:
|
|
108
104
|
error_3 = _a.sent();
|
|
@@ -113,21 +109,18 @@ var FirmaDistributionService = /** @class */ (function () {
|
|
|
113
109
|
});
|
|
114
110
|
});
|
|
115
111
|
};
|
|
116
|
-
FirmaDistributionService.prototype.
|
|
112
|
+
FirmaDistributionService.prototype.getGasEstimationWithdrawAllRewards = function (wallet, validatorAddress, txMisc) {
|
|
117
113
|
if (txMisc === void 0) { txMisc = distribution_1.DefaultTxMisc; }
|
|
118
114
|
return __awaiter(this, void 0, void 0, function () {
|
|
119
|
-
var
|
|
115
|
+
var txRaw, error_4;
|
|
120
116
|
return __generator(this, function (_a) {
|
|
121
117
|
switch (_a.label) {
|
|
122
118
|
case 0:
|
|
123
119
|
_a.trys.push([0, 3, , 4]);
|
|
124
|
-
|
|
125
|
-
return [4 /*yield*/, wallet.getAddress()];
|
|
120
|
+
return [4 /*yield*/, this.getSignedTxWithdrawAllRewards(wallet, validatorAddress, txMisc)];
|
|
126
121
|
case 1:
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
message = txClient.msgFundCommunityPool({ depositor: address, amount: [sendAmount] });
|
|
130
|
-
return [4 /*yield*/, txClient.sign([message], distribution_1.getSignAndBroadcastOption(this._config.denom, txMisc))];
|
|
122
|
+
txRaw = _a.sent();
|
|
123
|
+
return [4 /*yield*/, FirmaUtil_1.FirmaUtil.estimateGas(txRaw)];
|
|
131
124
|
case 2: return [2 /*return*/, _a.sent()];
|
|
132
125
|
case 3:
|
|
133
126
|
error_4 = _a.sent();
|
|
@@ -138,7 +131,7 @@ var FirmaDistributionService = /** @class */ (function () {
|
|
|
138
131
|
});
|
|
139
132
|
});
|
|
140
133
|
};
|
|
141
|
-
FirmaDistributionService.prototype.
|
|
134
|
+
FirmaDistributionService.prototype.getSignedTxWithdrawAllRewards = function (wallet, validatorAddress, txMisc) {
|
|
142
135
|
if (txMisc === void 0) { txMisc = distribution_1.DefaultTxMisc; }
|
|
143
136
|
return __awaiter(this, void 0, void 0, function () {
|
|
144
137
|
var txClient, address, message, error_5;
|
|
@@ -146,12 +139,12 @@ var FirmaDistributionService = /** @class */ (function () {
|
|
|
146
139
|
switch (_a.label) {
|
|
147
140
|
case 0:
|
|
148
141
|
_a.trys.push([0, 3, , 4]);
|
|
149
|
-
txClient = new distribution_1.DistributionTxClient(wallet.getRawWallet(), this.
|
|
142
|
+
txClient = new distribution_1.DistributionTxClient(wallet.getRawWallet(), this.config.rpcAddress);
|
|
150
143
|
return [4 /*yield*/, wallet.getAddress()];
|
|
151
144
|
case 1:
|
|
152
145
|
address = _a.sent();
|
|
153
|
-
message = txClient.
|
|
154
|
-
return [4 /*yield*/, txClient.sign([message], distribution_1.getSignAndBroadcastOption(this.
|
|
146
|
+
message = txClient.msgWithdrawDelegatorReward({ delegatorAddress: address, validatorAddress: validatorAddress });
|
|
147
|
+
return [4 /*yield*/, txClient.sign([message], distribution_1.getSignAndBroadcastOption(this.config.denom, txMisc))];
|
|
155
148
|
case 2: return [2 /*return*/, _a.sent()];
|
|
156
149
|
case 3:
|
|
157
150
|
error_5 = _a.sent();
|
|
@@ -162,10 +155,80 @@ var FirmaDistributionService = /** @class */ (function () {
|
|
|
162
155
|
});
|
|
163
156
|
});
|
|
164
157
|
};
|
|
158
|
+
FirmaDistributionService.prototype.getSignedTxSetWithdrawAddress = function (wallet, withdrawAddress, txMisc) {
|
|
159
|
+
if (txMisc === void 0) { txMisc = distribution_1.DefaultTxMisc; }
|
|
160
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
161
|
+
var txClient, address, message, error_6;
|
|
162
|
+
return __generator(this, function (_a) {
|
|
163
|
+
switch (_a.label) {
|
|
164
|
+
case 0:
|
|
165
|
+
_a.trys.push([0, 3, , 4]);
|
|
166
|
+
txClient = new distribution_1.DistributionTxClient(wallet.getRawWallet(), this.config.rpcAddress);
|
|
167
|
+
return [4 /*yield*/, wallet.getAddress()];
|
|
168
|
+
case 1:
|
|
169
|
+
address = _a.sent();
|
|
170
|
+
message = txClient.msgSetWithdrawAddress({ delegatorAddress: address, withdrawAddress: withdrawAddress });
|
|
171
|
+
return [4 /*yield*/, txClient.sign([message], distribution_1.getSignAndBroadcastOption(this.config.denom, txMisc))];
|
|
172
|
+
case 2: return [2 /*return*/, _a.sent()];
|
|
173
|
+
case 3:
|
|
174
|
+
error_6 = _a.sent();
|
|
175
|
+
FirmaUtil_1.FirmaUtil.printLog(error_6);
|
|
176
|
+
throw error_6;
|
|
177
|
+
case 4: return [2 /*return*/];
|
|
178
|
+
}
|
|
179
|
+
});
|
|
180
|
+
});
|
|
181
|
+
};
|
|
182
|
+
FirmaDistributionService.prototype.getSignedTxFundCommunityPool = function (wallet, amount, txMisc) {
|
|
183
|
+
if (txMisc === void 0) { txMisc = distribution_1.DefaultTxMisc; }
|
|
184
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
185
|
+
var txClient, address, sendAmount, message, error_7;
|
|
186
|
+
return __generator(this, function (_a) {
|
|
187
|
+
switch (_a.label) {
|
|
188
|
+
case 0:
|
|
189
|
+
_a.trys.push([0, 3, , 4]);
|
|
190
|
+
txClient = new distribution_1.DistributionTxClient(wallet.getRawWallet(), this.config.rpcAddress);
|
|
191
|
+
return [4 /*yield*/, wallet.getAddress()];
|
|
192
|
+
case 1:
|
|
193
|
+
address = _a.sent();
|
|
194
|
+
sendAmount = { denom: this.config.denom, amount: FirmaUtil_1.FirmaUtil.getUFCTStringFromFCT(amount) };
|
|
195
|
+
message = txClient.msgFundCommunityPool({ depositor: address, amount: [sendAmount] });
|
|
196
|
+
return [4 /*yield*/, txClient.sign([message], distribution_1.getSignAndBroadcastOption(this.config.denom, txMisc))];
|
|
197
|
+
case 2: return [2 /*return*/, _a.sent()];
|
|
198
|
+
case 3:
|
|
199
|
+
error_7 = _a.sent();
|
|
200
|
+
FirmaUtil_1.FirmaUtil.printLog(error_7);
|
|
201
|
+
throw error_7;
|
|
202
|
+
case 4: return [2 /*return*/];
|
|
203
|
+
}
|
|
204
|
+
});
|
|
205
|
+
});
|
|
206
|
+
};
|
|
207
|
+
FirmaDistributionService.prototype.getSignedTxWithdrawValidatorCommission = function (wallet, validatorAddres, txMisc) {
|
|
208
|
+
if (txMisc === void 0) { txMisc = distribution_1.DefaultTxMisc; }
|
|
209
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
210
|
+
var txClient, message, error_8;
|
|
211
|
+
return __generator(this, function (_a) {
|
|
212
|
+
switch (_a.label) {
|
|
213
|
+
case 0:
|
|
214
|
+
_a.trys.push([0, 2, , 3]);
|
|
215
|
+
txClient = new distribution_1.DistributionTxClient(wallet.getRawWallet(), this.config.rpcAddress);
|
|
216
|
+
message = txClient.msgWithdrawValidatorCommission({ validatorAddress: validatorAddres });
|
|
217
|
+
return [4 /*yield*/, txClient.sign([message], distribution_1.getSignAndBroadcastOption(this.config.denom, txMisc))];
|
|
218
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
219
|
+
case 2:
|
|
220
|
+
error_8 = _a.sent();
|
|
221
|
+
FirmaUtil_1.FirmaUtil.printLog(error_8);
|
|
222
|
+
throw error_8;
|
|
223
|
+
case 3: return [2 /*return*/];
|
|
224
|
+
}
|
|
225
|
+
});
|
|
226
|
+
});
|
|
227
|
+
};
|
|
165
228
|
FirmaDistributionService.prototype.setWithdrawAddress = function (wallet, withdrawAddress, txMisc) {
|
|
166
229
|
if (txMisc === void 0) { txMisc = distribution_1.DefaultTxMisc; }
|
|
167
230
|
return __awaiter(this, void 0, void 0, function () {
|
|
168
|
-
var txRaw, txClient,
|
|
231
|
+
var txRaw, txClient, error_9;
|
|
169
232
|
return __generator(this, function (_a) {
|
|
170
233
|
switch (_a.label) {
|
|
171
234
|
case 0:
|
|
@@ -173,13 +236,13 @@ var FirmaDistributionService = /** @class */ (function () {
|
|
|
173
236
|
return [4 /*yield*/, this.getSignedTxSetWithdrawAddress(wallet, withdrawAddress, txMisc)];
|
|
174
237
|
case 1:
|
|
175
238
|
txRaw = _a.sent();
|
|
176
|
-
txClient = new distribution_1.DistributionTxClient(wallet.getRawWallet(), this.
|
|
239
|
+
txClient = new distribution_1.DistributionTxClient(wallet.getRawWallet(), this.config.rpcAddress);
|
|
177
240
|
return [4 /*yield*/, txClient.broadcast(txRaw)];
|
|
178
241
|
case 2: return [2 /*return*/, _a.sent()];
|
|
179
242
|
case 3:
|
|
180
|
-
|
|
181
|
-
FirmaUtil_1.FirmaUtil.printLog(
|
|
182
|
-
throw
|
|
243
|
+
error_9 = _a.sent();
|
|
244
|
+
FirmaUtil_1.FirmaUtil.printLog(error_9);
|
|
245
|
+
throw error_9;
|
|
183
246
|
case 4: return [2 /*return*/];
|
|
184
247
|
}
|
|
185
248
|
});
|
|
@@ -188,7 +251,7 @@ var FirmaDistributionService = /** @class */ (function () {
|
|
|
188
251
|
FirmaDistributionService.prototype.fundCommunityPool = function (wallet, amount, txMisc) {
|
|
189
252
|
if (txMisc === void 0) { txMisc = distribution_1.DefaultTxMisc; }
|
|
190
253
|
return __awaiter(this, void 0, void 0, function () {
|
|
191
|
-
var txRaw, txClient,
|
|
254
|
+
var txRaw, txClient, error_10;
|
|
192
255
|
return __generator(this, function (_a) {
|
|
193
256
|
switch (_a.label) {
|
|
194
257
|
case 0:
|
|
@@ -196,13 +259,13 @@ var FirmaDistributionService = /** @class */ (function () {
|
|
|
196
259
|
return [4 /*yield*/, this.getSignedTxFundCommunityPool(wallet, amount, txMisc)];
|
|
197
260
|
case 1:
|
|
198
261
|
txRaw = _a.sent();
|
|
199
|
-
txClient = new distribution_1.DistributionTxClient(wallet.getRawWallet(), this.
|
|
262
|
+
txClient = new distribution_1.DistributionTxClient(wallet.getRawWallet(), this.config.rpcAddress);
|
|
200
263
|
return [4 /*yield*/, txClient.broadcast(txRaw)];
|
|
201
264
|
case 2: return [2 /*return*/, _a.sent()];
|
|
202
265
|
case 3:
|
|
203
|
-
|
|
204
|
-
FirmaUtil_1.FirmaUtil.printLog(
|
|
205
|
-
throw
|
|
266
|
+
error_10 = _a.sent();
|
|
267
|
+
FirmaUtil_1.FirmaUtil.printLog(error_10);
|
|
268
|
+
throw error_10;
|
|
206
269
|
case 4: return [2 /*return*/];
|
|
207
270
|
}
|
|
208
271
|
});
|
|
@@ -211,7 +274,7 @@ var FirmaDistributionService = /** @class */ (function () {
|
|
|
211
274
|
FirmaDistributionService.prototype.withdrawValidatorCommission = function (wallet, validatorAddres, txMisc) {
|
|
212
275
|
if (txMisc === void 0) { txMisc = distribution_1.DefaultTxMisc; }
|
|
213
276
|
return __awaiter(this, void 0, void 0, function () {
|
|
214
|
-
var txRaw, txClient,
|
|
277
|
+
var txRaw, txClient, error_11;
|
|
215
278
|
return __generator(this, function (_a) {
|
|
216
279
|
switch (_a.label) {
|
|
217
280
|
case 0:
|
|
@@ -219,13 +282,13 @@ var FirmaDistributionService = /** @class */ (function () {
|
|
|
219
282
|
return [4 /*yield*/, this.getSignedTxWithdrawValidatorCommission(wallet, validatorAddres, txMisc)];
|
|
220
283
|
case 1:
|
|
221
284
|
txRaw = _a.sent();
|
|
222
|
-
txClient = new distribution_1.DistributionTxClient(wallet.getRawWallet(), this.
|
|
285
|
+
txClient = new distribution_1.DistributionTxClient(wallet.getRawWallet(), this.config.rpcAddress);
|
|
223
286
|
return [4 /*yield*/, txClient.broadcast(txRaw)];
|
|
224
287
|
case 2: return [2 /*return*/, _a.sent()];
|
|
225
288
|
case 3:
|
|
226
|
-
|
|
227
|
-
FirmaUtil_1.FirmaUtil.printLog(
|
|
228
|
-
throw
|
|
289
|
+
error_11 = _a.sent();
|
|
290
|
+
FirmaUtil_1.FirmaUtil.printLog(error_11);
|
|
291
|
+
throw error_11;
|
|
229
292
|
case 4: return [2 /*return*/];
|
|
230
293
|
}
|
|
231
294
|
});
|
|
@@ -234,7 +297,7 @@ var FirmaDistributionService = /** @class */ (function () {
|
|
|
234
297
|
FirmaDistributionService.prototype.withdrawAllRewards = function (wallet, validatorAddress, txMisc) {
|
|
235
298
|
if (txMisc === void 0) { txMisc = distribution_1.DefaultTxMisc; }
|
|
236
299
|
return __awaiter(this, void 0, void 0, function () {
|
|
237
|
-
var txRaw, txClient,
|
|
300
|
+
var txRaw, txClient, error_12;
|
|
238
301
|
return __generator(this, function (_a) {
|
|
239
302
|
switch (_a.label) {
|
|
240
303
|
case 0:
|
|
@@ -242,13 +305,13 @@ var FirmaDistributionService = /** @class */ (function () {
|
|
|
242
305
|
return [4 /*yield*/, this.getSignedTxWithdrawAllRewards(wallet, validatorAddress, txMisc)];
|
|
243
306
|
case 1:
|
|
244
307
|
txRaw = _a.sent();
|
|
245
|
-
txClient = new distribution_1.DistributionTxClient(wallet.getRawWallet(), this.
|
|
308
|
+
txClient = new distribution_1.DistributionTxClient(wallet.getRawWallet(), this.config.rpcAddress);
|
|
246
309
|
return [4 /*yield*/, txClient.broadcast(txRaw)];
|
|
247
310
|
case 2: return [2 /*return*/, _a.sent()];
|
|
248
311
|
case 3:
|
|
249
|
-
|
|
250
|
-
FirmaUtil_1.FirmaUtil.printLog(
|
|
251
|
-
throw
|
|
312
|
+
error_12 = _a.sent();
|
|
313
|
+
FirmaUtil_1.FirmaUtil.printLog(error_12);
|
|
314
|
+
throw error_12;
|
|
252
315
|
case 4: return [2 /*return*/];
|
|
253
316
|
}
|
|
254
317
|
});
|
|
@@ -258,20 +321,20 @@ var FirmaDistributionService = /** @class */ (function () {
|
|
|
258
321
|
//
|
|
259
322
|
FirmaDistributionService.prototype.getRewardInfo = function (address, validatorAddress) {
|
|
260
323
|
return __awaiter(this, void 0, void 0, function () {
|
|
261
|
-
var queryClient, result,
|
|
324
|
+
var queryClient, result, error_13;
|
|
262
325
|
return __generator(this, function (_a) {
|
|
263
326
|
switch (_a.label) {
|
|
264
327
|
case 0:
|
|
265
328
|
_a.trys.push([0, 2, , 3]);
|
|
266
|
-
queryClient = new distribution_1.DistributionQueryClient(this.
|
|
329
|
+
queryClient = new distribution_1.DistributionQueryClient(this.config.restApiAddress);
|
|
267
330
|
return [4 /*yield*/, queryClient.queryGetRewardInfo(address, validatorAddress)];
|
|
268
331
|
case 1:
|
|
269
332
|
result = _a.sent();
|
|
270
333
|
return [2 /*return*/, result];
|
|
271
334
|
case 2:
|
|
272
|
-
|
|
273
|
-
FirmaUtil_1.FirmaUtil.printLog(
|
|
274
|
-
throw
|
|
335
|
+
error_13 = _a.sent();
|
|
336
|
+
FirmaUtil_1.FirmaUtil.printLog(error_13);
|
|
337
|
+
throw error_13;
|
|
275
338
|
case 3: return [2 /*return*/];
|
|
276
339
|
}
|
|
277
340
|
});
|
|
@@ -279,20 +342,20 @@ var FirmaDistributionService = /** @class */ (function () {
|
|
|
279
342
|
};
|
|
280
343
|
FirmaDistributionService.prototype.getValidatorOutStandingReward = function (validatorAddress) {
|
|
281
344
|
return __awaiter(this, void 0, void 0, function () {
|
|
282
|
-
var queryClient, result,
|
|
345
|
+
var queryClient, result, error_14;
|
|
283
346
|
return __generator(this, function (_a) {
|
|
284
347
|
switch (_a.label) {
|
|
285
348
|
case 0:
|
|
286
349
|
_a.trys.push([0, 2, , 3]);
|
|
287
|
-
queryClient = new distribution_1.DistributionQueryClient(this.
|
|
350
|
+
queryClient = new distribution_1.DistributionQueryClient(this.config.restApiAddress);
|
|
288
351
|
return [4 /*yield*/, queryClient.queryGetValidatorOutStandingReward(validatorAddress)];
|
|
289
352
|
case 1:
|
|
290
353
|
result = _a.sent();
|
|
291
354
|
return [2 /*return*/, result];
|
|
292
355
|
case 2:
|
|
293
|
-
|
|
294
|
-
FirmaUtil_1.FirmaUtil.printLog(
|
|
295
|
-
throw
|
|
356
|
+
error_14 = _a.sent();
|
|
357
|
+
FirmaUtil_1.FirmaUtil.printLog(error_14);
|
|
358
|
+
throw error_14;
|
|
296
359
|
case 3: return [2 /*return*/];
|
|
297
360
|
}
|
|
298
361
|
});
|
|
@@ -300,20 +363,20 @@ var FirmaDistributionService = /** @class */ (function () {
|
|
|
300
363
|
};
|
|
301
364
|
FirmaDistributionService.prototype.getValidatorCommission = function (validatorAddress) {
|
|
302
365
|
return __awaiter(this, void 0, void 0, function () {
|
|
303
|
-
var queryClient, result,
|
|
366
|
+
var queryClient, result, error_15;
|
|
304
367
|
return __generator(this, function (_a) {
|
|
305
368
|
switch (_a.label) {
|
|
306
369
|
case 0:
|
|
307
370
|
_a.trys.push([0, 2, , 3]);
|
|
308
|
-
queryClient = new distribution_1.DistributionQueryClient(this.
|
|
371
|
+
queryClient = new distribution_1.DistributionQueryClient(this.config.restApiAddress);
|
|
309
372
|
return [4 /*yield*/, queryClient.queryGetValidatorCommission(validatorAddress)];
|
|
310
373
|
case 1:
|
|
311
374
|
result = _a.sent();
|
|
312
375
|
return [2 /*return*/, result];
|
|
313
376
|
case 2:
|
|
314
|
-
|
|
315
|
-
FirmaUtil_1.FirmaUtil.printLog(
|
|
316
|
-
throw
|
|
377
|
+
error_15 = _a.sent();
|
|
378
|
+
FirmaUtil_1.FirmaUtil.printLog(error_15);
|
|
379
|
+
throw error_15;
|
|
317
380
|
case 3: return [2 /*return*/];
|
|
318
381
|
}
|
|
319
382
|
});
|
|
@@ -321,20 +384,20 @@ var FirmaDistributionService = /** @class */ (function () {
|
|
|
321
384
|
};
|
|
322
385
|
FirmaDistributionService.prototype.getTotalRewardInfo = function (address) {
|
|
323
386
|
return __awaiter(this, void 0, void 0, function () {
|
|
324
|
-
var queryClient, result,
|
|
387
|
+
var queryClient, result, error_16;
|
|
325
388
|
return __generator(this, function (_a) {
|
|
326
389
|
switch (_a.label) {
|
|
327
390
|
case 0:
|
|
328
391
|
_a.trys.push([0, 2, , 3]);
|
|
329
|
-
queryClient = new distribution_1.DistributionQueryClient(this.
|
|
392
|
+
queryClient = new distribution_1.DistributionQueryClient(this.config.restApiAddress);
|
|
330
393
|
return [4 /*yield*/, queryClient.queryGetTotalRewardInfo(address)];
|
|
331
394
|
case 1:
|
|
332
395
|
result = _a.sent();
|
|
333
396
|
return [2 /*return*/, result];
|
|
334
397
|
case 2:
|
|
335
|
-
|
|
336
|
-
FirmaUtil_1.FirmaUtil.printLog(
|
|
337
|
-
throw
|
|
398
|
+
error_16 = _a.sent();
|
|
399
|
+
FirmaUtil_1.FirmaUtil.printLog(error_16);
|
|
400
|
+
throw error_16;
|
|
338
401
|
case 3: return [2 /*return*/];
|
|
339
402
|
}
|
|
340
403
|
});
|
|
@@ -342,20 +405,41 @@ var FirmaDistributionService = /** @class */ (function () {
|
|
|
342
405
|
};
|
|
343
406
|
FirmaDistributionService.prototype.getCommunityPool = function () {
|
|
344
407
|
return __awaiter(this, void 0, void 0, function () {
|
|
345
|
-
var queryClient, result,
|
|
408
|
+
var queryClient, result, error_17;
|
|
346
409
|
return __generator(this, function (_a) {
|
|
347
410
|
switch (_a.label) {
|
|
348
411
|
case 0:
|
|
349
412
|
_a.trys.push([0, 2, , 3]);
|
|
350
|
-
queryClient = new distribution_1.DistributionQueryClient(this.
|
|
413
|
+
queryClient = new distribution_1.DistributionQueryClient(this.config.restApiAddress);
|
|
351
414
|
return [4 /*yield*/, queryClient.queryGetCommunityPool()];
|
|
352
415
|
case 1:
|
|
353
416
|
result = _a.sent();
|
|
354
417
|
return [2 /*return*/, result];
|
|
355
418
|
case 2:
|
|
356
|
-
|
|
357
|
-
FirmaUtil_1.FirmaUtil.printLog(
|
|
358
|
-
throw
|
|
419
|
+
error_17 = _a.sent();
|
|
420
|
+
FirmaUtil_1.FirmaUtil.printLog(error_17);
|
|
421
|
+
throw error_17;
|
|
422
|
+
case 3: return [2 /*return*/];
|
|
423
|
+
}
|
|
424
|
+
});
|
|
425
|
+
});
|
|
426
|
+
};
|
|
427
|
+
FirmaDistributionService.prototype.getWithdrawAddress = function (address) {
|
|
428
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
429
|
+
var queryClient, result, error_18;
|
|
430
|
+
return __generator(this, function (_a) {
|
|
431
|
+
switch (_a.label) {
|
|
432
|
+
case 0:
|
|
433
|
+
_a.trys.push([0, 2, , 3]);
|
|
434
|
+
queryClient = new distribution_1.DistributionQueryClient(this.config.restApiAddress);
|
|
435
|
+
return [4 /*yield*/, queryClient.queryGetWithdrawAddress(address)];
|
|
436
|
+
case 1:
|
|
437
|
+
result = _a.sent();
|
|
438
|
+
return [2 /*return*/, result];
|
|
439
|
+
case 2:
|
|
440
|
+
error_18 = _a.sent();
|
|
441
|
+
FirmaUtil_1.FirmaUtil.printLog(error_18);
|
|
442
|
+
throw error_18;
|
|
359
443
|
case 3: return [2 /*return*/];
|
|
360
444
|
}
|
|
361
445
|
});
|
|
@@ -1,15 +1,18 @@
|
|
|
1
|
-
import { TxMisc, BasicFeeGrantOption, PeriodicFeeGrantOption } from
|
|
1
|
+
import { TxMisc, BasicFeeGrantOption, PeriodicFeeGrantOption } from "./firmachain/feegrant";
|
|
2
2
|
import { FirmaWalletService } from "./FirmaWalletService";
|
|
3
3
|
import { FirmaConfig } from "./FirmaConfig";
|
|
4
|
-
import { FeeAllowanceType, FeeAllowanceType1 } from
|
|
5
|
-
import { BroadcastTxResponse } from
|
|
4
|
+
import { FeeAllowanceType, FeeAllowanceType1 } from "./firmachain/feegrant/FeeGrantQueryClient";
|
|
5
|
+
import { BroadcastTxResponse } from "./firmachain/common/stargateclient";
|
|
6
6
|
export declare class FirmaFeeGrantService {
|
|
7
|
-
private
|
|
8
|
-
constructor(
|
|
7
|
+
private readonly config;
|
|
8
|
+
constructor(config: FirmaConfig);
|
|
9
|
+
getGasEstimationRevokeAllowance(wallet: FirmaWalletService, granteeAddress: string, txMisc?: TxMisc): Promise<number>;
|
|
9
10
|
private getSignedTxRevokeAllowance;
|
|
10
11
|
revokeAllowance(wallet: FirmaWalletService, granteeAddress: string, txMisc?: TxMisc): Promise<BroadcastTxResponse>;
|
|
11
12
|
private getCoinType;
|
|
13
|
+
getGasEstimationGrantPeriodicAllowance(wallet: FirmaWalletService, granteeAddress: string, feegrantOption: PeriodicFeeGrantOption, txMisc?: TxMisc): Promise<number>;
|
|
12
14
|
private getSignedTxGrantPeriodicAllowance;
|
|
15
|
+
getGasEstimationGrantBasicAllowance(wallet: FirmaWalletService, granteeAddress: string, feegrantOption?: BasicFeeGrantOption, txMisc?: TxMisc): Promise<number>;
|
|
13
16
|
private getSignedTxGrantBasicAllowance;
|
|
14
17
|
grantPeriodicAllowance(wallet: FirmaWalletService, granteeAddress: string, feegrantOption: PeriodicFeeGrantOption, txMisc?: TxMisc): Promise<BroadcastTxResponse>;
|
|
15
18
|
grantBasicAllowance(wallet: FirmaWalletService, granteeAddress: string, feegrantOption?: BasicFeeGrantOption, txMisc?: TxMisc): Promise<BroadcastTxResponse>;
|