@firmachain/firma-js 0.3.1 โ†’ 0.3.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -5,20 +5,33 @@
5
5
  [![license](https://img.shields.io/badge/License-MIT-blue.svg)](https://github.com/firmachain/firma-js/blob/master/LICENSE)
6
6
  [![](https://tokei.rs/b1/github/XAMPPRocky/tokei)](https://github.com/FirmaChain/firma-js)
7
7
 
8
- The Javascript & TypeScript SDK for FirmaChain
8
+ **The Official JavaScript & TypeScript SDK for FirmaChain**
9
9
 
10
- Firma-js is a SDK for writing applications based on javascript & typescript. You can use it client web app or Node.js. This SDK is created inspired by cosmjs and several sdk. All functions of the FirmaChain can be accessed at the service level.
10
+ Firma-js is a comprehensive SDK for building applications on the FirmaChain blockchain using JavaScript and TypeScript. Whether you're developing client-side web applications or server-side Node.js applications, this SDK provides seamless integration with FirmaChain's full suite of blockchain capabilities.
11
11
 
12
- ## Features
13
- Most cosmos sdk features are supported
14
- - Wallet / Bank
15
- - Nft / Contract
16
- - Ipfs / Gov
17
- - Staking / Distribution
18
- - Feegrant ...and so one
12
+ Built with inspiration from CosmJS and other leading Cosmos SDK implementations, firma-js offers a service-oriented architecture that provides direct access to all FirmaChain functionality while maintaining type safety and developer experience.
19
13
 
20
- </br>
14
+ ## Features
21
15
 
16
+ **Core FirmaChain Integration**
17
+ - **Wallet Management**: Create, import, and manage wallets with mnemonic and private key support
18
+ - **Banking Operations**: Send, receive, and query FCT with full transaction control
19
+ - **Staking & Delegation**: Stake tokens, delegate to validators, and manage rewards
20
+ - **Authorization**: Grant and revoke permissions for account delegation
21
+ - **Fee Grant**: Grant and revoke fee allowances for gasless transactions
22
+ - **Governance**: Create proposals, vote, and query governance parameters
23
+
24
+ **FirmaChain Ecosystem**
25
+ - **Smart Contracts**: Deploy, execute, and query CosmWasm smart contracts with full parameter control
26
+ - **IBC Operations**: Cross-chain transfers and communication protocols
27
+ - **IPFS Integration**: Upload, pin, and retrieve files from IPFS with built-in gateway support
28
+ - **NFT Operations**: Mint, transfer, burn, and query built-in NFTs with comprehensive metadata support
29
+
30
+ **Developer Experience**
31
+ - **TypeScript Support**: Full type definitions for enhanced IDE support and compile-time safety
32
+ - **Modular Architecture**: Use only the modules you need for optimal bundle size
33
+ - **Comprehensive Documentation**: Extensive examples and API documentation
34
+ - **CosmJS Compatible**: Familiar patterns for developers experienced with Cosmos SDK
22
35
 
23
36
  ## Install
24
37
  You can install `firma-js` using [NPM](https://www.npmjs.com/package/@firmachain/firma-js)
@@ -30,6 +43,23 @@ or
30
43
  npm i @firmachain/firma-js
31
44
  ```
32
45
 
46
+ ## Conventions
47
+
48
+ ### Implementation Guidelines
49
+ - **Data Structure Consistency**: We recommend preserving the original data structure from FirmaChain RPCs throughout your application and only processing/transforming the data immediately before transaction generation. This convention is also applied to `firma-js` itself.
50
+ - **Chain Data Integrity**: This approach ensures consistency in chain data retrieval logic and maintains compatibility with upstream changes
51
+ - **Transaction Processing**: All data transformations should occur at the transaction boundary to minimize potential inconsistencies
52
+
53
+ ### Governance Parameters
54
+ - **Parameter Validation**: For governance proposals requiring multiple parameters, we perform dual validation by comparing submitted parameters against `fromPartial`-processed parameters to ensure identical values
55
+ - **Validation Failure Handling**: If any discrepancy is detected between the original and processed parameters, the transaction will automatically revert to prevent malformed proposals
56
+ - **Best Practice**: To ensure successful governance proposal submissions, use the provided helper functions:
57
+ - `getParamAsGovParams()` - Retrieve current governance parameters
58
+ - `getParamsAsStakingParams()` - Retrieve current staking parameters
59
+
60
+ Modify only the specific fields you need to change while preserving all other existing parameter values
61
+
62
+
33
63
  ## Usage
34
64
  ### Initializing SDK
35
65
  ```js
@@ -138,6 +168,10 @@ const tokenId = 1;
138
168
  let result = await firma.Nft.burn(wallet, tokenId);
139
169
  ```
140
170
 
141
- You can see everything usage of firma-js on the test folder.
142
- </br>
143
- https://github.com/FirmaChain/firma-js/tree/main/test
171
+ ## Complete Examples
172
+
173
+ For comprehensive usage examples and test cases, please refer to the test suite:
174
+
175
+ ๐Ÿ”— **[View Complete Examples](https://github.com/FirmaChain/firma-js/tree/main/test)**
176
+
177
+ The test folder contains detailed examples for all SDK features including wallet management, token operations, NFT handling, smart contracts, governance, staking, and more.
@@ -1,11 +1,11 @@
1
- import { TxMisc, VotingOption, ProposalInfo, ProposalStatus, ProposalParam, CurrentVoteInfo } from "./firmachain/gov";
1
+ import { TxMisc, VotingOption, ProposalStatus, CurrentVoteInfo, GovParamType } from "./firmachain/gov";
2
+ import { DeliverTxResponse } from "./firmachain/common/stargateclient";
2
3
  import { FirmaWalletService } from "./FirmaWalletService";
3
4
  import { FirmaConfig } from "./FirmaConfig";
4
- import { DeliverTxResponse } from "./firmachain/common/stargateclient";
5
5
  import { Plan } from "cosmjs-types/cosmos/upgrade/v1beta1/upgrade";
6
6
  import { Coin } from "cosmjs-types/cosmos/base/v1beta1/coin";
7
- import { Params as StakingParams } from "cosmjs-types/cosmos/staking/v1beta1/staking";
8
- import { Params as GovParams } from "cosmjs-types/cosmos/gov/v1/gov";
7
+ import { Proposal, Params as GovParams } from "@kintsugi-tech/cosmjs-types/cosmos/gov/v1/gov";
8
+ import { Params as StakingParams } from "@kintsugi-tech/cosmjs-types/cosmos/staking/v1beta1/staking";
9
9
  export declare class FirmaGovService {
10
10
  private readonly config;
11
11
  static readonly GOV_AUTHORITY = "firma10d07y265gmmuvt4z0w9aw880jnsr700j53mj8f";
@@ -39,8 +39,9 @@ export declare class FirmaGovService {
39
39
  private getSignedTxDeposit;
40
40
  deposit(wallet: FirmaWalletService, proposalId: number, amount: number, txMisc?: TxMisc): Promise<DeliverTxResponse>;
41
41
  getCurrentVoteInfo(id: string): Promise<CurrentVoteInfo>;
42
- getParam(): Promise<ProposalParam>;
43
- getProposal(id: string): Promise<ProposalInfo>;
44
- getProposalListByStatus(status: ProposalStatus): Promise<ProposalInfo[]>;
45
- getProposalList(): Promise<ProposalInfo[]>;
42
+ getParam(): Promise<GovParamType>;
43
+ getParamAsGovParams(): Promise<GovParams>;
44
+ getProposal(id: string): Promise<Proposal>;
45
+ getProposalListByStatus(status: ProposalStatus): Promise<Proposal[]>;
46
+ getProposalList(): Promise<Proposal[]>;
46
47
  }
@@ -35,17 +35,21 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
35
35
  if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
36
36
  }
37
37
  };
38
+ var __importDefault = (this && this.__importDefault) || function (mod) {
39
+ return (mod && mod.__esModule) ? mod : { "default": mod };
40
+ };
38
41
  Object.defineProperty(exports, "__esModule", { value: true });
39
42
  exports.FirmaGovService = void 0;
40
43
  var gov_1 = require("./firmachain/gov");
41
- var FirmaUtil_1 = require("./FirmaUtil");
42
44
  var any_1 = require("./firmachain/google/protobuf/any");
45
+ var FirmaUtil_1 = require("./FirmaUtil");
43
46
  var gov_2 = require("cosmjs-types/cosmos/gov/v1beta1/gov");
44
- var tx_1 = require("@kintsugi-tech/cosmjs-types/cosmos/gov/v1/tx");
45
- var tx_2 = require("@kintsugi-tech/cosmjs-types/cosmos/upgrade/v1beta1/tx");
46
- var tx_3 = require("@kintsugi-tech/cosmjs-types/cosmos/distribution/v1beta1/tx");
47
- var tx_4 = require("cosmjs-types/cosmos/staking/v1beta1/tx");
48
- var tx_5 = require("cosmjs-types/cosmos/gov/v1/tx");
47
+ var tx_1 = require("cosmjs-types/cosmos/staking/v1beta1/tx");
48
+ var fast_deep_equal_1 = __importDefault(require("fast-deep-equal"));
49
+ // temporarly using kintsugi-tech/cosmjs-types - this will be returned to original cosmjs-types after the PR is merged
50
+ var tx_2 = require("@kintsugi-tech/cosmjs-types/cosmos/gov/v1/tx");
51
+ var tx_3 = require("@kintsugi-tech/cosmjs-types/cosmos/upgrade/v1beta1/tx");
52
+ var tx_4 = require("@kintsugi-tech/cosmjs-types/cosmos/distribution/v1beta1/tx");
49
53
  var FirmaGovService = /** @class */ (function () {
50
54
  function FirmaGovService(config) {
51
55
  this.config = config;
@@ -107,7 +111,7 @@ var FirmaGovService = /** @class */ (function () {
107
111
  _a.trys.push([0, 3, , 4]);
108
112
  message = {
109
113
  typeUrl: "/cosmos.upgrade.v1beta1.MsgSoftwareUpgrade",
110
- value: tx_2.MsgSoftwareUpgrade.encode(tx_2.MsgSoftwareUpgrade.fromPartial({
114
+ value: tx_3.MsgSoftwareUpgrade.encode(tx_3.MsgSoftwareUpgrade.fromPartial({
111
115
  authority: FirmaGovService.GOV_AUTHORITY,
112
116
  plan: plan
113
117
  })).finish()
@@ -130,14 +134,25 @@ var FirmaGovService = /** @class */ (function () {
130
134
  if (metadata === void 0) { metadata = ""; }
131
135
  if (txMisc === void 0) { txMisc = FirmaUtil_1.DefaultTxMisc; }
132
136
  return __awaiter(this, void 0, void 0, function () {
133
- var message, txRaw, error_4;
137
+ var requestedParams, fromPartialParams, message, txRaw, error_4;
134
138
  return __generator(this, function (_a) {
135
139
  switch (_a.label) {
136
140
  case 0:
137
141
  _a.trys.push([0, 3, , 4]);
142
+ requestedParams = {
143
+ authority: FirmaGovService.GOV_AUTHORITY,
144
+ params: params
145
+ };
146
+ fromPartialParams = tx_1.MsgUpdateParams.fromPartial({
147
+ authority: FirmaGovService.GOV_AUTHORITY,
148
+ params: params
149
+ });
150
+ if (!fast_deep_equal_1.default(requestedParams.params, fromPartialParams.params)) {
151
+ throw new Error("All staking parameters must be provided. Use Staking.getParamsAsStakingParams() to get current values and override only the parameters you want to change.");
152
+ }
138
153
  message = {
139
154
  typeUrl: "/cosmos.staking.v1beta1.MsgUpdateParams",
140
- value: tx_4.MsgUpdateParams.encode(tx_4.MsgUpdateParams.fromPartial({
155
+ value: tx_1.MsgUpdateParams.encode(tx_1.MsgUpdateParams.fromPartial({
141
156
  authority: FirmaGovService.GOV_AUTHORITY,
142
157
  params: params
143
158
  })).finish()
@@ -160,19 +175,30 @@ var FirmaGovService = /** @class */ (function () {
160
175
  if (metadata === void 0) { metadata = ""; }
161
176
  if (txMisc === void 0) { txMisc = FirmaUtil_1.DefaultTxMisc; }
162
177
  return __awaiter(this, void 0, void 0, function () {
163
- var message, txRaw, error_5;
178
+ var requestedParams, fromPartialParams, message, txRaw, error_5;
164
179
  return __generator(this, function (_a) {
165
180
  switch (_a.label) {
166
181
  case 0:
167
182
  _a.trys.push([0, 3, , 4]);
183
+ requestedParams = {
184
+ authority: FirmaGovService.GOV_AUTHORITY,
185
+ params: params
186
+ };
187
+ fromPartialParams = tx_2.MsgUpdateParams.fromPartial({
188
+ authority: FirmaGovService.GOV_AUTHORITY,
189
+ params: params
190
+ });
191
+ if (!fast_deep_equal_1.default(requestedParams.params, fromPartialParams.params)) {
192
+ throw new Error("All governance parameters must be provided. Use getParamAsGovParams() to get current values and override only the parameters you want to change.");
193
+ }
168
194
  message = {
169
195
  typeUrl: "/cosmos.gov.v1.MsgUpdateParams",
170
- value: tx_5.MsgUpdateParams.encode(tx_5.MsgUpdateParams.fromPartial({
196
+ value: tx_2.MsgUpdateParams.encode(tx_2.MsgUpdateParams.fromPartial({
171
197
  authority: FirmaGovService.GOV_AUTHORITY,
172
198
  params: params
173
199
  })).finish()
174
200
  };
175
- return [4 /*yield*/, this.getSignedTxSubmitStakingParamsUpdateProposal(wallet, title, summary, initialDepositFCT, [message], metadata, txMisc)];
201
+ return [4 /*yield*/, this.getSignedTxSubmitGovParamsUpdateProposal(wallet, title, summary, initialDepositFCT, [message], metadata, txMisc)];
176
202
  case 1:
177
203
  txRaw = _a.sent();
178
204
  return [4 /*yield*/, FirmaUtil_1.FirmaUtil.estimateGas(txRaw)];
@@ -197,7 +223,7 @@ var FirmaGovService = /** @class */ (function () {
197
223
  amount = FirmaUtil_1.FirmaUtil.getUFCTStringFromFCT(amountFCT);
198
224
  message = {
199
225
  typeUrl: "/cosmos.distribution.v1beta1.MsgCommunityPoolSpend",
200
- value: Uint8Array.from(tx_3.MsgCommunityPoolSpend.encode(tx_3.MsgCommunityPoolSpend.fromPartial({
226
+ value: Uint8Array.from(tx_4.MsgCommunityPoolSpend.encode(tx_4.MsgCommunityPoolSpend.fromPartial({
201
227
  authority: FirmaGovService.GOV_AUTHORITY,
202
228
  recipient: recipient,
203
229
  amount: [{
@@ -312,7 +338,7 @@ var FirmaGovService = /** @class */ (function () {
312
338
  initialDeposit = [{ amount: FirmaUtil_1.FirmaUtil.getUFCTStringFromFCT(initialDepositFCT), denom: this.config.denom }];
313
339
  message = {
314
340
  typeUrl: "/cosmos.gov.v1.MsgSubmitProposal",
315
- value: tx_1.MsgSubmitProposal.fromPartial({
341
+ value: tx_2.MsgSubmitProposal.fromPartial({
316
342
  title: title,
317
343
  summary: summary,
318
344
  metadata: metadata,
@@ -348,7 +374,7 @@ var FirmaGovService = /** @class */ (function () {
348
374
  initialDeposit = [{ amount: FirmaUtil_1.FirmaUtil.getUFCTStringFromFCT(initialDepositFCT), denom: this.config.denom }];
349
375
  message = {
350
376
  typeUrl: "/cosmos.gov.v1.MsgSubmitProposal",
351
- value: tx_1.MsgSubmitProposal.fromPartial({
377
+ value: tx_2.MsgSubmitProposal.fromPartial({
352
378
  title: title,
353
379
  summary: summary,
354
380
  metadata: metadata,
@@ -384,7 +410,7 @@ var FirmaGovService = /** @class */ (function () {
384
410
  initialDeposit = [{ amount: FirmaUtil_1.FirmaUtil.getUFCTStringFromFCT(initialDepositFCT), denom: this.config.denom }];
385
411
  message = {
386
412
  typeUrl: "/cosmos.gov.v1.MsgSubmitProposal",
387
- value: tx_1.MsgSubmitProposal.fromPartial({
413
+ value: tx_2.MsgSubmitProposal.fromPartial({
388
414
  title: title,
389
415
  summary: summary,
390
416
  metadata: metadata,
@@ -420,7 +446,7 @@ var FirmaGovService = /** @class */ (function () {
420
446
  initialDeposit = [{ amount: FirmaUtil_1.FirmaUtil.getUFCTStringFromFCT(initialDepositFCT), denom: this.config.denom }];
421
447
  message = {
422
448
  typeUrl: "/cosmos.gov.v1.MsgSubmitProposal",
423
- value: tx_1.MsgSubmitProposal.fromPartial({
449
+ value: tx_2.MsgSubmitProposal.fromPartial({
424
450
  title: title,
425
451
  summary: summary,
426
452
  metadata: metadata,
@@ -452,7 +478,7 @@ var FirmaGovService = /** @class */ (function () {
452
478
  proposer = _a.sent();
453
479
  message = {
454
480
  typeUrl: "/cosmos.gov.v1.MsgCancelProposal",
455
- value: tx_1.MsgCancelProposal.fromPartial({
481
+ value: tx_2.MsgCancelProposal.fromPartial({
456
482
  proposalId: BigInt(proposalId),
457
483
  proposer: proposer
458
484
  })
@@ -475,7 +501,7 @@ var FirmaGovService = /** @class */ (function () {
475
501
  _a.trys.push([0, 3, , 4]);
476
502
  message = {
477
503
  typeUrl: "/cosmos.upgrade.v1beta1.MsgSoftwareUpgrade",
478
- value: tx_2.MsgSoftwareUpgrade.encode(tx_2.MsgSoftwareUpgrade.fromPartial({
504
+ value: tx_3.MsgSoftwareUpgrade.encode(tx_3.MsgSoftwareUpgrade.fromPartial({
479
505
  authority: FirmaGovService.GOV_AUTHORITY,
480
506
  plan: plan
481
507
  })).finish()
@@ -499,14 +525,25 @@ var FirmaGovService = /** @class */ (function () {
499
525
  if (metadata === void 0) { metadata = ""; }
500
526
  if (txMisc === void 0) { txMisc = FirmaUtil_1.DefaultTxMisc; }
501
527
  return __awaiter(this, void 0, void 0, function () {
502
- var message, txRaw, txClient, error_15;
528
+ var requestedParams, fromPartialParams, message, txRaw, txClient, error_15;
503
529
  return __generator(this, function (_a) {
504
530
  switch (_a.label) {
505
531
  case 0:
506
532
  _a.trys.push([0, 3, , 4]);
533
+ requestedParams = {
534
+ authority: FirmaGovService.GOV_AUTHORITY,
535
+ params: params
536
+ };
537
+ fromPartialParams = tx_1.MsgUpdateParams.fromPartial({
538
+ authority: FirmaGovService.GOV_AUTHORITY,
539
+ params: params
540
+ });
541
+ if (!fast_deep_equal_1.default(requestedParams.params, fromPartialParams.params)) {
542
+ throw new Error("All staking parameters must be provided. Use Staking.getParamsAsStakingParams() to get current values and override only the parameters you want to change.");
543
+ }
507
544
  message = {
508
545
  typeUrl: "/cosmos.staking.v1beta1.MsgUpdateParams",
509
- value: tx_4.MsgUpdateParams.encode(tx_4.MsgUpdateParams.fromPartial({
546
+ value: tx_1.MsgUpdateParams.encode(tx_1.MsgUpdateParams.fromPartial({
510
547
  authority: FirmaGovService.GOV_AUTHORITY,
511
548
  params: params
512
549
  })).finish()
@@ -530,14 +567,25 @@ var FirmaGovService = /** @class */ (function () {
530
567
  if (metadata === void 0) { metadata = ""; }
531
568
  if (txmisc === void 0) { txmisc = FirmaUtil_1.DefaultTxMisc; }
532
569
  return __awaiter(this, void 0, void 0, function () {
533
- var message, txRaw, txClient, error_16;
570
+ var requestedParams, fromPartialParams, message, txRaw, txClient, error_16;
534
571
  return __generator(this, function (_a) {
535
572
  switch (_a.label) {
536
573
  case 0:
537
574
  _a.trys.push([0, 3, , 4]);
575
+ requestedParams = {
576
+ authority: FirmaGovService.GOV_AUTHORITY,
577
+ params: params
578
+ };
579
+ fromPartialParams = tx_2.MsgUpdateParams.fromPartial({
580
+ authority: FirmaGovService.GOV_AUTHORITY,
581
+ params: params
582
+ });
583
+ if (!fast_deep_equal_1.default(requestedParams.params, fromPartialParams.params)) {
584
+ throw new Error("All governance parameters must be provided. Use getParamAsGovParams() to get current values and override only the parameters you want to change.");
585
+ }
538
586
  message = {
539
587
  typeUrl: "/cosmos.gov.v1.MsgUpdateParams",
540
- value: tx_5.MsgUpdateParams.encode(tx_5.MsgUpdateParams.fromPartial({
588
+ value: tx_2.MsgUpdateParams.encode(tx_2.MsgUpdateParams.fromPartial({
541
589
  authority: FirmaGovService.GOV_AUTHORITY,
542
590
  params: params
543
591
  })).finish()
@@ -569,7 +617,7 @@ var FirmaGovService = /** @class */ (function () {
569
617
  amount = FirmaUtil_1.FirmaUtil.getUFCTStringFromFCT(amountFCT);
570
618
  message = {
571
619
  typeUrl: "/cosmos.distribution.v1beta1.MsgCommunityPoolSpend",
572
- value: Uint8Array.from(tx_3.MsgCommunityPoolSpend.encode(tx_3.MsgCommunityPoolSpend.fromPartial({
620
+ value: Uint8Array.from(tx_4.MsgCommunityPoolSpend.encode(tx_4.MsgCommunityPoolSpend.fromPartial({
573
621
  authority: FirmaGovService.GOV_AUTHORITY,
574
622
  recipient: recipient,
575
623
  amount: [{
@@ -629,7 +677,7 @@ var FirmaGovService = /** @class */ (function () {
629
677
  proposer = _a.sent();
630
678
  message = {
631
679
  typeUrl: "/cosmos.gov.v1.MsgSubmitProposal",
632
- value: tx_1.MsgSubmitProposal.fromPartial({
680
+ value: tx_2.MsgSubmitProposal.fromPartial({
633
681
  title: title,
634
682
  summary: summary,
635
683
  metadata: metadata,
@@ -816,7 +864,7 @@ var FirmaGovService = /** @class */ (function () {
816
864
  });
817
865
  });
818
866
  };
819
- FirmaGovService.prototype.getProposal = function (id) {
867
+ FirmaGovService.prototype.getParamAsGovParams = function () {
820
868
  return __awaiter(this, void 0, void 0, function () {
821
869
  var queryClient, result, error_27;
822
870
  return __generator(this, function (_a) {
@@ -824,10 +872,28 @@ var FirmaGovService = /** @class */ (function () {
824
872
  case 0:
825
873
  _a.trys.push([0, 2, , 3]);
826
874
  queryClient = new gov_1.GovQueryClient(this.config.restApiAddress);
827
- return [4 /*yield*/, queryClient.queryGetProposal(id)];
875
+ return [4 /*yield*/, queryClient.queryGetParam()];
828
876
  case 1:
829
877
  result = _a.sent();
830
- return [2 /*return*/, result];
878
+ // return as GovParams type
879
+ return [2 /*return*/, {
880
+ minDeposit: result.min_deposit,
881
+ maxDepositPeriod: FirmaUtil_1.FirmaUtil.createDurationFromString(result.max_deposit_period),
882
+ votingPeriod: FirmaUtil_1.FirmaUtil.createDurationFromString(result.voting_period),
883
+ quorum: result.quorum,
884
+ threshold: result.threshold,
885
+ vetoThreshold: result.veto_threshold,
886
+ minInitialDepositRatio: result.min_initial_deposit_ratio,
887
+ proposalCancelRatio: result.proposal_cancel_ratio,
888
+ proposalCancelDest: result.proposal_cancel_dest,
889
+ expeditedVotingPeriod: FirmaUtil_1.FirmaUtil.createDurationFromString(result.expedited_voting_period),
890
+ expeditedThreshold: result.expedited_threshold,
891
+ expeditedMinDeposit: result.expedited_min_deposit,
892
+ burnVoteQuorum: result.burn_vote_quorum,
893
+ burnProposalDepositPrevote: result.burn_proposal_deposit_prevote,
894
+ burnVoteVeto: result.burn_vote_veto,
895
+ minDepositRatio: result.min_deposit_ratio
896
+ }];
831
897
  case 2:
832
898
  error_27 = _a.sent();
833
899
  FirmaUtil_1.FirmaUtil.printLog(error_27);
@@ -837,7 +903,7 @@ var FirmaGovService = /** @class */ (function () {
837
903
  });
838
904
  });
839
905
  };
840
- FirmaGovService.prototype.getProposalListByStatus = function (status) {
906
+ FirmaGovService.prototype.getProposal = function (id) {
841
907
  return __awaiter(this, void 0, void 0, function () {
842
908
  var queryClient, result, error_28;
843
909
  return __generator(this, function (_a) {
@@ -845,7 +911,7 @@ var FirmaGovService = /** @class */ (function () {
845
911
  case 0:
846
912
  _a.trys.push([0, 2, , 3]);
847
913
  queryClient = new gov_1.GovQueryClient(this.config.restApiAddress);
848
- return [4 /*yield*/, queryClient.queryGetProposalListByStatus(status)];
914
+ return [4 /*yield*/, queryClient.queryGetProposal(id)];
849
915
  case 1:
850
916
  result = _a.sent();
851
917
  return [2 /*return*/, result];
@@ -858,7 +924,7 @@ var FirmaGovService = /** @class */ (function () {
858
924
  });
859
925
  });
860
926
  };
861
- FirmaGovService.prototype.getProposalList = function () {
927
+ FirmaGovService.prototype.getProposalListByStatus = function (status) {
862
928
  return __awaiter(this, void 0, void 0, function () {
863
929
  var queryClient, result, error_29;
864
930
  return __generator(this, function (_a) {
@@ -866,7 +932,7 @@ var FirmaGovService = /** @class */ (function () {
866
932
  case 0:
867
933
  _a.trys.push([0, 2, , 3]);
868
934
  queryClient = new gov_1.GovQueryClient(this.config.restApiAddress);
869
- return [4 /*yield*/, queryClient.queryGetProposalList()];
935
+ return [4 /*yield*/, queryClient.queryGetProposalListByStatus(status)];
870
936
  case 1:
871
937
  result = _a.sent();
872
938
  return [2 /*return*/, result];
@@ -879,6 +945,27 @@ var FirmaGovService = /** @class */ (function () {
879
945
  });
880
946
  });
881
947
  };
948
+ FirmaGovService.prototype.getProposalList = function () {
949
+ return __awaiter(this, void 0, void 0, function () {
950
+ var queryClient, result, error_30;
951
+ return __generator(this, function (_a) {
952
+ switch (_a.label) {
953
+ case 0:
954
+ _a.trys.push([0, 2, , 3]);
955
+ queryClient = new gov_1.GovQueryClient(this.config.restApiAddress);
956
+ return [4 /*yield*/, queryClient.queryGetProposalList()];
957
+ case 1:
958
+ result = _a.sent();
959
+ return [2 /*return*/, result];
960
+ case 2:
961
+ error_30 = _a.sent();
962
+ FirmaUtil_1.FirmaUtil.printLog(error_30);
963
+ throw error_30;
964
+ case 3: return [2 /*return*/];
965
+ }
966
+ });
967
+ });
968
+ };
882
969
  FirmaGovService.GOV_AUTHORITY = "firma10d07y265gmmuvt4z0w9aw880jnsr700j53mj8f";
883
970
  return FirmaGovService;
884
971
  }());
@@ -1,9 +1,10 @@
1
- import { StakingTxClient, TxMisc, ValidatorDataType, PoolDataType, ParamsDataType, DelegationInfo, RedelegationInfo, UndelegationInfo, Pagination } from "./firmachain/staking";
1
+ import { StakingTxClient, TxMisc, ValidatorDataType, PoolDataType, DelegationInfo, RedelegationInfo, UndelegationInfo, Pagination, StakingParamType } from "./firmachain/staking";
2
2
  import { FirmaWalletService } from "./FirmaWalletService";
3
3
  import { FirmaConfig } from "./FirmaConfig";
4
4
  import { DeliverTxResponse } from "./firmachain/common/stargateclient";
5
5
  import { Description } from "cosmjs-types/cosmos/staking/v1beta1/staking";
6
6
  import { MsgCreateValidator } from "cosmjs-types/cosmos/staking/v1beta1/tx";
7
+ import { Params as StakingParams } from "@kintsugi-tech/cosmjs-types/cosmos/staking/v1beta1/staking";
7
8
  export declare enum StakingValidatorStatus {
8
9
  ALL = "",
9
10
  BONDED = "BOND_STATUS_BONDED",
@@ -43,7 +44,8 @@ export declare class FirmaStakingService {
43
44
  dataList: DelegationInfo[];
44
45
  pagination: Pagination;
45
46
  }>;
46
- getParams(): Promise<ParamsDataType>;
47
+ getParams(): Promise<StakingParamType>;
48
+ getParamsAsStakingParams(): Promise<StakingParams>;
47
49
  getPool(): Promise<PoolDataType>;
48
50
  getValidator(valoperAddress: string): Promise<ValidatorDataType>;
49
51
  getValidatorList(status?: StakingValidatorStatus, paginationKey?: string): Promise<{
@@ -549,7 +549,7 @@ var FirmaStakingService = /** @class */ (function () {
549
549
  });
550
550
  });
551
551
  };
552
- FirmaStakingService.prototype.getPool = function () {
552
+ FirmaStakingService.prototype.getParamsAsStakingParams = function () {
553
553
  return __awaiter(this, void 0, void 0, function () {
554
554
  var queryClient, result, error_22;
555
555
  return __generator(this, function (_a) {
@@ -557,10 +557,17 @@ var FirmaStakingService = /** @class */ (function () {
557
557
  case 0:
558
558
  _a.trys.push([0, 2, , 3]);
559
559
  queryClient = new staking_1.StakingQueryClient(this.config.restApiAddress);
560
- return [4 /*yield*/, queryClient.queryGetPool()];
560
+ return [4 /*yield*/, queryClient.queryGetParams()];
561
561
  case 1:
562
562
  result = _a.sent();
563
- return [2 /*return*/, result];
563
+ return [2 /*return*/, {
564
+ unbondingTime: FirmaUtil_1.FirmaUtil.createDurationFromString(result.unbonding_time),
565
+ maxValidators: result.max_validators,
566
+ maxEntries: result.max_entries,
567
+ historicalEntries: result.historical_entries,
568
+ bondDenom: result.bond_denom,
569
+ minCommissionRate: result.min_commission_rate
570
+ }];
564
571
  case 2:
565
572
  error_22 = _a.sent();
566
573
  FirmaUtil_1.FirmaUtil.printLog(error_22);
@@ -570,7 +577,7 @@ var FirmaStakingService = /** @class */ (function () {
570
577
  });
571
578
  });
572
579
  };
573
- FirmaStakingService.prototype.getValidator = function (valoperAddress) {
580
+ FirmaStakingService.prototype.getPool = function () {
574
581
  return __awaiter(this, void 0, void 0, function () {
575
582
  var queryClient, result, error_23;
576
583
  return __generator(this, function (_a) {
@@ -578,7 +585,7 @@ var FirmaStakingService = /** @class */ (function () {
578
585
  case 0:
579
586
  _a.trys.push([0, 2, , 3]);
580
587
  queryClient = new staking_1.StakingQueryClient(this.config.restApiAddress);
581
- return [4 /*yield*/, queryClient.queryValidator(valoperAddress)];
588
+ return [4 /*yield*/, queryClient.queryGetPool()];
582
589
  case 1:
583
590
  result = _a.sent();
584
591
  return [2 /*return*/, result];
@@ -591,9 +598,7 @@ var FirmaStakingService = /** @class */ (function () {
591
598
  });
592
599
  });
593
600
  };
594
- FirmaStakingService.prototype.getValidatorList = function (status, paginationKey) {
595
- if (status === void 0) { status = StakingValidatorStatus.ALL; }
596
- if (paginationKey === void 0) { paginationKey = ""; }
601
+ FirmaStakingService.prototype.getValidator = function (valoperAddress) {
597
602
  return __awaiter(this, void 0, void 0, function () {
598
603
  var queryClient, result, error_24;
599
604
  return __generator(this, function (_a) {
@@ -601,7 +606,7 @@ var FirmaStakingService = /** @class */ (function () {
601
606
  case 0:
602
607
  _a.trys.push([0, 2, , 3]);
603
608
  queryClient = new staking_1.StakingQueryClient(this.config.restApiAddress);
604
- return [4 /*yield*/, queryClient.queryValidators(status.toString(), paginationKey)];
609
+ return [4 /*yield*/, queryClient.queryValidator(valoperAddress)];
605
610
  case 1:
606
611
  result = _a.sent();
607
612
  return [2 /*return*/, result];
@@ -614,6 +619,29 @@ var FirmaStakingService = /** @class */ (function () {
614
619
  });
615
620
  });
616
621
  };
622
+ FirmaStakingService.prototype.getValidatorList = function (status, paginationKey) {
623
+ if (status === void 0) { status = StakingValidatorStatus.ALL; }
624
+ if (paginationKey === void 0) { paginationKey = ""; }
625
+ return __awaiter(this, void 0, void 0, function () {
626
+ var queryClient, result, error_25;
627
+ return __generator(this, function (_a) {
628
+ switch (_a.label) {
629
+ case 0:
630
+ _a.trys.push([0, 2, , 3]);
631
+ queryClient = new staking_1.StakingQueryClient(this.config.restApiAddress);
632
+ return [4 /*yield*/, queryClient.queryValidators(status.toString(), paginationKey)];
633
+ case 1:
634
+ result = _a.sent();
635
+ return [2 /*return*/, result];
636
+ case 2:
637
+ error_25 = _a.sent();
638
+ FirmaUtil_1.FirmaUtil.printLog(error_25);
639
+ throw error_25;
640
+ case 3: return [2 /*return*/];
641
+ }
642
+ });
643
+ });
644
+ };
617
645
  return FirmaStakingService;
618
646
  }());
619
647
  exports.FirmaStakingService = FirmaStakingService;
@@ -7,6 +7,7 @@ import { FirmaWalletService } from "./FirmaWalletService";
7
7
  import { ArbitraryVerifyData } from "./firmachain/common/signingstargateclient";
8
8
  import { Any } from "./firmachain/google/protobuf/any";
9
9
  import { CommonTxClient } from "./firmachain/common/CommonTxClient";
10
+ import { Duration } from "cosmjs-types/google/protobuf/duration";
10
11
  export declare class FirmaUtil {
11
12
  static config: FirmaConfig;
12
13
  static readonly FctDecimal: number;
@@ -49,6 +50,33 @@ export declare class FirmaUtil {
49
50
  static makeSignDocWithStringify(signerAddress: string, pubkey: string, messages: readonly EncodeObject[], txMisc?: TxMisc): Promise<string>;
50
51
  static getAnyData(registry: Registry, message: EncodeObject): Any;
51
52
  static getCommonTxClient(aliceWallet: FirmaWalletService): CommonTxClient;
53
+ /**
54
+ * Parses a duration string to a Duration object.
55
+ * Supports formats like "336h0m0s", "21d", "1000ms", "1s", "1m", "1h", "1ns", "1ยตs"/"1us"
56
+ *
57
+ * @param durationStr - Duration string to parse (e.g., "336h0m0s", "21d")
58
+ * @returns Duration object with seconds and nanos fields
59
+ */
60
+ static parseDurationString(durationStr: string): {
61
+ seconds: bigint;
62
+ nanos: number;
63
+ };
64
+ /**
65
+ * Creates a Duration object from a duration string.
66
+ * This is a convenience method that combines parseDurationString with Duration.fromPartial.
67
+ *
68
+ * @param durationStr - Duration string to parse (e.g., "336h0m0s", "21d")
69
+ * @returns Duration object ready to use with protobuf
70
+ */
71
+ static createDurationFromString(durationStr: string): Duration;
72
+ /**
73
+ * Safely processes commission rate strings to prevent big.Int conversion errors.
74
+ * Converts decimal commission rates to Cosmos SDK atomics format (integer representation).
75
+ *
76
+ * @param commissionRate - Commission rate string from staking params
77
+ * @returns Processed commission rate string safe for protobuf usage (atomics format or empty string)
78
+ */
79
+ static processCommissionRateAsDecimal(commissionRate: string): string;
52
80
  }
53
81
  export declare const DefaultTxMisc: {
54
82
  memo: string;