@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,538 +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
- var __read = (this && this.__read) || function (o, n) {
14
- var m = typeof Symbol === "function" && o[Symbol.iterator];
15
- if (!m) return o;
16
- var i = m.call(o), r, ar = [], e;
17
- try {
18
- while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
19
- }
20
- catch (error) { e = { error: error }; }
21
- finally {
22
- try {
23
- if (r && !r.done && (m = i["return"])) m.call(i);
24
- }
25
- finally { if (e) throw e.error; }
26
- }
27
- return ar;
28
- };
29
- var __spreadArray = (this && this.__spreadArray) || function (to, from) {
30
- for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
31
- to[j] = from[i];
32
- return to;
33
- };
34
- var __importDefault = (this && this.__importDefault) || function (mod) {
35
- return (mod && mod.__esModule) ? mod : { "default": mod };
36
- };
37
- Object.defineProperty(exports, "__esModule", { value: true });
38
- exports.AminoTypes = void 0;
39
- var encoding_1 = require("@cosmjs/encoding");
40
- var utils_1 = require("@cosmjs/utils");
41
- var gov_1 = require("cosmjs-types/cosmos/gov/v1beta1/gov");
42
- var any_1 = require("cosmjs-types/google/protobuf/any");
43
- var long_1 = __importDefault(require("long"));
44
- var encoding_2 = require("./encoding");
45
- function omitDefault(input) {
46
- if (typeof input === "string") {
47
- return input === "" ? undefined : input;
48
- }
49
- if (typeof input === "number") {
50
- return input === 0 ? undefined : input;
51
- }
52
- if (long_1.default.isLong(input)) {
53
- return input.isZero() ? undefined : input;
54
- }
55
- throw new Error("Got unsupported type '" + typeof input + "'");
56
- }
57
- function createDefaultTypes(prefix) {
58
- return {
59
- // bank
60
- "/cosmos.bank.v1beta1.MsgSend": {
61
- aminoType: "cosmos-sdk/MsgSend",
62
- toAmino: function (_a) {
63
- var fromAddress = _a.fromAddress, toAddress = _a.toAddress, amount = _a.amount;
64
- return ({
65
- from_address: fromAddress,
66
- to_address: toAddress,
67
- amount: __spreadArray([], __read(amount)),
68
- });
69
- },
70
- fromAmino: function (_a) {
71
- var from_address = _a.from_address, to_address = _a.to_address, amount = _a.amount;
72
- return ({
73
- fromAddress: from_address,
74
- toAddress: to_address,
75
- amount: __spreadArray([], __read(amount)),
76
- });
77
- },
78
- },
79
- "/cosmos.bank.v1beta1.MsgMultiSend": {
80
- aminoType: "cosmos-sdk/MsgMultiSend",
81
- toAmino: function (_a) {
82
- var inputs = _a.inputs, outputs = _a.outputs;
83
- return ({
84
- inputs: inputs.map(function (input) { return ({
85
- address: input.address,
86
- coins: __spreadArray([], __read(input.coins)),
87
- }); }),
88
- outputs: outputs.map(function (output) { return ({
89
- address: output.address,
90
- coins: __spreadArray([], __read(output.coins)),
91
- }); }),
92
- });
93
- },
94
- fromAmino: function (_a) {
95
- var inputs = _a.inputs, outputs = _a.outputs;
96
- return ({
97
- inputs: inputs.map(function (input) { return ({
98
- address: input.address,
99
- coins: __spreadArray([], __read(input.coins)),
100
- }); }),
101
- outputs: outputs.map(function (output) { return ({
102
- address: output.address,
103
- coins: __spreadArray([], __read(output.coins)),
104
- }); }),
105
- });
106
- },
107
- },
108
- // distribution
109
- "/cosmos.distribution.v1beta1.MsgFundCommunityPool": {
110
- aminoType: "cosmos-sdk/MsgFundCommunityPool",
111
- toAmino: function (_a) {
112
- var amount = _a.amount, depositor = _a.depositor;
113
- return ({
114
- amount: __spreadArray([], __read(amount)),
115
- depositor: depositor,
116
- });
117
- },
118
- fromAmino: function (_a) {
119
- var amount = _a.amount, depositor = _a.depositor;
120
- return ({
121
- amount: __spreadArray([], __read(amount)),
122
- depositor: depositor,
123
- });
124
- },
125
- },
126
- "/cosmos.distribution.v1beta1.MsgSetWithdrawAddress": {
127
- aminoType: "cosmos-sdk/MsgModifyWithdrawAddress",
128
- toAmino: function (_a) {
129
- var delegatorAddress = _a.delegatorAddress, withdrawAddress = _a.withdrawAddress;
130
- return ({
131
- delegator_address: delegatorAddress,
132
- withdraw_address: withdrawAddress,
133
- });
134
- },
135
- fromAmino: function (_a) {
136
- var delegator_address = _a.delegator_address, withdraw_address = _a.withdraw_address;
137
- return ({
138
- delegatorAddress: delegator_address,
139
- withdrawAddress: withdraw_address,
140
- });
141
- },
142
- },
143
- "/cosmos.distribution.v1beta1.MsgWithdrawDelegatorReward": {
144
- aminoType: "cosmos-sdk/MsgWithdrawDelegationReward",
145
- toAmino: function (_a) {
146
- var delegatorAddress = _a.delegatorAddress, validatorAddress = _a.validatorAddress;
147
- return ({
148
- delegator_address: delegatorAddress,
149
- validator_address: validatorAddress,
150
- });
151
- },
152
- fromAmino: function (_a) {
153
- var delegator_address = _a.delegator_address, validator_address = _a.validator_address;
154
- return ({
155
- delegatorAddress: delegator_address,
156
- validatorAddress: validator_address,
157
- });
158
- },
159
- },
160
- "/cosmos.distribution.v1beta1.MsgWithdrawValidatorCommission": {
161
- aminoType: "cosmos-sdk/MsgWithdrawValidatorCommission",
162
- toAmino: function (_a) {
163
- var validatorAddress = _a.validatorAddress;
164
- return ({
165
- validator_address: validatorAddress,
166
- });
167
- },
168
- fromAmino: function (_a) {
169
- var validator_address = _a.validator_address;
170
- return ({
171
- validatorAddress: validator_address,
172
- });
173
- },
174
- },
175
- // gov
176
- "/cosmos.gov.v1beta1.MsgDeposit": {
177
- aminoType: "cosmos-sdk/MsgDeposit",
178
- toAmino: function (_a) {
179
- var amount = _a.amount, depositor = _a.depositor, proposalId = _a.proposalId;
180
- return {
181
- amount: amount,
182
- depositor: depositor,
183
- proposal_id: proposalId.toString(),
184
- };
185
- },
186
- fromAmino: function (_a) {
187
- var amount = _a.amount, depositor = _a.depositor, proposal_id = _a.proposal_id;
188
- return {
189
- amount: Array.from(amount),
190
- depositor: depositor,
191
- proposalId: BigInt(proposal_id),
192
- };
193
- },
194
- },
195
- "/cosmos.gov.v1beta1.MsgVote": {
196
- aminoType: "cosmos-sdk/MsgVote",
197
- toAmino: function (_a) {
198
- var option = _a.option, proposalId = _a.proposalId, voter = _a.voter;
199
- return {
200
- option: option,
201
- proposal_id: proposalId.toString(),
202
- voter: voter,
203
- };
204
- },
205
- fromAmino: function (_a) {
206
- var option = _a.option, proposal_id = _a.proposal_id, voter = _a.voter;
207
- return {
208
- option: gov_1.voteOptionFromJSON(option),
209
- proposalId: BigInt(proposal_id),
210
- voter: voter,
211
- };
212
- },
213
- },
214
- "/cosmos.gov.v1beta1.MsgSubmitProposal": {
215
- aminoType: "cosmos-sdk/MsgSubmitProposal",
216
- toAmino: function (_a) {
217
- var initialDeposit = _a.initialDeposit, proposer = _a.proposer, content = _a.content;
218
- utils_1.assertDefinedAndNotNull(content);
219
- var proposal;
220
- switch (content.typeUrl) {
221
- case "/cosmos.gov.v1beta1.TextProposal": {
222
- var textProposal = gov_1.TextProposal.decode(content.value);
223
- proposal = {
224
- type: "cosmos-sdk/TextProposal",
225
- value: {
226
- description: textProposal.description,
227
- title: textProposal.title,
228
- },
229
- };
230
- break;
231
- }
232
- default:
233
- throw new Error("Unsupported proposal type: '" + content.typeUrl + "'");
234
- }
235
- return {
236
- initial_deposit: initialDeposit,
237
- proposer: proposer,
238
- content: proposal,
239
- };
240
- },
241
- fromAmino: function (_a) {
242
- var initial_deposit = _a.initial_deposit, proposer = _a.proposer, content = _a.content;
243
- var any_content;
244
- switch (content.type) {
245
- case "cosmos-sdk/TextProposal": {
246
- var value = content.value;
247
- utils_1.assert(utils_1.isNonNullObject(value));
248
- var _b = value, title = _b.title, description = _b.description;
249
- utils_1.assert(typeof title === "string");
250
- utils_1.assert(typeof description === "string");
251
- any_content = any_1.Any.fromPartial({
252
- typeUrl: "/cosmos.gov.v1beta1.TextProposal",
253
- value: gov_1.TextProposal.encode(gov_1.TextProposal.fromPartial({
254
- title: title,
255
- description: description,
256
- })).finish(),
257
- });
258
- break;
259
- }
260
- default:
261
- throw new Error("Unsupported proposal type: '" + content.type + "'");
262
- }
263
- return {
264
- initialDeposit: Array.from(initial_deposit),
265
- proposer: proposer,
266
- content: any_content,
267
- };
268
- },
269
- },
270
- // cancel proposal
271
- "/cosmos.gov.v1.MsgCancelProposal": {
272
- aminoType: "cosmos-sdk/MsgCancelProposal",
273
- toAmino: function (_a) {
274
- var proposalId = _a.proposalId, proposer = _a.proposer;
275
- return {
276
- proposalId: proposalId.toString(),
277
- proposer: proposer,
278
- };
279
- },
280
- fromAmino: function (_a) {
281
- var proposalId = _a.proposalId, proposer = _a.proposer;
282
- return {
283
- proposalId: BigInt(proposalId),
284
- proposer: proposer,
285
- };
286
- }
287
- },
288
- // staking
289
- "/cosmos.staking.v1beta1.MsgBeginRedelegate": {
290
- aminoType: "cosmos-sdk/MsgBeginRedelegate",
291
- toAmino: function (_a) {
292
- var delegatorAddress = _a.delegatorAddress, validatorSrcAddress = _a.validatorSrcAddress, validatorDstAddress = _a.validatorDstAddress, amount = _a.amount;
293
- utils_1.assertDefinedAndNotNull(amount, "missing amount");
294
- return {
295
- delegator_address: delegatorAddress,
296
- validator_src_address: validatorSrcAddress,
297
- validator_dst_address: validatorDstAddress,
298
- amount: amount,
299
- };
300
- },
301
- fromAmino: function (_a) {
302
- var delegator_address = _a.delegator_address, validator_src_address = _a.validator_src_address, validator_dst_address = _a.validator_dst_address, amount = _a.amount;
303
- return ({
304
- delegatorAddress: delegator_address,
305
- validatorSrcAddress: validator_src_address,
306
- validatorDstAddress: validator_dst_address,
307
- amount: amount,
308
- });
309
- },
310
- },
311
- "/cosmos.staking.v1beta1.MsgCreateValidator": {
312
- aminoType: "cosmos-sdk/MsgCreateValidator",
313
- toAmino: function (_a) {
314
- var description = _a.description, commission = _a.commission, minSelfDelegation = _a.minSelfDelegation, delegatorAddress = _a.delegatorAddress, validatorAddress = _a.validatorAddress, pubkey = _a.pubkey, value = _a.value;
315
- utils_1.assertDefinedAndNotNull(description, "missing description");
316
- utils_1.assertDefinedAndNotNull(commission, "missing commission");
317
- utils_1.assertDefinedAndNotNull(pubkey, "missing pubkey");
318
- utils_1.assertDefinedAndNotNull(value, "missing value");
319
- return {
320
- description: {
321
- moniker: description.moniker,
322
- identity: description.identity,
323
- website: description.website,
324
- security_contact: description.securityContact,
325
- details: description.details,
326
- },
327
- commission: {
328
- rate: commission.rate,
329
- max_rate: commission.maxRate,
330
- max_change_rate: commission.maxChangeRate,
331
- },
332
- min_self_delegation: minSelfDelegation,
333
- delegator_address: delegatorAddress,
334
- validator_address: validatorAddress,
335
- pubkey: encoding_2.encodeBech32Pubkey({
336
- type: "tendermint/PubKeySecp256k1",
337
- value: encoding_1.toBase64(pubkey.value),
338
- }, prefix),
339
- value: value,
340
- };
341
- },
342
- fromAmino: function (_a) {
343
- var description = _a.description, commission = _a.commission, min_self_delegation = _a.min_self_delegation, delegator_address = _a.delegator_address, validator_address = _a.validator_address, pubkey = _a.pubkey, value = _a.value;
344
- var decodedPubkey = encoding_2.decodeBech32Pubkey(pubkey);
345
- if (decodedPubkey.type !== "tendermint/PubKeySecp256k1") {
346
- throw new Error("Only Secp256k1 public keys are supported");
347
- }
348
- return {
349
- description: {
350
- moniker: description.moniker,
351
- identity: description.identity,
352
- website: description.website,
353
- securityContact: description.security_contact,
354
- details: description.details,
355
- },
356
- commission: {
357
- rate: commission.rate,
358
- maxRate: commission.max_rate,
359
- maxChangeRate: commission.max_change_rate,
360
- },
361
- minSelfDelegation: min_self_delegation,
362
- delegatorAddress: delegator_address,
363
- validatorAddress: validator_address,
364
- pubkey: {
365
- typeUrl: "/cosmos.crypto.secp256k1.PubKey",
366
- value: encoding_1.fromBase64(decodedPubkey.value),
367
- },
368
- value: value,
369
- };
370
- },
371
- },
372
- "/cosmos.staking.v1beta1.MsgDelegate": {
373
- aminoType: "cosmos-sdk/MsgDelegate",
374
- toAmino: function (_a) {
375
- var delegatorAddress = _a.delegatorAddress, validatorAddress = _a.validatorAddress, amount = _a.amount;
376
- utils_1.assertDefinedAndNotNull(amount, "missing amount");
377
- return {
378
- delegator_address: delegatorAddress,
379
- validator_address: validatorAddress,
380
- amount: amount,
381
- };
382
- },
383
- fromAmino: function (_a) {
384
- var delegator_address = _a.delegator_address, validator_address = _a.validator_address, amount = _a.amount;
385
- return ({
386
- delegatorAddress: delegator_address,
387
- validatorAddress: validator_address,
388
- amount: amount,
389
- });
390
- },
391
- },
392
- "/cosmos.staking.v1beta1.MsgEditValidator": {
393
- aminoType: "cosmos-sdk/MsgEditValidator",
394
- toAmino: function (_a) {
395
- var description = _a.description, commissionRate = _a.commissionRate, minSelfDelegation = _a.minSelfDelegation, validatorAddress = _a.validatorAddress;
396
- utils_1.assertDefinedAndNotNull(description, "missing description");
397
- return {
398
- description: {
399
- moniker: description.moniker,
400
- identity: description.identity,
401
- website: description.website,
402
- security_contact: description.securityContact,
403
- details: description.details,
404
- },
405
- commission_rate: commissionRate,
406
- min_self_delegation: minSelfDelegation,
407
- validator_address: validatorAddress,
408
- };
409
- },
410
- fromAmino: function (_a) {
411
- var description = _a.description, commission_rate = _a.commission_rate, min_self_delegation = _a.min_self_delegation, validator_address = _a.validator_address;
412
- return ({
413
- description: {
414
- moniker: description.moniker,
415
- identity: description.identity,
416
- website: description.website,
417
- securityContact: description.security_contact,
418
- details: description.details,
419
- },
420
- commissionRate: commission_rate,
421
- minSelfDelegation: min_self_delegation,
422
- validatorAddress: validator_address,
423
- });
424
- },
425
- },
426
- "/cosmos.staking.v1beta1.MsgUndelegate": {
427
- aminoType: "cosmos-sdk/MsgUndelegate",
428
- toAmino: function (_a) {
429
- var delegatorAddress = _a.delegatorAddress, validatorAddress = _a.validatorAddress, amount = _a.amount;
430
- utils_1.assertDefinedAndNotNull(amount, "missing amount");
431
- return {
432
- delegator_address: delegatorAddress,
433
- validator_address: validatorAddress,
434
- amount: amount,
435
- };
436
- },
437
- fromAmino: function (_a) {
438
- var delegator_address = _a.delegator_address, validator_address = _a.validator_address, amount = _a.amount;
439
- return ({
440
- delegatorAddress: delegator_address,
441
- validatorAddress: validator_address,
442
- amount: amount,
443
- });
444
- },
445
- },
446
- // ibc
447
- "/ibc.applications.transfer.v1.MsgTransfer": {
448
- aminoType: "cosmos-sdk/MsgTransfer",
449
- toAmino: function (_a) {
450
- var _b, _c, _d;
451
- var sourcePort = _a.sourcePort, sourceChannel = _a.sourceChannel, token = _a.token, sender = _a.sender, receiver = _a.receiver, timeoutHeight = _a.timeoutHeight, timeoutTimestamp = _a.timeoutTimestamp;
452
- return ({
453
- source_port: sourcePort,
454
- source_channel: sourceChannel,
455
- token: token,
456
- sender: sender,
457
- receiver: receiver,
458
- timeout_height: timeoutHeight
459
- ? {
460
- revision_height: (_b = omitDefault(timeoutHeight.revisionHeight)) === null || _b === void 0 ? void 0 : _b.toString(),
461
- revision_number: (_c = omitDefault(timeoutHeight.revisionNumber)) === null || _c === void 0 ? void 0 : _c.toString(),
462
- }
463
- : {},
464
- timeout_timestamp: (_d = omitDefault(timeoutTimestamp)) === null || _d === void 0 ? void 0 : _d.toString(),
465
- });
466
- },
467
- fromAmino: function (_a) {
468
- var source_port = _a.source_port, source_channel = _a.source_channel, token = _a.token, sender = _a.sender, receiver = _a.receiver, timeout_height = _a.timeout_height, timeout_timestamp = _a.timeout_timestamp, memo = _a.memo;
469
- return ({
470
- sourcePort: source_port,
471
- sourceChannel: source_channel,
472
- token: token,
473
- sender: sender,
474
- receiver: receiver,
475
- timeoutHeight: {
476
- revisionHeight: BigInt(timeout_height.revision_height || "0"),
477
- revisionNumber: BigInt(timeout_height.revision_number || "0"),
478
- },
479
- timeoutTimestamp: BigInt(timeout_timestamp || "0"),
480
- memo: memo
481
- });
482
- },
483
- },
484
- };
485
- }
486
- /**
487
- * A map from Stargate message types as used in the messages's `Any` type
488
- * to Amino types.
489
- */
490
- var AminoTypes = /** @class */ (function () {
491
- function AminoTypes(_a) {
492
- var _b = _a === void 0 ? {} : _a, _c = _b.additions, additions = _c === void 0 ? {} : _c, _d = _b.prefix, prefix = _d === void 0 ? "cosmos" : _d;
493
- var additionalAminoTypes = Object.values(additions);
494
- var filteredDefaultTypes = Object.entries(createDefaultTypes(prefix)).reduce(function (acc, _a) {
495
- var _b;
496
- var _c = __read(_a, 2), key = _c[0], value = _c[1];
497
- return additionalAminoTypes.find(function (_a) {
498
- var aminoType = _a.aminoType;
499
- return value.aminoType === aminoType;
500
- })
501
- ? acc
502
- : __assign(__assign({}, acc), (_b = {}, _b[key] = value, _b));
503
- }, {});
504
- this.register = __assign(__assign({}, filteredDefaultTypes), additions);
505
- }
506
- AminoTypes.prototype.toAmino = function (_a) {
507
- var typeUrl = _a.typeUrl, value = _a.value;
508
- var converter = this.register[typeUrl];
509
- if (!converter) {
510
- throw new Error("Type URL does not exist in the Amino message type register. " +
511
- "If you need support for this message type, you can pass in additional entries to the AminoTypes constructor. " +
512
- "If you think this message type should be included by default, please open an issue at https://github.com/cosmos/cosmjs/issues.");
513
- }
514
- return {
515
- type: converter.aminoType,
516
- value: converter.toAmino(value),
517
- };
518
- };
519
- AminoTypes.prototype.fromAmino = function (_a) {
520
- var type = _a.type, value = _a.value;
521
- var result = Object.entries(this.register).find(function (_a) {
522
- var _b = __read(_a, 2), _typeUrl = _b[0], aminoType = _b[1].aminoType;
523
- return aminoType === type;
524
- });
525
- if (!result) {
526
- throw new Error("Type does not exist in the Amino message type register. " +
527
- "If you need support for this message type, you can pass in additional entries to the AminoTypes constructor. " +
528
- "If you think this message type should be included by default, please open an issue at https://github.com/cosmos/cosmjs/issues.");
529
- }
530
- var _b = __read(result, 2), typeUrl = _b[0], converter = _b[1];
531
- return {
532
- typeUrl: typeUrl,
533
- value: converter.fromAmino(value),
534
- };
535
- };
536
- return AminoTypes;
537
- }());
538
- exports.AminoTypes = AminoTypes;
@@ -1,42 +0,0 @@
1
- export interface Coin {
2
- readonly denom: string;
3
- readonly amount: string;
4
- }
5
- /**
6
- * Creates a coin.
7
- *
8
- * If your values do not exceed the safe integer range of JS numbers (53 bit),
9
- * you can use the number type here. This is the case for all typical Cosmos SDK
10
- * chains that use the default 6 decimals.
11
- *
12
- * In case you need to supportr larger values, use unsigned integer strings instead.
13
- */
14
- export declare function coin(amount: number | string, denom: string): Coin;
15
- /**
16
- * Creates a list of coins with one element.
17
- */
18
- export declare function coins(amount: number | string, denom: string): Coin[];
19
- /**
20
- * Takes a coins list like "819966000ucosm,700000000ustake" and parses it.
21
- *
22
- * Starting with CosmJS 0.32.3, the following imports are all synonym and support
23
- * a variety of denom types such as IBC denoms or tokenfactory. If you need to
24
- * restrict the denom to something very minimal, this needs to be implemented
25
- * separately in the caller.
26
- *
27
- * ```
28
- * import { parseCoins } from "@cosmjs/proto-signing";
29
- * // equals
30
- * import { parseCoins } from "@cosmjs/stargate";
31
- * // equals
32
- * import { parseCoins } from "@cosmjs/amino";
33
- * ```
34
- *
35
- * This function is not made for supporting decimal amounts and does not support
36
- * parsing gas prices.
37
- */
38
- export declare function parseCoins(input: string): Coin[];
39
- /**
40
- * Function to sum up coins with type Coin
41
- */
42
- export declare function addCoins(lhs: Coin, rhs: Coin): Coin;
@@ -1,90 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.addCoins = exports.parseCoins = exports.coins = exports.coin = void 0;
4
- var math_1 = require("@cosmjs/math");
5
- /**
6
- * Creates a coin.
7
- *
8
- * If your values do not exceed the safe integer range of JS numbers (53 bit),
9
- * you can use the number type here. This is the case for all typical Cosmos SDK
10
- * chains that use the default 6 decimals.
11
- *
12
- * In case you need to supportr larger values, use unsigned integer strings instead.
13
- */
14
- function coin(amount, denom) {
15
- var outAmount;
16
- if (typeof amount === "number") {
17
- try {
18
- outAmount = new math_1.Uint53(amount).toString();
19
- }
20
- catch (_err) {
21
- throw new Error("Given amount is not a safe integer. Consider using a string instead to overcome the limitations of JS numbers.");
22
- }
23
- }
24
- else {
25
- if (!amount.match(/^[0-9]+$/)) {
26
- throw new Error("Invalid unsigned integer string format");
27
- }
28
- outAmount = amount.replace(/^0*/, "") || "0";
29
- }
30
- return {
31
- amount: outAmount,
32
- denom: denom,
33
- };
34
- }
35
- exports.coin = coin;
36
- /**
37
- * Creates a list of coins with one element.
38
- */
39
- function coins(amount, denom) {
40
- return [coin(amount, denom)];
41
- }
42
- exports.coins = coins;
43
- /**
44
- * Takes a coins list like "819966000ucosm,700000000ustake" and parses it.
45
- *
46
- * Starting with CosmJS 0.32.3, the following imports are all synonym and support
47
- * a variety of denom types such as IBC denoms or tokenfactory. If you need to
48
- * restrict the denom to something very minimal, this needs to be implemented
49
- * separately in the caller.
50
- *
51
- * ```
52
- * import { parseCoins } from "@cosmjs/proto-signing";
53
- * // equals
54
- * import { parseCoins } from "@cosmjs/stargate";
55
- * // equals
56
- * import { parseCoins } from "@cosmjs/amino";
57
- * ```
58
- *
59
- * This function is not made for supporting decimal amounts and does not support
60
- * parsing gas prices.
61
- */
62
- function parseCoins(input) {
63
- return input
64
- .replace(/\s/g, "")
65
- .split(",")
66
- .filter(Boolean)
67
- .map(function (part) {
68
- // Denom regex from Stargate (https://github.com/cosmos/cosmos-sdk/blob/v0.42.7/types/coin.go#L599-L601)
69
- var match = part.match(/^([0-9]+)([a-zA-Z][a-zA-Z0-9/]{2,127})$/);
70
- if (!match)
71
- throw new Error("Got an invalid coin string");
72
- return {
73
- amount: match[1].replace(/^0+/, "") || "0",
74
- denom: match[2],
75
- };
76
- });
77
- }
78
- exports.parseCoins = parseCoins;
79
- /**
80
- * Function to sum up coins with type Coin
81
- */
82
- function addCoins(lhs, rhs) {
83
- if (lhs.denom !== rhs.denom)
84
- throw new Error("Trying to add two coins with different denoms");
85
- return {
86
- amount: math_1.Decimal.fromAtomics(lhs.amount, 0).plus(math_1.Decimal.fromAtomics(rhs.amount, 0)).atomics,
87
- denom: lhs.denom,
88
- };
89
- }
90
- exports.addCoins = addCoins;