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