carbon-js-sdk 0.2.13 → 0.2.14-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 (267) hide show
  1. package/lib/clients/NEOClient.js +1 -1
  2. package/lib/clients/TokenClient.d.ts +5 -0
  3. package/lib/clients/TokenClient.js +29 -7
  4. package/lib/codec/book/genesis.d.ts +1 -1
  5. package/lib/codec/book/genesis.js +1 -1
  6. package/lib/codec/book/query.d.ts +1 -1
  7. package/lib/codec/book/query.js +1 -1
  8. package/lib/codec/broker/genesis.d.ts +1 -1
  9. package/lib/codec/broker/genesis.js +1 -1
  10. package/lib/codec/broker/query.d.ts +3 -3
  11. package/lib/codec/broker/query.js +3 -3
  12. package/lib/codec/btcx/denom_cross_chain_info.d.ts +1 -1
  13. package/lib/codec/btcx/denom_cross_chain_info.js +1 -1
  14. package/lib/codec/btcx/query.d.ts +1 -1
  15. package/lib/codec/btcx/query.js +1 -1
  16. package/lib/codec/ccm/genesis.d.ts +1 -1
  17. package/lib/codec/ccm/genesis.js +1 -1
  18. package/lib/codec/cdp/asset_params.d.ts +1 -12
  19. package/lib/codec/cdp/asset_params.js +14 -81
  20. package/lib/codec/cdp/debt_info.d.ts +1 -1
  21. package/lib/codec/cdp/debt_info.js +11 -13
  22. package/lib/codec/cdp/event.d.ts +321 -22
  23. package/lib/codec/cdp/event.js +2005 -82
  24. package/lib/codec/cdp/genesis.d.ts +80 -4
  25. package/lib/codec/cdp/genesis.js +531 -22
  26. package/lib/codec/cdp/params.d.ts +35 -0
  27. package/lib/codec/cdp/params.js +47 -1
  28. package/lib/codec/cdp/query.d.ts +437 -89
  29. package/lib/codec/cdp/query.js +1966 -177
  30. package/lib/codec/cdp/reward_scheme.d.ts +85 -0
  31. package/lib/codec/cdp/reward_scheme.js +656 -0
  32. package/lib/codec/cdp/stablecoin_debt_info.d.ts +1 -1
  33. package/lib/codec/cdp/stablecoin_debt_info.js +11 -13
  34. package/lib/codec/cdp/tx.d.ts +667 -96
  35. package/lib/codec/cdp/tx.js +3196 -243
  36. package/lib/codec/coin/event.d.ts +1 -1
  37. package/lib/codec/coin/event.js +1 -1
  38. package/lib/codec/coin/genesis.d.ts +2 -2
  39. package/lib/codec/coin/genesis.js +2 -2
  40. package/lib/codec/coin/proposal.d.ts +1 -1
  41. package/lib/codec/coin/proposal.js +1 -1
  42. package/lib/codec/coin/query.d.ts +2 -5
  43. package/lib/codec/coin/query.js +2 -8
  44. package/lib/codec/coin/token.d.ts +11 -0
  45. package/lib/codec/coin/token.js +65 -1
  46. package/lib/codec/coin/tx.d.ts +1 -1
  47. package/lib/codec/coin/tx.js +1 -1
  48. package/lib/codec/cosmos/auth/v1beta1/genesis.d.ts +1 -1
  49. package/lib/codec/cosmos/auth/v1beta1/genesis.js +1 -1
  50. package/lib/codec/cosmos/auth/v1beta1/query.d.ts +2 -2
  51. package/lib/codec/cosmos/auth/v1beta1/query.js +2 -2
  52. package/lib/codec/cosmos/authz/v1beta1/authz.d.ts +19 -0
  53. package/lib/codec/cosmos/authz/v1beta1/authz.js +89 -1
  54. package/lib/codec/cosmos/authz/v1beta1/genesis.d.ts +1 -15
  55. package/lib/codec/cosmos/authz/v1beta1/genesis.js +7 -120
  56. package/lib/codec/cosmos/authz/v1beta1/query.d.ts +70 -2
  57. package/lib/codec/cosmos/authz/v1beta1/query.js +275 -3
  58. package/lib/codec/cosmos/authz/v1beta1/tx.d.ts +1 -1
  59. package/lib/codec/cosmos/authz/v1beta1/tx.js +1 -1
  60. package/lib/codec/cosmos/bank/v1beta1/authz.d.ts +1 -1
  61. package/lib/codec/cosmos/bank/v1beta1/authz.js +1 -1
  62. package/lib/codec/cosmos/bank/v1beta1/bank.d.ts +1 -1
  63. package/lib/codec/cosmos/bank/v1beta1/bank.js +1 -1
  64. package/lib/codec/cosmos/bank/v1beta1/export.d.ts +1 -1
  65. package/lib/codec/cosmos/bank/v1beta1/export.js +3 -1
  66. package/lib/codec/cosmos/bank/v1beta1/genesis.d.ts +2 -2
  67. package/lib/codec/cosmos/bank/v1beta1/genesis.js +2 -2
  68. package/lib/codec/cosmos/bank/v1beta1/query.d.ts +43 -3
  69. package/lib/codec/cosmos/bank/v1beta1/query.js +140 -4
  70. package/lib/codec/cosmos/bank/v1beta1/tx.d.ts +2 -2
  71. package/lib/codec/cosmos/bank/v1beta1/tx.js +2 -2
  72. package/lib/codec/cosmos/base/snapshots/v1beta1/snapshot.d.ts +64 -0
  73. package/lib/codec/cosmos/base/snapshots/v1beta1/snapshot.js +343 -1
  74. package/lib/codec/cosmos/base/tendermint/v1beta1/query.d.ts +1 -1
  75. package/lib/codec/cosmos/base/tendermint/v1beta1/query.js +1 -1
  76. package/lib/codec/cosmos/capability/v1beta1/genesis.d.ts +1 -1
  77. package/lib/codec/cosmos/capability/v1beta1/genesis.js +1 -1
  78. package/lib/codec/cosmos/crisis/v1beta1/genesis.d.ts +1 -1
  79. package/lib/codec/cosmos/crisis/v1beta1/genesis.js +1 -1
  80. package/lib/codec/cosmos/distribution/v1beta1/distribution.d.ts +1 -1
  81. package/lib/codec/cosmos/distribution/v1beta1/distribution.js +1 -1
  82. package/lib/codec/cosmos/distribution/v1beta1/genesis.d.ts +2 -2
  83. package/lib/codec/cosmos/distribution/v1beta1/genesis.js +2 -2
  84. package/lib/codec/cosmos/distribution/v1beta1/query.d.ts +3 -3
  85. package/lib/codec/cosmos/distribution/v1beta1/query.js +3 -3
  86. package/lib/codec/cosmos/distribution/v1beta1/tx.d.ts +1 -1
  87. package/lib/codec/cosmos/distribution/v1beta1/tx.js +1 -1
  88. package/lib/codec/cosmos/evidence/v1beta1/query.d.ts +1 -1
  89. package/lib/codec/cosmos/evidence/v1beta1/query.js +1 -1
  90. package/lib/codec/cosmos/feegrant/v1beta1/feegrant.d.ts +1 -1
  91. package/lib/codec/cosmos/feegrant/v1beta1/feegrant.js +1 -1
  92. package/lib/codec/cosmos/feegrant/v1beta1/genesis.d.ts +1 -1
  93. package/lib/codec/cosmos/feegrant/v1beta1/genesis.js +1 -1
  94. package/lib/codec/cosmos/feegrant/v1beta1/query.d.ts +35 -2
  95. package/lib/codec/cosmos/feegrant/v1beta1/query.js +139 -3
  96. package/lib/codec/cosmos/gov/v1beta1/genesis.d.ts +1 -1
  97. package/lib/codec/cosmos/gov/v1beta1/genesis.js +1 -1
  98. package/lib/codec/cosmos/gov/v1beta1/gov.d.ts +1 -1
  99. package/lib/codec/cosmos/gov/v1beta1/gov.js +1 -1
  100. package/lib/codec/cosmos/gov/v1beta1/query.d.ts +2 -2
  101. package/lib/codec/cosmos/gov/v1beta1/query.js +2 -2
  102. package/lib/codec/cosmos/gov/v1beta1/tx.d.ts +2 -2
  103. package/lib/codec/cosmos/gov/v1beta1/tx.js +2 -2
  104. package/lib/codec/cosmos/mint/v1beta1/genesis.d.ts +1 -1
  105. package/lib/codec/cosmos/mint/v1beta1/genesis.js +1 -1
  106. package/lib/codec/cosmos/mint/v1beta1/query.d.ts +1 -1
  107. package/lib/codec/cosmos/mint/v1beta1/query.js +1 -1
  108. package/lib/codec/cosmos/params/v1beta1/query.d.ts +1 -1
  109. package/lib/codec/cosmos/params/v1beta1/query.js +1 -1
  110. package/lib/codec/cosmos/slashing/v1beta1/genesis.d.ts +1 -1
  111. package/lib/codec/cosmos/slashing/v1beta1/genesis.js +1 -1
  112. package/lib/codec/cosmos/slashing/v1beta1/query.d.ts +2 -2
  113. package/lib/codec/cosmos/slashing/v1beta1/query.js +2 -2
  114. package/lib/codec/cosmos/staking/v1beta1/authz.d.ts +1 -1
  115. package/lib/codec/cosmos/staking/v1beta1/authz.js +1 -1
  116. package/lib/codec/cosmos/staking/v1beta1/genesis.d.ts +1 -1
  117. package/lib/codec/cosmos/staking/v1beta1/genesis.js +1 -1
  118. package/lib/codec/cosmos/staking/v1beta1/query.d.ts +2 -2
  119. package/lib/codec/cosmos/staking/v1beta1/query.js +2 -2
  120. package/lib/codec/cosmos/staking/v1beta1/staking.d.ts +1 -1
  121. package/lib/codec/cosmos/staking/v1beta1/staking.js +1 -1
  122. package/lib/codec/cosmos/staking/v1beta1/tx.d.ts +2 -2
  123. package/lib/codec/cosmos/staking/v1beta1/tx.js +2 -2
  124. package/lib/codec/cosmos/tx/signing/v1beta1/signing.d.ts +14 -1
  125. package/lib/codec/cosmos/tx/signing/v1beta1/signing.js +19 -1
  126. package/lib/codec/cosmos/tx/v1beta1/export.d.ts +1 -1
  127. package/lib/codec/cosmos/tx/v1beta1/export.js +3 -1
  128. package/lib/codec/cosmos/tx/v1beta1/service.d.ts +53 -5
  129. package/lib/codec/cosmos/tx/v1beta1/service.js +179 -4
  130. package/lib/codec/cosmos/tx/v1beta1/tx.d.ts +3 -3
  131. package/lib/codec/cosmos/tx/v1beta1/tx.js +3 -3
  132. package/lib/codec/cosmos/upgrade/v1beta1/query.d.ts +1 -1
  133. package/lib/codec/cosmos/upgrade/v1beta1/query.js +1 -1
  134. package/lib/codec/cosmos/vesting/v1beta1/tx.d.ts +1 -1
  135. package/lib/codec/cosmos/vesting/v1beta1/tx.js +1 -1
  136. package/lib/codec/cosmos/vesting/v1beta1/vesting.d.ts +2 -2
  137. package/lib/codec/cosmos/vesting/v1beta1/vesting.js +2 -2
  138. package/lib/codec/fee/genesis.d.ts +1 -1
  139. package/lib/codec/fee/genesis.js +1 -1
  140. package/lib/codec/fee/proposal.d.ts +1 -1
  141. package/lib/codec/fee/proposal.js +1 -1
  142. package/lib/codec/fee/query.d.ts +1 -1
  143. package/lib/codec/fee/query.js +1 -1
  144. package/lib/codec/fee/tx.d.ts +1 -1
  145. package/lib/codec/fee/tx.js +1 -1
  146. package/lib/codec/headersync/genesis.d.ts +1 -1
  147. package/lib/codec/headersync/genesis.js +1 -1
  148. package/lib/codec/headersync/query.d.ts +1 -1
  149. package/lib/codec/headersync/query.js +1 -1
  150. package/lib/codec/index.d.ts +71 -23
  151. package/lib/codec/index.js +590 -384
  152. package/lib/codec/inflation/genesis.d.ts +1 -1
  153. package/lib/codec/inflation/genesis.js +1 -1
  154. package/lib/codec/inflation/query.d.ts +1 -1
  155. package/lib/codec/inflation/query.js +1 -1
  156. package/lib/codec/insurance/genesis.d.ts +1 -1
  157. package/lib/codec/insurance/genesis.js +1 -1
  158. package/lib/codec/leverage/genesis.d.ts +1 -1
  159. package/lib/codec/leverage/genesis.js +1 -1
  160. package/lib/codec/leverage/query.d.ts +1 -1
  161. package/lib/codec/leverage/query.js +1 -1
  162. package/lib/codec/liquidation/genesis.d.ts +1 -1
  163. package/lib/codec/liquidation/genesis.js +1 -1
  164. package/lib/codec/liquidation/query.d.ts +1 -1
  165. package/lib/codec/liquidation/query.js +1 -1
  166. package/lib/codec/liquidation/quote_changes.d.ts +1 -1
  167. package/lib/codec/liquidation/quote_changes.js +1 -1
  168. package/lib/codec/liquiditypool/event.d.ts +2 -2
  169. package/lib/codec/liquiditypool/event.js +2 -2
  170. package/lib/codec/liquiditypool/genesis.d.ts +2 -2
  171. package/lib/codec/liquiditypool/genesis.js +2 -2
  172. package/lib/codec/liquiditypool/proposal.d.ts +1 -1
  173. package/lib/codec/liquiditypool/proposal.js +1 -1
  174. package/lib/codec/liquiditypool/query.d.ts +2 -2
  175. package/lib/codec/liquiditypool/query.js +2 -2
  176. package/lib/codec/liquiditypool/tx.d.ts +1 -1
  177. package/lib/codec/liquiditypool/tx.js +1 -1
  178. package/lib/codec/lockproxy/genesis.d.ts +1 -1
  179. package/lib/codec/lockproxy/genesis.js +1 -1
  180. package/lib/codec/lockproxy/query.d.ts +1 -1
  181. package/lib/codec/lockproxy/query.js +1 -1
  182. package/lib/codec/market/event.d.ts +1 -1
  183. package/lib/codec/market/event.js +1 -1
  184. package/lib/codec/market/genesis.d.ts +2 -1
  185. package/lib/codec/market/genesis.js +20 -2
  186. package/lib/codec/market/proposal.d.ts +1 -1
  187. package/lib/codec/market/proposal.js +1 -1
  188. package/lib/codec/market/query.d.ts +1 -1
  189. package/lib/codec/market/query.js +1 -1
  190. package/lib/codec/market/tx.d.ts +1 -1
  191. package/lib/codec/market/tx.js +1 -1
  192. package/lib/codec/marketstats/genesis.d.ts +1 -1
  193. package/lib/codec/marketstats/genesis.js +1 -1
  194. package/lib/codec/marketstats/query.d.ts +2 -2
  195. package/lib/codec/marketstats/query.js +2 -2
  196. package/lib/codec/misc/message.d.ts +1 -1
  197. package/lib/codec/misc/message.js +1 -1
  198. package/lib/codec/misc/query.d.ts +3 -3
  199. package/lib/codec/misc/query.js +3 -3
  200. package/lib/codec/misc/trade.d.ts +1 -0
  201. package/lib/codec/misc/trade.js +17 -0
  202. package/lib/codec/misc/transaction.d.ts +1 -1
  203. package/lib/codec/misc/transaction.js +1 -1
  204. package/lib/codec/oracle/event.d.ts +1 -1
  205. package/lib/codec/oracle/event.js +1 -1
  206. package/lib/codec/oracle/genesis.d.ts +1 -1
  207. package/lib/codec/oracle/genesis.js +1 -1
  208. package/lib/codec/oracle/proposal.d.ts +1 -1
  209. package/lib/codec/oracle/proposal.js +1 -1
  210. package/lib/codec/oracle/query.d.ts +2 -2
  211. package/lib/codec/oracle/query.js +2 -2
  212. package/lib/codec/order/event.d.ts +1 -1
  213. package/lib/codec/order/event.js +1 -1
  214. package/lib/codec/order/genesis.d.ts +1 -1
  215. package/lib/codec/order/genesis.js +1 -1
  216. package/lib/codec/order/query.d.ts +1 -1
  217. package/lib/codec/order/query.js +1 -1
  218. package/lib/codec/position/event.d.ts +1 -1
  219. package/lib/codec/position/event.js +1 -1
  220. package/lib/codec/position/genesis.d.ts +1 -1
  221. package/lib/codec/position/genesis.js +1 -1
  222. package/lib/codec/position/query.d.ts +1 -1
  223. package/lib/codec/position/query.js +1 -1
  224. package/lib/codec/pricing/event.d.ts +11 -1
  225. package/lib/codec/pricing/event.js +52 -2
  226. package/lib/codec/pricing/genesis.d.ts +2 -1
  227. package/lib/codec/pricing/genesis.js +20 -5
  228. package/lib/codec/pricing/pricing.d.ts +13 -0
  229. package/lib/codec/pricing/pricing.js +83 -1
  230. package/lib/codec/pricing/query.d.ts +68 -1
  231. package/lib/codec/pricing/query.js +321 -2
  232. package/lib/codec/profile/event.d.ts +1 -1
  233. package/lib/codec/profile/event.js +1 -1
  234. package/lib/codec/profile/genesis.d.ts +1 -1
  235. package/lib/codec/profile/genesis.js +1 -1
  236. package/lib/codec/profile/query.d.ts +1 -1
  237. package/lib/codec/profile/query.js +1 -1
  238. package/lib/codec/subaccount/genesis.d.ts +1 -1
  239. package/lib/codec/subaccount/genesis.js +1 -1
  240. package/lib/codec/subaccount/query.d.ts +1 -1
  241. package/lib/codec/subaccount/query.js +1 -1
  242. package/lib/codec/tendermint/abci/types.d.ts +4 -4
  243. package/lib/codec/tendermint/abci/types.js +4 -4
  244. package/lib/codec/tendermint/types/block.d.ts +2 -2
  245. package/lib/codec/tendermint/types/block.js +2 -2
  246. package/lib/codec/tendermint/types/evidence.d.ts +2 -2
  247. package/lib/codec/tendermint/types/evidence.js +2 -2
  248. package/lib/codec/tendermint/types/types.d.ts +3 -3
  249. package/lib/codec/tendermint/types/types.js +3 -3
  250. package/lib/codec/tendermint/types/validator.d.ts +1 -1
  251. package/lib/codec/tendermint/types/validator.js +1 -1
  252. package/lib/modules/admin.d.ts +53 -1
  253. package/lib/modules/admin.js +175 -43
  254. package/lib/modules/cdp.d.ts +104 -13
  255. package/lib/modules/cdp.js +618 -20
  256. package/lib/provider/amino/types/admin.js +48 -7
  257. package/lib/provider/amino/types/cdp.js +72 -32
  258. package/lib/util/number.d.ts +1 -0
  259. package/lib/util/number.js +2 -1
  260. package/lib/util/tx.d.ts +58 -14
  261. package/lib/wallet/CarbonSigningClient.js +27 -2
  262. package/lib/wallet/CarbonWallet.js +0 -1
  263. package/lib/websocket/channel.js +60 -0
  264. package/lib/websocket/models.d.ts +179 -21
  265. package/lib/websocket/types.d.ts +69 -3
  266. package/lib/websocket/types.js +27 -0
  267. package/package.json +1 -1
