@firmachain/firma-js 0.2.13 → 0.2.17

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.
Files changed (119) hide show
  1. package/package.json +1 -1
  2. package/dist/index.d.ts +0 -3
  3. package/dist/index.js +0 -15
  4. package/dist/sdk/FirmaBankService.d.ts +0 -15
  5. package/dist/sdk/FirmaBankService.js +0 -211
  6. package/dist/sdk/FirmaChainService.d.ts +0 -8
  7. package/dist/sdk/FirmaChainService.js +0 -86
  8. package/dist/sdk/FirmaConfig.d.ts +0 -16
  9. package/dist/sdk/FirmaConfig.js +0 -55
  10. package/dist/sdk/FirmaContractService.d.ts +0 -30
  11. package/dist/sdk/FirmaContractService.js +0 -394
  12. package/dist/sdk/FirmaDistributionService.d.ts +0 -27
  13. package/dist/sdk/FirmaDistributionService.js +0 -450
  14. package/dist/sdk/FirmaFeeGrantService.d.ts +0 -21
  15. package/dist/sdk/FirmaFeeGrantService.js +0 -341
  16. package/dist/sdk/FirmaGovService.d.ts +0 -35
  17. package/dist/sdk/FirmaGovService.js +0 -775
  18. package/dist/sdk/FirmaIpfsService.d.ts +0 -12
  19. package/dist/sdk/FirmaIpfsService.js +0 -185
  20. package/dist/sdk/FirmaNftService.d.ts +0 -28
  21. package/dist/sdk/FirmaNftService.js +0 -390
  22. package/dist/sdk/FirmaSDK.d.ts +0 -29
  23. package/dist/sdk/FirmaSDK.js +0 -48
  24. package/dist/sdk/FirmaSlashingService.d.ts +0 -9
  25. package/dist/sdk/FirmaSlashingService.js +0 -105
  26. package/dist/sdk/FirmaStakingService.d.ts +0 -34
  27. package/dist/sdk/FirmaStakingService.js +0 -604
  28. package/dist/sdk/FirmaTokenService.d.ts +0 -26
  29. package/dist/sdk/FirmaTokenService.js +0 -416
  30. package/dist/sdk/FirmaUtil.d.ts +0 -22
  31. package/dist/sdk/FirmaUtil.js +0 -151
  32. package/dist/sdk/FirmaWalletService.d.ts +0 -28
  33. package/dist/sdk/FirmaWalletService.js +0 -275
  34. package/dist/sdk/firmachain/bank/BankQueryClient.d.ts +0 -12
  35. package/dist/sdk/firmachain/bank/BankQueryClient.js +0 -116
  36. package/dist/sdk/firmachain/bank/BankTxClient.d.ts +0 -16
  37. package/dist/sdk/firmachain/bank/BankTxClient.js +0 -40
  38. package/dist/sdk/firmachain/bank/index.d.ts +0 -3
  39. package/dist/sdk/firmachain/bank/index.js +0 -15
  40. package/dist/sdk/firmachain/common/ITxClient.d.ts +0 -13
  41. package/dist/sdk/firmachain/common/ITxClient.js +0 -98
  42. package/dist/sdk/firmachain/common/QueryCommon.d.ts +0 -4
  43. package/dist/sdk/firmachain/common/QueryCommon.js +0 -2
  44. package/dist/sdk/firmachain/common/TendermintQueryClient.d.ts +0 -42
  45. package/dist/sdk/firmachain/common/TendermintQueryClient.js +0 -108
  46. package/dist/sdk/firmachain/common/TxCommon.d.ts +0 -94
  47. package/dist/sdk/firmachain/common/TxCommon.js +0 -34
  48. package/dist/sdk/firmachain/common/accounts.d.ts +0 -16
  49. package/dist/sdk/firmachain/common/accounts.js +0 -64
  50. package/dist/sdk/firmachain/common/index.d.ts +0 -2
  51. package/dist/sdk/firmachain/common/index.js +0 -14
  52. package/dist/sdk/firmachain/common/signing.d.ts +0 -10
  53. package/dist/sdk/firmachain/common/signing.js +0 -59
  54. package/dist/sdk/firmachain/common/signingstargateclient.d.ts +0 -37
  55. package/dist/sdk/firmachain/common/signingstargateclient.js +0 -282
  56. package/dist/sdk/firmachain/common/stargateclient.d.ts +0 -46
  57. package/dist/sdk/firmachain/common/stargateclient.js +0 -208
  58. package/dist/sdk/firmachain/contract/ContractQueryClient.d.ts +0 -31
  59. package/dist/sdk/firmachain/contract/ContractQueryClient.js +0 -141
  60. package/dist/sdk/firmachain/contract/ContractTxClient.d.ts +0 -16
  61. package/dist/sdk/firmachain/contract/ContractTxClient.js +0 -40
  62. package/dist/sdk/firmachain/contract/ContractTxTypes.d.ts +0 -69
  63. package/dist/sdk/firmachain/contract/ContractTxTypes.js +0 -442
  64. package/dist/sdk/firmachain/contract/index.d.ts +0 -3
  65. package/dist/sdk/firmachain/contract/index.js +0 -15
  66. package/dist/sdk/firmachain/distribution/DistributionQueryClient.d.ts +0 -18
  67. package/dist/sdk/firmachain/distribution/DistributionQueryClient.js +0 -167
  68. package/dist/sdk/firmachain/distribution/DistributionTxClient.d.ts +0 -26
  69. package/dist/sdk/firmachain/distribution/DistributionTxClient.js +0 -48
  70. package/dist/sdk/firmachain/distribution/index.d.ts +0 -3
  71. package/dist/sdk/firmachain/distribution/index.js +0 -16
  72. package/dist/sdk/firmachain/feegrant/FeeGrantQueryClient.d.ts +0 -17
  73. package/dist/sdk/firmachain/feegrant/FeeGrantQueryClient.js +0 -86
  74. package/dist/sdk/firmachain/feegrant/FeeGrantTxClient.d.ts +0 -16
  75. package/dist/sdk/firmachain/feegrant/FeeGrantTxClient.js +0 -40
  76. package/dist/sdk/firmachain/feegrant/FeeGrantTxTypes.d.ts +0 -76
  77. package/dist/sdk/firmachain/feegrant/FeeGrantTxTypes.js +0 -144
  78. package/dist/sdk/firmachain/feegrant/index.d.ts +0 -2
  79. package/dist/sdk/firmachain/feegrant/index.js +0 -15
  80. package/dist/sdk/firmachain/google/protobuf/any.d.ts +0 -128
  81. package/dist/sdk/firmachain/google/protobuf/any.js +0 -105
  82. package/dist/sdk/firmachain/google/protobuf/descriptor.d.ts +0 -996
  83. package/dist/sdk/firmachain/google/protobuf/descriptor.js +0 -4289
  84. package/dist/sdk/firmachain/google/protobuf/duration.d.ts +0 -91
  85. package/dist/sdk/firmachain/google/protobuf/duration.js +0 -107
  86. package/dist/sdk/firmachain/google/protobuf/timestamp.d.ts +0 -109
  87. package/dist/sdk/firmachain/google/protobuf/timestamp.js +0 -107
  88. package/dist/sdk/firmachain/gov/GovQueryClient.d.ts +0 -61
  89. package/dist/sdk/firmachain/gov/GovQueryClient.js +0 -152
  90. package/dist/sdk/firmachain/gov/GovTxClient.d.ts +0 -21
  91. package/dist/sdk/firmachain/gov/GovTxClient.js +0 -44
  92. package/dist/sdk/firmachain/gov/index.d.ts +0 -3
  93. package/dist/sdk/firmachain/gov/index.js +0 -16
  94. package/dist/sdk/firmachain/nft/NftQueryClient.d.ts +0 -17
  95. package/dist/sdk/firmachain/nft/NftQueryClient.js +0 -121
  96. package/dist/sdk/firmachain/nft/NftTxClient.d.ts +0 -21
  97. package/dist/sdk/firmachain/nft/NftTxClient.js +0 -44
  98. package/dist/sdk/firmachain/nft/NftTxTypes.d.ts +0 -86
  99. package/dist/sdk/firmachain/nft/NftTxTypes.js +0 -424
  100. package/dist/sdk/firmachain/nft/index.d.ts +0 -3
  101. package/dist/sdk/firmachain/nft/index.js +0 -15
  102. package/dist/sdk/firmachain/slashing/SlashingQueryClient.d.ts +0 -22
  103. package/dist/sdk/firmachain/slashing/SlashingQueryClient.js +0 -101
  104. package/dist/sdk/firmachain/slashing/index.d.ts +0 -2
  105. package/dist/sdk/firmachain/slashing/index.js +0 -14
  106. package/dist/sdk/firmachain/staking/StakingQueryClient.d.ts +0 -93
  107. package/dist/sdk/firmachain/staking/StakingQueryClient.js +0 -223
  108. package/dist/sdk/firmachain/staking/StakingTxClient.d.ts +0 -31
  109. package/dist/sdk/firmachain/staking/StakingTxClient.js +0 -52
  110. package/dist/sdk/firmachain/staking/index.d.ts +0 -3
  111. package/dist/sdk/firmachain/staking/index.js +0 -15
  112. package/dist/sdk/firmachain/token/TokenQueryClient.d.ts +0 -24
  113. package/dist/sdk/firmachain/token/TokenQueryClient.js +0 -106
  114. package/dist/sdk/firmachain/token/TokenTxClient.d.ts +0 -26
  115. package/dist/sdk/firmachain/token/TokenTxClient.js +0 -48
  116. package/dist/sdk/firmachain/token/TokenTxTypes.d.ts +0 -116
  117. package/dist/sdk/firmachain/token/TokenTxTypes.js +0 -685
  118. package/dist/sdk/firmachain/token/index.d.ts +0 -3
  119. package/dist/sdk/firmachain/token/index.js +0 -15
