@firmachain/firma-js 0.2.37 → 0.2.40

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 (181) hide show
  1. package/dist/index.d.ts +16 -0
  2. package/dist/index.js +32 -0
  3. package/dist/sdk/FirmaAuthzService.d.ts +41 -0
  4. package/dist/sdk/FirmaAuthzService.js +633 -0
  5. package/dist/sdk/FirmaBankService.d.ts +17 -0
  6. package/dist/sdk/FirmaBankService.js +236 -0
  7. package/dist/sdk/FirmaChainService.d.ts +8 -0
  8. package/dist/sdk/FirmaChainService.js +86 -0
  9. package/dist/sdk/FirmaConfig.d.ts +18 -0
  10. package/dist/sdk/FirmaConfig.js +63 -0
  11. package/dist/sdk/FirmaContractService.d.ts +32 -0
  12. package/dist/sdk/FirmaContractService.js +434 -0
  13. package/dist/sdk/FirmaCosmWasmService.d.ts +38 -0
  14. package/dist/sdk/FirmaCosmWasmService.js +667 -0
  15. package/dist/sdk/FirmaDistributionService.d.ts +32 -0
  16. package/dist/sdk/FirmaDistributionService.js +527 -0
  17. package/dist/sdk/FirmaFeeGrantService.d.ts +21 -0
  18. package/dist/sdk/FirmaFeeGrantService.js +341 -0
  19. package/dist/sdk/FirmaGovService.d.ts +35 -0
  20. package/dist/sdk/FirmaGovService.js +775 -0
  21. package/dist/sdk/FirmaIbcService.d.ts +15 -0
  22. package/dist/sdk/FirmaIbcService.js +144 -0
  23. package/dist/sdk/FirmaIpfsService.d.ts +10 -0
  24. package/dist/sdk/FirmaIpfsService.js +143 -0
  25. package/dist/sdk/FirmaMobileSDK.d.ts +29 -0
  26. package/dist/sdk/FirmaMobileSDK.js +48 -0
  27. package/dist/sdk/FirmaNftService.d.ts +31 -0
  28. package/dist/sdk/FirmaNftService.js +372 -0
  29. package/dist/sdk/FirmaSDK.d.ts +35 -0
  30. package/dist/sdk/FirmaSDK.js +57 -0
  31. package/dist/sdk/FirmaSlashingService.d.ts +9 -0
  32. package/dist/sdk/FirmaSlashingService.js +105 -0
  33. package/dist/sdk/FirmaStakingService.d.ts +47 -0
  34. package/dist/sdk/FirmaStakingService.js +611 -0
  35. package/dist/sdk/FirmaTokenService.d.ts +26 -0
  36. package/dist/sdk/FirmaTokenService.js +416 -0
  37. package/dist/sdk/FirmaUtil.d.ts +56 -0
  38. package/dist/sdk/FirmaUtil.js +430 -0
  39. package/dist/sdk/FirmaWalletService.d.ts +39 -0
  40. package/dist/sdk/FirmaWalletService.js +317 -0
  41. package/dist/sdk/firmachain/amino/addresses.d.ts +5 -0
  42. package/dist/sdk/firmachain/amino/addresses.js +46 -0
  43. package/dist/sdk/firmachain/amino/aminomsgs.d.ts +281 -0
  44. package/dist/sdk/firmachain/amino/aminomsgs.js +77 -0
  45. package/dist/sdk/firmachain/amino/aminotypes.d.ts +22 -0
  46. package/dist/sdk/firmachain/amino/aminotypes.js +525 -0
  47. package/dist/sdk/firmachain/amino/coins.d.ts +30 -0
  48. package/dist/sdk/firmachain/amino/coins.js +69 -0
  49. package/dist/sdk/firmachain/amino/encoding.d.ts +24 -0
  50. package/dist/sdk/firmachain/amino/encoding.js +238 -0
  51. package/dist/sdk/firmachain/amino/multisig.d.ts +10 -0
  52. package/dist/sdk/firmachain/amino/multisig.js +42 -0
  53. package/dist/sdk/firmachain/amino/paths.d.ts +6 -0
  54. package/dist/sdk/firmachain/amino/paths.js +18 -0
  55. package/dist/sdk/firmachain/amino/pubkeys.d.ts +47 -0
  56. package/dist/sdk/firmachain/amino/pubkeys.js +29 -0
  57. package/dist/sdk/firmachain/amino/signature.d.ts +16 -0
  58. package/dist/sdk/firmachain/amino/signature.js +36 -0
  59. package/dist/sdk/firmachain/amino/signdoc.d.ts +26 -0
  60. package/dist/sdk/firmachain/amino/signdoc.js +42 -0
  61. package/dist/sdk/firmachain/amino/signer.d.ts +32 -0
  62. package/dist/sdk/firmachain/amino/signer.js +2 -0
  63. package/dist/sdk/firmachain/amino/stdtx.d.ts +15 -0
  64. package/dist/sdk/firmachain/amino/stdtx.js +17 -0
  65. package/dist/sdk/firmachain/amino/wallet.d.ts +32 -0
  66. package/dist/sdk/firmachain/amino/wallet.js +136 -0
  67. package/dist/sdk/firmachain/authz/AuthzQueryClient.d.ts +48 -0
  68. package/dist/sdk/firmachain/authz/AuthzQueryClient.js +142 -0
  69. package/dist/sdk/firmachain/authz/AuthzTxClient.d.ts +23 -0
  70. package/dist/sdk/firmachain/authz/AuthzTxClient.js +47 -0
  71. package/dist/sdk/firmachain/authz/AuthzTxTypes.d.ts +147 -0
  72. package/dist/sdk/firmachain/authz/AuthzTxTypes.js +358 -0
  73. package/dist/sdk/firmachain/authz/index.d.ts +4 -0
  74. package/dist/sdk/firmachain/authz/index.js +20 -0
  75. package/dist/sdk/firmachain/bank/BankQueryClient.d.ts +12 -0
  76. package/dist/sdk/firmachain/bank/BankQueryClient.js +116 -0
  77. package/dist/sdk/firmachain/bank/BankTxClient.d.ts +18 -0
  78. package/dist/sdk/firmachain/bank/BankTxClient.js +43 -0
  79. package/dist/sdk/firmachain/bank/index.d.ts +3 -0
  80. package/dist/sdk/firmachain/bank/index.js +19 -0
  81. package/dist/sdk/firmachain/common/CommonTxClient.d.ts +7 -0
  82. package/dist/sdk/firmachain/common/CommonTxClient.js +79 -0
  83. package/dist/sdk/firmachain/common/ITxClient.d.ts +18 -0
  84. package/dist/sdk/firmachain/common/ITxClient.js +117 -0
  85. package/dist/sdk/firmachain/common/LedgerSigningStargateClient.d.ts +27 -0
  86. package/dist/sdk/firmachain/common/LedgerSigningStargateClient.js +165 -0
  87. package/dist/sdk/firmachain/common/LedgerWallet.d.ts +14 -0
  88. package/dist/sdk/firmachain/common/LedgerWallet.js +151 -0
  89. package/dist/sdk/firmachain/common/QueryCommon.d.ts +4 -0
  90. package/dist/sdk/firmachain/common/QueryCommon.js +2 -0
  91. package/dist/sdk/firmachain/common/TendermintQueryClient.d.ts +42 -0
  92. package/dist/sdk/firmachain/common/TendermintQueryClient.js +111 -0
  93. package/dist/sdk/firmachain/common/TxCommon.d.ts +87 -0
  94. package/dist/sdk/firmachain/common/TxCommon.js +18 -0
  95. package/dist/sdk/firmachain/common/accounts.d.ts +16 -0
  96. package/dist/sdk/firmachain/common/accounts.js +64 -0
  97. package/dist/sdk/firmachain/common/index.d.ts +2 -0
  98. package/dist/sdk/firmachain/common/index.js +18 -0
  99. package/dist/sdk/firmachain/common/signing.d.ts +10 -0
  100. package/dist/sdk/firmachain/common/signing.js +79 -0
  101. package/dist/sdk/firmachain/common/signingaminostargateclient.d.ts +50 -0
  102. package/dist/sdk/firmachain/common/signingaminostargateclient.js +267 -0
  103. package/dist/sdk/firmachain/common/signingstargateclient.d.ts +44 -0
  104. package/dist/sdk/firmachain/common/signingstargateclient.js +361 -0
  105. package/dist/sdk/firmachain/common/stargateclient.d.ts +46 -0
  106. package/dist/sdk/firmachain/common/stargateclient.js +211 -0
  107. package/dist/sdk/firmachain/contract/ContractQueryClient.d.ts +32 -0
  108. package/dist/sdk/firmachain/contract/ContractQueryClient.js +156 -0
  109. package/dist/sdk/firmachain/contract/ContractTxClient.d.ts +18 -0
  110. package/dist/sdk/firmachain/contract/ContractTxClient.js +43 -0
  111. package/dist/sdk/firmachain/contract/ContractTxTypes.d.ts +69 -0
  112. package/dist/sdk/firmachain/contract/ContractTxTypes.js +483 -0
  113. package/dist/sdk/firmachain/contract/index.d.ts +3 -0
  114. package/dist/sdk/firmachain/contract/index.js +19 -0
  115. package/dist/sdk/firmachain/cosmwasm/CosmWasmQueryClient.d.ts +52 -0
  116. package/dist/sdk/firmachain/cosmwasm/CosmWasmQueryClient.js +193 -0
  117. package/dist/sdk/firmachain/cosmwasm/CosmWasmTxClient.d.ts +38 -0
  118. package/dist/sdk/firmachain/cosmwasm/CosmWasmTxClient.js +59 -0
  119. package/dist/sdk/firmachain/cosmwasm/index.d.ts +3 -0
  120. package/dist/sdk/firmachain/cosmwasm/index.js +19 -0
  121. package/dist/sdk/firmachain/distribution/DistributionQueryClient.d.ts +18 -0
  122. package/dist/sdk/firmachain/distribution/DistributionQueryClient.js +167 -0
  123. package/dist/sdk/firmachain/distribution/DistributionTxClient.d.ts +28 -0
  124. package/dist/sdk/firmachain/distribution/DistributionTxClient.js +51 -0
  125. package/dist/sdk/firmachain/distribution/index.d.ts +3 -0
  126. package/dist/sdk/firmachain/distribution/index.js +19 -0
  127. package/dist/sdk/firmachain/feegrant/FeeGrantQueryClient.d.ts +17 -0
  128. package/dist/sdk/firmachain/feegrant/FeeGrantQueryClient.js +86 -0
  129. package/dist/sdk/firmachain/feegrant/FeeGrantTxClient.d.ts +18 -0
  130. package/dist/sdk/firmachain/feegrant/FeeGrantTxClient.js +43 -0
  131. package/dist/sdk/firmachain/feegrant/FeeGrantTxTypes.d.ts +76 -0
  132. package/dist/sdk/firmachain/feegrant/FeeGrantTxTypes.js +194 -0
  133. package/dist/sdk/firmachain/feegrant/index.d.ts +3 -0
  134. package/dist/sdk/firmachain/feegrant/index.js +19 -0
  135. package/dist/sdk/firmachain/google/protobuf/any.d.ts +128 -0
  136. package/dist/sdk/firmachain/google/protobuf/any.js +106 -0
  137. package/dist/sdk/firmachain/google/protobuf/descriptor.d.ts +996 -0
  138. package/dist/sdk/firmachain/google/protobuf/descriptor.js +5329 -0
  139. package/dist/sdk/firmachain/google/protobuf/duration.d.ts +91 -0
  140. package/dist/sdk/firmachain/google/protobuf/duration.js +107 -0
  141. package/dist/sdk/firmachain/google/protobuf/timestamp.d.ts +109 -0
  142. package/dist/sdk/firmachain/google/protobuf/timestamp.js +107 -0
  143. package/dist/sdk/firmachain/gov/GovQueryClient.d.ts +61 -0
  144. package/dist/sdk/firmachain/gov/GovQueryClient.js +152 -0
  145. package/dist/sdk/firmachain/gov/GovTxClient.d.ts +23 -0
  146. package/dist/sdk/firmachain/gov/GovTxClient.js +47 -0
  147. package/dist/sdk/firmachain/gov/index.d.ts +3 -0
  148. package/dist/sdk/firmachain/gov/index.js +19 -0
  149. package/dist/sdk/firmachain/ibc/IbcQueryClient.d.ts +34 -0
  150. package/dist/sdk/firmachain/ibc/IbcQueryClient.js +71 -0
  151. package/dist/sdk/firmachain/ibc/IbcTxClient.d.ts +13 -0
  152. package/dist/sdk/firmachain/ibc/IbcTxClient.js +39 -0
  153. package/dist/sdk/firmachain/ibc/index.d.ts +3 -0
  154. package/dist/sdk/firmachain/ibc/index.js +19 -0
  155. package/dist/sdk/firmachain/nft/NftQueryClient.d.ts +20 -0
  156. package/dist/sdk/firmachain/nft/NftQueryClient.js +125 -0
  157. package/dist/sdk/firmachain/nft/NftTxClient.d.ts +23 -0
  158. package/dist/sdk/firmachain/nft/NftTxClient.js +47 -0
  159. package/dist/sdk/firmachain/nft/NftTxTypes.d.ts +86 -0
  160. package/dist/sdk/firmachain/nft/NftTxTypes.js +424 -0
  161. package/dist/sdk/firmachain/nft/index.d.ts +3 -0
  162. package/dist/sdk/firmachain/nft/index.js +19 -0
  163. package/dist/sdk/firmachain/slashing/SlashingQueryClient.d.ts +22 -0
  164. package/dist/sdk/firmachain/slashing/SlashingQueryClient.js +101 -0
  165. package/dist/sdk/firmachain/slashing/index.d.ts +2 -0
  166. package/dist/sdk/firmachain/slashing/index.js +18 -0
  167. package/dist/sdk/firmachain/staking/StakingQueryClient.d.ts +106 -0
  168. package/dist/sdk/firmachain/staking/StakingQueryClient.js +243 -0
  169. package/dist/sdk/firmachain/staking/StakingTxClient.d.ts +33 -0
  170. package/dist/sdk/firmachain/staking/StakingTxClient.js +55 -0
  171. package/dist/sdk/firmachain/staking/index.d.ts +3 -0
  172. package/dist/sdk/firmachain/staking/index.js +19 -0
  173. package/dist/sdk/firmachain/token/TokenQueryClient.d.ts +24 -0
  174. package/dist/sdk/firmachain/token/TokenQueryClient.js +106 -0
  175. package/dist/sdk/firmachain/token/TokenTxClient.d.ts +28 -0
  176. package/dist/sdk/firmachain/token/TokenTxClient.js +51 -0
  177. package/dist/sdk/firmachain/token/TokenTxTypes.d.ts +116 -0
  178. package/dist/sdk/firmachain/token/TokenTxTypes.js +685 -0
  179. package/dist/sdk/firmachain/token/index.d.ts +3 -0
  180. package/dist/sdk/firmachain/token/index.js +19 -0
  181. package/package.json +3 -7
