@firmachain/firma-js 0.2.31 → 0.2.34

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 (103) hide show
  1. package/dist/index.js +5 -1
  2. package/dist/sdk/FirmaAuthzService.d.ts +13 -4
  3. package/dist/sdk/FirmaAuthzService.js +29 -26
  4. package/dist/sdk/FirmaBankService.js +2 -2
  5. package/dist/sdk/FirmaContractService.js +14 -16
  6. package/dist/sdk/FirmaCosmWasmService.js +27 -29
  7. package/dist/sdk/FirmaDistributionService.js +10 -10
  8. package/dist/sdk/FirmaFeeGrantService.js +6 -6
  9. package/dist/sdk/FirmaGovService.js +26 -26
  10. package/dist/sdk/FirmaIbcService.d.ts +15 -0
  11. package/dist/sdk/FirmaIbcService.js +144 -0
  12. package/dist/sdk/FirmaIpfsService.js +1 -1
  13. package/dist/sdk/FirmaNftService.js +9 -9
  14. package/dist/sdk/FirmaSDK.d.ts +3 -1
  15. package/dist/sdk/FirmaSDK.js +4 -1
  16. package/dist/sdk/FirmaStakingService.d.ts +17 -5
  17. package/dist/sdk/FirmaStakingService.js +22 -18
  18. package/dist/sdk/FirmaTokenService.js +16 -16
  19. package/dist/sdk/FirmaUtil.d.ts +19 -1
  20. package/dist/sdk/FirmaUtil.js +198 -3
  21. package/dist/sdk/FirmaWalletService.d.ts +3 -0
  22. package/dist/sdk/FirmaWalletService.js +21 -13
  23. package/dist/sdk/firmachain/amino/addresses.js +11 -11
  24. package/dist/sdk/firmachain/amino/aminotypes.js +36 -32
  25. package/dist/sdk/firmachain/amino/encoding.js +30 -26
  26. package/dist/sdk/firmachain/amino/multisig.js +5 -5
  27. package/dist/sdk/firmachain/amino/signature.js +4 -4
  28. package/dist/sdk/firmachain/amino/signdoc.js +1 -1
  29. package/dist/sdk/firmachain/amino/signer.d.ts +1 -2
  30. package/dist/sdk/firmachain/amino/wallet.js +14 -10
  31. package/dist/sdk/firmachain/authz/AuthzQueryClient.d.ts +13 -3
  32. package/dist/sdk/firmachain/authz/AuthzQueryClient.js +42 -15
  33. package/dist/sdk/firmachain/authz/AuthzTxClient.d.ts +5 -4
  34. package/dist/sdk/firmachain/authz/AuthzTxClient.js +6 -3
  35. package/dist/sdk/firmachain/authz/index.js +5 -1
  36. package/dist/sdk/firmachain/bank/BankQueryClient.js +4 -4
  37. package/dist/sdk/firmachain/bank/BankTxClient.d.ts +4 -3
  38. package/dist/sdk/firmachain/bank/BankTxClient.js +5 -2
  39. package/dist/sdk/firmachain/bank/index.js +5 -1
  40. package/dist/sdk/firmachain/common/CommonTxClient.d.ts +7 -0
  41. package/dist/sdk/firmachain/common/CommonTxClient.js +79 -0
  42. package/dist/sdk/firmachain/common/ITxClient.d.ts +3 -3
  43. package/dist/sdk/firmachain/common/ITxClient.js +14 -8
  44. package/dist/sdk/firmachain/common/LedgerSigningStargateClient.js +2 -2
  45. package/dist/sdk/firmachain/common/LedgerWallet.js +14 -10
  46. package/dist/sdk/firmachain/common/accounts.js +2 -2
  47. package/dist/sdk/firmachain/common/index.js +5 -1
  48. package/dist/sdk/firmachain/common/signing.js +9 -5
  49. package/dist/sdk/firmachain/common/signingaminostargateclient.d.ts +50 -0
  50. package/dist/sdk/firmachain/common/signingaminostargateclient.js +267 -0
  51. package/dist/sdk/firmachain/common/signingstargateclient.d.ts +15 -8
  52. package/dist/sdk/firmachain/common/signingstargateclient.js +82 -19
  53. package/dist/sdk/firmachain/common/stargateclient.js +6 -6
  54. package/dist/sdk/firmachain/contract/ContractQueryClient.js +2 -2
  55. package/dist/sdk/firmachain/contract/ContractTxClient.d.ts +4 -3
  56. package/dist/sdk/firmachain/contract/ContractTxClient.js +5 -2
  57. package/dist/sdk/firmachain/contract/ContractTxTypes.d.ts +4 -4
  58. package/dist/sdk/firmachain/contract/index.js +5 -1
  59. package/dist/sdk/firmachain/cosmwasm/CosmWasmQueryClient.js +7 -7
  60. package/dist/sdk/firmachain/cosmwasm/CosmWasmTxClient.d.ts +8 -7
  61. package/dist/sdk/firmachain/cosmwasm/CosmWasmTxClient.js +9 -6
  62. package/dist/sdk/firmachain/cosmwasm/index.js +5 -1
  63. package/dist/sdk/firmachain/distribution/DistributionQueryClient.js +5 -5
  64. package/dist/sdk/firmachain/distribution/DistributionTxClient.d.ts +6 -5
  65. package/dist/sdk/firmachain/distribution/DistributionTxClient.js +7 -4
  66. package/dist/sdk/firmachain/distribution/index.js +5 -1
  67. package/dist/sdk/firmachain/feegrant/FeeGrantQueryClient.js +2 -2
  68. package/dist/sdk/firmachain/feegrant/FeeGrantTxClient.d.ts +4 -3
  69. package/dist/sdk/firmachain/feegrant/FeeGrantTxClient.js +5 -2
  70. package/dist/sdk/firmachain/feegrant/index.js +5 -1
  71. package/dist/sdk/firmachain/google/protobuf/any.d.ts +1 -1
  72. package/dist/sdk/firmachain/google/protobuf/descriptor.d.ts +27 -27
  73. package/dist/sdk/firmachain/google/protobuf/duration.d.ts +1 -1
  74. package/dist/sdk/firmachain/google/protobuf/timestamp.d.ts +1 -1
  75. package/dist/sdk/firmachain/gov/GovQueryClient.js +2 -2
  76. package/dist/sdk/firmachain/gov/GovTxClient.d.ts +5 -4
  77. package/dist/sdk/firmachain/gov/GovTxClient.js +6 -3
  78. package/dist/sdk/firmachain/gov/index.js +5 -1
  79. package/dist/sdk/firmachain/ibc/IbcQueryClient.d.ts +34 -0
  80. package/dist/sdk/firmachain/ibc/IbcQueryClient.js +71 -0
  81. package/dist/sdk/firmachain/ibc/IbcTxClient.d.ts +13 -0
  82. package/dist/sdk/firmachain/ibc/IbcTxClient.js +39 -0
  83. package/dist/sdk/firmachain/ibc/index.d.ts +3 -0
  84. package/dist/sdk/firmachain/ibc/index.js +19 -0
  85. package/dist/sdk/firmachain/nft/NftTxClient.d.ts +5 -4
  86. package/dist/sdk/firmachain/nft/NftTxClient.js +6 -3
  87. package/dist/sdk/firmachain/nft/NftTxTypes.d.ts +6 -6
  88. package/dist/sdk/firmachain/nft/index.js +5 -1
  89. package/dist/sdk/firmachain/slashing/index.js +5 -1
  90. package/dist/sdk/firmachain/staking/StakingQueryClient.d.ts +17 -4
  91. package/dist/sdk/firmachain/staking/StakingQueryClient.js +44 -24
  92. package/dist/sdk/firmachain/staking/StakingTxClient.d.ts +7 -6
  93. package/dist/sdk/firmachain/staking/StakingTxClient.js +8 -5
  94. package/dist/sdk/firmachain/staking/index.js +5 -1
  95. package/dist/sdk/firmachain/token/TokenTxClient.d.ts +6 -5
  96. package/dist/sdk/firmachain/token/TokenTxClient.js +7 -4
  97. package/dist/sdk/firmachain/token/TokenTxTypes.d.ts +8 -8
  98. package/dist/sdk/firmachain/token/index.js +5 -1
  99. package/package.json +2 -3
  100. package/dist/sdk/firmachain/amino/secp256k1hdwallet.d.ts +0 -94
  101. package/dist/sdk/firmachain/amino/secp256k1hdwallet.js +0 -437
  102. package/dist/sdk/firmachain/amino/secp256k1wallet.d.ts +0 -23
  103. package/dist/sdk/firmachain/amino/secp256k1wallet.js +0 -141
