@firmachain/firma-js 0.3.7 → 0.4.0-beta1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/sdk/FirmaAuthzService.js +20 -15
- package/dist/sdk/FirmaBankService.d.ts +1 -1
- package/dist/sdk/FirmaBankService.js +5 -4
- package/dist/sdk/FirmaConfig.js +4 -4
- package/dist/sdk/FirmaContractService.js +10 -8
- package/dist/sdk/FirmaDistributionService.js +37 -22
- package/dist/sdk/FirmaFeeGrantService.d.ts +0 -1
- package/dist/sdk/FirmaFeeGrantService.js +12 -14
- package/dist/sdk/FirmaGovService.d.ts +14 -0
- package/dist/sdk/FirmaGovService.js +74 -47
- package/dist/sdk/FirmaIbcService.js +4 -3
- package/dist/sdk/FirmaNftService.d.ts +3 -3
- package/dist/sdk/FirmaNftService.js +13 -10
- package/dist/sdk/FirmaStakingService.js +12 -9
- package/dist/sdk/FirmaTokenService.js +17 -14
- package/dist/sdk/FirmaUtil.js +1 -1
- package/dist/sdk/FirmaWalletService.d.ts +1 -1
- package/dist/sdk/FirmaWalletService.js +11 -23
- package/dist/sdk/firmachain/authz/AuthzTxClient.js +2 -0
- package/dist/sdk/firmachain/bank/BankTxClient.js +1 -1
- package/dist/sdk/firmachain/common/CommonTxClient.js +3 -1
- package/dist/sdk/firmachain/common/FirmaLedger.d.ts +49 -0
- package/dist/sdk/firmachain/common/FirmaLedger.js +301 -0
- package/dist/sdk/firmachain/common/ITxClient.d.ts +1 -1
- package/dist/sdk/firmachain/common/ITxClient.js +6 -4
- package/dist/sdk/firmachain/common/LedgerWallet.d.ts +5 -13
- package/dist/sdk/firmachain/common/LedgerWallet.js +1266 -124
- package/dist/sdk/firmachain/common/SigningProtobufStargateClient.js +3 -4
- package/dist/sdk/firmachain/common/SigningStargateClient.d.ts +2 -3
- package/dist/sdk/firmachain/common/SigningStargateClient.js +7 -10
- package/dist/sdk/firmachain/common/index.d.ts +1 -0
- package/dist/sdk/firmachain/common/index.js +1 -0
- package/dist/sdk/firmachain/common/signing.d.ts +4 -10
- package/dist/sdk/firmachain/common/signing.js +13 -60
- package/dist/sdk/firmachain/contract/ContractTxClient.js +1 -1
- package/dist/sdk/firmachain/contract/ContractTxTypes.js +54 -8
- package/dist/sdk/firmachain/distribution/DistributionTxClient.js +1 -1
- package/dist/sdk/firmachain/feegrant/FeeGrantTxClient.js +3 -1
- package/dist/sdk/firmachain/feegrant/FeeGrantTxTypes.d.ts +1 -2
- package/dist/sdk/firmachain/google/protobuf/any.js +0 -12
- package/dist/sdk/firmachain/gov/GovTxClient.js +3 -0
- package/dist/sdk/firmachain/nft/NftTxClient.js +1 -1
- package/dist/sdk/firmachain/token/TokenTxClient.js +1 -1
- package/package.json +16 -8
- package/dist/test/00.wallet.test.d.ts +0 -1
- package/dist/test/00.wallet.test.js +0 -96
- package/dist/test/01.contract_tx.test.d.ts +0 -1
- package/dist/test/01.contract_tx.test.js +0 -157
- package/dist/test/02.contract_query.test.d.ts +0 -1
- package/dist/test/02.contract_query.test.js +0 -245
- package/dist/test/03.contract_scenario.test.d.ts +0 -1
- package/dist/test/03.contract_scenario.test.js +0 -406
- package/dist/test/04.bank_tx.test.d.ts +0 -1
- package/dist/test/04.bank_tx.test.js +0 -126
- package/dist/test/05.bank_query.test.d.ts +0 -1
- package/dist/test/05.bank_query.test.js +0 -162
- package/dist/test/06.feegrant_tx.test.d.ts +0 -1
- package/dist/test/06.feegrant_tx.test.js +0 -185
- package/dist/test/07.feegrant_query.test.d.ts +0 -1
- package/dist/test/07.feegrant_query.test.js +0 -129
- package/dist/test/08.gas_estimate.test.d.ts +0 -1
- package/dist/test/08.gas_estimate.test.js +0 -728
- package/dist/test/09.ipfs.test.d.ts +0 -1
- package/dist/test/09.ipfs.test.js +0 -72
- package/dist/test/10.nft_tx.test.d.ts +0 -1
- package/dist/test/10.nft_tx.test.js +0 -209
- package/dist/test/11.nft_query.test.d.ts +0 -1
- package/dist/test/11.nft_query.test.js +0 -165
- package/dist/test/12.staking_tx.test.d.ts +0 -1
- package/dist/test/12.staking_tx.test.js +0 -211
- package/dist/test/13.staking_query.test.d.ts +0 -1
- package/dist/test/13.staking_query.test.js +0 -275
- package/dist/test/14.distribution_tx.test.d.ts +0 -1
- package/dist/test/14.distribution_tx.test.js +0 -170
- package/dist/test/15.distribution_query.test.d.ts +0 -1
- package/dist/test/15.distribution_query.test.js +0 -243
- package/dist/test/16.gov_tx.test.d.ts +0 -1
- package/dist/test/16.gov_tx.test.js +0 -396
- package/dist/test/17.gov_query.test.d.ts +0 -1
- package/dist/test/17.gov_query.test.js +0 -181
- package/dist/test/18.util.test.d.ts +0 -1
- package/dist/test/18.util.test.js +0 -354
- package/dist/test/19.chain.test.d.ts +0 -1
- package/dist/test/19.chain.test.js +0 -127
- package/dist/test/20.slashing_query.test.d.ts +0 -1
- package/dist/test/20.slashing_query.test.js +0 -111
- package/dist/test/21.token_tx.test.d.ts +0 -1
- package/dist/test/21.token_tx.test.js +0 -149
- package/dist/test/22.token_query.test.d.ts +0 -1
- package/dist/test/22.token_query.test.js +0 -103
- package/dist/test/23.authz_tx.test.d.ts +0 -1
- package/dist/test/23.authz_tx.test.js +0 -380
- package/dist/test/24.authz_query.test.d.ts +0 -1
- package/dist/test/24.authz_query.test.js +0 -202
- package/dist/test/25.cosmwasm_tx.test.d.ts +0 -1
- package/dist/test/25.cosmwasm_tx.test.js +0 -229
- package/dist/test/26.cosmwasm_query.test.d.ts +0 -1
- package/dist/test/26.cosmwasm_query.test.js +0 -275
- package/dist/test/27.arbitrary_sign.test.d.ts +0 -1
- package/dist/test/27.arbitrary_sign.test.js +0 -162
- package/dist/test/28.ibc_tx.test.d.ts +0 -1
- package/dist/test/28.ibc_tx.test.js +0 -98
- package/dist/test/29.mint_query.test.d.ts +0 -1
- package/dist/test/29.mint_query.test.js +0 -59
- package/dist/test/30.cw20_tx.test.d.ts +0 -1
- package/dist/test/30.cw20_tx.test.js +0 -450
- package/dist/test/31.cw20_query.test.d.ts +0 -1
- package/dist/test/31.cw20_query.test.js +0 -333
- package/dist/test/32.cw721_tx.test.d.ts +0 -1
- package/dist/test/32.cw721_tx.test.js +0 -431
- package/dist/test/33.cw721_query.test.d.ts +0 -1
- package/dist/test/33.cw721_query.test.js +0 -371
- package/dist/test/34.cw_bridge_tx.test.d.ts +0 -1
- package/dist/test/34.cw_bridge_tx.test.js +0 -476
- package/dist/test/35.cw_bridge_tx_low.test.d.ts +0 -1
- package/dist/test/35.cw_bridge_tx_low.test.js +0 -398
- package/dist/test/36.cw_bridge_query.test.d.ts +0 -1
- package/dist/test/36.cw_bridge_query.test.js +0 -318
- package/dist/test/37.cw_marketplace_tx.test.d.ts +0 -1
- package/dist/test/37.cw_marketplace_tx.test.js +0 -794
- package/dist/test/38.cw_marketplace_query.test.d.ts +0 -1
- package/dist/test/38.cw_marketplace_query.test.js +0 -128
- package/dist/test/config_test.d.ts +0 -11
- package/dist/test/config_test.js +0 -14
- package/dist/test/config_test.sample.d.ts +0 -11
- package/dist/test/config_test.sample.js +0 -14
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -49,3 +49,4 @@ __exportStar(require("./sdk/FirmaMintService"), exports);
|
|
|
49
49
|
__exportStar(require("./sdk/FirmaCosmWasmCw20"), exports);
|
|
50
50
|
__exportStar(require("./sdk/FirmaCosmWasmCw721"), exports);
|
|
51
51
|
__exportStar(require("./sdk/FirmaCosmWasmCwBridge"), exports);
|
|
52
|
+
__exportStar(require("./sdk/firmachain/common/FirmaLedger"), exports);
|
|
@@ -45,8 +45,9 @@ var FirmaAuthzService = /** @class */ (function () {
|
|
|
45
45
|
function FirmaAuthzService(config) {
|
|
46
46
|
this.config = config;
|
|
47
47
|
}
|
|
48
|
-
FirmaAuthzService.prototype.getSignedTxGrantSendAutorization = function (wallet, granteeAddress, maxTokens, expirationDate, txMisc) {
|
|
48
|
+
FirmaAuthzService.prototype.getSignedTxGrantSendAutorization = function (wallet, granteeAddress, maxTokens, expirationDate, txMisc, simulate) {
|
|
49
49
|
if (txMisc === void 0) { txMisc = FirmaUtil_1.DefaultTxMisc; }
|
|
50
|
+
if (simulate === void 0) { simulate = false; }
|
|
50
51
|
return __awaiter(this, void 0, void 0, function () {
|
|
51
52
|
var address, authorization, message, authzTxClient, error_1;
|
|
52
53
|
return __generator(this, function (_a) {
|
|
@@ -71,7 +72,7 @@ var FirmaAuthzService = /** @class */ (function () {
|
|
|
71
72
|
}
|
|
72
73
|
});
|
|
73
74
|
authzTxClient = new authz_1.AuthzTxClient(wallet, this.config.rpcAddress);
|
|
74
|
-
return [4 /*yield*/, authzTxClient.sign([message], (0, FirmaUtil_1.getSignAndBroadcastOption)(this.config.denom, txMisc))];
|
|
75
|
+
return [4 /*yield*/, authzTxClient.sign([message], (0, FirmaUtil_1.getSignAndBroadcastOption)(this.config.denom, txMisc), simulate)];
|
|
75
76
|
case 2: return [2 /*return*/, _a.sent()];
|
|
76
77
|
case 3:
|
|
77
78
|
error_1 = _a.sent();
|
|
@@ -82,8 +83,9 @@ var FirmaAuthzService = /** @class */ (function () {
|
|
|
82
83
|
});
|
|
83
84
|
});
|
|
84
85
|
};
|
|
85
|
-
FirmaAuthzService.prototype.getSignedTxGrantStakeAutorization = function (wallet, granteeAddress, validatorAddressList, type, maxTokens, expirationDate, txMisc) {
|
|
86
|
+
FirmaAuthzService.prototype.getSignedTxGrantStakeAutorization = function (wallet, granteeAddress, validatorAddressList, type, maxTokens, expirationDate, txMisc, simulate) {
|
|
86
87
|
if (txMisc === void 0) { txMisc = FirmaUtil_1.DefaultTxMisc; }
|
|
88
|
+
if (simulate === void 0) { simulate = false; }
|
|
87
89
|
return __awaiter(this, void 0, void 0, function () {
|
|
88
90
|
var address, authorization, message, authzTxClient, error_2;
|
|
89
91
|
return __generator(this, function (_a) {
|
|
@@ -110,7 +112,7 @@ var FirmaAuthzService = /** @class */ (function () {
|
|
|
110
112
|
}
|
|
111
113
|
});
|
|
112
114
|
authzTxClient = new authz_1.AuthzTxClient(wallet, this.config.rpcAddress);
|
|
113
|
-
return [4 /*yield*/, authzTxClient.sign([message], (0, FirmaUtil_1.getSignAndBroadcastOption)(this.config.denom, txMisc))];
|
|
115
|
+
return [4 /*yield*/, authzTxClient.sign([message], (0, FirmaUtil_1.getSignAndBroadcastOption)(this.config.denom, txMisc), simulate)];
|
|
114
116
|
case 2: return [2 /*return*/, _a.sent()];
|
|
115
117
|
case 3:
|
|
116
118
|
error_2 = _a.sent();
|
|
@@ -121,8 +123,9 @@ var FirmaAuthzService = /** @class */ (function () {
|
|
|
121
123
|
});
|
|
122
124
|
});
|
|
123
125
|
};
|
|
124
|
-
FirmaAuthzService.prototype.getSignedTxGrantGenericAuthorization = function (wallet, granteeAddress, msgType, expirationDate, txMisc) {
|
|
126
|
+
FirmaAuthzService.prototype.getSignedTxGrantGenericAuthorization = function (wallet, granteeAddress, msgType, expirationDate, txMisc, simulate) {
|
|
125
127
|
if (txMisc === void 0) { txMisc = FirmaUtil_1.DefaultTxMisc; }
|
|
128
|
+
if (simulate === void 0) { simulate = false; }
|
|
126
129
|
return __awaiter(this, void 0, void 0, function () {
|
|
127
130
|
var address, authorization, message, authzTxClient, error_3;
|
|
128
131
|
return __generator(this, function (_a) {
|
|
@@ -147,7 +150,7 @@ var FirmaAuthzService = /** @class */ (function () {
|
|
|
147
150
|
}
|
|
148
151
|
});
|
|
149
152
|
authzTxClient = new authz_1.AuthzTxClient(wallet, this.config.rpcAddress);
|
|
150
|
-
return [4 /*yield*/, authzTxClient.sign([message], (0, FirmaUtil_1.getSignAndBroadcastOption)(this.config.denom, txMisc))];
|
|
153
|
+
return [4 /*yield*/, authzTxClient.sign([message], (0, FirmaUtil_1.getSignAndBroadcastOption)(this.config.denom, txMisc), simulate)];
|
|
151
154
|
case 2: return [2 /*return*/, _a.sent()];
|
|
152
155
|
case 3:
|
|
153
156
|
error_3 = _a.sent();
|
|
@@ -158,8 +161,9 @@ var FirmaAuthzService = /** @class */ (function () {
|
|
|
158
161
|
});
|
|
159
162
|
});
|
|
160
163
|
};
|
|
161
|
-
FirmaAuthzService.prototype.getSignedTxRevokeGenericAuthorization = function (wallet, granteeAddress, msgType, txMisc) {
|
|
164
|
+
FirmaAuthzService.prototype.getSignedTxRevokeGenericAuthorization = function (wallet, granteeAddress, msgType, txMisc, simulate) {
|
|
162
165
|
if (txMisc === void 0) { txMisc = FirmaUtil_1.DefaultTxMisc; }
|
|
166
|
+
if (simulate === void 0) { simulate = false; }
|
|
163
167
|
return __awaiter(this, void 0, void 0, function () {
|
|
164
168
|
var address, message, authzTxClient, error_4;
|
|
165
169
|
return __generator(this, function (_a) {
|
|
@@ -175,7 +179,7 @@ var FirmaAuthzService = /** @class */ (function () {
|
|
|
175
179
|
msgTypeUrl: msgType
|
|
176
180
|
});
|
|
177
181
|
authzTxClient = new authz_1.AuthzTxClient(wallet, this.config.rpcAddress);
|
|
178
|
-
return [4 /*yield*/, authzTxClient.sign([message], (0, FirmaUtil_1.getSignAndBroadcastOption)(this.config.denom, txMisc))];
|
|
182
|
+
return [4 /*yield*/, authzTxClient.sign([message], (0, FirmaUtil_1.getSignAndBroadcastOption)(this.config.denom, txMisc), simulate)];
|
|
179
183
|
case 2: return [2 /*return*/, _a.sent()];
|
|
180
184
|
case 3:
|
|
181
185
|
error_4 = _a.sent();
|
|
@@ -187,8 +191,9 @@ var FirmaAuthzService = /** @class */ (function () {
|
|
|
187
191
|
});
|
|
188
192
|
};
|
|
189
193
|
// executeAllowance
|
|
190
|
-
FirmaAuthzService.prototype.getSignedTxExecuteAllowance = function (wallet, msgs, txMisc) {
|
|
194
|
+
FirmaAuthzService.prototype.getSignedTxExecuteAllowance = function (wallet, msgs, txMisc, simulate) {
|
|
191
195
|
if (txMisc === void 0) { txMisc = FirmaUtil_1.DefaultTxMisc; }
|
|
196
|
+
if (simulate === void 0) { simulate = false; }
|
|
192
197
|
return __awaiter(this, void 0, void 0, function () {
|
|
193
198
|
var address, message, authzTxClient, error_5;
|
|
194
199
|
return __generator(this, function (_a) {
|
|
@@ -203,7 +208,7 @@ var FirmaAuthzService = /** @class */ (function () {
|
|
|
203
208
|
msgs: msgs
|
|
204
209
|
});
|
|
205
210
|
authzTxClient = new authz_1.AuthzTxClient(wallet, this.config.rpcAddress);
|
|
206
|
-
return [4 /*yield*/, authzTxClient.sign([message], (0, FirmaUtil_1.getSignAndBroadcastOption)(this.config.denom, txMisc))];
|
|
211
|
+
return [4 /*yield*/, authzTxClient.sign([message], (0, FirmaUtil_1.getSignAndBroadcastOption)(this.config.denom, txMisc), simulate)];
|
|
207
212
|
case 2: return [2 /*return*/, _a.sent()];
|
|
208
213
|
case 3:
|
|
209
214
|
error_5 = _a.sent();
|
|
@@ -222,7 +227,7 @@ var FirmaAuthzService = /** @class */ (function () {
|
|
|
222
227
|
switch (_a.label) {
|
|
223
228
|
case 0:
|
|
224
229
|
_a.trys.push([0, 3, , 4]);
|
|
225
|
-
return [4 /*yield*/, this.getSignedTxGrantSendAutorization(wallet, granteeAddress, FirmaUtil_1.FirmaUtil.getUFCTStringFromFCT(maxTokens), expirationDate, txMisc)];
|
|
230
|
+
return [4 /*yield*/, this.getSignedTxGrantSendAutorization(wallet, granteeAddress, FirmaUtil_1.FirmaUtil.getUFCTStringFromFCT(maxTokens), expirationDate, txMisc, true)];
|
|
226
231
|
case 1:
|
|
227
232
|
txRaw = _a.sent();
|
|
228
233
|
return [4 /*yield*/, FirmaUtil_1.FirmaUtil.estimateGas(txRaw)];
|
|
@@ -268,7 +273,7 @@ var FirmaAuthzService = /** @class */ (function () {
|
|
|
268
273
|
switch (_a.label) {
|
|
269
274
|
case 0:
|
|
270
275
|
_a.trys.push([0, 3, , 4]);
|
|
271
|
-
return [4 /*yield*/, this.getSignedTxGrantStakeAutorization(wallet, granteeAddress, validatorAddressList, type, FirmaUtil_1.FirmaUtil.getUFCTStringFromFCT(maxTokens), expirationDate, txMisc)];
|
|
276
|
+
return [4 /*yield*/, this.getSignedTxGrantStakeAutorization(wallet, granteeAddress, validatorAddressList, type, FirmaUtil_1.FirmaUtil.getUFCTStringFromFCT(maxTokens), expirationDate, txMisc, true)];
|
|
272
277
|
case 1:
|
|
273
278
|
txRaw = _a.sent();
|
|
274
279
|
return [4 /*yield*/, FirmaUtil_1.FirmaUtil.estimateGas(txRaw)];
|
|
@@ -314,7 +319,7 @@ var FirmaAuthzService = /** @class */ (function () {
|
|
|
314
319
|
switch (_a.label) {
|
|
315
320
|
case 0:
|
|
316
321
|
_a.trys.push([0, 3, , 4]);
|
|
317
|
-
return [4 /*yield*/, this.getSignedTxGrantGenericAuthorization(wallet, granteeAddress, msg, expirationDate, txMisc)];
|
|
322
|
+
return [4 /*yield*/, this.getSignedTxGrantGenericAuthorization(wallet, granteeAddress, msg, expirationDate, txMisc, true)];
|
|
318
323
|
case 1:
|
|
319
324
|
txRaw = _a.sent();
|
|
320
325
|
return [4 /*yield*/, FirmaUtil_1.FirmaUtil.estimateGas(txRaw)];
|
|
@@ -461,7 +466,7 @@ var FirmaAuthzService = /** @class */ (function () {
|
|
|
461
466
|
default:
|
|
462
467
|
throw "AuthorizationType Error : " + type;
|
|
463
468
|
}
|
|
464
|
-
return [4 /*yield*/, this.getSignedTxRevokeGenericAuthorization(wallet, granteeAddress, msgType, txMisc)];
|
|
469
|
+
return [4 /*yield*/, this.getSignedTxRevokeGenericAuthorization(wallet, granteeAddress, msgType, txMisc, true)];
|
|
465
470
|
case 1:
|
|
466
471
|
txRaw = _a.sent();
|
|
467
472
|
return [4 /*yield*/, FirmaUtil_1.FirmaUtil.estimateGas(txRaw)];
|
|
@@ -520,7 +525,7 @@ var FirmaAuthzService = /** @class */ (function () {
|
|
|
520
525
|
switch (_a.label) {
|
|
521
526
|
case 0:
|
|
522
527
|
_a.trys.push([0, 3, , 4]);
|
|
523
|
-
return [4 /*yield*/, this.getSignedTxExecuteAllowance(wallet, msgs, txMisc)];
|
|
528
|
+
return [4 /*yield*/, this.getSignedTxExecuteAllowance(wallet, msgs, txMisc, true)];
|
|
524
529
|
case 1:
|
|
525
530
|
txRaw = _a.sent();
|
|
526
531
|
return [4 /*yield*/, FirmaUtil_1.FirmaUtil.estimateGas(txRaw)];
|
|
@@ -17,5 +17,5 @@ export declare class FirmaBankService {
|
|
|
17
17
|
getTokenBalanceList(address: string): Promise<Token[]>;
|
|
18
18
|
getTokenBalance(address: string, tokenID: string): Promise<string>;
|
|
19
19
|
getBalance(address: string): Promise<string>;
|
|
20
|
-
getSignedTxSend(wallet: FirmaWalletService, targetAddress: string, denom: string, amount: string, txMisc?: TxMisc): Promise<TxRaw>;
|
|
20
|
+
getSignedTxSend(wallet: FirmaWalletService, targetAddress: string, denom: string, amount: string, txMisc?: TxMisc, simulate?: boolean): Promise<TxRaw>;
|
|
21
21
|
}
|
|
@@ -54,7 +54,7 @@ var FirmaBankService = /** @class */ (function () {
|
|
|
54
54
|
switch (_a.label) {
|
|
55
55
|
case 0:
|
|
56
56
|
_a.trys.push([0, 3, , 4]);
|
|
57
|
-
return [4 /*yield*/, this.getSignedTxSend(wallet, targetAddress, this.config.denom, FirmaUtil_1.FirmaUtil.getUFCTStringFromFCT(amount), txMisc)];
|
|
57
|
+
return [4 /*yield*/, this.getSignedTxSend(wallet, targetAddress, this.config.denom, FirmaUtil_1.FirmaUtil.getUFCTStringFromFCT(amount), txMisc, true)];
|
|
58
58
|
case 1:
|
|
59
59
|
txRaw = _a.sent();
|
|
60
60
|
return [4 /*yield*/, FirmaUtil_1.FirmaUtil.estimateGas(txRaw)];
|
|
@@ -76,7 +76,7 @@ var FirmaBankService = /** @class */ (function () {
|
|
|
76
76
|
switch (_a.label) {
|
|
77
77
|
case 0:
|
|
78
78
|
_a.trys.push([0, 3, , 4]);
|
|
79
|
-
return [4 /*yield*/, this.getSignedTxSend(wallet, targetAddress, tokenID, FirmaUtil_1.FirmaUtil.getUTokenStringFromToken(amount, decimal), txMisc)];
|
|
79
|
+
return [4 /*yield*/, this.getSignedTxSend(wallet, targetAddress, tokenID, FirmaUtil_1.FirmaUtil.getUTokenStringFromToken(amount, decimal), txMisc, true)];
|
|
80
80
|
case 1:
|
|
81
81
|
txRaw = _a.sent();
|
|
82
82
|
return [4 /*yield*/, FirmaUtil_1.FirmaUtil.estimateGas(txRaw)];
|
|
@@ -272,8 +272,9 @@ var FirmaBankService = /** @class */ (function () {
|
|
|
272
272
|
});
|
|
273
273
|
});
|
|
274
274
|
};
|
|
275
|
-
FirmaBankService.prototype.getSignedTxSend = function (wallet, targetAddress, denom, amount, txMisc) {
|
|
275
|
+
FirmaBankService.prototype.getSignedTxSend = function (wallet, targetAddress, denom, amount, txMisc, simulate) {
|
|
276
276
|
if (txMisc === void 0) { txMisc = FirmaUtil_1.DefaultTxMisc; }
|
|
277
|
+
if (simulate === void 0) { simulate = false; }
|
|
277
278
|
return __awaiter(this, void 0, void 0, function () {
|
|
278
279
|
var bankTxClient, address, sendAmount, message, error_11;
|
|
279
280
|
return __generator(this, function (_a) {
|
|
@@ -286,7 +287,7 @@ var FirmaBankService = /** @class */ (function () {
|
|
|
286
287
|
address = _a.sent();
|
|
287
288
|
sendAmount = { denom: denom, amount: amount };
|
|
288
289
|
message = bank_1.BankTxClient.msgSend({ fromAddress: address, toAddress: targetAddress, amount: [sendAmount] });
|
|
289
|
-
return [4 /*yield*/, bankTxClient.sign([message], (0, FirmaUtil_1.getSignAndBroadcastOption)(this.config.denom, txMisc))];
|
|
290
|
+
return [4 /*yield*/, bankTxClient.sign([message], (0, FirmaUtil_1.getSignAndBroadcastOption)(this.config.denom, txMisc), simulate)];
|
|
290
291
|
case 2: return [2 /*return*/, _a.sent()];
|
|
291
292
|
case 3:
|
|
292
293
|
error_11 = _a.sent();
|
package/dist/sdk/FirmaConfig.js
CHANGED
|
@@ -32,8 +32,8 @@ var FirmaConfig = /** @class */ (function () {
|
|
|
32
32
|
};
|
|
33
33
|
FirmaConfig.TestNetConfig = {
|
|
34
34
|
chainID: "imperium-4",
|
|
35
|
-
rpcAddress: "https://
|
|
36
|
-
restApiAddress: "https://
|
|
35
|
+
rpcAddress: "https://testnet.firmachain.dev:26657",
|
|
36
|
+
restApiAddress: "https://testnet.firmachain.dev:1317",
|
|
37
37
|
ipfsNodeAddress: "https://ipfs-dev.firmachain.dev",
|
|
38
38
|
ipfsNodePort: 5001,
|
|
39
39
|
ipfsWebApiAddress: "https://ipfs-dev.firmachain.dev",
|
|
@@ -46,8 +46,8 @@ var FirmaConfig = /** @class */ (function () {
|
|
|
46
46
|
};
|
|
47
47
|
FirmaConfig.MainNetConfig = {
|
|
48
48
|
chainID: "colosseum-1",
|
|
49
|
-
rpcAddress: "https://
|
|
50
|
-
restApiAddress: "https://
|
|
49
|
+
rpcAddress: "https://mainnet.firmachain.dev:26657",
|
|
50
|
+
restApiAddress: "https://mainnet.firmachain.dev:1317",
|
|
51
51
|
ipfsNodeAddress: "https://ipfs-dev.firmachain.dev",
|
|
52
52
|
ipfsNodePort: 5001,
|
|
53
53
|
ipfsWebApiAddress: "https://ipfs-dev.firmachain.dev",
|
|
@@ -168,7 +168,7 @@ var ContractService = /** @class */ (function () {
|
|
|
168
168
|
case 0:
|
|
169
169
|
_a.trys.push([0, 3, , 4]);
|
|
170
170
|
contractTxClient = new contract_1.ContractTxClient(wallet, this.config.rpcAddress);
|
|
171
|
-
return [4 /*yield*/, contractTxClient.sign(txList, (0, FirmaUtil_1.getSignAndBroadcastOption)(this.config.denom, txMisc))];
|
|
171
|
+
return [4 /*yield*/, contractTxClient.sign(txList, (0, FirmaUtil_1.getSignAndBroadcastOption)(this.config.denom, txMisc), true)];
|
|
172
172
|
case 1:
|
|
173
173
|
txRaw = _a.sent();
|
|
174
174
|
return [4 /*yield*/, FirmaUtil_1.FirmaUtil.estimateGas(txRaw)];
|
|
@@ -190,7 +190,7 @@ var ContractService = /** @class */ (function () {
|
|
|
190
190
|
switch (_a.label) {
|
|
191
191
|
case 0:
|
|
192
192
|
_a.trys.push([0, 3, , 4]);
|
|
193
|
-
return [4 /*yield*/, this.getSignedTxCreateContractFile(wallet, fileHash, timeStamp, ownerList, metaDataJsonString, txMisc)];
|
|
193
|
+
return [4 /*yield*/, this.getSignedTxCreateContractFile(wallet, fileHash, timeStamp, ownerList, metaDataJsonString, txMisc, true)];
|
|
194
194
|
case 1:
|
|
195
195
|
txRaw = _a.sent();
|
|
196
196
|
return [4 /*yield*/, FirmaUtil_1.FirmaUtil.estimateGas(txRaw)];
|
|
@@ -230,8 +230,9 @@ var ContractService = /** @class */ (function () {
|
|
|
230
230
|
});
|
|
231
231
|
});
|
|
232
232
|
};
|
|
233
|
-
ContractService.prototype.getSignedTxCreateContractFile = function (wallet, fileHash, timeStamp, ownerList, metaDataJsonString, txMisc) {
|
|
233
|
+
ContractService.prototype.getSignedTxCreateContractFile = function (wallet, fileHash, timeStamp, ownerList, metaDataJsonString, txMisc, simulate) {
|
|
234
234
|
if (txMisc === void 0) { txMisc = FirmaUtil_1.DefaultTxMisc; }
|
|
235
|
+
if (simulate === void 0) { simulate = false; }
|
|
235
236
|
return __awaiter(this, void 0, void 0, function () {
|
|
236
237
|
var address, message, contractTxClient, error_10;
|
|
237
238
|
return __generator(this, function (_a) {
|
|
@@ -249,7 +250,7 @@ var ContractService = /** @class */ (function () {
|
|
|
249
250
|
metaDataJsonString: metaDataJsonString
|
|
250
251
|
});
|
|
251
252
|
contractTxClient = new contract_1.ContractTxClient(wallet, this.config.rpcAddress);
|
|
252
|
-
return [4 /*yield*/, contractTxClient.sign([message], (0, FirmaUtil_1.getSignAndBroadcastOption)(this.config.denom, txMisc))];
|
|
253
|
+
return [4 /*yield*/, contractTxClient.sign([message], (0, FirmaUtil_1.getSignAndBroadcastOption)(this.config.denom, txMisc), simulate)];
|
|
253
254
|
case 2: return [2 /*return*/, _a.sent()];
|
|
254
255
|
case 3:
|
|
255
256
|
error_10 = _a.sent();
|
|
@@ -291,7 +292,7 @@ var ContractService = /** @class */ (function () {
|
|
|
291
292
|
switch (_a.label) {
|
|
292
293
|
case 0:
|
|
293
294
|
_a.trys.push([0, 3, , 4]);
|
|
294
|
-
return [4 /*yield*/, this.getSignedTxAddContractLog(wallet, contractHash, timeStamp, eventName, ownerAddress, jsonString, txMisc)];
|
|
295
|
+
return [4 /*yield*/, this.getSignedTxAddContractLog(wallet, contractHash, timeStamp, eventName, ownerAddress, jsonString, txMisc, true)];
|
|
295
296
|
case 1:
|
|
296
297
|
txRaw = _a.sent();
|
|
297
298
|
return [4 /*yield*/, FirmaUtil_1.FirmaUtil.estimateGas(txRaw)];
|
|
@@ -305,8 +306,9 @@ var ContractService = /** @class */ (function () {
|
|
|
305
306
|
});
|
|
306
307
|
});
|
|
307
308
|
};
|
|
308
|
-
ContractService.prototype.getSignedTxAddContractLog = function (wallet, contractHash, timeStamp, eventName, ownerAddress, jsonString, txMisc) {
|
|
309
|
+
ContractService.prototype.getSignedTxAddContractLog = function (wallet, contractHash, timeStamp, eventName, ownerAddress, jsonString, txMisc, simulate) {
|
|
309
310
|
if (txMisc === void 0) { txMisc = FirmaUtil_1.DefaultTxMisc; }
|
|
311
|
+
if (simulate === void 0) { simulate = false; }
|
|
310
312
|
return __awaiter(this, void 0, void 0, function () {
|
|
311
313
|
var address, message, contractTxClient, error_13;
|
|
312
314
|
return __generator(this, function (_a) {
|
|
@@ -325,7 +327,7 @@ var ContractService = /** @class */ (function () {
|
|
|
325
327
|
jsonString: jsonString
|
|
326
328
|
});
|
|
327
329
|
contractTxClient = new contract_1.ContractTxClient(wallet, this.config.rpcAddress);
|
|
328
|
-
return [4 /*yield*/, contractTxClient.sign([message], (0, FirmaUtil_1.getSignAndBroadcastOption)(this.config.denom, txMisc))];
|
|
330
|
+
return [4 /*yield*/, contractTxClient.sign([message], (0, FirmaUtil_1.getSignAndBroadcastOption)(this.config.denom, txMisc), simulate)];
|
|
329
331
|
case 2: return [2 /*return*/, _a.sent()];
|
|
330
332
|
case 3:
|
|
331
333
|
error_13 = _a.sent();
|
|
@@ -395,7 +397,7 @@ var ContractService = /** @class */ (function () {
|
|
|
395
397
|
case 0:
|
|
396
398
|
_a.trys.push([0, 3, , 4]);
|
|
397
399
|
contractTxClient = new contract_1.ContractTxClient(wallet, this.config.rpcAddress);
|
|
398
|
-
return [4 /*yield*/, contractTxClient.sign(msgList, (0, FirmaUtil_1.getSignAndBroadcastOption)(this.config.denom, txMisc))];
|
|
400
|
+
return [4 /*yield*/, contractTxClient.sign(msgList, (0, FirmaUtil_1.getSignAndBroadcastOption)(this.config.denom, txMisc), true)];
|
|
399
401
|
case 1:
|
|
400
402
|
txRaw = _a.sent();
|
|
401
403
|
return [4 /*yield*/, FirmaUtil_1.FirmaUtil.estimateGas(txRaw)];
|
|
@@ -54,7 +54,7 @@ var FirmaDistributionService = /** @class */ (function () {
|
|
|
54
54
|
switch (_a.label) {
|
|
55
55
|
case 0:
|
|
56
56
|
_a.trys.push([0, 3, , 4]);
|
|
57
|
-
return [4 /*yield*/, this.getSignedTxSetWithdrawAddress(wallet, withdrawAddress, txMisc)];
|
|
57
|
+
return [4 /*yield*/, this.getSignedTxSetWithdrawAddress(wallet, withdrawAddress, txMisc, true)];
|
|
58
58
|
case 1:
|
|
59
59
|
txRaw = _a.sent();
|
|
60
60
|
return [4 /*yield*/, FirmaUtil_1.FirmaUtil.estimateGas(txRaw)];
|
|
@@ -76,7 +76,7 @@ var FirmaDistributionService = /** @class */ (function () {
|
|
|
76
76
|
switch (_a.label) {
|
|
77
77
|
case 0:
|
|
78
78
|
_a.trys.push([0, 3, , 4]);
|
|
79
|
-
return [4 /*yield*/, this.getSignedTxFundCommunityPool(wallet, amount, txMisc)];
|
|
79
|
+
return [4 /*yield*/, this.getSignedTxFundCommunityPool(wallet, amount, txMisc, true)];
|
|
80
80
|
case 1:
|
|
81
81
|
txRaw = _a.sent();
|
|
82
82
|
return [4 /*yield*/, FirmaUtil_1.FirmaUtil.estimateGas(txRaw)];
|
|
@@ -98,7 +98,7 @@ var FirmaDistributionService = /** @class */ (function () {
|
|
|
98
98
|
switch (_a.label) {
|
|
99
99
|
case 0:
|
|
100
100
|
_a.trys.push([0, 3, , 4]);
|
|
101
|
-
return [4 /*yield*/, this.getSignedTxWithdrawValidatorCommission(wallet, validatorAddress, txMisc)];
|
|
101
|
+
return [4 /*yield*/, this.getSignedTxWithdrawValidatorCommission(wallet, validatorAddress, txMisc, true)];
|
|
102
102
|
case 1:
|
|
103
103
|
txRaw = _a.sent();
|
|
104
104
|
return [4 /*yield*/, FirmaUtil_1.FirmaUtil.estimateGas(txRaw)];
|
|
@@ -120,7 +120,7 @@ var FirmaDistributionService = /** @class */ (function () {
|
|
|
120
120
|
switch (_a.label) {
|
|
121
121
|
case 0:
|
|
122
122
|
_a.trys.push([0, 3, , 4]);
|
|
123
|
-
return [4 /*yield*/, this.getSignedTxwithdrawAllRewardsFromAllValidator(wallet, delegationList, txMisc)];
|
|
123
|
+
return [4 /*yield*/, this.getSignedTxwithdrawAllRewardsFromAllValidator(wallet, delegationList, txMisc, true)];
|
|
124
124
|
case 1:
|
|
125
125
|
txRaw = _a.sent();
|
|
126
126
|
return [4 /*yield*/, FirmaUtil_1.FirmaUtil.estimateGas(txRaw)];
|
|
@@ -142,7 +142,7 @@ var FirmaDistributionService = /** @class */ (function () {
|
|
|
142
142
|
switch (_a.label) {
|
|
143
143
|
case 0:
|
|
144
144
|
_a.trys.push([0, 3, , 4]);
|
|
145
|
-
return [4 /*yield*/, this.getSignedTxWithdrawAllRewards(wallet, validatorAddress, txMisc)];
|
|
145
|
+
return [4 /*yield*/, this.getSignedTxWithdrawAllRewards(wallet, validatorAddress, txMisc, true)];
|
|
146
146
|
case 1:
|
|
147
147
|
txRaw = _a.sent();
|
|
148
148
|
return [4 /*yield*/, FirmaUtil_1.FirmaUtil.estimateGas(txRaw)];
|
|
@@ -156,8 +156,9 @@ var FirmaDistributionService = /** @class */ (function () {
|
|
|
156
156
|
});
|
|
157
157
|
});
|
|
158
158
|
};
|
|
159
|
-
FirmaDistributionService.prototype.getSignedTxWithdrawAllRewards = function (wallet, validatorAddress, txMisc) {
|
|
159
|
+
FirmaDistributionService.prototype.getSignedTxWithdrawAllRewards = function (wallet, validatorAddress, txMisc, simulate) {
|
|
160
160
|
if (txMisc === void 0) { txMisc = FirmaUtil_1.DefaultTxMisc; }
|
|
161
|
+
if (simulate === void 0) { simulate = false; }
|
|
161
162
|
return __awaiter(this, void 0, void 0, function () {
|
|
162
163
|
var txClient, address, message, error_6;
|
|
163
164
|
return __generator(this, function (_a) {
|
|
@@ -169,7 +170,7 @@ var FirmaDistributionService = /** @class */ (function () {
|
|
|
169
170
|
case 1:
|
|
170
171
|
address = _a.sent();
|
|
171
172
|
message = distribution_1.DistributionTxClient.msgWithdrawDelegatorReward({ delegatorAddress: address, validatorAddress: validatorAddress });
|
|
172
|
-
return [4 /*yield*/, txClient.sign([message], (0, FirmaUtil_1.getSignAndBroadcastOption)(this.config.denom, txMisc))];
|
|
173
|
+
return [4 /*yield*/, txClient.sign([message], (0, FirmaUtil_1.getSignAndBroadcastOption)(this.config.denom, txMisc), simulate)];
|
|
173
174
|
case 2: return [2 /*return*/, _a.sent()];
|
|
174
175
|
case 3:
|
|
175
176
|
error_6 = _a.sent();
|
|
@@ -180,8 +181,9 @@ var FirmaDistributionService = /** @class */ (function () {
|
|
|
180
181
|
});
|
|
181
182
|
});
|
|
182
183
|
};
|
|
183
|
-
FirmaDistributionService.prototype.getSignedTxSetWithdrawAddress = function (wallet, withdrawAddress, txMisc) {
|
|
184
|
+
FirmaDistributionService.prototype.getSignedTxSetWithdrawAddress = function (wallet, withdrawAddress, txMisc, simulate) {
|
|
184
185
|
if (txMisc === void 0) { txMisc = FirmaUtil_1.DefaultTxMisc; }
|
|
186
|
+
if (simulate === void 0) { simulate = false; }
|
|
185
187
|
return __awaiter(this, void 0, void 0, function () {
|
|
186
188
|
var txClient, address, message, error_7;
|
|
187
189
|
return __generator(this, function (_a) {
|
|
@@ -193,7 +195,7 @@ var FirmaDistributionService = /** @class */ (function () {
|
|
|
193
195
|
case 1:
|
|
194
196
|
address = _a.sent();
|
|
195
197
|
message = distribution_1.DistributionTxClient.msgSetWithdrawAddress({ delegatorAddress: address, withdrawAddress: withdrawAddress });
|
|
196
|
-
return [4 /*yield*/, txClient.sign([message], (0, FirmaUtil_1.getSignAndBroadcastOption)(this.config.denom, txMisc))];
|
|
198
|
+
return [4 /*yield*/, txClient.sign([message], (0, FirmaUtil_1.getSignAndBroadcastOption)(this.config.denom, txMisc), simulate)];
|
|
197
199
|
case 2: return [2 /*return*/, _a.sent()];
|
|
198
200
|
case 3:
|
|
199
201
|
error_7 = _a.sent();
|
|
@@ -204,8 +206,9 @@ var FirmaDistributionService = /** @class */ (function () {
|
|
|
204
206
|
});
|
|
205
207
|
});
|
|
206
208
|
};
|
|
207
|
-
FirmaDistributionService.prototype.getSignedTxFundCommunityPool = function (wallet, amount, txMisc) {
|
|
209
|
+
FirmaDistributionService.prototype.getSignedTxFundCommunityPool = function (wallet, amount, txMisc, simulate) {
|
|
208
210
|
if (txMisc === void 0) { txMisc = FirmaUtil_1.DefaultTxMisc; }
|
|
211
|
+
if (simulate === void 0) { simulate = false; }
|
|
209
212
|
return __awaiter(this, void 0, void 0, function () {
|
|
210
213
|
var txClient, address, sendAmount, message, error_8;
|
|
211
214
|
return __generator(this, function (_a) {
|
|
@@ -218,7 +221,7 @@ var FirmaDistributionService = /** @class */ (function () {
|
|
|
218
221
|
address = _a.sent();
|
|
219
222
|
sendAmount = { denom: this.config.denom, amount: FirmaUtil_1.FirmaUtil.getUFCTStringFromFCT(amount) };
|
|
220
223
|
message = distribution_1.DistributionTxClient.msgFundCommunityPool({ depositor: address, amount: [sendAmount] });
|
|
221
|
-
return [4 /*yield*/, txClient.sign([message], (0, FirmaUtil_1.getSignAndBroadcastOption)(this.config.denom, txMisc))];
|
|
224
|
+
return [4 /*yield*/, txClient.sign([message], (0, FirmaUtil_1.getSignAndBroadcastOption)(this.config.denom, txMisc), simulate)];
|
|
222
225
|
case 2: return [2 /*return*/, _a.sent()];
|
|
223
226
|
case 3:
|
|
224
227
|
error_8 = _a.sent();
|
|
@@ -229,8 +232,9 @@ var FirmaDistributionService = /** @class */ (function () {
|
|
|
229
232
|
});
|
|
230
233
|
});
|
|
231
234
|
};
|
|
232
|
-
FirmaDistributionService.prototype.getSignedTxWithdrawValidatorCommission = function (wallet, validatorAddres, txMisc) {
|
|
235
|
+
FirmaDistributionService.prototype.getSignedTxWithdrawValidatorCommission = function (wallet, validatorAddres, txMisc, simulate) {
|
|
233
236
|
if (txMisc === void 0) { txMisc = FirmaUtil_1.DefaultTxMisc; }
|
|
237
|
+
if (simulate === void 0) { simulate = false; }
|
|
234
238
|
return __awaiter(this, void 0, void 0, function () {
|
|
235
239
|
var txClient, message, error_9;
|
|
236
240
|
return __generator(this, function (_a) {
|
|
@@ -239,7 +243,7 @@ var FirmaDistributionService = /** @class */ (function () {
|
|
|
239
243
|
_a.trys.push([0, 2, , 3]);
|
|
240
244
|
txClient = new distribution_1.DistributionTxClient(wallet, this.config.rpcAddress);
|
|
241
245
|
message = distribution_1.DistributionTxClient.msgWithdrawValidatorCommission({ validatorAddress: validatorAddres });
|
|
242
|
-
return [4 /*yield*/, txClient.sign([message], (0, FirmaUtil_1.getSignAndBroadcastOption)(this.config.denom, txMisc))];
|
|
246
|
+
return [4 /*yield*/, txClient.sign([message], (0, FirmaUtil_1.getSignAndBroadcastOption)(this.config.denom, txMisc), simulate)];
|
|
243
247
|
case 1: return [2 /*return*/, _a.sent()];
|
|
244
248
|
case 2:
|
|
245
249
|
error_9 = _a.sent();
|
|
@@ -319,31 +323,42 @@ var FirmaDistributionService = /** @class */ (function () {
|
|
|
319
323
|
});
|
|
320
324
|
});
|
|
321
325
|
};
|
|
322
|
-
FirmaDistributionService.prototype.getSignedTxwithdrawAllRewardsFromAllValidator = function (wallet, delegationList, txMisc) {
|
|
326
|
+
FirmaDistributionService.prototype.getSignedTxwithdrawAllRewardsFromAllValidator = function (wallet, delegationList, txMisc, simulate) {
|
|
323
327
|
if (txMisc === void 0) { txMisc = FirmaUtil_1.DefaultTxMisc; }
|
|
328
|
+
if (simulate === void 0) { simulate = false; }
|
|
324
329
|
return __awaiter(this, void 0, void 0, function () {
|
|
325
|
-
var address, txClient, messageList, i, validatorAddress, message, error_13;
|
|
330
|
+
var address, txClient, messageList, totalRewardInfo_1, filteredDelegationList, i, validatorAddress, message, error_13;
|
|
326
331
|
return __generator(this, function (_a) {
|
|
327
332
|
switch (_a.label) {
|
|
328
333
|
case 0:
|
|
329
|
-
_a.trys.push([0,
|
|
334
|
+
_a.trys.push([0, 4, , 5]);
|
|
330
335
|
return [4 /*yield*/, wallet.getAddress()];
|
|
331
336
|
case 1:
|
|
332
337
|
address = _a.sent();
|
|
333
338
|
txClient = new distribution_1.DistributionTxClient(wallet, this.config.rpcAddress);
|
|
334
339
|
messageList = [];
|
|
335
|
-
|
|
336
|
-
|
|
340
|
+
return [4 /*yield*/, this.getTotalRewardInfo(address)];
|
|
341
|
+
case 2:
|
|
342
|
+
totalRewardInfo_1 = _a.sent();
|
|
343
|
+
filteredDelegationList = delegationList.filter(function (delegation) {
|
|
344
|
+
var hasReward = totalRewardInfo_1.rewards.some(function (reward) { return reward.validator_address === delegation.delegation.validator_address; });
|
|
345
|
+
if (!hasReward) {
|
|
346
|
+
FirmaUtil_1.FirmaUtil.printLog("Validator filtered. Will not request to withdraw reward from zero reward validator: ".concat(delegation.delegation.validator_address, ", delegation amount=").concat(delegation.balance.amount));
|
|
347
|
+
}
|
|
348
|
+
return hasReward;
|
|
349
|
+
});
|
|
350
|
+
for (i = 0; i < filteredDelegationList.length; i++) {
|
|
351
|
+
validatorAddress = filteredDelegationList[i].delegation.validator_address;
|
|
337
352
|
message = distribution_1.DistributionTxClient.msgWithdrawDelegatorReward({ delegatorAddress: address, validatorAddress: validatorAddress });
|
|
338
353
|
messageList.push(message);
|
|
339
354
|
}
|
|
340
|
-
return [4 /*yield*/, txClient.sign(messageList, (0, FirmaUtil_1.getSignAndBroadcastOption)(this.config.denom, txMisc))];
|
|
341
|
-
case
|
|
342
|
-
case
|
|
355
|
+
return [4 /*yield*/, txClient.sign(messageList, (0, FirmaUtil_1.getSignAndBroadcastOption)(this.config.denom, txMisc), simulate)];
|
|
356
|
+
case 3: return [2 /*return*/, _a.sent()];
|
|
357
|
+
case 4:
|
|
343
358
|
error_13 = _a.sent();
|
|
344
359
|
FirmaUtil_1.FirmaUtil.printLog(error_13);
|
|
345
360
|
throw error_13;
|
|
346
|
-
case
|
|
361
|
+
case 5: return [2 /*return*/];
|
|
347
362
|
}
|
|
348
363
|
});
|
|
349
364
|
});
|
|
@@ -10,7 +10,6 @@ export declare class FirmaFeeGrantService {
|
|
|
10
10
|
getGasEstimationRevokeAllowance(wallet: FirmaWalletService, granteeAddress: string, txMisc?: TxMisc): Promise<number>;
|
|
11
11
|
private getSignedTxRevokeAllowance;
|
|
12
12
|
revokeAllowance(wallet: FirmaWalletService, granteeAddress: string, txMisc?: TxMisc): Promise<DeliverTxResponse>;
|
|
13
|
-
private getCoinType;
|
|
14
13
|
getGasEstimationGrantPeriodicAllowance(wallet: FirmaWalletService, granteeAddress: string, feegrantOption: PeriodicAllowance, txMisc?: TxMisc): Promise<number>;
|
|
15
14
|
private getSignedTxGrantPeriodicAllowance;
|
|
16
15
|
getGasEstimationGrantBasicAllowance(wallet: FirmaWalletService, granteeAddress: string, feegrantOption: BasicAllowance, txMisc?: TxMisc): Promise<number>;
|
|
@@ -54,7 +54,7 @@ var FirmaFeeGrantService = /** @class */ (function () {
|
|
|
54
54
|
switch (_a.label) {
|
|
55
55
|
case 0:
|
|
56
56
|
_a.trys.push([0, 3, , 4]);
|
|
57
|
-
return [4 /*yield*/, this.getSignedTxRevokeAllowance(wallet, granteeAddress, txMisc)];
|
|
57
|
+
return [4 /*yield*/, this.getSignedTxRevokeAllowance(wallet, granteeAddress, txMisc, true)];
|
|
58
58
|
case 1:
|
|
59
59
|
txRaw = _a.sent();
|
|
60
60
|
return [4 /*yield*/, FirmaUtil_1.FirmaUtil.estimateGas(txRaw)];
|
|
@@ -68,8 +68,9 @@ var FirmaFeeGrantService = /** @class */ (function () {
|
|
|
68
68
|
});
|
|
69
69
|
});
|
|
70
70
|
};
|
|
71
|
-
FirmaFeeGrantService.prototype.getSignedTxRevokeAllowance = function (wallet, granteeAddress, txMisc) {
|
|
71
|
+
FirmaFeeGrantService.prototype.getSignedTxRevokeAllowance = function (wallet, granteeAddress, txMisc, simulate) {
|
|
72
72
|
if (txMisc === void 0) { txMisc = FirmaUtil_1.DefaultTxMisc; }
|
|
73
|
+
if (simulate === void 0) { simulate = false; }
|
|
73
74
|
return __awaiter(this, void 0, void 0, function () {
|
|
74
75
|
var address, feeGrantTxClient, message, error_2;
|
|
75
76
|
return __generator(this, function (_a) {
|
|
@@ -81,7 +82,7 @@ var FirmaFeeGrantService = /** @class */ (function () {
|
|
|
81
82
|
address = _a.sent();
|
|
82
83
|
feeGrantTxClient = new feegrant_1.FeeGrantTxClient(wallet, this.config.rpcAddress);
|
|
83
84
|
message = feegrant_1.FeeGrantTxClient.msgRevokeAllowance({ granter: address, grantee: granteeAddress });
|
|
84
|
-
return [4 /*yield*/, feeGrantTxClient.sign([message], (0, FirmaUtil_1.getSignAndBroadcastOption)(this.config.denom, txMisc))];
|
|
85
|
+
return [4 /*yield*/, feeGrantTxClient.sign([message], (0, FirmaUtil_1.getSignAndBroadcastOption)(this.config.denom, txMisc), simulate)];
|
|
85
86
|
case 2: return [2 /*return*/, _a.sent()];
|
|
86
87
|
case 3:
|
|
87
88
|
error_2 = _a.sent();
|
|
@@ -115,11 +116,6 @@ var FirmaFeeGrantService = /** @class */ (function () {
|
|
|
115
116
|
});
|
|
116
117
|
});
|
|
117
118
|
};
|
|
118
|
-
FirmaFeeGrantService.prototype.getCoinType = function (amount) {
|
|
119
|
-
if (amount == undefined)
|
|
120
|
-
return [];
|
|
121
|
-
return [{ denom: this.config.denom, amount: amount.toString() }];
|
|
122
|
-
};
|
|
123
119
|
FirmaFeeGrantService.prototype.getGasEstimationGrantPeriodicAllowance = function (wallet, granteeAddress, feegrantOption, txMisc) {
|
|
124
120
|
if (txMisc === void 0) { txMisc = FirmaUtil_1.DefaultTxMisc; }
|
|
125
121
|
return __awaiter(this, void 0, void 0, function () {
|
|
@@ -128,7 +124,7 @@ var FirmaFeeGrantService = /** @class */ (function () {
|
|
|
128
124
|
switch (_a.label) {
|
|
129
125
|
case 0:
|
|
130
126
|
_a.trys.push([0, 3, , 4]);
|
|
131
|
-
return [4 /*yield*/, this.getSignedTxGrantPeriodicAllowance(wallet, granteeAddress, feegrantOption, txMisc)];
|
|
127
|
+
return [4 /*yield*/, this.getSignedTxGrantPeriodicAllowance(wallet, granteeAddress, feegrantOption, txMisc, true)];
|
|
132
128
|
case 1:
|
|
133
129
|
txRaw = _a.sent();
|
|
134
130
|
return [4 /*yield*/, FirmaUtil_1.FirmaUtil.estimateGas(txRaw)];
|
|
@@ -142,8 +138,9 @@ var FirmaFeeGrantService = /** @class */ (function () {
|
|
|
142
138
|
});
|
|
143
139
|
});
|
|
144
140
|
};
|
|
145
|
-
FirmaFeeGrantService.prototype.getSignedTxGrantPeriodicAllowance = function (wallet, granteeAddress, feegrantOption, txMisc) {
|
|
141
|
+
FirmaFeeGrantService.prototype.getSignedTxGrantPeriodicAllowance = function (wallet, granteeAddress, feegrantOption, txMisc, simulate) {
|
|
146
142
|
if (txMisc === void 0) { txMisc = FirmaUtil_1.DefaultTxMisc; }
|
|
143
|
+
if (simulate === void 0) { simulate = false; }
|
|
147
144
|
return __awaiter(this, void 0, void 0, function () {
|
|
148
145
|
var address, feeGrantTxClient, bytes, allowanceAnyData, message, error_5;
|
|
149
146
|
return __generator(this, function (_a) {
|
|
@@ -164,7 +161,7 @@ var FirmaFeeGrantService = /** @class */ (function () {
|
|
|
164
161
|
grantee: granteeAddress,
|
|
165
162
|
allowance: any_1.Any.fromJSON(allowanceAnyData)
|
|
166
163
|
});
|
|
167
|
-
return [4 /*yield*/, feeGrantTxClient.sign([message], (0, FirmaUtil_1.getSignAndBroadcastOption)(this.config.denom, txMisc))];
|
|
164
|
+
return [4 /*yield*/, feeGrantTxClient.sign([message], (0, FirmaUtil_1.getSignAndBroadcastOption)(this.config.denom, txMisc), simulate)];
|
|
168
165
|
case 2: return [2 /*return*/, _a.sent()];
|
|
169
166
|
case 3:
|
|
170
167
|
error_5 = _a.sent();
|
|
@@ -183,7 +180,7 @@ var FirmaFeeGrantService = /** @class */ (function () {
|
|
|
183
180
|
switch (_a.label) {
|
|
184
181
|
case 0:
|
|
185
182
|
_a.trys.push([0, 3, , 4]);
|
|
186
|
-
return [4 /*yield*/, this.getSignedTxGrantBasicAllowance(wallet, granteeAddress, feegrantOption, txMisc)];
|
|
183
|
+
return [4 /*yield*/, this.getSignedTxGrantBasicAllowance(wallet, granteeAddress, feegrantOption, txMisc, true)];
|
|
187
184
|
case 1:
|
|
188
185
|
txRaw = _a.sent();
|
|
189
186
|
return [4 /*yield*/, FirmaUtil_1.FirmaUtil.estimateGas(txRaw)];
|
|
@@ -197,8 +194,9 @@ var FirmaFeeGrantService = /** @class */ (function () {
|
|
|
197
194
|
});
|
|
198
195
|
});
|
|
199
196
|
};
|
|
200
|
-
FirmaFeeGrantService.prototype.getSignedTxGrantBasicAllowance = function (wallet, granteeAddress, feegrantOption, txMisc) {
|
|
197
|
+
FirmaFeeGrantService.prototype.getSignedTxGrantBasicAllowance = function (wallet, granteeAddress, feegrantOption, txMisc, simulate) {
|
|
201
198
|
if (txMisc === void 0) { txMisc = FirmaUtil_1.DefaultTxMisc; }
|
|
199
|
+
if (simulate === void 0) { simulate = false; }
|
|
202
200
|
return __awaiter(this, void 0, void 0, function () {
|
|
203
201
|
var feeGrantTxClient, address, bytes, allowanceAnyData, message, error_7;
|
|
204
202
|
return __generator(this, function (_a) {
|
|
@@ -219,7 +217,7 @@ var FirmaFeeGrantService = /** @class */ (function () {
|
|
|
219
217
|
grantee: granteeAddress,
|
|
220
218
|
allowance: any_1.Any.fromJSON(allowanceAnyData)
|
|
221
219
|
});
|
|
222
|
-
return [4 /*yield*/, feeGrantTxClient.sign([message], (0, FirmaUtil_1.getSignAndBroadcastOption)(this.config.denom, txMisc))];
|
|
220
|
+
return [4 /*yield*/, feeGrantTxClient.sign([message], (0, FirmaUtil_1.getSignAndBroadcastOption)(this.config.denom, txMisc), simulate)];
|
|
223
221
|
case 2: return [2 /*return*/, _a.sent()];
|
|
224
222
|
case 3:
|
|
225
223
|
error_7 = _a.sent();
|
|
@@ -18,6 +18,20 @@ export declare class FirmaGovService {
|
|
|
18
18
|
getGasEstimationSubmitCommunityPoolSpendProposal(wallet: FirmaWalletService, title: string, summary: string, initialDepositFCT: number, amountFCT: number, recipient: string, txMisc?: TxMisc): Promise<number>;
|
|
19
19
|
getGasEstimationSubmitTextProposal(wallet: FirmaWalletService, title: string, description: string, initialDepositFCT: number, txMisc?: TxMisc): Promise<number>;
|
|
20
20
|
getGasEstimationCancelProposal(wallet: FirmaWalletService, proposalId: number, txMisc?: TxMisc): Promise<number>;
|
|
21
|
+
/**
|
|
22
|
+
* Submits a text proposal (signaling proposal with no executable messages).
|
|
23
|
+
*
|
|
24
|
+
* Cosmos SDK gov v1 MsgSubmitProposal.ValidateBasic() enforces:
|
|
25
|
+
* if len(m.Messages) == 0 && len(m.Metadata) == 0 { return ErrNoProposalMsgs }
|
|
26
|
+
*
|
|
27
|
+
* Text proposals have messages: [], so metadata MUST be non-empty or the tx
|
|
28
|
+
* fails with "either metadata or Msgs length must be non-nil: no messages
|
|
29
|
+
* proposed" (x/gov ErrNoProposalMsgs, code 11). This does NOT apply to
|
|
30
|
+
* regular proposals with messages — empty metadata is valid there.
|
|
31
|
+
*
|
|
32
|
+
* @see https://github.com/cosmos/cosmos-sdk/blob/release/v0.46.x/x/gov/types/v1/msgs.go
|
|
33
|
+
* @see https://github.com/cosmos/cosmos-sdk/blob/release/v0.46.x/x/gov/types/errors.go
|
|
34
|
+
*/
|
|
21
35
|
private getSignedTxSubmitTextProposal;
|
|
22
36
|
private getSignedTxSubmitSoftwareUpgradeProposal;
|
|
23
37
|
private getSignedTxSubmitStakingParamsUpdateProposal;
|