carbon-js-sdk 0.2.16 → 0.2.18-dev.0

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 (305) hide show
  1. package/lib/CarbonSDK.d.ts +13 -1
  2. package/lib/CarbonSDK.js +31 -2
  3. package/lib/clients/CarbonQueryClient.js +2 -2
  4. package/lib/clients/ETHClient.d.ts +1 -1
  5. package/lib/clients/ETHClient.js +15 -15
  6. package/lib/clients/HydrogenClient.js +1 -1
  7. package/lib/clients/NEOClient.d.ts +1 -1
  8. package/lib/clients/NEOClient.js +7 -7
  9. package/lib/clients/TokenClient.d.ts +5 -0
  10. package/lib/clients/TokenClient.js +38 -10
  11. package/lib/clients/ZILClient.d.ts +1 -1
  12. package/lib/clients/ZILClient.js +16 -16
  13. package/lib/codec/book/genesis.d.ts +1 -1
  14. package/lib/codec/book/genesis.js +1 -1
  15. package/lib/codec/book/query.d.ts +1 -1
  16. package/lib/codec/book/query.js +1 -1
  17. package/lib/codec/broker/genesis.d.ts +1 -1
  18. package/lib/codec/broker/genesis.js +1 -1
  19. package/lib/codec/broker/query.d.ts +3 -3
  20. package/lib/codec/broker/query.js +3 -3
  21. package/lib/codec/btcx/denom_cross_chain_info.d.ts +1 -1
  22. package/lib/codec/btcx/denom_cross_chain_info.js +1 -1
  23. package/lib/codec/btcx/query.d.ts +1 -1
  24. package/lib/codec/btcx/query.js +1 -1
  25. package/lib/codec/ccm/genesis.d.ts +1 -1
  26. package/lib/codec/ccm/genesis.js +1 -1
  27. package/lib/codec/cdp/asset_params.d.ts +1 -1
  28. package/lib/codec/cdp/asset_params.js +11 -10
  29. package/lib/codec/cdp/event.d.ts +389 -22
  30. package/lib/codec/cdp/event.js +2494 -83
  31. package/lib/codec/cdp/genesis.d.ts +97 -4
  32. package/lib/codec/cdp/genesis.js +648 -23
  33. package/lib/codec/cdp/params.d.ts +8 -0
  34. package/lib/codec/cdp/params.js +52 -9
  35. package/lib/codec/cdp/query.d.ts +439 -89
  36. package/lib/codec/cdp/query.js +1995 -177
  37. package/lib/codec/cdp/reward_scheme.d.ts +1 -13
  38. package/lib/codec/cdp/reward_scheme.js +15 -92
  39. package/lib/codec/cdp/tx.d.ts +760 -96
  40. package/lib/codec/cdp/tx.js +3645 -235
  41. package/lib/codec/coin/event.d.ts +1 -1
  42. package/lib/codec/coin/event.js +1 -1
  43. package/lib/codec/coin/genesis.d.ts +2 -2
  44. package/lib/codec/coin/genesis.js +2 -2
  45. package/lib/codec/coin/proposal.d.ts +1 -1
  46. package/lib/codec/coin/proposal.js +1 -1
  47. package/lib/codec/coin/query.d.ts +2 -2
  48. package/lib/codec/coin/query.js +2 -2
  49. package/lib/codec/coin/tx.d.ts +1 -1
  50. package/lib/codec/coin/tx.js +1 -1
  51. package/lib/codec/cosmos/auth/v1beta1/genesis.d.ts +1 -1
  52. package/lib/codec/cosmos/auth/v1beta1/genesis.js +1 -1
  53. package/lib/codec/cosmos/auth/v1beta1/query.d.ts +2 -2
  54. package/lib/codec/cosmos/auth/v1beta1/query.js +2 -2
  55. package/lib/codec/cosmos/authz/v1beta1/genesis.d.ts +1 -1
  56. package/lib/codec/cosmos/authz/v1beta1/genesis.js +1 -1
  57. package/lib/codec/cosmos/authz/v1beta1/query.d.ts +2 -2
  58. package/lib/codec/cosmos/authz/v1beta1/query.js +2 -2
  59. package/lib/codec/cosmos/authz/v1beta1/tx.d.ts +1 -1
  60. package/lib/codec/cosmos/authz/v1beta1/tx.js +1 -1
  61. package/lib/codec/cosmos/bank/v1beta1/authz.d.ts +1 -1
  62. package/lib/codec/cosmos/bank/v1beta1/authz.js +1 -1
  63. package/lib/codec/cosmos/bank/v1beta1/bank.d.ts +1 -1
  64. package/lib/codec/cosmos/bank/v1beta1/bank.js +1 -1
  65. package/lib/codec/cosmos/bank/v1beta1/genesis.d.ts +2 -2
  66. package/lib/codec/cosmos/bank/v1beta1/genesis.js +2 -2
  67. package/lib/codec/cosmos/bank/v1beta1/query.d.ts +3 -3
  68. package/lib/codec/cosmos/bank/v1beta1/query.js +3 -3
  69. package/lib/codec/cosmos/bank/v1beta1/tx.d.ts +2 -2
  70. package/lib/codec/cosmos/bank/v1beta1/tx.js +2 -2
  71. package/lib/codec/cosmos/base/tendermint/v1beta1/query.d.ts +1 -1
  72. package/lib/codec/cosmos/base/tendermint/v1beta1/query.js +1 -1
  73. package/lib/codec/cosmos/capability/v1beta1/genesis.d.ts +1 -1
  74. package/lib/codec/cosmos/capability/v1beta1/genesis.js +1 -1
  75. package/lib/codec/cosmos/crisis/v1beta1/genesis.d.ts +1 -1
  76. package/lib/codec/cosmos/crisis/v1beta1/genesis.js +1 -1
  77. package/lib/codec/cosmos/distribution/v1beta1/distribution.d.ts +1 -1
  78. package/lib/codec/cosmos/distribution/v1beta1/distribution.js +1 -1
  79. package/lib/codec/cosmos/distribution/v1beta1/genesis.d.ts +2 -2
  80. package/lib/codec/cosmos/distribution/v1beta1/genesis.js +2 -2
  81. package/lib/codec/cosmos/distribution/v1beta1/query.d.ts +3 -3
  82. package/lib/codec/cosmos/distribution/v1beta1/query.js +3 -3
  83. package/lib/codec/cosmos/distribution/v1beta1/tx.d.ts +1 -1
  84. package/lib/codec/cosmos/distribution/v1beta1/tx.js +1 -1
  85. package/lib/codec/cosmos/evidence/v1beta1/query.d.ts +1 -1
  86. package/lib/codec/cosmos/evidence/v1beta1/query.js +1 -1
  87. package/lib/codec/cosmos/feegrant/v1beta1/feegrant.d.ts +1 -1
  88. package/lib/codec/cosmos/feegrant/v1beta1/feegrant.js +1 -1
  89. package/lib/codec/cosmos/feegrant/v1beta1/genesis.d.ts +1 -1
  90. package/lib/codec/cosmos/feegrant/v1beta1/genesis.js +1 -1
  91. package/lib/codec/cosmos/feegrant/v1beta1/query.d.ts +2 -2
  92. package/lib/codec/cosmos/feegrant/v1beta1/query.js +2 -2
  93. package/lib/codec/cosmos/gov/v1beta1/genesis.d.ts +1 -1
  94. package/lib/codec/cosmos/gov/v1beta1/genesis.js +1 -1
  95. package/lib/codec/cosmos/gov/v1beta1/gov.d.ts +1 -1
  96. package/lib/codec/cosmos/gov/v1beta1/gov.js +1 -1
  97. package/lib/codec/cosmos/gov/v1beta1/query.d.ts +2 -2
  98. package/lib/codec/cosmos/gov/v1beta1/query.js +4 -4
  99. package/lib/codec/cosmos/gov/v1beta1/tx.d.ts +2 -2
  100. package/lib/codec/cosmos/gov/v1beta1/tx.js +4 -4
  101. package/lib/codec/cosmos/mint/v1beta1/genesis.d.ts +1 -1
  102. package/lib/codec/cosmos/mint/v1beta1/genesis.js +1 -1
  103. package/lib/codec/cosmos/mint/v1beta1/query.d.ts +1 -1
  104. package/lib/codec/cosmos/mint/v1beta1/query.js +1 -1
  105. package/lib/codec/cosmos/params/v1beta1/query.d.ts +1 -1
  106. package/lib/codec/cosmos/params/v1beta1/query.js +1 -1
  107. package/lib/codec/cosmos/slashing/v1beta1/genesis.d.ts +1 -1
  108. package/lib/codec/cosmos/slashing/v1beta1/genesis.js +1 -1
  109. package/lib/codec/cosmos/slashing/v1beta1/query.d.ts +2 -2
  110. package/lib/codec/cosmos/slashing/v1beta1/query.js +2 -2
  111. package/lib/codec/cosmos/staking/v1beta1/authz.d.ts +1 -1
  112. package/lib/codec/cosmos/staking/v1beta1/authz.js +1 -1
  113. package/lib/codec/cosmos/staking/v1beta1/genesis.d.ts +1 -1
  114. package/lib/codec/cosmos/staking/v1beta1/genesis.js +1 -1
  115. package/lib/codec/cosmos/staking/v1beta1/query.d.ts +2 -2
  116. package/lib/codec/cosmos/staking/v1beta1/query.js +2 -2
  117. package/lib/codec/cosmos/staking/v1beta1/staking.d.ts +1 -1
  118. package/lib/codec/cosmos/staking/v1beta1/staking.js +1 -1
  119. package/lib/codec/cosmos/staking/v1beta1/tx.d.ts +2 -2
  120. package/lib/codec/cosmos/staking/v1beta1/tx.js +2 -2
  121. package/lib/codec/cosmos/tx/signing/v1beta1/signing.d.ts +1 -1
  122. package/lib/codec/cosmos/tx/signing/v1beta1/signing.js +1 -1
  123. package/lib/codec/cosmos/tx/v1beta1/service.d.ts +3 -3
  124. package/lib/codec/cosmos/tx/v1beta1/service.js +3 -3
  125. package/lib/codec/cosmos/tx/v1beta1/tx.d.ts +3 -3
  126. package/lib/codec/cosmos/tx/v1beta1/tx.js +5 -5
  127. package/lib/codec/cosmos/upgrade/v1beta1/query.d.ts +1 -1
  128. package/lib/codec/cosmos/upgrade/v1beta1/query.js +1 -1
  129. package/lib/codec/cosmos/vesting/v1beta1/tx.d.ts +1 -1
  130. package/lib/codec/cosmos/vesting/v1beta1/tx.js +1 -1
  131. package/lib/codec/cosmos/vesting/v1beta1/vesting.d.ts +2 -2
  132. package/lib/codec/cosmos/vesting/v1beta1/vesting.js +2 -2
  133. package/lib/codec/fee/genesis.d.ts +1 -1
  134. package/lib/codec/fee/genesis.js +1 -1
  135. package/lib/codec/fee/proposal.d.ts +1 -1
  136. package/lib/codec/fee/proposal.js +1 -1
  137. package/lib/codec/fee/query.d.ts +1 -1
  138. package/lib/codec/fee/query.js +1 -1
  139. package/lib/codec/fee/tx.d.ts +1 -1
  140. package/lib/codec/fee/tx.js +1 -1
  141. package/lib/codec/headersync/genesis.d.ts +1 -1
  142. package/lib/codec/headersync/genesis.js +1 -1
  143. package/lib/codec/headersync/query.d.ts +1 -1
  144. package/lib/codec/headersync/query.js +1 -1
  145. package/lib/codec/index.d.ts +89 -18
  146. package/lib/codec/index.js +463 -180
  147. package/lib/codec/inflation/genesis.d.ts +1 -1
  148. package/lib/codec/inflation/genesis.js +1 -1
  149. package/lib/codec/inflation/query.d.ts +1 -1
  150. package/lib/codec/inflation/query.js +1 -1
  151. package/lib/codec/insurance/genesis.d.ts +1 -1
  152. package/lib/codec/insurance/genesis.js +1 -1
  153. package/lib/codec/leverage/genesis.d.ts +1 -1
  154. package/lib/codec/leverage/genesis.js +1 -1
  155. package/lib/codec/leverage/query.d.ts +1 -1
  156. package/lib/codec/leverage/query.js +1 -1
  157. package/lib/codec/liquidation/genesis.d.ts +1 -1
  158. package/lib/codec/liquidation/genesis.js +1 -1
  159. package/lib/codec/liquidation/query.d.ts +1 -1
  160. package/lib/codec/liquidation/query.js +1 -1
  161. package/lib/codec/liquidation/quote_changes.d.ts +1 -1
  162. package/lib/codec/liquidation/quote_changes.js +1 -1
  163. package/lib/codec/liquiditypool/event.d.ts +2 -2
  164. package/lib/codec/liquiditypool/event.js +2 -2
  165. package/lib/codec/liquiditypool/genesis.d.ts +2 -2
  166. package/lib/codec/liquiditypool/genesis.js +2 -2
  167. package/lib/codec/liquiditypool/liquiditypool.d.ts +3 -0
  168. package/lib/codec/liquiditypool/liquiditypool.js +44 -1
  169. package/lib/codec/liquiditypool/proposal.d.ts +1 -1
  170. package/lib/codec/liquiditypool/proposal.js +1 -1
  171. package/lib/codec/liquiditypool/query.d.ts +39 -2
  172. package/lib/codec/liquiditypool/query.js +195 -3
  173. package/lib/codec/liquiditypool/tx.d.ts +3 -1
  174. package/lib/codec/liquiditypool/tx.js +35 -1
  175. package/lib/codec/lockproxy/genesis.d.ts +1 -1
  176. package/lib/codec/lockproxy/genesis.js +1 -1
  177. package/lib/codec/lockproxy/query.d.ts +1 -1
  178. package/lib/codec/lockproxy/query.js +1 -1
  179. package/lib/codec/market/event.d.ts +1 -1
  180. package/lib/codec/market/event.js +1 -1
  181. package/lib/codec/market/genesis.d.ts +1 -1
  182. package/lib/codec/market/genesis.js +1 -1
  183. package/lib/codec/market/proposal.d.ts +1 -1
  184. package/lib/codec/market/proposal.js +1 -1
  185. package/lib/codec/market/query.d.ts +1 -1
  186. package/lib/codec/market/query.js +1 -1
  187. package/lib/codec/market/tx.d.ts +1 -1
  188. package/lib/codec/market/tx.js +1 -1
  189. package/lib/codec/marketstats/genesis.d.ts +1 -1
  190. package/lib/codec/marketstats/genesis.js +1 -1
  191. package/lib/codec/marketstats/query.d.ts +2 -2
  192. package/lib/codec/marketstats/query.js +2 -2
  193. package/lib/codec/misc/message.d.ts +1 -1
  194. package/lib/codec/misc/message.js +1 -1
  195. package/lib/codec/misc/query.d.ts +3 -3
  196. package/lib/codec/misc/query.js +3 -3
  197. package/lib/codec/misc/transaction.d.ts +1 -1
  198. package/lib/codec/misc/transaction.js +1 -1
  199. package/lib/codec/oracle/event.d.ts +1 -1
  200. package/lib/codec/oracle/event.js +1 -1
  201. package/lib/codec/oracle/genesis.d.ts +4 -1
  202. package/lib/codec/oracle/genesis.js +34 -3
  203. package/lib/codec/oracle/proposal.d.ts +1 -1
  204. package/lib/codec/oracle/proposal.js +1 -1
  205. package/lib/codec/oracle/query.d.ts +2 -2
  206. package/lib/codec/oracle/query.js +2 -2
  207. package/lib/codec/order/event.d.ts +1 -1
  208. package/lib/codec/order/event.js +1 -1
  209. package/lib/codec/order/genesis.d.ts +1 -1
  210. package/lib/codec/order/genesis.js +1 -1
  211. package/lib/codec/order/query.d.ts +1 -1
  212. package/lib/codec/order/query.js +1 -1
  213. package/lib/codec/position/event.d.ts +1 -1
  214. package/lib/codec/position/event.js +1 -1
  215. package/lib/codec/position/genesis.d.ts +1 -1
  216. package/lib/codec/position/genesis.js +1 -1
  217. package/lib/codec/position/query.d.ts +1 -1
  218. package/lib/codec/position/query.js +1 -1
  219. package/lib/codec/pricing/event.d.ts +56 -1
  220. package/lib/codec/pricing/event.js +298 -2
  221. package/lib/codec/pricing/genesis.d.ts +2 -1
  222. package/lib/codec/pricing/genesis.js +20 -5
  223. package/lib/codec/pricing/legacy.d.ts +22 -0
  224. package/lib/codec/pricing/legacy.js +93 -0
  225. package/lib/codec/pricing/pricing.d.ts +14 -0
  226. package/lib/codec/pricing/pricing.js +103 -1
  227. package/lib/codec/pricing/query.d.ts +68 -1
  228. package/lib/codec/pricing/query.js +321 -2
  229. package/lib/codec/pricing/tx.d.ts +96 -0
  230. package/lib/codec/pricing/tx.js +399 -1
  231. package/lib/codec/profile/event.d.ts +1 -1
  232. package/lib/codec/profile/event.js +1 -1
  233. package/lib/codec/profile/genesis.d.ts +1 -1
  234. package/lib/codec/profile/genesis.js +1 -1
  235. package/lib/codec/profile/query.d.ts +1 -1
  236. package/lib/codec/profile/query.js +1 -1
  237. package/lib/codec/subaccount/genesis.d.ts +1 -1
  238. package/lib/codec/subaccount/genesis.js +1 -1
  239. package/lib/codec/subaccount/query.d.ts +1 -1
  240. package/lib/codec/subaccount/query.js +1 -1
  241. package/lib/codec/tendermint/abci/types.d.ts +4 -4
  242. package/lib/codec/tendermint/abci/types.js +4 -4
  243. package/lib/codec/tendermint/types/block.d.ts +2 -2
  244. package/lib/codec/tendermint/types/block.js +2 -2
  245. package/lib/codec/tendermint/types/evidence.d.ts +2 -2
  246. package/lib/codec/tendermint/types/evidence.js +2 -2
  247. package/lib/codec/tendermint/types/types.d.ts +3 -3
  248. package/lib/codec/tendermint/types/types.js +3 -3
  249. package/lib/codec/tendermint/types/validator.d.ts +1 -1
  250. package/lib/codec/tendermint/types/validator.js +1 -1
  251. package/lib/constant/generic.js +1 -1
  252. package/lib/constant/token.d.ts +4 -0
  253. package/lib/constant/token.js +5 -1
  254. package/lib/modules/admin.d.ts +114 -7
  255. package/lib/modules/admin.js +275 -53
  256. package/lib/modules/cdp.d.ts +152 -13
  257. package/lib/modules/cdp.js +800 -20
  258. package/lib/modules/gov.js +14 -14
  259. package/lib/modules/liquiditypool.d.ts +3 -0
  260. package/lib/modules/liquiditypool.js +3 -1
  261. package/lib/provider/account/EthLedgerAccount/EthLedgerAccount.js +1 -1
  262. package/lib/provider/account/NeoLedgerAccount/N3Ledger/ErrorCode.js +1 -1
  263. package/lib/provider/account/NeoLedgerAccount/N3Ledger/main.js +8 -8
  264. package/lib/provider/account/NeoLedgerAccount/NeoLedgerAccount.js +3 -3
  265. package/lib/provider/account/NeoLedgerAccount/NeonLedger.js +1 -1
  266. package/lib/provider/amino/types/admin.js +91 -26
  267. package/lib/provider/amino/types/bank.js +1 -1
  268. package/lib/provider/amino/types/broker.js +1 -1
  269. package/lib/provider/amino/types/cdp.js +135 -24
  270. package/lib/provider/amino/types/coin.js +2 -2
  271. package/lib/provider/amino/types/gov.js +4 -4
  272. package/lib/provider/amino/types/ibc.js +1 -1
  273. package/lib/provider/amino/types/leverage.js +1 -1
  274. package/lib/provider/amino/types/liquidityPool.js +9 -7
  275. package/lib/provider/amino/types/market.js +1 -1
  276. package/lib/provider/amino/types/oracle.js +1 -1
  277. package/lib/provider/amino/types/order.js +4 -4
  278. package/lib/provider/amino/types/position.js +1 -1
  279. package/lib/provider/amino/types/profile.js +1 -1
  280. package/lib/provider/amino/types/staking.js +4 -4
  281. package/lib/provider/amino/types/subaccount.js +3 -3
  282. package/lib/provider/amino/utils.js +11 -11
  283. package/lib/provider/keplr/KeplrAccount.js +5 -0
  284. package/lib/provider/keplr/KeplrStore.js +1 -1
  285. package/lib/provider/ledger/ledger.js +2 -2
  286. package/lib/provider/metamask/MetaMask.js +1 -1
  287. package/lib/provider/o3/O3Wallet.js +2 -2
  288. package/lib/util/address.d.ts +1 -0
  289. package/lib/util/address.js +21 -13
  290. package/lib/util/api.js +4 -4
  291. package/lib/util/fetch.js +1 -1
  292. package/lib/util/generic.js +3 -3
  293. package/lib/util/number.d.ts +1 -0
  294. package/lib/util/number.js +7 -6
  295. package/lib/util/tx.d.ts +75 -10
  296. package/lib/wallet/CarbonSigner.d.ts +5 -2
  297. package/lib/wallet/CarbonSigner.js +15 -2
  298. package/lib/wallet/CarbonSigningClient.js +8 -8
  299. package/lib/wallet/CarbonWallet.js +6 -7
  300. package/lib/websocket/channel.js +115 -21
  301. package/lib/websocket/connector.js +3 -3
  302. package/lib/websocket/models.d.ts +156 -0
  303. package/lib/websocket/types.d.ts +87 -3
  304. package/lib/websocket/types.js +31 -0
  305. package/package.json +1 -1
