@firmachain/firma-js 0.3.4 → 0.3.6-beta1

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 (246) hide show
  1. package/dist/index.js +5 -1
  2. package/dist/sdk/FirmaAuthzService.d.ts +8 -7
  3. package/dist/sdk/FirmaAuthzService.js +12 -22
  4. package/dist/sdk/FirmaBankService.js +2 -2
  5. package/dist/sdk/FirmaChainService.js +1 -1
  6. package/dist/sdk/FirmaContractService.d.ts +1 -1
  7. package/dist/sdk/FirmaContractService.js +6 -6
  8. package/dist/sdk/FirmaCosmWasmCw20.d.ts +2 -2
  9. package/dist/sdk/FirmaCosmWasmCw20.js +8 -8
  10. package/dist/sdk/FirmaCosmWasmCw721.d.ts +2 -2
  11. package/dist/sdk/FirmaCosmWasmCw721.js +12 -12
  12. package/dist/sdk/FirmaCosmWasmCwBridge.d.ts +1 -1
  13. package/dist/sdk/FirmaCosmWasmCwBridge.js +8 -8
  14. package/dist/sdk/FirmaCosmWasmCwMarketplace.d.ts +1 -1
  15. package/dist/sdk/FirmaCosmWasmCwMarketplace.js +5 -5
  16. package/dist/sdk/FirmaCosmWasmService.d.ts +1 -1
  17. package/dist/sdk/FirmaCosmWasmService.js +13 -13
  18. package/dist/sdk/FirmaDistributionService.d.ts +1 -1
  19. package/dist/sdk/FirmaDistributionService.js +6 -6
  20. package/dist/sdk/FirmaFeeGrantService.d.ts +7 -6
  21. package/dist/sdk/FirmaFeeGrantService.js +9 -26
  22. package/dist/sdk/FirmaGovService.d.ts +1 -1
  23. package/dist/sdk/FirmaGovService.js +14 -14
  24. package/dist/sdk/FirmaIbcService.d.ts +3 -3
  25. package/dist/sdk/FirmaIbcService.js +11 -8
  26. package/dist/sdk/FirmaIpfsService.js +1 -1
  27. package/dist/sdk/FirmaMintService.js +1 -1
  28. package/dist/sdk/FirmaNftService.d.ts +1 -1
  29. package/dist/sdk/FirmaNftService.js +6 -6
  30. package/dist/sdk/FirmaSlashingService.js +1 -1
  31. package/dist/sdk/FirmaStakingService.d.ts +3 -3
  32. package/dist/sdk/FirmaStakingService.js +6 -6
  33. package/dist/sdk/FirmaTokenService.d.ts +1 -1
  34. package/dist/sdk/FirmaTokenService.js +5 -5
  35. package/dist/sdk/FirmaUtil.d.ts +26 -23
  36. package/dist/sdk/FirmaUtil.js +157 -137
  37. package/dist/sdk/FirmaWalletService.d.ts +5 -9
  38. package/dist/sdk/FirmaWalletService.js +86 -52
  39. package/dist/sdk/firmachain/authz/AuthzQueryClient.js +4 -4
  40. package/dist/sdk/firmachain/authz/AuthzTxTypes.d.ts +8 -11
  41. package/dist/sdk/firmachain/authz/AuthzTxTypes.js +6 -10
  42. package/dist/sdk/firmachain/authz/index.js +5 -1
  43. package/dist/sdk/firmachain/bank/BankQueryClient.js +5 -5
  44. package/dist/sdk/firmachain/bank/index.js +5 -1
  45. package/dist/sdk/firmachain/common/ITxClient.d.ts +3 -3
  46. package/dist/sdk/firmachain/common/ITxClient.js +25 -83
  47. package/dist/sdk/firmachain/common/LedgerWallet.d.ts +19 -3
  48. package/dist/sdk/firmachain/common/LedgerWallet.js +138 -68
  49. package/dist/sdk/firmachain/common/TendermintQueryClient.js +1 -1
  50. package/dist/sdk/firmachain/common/TxCommon.d.ts +14 -30
  51. package/dist/sdk/firmachain/common/accounts.d.ts +1 -1
  52. package/dist/sdk/firmachain/common/accounts.js +7 -7
  53. package/dist/sdk/firmachain/common/events.js +2 -2
  54. package/dist/sdk/firmachain/common/fee.d.ts +2 -2
  55. package/dist/sdk/firmachain/common/fee.js +4 -2
  56. package/dist/sdk/firmachain/common/index.d.ts +0 -1
  57. package/dist/sdk/firmachain/common/index.js +5 -4
  58. package/dist/sdk/firmachain/common/signing.d.ts +13 -9
  59. package/dist/sdk/firmachain/common/signing.js +81 -36
  60. package/dist/sdk/firmachain/common/signingprotobufstargateclient.d.ts +34 -0
  61. package/dist/sdk/firmachain/common/signingprotobufstargateclient.js +319 -0
  62. package/dist/sdk/firmachain/common/signingstargateclient.d.ts +21 -105
  63. package/dist/sdk/firmachain/common/signingstargateclient.js +120 -472
  64. package/dist/sdk/firmachain/common/{stargateclient.d.ts → stargateClient.d.ts} +11 -60
  65. package/dist/sdk/firmachain/common/{stargateclient.js → stargateClient.js} +109 -203
  66. package/dist/sdk/firmachain/{amino → common}/wallet.js +15 -11
  67. package/dist/sdk/firmachain/contract/ContractQueryClient.js +3 -3
  68. package/dist/sdk/firmachain/contract/ContractTxTypes.d.ts +6 -6
  69. package/dist/sdk/firmachain/contract/index.js +5 -1
  70. package/dist/sdk/firmachain/cosmwasm/CosmWasmQueryClient.js +9 -9
  71. package/dist/sdk/firmachain/cosmwasm/index.js +5 -1
  72. package/dist/sdk/firmachain/distribution/DistributionQueryClient.js +6 -6
  73. package/dist/sdk/firmachain/distribution/index.js +5 -1
  74. package/dist/sdk/firmachain/feegrant/FeeGrantQueryClient.js +3 -3
  75. package/dist/sdk/firmachain/feegrant/FeeGrantTxTypes.d.ts +4 -45
  76. package/dist/sdk/firmachain/feegrant/FeeGrantTxTypes.js +3 -82
  77. package/dist/sdk/firmachain/feegrant/index.js +5 -1
  78. package/dist/sdk/firmachain/google/protobuf/any.d.ts +3 -3
  79. package/dist/sdk/firmachain/google/protobuf/descriptor.d.ts +29 -29
  80. package/dist/sdk/firmachain/google/protobuf/duration.d.ts +3 -3
  81. package/dist/sdk/firmachain/gov/GovQueryClient.js +3 -3
  82. package/dist/sdk/firmachain/gov/index.js +5 -1
  83. package/dist/sdk/firmachain/ibc/IbcQueryClient.js +2 -2
  84. package/dist/sdk/firmachain/ibc/index.js +5 -1
  85. package/dist/sdk/firmachain/mint/MintQueryClient.js +1 -1
  86. package/dist/sdk/firmachain/mint/index.js +5 -1
  87. package/dist/sdk/firmachain/nft/NftQueryClient.js +1 -1
  88. package/dist/sdk/firmachain/nft/NftTxTypes.d.ts +8 -8
  89. package/dist/sdk/firmachain/nft/index.js +5 -1
  90. package/dist/sdk/firmachain/slashing/SlashingQueryClient.js +1 -1
  91. package/dist/sdk/firmachain/slashing/index.js +5 -1
  92. package/dist/sdk/firmachain/staking/StakingQueryClient.d.ts +2 -2
  93. package/dist/sdk/firmachain/staking/StakingQueryClient.js +10 -9
  94. package/dist/sdk/firmachain/staking/index.js +5 -1
  95. package/dist/sdk/firmachain/token/TokenQueryClient.js +1 -1
  96. package/dist/sdk/firmachain/token/TokenTxTypes.d.ts +11 -11
  97. package/dist/sdk/firmachain/token/TokenTxTypes.js +1 -1
  98. package/dist/sdk/firmachain/token/index.js +5 -1
  99. package/dist/test/00.wallet.test.js +4 -4
  100. package/dist/test/01.contract_tx.test.js +5 -5
  101. package/dist/test/02.contract_query.test.js +15 -15
  102. package/dist/test/03.contract_scenario.test.js +28 -28
  103. package/dist/test/04.bank_tx.test.js +4 -4
  104. package/dist/test/05.bank_query.test.js +9 -9
  105. package/dist/test/06.feegrant_tx.test.js +59 -35
  106. package/dist/test/07.feegrant_query.test.js +18 -15
  107. package/dist/test/08.gas_estimate.test.js +110 -70
  108. package/dist/test/09.ipfs.test.js +4 -4
  109. package/dist/test/10.nft_tx.test.js +7 -7
  110. package/dist/test/11.nft_query.test.js +9 -9
  111. package/dist/test/12.staking_tx.test.js +27 -15
  112. package/dist/test/13.staking_query.test.js +20 -20
  113. package/dist/test/14.distribution_tx.test.js +8 -8
  114. package/dist/test/15.distribution_query.test.js +15 -15
  115. package/dist/test/16.gov_tx.test.js +17 -17
  116. package/dist/test/17.gov_query.test.js +19 -19
  117. package/dist/test/18.util.test.js +105 -63
  118. package/dist/test/19.chain.test.js +38 -38
  119. package/dist/test/20.slashing_query.test.js +25 -25
  120. package/dist/test/21.token_tx.test.js +6 -6
  121. package/dist/test/22.token_query.test.js +4 -4
  122. package/dist/test/23.authz_tx.test.js +77 -47
  123. package/dist/test/24.authz_query.test.js +66 -67
  124. package/dist/test/25.cosmwasm_tx.test.js +7 -7
  125. package/dist/test/26.cosmwasm_query.test.js +127 -59
  126. package/dist/test/{27.arbitary_sign.test.js → 27.arbitrary_sign.test.js} +41 -40
  127. package/dist/test/28.ibc_tx.test.js +8 -8
  128. package/dist/test/29.mint_query.test.js +2 -2
  129. package/dist/test/30.cw20_tx.test.js +20 -20
  130. package/dist/test/31.cw20_query.test.js +24 -24
  131. package/dist/test/32.cw721_tx.test.js +19 -19
  132. package/dist/test/33.cw721_query.test.js +32 -32
  133. package/dist/test/34.cw_bridge_tx.test.js +19 -19
  134. package/dist/test/35.cw_bridge_tx_low.test.js +13 -13
  135. package/dist/test/36.cw_bridge_query.test.js +20 -20
  136. package/dist/test/37.cw_marketplace_tx.test.js +32 -32
  137. package/dist/test/38.cw_marketplace_query.test.js +2 -2
  138. package/dist/test/config_test.d.ts +2 -2
  139. package/dist/test/config_test.js +22 -5
  140. package/package.json +9 -10
  141. package/dist/sdk/firmachain/amino/addresses.d.ts +0 -5
  142. package/dist/sdk/firmachain/amino/addresses.js +0 -46
  143. package/dist/sdk/firmachain/amino/aminomsgs.d.ts +0 -291
  144. package/dist/sdk/firmachain/amino/aminomsgs.js +0 -81
  145. package/dist/sdk/firmachain/amino/aminotypes.d.ts +0 -22
  146. package/dist/sdk/firmachain/amino/aminotypes.js +0 -538
  147. package/dist/sdk/firmachain/amino/coins.d.ts +0 -42
  148. package/dist/sdk/firmachain/amino/coins.js +0 -90
  149. package/dist/sdk/firmachain/amino/encoding.d.ts +0 -33
  150. package/dist/sdk/firmachain/amino/encoding.js +0 -252
  151. package/dist/sdk/firmachain/amino/multisig.d.ts +0 -10
  152. package/dist/sdk/firmachain/amino/multisig.js +0 -42
  153. package/dist/sdk/firmachain/amino/pubkeys.d.ts +0 -47
  154. package/dist/sdk/firmachain/amino/pubkeys.js +0 -29
  155. package/dist/sdk/firmachain/amino/signature.d.ts +0 -16
  156. package/dist/sdk/firmachain/amino/signature.js +0 -36
  157. package/dist/sdk/firmachain/amino/signdoc.d.ts +0 -44
  158. package/dist/sdk/firmachain/amino/signdoc.js +0 -68
  159. package/dist/sdk/firmachain/amino/signer.d.ts +0 -33
  160. package/dist/sdk/firmachain/amino/signer.js +0 -2
  161. package/dist/sdk/firmachain/amino/stdtx.d.ts +0 -15
  162. package/dist/sdk/firmachain/amino/stdtx.js +0 -17
  163. package/dist/sdk/firmachain/common/LedgerSigningStargateClient.d.ts +0 -22
  164. package/dist/sdk/firmachain/common/LedgerSigningStargateClient.js +0 -170
  165. package/dist/sdk/firmachain/common/aminotypes.d.ts +0 -19
  166. package/dist/sdk/firmachain/common/aminotypes.js +0 -74
  167. package/dist/sdk/firmachain/common/modules/auth/queries.d.ts +0 -15
  168. package/dist/sdk/firmachain/common/modules/auth/queries.js +0 -64
  169. package/dist/sdk/firmachain/common/modules/authz/aminomessages.d.ts +0 -2
  170. package/dist/sdk/firmachain/common/modules/authz/aminomessages.js +0 -15
  171. package/dist/sdk/firmachain/common/modules/authz/messages.d.ts +0 -2
  172. package/dist/sdk/firmachain/common/modules/authz/messages.js +0 -9
  173. package/dist/sdk/firmachain/common/modules/authz/queries.d.ts +0 -10
  174. package/dist/sdk/firmachain/common/modules/authz/queries.js +0 -88
  175. package/dist/sdk/firmachain/common/modules/bank/aminomessages.d.ts +0 -35
  176. package/dist/sdk/firmachain/common/modules/bank/aminomessages.js +0 -85
  177. package/dist/sdk/firmachain/common/modules/bank/messages.d.ts +0 -8
  178. package/dist/sdk/firmachain/common/modules/bank/messages.js +0 -12
  179. package/dist/sdk/firmachain/common/modules/bank/queries.d.ts +0 -15
  180. package/dist/sdk/firmachain/common/modules/bank/queries.js +0 -128
  181. package/dist/sdk/firmachain/common/modules/crisis/aminomessages.d.ts +0 -14
  182. package/dist/sdk/firmachain/common/modules/crisis/aminomessages.js +0 -11
  183. package/dist/sdk/firmachain/common/modules/distribution/aminomessages.d.ts +0 -44
  184. package/dist/sdk/firmachain/common/modules/distribution/aminomessages.js +0 -113
  185. package/dist/sdk/firmachain/common/modules/distribution/messages.d.ts +0 -8
  186. package/dist/sdk/firmachain/common/modules/distribution/messages.js +0 -15
  187. package/dist/sdk/firmachain/common/modules/distribution/queries.d.ts +0 -16
  188. package/dist/sdk/firmachain/common/modules/distribution/queries.js +0 -171
  189. package/dist/sdk/firmachain/common/modules/evidence/aminomessages.d.ts +0 -18
  190. package/dist/sdk/firmachain/common/modules/evidence/aminomessages.js +0 -11
  191. package/dist/sdk/firmachain/common/modules/feegrant/aminomessages.d.ts +0 -2
  192. package/dist/sdk/firmachain/common/modules/feegrant/aminomessages.js +0 -14
  193. package/dist/sdk/firmachain/common/modules/feegrant/messages.d.ts +0 -2
  194. package/dist/sdk/firmachain/common/modules/feegrant/messages.js +0 -8
  195. package/dist/sdk/firmachain/common/modules/feegrant/queries.d.ts +0 -9
  196. package/dist/sdk/firmachain/common/modules/feegrant/queries.js +0 -81
  197. package/dist/sdk/firmachain/common/modules/gov/aminomessages.d.ts +0 -79
  198. package/dist/sdk/firmachain/common/modules/gov/aminomessages.js +0 -152
  199. package/dist/sdk/firmachain/common/modules/gov/messages.d.ts +0 -29
  200. package/dist/sdk/firmachain/common/modules/gov/messages.js +0 -39
  201. package/dist/sdk/firmachain/common/modules/gov/queries.d.ts +0 -19
  202. package/dist/sdk/firmachain/common/modules/gov/queries.js +0 -160
  203. package/dist/sdk/firmachain/common/modules/group/aminomessages.d.ts +0 -2
  204. package/dist/sdk/firmachain/common/modules/group/aminomessages.js +0 -8
  205. package/dist/sdk/firmachain/common/modules/group/messages.d.ts +0 -2
  206. package/dist/sdk/firmachain/common/modules/group/messages.js +0 -28
  207. package/dist/sdk/firmachain/common/modules/ibc/aminomessages.d.ts +0 -38
  208. package/dist/sdk/firmachain/common/modules/ibc/aminomessages.js +0 -55
  209. package/dist/sdk/firmachain/common/modules/ibc/messages.d.ts +0 -8
  210. package/dist/sdk/firmachain/common/modules/ibc/messages.js +0 -32
  211. package/dist/sdk/firmachain/common/modules/ibc/queries.d.ts +0 -58
  212. package/dist/sdk/firmachain/common/modules/ibc/queries.js +0 -576
  213. package/dist/sdk/firmachain/common/modules/index.d.ts +0 -32
  214. package/dist/sdk/firmachain/common/modules/index.js +0 -101
  215. package/dist/sdk/firmachain/common/modules/mint/queries.d.ts +0 -21
  216. package/dist/sdk/firmachain/common/modules/mint/queries.js +0 -95
  217. package/dist/sdk/firmachain/common/modules/slashing/aminomessages.d.ts +0 -12
  218. package/dist/sdk/firmachain/common/modules/slashing/aminomessages.js +0 -11
  219. package/dist/sdk/firmachain/common/modules/slashing/queries.d.ts +0 -10
  220. package/dist/sdk/firmachain/common/modules/slashing/queries.js +0 -88
  221. package/dist/sdk/firmachain/common/modules/staking/aminomessages.d.ts +0 -112
  222. package/dist/sdk/firmachain/common/modules/staking/aminomessages.js +0 -234
  223. package/dist/sdk/firmachain/common/modules/staking/messages.d.ts +0 -33
  224. package/dist/sdk/firmachain/common/modules/staking/messages.js +0 -37
  225. package/dist/sdk/firmachain/common/modules/staking/queries.d.ts +0 -23
  226. package/dist/sdk/firmachain/common/modules/staking/queries.js +0 -242
  227. package/dist/sdk/firmachain/common/modules/tx/queries.d.ts +0 -11
  228. package/dist/sdk/firmachain/common/modules/tx/queries.js +0 -103
  229. package/dist/sdk/firmachain/common/modules/vesting/aminomessages.d.ts +0 -16
  230. package/dist/sdk/firmachain/common/modules/vesting/aminomessages.js +0 -56
  231. package/dist/sdk/firmachain/common/modules/vesting/messages.d.ts +0 -2
  232. package/dist/sdk/firmachain/common/modules/vesting/messages.js +0 -7
  233. package/dist/sdk/firmachain/common/queryclient/index.d.ts +0 -2
  234. package/dist/sdk/firmachain/common/queryclient/index.js +0 -10
  235. package/dist/sdk/firmachain/common/queryclient/queryclient.d.ts +0 -75
  236. package/dist/sdk/firmachain/common/queryclient/queryclient.js +0 -157
  237. package/dist/sdk/firmachain/common/queryclient/utils.d.ts +0 -33
  238. package/dist/sdk/firmachain/common/queryclient/utils.js +0 -101
  239. package/dist/sdk/firmachain/common/search.d.ts +0 -10
  240. package/dist/sdk/firmachain/common/search.js +0 -7
  241. package/dist/sdk/firmachain/google/protobuf/timestamp.d.ts +0 -110
  242. package/dist/sdk/firmachain/google/protobuf/timestamp.js +0 -108
  243. /package/dist/sdk/firmachain/{amino → common}/paths.d.ts +0 -0
  244. /package/dist/sdk/firmachain/{amino → common}/paths.js +0 -0
  245. /package/dist/sdk/firmachain/{amino → common}/wallet.d.ts +0 -0
  246. /package/dist/test/{27.arbitary_sign.test.d.ts → 27.arbitrary_sign.test.d.ts} +0 -0
