@firmachain/firma-js 0.2.12 → 0.2.16
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/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/sdk/FirmaConfig.js +2 -2
- package/dist/sdk/FirmaDistributionService.d.ts +4 -0
- package/dist/sdk/FirmaDistributionService.js +132 -58
- package/dist/sdk/FirmaMobileSDK.d.ts +27 -0
- package/dist/sdk/FirmaMobileSDK.js +45 -0
- package/dist/sdk/firmachain/bank/BankQueryClient.js +2 -2
- package/dist/sdk/firmachain/common/TxCommon.js +2 -2
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -11,5 +11,6 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
11
11
|
};
|
|
12
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
13
|
__exportStar(require("./sdk/FirmaSDK"), exports);
|
|
14
|
+
__exportStar(require("./sdk/FirmaMobileSDK"), exports);
|
|
14
15
|
__exportStar(require("./sdk/FirmaConfig"), exports);
|
|
15
16
|
__exportStar(require("./sdk/FirmaUtil"), exports);
|
package/dist/sdk/FirmaConfig.js
CHANGED
|
@@ -28,8 +28,8 @@ var FirmaConfig = /** @class */ (function () {
|
|
|
28
28
|
};
|
|
29
29
|
FirmaConfig.TestNetConfig = {
|
|
30
30
|
chainID: "colosseum-1",
|
|
31
|
-
rpcAddress: "https://
|
|
32
|
-
restApiAddress: "https://
|
|
31
|
+
rpcAddress: "https://colosseum-lcd.firmachain.dev:26657",
|
|
32
|
+
restApiAddress: "https://colosseum-lcd.firmachain.dev:1317",
|
|
33
33
|
ipfsNodeAddress: "ipfs-api-firma-devnet.firmachain.org",
|
|
34
34
|
ipfsNodePort: 5001,
|
|
35
35
|
ipfsWebApiAddress: "https://ipfs-firma-devnet.firmachain.org",
|
|
@@ -3,12 +3,14 @@ import { FirmaWalletService } from "./FirmaWalletService";
|
|
|
3
3
|
import { FirmaConfig } from "./FirmaConfig";
|
|
4
4
|
import { BroadcastTxResponse } from "./firmachain/common/stargateclient";
|
|
5
5
|
import { Coin } from "cosmjs-types/cosmos/base/v1beta1/coin";
|
|
6
|
+
import { DelegationInfo } from "./firmachain/staking";
|
|
6
7
|
export declare class FirmaDistributionService {
|
|
7
8
|
private readonly config;
|
|
8
9
|
constructor(config: FirmaConfig);
|
|
9
10
|
getGasEstimationSetWithdrawAddress(wallet: FirmaWalletService, withdrawAddress: string, txMisc?: TxMisc): Promise<number>;
|
|
10
11
|
getGasEstimationFundCommunityPool(wallet: FirmaWalletService, amount: number, txMisc?: TxMisc): Promise<number>;
|
|
11
12
|
getGasEstimationWithdrawValidatorCommission(wallet: FirmaWalletService, validatorAddress: string, txMisc?: TxMisc): Promise<number>;
|
|
13
|
+
getGasEstimationWithdrawAllRewardsFromAllValidator(wallet: FirmaWalletService, delegationList: DelegationInfo[], txMisc?: TxMisc): Promise<number>;
|
|
12
14
|
getGasEstimationWithdrawAllRewards(wallet: FirmaWalletService, validatorAddress: string, txMisc?: TxMisc): Promise<number>;
|
|
13
15
|
private getSignedTxWithdrawAllRewards;
|
|
14
16
|
private getSignedTxSetWithdrawAddress;
|
|
@@ -17,6 +19,8 @@ export declare class FirmaDistributionService {
|
|
|
17
19
|
setWithdrawAddress(wallet: FirmaWalletService, withdrawAddress: string, txMisc?: TxMisc): Promise<BroadcastTxResponse>;
|
|
18
20
|
fundCommunityPool(wallet: FirmaWalletService, amount: number, txMisc?: TxMisc): Promise<BroadcastTxResponse>;
|
|
19
21
|
withdrawValidatorCommission(wallet: FirmaWalletService, validatorAddres: string, txMisc?: TxMisc): Promise<BroadcastTxResponse>;
|
|
22
|
+
private getSignedTxwithdrawAllRewardsFromAllValidator;
|
|
23
|
+
withdrawAllRewardsFromAllValidator(wallet: FirmaWalletService, delegationList: DelegationInfo[], txMisc?: TxMisc): Promise<BroadcastTxResponse>;
|
|
20
24
|
withdrawAllRewards(wallet: FirmaWalletService, validatorAddress: string, txMisc?: TxMisc): Promise<BroadcastTxResponse>;
|
|
21
25
|
getRewardInfo(address: string, validatorAddress: string): Promise<string>;
|
|
22
26
|
getValidatorOutStandingReward(validatorAddress: string): Promise<Coin[]>;
|
|
@@ -109,7 +109,7 @@ var FirmaDistributionService = /** @class */ (function () {
|
|
|
109
109
|
});
|
|
110
110
|
});
|
|
111
111
|
};
|
|
112
|
-
FirmaDistributionService.prototype.
|
|
112
|
+
FirmaDistributionService.prototype.getGasEstimationWithdrawAllRewardsFromAllValidator = function (wallet, delegationList, txMisc) {
|
|
113
113
|
if (txMisc === void 0) { txMisc = distribution_1.DefaultTxMisc; }
|
|
114
114
|
return __awaiter(this, void 0, void 0, function () {
|
|
115
115
|
var txRaw, error_4;
|
|
@@ -117,7 +117,7 @@ var FirmaDistributionService = /** @class */ (function () {
|
|
|
117
117
|
switch (_a.label) {
|
|
118
118
|
case 0:
|
|
119
119
|
_a.trys.push([0, 3, , 4]);
|
|
120
|
-
return [4 /*yield*/, this.
|
|
120
|
+
return [4 /*yield*/, this.getSignedTxwithdrawAllRewardsFromAllValidator(wallet, delegationList, txMisc)];
|
|
121
121
|
case 1:
|
|
122
122
|
txRaw = _a.sent();
|
|
123
123
|
return [4 /*yield*/, FirmaUtil_1.FirmaUtil.estimateGas(txRaw)];
|
|
@@ -131,10 +131,32 @@ var FirmaDistributionService = /** @class */ (function () {
|
|
|
131
131
|
});
|
|
132
132
|
});
|
|
133
133
|
};
|
|
134
|
+
FirmaDistributionService.prototype.getGasEstimationWithdrawAllRewards = function (wallet, validatorAddress, txMisc) {
|
|
135
|
+
if (txMisc === void 0) { txMisc = distribution_1.DefaultTxMisc; }
|
|
136
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
137
|
+
var txRaw, error_5;
|
|
138
|
+
return __generator(this, function (_a) {
|
|
139
|
+
switch (_a.label) {
|
|
140
|
+
case 0:
|
|
141
|
+
_a.trys.push([0, 3, , 4]);
|
|
142
|
+
return [4 /*yield*/, this.getSignedTxWithdrawAllRewards(wallet, validatorAddress, txMisc)];
|
|
143
|
+
case 1:
|
|
144
|
+
txRaw = _a.sent();
|
|
145
|
+
return [4 /*yield*/, FirmaUtil_1.FirmaUtil.estimateGas(txRaw)];
|
|
146
|
+
case 2: return [2 /*return*/, _a.sent()];
|
|
147
|
+
case 3:
|
|
148
|
+
error_5 = _a.sent();
|
|
149
|
+
FirmaUtil_1.FirmaUtil.printLog(error_5);
|
|
150
|
+
throw error_5;
|
|
151
|
+
case 4: return [2 /*return*/];
|
|
152
|
+
}
|
|
153
|
+
});
|
|
154
|
+
});
|
|
155
|
+
};
|
|
134
156
|
FirmaDistributionService.prototype.getSignedTxWithdrawAllRewards = function (wallet, validatorAddress, txMisc) {
|
|
135
157
|
if (txMisc === void 0) { txMisc = distribution_1.DefaultTxMisc; }
|
|
136
158
|
return __awaiter(this, void 0, void 0, function () {
|
|
137
|
-
var txClient, address, message,
|
|
159
|
+
var txClient, address, message, error_6;
|
|
138
160
|
return __generator(this, function (_a) {
|
|
139
161
|
switch (_a.label) {
|
|
140
162
|
case 0:
|
|
@@ -147,9 +169,9 @@ var FirmaDistributionService = /** @class */ (function () {
|
|
|
147
169
|
return [4 /*yield*/, txClient.sign([message], distribution_1.getSignAndBroadcastOption(this.config.denom, txMisc))];
|
|
148
170
|
case 2: return [2 /*return*/, _a.sent()];
|
|
149
171
|
case 3:
|
|
150
|
-
|
|
151
|
-
FirmaUtil_1.FirmaUtil.printLog(
|
|
152
|
-
throw
|
|
172
|
+
error_6 = _a.sent();
|
|
173
|
+
FirmaUtil_1.FirmaUtil.printLog(error_6);
|
|
174
|
+
throw error_6;
|
|
153
175
|
case 4: return [2 /*return*/];
|
|
154
176
|
}
|
|
155
177
|
});
|
|
@@ -158,7 +180,7 @@ var FirmaDistributionService = /** @class */ (function () {
|
|
|
158
180
|
FirmaDistributionService.prototype.getSignedTxSetWithdrawAddress = function (wallet, withdrawAddress, txMisc) {
|
|
159
181
|
if (txMisc === void 0) { txMisc = distribution_1.DefaultTxMisc; }
|
|
160
182
|
return __awaiter(this, void 0, void 0, function () {
|
|
161
|
-
var txClient, address, message,
|
|
183
|
+
var txClient, address, message, error_7;
|
|
162
184
|
return __generator(this, function (_a) {
|
|
163
185
|
switch (_a.label) {
|
|
164
186
|
case 0:
|
|
@@ -171,9 +193,9 @@ var FirmaDistributionService = /** @class */ (function () {
|
|
|
171
193
|
return [4 /*yield*/, txClient.sign([message], distribution_1.getSignAndBroadcastOption(this.config.denom, txMisc))];
|
|
172
194
|
case 2: return [2 /*return*/, _a.sent()];
|
|
173
195
|
case 3:
|
|
174
|
-
|
|
175
|
-
FirmaUtil_1.FirmaUtil.printLog(
|
|
176
|
-
throw
|
|
196
|
+
error_7 = _a.sent();
|
|
197
|
+
FirmaUtil_1.FirmaUtil.printLog(error_7);
|
|
198
|
+
throw error_7;
|
|
177
199
|
case 4: return [2 /*return*/];
|
|
178
200
|
}
|
|
179
201
|
});
|
|
@@ -182,7 +204,7 @@ var FirmaDistributionService = /** @class */ (function () {
|
|
|
182
204
|
FirmaDistributionService.prototype.getSignedTxFundCommunityPool = function (wallet, amount, txMisc) {
|
|
183
205
|
if (txMisc === void 0) { txMisc = distribution_1.DefaultTxMisc; }
|
|
184
206
|
return __awaiter(this, void 0, void 0, function () {
|
|
185
|
-
var txClient, address, sendAmount, message,
|
|
207
|
+
var txClient, address, sendAmount, message, error_8;
|
|
186
208
|
return __generator(this, function (_a) {
|
|
187
209
|
switch (_a.label) {
|
|
188
210
|
case 0:
|
|
@@ -196,9 +218,9 @@ var FirmaDistributionService = /** @class */ (function () {
|
|
|
196
218
|
return [4 /*yield*/, txClient.sign([message], distribution_1.getSignAndBroadcastOption(this.config.denom, txMisc))];
|
|
197
219
|
case 2: return [2 /*return*/, _a.sent()];
|
|
198
220
|
case 3:
|
|
199
|
-
|
|
200
|
-
FirmaUtil_1.FirmaUtil.printLog(
|
|
201
|
-
throw
|
|
221
|
+
error_8 = _a.sent();
|
|
222
|
+
FirmaUtil_1.FirmaUtil.printLog(error_8);
|
|
223
|
+
throw error_8;
|
|
202
224
|
case 4: return [2 /*return*/];
|
|
203
225
|
}
|
|
204
226
|
});
|
|
@@ -207,7 +229,7 @@ var FirmaDistributionService = /** @class */ (function () {
|
|
|
207
229
|
FirmaDistributionService.prototype.getSignedTxWithdrawValidatorCommission = function (wallet, validatorAddres, txMisc) {
|
|
208
230
|
if (txMisc === void 0) { txMisc = distribution_1.DefaultTxMisc; }
|
|
209
231
|
return __awaiter(this, void 0, void 0, function () {
|
|
210
|
-
var txClient, message,
|
|
232
|
+
var txClient, message, error_9;
|
|
211
233
|
return __generator(this, function (_a) {
|
|
212
234
|
switch (_a.label) {
|
|
213
235
|
case 0:
|
|
@@ -217,9 +239,9 @@ var FirmaDistributionService = /** @class */ (function () {
|
|
|
217
239
|
return [4 /*yield*/, txClient.sign([message], distribution_1.getSignAndBroadcastOption(this.config.denom, txMisc))];
|
|
218
240
|
case 1: return [2 /*return*/, _a.sent()];
|
|
219
241
|
case 2:
|
|
220
|
-
|
|
221
|
-
FirmaUtil_1.FirmaUtil.printLog(
|
|
222
|
-
throw
|
|
242
|
+
error_9 = _a.sent();
|
|
243
|
+
FirmaUtil_1.FirmaUtil.printLog(error_9);
|
|
244
|
+
throw error_9;
|
|
223
245
|
case 3: return [2 /*return*/];
|
|
224
246
|
}
|
|
225
247
|
});
|
|
@@ -228,7 +250,7 @@ var FirmaDistributionService = /** @class */ (function () {
|
|
|
228
250
|
FirmaDistributionService.prototype.setWithdrawAddress = function (wallet, withdrawAddress, txMisc) {
|
|
229
251
|
if (txMisc === void 0) { txMisc = distribution_1.DefaultTxMisc; }
|
|
230
252
|
return __awaiter(this, void 0, void 0, function () {
|
|
231
|
-
var txRaw, txClient,
|
|
253
|
+
var txRaw, txClient, error_10;
|
|
232
254
|
return __generator(this, function (_a) {
|
|
233
255
|
switch (_a.label) {
|
|
234
256
|
case 0:
|
|
@@ -240,9 +262,9 @@ var FirmaDistributionService = /** @class */ (function () {
|
|
|
240
262
|
return [4 /*yield*/, txClient.broadcast(txRaw)];
|
|
241
263
|
case 2: return [2 /*return*/, _a.sent()];
|
|
242
264
|
case 3:
|
|
243
|
-
|
|
244
|
-
FirmaUtil_1.FirmaUtil.printLog(
|
|
245
|
-
throw
|
|
265
|
+
error_10 = _a.sent();
|
|
266
|
+
FirmaUtil_1.FirmaUtil.printLog(error_10);
|
|
267
|
+
throw error_10;
|
|
246
268
|
case 4: return [2 /*return*/];
|
|
247
269
|
}
|
|
248
270
|
});
|
|
@@ -251,7 +273,7 @@ var FirmaDistributionService = /** @class */ (function () {
|
|
|
251
273
|
FirmaDistributionService.prototype.fundCommunityPool = function (wallet, amount, txMisc) {
|
|
252
274
|
if (txMisc === void 0) { txMisc = distribution_1.DefaultTxMisc; }
|
|
253
275
|
return __awaiter(this, void 0, void 0, function () {
|
|
254
|
-
var txRaw, txClient,
|
|
276
|
+
var txRaw, txClient, error_11;
|
|
255
277
|
return __generator(this, function (_a) {
|
|
256
278
|
switch (_a.label) {
|
|
257
279
|
case 0:
|
|
@@ -263,9 +285,9 @@ var FirmaDistributionService = /** @class */ (function () {
|
|
|
263
285
|
return [4 /*yield*/, txClient.broadcast(txRaw)];
|
|
264
286
|
case 2: return [2 /*return*/, _a.sent()];
|
|
265
287
|
case 3:
|
|
266
|
-
|
|
267
|
-
FirmaUtil_1.FirmaUtil.printLog(
|
|
268
|
-
throw
|
|
288
|
+
error_11 = _a.sent();
|
|
289
|
+
FirmaUtil_1.FirmaUtil.printLog(error_11);
|
|
290
|
+
throw error_11;
|
|
269
291
|
case 4: return [2 /*return*/];
|
|
270
292
|
}
|
|
271
293
|
});
|
|
@@ -274,7 +296,7 @@ var FirmaDistributionService = /** @class */ (function () {
|
|
|
274
296
|
FirmaDistributionService.prototype.withdrawValidatorCommission = function (wallet, validatorAddres, txMisc) {
|
|
275
297
|
if (txMisc === void 0) { txMisc = distribution_1.DefaultTxMisc; }
|
|
276
298
|
return __awaiter(this, void 0, void 0, function () {
|
|
277
|
-
var txRaw, txClient,
|
|
299
|
+
var txRaw, txClient, error_12;
|
|
278
300
|
return __generator(this, function (_a) {
|
|
279
301
|
switch (_a.label) {
|
|
280
302
|
case 0:
|
|
@@ -286,9 +308,61 @@ var FirmaDistributionService = /** @class */ (function () {
|
|
|
286
308
|
return [4 /*yield*/, txClient.broadcast(txRaw)];
|
|
287
309
|
case 2: return [2 /*return*/, _a.sent()];
|
|
288
310
|
case 3:
|
|
289
|
-
|
|
290
|
-
FirmaUtil_1.FirmaUtil.printLog(
|
|
291
|
-
throw
|
|
311
|
+
error_12 = _a.sent();
|
|
312
|
+
FirmaUtil_1.FirmaUtil.printLog(error_12);
|
|
313
|
+
throw error_12;
|
|
314
|
+
case 4: return [2 /*return*/];
|
|
315
|
+
}
|
|
316
|
+
});
|
|
317
|
+
});
|
|
318
|
+
};
|
|
319
|
+
FirmaDistributionService.prototype.getSignedTxwithdrawAllRewardsFromAllValidator = function (wallet, delegationList, txMisc) {
|
|
320
|
+
if (txMisc === void 0) { txMisc = distribution_1.DefaultTxMisc; }
|
|
321
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
322
|
+
var address, txClient, messageList, i, validatorAddress, message, error_13;
|
|
323
|
+
return __generator(this, function (_a) {
|
|
324
|
+
switch (_a.label) {
|
|
325
|
+
case 0:
|
|
326
|
+
_a.trys.push([0, 3, , 4]);
|
|
327
|
+
return [4 /*yield*/, wallet.getAddress()];
|
|
328
|
+
case 1:
|
|
329
|
+
address = _a.sent();
|
|
330
|
+
txClient = new distribution_1.DistributionTxClient(wallet.getRawWallet(), this.config.rpcAddress);
|
|
331
|
+
messageList = [];
|
|
332
|
+
for (i = 0; i < delegationList.length; i++) {
|
|
333
|
+
validatorAddress = delegationList[i].delegation.validator_address;
|
|
334
|
+
message = txClient.msgWithdrawDelegatorReward({ delegatorAddress: address, validatorAddress: validatorAddress });
|
|
335
|
+
messageList.push(message);
|
|
336
|
+
}
|
|
337
|
+
return [4 /*yield*/, txClient.sign(messageList, distribution_1.getSignAndBroadcastOption(this.config.denom, txMisc))];
|
|
338
|
+
case 2: return [2 /*return*/, _a.sent()];
|
|
339
|
+
case 3:
|
|
340
|
+
error_13 = _a.sent();
|
|
341
|
+
FirmaUtil_1.FirmaUtil.printLog(error_13);
|
|
342
|
+
throw error_13;
|
|
343
|
+
case 4: return [2 /*return*/];
|
|
344
|
+
}
|
|
345
|
+
});
|
|
346
|
+
});
|
|
347
|
+
};
|
|
348
|
+
FirmaDistributionService.prototype.withdrawAllRewardsFromAllValidator = function (wallet, delegationList, txMisc) {
|
|
349
|
+
if (txMisc === void 0) { txMisc = distribution_1.DefaultTxMisc; }
|
|
350
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
351
|
+
var txRaw, txClient, error_14;
|
|
352
|
+
return __generator(this, function (_a) {
|
|
353
|
+
switch (_a.label) {
|
|
354
|
+
case 0:
|
|
355
|
+
_a.trys.push([0, 3, , 4]);
|
|
356
|
+
return [4 /*yield*/, this.getSignedTxwithdrawAllRewardsFromAllValidator(wallet, delegationList, txMisc)];
|
|
357
|
+
case 1:
|
|
358
|
+
txRaw = _a.sent();
|
|
359
|
+
txClient = new distribution_1.DistributionTxClient(wallet.getRawWallet(), this.config.rpcAddress);
|
|
360
|
+
return [4 /*yield*/, txClient.broadcast(txRaw)];
|
|
361
|
+
case 2: return [2 /*return*/, _a.sent()];
|
|
362
|
+
case 3:
|
|
363
|
+
error_14 = _a.sent();
|
|
364
|
+
FirmaUtil_1.FirmaUtil.printLog(error_14);
|
|
365
|
+
throw error_14;
|
|
292
366
|
case 4: return [2 /*return*/];
|
|
293
367
|
}
|
|
294
368
|
});
|
|
@@ -297,7 +371,7 @@ var FirmaDistributionService = /** @class */ (function () {
|
|
|
297
371
|
FirmaDistributionService.prototype.withdrawAllRewards = function (wallet, validatorAddress, txMisc) {
|
|
298
372
|
if (txMisc === void 0) { txMisc = distribution_1.DefaultTxMisc; }
|
|
299
373
|
return __awaiter(this, void 0, void 0, function () {
|
|
300
|
-
var txRaw, txClient,
|
|
374
|
+
var txRaw, txClient, error_15;
|
|
301
375
|
return __generator(this, function (_a) {
|
|
302
376
|
switch (_a.label) {
|
|
303
377
|
case 0:
|
|
@@ -309,9 +383,9 @@ var FirmaDistributionService = /** @class */ (function () {
|
|
|
309
383
|
return [4 /*yield*/, txClient.broadcast(txRaw)];
|
|
310
384
|
case 2: return [2 /*return*/, _a.sent()];
|
|
311
385
|
case 3:
|
|
312
|
-
|
|
313
|
-
FirmaUtil_1.FirmaUtil.printLog(
|
|
314
|
-
throw
|
|
386
|
+
error_15 = _a.sent();
|
|
387
|
+
FirmaUtil_1.FirmaUtil.printLog(error_15);
|
|
388
|
+
throw error_15;
|
|
315
389
|
case 4: return [2 /*return*/];
|
|
316
390
|
}
|
|
317
391
|
});
|
|
@@ -321,7 +395,7 @@ var FirmaDistributionService = /** @class */ (function () {
|
|
|
321
395
|
//
|
|
322
396
|
FirmaDistributionService.prototype.getRewardInfo = function (address, validatorAddress) {
|
|
323
397
|
return __awaiter(this, void 0, void 0, function () {
|
|
324
|
-
var queryClient, result,
|
|
398
|
+
var queryClient, result, error_16;
|
|
325
399
|
return __generator(this, function (_a) {
|
|
326
400
|
switch (_a.label) {
|
|
327
401
|
case 0:
|
|
@@ -332,9 +406,9 @@ var FirmaDistributionService = /** @class */ (function () {
|
|
|
332
406
|
result = _a.sent();
|
|
333
407
|
return [2 /*return*/, result];
|
|
334
408
|
case 2:
|
|
335
|
-
|
|
336
|
-
FirmaUtil_1.FirmaUtil.printLog(
|
|
337
|
-
throw
|
|
409
|
+
error_16 = _a.sent();
|
|
410
|
+
FirmaUtil_1.FirmaUtil.printLog(error_16);
|
|
411
|
+
throw error_16;
|
|
338
412
|
case 3: return [2 /*return*/];
|
|
339
413
|
}
|
|
340
414
|
});
|
|
@@ -342,7 +416,7 @@ var FirmaDistributionService = /** @class */ (function () {
|
|
|
342
416
|
};
|
|
343
417
|
FirmaDistributionService.prototype.getValidatorOutStandingReward = function (validatorAddress) {
|
|
344
418
|
return __awaiter(this, void 0, void 0, function () {
|
|
345
|
-
var queryClient, result,
|
|
419
|
+
var queryClient, result, error_17;
|
|
346
420
|
return __generator(this, function (_a) {
|
|
347
421
|
switch (_a.label) {
|
|
348
422
|
case 0:
|
|
@@ -353,9 +427,9 @@ var FirmaDistributionService = /** @class */ (function () {
|
|
|
353
427
|
result = _a.sent();
|
|
354
428
|
return [2 /*return*/, result];
|
|
355
429
|
case 2:
|
|
356
|
-
|
|
357
|
-
FirmaUtil_1.FirmaUtil.printLog(
|
|
358
|
-
throw
|
|
430
|
+
error_17 = _a.sent();
|
|
431
|
+
FirmaUtil_1.FirmaUtil.printLog(error_17);
|
|
432
|
+
throw error_17;
|
|
359
433
|
case 3: return [2 /*return*/];
|
|
360
434
|
}
|
|
361
435
|
});
|
|
@@ -363,7 +437,7 @@ var FirmaDistributionService = /** @class */ (function () {
|
|
|
363
437
|
};
|
|
364
438
|
FirmaDistributionService.prototype.getValidatorCommission = function (validatorAddress) {
|
|
365
439
|
return __awaiter(this, void 0, void 0, function () {
|
|
366
|
-
var queryClient, result,
|
|
440
|
+
var queryClient, result, error_18;
|
|
367
441
|
return __generator(this, function (_a) {
|
|
368
442
|
switch (_a.label) {
|
|
369
443
|
case 0:
|
|
@@ -374,9 +448,9 @@ var FirmaDistributionService = /** @class */ (function () {
|
|
|
374
448
|
result = _a.sent();
|
|
375
449
|
return [2 /*return*/, result];
|
|
376
450
|
case 2:
|
|
377
|
-
|
|
378
|
-
FirmaUtil_1.FirmaUtil.printLog(
|
|
379
|
-
throw
|
|
451
|
+
error_18 = _a.sent();
|
|
452
|
+
FirmaUtil_1.FirmaUtil.printLog(error_18);
|
|
453
|
+
throw error_18;
|
|
380
454
|
case 3: return [2 /*return*/];
|
|
381
455
|
}
|
|
382
456
|
});
|
|
@@ -384,7 +458,7 @@ var FirmaDistributionService = /** @class */ (function () {
|
|
|
384
458
|
};
|
|
385
459
|
FirmaDistributionService.prototype.getTotalRewardInfo = function (address) {
|
|
386
460
|
return __awaiter(this, void 0, void 0, function () {
|
|
387
|
-
var queryClient, result,
|
|
461
|
+
var queryClient, result, error_19;
|
|
388
462
|
return __generator(this, function (_a) {
|
|
389
463
|
switch (_a.label) {
|
|
390
464
|
case 0:
|
|
@@ -395,9 +469,9 @@ var FirmaDistributionService = /** @class */ (function () {
|
|
|
395
469
|
result = _a.sent();
|
|
396
470
|
return [2 /*return*/, result];
|
|
397
471
|
case 2:
|
|
398
|
-
|
|
399
|
-
FirmaUtil_1.FirmaUtil.printLog(
|
|
400
|
-
throw
|
|
472
|
+
error_19 = _a.sent();
|
|
473
|
+
FirmaUtil_1.FirmaUtil.printLog(error_19);
|
|
474
|
+
throw error_19;
|
|
401
475
|
case 3: return [2 /*return*/];
|
|
402
476
|
}
|
|
403
477
|
});
|
|
@@ -405,7 +479,7 @@ var FirmaDistributionService = /** @class */ (function () {
|
|
|
405
479
|
};
|
|
406
480
|
FirmaDistributionService.prototype.getCommunityPool = function () {
|
|
407
481
|
return __awaiter(this, void 0, void 0, function () {
|
|
408
|
-
var queryClient, result,
|
|
482
|
+
var queryClient, result, error_20;
|
|
409
483
|
return __generator(this, function (_a) {
|
|
410
484
|
switch (_a.label) {
|
|
411
485
|
case 0:
|
|
@@ -416,9 +490,9 @@ var FirmaDistributionService = /** @class */ (function () {
|
|
|
416
490
|
result = _a.sent();
|
|
417
491
|
return [2 /*return*/, result];
|
|
418
492
|
case 2:
|
|
419
|
-
|
|
420
|
-
FirmaUtil_1.FirmaUtil.printLog(
|
|
421
|
-
throw
|
|
493
|
+
error_20 = _a.sent();
|
|
494
|
+
FirmaUtil_1.FirmaUtil.printLog(error_20);
|
|
495
|
+
throw error_20;
|
|
422
496
|
case 3: return [2 /*return*/];
|
|
423
497
|
}
|
|
424
498
|
});
|
|
@@ -426,7 +500,7 @@ var FirmaDistributionService = /** @class */ (function () {
|
|
|
426
500
|
};
|
|
427
501
|
FirmaDistributionService.prototype.getWithdrawAddress = function (address) {
|
|
428
502
|
return __awaiter(this, void 0, void 0, function () {
|
|
429
|
-
var queryClient, result,
|
|
503
|
+
var queryClient, result, error_21;
|
|
430
504
|
return __generator(this, function (_a) {
|
|
431
505
|
switch (_a.label) {
|
|
432
506
|
case 0:
|
|
@@ -437,9 +511,9 @@ var FirmaDistributionService = /** @class */ (function () {
|
|
|
437
511
|
result = _a.sent();
|
|
438
512
|
return [2 /*return*/, result];
|
|
439
513
|
case 2:
|
|
440
|
-
|
|
441
|
-
FirmaUtil_1.FirmaUtil.printLog(
|
|
442
|
-
throw
|
|
514
|
+
error_21 = _a.sent();
|
|
515
|
+
FirmaUtil_1.FirmaUtil.printLog(error_21);
|
|
516
|
+
throw error_21;
|
|
443
517
|
case 3: return [2 /*return*/];
|
|
444
518
|
}
|
|
445
519
|
});
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { FirmaConfig } from "./FirmaConfig";
|
|
2
|
+
import { FirmaBankService } from "./FirmaBankService";
|
|
3
|
+
import { FirmaFeeGrantService } from "./FirmaFeeGrantService";
|
|
4
|
+
import { FirmaStakingService } from "./FirmaStakingService";
|
|
5
|
+
import { FirmaDistributionService } from "./FirmaDistributionService";
|
|
6
|
+
import { NftService } from "./FirmaNftService";
|
|
7
|
+
import { TokenService } from "./FirmaTokenService";
|
|
8
|
+
import { ContractService } from "./FirmaContractService";
|
|
9
|
+
import { FirmaWalletService } from "./FirmaWalletService";
|
|
10
|
+
import { FirmaGovService } from "./FirmaGovService";
|
|
11
|
+
import { ChainService } from "./FirmaChainService";
|
|
12
|
+
import { SlashingService } from "./FirmaSlashingService";
|
|
13
|
+
export declare class FirmaMobileSDK {
|
|
14
|
+
Config: FirmaConfig;
|
|
15
|
+
Wallet: FirmaWalletService;
|
|
16
|
+
Bank: FirmaBankService;
|
|
17
|
+
FeeGrant: FirmaFeeGrantService;
|
|
18
|
+
Staking: FirmaStakingService;
|
|
19
|
+
Distribution: FirmaDistributionService;
|
|
20
|
+
Gov: FirmaGovService;
|
|
21
|
+
Nft: NftService;
|
|
22
|
+
Token: TokenService;
|
|
23
|
+
Contract: ContractService;
|
|
24
|
+
BlockChain: ChainService;
|
|
25
|
+
Slashing: SlashingService;
|
|
26
|
+
constructor(Config: FirmaConfig, Wallet?: FirmaWalletService, Bank?: FirmaBankService, FeeGrant?: FirmaFeeGrantService, Staking?: FirmaStakingService, Distribution?: FirmaDistributionService, Gov?: FirmaGovService, Nft?: NftService, Token?: TokenService, Contract?: ContractService, BlockChain?: ChainService, Slashing?: SlashingService);
|
|
27
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FirmaMobileSDK = void 0;
|
|
4
|
+
var FirmaBankService_1 = require("./FirmaBankService");
|
|
5
|
+
var FirmaFeeGrantService_1 = require("./FirmaFeeGrantService");
|
|
6
|
+
var FirmaStakingService_1 = require("./FirmaStakingService");
|
|
7
|
+
var FirmaDistributionService_1 = require("./FirmaDistributionService");
|
|
8
|
+
var FirmaNftService_1 = require("./FirmaNftService");
|
|
9
|
+
var FirmaTokenService_1 = require("./FirmaTokenService");
|
|
10
|
+
var FirmaContractService_1 = require("./FirmaContractService");
|
|
11
|
+
var FirmaWalletService_1 = require("./FirmaWalletService");
|
|
12
|
+
var FirmaUtil_1 = require("./FirmaUtil");
|
|
13
|
+
var FirmaGovService_1 = require("./FirmaGovService");
|
|
14
|
+
var FirmaChainService_1 = require("./FirmaChainService");
|
|
15
|
+
var FirmaSlashingService_1 = require("./FirmaSlashingService");
|
|
16
|
+
var FirmaMobileSDK = /** @class */ (function () {
|
|
17
|
+
function FirmaMobileSDK(Config, Wallet, Bank, FeeGrant, Staking, Distribution, Gov, Nft, Token, Contract, BlockChain, Slashing) {
|
|
18
|
+
if (Wallet === void 0) { Wallet = new FirmaWalletService_1.FirmaWalletService(Config); }
|
|
19
|
+
if (Bank === void 0) { Bank = new FirmaBankService_1.FirmaBankService(Config); }
|
|
20
|
+
if (FeeGrant === void 0) { FeeGrant = new FirmaFeeGrantService_1.FirmaFeeGrantService(Config); }
|
|
21
|
+
if (Staking === void 0) { Staking = new FirmaStakingService_1.FirmaStakingService(Config); }
|
|
22
|
+
if (Distribution === void 0) { Distribution = new FirmaDistributionService_1.FirmaDistributionService(Config); }
|
|
23
|
+
if (Gov === void 0) { Gov = new FirmaGovService_1.FirmaGovService(Config); }
|
|
24
|
+
if (Nft === void 0) { Nft = new FirmaNftService_1.NftService(Config); }
|
|
25
|
+
if (Token === void 0) { Token = new FirmaTokenService_1.TokenService(Config); }
|
|
26
|
+
if (Contract === void 0) { Contract = new FirmaContractService_1.ContractService(Config); }
|
|
27
|
+
if (BlockChain === void 0) { BlockChain = new FirmaChainService_1.ChainService(Config); }
|
|
28
|
+
if (Slashing === void 0) { Slashing = new FirmaSlashingService_1.SlashingService(Config); }
|
|
29
|
+
this.Config = Config;
|
|
30
|
+
this.Wallet = Wallet;
|
|
31
|
+
this.Bank = Bank;
|
|
32
|
+
this.FeeGrant = FeeGrant;
|
|
33
|
+
this.Staking = Staking;
|
|
34
|
+
this.Distribution = Distribution;
|
|
35
|
+
this.Gov = Gov;
|
|
36
|
+
this.Nft = Nft;
|
|
37
|
+
this.Token = Token;
|
|
38
|
+
this.Contract = Contract;
|
|
39
|
+
this.BlockChain = BlockChain;
|
|
40
|
+
this.Slashing = Slashing;
|
|
41
|
+
FirmaUtil_1.FirmaUtil.config = Config;
|
|
42
|
+
}
|
|
43
|
+
return FirmaMobileSDK;
|
|
44
|
+
}());
|
|
45
|
+
exports.FirmaMobileSDK = FirmaMobileSDK;
|
|
@@ -72,7 +72,7 @@ var BankQueryClient = /** @class */ (function () {
|
|
|
72
72
|
return __generator(this, function (_a) {
|
|
73
73
|
switch (_a.label) {
|
|
74
74
|
case 0:
|
|
75
|
-
path = "/cosmos/bank/v1beta1/balances/" + address + "/" + denom;
|
|
75
|
+
path = "/cosmos/bank/v1beta1/balances/" + address + "/by_denom?denom=" + denom;
|
|
76
76
|
return [4 /*yield*/, this.axios.get(path)];
|
|
77
77
|
case 1:
|
|
78
78
|
result = _a.sent();
|
|
@@ -102,7 +102,7 @@ var BankQueryClient = /** @class */ (function () {
|
|
|
102
102
|
return __generator(this, function (_a) {
|
|
103
103
|
switch (_a.label) {
|
|
104
104
|
case 0:
|
|
105
|
-
path = "/cosmos/bank/v1beta1/balances/" + address + "/" + denom;
|
|
105
|
+
path = "/cosmos/bank/v1beta1/balances/" + address + "/by_denom?denom=" + denom;
|
|
106
106
|
return [4 /*yield*/, this.axios.get(path)];
|
|
107
107
|
case 1:
|
|
108
108
|
result = _a.sent();
|
|
@@ -7,7 +7,7 @@ function getSignAndBroadcastOption(denom, txMisc) {
|
|
|
7
7
|
if (txMisc.memo == null)
|
|
8
8
|
txMisc.memo = "";
|
|
9
9
|
if (txMisc.fee == null)
|
|
10
|
-
txMisc.fee =
|
|
10
|
+
txMisc.fee = 200000;
|
|
11
11
|
if (txMisc.gas == null)
|
|
12
12
|
txMisc.gas = 200000;
|
|
13
13
|
if (txMisc.feeGranter == null)
|
|
@@ -17,7 +17,7 @@ function getSignAndBroadcastOption(denom, txMisc) {
|
|
|
17
17
|
return { fee: defaultFee, memo: txMisc.memo };
|
|
18
18
|
}
|
|
19
19
|
exports.getSignAndBroadcastOption = getSignAndBroadcastOption;
|
|
20
|
-
exports.DefaultTxMisc = { memo: "", fee:
|
|
20
|
+
exports.DefaultTxMisc = { memo: "", fee: 200000, gas: 200000, feeGranter: "" };
|
|
21
21
|
var VotingOption;
|
|
22
22
|
(function (VotingOption) {
|
|
23
23
|
/** VOTE_OPTION_UNSPECIFIED - VOTE_OPTION_UNSPECIFIED defines a no-op vote option. */
|