@firmachain/firma-js 0.2.62 → 0.3.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/README.md +4 -1
- package/dist/sdk/FirmaAuthzService.d.ts +8 -8
- package/dist/sdk/FirmaAuthzService.js +12 -6
- package/dist/sdk/FirmaBankService.d.ts +4 -4
- package/dist/sdk/FirmaContractService.d.ts +4 -4
- package/dist/sdk/FirmaCosmWasmCw20.d.ts +14 -14
- package/dist/sdk/FirmaCosmWasmCw721.d.ts +31 -13
- package/dist/sdk/FirmaCosmWasmCw721.js +25 -0
- package/dist/sdk/FirmaCosmWasmCwBridge.d.ts +9 -9
- package/dist/sdk/FirmaCosmWasmCwMarketplace.d.ts +8 -8
- package/dist/sdk/FirmaCosmWasmService.d.ts +8 -8
- package/dist/sdk/FirmaCosmWasmService.js +2 -3
- package/dist/sdk/FirmaDistributionService.d.ts +6 -6
- package/dist/sdk/FirmaFeeGrantService.d.ts +4 -4
- package/dist/sdk/FirmaGovService.d.ts +12 -9
- package/dist/sdk/FirmaGovService.js +162 -97
- package/dist/sdk/FirmaIbcService.d.ts +3 -4
- package/dist/sdk/FirmaIbcService.js +5 -2
- package/dist/sdk/FirmaNftService.d.ts +5 -5
- package/dist/sdk/FirmaStakingService.d.ts +6 -6
- package/dist/sdk/FirmaTokenService.d.ts +5 -5
- package/dist/sdk/FirmaUtil.d.ts +1 -1
- package/dist/sdk/FirmaUtil.js +12 -14
- package/dist/sdk/firmachain/amino/addresses.js +1 -1
- package/dist/sdk/firmachain/amino/aminomsgs.d.ts +10 -0
- package/dist/sdk/firmachain/amino/aminomsgs.js +5 -1
- package/dist/sdk/firmachain/amino/aminotypes.js +27 -10
- package/dist/sdk/firmachain/amino/coins.d.ts +14 -2
- package/dist/sdk/firmachain/amino/coins.js +26 -5
- package/dist/sdk/firmachain/amino/encoding.d.ts +10 -1
- package/dist/sdk/firmachain/amino/encoding.js +21 -3
- package/dist/sdk/firmachain/amino/signdoc.d.ts +21 -3
- package/dist/sdk/firmachain/amino/signdoc.js +37 -11
- package/dist/sdk/firmachain/amino/signer.d.ts +2 -1
- package/dist/sdk/firmachain/authz/AuthzTxTypes.d.ts +7 -6
- package/dist/sdk/firmachain/authz/AuthzTxTypes.js +7 -6
- package/dist/sdk/firmachain/bank/BankQueryClient.js +1 -1
- package/dist/sdk/firmachain/common/CommonTxClient.js +11 -9
- package/dist/sdk/firmachain/common/ITxClient.d.ts +6 -6
- package/dist/sdk/firmachain/common/ITxClient.js +82 -24
- package/dist/sdk/firmachain/common/LedgerSigningStargateClient.d.ts +4 -9
- package/dist/sdk/firmachain/common/LedgerSigningStargateClient.js +37 -32
- package/dist/sdk/firmachain/common/LedgerWallet.js +4 -8
- package/dist/sdk/firmachain/common/TxCommon.d.ts +1 -2
- package/dist/sdk/firmachain/common/accounts.d.ts +7 -3
- package/dist/sdk/firmachain/common/accounts.js +28 -33
- package/dist/sdk/firmachain/common/aminotypes.d.ts +19 -0
- package/dist/sdk/firmachain/common/aminotypes.js +74 -0
- package/dist/sdk/firmachain/common/events.d.ts +32 -0
- package/dist/sdk/firmachain/common/events.js +18 -0
- package/dist/sdk/firmachain/common/fee.d.ts +26 -0
- package/dist/sdk/firmachain/common/fee.js +83 -0
- package/dist/sdk/firmachain/common/index.d.ts +1 -0
- package/dist/sdk/firmachain/common/index.js +3 -0
- package/dist/sdk/firmachain/common/modules/auth/queries.d.ts +15 -0
- package/dist/sdk/firmachain/common/modules/auth/queries.js +64 -0
- package/dist/sdk/firmachain/common/modules/authz/aminomessages.d.ts +2 -0
- package/dist/sdk/firmachain/common/modules/authz/aminomessages.js +15 -0
- package/dist/sdk/firmachain/common/modules/authz/messages.d.ts +2 -0
- package/dist/sdk/firmachain/common/modules/authz/messages.js +9 -0
- package/dist/sdk/firmachain/common/modules/authz/queries.d.ts +10 -0
- package/dist/sdk/firmachain/common/modules/authz/queries.js +88 -0
- package/dist/sdk/firmachain/common/modules/bank/aminomessages.d.ts +35 -0
- package/dist/sdk/firmachain/common/modules/bank/aminomessages.js +85 -0
- package/dist/sdk/firmachain/common/modules/bank/messages.d.ts +8 -0
- package/dist/sdk/firmachain/common/modules/bank/messages.js +12 -0
- package/dist/sdk/firmachain/common/modules/bank/queries.d.ts +15 -0
- package/dist/sdk/firmachain/common/modules/bank/queries.js +128 -0
- package/dist/sdk/firmachain/common/modules/crisis/aminomessages.d.ts +14 -0
- package/dist/sdk/firmachain/common/modules/crisis/aminomessages.js +11 -0
- package/dist/sdk/firmachain/common/modules/distribution/aminomessages.d.ts +44 -0
- package/dist/sdk/firmachain/common/modules/distribution/aminomessages.js +113 -0
- package/dist/sdk/firmachain/common/modules/distribution/messages.d.ts +8 -0
- package/dist/sdk/firmachain/common/modules/distribution/messages.js +15 -0
- package/dist/sdk/firmachain/common/modules/distribution/queries.d.ts +16 -0
- package/dist/sdk/firmachain/common/modules/distribution/queries.js +171 -0
- package/dist/sdk/firmachain/common/modules/evidence/aminomessages.d.ts +18 -0
- package/dist/sdk/firmachain/common/modules/evidence/aminomessages.js +11 -0
- package/dist/sdk/firmachain/common/modules/feegrant/aminomessages.d.ts +2 -0
- package/dist/sdk/firmachain/common/modules/feegrant/aminomessages.js +14 -0
- package/dist/sdk/firmachain/common/modules/feegrant/messages.d.ts +2 -0
- package/dist/sdk/firmachain/common/modules/feegrant/messages.js +8 -0
- package/dist/sdk/firmachain/common/modules/feegrant/queries.d.ts +9 -0
- package/dist/sdk/firmachain/common/modules/feegrant/queries.js +81 -0
- package/dist/sdk/firmachain/common/modules/gov/aminomessages.d.ts +79 -0
- package/dist/sdk/firmachain/common/modules/gov/aminomessages.js +152 -0
- package/dist/sdk/firmachain/common/modules/gov/messages.d.ts +29 -0
- package/dist/sdk/firmachain/common/modules/gov/messages.js +38 -0
- package/dist/sdk/firmachain/common/modules/gov/queries.d.ts +19 -0
- package/dist/sdk/firmachain/common/modules/gov/queries.js +160 -0
- package/dist/sdk/firmachain/common/modules/group/aminomessages.d.ts +2 -0
- package/dist/sdk/firmachain/common/modules/group/aminomessages.js +8 -0
- package/dist/sdk/firmachain/common/modules/group/messages.d.ts +2 -0
- package/dist/sdk/firmachain/common/modules/group/messages.js +28 -0
- package/dist/sdk/firmachain/common/modules/ibc/aminomessages.d.ts +38 -0
- package/dist/sdk/firmachain/common/modules/ibc/aminomessages.js +55 -0
- package/dist/sdk/firmachain/common/modules/ibc/messages.d.ts +8 -0
- package/dist/sdk/firmachain/common/modules/ibc/messages.js +32 -0
- package/dist/sdk/firmachain/common/modules/ibc/queries.d.ts +58 -0
- package/dist/sdk/firmachain/common/modules/ibc/queries.js +576 -0
- package/dist/sdk/firmachain/common/modules/index.d.ts +32 -0
- package/dist/sdk/firmachain/common/modules/index.js +101 -0
- package/dist/sdk/firmachain/common/modules/mint/queries.d.ts +21 -0
- package/dist/sdk/firmachain/common/modules/mint/queries.js +95 -0
- package/dist/sdk/firmachain/common/modules/slashing/aminomessages.d.ts +12 -0
- package/dist/sdk/firmachain/common/modules/slashing/aminomessages.js +11 -0
- package/dist/sdk/firmachain/common/modules/slashing/queries.d.ts +10 -0
- package/dist/sdk/firmachain/common/modules/slashing/queries.js +88 -0
- package/dist/sdk/firmachain/common/modules/staking/aminomessages.d.ts +112 -0
- package/dist/sdk/firmachain/common/modules/staking/aminomessages.js +234 -0
- package/dist/sdk/firmachain/common/modules/staking/messages.d.ts +33 -0
- package/dist/sdk/firmachain/common/modules/staking/messages.js +37 -0
- package/dist/sdk/firmachain/common/modules/staking/queries.d.ts +23 -0
- package/dist/sdk/firmachain/common/modules/staking/queries.js +242 -0
- package/dist/sdk/firmachain/common/modules/tx/queries.d.ts +11 -0
- package/dist/sdk/firmachain/common/modules/tx/queries.js +103 -0
- package/dist/sdk/firmachain/common/modules/vesting/aminomessages.d.ts +16 -0
- package/dist/sdk/firmachain/common/modules/vesting/aminomessages.js +56 -0
- package/dist/sdk/firmachain/common/modules/vesting/messages.d.ts +2 -0
- package/dist/sdk/firmachain/common/modules/vesting/messages.js +7 -0
- package/dist/sdk/firmachain/common/queryclient/index.d.ts +2 -0
- package/dist/sdk/firmachain/common/queryclient/index.js +10 -0
- package/dist/sdk/firmachain/common/queryclient/queryclient.d.ts +75 -0
- package/dist/sdk/firmachain/common/queryclient/queryclient.js +157 -0
- package/dist/sdk/firmachain/common/queryclient/utils.d.ts +33 -0
- package/dist/sdk/firmachain/common/queryclient/utils.js +101 -0
- package/dist/sdk/firmachain/common/search.d.ts +10 -0
- package/dist/sdk/firmachain/common/search.js +7 -0
- package/dist/sdk/firmachain/common/signing.d.ts +8 -3
- package/dist/sdk/firmachain/common/signing.js +24 -12
- package/dist/sdk/firmachain/common/signingstargateclient.d.ts +107 -30
- package/dist/sdk/firmachain/common/signingstargateclient.js +445 -128
- package/dist/sdk/firmachain/common/stargateclient.d.ts +184 -20
- package/dist/sdk/firmachain/common/stargateclient.js +351 -35
- package/dist/sdk/firmachain/contract/ContractTxClient.d.ts +2 -2
- package/dist/sdk/firmachain/contract/ContractTxClient.js +4 -4
- package/dist/sdk/firmachain/contract/ContractTxTypes.d.ts +1 -1
- package/dist/sdk/firmachain/contract/ContractTxTypes.js +3 -3
- package/dist/sdk/firmachain/cosmwasm/CosmWasmQueryClient.js +1 -1
- package/dist/sdk/firmachain/feegrant/FeeGrantTxTypes.d.ts +5 -5
- package/dist/sdk/firmachain/feegrant/FeeGrantTxTypes.js +10 -8
- package/dist/sdk/firmachain/google/protobuf/any.d.ts +3 -2
- package/dist/sdk/firmachain/google/protobuf/any.js +2 -1
- package/dist/sdk/firmachain/google/protobuf/duration.d.ts +3 -2
- package/dist/sdk/firmachain/google/protobuf/duration.js +2 -1
- package/dist/sdk/firmachain/google/protobuf/timestamp.d.ts +3 -2
- package/dist/sdk/firmachain/google/protobuf/timestamp.js +2 -1
- package/dist/sdk/firmachain/gov/GovTxClient.d.ts +6 -0
- package/dist/sdk/firmachain/gov/GovTxClient.js +6 -1
- package/dist/sdk/firmachain/nft/NftTxClient.d.ts +3 -3
- package/dist/sdk/firmachain/nft/NftTxClient.js +6 -6
- package/dist/sdk/firmachain/nft/NftTxTypes.d.ts +1 -1
- package/dist/sdk/firmachain/nft/NftTxTypes.js +4 -4
- package/dist/sdk/firmachain/staking/StakingQueryClient.js +0 -1
- package/dist/sdk/firmachain/token/TokenTxClient.d.ts +4 -4
- package/dist/sdk/firmachain/token/TokenTxClient.js +8 -8
- package/dist/sdk/firmachain/token/TokenTxTypes.d.ts +1 -1
- package/dist/sdk/firmachain/token/TokenTxTypes.js +5 -5
- package/dist/test/00.wallet.test.d.ts +1 -0
- package/dist/test/00.wallet.test.js +96 -0
- package/dist/test/01.contract_tx.test.d.ts +1 -0
- package/dist/test/01.contract_tx.test.js +157 -0
- package/dist/test/02.contract_query.test.d.ts +1 -0
- package/dist/test/02.contract_query.test.js +245 -0
- package/dist/test/03.contract_scenario.test.d.ts +1 -0
- package/dist/test/03.contract_scenario.test.js +406 -0
- package/dist/test/04.bank_tx.test.d.ts +1 -0
- package/dist/test/04.bank_tx.test.js +126 -0
- package/dist/test/05.bank_query.test.d.ts +1 -0
- package/dist/test/05.bank_query.test.js +162 -0
- package/dist/test/06.feegrant_tx.test.d.ts +1 -0
- package/dist/test/06.feegrant_tx.test.js +161 -0
- package/dist/test/07.feegrant_query.test.d.ts +1 -0
- package/dist/test/07.feegrant_query.test.js +126 -0
- package/dist/test/08.gas_estimate.test.d.ts +1 -0
- package/dist/test/08.gas_estimate.test.js +675 -0
- package/dist/test/09.ipfs.test.d.ts +1 -0
- package/dist/test/09.ipfs.test.js +72 -0
- package/dist/test/10.nft_tx.test.d.ts +1 -0
- package/dist/test/10.nft_tx.test.js +209 -0
- package/dist/test/11.nft_query.test.d.ts +1 -0
- package/dist/test/11.nft_query.test.js +165 -0
- package/dist/test/12.staking_tx.test.d.ts +1 -0
- package/dist/test/12.staking_tx.test.js +199 -0
- package/dist/test/13.staking_query.test.d.ts +1 -0
- package/dist/test/13.staking_query.test.js +263 -0
- package/dist/test/14.distribution_tx.test.d.ts +1 -0
- package/dist/test/14.distribution_tx.test.js +170 -0
- package/dist/test/15.distribution_query.test.d.ts +1 -0
- package/dist/test/15.distribution_query.test.js +243 -0
- package/dist/test/16.gov_tx.test.d.ts +1 -0
- package/dist/test/16.gov_tx.test.js +311 -0
- package/dist/test/17.gov_query.test.d.ts +1 -0
- package/dist/test/17.gov_query.test.js +157 -0
- package/dist/test/18.util.test.d.ts +1 -0
- package/dist/test/18.util.test.js +251 -0
- package/dist/test/19.chain.test.d.ts +1 -0
- package/dist/test/19.chain.test.js +127 -0
- package/dist/test/20.slashing_query.test.d.ts +1 -0
- package/dist/test/20.slashing_query.test.js +112 -0
- package/dist/test/21.token_tx.test.d.ts +1 -0
- package/dist/test/21.token_tx.test.js +149 -0
- package/dist/test/22.token_query.test.d.ts +1 -0
- package/dist/test/22.token_query.test.js +103 -0
- package/dist/test/23.authz_tx.test.d.ts +1 -0
- package/dist/test/23.authz_tx.test.js +350 -0
- package/dist/test/24.authz_query.test.d.ts +1 -0
- package/dist/test/24.authz_query.test.js +203 -0
- package/dist/test/25.cosmwasm_tx.test.d.ts +1 -0
- package/dist/test/25.cosmwasm_tx.test.js +229 -0
- package/dist/test/26.cosmwasm_query.test.d.ts +1 -0
- package/dist/test/26.cosmwasm_query.test.js +209 -0
- package/dist/test/27.arbitary_sign.test.d.ts +1 -0
- package/dist/test/27.arbitary_sign.test.js +159 -0
- package/dist/test/28.ibc_tx.test.d.ts +1 -0
- package/dist/test/28.ibc_tx.test.js +98 -0
- package/dist/test/29.mint_query.test.d.ts +1 -0
- package/dist/test/29.mint_query.test.js +59 -0
- package/dist/test/30.cw20_tx.test.d.ts +1 -0
- package/dist/test/30.cw20_tx.test.js +450 -0
- package/dist/test/31.cw20_query.test.d.ts +1 -0
- package/dist/test/31.cw20_query.test.js +333 -0
- package/dist/test/32.cw721_tx.test.d.ts +1 -0
- package/dist/test/32.cw721_tx.test.js +431 -0
- package/dist/test/33.cw721_query.test.d.ts +1 -0
- package/dist/test/33.cw721_query.test.js +371 -0
- package/dist/test/34.cw_bridge_tx.test.d.ts +1 -0
- package/dist/test/34.cw_bridge_tx.test.js +476 -0
- package/dist/test/35.cw_bridge_tx_low.test.d.ts +1 -0
- package/dist/test/35.cw_bridge_tx_low.test.js +398 -0
- package/dist/test/36.cw_bridge_query.test.d.ts +1 -0
- package/dist/test/36.cw_bridge_query.test.js +318 -0
- package/dist/test/37.cw_marketplace_tx.test.d.ts +1 -0
- package/dist/test/37.cw_marketplace_tx.test.js +794 -0
- package/dist/test/38.cw_marketplace_query.test.d.ts +1 -0
- package/dist/test/38.cw_marketplace_query.test.js +128 -0
- package/dist/test/config_test.d.ts +11 -0
- package/dist/test/config_test.js +29 -0
- package/dist/test/config_test.sample.d.ts +5 -0
- package/dist/test/config_test.sample.js +8 -0
- package/package.json +9 -7
- package/dist/sdk/firmachain/common/signingaminostargateclient.d.ts +0 -50
- package/dist/sdk/firmachain/common/signingaminostargateclient.js +0 -267
|
@@ -0,0 +1,675 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
+
function step(op) {
|
|
16
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
+
while (_) try {
|
|
18
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
+
switch (op[0]) {
|
|
21
|
+
case 0: case 1: t = op; break;
|
|
22
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
+
default:
|
|
26
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
+
if (t[2]) _.ops.pop();
|
|
31
|
+
_.trys.pop(); continue;
|
|
32
|
+
}
|
|
33
|
+
op = body.call(thisArg, _);
|
|
34
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
var __values = (this && this.__values) || function(o) {
|
|
39
|
+
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
40
|
+
if (m) return m.call(o);
|
|
41
|
+
if (o && typeof o.length === "number") return {
|
|
42
|
+
next: function () {
|
|
43
|
+
if (o && i >= o.length) o = void 0;
|
|
44
|
+
return { value: o && o[i++], done: !o };
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
48
|
+
};
|
|
49
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
50
|
+
var chai_1 = require("chai");
|
|
51
|
+
var FirmaSDK_1 = require("../sdk/FirmaSDK");
|
|
52
|
+
var FirmaUtil_1 = require("../sdk/FirmaUtil");
|
|
53
|
+
var common_1 = require("../sdk/firmachain/common");
|
|
54
|
+
var config_test_1 = require("./config_test");
|
|
55
|
+
describe('[08. Gas Estimation Test]', function () {
|
|
56
|
+
var firma;
|
|
57
|
+
var aliceWallet;
|
|
58
|
+
var bobWallet;
|
|
59
|
+
var aliceAddress;
|
|
60
|
+
var bobAddress;
|
|
61
|
+
var validatorWallet;
|
|
62
|
+
var validatorAddress;
|
|
63
|
+
var valOperAddress;
|
|
64
|
+
var extractValue = function (events, eventType, attrKey) {
|
|
65
|
+
var e_1, _a, e_2, _b;
|
|
66
|
+
try {
|
|
67
|
+
for (var events_1 = __values(events), events_1_1 = events_1.next(); !events_1_1.done; events_1_1 = events_1.next()) {
|
|
68
|
+
var event_1 = events_1_1.value;
|
|
69
|
+
if (event_1.type === eventType) {
|
|
70
|
+
try {
|
|
71
|
+
for (var _c = (e_2 = void 0, __values(event_1.attributes)), _d = _c.next(); !_d.done; _d = _c.next()) {
|
|
72
|
+
var attr = _d.value;
|
|
73
|
+
if (attr.key === attrKey) {
|
|
74
|
+
return attr.value;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
79
|
+
finally {
|
|
80
|
+
try {
|
|
81
|
+
if (_d && !_d.done && (_b = _c.return)) _b.call(_c);
|
|
82
|
+
}
|
|
83
|
+
finally { if (e_2) throw e_2.error; }
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
89
|
+
finally {
|
|
90
|
+
try {
|
|
91
|
+
if (events_1_1 && !events_1_1.done && (_a = events_1.return)) _a.call(events_1);
|
|
92
|
+
}
|
|
93
|
+
finally { if (e_1) throw e_1.error; }
|
|
94
|
+
}
|
|
95
|
+
return "";
|
|
96
|
+
};
|
|
97
|
+
beforeEach(function () {
|
|
98
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
99
|
+
return __generator(this, function (_a) {
|
|
100
|
+
switch (_a.label) {
|
|
101
|
+
case 0:
|
|
102
|
+
firma = new FirmaSDK_1.FirmaSDK(config_test_1.TestChainConfig);
|
|
103
|
+
return [4 /*yield*/, firma.Wallet.fromMnemonic(config_test_1.aliceMnemonic)];
|
|
104
|
+
case 1:
|
|
105
|
+
aliceWallet = _a.sent();
|
|
106
|
+
return [4 /*yield*/, aliceWallet.getAddress()];
|
|
107
|
+
case 2:
|
|
108
|
+
aliceAddress = _a.sent();
|
|
109
|
+
return [4 /*yield*/, firma.Wallet.fromMnemonic(config_test_1.bobMnemonic)];
|
|
110
|
+
case 3:
|
|
111
|
+
bobWallet = _a.sent();
|
|
112
|
+
return [4 /*yield*/, bobWallet.getAddress()];
|
|
113
|
+
case 4:
|
|
114
|
+
bobAddress = _a.sent();
|
|
115
|
+
return [4 /*yield*/, firma.Wallet.fromMnemonic(config_test_1.validatorMnemonic)];
|
|
116
|
+
case 5:
|
|
117
|
+
validatorWallet = _a.sent();
|
|
118
|
+
return [4 /*yield*/, validatorWallet.getAddress()];
|
|
119
|
+
case 6:
|
|
120
|
+
validatorAddress = _a.sent();
|
|
121
|
+
valOperAddress = FirmaUtil_1.FirmaUtil.getValOperAddressFromAccAddress(validatorAddress);
|
|
122
|
+
return [2 /*return*/];
|
|
123
|
+
}
|
|
124
|
+
});
|
|
125
|
+
});
|
|
126
|
+
});
|
|
127
|
+
it("1-1. bank send gas estimation", function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
128
|
+
var amount, gas;
|
|
129
|
+
return __generator(this, function (_a) {
|
|
130
|
+
switch (_a.label) {
|
|
131
|
+
case 0:
|
|
132
|
+
amount = 1;
|
|
133
|
+
return [4 /*yield*/, firma.Bank.getGasEstimationSend(aliceWallet, bobAddress, amount)];
|
|
134
|
+
case 1:
|
|
135
|
+
gas = _a.sent();
|
|
136
|
+
chai_1.expect(gas).to.not.equal(0);
|
|
137
|
+
return [2 /*return*/];
|
|
138
|
+
}
|
|
139
|
+
});
|
|
140
|
+
}); });
|
|
141
|
+
it("1-2. bank sendToken gas estimation", function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
142
|
+
var timestamp, tokenName, tokenId, tokenSymbol, tokenURI, tokenSupply, decimal, mintAmount, sendAmount, createResult, mintResult, gas;
|
|
143
|
+
return __generator(this, function (_a) {
|
|
144
|
+
switch (_a.label) {
|
|
145
|
+
case 0:
|
|
146
|
+
timestamp = Math.round(+new Date() / 1000);
|
|
147
|
+
tokenName = "KOMX TOKEN";
|
|
148
|
+
tokenId = "ukomx" + timestamp;
|
|
149
|
+
tokenSymbol = "KOMX" + timestamp;
|
|
150
|
+
tokenURI = "https://token.firmachain.dev";
|
|
151
|
+
tokenSupply = 100000000;
|
|
152
|
+
decimal = 6;
|
|
153
|
+
mintAmount = 10;
|
|
154
|
+
sendAmount = 1;
|
|
155
|
+
return [4 /*yield*/, firma.Token.createToken(aliceWallet, tokenName, tokenSymbol, tokenURI, tokenSupply, decimal, true, true)];
|
|
156
|
+
case 1:
|
|
157
|
+
createResult = _a.sent();
|
|
158
|
+
chai_1.expect(createResult.code).to.be.equal(0);
|
|
159
|
+
return [4 /*yield*/, firma.Token.mint(aliceWallet, tokenId, mintAmount, decimal, aliceAddress)];
|
|
160
|
+
case 2:
|
|
161
|
+
mintResult = _a.sent();
|
|
162
|
+
chai_1.expect(mintResult.code).to.be.equal(0);
|
|
163
|
+
return [4 /*yield*/, firma.Bank.getGasEstimationSendToken(aliceWallet, bobAddress, tokenId, sendAmount, decimal)];
|
|
164
|
+
case 3:
|
|
165
|
+
gas = _a.sent();
|
|
166
|
+
chai_1.expect(gas).to.not.equal(0);
|
|
167
|
+
return [2 /*return*/];
|
|
168
|
+
}
|
|
169
|
+
});
|
|
170
|
+
}); });
|
|
171
|
+
it("2-1. Contract addContractLog getGasEstimationFromUnSignedTxList gas estimation", function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
172
|
+
var contractHash, timeStamp, eventName, ownerAddress, jsonString, tx1, gas;
|
|
173
|
+
return __generator(this, function (_a) {
|
|
174
|
+
switch (_a.label) {
|
|
175
|
+
case 0:
|
|
176
|
+
contractHash = "0xsalkdjfasldkjf2";
|
|
177
|
+
timeStamp = Math.round(+new Date() / 1000);
|
|
178
|
+
;
|
|
179
|
+
eventName = "CreateContract";
|
|
180
|
+
ownerAddress = aliceAddress;
|
|
181
|
+
jsonString = "{}";
|
|
182
|
+
return [4 /*yield*/, firma.Contract.getUnsignedTxAddContractLog(aliceWallet, contractHash, timeStamp, eventName, ownerAddress, jsonString)];
|
|
183
|
+
case 1:
|
|
184
|
+
tx1 = _a.sent();
|
|
185
|
+
return [4 /*yield*/, firma.Contract.getGasEstimationFromUnSignedTxList(aliceWallet, [tx1, tx1, tx1, tx1, tx1])];
|
|
186
|
+
case 2:
|
|
187
|
+
gas = _a.sent();
|
|
188
|
+
chai_1.expect(gas).to.not.equal(0);
|
|
189
|
+
return [2 /*return*/];
|
|
190
|
+
}
|
|
191
|
+
});
|
|
192
|
+
}); });
|
|
193
|
+
it("2-2. Contract addContractLog gas estimation", function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
194
|
+
var contractHash, timeStamp, eventName, ownerAddress, jsonString, gas;
|
|
195
|
+
return __generator(this, function (_a) {
|
|
196
|
+
switch (_a.label) {
|
|
197
|
+
case 0:
|
|
198
|
+
contractHash = "0xsalkdjfasldkjf2";
|
|
199
|
+
timeStamp = Math.round(+new Date() / 1000);
|
|
200
|
+
;
|
|
201
|
+
eventName = "CreateContract";
|
|
202
|
+
ownerAddress = aliceAddress;
|
|
203
|
+
jsonString = "{}";
|
|
204
|
+
return [4 /*yield*/, firma.Contract.getGasEstimationAddContractLog(aliceWallet, contractHash, timeStamp, eventName, ownerAddress, jsonString)];
|
|
205
|
+
case 1:
|
|
206
|
+
gas = _a.sent();
|
|
207
|
+
chai_1.expect(gas).to.not.equal(0);
|
|
208
|
+
return [2 /*return*/];
|
|
209
|
+
}
|
|
210
|
+
});
|
|
211
|
+
}); });
|
|
212
|
+
it("2-3. Contract createContractFile gas estimation", function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
213
|
+
var timeStamp, fileHash, ownerAddress, ownerList, jsonString, gas;
|
|
214
|
+
return __generator(this, function (_a) {
|
|
215
|
+
switch (_a.label) {
|
|
216
|
+
case 0:
|
|
217
|
+
timeStamp = Math.round(+new Date() / 1000);
|
|
218
|
+
fileHash = "0xklsdjflaksjflaksjf" + timeStamp;
|
|
219
|
+
ownerAddress = aliceAddress;
|
|
220
|
+
ownerList = [ownerAddress, bobAddress];
|
|
221
|
+
jsonString = "{}";
|
|
222
|
+
return [4 /*yield*/, firma.Contract.getGasEstimationCreateContractFile(aliceWallet, fileHash, timeStamp, ownerList, jsonString)];
|
|
223
|
+
case 1:
|
|
224
|
+
gas = _a.sent();
|
|
225
|
+
chai_1.expect(gas).to.not.equal(0);
|
|
226
|
+
return [2 /*return*/];
|
|
227
|
+
}
|
|
228
|
+
});
|
|
229
|
+
}); });
|
|
230
|
+
it("3-1. NFT Mint gas estimation", function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
231
|
+
var gas;
|
|
232
|
+
return __generator(this, function (_a) {
|
|
233
|
+
switch (_a.label) {
|
|
234
|
+
case 0: return [4 /*yield*/, firma.Nft.getGasEstimationMint(aliceWallet, "https://naver.com")];
|
|
235
|
+
case 1:
|
|
236
|
+
gas = _a.sent();
|
|
237
|
+
chai_1.expect(gas).to.not.equal(0);
|
|
238
|
+
return [2 /*return*/];
|
|
239
|
+
}
|
|
240
|
+
});
|
|
241
|
+
}); });
|
|
242
|
+
it("3-2. NFT Transfer gas estimation", function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
243
|
+
var result, nftId, gas;
|
|
244
|
+
return __generator(this, function (_a) {
|
|
245
|
+
switch (_a.label) {
|
|
246
|
+
case 0: return [4 /*yield*/, firma.Nft.mint(aliceWallet, "https://naver.com")];
|
|
247
|
+
case 1:
|
|
248
|
+
result = _a.sent();
|
|
249
|
+
chai_1.expect(result.code).to.be.equal(0);
|
|
250
|
+
nftId = extractValue(result.events, "message", "nftID");
|
|
251
|
+
return [4 /*yield*/, firma.Nft.getGasEstimationTransfer(aliceWallet, bobAddress, nftId)];
|
|
252
|
+
case 2:
|
|
253
|
+
gas = _a.sent();
|
|
254
|
+
chai_1.expect(gas).to.not.equal(0);
|
|
255
|
+
return [2 /*return*/];
|
|
256
|
+
}
|
|
257
|
+
});
|
|
258
|
+
}); });
|
|
259
|
+
it("3-3. NFT Burn gas estimation", function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
260
|
+
var result, nftId, gas;
|
|
261
|
+
return __generator(this, function (_a) {
|
|
262
|
+
switch (_a.label) {
|
|
263
|
+
case 0: return [4 /*yield*/, firma.Nft.mint(aliceWallet, "https://naver.com")];
|
|
264
|
+
case 1:
|
|
265
|
+
result = _a.sent();
|
|
266
|
+
chai_1.expect(result.code).to.be.equal(0);
|
|
267
|
+
nftId = extractValue(result.events, "message", "nftID");
|
|
268
|
+
return [4 /*yield*/, firma.Nft.getGasEstimationBurn(aliceWallet, nftId)];
|
|
269
|
+
case 2:
|
|
270
|
+
gas = _a.sent();
|
|
271
|
+
chai_1.expect(gas).to.not.equal(0);
|
|
272
|
+
return [2 /*return*/];
|
|
273
|
+
}
|
|
274
|
+
});
|
|
275
|
+
}); });
|
|
276
|
+
it("4-1. Feegrant GrantPeriodicAllowance gas estimation", function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
277
|
+
var spendLimit, expirationDate, periodicAllowanceData, gas;
|
|
278
|
+
return __generator(this, function (_a) {
|
|
279
|
+
switch (_a.label) {
|
|
280
|
+
case 0:
|
|
281
|
+
spendLimit = 2000;
|
|
282
|
+
expirationDate = new Date();
|
|
283
|
+
expirationDate.setMinutes(expirationDate.getMinutes() + 2);
|
|
284
|
+
periodicAllowanceData = {
|
|
285
|
+
// basicSpendLimit: undefined,
|
|
286
|
+
// basicExpiration: undefined,
|
|
287
|
+
periodSeconds: 30,
|
|
288
|
+
periodSpendLimit: spendLimit,
|
|
289
|
+
periodCanSpend: 10000,
|
|
290
|
+
periodReset: expirationDate
|
|
291
|
+
};
|
|
292
|
+
return [4 /*yield*/, firma.FeeGrant.getGasEstimationGrantPeriodicAllowance(bobWallet, aliceAddress, periodicAllowanceData)];
|
|
293
|
+
case 1:
|
|
294
|
+
gas = _a.sent();
|
|
295
|
+
chai_1.expect(gas).to.not.equal(0);
|
|
296
|
+
return [2 /*return*/];
|
|
297
|
+
}
|
|
298
|
+
});
|
|
299
|
+
}); });
|
|
300
|
+
it("4-2. Feegrant GrantBasicAllowance gas estimation", function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
301
|
+
var gas;
|
|
302
|
+
return __generator(this, function (_a) {
|
|
303
|
+
switch (_a.label) {
|
|
304
|
+
case 0: return [4 /*yield*/, firma.FeeGrant.getGasEstimationGrantBasicAllowance(bobWallet, aliceAddress)];
|
|
305
|
+
case 1:
|
|
306
|
+
gas = _a.sent();
|
|
307
|
+
chai_1.expect(gas).to.not.equal(0);
|
|
308
|
+
return [2 /*return*/];
|
|
309
|
+
}
|
|
310
|
+
});
|
|
311
|
+
}); });
|
|
312
|
+
it("4-3. Feegrant revokeAllowance gas estimation", function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
313
|
+
var expirationDate, result, gas, fee;
|
|
314
|
+
return __generator(this, function (_a) {
|
|
315
|
+
switch (_a.label) {
|
|
316
|
+
case 0:
|
|
317
|
+
expirationDate = new Date();
|
|
318
|
+
expirationDate.setMinutes(expirationDate.getMinutes() + 20);
|
|
319
|
+
return [4 /*yield*/, firma.FeeGrant.grantBasicAllowance(aliceWallet, bobAddress, { expiration: expirationDate })];
|
|
320
|
+
case 1:
|
|
321
|
+
result = _a.sent();
|
|
322
|
+
chai_1.expect(result.code).to.equal(0);
|
|
323
|
+
return [4 /*yield*/, firma.FeeGrant.getGasEstimationRevokeAllowance(aliceWallet, bobAddress)];
|
|
324
|
+
case 2:
|
|
325
|
+
gas = _a.sent();
|
|
326
|
+
chai_1.expect(gas).to.not.equal(0);
|
|
327
|
+
fee = Math.ceil(gas * 0.1);
|
|
328
|
+
return [4 /*yield*/, firma.FeeGrant.revokeAllowance(aliceWallet, bobAddress, { gas: gas, fee: fee })];
|
|
329
|
+
case 3:
|
|
330
|
+
_a.sent();
|
|
331
|
+
return [2 /*return*/];
|
|
332
|
+
}
|
|
333
|
+
});
|
|
334
|
+
}); });
|
|
335
|
+
it("5-1. Staking delegate gas estimation", function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
336
|
+
var amountFCT, gas;
|
|
337
|
+
return __generator(this, function (_a) {
|
|
338
|
+
switch (_a.label) {
|
|
339
|
+
case 0:
|
|
340
|
+
amountFCT = 60;
|
|
341
|
+
return [4 /*yield*/, firma.Staking.getGasEstimationDelegate(aliceWallet, valOperAddress, amountFCT)];
|
|
342
|
+
case 1:
|
|
343
|
+
gas = _a.sent();
|
|
344
|
+
chai_1.expect(gas).to.not.equal(0);
|
|
345
|
+
return [2 /*return*/];
|
|
346
|
+
}
|
|
347
|
+
});
|
|
348
|
+
}); });
|
|
349
|
+
it("5-2. Staking undelegate gas estimation", function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
350
|
+
var amount, gas;
|
|
351
|
+
return __generator(this, function (_a) {
|
|
352
|
+
switch (_a.label) {
|
|
353
|
+
case 0:
|
|
354
|
+
amount = 5;
|
|
355
|
+
return [4 /*yield*/, firma.Staking.getGasEstimationUndelegate(aliceWallet, valOperAddress, amount)];
|
|
356
|
+
case 1:
|
|
357
|
+
gas = _a.sent();
|
|
358
|
+
chai_1.expect(gas).to.not.equal(0);
|
|
359
|
+
return [2 /*return*/];
|
|
360
|
+
}
|
|
361
|
+
});
|
|
362
|
+
}); });
|
|
363
|
+
/*
|
|
364
|
+
This test may fail even with a valid call due to the following two reasons:
|
|
365
|
+
- The maximum number of allowed redelegations (7) has been exceeded
|
|
366
|
+
- There are no delegated tokens to the srcValidatorAddress
|
|
367
|
+
*/
|
|
368
|
+
it("5-3. Staking redelegate gas estimation", function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
369
|
+
var validatorList, srcValidatorAddress, dstValidatorAddress, amount, gas;
|
|
370
|
+
return __generator(this, function (_a) {
|
|
371
|
+
switch (_a.label) {
|
|
372
|
+
case 0: return [4 /*yield*/, firma.Staking.getValidatorList()];
|
|
373
|
+
case 1:
|
|
374
|
+
validatorList = (_a.sent()).dataList;
|
|
375
|
+
if (validatorList.length < 2)
|
|
376
|
+
return [2 /*return*/];
|
|
377
|
+
srcValidatorAddress = validatorList[0].operator_address;
|
|
378
|
+
dstValidatorAddress = validatorList[1].operator_address;
|
|
379
|
+
amount = 10;
|
|
380
|
+
return [4 /*yield*/, firma.Staking.getGasEstimationRedelegate(aliceWallet, srcValidatorAddress, dstValidatorAddress, amount, { gas: 300000, fee: 30000 })];
|
|
381
|
+
case 2:
|
|
382
|
+
gas = _a.sent();
|
|
383
|
+
chai_1.expect(gas).to.not.equal(0);
|
|
384
|
+
return [2 /*return*/];
|
|
385
|
+
}
|
|
386
|
+
});
|
|
387
|
+
}); });
|
|
388
|
+
it("6-1. Distribution withdrawAllRewards gas estimation", function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
389
|
+
var delegationList, validatorAddress, gas;
|
|
390
|
+
return __generator(this, function (_a) {
|
|
391
|
+
switch (_a.label) {
|
|
392
|
+
case 0: return [4 /*yield*/, firma.Staking.getTotalDelegationInfo(aliceAddress)];
|
|
393
|
+
case 1:
|
|
394
|
+
delegationList = (_a.sent()).dataList;
|
|
395
|
+
validatorAddress = delegationList[0].delegation.validator_address;
|
|
396
|
+
return [4 /*yield*/, firma.Distribution.getGasEstimationWithdrawAllRewards(aliceWallet, validatorAddress)];
|
|
397
|
+
case 2:
|
|
398
|
+
gas = _a.sent();
|
|
399
|
+
chai_1.expect(gas).to.not.equal(0);
|
|
400
|
+
return [2 /*return*/];
|
|
401
|
+
}
|
|
402
|
+
});
|
|
403
|
+
}); });
|
|
404
|
+
it("6-2. Distribution withdrawValidatorCommission gas estimation", function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
405
|
+
var valOperAddress, gas;
|
|
406
|
+
return __generator(this, function (_a) {
|
|
407
|
+
switch (_a.label) {
|
|
408
|
+
case 0:
|
|
409
|
+
valOperAddress = FirmaUtil_1.FirmaUtil.getValOperAddressFromAccAddress(validatorAddress);
|
|
410
|
+
return [4 /*yield*/, firma.Distribution.getGasEstimationWithdrawValidatorCommission(validatorWallet, valOperAddress)];
|
|
411
|
+
case 1:
|
|
412
|
+
gas = _a.sent();
|
|
413
|
+
chai_1.expect(gas).to.not.equal(0);
|
|
414
|
+
return [2 /*return*/];
|
|
415
|
+
}
|
|
416
|
+
});
|
|
417
|
+
}); });
|
|
418
|
+
it("6-3. Distribution fundCommunityPool gas estimation", function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
419
|
+
var amount, gas;
|
|
420
|
+
return __generator(this, function (_a) {
|
|
421
|
+
switch (_a.label) {
|
|
422
|
+
case 0:
|
|
423
|
+
amount = 1;
|
|
424
|
+
return [4 /*yield*/, firma.Distribution.getGasEstimationFundCommunityPool(validatorWallet, amount)];
|
|
425
|
+
case 1:
|
|
426
|
+
gas = _a.sent();
|
|
427
|
+
chai_1.expect(gas).to.not.equal(0);
|
|
428
|
+
return [2 /*return*/];
|
|
429
|
+
}
|
|
430
|
+
});
|
|
431
|
+
}); });
|
|
432
|
+
it("6-4. Distribution setWithdrawAddress gas estimation", function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
433
|
+
var gas;
|
|
434
|
+
return __generator(this, function (_a) {
|
|
435
|
+
switch (_a.label) {
|
|
436
|
+
case 0: return [4 /*yield*/, firma.Distribution.getGasEstimationSetWithdrawAddress(aliceWallet, bobAddress)];
|
|
437
|
+
case 1:
|
|
438
|
+
gas = _a.sent();
|
|
439
|
+
chai_1.expect(gas).to.not.equal(0);
|
|
440
|
+
return [2 /*return*/];
|
|
441
|
+
}
|
|
442
|
+
});
|
|
443
|
+
}); });
|
|
444
|
+
it("7-1. Gov submitTextProposal gas estimation", function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
445
|
+
var initialDepositFCT, title, description, gas, error_1;
|
|
446
|
+
return __generator(this, function (_a) {
|
|
447
|
+
switch (_a.label) {
|
|
448
|
+
case 0:
|
|
449
|
+
initialDepositFCT = 2500;
|
|
450
|
+
title = "test submit proposal";
|
|
451
|
+
description = "test description";
|
|
452
|
+
_a.label = 1;
|
|
453
|
+
case 1:
|
|
454
|
+
_a.trys.push([1, 3, , 4]);
|
|
455
|
+
return [4 /*yield*/, firma.Gov.getGasEstimationSubmitTextProposal(aliceWallet, title, description, initialDepositFCT)];
|
|
456
|
+
case 2:
|
|
457
|
+
gas = _a.sent();
|
|
458
|
+
chai_1.expect(gas).to.not.equal(0);
|
|
459
|
+
return [3 /*break*/, 4];
|
|
460
|
+
case 3:
|
|
461
|
+
error_1 = _a.sent();
|
|
462
|
+
console.log(error_1);
|
|
463
|
+
return [3 /*break*/, 4];
|
|
464
|
+
case 4: return [2 /*return*/];
|
|
465
|
+
}
|
|
466
|
+
});
|
|
467
|
+
}); });
|
|
468
|
+
it.skip("7-2. Gov submitCommunityPoolSpendProposal gas estimation", function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
469
|
+
var initialDepositFCT, title, description, amountFCT, recipient, gas;
|
|
470
|
+
return __generator(this, function (_a) {
|
|
471
|
+
switch (_a.label) {
|
|
472
|
+
case 0:
|
|
473
|
+
initialDepositFCT = 2500;
|
|
474
|
+
title = "Community spend proposal";
|
|
475
|
+
description = "Proposal to spend from community pool";
|
|
476
|
+
amountFCT = 1000;
|
|
477
|
+
recipient = bobAddress;
|
|
478
|
+
return [4 /*yield*/, firma.Gov.getGasEstimationSubmitCommunityPoolSpendProposal(aliceWallet, title, description, initialDepositFCT, amountFCT, recipient)];
|
|
479
|
+
case 1:
|
|
480
|
+
gas = _a.sent();
|
|
481
|
+
chai_1.expect(gas).to.not.equal(0);
|
|
482
|
+
return [2 /*return*/];
|
|
483
|
+
}
|
|
484
|
+
});
|
|
485
|
+
}); });
|
|
486
|
+
it.skip("7-3. Gov submitParameterChangeProposal gas estimation", function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
487
|
+
var initialDepositFCT, title, description, changeParamList, gas;
|
|
488
|
+
return __generator(this, function (_a) {
|
|
489
|
+
switch (_a.label) {
|
|
490
|
+
case 0:
|
|
491
|
+
initialDepositFCT = 10;
|
|
492
|
+
title = "Parameter Change proposal1";
|
|
493
|
+
description = "This is a Parameter change proposal";
|
|
494
|
+
changeParamList = [{
|
|
495
|
+
subspace: "staking",
|
|
496
|
+
key: "MaxValidators",
|
|
497
|
+
value: "100",
|
|
498
|
+
}];
|
|
499
|
+
return [4 /*yield*/, firma.Gov.getGasEstimationSubmitParameterChangeProposal(aliceWallet, title, description, initialDepositFCT, changeParamList)];
|
|
500
|
+
case 1:
|
|
501
|
+
gas = _a.sent();
|
|
502
|
+
chai_1.expect(gas).to.not.equal(0);
|
|
503
|
+
return [2 /*return*/];
|
|
504
|
+
}
|
|
505
|
+
});
|
|
506
|
+
}); });
|
|
507
|
+
it.skip("7-4. Gov submitSoftwareUpgradeProposalByHeight gas estimation", function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
508
|
+
var initialDepositFCT, title, description, upgradeName, upgradeHeight, gas;
|
|
509
|
+
return __generator(this, function (_a) {
|
|
510
|
+
switch (_a.label) {
|
|
511
|
+
case 0:
|
|
512
|
+
initialDepositFCT = 10000;
|
|
513
|
+
title = "Software Upgrade proposal1";
|
|
514
|
+
description = "This is a software upgrade proposal";
|
|
515
|
+
upgradeName = "v0.2.7";
|
|
516
|
+
upgradeHeight = 20000000;
|
|
517
|
+
return [4 /*yield*/, firma.Gov.getGasEstimationSubmitSoftwareUpgradeProposalByHeight(aliceWallet, title, description, initialDepositFCT, upgradeName, upgradeHeight)];
|
|
518
|
+
case 1:
|
|
519
|
+
gas = _a.sent();
|
|
520
|
+
chai_1.expect(gas).to.not.equal(0);
|
|
521
|
+
return [2 /*return*/];
|
|
522
|
+
}
|
|
523
|
+
});
|
|
524
|
+
}); });
|
|
525
|
+
it.skip("7-5. Gov submitCancelSoftwareUpgradeProposal gas estimation", function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
526
|
+
var initialDepositFCT, title, description, gas;
|
|
527
|
+
return __generator(this, function (_a) {
|
|
528
|
+
switch (_a.label) {
|
|
529
|
+
case 0:
|
|
530
|
+
initialDepositFCT = 1000;
|
|
531
|
+
title = "Software Upgrade proposal1";
|
|
532
|
+
description = "This is a software upgrade proposal";
|
|
533
|
+
return [4 /*yield*/, firma.Gov.getGasEstimationSubmitCancelSoftwareUpgradeProposal(aliceWallet, title, description, initialDepositFCT)];
|
|
534
|
+
case 1:
|
|
535
|
+
gas = _a.sent();
|
|
536
|
+
chai_1.expect(gas).to.not.equal(0);
|
|
537
|
+
return [2 /*return*/];
|
|
538
|
+
}
|
|
539
|
+
});
|
|
540
|
+
}); });
|
|
541
|
+
it.skip("7-6. Gov deposit gas estimation", function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
542
|
+
var proposalId, amount, gas;
|
|
543
|
+
return __generator(this, function (_a) {
|
|
544
|
+
switch (_a.label) {
|
|
545
|
+
case 0:
|
|
546
|
+
proposalId = 1;
|
|
547
|
+
amount = 1000;
|
|
548
|
+
return [4 /*yield*/, firma.Gov.getGasEstimationDeposit(aliceWallet, proposalId, amount)];
|
|
549
|
+
case 1:
|
|
550
|
+
gas = _a.sent();
|
|
551
|
+
chai_1.expect(gas).to.not.equal(0);
|
|
552
|
+
return [2 /*return*/];
|
|
553
|
+
}
|
|
554
|
+
});
|
|
555
|
+
}); });
|
|
556
|
+
it.skip("7-7. Gov vote gas estimation", function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
557
|
+
var proposalId, gas;
|
|
558
|
+
return __generator(this, function (_a) {
|
|
559
|
+
switch (_a.label) {
|
|
560
|
+
case 0:
|
|
561
|
+
proposalId = 1;
|
|
562
|
+
return [4 /*yield*/, firma.Gov.getGasEstimationVote(aliceWallet, proposalId, common_1.VotingOption.VOTE_OPTION_YES)];
|
|
563
|
+
case 1:
|
|
564
|
+
gas = _a.sent();
|
|
565
|
+
chai_1.expect(gas).to.not.equal(0);
|
|
566
|
+
return [2 /*return*/];
|
|
567
|
+
}
|
|
568
|
+
});
|
|
569
|
+
}); });
|
|
570
|
+
it("8-1. Token createToken gas estimation", function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
571
|
+
var tokenName, symbol, tokenURI, totalSupply, decimal, mintable, burnable, gas;
|
|
572
|
+
return __generator(this, function (_a) {
|
|
573
|
+
switch (_a.label) {
|
|
574
|
+
case 0:
|
|
575
|
+
tokenName = "KOMX TOKEN";
|
|
576
|
+
symbol = "KOMX63232";
|
|
577
|
+
tokenURI = "https://naver.com";
|
|
578
|
+
totalSupply = 10000;
|
|
579
|
+
decimal = 6;
|
|
580
|
+
mintable = true;
|
|
581
|
+
burnable = true;
|
|
582
|
+
return [4 /*yield*/, firma.Token.getGasEstimationCreateToken(aliceWallet, tokenName, symbol, tokenURI, totalSupply, decimal, mintable, burnable)];
|
|
583
|
+
case 1:
|
|
584
|
+
gas = _a.sent();
|
|
585
|
+
chai_1.expect(gas).to.not.equal(0);
|
|
586
|
+
return [2 /*return*/];
|
|
587
|
+
}
|
|
588
|
+
});
|
|
589
|
+
}); });
|
|
590
|
+
it("8-2. Token mint gas estimation", function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
591
|
+
var timeStamp, tokenName, symbol, tokenURI, totalSupply, decimal, mintable, burnable, createResult, tokenID, amount, gas;
|
|
592
|
+
return __generator(this, function (_a) {
|
|
593
|
+
switch (_a.label) {
|
|
594
|
+
case 0:
|
|
595
|
+
timeStamp = Math.round(+new Date() / 1000);
|
|
596
|
+
tokenName = "KOMX TOKEN" + timeStamp;
|
|
597
|
+
symbol = "KOMX" + timeStamp;
|
|
598
|
+
tokenURI = "https://naver.com";
|
|
599
|
+
totalSupply = 10000;
|
|
600
|
+
decimal = 6;
|
|
601
|
+
mintable = true;
|
|
602
|
+
burnable = true;
|
|
603
|
+
return [4 /*yield*/, firma.Token.createToken(aliceWallet, tokenName, symbol, tokenURI, totalSupply, decimal, mintable, burnable)];
|
|
604
|
+
case 1:
|
|
605
|
+
createResult = _a.sent();
|
|
606
|
+
chai_1.expect(createResult.code).to.equal(0);
|
|
607
|
+
tokenID = "ukomx" + timeStamp;
|
|
608
|
+
amount = 10000;
|
|
609
|
+
return [4 /*yield*/, firma.Token.getGasEstimationMint(aliceWallet, tokenID, amount, decimal, bobAddress)];
|
|
610
|
+
case 2:
|
|
611
|
+
gas = _a.sent();
|
|
612
|
+
chai_1.expect(gas).to.not.equal(0);
|
|
613
|
+
return [2 /*return*/];
|
|
614
|
+
}
|
|
615
|
+
});
|
|
616
|
+
}); });
|
|
617
|
+
it("8-3. Token burn gas estimation", function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
618
|
+
var timeStamp, tokenName, symbol, tokenURI, totalSupply, decimal, mintable, burnable, createResult, tokenID, amount, mintResult, gas;
|
|
619
|
+
return __generator(this, function (_a) {
|
|
620
|
+
switch (_a.label) {
|
|
621
|
+
case 0:
|
|
622
|
+
timeStamp = Math.round(+new Date() / 1000);
|
|
623
|
+
tokenName = "KOMX TOKEN" + timeStamp;
|
|
624
|
+
symbol = "KOMX" + timeStamp;
|
|
625
|
+
tokenURI = "https://naver.com";
|
|
626
|
+
totalSupply = 10000;
|
|
627
|
+
decimal = 6;
|
|
628
|
+
mintable = true;
|
|
629
|
+
burnable = true;
|
|
630
|
+
return [4 /*yield*/, firma.Token.createToken(aliceWallet, tokenName, symbol, tokenURI, totalSupply, decimal, mintable, burnable)];
|
|
631
|
+
case 1:
|
|
632
|
+
createResult = _a.sent();
|
|
633
|
+
chai_1.expect(createResult.code).to.equal(0);
|
|
634
|
+
tokenID = "ukomx" + timeStamp;
|
|
635
|
+
amount = 10;
|
|
636
|
+
return [4 /*yield*/, firma.Token.mint(aliceWallet, tokenID, amount, decimal, bobAddress)];
|
|
637
|
+
case 2:
|
|
638
|
+
mintResult = _a.sent();
|
|
639
|
+
chai_1.expect(mintResult.code).to.equal(0);
|
|
640
|
+
return [4 /*yield*/, firma.Token.getGasEstimationBurn(aliceWallet, tokenID, amount, decimal)];
|
|
641
|
+
case 3:
|
|
642
|
+
gas = _a.sent();
|
|
643
|
+
chai_1.expect(gas).to.not.equal(0);
|
|
644
|
+
return [2 /*return*/];
|
|
645
|
+
}
|
|
646
|
+
});
|
|
647
|
+
}); });
|
|
648
|
+
it("8-4. Token updateTokenURI gas estimation", function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
649
|
+
var timeStamp, tokenName, symbol, tokenURI, totalSupply, decimal, mintable, burnable, createResult, tokenID, newTokenURI, gas;
|
|
650
|
+
return __generator(this, function (_a) {
|
|
651
|
+
switch (_a.label) {
|
|
652
|
+
case 0:
|
|
653
|
+
timeStamp = Math.round(+new Date() / 1000);
|
|
654
|
+
tokenName = "KOMX TOKEN" + timeStamp;
|
|
655
|
+
symbol = "KOMX" + timeStamp;
|
|
656
|
+
tokenURI = "https://naver.com";
|
|
657
|
+
totalSupply = 10000;
|
|
658
|
+
decimal = 6;
|
|
659
|
+
mintable = true;
|
|
660
|
+
burnable = true;
|
|
661
|
+
return [4 /*yield*/, firma.Token.createToken(aliceWallet, tokenName, symbol, tokenURI, totalSupply, decimal, mintable, burnable)];
|
|
662
|
+
case 1:
|
|
663
|
+
createResult = _a.sent();
|
|
664
|
+
chai_1.expect(createResult.code).to.equal(0);
|
|
665
|
+
tokenID = "ukomx" + timeStamp;
|
|
666
|
+
newTokenURI = "https://firmachain.org";
|
|
667
|
+
return [4 /*yield*/, firma.Token.getGasEstimationUpdateTokenURI(aliceWallet, tokenID, newTokenURI)];
|
|
668
|
+
case 2:
|
|
669
|
+
gas = _a.sent();
|
|
670
|
+
chai_1.expect(gas).to.not.equal(0);
|
|
671
|
+
return [2 /*return*/];
|
|
672
|
+
}
|
|
673
|
+
});
|
|
674
|
+
}); });
|
|
675
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|