UNPKG

@firmachain/firma-js

Version:

The Official FirmaChain Javascript SDK written in Typescript

704 lines (703 loc) 37 kB
"use strict"; var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } return new (P || (P = Promise))(function (resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; var __generator = (this && this.__generator) || function (thisArg, body) { var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; function verb(n) { return function (v) { return step([n, v]); }; } function step(op) { if (f) throw new TypeError("Generator is already executing."); while (_) try { 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; if (y = 0, t) op = [op[0] & 2, t.value]; switch (op[0]) { case 0: case 1: t = op; break; case 4: _.label++; return { value: op[1], done: false }; case 5: _.label++; y = op[1]; op = [0]; continue; case 7: op = _.ops.pop(); _.trys.pop(); continue; default: if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } if (t[2]) _.ops.pop(); _.trys.pop(); continue; } op = body.call(thisArg, _); } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; } }; Object.defineProperty(exports, "__esModule", { value: true }); var FirmaSDK_1 = require("../sdk/FirmaSDK"); var FirmaUtil_1 = require("../sdk/FirmaUtil"); var config_test_1 = require("./config_test"); var common_1 = require("../sdk/firmachain/common"); describe.skip('[08. Gas Estimation Test]', function () { var firma; beforeEach(function () { firma = new FirmaSDK_1.FirmaSDK(config_test_1.TestChainConfig); }); it("1-1. bank send gas estimation", function () { return __awaiter(void 0, void 0, void 0, function () { var wallet, targetWallet, amount, gas, _a, _b, _c, error_1; return __generator(this, function (_d) { switch (_d.label) { case 0: return [4 /*yield*/, firma.Wallet.fromMnemonic(config_test_1.aliceMnemonic)]; case 1: wallet = _d.sent(); return [4 /*yield*/, firma.Wallet.fromMnemonic(config_test_1.bobMnemonic)]; case 2: targetWallet = _d.sent(); amount = 1; _d.label = 3; case 3: _d.trys.push([3, 6, , 7]); _b = (_a = firma.Bank).getGasEstimationSend; _c = [wallet]; return [4 /*yield*/, targetWallet.getAddress()]; case 4: return [4 /*yield*/, _b.apply(_a, _c.concat([_d.sent(), amount]))]; case 5: gas = _d.sent(); console.log("estimateGas : " + gas); return [3 /*break*/, 7]; case 6: error_1 = _d.sent(); console.log(error_1); return [3 /*break*/, 7]; case 7: return [2 /*return*/]; } }); }); }); it("1-2. bank sendToken gas estimation", function () { return __awaiter(void 0, void 0, void 0, function () { var wallet, targetWallet, amount, tokenID, decimal, gas, _a, _b, _c, error_2; return __generator(this, function (_d) { switch (_d.label) { case 0: return [4 /*yield*/, firma.Wallet.fromMnemonic(config_test_1.aliceMnemonic)]; case 1: wallet = _d.sent(); return [4 /*yield*/, firma.Wallet.fromMnemonic(config_test_1.bobMnemonic)]; case 2: targetWallet = _d.sent(); amount = 1; tokenID = "ukomx"; decimal = 6; _d.label = 3; case 3: _d.trys.push([3, 6, , 7]); _b = (_a = firma.Bank).getGasEstimationSendToken; _c = [wallet]; return [4 /*yield*/, targetWallet.getAddress()]; case 4: return [4 /*yield*/, _b.apply(_a, _c.concat([_d.sent(), tokenID, amount, decimal]))]; case 5: gas = _d.sent(); console.log("estimateGas : " + gas); return [3 /*break*/, 7]; case 6: error_2 = _d.sent(); console.log(error_2); return [3 /*break*/, 7]; case 7: return [2 /*return*/]; } }); }); }); it("2-1. Contract addContractLog getGasEstimationFromUnSignedTxList gas estimation", function () { return __awaiter(void 0, void 0, void 0, function () { var wallet, contractHash, timeStamp, eventName, ownerAddress, jsonString, tx1, gas; return __generator(this, function (_a) { switch (_a.label) { case 0: return [4 /*yield*/, firma.Wallet.fromMnemonic(config_test_1.aliceMnemonic)]; case 1: wallet = _a.sent(); contractHash = "0xsalkdjfasldkjf2"; timeStamp = Math.round(+new Date() / 1000); ; eventName = "CreateContract"; return [4 /*yield*/, wallet.getAddress()]; case 2: ownerAddress = _a.sent(); jsonString = "{}"; return [4 /*yield*/, firma.Contract.getUnsignedTxAddContractLog(wallet, contractHash, timeStamp, eventName, ownerAddress, jsonString)]; case 3: tx1 = _a.sent(); return [4 /*yield*/, firma.Contract.getGasEstimationFromUnSignedTxList(wallet, [tx1, tx1, tx1, tx1, tx1])]; case 4: gas = _a.sent(); console.log("estimateGas : " + gas); return [2 /*return*/]; } }); }); }); it("2-2. Contract addContractLog gas estimation", function () { return __awaiter(void 0, void 0, void 0, function () { var wallet, contractHash, timeStamp, eventName, ownerAddress, jsonString, gas; return __generator(this, function (_a) { switch (_a.label) { case 0: return [4 /*yield*/, firma.Wallet.fromMnemonic(config_test_1.aliceMnemonic)]; case 1: wallet = _a.sent(); contractHash = "0xsalkdjfasldkjf2"; timeStamp = Math.round(+new Date() / 1000); ; eventName = "CreateContract"; return [4 /*yield*/, wallet.getAddress()]; case 2: ownerAddress = _a.sent(); jsonString = "{}"; return [4 /*yield*/, firma.Contract.getGasEstimationAddContractLog(wallet, contractHash, timeStamp, eventName, ownerAddress, jsonString)]; case 3: gas = _a.sent(); console.log("estimateGas : " + gas); return [2 /*return*/]; } }); }); }); it("2-3. Contract createContractFile gas estimation", function () { return __awaiter(void 0, void 0, void 0, function () { var wallet, timeStamp, fileHash, ownerAddress, ownerList, jsonString, gas; return __generator(this, function (_a) { switch (_a.label) { case 0: return [4 /*yield*/, firma.Wallet.fromMnemonic(config_test_1.aliceMnemonic)]; case 1: wallet = _a.sent(); timeStamp = Math.round(+new Date() / 1000); fileHash = "0xklsdjflaksjflaksjf" + timeStamp; return [4 /*yield*/, wallet.getAddress()]; case 2: ownerAddress = _a.sent(); ownerList = [ownerAddress, ownerAddress]; jsonString = "{}"; return [4 /*yield*/, firma.Contract.getGasEstimationCreateContractFile(wallet, fileHash, timeStamp, ownerList, jsonString)]; case 3: gas = _a.sent(); console.log("estimateGas : " + gas); return [2 /*return*/]; } }); }); }); it("3-1. NFT Mint gas estimation", function () { return __awaiter(void 0, void 0, void 0, function () { var wallet, gas; return __generator(this, function (_a) { switch (_a.label) { case 0: return [4 /*yield*/, firma.Wallet.fromMnemonic(config_test_1.aliceMnemonic)]; case 1: wallet = _a.sent(); return [4 /*yield*/, firma.Nft.getGasEstimationMint(wallet, "https://naver.com")]; case 2: gas = _a.sent(); console.log("estimateGas : " + gas); return [2 /*return*/]; } }); }); }); it("3-2. NFT Transfer gas estimation", function () { return __awaiter(void 0, void 0, void 0, function () { var wallet, targetWallet, result, jsonData, nftId, gas, _a, _b, _c; return __generator(this, function (_d) { switch (_d.label) { case 0: return [4 /*yield*/, firma.Wallet.fromMnemonic(config_test_1.aliceMnemonic)]; case 1: wallet = _d.sent(); return [4 /*yield*/, firma.Wallet.fromMnemonic(config_test_1.bobMnemonic)]; case 2: targetWallet = _d.sent(); return [4 /*yield*/, firma.Nft.mint(wallet, "https://naver.com")]; case 3: result = _d.sent(); jsonData = JSON.parse(result.rawLog); nftId = jsonData[0]["events"][0]["attributes"][2]["value"]; _b = (_a = firma.Nft).getGasEstimationTransfer; _c = [wallet]; return [4 /*yield*/, targetWallet.getAddress()]; case 4: return [4 /*yield*/, _b.apply(_a, _c.concat([_d.sent(), nftId]))]; case 5: gas = _d.sent(); console.log("estimateGas : " + gas); return [2 /*return*/]; } }); }); }); it("3-3. NFT Burn gas estimation", function () { return __awaiter(void 0, void 0, void 0, function () { var wallet, result, jsonData, nftId, gas; return __generator(this, function (_a) { switch (_a.label) { case 0: return [4 /*yield*/, firma.Wallet.fromMnemonic(config_test_1.aliceMnemonic)]; case 1: wallet = _a.sent(); return [4 /*yield*/, firma.Nft.mint(wallet, "https://naver.com")]; case 2: result = _a.sent(); jsonData = JSON.parse(result.rawLog); nftId = jsonData[0]["events"][0]["attributes"][2]["value"]; return [4 /*yield*/, firma.Nft.getGasEstimationBurn(wallet, nftId)]; case 3: gas = _a.sent(); console.log("estimateGas : " + gas); return [2 /*return*/]; } }); }); }); it.skip("4-1. Feegrant GrantPeriodicAllowance gas estimation", function () { return __awaiter(void 0, void 0, void 0, function () { var aliceWallet, bobWallet, spendLimit, expirationDate, periodicAllowanceData, gas, _a, _b, _c; return __generator(this, function (_d) { switch (_d.label) { case 0: return [4 /*yield*/, firma.Wallet.fromMnemonic(config_test_1.aliceMnemonic)]; case 1: aliceWallet = _d.sent(); return [4 /*yield*/, firma.Wallet.fromMnemonic(config_test_1.bobMnemonic)]; case 2: bobWallet = _d.sent(); spendLimit = 200000; expirationDate = new Date(); expirationDate.setMinutes(expirationDate.getMinutes() + 2); periodicAllowanceData = { // basicSpendLimit: undefined, // basicExpiration: undefined, periodSeconds: 30, periodSpendLimit: 2000, periodCanSpend: 10000, periodReset: expirationDate }; _b = (_a = firma.FeeGrant).getGasEstimationGrantPeriodicAllowance; _c = [aliceWallet]; return [4 /*yield*/, bobWallet.getAddress()]; case 3: return [4 /*yield*/, _b.apply(_a, _c.concat([_d.sent(), periodicAllowanceData]))]; case 4: gas = _d.sent(); console.log("estimateGas : " + gas); return [2 /*return*/]; } }); }); }); it.skip("4-2. Feegrant GrantBasicAllowance gas estimation", function () { return __awaiter(void 0, void 0, void 0, function () { var aliceWallet, bobWallet, gas, _a, _b, _c; return __generator(this, function (_d) { switch (_d.label) { case 0: return [4 /*yield*/, firma.Wallet.fromMnemonic(config_test_1.aliceMnemonic)]; case 1: aliceWallet = _d.sent(); return [4 /*yield*/, firma.Wallet.fromMnemonic(config_test_1.bobMnemonic)]; case 2: bobWallet = _d.sent(); _b = (_a = firma.FeeGrant).getGasEstimationGrantBasicAllowance; _c = [aliceWallet]; return [4 /*yield*/, bobWallet.getAddress()]; case 3: return [4 /*yield*/, _b.apply(_a, _c.concat([_d.sent()]))]; case 4: gas = _d.sent(); console.log("estimateGas : " + gas); return [2 /*return*/]; } }); }); }); it("4-3. Feegrant revokeAllowance gas estimation", function () { return __awaiter(void 0, void 0, void 0, function () { var aliceWallet, bobWallet, gas, _a, _b, _c; return __generator(this, function (_d) { switch (_d.label) { case 0: return [4 /*yield*/, firma.Wallet.fromMnemonic(config_test_1.aliceMnemonic)]; case 1: aliceWallet = _d.sent(); return [4 /*yield*/, firma.Wallet.fromMnemonic(config_test_1.bobMnemonic)]; case 2: bobWallet = _d.sent(); _b = (_a = firma.FeeGrant).getGasEstimationRevokeAllowance; _c = [aliceWallet]; return [4 /*yield*/, bobWallet.getAddress()]; case 3: return [4 /*yield*/, _b.apply(_a, _c.concat([_d.sent()]))]; case 4: gas = _d.sent(); console.log("estimateGas : " + gas); return [2 /*return*/]; } }); }); }); // var result = await firma.Staking.delegate(wallet, validatorAddress, amountFCT); // var result = await firma.Staking.undelegate(wallet, validatorAddress, amount); //let result1 = await firma.Staking.redelegate(wallet, srcValidatorAddress, dstValidatorAddress, amount,{ gas: 300000, fee: 3000 }); it("5-1. Staking delegate gas estimation", function () { return __awaiter(void 0, void 0, void 0, function () { var wallet, validatorWallet, validatorAddress, _a, _b, amountFCT, gas; return __generator(this, function (_c) { switch (_c.label) { case 0: return [4 /*yield*/, firma.Wallet.fromMnemonic(config_test_1.aliceMnemonic)]; case 1: wallet = _c.sent(); return [4 /*yield*/, firma.Wallet.fromMnemonic(config_test_1.validatorMnemonic)]; case 2: validatorWallet = _c.sent(); _b = (_a = FirmaUtil_1.FirmaUtil).getValOperAddressFromAccAddress; return [4 /*yield*/, validatorWallet.getAddress()]; case 3: validatorAddress = _b.apply(_a, [_c.sent()]); amountFCT = 60; return [4 /*yield*/, firma.Staking.getGasEstimationDelegate(wallet, validatorAddress, amountFCT)]; case 4: gas = _c.sent(); console.log("estimateGas : " + gas); return [2 /*return*/]; } }); }); }); it("5-2. Staking undelegate gas estimation", function () { return __awaiter(void 0, void 0, void 0, function () { var wallet, validatorWallet, validatorAddress, _a, _b, amount, gas; return __generator(this, function (_c) { switch (_c.label) { case 0: return [4 /*yield*/, firma.Wallet.fromMnemonic(config_test_1.aliceMnemonic)]; case 1: wallet = _c.sent(); return [4 /*yield*/, firma.Wallet.fromMnemonic(config_test_1.validatorMnemonic)]; case 2: validatorWallet = _c.sent(); _b = (_a = FirmaUtil_1.FirmaUtil).getValOperAddressFromAccAddress; return [4 /*yield*/, validatorWallet.getAddress()]; case 3: validatorAddress = _b.apply(_a, [_c.sent()]); amount = 5; return [4 /*yield*/, firma.Staking.getGasEstimationUndelegate(wallet, validatorAddress, amount)]; case 4: gas = _c.sent(); console.log("estimateGas : " + gas); return [2 /*return*/]; } }); }); }); it("5-3. Staking redelegate gas estimation", function () { return __awaiter(void 0, void 0, void 0, function () { var wallet, validatorList, srcValidatorAddress, dstValidatorAddress, amount, gas, error_3; return __generator(this, function (_a) { switch (_a.label) { case 0: return [4 /*yield*/, firma.Wallet.fromMnemonic(config_test_1.aliceMnemonic)]; case 1: wallet = _a.sent(); return [4 /*yield*/, firma.Staking.getValidatorList()]; case 2: validatorList = (_a.sent()).dataList; if (validatorList.length < 2) return [2 /*return*/]; srcValidatorAddress = validatorList[0].operator_address; dstValidatorAddress = validatorList[1].operator_address; amount = 10; _a.label = 3; case 3: _a.trys.push([3, 5, , 6]); return [4 /*yield*/, firma.Staking.getGasEstimationRedelegate(wallet, srcValidatorAddress, dstValidatorAddress, amount, { gas: 300000, fee: 30000 })]; case 4: gas = _a.sent(); console.log("estimateGas : " + gas); return [3 /*break*/, 6]; case 5: error_3 = _a.sent(); console.log(error_3); return [3 /*break*/, 6]; case 6: return [2 /*return*/]; } }); }); }); it("6-1. Distribution withdrawAllRewards gas estimation", function () { return __awaiter(void 0, void 0, void 0, function () { var wallet, delegationList, _a, _b, validatorAddress, gas; return __generator(this, function (_c) { switch (_c.label) { case 0: return [4 /*yield*/, firma.Wallet.fromMnemonic(config_test_1.aliceMnemonic)]; case 1: wallet = _c.sent(); _b = (_a = firma.Staking).getTotalDelegationInfo; return [4 /*yield*/, wallet.getAddress()]; case 2: return [4 /*yield*/, _b.apply(_a, [_c.sent()])]; case 3: return [4 /*yield*/, (_c.sent()).dataList]; case 4: delegationList = (_c.sent()); validatorAddress = delegationList[0].delegation.validator_address; return [4 /*yield*/, firma.Distribution.getGasEstimationWithdrawAllRewards(wallet, validatorAddress)]; case 5: gas = _c.sent(); console.log("estimateGas : " + gas); return [2 /*return*/]; } }); }); }); it("6-2. Distribution withdrawValidatorCommission gas estimation", function () { return __awaiter(void 0, void 0, void 0, function () { var wallet, address, validatorAddress, gas; return __generator(this, function (_a) { switch (_a.label) { case 0: return [4 /*yield*/, firma.Wallet.fromMnemonic(config_test_1.validatorMnemonic)]; case 1: wallet = _a.sent(); return [4 /*yield*/, wallet.getAddress()]; case 2: address = _a.sent(); validatorAddress = FirmaUtil_1.FirmaUtil.getValOperAddressFromAccAddress(address); return [4 /*yield*/, firma.Distribution.getGasEstimationWithdrawValidatorCommission(wallet, validatorAddress)]; case 3: gas = _a.sent(); console.log("estimateGas : " + gas); return [2 /*return*/]; } }); }); }); it("6-3. Distribution fundCommunityPool gas estimation", function () { return __awaiter(void 0, void 0, void 0, function () { var wallet, amount, gas; return __generator(this, function (_a) { switch (_a.label) { case 0: return [4 /*yield*/, firma.Wallet.fromMnemonic(config_test_1.validatorMnemonic)]; case 1: wallet = _a.sent(); amount = 1; return [4 /*yield*/, firma.Distribution.getGasEstimationFundCommunityPool(wallet, amount)]; case 2: gas = _a.sent(); console.log("estimateGas : " + gas); return [2 /*return*/]; } }); }); }); it("6-4. Distribution setWithdrawAddress gas estimation", function () { return __awaiter(void 0, void 0, void 0, function () { var aliceWallet, bobWallet, gas, _a, _b, _c; return __generator(this, function (_d) { switch (_d.label) { case 0: return [4 /*yield*/, firma.Wallet.fromMnemonic(config_test_1.aliceMnemonic)]; case 1: aliceWallet = _d.sent(); return [4 /*yield*/, firma.Wallet.fromMnemonic(config_test_1.bobMnemonic)]; case 2: bobWallet = _d.sent(); _b = (_a = firma.Distribution).getGasEstimationSetWithdrawAddress; _c = [aliceWallet]; return [4 /*yield*/, bobWallet.getAddress()]; case 3: return [4 /*yield*/, _b.apply(_a, _c.concat([_d.sent()]))]; case 4: gas = _d.sent(); console.log("estimateGas : " + gas); return [2 /*return*/]; } }); }); }); // var result = await firma.Gov.submitTextProposal(wallet, title, description, initialDepositFCT); // var result = await firma.Gov.submitCommunityPoolSpendProposal(aliceWallet, title, description, initialDepositFCT, amount, recipient); // var result = await firma.Gov.submitParameterChangeProposal(aliceWallet, title, description, initialDepositFCT, changeParamList); // var result = await firma.Gov.submitSoftwareUpgradeProposalByHeight(aliceWallet, title, description, initialDepositFCT, upgradeName, upgradeHeight); // var result = await firma.Gov.submitCancelSoftwareUpgradeProposal(aliceWallet, title, description, initialDepositFCT); // var result = await firma.Gov.deposit(wallet, proposalId, amount); // var result = await firma.Gov.vote(wallet, proposalId, VotingOption.VOTE_OPTION_YES); it("7-1. Gov submitTextProposal gas estimation", function () { return __awaiter(void 0, void 0, void 0, function () { var wallet, initialDepositFCT, title, description, result, gas; return __generator(this, function (_a) { switch (_a.label) { case 0: return [4 /*yield*/, firma.Wallet.fromMnemonic(config_test_1.aliceMnemonic)]; case 1: wallet = _a.sent(); initialDepositFCT = 10; title = "test submit proposal"; description = "test description"; return [4 /*yield*/, firma.Gov.submitTextProposal(wallet, title, description, initialDepositFCT)]; case 2: result = _a.sent(); return [4 /*yield*/, firma.Gov.getGasEstimationSubmitTextProposal(wallet, title, description, initialDepositFCT)]; case 3: gas = _a.sent(); console.log("estimateGas : " + gas); return [2 /*return*/]; } }); }); }); it("7-2. Gov submitCommunityPoolSpendProposal gas estimation", function () { return __awaiter(void 0, void 0, void 0, function () { var aliceWallet, bobWallet, initialDepositFCT, title, description, amount, recipient, gas; return __generator(this, function (_a) { switch (_a.label) { case 0: return [4 /*yield*/, firma.Wallet.fromMnemonic(config_test_1.aliceMnemonic)]; case 1: aliceWallet = _a.sent(); return [4 /*yield*/, firma.Wallet.fromMnemonic(config_test_1.bobMnemonic)]; case 2: bobWallet = _a.sent(); initialDepositFCT = 10; title = "Community spend proposal1"; description = "This is a community spend proposal"; amount = 1000; return [4 /*yield*/, bobWallet.getAddress()]; case 3: recipient = _a.sent(); return [4 /*yield*/, firma.Gov.getGasEstimationSubmitCommunityPoolSpendProposal(aliceWallet, title, description, initialDepositFCT, amount, recipient)]; case 4: gas = _a.sent(); console.log("estimateGas : " + gas); return [2 /*return*/]; } }); }); }); it("7-3. Gov submitParameterChangeProposal gas estimation", function () { return __awaiter(void 0, void 0, void 0, function () { var aliceWallet, initialDepositFCT, title, description, changeParamList, gas; return __generator(this, function (_a) { switch (_a.label) { case 0: return [4 /*yield*/, firma.Wallet.fromMnemonic(config_test_1.aliceMnemonic)]; case 1: aliceWallet = _a.sent(); initialDepositFCT = 10; title = "Parameter Change proposal1"; description = "This is a Parameter change proposal"; changeParamList = [{ subspace: "staking", key: "MaxValidators", value: "100", }]; return [4 /*yield*/, firma.Gov.getGasEstimationSubmitParameterChangeProposal(aliceWallet, title, description, initialDepositFCT, changeParamList)]; case 2: gas = _a.sent(); console.log("estimateGas : " + gas); return [2 /*return*/]; } }); }); }); it("7-4. Gov submitSoftwareUpgradeProposalByHeight gas estimation", function () { return __awaiter(void 0, void 0, void 0, function () { var aliceWallet, initialDepositFCT, title, description, upgradeName, upgradeHeight, gas; return __generator(this, function (_a) { switch (_a.label) { case 0: return [4 /*yield*/, firma.Wallet.fromMnemonic(config_test_1.aliceMnemonic)]; case 1: aliceWallet = _a.sent(); initialDepositFCT = 10000; title = "Software Upgrade proposal1"; description = "This is a software upgrade proposal"; upgradeName = "v0.2.7"; upgradeHeight = 20000000; return [4 /*yield*/, firma.Gov.getGasEstimationSubmitSoftwareUpgradeProposalByHeight(aliceWallet, title, description, initialDepositFCT, upgradeName, upgradeHeight)]; case 2: gas = _a.sent(); console.log("estimateGas : " + gas); return [2 /*return*/]; } }); }); }); it("7-5. Gov submitCancelSoftwareUpgradeProposal gas estimation", function () { return __awaiter(void 0, void 0, void 0, function () { var aliceWallet, initialDepositFCT, title, description, gas; return __generator(this, function (_a) { switch (_a.label) { case 0: return [4 /*yield*/, firma.Wallet.fromMnemonic(config_test_1.aliceMnemonic)]; case 1: aliceWallet = _a.sent(); initialDepositFCT = 1000; title = "Software Upgrade proposal1"; description = "This is a software upgrade proposal"; return [4 /*yield*/, firma.Gov.getGasEstimationSubmitCancelSoftwareUpgradeProposal(aliceWallet, title, description, initialDepositFCT)]; case 2: gas = _a.sent(); console.log("estimateGas : " + gas); return [2 /*return*/]; } }); }); }); it("7-6. Gov deposit gas estimation", function () { return __awaiter(void 0, void 0, void 0, function () { var wallet, proposalId, amount, result, gas; return __generator(this, function (_a) { switch (_a.label) { case 0: return [4 /*yield*/, firma.Wallet.fromMnemonic(config_test_1.aliceMnemonic)]; case 1: wallet = _a.sent(); proposalId = 1; amount = 1000; return [4 /*yield*/, firma.Gov.deposit(wallet, proposalId, amount)]; case 2: result = _a.sent(); return [4 /*yield*/, firma.Gov.getGasEstimationDeposit(wallet, proposalId, amount)]; case 3: gas = _a.sent(); console.log("estimateGas : " + gas); return [2 /*return*/]; } }); }); }); it("7-7. Gov vote gas estimation", function () { return __awaiter(void 0, void 0, void 0, function () { var wallet, proposalId, gas; return __generator(this, function (_a) { switch (_a.label) { case 0: return [4 /*yield*/, firma.Wallet.fromMnemonic(config_test_1.aliceMnemonic)]; case 1: wallet = _a.sent(); proposalId = 1; return [4 /*yield*/, firma.Gov.getGasEstimationVote(wallet, proposalId, common_1.VotingOption.VOTE_OPTION_YES)]; case 2: gas = _a.sent(); console.log("estimateGas : " + gas); return [2 /*return*/]; } }); }); }); it("8-1. Token createToken gas estimation", function () { return __awaiter(void 0, void 0, void 0, function () { var wallet, tokenName, symbol, tokenURI, totalSupply, decimal, mintable, burnable, gas; return __generator(this, function (_a) { switch (_a.label) { case 0: return [4 /*yield*/, firma.Wallet.fromMnemonic(config_test_1.aliceMnemonic)]; case 1: wallet = _a.sent(); tokenName = "KOMX TOKEN"; symbol = "KOMX63232"; tokenURI = "https://naver.com"; totalSupply = 10000; decimal = 6; mintable = true; burnable = true; return [4 /*yield*/, firma.Token.getGasEstimationCreateToken(wallet, tokenName, symbol, tokenURI, totalSupply, decimal, mintable, burnable)]; case 2: gas = _a.sent(); console.log("estimateGas : " + gas); return [2 /*return*/]; } }); }); }); it("8-2. Token mint gas estimation", function () { return __awaiter(void 0, void 0, void 0, function () { var wallet, bobAddress, tokenID, amount, decimal, gas; return __generator(this, function (_a) { switch (_a.label) { case 0: return [4 /*yield*/, firma.Wallet.fromMnemonic(config_test_1.aliceMnemonic)]; case 1: wallet = _a.sent(); return [4 /*yield*/, firma.Wallet.fromMnemonic(config_test_1.bobMnemonic)]; case 2: return [4 /*yield*/, (_a.sent()).getAddress()]; case 3: bobAddress = _a.sent(); tokenID = "ukomx6"; amount = 10000; decimal = 6; return [4 /*yield*/, firma.Token.getGasEstimationMint(wallet, tokenID, amount, decimal, bobAddress)]; case 4: gas = _a.sent(); console.log("estimateGas : " + gas); return [2 /*return*/]; } }); }); }); it("8-3. Token burn gas estimation", function () { return __awaiter(void 0, void 0, void 0, function () { var wallet, tokenID, amount, decimal, gas; return __generator(this, function (_a) { switch (_a.label) { case 0: return [4 /*yield*/, firma.Wallet.fromMnemonic(config_test_1.aliceMnemonic)]; case 1: wallet = _a.sent(); tokenID = "ukomx6"; amount = 10; decimal = 6; return [4 /*yield*/, firma.Token.getGasEstimationBurn(wallet, tokenID, amount, decimal)]; case 2: gas = _a.sent(); console.log("estimateGas : " + gas); return [2 /*return*/]; } }); }); }); it("8-4. Token updateTokenURI gas estimation", function () { return __awaiter(void 0, void 0, void 0, function () { var wallet, tokenID, tokenURI, gas; return __generator(this, function (_a) { switch (_a.label) { case 0: return [4 /*yield*/, firma.Wallet.fromMnemonic(config_test_1.aliceMnemonic)]; case 1: wallet = _a.sent(); tokenID = "ukomx6"; tokenURI = "https://firmachain.org"; return [4 /*yield*/, firma.Token.getGasEstimationUpdateTokenURI(wallet, tokenID, tokenURI)]; case 2: gas = _a.sent(); console.log("estimateGas : " + gas); return [2 /*return*/]; } }); }); }); });