@firmachain/firma-js 0.2.14 → 0.2.18

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 (71) hide show
  1. package/dist/index.d.ts +1 -0
  2. package/dist/index.js +1 -0
  3. package/dist/sdk/FirmaBankService.js +3 -3
  4. package/dist/sdk/FirmaContractService.js +8 -8
  5. package/dist/sdk/FirmaDistributionService.d.ts +4 -0
  6. package/dist/sdk/FirmaDistributionService.js +140 -66
  7. package/dist/sdk/FirmaFeeGrantService.js +6 -6
  8. package/dist/sdk/FirmaGovService.js +15 -15
  9. package/dist/sdk/FirmaMobileSDK.d.ts +27 -0
  10. package/dist/sdk/FirmaMobileSDK.js +45 -0
  11. package/dist/sdk/FirmaNftService.js +6 -6
  12. package/dist/sdk/FirmaStakingService.js +10 -10
  13. package/dist/sdk/FirmaTokenService.js +8 -8
  14. package/dist/sdk/FirmaUtil.d.ts +3 -0
  15. package/dist/sdk/FirmaUtil.js +56 -6
  16. package/dist/sdk/FirmaWalletService.d.ts +13 -1
  17. package/dist/sdk/FirmaWalletService.js +39 -5
  18. package/dist/sdk/firmachain/amino/addresses.d.ts +5 -0
  19. package/dist/sdk/firmachain/amino/addresses.js +46 -0
  20. package/dist/sdk/firmachain/amino/aminomsgs.d.ts +281 -0
  21. package/dist/sdk/firmachain/amino/aminomsgs.js +77 -0
  22. package/dist/sdk/firmachain/amino/aminotypes.d.ts +22 -0
  23. package/dist/sdk/firmachain/amino/aminotypes.js +521 -0
  24. package/dist/sdk/firmachain/amino/coins.d.ts +30 -0
  25. package/dist/sdk/firmachain/amino/coins.js +69 -0
  26. package/dist/sdk/firmachain/amino/encoding.d.ts +24 -0
  27. package/dist/sdk/firmachain/amino/encoding.js +234 -0
  28. package/dist/sdk/firmachain/amino/multisig.d.ts +10 -0
  29. package/dist/sdk/firmachain/amino/multisig.js +42 -0
  30. package/dist/sdk/firmachain/amino/paths.d.ts +6 -0
  31. package/dist/sdk/firmachain/amino/paths.js +18 -0
  32. package/dist/sdk/firmachain/amino/pubkeys.d.ts +47 -0
  33. package/dist/sdk/firmachain/amino/pubkeys.js +29 -0
  34. package/dist/sdk/firmachain/amino/secp256k1hdwallet.d.ts +94 -0
  35. package/dist/sdk/firmachain/amino/secp256k1hdwallet.js +437 -0
  36. package/dist/sdk/firmachain/amino/secp256k1wallet.d.ts +23 -0
  37. package/dist/sdk/firmachain/amino/secp256k1wallet.js +141 -0
  38. package/dist/sdk/firmachain/amino/signature.d.ts +16 -0
  39. package/dist/sdk/firmachain/amino/signature.js +36 -0
  40. package/dist/sdk/firmachain/amino/signdoc.d.ts +26 -0
  41. package/dist/sdk/firmachain/amino/signdoc.js +42 -0
  42. package/dist/sdk/firmachain/amino/signer.d.ts +33 -0
  43. package/dist/sdk/firmachain/amino/signer.js +2 -0
  44. package/dist/sdk/firmachain/amino/stdtx.d.ts +15 -0
  45. package/dist/sdk/firmachain/amino/stdtx.js +17 -0
  46. package/dist/sdk/firmachain/amino/wallet.d.ts +32 -0
  47. package/dist/sdk/firmachain/amino/wallet.js +132 -0
  48. package/dist/sdk/firmachain/bank/BankTxClient.d.ts +3 -2
  49. package/dist/sdk/firmachain/common/ITxClient.d.ts +4 -2
  50. package/dist/sdk/firmachain/common/ITxClient.js +10 -6
  51. package/dist/sdk/firmachain/common/LedgerSigningStargateClient.d.ts +27 -0
  52. package/dist/sdk/firmachain/common/LedgerSigningStargateClient.js +165 -0
  53. package/dist/sdk/firmachain/common/LedgerWallet.d.ts +9 -0
  54. package/dist/sdk/firmachain/common/LedgerWallet.js +150 -0
  55. package/dist/sdk/firmachain/common/signing.js +17 -1
  56. package/dist/sdk/firmachain/common/signingstargateclient.js +19 -3
  57. package/dist/sdk/firmachain/common/stargateclient.js +5 -2
  58. package/dist/sdk/firmachain/contract/ContractTxClient.d.ts +3 -2
  59. package/dist/sdk/firmachain/contract/ContractTxTypes.js +50 -9
  60. package/dist/sdk/firmachain/distribution/DistributionTxClient.d.ts +3 -2
  61. package/dist/sdk/firmachain/distribution/index.js +0 -1
  62. package/dist/sdk/firmachain/feegrant/FeeGrantTxClient.d.ts +3 -2
  63. package/dist/sdk/firmachain/feegrant/FeeGrantTxTypes.js +63 -13
  64. package/dist/sdk/firmachain/google/protobuf/any.js +3 -2
  65. package/dist/sdk/firmachain/google/protobuf/descriptor.js +1364 -324
  66. package/dist/sdk/firmachain/gov/GovTxClient.d.ts +3 -2
  67. package/dist/sdk/firmachain/gov/index.js +0 -1
  68. package/dist/sdk/firmachain/nft/NftTxClient.d.ts +3 -2
  69. package/dist/sdk/firmachain/staking/StakingTxClient.d.ts +3 -2
  70. package/dist/sdk/firmachain/token/TokenTxClient.d.ts +3 -2
  71. package/package.json +1 -1
