@firmachain/firma-js 0.2.46 → 0.2.48

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