carbon-js-sdk 0.2.15 → 0.2.16-dev.1

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 (272) hide show
  1. package/lib/CarbonSDK.d.ts +13 -1
  2. package/lib/CarbonSDK.js +31 -2
  3. package/lib/clients/ETHClient.d.ts +1 -1
  4. package/lib/clients/NEOClient.d.ts +1 -1
  5. package/lib/clients/NEOClient.js +1 -1
  6. package/lib/clients/TokenClient.d.ts +5 -0
  7. package/lib/clients/TokenClient.js +38 -10
  8. package/lib/clients/ZILClient.d.ts +1 -1
  9. package/lib/codec/book/genesis.d.ts +1 -1
  10. package/lib/codec/book/genesis.js +1 -1
  11. package/lib/codec/book/query.d.ts +1 -1
  12. package/lib/codec/book/query.js +1 -1
  13. package/lib/codec/broker/genesis.d.ts +1 -1
  14. package/lib/codec/broker/genesis.js +1 -1
  15. package/lib/codec/broker/query.d.ts +3 -3
  16. package/lib/codec/broker/query.js +3 -3
  17. package/lib/codec/btcx/denom_cross_chain_info.d.ts +1 -1
  18. package/lib/codec/btcx/denom_cross_chain_info.js +1 -1
  19. package/lib/codec/btcx/query.d.ts +1 -1
  20. package/lib/codec/btcx/query.js +1 -1
  21. package/lib/codec/ccm/genesis.d.ts +1 -1
  22. package/lib/codec/ccm/genesis.js +1 -1
  23. package/lib/codec/cdp/asset_params.d.ts +1 -1
  24. package/lib/codec/cdp/asset_params.js +11 -10
  25. package/lib/codec/cdp/event.d.ts +389 -22
  26. package/lib/codec/cdp/event.js +2494 -83
  27. package/lib/codec/cdp/genesis.d.ts +97 -4
  28. package/lib/codec/cdp/genesis.js +648 -23
  29. package/lib/codec/cdp/params.d.ts +8 -0
  30. package/lib/codec/cdp/params.js +52 -9
  31. package/lib/codec/cdp/query.d.ts +439 -89
  32. package/lib/codec/cdp/query.js +1995 -177
  33. package/lib/codec/cdp/reward_scheme.d.ts +0 -13
  34. package/lib/codec/cdp/reward_scheme.js +1 -91
  35. package/lib/codec/cdp/tx.d.ts +760 -96
  36. package/lib/codec/cdp/tx.js +3645 -235
  37. package/lib/codec/coin/event.d.ts +1 -1
  38. package/lib/codec/coin/event.js +1 -1
  39. package/lib/codec/coin/genesis.d.ts +2 -2
  40. package/lib/codec/coin/genesis.js +2 -2
  41. package/lib/codec/coin/proposal.d.ts +1 -1
  42. package/lib/codec/coin/proposal.js +1 -1
  43. package/lib/codec/coin/query.d.ts +2 -2
  44. package/lib/codec/coin/query.js +2 -2
  45. package/lib/codec/coin/tx.d.ts +1 -1
  46. package/lib/codec/coin/tx.js +1 -1
  47. package/lib/codec/cosmos/auth/v1beta1/genesis.d.ts +1 -1
  48. package/lib/codec/cosmos/auth/v1beta1/genesis.js +1 -1
  49. package/lib/codec/cosmos/auth/v1beta1/query.d.ts +2 -2
  50. package/lib/codec/cosmos/auth/v1beta1/query.js +2 -2
  51. package/lib/codec/cosmos/authz/v1beta1/genesis.d.ts +1 -1
  52. package/lib/codec/cosmos/authz/v1beta1/genesis.js +1 -1
  53. package/lib/codec/cosmos/authz/v1beta1/query.d.ts +2 -2
  54. package/lib/codec/cosmos/authz/v1beta1/query.js +2 -2
  55. package/lib/codec/cosmos/authz/v1beta1/tx.d.ts +1 -1
  56. package/lib/codec/cosmos/authz/v1beta1/tx.js +1 -1
  57. package/lib/codec/cosmos/bank/v1beta1/authz.d.ts +1 -1
  58. package/lib/codec/cosmos/bank/v1beta1/authz.js +1 -1
  59. package/lib/codec/cosmos/bank/v1beta1/bank.d.ts +1 -1
  60. package/lib/codec/cosmos/bank/v1beta1/bank.js +1 -1
  61. package/lib/codec/cosmos/bank/v1beta1/genesis.d.ts +2 -2
  62. package/lib/codec/cosmos/bank/v1beta1/genesis.js +2 -2
  63. package/lib/codec/cosmos/bank/v1beta1/query.d.ts +3 -3
  64. package/lib/codec/cosmos/bank/v1beta1/query.js +3 -3
  65. package/lib/codec/cosmos/bank/v1beta1/tx.d.ts +2 -2
  66. package/lib/codec/cosmos/bank/v1beta1/tx.js +2 -2
  67. package/lib/codec/cosmos/base/tendermint/v1beta1/query.d.ts +1 -1
  68. package/lib/codec/cosmos/base/tendermint/v1beta1/query.js +1 -1
  69. package/lib/codec/cosmos/capability/v1beta1/genesis.d.ts +1 -1
  70. package/lib/codec/cosmos/capability/v1beta1/genesis.js +1 -1
  71. package/lib/codec/cosmos/crisis/v1beta1/genesis.d.ts +1 -1
  72. package/lib/codec/cosmos/crisis/v1beta1/genesis.js +1 -1
  73. package/lib/codec/cosmos/distribution/v1beta1/distribution.d.ts +1 -1
  74. package/lib/codec/cosmos/distribution/v1beta1/distribution.js +1 -1
  75. package/lib/codec/cosmos/distribution/v1beta1/genesis.d.ts +2 -2
  76. package/lib/codec/cosmos/distribution/v1beta1/genesis.js +2 -2
  77. package/lib/codec/cosmos/distribution/v1beta1/query.d.ts +3 -3
  78. package/lib/codec/cosmos/distribution/v1beta1/query.js +3 -3
  79. package/lib/codec/cosmos/distribution/v1beta1/tx.d.ts +1 -1
  80. package/lib/codec/cosmos/distribution/v1beta1/tx.js +1 -1
  81. package/lib/codec/cosmos/evidence/v1beta1/query.d.ts +1 -1
  82. package/lib/codec/cosmos/evidence/v1beta1/query.js +1 -1
  83. package/lib/codec/cosmos/feegrant/v1beta1/feegrant.d.ts +1 -1
  84. package/lib/codec/cosmos/feegrant/v1beta1/feegrant.js +1 -1
  85. package/lib/codec/cosmos/feegrant/v1beta1/genesis.d.ts +1 -1
  86. package/lib/codec/cosmos/feegrant/v1beta1/genesis.js +1 -1
  87. package/lib/codec/cosmos/feegrant/v1beta1/query.d.ts +2 -2
  88. package/lib/codec/cosmos/feegrant/v1beta1/query.js +2 -2
  89. package/lib/codec/cosmos/gov/v1beta1/genesis.d.ts +1 -1
  90. package/lib/codec/cosmos/gov/v1beta1/genesis.js +1 -1
  91. package/lib/codec/cosmos/gov/v1beta1/gov.d.ts +1 -1
  92. package/lib/codec/cosmos/gov/v1beta1/gov.js +1 -1
  93. package/lib/codec/cosmos/gov/v1beta1/query.d.ts +2 -2
  94. package/lib/codec/cosmos/gov/v1beta1/query.js +2 -2
  95. package/lib/codec/cosmos/gov/v1beta1/tx.d.ts +2 -2
  96. package/lib/codec/cosmos/gov/v1beta1/tx.js +2 -2
  97. package/lib/codec/cosmos/mint/v1beta1/genesis.d.ts +1 -1
  98. package/lib/codec/cosmos/mint/v1beta1/genesis.js +1 -1
  99. package/lib/codec/cosmos/mint/v1beta1/query.d.ts +1 -1
  100. package/lib/codec/cosmos/mint/v1beta1/query.js +1 -1
  101. package/lib/codec/cosmos/params/v1beta1/query.d.ts +1 -1
  102. package/lib/codec/cosmos/params/v1beta1/query.js +1 -1
  103. package/lib/codec/cosmos/slashing/v1beta1/genesis.d.ts +1 -1
  104. package/lib/codec/cosmos/slashing/v1beta1/genesis.js +1 -1
  105. package/lib/codec/cosmos/slashing/v1beta1/query.d.ts +2 -2
  106. package/lib/codec/cosmos/slashing/v1beta1/query.js +2 -2
  107. package/lib/codec/cosmos/staking/v1beta1/authz.d.ts +1 -1
  108. package/lib/codec/cosmos/staking/v1beta1/authz.js +1 -1
  109. package/lib/codec/cosmos/staking/v1beta1/genesis.d.ts +1 -1
  110. package/lib/codec/cosmos/staking/v1beta1/genesis.js +1 -1
  111. package/lib/codec/cosmos/staking/v1beta1/query.d.ts +2 -2
  112. package/lib/codec/cosmos/staking/v1beta1/query.js +2 -2
  113. package/lib/codec/cosmos/staking/v1beta1/staking.d.ts +1 -1
  114. package/lib/codec/cosmos/staking/v1beta1/staking.js +1 -1
  115. package/lib/codec/cosmos/staking/v1beta1/tx.d.ts +2 -2
  116. package/lib/codec/cosmos/staking/v1beta1/tx.js +2 -2
  117. package/lib/codec/cosmos/tx/signing/v1beta1/signing.d.ts +1 -1
  118. package/lib/codec/cosmos/tx/signing/v1beta1/signing.js +1 -1
  119. package/lib/codec/cosmos/tx/v1beta1/service.d.ts +3 -3
  120. package/lib/codec/cosmos/tx/v1beta1/service.js +3 -3
  121. package/lib/codec/cosmos/tx/v1beta1/tx.d.ts +3 -3
  122. package/lib/codec/cosmos/tx/v1beta1/tx.js +3 -3
  123. package/lib/codec/cosmos/upgrade/v1beta1/query.d.ts +1 -1
  124. package/lib/codec/cosmos/upgrade/v1beta1/query.js +1 -1
  125. package/lib/codec/cosmos/vesting/v1beta1/tx.d.ts +1 -1
  126. package/lib/codec/cosmos/vesting/v1beta1/tx.js +1 -1
  127. package/lib/codec/cosmos/vesting/v1beta1/vesting.d.ts +2 -2
  128. package/lib/codec/cosmos/vesting/v1beta1/vesting.js +2 -2
  129. package/lib/codec/fee/genesis.d.ts +1 -1
  130. package/lib/codec/fee/genesis.js +1 -1
  131. package/lib/codec/fee/proposal.d.ts +1 -1
  132. package/lib/codec/fee/proposal.js +1 -1
  133. package/lib/codec/fee/query.d.ts +1 -1
  134. package/lib/codec/fee/query.js +1 -1
  135. package/lib/codec/fee/tx.d.ts +1 -1
  136. package/lib/codec/fee/tx.js +1 -1
  137. package/lib/codec/headersync/genesis.d.ts +1 -1
  138. package/lib/codec/headersync/genesis.js +1 -1
  139. package/lib/codec/headersync/query.d.ts +1 -1
  140. package/lib/codec/headersync/query.js +1 -1
  141. package/lib/codec/index.d.ts +89 -18
  142. package/lib/codec/index.js +463 -180
  143. package/lib/codec/inflation/genesis.d.ts +1 -1
  144. package/lib/codec/inflation/genesis.js +1 -1
  145. package/lib/codec/inflation/query.d.ts +1 -1
  146. package/lib/codec/inflation/query.js +1 -1
  147. package/lib/codec/insurance/genesis.d.ts +1 -1
  148. package/lib/codec/insurance/genesis.js +1 -1
  149. package/lib/codec/leverage/genesis.d.ts +1 -1
  150. package/lib/codec/leverage/genesis.js +1 -1
  151. package/lib/codec/leverage/query.d.ts +1 -1
  152. package/lib/codec/leverage/query.js +1 -1
  153. package/lib/codec/liquidation/genesis.d.ts +1 -1
  154. package/lib/codec/liquidation/genesis.js +1 -1
  155. package/lib/codec/liquidation/query.d.ts +1 -1
  156. package/lib/codec/liquidation/query.js +1 -1
  157. package/lib/codec/liquidation/quote_changes.d.ts +1 -1
  158. package/lib/codec/liquidation/quote_changes.js +1 -1
  159. package/lib/codec/liquiditypool/event.d.ts +2 -2
  160. package/lib/codec/liquiditypool/event.js +2 -2
  161. package/lib/codec/liquiditypool/genesis.d.ts +2 -2
  162. package/lib/codec/liquiditypool/genesis.js +2 -2
  163. package/lib/codec/liquiditypool/liquiditypool.d.ts +3 -0
  164. package/lib/codec/liquiditypool/liquiditypool.js +44 -1
  165. package/lib/codec/liquiditypool/proposal.d.ts +1 -1
  166. package/lib/codec/liquiditypool/proposal.js +1 -1
  167. package/lib/codec/liquiditypool/query.d.ts +39 -2
  168. package/lib/codec/liquiditypool/query.js +195 -3
  169. package/lib/codec/liquiditypool/tx.d.ts +3 -1
  170. package/lib/codec/liquiditypool/tx.js +35 -1
  171. package/lib/codec/lockproxy/genesis.d.ts +1 -1
  172. package/lib/codec/lockproxy/genesis.js +1 -1
  173. package/lib/codec/lockproxy/query.d.ts +1 -1
  174. package/lib/codec/lockproxy/query.js +1 -1
  175. package/lib/codec/market/event.d.ts +1 -1
  176. package/lib/codec/market/event.js +1 -1
  177. package/lib/codec/market/genesis.d.ts +1 -1
  178. package/lib/codec/market/genesis.js +1 -1
  179. package/lib/codec/market/proposal.d.ts +1 -1
  180. package/lib/codec/market/proposal.js +1 -1
  181. package/lib/codec/market/query.d.ts +1 -1
  182. package/lib/codec/market/query.js +1 -1
  183. package/lib/codec/market/tx.d.ts +1 -1
  184. package/lib/codec/market/tx.js +1 -1
  185. package/lib/codec/marketstats/genesis.d.ts +1 -1
  186. package/lib/codec/marketstats/genesis.js +1 -1
  187. package/lib/codec/marketstats/query.d.ts +2 -2
  188. package/lib/codec/marketstats/query.js +2 -2
  189. package/lib/codec/misc/message.d.ts +1 -1
  190. package/lib/codec/misc/message.js +1 -1
  191. package/lib/codec/misc/query.d.ts +3 -3
  192. package/lib/codec/misc/query.js +3 -3
  193. package/lib/codec/misc/transaction.d.ts +1 -1
  194. package/lib/codec/misc/transaction.js +1 -1
  195. package/lib/codec/oracle/event.d.ts +1 -1
  196. package/lib/codec/oracle/event.js +1 -1
  197. package/lib/codec/oracle/genesis.d.ts +4 -1
  198. package/lib/codec/oracle/genesis.js +34 -3
  199. package/lib/codec/oracle/proposal.d.ts +1 -1
  200. package/lib/codec/oracle/proposal.js +1 -1
  201. package/lib/codec/oracle/query.d.ts +2 -2
  202. package/lib/codec/oracle/query.js +2 -2
  203. package/lib/codec/order/event.d.ts +1 -1
  204. package/lib/codec/order/event.js +1 -1
  205. package/lib/codec/order/genesis.d.ts +1 -1
  206. package/lib/codec/order/genesis.js +1 -1
  207. package/lib/codec/order/query.d.ts +1 -1
  208. package/lib/codec/order/query.js +1 -1
  209. package/lib/codec/position/event.d.ts +1 -1
  210. package/lib/codec/position/event.js +1 -1
  211. package/lib/codec/position/genesis.d.ts +1 -1
  212. package/lib/codec/position/genesis.js +1 -1
  213. package/lib/codec/position/query.d.ts +1 -1
  214. package/lib/codec/position/query.js +1 -1
  215. package/lib/codec/pricing/event.d.ts +56 -1
  216. package/lib/codec/pricing/event.js +298 -2
  217. package/lib/codec/pricing/genesis.d.ts +2 -1
  218. package/lib/codec/pricing/genesis.js +20 -5
  219. package/lib/codec/pricing/legacy.d.ts +22 -0
  220. package/lib/codec/pricing/legacy.js +93 -0
  221. package/lib/codec/pricing/pricing.d.ts +14 -0
  222. package/lib/codec/pricing/pricing.js +103 -1
  223. package/lib/codec/pricing/query.d.ts +68 -1
  224. package/lib/codec/pricing/query.js +321 -2
  225. package/lib/codec/pricing/tx.d.ts +96 -0
  226. package/lib/codec/pricing/tx.js +399 -1
  227. package/lib/codec/profile/event.d.ts +1 -1
  228. package/lib/codec/profile/event.js +1 -1
  229. package/lib/codec/profile/genesis.d.ts +1 -1
  230. package/lib/codec/profile/genesis.js +1 -1
  231. package/lib/codec/profile/query.d.ts +1 -1
  232. package/lib/codec/profile/query.js +1 -1
  233. package/lib/codec/subaccount/genesis.d.ts +1 -1
  234. package/lib/codec/subaccount/genesis.js +1 -1
  235. package/lib/codec/subaccount/query.d.ts +1 -1
  236. package/lib/codec/subaccount/query.js +1 -1
  237. package/lib/codec/tendermint/abci/types.d.ts +4 -4
  238. package/lib/codec/tendermint/abci/types.js +4 -4
  239. package/lib/codec/tendermint/types/block.d.ts +2 -2
  240. package/lib/codec/tendermint/types/block.js +2 -2
  241. package/lib/codec/tendermint/types/evidence.d.ts +2 -2
  242. package/lib/codec/tendermint/types/evidence.js +2 -2
  243. package/lib/codec/tendermint/types/types.d.ts +3 -3
  244. package/lib/codec/tendermint/types/types.js +3 -3
  245. package/lib/codec/tendermint/types/validator.d.ts +1 -1
  246. package/lib/codec/tendermint/types/validator.js +1 -1
  247. package/lib/constant/network.js +1 -1
  248. package/lib/constant/token.d.ts +4 -0
  249. package/lib/constant/token.js +5 -1
  250. package/lib/modules/admin.d.ts +114 -7
  251. package/lib/modules/admin.js +275 -53
  252. package/lib/modules/cdp.d.ts +152 -13
  253. package/lib/modules/cdp.js +796 -20
  254. package/lib/modules/liquiditypool.d.ts +2 -0
  255. package/lib/modules/liquiditypool.js +2 -0
  256. package/lib/provider/amino/types/admin.js +72 -7
  257. package/lib/provider/amino/types/cdp.js +102 -32
  258. package/lib/provider/amino/types/liquidityPool.js +2 -0
  259. package/lib/provider/keplr/KeplrAccount.js +5 -0
  260. package/lib/util/address.d.ts +1 -0
  261. package/lib/util/address.js +8 -0
  262. package/lib/util/number.d.ts +1 -0
  263. package/lib/util/number.js +2 -1
  264. package/lib/util/tx.d.ts +75 -10
  265. package/lib/wallet/CarbonSigner.d.ts +5 -2
  266. package/lib/wallet/CarbonSigner.js +13 -0
  267. package/lib/wallet/CarbonWallet.js +0 -1
  268. package/lib/websocket/channel.js +115 -21
  269. package/lib/websocket/models.d.ts +155 -0
  270. package/lib/websocket/types.d.ts +87 -3
  271. package/lib/websocket/types.js +31 -0
  272. package/package.json +1 -1
@@ -25,6 +25,7 @@ export declare namespace LiquidityPoolModule {
25
25
  tokenAWeight: BigNumber;
26
26
  tokenBWeight: BigNumber;
27
27
  swapFee: BigNumber;
28
+ ampBps: BigNumber;
28
29
  numQuotes: number;
29
30
  }
30
31
  interface CreatePoolWithLiquidityParams {
@@ -35,6 +36,7 @@ export declare namespace LiquidityPoolModule {
35
36
  amountA: BigNumber;
36
37
  amountB: BigNumber;
37
38
  swapFee: BigNumber;
39
+ ampBps: BigNumber;
38
40
  numQuotes: number;
39
41
  }
40
42
  interface AddLiquidityParams {
@@ -30,6 +30,7 @@ class LiquidityPoolModule extends base_1.default {
30
30
  tokenAWeight: params.tokenAWeight.shiftedBy(18).toString(10),
31
31
  tokenBWeight: params.tokenBWeight.shiftedBy(18).toString(10),
32
32
  swapFee: params.swapFee.shiftedBy(18).toString(10),
33
+ ampBps: new long_1.default(params.ampBps.shiftedBy(4).toNumber()),
33
34
  numQuotes: new long_1.default(params.numQuotes),
34
35
  });
35
36
  return yield wallet.sendTx({
@@ -50,6 +51,7 @@ class LiquidityPoolModule extends base_1.default {
50
51
  amountA: params.amountA.toString(10),
51
52
  amountB: params.amountB.toString(10),
52
53
  swapFee: params.swapFee.shiftedBy(18).toString(10),
54
+ ampBps: new long_1.default(params.ampBps.shiftedBy(4).toNumber()),
53
55
  numQuotes: new long_1.default(params.numQuotes),
54
56
  });
55
57
  return yield wallet.sendTx({
@@ -43,6 +43,17 @@ const TxTypes = {
43
43
  RemoveMinGasPrice: "fee/RemoveMinGasPrice",
44
44
  CreateValidator: "cosmos-sdk/MsgCreateValidator",
45
45
  EditValidator: "cosmos-sdk/MsgEditValidator",
46
+ AddRateStrategy: "cdp/AddRateStrategy",
47
+ UpdateRateStrategy: "cdp/UpdateRateStrategy",
48
+ RemoveRateStrategy: "cdp/RemoveRateStrategy",
49
+ AddAsset: "cdp/AddAsset",
50
+ UpdateAsset: "cdp/UpdateAsset",
51
+ SetLiquidationFee: "cdp/SetLiquidationFee",
52
+ SetInterestFee: "cdp/SetInterestFee",
53
+ SetStablecoinInterestRate: "cdp/SetStablecoinInterestRate",
54
+ SetCompleteLiquidationThreshold: "cdp/SetCompleteLiquidationThreshold",
55
+ SetMinimumCloseFactor: "cdp/SetMinimumCloseFactor",
56
+ SetSmallLiquidationSize: "cdp/SetSmallLiquidationSize",
46
57
  };
47
58
  const MsgCreateOracle = {
48
59
  aminoType: TxTypes.CreateOracle,
@@ -84,12 +95,6 @@ const MsgCreateMarket = {
84
95
  currentQuotePriceUsd: utils_1.ConvertEncType.Dec,
85
96
  },
86
97
  };
87
- const MsgCreateVaultType = {
88
- aminoType: TxTypes.CreateVaultType,
89
- valueMap: {
90
- collateralizationRatio: utils_1.ConvertEncType.Dec,
91
- },
92
- };
93
98
  const MsgLinkPool = {
94
99
  aminoType: TxTypes.LinkPool,
95
100
  valueMap: {
@@ -177,6 +182,56 @@ const MsgEditValidator = {
177
182
  commissionRate: utils_1.ConvertEncType.Dec,
178
183
  },
179
184
  };
185
+ const MsgAddRateStrategy = {
186
+ aminoType: TxTypes.AddRateStrategy,
187
+ valueMap: {},
188
+ };
189
+ const MsgUpdateRateStrategy = {
190
+ aminoType: TxTypes.UpdateRateStrategy,
191
+ valueMap: {},
192
+ };
193
+ const MsgRemoveRateStrategy = {
194
+ aminoType: TxTypes.RemoveRateStrategy,
195
+ valueMap: {},
196
+ };
197
+ const MsgAddAsset = {
198
+ aminoType: TxTypes.AddAsset,
199
+ valueMap: {},
200
+ };
201
+ const MsgUpdateAsset = {
202
+ aminoType: TxTypes.UpdateAsset,
203
+ valueMap: {},
204
+ };
205
+ const MsgSetLiquidationFee = {
206
+ aminoType: TxTypes.SetLiquidationFee,
207
+ valueMap: {},
208
+ };
209
+ const MsgSetInterestFee = {
210
+ aminoType: TxTypes.SetInterestFee,
211
+ valueMap: {},
212
+ };
213
+ const MsgSetStablecoinInterestRate = {
214
+ aminoType: TxTypes.SetStablecoinInterestRate,
215
+ valueMap: {},
216
+ };
217
+ const MsgSetCompleteLiquidationThreshold = {
218
+ aminoType: TxTypes.SetCompleteLiquidationThreshold,
219
+ valueMap: {
220
+ completeLiquidationThreshold: utils_1.ConvertEncType.Dec,
221
+ },
222
+ };
223
+ const MsgSetMinimumCloseFactor = {
224
+ aminoType: TxTypes.SetMinimumCloseFactor,
225
+ valueMap: {
226
+ minimumCloseFactor: utils_1.ConvertEncType.Dec,
227
+ },
228
+ };
229
+ const MsgSetSmallLiquidationSize = {
230
+ aminoType: TxTypes.SetSmallLiquidationSize,
231
+ valueMap: {
232
+ smallLiquidationSize: utils_1.ConvertEncType.Dec,
233
+ },
234
+ };
180
235
  const AdminAmino = {
181
236
  [CarbonTx.Types.MsgCreateOracle]: (0, utils_1.generateAminoType)(MsgCreateOracle),
182
237
  [CarbonTx.Types.MsgBindToken]: (0, utils_1.generateAminoType)(MsgBindToken),
@@ -184,7 +239,6 @@ const AdminAmino = {
184
239
  [CarbonTx.Types.MsgLinkToken]: (0, utils_1.generateAminoType)(MsgLinkToken),
185
240
  [CarbonTx.Types.MsgSyncToken]: (0, utils_1.generateAminoType)(MsgSyncToken),
186
241
  [CarbonTx.Types.MsgCreateMarket]: (0, utils_1.generateAminoType)(MsgCreateMarket),
187
- [CarbonTx.Types.MsgCreateVaultType]: (0, utils_1.generateAminoType)(MsgCreateVaultType),
188
242
  [CarbonTx.Types.MsgLinkPool]: (0, utils_1.generateAminoType)(MsgLinkPool),
189
243
  [CarbonTx.Types.MsgUnlinkPool]: (0, utils_1.generateAminoType)(MsgUnlinkPool),
190
244
  [CarbonTx.Types.MsgUpdatePool]: (0, utils_1.generateAminoType)(MsgUpdatePool),
@@ -198,5 +252,16 @@ const AdminAmino = {
198
252
  [CarbonTx.Types.MsgRemoveMinGasPrice]: (0, utils_1.generateAminoType)(MsgRemoveMinGasPrice),
199
253
  [CarbonTx.Types.MsgCreateValidator]: (0, utils_1.generateAminoType)(MsgCreateValidator),
200
254
  [CarbonTx.Types.MsgEditValidator]: (0, utils_1.generateAminoType)(MsgEditValidator),
255
+ [CarbonTx.Types.MsgAddRateStrategy]: (0, utils_1.generateAminoType)(MsgAddRateStrategy),
256
+ [CarbonTx.Types.MsgUpdateRateStrategy]: (0, utils_1.generateAminoType)(MsgUpdateRateStrategy),
257
+ [CarbonTx.Types.MsgRemoveRateStrategy]: (0, utils_1.generateAminoType)(MsgRemoveRateStrategy),
258
+ [CarbonTx.Types.MsgAddAsset]: (0, utils_1.generateAminoType)(MsgAddAsset),
259
+ [CarbonTx.Types.MsgUpdateAsset]: (0, utils_1.generateAminoType)(MsgUpdateAsset),
260
+ [CarbonTx.Types.MsgSetLiquidationFee]: (0, utils_1.generateAminoType)(MsgSetLiquidationFee),
261
+ [CarbonTx.Types.MsgSetInterestFee]: (0, utils_1.generateAminoType)(MsgSetInterestFee),
262
+ [CarbonTx.Types.MsgSetStablecoinInterestRate]: (0, utils_1.generateAminoType)(MsgSetStablecoinInterestRate),
263
+ [CarbonTx.Types.MsgSetCompleteLiquidationThreshold]: (0, utils_1.generateAminoType)(MsgSetCompleteLiquidationThreshold),
264
+ [CarbonTx.Types.MsgSetMinimumCloseFactor]: (0, utils_1.generateAminoType)(MsgSetMinimumCloseFactor),
265
+ [CarbonTx.Types.MsgSetSmallLiquidationSize]: (0, utils_1.generateAminoType)(MsgSetSmallLiquidationSize),
201
266
  };
202
267
  exports.default = AdminAmino;
@@ -22,39 +22,109 @@ Object.defineProperty(exports, "__esModule", { value: true });
22
22
  const CarbonTx = __importStar(require("../../../util/tx"));
23
23
  const utils_1 = require("../utils");
24
24
  const TxTypes = {
25
- AddCollateral: "cdp/AddCollateral",
26
- RemoveCollateral: "cdp/removeCollateral",
27
- AddDebt: "cdp/AddDebt",
28
- RemoveDebt: "cdp/RemoveDebt",
29
- };
30
- const MsgAddCollateral = {
31
- aminoType: TxTypes.AddCollateral,
32
- valueMap: {
33
- vaultTypeId: utils_1.ConvertEncType.Long,
34
- },
35
- };
36
- const MsgRemoveCollateral = {
37
- aminoType: TxTypes.RemoveCollateral,
38
- valueMap: {
39
- vaultTypeId: utils_1.ConvertEncType.Long,
40
- },
41
- };
42
- const MsgAddDebt = {
43
- aminoType: TxTypes.AddDebt,
44
- valueMap: {
45
- vaultTypeId: utils_1.ConvertEncType.Long,
46
- },
47
- };
48
- const MsgRemoveDebt = {
49
- aminoType: TxTypes.RemoveDebt,
50
- valueMap: {
51
- vaultTypeId: utils_1.ConvertEncType.Long,
52
- },
25
+ SupplyAsset: "cdp/SupplyAsset",
26
+ WithdrawAsset: "cdp/WithdrawAsset",
27
+ LockCollateral: "cdp/LockCollateral",
28
+ UnlockCollateral: "cdp/UnlockCollateral",
29
+ BorrowAsset: "cdp/BorrowAsset",
30
+ RepayAsset: "cdp/RepayAsset",
31
+ SupplyAssetAndLockCollateral: "cdp/SupplyAssetAndLockCollateral",
32
+ UnlockCollateralAndWithdrawAsset: "cdp/UnlockCollateralAndWithdrawAsset",
33
+ LiquidateCollateral: "cdp/LiquidateCollateral",
34
+ RepayAssetWithCdpTokens: "cdp/RepayAssetWithCdpTokens",
35
+ RepayAssetWithCollateral: "cdp/RepayAssetWithCollateral",
36
+ MintStablecoin: "cdp/MintStablecoin",
37
+ ReturnStablecoin: "cdp/ReturnStablecoin",
38
+ LiquidateCollateralWithCdpTokens: "cdp/LiquidateCollateralWithCdpTokens",
39
+ LiquidateCollateralWithCollateral: "cdp/LiquidateCollateralWithCollateral",
40
+ LiquidateCollateralWithStablecoin: "cdp/LiquidateCollateralWithStablecoin",
41
+ ClaimRewards: "cdp/ClaimRewards",
42
+ };
43
+ const MsgSupplyAsset = {
44
+ aminoType: TxTypes.SupplyAsset,
45
+ valueMap: {},
46
+ };
47
+ const MsgWithdrawAsset = {
48
+ aminoType: TxTypes.WithdrawAsset,
49
+ valueMap: {},
50
+ };
51
+ const MsgLockCollateral = {
52
+ aminoType: TxTypes.LockCollateral,
53
+ valueMap: {},
54
+ };
55
+ const MsgUnlockCollateral = {
56
+ aminoType: TxTypes.UnlockCollateral,
57
+ valueMap: {},
58
+ };
59
+ const MsgBorrowAsset = {
60
+ aminoType: TxTypes.BorrowAsset,
61
+ valueMap: {},
62
+ };
63
+ const MsgRepayAsset = {
64
+ aminoType: TxTypes.RepayAsset,
65
+ valueMap: {},
66
+ };
67
+ const MsgSupplyAssetAndLockCollateral = {
68
+ aminoType: TxTypes.SupplyAssetAndLockCollateral,
69
+ valueMap: {},
70
+ };
71
+ const MsgUnlockCollateralAndWithdrawAsset = {
72
+ aminoType: TxTypes.UnlockCollateralAndWithdrawAsset,
73
+ valueMap: {},
74
+ };
75
+ const MsgLiquidateCollateral = {
76
+ aminoType: TxTypes.LiquidateCollateral,
77
+ valueMap: {},
78
+ };
79
+ const MsgRepayAssetWithCdpTokens = {
80
+ aminoType: TxTypes.RepayAssetWithCdpTokens,
81
+ valueMap: {},
82
+ };
83
+ const MsgRepayAssetWithCollateral = {
84
+ aminoType: TxTypes.RepayAssetWithCollateral,
85
+ valueMap: {},
86
+ };
87
+ const MsgMintStablecoin = {
88
+ aminoType: TxTypes.MintStablecoin,
89
+ valueMap: {},
90
+ };
91
+ const MsgReturnStablecoin = {
92
+ aminoType: TxTypes.ReturnStablecoin,
93
+ valueMap: {},
94
+ };
95
+ const MsgLiquidateCollateralWithCdpTokens = {
96
+ aminoType: TxTypes.LiquidateCollateralWithCdpTokens,
97
+ valueMap: {},
98
+ };
99
+ const MsgLiquidateCollateralWithCollateral = {
100
+ aminoType: TxTypes.LiquidateCollateralWithCollateral,
101
+ valueMap: {},
102
+ };
103
+ const MsgLiquidateCollateralWithStablecoin = {
104
+ aminoType: TxTypes.LiquidateCollateralWithStablecoin,
105
+ valueMap: {},
106
+ };
107
+ const MsgClaimRewards = {
108
+ aminoType: TxTypes.ClaimRewards,
109
+ valueMap: {},
53
110
  };
54
111
  const CdpAmino = {
55
- [CarbonTx.Types.MsgAddCollateral]: (0, utils_1.generateAminoType)(MsgAddCollateral),
56
- [CarbonTx.Types.MsgRemoveCollateral]: (0, utils_1.generateAminoType)(MsgRemoveCollateral),
57
- [CarbonTx.Types.MsgAddDebt]: (0, utils_1.generateAminoType)(MsgAddDebt),
58
- [CarbonTx.Types.MsgRemoveDebt]: (0, utils_1.generateAminoType)(MsgRemoveDebt),
112
+ [CarbonTx.Types.MsgSupplyAsset]: (0, utils_1.generateAminoType)(MsgSupplyAsset),
113
+ [CarbonTx.Types.MsgWithdrawAsset]: (0, utils_1.generateAminoType)(MsgWithdrawAsset),
114
+ [CarbonTx.Types.MsgLockCollateral]: (0, utils_1.generateAminoType)(MsgLockCollateral),
115
+ [CarbonTx.Types.MsgUnlockCollateral]: (0, utils_1.generateAminoType)(MsgUnlockCollateral),
116
+ [CarbonTx.Types.MsgBorrowAsset]: (0, utils_1.generateAminoType)(MsgBorrowAsset),
117
+ [CarbonTx.Types.MsgRepayAsset]: (0, utils_1.generateAminoType)(MsgRepayAsset),
118
+ [CarbonTx.Types.MsgSupplyAssetAndLockCollateral]: (0, utils_1.generateAminoType)(MsgSupplyAssetAndLockCollateral),
119
+ [CarbonTx.Types.MsgUnlockCollateralAndWithdrawAsset]: (0, utils_1.generateAminoType)(MsgUnlockCollateralAndWithdrawAsset),
120
+ [CarbonTx.Types.MsgLiquidateCollateral]: (0, utils_1.generateAminoType)(MsgLiquidateCollateral),
121
+ [CarbonTx.Types.MsgRepayAssetWithCdpTokens]: (0, utils_1.generateAminoType)(MsgRepayAssetWithCdpTokens),
122
+ [CarbonTx.Types.MsgRepayAssetWithCollateral]: (0, utils_1.generateAminoType)(MsgRepayAssetWithCollateral),
123
+ [CarbonTx.Types.MsgMintStablecoin]: (0, utils_1.generateAminoType)(MsgMintStablecoin),
124
+ [CarbonTx.Types.MsgReturnStablecoin]: (0, utils_1.generateAminoType)(MsgReturnStablecoin),
125
+ [CarbonTx.Types.MsgLiquidateCollateralWithCdpTokens]: (0, utils_1.generateAminoType)(MsgLiquidateCollateralWithCdpTokens),
126
+ [CarbonTx.Types.MsgLiquidateCollateralWithCollateral]: (0, utils_1.generateAminoType)(MsgLiquidateCollateralWithCollateral),
127
+ [CarbonTx.Types.MsgLiquidateCollateralWithStablecoin]: (0, utils_1.generateAminoType)(MsgLiquidateCollateralWithStablecoin),
128
+ [CarbonTx.Types.MsgClaimRewards]: (0, utils_1.generateAminoType)(MsgClaimRewards),
59
129
  };
60
130
  exports.default = CdpAmino;
@@ -37,6 +37,7 @@ const MsgCreatePool = {
37
37
  swapFee: utils_1.ConvertEncType.Dec,
38
38
  tokenAWeight: utils_1.ConvertEncType.Dec,
39
39
  tokenBWeight: utils_1.ConvertEncType.Dec,
40
+ ampBps: utils_1.ConvertEncType.Long,
40
41
  },
41
42
  };
42
43
  const MsgCreatePoolWithLiquidity = {
@@ -46,6 +47,7 @@ const MsgCreatePoolWithLiquidity = {
46
47
  tokenBWeight: utils_1.ConvertEncType.Dec,
47
48
  swapFee: utils_1.ConvertEncType.Dec,
48
49
  numQuotes: utils_1.ConvertEncType.Long,
50
+ ampBps: utils_1.ConvertEncType.Long,
49
51
  },
50
52
  };
51
53
  const MsgAddLiquidity = {
@@ -24,6 +24,10 @@ class KeplrAccount {
24
24
  const signOpts = { preferNoSetFee: true };
25
25
  return yield keplr.signDirect(chainInfo.chainId, signerAddress, doc, signOpts);
26
26
  });
27
+ const signAmino = (signerAddress, doc) => __awaiter(this, void 0, void 0, function* () {
28
+ const signOpts = { preferNoSetFee: true };
29
+ return yield keplr.signAmino(chainInfo.chainId, signerAddress, doc, signOpts);
30
+ });
27
31
  const getAccounts = () => __awaiter(this, void 0, void 0, function* () {
28
32
  return [{
29
33
  algo: 'secp256k1',
@@ -34,6 +38,7 @@ class KeplrAccount {
34
38
  return {
35
39
  type: wallet_1.CarbonSignerTypes.BrowserInjected,
36
40
  signDirect,
41
+ signAmino,
37
42
  getAccounts,
38
43
  };
39
44
  }
@@ -62,6 +62,7 @@ declare type SWTHAddressType = AddressBuilder<SWTHAddressOptions> & {
62
62
  getAddressBytes(bech32Address: string, networkConfig: Network): Uint8Array;
63
63
  keyDerivationPath(index?: number, change?: number, account?: number): number[];
64
64
  encode(hash: string | Buffer, opts?: SWTHAddressOptions): string;
65
+ getModuleAddress(moduleKey: string, network?: Network): string;
65
66
  };
66
67
  export declare const SWTHAddress: SWTHAddressType;
67
68
  declare type NEOAddressType = AddressBuilder<AddressOptions> & {
@@ -18,6 +18,9 @@ var __importStar = (this && this.__importStar) || function (mod) {
18
18
  __setModuleDefault(result, mod);
19
19
  return result;
20
20
  };
21
+ var __importDefault = (this && this.__importDefault) || function (mod) {
22
+ return (mod && mod.__esModule) ? mod : { "default": mod };
23
+ };
21
24
  Object.defineProperty(exports, "__esModule", { value: true });
22
25
  exports.ETHAddress = exports.N3Address = exports.NEOAddress = exports.SWTHAddress = exports.wifEncodePrivateKey = exports.randomMnemonic = exports.BIP44Path = exports.stringOrBufferToBuffer = void 0;
23
26
  const constant_1 = require("../constant");
@@ -26,6 +29,7 @@ const Base58Check = __importStar(require("base58check"));
26
29
  const bech32 = __importStar(require("bech32"));
27
30
  const BIP32 = __importStar(require("bip32"));
28
31
  const BIP39 = __importStar(require("bip39"));
32
+ const crypto_js_1 = __importDefault(require("crypto-js"));
29
33
  const ethers_1 = require("ethers");
30
34
  const secp256k1 = __importStar(require("secp256k1"));
31
35
  const secp256r1 = __importStar(require("secp256r1"));
@@ -189,6 +193,10 @@ exports.SWTHAddress = {
189
193
  }
190
194
  return new Uint8Array(bech32.fromWords(words));
191
195
  },
196
+ getModuleAddress: (moduleKey, network = constant_1.Network.MainNet) => {
197
+ const addressHash = crypto_js_1.default.SHA256(moduleKey).toString(crypto_js_1.default.enc.Hex);
198
+ return exports.SWTHAddress.encode(addressHash, { network });
199
+ },
192
200
  };
193
201
  exports.NEOAddress = {
194
202
  coinType: () => {
@@ -1,6 +1,7 @@
1
1
  import BigNumber from "bignumber.js";
2
2
  export declare const BN_ONE: BigNumber;
3
3
  export declare const BN_ZERO: BigNumber;
4
+ export declare const BN_10000: BigNumber;
4
5
  export declare const parseBN: (input?: string | number | BigNumber | null | undefined, defaultValue?: BigNumber | undefined) => BigNumber | undefined;
5
6
  export declare const bnOrZero: (input?: string | number | BigNumber | null | undefined, defaultValue?: BigNumber) => BigNumber;
6
7
  export declare const toHuman: (value?: string | number | BigNumber | null | undefined, decimals?: string | number | BigNumber | null | undefined) => BigNumber | undefined;
@@ -3,10 +3,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.generateNonce = exports.toUnitless = exports.toHuman = exports.bnOrZero = exports.parseBN = exports.BN_ZERO = exports.BN_ONE = void 0;
6
+ exports.generateNonce = exports.toUnitless = exports.toHuman = exports.bnOrZero = exports.parseBN = exports.BN_10000 = exports.BN_ZERO = exports.BN_ONE = void 0;
7
7
  const bignumber_js_1 = __importDefault(require("bignumber.js"));
8
8
  exports.BN_ONE = new bignumber_js_1.default(1);
9
9
  exports.BN_ZERO = new bignumber_js_1.default(0);
10
+ exports.BN_10000 = new bignumber_js_1.default(10000);
10
11
  const parseBN = (input, defaultValue) => {
11
12
  if (!input && input !== 0)
12
13
  return defaultValue;
package/lib/util/tx.d.ts CHANGED
@@ -3,6 +3,7 @@ import * as CosmosModels from "../codec/cosmos-models";
3
3
  import { StdFee } from "@cosmjs/amino";
4
4
  import { SignerData } from "@cosmjs/stargate";
5
5
  import { SWTHAddressOptions } from "./address";
6
+ export { StdSignDoc } from "@cosmjs/amino";
6
7
  export interface TxBody extends Omit<CosmosModels.Tx.TxBody, "messages"> {
7
8
  messages: unknown[];
8
9
  }
@@ -57,16 +58,72 @@ export declare const Types: {
57
58
  MsgCancelOrderResponse: string;
58
59
  MsgCancelAll: string;
59
60
  MsgCancelAllResponse: string;
60
- MsgAddCollateral: string;
61
- MsgAddCollateralResponse: string;
62
- MsgRemoveCollateral: string;
63
- MsgRemoveCollateralResponse: string;
64
- MsgAddDebt: string;
65
- MsgAddDebtResponse: string;
66
- MsgRemoveDebt: string;
67
- MsgRemoveDebtResponse: string;
68
- MsgCreateVaultType: string;
69
- MsgCreateVaultTypeResponse: string;
61
+ MsgAddRateStrategy: string;
62
+ MsgAddRateStrategyResponse: string;
63
+ MsgUpdateRateStrategy: string;
64
+ MsgUpdateRateStrategyResponse: string;
65
+ MsgRemoveRateStrategy: string;
66
+ MsgRemoveRateStrategyResponse: string;
67
+ MsgAddAsset: string;
68
+ MsgAddAssetResponse: string;
69
+ MsgUpdateAsset: string;
70
+ MsgUpdateAssetResponse: string;
71
+ MsgSupplyAsset: string;
72
+ MsgSupplyAssetResponse: string;
73
+ MsgWithdrawAsset: string;
74
+ MsgWithdrawAssetResponse: string;
75
+ MsgLockCollateral: string;
76
+ MsgLockCollateralResponse: string;
77
+ MsgUnlockCollateral: string;
78
+ MsgUnlockCollateralResponse: string;
79
+ MsgBorrowAsset: string;
80
+ MsgBorrowAssetResponse: string;
81
+ MsgRepayAsset: string;
82
+ MsgRepayAssetResponse: string;
83
+ MsgSupplyAssetAndLockCollateral: string;
84
+ MsgSupplyAssetAndLockCollateralResponse: string;
85
+ MsgUnlockCollateralAndWithdrawAsset: string;
86
+ MsgUnlockCollateralAndWithdrawAssetResponse: string;
87
+ MsgLiquidateCollateral: string;
88
+ MsgLiquidateCollateralResponse: string;
89
+ MsgSetLiquidationFee: string;
90
+ MsgSetLiquidationFeeResponse: string;
91
+ MsgSetInterestFee: string;
92
+ MsgSetInterestFeeResponse: string;
93
+ MsgRepayAssetWithCdpTokens: string;
94
+ MsgRepayAssetWithCdpTokensResponse: string;
95
+ MsgRepayAssetWithCollateral: string;
96
+ MsgRepayAssetWithCollateralResponse: string;
97
+ MsgSetStablecoinInterestRate: string;
98
+ MsgSetStablecoinInterestRateResponse: string;
99
+ MsgSetStablecoinMintCap: string;
100
+ MsgSetStablecoinMintCapResponse: string;
101
+ MsgMintStablecoin: string;
102
+ MsgMintStablecoinResponse: string;
103
+ MsgReturnStablecoin: string;
104
+ MsgReturnStablecoinResponse: string;
105
+ MsgSetCompleteLiquidationThreshold: string;
106
+ MsgSetCompleteLiquidationThresholdResponse: string;
107
+ MsgSetMinimumCloseFactor: string;
108
+ MsgSetMinimumCloseFactorResponse: string;
109
+ MsgSetSmallLiquidationSize: string;
110
+ MsgSetSmallLiquidationSizeResponse: string;
111
+ MsgLiquidateCollateralWithCdpTokens: string;
112
+ MsgLiquidateCollateralWithCdpTokensResponse: string;
113
+ MsgLiquidateCollateralWithCollateral: string;
114
+ MsgLiquidateCollateralWithCollateralResponse: string;
115
+ MsgLiquidateCollateralWithStablecoin: string;
116
+ MsgLiquidateCollateralWithStablecoinResponse: string;
117
+ MsgCreateRewardScheme: string;
118
+ MsgCreateRewardSchemeResponse: string;
119
+ MsgUpdateRewardScheme: string;
120
+ MsgUpdateRewardSchemeResponse: string;
121
+ MsgClaimRewards: string;
122
+ MsgClaimRewardsResponse: string;
123
+ MsgSetStalePriceGracePeriod: string;
124
+ MsgSetStalePriceGracePeriodResponse: string;
125
+ MsgSetCdpPaused: string;
126
+ MsgSetCdpPausedResponse: string;
70
127
  MsgSyncGenesis: string;
71
128
  MsgSyncGenesisResponse: string;
72
129
  MsgSyncHeaders: string;
@@ -285,6 +342,14 @@ export declare const Types: {
285
342
  SetCommitmentCurveProposal: string;
286
343
  SetRewardsWeightsProposal: string;
287
344
  UpdatePoolProposal: string;
345
+ MsgSetBackfillTimeInterval: string;
346
+ MsgSetBackfillTimeIntervalResponse: string;
347
+ MsgSetSmoothenBand: string;
348
+ MsgSetSmoothenBandResponse: string;
349
+ MsgSetImpactBand: string;
350
+ MsgSetImpactBandResponse: string;
351
+ MsgSetStaleIndexAllowance: string;
352
+ MsgSetStaleIndexAllowanceResponse: string;
288
353
  SettlementPriceProposal: string;
289
354
  MsgSetWrapperMapping: string;
290
355
  MsgSetWrapperMappingResponse: string;
@@ -1,7 +1,7 @@
1
1
  /// <reference types="node" />
2
2
  import { SignDoc } from '../codec/cosmos/tx/v1beta1/tx';
3
3
  import { CosmosLedger } from '../provider';
4
- import { AminoSignResponse, OfflineAminoSigner, StdSignDoc } from "@cosmjs/amino";
4
+ import { AminoSignResponse, OfflineAminoSigner, Secp256k1Wallet, StdSignDoc } from "@cosmjs/amino";
5
5
  import { AccountData, DirectSecp256k1Wallet, DirectSignResponse, OfflineDirectSigner } from '@cosmjs/proto-signing';
6
6
  export declare enum CarbonSignerTypes {
7
7
  Ledger = 0,
@@ -16,14 +16,17 @@ export declare type DirectCarbonSigner = OfflineDirectSigner & {
16
16
  export declare type AminoCarbonSigner = OfflineAminoSigner & {
17
17
  type: CarbonSignerTypes;
18
18
  };
19
- export declare class CarbonPrivateKeySigner implements DirectCarbonSigner {
19
+ export declare class CarbonPrivateKeySigner implements DirectCarbonSigner, AminoCarbonSigner {
20
20
  readonly privateKey: Buffer;
21
21
  readonly prefix: string;
22
22
  type: CarbonSignerTypes;
23
23
  wallet?: DirectSecp256k1Wallet;
24
+ aminoWallet?: Secp256k1Wallet;
24
25
  constructor(privateKey: Buffer, prefix: string);
25
26
  initWallet(): Promise<DirectSecp256k1Wallet>;
27
+ initAminoWallet(): Promise<Secp256k1Wallet>;
26
28
  getAccounts(): Promise<readonly AccountData[]>;
29
+ signAmino(signerAddress: string, signDoc: StdSignDoc): Promise<AminoSignResponse>;
27
30
  signDirect(signerAddress: string, signDoc: SignDoc): Promise<DirectSignResponse>;
28
31
  }
29
32
  export declare class CarbonNonSigner implements DirectCarbonSigner {
@@ -33,12 +33,25 @@ class CarbonPrivateKeySigner {
33
33
  return this.wallet;
34
34
  });
35
35
  }
36
+ initAminoWallet() {
37
+ return __awaiter(this, void 0, void 0, function* () {
38
+ if (!this.aminoWallet)
39
+ this.aminoWallet = yield amino_1.Secp256k1Wallet.fromKey(this.privateKey, this.prefix);
40
+ return this.aminoWallet;
41
+ });
42
+ }
36
43
  getAccounts() {
37
44
  return __awaiter(this, void 0, void 0, function* () {
38
45
  const wallet = yield this.initWallet();
39
46
  return wallet.getAccounts();
40
47
  });
41
48
  }
49
+ signAmino(signerAddress, signDoc) {
50
+ return __awaiter(this, void 0, void 0, function* () {
51
+ const aminoWallet = yield this.initAminoWallet();
52
+ return yield aminoWallet.signAmino(signerAddress, signDoc);
53
+ });
54
+ }
42
55
  signDirect(signerAddress, signDoc) {
43
56
  return __awaiter(this, void 0, void 0, function* () {
44
57
  const wallet = yield this.initWallet();
@@ -168,7 +168,6 @@ class CarbonWallet {
168
168
  const response = yield carbonClient.broadcastTx(tx, timeoutMs, pollIntervalMs);
169
169
  if ((0, stargate_1.isDeliverTxFailure)(response)) {
170
170
  // tx failed
171
- console.error(response);
172
171
  throw new Error(`[${response.code}] ${response.rawLog}`);
173
172
  }
174
173
  return response;