@@ -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();
@@ -93,9 +106,9 @@ class CarbonLedgerSigner {
93
106
  return __awaiter(this, void 0, void 0, function* () {
94
107
  const account = yield this.retrieveAccount();
95
108
  const { pubkey } = account;
96
- const msg = JSON.stringify((0, generic_1.sortObject)(doc));
109
+ const msg = JSON.stringify(generic_1.sortObject(doc));
97
110
  const signBytes = yield this.ledger.sign(msg);
98
- const signature = (0, amino_1.encodeSecp256k1Signature)(pubkey, signBytes);
111
+ const signature = amino_1.encodeSecp256k1Signature(pubkey, signBytes);
99
112
  return {
100
113
  signed: doc,
101
114
  signature,
@@ -87,7 +87,7 @@ class CarbonSigningClient extends stargate_1.StargateClient {
87
87
  */
88
88
  sign(signerAddress, messages, fee, memo, signerData) {
89
89
  return __awaiter(this, void 0, void 0, function* () {
90
- return (0, proto_signing_1.isOfflineDirectSigner)(this.signer)
90
+ return proto_signing_1.isOfflineDirectSigner(this.signer)
91
91
  ? this.signDirect(signerAddress, messages, fee, memo, signerData)
92
92
  : this.signAmino(signerAddress, messages, fee, memo, signerData);
93
93
  });
@@ -99,7 +99,7 @@ class CarbonSigningClient extends stargate_1.StargateClient {
99
99
  if (!accountFromSigner) {
100
100
  throw new Error("Failed to retrieve account from signer");
101
101
  }
102
- const pubkey = (0, proto_signing_1.encodePubkey)((0, amino_1.encodeSecp256k1Pubkey)(accountFromSigner.pubkey));
102
+ const pubkey = proto_signing_1.encodePubkey(amino_1.encodeSecp256k1Pubkey(accountFromSigner.pubkey));
103
103
  const txBodyEncodeObject = {
104
104
  typeUrl: "/cosmos.tx.v1beta1.TxBody",
105
105
  value: Object.assign({ messages: messages, memo: memo }, timeoutHeight && {
@@ -108,13 +108,13 @@ class CarbonSigningClient extends stargate_1.StargateClient {
108
108
  };
109
109
  const txBodyBytes = this.registry.encode(txBodyEncodeObject);
110
110
  const gasLimit = math_1.Int53.fromString(fee.gas).toNumber();
111
- const authInfoBytes = (0, proto_signing_1.makeAuthInfoBytes)([{ pubkey, sequence }], fee.amount, gasLimit);
112
- const signDoc = (0, proto_signing_1.makeSignDoc)(txBodyBytes, authInfoBytes, chainId, accountNumber);
111
+ const authInfoBytes = proto_signing_1.makeAuthInfoBytes([{ pubkey, sequence }], fee.amount, gasLimit);
112
+ const signDoc = proto_signing_1.makeSignDoc(txBodyBytes, authInfoBytes, chainId, accountNumber);
113
113
  const { signature, signed } = yield signer.signDirect(signerAddress, signDoc);
114
114
  return tx_1.TxRaw.fromPartial({
115
115
  bodyBytes: signed.bodyBytes,
116
116
  authInfoBytes: signed.authInfoBytes,
117
- signatures: [(0, encoding_1.fromBase64)(signature.signature)],
117
+ signatures: [encoding_1.fromBase64(signature.signature)],
118
118
  });
119
119
  });
120
120
  }
@@ -125,7 +125,7 @@ class CarbonSigningClient extends stargate_1.StargateClient {
125
125
  if (!accountFromSigner) {
126
126
  throw new Error("Failed to retrieve account from signer");
127
127
  }
128
- const pubkey = (0, proto_signing_1.encodePubkey)((0, amino_1.encodeSecp256k1Pubkey)(accountFromSigner.pubkey));
128
+ const pubkey = proto_signing_1.encodePubkey(amino_1.encodeSecp256k1Pubkey(accountFromSigner.pubkey));
129
129
  const signMode = SignMode.SIGN_MODE_LEGACY_AMINO_JSON;
130
130
  const msgs = messages.map((msg) => this.aminoTypes.toAmino(msg));
131
131
  const signDoc = makeSignDocAmino(msgs, fee, chainId, memo, accountNumber, sequence, timeoutHeight !== null && timeoutHeight !== void 0 ? timeoutHeight : 0);
@@ -140,11 +140,11 @@ class CarbonSigningClient extends stargate_1.StargateClient {
140
140
  const signedTxBodyBytes = this.registry.encode(signedTxBodyEncodeObject);
141
141
  const signedGasLimit = math_1.Int53.fromString(signed.fee.gas).toNumber();
142
142
  const signedSequence = math_1.Int53.fromString(signed.sequence).toNumber();
143
- const signedAuthInfoBytes = (0, proto_signing_1.makeAuthInfoBytes)([{ pubkey, sequence: signedSequence }], signed.fee.amount, signedGasLimit, signMode);
143
+ const signedAuthInfoBytes = proto_signing_1.makeAuthInfoBytes([{ pubkey, sequence: signedSequence }], signed.fee.amount, signedGasLimit, signMode);
144
144
  return tx_1.TxRaw.fromPartial({
145
145
  bodyBytes: signedTxBodyBytes,
146
146
  authInfoBytes: signedAuthInfoBytes,
147
- signatures: [(0, encoding_1.fromBase64)(signature.signature)],
147
+ signatures: [encoding_1.fromBase64(signature.signature)],
148
148
  });
149
149
  });
150
150
  }
@@ -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 = (0, amino_1.encodeSecp256k1Signature)(account.pubkey, txRaw.signatures[0]);
151
+ signature = amino_1.encodeSecp256k1Signature(account.pubkey, txRaw.signatures[0]);
152
152
  return txRaw;
153
153
  }
154
154
  finally {
@@ -166,9 +166,8 @@ 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 ((0, stargate_1.isDeliverTxFailure)(response)) {
169
+ if (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;
@@ -206,9 +205,9 @@ class CarbonWallet {
206
205
  try {
207
206
  if (!this.accountInfo || this.sequenceInvalidated)
208
207
  yield this.reloadAccountSequence();
209
- const heightResponse = yield (0, fetch_1.fetch)(`${this.networkConfig.tmRpcUrl}/blockchain?cache=${new Date().getTime()}`);
208
+ const heightResponse = yield fetch_1.fetch(`${this.networkConfig.tmRpcUrl}/blockchain?cache=${new Date().getTime()}`);
210
209
  const heightRes = yield heightResponse.json();
211
- const height = (0, number_1.bnOrZero)((_a = heightRes.result) === null || _a === void 0 ? void 0 : _a.last_height);
210
+ const height = number_1.bnOrZero((_a = heightRes.result) === null || _a === void 0 ? void 0 : _a.last_height);
212
211
  const timeoutHeight = height.isZero() ? undefined : height.toNumber() + this.defaultTimeoutBlocks;
213
212
  const sequence = this.accountInfo.sequence;
214
213
  this.accountInfo = Object.assign(Object.assign({}, this.accountInfo), { sequence: sequence + 1 });
@@ -342,12 +341,12 @@ class CarbonWallet {
342
341
  const queryClient = this.getQueryClient();
343
342
  const { msgGasCosts } = yield queryClient.fee.MsgGasCostAll({});
344
343
  this.txGasCosts = msgGasCosts.reduce((result, item) => {
345
- result[item.msgType] = (0, number_1.bnOrZero)(item.gasCost);
344
+ result[item.msgType] = number_1.bnOrZero(item.gasCost);
346
345
  return result;
347
346
  }, {});
348
347
  const { minGasPrices } = yield queryClient.fee.MinGasPriceAll({});
349
348
  this.txGasPrices = minGasPrices.reduce((result, item) => {
350
- result[item.denom] = (0, number_1.bnOrZero)(item.gasPrice).shiftedBy(-18); // sdk.Dec shifting
349
+ result[item.denom] = number_1.bnOrZero(item.gasPrice).shiftedBy(-18); // sdk.Dec shifting
351
350
  return result;
352
351
  }, {});
353
352
  if (!this.txGasPrices[this.defaultFeeDenom]) {
@@ -68,60 +68,104 @@ const generateChannelId = (params) => {
68
68
  const { channel, id } = params;
69
69
  return [channel, id].join(':');
70
70
  }
71
+ case types_1.WSChannel.token_prices: {
72
+ const { channel } = params;
73
+ return [channel].join(':');
74
+ }
75
+ case types_1.WSChannel.token_prices_by_denom: {
76
+ const { channel, denom } = params;
77
+ return [channel, denom].join(':');
78
+ }
71
79
  case types_1.WSChannel.commitments: {
72
80
  const { channel, address } = params;
73
81
  return [channel, address].join(':');
74
82
  }
83
+ case types_1.WSChannel.cdp_borrows: {
84
+ const { channel, address } = params;
85
+ return [channel, address].join(':');
86
+ }
87
+ case types_1.WSChannel.cdp_collaterals: {
88
+ const { channel, address } = params;
89
+ return [channel, address].join(':');
90
+ }
91
+ case types_1.WSChannel.cdp_liquidate_collaterals: {
92
+ const { channel } = params;
93
+ return [channel].join(':');
94
+ }
95
+ case types_1.WSChannel.cdp_token_debts: {
96
+ const { channel } = params;
97
+ return [channel].join(':');
98
+ }
99
+ case types_1.WSChannel.cdp_token_debts_by_denom: {
100
+ const { channel, denom } = params;
101
+ return [channel, denom].join(':');
102
+ }
103
+ case types_1.WSChannel.cdp_reward_schemes: {
104
+ const { channel } = params;
105
+ return [channel].join(':');
106
+ }
107
+ case types_1.WSChannel.cdp_reward_debts: {
108
+ const { channel, address } = params;
109
+ return [channel, address].join(':');
110
+ }
111
+ case types_1.WSChannel.cdp_token_supply: {
112
+ const { channel } = params;
113
+ return [channel].join(':');
114
+ }
115
+ case types_1.WSChannel.cdp_token_supply_by_denom: {
116
+ const { channel, denom } = params;
117
+ return [channel, denom].join(':');
118
+ }
75
119
  default:
76
120
  throw new Error(`invalid subscription channel: ${params.channel}`);
77
121
  }
78
122
  };
79
123
  exports.generateChannelId = generateChannelId;
80
124
  const parseChannelId = (rawChannelId) => {
81
- const [channel, market, resolution, address, id] = rawChannelId.split(':');
125
+ const [channel, param0, param1] = rawChannelId.split(':');
82
126
  switch (channel) {
83
127
  case types_1.WSChannel.candlesticks:
84
128
  return {
85
129
  channel,
86
- market,
87
- resolution,
130
+ market: param0,
131
+ resolution: param1,
88
132
  };
89
133
  case types_1.WSChannel.books:
90
134
  return {
91
135
  channel,
92
- market,
136
+ market: param0,
93
137
  };
94
138
  case types_1.WSChannel.recent_trades:
95
139
  return {
96
140
  channel,
97
- market,
141
+ market: param0,
98
142
  };
99
143
  case types_1.WSChannel.orders:
100
144
  return {
101
145
  channel,
102
- address,
146
+ address: param0,
103
147
  };
104
148
  case types_1.WSChannel.orders_by_market:
105
149
  return {
106
150
  channel,
107
- market,
108
- address,
151
+ market: param0,
152
+ address: param1,
109
153
  };
110
154
  case types_1.WSChannel.balances:
111
155
  return {
112
156
  channel,
113
- address,
157
+ address: param0,
114
158
  };
115
159
  case types_1.WSChannel.account_trades:
116
160
  return {
117
161
  channel,
118
- address,
162
+ address: param0,
119
163
  };
120
164
  case types_1.WSChannel.account_trades_by_market:
121
165
  return {
122
166
  channel,
123
- market,
124
- address,
167
+ market: param0,
168
+ address: param1,
125
169
  };
126
170
  case types_1.WSChannel.market_stats:
127
171
  return {
@@ -130,29 +174,29 @@ const parseChannelId = (rawChannelId) => {
130
174
  case types_1.WSChannel.market_stats_by_market:
131
175
  return {
132
176
  channel,
133
- market,
177
+ market: param0,
134
178
  };
135
179
  case types_1.WSChannel.leverages:
136
180
  return {
137
181
  channel,
138
- address,
182
+ address: param0,
139
183
  };
140
184
  case types_1.WSChannel.leverages_by_market:
141
185
  return {
142
186
  channel,
143
- market,
144
- address,
187
+ market: param0,
188
+ address: param1,
145
189
  };
146
190
  case types_1.WSChannel.positions:
147
191
  return {
148
192
  channel,
149
- address,
193
+ address: param0,
150
194
  };
151
195
  case types_1.WSChannel.positions_by_market:
152
196
  return {
153
197
  channel,
154
- market,
155
- address,
198
+ market: param0,
199
+ address: param1,
156
200
  };
157
201
  case types_1.WSChannel.pools:
158
202
  return {
@@ -161,12 +205,62 @@ const parseChannelId = (rawChannelId) => {
161
205
  case types_1.WSChannel.pools_by_id:
162
206
  return {
163
207
  channel,
164
- id,
208
+ id: param0,
165
209
  };
166
210
  case types_1.WSChannel.commitments:
167
211
  return {
168
212
  channel,
169
- address,
213
+ address: param0,
214
+ };
215
+ case types_1.WSChannel.token_prices:
216
+ return {
217
+ channel,
218
+ };
219
+ case types_1.WSChannel.token_prices:
220
+ return {
221
+ channel,
222
+ denom: param0,
223
+ };
224
+ case types_1.WSChannel.cdp_borrows:
225
+ return {
226
+ channel,
227
+ address: param0,
228
+ };
229
+ case types_1.WSChannel.cdp_collaterals:
230
+ return {
231
+ channel,
232
+ address: param0,
233
+ };
234
+ case types_1.WSChannel.cdp_liquidate_collaterals:
235
+ return {
236
+ channel,
237
+ };
238
+ case types_1.WSChannel.cdp_token_debts:
239
+ return {
240
+ channel,
241
+ };
242
+ case types_1.WSChannel.cdp_token_debts_by_denom:
243
+ return {
244
+ channel,
245
+ denom: param0,
246
+ };
247
+ case types_1.WSChannel.cdp_reward_schemes:
248
+ return {
249
+ channel,
250
+ };
251
+ case types_1.WSChannel.cdp_reward_debts:
252
+ return {
253
+ channel,
254
+ address: param0,
255
+ };
256
+ case types_1.WSChannel.cdp_token_supply:
257
+ return {
258
+ channel,
259
+ };
260
+ case types_1.WSChannel.cdp_token_supply_by_denom:
261
+ return {
262
+ channel,
263
+ denom: param0,
170
264
  };
171
265
  default:
172
266
  throw new Error('Error parsing channelId');
@@ -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 = (0, channel_1.generateChannelId)(param);
174
+ const channelId = 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 = (0, channel_1.generateChannelId)(param);
196
+ const channelId = 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 = (0, channel_1.parseChannelId)(message.channel);
282
+ const params = channel_1.parseChannelId(message.channel);
283
283
  this.unsubscribe({ channel: params.channel });
284
284
  }
285
285
  catch (error) {
@@ -143,6 +143,9 @@ export interface Pool {
143
143
  num_quotes: number;
144
144
  shares_amount: string;
145
145
  market: string;
146
+ amp_bps: string;
147
+ v_amount_a: string;
148
+ v_amount_b: string;
146
149
  };
147
150
  rewards_weight: string;
148
151
  total_commitment: string;
@@ -160,3 +163,156 @@ export interface Commitment {
160
163
  export interface CommitmentEvent extends Commitment {
161
164
  Type?: string;
162
165
  }
166
+ export interface TokenPrice {
167
+ denom: string;
168
+ index: string;
169
+ index_updated_at: string;
170
+ twap: string;
171
+ }
172
+ export interface CDPParams {
173
+ interest_fee: string;
174
+ liquidation_fee: string;
175
+ stablecoin_interest_rate: string;
176
+ complete_liquidation_threshold: string;
177
+ minimum_close_factor: string;
178
+ small_liquidation_size: string;
179
+ }
180
+ export interface RateStrategy {
181
+ name: string;
182
+ optimal_usage: string;
183
+ base_variable_borrow_rate: string;
184
+ variable_rate_slope_1: string;
185
+ variable_rate_slope_2: string;
186
+ base_stable_borrow_rate: string;
187
+ stable_rate_slope_1: string;
188
+ stable_rate_slope_2: string;
189
+ optimal_stable_to_total_debt_ratio: string;
190
+ }
191
+ /**
192
+ * @deprecated old websocket response struct for get_cdp_assets_all
193
+ * use AssetParams instead
194
+ */
195
+ export interface Asset {
196
+ asset_params: {
197
+ denom: string;
198
+ oracle_id: string;
199
+ rate_strategy_name: string;
200
+ loan_to_value: string;
201
+ liquidation_threshold: string;
202
+ liquidation_bonus: string;
203
+ supply_cap: string;
204
+ borrow_cap: string;
205
+ };
206
+ asset_utilization: {
207
+ denom: string;
208
+ total_borrowed: string;
209
+ total_amount: string;
210
+ utilization_rate: string;
211
+ };
212
+ }
213
+ export interface AssetParams {
214
+ denom: string;
215
+ oracle_id: string;
216
+ rate_strategy_name: string;
217
+ allow_repay_stablecoin_interest_debt: boolean;
218
+ loan_to_value: string;
219
+ liquidation_threshold: string;
220
+ liquidation_discount: string;
221
+ supply_cap: string;
222
+ borrow_cap: string;
223
+ }
224
+ export interface Collateral {
225
+ cdp_denom: string;
226
+ denom: string;
227
+ collateral_amount: string;
228
+ }
229
+ export interface Debt {
230
+ denom: string;
231
+ principal_debt: string;
232
+ initial_cumulative_interest_multiplier: string;
233
+ }
234
+ export interface AccountData {
235
+ total_collaterals_usd: string;
236
+ total_debts_usd: string;
237
+ available_borrows_usd: string;
238
+ curr_liquidation_threshold: string;
239
+ health_factor: string;
240
+ }
241
+ export interface CDPAccountStablecoin {
242
+ principal_debt: string;
243
+ interest_debt: string;
244
+ initial_cumulative_interest_multiplier: string;
245
+ }
246
+ /**
247
+ * Response for get_cdp_total_borrows and get_cdp_borrows
248
+ * Do not confuse with Debt
249
+ */
250
+ export interface CDPBorrow {
251
+ address: string;
252
+ amount: string;
253
+ denom: string;
254
+ type: string;
255
+ initial_cumulative_interest_multiplier?: string;
256
+ }
257
+ /**
258
+ * Response for get_cdp_total_collaterals and get_cdp_collaterals
259
+ * Do not confuse with Collateral
260
+ */
261
+ export interface CDPCollateral {
262
+ address: string;
263
+ amount: string;
264
+ denom: string;
265
+ }
266
+ export interface CDPDebtInfo {
267
+ denom: string;
268
+ last_updated_time: string;
269
+ total_principal: string;
270
+ cumulative_interest_multiplier: string;
271
+ total_accumulated_interest: string;
272
+ utilization_rate: string;
273
+ }
274
+ export interface CDPStableCoinDebtInfo {
275
+ denom: string;
276
+ last_updated_time: string;
277
+ total_principal: string;
278
+ cumulative_interest_multiplier: string;
279
+ total_accumulated_interest: string;
280
+ }
281
+ export interface CDPLiquidation {
282
+ liquidator: string;
283
+ debtor: string;
284
+ collateral_denom: string;
285
+ collateral_amount_liquidated: string;
286
+ collateral_amount_liquidator: string;
287
+ collateral_amount_fee: string;
288
+ liquidation_price: string;
289
+ market_price: string;
290
+ discount: string;
291
+ debt_denom: string;
292
+ debt_amount: string;
293
+ block_height: number;
294
+ block_time: string;
295
+ transaction_hash: string;
296
+ }
297
+ export interface RewardScheme {
298
+ id: number;
299
+ creator: string;
300
+ reward_denom: string;
301
+ asset_denom: string;
302
+ reward_type: string;
303
+ reward_amount_per_second: string;
304
+ start_time: string;
305
+ end_time: string;
306
+ reward_per_share_last_updated_at: string;
307
+ reward_per_share: string;
308
+ }
309
+ export interface RewardDebt {
310
+ user_address: string;
311
+ reward_scheme_id: number;
312
+ reward_debt: string;
313
+ last_updated_at: string;
314
+ }
315
+ export interface CDPTokenSupply {
316
+ cdp_denom: string;
317
+ amount: string;
318
+ }