@firmachain/firma-js 0.2.15 → 0.2.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/sdk/FirmaBankService.js +3 -3
- package/dist/sdk/FirmaContractService.js +8 -8
- package/dist/sdk/FirmaDistributionService.d.ts +4 -0
- package/dist/sdk/FirmaDistributionService.js +140 -66
- package/dist/sdk/FirmaFeeGrantService.js +6 -6
- package/dist/sdk/FirmaGovService.js +15 -15
- package/dist/sdk/FirmaNftService.js +6 -6
- package/dist/sdk/FirmaStakingService.js +10 -10
- package/dist/sdk/FirmaTokenService.js +8 -8
- package/dist/sdk/FirmaUtil.d.ts +3 -0
- package/dist/sdk/FirmaUtil.js +56 -6
- package/dist/sdk/FirmaWalletService.d.ts +9 -1
- package/dist/sdk/FirmaWalletService.js +39 -5
- package/dist/sdk/firmachain/amino/addresses.d.ts +5 -0
- package/dist/sdk/firmachain/amino/addresses.js +46 -0
- package/dist/sdk/firmachain/amino/aminomsgs.d.ts +281 -0
- package/dist/sdk/firmachain/amino/aminomsgs.js +77 -0
- package/dist/sdk/firmachain/amino/aminotypes.d.ts +22 -0
- package/dist/sdk/firmachain/amino/aminotypes.js +521 -0
- package/dist/sdk/firmachain/amino/coins.d.ts +30 -0
- package/dist/sdk/firmachain/amino/coins.js +69 -0
- package/dist/sdk/firmachain/amino/encoding.d.ts +24 -0
- package/dist/sdk/firmachain/amino/encoding.js +234 -0
- package/dist/sdk/firmachain/amino/multisig.d.ts +10 -0
- package/dist/sdk/firmachain/amino/multisig.js +42 -0
- package/dist/sdk/firmachain/amino/paths.d.ts +6 -0
- package/dist/sdk/firmachain/amino/paths.js +18 -0
- package/dist/sdk/firmachain/amino/pubkeys.d.ts +47 -0
- package/dist/sdk/firmachain/amino/pubkeys.js +29 -0
- package/dist/sdk/firmachain/amino/secp256k1hdwallet.d.ts +94 -0
- package/dist/sdk/firmachain/amino/secp256k1hdwallet.js +437 -0
- package/dist/sdk/firmachain/amino/secp256k1wallet.d.ts +23 -0
- package/dist/sdk/firmachain/amino/secp256k1wallet.js +141 -0
- package/dist/sdk/firmachain/amino/signature.d.ts +16 -0
- package/dist/sdk/firmachain/amino/signature.js +36 -0
- package/dist/sdk/firmachain/amino/signdoc.d.ts +26 -0
- package/dist/sdk/firmachain/amino/signdoc.js +42 -0
- package/dist/sdk/firmachain/amino/signer.d.ts +33 -0
- package/dist/sdk/firmachain/amino/signer.js +2 -0
- package/dist/sdk/firmachain/amino/stdtx.d.ts +15 -0
- package/dist/sdk/firmachain/amino/stdtx.js +17 -0
- package/dist/sdk/firmachain/amino/wallet.d.ts +32 -0
- package/dist/sdk/firmachain/amino/wallet.js +132 -0
- package/dist/sdk/firmachain/bank/BankTxClient.d.ts +3 -2
- package/dist/sdk/firmachain/common/ITxClient.d.ts +4 -2
- package/dist/sdk/firmachain/common/ITxClient.js +10 -6
- package/dist/sdk/firmachain/common/LedgerSigningStargateClient.d.ts +27 -0
- package/dist/sdk/firmachain/common/LedgerSigningStargateClient.js +165 -0
- package/dist/sdk/firmachain/common/LedgerWallet.d.ts +14 -0
- package/dist/sdk/firmachain/common/LedgerWallet.js +147 -0
- package/dist/sdk/firmachain/common/signing.js +17 -1
- package/dist/sdk/firmachain/common/signingstargateclient.js +19 -3
- package/dist/sdk/firmachain/common/stargateclient.js +5 -2
- package/dist/sdk/firmachain/contract/ContractTxClient.d.ts +3 -2
- package/dist/sdk/firmachain/contract/ContractTxTypes.js +50 -9
- package/dist/sdk/firmachain/distribution/DistributionTxClient.d.ts +3 -2
- package/dist/sdk/firmachain/distribution/index.js +0 -1
- package/dist/sdk/firmachain/feegrant/FeeGrantTxClient.d.ts +3 -2
- package/dist/sdk/firmachain/feegrant/FeeGrantTxTypes.js +63 -13
- package/dist/sdk/firmachain/google/protobuf/any.js +3 -2
- package/dist/sdk/firmachain/google/protobuf/descriptor.js +1364 -324
- package/dist/sdk/firmachain/gov/GovTxClient.d.ts +3 -2
- package/dist/sdk/firmachain/gov/index.js +0 -1
- package/dist/sdk/firmachain/nft/NftTxClient.d.ts +3 -2
- package/dist/sdk/firmachain/staking/StakingTxClient.d.ts +3 -2
- package/dist/sdk/firmachain/token/TokenTxClient.d.ts +3 -2
- package/package.json +1 -1
|
@@ -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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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.
|
|
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,20 +131,18 @@ var FirmaDistributionService = /** @class */ (function () {
|
|
|
131
131
|
});
|
|
132
132
|
});
|
|
133
133
|
};
|
|
134
|
-
FirmaDistributionService.prototype.
|
|
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
|
|
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
|
-
|
|
143
|
-
return [4 /*yield*/, wallet.getAddress()];
|
|
142
|
+
return [4 /*yield*/, this.getSignedTxWithdrawAllRewards(wallet, validatorAddress, txMisc)];
|
|
144
143
|
case 1:
|
|
145
|
-
|
|
146
|
-
|
|
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.
|
|
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
|
|
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.
|
|
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.
|
|
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,
|
|
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
|
|
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
|
-
|
|
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,
|
|
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
|
|
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
|
-
|
|
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:
|
|
@@ -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
|
|
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
|
-
|
|
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:
|
|
@@ -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
|
|
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
|
-
|
|
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:
|
|
@@ -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
|
|
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
|
-
|
|
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, 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,
|
|
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
|
|
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
|
-
|
|
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
|
});
|
|
@@ -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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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:
|