@@ -1,450 +0,0 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- var __generator = (this && this.__generator) || function (thisArg, body) {
12
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
13
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
14
- function verb(n) { return function (v) { return step([n, v]); }; }
15
- function step(op) {
16
- if (f) throw new TypeError("Generator is already executing.");
17
- while (_) try {
18
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
19
- if (y = 0, t) op = [op[0] & 2, t.value];
20
- switch (op[0]) {
21
- case 0: case 1: t = op; break;
22
- case 4: _.label++; return { value: op[1], done: false };
23
- case 5: _.label++; y = op[1]; op = [0]; continue;
24
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
25
- default:
26
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
27
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
28
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
29
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
30
- if (t[2]) _.ops.pop();
31
- _.trys.pop(); continue;
32
- }
33
- op = body.call(thisArg, _);
34
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
35
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
36
- }
37
- };
38
- Object.defineProperty(exports, "__esModule", { value: true });
39
- exports.FirmaDistributionService = void 0;
40
- var distribution_1 = require("./firmachain/distribution");
41
- var FirmaUtil_1 = require("./FirmaUtil");
42
- var FirmaDistributionService = /** @class */ (function () {
43
- function FirmaDistributionService(config) {
44
- this.config = config;
45
- }
46
- FirmaDistributionService.prototype.getGasEstimationSetWithdrawAddress = function (wallet, withdrawAddress, txMisc) {
47
- if (txMisc === void 0) { txMisc = distribution_1.DefaultTxMisc; }
48
- return __awaiter(this, void 0, void 0, function () {
49
- var txRaw, error_1;
50
- return __generator(this, function (_a) {
51
- switch (_a.label) {
52
- case 0:
53
- _a.trys.push([0, 3, , 4]);
54
- return [4 /*yield*/, this.getSignedTxSetWithdrawAddress(wallet, withdrawAddress, txMisc)];
55
- case 1:
56
- txRaw = _a.sent();
57
- return [4 /*yield*/, FirmaUtil_1.FirmaUtil.estimateGas(txRaw)];
58
- case 2: return [2 /*return*/, _a.sent()];
59
- case 3:
60
- error_1 = _a.sent();
61
- FirmaUtil_1.FirmaUtil.printLog(error_1);
62
- throw error_1;
63
- case 4: return [2 /*return*/];
64
- }
65
- });
66
- });
67
- };
68
- FirmaDistributionService.prototype.getGasEstimationFundCommunityPool = function (wallet, amount, txMisc) {
69
- if (txMisc === void 0) { txMisc = distribution_1.DefaultTxMisc; }
70
- return __awaiter(this, void 0, void 0, function () {
71
- var txRaw, error_2;
72
- return __generator(this, function (_a) {
73
- switch (_a.label) {
74
- case 0:
75
- _a.trys.push([0, 3, , 4]);
76
- return [4 /*yield*/, this.getSignedTxFundCommunityPool(wallet, amount, txMisc)];
77
- case 1:
78
- txRaw = _a.sent();
79
- return [4 /*yield*/, FirmaUtil_1.FirmaUtil.estimateGas(txRaw)];
80
- case 2: return [2 /*return*/, _a.sent()];
81
- case 3:
82
- error_2 = _a.sent();
83
- FirmaUtil_1.FirmaUtil.printLog(error_2);
84
- throw error_2;
85
- case 4: return [2 /*return*/];
86
- }
87
- });
88
- });
89
- };
90
- FirmaDistributionService.prototype.getGasEstimationWithdrawValidatorCommission = function (wallet, validatorAddress, txMisc) {
91
- if (txMisc === void 0) { txMisc = distribution_1.DefaultTxMisc; }
92
- return __awaiter(this, void 0, void 0, function () {
93
- var txRaw, error_3;
94
- return __generator(this, function (_a) {
95
- switch (_a.label) {
96
- case 0:
97
- _a.trys.push([0, 3, , 4]);
98
- return [4 /*yield*/, this.getSignedTxWithdrawValidatorCommission(wallet, validatorAddress, txMisc)];
99
- case 1:
100
- txRaw = _a.sent();
101
- return [4 /*yield*/, FirmaUtil_1.FirmaUtil.estimateGas(txRaw)];
102
- case 2: return [2 /*return*/, _a.sent()];
103
- case 3:
104
- error_3 = _a.sent();
105
- FirmaUtil_1.FirmaUtil.printLog(error_3);
106
- throw error_3;
107
- case 4: return [2 /*return*/];
108
- }
109
- });
110
- });
111
- };
112
- FirmaDistributionService.prototype.getGasEstimationWithdrawAllRewards = function (wallet, validatorAddress, txMisc) {
113
- if (txMisc === void 0) { txMisc = distribution_1.DefaultTxMisc; }
114
- return __awaiter(this, void 0, void 0, function () {
115
- var txRaw, error_4;
116
- return __generator(this, function (_a) {
117
- switch (_a.label) {
118
- case 0:
119
- _a.trys.push([0, 3, , 4]);
120
- return [4 /*yield*/, this.getSignedTxWithdrawAllRewards(wallet, validatorAddress, txMisc)];
121
- case 1:
122
- txRaw = _a.sent();
123
- return [4 /*yield*/, FirmaUtil_1.FirmaUtil.estimateGas(txRaw)];
124
- case 2: return [2 /*return*/, _a.sent()];
125
- case 3:
126
- error_4 = _a.sent();
127
- FirmaUtil_1.FirmaUtil.printLog(error_4);
128
- throw error_4;
129
- case 4: return [2 /*return*/];
130
- }
131
- });
132
- });
133
- };
134
- FirmaDistributionService.prototype.getSignedTxWithdrawAllRewards = function (wallet, validatorAddress, txMisc) {
135
- if (txMisc === void 0) { txMisc = distribution_1.DefaultTxMisc; }
136
- return __awaiter(this, void 0, void 0, function () {
137
- var txClient, address, message, error_5;
138
- return __generator(this, function (_a) {
139
- switch (_a.label) {
140
- case 0:
141
- _a.trys.push([0, 3, , 4]);
142
- txClient = new distribution_1.DistributionTxClient(wallet.getRawWallet(), this.config.rpcAddress);
143
- return [4 /*yield*/, wallet.getAddress()];
144
- case 1:
145
- address = _a.sent();
146
- message = txClient.msgWithdrawDelegatorReward({ delegatorAddress: address, validatorAddress: validatorAddress });
147
- return [4 /*yield*/, txClient.sign([message], distribution_1.getSignAndBroadcastOption(this.config.denom, txMisc))];
148
- case 2: return [2 /*return*/, _a.sent()];
149
- case 3:
150
- error_5 = _a.sent();
151
- FirmaUtil_1.FirmaUtil.printLog(error_5);
152
- throw error_5;
153
- case 4: return [2 /*return*/];
154
- }
155
- });
156
- });
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
- };
228
- FirmaDistributionService.prototype.setWithdrawAddress = function (wallet, withdrawAddress, txMisc) {
229
- if (txMisc === void 0) { txMisc = distribution_1.DefaultTxMisc; }
230
- return __awaiter(this, void 0, void 0, function () {
231
- var txRaw, txClient, error_9;
232
- return __generator(this, function (_a) {
233
- switch (_a.label) {
234
- case 0:
235
- _a.trys.push([0, 3, , 4]);
236
- return [4 /*yield*/, this.getSignedTxSetWithdrawAddress(wallet, withdrawAddress, txMisc)];
237
- case 1:
238
- txRaw = _a.sent();
239
- txClient = new distribution_1.DistributionTxClient(wallet.getRawWallet(), this.config.rpcAddress);
240
- return [4 /*yield*/, txClient.broadcast(txRaw)];
241
- case 2: return [2 /*return*/, _a.sent()];
242
- case 3:
243
- error_9 = _a.sent();
244
- FirmaUtil_1.FirmaUtil.printLog(error_9);
245
- throw error_9;
246
- case 4: return [2 /*return*/];
247
- }
248
- });
249
- });
250
- };
251
- FirmaDistributionService.prototype.fundCommunityPool = function (wallet, amount, txMisc) {
252
- if (txMisc === void 0) { txMisc = distribution_1.DefaultTxMisc; }
253
- return __awaiter(this, void 0, void 0, function () {
254
- var txRaw, txClient, error_10;
255
- return __generator(this, function (_a) {
256
- switch (_a.label) {
257
- case 0:
258
- _a.trys.push([0, 3, , 4]);
259
- return [4 /*yield*/, this.getSignedTxFundCommunityPool(wallet, amount, txMisc)];
260
- case 1:
261
- txRaw = _a.sent();
262
- txClient = new distribution_1.DistributionTxClient(wallet.getRawWallet(), this.config.rpcAddress);
263
- return [4 /*yield*/, txClient.broadcast(txRaw)];
264
- case 2: return [2 /*return*/, _a.sent()];
265
- case 3:
266
- error_10 = _a.sent();
267
- FirmaUtil_1.FirmaUtil.printLog(error_10);
268
- throw error_10;
269
- case 4: return [2 /*return*/];
270
- }
271
- });
272
- });
273
- };
274
- FirmaDistributionService.prototype.withdrawValidatorCommission = function (wallet, validatorAddres, txMisc) {
275
- if (txMisc === void 0) { txMisc = distribution_1.DefaultTxMisc; }
276
- return __awaiter(this, void 0, void 0, function () {
277
- var txRaw, txClient, error_11;
278
- return __generator(this, function (_a) {
279
- switch (_a.label) {
280
- case 0:
281
- _a.trys.push([0, 3, , 4]);
282
- return [4 /*yield*/, this.getSignedTxWithdrawValidatorCommission(wallet, validatorAddres, txMisc)];
283
- case 1:
284
- txRaw = _a.sent();
285
- txClient = new distribution_1.DistributionTxClient(wallet.getRawWallet(), this.config.rpcAddress);
286
- return [4 /*yield*/, txClient.broadcast(txRaw)];
287
- case 2: return [2 /*return*/, _a.sent()];
288
- case 3:
289
- error_11 = _a.sent();
290
- FirmaUtil_1.FirmaUtil.printLog(error_11);
291
- throw error_11;
292
- case 4: return [2 /*return*/];
293
- }
294
- });
295
- });
296
- };
297
- FirmaDistributionService.prototype.withdrawAllRewards = function (wallet, validatorAddress, txMisc) {
298
- if (txMisc === void 0) { txMisc = distribution_1.DefaultTxMisc; }
299
- return __awaiter(this, void 0, void 0, function () {
300
- var txRaw, txClient, error_12;
301
- return __generator(this, function (_a) {
302
- switch (_a.label) {
303
- case 0:
304
- _a.trys.push([0, 3, , 4]);
305
- return [4 /*yield*/, this.getSignedTxWithdrawAllRewards(wallet, validatorAddress, txMisc)];
306
- case 1:
307
- txRaw = _a.sent();
308
- txClient = new distribution_1.DistributionTxClient(wallet.getRawWallet(), this.config.rpcAddress);
309
- return [4 /*yield*/, txClient.broadcast(txRaw)];
310
- case 2: return [2 /*return*/, _a.sent()];
311
- case 3:
312
- error_12 = _a.sent();
313
- FirmaUtil_1.FirmaUtil.printLog(error_12);
314
- throw error_12;
315
- case 4: return [2 /*return*/];
316
- }
317
- });
318
- });
319
- };
320
- // query
321
- //
322
- FirmaDistributionService.prototype.getRewardInfo = function (address, validatorAddress) {
323
- return __awaiter(this, void 0, void 0, function () {
324
- var queryClient, result, error_13;
325
- return __generator(this, function (_a) {
326
- switch (_a.label) {
327
- case 0:
328
- _a.trys.push([0, 2, , 3]);
329
- queryClient = new distribution_1.DistributionQueryClient(this.config.restApiAddress);
330
- return [4 /*yield*/, queryClient.queryGetRewardInfo(address, validatorAddress)];
331
- case 1:
332
- result = _a.sent();
333
- return [2 /*return*/, result];
334
- case 2:
335
- error_13 = _a.sent();
336
- FirmaUtil_1.FirmaUtil.printLog(error_13);
337
- throw error_13;
338
- case 3: return [2 /*return*/];
339
- }
340
- });
341
- });
342
- };
343
- FirmaDistributionService.prototype.getValidatorOutStandingReward = function (validatorAddress) {
344
- return __awaiter(this, void 0, void 0, function () {
345
- var queryClient, result, error_14;
346
- return __generator(this, function (_a) {
347
- switch (_a.label) {
348
- case 0:
349
- _a.trys.push([0, 2, , 3]);
350
- queryClient = new distribution_1.DistributionQueryClient(this.config.restApiAddress);
351
- return [4 /*yield*/, queryClient.queryGetValidatorOutStandingReward(validatorAddress)];
352
- case 1:
353
- result = _a.sent();
354
- return [2 /*return*/, result];
355
- case 2:
356
- error_14 = _a.sent();
357
- FirmaUtil_1.FirmaUtil.printLog(error_14);
358
- throw error_14;
359
- case 3: return [2 /*return*/];
360
- }
361
- });
362
- });
363
- };
364
- FirmaDistributionService.prototype.getValidatorCommission = function (validatorAddress) {
365
- return __awaiter(this, void 0, void 0, function () {
366
- var queryClient, result, error_15;
367
- return __generator(this, function (_a) {
368
- switch (_a.label) {
369
- case 0:
370
- _a.trys.push([0, 2, , 3]);
371
- queryClient = new distribution_1.DistributionQueryClient(this.config.restApiAddress);
372
- return [4 /*yield*/, queryClient.queryGetValidatorCommission(validatorAddress)];
373
- case 1:
374
- result = _a.sent();
375
- return [2 /*return*/, result];
376
- case 2:
377
- error_15 = _a.sent();
378
- FirmaUtil_1.FirmaUtil.printLog(error_15);
379
- throw error_15;
380
- case 3: return [2 /*return*/];
381
- }
382
- });
383
- });
384
- };
385
- FirmaDistributionService.prototype.getTotalRewardInfo = function (address) {
386
- return __awaiter(this, void 0, void 0, function () {
387
- var queryClient, result, error_16;
388
- return __generator(this, function (_a) {
389
- switch (_a.label) {
390
- case 0:
391
- _a.trys.push([0, 2, , 3]);
392
- queryClient = new distribution_1.DistributionQueryClient(this.config.restApiAddress);
393
- return [4 /*yield*/, queryClient.queryGetTotalRewardInfo(address)];
394
- case 1:
395
- result = _a.sent();
396
- return [2 /*return*/, result];
397
- case 2:
398
- error_16 = _a.sent();
399
- FirmaUtil_1.FirmaUtil.printLog(error_16);
400
- throw error_16;
401
- case 3: return [2 /*return*/];
402
- }
403
- });
404
- });
405
- };
406
- FirmaDistributionService.prototype.getCommunityPool = function () {
407
- return __awaiter(this, void 0, void 0, function () {
408
- var queryClient, result, error_17;
409
- return __generator(this, function (_a) {
410
- switch (_a.label) {
411
- case 0:
412
- _a.trys.push([0, 2, , 3]);
413
- queryClient = new distribution_1.DistributionQueryClient(this.config.restApiAddress);
414
- return [4 /*yield*/, queryClient.queryGetCommunityPool()];
415
- case 1:
416
- result = _a.sent();
417
- return [2 /*return*/, result];
418
- case 2:
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;
443
- case 3: return [2 /*return*/];
444
- }
445
- });
446
- });
447
- };
448
- return FirmaDistributionService;
449
- }());
450
- exports.FirmaDistributionService = FirmaDistributionService;
@@ -1,21 +0,0 @@
1
- import { TxMisc, BasicFeeGrantOption, PeriodicFeeGrantOption } from "./firmachain/feegrant";
2
- import { FirmaWalletService } from "./FirmaWalletService";
3
- import { FirmaConfig } from "./FirmaConfig";
4
- import { FeeAllowanceType, FeeAllowanceType1 } from "./firmachain/feegrant/FeeGrantQueryClient";
5
- import { BroadcastTxResponse } from "./firmachain/common/stargateclient";
6
- export declare class FirmaFeeGrantService {
7
- private readonly config;
8
- constructor(config: FirmaConfig);
9
- getGasEstimationRevokeAllowance(wallet: FirmaWalletService, granteeAddress: string, txMisc?: TxMisc): Promise<number>;
10
- private getSignedTxRevokeAllowance;
11
- revokeAllowance(wallet: FirmaWalletService, granteeAddress: string, txMisc?: TxMisc): Promise<BroadcastTxResponse>;
12
- private getCoinType;
13
- getGasEstimationGrantPeriodicAllowance(wallet: FirmaWalletService, granteeAddress: string, feegrantOption: PeriodicFeeGrantOption, txMisc?: TxMisc): Promise<number>;
14
- private getSignedTxGrantPeriodicAllowance;
15
- getGasEstimationGrantBasicAllowance(wallet: FirmaWalletService, granteeAddress: string, feegrantOption?: BasicFeeGrantOption, txMisc?: TxMisc): Promise<number>;
16
- private getSignedTxGrantBasicAllowance;
17
- grantPeriodicAllowance(wallet: FirmaWalletService, granteeAddress: string, feegrantOption: PeriodicFeeGrantOption, txMisc?: TxMisc): Promise<BroadcastTxResponse>;
18
- grantBasicAllowance(wallet: FirmaWalletService, granteeAddress: string, feegrantOption?: BasicFeeGrantOption, txMisc?: TxMisc): Promise<BroadcastTxResponse>;
19
- getGranteeAllowance(granterAddress: string, granteeAddress: string): Promise<FeeAllowanceType1>;
20
- getGranteeAllowanceAll(granteeAddress: string): Promise<FeeAllowanceType[]>;
21
- }