@@ -0,0 +1,79 @@
1
+ "use strict";
2
+ var __extends = (this && this.__extends) || (function () {
3
+ var extendStatics = function (d, b) {
4
+ extendStatics = Object.setPrototypeOf ||
5
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
+ return extendStatics(d, b);
8
+ };
9
+ return function (d, b) {
10
+ if (typeof b !== "function" && b !== null)
11
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
12
+ extendStatics(d, b);
13
+ function __() { this.constructor = d; }
14
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15
+ };
16
+ })();
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ exports.CommonTxClient = void 0;
19
+ var proto_signing_1 = require("@cosmjs/proto-signing");
20
+ var tx_1 = require("cosmjs-types/cosmos/bank/v1beta1/tx");
21
+ var tx_2 = require("cosmjs-types/cosmos/distribution/v1beta1/tx");
22
+ var tx_3 = require("cosmjs-types/cosmos/gov/v1beta1/tx");
23
+ var tx_4 = require("cosmjs-types/cosmos/staking/v1beta1/tx");
24
+ var tx_5 = require("cosmjs-types/cosmwasm/wasm/v1/tx");
25
+ var AuthzTxTypes_1 = require("../authz/AuthzTxTypes");
26
+ var ContractTxTypes_1 = require("../contract/ContractTxTypes");
27
+ var FeeGrantTxTypes_1 = require("../feegrant/FeeGrantTxTypes");
28
+ var NftTxTypes_1 = require("../nft/NftTxTypes");
29
+ var TokenTxTypes_1 = require("../token/TokenTxTypes");
30
+ var ITxClient_1 = require("./ITxClient");
31
+ var types = [
32
+ ["/cosmos.authz.v1beta1.MsgExec", AuthzTxTypes_1.MsgExec],
33
+ ["/cosmos.authz.v1beta1.MsgGrant", AuthzTxTypes_1.MsgGrant],
34
+ ["/cosmos.authz.v1beta1.MsgRevoke", AuthzTxTypes_1.MsgRevoke],
35
+ ["/cosmos.bank.v1beta1.MsgSend", tx_1.MsgSend],
36
+ ["/cosmos.bank.v1beta1.MsgMultiSend", tx_1.MsgMultiSend],
37
+ ["/firmachain.firmachain.contract.MsgCreateContractFile", ContractTxTypes_1.MsgCreateContractFile],
38
+ ["/firmachain.firmachain.contract.MsgAddContractLog", ContractTxTypes_1.MsgAddContractLog],
39
+ ["/cosmwasm.wasm.v1.MsgStoreCode", tx_5.MsgStoreCode],
40
+ ["/cosmwasm.wasm.v1.MsgInstantiateContract", tx_5.MsgInstantiateContract],
41
+ ["/cosmwasm.wasm.v1.MsgExecuteContract", tx_5.MsgExecuteContract],
42
+ ["/cosmwasm.wasm.v1.MsgUpdateAdmin", tx_5.MsgUpdateAdmin],
43
+ ["/cosmwasm.wasm.v1.MsgClearAdmin", tx_5.MsgClearAdmin],
44
+ ["/cosmwasm.wasm.v1.MsgMigrateContract", tx_5.MsgMigrateContract],
45
+ ["/cosmos.distribution.v1beta1.MsgFundCommunityPool", tx_2.MsgFundCommunityPool],
46
+ ["/cosmos.distribution.v1beta1.MsgSetWithdrawAddress", tx_2.MsgSetWithdrawAddress],
47
+ ["/cosmos.distribution.v1beta1.MsgWithdrawDelegatorReward", tx_2.MsgWithdrawDelegatorReward],
48
+ ["/cosmos.distribution.v1beta1.MsgWithdrawValidatorCommission", tx_2.MsgWithdrawValidatorCommission],
49
+ ["/cosmos.feegrant.v1beta1.MsgGrantAllowance", FeeGrantTxTypes_1.MsgGrantAllowance],
50
+ ["/cosmos.feegrant.v1beta1.MsgRevokeAllowance", FeeGrantTxTypes_1.MsgRevokeAllowance],
51
+ ["/cosmos.gov.v1beta1.MsgDeposit", tx_3.MsgDeposit],
52
+ ["/cosmos.gov.v1beta1.MsgSubmitProposal", tx_3.MsgSubmitProposal],
53
+ ["/cosmos.gov.v1beta1.MsgVote", tx_3.MsgVote],
54
+ ["/ibc.applications.transfer.v1.MsgTransfer", NftTxTypes_1.MsgTransfer],
55
+ ["/firmachain.firmachain.nft.MsgTransfer", NftTxTypes_1.MsgTransfer],
56
+ ["/firmachain.firmachain.nft.MsgMint", NftTxTypes_1.MsgMint],
57
+ ["/firmachain.firmachain.nft.MsgBurn", NftTxTypes_1.MsgBurn],
58
+ ["/cosmos.staking.v1beta1.MsgDelegate", tx_4.MsgDelegate],
59
+ ["/cosmos.staking.v1beta1.MsgUndelegate", tx_4.MsgUndelegate],
60
+ ["/cosmos.staking.v1beta1.MsgBeginRedelegate", tx_4.MsgBeginRedelegate],
61
+ ["/cosmos.staking.v1beta1.MsgEditValidator", tx_4.MsgEditValidator],
62
+ ["/cosmos.staking.v1beta1.MsgCreateValidator", tx_4.MsgCreateValidator],
63
+ ["/firmachain.firmachain.token.MsgCreateToken", TokenTxTypes_1.MsgCreateToken],
64
+ ["/firmachain.firmachain.token.MsgUpdateTokenURI", TokenTxTypes_1.MsgUpdateTokenURI],
65
+ ["/firmachain.firmachain.token.MsgMint", NftTxTypes_1.MsgMint],
66
+ ["/firmachain.firmachain.token.MsgBurn", NftTxTypes_1.MsgBurn]
67
+ ];
68
+ var registry = new proto_signing_1.Registry(types);
69
+ var CommonTxClient = /** @class */ (function (_super) {
70
+ __extends(CommonTxClient, _super);
71
+ function CommonTxClient(wallet, address) {
72
+ return _super.call(this, wallet, address, registry) || this;
73
+ }
74
+ CommonTxClient.getRegistry = function () {
75
+ return registry;
76
+ };
77
+ return CommonTxClient;
78
+ }(ITxClient_1.ITxClient));
79
+ exports.CommonTxClient = CommonTxClient;
@@ -0,0 +1,18 @@
1
+ import { Registry, EncodeObject } from "@cosmjs/proto-signing";
2
+ import { SignAndBroadcastOptions } from ".";
3
+ import { SignDoc, TxRaw } from "cosmjs-types/cosmos/tx/v1beta1/tx";
4
+ import { TxRawExt } from "./signingstargateclient";
5
+ import { BroadcastTxResponse } from "./stargateclient";
6
+ import { FirmaWalletService } from "../../FirmaWalletService";
7
+ export declare class ITxClient {
8
+ private readonly wallet;
9
+ private readonly serverUrl;
10
+ private readonly registry;
11
+ private rawWallet;
12
+ constructor(wallet: FirmaWalletService, serverUrl: string, registry: Registry);
13
+ getRegistry(): Registry;
14
+ sign(msgs: EncodeObject[], { fee, memo }: SignAndBroadcastOptions): Promise<TxRaw>;
15
+ broadcast(txRaw: TxRaw): Promise<BroadcastTxResponse>;
16
+ signAndBroadcast(msgs: EncodeObject[], { fee, memo }: SignAndBroadcastOptions): Promise<BroadcastTxResponse>;
17
+ signDirectForSignDoc(signerAddress: string, signDoc: SignDoc): Promise<TxRawExt>;
18
+ }
@@ -0,0 +1,117 @@
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.ITxClient = void 0;
40
+ var tx_1 = require("cosmjs-types/cosmos/tx/v1beta1/tx");
41
+ var signingstargateclient_1 = require("./signingstargateclient");
42
+ var ITxClient = /** @class */ (function () {
43
+ function ITxClient(wallet, serverUrl, registry) {
44
+ this.wallet = wallet;
45
+ this.serverUrl = serverUrl;
46
+ this.registry = registry;
47
+ this.rawWallet = wallet.getRawWallet();
48
+ }
49
+ ITxClient.prototype.getRegistry = function () { return this.registry; };
50
+ ITxClient.prototype.sign = function (msgs, _a) {
51
+ var fee = _a.fee, memo = _a.memo;
52
+ return __awaiter(this, void 0, void 0, function () {
53
+ var client, address;
54
+ return __generator(this, function (_b) {
55
+ switch (_b.label) {
56
+ case 0:
57
+ if (!this.wallet.isLedger()) return [3 /*break*/, 1];
58
+ return [2 /*return*/, this.wallet.signLedger(msgs, { fee: fee, memo: memo }, this.registry)];
59
+ case 1: return [4 /*yield*/, signingstargateclient_1.SigningStargateClient.connectWithSigner(this.serverUrl, this.rawWallet, this.registry)];
60
+ case 2:
61
+ client = _b.sent();
62
+ return [4 /*yield*/, this.rawWallet.getAccounts()];
63
+ case 3:
64
+ address = (_b.sent())[0].address;
65
+ return [4 /*yield*/, client.sign(address, msgs, fee, memo)];
66
+ case 4: return [2 /*return*/, _b.sent()];
67
+ }
68
+ });
69
+ });
70
+ };
71
+ ITxClient.prototype.broadcast = function (txRaw) {
72
+ return __awaiter(this, void 0, void 0, function () {
73
+ var client, txBytes;
74
+ return __generator(this, function (_a) {
75
+ switch (_a.label) {
76
+ case 0: return [4 /*yield*/, signingstargateclient_1.SigningStargateClient.connectWithSigner(this.serverUrl, this.rawWallet, this.registry)];
77
+ case 1:
78
+ client = _a.sent();
79
+ txBytes = tx_1.TxRaw.encode(txRaw).finish();
80
+ return [4 /*yield*/, client.broadcastTx(txBytes)];
81
+ case 2: return [2 /*return*/, _a.sent()];
82
+ }
83
+ });
84
+ });
85
+ };
86
+ ITxClient.prototype.signAndBroadcast = function (msgs, _a) {
87
+ var fee = _a.fee, memo = _a.memo;
88
+ return __awaiter(this, void 0, void 0, function () {
89
+ var _b;
90
+ return __generator(this, function (_c) {
91
+ switch (_c.label) {
92
+ case 0:
93
+ _b = this.broadcast;
94
+ return [4 /*yield*/, this.sign(msgs, { fee: fee, memo: memo })];
95
+ case 1: return [4 /*yield*/, _b.apply(this, [_c.sent()])];
96
+ case 2: return [2 /*return*/, _c.sent()];
97
+ }
98
+ });
99
+ });
100
+ };
101
+ ITxClient.prototype.signDirectForSignDoc = function (signerAddress, signDoc) {
102
+ return __awaiter(this, void 0, void 0, function () {
103
+ var client;
104
+ return __generator(this, function (_a) {
105
+ switch (_a.label) {
106
+ case 0: return [4 /*yield*/, signingstargateclient_1.SigningStargateClient.connectWithSigner(this.serverUrl, this.rawWallet, this.registry)];
107
+ case 1:
108
+ client = _a.sent();
109
+ return [4 /*yield*/, client.signDirectForSignDoc(signerAddress, signDoc)];
110
+ case 2: return [2 /*return*/, _a.sent()];
111
+ }
112
+ });
113
+ });
114
+ };
115
+ return ITxClient;
116
+ }());
117
+ exports.ITxClient = ITxClient;
@@ -0,0 +1,27 @@
1
+ import { Tendermint34Client } from "@cosmjs/tendermint-rpc";
2
+ import { Account } from "./accounts";
3
+ import { StargateClient } from "./stargateclient";
4
+ export interface SignerData {
5
+ readonly account_number: string;
6
+ readonly sequence: string;
7
+ readonly chain_id: string;
8
+ }
9
+ export interface SequenceResponse {
10
+ readonly account_number: string;
11
+ readonly sequence: string;
12
+ }
13
+ export declare class LedgerSigningStargateClient extends StargateClient {
14
+ private chainId;
15
+ private static _endpoint;
16
+ static connectWithSigner(endpoint: string): Promise<LedgerSigningStargateClient>;
17
+ protected constructor(tmClient: Tendermint34Client);
18
+ getSignerData(address: string): Promise<SignerData>;
19
+ getChainId(): Promise<string>;
20
+ /**
21
+ * Takes a bech32 encoded address and returns the data part. The prefix is ignored and discarded.
22
+ * This is called AccAddress in Cosmos SDK, which is basically an alias for raw binary data.
23
+ * The result is typically 20 bytes long but not restricted to that.
24
+ */
25
+ private toAccAddress;
26
+ getAccount(address: string): Promise<Account | undefined>;
27
+ }
@@ -0,0 +1,165 @@
1
+ "use strict";
2
+ var __extends = (this && this.__extends) || (function () {
3
+ var extendStatics = function (d, b) {
4
+ extendStatics = Object.setPrototypeOf ||
5
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
+ return extendStatics(d, b);
8
+ };
9
+ return function (d, b) {
10
+ if (typeof b !== "function" && b !== null)
11
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
12
+ extendStatics(d, b);
13
+ function __() { this.constructor = d; }
14
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15
+ };
16
+ })();
17
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
18
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
19
+ return new (P || (P = Promise))(function (resolve, reject) {
20
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
21
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
22
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
23
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
24
+ });
25
+ };
26
+ var __generator = (this && this.__generator) || function (thisArg, body) {
27
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
28
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
29
+ function verb(n) { return function (v) { return step([n, v]); }; }
30
+ function step(op) {
31
+ if (f) throw new TypeError("Generator is already executing.");
32
+ while (_) try {
33
+ 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;
34
+ if (y = 0, t) op = [op[0] & 2, t.value];
35
+ switch (op[0]) {
36
+ case 0: case 1: t = op; break;
37
+ case 4: _.label++; return { value: op[1], done: false };
38
+ case 5: _.label++; y = op[1]; op = [0]; continue;
39
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
40
+ default:
41
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
42
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
43
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
44
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
45
+ if (t[2]) _.ops.pop();
46
+ _.trys.pop(); continue;
47
+ }
48
+ op = body.call(thisArg, _);
49
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
50
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
51
+ }
52
+ };
53
+ var __importDefault = (this && this.__importDefault) || function (mod) {
54
+ return (mod && mod.__esModule) ? mod : { "default": mod };
55
+ };
56
+ Object.defineProperty(exports, "__esModule", { value: true });
57
+ exports.LedgerSigningStargateClient = void 0;
58
+ var encoding_1 = require("@cosmjs/encoding");
59
+ var tendermint_rpc_1 = require("@cosmjs/tendermint-rpc");
60
+ var accounts_1 = require("./accounts");
61
+ var stargateclient_1 = require("./stargateclient");
62
+ var axios_1 = __importDefault(require("axios"));
63
+ var any_1 = require("../google/protobuf/any");
64
+ var LedgerSigningStargateClient = /** @class */ (function (_super) {
65
+ __extends(LedgerSigningStargateClient, _super);
66
+ function LedgerSigningStargateClient(tmClient) {
67
+ return _super.call(this, tmClient) || this;
68
+ }
69
+ LedgerSigningStargateClient.connectWithSigner = function (endpoint) {
70
+ return __awaiter(this, void 0, void 0, function () {
71
+ var tmClient;
72
+ return __generator(this, function (_a) {
73
+ switch (_a.label) {
74
+ case 0:
75
+ this._endpoint = endpoint;
76
+ return [4 /*yield*/, tendermint_rpc_1.Tendermint34Client.connect(endpoint)];
77
+ case 1:
78
+ tmClient = _a.sent();
79
+ return [2 /*return*/, new LedgerSigningStargateClient(tmClient)];
80
+ }
81
+ });
82
+ });
83
+ };
84
+ LedgerSigningStargateClient.prototype.getSignerData = function (address) {
85
+ return __awaiter(this, void 0, void 0, function () {
86
+ var chainID, account;
87
+ return __generator(this, function (_a) {
88
+ switch (_a.label) {
89
+ case 0: return [4 /*yield*/, this.getChainId()];
90
+ case 1:
91
+ chainID = _a.sent();
92
+ return [4 /*yield*/, this.getAccount(address)];
93
+ case 2:
94
+ account = _a.sent();
95
+ if (account == null)
96
+ throw new Error("account is null");
97
+ return [2 /*return*/, { account_number: account.accountNumber.toString(), sequence: account.sequence.toString(), chain_id: chainID }];
98
+ }
99
+ });
100
+ });
101
+ };
102
+ LedgerSigningStargateClient.prototype.getChainId = function () {
103
+ return __awaiter(this, void 0, void 0, function () {
104
+ var response, chainId;
105
+ return __generator(this, function (_a) {
106
+ switch (_a.label) {
107
+ case 0:
108
+ if (!!this.chainId) return [3 /*break*/, 2];
109
+ return [4 /*yield*/, this.forceGetTmClient().status()];
110
+ case 1:
111
+ response = _a.sent();
112
+ chainId = response.nodeInfo.network;
113
+ if (!chainId)
114
+ throw new Error("Chain ID must not be empty");
115
+ this.chainId = chainId;
116
+ _a.label = 2;
117
+ case 2: return [2 /*return*/, this.chainId];
118
+ }
119
+ });
120
+ });
121
+ };
122
+ /**
123
+ * Takes a bech32 encoded address and returns the data part. The prefix is ignored and discarded.
124
+ * This is called AccAddress in Cosmos SDK, which is basically an alias for raw binary data.
125
+ * The result is typically 20 bytes long but not restricted to that.
126
+ */
127
+ LedgerSigningStargateClient.prototype.toAccAddress = function (address) {
128
+ return encoding_1.Bech32.decode(address).data;
129
+ };
130
+ LedgerSigningStargateClient.prototype.getAccount = function (address) {
131
+ return __awaiter(this, void 0, void 0, function () {
132
+ var accAddress, hexAccAddress, axios, path, result, finalData, account, finalAccount, error_1;
133
+ return __generator(this, function (_a) {
134
+ switch (_a.label) {
135
+ case 0:
136
+ _a.trys.push([0, 2, , 3]);
137
+ accAddress = this.toAccAddress(address);
138
+ hexAccAddress = "0x01".concat(Buffer.from(accAddress).toString("hex"));
139
+ axios = axios_1.default.create({
140
+ baseURL: LedgerSigningStargateClient._endpoint,
141
+ headers: {
142
+ Accept: "application/json",
143
+ },
144
+ timeout: 15000
145
+ });
146
+ path = "/abci_query?path=\"/store/acc/key\"";
147
+ return [4 /*yield*/, axios.get(path, { params: { data: hexAccAddress } })];
148
+ case 1:
149
+ result = _a.sent();
150
+ finalData = result.data.result.response.value;
151
+ account = any_1.Any.decode(Buffer.from(finalData, "base64"));
152
+ finalAccount = (0, accounts_1.accountFromAny)(account);
153
+ return [2 /*return*/, finalAccount];
154
+ case 2:
155
+ error_1 = _a.sent();
156
+ return [2 /*return*/, undefined];
157
+ case 3: return [2 /*return*/];
158
+ }
159
+ });
160
+ });
161
+ };
162
+ LedgerSigningStargateClient._endpoint = "";
163
+ return LedgerSigningStargateClient;
164
+ }(stargateclient_1.StargateClient));
165
+ exports.LedgerSigningStargateClient = LedgerSigningStargateClient;
@@ -0,0 +1,14 @@
1
+ import { EncodeObject, Registry } from "@cosmjs/proto-signing";
2
+ import { TxRaw } from "cosmjs-types/cosmos/tx/v1beta1/tx";
3
+ import { SignAndBroadcastOptions } from "../common";
4
+ export interface LedgerWalletInterface {
5
+ getAddress(): Promise<string>;
6
+ sign(message: string): Promise<Uint8Array>;
7
+ getPublicKey(): Promise<Uint8Array>;
8
+ getAddressAndPublicKey(): Promise<{
9
+ address: string;
10
+ publicKey: Uint8Array;
11
+ }>;
12
+ showAddressOnDevice(): Promise<void>;
13
+ }
14
+ export declare function signFromLedger(ledger: LedgerWalletInterface, messages: EncodeObject[], option: SignAndBroadcastOptions, registry: Registry): Promise<TxRaw>;
@@ -0,0 +1,151 @@
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
+ var __read = (this && this.__read) || function (o, n) {
39
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
40
+ if (!m) return o;
41
+ var i = m.call(o), r, ar = [], e;
42
+ try {
43
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
44
+ }
45
+ catch (error) { e = { error: error }; }
46
+ finally {
47
+ try {
48
+ if (r && !r.done && (m = i["return"])) m.call(i);
49
+ }
50
+ finally { if (e) throw e.error; }
51
+ }
52
+ return ar;
53
+ };
54
+ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
55
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
56
+ if (ar || !(i in from)) {
57
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
58
+ ar[i] = from[i];
59
+ }
60
+ }
61
+ return to.concat(ar || Array.prototype.slice.call(from));
62
+ };
63
+ var __importDefault = (this && this.__importDefault) || function (mod) {
64
+ return (mod && mod.__esModule) ? mod : { "default": mod };
65
+ };
66
+ Object.defineProperty(exports, "__esModule", { value: true });
67
+ exports.signFromLedger = void 0;
68
+ var proto_signing_1 = require("@cosmjs/proto-signing");
69
+ var tx_1 = require("cosmjs-types/cosmos/tx/v1beta1/tx");
70
+ var long_1 = __importDefault(require("long"));
71
+ var math_1 = require("@cosmjs/math");
72
+ var encoding_1 = require("@cosmjs/encoding");
73
+ var aminotypes_1 = require("../amino/aminotypes");
74
+ var signdoc_1 = require("../amino/signdoc");
75
+ var encoding_2 = require("../amino/encoding");
76
+ var signdoc_2 = require("../amino/signdoc");
77
+ var encoding_3 = require("@cosmjs/encoding");
78
+ var signing_1 = require("cosmjs-types/cosmos/tx/signing/v1beta1/signing");
79
+ var tx_2 = require("cosmjs-types/cosmos/tx/v1beta1/tx");
80
+ var FirmaUtil_1 = require("../../FirmaUtil");
81
+ function makeSignerInfos(signers, signMode) {
82
+ return signers.map(function (_a) {
83
+ var pubkey = _a.pubkey, sequence = _a.sequence;
84
+ return ({
85
+ publicKey: pubkey,
86
+ modeInfo: {
87
+ single: { mode: signMode },
88
+ },
89
+ sequence: long_1.default.fromNumber(sequence),
90
+ });
91
+ });
92
+ }
93
+ function makeAuthInfoBytes(signers, feeAmount, gasLimit, granter, signMode) {
94
+ if (signMode === void 0) { signMode = signing_1.SignMode.SIGN_MODE_LEGACY_AMINO_JSON; }
95
+ var authInfo = {
96
+ signerInfos: makeSignerInfos(signers, signMode),
97
+ fee: {
98
+ amount: __spreadArray([], __read(feeAmount), false),
99
+ gasLimit: long_1.default.fromNumber(gasLimit),
100
+ granter: granter,
101
+ },
102
+ };
103
+ return tx_1.AuthInfo.encode(tx_1.AuthInfo.fromPartial(authInfo)).finish();
104
+ }
105
+ function signFromLedger(ledger, messages, option, registry) {
106
+ return __awaiter(this, void 0, void 0, function () {
107
+ var _a, address, publicKey, signerData, pubkey, aminoTypes, msgs, chainId, accountNumber, sequence, memo, fee, signDoc, signMessage, ledgerSignature, signedTxBody, signedTxBodyEncodeObject, signedTxBodyBytes, signedGasLimit, signedAuthInfoBytes, txRaw;
108
+ return __generator(this, function (_b) {
109
+ switch (_b.label) {
110
+ case 0: return [4 /*yield*/, ledger.getAddressAndPublicKey()];
111
+ case 1:
112
+ _a = _b.sent(), address = _a.address, publicKey = _a.publicKey;
113
+ return [4 /*yield*/, FirmaUtil_1.FirmaUtil.getSignerDataForLedger(address)];
114
+ case 2:
115
+ signerData = _b.sent();
116
+ pubkey = (0, proto_signing_1.encodePubkey)((0, encoding_2.encodeSecp256k1Pubkey)(publicKey));
117
+ aminoTypes = new aminotypes_1.AminoTypes({});
118
+ msgs = messages.map(function (msg) { return aminoTypes.toAmino(msg); });
119
+ chainId = signerData.chain_id;
120
+ accountNumber = Number.parseInt(signerData.account_number);
121
+ sequence = Number.parseInt(signerData.sequence);
122
+ memo = option.memo;
123
+ fee = { amount: option.fee.amount, gas: option.fee.gas };
124
+ signDoc = (0, signdoc_2.makeSignDoc)(msgs, fee, chainId, memo, accountNumber, sequence);
125
+ signMessage = (0, signdoc_1.serializeSignDoc)(signDoc);
126
+ return [4 /*yield*/, ledger.sign((0, encoding_3.fromUtf8)(signMessage))];
127
+ case 3:
128
+ ledgerSignature = _b.sent();
129
+ ;
130
+ signedTxBody = {
131
+ messages: signDoc.msgs.map(function (msg) { return aminoTypes.fromAmino(msg); }),
132
+ memo: memo,
133
+ };
134
+ signedTxBodyEncodeObject = {
135
+ typeUrl: "/cosmos.tx.v1beta1.TxBody",
136
+ value: signedTxBody,
137
+ };
138
+ signedTxBodyBytes = registry.encode(signedTxBodyEncodeObject);
139
+ signedGasLimit = math_1.Int53.fromString(option.fee.gas).toNumber();
140
+ signedAuthInfoBytes = makeAuthInfoBytes([{ pubkey: pubkey, sequence: sequence }], option.fee.amount, signedGasLimit, option.fee.granter, signing_1.SignMode.SIGN_MODE_LEGACY_AMINO_JSON);
141
+ txRaw = tx_2.TxRaw.fromPartial({
142
+ bodyBytes: signedTxBodyBytes,
143
+ authInfoBytes: signedAuthInfoBytes,
144
+ signatures: [(0, encoding_1.fromBase64)(Buffer.from(ledgerSignature).toString('base64'))],
145
+ });
146
+ return [2 /*return*/, txRaw];
147
+ }
148
+ });
149
+ });
150
+ }
151
+ exports.signFromLedger = signFromLedger;
@@ -0,0 +1,4 @@
1
+ export interface Pagination {
2
+ next_key: string;
3
+ total: number;
4
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,42 @@
1
+ export interface ChainSyncInfo {
2
+ latest_block_hash: string;
3
+ latest_app_hash: string;
4
+ latest_block_height: string;
5
+ latest_block_time: string;
6
+ earliest_block_hash: string;
7
+ earliest_app_hash: string;
8
+ earliest_block_height: string;
9
+ earliest_block_time: string;
10
+ catching_up: boolean;
11
+ }
12
+ export interface TransactionEvent {
13
+ type: string;
14
+ attributes: {
15
+ key: string;
16
+ value: string;
17
+ index: boolean;
18
+ }[];
19
+ }
20
+ export interface TransactionHash {
21
+ hash: string;
22
+ height: string;
23
+ index: number;
24
+ tx_result: {
25
+ code: number;
26
+ data: string;
27
+ log: string;
28
+ info: string;
29
+ gas_wanted: string;
30
+ gas_used: string;
31
+ events: TransactionEvent[];
32
+ codespace: string;
33
+ };
34
+ tx: string;
35
+ }
36
+ export declare class TendermintQueryClient {
37
+ private readonly axios;
38
+ constructor(baseUrl: string);
39
+ queryEstimateGas(hexTx: string): Promise<number>;
40
+ queryChainSyncInfo(): Promise<ChainSyncInfo>;
41
+ queryTransactionHash(txHash: string): Promise<TransactionHash>;
42
+ }