@@ -1,33 +0,0 @@
1
- import { Ed25519Pubkey, Pubkey, Secp256k1Pubkey } from "./pubkeys";
2
- /**
3
- * Takes a Secp256k1 public key as raw bytes and returns the Amino JSON
4
- * representation of it (the type/value wrapper object).
5
- */
6
- export declare function encodeSecp256k1Pubkey(pubkey: Uint8Array): Secp256k1Pubkey;
7
- /**
8
- * Takes an Edd25519 public key as raw bytes and returns the Amino JSON
9
- * representation of it (the type/value wrapper object).
10
- */
11
- export declare function encodeEd25519Pubkey(pubkey: Uint8Array): Ed25519Pubkey;
12
- /**
13
- * Decodes a pubkey in the Amino binary format to a type/value object.
14
- */
15
- export declare function decodeAminoPubkey(data: Uint8Array): Pubkey;
16
- /**
17
- * Decodes a bech32 pubkey to Amino binary, which is then decoded to a type/value object.
18
- * The bech32 prefix is ignored and discareded.
19
- *
20
- * @param bechEncoded the bech32 encoded pubkey
21
- */
22
- export declare function decodeBech32Pubkey(bechEncoded: string): Pubkey;
23
- /**
24
- * Encodes a public key to binary Amino.
25
- */
26
- export declare function encodeAminoPubkey(pubkey: Pubkey): Uint8Array;
27
- /**
28
- * Encodes a public key to binary Amino and then to bech32.
29
- *
30
- * @param pubkey the public key to encode
31
- * @param prefix the bech32 prefix (human readable part)
32
- */
33
- export declare function encodeBech32Pubkey(pubkey: Pubkey, prefix: string): string;
@@ -1,252 +0,0 @@
1
- "use strict";
2
- var __read = (this && this.__read) || function (o, n) {
3
- var m = typeof Symbol === "function" && o[Symbol.iterator];
4
- if (!m) return o;
5
- var i = m.call(o), r, ar = [], e;
6
- try {
7
- while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
8
- }
9
- catch (error) { e = { error: error }; }
10
- finally {
11
- try {
12
- if (r && !r.done && (m = i["return"])) m.call(i);
13
- }
14
- finally { if (e) throw e.error; }
15
- }
16
- return ar;
17
- };
18
- var __spreadArray = (this && this.__spreadArray) || function (to, from) {
19
- for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
20
- to[j] = from[i];
21
- return to;
22
- };
23
- var __values = (this && this.__values) || function(o) {
24
- var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
25
- if (m) return m.call(o);
26
- if (o && typeof o.length === "number") return {
27
- next: function () {
28
- if (o && i >= o.length) o = void 0;
29
- return { value: o && o[i++], done: !o };
30
- }
31
- };
32
- throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
33
- };
34
- Object.defineProperty(exports, "__esModule", { value: true });
35
- exports.encodeBech32Pubkey = exports.encodeAminoPubkey = exports.decodeBech32Pubkey = exports.decodeAminoPubkey = exports.encodeEd25519Pubkey = exports.encodeSecp256k1Pubkey = void 0;
36
- var encoding_1 = require("@cosmjs/encoding");
37
- var math_1 = require("@cosmjs/math");
38
- var utils_1 = require("@cosmjs/utils");
39
- var pubkeys_1 = require("./pubkeys");
40
- /**
41
- * Takes a Secp256k1 public key as raw bytes and returns the Amino JSON
42
- * representation of it (the type/value wrapper object).
43
- */
44
- function encodeSecp256k1Pubkey(pubkey) {
45
- if (pubkey.length !== 33 || (pubkey[0] !== 0x02 && pubkey[0] !== 0x03)) {
46
- throw new Error("Public key must be compressed secp256k1, i.e. 33 bytes starting with 0x02 or 0x03");
47
- }
48
- return {
49
- type: pubkeys_1.pubkeyType.secp256k1,
50
- value: encoding_1.toBase64(pubkey),
51
- };
52
- }
53
- exports.encodeSecp256k1Pubkey = encodeSecp256k1Pubkey;
54
- /**
55
- * Takes an Edd25519 public key as raw bytes and returns the Amino JSON
56
- * representation of it (the type/value wrapper object).
57
- */
58
- function encodeEd25519Pubkey(pubkey) {
59
- if (pubkey.length !== 32) {
60
- throw new Error("Ed25519 public key must be 32 bytes long");
61
- }
62
- return {
63
- type: pubkeys_1.pubkeyType.ed25519,
64
- value: encoding_1.toBase64(pubkey),
65
- };
66
- }
67
- exports.encodeEd25519Pubkey = encodeEd25519Pubkey;
68
- // As discussed in https://github.com/binance-chain/javascript-sdk/issues/163
69
- // Prefixes listed here: https://github.com/tendermint/tendermint/blob/d419fffe18531317c28c29a292ad7d253f6cafdf/docs/spec/blockchain/encoding.md#public-key-cryptography
70
- // Last bytes is varint-encoded length prefix
71
- var pubkeyAminoPrefixSecp256k1 = encoding_1.fromHex("eb5ae987" + "21" /* fixed length */);
72
- var pubkeyAminoPrefixEd25519 = encoding_1.fromHex("1624de64" + "20" /* fixed length */);
73
- var pubkeyAminoPrefixSr25519 = encoding_1.fromHex("0dfb1005" + "20" /* fixed length */);
74
- /** See https://github.com/tendermint/tendermint/commit/38b401657e4ad7a7eeb3c30a3cbf512037df3740 */
75
- var pubkeyAminoPrefixMultisigThreshold = encoding_1.fromHex("22c1f7e2" /* variable length not included */);
76
- /**
77
- * Decodes a pubkey in the Amino binary format to a type/value object.
78
- */
79
- function decodeAminoPubkey(data) {
80
- if (utils_1.arrayContentStartsWith(data, pubkeyAminoPrefixSecp256k1)) {
81
- var rest = data.slice(pubkeyAminoPrefixSecp256k1.length);
82
- if (rest.length !== 33) {
83
- throw new Error("Invalid rest data length. Expected 33 bytes (compressed secp256k1 pubkey).");
84
- }
85
- return {
86
- type: pubkeys_1.pubkeyType.secp256k1,
87
- value: encoding_1.toBase64(rest),
88
- };
89
- }
90
- else if (utils_1.arrayContentStartsWith(data, pubkeyAminoPrefixEd25519)) {
91
- var rest = data.slice(pubkeyAminoPrefixEd25519.length);
92
- if (rest.length !== 32) {
93
- throw new Error("Invalid rest data length. Expected 32 bytes (Ed25519 pubkey).");
94
- }
95
- return {
96
- type: pubkeys_1.pubkeyType.ed25519,
97
- value: encoding_1.toBase64(rest),
98
- };
99
- }
100
- else if (utils_1.arrayContentStartsWith(data, pubkeyAminoPrefixSr25519)) {
101
- var rest = data.slice(pubkeyAminoPrefixSr25519.length);
102
- if (rest.length !== 32) {
103
- throw new Error("Invalid rest data length. Expected 32 bytes (Sr25519 pubkey).");
104
- }
105
- return {
106
- type: pubkeys_1.pubkeyType.sr25519,
107
- value: encoding_1.toBase64(rest),
108
- };
109
- }
110
- else if (utils_1.arrayContentStartsWith(data, pubkeyAminoPrefixMultisigThreshold)) {
111
- // eslint-disable-next-line @typescript-eslint/no-use-before-define
112
- return decodeMultisigPubkey(data);
113
- }
114
- else {
115
- throw new Error("Unsupported public key type. Amino data starts with: " + encoding_1.toHex(data.slice(0, 5)));
116
- }
117
- }
118
- exports.decodeAminoPubkey = decodeAminoPubkey;
119
- /**
120
- * Decodes a bech32 pubkey to Amino binary, which is then decoded to a type/value object.
121
- * The bech32 prefix is ignored and discareded.
122
- *
123
- * @param bechEncoded the bech32 encoded pubkey
124
- */
125
- function decodeBech32Pubkey(bechEncoded) {
126
- var data = encoding_1.fromBech32(bechEncoded).data;
127
- return decodeAminoPubkey(data);
128
- }
129
- exports.decodeBech32Pubkey = decodeBech32Pubkey;
130
- /**
131
- * Uvarint decoder for Amino.
132
- * @see https://github.com/tendermint/go-amino/blob/8e779b71f40d175/decoder.go#L64-76
133
- * @returns varint as number, and bytes count occupied by varaint
134
- */
135
- function decodeUvarint(reader) {
136
- if (reader.length < 1) {
137
- throw new Error("Can't decode varint. EOF");
138
- }
139
- if (reader[0] > 127) {
140
- throw new Error("Decoding numbers > 127 is not supported here. Please tell those lazy CosmJS maintainers to port the binary.Varint implementation from the Go standard library and write some tests.");
141
- }
142
- return [reader[0], 1];
143
- }
144
- /**
145
- * Decodes a multisig pubkey to type object.
146
- * Pubkey structure [ prefix + const + threshold + loop:(const + pubkeyLength + pubkey ) ]
147
- * [ 4b + 1b + varint + loop:(1b + varint + pubkeyLength bytes) ]
148
- * @param data encoded pubkey
149
- */
150
- function decodeMultisigPubkey(data) {
151
- var reader = Array.from(data);
152
- // remove multisig amino prefix;
153
- var prefixFromReader = reader.splice(0, pubkeyAminoPrefixMultisigThreshold.length);
154
- if (!utils_1.arrayContentStartsWith(prefixFromReader, pubkeyAminoPrefixMultisigThreshold)) {
155
- throw new Error("Invalid multisig prefix.");
156
- }
157
- // remove 0x08 threshold prefix;
158
- if (reader.shift() != 0x08) {
159
- throw new Error("Invalid multisig data. Expecting 0x08 prefix before threshold.");
160
- }
161
- // read threshold
162
- var _a = __read(decodeUvarint(reader), 2), threshold = _a[0], thresholdBytesLength = _a[1];
163
- reader.splice(0, thresholdBytesLength);
164
- // read participants pubkeys
165
- var pubkeys = [];
166
- while (reader.length > 0) {
167
- // remove 0x12 threshold prefix;
168
- if (reader.shift() != 0x12) {
169
- throw new Error("Invalid multisig data. Expecting 0x12 prefix before participant pubkey length.");
170
- }
171
- // read pubkey length
172
- var _b = __read(decodeUvarint(reader), 2), pubkeyLength = _b[0], pubkeyLengthBytesSize = _b[1];
173
- reader.splice(0, pubkeyLengthBytesSize);
174
- // verify that we can read pubkey
175
- if (reader.length < pubkeyLength) {
176
- throw new Error("Invalid multisig data length.");
177
- }
178
- // read and decode participant pubkey
179
- var encodedPubkey = reader.splice(0, pubkeyLength);
180
- var pubkey = decodeAminoPubkey(Uint8Array.from(encodedPubkey));
181
- pubkeys.push(pubkey);
182
- }
183
- return {
184
- type: pubkeys_1.pubkeyType.multisigThreshold,
185
- value: {
186
- threshold: threshold.toString(),
187
- pubkeys: pubkeys,
188
- },
189
- };
190
- }
191
- /**
192
- * Uvarint encoder for Amino. This is the same encoding as `binary.PutUvarint` from the Go
193
- * standard library.
194
- *
195
- * @see https://github.com/tendermint/go-amino/blob/8e779b71f40d175/encoder.go#L77-L85
196
- */
197
- function encodeUvarint(value) {
198
- var checked = math_1.Uint53.fromString(value.toString()).toNumber();
199
- if (checked > 127) {
200
- throw new Error("Encoding numbers > 127 is not supported here. Please tell those lazy CosmJS maintainers to port the binary.PutUvarint implementation from the Go standard library and write some tests.");
201
- }
202
- return [checked];
203
- }
204
- /**
205
- * Encodes a public key to binary Amino.
206
- */
207
- function encodeAminoPubkey(pubkey) {
208
- var e_1, _a;
209
- if (pubkeys_1.isMultisigThresholdPubkey(pubkey)) {
210
- var out = Array.from(pubkeyAminoPrefixMultisigThreshold);
211
- out.push(0x08); // TODO: What is this?
212
- out.push.apply(// TODO: What is this?
213
- out, __spreadArray([], __read(encodeUvarint(pubkey.value.threshold))));
214
- try {
215
- for (var _b = __values(pubkey.value.pubkeys.map(function (p) { return encodeAminoPubkey(p); })), _c = _b.next(); !_c.done; _c = _b.next()) {
216
- var pubkeyData = _c.value;
217
- out.push(0x12); // TODO: What is this?
218
- out.push.apply(// TODO: What is this?
219
- out, __spreadArray([], __read(encodeUvarint(pubkeyData.length))));
220
- out.push.apply(out, __spreadArray([], __read(pubkeyData)));
221
- }
222
- }
223
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
224
- finally {
225
- try {
226
- if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
227
- }
228
- finally { if (e_1) throw e_1.error; }
229
- }
230
- return new Uint8Array(out);
231
- }
232
- else if (pubkeys_1.isEd25519Pubkey(pubkey)) {
233
- return new Uint8Array(__spreadArray(__spreadArray([], __read(pubkeyAminoPrefixEd25519)), __read(encoding_1.fromBase64(pubkey.value))));
234
- }
235
- else if (pubkeys_1.isSecp256k1Pubkey(pubkey)) {
236
- return new Uint8Array(__spreadArray(__spreadArray([], __read(pubkeyAminoPrefixSecp256k1)), __read(encoding_1.fromBase64(pubkey.value))));
237
- }
238
- else {
239
- throw new Error("Unsupported pubkey type");
240
- }
241
- }
242
- exports.encodeAminoPubkey = encodeAminoPubkey;
243
- /**
244
- * Encodes a public key to binary Amino and then to bech32.
245
- *
246
- * @param pubkey the public key to encode
247
- * @param prefix the bech32 prefix (human readable part)
248
- */
249
- function encodeBech32Pubkey(pubkey, prefix) {
250
- return encoding_1.toBech32(prefix, encodeAminoPubkey(pubkey));
251
- }
252
- exports.encodeBech32Pubkey = encodeBech32Pubkey;
@@ -1,10 +0,0 @@
1
- import { MultisigThresholdPubkey, SinglePubkey } from "./pubkeys";
2
- /**
3
- * Compare arrays lexicographically.
4
- *
5
- * Returns value < 0 if `a < b`.
6
- * Returns value > 0 if `a > b`.
7
- * Returns 0 if `a === b`.
8
- */
9
- export declare function compareArrays(a: Uint8Array, b: Uint8Array): number;
10
- export declare function createMultisigThresholdPubkey(pubkeys: readonly SinglePubkey[], threshold: number, nosort?: boolean): MultisigThresholdPubkey;
@@ -1,42 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.createMultisigThresholdPubkey = exports.compareArrays = void 0;
4
- var encoding_1 = require("@cosmjs/encoding");
5
- var math_1 = require("@cosmjs/math");
6
- var addresses_1 = require("./addresses");
7
- /**
8
- * Compare arrays lexicographically.
9
- *
10
- * Returns value < 0 if `a < b`.
11
- * Returns value > 0 if `a > b`.
12
- * Returns 0 if `a === b`.
13
- */
14
- function compareArrays(a, b) {
15
- var aHex = encoding_1.toHex(a);
16
- var bHex = encoding_1.toHex(b);
17
- return aHex === bHex ? 0 : aHex < bHex ? -1 : 1;
18
- }
19
- exports.compareArrays = compareArrays;
20
- function createMultisigThresholdPubkey(pubkeys, threshold, nosort) {
21
- if (nosort === void 0) { nosort = false; }
22
- var uintThreshold = new math_1.Uint53(threshold);
23
- if (uintThreshold.toNumber() > pubkeys.length) {
24
- throw new Error("Threshold k = " + uintThreshold.toNumber() + " exceeds number of keys n = " + pubkeys.length);
25
- }
26
- var outPubkeys = nosort
27
- ? pubkeys
28
- : Array.from(pubkeys).sort(function (lhs, rhs) {
29
- // https://github.com/cosmos/cosmos-sdk/blob/v0.42.2/client/keys/add.go#L172-L174
30
- var addressLhs = addresses_1.pubkeyToRawAddress(lhs);
31
- var addressRhs = addresses_1.pubkeyToRawAddress(rhs);
32
- return compareArrays(addressLhs, addressRhs);
33
- });
34
- return {
35
- type: "tendermint/PubKeyMultisigThreshold",
36
- value: {
37
- threshold: uintThreshold.toString(),
38
- pubkeys: outPubkeys,
39
- },
40
- };
41
- }
42
- exports.createMultisigThresholdPubkey = createMultisigThresholdPubkey;
@@ -1,47 +0,0 @@
1
- export interface Pubkey {
2
- readonly type: string;
3
- readonly value: any;
4
- }
5
- export interface Ed25519Pubkey extends SinglePubkey {
6
- readonly type: "tendermint/PubKeyEd25519";
7
- readonly value: string;
8
- }
9
- export declare function isEd25519Pubkey(pubkey: Pubkey): pubkey is Ed25519Pubkey;
10
- export interface Secp256k1Pubkey extends SinglePubkey {
11
- readonly type: "tendermint/PubKeySecp256k1";
12
- readonly value: string;
13
- }
14
- export declare function isSecp256k1Pubkey(pubkey: Pubkey): pubkey is Secp256k1Pubkey;
15
- export declare const pubkeyType: {
16
- /** @see https://github.com/tendermint/tendermint/blob/v0.33.0/crypto/ed25519/ed25519.go#L22 */
17
- secp256k1: "tendermint/PubKeySecp256k1";
18
- /** @see https://github.com/tendermint/tendermint/blob/v0.33.0/crypto/secp256k1/secp256k1.go#L23 */
19
- ed25519: "tendermint/PubKeyEd25519";
20
- /** @see https://github.com/tendermint/tendermint/blob/v0.33.0/crypto/sr25519/codec.go#L12 */
21
- sr25519: "tendermint/PubKeySr25519";
22
- multisigThreshold: "tendermint/PubKeyMultisigThreshold";
23
- };
24
- /**
25
- * A pubkey which contains the data directly without further nesting.
26
- *
27
- * You can think of this as a non-multisig pubkey.
28
- */
29
- export interface SinglePubkey extends Pubkey {
30
- readonly type: string;
31
- /**
32
- * The base64 encoding of the Amino binary encoded pubkey.
33
- *
34
- * Note: if type is Secp256k1, this must contain a 33 bytes compressed pubkey.
35
- */
36
- readonly value: string;
37
- }
38
- export declare function isSinglePubkey(pubkey: Pubkey): pubkey is SinglePubkey;
39
- export interface MultisigThresholdPubkey extends Pubkey {
40
- readonly type: "tendermint/PubKeyMultisigThreshold";
41
- readonly value: {
42
- /** A string-encoded integer */
43
- readonly threshold: string;
44
- readonly pubkeys: readonly SinglePubkey[];
45
- };
46
- }
47
- export declare function isMultisigThresholdPubkey(pubkey: Pubkey): pubkey is MultisigThresholdPubkey;
@@ -1,29 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isMultisigThresholdPubkey = exports.isSinglePubkey = exports.pubkeyType = exports.isSecp256k1Pubkey = exports.isEd25519Pubkey = void 0;
4
- function isEd25519Pubkey(pubkey) {
5
- return pubkey.type === "tendermint/PubKeyEd25519";
6
- }
7
- exports.isEd25519Pubkey = isEd25519Pubkey;
8
- function isSecp256k1Pubkey(pubkey) {
9
- return pubkey.type === "tendermint/PubKeySecp256k1";
10
- }
11
- exports.isSecp256k1Pubkey = isSecp256k1Pubkey;
12
- exports.pubkeyType = {
13
- /** @see https://github.com/tendermint/tendermint/blob/v0.33.0/crypto/ed25519/ed25519.go#L22 */
14
- secp256k1: "tendermint/PubKeySecp256k1",
15
- /** @see https://github.com/tendermint/tendermint/blob/v0.33.0/crypto/secp256k1/secp256k1.go#L23 */
16
- ed25519: "tendermint/PubKeyEd25519",
17
- /** @see https://github.com/tendermint/tendermint/blob/v0.33.0/crypto/sr25519/codec.go#L12 */
18
- sr25519: "tendermint/PubKeySr25519",
19
- multisigThreshold: "tendermint/PubKeyMultisigThreshold",
20
- };
21
- function isSinglePubkey(pubkey) {
22
- var singPubkeyTypes = [exports.pubkeyType.ed25519, exports.pubkeyType.secp256k1, exports.pubkeyType.sr25519];
23
- return singPubkeyTypes.includes(pubkey.type);
24
- }
25
- exports.isSinglePubkey = isSinglePubkey;
26
- function isMultisigThresholdPubkey(pubkey) {
27
- return pubkey.type === "tendermint/PubKeyMultisigThreshold";
28
- }
29
- exports.isMultisigThresholdPubkey = isMultisigThresholdPubkey;
@@ -1,16 +0,0 @@
1
- import { Pubkey } from "./pubkeys";
2
- export interface StdSignature {
3
- readonly pub_key: Pubkey;
4
- readonly signature: string;
5
- }
6
- /**
7
- * Takes a binary pubkey and signature to create a signature object
8
- *
9
- * @param pubkey a compressed secp256k1 public key
10
- * @param signature a 64 byte fixed length representation of secp256k1 signature components r and s
11
- */
12
- export declare function encodeSecp256k1Signature(pubkey: Uint8Array, signature: Uint8Array): StdSignature;
13
- export declare function decodeSignature(signature: StdSignature): {
14
- readonly pubkey: Uint8Array;
15
- readonly signature: Uint8Array;
16
- };
@@ -1,36 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.decodeSignature = exports.encodeSecp256k1Signature = void 0;
4
- /* eslint-disable @typescript-eslint/naming-convention */
5
- var encoding_1 = require("@cosmjs/encoding");
6
- var encoding_2 = require("./encoding");
7
- var pubkeys_1 = require("./pubkeys");
8
- /**
9
- * Takes a binary pubkey and signature to create a signature object
10
- *
11
- * @param pubkey a compressed secp256k1 public key
12
- * @param signature a 64 byte fixed length representation of secp256k1 signature components r and s
13
- */
14
- function encodeSecp256k1Signature(pubkey, signature) {
15
- if (signature.length !== 64) {
16
- throw new Error("Signature must be 64 bytes long. Cosmos SDK uses a 2x32 byte fixed length encoding for the secp256k1 signature integers r and s.");
17
- }
18
- return {
19
- pub_key: encoding_2.encodeSecp256k1Pubkey(pubkey),
20
- signature: encoding_1.toBase64(signature),
21
- };
22
- }
23
- exports.encodeSecp256k1Signature = encodeSecp256k1Signature;
24
- function decodeSignature(signature) {
25
- switch (signature.pub_key.type) {
26
- // Note: please don't add cases here without writing additional unit tests
27
- case pubkeys_1.pubkeyType.secp256k1:
28
- return {
29
- pubkey: encoding_1.fromBase64(signature.pub_key.value),
30
- signature: encoding_1.fromBase64(signature.signature),
31
- };
32
- default:
33
- throw new Error("Unsupported pubkey type");
34
- }
35
- }
36
- exports.decodeSignature = decodeSignature;
@@ -1,44 +0,0 @@
1
- import { Coin } from "./coins";
2
- export interface AminoMsg {
3
- readonly type: string;
4
- readonly value: any;
5
- }
6
- export interface StdFee {
7
- readonly amount: readonly Coin[];
8
- readonly gas: string;
9
- /** The granter address that is used for paying with feegrants */
10
- readonly granter?: string;
11
- /** The fee payer address. The payer must have signed the transaction. */
12
- readonly payer?: string;
13
- }
14
- /**
15
- * The document to be signed
16
- *
17
- * @see https://docs.cosmos.network/master/modules/auth/03_types.html#stdsigndoc
18
- */
19
- export interface StdSignDoc {
20
- readonly chain_id: string;
21
- readonly account_number: string;
22
- readonly sequence: string;
23
- readonly fee: StdFee;
24
- readonly msgs: readonly AminoMsg[];
25
- readonly memo: string;
26
- readonly timeout_height?: string;
27
- }
28
- /** Returns a JSON string with objects sorted by key */
29
- export declare function sortedJsonStringify(obj: any): string;
30
- export declare function makeSignDoc(msgs: readonly AminoMsg[], fee: StdFee, chainId: string, memo: string | undefined, accountNumber: number | string, sequence: number | string, timeout_height?: bigint): StdSignDoc;
31
- /**
32
- * Takes a valid JSON document and performs the following escapings in string values:
33
- *
34
- * `&` -> `\u0026`
35
- * `<` -> `\u003c`
36
- * `>` -> `\u003e`
37
- *
38
- * Since those characters do not occur in other places of the JSON document, only
39
- * string values are affected.
40
- *
41
- * If the input is invalid JSON, the behaviour is undefined.
42
- */
43
- export declare function escapeCharacters(input: string): string;
44
- export declare function serializeSignDoc(signDoc: StdSignDoc): Uint8Array;
@@ -1,68 +0,0 @@
1
- "use strict";
2
- var __assign = (this && this.__assign) || function () {
3
- __assign = Object.assign || function(t) {
4
- for (var s, i = 1, n = arguments.length; i < n; i++) {
5
- s = arguments[i];
6
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
- t[p] = s[p];
8
- }
9
- return t;
10
- };
11
- return __assign.apply(this, arguments);
12
- };
13
- Object.defineProperty(exports, "__esModule", { value: true });
14
- exports.serializeSignDoc = exports.escapeCharacters = exports.makeSignDoc = exports.sortedJsonStringify = void 0;
15
- /* eslint-disable @typescript-eslint/naming-convention */
16
- var encoding_1 = require("@cosmjs/encoding");
17
- var math_1 = require("@cosmjs/math");
18
- function sortedObject(obj) {
19
- if (typeof obj !== "object" || obj === null) {
20
- return obj;
21
- }
22
- if (Array.isArray(obj)) {
23
- return obj.map(sortedObject);
24
- }
25
- var sortedKeys = Object.keys(obj).sort();
26
- var result = {};
27
- // NOTE: Use forEach instead of reduce for performance with large objects eg Wasm code
28
- sortedKeys.forEach(function (key) {
29
- result[key] = sortedObject(obj[key]);
30
- });
31
- return result;
32
- }
33
- /** Returns a JSON string with objects sorted by key */
34
- // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
35
- function sortedJsonStringify(obj) {
36
- return JSON.stringify(sortedObject(obj));
37
- }
38
- exports.sortedJsonStringify = sortedJsonStringify;
39
- function makeSignDoc(msgs, fee, chainId, memo, accountNumber, sequence, timeout_height) {
40
- return __assign({ chain_id: chainId, account_number: math_1.Uint53.fromString(accountNumber.toString()).toString(), sequence: math_1.Uint53.fromString(sequence.toString()).toString(), fee: fee, msgs: msgs, memo: memo || "" }, (timeout_height && { timeout_height: timeout_height.toString() }));
41
- }
42
- exports.makeSignDoc = makeSignDoc;
43
- /**
44
- * Takes a valid JSON document and performs the following escapings in string values:
45
- *
46
- * `&` -> `\u0026`
47
- * `<` -> `\u003c`
48
- * `>` -> `\u003e`
49
- *
50
- * Since those characters do not occur in other places of the JSON document, only
51
- * string values are affected.
52
- *
53
- * If the input is invalid JSON, the behaviour is undefined.
54
- */
55
- function escapeCharacters(input) {
56
- // When we migrate to target es2021 or above, we can use replaceAll instead of global patterns.
57
- // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/replaceAll
58
- var amp = /&/g;
59
- var lt = /</g;
60
- var gt = />/g;
61
- return input.replace(amp, "\\u0026").replace(lt, "\\u003c").replace(gt, "\\u003e");
62
- }
63
- exports.escapeCharacters = escapeCharacters;
64
- function serializeSignDoc(signDoc) {
65
- var serialized = escapeCharacters(sortedJsonStringify(signDoc));
66
- return encoding_1.toUtf8(serialized);
67
- }
68
- exports.serializeSignDoc = serializeSignDoc;
@@ -1,33 +0,0 @@
1
- import { StdSignature } from "./signature";
2
- import { StdSignDoc } from "./signdoc";
3
- export declare type Algo = "secp256k1" | "ed25519" | "sr25519";
4
- export interface AccountData {
5
- /** A printable address (typically bech32 encoded) */
6
- readonly address: string;
7
- readonly algo: Algo;
8
- readonly pubkey: Uint8Array;
9
- }
10
- export interface AminoSignResponse {
11
- /**
12
- * The sign doc that was signed.
13
- * This may be different from the input signDoc when the signer modifies it as part of the signing process.
14
- */
15
- readonly signed: StdSignDoc;
16
- readonly signature: StdSignature;
17
- }
18
- export interface OfflineAminoSigner {
19
- /**
20
- * Get AccountData array from wallet. Rejects if not enabled.
21
- */
22
- readonly getAccounts: () => Promise<readonly AccountData[]>;
23
- /**
24
- * Request signature from whichever key corresponds to provided bech32-encoded address. Rejects if not enabled.
25
- *
26
- * The signer implementation may offer the user the ability to override parts of the signDoc. It must
27
- * return the doc that was signed in the response.
28
- *
29
- * @param signerAddress The address of the account that should sign the transaction
30
- * @param signDoc The content that should be signed
31
- */
32
- readonly signAmino: (signerAddress: string, signDoc: StdSignDoc) => Promise<AminoSignResponse>;
33
- }
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,15 +0,0 @@
1
- import { StdSignature } from "./signature";
2
- import { AminoMsg, StdFee, StdSignDoc } from "./signdoc";
3
- /**
4
- * A Cosmos SDK StdTx
5
- *
6
- * @see https://docs.cosmos.network/master/modules/auth/03_types.html#stdtx
7
- */
8
- export interface StdTx {
9
- readonly msg: readonly AminoMsg[];
10
- readonly fee: StdFee;
11
- readonly signatures: readonly StdSignature[];
12
- readonly memo: string | undefined;
13
- }
14
- export declare function isStdTx(txValue: unknown): txValue is StdTx;
15
- export declare function makeStdTx(content: Pick<StdSignDoc, "msgs" | "fee" | "memo">, signatures: StdSignature | readonly StdSignature[]): StdTx;
@@ -1,17 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.makeStdTx = exports.isStdTx = void 0;
4
- function isStdTx(txValue) {
5
- var _a = txValue, memo = _a.memo, msg = _a.msg, fee = _a.fee, signatures = _a.signatures;
6
- return (typeof memo === "string" && Array.isArray(msg) && typeof fee === "object" && Array.isArray(signatures));
7
- }
8
- exports.isStdTx = isStdTx;
9
- function makeStdTx(content, signatures) {
10
- return {
11
- msg: content.msgs,
12
- fee: content.fee,
13
- memo: content.memo,
14
- signatures: Array.isArray(signatures) ? signatures : [signatures],
15
- };
16
- }
17
- exports.makeStdTx = makeStdTx;