@@ -37,8 +37,8 @@ const util_1 = require("../util");
37
37
  const address_1 = require("../util/address");
38
38
  const blockchain_1 = require("../util/blockchain");
39
39
  const generic_1 = require("../util/generic");
40
- const neon_js_1 = require("@cityofzion/neon-js");
41
40
  const Neon = __importStar(require("@cityofzion/neon-core"));
41
+ const neon_js_1 = require("@cityofzion/neon-js");
42
42
  const bignumber_js_1 = __importDefault(require("bignumber.js"));
43
43
  const ethers_1 = require("ethers");
44
44
  const lodash_1 = require("lodash");
@@ -11,6 +11,7 @@ declare class TokenClient {
11
11
  readonly tokens: TypeUtils.SimpleMap<Token>;
12
12
  readonly wrapperMap: TypeUtils.SimpleMap<string>;
13
13
  readonly poolTokens: TypeUtils.SimpleMap<Token>;
14
+ readonly cdpTokens: TypeUtils.SimpleMap<Token>;
14
15
  readonly symbols: TypeUtils.SimpleMap<string>;
15
16
  readonly usdValues: TypeUtils.SimpleMap<BigNumber>;
16
17
  readonly commonAssetNames: TypeUtils.SimpleMap<string>;
@@ -35,6 +36,7 @@ declare class TokenClient {
35
36
  static isPoolTokenNew(denom: string): boolean;
36
37
  static isPoolTokenLegacy(denom: string): boolean;
37
38
  static isPoolToken(denom: string): boolean;
39
+ static isCdpToken(denom: string): boolean;
38
40
  static isIBCDenom(denom: string): boolean;
39
41
  isWrappedToken(denom?: string): boolean;
40
42
  hasWrappedToken(denom?: string): boolean;
@@ -42,11 +44,14 @@ declare class TokenClient {
42
44
  getWrappedToken(denom: string, blockchain?: BlockchainUtils.Blockchain): Token | null;
43
45
  getSourceToken(denom: string): Token | null;
44
46
  getNativeToken(): Token | undefined;
47
+ getNativeStablecoin(): Token | undefined;
45
48
  isNativeToken(denom: string): boolean;
49
+ isNativeStablecoin(denom: string): boolean;
46
50
  getDepositTokenFor(tokenDenom: string, chain: BlockchainUtils.Blockchain): Token | undefined;
47
51
  getAllTokens(): Promise<Token[]>;
48
52
  reloadTokens(): Promise<TypeUtils.SimpleMap<Token>>;
49
53
  getCarbonIbcTokens(): Token[];
54
+ getCdpUnderlyingToken(cdpDenom: string): Token | undefined;
50
55
  reloadWrapperMap(): Promise<TypeUtils.SimpleMap<string>>;
51
56
  reloadDenomGeckoMap(): Promise<void>;
52
57
  reloadUSDValues(denoms?: string[]): Promise<TypeUtils.SimpleMap<BigNumber>>;
@@ -39,6 +39,7 @@ class TokenClient {
39
39
  this.tokens = {};
40
40
  this.wrapperMap = {};
41
41
  this.poolTokens = {};
42
+ this.cdpTokens = {};
42
43
  this.symbols = {};
43
44
  this.usdValues = {};
44
45
  this.commonAssetNames = constant_1.CommonAssetName;
@@ -72,16 +73,16 @@ class TokenClient {
72
73
  return (_a = this.commonAssetNames[denom]) !== null && _a !== void 0 ? _a : denom;
73
74
  }
74
75
  getDecimals(denom) {
75
- var _a, _b;
76
- return (_b = ((_a = this.tokens[denom]) !== null && _a !== void 0 ? _a : this.poolTokens[denom])) === null || _b === void 0 ? void 0 : _b.decimals.toNumber();
76
+ var _a, _b, _c;
77
+ return (_c = ((_b = (_a = this.tokens[denom]) !== null && _a !== void 0 ? _a : this.poolTokens[denom]) !== null && _b !== void 0 ? _b : this.cdpTokens[denom])) === null || _c === void 0 ? void 0 : _c.decimals.toNumber();
77
78
  }
78
79
  getBlockchain(denom) {
79
80
  var _a, _b, _c;
80
81
  // chainId defaults to 3 so that blockchain will be undefined
81
82
  let chainId = (_c = (_b = (_a = this.tokens[denom]) === null || _a === void 0 ? void 0 : _a.chainId) === null || _b === void 0 ? void 0 : _b.toNumber()) !== null && _c !== void 0 ? _c : 3;
82
- if (this.isNativeToken(denom) || TokenClient.isPoolToken(denom)) {
83
- // native denom "swth" should be native.
84
- // pool tokens are on the Native blockchain, hence 0
83
+ if (this.isNativeToken(denom) || this.isNativeStablecoin(denom) || TokenClient.isPoolToken(denom) || TokenClient.isCdpToken(denom)) {
84
+ // native denoms "swth" and "usc" should be native.
85
+ // pool and cdp tokens are on the Native blockchain, hence 0
85
86
  chainId = 0;
86
87
  }
87
88
  if (TokenClient.isIBCDenom(denom)) {
@@ -155,7 +156,7 @@ class TokenClient {
155
156
  return symbol;
156
157
  }
157
158
  getTokenDesc(denom) {
158
- var _a, _b;
159
+ var _a, _b, _c, _d;
159
160
  if (typeof denom !== 'string')
160
161
  return '';
161
162
  denom = denom.toLowerCase();
@@ -172,7 +173,10 @@ class TokenClient {
172
173
  const symbolB = this.getTokenName(denomB);
173
174
  return `${weightA}% ${symbolA} / ${weightB}% ${symbolB}`;
174
175
  }
175
- return (_b = (_a = this.tokens[denom]) === null || _a === void 0 ? void 0 : _a.name) !== null && _b !== void 0 ? _b : this.getSymbol(denom);
176
+ if (TokenClient.isCdpToken(denom)) {
177
+ return (_b = (_a = this.cdpTokens[denom]) === null || _a === void 0 ? void 0 : _a.name) !== null && _b !== void 0 ? _b : this.getSymbol(denom);
178
+ }
179
+ return (_d = (_c = this.tokens[denom]) === null || _c === void 0 ? void 0 : _c.name) !== null && _d !== void 0 ? _d : this.getSymbol(denom);
176
180
  }
177
181
  static isPoolTokenNew(denom) {
178
182
  return denom.match(/^clpt\/(\d+)$/i) !== null;
@@ -183,6 +187,9 @@ class TokenClient {
183
187
  static isPoolToken(denom) {
184
188
  return this.isPoolTokenNew(denom) || this.isPoolTokenLegacy(denom);
185
189
  }
190
+ static isCdpToken(denom) {
191
+ return denom.includes('cdp/');
192
+ }
186
193
  static isIBCDenom(denom) {
187
194
  return denom.match(ibc_1.ibcTokenRegex) !== null;
188
195
  }
@@ -252,9 +259,15 @@ class TokenClient {
252
259
  getNativeToken() {
253
260
  return this.tokenForId("swth");
254
261
  }
262
+ getNativeStablecoin() {
263
+ return this.tokenForId("usc");
264
+ }
255
265
  isNativeToken(denom) {
256
266
  return denom === "swth";
257
267
  }
268
+ isNativeStablecoin(denom) {
269
+ return denom === "usc";
270
+ }
258
271
  getDepositTokenFor(tokenDenom, chain) {
259
272
  const token = this.tokenForDenom(tokenDenom);
260
273
  if (!token) {
@@ -300,6 +313,9 @@ class TokenClient {
300
313
  if (TokenClient.isPoolToken(token.denom)) {
301
314
  this.poolTokens[token.denom] = token;
302
315
  }
316
+ else if (TokenClient.isCdpToken(token.denom)) {
317
+ this.cdpTokens[token.denom] = token;
318
+ }
303
319
  else {
304
320
  if (this.isNativeToken(token.denom)) {
305
321
  // Change token name to Carbon
@@ -356,6 +372,12 @@ class TokenClient {
356
372
  });
357
373
  return swthTokens;
358
374
  }
375
+ getCdpUnderlyingToken(cdpDenom) {
376
+ if (!this.cdpTokens[cdpDenom])
377
+ throw new Error("not a CDP denom");
378
+ const tokenDenom = cdpDenom.replace(/^cdp\//i, "");
379
+ return this.tokenForDenom(tokenDenom);
380
+ }
359
381
  reloadWrapperMap() {
360
382
  var _a;
361
383
  return __awaiter(this, void 0, void 0, function* () {
@@ -1,6 +1,6 @@
1
1
  import Long from "long";
2
2
  import _m0 from "protobufjs/minimal";
3
- import { OrderBook, StopBook } from "../book/book";
3
+ import { OrderBook, StopBook } from "./book";
4
4
  export declare const protobufPackage = "Switcheo.carbon.book";
5
5
  /** GenesisState defines the book module's genesis state. */
6
6
  export interface GenesisState {
@@ -7,7 +7,7 @@ exports.GenesisState = exports.protobufPackage = void 0;
7
7
  /* eslint-disable */
8
8
  const long_1 = __importDefault(require("long"));
9
9
  const minimal_1 = __importDefault(require("protobufjs/minimal"));
10
- const book_1 = require("../book/book");
10
+ const book_1 = require("./book");
11
11
  exports.protobufPackage = "Switcheo.carbon.book";
12
12
  const baseGenesisState = {};
13
13
  exports.GenesisState = {
@@ -1,6 +1,6 @@
1
1
  import Long from "long";
2
2
  import _m0 from "protobufjs/minimal";
3
- import { OrderBook } from "../book/book";
3
+ import { OrderBook } from "./book";
4
4
  import { PageRequest, PageResponse } from "../cosmos/base/query/v1beta1/pagination";
5
5
  export declare const protobufPackage = "Switcheo.carbon.book";
6
6
  /** this line is used by starport scaffolding # 3 */
@@ -7,7 +7,7 @@ exports.QueryClientImpl = exports.QueryAllBookResponse = exports.QueryAllBookReq
7
7
  /* eslint-disable */
8
8
  const long_1 = __importDefault(require("long"));
9
9
  const minimal_1 = __importDefault(require("protobufjs/minimal"));
10
- const book_1 = require("../book/book");
10
+ const book_1 = require("./book");
11
11
  const pagination_1 = require("../cosmos/base/query/v1beta1/pagination");
12
12
  exports.protobufPackage = "Switcheo.carbon.book";
13
13
  const baseQueryGetBookRequest = { market: "" };
@@ -1,6 +1,6 @@
1
1
  import Long from "long";
2
2
  import _m0 from "protobufjs/minimal";
3
- import { Amm } from "../broker/amm";
3
+ import { Amm } from "./amm";
4
4
  export declare const protobufPackage = "Switcheo.carbon.broker";
5
5
  /** GenesisState defines the broker module's genesis state. */
6
6
  export interface GenesisState {
@@ -7,7 +7,7 @@ exports.GenesisState = exports.protobufPackage = void 0;
7
7
  /* eslint-disable */
8
8
  const long_1 = __importDefault(require("long"));
9
9
  const minimal_1 = __importDefault(require("protobufjs/minimal"));
10
- const amm_1 = require("../broker/amm");
10
+ const amm_1 = require("./amm");
11
11
  exports.protobufPackage = "Switcheo.carbon.broker";
12
12
  const baseGenesisState = {};
13
13
  exports.GenesisState = {
@@ -1,9 +1,9 @@
1
1
  import Long from "long";
2
2
  import _m0 from "protobufjs/minimal";
3
3
  import { PageRequest, PageResponse } from "../query/pagination";
4
- import { MinMaxBoundary } from "../broker/pagination";
5
- import { Candlestick } from "../broker/candlestick";
6
- import { TradeEvent } from "../broker/event";
4
+ import { MinMaxBoundary } from "./pagination";
5
+ import { Candlestick } from "./candlestick";
6
+ import { TradeEvent } from "./event";
7
7
  export declare const protobufPackage = "Switcheo.carbon.broker";
8
8
  export interface QueryCandlesticksRequest {
9
9
  market: string;
@@ -8,9 +8,9 @@ exports.QueryClientImpl = exports.QueryTradesForPositionResponse = exports.Query
8
8
  const long_1 = __importDefault(require("long"));
9
9
  const minimal_1 = __importDefault(require("protobufjs/minimal"));
10
10
  const pagination_1 = require("../query/pagination");
11
- const pagination_2 = require("../broker/pagination");
12
- const candlestick_1 = require("../broker/candlestick");
13
- const event_1 = require("../broker/event");
11
+ const pagination_2 = require("./pagination");
12
+ const candlestick_1 = require("./candlestick");
13
+ const event_1 = require("./event");
14
14
  exports.protobufPackage = "Switcheo.carbon.broker";
15
15
  const baseQueryCandlesticksRequest = {
16
16
  market: "",
@@ -1,6 +1,6 @@
1
1
  import Long from "long";
2
2
  import _m0 from "protobufjs/minimal";
3
- import { DenomInfo } from "../btcx/denom_info";
3
+ import { DenomInfo } from "./denom_info";
4
4
  export declare const protobufPackage = "Switcheo.carbon.btcx";
5
5
  export interface DenomCrossChainInfo {
6
6
  denomInfo?: DenomInfo;
@@ -7,7 +7,7 @@ exports.DenomCrossChainInfo = exports.protobufPackage = void 0;
7
7
  /* eslint-disable */
8
8
  const long_1 = __importDefault(require("long"));
9
9
  const minimal_1 = __importDefault(require("protobufjs/minimal"));
10
- const denom_info_1 = require("../btcx/denom_info");
10
+ const denom_info_1 = require("./denom_info");
11
11
  exports.protobufPackage = "Switcheo.carbon.btcx";
12
12
  const baseDenomCrossChainInfo = {
13
13
  toChainId: long_1.default.UZERO,
@@ -1,6 +1,6 @@
1
1
  import Long from "long";
2
2
  import _m0 from "protobufjs/minimal";
3
- import { DenomInfo } from "../btcx/denom_info";
3
+ import { DenomInfo } from "./denom_info";
4
4
  export declare const protobufPackage = "Switcheo.carbon.btcx";
5
5
  /** this line is used by starport scaffolding # 3 */
6
6
  export interface QueryGetDenomInfoRequest {
@@ -7,7 +7,7 @@ exports.QueryClientImpl = exports.QueryGetDenomCrossChainInfoResponse = exports.
7
7
  /* eslint-disable */
8
8
  const long_1 = __importDefault(require("long"));
9
9
  const minimal_1 = __importDefault(require("protobufjs/minimal"));
10
- const denom_info_1 = require("../btcx/denom_info");
10
+ const denom_info_1 = require("./denom_info");
11
11
  exports.protobufPackage = "Switcheo.carbon.btcx";
12
12
  const baseQueryGetDenomInfoRequest = { denom: "" };
13
13
  exports.QueryGetDenomInfoRequest = {
@@ -1,6 +1,6 @@
1
1
  import Long from "long";
2
2
  import _m0 from "protobufjs/minimal";
3
- import { Params } from "../ccm/ccm";
3
+ import { Params } from "./ccm";
4
4
  export declare const protobufPackage = "Switcheo.carbon.ccm";
5
5
  /** GenesisState defines the ccm module's genesis state. */
6
6
  export interface GenesisState {
@@ -7,7 +7,7 @@ exports.GenesisState_ZionCreatedTxDetailsEntry = exports.GenesisState_DenomCreat
7
7
  /* eslint-disable */
8
8
  const long_1 = __importDefault(require("long"));
9
9
  const minimal_1 = __importDefault(require("protobufjs/minimal"));
10
- const ccm_1 = require("../ccm/ccm");
10
+ const ccm_1 = require("./ccm");
11
11
  exports.protobufPackage = "Switcheo.carbon.ccm";
12
12
  const baseGenesisState = { createdTxCount: "" };
13
13
  exports.GenesisState = {
@@ -5,7 +5,7 @@ export interface AssetParams {
5
5
  denom: string;
6
6
  oracleId: string;
7
7
  rateStrategyName: string;
8
- repayStablecoinInterestDebt: boolean;
8
+ allowRepayStablecoinInterestDebt: boolean;
9
9
  loanToValue: string;
10
10
  liquidationThreshold: string;
11
11
  liquidationBonus: string;
@@ -18,10 +18,6 @@ export interface AssetUtilization {
18
18
  totalAmount: string;
19
19
  utilizationRate: string;
20
20
  }
21
- export interface AssetData {
22
- assetParams?: AssetParams;
23
- assetUtilization?: AssetUtilization;
24
- }
25
21
  export declare const AssetParams: {
26
22
  encode(message: AssetParams, writer?: _m0.Writer): _m0.Writer;
27
23
  decode(input: _m0.Reader | Uint8Array, length?: number | undefined): AssetParams;
@@ -36,13 +32,6 @@ export declare const AssetUtilization: {
36
32
  toJSON(message: AssetUtilization): unknown;
37
33
  fromPartial(object: DeepPartial<AssetUtilization>): AssetUtilization;
38
34
  };
39
- export declare const AssetData: {
40
- encode(message: AssetData, writer?: _m0.Writer): _m0.Writer;
41
- decode(input: _m0.Reader | Uint8Array, length?: number | undefined): AssetData;
42
- fromJSON(object: any): AssetData;
43
- toJSON(message: AssetData): unknown;
44
- fromPartial(object: DeepPartial<AssetData>): AssetData;
45
- };
46
35
  declare type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
47
36
  export declare type DeepPartial<T> = T extends Builtin ? T : T extends Long ? string | number | Long : T extends Array<infer U> ? Array<DeepPartial<U>> : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>> : T extends {} ? {
48
37
  [K in keyof T]?: DeepPartial<T[K]>;
@@ -3,7 +3,7 @@ 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.AssetData = exports.AssetUtilization = exports.AssetParams = exports.protobufPackage = void 0;
6
+ exports.AssetUtilization = exports.AssetParams = exports.protobufPackage = void 0;
7
7
  /* eslint-disable */
8
8
  const long_1 = __importDefault(require("long"));
9
9
  const minimal_1 = __importDefault(require("protobufjs/minimal"));
@@ -12,7 +12,7 @@ const baseAssetParams = {
12
12
  denom: "",
13
13
  oracleId: "",
14
14
  rateStrategyName: "",
15
- repayStablecoinInterestDebt: false,
15
+ allowRepayStablecoinInterestDebt: false,
16
16
  loanToValue: "",
17
17
  liquidationThreshold: "",
18
18
  liquidationBonus: "",
@@ -30,8 +30,8 @@ exports.AssetParams = {
30
30
  if (message.rateStrategyName !== "") {
31
31
  writer.uint32(26).string(message.rateStrategyName);
32
32
  }
33
- if (message.repayStablecoinInterestDebt === true) {
34
- writer.uint32(32).bool(message.repayStablecoinInterestDebt);
33
+ if (message.allowRepayStablecoinInterestDebt === true) {
34
+ writer.uint32(32).bool(message.allowRepayStablecoinInterestDebt);
35
35
  }
36
36
  if (message.loanToValue !== "") {
37
37
  writer.uint32(42).string(message.loanToValue);
@@ -67,7 +67,7 @@ exports.AssetParams = {
67
67
  message.rateStrategyName = reader.string();
68
68
  break;
69
69
  case 4:
70
- message.repayStablecoinInterestDebt = reader.bool();
70
+ message.allowRepayStablecoinInterestDebt = reader.bool();
71
71
  break;
72
72
  case 5:
73
73
  message.loanToValue = reader.string();
@@ -105,10 +105,10 @@ exports.AssetParams = {
105
105
  object.rateStrategyName !== undefined && object.rateStrategyName !== null
106
106
  ? String(object.rateStrategyName)
107
107
  : "";
108
- message.repayStablecoinInterestDebt =
109
- object.repayStablecoinInterestDebt !== undefined &&
110
- object.repayStablecoinInterestDebt !== null
111
- ? Boolean(object.repayStablecoinInterestDebt)
108
+ message.allowRepayStablecoinInterestDebt =
109
+ object.allowRepayStablecoinInterestDebt !== undefined &&
110
+ object.allowRepayStablecoinInterestDebt !== null
111
+ ? Boolean(object.allowRepayStablecoinInterestDebt)
112
112
  : false;
113
113
  message.loanToValue =
114
114
  object.loanToValue !== undefined && object.loanToValue !== null
@@ -139,8 +139,9 @@ exports.AssetParams = {
139
139
  message.oracleId !== undefined && (obj.oracleId = message.oracleId);
140
140
  message.rateStrategyName !== undefined &&
141
141
  (obj.rateStrategyName = message.rateStrategyName);
142
- message.repayStablecoinInterestDebt !== undefined &&
143
- (obj.repayStablecoinInterestDebt = message.repayStablecoinInterestDebt);
142
+ message.allowRepayStablecoinInterestDebt !== undefined &&
143
+ (obj.allowRepayStablecoinInterestDebt =
144
+ message.allowRepayStablecoinInterestDebt);
144
145
  message.loanToValue !== undefined &&
145
146
  (obj.loanToValue = message.loanToValue);
146
147
  message.liquidationThreshold !== undefined &&
@@ -157,8 +158,8 @@ exports.AssetParams = {
157
158
  message.denom = (_a = object.denom) !== null && _a !== void 0 ? _a : "";
158
159
  message.oracleId = (_b = object.oracleId) !== null && _b !== void 0 ? _b : "";
159
160
  message.rateStrategyName = (_c = object.rateStrategyName) !== null && _c !== void 0 ? _c : "";
160
- message.repayStablecoinInterestDebt =
161
- (_d = object.repayStablecoinInterestDebt) !== null && _d !== void 0 ? _d : false;
161
+ message.allowRepayStablecoinInterestDebt =
162
+ (_d = object.allowRepayStablecoinInterestDebt) !== null && _d !== void 0 ? _d : false;
162
163
  message.loanToValue = (_e = object.loanToValue) !== null && _e !== void 0 ? _e : "";
163
164
  message.liquidationThreshold = (_f = object.liquidationThreshold) !== null && _f !== void 0 ? _f : "";
164
165
  message.liquidationBonus = (_g = object.liquidationBonus) !== null && _g !== void 0 ? _g : "";
@@ -256,74 +257,6 @@ exports.AssetUtilization = {
256
257
  return message;
257
258
  },
258
259
  };
259
- const baseAssetData = {};
260
- exports.AssetData = {
261
- encode(message, writer = minimal_1.default.Writer.create()) {
262
- if (message.assetParams !== undefined) {
263
- exports.AssetParams.encode(message.assetParams, writer.uint32(10).fork()).ldelim();
264
- }
265
- if (message.assetUtilization !== undefined) {
266
- exports.AssetUtilization.encode(message.assetUtilization, writer.uint32(18).fork()).ldelim();
267
- }
268
- return writer;
269
- },
270
- decode(input, length) {
271
- const reader = input instanceof minimal_1.default.Reader ? input : new minimal_1.default.Reader(input);
272
- let end = length === undefined ? reader.len : reader.pos + length;
273
- const message = Object.assign({}, baseAssetData);
274
- while (reader.pos < end) {
275
- const tag = reader.uint32();
276
- switch (tag >>> 3) {
277
- case 1:
278
- message.assetParams = exports.AssetParams.decode(reader, reader.uint32());
279
- break;
280
- case 2:
281
- message.assetUtilization = exports.AssetUtilization.decode(reader, reader.uint32());
282
- break;
283
- default:
284
- reader.skipType(tag & 7);
285
- break;
286
- }
287
- }
288
- return message;
289
- },
290
- fromJSON(object) {
291
- const message = Object.assign({}, baseAssetData);
292
- message.assetParams =
293
- object.assetParams !== undefined && object.assetParams !== null
294
- ? exports.AssetParams.fromJSON(object.assetParams)
295
- : undefined;
296
- message.assetUtilization =
297
- object.assetUtilization !== undefined && object.assetUtilization !== null
298
- ? exports.AssetUtilization.fromJSON(object.assetUtilization)
299
- : undefined;
300
- return message;
301
- },
302
- toJSON(message) {
303
- const obj = {};
304
- message.assetParams !== undefined &&
305
- (obj.assetParams = message.assetParams
306
- ? exports.AssetParams.toJSON(message.assetParams)
307
- : undefined);
308
- message.assetUtilization !== undefined &&
309
- (obj.assetUtilization = message.assetUtilization
310
- ? exports.AssetUtilization.toJSON(message.assetUtilization)
311
- : undefined);
312
- return obj;
313
- },
314
- fromPartial(object) {
315
- const message = Object.assign({}, baseAssetData);
316
- message.assetParams =
317
- object.assetParams !== undefined && object.assetParams !== null
318
- ? exports.AssetParams.fromPartial(object.assetParams)
319
- : undefined;
320
- message.assetUtilization =
321
- object.assetUtilization !== undefined && object.assetUtilization !== null
322
- ? exports.AssetUtilization.fromPartial(object.assetUtilization)
323
- : undefined;
324
- return message;
325
- },
326
- };
327
260
  if (minimal_1.default.util.Long !== long_1.default) {
328
261
  minimal_1.default.util.Long = long_1.default;
329
262
  minimal_1.default.configure();
@@ -6,7 +6,7 @@ export interface DebtInfo {
6
6
  lastUpdatedTime?: Date;
7
7
  totalPrincipal: string;
8
8
  cumulativeInterestMultiplier: string;
9
- initialCumulativeInterestMultiplier: string;
9
+ totalAccumulatedInterest: string;
10
10
  utilizationRate: string;
11
11
  }
12
12
  export declare const DebtInfo: {
@@ -13,7 +13,7 @@ const baseDebtInfo = {
13
13
  denom: "",
14
14
  totalPrincipal: "",
15
15
  cumulativeInterestMultiplier: "",
16
- initialCumulativeInterestMultiplier: "",
16
+ totalAccumulatedInterest: "",
17
17
  utilizationRate: "",
18
18
  };
19
19
  exports.DebtInfo = {
@@ -30,8 +30,8 @@ exports.DebtInfo = {
30
30
  if (message.cumulativeInterestMultiplier !== "") {
31
31
  writer.uint32(34).string(message.cumulativeInterestMultiplier);
32
32
  }
33
- if (message.initialCumulativeInterestMultiplier !== "") {
34
- writer.uint32(42).string(message.initialCumulativeInterestMultiplier);
33
+ if (message.totalAccumulatedInterest !== "") {
34
+ writer.uint32(42).string(message.totalAccumulatedInterest);
35
35
  }
36
36
  if (message.utilizationRate !== "") {
37
37
  writer.uint32(50).string(message.utilizationRate);
@@ -58,7 +58,7 @@ exports.DebtInfo = {
58
58
  message.cumulativeInterestMultiplier = reader.string();
59
59
  break;
60
60
  case 5:
61
- message.initialCumulativeInterestMultiplier = reader.string();
61
+ message.totalAccumulatedInterest = reader.string();
62
62
  break;
63
63
  case 6:
64
64
  message.utilizationRate = reader.string();
@@ -89,10 +89,10 @@ exports.DebtInfo = {
89
89
  object.cumulativeInterestMultiplier !== null
90
90
  ? String(object.cumulativeInterestMultiplier)
91
91
  : "";
92
- message.initialCumulativeInterestMultiplier =
93
- object.initialCumulativeInterestMultiplier !== undefined &&
94
- object.initialCumulativeInterestMultiplier !== null
95
- ? String(object.initialCumulativeInterestMultiplier)
92
+ message.totalAccumulatedInterest =
93
+ object.totalAccumulatedInterest !== undefined &&
94
+ object.totalAccumulatedInterest !== null
95
+ ? String(object.totalAccumulatedInterest)
96
96
  : "";
97
97
  message.utilizationRate =
98
98
  object.utilizationRate !== undefined && object.utilizationRate !== null
@@ -109,9 +109,8 @@ exports.DebtInfo = {
109
109
  (obj.totalPrincipal = message.totalPrincipal);
110
110
  message.cumulativeInterestMultiplier !== undefined &&
111
111
  (obj.cumulativeInterestMultiplier = message.cumulativeInterestMultiplier);
112
- message.initialCumulativeInterestMultiplier !== undefined &&
113
- (obj.initialCumulativeInterestMultiplier =
114
- message.initialCumulativeInterestMultiplier);
112
+ message.totalAccumulatedInterest !== undefined &&
113
+ (obj.totalAccumulatedInterest = message.totalAccumulatedInterest);
115
114
  message.utilizationRate !== undefined &&
116
115
  (obj.utilizationRate = message.utilizationRate);
117
116
  return obj;
@@ -124,8 +123,7 @@ exports.DebtInfo = {
124
123
  message.totalPrincipal = (_c = object.totalPrincipal) !== null && _c !== void 0 ? _c : "";
125
124
  message.cumulativeInterestMultiplier =
126
125
  (_d = object.cumulativeInterestMultiplier) !== null && _d !== void 0 ? _d : "";
127
- message.initialCumulativeInterestMultiplier =
128
- (_e = object.initialCumulativeInterestMultiplier) !== null && _e !== void 0 ? _e : "";
126
+ message.totalAccumulatedInterest = (_e = object.totalAccumulatedInterest) !== null && _e !== void 0 ? _e : "";
129
127
  message.utilizationRate = (_f = object.utilizationRate) !== null && _f !== void 0 ? _f : "";
130
128
  return message;
131
129
  },