@firmachain/firma-js 0.3.0-beta1 → 0.3.2

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.
@@ -465,17 +465,17 @@ describe('[08. Gas Estimation Test]', function () {
465
465
  }
466
466
  });
467
467
  }); });
468
- it.skip("7-2. Gov submitCommunityPoolSpendProposal gas estimation", function () { return __awaiter(void 0, void 0, void 0, function () {
469
- var initialDepositFCT, title, description, amountFCT, recipient, gas;
468
+ it("7-2. Gov submitCommunityPoolSpendProposal gas estimation", function () { return __awaiter(void 0, void 0, void 0, function () {
469
+ var initialDepositFCT, title, summary, amountFCT, recipient, gas;
470
470
  return __generator(this, function (_a) {
471
471
  switch (_a.label) {
472
472
  case 0:
473
473
  initialDepositFCT = 2500;
474
474
  title = "Community spend proposal";
475
- description = "Proposal to spend from community pool";
475
+ summary = "Proposal to spend from community pool";
476
476
  amountFCT = 1000;
477
477
  recipient = bobAddress;
478
- return [4 /*yield*/, firma.Gov.getGasEstimationSubmitCommunityPoolSpendProposal(aliceWallet, title, description, initialDepositFCT, amountFCT, recipient)];
478
+ return [4 /*yield*/, firma.Gov.getGasEstimationSubmitCommunityPoolSpendProposal(aliceWallet, title, summary, initialDepositFCT, amountFCT, recipient)];
479
479
  case 1:
480
480
  gas = _a.sent();
481
481
  chai_1.expect(gas).to.not.equal(0);
@@ -483,54 +483,67 @@ describe('[08. Gas Estimation Test]', function () {
483
483
  }
484
484
  });
485
485
  }); });
486
- it.skip("7-3. Gov submitParameterChangeProposal gas estimation", function () { return __awaiter(void 0, void 0, void 0, function () {
487
- var initialDepositFCT, title, description, changeParamList, gas;
486
+ it("7-3. Gov submitStakingParamsUpdateProposal gas estimation", function () { return __awaiter(void 0, void 0, void 0, function () {
487
+ var initialDepositFCT, title, summary, params, metadata, gas;
488
488
  return __generator(this, function (_a) {
489
489
  switch (_a.label) {
490
490
  case 0:
491
- initialDepositFCT = 10;
492
- title = "Parameter Change proposal1";
493
- description = "This is a Parameter change proposal";
494
- changeParamList = [{
495
- subspace: "staking",
496
- key: "MaxValidators",
497
- value: "100",
498
- }];
499
- return [4 /*yield*/, firma.Gov.getGasEstimationSubmitParameterChangeProposal(aliceWallet, title, description, initialDepositFCT, changeParamList)];
491
+ initialDepositFCT = 5000;
492
+ title = "Staking parameter change proposal";
493
+ summary = "This is a Staking parameter change proposal";
494
+ return [4 /*yield*/, firma.Staking.getParamsAsStakingParams()];
500
495
  case 1:
496
+ params = _a.sent();
497
+ params.maxValidators = 100;
498
+ metadata = "";
499
+ return [4 /*yield*/, firma.Gov.getGasEstimationSubmitStakingParamsUpdateProposal(aliceWallet, title, summary, initialDepositFCT, params, metadata)];
500
+ case 2:
501
501
  gas = _a.sent();
502
502
  chai_1.expect(gas).to.not.equal(0);
503
503
  return [2 /*return*/];
504
504
  }
505
505
  });
506
506
  }); });
507
- it.skip("7-4. Gov submitSoftwareUpgradeProposalByHeight gas estimation", function () { return __awaiter(void 0, void 0, void 0, function () {
508
- var initialDepositFCT, title, description, upgradeName, upgradeHeight, gas;
507
+ it("7-4, Gov submitGovParamsUpdateProposal gas estimation", function () { return __awaiter(void 0, void 0, void 0, function () {
508
+ var initialDepositFCT, title, summary, params, metadata, gas;
509
509
  return __generator(this, function (_a) {
510
510
  switch (_a.label) {
511
511
  case 0:
512
- initialDepositFCT = 10000;
513
- title = "Software Upgrade proposal1";
514
- description = "This is a software upgrade proposal";
515
- upgradeName = "v0.2.7";
516
- upgradeHeight = 20000000;
517
- return [4 /*yield*/, firma.Gov.getGasEstimationSubmitSoftwareUpgradeProposalByHeight(aliceWallet, title, description, initialDepositFCT, upgradeName, upgradeHeight)];
512
+ initialDepositFCT = 5000;
513
+ title = "Gov parameter change proposal";
514
+ summary = "This is a Gov parameter change proposal";
515
+ return [4 /*yield*/, firma.Gov.getParamAsGovParams()];
518
516
  case 1:
517
+ params = _a.sent();
518
+ params.burnProposalDepositPrevote = true;
519
+ metadata = "";
520
+ return [4 /*yield*/, firma.Gov.getGasEstimationSubmitGovParamsUpdateProposal(aliceWallet, title, summary, initialDepositFCT, params, metadata)];
521
+ case 2:
519
522
  gas = _a.sent();
520
523
  chai_1.expect(gas).to.not.equal(0);
521
524
  return [2 /*return*/];
522
525
  }
523
526
  });
524
527
  }); });
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;
528
+ it("7-5. Gov submitSoftwareUpgradeProposal gas estimation", function () { return __awaiter(void 0, void 0, void 0, function () {
529
+ var initialDepositFCT, title, summary, plan, metadata, gas;
527
530
  return __generator(this, function (_a) {
528
531
  switch (_a.label) {
529
532
  case 0:
530
- initialDepositFCT = 1000;
533
+ initialDepositFCT = 5000;
531
534
  title = "Software Upgrade proposal1";
532
- description = "This is a software upgrade proposal";
533
- return [4 /*yield*/, firma.Gov.getGasEstimationSubmitCancelSoftwareUpgradeProposal(aliceWallet, title, description, initialDepositFCT)];
535
+ summary = "This is a software upgrade proposal";
536
+ plan = {
537
+ name: 'v0.5.1',
538
+ time: {
539
+ seconds: BigInt(0),
540
+ nanos: 0
541
+ },
542
+ height: BigInt(1050000),
543
+ info: ''
544
+ };
545
+ metadata = "";
546
+ return [4 /*yield*/, firma.Gov.getGasEstimationSubmitSoftwareUpgradeProposal(aliceWallet, title, summary, initialDepositFCT, plan, metadata)];
534
547
  case 1:
535
548
  gas = _a.sent();
536
549
  chai_1.expect(gas).to.not.equal(0);
@@ -137,6 +137,18 @@ describe('[13. Staking Query Test]', function () {
137
137
  }
138
138
  });
139
139
  }); });
140
+ it('6-1.get getParamsAsStakingParams', function () { return __awaiter(void 0, void 0, void 0, function () {
141
+ var result;
142
+ return __generator(this, function (_a) {
143
+ switch (_a.label) {
144
+ case 0: return [4 /*yield*/, firma.Staking.getParamsAsStakingParams()];
145
+ case 1:
146
+ result = _a.sent();
147
+ chai_1.expect(result.maxValidators).to.not.equal(0);
148
+ return [2 /*return*/];
149
+ }
150
+ });
151
+ }); });
140
152
  // user side
141
153
  it('7.get userside getTotalDelegationInfo', function () { return __awaiter(void 0, void 0, void 0, function () {
142
154
  var wallet, result, _a, _b;
@@ -134,17 +134,17 @@ describe('[16. Gov Tx Test]', function () {
134
134
  }
135
135
  });
136
136
  }); });
137
- it.skip('SubmitCommunityPoolSpendProposal Test', function () { return __awaiter(void 0, void 0, void 0, function () {
138
- var initialDepositFCT, title, description, amount, recipient, result;
137
+ it('SubmitCommunityPoolSpendProposal Test', function () { return __awaiter(void 0, void 0, void 0, function () {
138
+ var initialDepositFCT, title, summary, amountFCT, recipient, result;
139
139
  return __generator(this, function (_a) {
140
140
  switch (_a.label) {
141
141
  case 0:
142
- initialDepositFCT = 10;
142
+ initialDepositFCT = 2500;
143
143
  title = "Community spend proposal1";
144
- description = "This is a community spend proposal";
145
- amount = 1000;
146
- recipient = bobAddress;
147
- return [4 /*yield*/, firma.Gov.submitCommunityPoolSpendProposal(aliceWallet, title, description, initialDepositFCT, amount, recipient)];
144
+ summary = "This is a community spend proposal";
145
+ amountFCT = 1000;
146
+ recipient = aliceAddress;
147
+ return [4 /*yield*/, firma.Gov.submitCommunityPoolSpendProposal(aliceWallet, title, summary, initialDepositFCT, amountFCT, recipient)];
148
148
  case 1:
149
149
  result = _a.sent();
150
150
  chai_1.expect(result.code).to.equal(0);
@@ -152,43 +152,42 @@ describe('[16. Gov Tx Test]', function () {
152
152
  }
153
153
  });
154
154
  }); });
155
- it.skip('SubmitParameterChangeProposal Test', function () { return __awaiter(void 0, void 0, void 0, function () {
156
- var initialDepositFCT, title, description, changeParamList, result;
155
+ it('SubmitStakingParamsUpdateProposal Test', function () { return __awaiter(void 0, void 0, void 0, function () {
156
+ var title, summary, initialDepositFCT, params, metadata, result;
157
157
  return __generator(this, function (_a) {
158
158
  switch (_a.label) {
159
159
  case 0:
160
- initialDepositFCT = 10;
161
- title = "Parameter Change proposal1";
162
- description = "This is a Parameter change proposal";
163
- changeParamList = [{
164
- subspace: "staking",
165
- key: "MaxValidators",
166
- value: "100",
167
- }];
168
- return [4 /*yield*/, firma.Gov.submitParameterChangeProposal(aliceWallet, title, description, initialDepositFCT, changeParamList)];
160
+ title = "Staking Parameter Change proposal";
161
+ summary = "This is a Staking Parameter change proposal";
162
+ initialDepositFCT = 2500;
163
+ return [4 /*yield*/, firma.Staking.getParamsAsStakingParams()];
169
164
  case 1:
165
+ params = _a.sent();
166
+ params.maxValidators = 100;
167
+ params.historicalEntries = 10000;
168
+ metadata = "";
169
+ return [4 /*yield*/, firma.Gov.submitStakingParamsUpdateProposal(aliceWallet, title, summary, initialDepositFCT, params, metadata)];
170
+ case 2:
170
171
  result = _a.sent();
171
172
  chai_1.expect(result.code).to.equal(0);
172
173
  return [2 /*return*/];
173
174
  }
174
175
  });
175
176
  }); });
176
- // This unit test needs specific option setup, so it’s skipped by default.
177
- it.skip('SubmitSoftwareUpgradeProposalByHeight Test', function () { return __awaiter(void 0, void 0, void 0, function () {
178
- var initialDepositFCT, title, description, upgradeName, upgradeHeight, gas, fee, result;
177
+ it('SubmitGovParamsUpdateProposal Test', function () { return __awaiter(void 0, void 0, void 0, function () {
178
+ var title, summary, initialDepositFCT, params, metadata, result;
179
179
  return __generator(this, function (_a) {
180
180
  switch (_a.label) {
181
181
  case 0:
182
- initialDepositFCT = 5000;
183
- title = "FIRMACHAIN v0.5.0 Upgrade";
184
- description = "## OVERVIEW\nThis is a proposal on FIRMACHAIN Software Upgrade(v0.5.0-alpha1).\n\nneed form (comment)\n\nOnce this proposal passes, the FIRMACHAIN network will be upgraded at block height [xxx,xxx].\n\n## Upgrade features\nFollowing are the details of this upgrade. \n - Cosmos SDK : v0.45.9 -> v0.50.12\n - CometBFT : v0.34.21 -> v0.38.17\n - Chain Binary : v0.4.0 -> v0.5.0\n - IBC-go(IBC) : v4.4.0 -> v8.6.1\n - Wasmd : v0.29.2 -> v0.54.0\n - New Governance parameters\n\t - MinInitialDepositRatio : 0.5\n\t - ProposalCancelRatio : 0.5\n\n## Timeline\nneed form (comment)\n\nIf we are faced with any problems during the upgrade, a hasty and swift communication via Discord is necessary to solve the issue.\nAny FIRMACHAIN Validator who hasn't joined our Discord channel must contact us at contact@firmachain.org before this Software Upgrade.\n\n## Actions required by node operators\nOnce this proposal passes and when the block height reaches xxxxx, any block creation activity on the FIRMACHAIN (Colosseum-1) network will be halted. \nAll Validators must upgrade using the manual binary switch or the Cosmovisor in order to conduct the FIRMACHAIN Software Upgrade.\n\nFor a more detailed upgrade guide, please visit https://github.com/FirmaChain/mainnet/blob/main/docs/upgrade-notes-v0.5.0.md";
185
- upgradeName = "v0.5.0";
186
- upgradeHeight = 558800;
187
- return [4 /*yield*/, firma.Gov.getGasEstimationSubmitSoftwareUpgradeProposalByHeight(aliceWallet, title, description, initialDepositFCT, upgradeName, upgradeHeight)];
182
+ title = "Gov Parameter Change proposal";
183
+ summary = "This is a Gov Parameter change proposal";
184
+ initialDepositFCT = 2500;
185
+ return [4 /*yield*/, firma.Gov.getParamAsGovParams()];
188
186
  case 1:
189
- gas = _a.sent();
190
- fee = Math.ceil(gas * 0.1);
191
- return [4 /*yield*/, firma.Gov.submitSoftwareUpgradeProposalByHeight(aliceWallet, title, description, initialDepositFCT, upgradeName, upgradeHeight, { gas: gas, fee: fee })];
187
+ params = _a.sent();
188
+ params.burnProposalDepositPrevote = true;
189
+ metadata = "";
190
+ return [4 /*yield*/, firma.Gov.submitGovParamsUpdateProposal(aliceWallet, title, summary, initialDepositFCT, params, metadata)];
192
191
  case 2:
193
192
  result = _a.sent();
194
193
  chai_1.expect(result.code).to.equal(0);
@@ -196,19 +195,32 @@ describe('[16. Gov Tx Test]', function () {
196
195
  }
197
196
  });
198
197
  }); });
199
- // This unit test needs specific option setup, so it’s skipped by default.
200
- it.skip('SubmitCancelSoftwareUpgradeProposal Test', function () { return __awaiter(void 0, void 0, void 0, function () {
201
- var initialDepositFCT, title, description, result;
198
+ it('SubmitSoftwareUpgradeProposal Test', function () { return __awaiter(void 0, void 0, void 0, function () {
199
+ var initialDeposit, title, summary, plan, metadata, gas, fee, result;
202
200
  return __generator(this, function (_a) {
203
201
  switch (_a.label) {
204
202
  case 0:
205
- initialDepositFCT = 1000;
206
- title = "Software Upgrade proposal1";
207
- description = "This is a software upgrade proposal";
208
- return [4 /*yield*/, firma.Gov.submitCancelSoftwareUpgradeProposal(aliceWallet, title, description, initialDepositFCT)];
203
+ initialDeposit = 5000;
204
+ title = "CancelProposal test proposal";
205
+ summary = "This is a Text & CancelProposal";
206
+ plan = {
207
+ name: 'v0.5.1',
208
+ time: {
209
+ seconds: BigInt(0),
210
+ nanos: 0
211
+ },
212
+ height: BigInt(1050000),
213
+ info: ''
214
+ };
215
+ metadata = "";
216
+ return [4 /*yield*/, firma.Gov.getGasEstimationSubmitSoftwareUpgradeProposal(aliceWallet, title, summary, initialDeposit, plan, metadata)];
209
217
  case 1:
218
+ gas = _a.sent();
219
+ fee = Math.ceil(gas * 0.1);
220
+ return [4 /*yield*/, firma.Gov.submitSoftwareUpgradeProposal(aliceWallet, title, summary, initialDeposit, plan, metadata, { gas: gas, fee: fee })];
221
+ case 2:
210
222
  result = _a.sent();
211
- chai_1.expect(result.code).to.equal(0);
223
+ chai_1.expect(result.code).to.be.equal(0);
212
224
  return [2 /*return*/];
213
225
  }
214
226
  });
@@ -243,27 +255,8 @@ describe('[16. Gov Tx Test]', function () {
243
255
  }
244
256
  });
245
257
  }); });
246
- // NOTICE: time-based upgrades have been deprecated in the SDK: invalid request
247
- /*it.skip('SubmitSoftwareUpgradeProposalByTime Test', async () => {
248
-
249
- const initialDepositFCT = 8;
250
- const title = "Software Upgrade proposal2";
251
- const description = "This is a software upgrade proposal";
252
-
253
- const expirationDate = new Date();
254
- expirationDate.setMinutes(expirationDate.getMinutes() + 3);
255
-
256
- const upgradeName = "v0.2.4";
257
- const upgradeTime = expirationDate;
258
- const upgradeInfo = "info?";
259
-
260
- var result = await firma.Gov.SubmitSoftwareUpgradeProposalByTime(aliceWallet, title, description, initialDepositFCT, upgradeName, upgradeTime);
261
-
262
- console.log(result);
263
- expect(result.code).to.equal(0);
264
- });*/
265
258
  // TODO: get recent gov proposal list and then set proposalId for below case
266
- var tempProposalId = 15;
259
+ var tempProposalId = 1;
267
260
  // more deposit after initial deposit case
268
261
  it.skip('Deposit OK', function () { return __awaiter(void 0, void 0, void 0, function () {
269
262
  var proposalId, amount, result;
@@ -308,4 +301,92 @@ describe('[16. Gov Tx Test]', function () {
308
301
  }
309
302
  });
310
303
  }); });
304
+ it('SubmitCommunityPoolSpendProposal & Deposit & Vote scenario test', function () { return __awaiter(void 0, void 0, void 0, function () {
305
+ var initialDepositFCT, title, summary, amountFCT, recipient, result, proposalId, addDepositAmount;
306
+ return __generator(this, function (_a) {
307
+ switch (_a.label) {
308
+ case 0:
309
+ initialDepositFCT = 2500;
310
+ title = "Community spend proposal1";
311
+ summary = "This is a community spend proposal";
312
+ amountFCT = 1000;
313
+ recipient = aliceAddress;
314
+ return [4 /*yield*/, firma.Gov.submitCommunityPoolSpendProposal(aliceWallet, title, summary, initialDepositFCT, amountFCT, recipient)];
315
+ case 1:
316
+ result = _a.sent();
317
+ chai_1.expect(result.code).to.equal(0);
318
+ proposalId = extractValue(result.events, "submit_proposal", "proposal_id");
319
+ addDepositAmount = 2500;
320
+ return [4 /*yield*/, firma.Gov.deposit(aliceWallet, proposalId, addDepositAmount)];
321
+ case 2:
322
+ result = _a.sent();
323
+ chai_1.expect(result.code).to.equal(0);
324
+ return [4 /*yield*/, firma.Gov.vote(aliceWallet, proposalId, common_1.VotingOption.VOTE_OPTION_YES)];
325
+ case 3:
326
+ result = _a.sent();
327
+ chai_1.expect(result.code).to.equal(0);
328
+ return [4 /*yield*/, firma.Gov.vote(aliceWallet, proposalId, common_1.VotingOption.VOTE_OPTION_NO)];
329
+ case 4:
330
+ result = _a.sent();
331
+ chai_1.expect(result.code).to.equal(0);
332
+ return [2 /*return*/];
333
+ }
334
+ });
335
+ }); });
336
+ it('SubmitGovParamsUpdateProposal Test - failure case (missing parameter)', function () { return __awaiter(void 0, void 0, void 0, function () {
337
+ var title, summary, initialDeposit, proposalParams, metadata, errorMsg, error_1;
338
+ return __generator(this, function (_a) {
339
+ switch (_a.label) {
340
+ case 0:
341
+ title = "Gov Parameter Change fail proposal";
342
+ summary = "This is a Gov Parameter change proposal";
343
+ initialDeposit = 5000;
344
+ proposalParams = {
345
+ burnVoteQuorum: false
346
+ };
347
+ metadata = "";
348
+ errorMsg = "All governance parameters must be provided. Use getParamAsGovParams() to get current values and override only the parameters you want to change.";
349
+ _a.label = 1;
350
+ case 1:
351
+ _a.trys.push([1, 3, , 4]);
352
+ return [4 /*yield*/, firma.Gov.submitGovParamsUpdateProposal(aliceWallet, title, summary, initialDeposit, proposalParams, metadata)];
353
+ case 2:
354
+ _a.sent();
355
+ return [3 /*break*/, 4];
356
+ case 3:
357
+ error_1 = _a.sent();
358
+ chai_1.expect(error_1.message).to.equal(errorMsg);
359
+ return [3 /*break*/, 4];
360
+ case 4: return [2 /*return*/];
361
+ }
362
+ });
363
+ }); });
364
+ it('SubmitStakingParamsUpdateProposal Test - failure case (missing parameter)', function () { return __awaiter(void 0, void 0, void 0, function () {
365
+ var title, summary, initialDeposit, proposalParams, metadata, errorMsg, error_2;
366
+ return __generator(this, function (_a) {
367
+ switch (_a.label) {
368
+ case 0:
369
+ title = "Staking Parameter Change fail proposal";
370
+ summary = "This is a Staking Parameter change proposal";
371
+ initialDeposit = 5000;
372
+ proposalParams = {
373
+ maxValidators: 100
374
+ };
375
+ metadata = "";
376
+ errorMsg = "All staking parameters must be provided. Use Staking.getParamsAsStakingParams() to get current values and override only the parameters you want to change.";
377
+ _a.label = 1;
378
+ case 1:
379
+ _a.trys.push([1, 3, , 4]);
380
+ return [4 /*yield*/, firma.Gov.submitStakingParamsUpdateProposal(aliceWallet, title, summary, initialDeposit, proposalParams, metadata)];
381
+ case 2:
382
+ _a.sent();
383
+ return [3 /*break*/, 4];
384
+ case 3:
385
+ error_2 = _a.sent();
386
+ chai_1.expect(error_2.message).to.equal(errorMsg);
387
+ return [3 /*break*/, 4];
388
+ case 4: return [2 /*return*/];
389
+ }
390
+ });
391
+ }); });
311
392
  });
@@ -50,7 +50,7 @@ describe('[17. Gov Query Test]', function () {
50
50
  return __generator(this, function (_a) {
51
51
  proposalList = [];
52
52
  if (proposalList.length > 0) {
53
- chai_1.expect(proposalList[0].proposal_id).to.not.equal('');
53
+ chai_1.expect(proposalList[0].id).to.not.equal('');
54
54
  }
55
55
  else {
56
56
  chai_1.expect(proposalList).to.be.deep.equal([]);
@@ -69,8 +69,8 @@ describe('[17. Gov Query Test]', function () {
69
69
  proposalList = _a.sent();
70
70
  chai_1.expect(proposalList).to.be.an('array');
71
71
  if (proposalList.length > 0) {
72
- chai_1.expect(proposalList[0]).to.have.property('proposal_id');
73
- chai_1.expect(proposalList[0].proposal_id).to.not.equal('');
72
+ chai_1.expect(proposalList[0]).to.have.property('id');
73
+ chai_1.expect(proposalList[0].id).to.not.equal('');
74
74
  }
75
75
  else {
76
76
  chai_1.expect(proposalList).to.have.lengthOf(0);
@@ -92,8 +92,8 @@ describe('[17. Gov Query Test]', function () {
92
92
  case 2:
93
93
  proposal = _a.sent();
94
94
  chai_1.expect(proposal).to.be.an('object');
95
- chai_1.expect(proposal).to.have.property('proposal_id');
96
- chai_1.expect(proposal.proposal_id).to.equal(id);
95
+ chai_1.expect(proposal).to.have.property('id');
96
+ chai_1.expect(proposal.id).to.equal(id);
97
97
  return [3 /*break*/, 4];
98
98
  case 3:
99
99
  chai_1.expect(proposalList).to.have.lengthOf(0);
@@ -111,19 +111,19 @@ describe('[17. Gov Query Test]', function () {
111
111
  case 1:
112
112
  param = _a.sent();
113
113
  chai_1.expect(param).to.be.an('object');
114
- chai_1.expect(param).to.have.property('voting_period');
115
- chai_1.expect(param).to.have.property('deposit_params');
116
- chai_1.expect(param.deposit_params).to.have.property('min_deposit');
117
- chai_1.expect(param.deposit_params).to.have.property('max_deposit_period');
118
- chai_1.expect(param.deposit_params.min_deposit).to.be.an('array');
119
- if (param.deposit_params.min_deposit.length > 0) {
120
- chai_1.expect(param.deposit_params.min_deposit[0]).to.have.property('denom');
121
- chai_1.expect(param.deposit_params.min_deposit[0]).to.have.property('amount');
122
- }
123
- chai_1.expect(param).to.have.property('tally_params');
124
- chai_1.expect(param.tally_params).to.have.property('quorum');
125
- chai_1.expect(param.tally_params).to.have.property('threshold');
126
- chai_1.expect(param.tally_params).to.have.property('veto_threshold');
114
+ return [2 /*return*/];
115
+ }
116
+ });
117
+ }); });
118
+ // integrated function with params/voting, params/deposit, params/tallying - GovParams
119
+ it('get params as GovParams', function () { return __awaiter(void 0, void 0, void 0, function () {
120
+ var param;
121
+ return __generator(this, function (_a) {
122
+ switch (_a.label) {
123
+ case 0: return [4 /*yield*/, firma.Gov.getParamAsGovParams()];
124
+ case 1:
125
+ param = _a.sent();
126
+ chai_1.expect(param).to.be.an('object');
127
127
  return [2 /*return*/];
128
128
  }
129
129
  });
@@ -248,4 +248,78 @@ describe('[18. util Test]', function () {
248
248
  return [2 /*return*/];
249
249
  });
250
250
  }); });
251
+ it('parseDurationString test', function () { return __awaiter(void 0, void 0, void 0, function () {
252
+ var testString, duration;
253
+ return __generator(this, function (_a) {
254
+ testString = "1800s";
255
+ duration = FirmaUtil_1.FirmaUtil.parseDurationString(testString);
256
+ // Correct way to test object properties
257
+ chai_1.expect(duration.seconds).to.be.equal(BigInt(1800));
258
+ chai_1.expect(duration.nanos).to.be.equal(0);
259
+ return [2 /*return*/];
260
+ });
261
+ }); });
262
+ it('createDurationFromString test', function () { return __awaiter(void 0, void 0, void 0, function () {
263
+ var testString, duration;
264
+ return __generator(this, function (_a) {
265
+ testString = "1800s";
266
+ duration = FirmaUtil_1.FirmaUtil.createDurationFromString(testString);
267
+ chai_1.expect(duration.seconds).to.be.equal(BigInt(1800));
268
+ chai_1.expect(duration.nanos).to.be.equal(0);
269
+ return [2 /*return*/];
270
+ });
271
+ }); });
272
+ it('normalizeDecimalString test - success case', function () { return __awaiter(void 0, void 0, void 0, function () {
273
+ var result;
274
+ return __generator(this, function (_a) {
275
+ result = FirmaUtil_1.FirmaUtil.normalizeDecimalString("0.000000000000000000");
276
+ chai_1.expect(result).to.equal("");
277
+ return [2 /*return*/];
278
+ });
279
+ }); });
280
+ it('normalizeDecimalString test - failure case', function () { return __awaiter(void 0, void 0, void 0, function () {
281
+ var result;
282
+ return __generator(this, function (_a) {
283
+ result = FirmaUtil_1.FirmaUtil.normalizeDecimalString("0.000000000000000000");
284
+ chai_1.expect(result).to.not.equal("0.000000000000000000");
285
+ return [2 /*return*/];
286
+ });
287
+ }); });
288
+ it('processCommissionRate test - success case', function () { return __awaiter(void 0, void 0, void 0, function () {
289
+ var result;
290
+ return __generator(this, function (_a) {
291
+ result = FirmaUtil_1.FirmaUtil.processCommissionRate("0.000000000000000000");
292
+ chai_1.expect(result).to.equal("");
293
+ result = FirmaUtil_1.FirmaUtil.processCommissionRate("0.1");
294
+ chai_1.expect(result).to.equal("0.1");
295
+ result = FirmaUtil_1.FirmaUtil.processCommissionRate("1");
296
+ chai_1.expect(result).to.equal("1");
297
+ result = FirmaUtil_1.FirmaUtil.processCommissionRate(" 0.75 ");
298
+ chai_1.expect(result).to.equal("0.75");
299
+ result = FirmaUtil_1.FirmaUtil.processCommissionRate("");
300
+ chai_1.expect(result).to.equal("");
301
+ return [2 /*return*/];
302
+ });
303
+ }); });
304
+ it('processCommissionRate - failure cases', function () { return __awaiter(void 0, void 0, void 0, function () {
305
+ var testString;
306
+ return __generator(this, function (_a) {
307
+ testString = "1.01";
308
+ try {
309
+ FirmaUtil_1.FirmaUtil.processCommissionRate(testString);
310
+ }
311
+ catch (error) {
312
+ chai_1.expect(error.message).to.equal("Invalid commission rate format: 1.01");
313
+ }
314
+ // Invalid commission rate: -0.1. Must be >= 0
315
+ testString = "-0.1";
316
+ try {
317
+ FirmaUtil_1.FirmaUtil.processCommissionRate(testString);
318
+ }
319
+ catch (error) {
320
+ chai_1.expect(error.message).to.equal("Invalid commission rate format: -0.1");
321
+ }
322
+ return [2 /*return*/];
323
+ });
324
+ }); });
251
325
  });
@@ -79,7 +79,6 @@ describe('[20. Slashing Query Test]', function () {
79
79
  chai_1.expect(result[0]).to.have.property('jailed_until');
80
80
  chai_1.expect(result[0]).to.have.property('tombstoned');
81
81
  chai_1.expect(result[0]).to.have.property('missed_blocks_counter');
82
- // address가 비어있지 않은지 확인
83
82
  chai_1.expect(result[0].address).to.not.be.empty;
84
83
  }
85
84
  return [2 /*return*/];
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.signerMnemonic4 = exports.signerMnemonic3 = exports.signerMnemonic2 = exports.signerMnemonic1 = exports.firmaFeeMnemonic = exports.feeMnemonic = exports.bobMnemonic = exports.aliceMnemonic = exports.validatorMnemonic = exports.TestChainConfig = void 0;
4
+ // export let TestChainConfig: FirmaConfig = FirmaConfig.TestNetConfig;
4
5
  exports.TestChainConfig = {
5
6
  chainID: "roma-1",
6
7
  rpcAddress: "http://192.168.30.47:26657",
@@ -16,10 +17,15 @@ exports.TestChainConfig = {
16
17
  isShowLog: false,
17
18
  };
18
19
  exports.validatorMnemonic = "angry water bunker where iron absurd cruise deliver clutch unique creek pyramid arch express flush pill lens concert absent enemy boring mom nuclear rose";
19
- exports.aliceMnemonic = "immune flavor record sphere foam planet faint grid disorder flag minute eternal beef sea camp surge extra scorpion pistol plastic happy siren juice found"; // ALICE REAL
20
- // export const aliceMnemonic = "innocent enforce visit tilt job kitten actual glory flash feed wonder license rubber outer drum sun fuel relax roof universe enrich pulse fine grid"; // FAKE
21
- exports.bobMnemonic = "innocent enforce visit tilt job kitten actual glory flash feed wonder license rubber outer drum sun fuel relax roof universe enrich pulse fine grid"; // BOB REAL
22
- // export const bobMnemonic = "immune flavor record sphere foam planet faint grid disorder flag minute eternal beef sea camp surge extra scorpion pistol plastic happy siren juice found"; // FAKE
20
+ exports.aliceMnemonic = "immune flavor record sphere foam planet faint grid disorder flag minute eternal beef sea camp surge extra scorpion pistol plastic happy siren juice found";
21
+ // voting test
22
+ // export const aliceMnemonic = "long shallow crumble clown truth book oval render seed canal buffalo assist sadness elbow afraid catalog brother trade food subject must luggage bread neither";
23
+ // export const aliceMnemonic = "angry water bunker where iron absurd cruise deliver clutch unique creek pyramid arch express flush pill lens concert absent enemy boring mom nuclear rose";
24
+ // export const aliceMnemonic = "stadium lonely midnight okay meat rib awesome wealth phone leisure turn prosper notable label fruit define little also father silver half drill bargain antique";
25
+ // export const aliceMnemonic = "uncle banana theme relax oak prosper volcano glad industry bicycle tower thrive jelly curious luggage frame that defy reason jewel figure begin nice moon";
26
+ // export const aliceMnemonic = "rebel engine situate catalog blood strong satisfy aerobic cupboard again vivid twice flag work taxi heart fruit island ribbon hungry cheap ordinary horse foam";
27
+ // export const aliceMnemonic = "ladder damage art company shield glance cushion float need layer rare toast intact grief wet point write season correct access mix bomb accident estate";
28
+ exports.bobMnemonic = "innocent enforce visit tilt job kitten actual glory flash feed wonder license rubber outer drum sun fuel relax roof universe enrich pulse fine grid";
23
29
  exports.feeMnemonic = "long shallow crumble clown truth book oval render seed canal buffalo assist sadness elbow afraid catalog brother trade food subject must luggage bread neither";
24
30
  exports.firmaFeeMnemonic = "arrest dynamic typical lunch original glare truth narrow stairs clip canyon space alley chat drive sudden music bubble time mesh color office minor draft";
25
31
  // export const firmaFeeMnemonic = "child material talent property foot sign talent congress cargo pistol suspect screen leader owner type style patch amused stable flame sure fluid april acoustic";
@@ -3,3 +3,9 @@ export declare let TestChainConfig: FirmaConfig;
3
3
  export declare const validatorMnemonic = "";
4
4
  export declare const aliceMnemonic = "";
5
5
  export declare const bobMnemonic = "";
6
+ export declare const feeMnemonic = "";
7
+ export declare const firmaFeeMnemonic = "";
8
+ export declare const signerMnemonic1 = "";
9
+ export declare const signerMnemonic2 = "";
10
+ export declare const signerMnemonic3 = "";
11
+ export declare const signerMnemonic4 = "";
@@ -1,8 +1,14 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.bobMnemonic = exports.aliceMnemonic = exports.validatorMnemonic = exports.TestChainConfig = void 0;
3
+ exports.signerMnemonic4 = exports.signerMnemonic3 = exports.signerMnemonic2 = exports.signerMnemonic1 = exports.firmaFeeMnemonic = exports.feeMnemonic = exports.bobMnemonic = exports.aliceMnemonic = exports.validatorMnemonic = exports.TestChainConfig = void 0;
4
4
  var FirmaConfig_1 = require("../sdk/FirmaConfig");
5
5
  exports.TestChainConfig = FirmaConfig_1.FirmaConfig.TestNetConfig;
6
6
  exports.validatorMnemonic = "";
7
7
  exports.aliceMnemonic = "";
8
8
  exports.bobMnemonic = "";
9
+ exports.feeMnemonic = "";
10
+ exports.firmaFeeMnemonic = "";
11
+ exports.signerMnemonic1 = "";
12
+ exports.signerMnemonic2 = "";
13
+ exports.signerMnemonic3 = "";
14
+ exports.signerMnemonic4 = "";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@firmachain/firma-js",
3
- "version": "0.3.0-beta1",
3
+ "version": "0.3.2",
4
4
  "description": "The Official FirmaChain Javascript SDK written in Typescript",
5
5
  "main": "dist/index.js",
6
6
  "typings": "dist/index.d.ts",