@@ -219,12 +219,11 @@ var FirmaGovService = /** @class */ (function () {
219
219
  FirmaGovService.prototype.getSignedTxSubmitTextProposal = function (wallet, title, description, initialDepositFCT, txMisc) {
220
220
  if (txMisc === void 0) { txMisc = FirmaUtil_1.DefaultTxMisc; }
221
221
  return __awaiter(this, void 0, void 0, function () {
222
- var txClient, sendAmount, proposal, content, proposer, message, error_8;
222
+ var sendAmount, proposal, content, proposer, message, txClient, error_8;
223
223
  return __generator(this, function (_a) {
224
224
  switch (_a.label) {
225
225
  case 0:
226
226
  _a.trys.push([0, 3, , 4]);
227
- txClient = new gov_1.GovTxClient(wallet, this.config.rpcAddress);
228
227
  sendAmount = { denom: this.config.denom, amount: FirmaUtil_1.FirmaUtil.getUFCTStringFromFCT(initialDepositFCT) };
229
228
  proposal = gov_2.TextProposal.fromPartial({
230
229
  title: title,
@@ -237,8 +236,9 @@ var FirmaGovService = /** @class */ (function () {
237
236
  return [4 /*yield*/, wallet.getAddress()];
238
237
  case 1:
239
238
  proposer = _a.sent();
240
- message = txClient.msgSubmitProposal({ content: content, initialDeposit: [sendAmount], proposer: proposer });
241
- return [4 /*yield*/, txClient.sign([message], FirmaUtil_1.getSignAndBroadcastOption(this.config.denom, txMisc))];
239
+ message = gov_1.GovTxClient.msgSubmitProposal({ content: content, initialDeposit: [sendAmount], proposer: proposer });
240
+ txClient = new gov_1.GovTxClient(wallet, this.config.rpcAddress);
241
+ return [4 /*yield*/, txClient.sign([message], (0, FirmaUtil_1.getSignAndBroadcastOption)(this.config.denom, txMisc))];
242
242
  case 2: return [2 /*return*/, _a.sent()];
243
243
  case 3:
244
244
  error_8 = _a.sent();
@@ -252,12 +252,11 @@ var FirmaGovService = /** @class */ (function () {
252
252
  FirmaGovService.prototype.getSignedTxSubmitCancelSoftwareUpgradeProposal = function (wallet, title, description, initialDepositFCT, txMisc) {
253
253
  if (txMisc === void 0) { txMisc = FirmaUtil_1.DefaultTxMisc; }
254
254
  return __awaiter(this, void 0, void 0, function () {
255
- var txClient, initialDepositAmount, proposal, content, proposer, message, error_9;
255
+ var initialDepositAmount, proposal, content, proposer, message, txClient, error_9;
256
256
  return __generator(this, function (_a) {
257
257
  switch (_a.label) {
258
258
  case 0:
259
259
  _a.trys.push([0, 3, , 4]);
260
- txClient = new gov_1.GovTxClient(wallet, this.config.rpcAddress);
261
260
  initialDepositAmount = {
262
261
  denom: this.config.denom,
263
262
  amount: FirmaUtil_1.FirmaUtil.getUFCTStringFromFCT(initialDepositFCT)
@@ -273,12 +272,13 @@ var FirmaGovService = /** @class */ (function () {
273
272
  return [4 /*yield*/, wallet.getAddress()];
274
273
  case 1:
275
274
  proposer = _a.sent();
276
- message = txClient.msgSubmitProposal({
275
+ message = gov_1.GovTxClient.msgSubmitProposal({
277
276
  content: content,
278
277
  initialDeposit: [initialDepositAmount],
279
278
  proposer: proposer
280
279
  });
281
- return [4 /*yield*/, txClient.sign([message], FirmaUtil_1.getSignAndBroadcastOption(this.config.denom, txMisc))];
280
+ txClient = new gov_1.GovTxClient(wallet, this.config.rpcAddress);
281
+ return [4 /*yield*/, txClient.sign([message], (0, FirmaUtil_1.getSignAndBroadcastOption)(this.config.denom, txMisc))];
282
282
  case 2: return [2 /*return*/, _a.sent()];
283
283
  case 3:
284
284
  error_9 = _a.sent();
@@ -292,12 +292,11 @@ var FirmaGovService = /** @class */ (function () {
292
292
  FirmaGovService.prototype.getSignedTxSubmitSoftwareUpgradeProposal = function (wallet, title, description, initialDepositFCT, plan, txMisc) {
293
293
  if (txMisc === void 0) { txMisc = FirmaUtil_1.DefaultTxMisc; }
294
294
  return __awaiter(this, void 0, void 0, function () {
295
- var txClient, initialDepositAmount, proposal, content, proposer, message, error_10;
295
+ var initialDepositAmount, proposal, content, proposer, message, txClient, error_10;
296
296
  return __generator(this, function (_a) {
297
297
  switch (_a.label) {
298
298
  case 0:
299
299
  _a.trys.push([0, 3, , 4]);
300
- txClient = new gov_1.GovTxClient(wallet, this.config.rpcAddress);
301
300
  initialDepositAmount = {
302
301
  denom: this.config.denom,
303
302
  amount: FirmaUtil_1.FirmaUtil.getUFCTStringFromFCT(initialDepositFCT)
@@ -314,12 +313,13 @@ var FirmaGovService = /** @class */ (function () {
314
313
  return [4 /*yield*/, wallet.getAddress()];
315
314
  case 1:
316
315
  proposer = _a.sent();
317
- message = txClient.msgSubmitProposal({
316
+ message = gov_1.GovTxClient.msgSubmitProposal({
318
317
  content: content,
319
318
  initialDeposit: [initialDepositAmount],
320
319
  proposer: proposer
321
320
  });
322
- return [4 /*yield*/, txClient.sign([message], FirmaUtil_1.getSignAndBroadcastOption(this.config.denom, txMisc))];
321
+ txClient = new gov_1.GovTxClient(wallet, this.config.rpcAddress);
322
+ return [4 /*yield*/, txClient.sign([message], (0, FirmaUtil_1.getSignAndBroadcastOption)(this.config.denom, txMisc))];
323
323
  case 2: return [2 /*return*/, _a.sent()];
324
324
  case 3:
325
325
  error_10 = _a.sent();
@@ -333,12 +333,11 @@ var FirmaGovService = /** @class */ (function () {
333
333
  FirmaGovService.prototype.getSignedTxSubmitParameterChangeProposal = function (wallet, title, description, initialDepositFCT, paramList, txMisc) {
334
334
  if (txMisc === void 0) { txMisc = FirmaUtil_1.DefaultTxMisc; }
335
335
  return __awaiter(this, void 0, void 0, function () {
336
- var txClient, initialDepositAmount, proposal, content, proposer, message, error_11;
336
+ var initialDepositAmount, proposal, content, proposer, message, txClient, error_11;
337
337
  return __generator(this, function (_a) {
338
338
  switch (_a.label) {
339
339
  case 0:
340
340
  _a.trys.push([0, 3, , 4]);
341
- txClient = new gov_1.GovTxClient(wallet, this.config.rpcAddress);
342
341
  initialDepositAmount = {
343
342
  denom: this.config.denom,
344
343
  amount: FirmaUtil_1.FirmaUtil.getUFCTStringFromFCT(initialDepositFCT)
@@ -355,12 +354,13 @@ var FirmaGovService = /** @class */ (function () {
355
354
  return [4 /*yield*/, wallet.getAddress()];
356
355
  case 1:
357
356
  proposer = _a.sent();
358
- message = txClient.msgSubmitProposal({
357
+ message = gov_1.GovTxClient.msgSubmitProposal({
359
358
  content: content,
360
359
  initialDeposit: [initialDepositAmount],
361
360
  proposer: proposer
362
361
  });
363
- return [4 /*yield*/, txClient.sign([message], FirmaUtil_1.getSignAndBroadcastOption(this.config.denom, txMisc))];
362
+ txClient = new gov_1.GovTxClient(wallet, this.config.rpcAddress);
363
+ return [4 /*yield*/, txClient.sign([message], (0, FirmaUtil_1.getSignAndBroadcastOption)(this.config.denom, txMisc))];
364
364
  case 2: return [2 /*return*/, _a.sent()];
365
365
  case 3:
366
366
  error_11 = _a.sent();
@@ -374,12 +374,11 @@ var FirmaGovService = /** @class */ (function () {
374
374
  FirmaGovService.prototype.getSignedTxSubmitCommunityPoolSpendProposal = function (wallet, title, description, initialDepositFCT, amount, recipient, txMisc) {
375
375
  if (txMisc === void 0) { txMisc = FirmaUtil_1.DefaultTxMisc; }
376
376
  return __awaiter(this, void 0, void 0, function () {
377
- var txClient, initialDepositAmount, sendAmount, proposal, content, proposer, message, error_12;
377
+ var initialDepositAmount, sendAmount, proposal, content, proposer, message, txClient, error_12;
378
378
  return __generator(this, function (_a) {
379
379
  switch (_a.label) {
380
380
  case 0:
381
381
  _a.trys.push([0, 3, , 4]);
382
- txClient = new gov_1.GovTxClient(wallet, this.config.rpcAddress);
383
382
  initialDepositAmount = {
384
383
  denom: this.config.denom,
385
384
  amount: FirmaUtil_1.FirmaUtil.getUFCTStringFromFCT(initialDepositFCT)
@@ -398,12 +397,13 @@ var FirmaGovService = /** @class */ (function () {
398
397
  return [4 /*yield*/, wallet.getAddress()];
399
398
  case 1:
400
399
  proposer = _a.sent();
401
- message = txClient.msgSubmitProposal({
400
+ message = gov_1.GovTxClient.msgSubmitProposal({
402
401
  content: content,
403
402
  initialDeposit: [initialDepositAmount],
404
403
  proposer: proposer
405
404
  });
406
- return [4 /*yield*/, txClient.sign([message], FirmaUtil_1.getSignAndBroadcastOption(this.config.denom, txMisc))];
405
+ txClient = new gov_1.GovTxClient(wallet, this.config.rpcAddress);
406
+ return [4 /*yield*/, txClient.sign([message], (0, FirmaUtil_1.getSignAndBroadcastOption)(this.config.denom, txMisc))];
407
407
  case 2: return [2 /*return*/, _a.sent()];
408
408
  case 3:
409
409
  error_12 = _a.sent();
@@ -579,8 +579,8 @@ var FirmaGovService = /** @class */ (function () {
579
579
  case 1:
580
580
  voter = _a.sent();
581
581
  txClient = new gov_1.GovTxClient(wallet, this.config.rpcAddress);
582
- message = txClient.msgVote({ proposalId: proposalId, voter: voter, option: option });
583
- return [4 /*yield*/, txClient.sign([message], FirmaUtil_1.getSignAndBroadcastOption(this.config.denom, txMisc))];
582
+ message = gov_1.GovTxClient.msgVote({ proposalId: proposalId, voter: voter, option: option });
583
+ return [4 /*yield*/, txClient.sign([message], (0, FirmaUtil_1.getSignAndBroadcastOption)(this.config.denom, txMisc))];
584
584
  case 2: return [2 /*return*/, _a.sent()];
585
585
  case 3:
586
586
  error_19 = _a.sent();
@@ -618,18 +618,18 @@ var FirmaGovService = /** @class */ (function () {
618
618
  FirmaGovService.prototype.getSignedTxDeposit = function (wallet, proposalId, amount, txMisc) {
619
619
  if (txMisc === void 0) { txMisc = FirmaUtil_1.DefaultTxMisc; }
620
620
  return __awaiter(this, void 0, void 0, function () {
621
- var txClient, depositor, sendAmount, message, error_21;
621
+ var depositor, sendAmount, message, txClient, error_21;
622
622
  return __generator(this, function (_a) {
623
623
  switch (_a.label) {
624
624
  case 0:
625
625
  _a.trys.push([0, 3, , 4]);
626
- txClient = new gov_1.GovTxClient(wallet, this.config.rpcAddress);
627
626
  return [4 /*yield*/, wallet.getAddress()];
628
627
  case 1:
629
628
  depositor = _a.sent();
630
629
  sendAmount = { denom: this.config.denom, amount: FirmaUtil_1.FirmaUtil.getUFCTStringFromFCT(amount) };
631
- message = txClient.msgDeposit({ proposalId: proposalId, depositor: depositor, amount: [sendAmount] });
632
- return [4 /*yield*/, txClient.sign([message], FirmaUtil_1.getSignAndBroadcastOption(this.config.denom, txMisc))];
630
+ message = gov_1.GovTxClient.msgDeposit({ proposalId: proposalId, depositor: depositor, amount: [sendAmount] });
631
+ txClient = new gov_1.GovTxClient(wallet, this.config.rpcAddress);
632
+ return [4 /*yield*/, txClient.sign([message], (0, FirmaUtil_1.getSignAndBroadcastOption)(this.config.denom, txMisc))];
633
633
  case 2: return [2 /*return*/, _a.sent()];
634
634
  case 3:
635
635
  error_21 = _a.sent();
@@ -0,0 +1,15 @@
1
+ import { FirmaWalletService } from "./FirmaWalletService";
2
+ import { FirmaConfig } from "./FirmaConfig";
3
+ import { BroadcastTxResponse } from "./firmachain/common/stargateclient";
4
+ import { ClientState, IbcTxClient, TxMisc } from "./firmachain/ibc";
5
+ import Long from "long";
6
+ import { Height } from "cosmjs-types/ibc/core/client/v1/client";
7
+ export declare class FirmaIbcService {
8
+ private readonly config;
9
+ constructor(config: FirmaConfig);
10
+ getTxClient(wallet: FirmaWalletService): IbcTxClient;
11
+ getGasEstimationTransfer(wallet: FirmaWalletService, sourcePort: string, sourceChannel: string, denom: string, amount: string, receiver: string, timeoutHeight: Height, timeoutTimestamp: Long, txMisc?: TxMisc): Promise<number>;
12
+ transfer(wallet: FirmaWalletService, sourcePort: string, sourceChannel: string, denom: string, amount: string, receiver: string, timeoutHeight: Height, timeoutTimestamp: Long, txMisc?: TxMisc): Promise<BroadcastTxResponse>;
13
+ private getSignedTxTransfer;
14
+ getClientState(sourceChannel: string, sourcePort: string): Promise<ClientState>;
15
+ }
@@ -0,0 +1,144 @@
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
+ exports.FirmaIbcService = void 0;
40
+ var FirmaUtil_1 = require("./FirmaUtil");
41
+ var ibc_1 = require("./firmachain/ibc");
42
+ var FirmaIbcService = /** @class */ (function () {
43
+ function FirmaIbcService(config) {
44
+ this.config = config;
45
+ }
46
+ FirmaIbcService.prototype.getTxClient = function (wallet) {
47
+ return new ibc_1.IbcTxClient(wallet, this.config.rpcAddress);
48
+ };
49
+ FirmaIbcService.prototype.getGasEstimationTransfer = function (wallet, sourcePort, sourceChannel, denom, amount, receiver, timeoutHeight, timeoutTimestamp, txMisc) {
50
+ if (txMisc === void 0) { txMisc = FirmaUtil_1.DefaultTxMisc; }
51
+ return __awaiter(this, void 0, void 0, function () {
52
+ var txRaw, error_1;
53
+ return __generator(this, function (_a) {
54
+ switch (_a.label) {
55
+ case 0:
56
+ _a.trys.push([0, 3, , 4]);
57
+ return [4 /*yield*/, this.getSignedTxTransfer(wallet, sourcePort, sourceChannel, denom, amount, receiver, timeoutHeight, timeoutTimestamp, txMisc)];
58
+ case 1:
59
+ txRaw = _a.sent();
60
+ return [4 /*yield*/, FirmaUtil_1.FirmaUtil.estimateGas(txRaw)];
61
+ case 2: return [2 /*return*/, _a.sent()];
62
+ case 3:
63
+ error_1 = _a.sent();
64
+ FirmaUtil_1.FirmaUtil.printLog(error_1);
65
+ throw error_1;
66
+ case 4: return [2 /*return*/];
67
+ }
68
+ });
69
+ });
70
+ };
71
+ FirmaIbcService.prototype.transfer = function (wallet, sourcePort, sourceChannel, denom, amount, receiver, timeoutHeight, timeoutTimestamp, txMisc) {
72
+ if (txMisc === void 0) { txMisc = FirmaUtil_1.DefaultTxMisc; }
73
+ return __awaiter(this, void 0, void 0, function () {
74
+ var txRaw, bankTxClient, error_2;
75
+ return __generator(this, function (_a) {
76
+ switch (_a.label) {
77
+ case 0:
78
+ _a.trys.push([0, 3, , 4]);
79
+ return [4 /*yield*/, this.getSignedTxTransfer(wallet, sourcePort, sourceChannel, denom, amount, receiver, timeoutHeight, timeoutTimestamp, txMisc)];
80
+ case 1:
81
+ txRaw = _a.sent();
82
+ bankTxClient = new ibc_1.IbcTxClient(wallet, this.config.rpcAddress);
83
+ return [4 /*yield*/, bankTxClient.broadcast(txRaw)];
84
+ case 2: return [2 /*return*/, _a.sent()];
85
+ case 3:
86
+ error_2 = _a.sent();
87
+ FirmaUtil_1.FirmaUtil.printLog(error_2);
88
+ throw error_2;
89
+ case 4: return [2 /*return*/];
90
+ }
91
+ });
92
+ });
93
+ };
94
+ FirmaIbcService.prototype.getSignedTxTransfer = function (wallet, sourcePort, sourceChannel, denom, amount, receiver, timeoutHeight, timeoutTimestamp, txMisc) {
95
+ if (txMisc === void 0) { txMisc = FirmaUtil_1.DefaultTxMisc; }
96
+ return __awaiter(this, void 0, void 0, function () {
97
+ var address, message, ibcTxClient, error_3;
98
+ return __generator(this, function (_a) {
99
+ switch (_a.label) {
100
+ case 0:
101
+ _a.trys.push([0, 3, , 4]);
102
+ return [4 /*yield*/, wallet.getAddress()];
103
+ case 1:
104
+ address = _a.sent();
105
+ message = ibc_1.IbcTxClient.msgTransfer({ sourcePort: sourcePort, sourceChannel: sourceChannel, sender: address, receiver: receiver,
106
+ token: { denom: denom, amount: amount },
107
+ timeoutHeight: timeoutHeight, timeoutTimestamp: timeoutTimestamp });
108
+ ibcTxClient = new ibc_1.IbcTxClient(wallet, this.config.rpcAddress);
109
+ return [4 /*yield*/, ibcTxClient.sign([message], (0, FirmaUtil_1.getSignAndBroadcastOption)(this.config.denom, txMisc))];
110
+ case 2: return [2 /*return*/, _a.sent()];
111
+ case 3:
112
+ error_3 = _a.sent();
113
+ FirmaUtil_1.FirmaUtil.printLog(error_3);
114
+ throw error_3;
115
+ case 4: return [2 /*return*/];
116
+ }
117
+ });
118
+ });
119
+ };
120
+ // query
121
+ FirmaIbcService.prototype.getClientState = function (sourceChannel, sourcePort) {
122
+ return __awaiter(this, void 0, void 0, function () {
123
+ var queryClient, result, error_4;
124
+ return __generator(this, function (_a) {
125
+ switch (_a.label) {
126
+ case 0:
127
+ _a.trys.push([0, 2, , 3]);
128
+ queryClient = new ibc_1.IbcQueryClient(this.config.restApiAddress);
129
+ return [4 /*yield*/, queryClient.getClientState(sourceChannel, sourcePort)];
130
+ case 1:
131
+ result = _a.sent();
132
+ return [2 /*return*/, result];
133
+ case 2:
134
+ error_4 = _a.sent();
135
+ FirmaUtil_1.FirmaUtil.printLog(error_4);
136
+ throw error_4;
137
+ case 3: return [2 /*return*/];
138
+ }
139
+ });
140
+ });
141
+ };
142
+ return FirmaIbcService;
143
+ }());
144
+ exports.FirmaIbcService = FirmaIbcService;
@@ -65,7 +65,7 @@ var IpfsService = /** @class */ (function () {
65
65
  var address = config.ipfsNodeAddress;
66
66
  address = address.replace("https://", "");
67
67
  address = address.replace("http://", "");
68
- this.ipfsNodeClient = ipfs_http_client_1.create({ host: address, port: config.ipfsNodePort, protocol: this.protocol });
68
+ this.ipfsNodeClient = (0, ipfs_http_client_1.create)({ host: address, port: config.ipfsNodePort, protocol: this.protocol });
69
69
  }
70
70
  IpfsService.prototype.addJson = function (jsonData) {
71
71
  return __awaiter(this, void 0, void 0, function () {
@@ -185,7 +185,7 @@ var NftService = /** @class */ (function () {
185
185
  NftService.prototype.getSignedTxTransfer = function (wallet, toAddress, nftID, txMisc) {
186
186
  if (txMisc === void 0) { txMisc = FirmaUtil_1.DefaultTxMisc; }
187
187
  return __awaiter(this, void 0, void 0, function () {
188
- var address, nftTxClient, message, error_7;
188
+ var address, message, nftTxClient, error_7;
189
189
  return __generator(this, function (_a) {
190
190
  switch (_a.label) {
191
191
  case 0:
@@ -193,9 +193,9 @@ var NftService = /** @class */ (function () {
193
193
  return [4 /*yield*/, wallet.getAddress()];
194
194
  case 1:
195
195
  address = _a.sent();
196
+ message = nft_1.NftTxClient.msgTransfer({ owner: address, toAddress: toAddress, nftId: parseInt(nftID) });
196
197
  nftTxClient = new nft_1.NftTxClient(wallet, this.config.rpcAddress);
197
- message = nftTxClient.msgTransfer({ owner: address, toAddress: toAddress, nftId: parseInt(nftID) });
198
- return [4 /*yield*/, nftTxClient.sign([message], FirmaUtil_1.getSignAndBroadcastOption(this.config.denom, txMisc))];
198
+ return [4 /*yield*/, nftTxClient.sign([message], (0, FirmaUtil_1.getSignAndBroadcastOption)(this.config.denom, txMisc))];
199
199
  case 2: return [2 /*return*/, _a.sent()];
200
200
  case 3:
201
201
  error_7 = _a.sent();
@@ -254,7 +254,7 @@ var NftService = /** @class */ (function () {
254
254
  NftService.prototype.getSignedTxBurn = function (wallet, nftID, txMisc) {
255
255
  if (txMisc === void 0) { txMisc = FirmaUtil_1.DefaultTxMisc; }
256
256
  return __awaiter(this, void 0, void 0, function () {
257
- var address, nftTxClient, message, error_10;
257
+ var address, message, nftTxClient, error_10;
258
258
  return __generator(this, function (_a) {
259
259
  switch (_a.label) {
260
260
  case 0:
@@ -262,9 +262,9 @@ var NftService = /** @class */ (function () {
262
262
  return [4 /*yield*/, wallet.getAddress()];
263
263
  case 1:
264
264
  address = _a.sent();
265
+ message = nft_1.NftTxClient.msgBurn({ owner: address, nftId: parseInt(nftID) });
265
266
  nftTxClient = new nft_1.NftTxClient(wallet, this.config.rpcAddress);
266
- message = nftTxClient.msgBurn({ owner: address, nftId: parseInt(nftID) });
267
- return [4 /*yield*/, nftTxClient.sign([message], FirmaUtil_1.getSignAndBroadcastOption(this.config.denom, txMisc))];
267
+ return [4 /*yield*/, nftTxClient.sign([message], (0, FirmaUtil_1.getSignAndBroadcastOption)(this.config.denom, txMisc))];
268
268
  case 2: return [2 /*return*/, _a.sent()];
269
269
  case 3:
270
270
  error_10 = _a.sent();
@@ -323,7 +323,7 @@ var NftService = /** @class */ (function () {
323
323
  NftService.prototype.getSignedTxMint = function (wallet, tokenURI, txMisc) {
324
324
  if (txMisc === void 0) { txMisc = FirmaUtil_1.DefaultTxMisc; }
325
325
  return __awaiter(this, void 0, void 0, function () {
326
- var address, nftTxClient, message, error_13;
326
+ var address, message, nftTxClient, error_13;
327
327
  return __generator(this, function (_a) {
328
328
  switch (_a.label) {
329
329
  case 0:
@@ -331,9 +331,9 @@ var NftService = /** @class */ (function () {
331
331
  return [4 /*yield*/, wallet.getAddress()];
332
332
  case 1:
333
333
  address = _a.sent();
334
+ message = nft_1.NftTxClient.msgMint({ owner: address, tokenURI: tokenURI });
334
335
  nftTxClient = new nft_1.NftTxClient(wallet, this.config.rpcAddress);
335
- message = nftTxClient.msgMint({ owner: address, tokenURI: tokenURI });
336
- return [4 /*yield*/, nftTxClient.sign([message], FirmaUtil_1.getSignAndBroadcastOption(this.config.denom, txMisc))];
336
+ return [4 /*yield*/, nftTxClient.sign([message], (0, FirmaUtil_1.getSignAndBroadcastOption)(this.config.denom, txMisc))];
337
337
  case 2: return [2 /*return*/, _a.sent()];
338
338
  case 3:
339
339
  error_13 = _a.sent();
@@ -13,6 +13,7 @@ import { ChainService } from "./FirmaChainService";
13
13
  import { SlashingService } from "./FirmaSlashingService";
14
14
  import { FirmaAuthzService } from "./FirmaAuthzService";
15
15
  import { FirmaCosmWasmService } from "./FirmaCosmWasmService";
16
+ import { FirmaIbcService } from "./FirmaIbcService";
16
17
  export declare class FirmaSDK {
17
18
  Config: FirmaConfig;
18
19
  Wallet: FirmaWalletService;
@@ -29,5 +30,6 @@ export declare class FirmaSDK {
29
30
  Slashing: SlashingService;
30
31
  Authz: FirmaAuthzService;
31
32
  CosmWasm: FirmaCosmWasmService;
32
- constructor(Config: FirmaConfig, Wallet?: FirmaWalletService, Bank?: FirmaBankService, FeeGrant?: FirmaFeeGrantService, Staking?: FirmaStakingService, Distribution?: FirmaDistributionService, Gov?: FirmaGovService, Nft?: NftService, Token?: TokenService, Contract?: ContractService, Ipfs?: IpfsService, BlockChain?: ChainService, Slashing?: SlashingService, Authz?: FirmaAuthzService, CosmWasm?: FirmaCosmWasmService);
33
+ Ibc: FirmaIbcService;
34
+ constructor(Config: FirmaConfig, Wallet?: FirmaWalletService, Bank?: FirmaBankService, FeeGrant?: FirmaFeeGrantService, Staking?: FirmaStakingService, Distribution?: FirmaDistributionService, Gov?: FirmaGovService, Nft?: NftService, Token?: TokenService, Contract?: ContractService, Ipfs?: IpfsService, BlockChain?: ChainService, Slashing?: SlashingService, Authz?: FirmaAuthzService, CosmWasm?: FirmaCosmWasmService, Ibc?: FirmaIbcService);
33
35
  }
@@ -16,8 +16,9 @@ var FirmaChainService_1 = require("./FirmaChainService");
16
16
  var FirmaSlashingService_1 = require("./FirmaSlashingService");
17
17
  var FirmaAuthzService_1 = require("./FirmaAuthzService");
18
18
  var FirmaCosmWasmService_1 = require("./FirmaCosmWasmService");
19
+ var FirmaIbcService_1 = require("./FirmaIbcService");
19
20
  var FirmaSDK = /** @class */ (function () {
20
- function FirmaSDK(Config, Wallet, Bank, FeeGrant, Staking, Distribution, Gov, Nft, Token, Contract, Ipfs, BlockChain, Slashing, Authz, CosmWasm) {
21
+ function FirmaSDK(Config, Wallet, Bank, FeeGrant, Staking, Distribution, Gov, Nft, Token, Contract, Ipfs, BlockChain, Slashing, Authz, CosmWasm, Ibc) {
21
22
  if (Wallet === void 0) { Wallet = new FirmaWalletService_1.FirmaWalletService(Config); }
22
23
  if (Bank === void 0) { Bank = new FirmaBankService_1.FirmaBankService(Config); }
23
24
  if (FeeGrant === void 0) { FeeGrant = new FirmaFeeGrantService_1.FirmaFeeGrantService(Config); }
@@ -32,6 +33,7 @@ var FirmaSDK = /** @class */ (function () {
32
33
  if (Slashing === void 0) { Slashing = new FirmaSlashingService_1.SlashingService(Config); }
33
34
  if (Authz === void 0) { Authz = new FirmaAuthzService_1.FirmaAuthzService(Config); }
34
35
  if (CosmWasm === void 0) { CosmWasm = new FirmaCosmWasmService_1.FirmaCosmWasmService(Config); }
36
+ if (Ibc === void 0) { Ibc = new FirmaIbcService_1.FirmaIbcService(Config); }
35
37
  this.Config = Config;
36
38
  this.Wallet = Wallet;
37
39
  this.Bank = Bank;
@@ -47,6 +49,7 @@ var FirmaSDK = /** @class */ (function () {
47
49
  this.Slashing = Slashing;
48
50
  this.Authz = Authz;
49
51
  this.CosmWasm = CosmWasm;
52
+ this.Ibc = Ibc;
50
53
  FirmaUtil_1.FirmaUtil.config = Config;
51
54
  }
52
55
  return FirmaSDK;
@@ -1,4 +1,4 @@
1
- import { StakingTxClient, TxMisc, ValidatorDataType, PoolDataType, ParamsDataType, DelegationInfo, RedelegationInfo, UndelegationInfo } from "./firmachain/staking";
1
+ import { StakingTxClient, TxMisc, ValidatorDataType, PoolDataType, ParamsDataType, DelegationInfo, RedelegationInfo, UndelegationInfo, Pagination } from "./firmachain/staking";
2
2
  import { FirmaWalletService } from "./FirmaWalletService";
3
3
  import { FirmaConfig } from "./FirmaConfig";
4
4
  import { BroadcastTxResponse } from "./firmachain/common/stargateclient";
@@ -25,11 +25,23 @@ export declare class FirmaStakingService {
25
25
  getDelegationInfoFromValidator(address: string, validatorAddress: string): Promise<DelegationInfo>;
26
26
  getTotalUndelegateInfo(address: string): Promise<UndelegationInfo[]>;
27
27
  getTotalRedelegationInfo(address: string): Promise<RedelegationInfo[]>;
28
- getUndelegationListFromValidator(valoperAddress: string): Promise<UndelegationInfo[]>;
29
- getDelegationListFromValidator(valoperAddress: string): Promise<DelegationInfo[]>;
30
- getTotalDelegationInfo(address: string): Promise<DelegationInfo[]>;
28
+ getUndelegationListFromValidator(valoperAddress: string, paginationKey?: string): Promise<{
29
+ dataList: UndelegationInfo[];
30
+ pagination: Pagination;
31
+ }>;
32
+ getDelegationListFromValidator(valoperAddress: string, paginationKey?: string): Promise<{
33
+ dataList: DelegationInfo[];
34
+ pagination: Pagination;
35
+ }>;
36
+ getTotalDelegationInfo(address: string, paginationKey?: string): Promise<{
37
+ dataList: DelegationInfo[];
38
+ pagination: Pagination;
39
+ }>;
31
40
  getParams(): Promise<ParamsDataType>;
32
41
  getPool(): Promise<PoolDataType>;
33
42
  getValidator(valoperAddress: string): Promise<ValidatorDataType>;
34
- getValidatorList(): Promise<ValidatorDataType[]>;
43
+ getValidatorList(paginationKey?: string): Promise<{
44
+ dataList: ValidatorDataType[];
45
+ pagination: Pagination;
46
+ }>;
35
47
  }