@firmachain/firma-js 0.3.8 → 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 +20 -15
- 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 +58 -37
- 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 -394
- 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 -26
- package/dist/test/config_test.sample.d.ts +0 -11
- package/dist/test/config_test.sample.js +0 -14
|
@@ -66,9 +66,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
66
66
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
67
67
|
exports.FirmaGovService = void 0;
|
|
68
68
|
var gov_1 = require("./firmachain/gov");
|
|
69
|
-
var any_1 = require("./firmachain/google/protobuf/any");
|
|
70
69
|
var FirmaUtil_1 = require("./FirmaUtil");
|
|
71
|
-
var gov_2 = require("cosmjs-types/cosmos/gov/v1beta1/gov");
|
|
72
70
|
var tx_1 = require("cosmjs-types/cosmos/staking/v1beta1/tx");
|
|
73
71
|
var fast_deep_equal_1 = __importDefault(require("fast-deep-equal"));
|
|
74
72
|
// temporarly using kintsugi-tech/cosmjs-types - this will be returned to original cosmjs-types after the PR is merged
|
|
@@ -88,7 +86,7 @@ var FirmaGovService = /** @class */ (function () {
|
|
|
88
86
|
case 0:
|
|
89
87
|
_a.trys.push([0, 3, , 4]);
|
|
90
88
|
bigIntId = BigInt(proposalId);
|
|
91
|
-
return [4 /*yield*/, this.getSignedTxVote(wallet, bigIntId, option, txMisc)];
|
|
89
|
+
return [4 /*yield*/, this.getSignedTxVote(wallet, bigIntId, option, txMisc, true)];
|
|
92
90
|
case 1:
|
|
93
91
|
txRaw = _a.sent();
|
|
94
92
|
return [4 /*yield*/, FirmaUtil_1.FirmaUtil.estimateGas(txRaw)];
|
|
@@ -111,7 +109,7 @@ var FirmaGovService = /** @class */ (function () {
|
|
|
111
109
|
case 0:
|
|
112
110
|
_a.trys.push([0, 3, , 4]);
|
|
113
111
|
bigIntId = BigInt(proposalId);
|
|
114
|
-
return [4 /*yield*/, this.getSignedTxDeposit(wallet, bigIntId, amount, txMisc)];
|
|
112
|
+
return [4 /*yield*/, this.getSignedTxDeposit(wallet, bigIntId, amount, txMisc, true)];
|
|
115
113
|
case 1:
|
|
116
114
|
txRaw = _a.sent();
|
|
117
115
|
return [4 /*yield*/, FirmaUtil_1.FirmaUtil.estimateGas(txRaw)];
|
|
@@ -144,7 +142,7 @@ var FirmaGovService = /** @class */ (function () {
|
|
|
144
142
|
typeUrl: "/cosmos.upgrade.v1beta1.MsgSoftwareUpgrade",
|
|
145
143
|
value: tx_3.MsgSoftwareUpgrade.encode(msgObj).finish()
|
|
146
144
|
};
|
|
147
|
-
return [4 /*yield*/, this.getSignedTxSubmitSoftwareUpgradeProposal(wallet, title, summary, initialDepositFCT, [message], metadata, txMisc)];
|
|
145
|
+
return [4 /*yield*/, this.getSignedTxSubmitSoftwareUpgradeProposal(wallet, title, summary, initialDepositFCT, [message], metadata, txMisc, true)];
|
|
148
146
|
case 1:
|
|
149
147
|
txRaw = _a.sent();
|
|
150
148
|
return [4 /*yield*/, FirmaUtil_1.FirmaUtil.estimateGas(txRaw)];
|
|
@@ -185,7 +183,7 @@ var FirmaGovService = /** @class */ (function () {
|
|
|
185
183
|
params: params
|
|
186
184
|
})).finish()
|
|
187
185
|
};
|
|
188
|
-
return [4 /*yield*/, this.getSignedTxSubmitStakingParamsUpdateProposal(wallet, title, summary, initialDepositFCT, [message], metadata, txMisc)];
|
|
186
|
+
return [4 /*yield*/, this.getSignedTxSubmitStakingParamsUpdateProposal(wallet, title, summary, initialDepositFCT, [message], metadata, txMisc, true)];
|
|
189
187
|
case 1:
|
|
190
188
|
txRaw = _a.sent();
|
|
191
189
|
return [4 /*yield*/, FirmaUtil_1.FirmaUtil.estimateGas(txRaw)];
|
|
@@ -226,7 +224,7 @@ var FirmaGovService = /** @class */ (function () {
|
|
|
226
224
|
params: params
|
|
227
225
|
})).finish()
|
|
228
226
|
};
|
|
229
|
-
return [4 /*yield*/, this.getSignedTxSubmitGovParamsUpdateProposal(wallet, title, summary, initialDepositFCT, [message], metadata, txMisc)];
|
|
227
|
+
return [4 /*yield*/, this.getSignedTxSubmitGovParamsUpdateProposal(wallet, title, summary, initialDepositFCT, [message], metadata, txMisc, true)];
|
|
230
228
|
case 1:
|
|
231
229
|
txRaw = _a.sent();
|
|
232
230
|
return [4 /*yield*/, FirmaUtil_1.FirmaUtil.estimateGas(txRaw)];
|
|
@@ -260,7 +258,7 @@ var FirmaGovService = /** @class */ (function () {
|
|
|
260
258
|
}]
|
|
261
259
|
})).finish())
|
|
262
260
|
};
|
|
263
|
-
return [4 /*yield*/, this.getSignedTxSubmitCommunityPoolSpendProposal(wallet, title, summary, initialDepositFCT, [message], recipient, txMisc)];
|
|
261
|
+
return [4 /*yield*/, this.getSignedTxSubmitCommunityPoolSpendProposal(wallet, title, summary, initialDepositFCT, [message], recipient, txMisc, true)];
|
|
264
262
|
case 1:
|
|
265
263
|
txRaw = _a.sent();
|
|
266
264
|
return [4 /*yield*/, FirmaUtil_1.FirmaUtil.estimateGas(txRaw)];
|
|
@@ -282,7 +280,7 @@ var FirmaGovService = /** @class */ (function () {
|
|
|
282
280
|
switch (_a.label) {
|
|
283
281
|
case 0:
|
|
284
282
|
_a.trys.push([0, 3, , 4]);
|
|
285
|
-
return [4 /*yield*/, this.getSignedTxSubmitTextProposal(wallet, title, description, initialDepositFCT, txMisc)];
|
|
283
|
+
return [4 /*yield*/, this.getSignedTxSubmitTextProposal(wallet, title, description, initialDepositFCT, txMisc, true)];
|
|
286
284
|
case 1:
|
|
287
285
|
txRaw = _a.sent();
|
|
288
286
|
return [4 /*yield*/, FirmaUtil_1.FirmaUtil.estimateGas(txRaw)];
|
|
@@ -304,7 +302,7 @@ var FirmaGovService = /** @class */ (function () {
|
|
|
304
302
|
switch (_a.label) {
|
|
305
303
|
case 0:
|
|
306
304
|
_a.trys.push([0, 3, , 4]);
|
|
307
|
-
return [4 /*yield*/, this.getSignedTxCancelProposal(wallet, proposalId, txMisc)];
|
|
305
|
+
return [4 /*yield*/, this.getSignedTxCancelProposal(wallet, proposalId, txMisc, true)];
|
|
308
306
|
case 1:
|
|
309
307
|
txRaw = _a.sent();
|
|
310
308
|
return [4 /*yield*/, FirmaUtil_1.FirmaUtil.estimateGas(txRaw)];
|
|
@@ -318,29 +316,45 @@ var FirmaGovService = /** @class */ (function () {
|
|
|
318
316
|
});
|
|
319
317
|
});
|
|
320
318
|
};
|
|
321
|
-
|
|
319
|
+
/**
|
|
320
|
+
* Submits a text proposal (signaling proposal with no executable messages).
|
|
321
|
+
*
|
|
322
|
+
* Cosmos SDK gov v1 MsgSubmitProposal.ValidateBasic() enforces:
|
|
323
|
+
* if len(m.Messages) == 0 && len(m.Metadata) == 0 { return ErrNoProposalMsgs }
|
|
324
|
+
*
|
|
325
|
+
* Text proposals have messages: [], so metadata MUST be non-empty or the tx
|
|
326
|
+
* fails with "either metadata or Msgs length must be non-nil: no messages
|
|
327
|
+
* proposed" (x/gov ErrNoProposalMsgs, code 11). This does NOT apply to
|
|
328
|
+
* regular proposals with messages — empty metadata is valid there.
|
|
329
|
+
*
|
|
330
|
+
* @see https://github.com/cosmos/cosmos-sdk/blob/release/v0.46.x/x/gov/types/v1/msgs.go
|
|
331
|
+
* @see https://github.com/cosmos/cosmos-sdk/blob/release/v0.46.x/x/gov/types/errors.go
|
|
332
|
+
*/
|
|
333
|
+
FirmaGovService.prototype.getSignedTxSubmitTextProposal = function (wallet, title, description, initialDepositFCT, txMisc, simulate, metadata) {
|
|
322
334
|
if (txMisc === void 0) { txMisc = FirmaUtil_1.DefaultTxMisc; }
|
|
335
|
+
if (simulate === void 0) { simulate = false; }
|
|
336
|
+
if (metadata === void 0) { metadata = "ipfs://CID"; }
|
|
323
337
|
return __awaiter(this, void 0, void 0, function () {
|
|
324
|
-
var
|
|
338
|
+
var proposer, initialDeposit, txClient, message, error_9;
|
|
325
339
|
return __generator(this, function (_a) {
|
|
326
340
|
switch (_a.label) {
|
|
327
341
|
case 0:
|
|
328
342
|
_a.trys.push([0, 3, , 4]);
|
|
329
|
-
sendAmount = { denom: this.config.denom, amount: FirmaUtil_1.FirmaUtil.getUFCTStringFromFCT(initialDepositFCT) };
|
|
330
|
-
proposal = gov_2.TextProposal.fromPartial({
|
|
331
|
-
title: title,
|
|
332
|
-
description: description,
|
|
333
|
-
});
|
|
334
|
-
content = any_1.Any.fromPartial({
|
|
335
|
-
typeUrl: "/cosmos.gov.v1beta1.TextProposal",
|
|
336
|
-
value: Uint8Array.from(gov_2.TextProposal.encode(proposal).finish()),
|
|
337
|
-
});
|
|
338
343
|
return [4 /*yield*/, wallet.getAddress()];
|
|
339
344
|
case 1:
|
|
340
345
|
proposer = _a.sent();
|
|
341
|
-
|
|
346
|
+
initialDeposit = [{ denom: this.config.denom, amount: FirmaUtil_1.FirmaUtil.getUFCTStringFromFCT(initialDepositFCT) }];
|
|
342
347
|
txClient = new gov_1.GovTxClient(wallet, this.config.rpcAddress);
|
|
343
|
-
|
|
348
|
+
message = gov_1.GovTxClient.v1MsgSubmitProposal({
|
|
349
|
+
title: title,
|
|
350
|
+
summary: description,
|
|
351
|
+
metadata: metadata,
|
|
352
|
+
messages: [],
|
|
353
|
+
proposer: proposer,
|
|
354
|
+
initialDeposit: initialDeposit,
|
|
355
|
+
expedited: false
|
|
356
|
+
});
|
|
357
|
+
return [4 /*yield*/, txClient.sign([message], (0, FirmaUtil_1.getSignAndBroadcastOption)(this.config.denom, txMisc), simulate)];
|
|
344
358
|
case 2: return [2 /*return*/, _a.sent()];
|
|
345
359
|
case 3:
|
|
346
360
|
error_9 = _a.sent();
|
|
@@ -351,9 +365,10 @@ var FirmaGovService = /** @class */ (function () {
|
|
|
351
365
|
});
|
|
352
366
|
});
|
|
353
367
|
};
|
|
354
|
-
FirmaGovService.prototype.getSignedTxSubmitSoftwareUpgradeProposal = function (wallet, title, summary, initialDepositFCT, messages, metadata, txMisc) {
|
|
368
|
+
FirmaGovService.prototype.getSignedTxSubmitSoftwareUpgradeProposal = function (wallet, title, summary, initialDepositFCT, messages, metadata, txMisc, simulate) {
|
|
355
369
|
if (metadata === void 0) { metadata = ""; }
|
|
356
370
|
if (txMisc === void 0) { txMisc = FirmaUtil_1.DefaultTxMisc; }
|
|
371
|
+
if (simulate === void 0) { simulate = false; }
|
|
357
372
|
return __awaiter(this, void 0, void 0, function () {
|
|
358
373
|
var proposer, initialDeposit, txClient, message, error_10;
|
|
359
374
|
return __generator(this, function (_a) {
|
|
@@ -374,7 +389,7 @@ var FirmaGovService = /** @class */ (function () {
|
|
|
374
389
|
initialDeposit: initialDeposit,
|
|
375
390
|
expedited: false
|
|
376
391
|
});
|
|
377
|
-
return [4 /*yield*/, txClient.sign([message], (0, FirmaUtil_1.getSignAndBroadcastOption)(this.config.denom, txMisc))];
|
|
392
|
+
return [4 /*yield*/, txClient.sign([message], (0, FirmaUtil_1.getSignAndBroadcastOption)(this.config.denom, txMisc), simulate)];
|
|
378
393
|
case 2: return [2 /*return*/, _a.sent()];
|
|
379
394
|
case 3:
|
|
380
395
|
error_10 = _a.sent();
|
|
@@ -385,9 +400,10 @@ var FirmaGovService = /** @class */ (function () {
|
|
|
385
400
|
});
|
|
386
401
|
});
|
|
387
402
|
};
|
|
388
|
-
FirmaGovService.prototype.getSignedTxSubmitStakingParamsUpdateProposal = function (wallet, title, summary, initialDepositFCT, messages, metadata, txMisc) {
|
|
403
|
+
FirmaGovService.prototype.getSignedTxSubmitStakingParamsUpdateProposal = function (wallet, title, summary, initialDepositFCT, messages, metadata, txMisc, simulate) {
|
|
389
404
|
if (metadata === void 0) { metadata = ""; }
|
|
390
405
|
if (txMisc === void 0) { txMisc = FirmaUtil_1.DefaultTxMisc; }
|
|
406
|
+
if (simulate === void 0) { simulate = false; }
|
|
391
407
|
return __awaiter(this, void 0, void 0, function () {
|
|
392
408
|
var proposer, initialDeposit, txClient, message, error_11;
|
|
393
409
|
return __generator(this, function (_a) {
|
|
@@ -408,7 +424,7 @@ var FirmaGovService = /** @class */ (function () {
|
|
|
408
424
|
initialDeposit: initialDeposit,
|
|
409
425
|
expedited: false
|
|
410
426
|
});
|
|
411
|
-
return [4 /*yield*/, txClient.sign([message], (0, FirmaUtil_1.getSignAndBroadcastOption)(this.config.denom, txMisc))];
|
|
427
|
+
return [4 /*yield*/, txClient.sign([message], (0, FirmaUtil_1.getSignAndBroadcastOption)(this.config.denom, txMisc), simulate)];
|
|
412
428
|
case 2: return [2 /*return*/, _a.sent()];
|
|
413
429
|
case 3:
|
|
414
430
|
error_11 = _a.sent();
|
|
@@ -419,9 +435,10 @@ var FirmaGovService = /** @class */ (function () {
|
|
|
419
435
|
});
|
|
420
436
|
});
|
|
421
437
|
};
|
|
422
|
-
FirmaGovService.prototype.getSignedTxSubmitGovParamsUpdateProposal = function (wallet, title, summary, initialDepositFCT, messages, metadata, txMisc) {
|
|
438
|
+
FirmaGovService.prototype.getSignedTxSubmitGovParamsUpdateProposal = function (wallet, title, summary, initialDepositFCT, messages, metadata, txMisc, simulate) {
|
|
423
439
|
if (metadata === void 0) { metadata = ""; }
|
|
424
440
|
if (txMisc === void 0) { txMisc = FirmaUtil_1.DefaultTxMisc; }
|
|
441
|
+
if (simulate === void 0) { simulate = false; }
|
|
425
442
|
return __awaiter(this, void 0, void 0, function () {
|
|
426
443
|
var proposer, initialDeposit, txClient, message, error_12;
|
|
427
444
|
return __generator(this, function (_a) {
|
|
@@ -442,7 +459,7 @@ var FirmaGovService = /** @class */ (function () {
|
|
|
442
459
|
initialDeposit: initialDeposit,
|
|
443
460
|
expedited: false
|
|
444
461
|
});
|
|
445
|
-
return [4 /*yield*/, txClient.sign([message], (0, FirmaUtil_1.getSignAndBroadcastOption)(this.config.denom, txMisc))];
|
|
462
|
+
return [4 /*yield*/, txClient.sign([message], (0, FirmaUtil_1.getSignAndBroadcastOption)(this.config.denom, txMisc), simulate)];
|
|
446
463
|
case 2: return [2 /*return*/, _a.sent()];
|
|
447
464
|
case 3:
|
|
448
465
|
error_12 = _a.sent();
|
|
@@ -453,9 +470,10 @@ var FirmaGovService = /** @class */ (function () {
|
|
|
453
470
|
});
|
|
454
471
|
});
|
|
455
472
|
};
|
|
456
|
-
FirmaGovService.prototype.getSignedTxSubmitCommunityPoolSpendProposal = function (wallet, title, summary, initialDepositFCT, messages, metadata, txMisc) {
|
|
473
|
+
FirmaGovService.prototype.getSignedTxSubmitCommunityPoolSpendProposal = function (wallet, title, summary, initialDepositFCT, messages, metadata, txMisc, simulate) {
|
|
457
474
|
if (metadata === void 0) { metadata = ""; }
|
|
458
475
|
if (txMisc === void 0) { txMisc = FirmaUtil_1.DefaultTxMisc; }
|
|
476
|
+
if (simulate === void 0) { simulate = false; }
|
|
459
477
|
return __awaiter(this, void 0, void 0, function () {
|
|
460
478
|
var proposer, initialDeposit, txClient, message, error_13;
|
|
461
479
|
return __generator(this, function (_a) {
|
|
@@ -476,7 +494,7 @@ var FirmaGovService = /** @class */ (function () {
|
|
|
476
494
|
initialDeposit: initialDeposit,
|
|
477
495
|
expedited: false
|
|
478
496
|
});
|
|
479
|
-
return [4 /*yield*/, txClient.sign([message], (0, FirmaUtil_1.getSignAndBroadcastOption)(this.config.denom, txMisc))];
|
|
497
|
+
return [4 /*yield*/, txClient.sign([message], (0, FirmaUtil_1.getSignAndBroadcastOption)(this.config.denom, txMisc), simulate)];
|
|
480
498
|
case 2: return [2 /*return*/, _a.sent()];
|
|
481
499
|
case 3:
|
|
482
500
|
error_13 = _a.sent();
|
|
@@ -487,8 +505,9 @@ var FirmaGovService = /** @class */ (function () {
|
|
|
487
505
|
});
|
|
488
506
|
});
|
|
489
507
|
};
|
|
490
|
-
FirmaGovService.prototype.getSignedTxCancelProposal = function (wallet, proposalId, txMisc) {
|
|
508
|
+
FirmaGovService.prototype.getSignedTxCancelProposal = function (wallet, proposalId, txMisc, simulate) {
|
|
491
509
|
if (txMisc === void 0) { txMisc = FirmaUtil_1.DefaultTxMisc; }
|
|
510
|
+
if (simulate === void 0) { simulate = false; }
|
|
492
511
|
return __awaiter(this, void 0, void 0, function () {
|
|
493
512
|
var proposer, txClient, message;
|
|
494
513
|
return __generator(this, function (_a) {
|
|
@@ -498,7 +517,7 @@ var FirmaGovService = /** @class */ (function () {
|
|
|
498
517
|
proposer = _a.sent();
|
|
499
518
|
txClient = new gov_1.GovTxClient(wallet, this.config.rpcAddress);
|
|
500
519
|
message = gov_1.GovTxClient.v1MsgCancelProposal({ proposalId: BigInt(proposalId), proposer: proposer });
|
|
501
|
-
return [4 /*yield*/, txClient.sign([message], (0, FirmaUtil_1.getSignAndBroadcastOption)(this.config.denom, txMisc))];
|
|
520
|
+
return [4 /*yield*/, txClient.sign([message], (0, FirmaUtil_1.getSignAndBroadcastOption)(this.config.denom, txMisc), simulate)];
|
|
502
521
|
case 2: return [2 /*return*/, _a.sent()];
|
|
503
522
|
}
|
|
504
523
|
});
|
|
@@ -741,8 +760,9 @@ var FirmaGovService = /** @class */ (function () {
|
|
|
741
760
|
});
|
|
742
761
|
});
|
|
743
762
|
};
|
|
744
|
-
FirmaGovService.prototype.getSignedTxVote = function (wallet, proposalId, option, txMisc) {
|
|
763
|
+
FirmaGovService.prototype.getSignedTxVote = function (wallet, proposalId, option, txMisc, simulate) {
|
|
745
764
|
if (txMisc === void 0) { txMisc = FirmaUtil_1.DefaultTxMisc; }
|
|
765
|
+
if (simulate === void 0) { simulate = false; }
|
|
746
766
|
return __awaiter(this, void 0, void 0, function () {
|
|
747
767
|
var voter, txClient, message, error_21;
|
|
748
768
|
return __generator(this, function (_a) {
|
|
@@ -754,7 +774,7 @@ var FirmaGovService = /** @class */ (function () {
|
|
|
754
774
|
voter = _a.sent();
|
|
755
775
|
txClient = new gov_1.GovTxClient(wallet, this.config.rpcAddress);
|
|
756
776
|
message = gov_1.GovTxClient.v1MsgVote({ proposalId: proposalId, voter: voter, option: option, metadata: "" });
|
|
757
|
-
return [4 /*yield*/, txClient.sign([message], (0, FirmaUtil_1.getSignAndBroadcastOption)(this.config.denom, txMisc))];
|
|
777
|
+
return [4 /*yield*/, txClient.sign([message], (0, FirmaUtil_1.getSignAndBroadcastOption)(this.config.denom, txMisc), simulate)];
|
|
758
778
|
case 2: return [2 /*return*/, _a.sent()];
|
|
759
779
|
case 3:
|
|
760
780
|
error_21 = _a.sent();
|
|
@@ -789,8 +809,9 @@ var FirmaGovService = /** @class */ (function () {
|
|
|
789
809
|
});
|
|
790
810
|
});
|
|
791
811
|
};
|
|
792
|
-
FirmaGovService.prototype.getSignedTxDeposit = function (wallet, proposalId, amount, txMisc) {
|
|
812
|
+
FirmaGovService.prototype.getSignedTxDeposit = function (wallet, proposalId, amount, txMisc, simulate) {
|
|
793
813
|
if (txMisc === void 0) { txMisc = FirmaUtil_1.DefaultTxMisc; }
|
|
814
|
+
if (simulate === void 0) { simulate = false; }
|
|
794
815
|
return __awaiter(this, void 0, void 0, function () {
|
|
795
816
|
var depositor, sendAmount, message, txClient, error_23;
|
|
796
817
|
return __generator(this, function (_a) {
|
|
@@ -803,7 +824,7 @@ var FirmaGovService = /** @class */ (function () {
|
|
|
803
824
|
sendAmount = { denom: this.config.denom, amount: FirmaUtil_1.FirmaUtil.getUFCTStringFromFCT(amount) };
|
|
804
825
|
message = gov_1.GovTxClient.v1MsgDeposit({ proposalId: proposalId, depositor: depositor, amount: [sendAmount] });
|
|
805
826
|
txClient = new gov_1.GovTxClient(wallet, this.config.rpcAddress);
|
|
806
|
-
return [4 /*yield*/, txClient.sign([message], (0, FirmaUtil_1.getSignAndBroadcastOption)(this.config.denom, txMisc))];
|
|
827
|
+
return [4 /*yield*/, txClient.sign([message], (0, FirmaUtil_1.getSignAndBroadcastOption)(this.config.denom, txMisc), simulate)];
|
|
807
828
|
case 2: return [2 /*return*/, _a.sent()];
|
|
808
829
|
case 3:
|
|
809
830
|
error_23 = _a.sent();
|
|
@@ -55,7 +55,7 @@ var FirmaIbcService = /** @class */ (function () {
|
|
|
55
55
|
switch (_a.label) {
|
|
56
56
|
case 0:
|
|
57
57
|
_a.trys.push([0, 3, , 4]);
|
|
58
|
-
return [4 /*yield*/, this.getSignedTxTransfer(wallet, sourcePort, sourceChannel, denom, amount, receiver, timeoutHeight, timeoutTimestamp, memo, txMisc)];
|
|
58
|
+
return [4 /*yield*/, this.getSignedTxTransfer(wallet, sourcePort, sourceChannel, denom, amount, receiver, timeoutHeight, timeoutTimestamp, memo, txMisc, true)];
|
|
59
59
|
case 1:
|
|
60
60
|
txRaw = _a.sent();
|
|
61
61
|
return [4 /*yield*/, FirmaUtil_1.FirmaUtil.estimateGas(txRaw)];
|
|
@@ -93,9 +93,10 @@ var FirmaIbcService = /** @class */ (function () {
|
|
|
93
93
|
});
|
|
94
94
|
});
|
|
95
95
|
};
|
|
96
|
-
FirmaIbcService.prototype.getSignedTxTransfer = function (wallet, sourcePort, sourceChannel, denom, amount, receiver, timeoutHeight, timeoutTimestamp, memo, txMisc) {
|
|
96
|
+
FirmaIbcService.prototype.getSignedTxTransfer = function (wallet, sourcePort, sourceChannel, denom, amount, receiver, timeoutHeight, timeoutTimestamp, memo, txMisc, simulate) {
|
|
97
97
|
if (memo === void 0) { memo = ""; }
|
|
98
98
|
if (txMisc === void 0) { txMisc = FirmaUtil_1.DefaultTxMisc; }
|
|
99
|
+
if (simulate === void 0) { simulate = false; }
|
|
99
100
|
return __awaiter(this, void 0, void 0, function () {
|
|
100
101
|
var address, message, ibcTxClient, error_3;
|
|
101
102
|
return __generator(this, function (_a) {
|
|
@@ -112,7 +113,7 @@ var FirmaIbcService = /** @class */ (function () {
|
|
|
112
113
|
memo: memo
|
|
113
114
|
});
|
|
114
115
|
ibcTxClient = new ibc_1.IbcTxClient(wallet, this.config.rpcAddress);
|
|
115
|
-
return [4 /*yield*/, ibcTxClient.sign([message], (0, FirmaUtil_1.getSignAndBroadcastOption)(this.config.denom, txMisc))];
|
|
116
|
+
return [4 /*yield*/, ibcTxClient.sign([message], (0, FirmaUtil_1.getSignAndBroadcastOption)(this.config.denom, txMisc), simulate)];
|
|
116
117
|
case 2: return [2 /*return*/, _a.sent()];
|
|
117
118
|
case 3:
|
|
118
119
|
error_3 = _a.sent();
|
|
@@ -23,15 +23,15 @@ export declare class NftService {
|
|
|
23
23
|
getBalanceOf(ownerAddress: string): Promise<number>;
|
|
24
24
|
getGasEstimationTransfer(wallet: FirmaWalletService, toAddress: string, nftID: string, txMisc?: TxMisc): Promise<number>;
|
|
25
25
|
getUnsignedTxTransfer(wallet: FirmaWalletService, toAddress: string, nftID: string): Promise<EncodeObject>;
|
|
26
|
-
getSignedTxTransfer(wallet: FirmaWalletService, toAddress: string, nftID: string, txMisc?: TxMisc): Promise<TxRaw>;
|
|
26
|
+
getSignedTxTransfer(wallet: FirmaWalletService, toAddress: string, nftID: string, txMisc?: TxMisc, simulate?: boolean): Promise<TxRaw>;
|
|
27
27
|
transfer(wallet: FirmaWalletService, toAddress: string, nftID: string, txMisc?: TxMisc): Promise<DeliverTxResponse>;
|
|
28
28
|
getGasEstimationBurn(wallet: FirmaWalletService, nftID: string, txMisc?: TxMisc): Promise<number>;
|
|
29
29
|
getUnsignedTxBurn(wallet: FirmaWalletService, nftID: string): Promise<EncodeObject>;
|
|
30
|
-
getSignedTxBurn(wallet: FirmaWalletService, nftID: string, txMisc?: TxMisc): Promise<TxRaw>;
|
|
30
|
+
getSignedTxBurn(wallet: FirmaWalletService, nftID: string, txMisc?: TxMisc, simulate?: boolean): Promise<TxRaw>;
|
|
31
31
|
burn(wallet: FirmaWalletService, nftID: string, txMisc?: TxMisc): Promise<DeliverTxResponse>;
|
|
32
32
|
getGasEstimationFromEncodeObject(wallet: FirmaWalletService, msgList: EncodeObject[], txMisc?: TxMisc): Promise<number>;
|
|
33
33
|
getGasEstimationMint(wallet: FirmaWalletService, tokenURI: string, txMisc?: TxMisc): Promise<number>;
|
|
34
|
-
getSignedTxMint(wallet: FirmaWalletService, tokenURI: string, txMisc?: TxMisc): Promise<TxRaw>;
|
|
34
|
+
getSignedTxMint(wallet: FirmaWalletService, tokenURI: string, txMisc?: TxMisc, simulate?: boolean): Promise<TxRaw>;
|
|
35
35
|
getUnsignedTxMint(wallet: FirmaWalletService, tokenURI: string): Promise<EncodeObject>;
|
|
36
36
|
mint(wallet: FirmaWalletService, tokenURI: string, txMisc?: TxMisc): Promise<DeliverTxResponse>;
|
|
37
37
|
signAndBroadcast(wallet: FirmaWalletService, msgList: EncodeObject[], txMisc?: TxMisc): Promise<DeliverTxResponse>;
|
|
@@ -168,7 +168,7 @@ var NftService = /** @class */ (function () {
|
|
|
168
168
|
switch (_a.label) {
|
|
169
169
|
case 0:
|
|
170
170
|
_a.trys.push([0, 3, , 4]);
|
|
171
|
-
return [4 /*yield*/, this.getSignedTxTransfer(wallet, toAddress, nftID, txMisc)];
|
|
171
|
+
return [4 /*yield*/, this.getSignedTxTransfer(wallet, toAddress, nftID, txMisc, true)];
|
|
172
172
|
case 1:
|
|
173
173
|
txRaw = _a.sent();
|
|
174
174
|
return [4 /*yield*/, FirmaUtil_1.FirmaUtil.estimateGas(txRaw)];
|
|
@@ -203,8 +203,9 @@ var NftService = /** @class */ (function () {
|
|
|
203
203
|
});
|
|
204
204
|
});
|
|
205
205
|
};
|
|
206
|
-
NftService.prototype.getSignedTxTransfer = function (wallet, toAddress, nftID, txMisc) {
|
|
206
|
+
NftService.prototype.getSignedTxTransfer = function (wallet, toAddress, nftID, txMisc, simulate) {
|
|
207
207
|
if (txMisc === void 0) { txMisc = FirmaUtil_1.DefaultTxMisc; }
|
|
208
|
+
if (simulate === void 0) { simulate = false; }
|
|
208
209
|
return __awaiter(this, void 0, void 0, function () {
|
|
209
210
|
var message, nftTxClient, error_8;
|
|
210
211
|
return __generator(this, function (_a) {
|
|
@@ -215,7 +216,7 @@ var NftService = /** @class */ (function () {
|
|
|
215
216
|
case 1:
|
|
216
217
|
message = _a.sent();
|
|
217
218
|
nftTxClient = new nft_1.NftTxClient(wallet, this.config.rpcAddress);
|
|
218
|
-
return [4 /*yield*/, nftTxClient.sign([message], (0, FirmaUtil_1.getSignAndBroadcastOption)(this.config.denom, txMisc))];
|
|
219
|
+
return [4 /*yield*/, nftTxClient.sign([message], (0, FirmaUtil_1.getSignAndBroadcastOption)(this.config.denom, txMisc), simulate)];
|
|
219
220
|
case 2: return [2 /*return*/, _a.sent()];
|
|
220
221
|
case 3:
|
|
221
222
|
error_8 = _a.sent();
|
|
@@ -257,7 +258,7 @@ var NftService = /** @class */ (function () {
|
|
|
257
258
|
switch (_a.label) {
|
|
258
259
|
case 0:
|
|
259
260
|
_a.trys.push([0, 3, , 4]);
|
|
260
|
-
return [4 /*yield*/, this.getSignedTxBurn(wallet, nftID, txMisc)];
|
|
261
|
+
return [4 /*yield*/, this.getSignedTxBurn(wallet, nftID, txMisc, true)];
|
|
261
262
|
case 1:
|
|
262
263
|
txRaw = _a.sent();
|
|
263
264
|
return [4 /*yield*/, FirmaUtil_1.FirmaUtil.estimateGas(txRaw)];
|
|
@@ -292,8 +293,9 @@ var NftService = /** @class */ (function () {
|
|
|
292
293
|
});
|
|
293
294
|
});
|
|
294
295
|
};
|
|
295
|
-
NftService.prototype.getSignedTxBurn = function (wallet, nftID, txMisc) {
|
|
296
|
+
NftService.prototype.getSignedTxBurn = function (wallet, nftID, txMisc, simulate) {
|
|
296
297
|
if (txMisc === void 0) { txMisc = FirmaUtil_1.DefaultTxMisc; }
|
|
298
|
+
if (simulate === void 0) { simulate = false; }
|
|
297
299
|
return __awaiter(this, void 0, void 0, function () {
|
|
298
300
|
var message, nftTxClient, error_12;
|
|
299
301
|
return __generator(this, function (_a) {
|
|
@@ -304,7 +306,7 @@ var NftService = /** @class */ (function () {
|
|
|
304
306
|
case 1:
|
|
305
307
|
message = _a.sent();
|
|
306
308
|
nftTxClient = new nft_1.NftTxClient(wallet, this.config.rpcAddress);
|
|
307
|
-
return [4 /*yield*/, nftTxClient.sign([message], (0, FirmaUtil_1.getSignAndBroadcastOption)(this.config.denom, txMisc))];
|
|
309
|
+
return [4 /*yield*/, nftTxClient.sign([message], (0, FirmaUtil_1.getSignAndBroadcastOption)(this.config.denom, txMisc), simulate)];
|
|
308
310
|
case 2: return [2 /*return*/, _a.sent()];
|
|
309
311
|
case 3:
|
|
310
312
|
error_12 = _a.sent();
|
|
@@ -347,7 +349,7 @@ var NftService = /** @class */ (function () {
|
|
|
347
349
|
case 0:
|
|
348
350
|
_a.trys.push([0, 3, , 4]);
|
|
349
351
|
nftTxClient = new nft_1.NftTxClient(wallet, this.config.rpcAddress);
|
|
350
|
-
return [4 /*yield*/, nftTxClient.sign(msgList, (0, FirmaUtil_1.getSignAndBroadcastOption)(this.config.denom, txMisc))];
|
|
352
|
+
return [4 /*yield*/, nftTxClient.sign(msgList, (0, FirmaUtil_1.getSignAndBroadcastOption)(this.config.denom, txMisc), true)];
|
|
351
353
|
case 1:
|
|
352
354
|
txRaw = _a.sent();
|
|
353
355
|
return [4 /*yield*/, FirmaUtil_1.FirmaUtil.estimateGas(txRaw)];
|
|
@@ -369,7 +371,7 @@ var NftService = /** @class */ (function () {
|
|
|
369
371
|
switch (_a.label) {
|
|
370
372
|
case 0:
|
|
371
373
|
_a.trys.push([0, 3, , 4]);
|
|
372
|
-
return [4 /*yield*/, this.getSignedTxMint(wallet, tokenURI, txMisc)];
|
|
374
|
+
return [4 /*yield*/, this.getSignedTxMint(wallet, tokenURI, txMisc, true)];
|
|
373
375
|
case 1:
|
|
374
376
|
txRaw = _a.sent();
|
|
375
377
|
return [4 /*yield*/, FirmaUtil_1.FirmaUtil.estimateGas(txRaw)];
|
|
@@ -383,8 +385,9 @@ var NftService = /** @class */ (function () {
|
|
|
383
385
|
});
|
|
384
386
|
});
|
|
385
387
|
};
|
|
386
|
-
NftService.prototype.getSignedTxMint = function (wallet, tokenURI, txMisc) {
|
|
388
|
+
NftService.prototype.getSignedTxMint = function (wallet, tokenURI, txMisc, simulate) {
|
|
387
389
|
if (txMisc === void 0) { txMisc = FirmaUtil_1.DefaultTxMisc; }
|
|
390
|
+
if (simulate === void 0) { simulate = false; }
|
|
388
391
|
return __awaiter(this, void 0, void 0, function () {
|
|
389
392
|
var message, nftTxClient, error_16;
|
|
390
393
|
return __generator(this, function (_a) {
|
|
@@ -395,7 +398,7 @@ var NftService = /** @class */ (function () {
|
|
|
395
398
|
case 1:
|
|
396
399
|
message = _a.sent();
|
|
397
400
|
nftTxClient = new nft_1.NftTxClient(wallet, this.config.rpcAddress);
|
|
398
|
-
return [4 /*yield*/, nftTxClient.sign([message], (0, FirmaUtil_1.getSignAndBroadcastOption)(this.config.denom, txMisc))];
|
|
401
|
+
return [4 /*yield*/, nftTxClient.sign([message], (0, FirmaUtil_1.getSignAndBroadcastOption)(this.config.denom, txMisc), simulate)];
|
|
399
402
|
case 2: return [2 /*return*/, _a.sent()];
|
|
400
403
|
case 3:
|
|
401
404
|
error_16 = _a.sent();
|
|
@@ -61,7 +61,7 @@ var FirmaStakingService = /** @class */ (function () {
|
|
|
61
61
|
switch (_a.label) {
|
|
62
62
|
case 0:
|
|
63
63
|
_a.trys.push([0, 3, , 4]);
|
|
64
|
-
return [4 /*yield*/, this.getSignedTxDelegate(wallet, validatorAddres, amount, txMisc)];
|
|
64
|
+
return [4 /*yield*/, this.getSignedTxDelegate(wallet, validatorAddres, amount, txMisc, true)];
|
|
65
65
|
case 1:
|
|
66
66
|
txRaw = _a.sent();
|
|
67
67
|
return [4 /*yield*/, FirmaUtil_1.FirmaUtil.estimateGas(txRaw)];
|
|
@@ -83,7 +83,7 @@ var FirmaStakingService = /** @class */ (function () {
|
|
|
83
83
|
switch (_a.label) {
|
|
84
84
|
case 0:
|
|
85
85
|
_a.trys.push([0, 3, , 4]);
|
|
86
|
-
return [4 /*yield*/, this.getSignedTxUndelegate(wallet, validatorAddres, amount, txMisc)];
|
|
86
|
+
return [4 /*yield*/, this.getSignedTxUndelegate(wallet, validatorAddres, amount, txMisc, true)];
|
|
87
87
|
case 1:
|
|
88
88
|
txRaw = _a.sent();
|
|
89
89
|
return [4 /*yield*/, FirmaUtil_1.FirmaUtil.estimateGas(txRaw)];
|
|
@@ -105,7 +105,7 @@ var FirmaStakingService = /** @class */ (function () {
|
|
|
105
105
|
switch (_a.label) {
|
|
106
106
|
case 0:
|
|
107
107
|
_a.trys.push([0, 3, , 4]);
|
|
108
|
-
return [4 /*yield*/, this.getSignedTxRedelegate(wallet, validatorSrcAddress, validatorDstAddress, amount, txMisc)];
|
|
108
|
+
return [4 /*yield*/, this.getSignedTxRedelegate(wallet, validatorSrcAddress, validatorDstAddress, amount, txMisc, true)];
|
|
109
109
|
case 1:
|
|
110
110
|
txRaw = _a.sent();
|
|
111
111
|
return [4 /*yield*/, FirmaUtil_1.FirmaUtil.estimateGas(txRaw)];
|
|
@@ -119,8 +119,9 @@ var FirmaStakingService = /** @class */ (function () {
|
|
|
119
119
|
});
|
|
120
120
|
});
|
|
121
121
|
};
|
|
122
|
-
FirmaStakingService.prototype.getSignedTxDelegate = function (wallet, validatorAddres, amount, txMisc) {
|
|
122
|
+
FirmaStakingService.prototype.getSignedTxDelegate = function (wallet, validatorAddres, amount, txMisc, simulate) {
|
|
123
123
|
if (txMisc === void 0) { txMisc = FirmaUtil_1.DefaultTxMisc; }
|
|
124
|
+
if (simulate === void 0) { simulate = false; }
|
|
124
125
|
return __awaiter(this, void 0, void 0, function () {
|
|
125
126
|
var txClient, address, sendAmount, message, error_4;
|
|
126
127
|
return __generator(this, function (_a) {
|
|
@@ -137,7 +138,7 @@ var FirmaStakingService = /** @class */ (function () {
|
|
|
137
138
|
validatorAddress: validatorAddres,
|
|
138
139
|
amount: sendAmount
|
|
139
140
|
});
|
|
140
|
-
return [4 /*yield*/, txClient.sign([message], (0, FirmaUtil_1.getSignAndBroadcastOption)(this.config.denom, txMisc))];
|
|
141
|
+
return [4 /*yield*/, txClient.sign([message], (0, FirmaUtil_1.getSignAndBroadcastOption)(this.config.denom, txMisc), simulate)];
|
|
141
142
|
case 2: return [2 /*return*/, _a.sent()];
|
|
142
143
|
case 3:
|
|
143
144
|
error_4 = _a.sent();
|
|
@@ -148,8 +149,9 @@ var FirmaStakingService = /** @class */ (function () {
|
|
|
148
149
|
});
|
|
149
150
|
});
|
|
150
151
|
};
|
|
151
|
-
FirmaStakingService.prototype.getSignedTxUndelegate = function (wallet, validatorAddres, amount, txMisc) {
|
|
152
|
+
FirmaStakingService.prototype.getSignedTxUndelegate = function (wallet, validatorAddres, amount, txMisc, simulate) {
|
|
152
153
|
if (txMisc === void 0) { txMisc = FirmaUtil_1.DefaultTxMisc; }
|
|
154
|
+
if (simulate === void 0) { simulate = false; }
|
|
153
155
|
return __awaiter(this, void 0, void 0, function () {
|
|
154
156
|
var txClient, address, sendAmount, message, error_5;
|
|
155
157
|
return __generator(this, function (_a) {
|
|
@@ -166,7 +168,7 @@ var FirmaStakingService = /** @class */ (function () {
|
|
|
166
168
|
validatorAddress: validatorAddres,
|
|
167
169
|
amount: sendAmount
|
|
168
170
|
});
|
|
169
|
-
return [4 /*yield*/, txClient.sign([message], (0, FirmaUtil_1.getSignAndBroadcastOption)(this.config.denom, txMisc))];
|
|
171
|
+
return [4 /*yield*/, txClient.sign([message], (0, FirmaUtil_1.getSignAndBroadcastOption)(this.config.denom, txMisc), simulate)];
|
|
170
172
|
case 2: return [2 /*return*/, _a.sent()];
|
|
171
173
|
case 3:
|
|
172
174
|
error_5 = _a.sent();
|
|
@@ -177,8 +179,9 @@ var FirmaStakingService = /** @class */ (function () {
|
|
|
177
179
|
});
|
|
178
180
|
});
|
|
179
181
|
};
|
|
180
|
-
FirmaStakingService.prototype.getSignedTxRedelegate = function (wallet, validatorSrcAddress, validatorDstAddress, amount, txMisc) {
|
|
182
|
+
FirmaStakingService.prototype.getSignedTxRedelegate = function (wallet, validatorSrcAddress, validatorDstAddress, amount, txMisc, simulate) {
|
|
181
183
|
if (txMisc === void 0) { txMisc = FirmaUtil_1.DefaultTxMisc; }
|
|
184
|
+
if (simulate === void 0) { simulate = false; }
|
|
182
185
|
return __awaiter(this, void 0, void 0, function () {
|
|
183
186
|
var txClient, address, sendAmount, message, error_6;
|
|
184
187
|
return __generator(this, function (_a) {
|
|
@@ -196,7 +199,7 @@ var FirmaStakingService = /** @class */ (function () {
|
|
|
196
199
|
validatorDstAddress: validatorDstAddress,
|
|
197
200
|
amount: sendAmount
|
|
198
201
|
});
|
|
199
|
-
return [4 /*yield*/, txClient.sign([message], (0, FirmaUtil_1.getSignAndBroadcastOption)(this.config.denom, txMisc))];
|
|
202
|
+
return [4 /*yield*/, txClient.sign([message], (0, FirmaUtil_1.getSignAndBroadcastOption)(this.config.denom, txMisc), simulate)];
|
|
200
203
|
case 2: return [2 /*return*/, _a.sent()];
|
|
201
204
|
case 3:
|
|
202
205
|
error_6 = _a.sent();
|
|
@@ -52,7 +52,7 @@ var TokenService = /** @class */ (function () {
|
|
|
52
52
|
case 0:
|
|
53
53
|
_a.trys.push([0, 3, , 4]);
|
|
54
54
|
newTotalSupply = FirmaUtil_1.FirmaUtil.getUTokenFromToken(totalSupply, decimal);
|
|
55
|
-
return [4 /*yield*/, this.getSignedTxCreateToken(wallet, tokenName, tokenSymbol, tokenURI, newTotalSupply, decimal, isMintable, isBurnable, txMisc)];
|
|
55
|
+
return [4 /*yield*/, this.getSignedTxCreateToken(wallet, tokenName, tokenSymbol, tokenURI, newTotalSupply, decimal, isMintable, isBurnable, txMisc, true)];
|
|
56
56
|
case 1:
|
|
57
57
|
txRaw = _a.sent();
|
|
58
58
|
return [4 /*yield*/, FirmaUtil_1.FirmaUtil.estimateGas(txRaw)];
|
|
@@ -69,13 +69,12 @@ var TokenService = /** @class */ (function () {
|
|
|
69
69
|
TokenService.prototype.getGasEstimationMint = function (wallet, tokenID, amount, decimal, toAddress, txMisc) {
|
|
70
70
|
if (txMisc === void 0) { txMisc = FirmaUtil_1.DefaultTxMisc; }
|
|
71
71
|
return __awaiter(this, void 0, void 0, function () {
|
|
72
|
-
var
|
|
72
|
+
var txRaw, error_2;
|
|
73
73
|
return __generator(this, function (_a) {
|
|
74
74
|
switch (_a.label) {
|
|
75
75
|
case 0:
|
|
76
76
|
_a.trys.push([0, 3, , 4]);
|
|
77
|
-
|
|
78
|
-
return [4 /*yield*/, this.getSignedTxMint(wallet, tokenID, amount, toAddress, txMisc)];
|
|
77
|
+
return [4 /*yield*/, this.getSignedTxMint(wallet, tokenID, amount, toAddress, txMisc, true)];
|
|
79
78
|
case 1:
|
|
80
79
|
txRaw = _a.sent();
|
|
81
80
|
return [4 /*yield*/, FirmaUtil_1.FirmaUtil.estimateGas(txRaw)];
|
|
@@ -98,7 +97,7 @@ var TokenService = /** @class */ (function () {
|
|
|
98
97
|
case 0:
|
|
99
98
|
_a.trys.push([0, 3, , 4]);
|
|
100
99
|
newAmount = FirmaUtil_1.FirmaUtil.getUTokenFromToken(amount, decimal);
|
|
101
|
-
return [4 /*yield*/, this.getSignedTxBurn(wallet, tokenID, newAmount, txMisc)];
|
|
100
|
+
return [4 /*yield*/, this.getSignedTxBurn(wallet, tokenID, newAmount, txMisc, true)];
|
|
102
101
|
case 1:
|
|
103
102
|
txRaw = _a.sent();
|
|
104
103
|
return [4 /*yield*/, FirmaUtil_1.FirmaUtil.estimateGas(txRaw)];
|
|
@@ -120,7 +119,7 @@ var TokenService = /** @class */ (function () {
|
|
|
120
119
|
switch (_a.label) {
|
|
121
120
|
case 0:
|
|
122
121
|
_a.trys.push([0, 3, , 4]);
|
|
123
|
-
return [4 /*yield*/, this.getSignedTxUpdateTokenURI(wallet, tokenID, tokenURI, txMisc)];
|
|
122
|
+
return [4 /*yield*/, this.getSignedTxUpdateTokenURI(wallet, tokenID, tokenURI, txMisc, true)];
|
|
124
123
|
case 1:
|
|
125
124
|
txRaw = _a.sent();
|
|
126
125
|
return [4 /*yield*/, FirmaUtil_1.FirmaUtil.estimateGas(txRaw)];
|
|
@@ -134,8 +133,9 @@ var TokenService = /** @class */ (function () {
|
|
|
134
133
|
});
|
|
135
134
|
});
|
|
136
135
|
};
|
|
137
|
-
TokenService.prototype.getSignedTxUpdateTokenURI = function (wallet, tokenID, tokenURI, txMisc) {
|
|
136
|
+
TokenService.prototype.getSignedTxUpdateTokenURI = function (wallet, tokenID, tokenURI, txMisc, simulate) {
|
|
138
137
|
if (txMisc === void 0) { txMisc = FirmaUtil_1.DefaultTxMisc; }
|
|
138
|
+
if (simulate === void 0) { simulate = false; }
|
|
139
139
|
return __awaiter(this, void 0, void 0, function () {
|
|
140
140
|
var address, message, txClient, error_5;
|
|
141
141
|
return __generator(this, function (_a) {
|
|
@@ -151,7 +151,7 @@ var TokenService = /** @class */ (function () {
|
|
|
151
151
|
tokenURI: tokenURI
|
|
152
152
|
});
|
|
153
153
|
txClient = new token_1.TokenTxClient(wallet, this.config.rpcAddress);
|
|
154
|
-
return [4 /*yield*/, txClient.sign([message], (0, FirmaUtil_1.getSignAndBroadcastOption)(this.config.denom, txMisc))];
|
|
154
|
+
return [4 /*yield*/, txClient.sign([message], (0, FirmaUtil_1.getSignAndBroadcastOption)(this.config.denom, txMisc), simulate)];
|
|
155
155
|
case 2: return [2 /*return*/, _a.sent()];
|
|
156
156
|
case 3:
|
|
157
157
|
error_5 = _a.sent();
|
|
@@ -162,8 +162,9 @@ var TokenService = /** @class */ (function () {
|
|
|
162
162
|
});
|
|
163
163
|
});
|
|
164
164
|
};
|
|
165
|
-
TokenService.prototype.getSignedTxBurn = function (wallet, tokenID, amount, txMisc) {
|
|
165
|
+
TokenService.prototype.getSignedTxBurn = function (wallet, tokenID, amount, txMisc, simulate) {
|
|
166
166
|
if (txMisc === void 0) { txMisc = FirmaUtil_1.DefaultTxMisc; }
|
|
167
|
+
if (simulate === void 0) { simulate = false; }
|
|
167
168
|
return __awaiter(this, void 0, void 0, function () {
|
|
168
169
|
var address, message, txClient, error_6;
|
|
169
170
|
return __generator(this, function (_a) {
|
|
@@ -179,7 +180,7 @@ var TokenService = /** @class */ (function () {
|
|
|
179
180
|
amount: amount
|
|
180
181
|
});
|
|
181
182
|
txClient = new token_1.TokenTxClient(wallet, this.config.rpcAddress);
|
|
182
|
-
return [4 /*yield*/, txClient.sign([message], (0, FirmaUtil_1.getSignAndBroadcastOption)(this.config.denom, txMisc))];
|
|
183
|
+
return [4 /*yield*/, txClient.sign([message], (0, FirmaUtil_1.getSignAndBroadcastOption)(this.config.denom, txMisc), simulate)];
|
|
183
184
|
case 2: return [2 /*return*/, _a.sent()];
|
|
184
185
|
case 3:
|
|
185
186
|
error_6 = _a.sent();
|
|
@@ -190,8 +191,9 @@ var TokenService = /** @class */ (function () {
|
|
|
190
191
|
});
|
|
191
192
|
});
|
|
192
193
|
};
|
|
193
|
-
TokenService.prototype.getSignedTxMint = function (wallet, tokenID, amount, toAddress, txMisc) {
|
|
194
|
+
TokenService.prototype.getSignedTxMint = function (wallet, tokenID, amount, toAddress, txMisc, simulate) {
|
|
194
195
|
if (txMisc === void 0) { txMisc = FirmaUtil_1.DefaultTxMisc; }
|
|
196
|
+
if (simulate === void 0) { simulate = false; }
|
|
195
197
|
return __awaiter(this, void 0, void 0, function () {
|
|
196
198
|
var address, message, txClient, error_7;
|
|
197
199
|
return __generator(this, function (_a) {
|
|
@@ -208,7 +210,7 @@ var TokenService = /** @class */ (function () {
|
|
|
208
210
|
toAddress: toAddress
|
|
209
211
|
});
|
|
210
212
|
txClient = new token_1.TokenTxClient(wallet, this.config.rpcAddress);
|
|
211
|
-
return [4 /*yield*/, txClient.sign([message], (0, FirmaUtil_1.getSignAndBroadcastOption)(this.config.denom, txMisc))];
|
|
213
|
+
return [4 /*yield*/, txClient.sign([message], (0, FirmaUtil_1.getSignAndBroadcastOption)(this.config.denom, txMisc), simulate)];
|
|
212
214
|
case 2: return [2 /*return*/, _a.sent()];
|
|
213
215
|
case 3:
|
|
214
216
|
error_7 = _a.sent();
|
|
@@ -219,8 +221,9 @@ var TokenService = /** @class */ (function () {
|
|
|
219
221
|
});
|
|
220
222
|
});
|
|
221
223
|
};
|
|
222
|
-
TokenService.prototype.getSignedTxCreateToken = function (wallet, tokenName, tokenSymbol, tokenURI, totalSupply, decimal, isMintable, isBurnable, txMisc) {
|
|
224
|
+
TokenService.prototype.getSignedTxCreateToken = function (wallet, tokenName, tokenSymbol, tokenURI, totalSupply, decimal, isMintable, isBurnable, txMisc, simulate) {
|
|
223
225
|
if (txMisc === void 0) { txMisc = FirmaUtil_1.DefaultTxMisc; }
|
|
226
|
+
if (simulate === void 0) { simulate = false; }
|
|
224
227
|
return __awaiter(this, void 0, void 0, function () {
|
|
225
228
|
var address, message, txClient, error_8;
|
|
226
229
|
return __generator(this, function (_a) {
|
|
@@ -241,7 +244,7 @@ var TokenService = /** @class */ (function () {
|
|
|
241
244
|
burnable: isBurnable
|
|
242
245
|
});
|
|
243
246
|
txClient = new token_1.TokenTxClient(wallet, this.config.rpcAddress);
|
|
244
|
-
return [4 /*yield*/, txClient.sign([message], (0, FirmaUtil_1.getSignAndBroadcastOption)(this.config.denom, txMisc))];
|
|
247
|
+
return [4 /*yield*/, txClient.sign([message], (0, FirmaUtil_1.getSignAndBroadcastOption)(this.config.denom, txMisc), simulate)];
|
|
245
248
|
case 2: return [2 /*return*/, _a.sent()];
|
|
246
249
|
case 3:
|
|
247
250
|
error_8 = _a.sent();
|