carbon-js-sdk 0.2.10 → 0.2.11-dev.2

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 (290) hide show
  1. package/lib/clients/CarbonQueryClient.js +1 -1
  2. package/lib/clients/ETHClient.js +15 -15
  3. package/lib/clients/HydrogenClient.js +1 -1
  4. package/lib/clients/InsightsQueryClient.d.ts +3 -1
  5. package/lib/clients/InsightsQueryClient.js +17 -6
  6. package/lib/clients/NEOClient.js +7 -7
  7. package/lib/clients/TokenClient.d.ts +4 -0
  8. package/lib/clients/TokenClient.js +23 -7
  9. package/lib/clients/ZILClient.js +16 -16
  10. package/lib/codec/book/genesis.d.ts +1 -1
  11. package/lib/codec/book/genesis.js +1 -1
  12. package/lib/codec/book/query.d.ts +1 -1
  13. package/lib/codec/book/query.js +1 -1
  14. package/lib/codec/broker/genesis.d.ts +1 -1
  15. package/lib/codec/broker/genesis.js +1 -1
  16. package/lib/codec/broker/query.d.ts +3 -3
  17. package/lib/codec/broker/query.js +3 -3
  18. package/lib/codec/btcx/denom_cross_chain_info.d.ts +1 -1
  19. package/lib/codec/btcx/denom_cross_chain_info.js +1 -1
  20. package/lib/codec/btcx/query.d.ts +1 -1
  21. package/lib/codec/btcx/query.js +1 -1
  22. package/lib/codec/ccm/genesis.d.ts +1 -1
  23. package/lib/codec/ccm/genesis.js +1 -1
  24. package/lib/codec/cdp/asset_params.d.ts +1 -0
  25. package/lib/codec/cdp/asset_params.js +31 -15
  26. package/lib/codec/cdp/event.d.ts +226 -22
  27. package/lib/codec/cdp/event.js +1414 -80
  28. package/lib/codec/cdp/genesis.d.ts +57 -4
  29. package/lib/codec/cdp/genesis.js +417 -22
  30. package/lib/codec/cdp/query.d.ts +328 -94
  31. package/lib/codec/cdp/query.js +1300 -236
  32. package/lib/codec/cdp/tx.d.ts +466 -96
  33. package/lib/codec/cdp/tx.js +1961 -181
  34. package/lib/codec/coin/event.d.ts +1 -1
  35. package/lib/codec/coin/event.js +1 -1
  36. package/lib/codec/coin/genesis.d.ts +2 -2
  37. package/lib/codec/coin/genesis.js +2 -2
  38. package/lib/codec/coin/proposal.d.ts +1 -1
  39. package/lib/codec/coin/proposal.js +1 -1
  40. package/lib/codec/coin/query.d.ts +2 -5
  41. package/lib/codec/coin/query.js +2 -8
  42. package/lib/codec/coin/token.d.ts +11 -0
  43. package/lib/codec/coin/token.js +65 -1
  44. package/lib/codec/coin/tx.d.ts +1 -1
  45. package/lib/codec/coin/tx.js +1 -1
  46. package/lib/codec/cosmos/auth/v1beta1/genesis.d.ts +1 -1
  47. package/lib/codec/cosmos/auth/v1beta1/genesis.js +1 -1
  48. package/lib/codec/cosmos/auth/v1beta1/query.d.ts +2 -2
  49. package/lib/codec/cosmos/auth/v1beta1/query.js +2 -2
  50. package/lib/codec/cosmos/authz/v1beta1/query.d.ts +2 -2
  51. package/lib/codec/cosmos/authz/v1beta1/query.js +2 -2
  52. package/lib/codec/cosmos/authz/v1beta1/tx.d.ts +1 -1
  53. package/lib/codec/cosmos/authz/v1beta1/tx.js +1 -1
  54. package/lib/codec/cosmos/bank/v1beta1/authz.d.ts +1 -1
  55. package/lib/codec/cosmos/bank/v1beta1/authz.js +1 -1
  56. package/lib/codec/cosmos/bank/v1beta1/bank.d.ts +1 -1
  57. package/lib/codec/cosmos/bank/v1beta1/bank.js +1 -1
  58. package/lib/codec/cosmos/bank/v1beta1/genesis.d.ts +2 -2
  59. package/lib/codec/cosmos/bank/v1beta1/genesis.js +2 -2
  60. package/lib/codec/cosmos/bank/v1beta1/query.d.ts +3 -3
  61. package/lib/codec/cosmos/bank/v1beta1/query.js +3 -3
  62. package/lib/codec/cosmos/bank/v1beta1/tx.d.ts +2 -2
  63. package/lib/codec/cosmos/bank/v1beta1/tx.js +2 -2
  64. package/lib/codec/cosmos/base/tendermint/v1beta1/query.d.ts +1 -1
  65. package/lib/codec/cosmos/base/tendermint/v1beta1/query.js +1 -1
  66. package/lib/codec/cosmos/capability/v1beta1/genesis.d.ts +1 -1
  67. package/lib/codec/cosmos/capability/v1beta1/genesis.js +1 -1
  68. package/lib/codec/cosmos/crisis/v1beta1/genesis.d.ts +1 -1
  69. package/lib/codec/cosmos/crisis/v1beta1/genesis.js +1 -1
  70. package/lib/codec/cosmos/distribution/v1beta1/distribution.d.ts +1 -1
  71. package/lib/codec/cosmos/distribution/v1beta1/distribution.js +1 -1
  72. package/lib/codec/cosmos/distribution/v1beta1/genesis.d.ts +2 -2
  73. package/lib/codec/cosmos/distribution/v1beta1/genesis.js +2 -2
  74. package/lib/codec/cosmos/distribution/v1beta1/query.d.ts +3 -3
  75. package/lib/codec/cosmos/distribution/v1beta1/query.js +3 -3
  76. package/lib/codec/cosmos/distribution/v1beta1/tx.d.ts +1 -1
  77. package/lib/codec/cosmos/distribution/v1beta1/tx.js +1 -1
  78. package/lib/codec/cosmos/evidence/v1beta1/query.d.ts +1 -1
  79. package/lib/codec/cosmos/evidence/v1beta1/query.js +1 -1
  80. package/lib/codec/cosmos/feegrant/v1beta1/feegrant.d.ts +1 -1
  81. package/lib/codec/cosmos/feegrant/v1beta1/feegrant.js +1 -1
  82. package/lib/codec/cosmos/feegrant/v1beta1/genesis.d.ts +1 -1
  83. package/lib/codec/cosmos/feegrant/v1beta1/genesis.js +1 -1
  84. package/lib/codec/cosmos/feegrant/v1beta1/query.d.ts +2 -2
  85. package/lib/codec/cosmos/feegrant/v1beta1/query.js +2 -2
  86. package/lib/codec/cosmos/gov/v1beta1/genesis.d.ts +1 -1
  87. package/lib/codec/cosmos/gov/v1beta1/genesis.js +1 -1
  88. package/lib/codec/cosmos/gov/v1beta1/gov.d.ts +1 -1
  89. package/lib/codec/cosmos/gov/v1beta1/gov.js +1 -1
  90. package/lib/codec/cosmos/gov/v1beta1/query.d.ts +2 -2
  91. package/lib/codec/cosmos/gov/v1beta1/query.js +4 -4
  92. package/lib/codec/cosmos/gov/v1beta1/tx.d.ts +2 -2
  93. package/lib/codec/cosmos/gov/v1beta1/tx.js +4 -4
  94. package/lib/codec/cosmos/mint/v1beta1/genesis.d.ts +1 -1
  95. package/lib/codec/cosmos/mint/v1beta1/genesis.js +1 -1
  96. package/lib/codec/cosmos/mint/v1beta1/query.d.ts +1 -1
  97. package/lib/codec/cosmos/mint/v1beta1/query.js +1 -1
  98. package/lib/codec/cosmos/params/v1beta1/query.d.ts +1 -1
  99. package/lib/codec/cosmos/params/v1beta1/query.js +1 -1
  100. package/lib/codec/cosmos/slashing/v1beta1/genesis.d.ts +1 -1
  101. package/lib/codec/cosmos/slashing/v1beta1/genesis.js +1 -1
  102. package/lib/codec/cosmos/slashing/v1beta1/query.d.ts +2 -2
  103. package/lib/codec/cosmos/slashing/v1beta1/query.js +2 -2
  104. package/lib/codec/cosmos/staking/v1beta1/authz.d.ts +1 -1
  105. package/lib/codec/cosmos/staking/v1beta1/authz.js +1 -1
  106. package/lib/codec/cosmos/staking/v1beta1/genesis.d.ts +1 -1
  107. package/lib/codec/cosmos/staking/v1beta1/genesis.js +1 -1
  108. package/lib/codec/cosmos/staking/v1beta1/query.d.ts +2 -2
  109. package/lib/codec/cosmos/staking/v1beta1/query.js +2 -2
  110. package/lib/codec/cosmos/staking/v1beta1/staking.d.ts +1 -1
  111. package/lib/codec/cosmos/staking/v1beta1/staking.js +1 -1
  112. package/lib/codec/cosmos/staking/v1beta1/tx.d.ts +2 -2
  113. package/lib/codec/cosmos/staking/v1beta1/tx.js +2 -2
  114. package/lib/codec/cosmos/tx/signing/v1beta1/signing.d.ts +1 -1
  115. package/lib/codec/cosmos/tx/signing/v1beta1/signing.js +1 -1
  116. package/lib/codec/cosmos/tx/v1beta1/service.d.ts +3 -3
  117. package/lib/codec/cosmos/tx/v1beta1/service.js +3 -3
  118. package/lib/codec/cosmos/tx/v1beta1/tx.d.ts +3 -3
  119. package/lib/codec/cosmos/tx/v1beta1/tx.js +5 -5
  120. package/lib/codec/cosmos/upgrade/v1beta1/query.d.ts +1 -1
  121. package/lib/codec/cosmos/upgrade/v1beta1/query.js +1 -1
  122. package/lib/codec/cosmos/vesting/v1beta1/tx.d.ts +1 -1
  123. package/lib/codec/cosmos/vesting/v1beta1/tx.js +1 -1
  124. package/lib/codec/cosmos/vesting/v1beta1/vesting.d.ts +2 -2
  125. package/lib/codec/cosmos/vesting/v1beta1/vesting.js +2 -2
  126. package/lib/codec/fee/genesis.d.ts +1 -1
  127. package/lib/codec/fee/genesis.js +1 -1
  128. package/lib/codec/fee/proposal.d.ts +1 -1
  129. package/lib/codec/fee/proposal.js +1 -1
  130. package/lib/codec/fee/query.d.ts +1 -1
  131. package/lib/codec/fee/query.js +1 -1
  132. package/lib/codec/fee/tx.d.ts +1 -1
  133. package/lib/codec/fee/tx.js +1 -1
  134. package/lib/codec/headersync/genesis.d.ts +1 -1
  135. package/lib/codec/headersync/genesis.js +1 -1
  136. package/lib/codec/headersync/query.d.ts +1 -1
  137. package/lib/codec/headersync/query.js +1 -1
  138. package/lib/codec/index.d.ts +53 -22
  139. package/lib/codec/index.js +514 -384
  140. package/lib/codec/inflation/genesis.d.ts +1 -1
  141. package/lib/codec/inflation/genesis.js +1 -1
  142. package/lib/codec/inflation/query.d.ts +1 -1
  143. package/lib/codec/inflation/query.js +1 -1
  144. package/lib/codec/insurance/genesis.d.ts +1 -1
  145. package/lib/codec/insurance/genesis.js +1 -1
  146. package/lib/codec/leverage/genesis.d.ts +1 -1
  147. package/lib/codec/leverage/genesis.js +1 -1
  148. package/lib/codec/leverage/query.d.ts +1 -1
  149. package/lib/codec/leverage/query.js +1 -1
  150. package/lib/codec/liquidation/genesis.d.ts +1 -1
  151. package/lib/codec/liquidation/genesis.js +1 -1
  152. package/lib/codec/liquidation/query.d.ts +1 -1
  153. package/lib/codec/liquidation/query.js +1 -1
  154. package/lib/codec/liquidation/quote_changes.d.ts +1 -1
  155. package/lib/codec/liquidation/quote_changes.js +1 -1
  156. package/lib/codec/liquiditypool/event.d.ts +2 -2
  157. package/lib/codec/liquiditypool/event.js +2 -2
  158. package/lib/codec/liquiditypool/genesis.d.ts +2 -2
  159. package/lib/codec/liquiditypool/genesis.js +2 -2
  160. package/lib/codec/liquiditypool/proposal.d.ts +1 -1
  161. package/lib/codec/liquiditypool/proposal.js +1 -1
  162. package/lib/codec/liquiditypool/query.d.ts +2 -2
  163. package/lib/codec/liquiditypool/query.js +2 -2
  164. package/lib/codec/liquiditypool/tx.d.ts +1 -1
  165. package/lib/codec/liquiditypool/tx.js +1 -1
  166. package/lib/codec/lockproxy/genesis.d.ts +1 -1
  167. package/lib/codec/lockproxy/genesis.js +1 -1
  168. package/lib/codec/lockproxy/query.d.ts +1 -1
  169. package/lib/codec/lockproxy/query.js +1 -1
  170. package/lib/codec/market/event.d.ts +1 -1
  171. package/lib/codec/market/event.js +1 -1
  172. package/lib/codec/market/genesis.d.ts +2 -1
  173. package/lib/codec/market/genesis.js +20 -2
  174. package/lib/codec/market/proposal.d.ts +1 -1
  175. package/lib/codec/market/proposal.js +1 -1
  176. package/lib/codec/market/query.d.ts +1 -1
  177. package/lib/codec/market/query.js +1 -1
  178. package/lib/codec/market/tx.d.ts +1 -1
  179. package/lib/codec/market/tx.js +1 -1
  180. package/lib/codec/marketstats/genesis.d.ts +1 -1
  181. package/lib/codec/marketstats/genesis.js +1 -1
  182. package/lib/codec/marketstats/query.d.ts +2 -2
  183. package/lib/codec/marketstats/query.js +2 -2
  184. package/lib/codec/misc/message.d.ts +1 -1
  185. package/lib/codec/misc/message.js +1 -1
  186. package/lib/codec/misc/query.d.ts +3 -3
  187. package/lib/codec/misc/query.js +3 -3
  188. package/lib/codec/misc/trade.d.ts +1 -0
  189. package/lib/codec/misc/trade.js +17 -0
  190. package/lib/codec/misc/transaction.d.ts +1 -1
  191. package/lib/codec/misc/transaction.js +1 -1
  192. package/lib/codec/oracle/event.d.ts +1 -1
  193. package/lib/codec/oracle/event.js +1 -1
  194. package/lib/codec/oracle/genesis.d.ts +1 -1
  195. package/lib/codec/oracle/genesis.js +1 -1
  196. package/lib/codec/oracle/proposal.d.ts +1 -1
  197. package/lib/codec/oracle/proposal.js +1 -1
  198. package/lib/codec/oracle/query.d.ts +2 -2
  199. package/lib/codec/oracle/query.js +2 -2
  200. package/lib/codec/order/event.d.ts +1 -1
  201. package/lib/codec/order/event.js +1 -1
  202. package/lib/codec/order/genesis.d.ts +1 -1
  203. package/lib/codec/order/genesis.js +1 -1
  204. package/lib/codec/order/query.d.ts +1 -1
  205. package/lib/codec/order/query.js +1 -1
  206. package/lib/codec/position/event.d.ts +1 -1
  207. package/lib/codec/position/event.js +1 -1
  208. package/lib/codec/position/genesis.d.ts +1 -1
  209. package/lib/codec/position/genesis.js +1 -1
  210. package/lib/codec/position/query.d.ts +1 -1
  211. package/lib/codec/position/query.js +1 -1
  212. package/lib/codec/pricing/event.d.ts +11 -1
  213. package/lib/codec/pricing/event.js +52 -2
  214. package/lib/codec/pricing/genesis.d.ts +2 -1
  215. package/lib/codec/pricing/genesis.js +20 -5
  216. package/lib/codec/pricing/pricing.d.ts +13 -0
  217. package/lib/codec/pricing/pricing.js +83 -1
  218. package/lib/codec/pricing/query.d.ts +1 -1
  219. package/lib/codec/pricing/query.js +1 -1
  220. package/lib/codec/profile/event.d.ts +1 -1
  221. package/lib/codec/profile/event.js +1 -1
  222. package/lib/codec/profile/genesis.d.ts +1 -1
  223. package/lib/codec/profile/genesis.js +1 -1
  224. package/lib/codec/profile/query.d.ts +1 -1
  225. package/lib/codec/profile/query.js +1 -1
  226. package/lib/codec/subaccount/genesis.d.ts +1 -1
  227. package/lib/codec/subaccount/genesis.js +1 -1
  228. package/lib/codec/subaccount/query.d.ts +1 -1
  229. package/lib/codec/subaccount/query.js +1 -1
  230. package/lib/codec/tendermint/abci/types.d.ts +4 -4
  231. package/lib/codec/tendermint/abci/types.js +4 -4
  232. package/lib/codec/tendermint/types/block.d.ts +2 -2
  233. package/lib/codec/tendermint/types/block.js +2 -2
  234. package/lib/codec/tendermint/types/evidence.d.ts +2 -2
  235. package/lib/codec/tendermint/types/evidence.js +2 -2
  236. package/lib/codec/tendermint/types/types.d.ts +3 -3
  237. package/lib/codec/tendermint/types/types.js +3 -3
  238. package/lib/codec/tendermint/types/validator.d.ts +1 -1
  239. package/lib/codec/tendermint/types/validator.js +1 -1
  240. package/lib/constant/generic.js +1 -1
  241. package/lib/insights/common.d.ts +2 -0
  242. package/lib/insights/common.js +2 -0
  243. package/lib/insights/competition.d.ts +49 -7
  244. package/lib/modules/admin.d.ts +61 -1
  245. package/lib/modules/admin.js +193 -42
  246. package/lib/modules/cdp.d.ts +55 -12
  247. package/lib/modules/cdp.js +134 -20
  248. package/lib/modules/gov.js +14 -14
  249. package/lib/modules/liquiditypool.js +1 -1
  250. package/lib/provider/account/EthLedgerAccount/EthLedgerAccount.js +1 -1
  251. package/lib/provider/account/NeoLedgerAccount/N3Ledger/ErrorCode.js +1 -1
  252. package/lib/provider/account/NeoLedgerAccount/N3Ledger/main.js +8 -8
  253. package/lib/provider/account/NeoLedgerAccount/NeoLedgerAccount.js +3 -3
  254. package/lib/provider/account/NeoLedgerAccount/NeonLedger.js +1 -1
  255. package/lib/provider/amino/types/admin.js +67 -26
  256. package/lib/provider/amino/types/bank.js +1 -1
  257. package/lib/provider/amino/types/broker.js +1 -1
  258. package/lib/provider/amino/types/cdp.js +72 -32
  259. package/lib/provider/amino/types/coin.js +2 -2
  260. package/lib/provider/amino/types/gov.js +4 -4
  261. package/lib/provider/amino/types/ibc.js +1 -1
  262. package/lib/provider/amino/types/leverage.js +1 -1
  263. package/lib/provider/amino/types/liquidityPool.js +7 -7
  264. package/lib/provider/amino/types/market.js +1 -1
  265. package/lib/provider/amino/types/oracle.js +1 -1
  266. package/lib/provider/amino/types/order.js +4 -4
  267. package/lib/provider/amino/types/position.js +1 -1
  268. package/lib/provider/amino/types/profile.js +1 -1
  269. package/lib/provider/amino/types/staking.js +4 -4
  270. package/lib/provider/amino/types/subaccount.js +3 -3
  271. package/lib/provider/amino/utils.js +11 -11
  272. package/lib/provider/keplr/KeplrStore.js +1 -1
  273. package/lib/provider/ledger/ledger.js +2 -2
  274. package/lib/provider/metamask/MetaMask.js +1 -1
  275. package/lib/provider/o3/O3Wallet.js +2 -2
  276. package/lib/util/address.js +13 -13
  277. package/lib/util/api.js +4 -4
  278. package/lib/util/fetch.js +1 -1
  279. package/lib/util/generic.js +3 -3
  280. package/lib/util/number.js +5 -5
  281. package/lib/util/tx.d.ts +42 -14
  282. package/lib/wallet/CarbonSigner.js +2 -2
  283. package/lib/wallet/CarbonSigningClient.js +8 -8
  284. package/lib/wallet/CarbonWallet.js +6 -6
  285. package/lib/websocket/channel.js +26 -0
  286. package/lib/websocket/connector.js +3 -3
  287. package/lib/websocket/models.d.ts +63 -0
  288. package/lib/websocket/types.d.ts +38 -3
  289. package/lib/websocket/types.js +16 -0
  290. package/package.json +2 -1