package/dist/index.d.ts CHANGED
@@ -1,3 +1,4 @@
1
1
  export * from './sdk/FirmaSDK';
2
+ export * from './sdk/FirmaMobileSDK';
2
3
  export * from './sdk/FirmaConfig';
3
4
  export * from './sdk/FirmaUtil';
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);
@@ -76,7 +76,7 @@ var FirmaBankService = /** @class */ (function () {
76
76
  return [4 /*yield*/, this.getSignedTxSend(wallet, targetAddress, tokenID, FirmaUtil_1.FirmaUtil.getUTokenStringFromToken(amount, decimal), txMisc)];
77
77
  case 1:
78
78
  txRaw = _a.sent();
79
- bankTxClient = new bank_1.BankTxClient(wallet.getRawWallet(), this.config.rpcAddress);
79
+ bankTxClient = new bank_1.BankTxClient(wallet, this.config.rpcAddress);
80
80
  return [4 /*yield*/, bankTxClient.broadcast(txRaw)];
81
81
  case 2: return [2 /*return*/, _a.sent()];
82
82
  case 3:
@@ -99,7 +99,7 @@ var FirmaBankService = /** @class */ (function () {
99
99
  return [4 /*yield*/, this.getSignedTxSend(wallet, targetAddress, this.config.denom, FirmaUtil_1.FirmaUtil.getUFCTStringFromFCT(amount), txMisc)];
100
100
  case 1:
101
101
  txRaw = _a.sent();
102
- bankTxClient = new bank_1.BankTxClient(wallet.getRawWallet(), this.config.rpcAddress);
102
+ bankTxClient = new bank_1.BankTxClient(wallet, this.config.rpcAddress);
103
103
  return [4 /*yield*/, bankTxClient.broadcast(txRaw)];
104
104
  case 2: return [2 /*return*/, _a.sent()];
105
105
  case 3:
@@ -189,7 +189,7 @@ var FirmaBankService = /** @class */ (function () {
189
189
  switch (_a.label) {
190
190
  case 0:
191
191
  _a.trys.push([0, 3, , 4]);
192
- bankTxClient = new bank_1.BankTxClient(wallet.getRawWallet(), this.config.rpcAddress);
192
+ bankTxClient = new bank_1.BankTxClient(wallet, this.config.rpcAddress);
193
193
  return [4 /*yield*/, wallet.getAddress()];
194
194
  case 1:
195
195
  address = _a.sent();
@@ -148,7 +148,7 @@ var ContractService = /** @class */ (function () {
148
148
  switch (_a.label) {
149
149
  case 0:
150
150
  _a.trys.push([0, 3, , 4]);
151
- contractTxClient = new contract_1.ContractTxClient(wallet.getRawWallet(), this.config.rpcAddress);
151
+ contractTxClient = new contract_1.ContractTxClient(wallet, this.config.rpcAddress);
152
152
  return [4 /*yield*/, contractTxClient.sign(txList, contract_1.getSignAndBroadcastOption(this.config.denom, txMisc))];
153
153
  case 1:
154
154
  txRaw = _a.sent();
@@ -195,7 +195,7 @@ var ContractService = /** @class */ (function () {
195
195
  return [4 /*yield*/, wallet.getAddress()];
196
196
  case 1:
197
197
  address = _a.sent();
198
- contractTxClient = new contract_1.ContractTxClient(wallet.getRawWallet(), this.config.rpcAddress);
198
+ contractTxClient = new contract_1.ContractTxClient(wallet, this.config.rpcAddress);
199
199
  return [2 /*return*/, contractTxClient.msgCreateContractFile({
200
200
  creator: address,
201
201
  fileHash: fileHash,
@@ -223,7 +223,7 @@ var ContractService = /** @class */ (function () {
223
223
  return [4 /*yield*/, wallet.getAddress()];
224
224
  case 1:
225
225
  address = _a.sent();
226
- contractTxClient = new contract_1.ContractTxClient(wallet.getRawWallet(), this.config.rpcAddress);
226
+ contractTxClient = new contract_1.ContractTxClient(wallet, this.config.rpcAddress);
227
227
  message = contractTxClient.msgCreateContractFile({
228
228
  creator: address,
229
229
  fileHash: fileHash,
@@ -253,7 +253,7 @@ var ContractService = /** @class */ (function () {
253
253
  return [4 /*yield*/, this.getSignedTxCreateContractFile(wallet, fileHash, timeStamp, ownerList, metaDataJsonString, txMisc)];
254
254
  case 1:
255
255
  txRaw = _a.sent();
256
- contractTxClient = new contract_1.ContractTxClient(wallet.getRawWallet(), this.config.rpcAddress);
256
+ contractTxClient = new contract_1.ContractTxClient(wallet, this.config.rpcAddress);
257
257
  return [4 /*yield*/, contractTxClient.broadcast(txRaw)];
258
258
  case 2: return [2 /*return*/, _a.sent()];
259
259
  case 3:
@@ -298,7 +298,7 @@ var ContractService = /** @class */ (function () {
298
298
  return [4 /*yield*/, wallet.getAddress()];
299
299
  case 1:
300
300
  address = _a.sent();
301
- contractTxClient = new contract_1.ContractTxClient(wallet.getRawWallet(), this.config.rpcAddress);
301
+ contractTxClient = new contract_1.ContractTxClient(wallet, this.config.rpcAddress);
302
302
  message = contractTxClient.msgAddContractLog({
303
303
  creator: address,
304
304
  contractHash: contractHash,
@@ -329,7 +329,7 @@ var ContractService = /** @class */ (function () {
329
329
  return [4 /*yield*/, this.getSignedTxAddContractLog(wallet, contractHash, timeStamp, eventName, ownerAddress, jsonString, txMisc)];
330
330
  case 1:
331
331
  txRaw = _a.sent();
332
- contractTxClient = new contract_1.ContractTxClient(wallet.getRawWallet(), this.config.rpcAddress);
332
+ contractTxClient = new contract_1.ContractTxClient(wallet, this.config.rpcAddress);
333
333
  return [4 /*yield*/, contractTxClient.broadcast(txRaw)];
334
334
  case 2: return [2 /*return*/, _a.sent()];
335
335
  case 3:
@@ -351,7 +351,7 @@ var ContractService = /** @class */ (function () {
351
351
  return [4 /*yield*/, wallet.getAddress()];
352
352
  case 1:
353
353
  address = _a.sent();
354
- contractTxClient = new contract_1.ContractTxClient(wallet.getRawWallet(), this.config.rpcAddress);
354
+ contractTxClient = new contract_1.ContractTxClient(wallet, this.config.rpcAddress);
355
355
  return [2 /*return*/, contractTxClient.msgAddContractLog({
356
356
  creator: address,
357
357
  contractHash: contractHash,
@@ -377,7 +377,7 @@ var ContractService = /** @class */ (function () {
377
377
  switch (_a.label) {
378
378
  case 0:
379
379
  _a.trys.push([0, 2, , 3]);
380
- contractTxClient = new contract_1.ContractTxClient(wallet.getRawWallet(), this.config.rpcAddress);
380
+ contractTxClient = new contract_1.ContractTxClient(wallet, this.config.rpcAddress);
381
381
  return [4 /*yield*/, contractTxClient.signAndBroadcast(msgList, contract_1.getSignAndBroadcastOption(this.config.denom, txMisc))];
382
382
  case 1: return [2 /*return*/, _a.sent()];
383
383
  case 2:
@@ -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.getGasEstimationWithdrawAllRewards = function (wallet, validatorAddress, txMisc) {
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.getSignedTxWithdrawAllRewards(wallet, validatorAddress, txMisc)];
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,20 +131,18 @@ var FirmaDistributionService = /** @class */ (function () {
131
131
  });
132
132
  });
133
133
  };
134
- FirmaDistributionService.prototype.getSignedTxWithdrawAllRewards = function (wallet, validatorAddress, txMisc) {
134
+ FirmaDistributionService.prototype.getGasEstimationWithdrawAllRewards = function (wallet, validatorAddress, txMisc) {
135
135
  if (txMisc === void 0) { txMisc = distribution_1.DefaultTxMisc; }
136
136
  return __awaiter(this, void 0, void 0, function () {
137
- var txClient, address, message, error_5;
137
+ var txRaw, error_5;
138
138
  return __generator(this, function (_a) {
139
139
  switch (_a.label) {
140
140
  case 0:
141
141
  _a.trys.push([0, 3, , 4]);
142
- txClient = new distribution_1.DistributionTxClient(wallet.getRawWallet(), this.config.rpcAddress);
143
- return [4 /*yield*/, wallet.getAddress()];
142
+ return [4 /*yield*/, this.getSignedTxWithdrawAllRewards(wallet, validatorAddress, txMisc)];
144
143
  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))];
144
+ txRaw = _a.sent();
145
+ return [4 /*yield*/, FirmaUtil_1.FirmaUtil.estimateGas(txRaw)];
148
146
  case 2: return [2 /*return*/, _a.sent()];
149
147
  case 3:
150
148
  error_5 = _a.sent();
@@ -155,7 +153,7 @@ var FirmaDistributionService = /** @class */ (function () {
155
153
  });
156
154
  });
157
155
  };
158
- FirmaDistributionService.prototype.getSignedTxSetWithdrawAddress = function (wallet, withdrawAddress, txMisc) {
156
+ FirmaDistributionService.prototype.getSignedTxWithdrawAllRewards = function (wallet, validatorAddress, txMisc) {
159
157
  if (txMisc === void 0) { txMisc = distribution_1.DefaultTxMisc; }
160
158
  return __awaiter(this, void 0, void 0, function () {
161
159
  var txClient, address, message, error_6;
@@ -163,11 +161,11 @@ var FirmaDistributionService = /** @class */ (function () {
163
161
  switch (_a.label) {
164
162
  case 0:
165
163
  _a.trys.push([0, 3, , 4]);
166
- txClient = new distribution_1.DistributionTxClient(wallet.getRawWallet(), this.config.rpcAddress);
164
+ txClient = new distribution_1.DistributionTxClient(wallet, this.config.rpcAddress);
167
165
  return [4 /*yield*/, wallet.getAddress()];
168
166
  case 1:
169
167
  address = _a.sent();
170
- message = txClient.msgSetWithdrawAddress({ delegatorAddress: address, withdrawAddress: withdrawAddress });
168
+ message = txClient.msgWithdrawDelegatorReward({ delegatorAddress: address, validatorAddress: validatorAddress });
171
169
  return [4 /*yield*/, txClient.sign([message], distribution_1.getSignAndBroadcastOption(this.config.denom, txMisc))];
172
170
  case 2: return [2 /*return*/, _a.sent()];
173
171
  case 3:
@@ -179,20 +177,19 @@ var FirmaDistributionService = /** @class */ (function () {
179
177
  });
180
178
  });
181
179
  };
182
- FirmaDistributionService.prototype.getSignedTxFundCommunityPool = function (wallet, amount, txMisc) {
180
+ FirmaDistributionService.prototype.getSignedTxSetWithdrawAddress = function (wallet, withdrawAddress, txMisc) {
183
181
  if (txMisc === void 0) { txMisc = distribution_1.DefaultTxMisc; }
184
182
  return __awaiter(this, void 0, void 0, function () {
185
- var txClient, address, sendAmount, message, error_7;
183
+ var txClient, address, message, error_7;
186
184
  return __generator(this, function (_a) {
187
185
  switch (_a.label) {
188
186
  case 0:
189
187
  _a.trys.push([0, 3, , 4]);
190
- txClient = new distribution_1.DistributionTxClient(wallet.getRawWallet(), this.config.rpcAddress);
188
+ txClient = new distribution_1.DistributionTxClient(wallet, this.config.rpcAddress);
191
189
  return [4 /*yield*/, wallet.getAddress()];
192
190
  case 1:
193
191
  address = _a.sent();
194
- sendAmount = { denom: this.config.denom, amount: FirmaUtil_1.FirmaUtil.getUFCTStringFromFCT(amount) };
195
- message = txClient.msgFundCommunityPool({ depositor: address, amount: [sendAmount] });
192
+ message = txClient.msgSetWithdrawAddress({ delegatorAddress: address, withdrawAddress: withdrawAddress });
196
193
  return [4 /*yield*/, txClient.sign([message], distribution_1.getSignAndBroadcastOption(this.config.denom, txMisc))];
197
194
  case 2: return [2 /*return*/, _a.sent()];
198
195
  case 3:
@@ -204,22 +201,47 @@ var FirmaDistributionService = /** @class */ (function () {
204
201
  });
205
202
  });
206
203
  };
204
+ FirmaDistributionService.prototype.getSignedTxFundCommunityPool = function (wallet, amount, txMisc) {
205
+ if (txMisc === void 0) { txMisc = distribution_1.DefaultTxMisc; }
206
+ return __awaiter(this, void 0, void 0, function () {
207
+ var txClient, address, sendAmount, message, error_8;
208
+ return __generator(this, function (_a) {
209
+ switch (_a.label) {
210
+ case 0:
211
+ _a.trys.push([0, 3, , 4]);
212
+ txClient = new distribution_1.DistributionTxClient(wallet, this.config.rpcAddress);
213
+ return [4 /*yield*/, wallet.getAddress()];
214
+ case 1:
215
+ address = _a.sent();
216
+ sendAmount = { denom: this.config.denom, amount: FirmaUtil_1.FirmaUtil.getUFCTStringFromFCT(amount) };
217
+ message = txClient.msgFundCommunityPool({ depositor: address, amount: [sendAmount] });
218
+ return [4 /*yield*/, txClient.sign([message], distribution_1.getSignAndBroadcastOption(this.config.denom, txMisc))];
219
+ case 2: return [2 /*return*/, _a.sent()];
220
+ case 3:
221
+ error_8 = _a.sent();
222
+ FirmaUtil_1.FirmaUtil.printLog(error_8);
223
+ throw error_8;
224
+ case 4: return [2 /*return*/];
225
+ }
226
+ });
227
+ });
228
+ };
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, error_8;
232
+ var txClient, message, error_9;
211
233
  return __generator(this, function (_a) {
212
234
  switch (_a.label) {
213
235
  case 0:
214
236
  _a.trys.push([0, 2, , 3]);
215
- txClient = new distribution_1.DistributionTxClient(wallet.getRawWallet(), this.config.rpcAddress);
237
+ txClient = new distribution_1.DistributionTxClient(wallet, this.config.rpcAddress);
216
238
  message = txClient.msgWithdrawValidatorCommission({ validatorAddress: validatorAddres });
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
- error_8 = _a.sent();
221
- FirmaUtil_1.FirmaUtil.printLog(error_8);
222
- throw error_8;
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, error_9;
253
+ var txRaw, txClient, error_10;
232
254
  return __generator(this, function (_a) {
233
255
  switch (_a.label) {
234
256
  case 0:
@@ -236,13 +258,13 @@ var FirmaDistributionService = /** @class */ (function () {
236
258
  return [4 /*yield*/, this.getSignedTxSetWithdrawAddress(wallet, withdrawAddress, txMisc)];
237
259
  case 1:
238
260
  txRaw = _a.sent();
239
- txClient = new distribution_1.DistributionTxClient(wallet.getRawWallet(), this.config.rpcAddress);
261
+ txClient = new distribution_1.DistributionTxClient(wallet, this.config.rpcAddress);
240
262
  return [4 /*yield*/, txClient.broadcast(txRaw)];
241
263
  case 2: return [2 /*return*/, _a.sent()];
242
264
  case 3:
243
- error_9 = _a.sent();
244
- FirmaUtil_1.FirmaUtil.printLog(error_9);
245
- throw error_9;
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, error_10;
276
+ var txRaw, txClient, error_11;
255
277
  return __generator(this, function (_a) {
256
278
  switch (_a.label) {
257
279
  case 0:
@@ -259,13 +281,13 @@ var FirmaDistributionService = /** @class */ (function () {
259
281
  return [4 /*yield*/, this.getSignedTxFundCommunityPool(wallet, amount, txMisc)];
260
282
  case 1:
261
283
  txRaw = _a.sent();
262
- txClient = new distribution_1.DistributionTxClient(wallet.getRawWallet(), this.config.rpcAddress);
284
+ txClient = new distribution_1.DistributionTxClient(wallet, this.config.rpcAddress);
263
285
  return [4 /*yield*/, txClient.broadcast(txRaw)];
264
286
  case 2: return [2 /*return*/, _a.sent()];
265
287
  case 3:
266
- error_10 = _a.sent();
267
- FirmaUtil_1.FirmaUtil.printLog(error_10);
268
- throw error_10;
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, error_11;
299
+ var txRaw, txClient, error_12;
278
300
  return __generator(this, function (_a) {
279
301
  switch (_a.label) {
280
302
  case 0:
@@ -282,13 +304,65 @@ var FirmaDistributionService = /** @class */ (function () {
282
304
  return [4 /*yield*/, this.getSignedTxWithdrawValidatorCommission(wallet, validatorAddres, txMisc)];
283
305
  case 1:
284
306
  txRaw = _a.sent();
285
- txClient = new distribution_1.DistributionTxClient(wallet.getRawWallet(), this.config.rpcAddress);
307
+ txClient = new distribution_1.DistributionTxClient(wallet, this.config.rpcAddress);
286
308
  return [4 /*yield*/, txClient.broadcast(txRaw)];
287
309
  case 2: return [2 /*return*/, _a.sent()];
288
310
  case 3:
289
- error_11 = _a.sent();
290
- FirmaUtil_1.FirmaUtil.printLog(error_11);
291
- throw error_11;
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, 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, 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, error_12;
374
+ var txRaw, txClient, error_15;
301
375
  return __generator(this, function (_a) {
302
376
  switch (_a.label) {
303
377
  case 0:
@@ -305,13 +379,13 @@ var FirmaDistributionService = /** @class */ (function () {
305
379
  return [4 /*yield*/, this.getSignedTxWithdrawAllRewards(wallet, validatorAddress, txMisc)];
306
380
  case 1:
307
381
  txRaw = _a.sent();
308
- txClient = new distribution_1.DistributionTxClient(wallet.getRawWallet(), this.config.rpcAddress);
382
+ txClient = new distribution_1.DistributionTxClient(wallet, this.config.rpcAddress);
309
383
  return [4 /*yield*/, txClient.broadcast(txRaw)];
310
384
  case 2: return [2 /*return*/, _a.sent()];
311
385
  case 3:
312
- error_12 = _a.sent();
313
- FirmaUtil_1.FirmaUtil.printLog(error_12);
314
- throw error_12;
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, error_13;
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
- error_13 = _a.sent();
336
- FirmaUtil_1.FirmaUtil.printLog(error_13);
337
- throw error_13;
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, error_14;
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
- error_14 = _a.sent();
357
- FirmaUtil_1.FirmaUtil.printLog(error_14);
358
- throw error_14;
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, error_15;
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
- error_15 = _a.sent();
378
- FirmaUtil_1.FirmaUtil.printLog(error_15);
379
- throw error_15;
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, error_16;
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
- error_16 = _a.sent();
399
- FirmaUtil_1.FirmaUtil.printLog(error_16);
400
- throw error_16;
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, error_17;
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
- error_17 = _a.sent();
420
- FirmaUtil_1.FirmaUtil.printLog(error_17);
421
- throw error_17;
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, error_18;
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
- error_18 = _a.sent();
441
- FirmaUtil_1.FirmaUtil.printLog(error_18);
442
- throw error_18;
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
  });
@@ -79,7 +79,7 @@ var FirmaFeeGrantService = /** @class */ (function () {
79
79
  return [4 /*yield*/, wallet.getAddress()];
80
80
  case 1:
81
81
  address = _a.sent();
82
- feeGrantTxClient = new feegrant_1.FeeGrantTxClient(wallet.getRawWallet(), this.config.rpcAddress);
82
+ feeGrantTxClient = new feegrant_1.FeeGrantTxClient(wallet, this.config.rpcAddress);
83
83
  message = feeGrantTxClient.msgRevokeAllowance({ granter: address, grantee: granteeAddress });
84
84
  return [4 /*yield*/, feeGrantTxClient.sign([message], feegrant_1.getSignAndBroadcastOption(this.config.denom, txMisc))];
85
85
  case 2: return [2 /*return*/, _a.sent()];
@@ -103,7 +103,7 @@ var FirmaFeeGrantService = /** @class */ (function () {
103
103
  return [4 /*yield*/, this.getSignedTxRevokeAllowance(wallet, granteeAddress, txMisc)];
104
104
  case 1:
105
105
  txRaw = _a.sent();
106
- feeGrantTxClient = new feegrant_1.FeeGrantTxClient(wallet.getRawWallet(), this.config.rpcAddress);
106
+ feeGrantTxClient = new feegrant_1.FeeGrantTxClient(wallet, this.config.rpcAddress);
107
107
  return [4 /*yield*/, feeGrantTxClient.broadcast(txRaw)];
108
108
  case 2: return [2 /*return*/, _a.sent()];
109
109
  case 3:
@@ -153,7 +153,7 @@ var FirmaFeeGrantService = /** @class */ (function () {
153
153
  return [4 /*yield*/, wallet.getAddress()];
154
154
  case 1:
155
155
  address = _a.sent();
156
- feeGrantTxClient = new feegrant_1.FeeGrantTxClient(wallet.getRawWallet(), this.config.rpcAddress);
156
+ feeGrantTxClient = new feegrant_1.FeeGrantTxClient(wallet, this.config.rpcAddress);
157
157
  periodicAllowanceData = {
158
158
  basic: {
159
159
  spendLimit: this.getCoinType(feegrantOption.basicSpendLimit),
@@ -217,7 +217,7 @@ var FirmaFeeGrantService = /** @class */ (function () {
217
217
  switch (_a.label) {
218
218
  case 0:
219
219
  _a.trys.push([0, 3, , 4]);
220
- feeGrantTxClient = new feegrant_1.FeeGrantTxClient(wallet.getRawWallet(), this.config.rpcAddress);
220
+ feeGrantTxClient = new feegrant_1.FeeGrantTxClient(wallet, this.config.rpcAddress);
221
221
  return [4 /*yield*/, wallet.getAddress()];
222
222
  case 1:
223
223
  address = _a.sent();
@@ -257,7 +257,7 @@ var FirmaFeeGrantService = /** @class */ (function () {
257
257
  return [4 /*yield*/, this.getSignedTxGrantPeriodicAllowance(wallet, granteeAddress, feegrantOption, txMisc)];
258
258
  case 1:
259
259
  txRaw = _a.sent();
260
- feeGrantTxClient = new feegrant_1.FeeGrantTxClient(wallet.getRawWallet(), this.config.rpcAddress);
260
+ feeGrantTxClient = new feegrant_1.FeeGrantTxClient(wallet, this.config.rpcAddress);
261
261
  return [4 /*yield*/, feeGrantTxClient.broadcast(txRaw)];
262
262
  case 2: return [2 /*return*/, _a.sent()];
263
263
  case 3:
@@ -281,7 +281,7 @@ var FirmaFeeGrantService = /** @class */ (function () {
281
281
  return [4 /*yield*/, this.getSignedTxGrantBasicAllowance(wallet, granteeAddress, feegrantOption, txMisc)];
282
282
  case 1:
283
283
  txRaw = _a.sent();
284
- feeGrantTxClient = new feegrant_1.FeeGrantTxClient(wallet.getRawWallet(), this.config.rpcAddress);
284
+ feeGrantTxClient = new feegrant_1.FeeGrantTxClient(wallet, this.config.rpcAddress);
285
285
  return [4 /*yield*/, feeGrantTxClient.broadcast(txRaw)];
286
286
  case 2: return [2 /*return*/, _a.sent()];
287
287
  case 3: