@firmachain/firma-js 0.3.8 → 0.4.0-beta2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/sdk/FirmaAuthzService.js +20 -15
- package/dist/sdk/FirmaBankService.d.ts +1 -1
- package/dist/sdk/FirmaBankService.js +5 -4
- package/dist/sdk/FirmaConfig.js +4 -4
- package/dist/sdk/FirmaContractService.js +10 -8
- package/dist/sdk/FirmaDistributionService.js +20 -15
- package/dist/sdk/FirmaFeeGrantService.d.ts +0 -1
- package/dist/sdk/FirmaFeeGrantService.js +12 -14
- package/dist/sdk/FirmaGovService.d.ts +14 -0
- package/dist/sdk/FirmaGovService.js +58 -37
- package/dist/sdk/FirmaIbcService.js +4 -3
- package/dist/sdk/FirmaNftService.d.ts +3 -3
- package/dist/sdk/FirmaNftService.js +13 -10
- package/dist/sdk/FirmaStakingService.d.ts +4 -0
- package/dist/sdk/FirmaStakingService.js +58 -33
- package/dist/sdk/FirmaTokenService.js +17 -14
- package/dist/sdk/FirmaUtil.js +1 -1
- package/dist/sdk/FirmaWalletService.d.ts +1 -1
- package/dist/sdk/FirmaWalletService.js +11 -23
- package/dist/sdk/firmachain/authz/AuthzTxClient.js +2 -0
- package/dist/sdk/firmachain/bank/BankTxClient.js +1 -1
- package/dist/sdk/firmachain/common/CommonTxClient.js +3 -1
- package/dist/sdk/firmachain/common/FirmaLedger.d.ts +49 -0
- package/dist/sdk/firmachain/common/FirmaLedger.js +301 -0
- package/dist/sdk/firmachain/common/ITxClient.d.ts +1 -1
- package/dist/sdk/firmachain/common/ITxClient.js +6 -4
- package/dist/sdk/firmachain/common/LedgerWallet.d.ts +5 -13
- package/dist/sdk/firmachain/common/LedgerWallet.js +1266 -124
- package/dist/sdk/firmachain/common/SigningProtobufStargateClient.js +3 -4
- package/dist/sdk/firmachain/common/SigningStargateClient.d.ts +2 -3
- package/dist/sdk/firmachain/common/SigningStargateClient.js +7 -10
- package/dist/sdk/firmachain/common/index.d.ts +1 -0
- package/dist/sdk/firmachain/common/index.js +1 -0
- package/dist/sdk/firmachain/common/signing.d.ts +4 -10
- package/dist/sdk/firmachain/common/signing.js +13 -60
- package/dist/sdk/firmachain/contract/ContractTxClient.js +1 -1
- package/dist/sdk/firmachain/contract/ContractTxTypes.js +54 -8
- package/dist/sdk/firmachain/distribution/DistributionTxClient.js +1 -1
- package/dist/sdk/firmachain/feegrant/FeeGrantTxClient.js +3 -1
- package/dist/sdk/firmachain/feegrant/FeeGrantTxTypes.d.ts +1 -2
- package/dist/sdk/firmachain/google/protobuf/any.js +0 -12
- package/dist/sdk/firmachain/gov/GovTxClient.js +3 -0
- package/dist/sdk/firmachain/nft/NftTxClient.js +1 -1
- package/dist/sdk/firmachain/staking/StakingQueryClient.d.ts +15 -0
- package/dist/sdk/firmachain/staking/StakingQueryClient.js +109 -0
- package/dist/sdk/firmachain/token/TokenTxClient.js +1 -1
- package/package.json +18 -9
- package/dist/test/00.wallet.test.d.ts +0 -1
- package/dist/test/00.wallet.test.js +0 -96
- package/dist/test/01.contract_tx.test.d.ts +0 -1
- package/dist/test/01.contract_tx.test.js +0 -157
- package/dist/test/02.contract_query.test.d.ts +0 -1
- package/dist/test/02.contract_query.test.js +0 -245
- package/dist/test/03.contract_scenario.test.d.ts +0 -1
- package/dist/test/03.contract_scenario.test.js +0 -406
- package/dist/test/04.bank_tx.test.d.ts +0 -1
- package/dist/test/04.bank_tx.test.js +0 -126
- package/dist/test/05.bank_query.test.d.ts +0 -1
- package/dist/test/05.bank_query.test.js +0 -162
- package/dist/test/06.feegrant_tx.test.d.ts +0 -1
- package/dist/test/06.feegrant_tx.test.js +0 -185
- package/dist/test/07.feegrant_query.test.d.ts +0 -1
- package/dist/test/07.feegrant_query.test.js +0 -129
- package/dist/test/08.gas_estimate.test.d.ts +0 -1
- package/dist/test/08.gas_estimate.test.js +0 -728
- package/dist/test/09.ipfs.test.d.ts +0 -1
- package/dist/test/09.ipfs.test.js +0 -72
- package/dist/test/10.nft_tx.test.d.ts +0 -1
- package/dist/test/10.nft_tx.test.js +0 -209
- package/dist/test/11.nft_query.test.d.ts +0 -1
- package/dist/test/11.nft_query.test.js +0 -165
- package/dist/test/12.staking_tx.test.d.ts +0 -1
- package/dist/test/12.staking_tx.test.js +0 -211
- package/dist/test/13.staking_query.test.d.ts +0 -1
- package/dist/test/13.staking_query.test.js +0 -275
- package/dist/test/14.distribution_tx.test.d.ts +0 -1
- package/dist/test/14.distribution_tx.test.js +0 -170
- package/dist/test/15.distribution_query.test.d.ts +0 -1
- package/dist/test/15.distribution_query.test.js +0 -243
- package/dist/test/16.gov_tx.test.d.ts +0 -1
- package/dist/test/16.gov_tx.test.js +0 -394
- package/dist/test/17.gov_query.test.d.ts +0 -1
- package/dist/test/17.gov_query.test.js +0 -181
- package/dist/test/18.util.test.d.ts +0 -1
- package/dist/test/18.util.test.js +0 -354
- package/dist/test/19.chain.test.d.ts +0 -1
- package/dist/test/19.chain.test.js +0 -127
- package/dist/test/20.slashing_query.test.d.ts +0 -1
- package/dist/test/20.slashing_query.test.js +0 -111
- package/dist/test/21.token_tx.test.d.ts +0 -1
- package/dist/test/21.token_tx.test.js +0 -149
- package/dist/test/22.token_query.test.d.ts +0 -1
- package/dist/test/22.token_query.test.js +0 -103
- package/dist/test/23.authz_tx.test.d.ts +0 -1
- package/dist/test/23.authz_tx.test.js +0 -380
- package/dist/test/24.authz_query.test.d.ts +0 -1
- package/dist/test/24.authz_query.test.js +0 -202
- package/dist/test/25.cosmwasm_tx.test.d.ts +0 -1
- package/dist/test/25.cosmwasm_tx.test.js +0 -229
- package/dist/test/26.cosmwasm_query.test.d.ts +0 -1
- package/dist/test/26.cosmwasm_query.test.js +0 -275
- package/dist/test/27.arbitrary_sign.test.d.ts +0 -1
- package/dist/test/27.arbitrary_sign.test.js +0 -162
- package/dist/test/28.ibc_tx.test.d.ts +0 -1
- package/dist/test/28.ibc_tx.test.js +0 -98
- package/dist/test/29.mint_query.test.d.ts +0 -1
- package/dist/test/29.mint_query.test.js +0 -59
- package/dist/test/30.cw20_tx.test.d.ts +0 -1
- package/dist/test/30.cw20_tx.test.js +0 -450
- package/dist/test/31.cw20_query.test.d.ts +0 -1
- package/dist/test/31.cw20_query.test.js +0 -333
- package/dist/test/32.cw721_tx.test.d.ts +0 -1
- package/dist/test/32.cw721_tx.test.js +0 -431
- package/dist/test/33.cw721_query.test.d.ts +0 -1
- package/dist/test/33.cw721_query.test.js +0 -371
- package/dist/test/34.cw_bridge_tx.test.d.ts +0 -1
- package/dist/test/34.cw_bridge_tx.test.js +0 -476
- package/dist/test/35.cw_bridge_tx_low.test.d.ts +0 -1
- package/dist/test/35.cw_bridge_tx_low.test.js +0 -398
- package/dist/test/36.cw_bridge_query.test.d.ts +0 -1
- package/dist/test/36.cw_bridge_query.test.js +0 -318
- package/dist/test/37.cw_marketplace_tx.test.d.ts +0 -1
- package/dist/test/37.cw_marketplace_tx.test.js +0 -794
- package/dist/test/38.cw_marketplace_query.test.d.ts +0 -1
- package/dist/test/38.cw_marketplace_query.test.js +0 -128
- package/dist/test/config_test.d.ts +0 -11
- package/dist/test/config_test.js +0 -26
- package/dist/test/config_test.sample.d.ts +0 -11
- package/dist/test/config_test.sample.js +0 -14
|
@@ -1,728 +0,0 @@
|
|
|
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 (g && (g = 0, op[0] && (_ = 0)), _) 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
|
-
(0, 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".concat(timestamp);
|
|
149
|
-
tokenSymbol = "KOMX".concat(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
|
-
(0, 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
|
-
(0, 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
|
-
(0, 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
|
-
(0, 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
|
-
(0, 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
|
-
(0, 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
|
-
(0, 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
|
-
(0, 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
|
-
(0, 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
|
-
(0, 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
|
-
(0, 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 spendAmount, expirationDate, periodicAllowanceData, gas;
|
|
278
|
-
return __generator(this, function (_a) {
|
|
279
|
-
switch (_a.label) {
|
|
280
|
-
case 0:
|
|
281
|
-
spendAmount = FirmaUtil_1.FirmaUtil.getUFCTStringFromFCTStr("10");
|
|
282
|
-
expirationDate = new Date();
|
|
283
|
-
periodicAllowanceData = {
|
|
284
|
-
basic: {
|
|
285
|
-
spendLimit: [
|
|
286
|
-
{ amount: spendAmount, denom: firma.Config.denom }
|
|
287
|
-
]
|
|
288
|
-
},
|
|
289
|
-
period: { seconds: BigInt(60 * 60 * 24), nanos: 0 },
|
|
290
|
-
periodSpendLimit: [
|
|
291
|
-
{ amount: spendAmount, denom: firma.Config.denom }
|
|
292
|
-
],
|
|
293
|
-
periodCanSpend: [
|
|
294
|
-
{ amount: spendAmount, denom: firma.Config.denom }
|
|
295
|
-
],
|
|
296
|
-
periodReset: {
|
|
297
|
-
seconds: BigInt(Math.floor(expirationDate.getTime() / 1000)),
|
|
298
|
-
nanos: (expirationDate.getTime() % 1000) * 1000000
|
|
299
|
-
}
|
|
300
|
-
};
|
|
301
|
-
return [4 /*yield*/, firma.FeeGrant.getGasEstimationGrantPeriodicAllowance(bobWallet, aliceAddress, periodicAllowanceData)];
|
|
302
|
-
case 1:
|
|
303
|
-
gas = _a.sent();
|
|
304
|
-
(0, chai_1.expect)(gas).to.not.equal(0);
|
|
305
|
-
return [2 /*return*/];
|
|
306
|
-
}
|
|
307
|
-
});
|
|
308
|
-
}); });
|
|
309
|
-
it("4-2. Feegrant GrantBasicAllowance gas estimation", function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
310
|
-
var basicAllowance, gas;
|
|
311
|
-
return __generator(this, function (_a) {
|
|
312
|
-
switch (_a.label) {
|
|
313
|
-
case 0:
|
|
314
|
-
basicAllowance = {
|
|
315
|
-
spendLimit: [
|
|
316
|
-
{ amount: "20000", denom: firma.Config.denom }
|
|
317
|
-
]
|
|
318
|
-
};
|
|
319
|
-
return [4 /*yield*/, firma.FeeGrant.getGasEstimationGrantBasicAllowance(bobWallet, aliceAddress, basicAllowance)];
|
|
320
|
-
case 1:
|
|
321
|
-
gas = _a.sent();
|
|
322
|
-
(0, chai_1.expect)(gas).to.not.equal(0);
|
|
323
|
-
return [2 /*return*/];
|
|
324
|
-
}
|
|
325
|
-
});
|
|
326
|
-
}); });
|
|
327
|
-
it("4-3. Feegrant revokeAllowance gas estimation", function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
328
|
-
var error_1, basicAllowance, result, gas, fee;
|
|
329
|
-
return __generator(this, function (_a) {
|
|
330
|
-
switch (_a.label) {
|
|
331
|
-
case 0:
|
|
332
|
-
_a.trys.push([0, 2, , 3]);
|
|
333
|
-
return [4 /*yield*/, firma.FeeGrant.revokeAllowance(aliceWallet, bobAddress)];
|
|
334
|
-
case 1:
|
|
335
|
-
_a.sent();
|
|
336
|
-
return [3 /*break*/, 3];
|
|
337
|
-
case 2:
|
|
338
|
-
error_1 = _a.sent();
|
|
339
|
-
return [3 /*break*/, 3];
|
|
340
|
-
case 3:
|
|
341
|
-
basicAllowance = {
|
|
342
|
-
spendLimit: [
|
|
343
|
-
{ amount: "20000", denom: firma.Config.denom }
|
|
344
|
-
]
|
|
345
|
-
};
|
|
346
|
-
return [4 /*yield*/, firma.FeeGrant.grantBasicAllowance(aliceWallet, bobAddress, basicAllowance)];
|
|
347
|
-
case 4:
|
|
348
|
-
result = _a.sent();
|
|
349
|
-
(0, chai_1.expect)(result.code).to.equal(0);
|
|
350
|
-
return [4 /*yield*/, firma.FeeGrant.getGasEstimationRevokeAllowance(aliceWallet, bobAddress)];
|
|
351
|
-
case 5:
|
|
352
|
-
gas = _a.sent();
|
|
353
|
-
(0, chai_1.expect)(gas).to.not.equal(0);
|
|
354
|
-
fee = Math.ceil(gas * 0.1);
|
|
355
|
-
return [4 /*yield*/, firma.FeeGrant.revokeAllowance(aliceWallet, bobAddress, { gas: gas, fee: fee })];
|
|
356
|
-
case 6:
|
|
357
|
-
_a.sent();
|
|
358
|
-
return [2 /*return*/];
|
|
359
|
-
}
|
|
360
|
-
});
|
|
361
|
-
}); });
|
|
362
|
-
it("5-1. Staking delegate gas estimation", function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
363
|
-
var amountFCT, gas;
|
|
364
|
-
return __generator(this, function (_a) {
|
|
365
|
-
switch (_a.label) {
|
|
366
|
-
case 0:
|
|
367
|
-
amountFCT = 60;
|
|
368
|
-
return [4 /*yield*/, firma.Staking.getGasEstimationDelegate(aliceWallet, valOperAddress, amountFCT)];
|
|
369
|
-
case 1:
|
|
370
|
-
gas = _a.sent();
|
|
371
|
-
(0, chai_1.expect)(gas).to.not.equal(0);
|
|
372
|
-
return [2 /*return*/];
|
|
373
|
-
}
|
|
374
|
-
});
|
|
375
|
-
}); });
|
|
376
|
-
it("5-2. Staking undelegate gas estimation", function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
377
|
-
var amount, gas;
|
|
378
|
-
return __generator(this, function (_a) {
|
|
379
|
-
switch (_a.label) {
|
|
380
|
-
case 0:
|
|
381
|
-
amount = 5;
|
|
382
|
-
return [4 /*yield*/, firma.Staking.getGasEstimationUndelegate(aliceWallet, valOperAddress, amount)];
|
|
383
|
-
case 1:
|
|
384
|
-
gas = _a.sent();
|
|
385
|
-
(0, chai_1.expect)(gas).to.not.equal(0);
|
|
386
|
-
return [2 /*return*/];
|
|
387
|
-
}
|
|
388
|
-
});
|
|
389
|
-
}); });
|
|
390
|
-
/*
|
|
391
|
-
This test may fail even with a valid call due to the following two reasons:
|
|
392
|
-
- The maximum number of allowed redelegations (7) has been exceeded
|
|
393
|
-
- There are no delegated tokens to the srcValidatorAddress
|
|
394
|
-
*/
|
|
395
|
-
it("5-3. Staking redelegate gas estimation", function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
396
|
-
var validatorList, srcValidatorAddress, dstValidatorAddress, amount, gas;
|
|
397
|
-
return __generator(this, function (_a) {
|
|
398
|
-
switch (_a.label) {
|
|
399
|
-
case 0: return [4 /*yield*/, firma.Staking.getValidatorList()];
|
|
400
|
-
case 1:
|
|
401
|
-
validatorList = (_a.sent()).dataList;
|
|
402
|
-
if (validatorList.length < 2)
|
|
403
|
-
return [2 /*return*/];
|
|
404
|
-
srcValidatorAddress = validatorList[0].operator_address;
|
|
405
|
-
dstValidatorAddress = validatorList[1].operator_address;
|
|
406
|
-
amount = 10;
|
|
407
|
-
return [4 /*yield*/, firma.Staking.getGasEstimationRedelegate(aliceWallet, srcValidatorAddress, dstValidatorAddress, amount, { gas: 300000, fee: 30000 })];
|
|
408
|
-
case 2:
|
|
409
|
-
gas = _a.sent();
|
|
410
|
-
(0, chai_1.expect)(gas).to.not.equal(0);
|
|
411
|
-
return [2 /*return*/];
|
|
412
|
-
}
|
|
413
|
-
});
|
|
414
|
-
}); });
|
|
415
|
-
it("6-1. Distribution withdrawAllRewards gas estimation", function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
416
|
-
var delegationList, validatorAddress, gas;
|
|
417
|
-
return __generator(this, function (_a) {
|
|
418
|
-
switch (_a.label) {
|
|
419
|
-
case 0: return [4 /*yield*/, firma.Staking.getTotalDelegationInfo(aliceAddress)];
|
|
420
|
-
case 1:
|
|
421
|
-
delegationList = (_a.sent()).dataList;
|
|
422
|
-
validatorAddress = delegationList[0].delegation.validator_address;
|
|
423
|
-
return [4 /*yield*/, firma.Distribution.getGasEstimationWithdrawAllRewards(aliceWallet, validatorAddress)];
|
|
424
|
-
case 2:
|
|
425
|
-
gas = _a.sent();
|
|
426
|
-
(0, chai_1.expect)(gas).to.not.equal(0);
|
|
427
|
-
return [2 /*return*/];
|
|
428
|
-
}
|
|
429
|
-
});
|
|
430
|
-
}); });
|
|
431
|
-
it("6-2. Distribution withdrawValidatorCommission gas estimation", function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
432
|
-
var valOperAddress, gas;
|
|
433
|
-
return __generator(this, function (_a) {
|
|
434
|
-
switch (_a.label) {
|
|
435
|
-
case 0:
|
|
436
|
-
valOperAddress = FirmaUtil_1.FirmaUtil.getValOperAddressFromAccAddress(validatorAddress);
|
|
437
|
-
return [4 /*yield*/, firma.Distribution.getGasEstimationWithdrawValidatorCommission(validatorWallet, valOperAddress)];
|
|
438
|
-
case 1:
|
|
439
|
-
gas = _a.sent();
|
|
440
|
-
(0, chai_1.expect)(gas).to.not.equal(0);
|
|
441
|
-
return [2 /*return*/];
|
|
442
|
-
}
|
|
443
|
-
});
|
|
444
|
-
}); });
|
|
445
|
-
it("6-3. Distribution fundCommunityPool gas estimation", function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
446
|
-
var amount, gas;
|
|
447
|
-
return __generator(this, function (_a) {
|
|
448
|
-
switch (_a.label) {
|
|
449
|
-
case 0:
|
|
450
|
-
amount = 1;
|
|
451
|
-
return [4 /*yield*/, firma.Distribution.getGasEstimationFundCommunityPool(validatorWallet, amount)];
|
|
452
|
-
case 1:
|
|
453
|
-
gas = _a.sent();
|
|
454
|
-
(0, chai_1.expect)(gas).to.not.equal(0);
|
|
455
|
-
return [2 /*return*/];
|
|
456
|
-
}
|
|
457
|
-
});
|
|
458
|
-
}); });
|
|
459
|
-
it("6-4. Distribution setWithdrawAddress gas estimation", function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
460
|
-
var gas;
|
|
461
|
-
return __generator(this, function (_a) {
|
|
462
|
-
switch (_a.label) {
|
|
463
|
-
case 0: return [4 /*yield*/, firma.Distribution.getGasEstimationSetWithdrawAddress(aliceWallet, bobAddress)];
|
|
464
|
-
case 1:
|
|
465
|
-
gas = _a.sent();
|
|
466
|
-
(0, chai_1.expect)(gas).to.not.equal(0);
|
|
467
|
-
return [2 /*return*/];
|
|
468
|
-
}
|
|
469
|
-
});
|
|
470
|
-
}); });
|
|
471
|
-
it("7-1. Gov submitTextProposal gas estimation", function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
472
|
-
var initialDepositFCT, title, description, gas, error_2;
|
|
473
|
-
return __generator(this, function (_a) {
|
|
474
|
-
switch (_a.label) {
|
|
475
|
-
case 0:
|
|
476
|
-
initialDepositFCT = 2500;
|
|
477
|
-
title = "test submit proposal";
|
|
478
|
-
description = "test description";
|
|
479
|
-
_a.label = 1;
|
|
480
|
-
case 1:
|
|
481
|
-
_a.trys.push([1, 3, , 4]);
|
|
482
|
-
return [4 /*yield*/, firma.Gov.getGasEstimationSubmitTextProposal(aliceWallet, title, description, initialDepositFCT)];
|
|
483
|
-
case 2:
|
|
484
|
-
gas = _a.sent();
|
|
485
|
-
(0, chai_1.expect)(gas).to.not.equal(0);
|
|
486
|
-
return [3 /*break*/, 4];
|
|
487
|
-
case 3:
|
|
488
|
-
error_2 = _a.sent();
|
|
489
|
-
console.log(error_2);
|
|
490
|
-
return [3 /*break*/, 4];
|
|
491
|
-
case 4: return [2 /*return*/];
|
|
492
|
-
}
|
|
493
|
-
});
|
|
494
|
-
}); });
|
|
495
|
-
it("7-2. Gov submitCommunityPoolSpendProposal gas estimation", function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
496
|
-
var initialDepositFCT, title, summary, amountFCT, recipient, gas;
|
|
497
|
-
return __generator(this, function (_a) {
|
|
498
|
-
switch (_a.label) {
|
|
499
|
-
case 0:
|
|
500
|
-
initialDepositFCT = 2500;
|
|
501
|
-
title = "Community spend proposal";
|
|
502
|
-
summary = "Proposal to spend from community pool";
|
|
503
|
-
amountFCT = 1000;
|
|
504
|
-
recipient = bobAddress;
|
|
505
|
-
return [4 /*yield*/, firma.Gov.getGasEstimationSubmitCommunityPoolSpendProposal(aliceWallet, title, summary, initialDepositFCT, amountFCT, recipient)];
|
|
506
|
-
case 1:
|
|
507
|
-
gas = _a.sent();
|
|
508
|
-
(0, chai_1.expect)(gas).to.not.equal(0);
|
|
509
|
-
return [2 /*return*/];
|
|
510
|
-
}
|
|
511
|
-
});
|
|
512
|
-
}); });
|
|
513
|
-
it("7-3. Gov submitStakingParamsUpdateProposal gas estimation", function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
514
|
-
var initialDepositFCT, title, summary, params, metadata, gas;
|
|
515
|
-
return __generator(this, function (_a) {
|
|
516
|
-
switch (_a.label) {
|
|
517
|
-
case 0:
|
|
518
|
-
initialDepositFCT = 2500;
|
|
519
|
-
title = "Staking parameter change proposal";
|
|
520
|
-
summary = "This is a Staking parameter change proposal";
|
|
521
|
-
return [4 /*yield*/, firma.Staking.getParamsAsStakingParams()];
|
|
522
|
-
case 1:
|
|
523
|
-
params = _a.sent();
|
|
524
|
-
params.maxValidators = 100;
|
|
525
|
-
params.minCommissionRate = FirmaUtil_1.FirmaUtil.processCommissionRateAsDecimal(params.minCommissionRate);
|
|
526
|
-
metadata = "";
|
|
527
|
-
return [4 /*yield*/, firma.Gov.getGasEstimationSubmitStakingParamsUpdateProposal(aliceWallet, title, summary, initialDepositFCT, params, metadata)];
|
|
528
|
-
case 2:
|
|
529
|
-
gas = _a.sent();
|
|
530
|
-
(0, chai_1.expect)(gas).to.not.equal(0);
|
|
531
|
-
return [2 /*return*/];
|
|
532
|
-
}
|
|
533
|
-
});
|
|
534
|
-
}); });
|
|
535
|
-
it("7-4, Gov submitGovParamsUpdateProposal gas estimation", function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
536
|
-
var initialDepositFCT, title, summary, params, metadata, gas;
|
|
537
|
-
return __generator(this, function (_a) {
|
|
538
|
-
switch (_a.label) {
|
|
539
|
-
case 0:
|
|
540
|
-
initialDepositFCT = 5000;
|
|
541
|
-
title = "Gov parameter change proposal";
|
|
542
|
-
summary = "This is a Gov parameter change proposal";
|
|
543
|
-
return [4 /*yield*/, firma.Gov.getParamAsGovParams()];
|
|
544
|
-
case 1:
|
|
545
|
-
params = _a.sent();
|
|
546
|
-
params.burnProposalDepositPrevote = true;
|
|
547
|
-
metadata = "";
|
|
548
|
-
return [4 /*yield*/, firma.Gov.getGasEstimationSubmitGovParamsUpdateProposal(aliceWallet, title, summary, initialDepositFCT, params, metadata)];
|
|
549
|
-
case 2:
|
|
550
|
-
gas = _a.sent();
|
|
551
|
-
(0, chai_1.expect)(gas).to.not.equal(0);
|
|
552
|
-
return [2 /*return*/];
|
|
553
|
-
}
|
|
554
|
-
});
|
|
555
|
-
}); });
|
|
556
|
-
it("7-5. Gov submitSoftwareUpgradeProposal gas estimation", function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
557
|
-
var initialDepositFCT, title, summary, plan, metadata, gas;
|
|
558
|
-
return __generator(this, function (_a) {
|
|
559
|
-
switch (_a.label) {
|
|
560
|
-
case 0:
|
|
561
|
-
initialDepositFCT = 5000;
|
|
562
|
-
title = "Software Upgrade proposal1";
|
|
563
|
-
summary = "This is a software upgrade proposal";
|
|
564
|
-
plan = {
|
|
565
|
-
name: 'v0.5.1',
|
|
566
|
-
time: {
|
|
567
|
-
seconds: BigInt(0),
|
|
568
|
-
nanos: 0
|
|
569
|
-
},
|
|
570
|
-
height: BigInt(1050000),
|
|
571
|
-
info: ''
|
|
572
|
-
};
|
|
573
|
-
metadata = "";
|
|
574
|
-
return [4 /*yield*/, firma.Gov.getGasEstimationSubmitSoftwareUpgradeProposal(aliceWallet, title, summary, initialDepositFCT, plan, metadata)];
|
|
575
|
-
case 1:
|
|
576
|
-
gas = _a.sent();
|
|
577
|
-
(0, chai_1.expect)(gas).to.not.equal(0);
|
|
578
|
-
return [2 /*return*/];
|
|
579
|
-
}
|
|
580
|
-
});
|
|
581
|
-
}); });
|
|
582
|
-
it("7-6. Gov deposit gas estimation", function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
583
|
-
var initialDepositFCT, title, description, result, proposalId, amount, gas;
|
|
584
|
-
return __generator(this, function (_a) {
|
|
585
|
-
switch (_a.label) {
|
|
586
|
-
case 0:
|
|
587
|
-
initialDepositFCT = 2500;
|
|
588
|
-
title = "test submit textProposal(deposit gas)";
|
|
589
|
-
description = "test description";
|
|
590
|
-
return [4 /*yield*/, firma.Gov.submitTextProposal(aliceWallet, title, description, initialDepositFCT)];
|
|
591
|
-
case 1:
|
|
592
|
-
result = _a.sent();
|
|
593
|
-
proposalId = extractValue(result.events, "submit_proposal", "proposal_id");
|
|
594
|
-
amount = 1000;
|
|
595
|
-
return [4 /*yield*/, firma.Gov.getGasEstimationDeposit(aliceWallet, proposalId, amount)];
|
|
596
|
-
case 2:
|
|
597
|
-
gas = _a.sent();
|
|
598
|
-
(0, chai_1.expect)(gas).to.not.equal(0);
|
|
599
|
-
return [2 /*return*/];
|
|
600
|
-
}
|
|
601
|
-
});
|
|
602
|
-
}); });
|
|
603
|
-
it("7-7. Gov vote gas estimation", function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
604
|
-
var initialDepositFCT, title, description, result, proposalId, gas;
|
|
605
|
-
return __generator(this, function (_a) {
|
|
606
|
-
switch (_a.label) {
|
|
607
|
-
case 0:
|
|
608
|
-
initialDepositFCT = 5000;
|
|
609
|
-
title = "test submit textProposal(vote gas)";
|
|
610
|
-
description = "test description";
|
|
611
|
-
return [4 /*yield*/, firma.Gov.submitTextProposal(aliceWallet, title, description, initialDepositFCT)];
|
|
612
|
-
case 1:
|
|
613
|
-
result = _a.sent();
|
|
614
|
-
proposalId = extractValue(result.events, "submit_proposal", "proposal_id");
|
|
615
|
-
return [4 /*yield*/, firma.Gov.getGasEstimationVote(aliceWallet, proposalId, common_1.VotingOption.VOTE_OPTION_YES)];
|
|
616
|
-
case 2:
|
|
617
|
-
gas = _a.sent();
|
|
618
|
-
(0, chai_1.expect)(gas).to.not.equal(0);
|
|
619
|
-
return [2 /*return*/];
|
|
620
|
-
}
|
|
621
|
-
});
|
|
622
|
-
}); });
|
|
623
|
-
it("8-1. Token createToken gas estimation", function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
624
|
-
var tokenName, symbol, tokenURI, totalSupply, decimal, mintable, burnable, gas;
|
|
625
|
-
return __generator(this, function (_a) {
|
|
626
|
-
switch (_a.label) {
|
|
627
|
-
case 0:
|
|
628
|
-
tokenName = "KOMX TOKEN";
|
|
629
|
-
symbol = "KOMX63232";
|
|
630
|
-
tokenURI = "https://naver.com";
|
|
631
|
-
totalSupply = 10000;
|
|
632
|
-
decimal = 6;
|
|
633
|
-
mintable = true;
|
|
634
|
-
burnable = true;
|
|
635
|
-
return [4 /*yield*/, firma.Token.getGasEstimationCreateToken(aliceWallet, tokenName, symbol, tokenURI, totalSupply, decimal, mintable, burnable)];
|
|
636
|
-
case 1:
|
|
637
|
-
gas = _a.sent();
|
|
638
|
-
(0, chai_1.expect)(gas).to.not.equal(0);
|
|
639
|
-
return [2 /*return*/];
|
|
640
|
-
}
|
|
641
|
-
});
|
|
642
|
-
}); });
|
|
643
|
-
it("8-2. Token mint gas estimation", function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
644
|
-
var timeStamp, tokenName, symbol, tokenURI, totalSupply, decimal, mintable, burnable, createResult, tokenID, amount, gas;
|
|
645
|
-
return __generator(this, function (_a) {
|
|
646
|
-
switch (_a.label) {
|
|
647
|
-
case 0:
|
|
648
|
-
timeStamp = Math.round(+new Date() / 1000);
|
|
649
|
-
tokenName = "KOMX TOKEN" + timeStamp;
|
|
650
|
-
symbol = "KOMX" + timeStamp;
|
|
651
|
-
tokenURI = "https://naver.com";
|
|
652
|
-
totalSupply = 10000;
|
|
653
|
-
decimal = 6;
|
|
654
|
-
mintable = true;
|
|
655
|
-
burnable = true;
|
|
656
|
-
return [4 /*yield*/, firma.Token.createToken(aliceWallet, tokenName, symbol, tokenURI, totalSupply, decimal, mintable, burnable)];
|
|
657
|
-
case 1:
|
|
658
|
-
createResult = _a.sent();
|
|
659
|
-
(0, chai_1.expect)(createResult.code).to.equal(0);
|
|
660
|
-
tokenID = "ukomx" + timeStamp;
|
|
661
|
-
amount = 10000;
|
|
662
|
-
return [4 /*yield*/, firma.Token.getGasEstimationMint(aliceWallet, tokenID, amount, decimal, bobAddress)];
|
|
663
|
-
case 2:
|
|
664
|
-
gas = _a.sent();
|
|
665
|
-
(0, chai_1.expect)(gas).to.not.equal(0);
|
|
666
|
-
return [2 /*return*/];
|
|
667
|
-
}
|
|
668
|
-
});
|
|
669
|
-
}); });
|
|
670
|
-
it("8-3. Token burn gas estimation", function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
671
|
-
var timeStamp, tokenName, symbol, tokenURI, totalSupply, decimal, mintable, burnable, createResult, tokenID, amount, mintResult, gas;
|
|
672
|
-
return __generator(this, function (_a) {
|
|
673
|
-
switch (_a.label) {
|
|
674
|
-
case 0:
|
|
675
|
-
timeStamp = Math.round(+new Date() / 1000);
|
|
676
|
-
tokenName = "KOMX TOKEN" + timeStamp;
|
|
677
|
-
symbol = "KOMX" + timeStamp;
|
|
678
|
-
tokenURI = "https://naver.com";
|
|
679
|
-
totalSupply = 10000;
|
|
680
|
-
decimal = 6;
|
|
681
|
-
mintable = true;
|
|
682
|
-
burnable = true;
|
|
683
|
-
return [4 /*yield*/, firma.Token.createToken(aliceWallet, tokenName, symbol, tokenURI, totalSupply, decimal, mintable, burnable)];
|
|
684
|
-
case 1:
|
|
685
|
-
createResult = _a.sent();
|
|
686
|
-
(0, chai_1.expect)(createResult.code).to.equal(0);
|
|
687
|
-
tokenID = "ukomx" + timeStamp;
|
|
688
|
-
amount = 10;
|
|
689
|
-
return [4 /*yield*/, firma.Token.mint(aliceWallet, tokenID, amount, decimal, bobAddress)];
|
|
690
|
-
case 2:
|
|
691
|
-
mintResult = _a.sent();
|
|
692
|
-
(0, chai_1.expect)(mintResult.code).to.equal(0);
|
|
693
|
-
return [4 /*yield*/, firma.Token.getGasEstimationBurn(aliceWallet, tokenID, amount, decimal)];
|
|
694
|
-
case 3:
|
|
695
|
-
gas = _a.sent();
|
|
696
|
-
(0, chai_1.expect)(gas).to.not.equal(0);
|
|
697
|
-
return [2 /*return*/];
|
|
698
|
-
}
|
|
699
|
-
});
|
|
700
|
-
}); });
|
|
701
|
-
it("8-4. Token updateTokenURI gas estimation", function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
702
|
-
var timeStamp, tokenName, symbol, tokenURI, totalSupply, decimal, mintable, burnable, createResult, tokenID, newTokenURI, gas;
|
|
703
|
-
return __generator(this, function (_a) {
|
|
704
|
-
switch (_a.label) {
|
|
705
|
-
case 0:
|
|
706
|
-
timeStamp = Math.round(+new Date() / 1000);
|
|
707
|
-
tokenName = "KOMX TOKEN" + timeStamp;
|
|
708
|
-
symbol = "KOMX" + timeStamp;
|
|
709
|
-
tokenURI = "https://naver.com";
|
|
710
|
-
totalSupply = 10000;
|
|
711
|
-
decimal = 6;
|
|
712
|
-
mintable = true;
|
|
713
|
-
burnable = true;
|
|
714
|
-
return [4 /*yield*/, firma.Token.createToken(aliceWallet, tokenName, symbol, tokenURI, totalSupply, decimal, mintable, burnable)];
|
|
715
|
-
case 1:
|
|
716
|
-
createResult = _a.sent();
|
|
717
|
-
(0, chai_1.expect)(createResult.code).to.equal(0);
|
|
718
|
-
tokenID = "ukomx" + timeStamp;
|
|
719
|
-
newTokenURI = "https://firmachain.org";
|
|
720
|
-
return [4 /*yield*/, firma.Token.getGasEstimationUpdateTokenURI(aliceWallet, tokenID, newTokenURI)];
|
|
721
|
-
case 2:
|
|
722
|
-
gas = _a.sent();
|
|
723
|
-
(0, chai_1.expect)(gas).to.not.equal(0);
|
|
724
|
-
return [2 /*return*/];
|
|
725
|
-
}
|
|
726
|
-
});
|
|
727
|
-
}); });
|
|
728
|
-
});
|