package/lib/util/tx.d.ts CHANGED
@@ -57,16 +57,48 @@ export declare const Types: {
57
57
  MsgCancelOrderResponse: string;
58
58
  MsgCancelAll: string;
59
59
  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;
60
+ MsgAddRateStrategy: string;
61
+ MsgAddRateStrategyResponse: string;
62
+ MsgUpdateRateStrategy: string;
63
+ MsgUpdateRateStrategyResponse: string;
64
+ MsgRemoveRateStrategy: string;
65
+ MsgRemoveRateStrategyResponse: string;
66
+ MsgAddAsset: string;
67
+ MsgAddAssetResponse: string;
68
+ MsgUpdateAsset: string;
69
+ MsgUpdateAssetResponse: string;
70
+ MsgSupplyAsset: string;
71
+ MsgSupplyAssetResponse: string;
72
+ MsgWithdrawAsset: string;
73
+ MsgWithdrawAssetResponse: string;
74
+ MsgLockCollateral: string;
75
+ MsgLockCollateralResponse: string;
76
+ MsgUnlockCollateral: string;
77
+ MsgUnlockCollateralResponse: string;
78
+ MsgBorrowAsset: string;
79
+ MsgBorrowAssetResponse: string;
80
+ MsgRepayAsset: string;
81
+ MsgRepayAssetResponse: string;
82
+ MsgSupplyAssetAndLockCollateral: string;
83
+ MsgSupplyAssetAndLockCollateralResponse: string;
84
+ MsgUnlockCollateralAndWithdrawAsset: string;
85
+ MsgUnlockCollateralAndWithdrawAssetResponse: string;
86
+ MsgLiquidateCollateral: string;
87
+ MsgLiquidateCollateralResponse: string;
88
+ MsgSetLiquidationFee: string;
89
+ MsgSetLiquidationFeeResponse: string;
90
+ MsgSetInterestFee: string;
91
+ MsgSetInterestFeeResponse: string;
92
+ MsgRepayAssetWithCdpTokens: string;
93
+ MsgRepayAssetWithCdpTokensResponse: string;
94
+ MsgRepayAssetWithCollateral: string;
95
+ MsgRepayAssetWithCollateralResponse: string;
96
+ MsgSetStablecoinInterestRate: string;
97
+ MsgSetStablecoinInterestRateResponse: string;
98
+ MsgMintStablecoin: string;
99
+ MsgMintStablecoinResponse: string;
100
+ MsgReturnStablecoin: string;
101
+ MsgReturnStablecoinResponse: string;
70
102
  MsgSyncGenesis: string;
71
103
  MsgSyncGenesisResponse: string;
72
104
  MsgSyncHeaders: string;
@@ -85,10 +117,6 @@ export declare const Types: {
85
117
  SetMinGasPriceProposal: string;
86
118
  RemoveMsgGasCostProposal: string;
87
119
  RemoveMinGasPriceProposal: string;
88
- MsgEnableSend: string;
89
- MsgEnableSendResponse: string;
90
- MsgDisableSend: string;
91
- MsgDisableSendResponse: string;
92
120
  MsgCreate: string;
93
121
  MsgCreateResponse: string;
94
122
  MsgBind: string;
@@ -93,9 +93,9 @@ class CarbonLedgerSigner {
93
93
  return __awaiter(this, void 0, void 0, function* () {
94
94
  const account = yield this.retrieveAccount();
95
95
  const { pubkey } = account;
96
- const msg = JSON.stringify(generic_1.sortObject(doc));
96
+ const msg = JSON.stringify((0, generic_1.sortObject)(doc));
97
97
  const signBytes = yield this.ledger.sign(msg);
98
- const signature = amino_1.encodeSecp256k1Signature(pubkey, signBytes);
98
+ const signature = (0, amino_1.encodeSecp256k1Signature)(pubkey, signBytes);
99
99
  return {
100
100
  signed: doc,
101
101
  signature,
@@ -62,7 +62,7 @@ class CarbonSigningClient extends stargate_1.StargateClient {
62
62
  */
63
63
  sign(signerAddress, messages, fee, memo, signerData) {
64
64
  return __awaiter(this, void 0, void 0, function* () {
65
- return proto_signing_1.isOfflineDirectSigner(this.signer)
65
+ return (0, proto_signing_1.isOfflineDirectSigner)(this.signer)
66
66
  ? this.signDirect(signerAddress, messages, fee, memo, signerData)
67
67
  : this.signAmino(signerAddress, messages, fee, memo, signerData);
68
68
  });
@@ -74,7 +74,7 @@ class CarbonSigningClient extends stargate_1.StargateClient {
74
74
  if (!accountFromSigner) {
75
75
  throw new Error("Failed to retrieve account from signer");
76
76
  }
77
- const pubkey = proto_signing_1.encodePubkey(amino_1.encodeSecp256k1Pubkey(accountFromSigner.pubkey));
77
+ const pubkey = (0, proto_signing_1.encodePubkey)((0, amino_1.encodeSecp256k1Pubkey)(accountFromSigner.pubkey));
78
78
  const txBodyEncodeObject = {
79
79
  typeUrl: "/cosmos.tx.v1beta1.TxBody",
80
80
  value: Object.assign({ messages: messages, memo: memo }, timeoutHeight && {
@@ -83,13 +83,13 @@ class CarbonSigningClient extends stargate_1.StargateClient {
83
83
  };
84
84
  const txBodyBytes = this.registry.encode(txBodyEncodeObject);
85
85
  const gasLimit = math_1.Int53.fromString(fee.gas).toNumber();
86
- const authInfoBytes = proto_signing_1.makeAuthInfoBytes([{ pubkey, sequence }], fee.amount, gasLimit);
87
- const signDoc = proto_signing_1.makeSignDoc(txBodyBytes, authInfoBytes, chainId, accountNumber);
86
+ const authInfoBytes = (0, proto_signing_1.makeAuthInfoBytes)([{ pubkey, sequence }], fee.amount, gasLimit);
87
+ const signDoc = (0, proto_signing_1.makeSignDoc)(txBodyBytes, authInfoBytes, chainId, accountNumber);
88
88
  const { signature, signed } = yield signer.signDirect(signerAddress, signDoc);
89
89
  return tx_1.TxRaw.fromPartial({
90
90
  bodyBytes: signed.bodyBytes,
91
91
  authInfoBytes: signed.authInfoBytes,
92
- signatures: [encoding_1.fromBase64(signature.signature)],
92
+ signatures: [(0, encoding_1.fromBase64)(signature.signature)],
93
93
  });
94
94
  });
95
95
  }
@@ -100,7 +100,7 @@ class CarbonSigningClient extends stargate_1.StargateClient {
100
100
  if (!accountFromSigner) {
101
101
  throw new Error("Failed to retrieve account from signer");
102
102
  }
103
- const pubkey = proto_signing_1.encodePubkey(amino_1.encodeSecp256k1Pubkey(accountFromSigner.pubkey));
103
+ const pubkey = (0, proto_signing_1.encodePubkey)((0, amino_1.encodeSecp256k1Pubkey)(accountFromSigner.pubkey));
104
104
  const signMode = signing_1.SignMode.SIGN_MODE_LEGACY_AMINO_JSON;
105
105
  const msgs = messages.map((msg) => this.aminoTypes.toAmino(msg));
106
106
  const signDoc = makeSignDocAmino(msgs, fee, chainId, memo, accountNumber, sequence, timeoutHeight !== null && timeoutHeight !== void 0 ? timeoutHeight : 0);
@@ -115,11 +115,11 @@ class CarbonSigningClient extends stargate_1.StargateClient {
115
115
  const signedTxBodyBytes = this.registry.encode(signedTxBodyEncodeObject);
116
116
  const signedGasLimit = math_1.Int53.fromString(signed.fee.gas).toNumber();
117
117
  const signedSequence = math_1.Int53.fromString(signed.sequence).toNumber();
118
- const signedAuthInfoBytes = proto_signing_1.makeAuthInfoBytes([{ pubkey, sequence: signedSequence }], signed.fee.amount, signedGasLimit, signMode);
118
+ const signedAuthInfoBytes = (0, proto_signing_1.makeAuthInfoBytes)([{ pubkey, sequence: signedSequence }], signed.fee.amount, signedGasLimit, signMode);
119
119
  return tx_1.TxRaw.fromPartial({
120
120
  bodyBytes: signedTxBodyBytes,
121
121
  authInfoBytes: signedAuthInfoBytes,
122
- signatures: [encoding_1.fromBase64(signature.signature)],
122
+ signatures: [(0, encoding_1.fromBase64)(signature.signature)],
123
123
  });
124
124
  });
125
125
  }
@@ -148,7 +148,7 @@ class CarbonWallet {
148
148
  const signerData = Object.assign({ accountNumber: this.accountInfo.accountNumber, chainId: this.getChainId(), sequence }, explicitSignerData);
149
149
  const fee = (_a = opts === null || opts === void 0 ? void 0 : opts.fee) !== null && _a !== void 0 ? _a : this.estimateTxFee(messages, feeDenom);
150
150
  const txRaw = yield signingClient.sign(signerAddress, messages, fee, memo, signerData);
151
- signature = amino_1.encodeSecp256k1Signature(account.pubkey, txRaw.signatures[0]);
151
+ signature = (0, amino_1.encodeSecp256k1Signature)(account.pubkey, txRaw.signatures[0]);
152
152
  return txRaw;
153
153
  }
154
154
  finally {
@@ -166,7 +166,7 @@ class CarbonWallet {
166
166
  const tx = CarbonWallet.TxRaw.encode(txRaw).finish();
167
167
  const carbonClient = this.getSigningClient();
168
168
  const response = yield carbonClient.broadcastTx(tx, timeoutMs, pollIntervalMs);
169
- if (stargate_1.isDeliverTxFailure(response)) {
169
+ if ((0, stargate_1.isDeliverTxFailure)(response)) {
170
170
  // tx failed
171
171
  console.error(response);
172
172
  throw new Error(`[${response.code}] ${response.rawLog}`);
@@ -206,9 +206,9 @@ class CarbonWallet {
206
206
  try {
207
207
  if (!this.accountInfo || this.sequenceInvalidated)
208
208
  yield this.reloadAccountSequence();
209
- const heightResponse = yield fetch_1.fetch(`${this.networkConfig.tmRpcUrl}/blockchain?cache=${new Date().getTime()}`);
209
+ const heightResponse = yield (0, fetch_1.fetch)(`${this.networkConfig.tmRpcUrl}/blockchain?cache=${new Date().getTime()}`);
210
210
  const heightRes = yield heightResponse.json();
211
- const height = number_1.bnOrZero((_a = heightRes.result) === null || _a === void 0 ? void 0 : _a.last_height);
211
+ const height = (0, number_1.bnOrZero)((_a = heightRes.result) === null || _a === void 0 ? void 0 : _a.last_height);
212
212
  const timeoutHeight = height.isZero() ? undefined : height.toNumber() + this.defaultTimeoutBlocks;
213
213
  const sequence = this.accountInfo.sequence;
214
214
  this.accountInfo = Object.assign(Object.assign({}, this.accountInfo), { sequence: sequence + 1 });
@@ -342,12 +342,12 @@ class CarbonWallet {
342
342
  const queryClient = this.getQueryClient();
343
343
  const { msgGasCosts } = yield queryClient.fee.MsgGasCostAll({});
344
344
  this.txGasCosts = msgGasCosts.reduce((result, item) => {
345
- result[item.msgType] = number_1.bnOrZero(item.gasCost);
345
+ result[item.msgType] = (0, number_1.bnOrZero)(item.gasCost);
346
346
  return result;
347
347
  }, {});
348
348
  const { minGasPrices } = yield queryClient.fee.MinGasPriceAll({});
349
349
  this.txGasPrices = minGasPrices.reduce((result, item) => {
350
- result[item.denom] = number_1.bnOrZero(item.gasPrice).shiftedBy(-18); // sdk.Dec shifting
350
+ result[item.denom] = (0, number_1.bnOrZero)(item.gasPrice).shiftedBy(-18); // sdk.Dec shifting
351
351
  return result;
352
352
  }, {});
353
353
  if (!this.txGasPrices[this.defaultFeeDenom]) {
@@ -72,6 +72,18 @@ const generateChannelId = (params) => {
72
72
  const { channel, address } = params;
73
73
  return [channel, address].join(':');
74
74
  }
75
+ case types_1.WSChannel.cdp_borrows: {
76
+ const { channel, address } = params;
77
+ return [channel, address].join(':');
78
+ }
79
+ case types_1.WSChannel.cdp_collaterals: {
80
+ const { channel, address } = params;
81
+ return [channel, address].join(':');
82
+ }
83
+ case types_1.WSChannel.cdp_liquidate_collaterals: {
84
+ const { channel } = params;
85
+ return [channel].join(':');
86
+ }
75
87
  default:
76
88
  throw new Error(`invalid subscription channel: ${params.channel}`);
77
89
  }
@@ -168,6 +180,20 @@ const parseChannelId = (rawChannelId) => {
168
180
  channel,
169
181
  address,
170
182
  };
183
+ case types_1.WSChannel.cdp_borrows:
184
+ return {
185
+ channel,
186
+ address,
187
+ };
188
+ case types_1.WSChannel.cdp_collaterals:
189
+ return {
190
+ channel,
191
+ address,
192
+ };
193
+ case types_1.WSChannel.cdp_liquidate_collaterals:
194
+ return {
195
+ channel,
196
+ };
171
197
  default:
172
198
  throw new Error('Error parsing channelId');
173
199
  }
@@ -171,7 +171,7 @@ class WSConnector {
171
171
  params = [params]; // eslint-disable-line no-param-reassign
172
172
  }
173
173
  for (const param of params) {
174
- const channelId = channel_1.generateChannelId(param);
174
+ const channelId = (0, channel_1.generateChannelId)(param);
175
175
  const shouldSubscribe = this.channelHandlers[channelId] === undefined;
176
176
  this.channelHandlers[channelId] = handler;
177
177
  if (shouldSubscribe) {
@@ -193,7 +193,7 @@ class WSConnector {
193
193
  }
194
194
  const channelIds = [];
195
195
  for (const param of params) {
196
- const channelId = channel_1.generateChannelId(param);
196
+ const channelId = (0, channel_1.generateChannelId)(param);
197
197
  delete this.channelHandlers[channelId];
198
198
  }
199
199
  this.send('unsubscribe', {
@@ -279,7 +279,7 @@ class WSConnector {
279
279
  if (!channelHandler) {
280
280
  this.debugLog(`handler not found for channel: ${message.channel}`);
281
281
  try {
282
- const params = channel_1.parseChannelId(message.channel);
282
+ const params = (0, channel_1.parseChannelId)(message.channel);
283
283
  this.unsubscribe({ channel: params.channel });
284
284
  }
285
285
  catch (error) {
@@ -144,3 +144,66 @@ export interface Commitment {
144
144
  commitment_power: string;
145
145
  boost_factor: string;
146
146
  }
147
+ export interface CDPParams {
148
+ interest_fee: string;
149
+ liquidation_fee: string;
150
+ stable_coin_interest_rate: string;
151
+ }
152
+ export interface RateStrategy {
153
+ name: string;
154
+ optimal_usage: string;
155
+ base_variable_borrow_rate: string;
156
+ variable_rate_slope_1: string;
157
+ variable_rate_slope_2: string;
158
+ base_stable_borrow_rate: string;
159
+ stable_rate_slope_1: string;
160
+ stable_rate_slope_2: string;
161
+ optimal_stable_to_total_debt_ratio: string;
162
+ }
163
+ export interface Asset {
164
+ asset_params: {
165
+ denom: string;
166
+ oracle_id: string;
167
+ rate_strategy_name: string;
168
+ loan_to_value: string;
169
+ liquidation_threshold: string;
170
+ liquidation_bonus: string;
171
+ supply_cap: string;
172
+ borrow_cap: string;
173
+ };
174
+ asset_utilization: {
175
+ denom: string;
176
+ total_borrowed: string;
177
+ total_amount: string;
178
+ utilizationRate: string;
179
+ };
180
+ }
181
+ export interface Collateral {
182
+ cdp_denom: string;
183
+ denom: string;
184
+ cdp_to_actual_ratio: string;
185
+ amount: string;
186
+ value_in_usd: string;
187
+ }
188
+ export interface Debt {
189
+ denom: string;
190
+ amount: string;
191
+ value_in_usd: string;
192
+ }
193
+ export interface AccountData {
194
+ total_collaterals_usd: string;
195
+ total_debts_usd: string;
196
+ available_borrows_usd: string;
197
+ curr_liquidation_threshold: string;
198
+ health_factor: string;
199
+ }
200
+ export interface CDPBorrow {
201
+ address: string;
202
+ amount: string;
203
+ denom: string;
204
+ }
205
+ export interface CDPCollaterals {
206
+ address: string;
207
+ amount: string;
208
+ denom: string;
209
+ }
@@ -15,7 +15,10 @@ export declare enum WSChannel {
15
15
  positions_by_market = "positions_by_market",
16
16
  pools = "pools",
17
17
  pools_by_id = "pools_by_id",
18
- commitments = "commitments"
18
+ commitments = "commitments",
19
+ cdp_borrows = "cdp_borrows",
20
+ cdp_collaterals = "cdp_collaterals",
21
+ cdp_liquidate_collaterals = "cdp_liquidate_collaterals"
19
22
  }
20
23
  export declare enum WSRequest {
21
24
  MarketStats = "get_market_stats",
@@ -31,7 +34,20 @@ export declare enum WSRequest {
31
34
  Balances = "get_balances",
32
35
  OrderBook = "get_orderbook",
33
36
  Pools = "get_pools",
34
- Commitments = "get_commitments"
37
+ Commitments = "get_commitments",
38
+ CDPAllAssets = "get_cdp_all_assets",
39
+ CDPAssets = "get_cdp_assets",
40
+ CDPAccountCollaterals = "get_cdp_account_collaterals",
41
+ CDPAccountDebts = "get_cdp_account_debts",
42
+ CDPAccountData = "get_cdp_account_data",
43
+ CDPParams = "get_cdp_params",
44
+ CDPAllRateStrategies = "get_cdp_all_rate_strategies",
45
+ CDPRateStrategies = "get_cdp_rate_strategies",
46
+ CDPBorrows = "get_cdp_borrows",
47
+ CDPTotalBorrows = "get_cdp_total_borrows",
48
+ CDPCollaterals = "get_cdp_collaterals",
49
+ CDPTotalCollaterals = "get_cdp_total_collaterals",
50
+ CDPLiquidateCollateral = "get_cdp_liquidate_collateral"
35
51
  }
36
52
  export interface WsGetRecentTradesParams {
37
53
  market: string;
@@ -75,6 +91,17 @@ export interface WsGetPositionsParams {
75
91
  export interface WsGetCommitmentsParams {
76
92
  address: string;
77
93
  }
94
+ export interface WsGetCDPParams {
95
+ }
96
+ export interface WsGetCDPAssetParams {
97
+ denom: string;
98
+ }
99
+ export interface WsGetCDPAccountParams {
100
+ address: string;
101
+ }
102
+ export interface WsGetCDPRateStrategiesParams {
103
+ name: string;
104
+ }
78
105
  export interface WsSubscribeParams {
79
106
  channel: WSChannel;
80
107
  }
@@ -137,4 +164,12 @@ export interface WsUnsubscribeCandlesticksParams extends WsSubscribeParams {
137
164
  market: string;
138
165
  resolution: string;
139
166
  }
140
- export declare type WsSubscriptionParams = WsSubscribeCandlesticksParams | WsSubscribeBooksParams | WsSubscribeRecentTradesParams | WsSubscribeOrdersAllParams | WsSubscribeOrdersByMarketParams | WsSubscribeWalletBalanceParams | WsSubscribeAccountTradesAllParams | WsSubscribeAccountTradesByMarketParams | WsSubscribeMarketStatsAllParams | WsSubscribeMarketStatsByMarketParams | WsSubscribeLeveragesAllParams | WsSubscribeLeveragesByMarketParams | WsSubscribePositionsAllParams | WsSubscribePositionsByMarketParams | WsSubscribePoolsAllParams | WsSubscribePoolsByIdParams | WsSubscribeCommitmentParams | WsUnsubscribeCandlesticksParams;
167
+ export interface WsSubscribeCDPBorrows extends WsSubscribeParams {
168
+ address: string;
169
+ }
170
+ export interface WsSubscribeCDPCollaterals extends WsSubscribeParams {
171
+ address: string;
172
+ }
173
+ export interface WsSubscribeCDPLiquidateCollaterals extends WsSubscribeParams {
174
+ }
175
+ export declare type WsSubscriptionParams = WsSubscribeCandlesticksParams | WsSubscribeBooksParams | WsSubscribeRecentTradesParams | WsSubscribeOrdersAllParams | WsSubscribeOrdersByMarketParams | WsSubscribeWalletBalanceParams | WsSubscribeAccountTradesAllParams | WsSubscribeAccountTradesByMarketParams | WsSubscribeMarketStatsAllParams | WsSubscribeMarketStatsByMarketParams | WsSubscribeLeveragesAllParams | WsSubscribeLeveragesByMarketParams | WsSubscribePositionsAllParams | WsSubscribePositionsByMarketParams | WsSubscribePoolsAllParams | WsSubscribePoolsByIdParams | WsSubscribeCommitmentParams | WsUnsubscribeCandlesticksParams | WsSubscribeCDPBorrows | WsSubscribeCDPCollaterals | WsSubscribeCDPLiquidateCollaterals;
@@ -20,6 +20,9 @@ var WSChannel;
20
20
  WSChannel["pools"] = "pools";
21
21
  WSChannel["pools_by_id"] = "pools_by_id";
22
22
  WSChannel["commitments"] = "commitments";
23
+ WSChannel["cdp_borrows"] = "cdp_borrows";
24
+ WSChannel["cdp_collaterals"] = "cdp_collaterals";
25
+ WSChannel["cdp_liquidate_collaterals"] = "cdp_liquidate_collaterals";
23
26
  })(WSChannel = exports.WSChannel || (exports.WSChannel = {}));
24
27
  var WSRequest;
25
28
  (function (WSRequest) {
@@ -37,4 +40,17 @@ var WSRequest;
37
40
  WSRequest["OrderBook"] = "get_orderbook";
38
41
  WSRequest["Pools"] = "get_pools";
39
42
  WSRequest["Commitments"] = "get_commitments";
43
+ WSRequest["CDPAllAssets"] = "get_cdp_all_assets";
44
+ WSRequest["CDPAssets"] = "get_cdp_assets";
45
+ WSRequest["CDPAccountCollaterals"] = "get_cdp_account_collaterals";
46
+ WSRequest["CDPAccountDebts"] = "get_cdp_account_debts";
47
+ WSRequest["CDPAccountData"] = "get_cdp_account_data";
48
+ WSRequest["CDPParams"] = "get_cdp_params";
49
+ WSRequest["CDPAllRateStrategies"] = "get_cdp_all_rate_strategies";
50
+ WSRequest["CDPRateStrategies"] = "get_cdp_rate_strategies";
51
+ WSRequest["CDPBorrows"] = "get_cdp_borrows";
52
+ WSRequest["CDPTotalBorrows"] = "get_cdp_total_borrows";
53
+ WSRequest["CDPCollaterals"] = "get_cdp_collaterals";
54
+ WSRequest["CDPTotalCollaterals"] = "get_cdp_total_collaterals";
55
+ WSRequest["CDPLiquidateCollateral"] = "get_cdp_liquidate_collateral";
40
56
  })(WSRequest = exports.WSRequest || (exports.WSRequest = {}));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "carbon-js-sdk",
3
- "version": "0.2.10",
3
+ "version": "0.2.11-dev.2",
4
4
  "description": "TypeScript SDK for Carbon blockchain",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
@@ -40,6 +40,7 @@
40
40
  "@cityofzion/neon-core": "^4.9.0",
41
41
  "@cityofzion/neon-js": "^4.9.0",
42
42
  "@cityofzion/neon-core-next": "npm:@cityofzion/neon-core@^5.0.0",
43
+ "@cityofzion/neon-js": "^4.9.0",
43
44
  "@cosmjs/proto-signing": "^0.28.10",
44
45
  "@cosmjs/stargate": "^0.28.10",
45
46
  "@grpc/grpc-js": "^1.3.2",