@mento-protocol/mento-sdk 3.2.2-beta1 → 3.2.3

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 (397) hide show
  1. package/dist/cjs/ChainClient.d.ts +9 -0
  2. package/dist/cjs/ChainClient.js +58 -0
  3. package/dist/cjs/TestChainClient.d.ts +7 -0
  4. package/dist/cjs/TestChainClient.js +41 -0
  5. package/dist/cjs/constants/addresses.d.ts +4 -0
  6. package/dist/cjs/constants/addresses.js +59 -0
  7. package/dist/cjs/constants/currencies.d.ts +5 -0
  8. package/dist/cjs/constants/currencies.js +29 -0
  9. package/dist/cjs/constants/index.d.ts +4 -0
  10. package/dist/{services/borrow → cjs/constants}/index.js +4 -4
  11. package/dist/cjs/constants/tokens.11142220.d.ts +2 -0
  12. package/dist/cjs/constants/tokens.11142220.js +128 -0
  13. package/dist/cjs/constants/tokens.42220.d.ts +2 -0
  14. package/dist/cjs/constants/tokens.42220.js +128 -0
  15. package/dist/cjs/constants/tokens.d.ts +65 -0
  16. package/dist/cjs/constants/tokens.js +170 -0
  17. package/dist/cjs/constants/tradablePairs.11142220.d.ts +2 -0
  18. package/dist/cjs/constants/tradablePairs.11142220.js +7391 -0
  19. package/dist/cjs/constants/tradablePairs.42220.d.ts +2 -0
  20. package/dist/cjs/constants/tradablePairs.42220.js +7391 -0
  21. package/dist/cjs/constants/tradablePairs.d.ts +16 -0
  22. package/dist/cjs/constants/tradablePairs.js +53 -0
  23. package/dist/cjs/enums/chainId.d.ts +4 -0
  24. package/dist/{core/constants → cjs/enums}/chainId.js +1 -4
  25. package/dist/cjs/enums/index.d.ts +3 -0
  26. package/dist/{services/liquidity → cjs/enums}/index.js +3 -2
  27. package/dist/cjs/enums/proposalState.d.ts +10 -0
  28. package/dist/cjs/enums/proposalState.js +14 -0
  29. package/dist/cjs/enums/tradingMode.d.ts +17 -0
  30. package/dist/cjs/enums/tradingMode.js +21 -0
  31. package/dist/cjs/governance.d.ts +62 -0
  32. package/dist/cjs/governance.js +151 -0
  33. package/dist/cjs/index.d.ts +7 -0
  34. package/dist/{core/constants → cjs}/index.js +7 -6
  35. package/dist/cjs/interfaces/IChainClient.d.ts +6 -0
  36. package/dist/{core/types/route.js → cjs/interfaces/IChainClient.js} +0 -1
  37. package/dist/cjs/interfaces/index.d.ts +4 -0
  38. package/dist/{core/errors → cjs/interfaces}/index.js +4 -4
  39. package/dist/cjs/interfaces/tradingLimit.d.ts +7 -0
  40. package/dist/{core/types/token.js → cjs/interfaces/tradingLimit.js} +0 -1
  41. package/dist/cjs/interfaces/tradingLimitsConfig.d.ts +10 -0
  42. package/dist/{core/types/borrow.js → cjs/interfaces/tradingLimitsConfig.js} +0 -1
  43. package/dist/cjs/interfaces/tradingLimitsState.d.ts +9 -0
  44. package/dist/{core/types/provider.js → cjs/interfaces/tradingLimitsState.js} +0 -1
  45. package/dist/cjs/limits.d.ts +33 -0
  46. package/dist/cjs/limits.js +130 -0
  47. package/dist/cjs/mento.d.ts +287 -0
  48. package/dist/cjs/mento.js +699 -0
  49. package/dist/{utils → cjs}/routeUtils.d.ts +93 -84
  50. package/dist/{utils → cjs}/routeUtils.js +124 -123
  51. package/dist/cjs/types/contractAddressMap.d.ts +4 -0
  52. package/dist/cjs/types/contractAddressMap.js +2 -0
  53. package/dist/cjs/types/contractAddresses.d.ts +23 -0
  54. package/dist/cjs/types/contractAddresses.js +2 -0
  55. package/dist/cjs/types/index.d.ts +2 -0
  56. package/dist/{services/pools → cjs/types}/index.js +2 -2
  57. package/dist/cjs/utils.d.ts +80 -0
  58. package/dist/cjs/utils.js +177 -0
  59. package/dist/esm/ChainClient.d.ts +9 -0
  60. package/dist/esm/ChainClient.js +54 -0
  61. package/dist/esm/TestChainClient.d.ts +7 -0
  62. package/dist/esm/TestChainClient.js +37 -0
  63. package/dist/esm/constants/addresses.d.ts +4 -0
  64. package/dist/esm/constants/addresses.js +55 -0
  65. package/dist/esm/constants/currencies.d.ts +5 -0
  66. package/dist/esm/constants/currencies.js +26 -0
  67. package/dist/esm/constants/index.d.ts +4 -0
  68. package/dist/esm/constants/index.js +4 -0
  69. package/dist/esm/constants/tokens.11142220.d.ts +2 -0
  70. package/dist/esm/constants/tokens.11142220.js +125 -0
  71. package/dist/esm/constants/tokens.42220.d.ts +2 -0
  72. package/dist/esm/constants/tokens.42220.js +125 -0
  73. package/dist/esm/constants/tokens.d.ts +65 -0
  74. package/dist/esm/constants/tokens.js +142 -0
  75. package/dist/esm/constants/tradablePairs.11142220.d.ts +2 -0
  76. package/dist/esm/constants/tradablePairs.11142220.js +7388 -0
  77. package/dist/esm/constants/tradablePairs.42220.d.ts +2 -0
  78. package/dist/esm/constants/tradablePairs.42220.js +7388 -0
  79. package/dist/esm/constants/tradablePairs.d.ts +16 -0
  80. package/dist/esm/constants/tradablePairs.js +26 -0
  81. package/dist/esm/enums/chainId.d.ts +4 -0
  82. package/dist/esm/{core/constants → enums}/chainId.js +0 -2
  83. package/dist/esm/enums/index.d.ts +3 -0
  84. package/dist/esm/enums/index.js +3 -0
  85. package/dist/esm/enums/proposalState.d.ts +10 -0
  86. package/dist/esm/enums/proposalState.js +11 -0
  87. package/dist/esm/enums/tradingMode.d.ts +17 -0
  88. package/dist/esm/enums/tradingMode.js +18 -0
  89. package/dist/esm/governance.d.ts +62 -0
  90. package/dist/esm/governance.js +147 -0
  91. package/dist/esm/index.d.ts +7 -0
  92. package/dist/esm/index.js +6 -138
  93. package/dist/esm/interfaces/IChainClient.d.ts +6 -0
  94. package/dist/esm/interfaces/index.d.ts +4 -0
  95. package/dist/esm/interfaces/index.js +4 -0
  96. package/dist/esm/interfaces/tradingLimit.d.ts +7 -0
  97. package/dist/esm/interfaces/tradingLimitsConfig.d.ts +10 -0
  98. package/dist/esm/interfaces/tradingLimitsState.d.ts +9 -0
  99. package/dist/esm/limits.d.ts +33 -0
  100. package/dist/esm/limits.js +123 -0
  101. package/dist/esm/mento.d.ts +287 -0
  102. package/dist/esm/mento.js +671 -0
  103. package/dist/esm/routeUtils.d.ts +304 -0
  104. package/dist/esm/{utils/routeUtils.js → routeUtils.js} +116 -115
  105. package/dist/esm/types/contractAddressMap.d.ts +4 -0
  106. package/dist/esm/types/contractAddresses.d.ts +23 -0
  107. package/dist/esm/types/index.d.ts +2 -0
  108. package/dist/esm/types/index.js +2 -0
  109. package/dist/esm/utils.d.ts +80 -0
  110. package/dist/esm/utils.js +162 -0
  111. package/package.json +1 -1
  112. package/dist/cache/routes.d.ts +0 -13
  113. package/dist/cache/routes.js +0 -13733
  114. package/dist/cache/tokens.d.ts +0 -68
  115. package/dist/cache/tokens.js +0 -446
  116. package/dist/core/abis/activePool.d.ts +0 -2
  117. package/dist/core/abis/activePool.js +0 -14
  118. package/dist/core/abis/addressesRegistry.d.ts +0 -2
  119. package/dist/core/abis/addressesRegistry.js +0 -26
  120. package/dist/core/abis/bipoolmanager.d.ts +0 -34
  121. package/dist/core/abis/bipoolmanager.js +0 -72
  122. package/dist/core/abis/borrowerOperations.d.ts +0 -9
  123. package/dist/core/abis/borrowerOperations.js +0 -89
  124. package/dist/core/abis/breakerbox.d.ts +0 -13
  125. package/dist/core/abis/breakerbox.js +0 -8
  126. package/dist/core/abis/broker.d.ts +0 -2
  127. package/dist/core/abis/broker.js +0 -9
  128. package/dist/core/abis/erc20.d.ts +0 -9
  129. package/dist/core/abis/erc20.js +0 -21
  130. package/dist/core/abis/fpmm.d.ts +0 -270
  131. package/dist/core/abis/fpmm.js +0 -49
  132. package/dist/core/abis/fpmmFactory.d.ts +0 -85
  133. package/dist/core/abis/fpmmFactory.js +0 -26
  134. package/dist/core/abis/hintHelpers.d.ts +0 -2
  135. package/dist/core/abis/hintHelpers.js +0 -14
  136. package/dist/core/abis/index.d.ts +0 -22
  137. package/dist/core/abis/index.js +0 -38
  138. package/dist/core/abis/liquidityStrategy.d.ts +0 -132
  139. package/dist/core/abis/liquidityStrategy.js +0 -10
  140. package/dist/core/abis/multiTroveGetter.d.ts +0 -8
  141. package/dist/core/abis/multiTroveGetter.js +0 -15
  142. package/dist/core/abis/priceFeed.d.ts +0 -7
  143. package/dist/core/abis/priceFeed.js +0 -16
  144. package/dist/core/abis/pricingmodule.d.ts +0 -2
  145. package/dist/core/abis/pricingmodule.js +0 -6
  146. package/dist/core/abis/reserve.d.ts +0 -3
  147. package/dist/core/abis/reserve.js +0 -18
  148. package/dist/core/abis/router.d.ts +0 -521
  149. package/dist/core/abis/router.js +0 -45
  150. package/dist/core/abis/sortedTroves.d.ts +0 -2
  151. package/dist/core/abis/sortedTroves.js +0 -15
  152. package/dist/core/abis/systemParams.d.ts +0 -2
  153. package/dist/core/abis/systemParams.js +0 -14
  154. package/dist/core/abis/troveManager.d.ts +0 -2
  155. package/dist/core/abis/troveManager.js +0 -27
  156. package/dist/core/abis/troveNFT.d.ts +0 -2
  157. package/dist/core/abis/troveNFT.js +0 -9
  158. package/dist/core/abis/virtualPool.d.ts +0 -50
  159. package/dist/core/abis/virtualPool.js +0 -11
  160. package/dist/core/abis/virtualPoolFactory.d.ts +0 -59
  161. package/dist/core/abis/virtualPoolFactory.js +0 -17
  162. package/dist/core/constants/addresses.d.ts +0 -18
  163. package/dist/core/constants/addresses.js +0 -113
  164. package/dist/core/constants/borrowConstants.d.ts +0 -10
  165. package/dist/core/constants/borrowConstants.js +0 -16
  166. package/dist/core/constants/borrowRegistries.d.ts +0 -7
  167. package/dist/core/constants/borrowRegistries.js +0 -30
  168. package/dist/core/constants/chainId.d.ts +0 -7
  169. package/dist/core/constants/contractNames.d.ts +0 -21
  170. package/dist/core/constants/contractNames.js +0 -24
  171. package/dist/core/constants/index.d.ts +0 -6
  172. package/dist/core/errors/base.d.ts +0 -8
  173. package/dist/core/errors/base.js +0 -17
  174. package/dist/core/errors/index.d.ts +0 -4
  175. package/dist/core/errors/oracle.d.ts +0 -9
  176. package/dist/core/errors/oracle.js +0 -15
  177. package/dist/core/errors/router.d.ts +0 -14
  178. package/dist/core/errors/router.js +0 -24
  179. package/dist/core/types/borrow.d.ts +0 -87
  180. package/dist/core/types/contractAddresses.d.ts +0 -42
  181. package/dist/core/types/contractAddresses.js +0 -3
  182. package/dist/core/types/index.d.ts +0 -10
  183. package/dist/core/types/index.js +0 -26
  184. package/dist/core/types/liquidity.d.ts +0 -194
  185. package/dist/core/types/liquidity.js +0 -3
  186. package/dist/core/types/pool.d.ts +0 -208
  187. package/dist/core/types/pool.js +0 -14
  188. package/dist/core/types/provider.d.ts +0 -45
  189. package/dist/core/types/route.d.ts +0 -62
  190. package/dist/core/types/token.d.ts +0 -21
  191. package/dist/core/types/tradingLimits.d.ts +0 -91
  192. package/dist/core/types/tradingLimits.js +0 -3
  193. package/dist/core/types/tradingMode.d.ts +0 -24
  194. package/dist/core/types/tradingMode.js +0 -31
  195. package/dist/core/types/transaction.d.ts +0 -45
  196. package/dist/core/types/transaction.js +0 -3
  197. package/dist/esm/cache/routes.js +0 -13728
  198. package/dist/esm/cache/tokens.js +0 -438
  199. package/dist/esm/core/abis/activePool.js +0 -10
  200. package/dist/esm/core/abis/addressesRegistry.js +0 -22
  201. package/dist/esm/core/abis/bipoolmanager.js +0 -68
  202. package/dist/esm/core/abis/borrowerOperations.js +0 -85
  203. package/dist/esm/core/abis/breakerbox.js +0 -4
  204. package/dist/esm/core/abis/broker.js +0 -5
  205. package/dist/esm/core/abis/erc20.js +0 -17
  206. package/dist/esm/core/abis/fpmm.js +0 -45
  207. package/dist/esm/core/abis/fpmmFactory.js +0 -22
  208. package/dist/esm/core/abis/hintHelpers.js +0 -10
  209. package/dist/esm/core/abis/index.js +0 -21
  210. package/dist/esm/core/abis/liquidityStrategy.js +0 -6
  211. package/dist/esm/core/abis/multiTroveGetter.js +0 -11
  212. package/dist/esm/core/abis/priceFeed.js +0 -12
  213. package/dist/esm/core/abis/pricingmodule.js +0 -2
  214. package/dist/esm/core/abis/reserve.js +0 -14
  215. package/dist/esm/core/abis/router.js +0 -41
  216. package/dist/esm/core/abis/sortedTroves.js +0 -11
  217. package/dist/esm/core/abis/systemParams.js +0 -10
  218. package/dist/esm/core/abis/troveManager.js +0 -23
  219. package/dist/esm/core/abis/troveNFT.js +0 -5
  220. package/dist/esm/core/abis/virtualPool.js +0 -7
  221. package/dist/esm/core/abis/virtualPoolFactory.js +0 -13
  222. package/dist/esm/core/constants/addresses.js +0 -107
  223. package/dist/esm/core/constants/borrowConstants.js +0 -12
  224. package/dist/esm/core/constants/borrowRegistries.js +0 -25
  225. package/dist/esm/core/constants/contractNames.js +0 -20
  226. package/dist/esm/core/constants/index.js +0 -5
  227. package/dist/esm/core/errors/base.js +0 -12
  228. package/dist/esm/core/errors/index.js +0 -3
  229. package/dist/esm/core/errors/oracle.js +0 -10
  230. package/dist/esm/core/errors/router.js +0 -18
  231. package/dist/esm/core/types/index.js +0 -9
  232. package/dist/esm/core/types/pool.js +0 -10
  233. package/dist/esm/core/types/tradingLimits.js +0 -1
  234. package/dist/esm/core/types/tradingMode.js +0 -26
  235. package/dist/esm/core/types/transaction.js +0 -1
  236. package/dist/esm/package.json +0 -1
  237. package/dist/esm/services/borrow/BorrowService.js +0 -455
  238. package/dist/esm/services/borrow/borrowHelpers.js +0 -3
  239. package/dist/esm/services/borrow/borrowMath.js +0 -127
  240. package/dist/esm/services/borrow/index.js +0 -3
  241. package/dist/esm/services/borrow/internal/borrowApprovalService.js +0 -48
  242. package/dist/esm/services/borrow/internal/borrowContextStore.js +0 -35
  243. package/dist/esm/services/borrow/internal/borrowErc20.js +0 -38
  244. package/dist/esm/services/borrow/internal/borrowHints.js +0 -27
  245. package/dist/esm/services/borrow/internal/borrowPositionParser.js +0 -82
  246. package/dist/esm/services/borrow/internal/borrowReadService.js +0 -271
  247. package/dist/esm/services/borrow/internal/borrowRegistryReader.js +0 -108
  248. package/dist/esm/services/borrow/internal/borrowTransactionService.js +0 -271
  249. package/dist/esm/services/borrow/internal/borrowTypes.js +0 -1
  250. package/dist/esm/services/borrow/internal/borrowValidation.js +0 -89
  251. package/dist/esm/services/index.js +0 -8
  252. package/dist/esm/services/liquidity/LiquidityService.js +0 -163
  253. package/dist/esm/services/liquidity/basicLiquidity.js +0 -162
  254. package/dist/esm/services/liquidity/index.js +0 -1
  255. package/dist/esm/services/liquidity/liquidityHelpers.js +0 -95
  256. package/dist/esm/services/liquidity/rebalance.js +0 -59
  257. package/dist/esm/services/liquidity/zapHelpers.js +0 -120
  258. package/dist/esm/services/liquidity/zapIn.js +0 -112
  259. package/dist/esm/services/liquidity/zapOut.js +0 -248
  260. package/dist/esm/services/pools/PoolService.js +0 -204
  261. package/dist/esm/services/pools/index.js +0 -1
  262. package/dist/esm/services/pools/poolDetails.js +0 -209
  263. package/dist/esm/services/pools/poolDiscovery.js +0 -112
  264. package/dist/esm/services/pools/rebalancePreview.js +0 -181
  265. package/dist/esm/services/quotes/QuoteService.js +0 -85
  266. package/dist/esm/services/quotes/index.js +0 -1
  267. package/dist/esm/services/routes/RouteService.js +0 -268
  268. package/dist/esm/services/routes/index.js +0 -1
  269. package/dist/esm/services/swap/SwapService.js +0 -247
  270. package/dist/esm/services/swap/index.js +0 -1
  271. package/dist/esm/services/tokens/index.js +0 -1
  272. package/dist/esm/services/tokens/tokenService.js +0 -285
  273. package/dist/esm/services/trading/TradingLimitsService.js +0 -154
  274. package/dist/esm/services/trading/TradingService.js +0 -196
  275. package/dist/esm/services/trading/index.js +0 -2
  276. package/dist/esm/utils/chainConfig.js +0 -118
  277. package/dist/esm/utils/costUtils.js +0 -56
  278. package/dist/esm/utils/deadline.js +0 -22
  279. package/dist/esm/utils/index.js +0 -9
  280. package/dist/esm/utils/multicall.js +0 -47
  281. package/dist/esm/utils/pathEncoder.js +0 -69
  282. package/dist/esm/utils/rateFeed.js +0 -23
  283. package/dist/esm/utils/retry.js +0 -24
  284. package/dist/esm/utils/routes.js +0 -2
  285. package/dist/esm/utils/sortUtils.js +0 -33
  286. package/dist/esm/utils/tokens.js +0 -2
  287. package/dist/esm/utils/tradingLimits.js +0 -163
  288. package/dist/esm/utils/validation.js +0 -30
  289. package/dist/index.d.ts +0 -101
  290. package/dist/index.js +0 -158
  291. package/dist/services/borrow/BorrowService.d.ts +0 -381
  292. package/dist/services/borrow/BorrowService.js +0 -460
  293. package/dist/services/borrow/borrowHelpers.d.ts +0 -4
  294. package/dist/services/borrow/borrowHelpers.js +0 -13
  295. package/dist/services/borrow/borrowMath.d.ts +0 -21
  296. package/dist/services/borrow/borrowMath.js +0 -137
  297. package/dist/services/borrow/index.d.ts +0 -4
  298. package/dist/services/borrow/internal/borrowApprovalService.d.ts +0 -14
  299. package/dist/services/borrow/internal/borrowApprovalService.js +0 -53
  300. package/dist/services/borrow/internal/borrowContextStore.d.ts +0 -11
  301. package/dist/services/borrow/internal/borrowContextStore.js +0 -40
  302. package/dist/services/borrow/internal/borrowErc20.d.ts +0 -5
  303. package/dist/services/borrow/internal/borrowErc20.js +0 -43
  304. package/dist/services/borrow/internal/borrowHints.d.ts +0 -7
  305. package/dist/services/borrow/internal/borrowHints.js +0 -31
  306. package/dist/services/borrow/internal/borrowPositionParser.d.ts +0 -4
  307. package/dist/services/borrow/internal/borrowPositionParser.js +0 -87
  308. package/dist/services/borrow/internal/borrowReadService.d.ts +0 -31
  309. package/dist/services/borrow/internal/borrowReadService.js +0 -276
  310. package/dist/services/borrow/internal/borrowRegistryReader.d.ts +0 -5
  311. package/dist/services/borrow/internal/borrowRegistryReader.js +0 -113
  312. package/dist/services/borrow/internal/borrowTransactionService.d.ts +0 -23
  313. package/dist/services/borrow/internal/borrowTransactionService.js +0 -276
  314. package/dist/services/borrow/internal/borrowTypes.d.ts +0 -15
  315. package/dist/services/borrow/internal/borrowTypes.js +0 -3
  316. package/dist/services/borrow/internal/borrowValidation.d.ts +0 -14
  317. package/dist/services/borrow/internal/borrowValidation.js +0 -104
  318. package/dist/services/index.d.ts +0 -9
  319. package/dist/services/index.js +0 -25
  320. package/dist/services/liquidity/LiquidityService.d.ts +0 -139
  321. package/dist/services/liquidity/LiquidityService.js +0 -168
  322. package/dist/services/liquidity/basicLiquidity.d.ts +0 -11
  323. package/dist/services/liquidity/basicLiquidity.js +0 -172
  324. package/dist/services/liquidity/index.d.ts +0 -2
  325. package/dist/services/liquidity/liquidityHelpers.d.ts +0 -19
  326. package/dist/services/liquidity/liquidityHelpers.js +0 -104
  327. package/dist/services/liquidity/rebalance.d.ts +0 -6
  328. package/dist/services/liquidity/rebalance.js +0 -64
  329. package/dist/services/liquidity/zapHelpers.d.ts +0 -66
  330. package/dist/services/liquidity/zapHelpers.js +0 -129
  331. package/dist/services/liquidity/zapIn.d.ts +0 -18
  332. package/dist/services/liquidity/zapIn.js +0 -119
  333. package/dist/services/liquidity/zapOut.d.ts +0 -9
  334. package/dist/services/liquidity/zapOut.js +0 -255
  335. package/dist/services/pools/PoolService.d.ts +0 -69
  336. package/dist/services/pools/PoolService.js +0 -209
  337. package/dist/services/pools/index.d.ts +0 -2
  338. package/dist/services/pools/poolDetails.d.ts +0 -13
  339. package/dist/services/pools/poolDetails.js +0 -216
  340. package/dist/services/pools/poolDiscovery.d.ts +0 -12
  341. package/dist/services/pools/poolDiscovery.js +0 -117
  342. package/dist/services/pools/rebalancePreview.d.ts +0 -5
  343. package/dist/services/pools/rebalancePreview.js +0 -186
  344. package/dist/services/quotes/QuoteService.d.ts +0 -51
  345. package/dist/services/quotes/QuoteService.js +0 -91
  346. package/dist/services/quotes/index.d.ts +0 -2
  347. package/dist/services/quotes/index.js +0 -18
  348. package/dist/services/routes/RouteService.d.ts +0 -117
  349. package/dist/services/routes/RouteService.js +0 -306
  350. package/dist/services/routes/index.d.ts +0 -2
  351. package/dist/services/routes/index.js +0 -18
  352. package/dist/services/swap/SwapService.d.ts +0 -198
  353. package/dist/services/swap/SwapService.js +0 -252
  354. package/dist/services/swap/index.d.ts +0 -2
  355. package/dist/services/swap/index.js +0 -18
  356. package/dist/services/tokens/index.d.ts +0 -2
  357. package/dist/services/tokens/index.js +0 -18
  358. package/dist/services/tokens/tokenService.d.ts +0 -55
  359. package/dist/services/tokens/tokenService.js +0 -290
  360. package/dist/services/trading/TradingLimitsService.d.ts +0 -38
  361. package/dist/services/trading/TradingLimitsService.js +0 -159
  362. package/dist/services/trading/TradingService.d.ts +0 -113
  363. package/dist/services/trading/TradingService.js +0 -201
  364. package/dist/services/trading/index.d.ts +0 -3
  365. package/dist/services/trading/index.js +0 -19
  366. package/dist/utils/chainConfig.d.ts +0 -16
  367. package/dist/utils/chainConfig.js +0 -123
  368. package/dist/utils/costUtils.d.ts +0 -12
  369. package/dist/utils/costUtils.js +0 -60
  370. package/dist/utils/deadline.d.ts +0 -21
  371. package/dist/utils/deadline.js +0 -26
  372. package/dist/utils/index.d.ts +0 -10
  373. package/dist/utils/index.js +0 -26
  374. package/dist/utils/multicall.d.ts +0 -30
  375. package/dist/utils/multicall.js +0 -52
  376. package/dist/utils/pathEncoder.d.ts +0 -34
  377. package/dist/utils/pathEncoder.js +0 -73
  378. package/dist/utils/rateFeed.d.ts +0 -18
  379. package/dist/utils/rateFeed.js +0 -27
  380. package/dist/utils/retry.d.ts +0 -12
  381. package/dist/utils/retry.js +0 -28
  382. package/dist/utils/routes.d.ts +0 -3
  383. package/dist/utils/routes.js +0 -8
  384. package/dist/utils/sortUtils.d.ts +0 -24
  385. package/dist/utils/sortUtils.js +0 -39
  386. package/dist/utils/tokens.d.ts +0 -2
  387. package/dist/utils/tokens.js +0 -13
  388. package/dist/utils/tradingLimits.d.ts +0 -41
  389. package/dist/utils/tradingLimits.js +0 -171
  390. package/dist/utils/validation.d.ts +0 -19
  391. package/dist/utils/validation.js +0 -34
  392. /package/dist/esm/{core/types/borrow.js → interfaces/IChainClient.js} +0 -0
  393. /package/dist/esm/{core/types/contractAddresses.js → interfaces/tradingLimit.js} +0 -0
  394. /package/dist/esm/{core/types/liquidity.js → interfaces/tradingLimitsConfig.js} +0 -0
  395. /package/dist/esm/{core/types/provider.js → interfaces/tradingLimitsState.js} +0 -0
  396. /package/dist/esm/{core/types/route.js → types/contractAddressMap.js} +0 -0
  397. /package/dist/esm/{core/types/token.js → types/contractAddresses.js} +0 -0
@@ -0,0 +1,16 @@
1
+ import { TradablePair } from '../mento';
2
+ export interface TradablePairWithSpread extends TradablePair {
3
+ spreadData: {
4
+ totalSpreadPercent: number;
5
+ hops: Array<{
6
+ exchangeId: string;
7
+ spreadPercent: number;
8
+ }>;
9
+ };
10
+ }
11
+ /**
12
+ * Gets cached tradable pairs for a specific chain ID
13
+ * @param chainId - The chain ID to get cached pairs for
14
+ * @returns Promise resolving to the cached tradable pairs or undefined if not available
15
+ */
16
+ export declare function getCachedTradablePairs(chainId: number): Promise<readonly (TradablePair | TradablePairWithSpread)[] | undefined>;
@@ -0,0 +1,26 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ /**
11
+ * Gets cached tradable pairs for a specific chain ID
12
+ * @param chainId - The chain ID to get cached pairs for
13
+ * @returns Promise resolving to the cached tradable pairs or undefined if not available
14
+ */
15
+ export function getCachedTradablePairs(chainId) {
16
+ return __awaiter(this, void 0, void 0, function* () {
17
+ switch (chainId) {
18
+ case 42220:
19
+ return yield import('./tradablePairs.42220').then((module) => module.tradablePairs42220);
20
+ case 11142220:
21
+ return yield import('./tradablePairs.11142220').then((module) => module.tradablePairs11142220);
22
+ default:
23
+ return undefined;
24
+ }
25
+ });
26
+ }
@@ -0,0 +1,4 @@
1
+ export declare enum ChainId {
2
+ CELO = 42220,
3
+ CELO_SEPOLIA = 11142220
4
+ }
@@ -2,6 +2,4 @@ export var ChainId;
2
2
  (function (ChainId) {
3
3
  ChainId[ChainId["CELO"] = 42220] = "CELO";
4
4
  ChainId[ChainId["CELO_SEPOLIA"] = 11142220] = "CELO_SEPOLIA";
5
- ChainId[ChainId["MONAD_TESTNET"] = 10143] = "MONAD_TESTNET";
6
- ChainId[ChainId["MONAD"] = 143] = "MONAD";
7
5
  })(ChainId || (ChainId = {}));
@@ -0,0 +1,3 @@
1
+ export * from './chainId';
2
+ export * from './proposalState';
3
+ export * from './tradingMode';
@@ -0,0 +1,3 @@
1
+ export * from './chainId';
2
+ export * from './proposalState';
3
+ export * from './tradingMode';
@@ -0,0 +1,10 @@
1
+ export declare enum ProposalState {
2
+ PENDING = 0,
3
+ ACTIVE = 1,
4
+ CANCELED = 2,
5
+ DEFEATED = 3,
6
+ SUCCEEDED = 4,
7
+ QUEUED = 5,
8
+ EXPIRED = 6,
9
+ EXECUTED = 7
10
+ }
@@ -0,0 +1,11 @@
1
+ export var ProposalState;
2
+ (function (ProposalState) {
3
+ ProposalState[ProposalState["PENDING"] = 0] = "PENDING";
4
+ ProposalState[ProposalState["ACTIVE"] = 1] = "ACTIVE";
5
+ ProposalState[ProposalState["CANCELED"] = 2] = "CANCELED";
6
+ ProposalState[ProposalState["DEFEATED"] = 3] = "DEFEATED";
7
+ ProposalState[ProposalState["SUCCEEDED"] = 4] = "SUCCEEDED";
8
+ ProposalState[ProposalState["QUEUED"] = 5] = "QUEUED";
9
+ ProposalState[ProposalState["EXPIRED"] = 6] = "EXPIRED";
10
+ ProposalState[ProposalState["EXECUTED"] = 7] = "EXECUTED";
11
+ })(ProposalState || (ProposalState = {}));
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Trading modes for rate feeds in the BreakerBox
3
+ */
4
+ export declare enum TradingMode {
5
+ /**
6
+ * Bidirectional trading is enabled
7
+ */
8
+ BIDIRECTIONAL = 0,
9
+ /**
10
+ * Trading is temporarily halted (circuit breaker tripped)
11
+ */
12
+ HALTED = 1,
13
+ /**
14
+ * Trading is permanently disabled
15
+ */
16
+ DISABLED = 2
17
+ }
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Trading modes for rate feeds in the BreakerBox
3
+ */
4
+ export var TradingMode;
5
+ (function (TradingMode) {
6
+ /**
7
+ * Bidirectional trading is enabled
8
+ */
9
+ TradingMode[TradingMode["BIDIRECTIONAL"] = 0] = "BIDIRECTIONAL";
10
+ /**
11
+ * Trading is temporarily halted (circuit breaker tripped)
12
+ */
13
+ TradingMode[TradingMode["HALTED"] = 1] = "HALTED";
14
+ /**
15
+ * Trading is permanently disabled
16
+ */
17
+ TradingMode[TradingMode["DISABLED"] = 2] = "DISABLED";
18
+ })(TradingMode || (TradingMode = {}));
@@ -0,0 +1,62 @@
1
+ import { BigNumberish, Signer, providers } from 'ethers';
2
+ import { MentoGovernor } from '@mento-protocol/mento-core-ts';
3
+ import { IChainClient } from './interfaces';
4
+ export declare class Governance {
5
+ private chainClient;
6
+ constructor(chainClient: IChainClient);
7
+ constructor(signerOrProvider: Signer | providers.Provider);
8
+ /**
9
+ * This function retrieves the MentoGovernor contract.
10
+ * @returns The MentoGovernor contract.
11
+ */
12
+ getGovernorContract(): Promise<MentoGovernor>;
13
+ /**
14
+ * Generates a transaction that submits a proposal to be created to the Mento Governor contract using the specified values.
15
+ * @param targets The addresses of the contracts to be called during proposal execution.
16
+ * @param values The values to be passed to the calls to the target contracts.
17
+ * @param calldatas The calldata to be passed to the calls to the target contracts.
18
+ * @param description A human readable description of the proposal.
19
+ * @returns The transaction request.
20
+ */
21
+ createProposal(targets: string[], values: BigNumberish[], calldatas: string[], description: string): Promise<providers.TransactionRequest>;
22
+ /**
23
+ * Generates a transaction that will queue the proposal with the specified id to be executed.
24
+ * @param proposalId The id of the proposal to queue.
25
+ * @returns The transaction request.
26
+ */
27
+ queueProposal(proposalId: BigNumberish): Promise<providers.TransactionRequest>;
28
+ /**
29
+ * Executes the proposal with the specified id.
30
+ * @param proposalId The id of the proposal to execute.
31
+ * @returns The transaction request.
32
+ */
33
+ executeProposal(proposalId: BigNumberish): Promise<providers.TransactionRequest>;
34
+ /**
35
+ * Submits a vote to the Mento Governor contract for the specified proposal.
36
+ * @param proposalId The id of the proposal to vote on.
37
+ * @param support Whether or not to support the proposal.
38
+ * @returns The transaction request.
39
+ */
40
+ castVote(proposalId: BigNumberish, support: BigNumberish): Promise<providers.TransactionRequest>;
41
+ /**
42
+ * Cancels the proposal with the specified id.
43
+ * @param proposalId The id of the proposal to vote on.
44
+ * @param support Whether or not to support the proposal.
45
+ * @returns The transaction request.
46
+ */
47
+ cancelProposal(proposalId: BigNumberish): Promise<providers.TransactionRequest>;
48
+ /**
49
+ * Returns the state of the proposal with the specified id.
50
+ * @param proposalId The id of the proposal to get the state of.
51
+ * @returns The state of the proposal.
52
+ */
53
+ getProposalState(proposalId: BigNumberish): Promise<string>;
54
+ /**
55
+ * This function validates the args that are to be used in the createProposal function.
56
+ * @param targets The addresses of the contracts to be called during proposal execution.
57
+ * @param values The values to be passed to the calls to the target contracts.
58
+ * @param calldatas The calldata to be passed to the calls to the target contracts.
59
+ * @param description A human readable description of the proposal.
60
+ */
61
+ private validateProposalArgs;
62
+ }
@@ -0,0 +1,147 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ import { Signer, providers } from 'ethers';
11
+ import { MentoGovernor__factory, } from '@mento-protocol/mento-core-ts';
12
+ import { ChainClient } from './ChainClient';
13
+ import { TestChainClient } from './TestChainClient';
14
+ import { ProposalState } from './enums';
15
+ import { addresses } from './constants';
16
+ export class Governance {
17
+ constructor(arg) {
18
+ // TODO: Remove use of TestChainClient in future this is only meant for testing
19
+ if (arg instanceof ChainClient || arg instanceof TestChainClient) {
20
+ this.chainClient = arg;
21
+ }
22
+ else if (Signer.isSigner(arg) || providers.Provider.isProvider(arg)) {
23
+ this.chainClient = new ChainClient(arg);
24
+ }
25
+ else {
26
+ throw new Error('Invalid constructor argument');
27
+ }
28
+ }
29
+ /**
30
+ * This function retrieves the MentoGovernor contract.
31
+ * @returns The MentoGovernor contract.
32
+ */
33
+ getGovernorContract() {
34
+ return __awaiter(this, void 0, void 0, function* () {
35
+ const chainId = yield this.chainClient.getChainId();
36
+ const contracts = addresses[chainId];
37
+ if (!contracts) {
38
+ throw new Error(`Contracts not deployed on network with chain id ${chainId}`);
39
+ }
40
+ const mentoGovernorAddress = contracts.MentoGovernor;
41
+ return MentoGovernor__factory.connect(mentoGovernorAddress, yield this.chainClient.getSigner());
42
+ });
43
+ }
44
+ /**
45
+ * Generates a transaction that submits a proposal to be created to the Mento Governor contract using the specified values.
46
+ * @param targets The addresses of the contracts to be called during proposal execution.
47
+ * @param values The values to be passed to the calls to the target contracts.
48
+ * @param calldatas The calldata to be passed to the calls to the target contracts.
49
+ * @param description A human readable description of the proposal.
50
+ * @returns The transaction request.
51
+ */
52
+ createProposal(targets, values, calldatas, description) {
53
+ return __awaiter(this, void 0, void 0, function* () {
54
+ this.validateProposalArgs(targets, values, calldatas, description);
55
+ const governor = yield this.getGovernorContract();
56
+ const tx = yield governor.populateTransaction['propose(address[],uint256[],bytes[],string)'](targets, values, calldatas, description);
57
+ return yield this.chainClient.populateTransaction(tx);
58
+ });
59
+ }
60
+ /**
61
+ * Generates a transaction that will queue the proposal with the specified id to be executed.
62
+ * @param proposalId The id of the proposal to queue.
63
+ * @returns The transaction request.
64
+ */
65
+ queueProposal(proposalId) {
66
+ return __awaiter(this, void 0, void 0, function* () {
67
+ const governor = yield this.getGovernorContract();
68
+ const tx = yield governor.populateTransaction['queue(uint256)'](proposalId);
69
+ return yield this.chainClient.populateTransaction(tx);
70
+ });
71
+ }
72
+ /**
73
+ * Executes the proposal with the specified id.
74
+ * @param proposalId The id of the proposal to execute.
75
+ * @returns The transaction request.
76
+ */
77
+ executeProposal(proposalId) {
78
+ return __awaiter(this, void 0, void 0, function* () {
79
+ const governor = yield this.getGovernorContract();
80
+ const tx = yield governor.populateTransaction['execute(uint256)'](proposalId);
81
+ return yield this.chainClient.populateTransaction(tx);
82
+ });
83
+ }
84
+ /**
85
+ * Submits a vote to the Mento Governor contract for the specified proposal.
86
+ * @param proposalId The id of the proposal to vote on.
87
+ * @param support Whether or not to support the proposal.
88
+ * @returns The transaction request.
89
+ */
90
+ castVote(proposalId, support) {
91
+ return __awaiter(this, void 0, void 0, function* () {
92
+ const governor = yield this.getGovernorContract();
93
+ const tx = yield governor.populateTransaction.castVote(proposalId, support);
94
+ return yield this.chainClient.populateTransaction(tx);
95
+ });
96
+ }
97
+ /**
98
+ * Cancels the proposal with the specified id.
99
+ * @param proposalId The id of the proposal to vote on.
100
+ * @param support Whether or not to support the proposal.
101
+ * @returns The transaction request.
102
+ */
103
+ cancelProposal(proposalId) {
104
+ return __awaiter(this, void 0, void 0, function* () {
105
+ const governor = yield this.getGovernorContract();
106
+ const tx = yield governor.populateTransaction.cancel(proposalId);
107
+ return yield this.chainClient.populateTransaction(tx);
108
+ });
109
+ }
110
+ /**
111
+ * Returns the state of the proposal with the specified id.
112
+ * @param proposalId The id of the proposal to get the state of.
113
+ * @returns The state of the proposal.
114
+ */
115
+ getProposalState(proposalId) {
116
+ return __awaiter(this, void 0, void 0, function* () {
117
+ const governor = yield this.getGovernorContract();
118
+ const state = (yield governor.functions.state(proposalId))[0];
119
+ return ProposalState[state];
120
+ });
121
+ }
122
+ /**
123
+ * This function validates the args that are to be used in the createProposal function.
124
+ * @param targets The addresses of the contracts to be called during proposal execution.
125
+ * @param values The values to be passed to the calls to the target contracts.
126
+ * @param calldatas The calldata to be passed to the calls to the target contracts.
127
+ * @param description A human readable description of the proposal.
128
+ */
129
+ validateProposalArgs(targets, values, calldatas, description) {
130
+ if (!targets || targets.length === 0) {
131
+ throw new Error('Targets must be specified');
132
+ }
133
+ if (!values || values.length === 0) {
134
+ throw new Error('Values must be specified');
135
+ }
136
+ if (!calldatas || calldatas.length === 0) {
137
+ throw new Error('Calldatas must be specified');
138
+ }
139
+ if (!description) {
140
+ throw new Error('Description must be specified');
141
+ }
142
+ if (targets.length !== values.length ||
143
+ targets.length !== calldatas.length) {
144
+ throw new Error('Targets, values, and calldatas must all have the same length');
145
+ }
146
+ }
147
+ }
@@ -0,0 +1,7 @@
1
+ export * from './constants';
2
+ export * from './enums';
3
+ export * from './governance';
4
+ export * from './mento';
5
+ export * from './routeUtils';
6
+ export { ContractAddresses } from './types';
7
+ export * from './utils';
package/dist/esm/index.js CHANGED
@@ -1,139 +1,7 @@
1
- import { createPublicClient, http } from 'viem';
2
- import { ChainId } from './core/constants/chainId';
3
- import { getContractAddress } from './core/constants/addresses';
4
- import { getDefaultRpcUrl, getChainConfig } from './utils/chainConfig';
5
- import { TokenService } from './services/tokens';
6
- import { PoolService } from './services/pools';
7
- import { RouteService } from './services/routes';
8
- import { QuoteService } from './services/quotes';
9
- import { SwapService } from './services/swap';
10
- import { TradingService } from './services/trading';
11
- import { LiquidityService } from './services/liquidity';
12
- import { BorrowService } from './services/borrow';
13
- const DEFAULT_HTTP_BATCH_OPTIONS = {
14
- batchSize: 1000,
15
- wait: 8,
16
- };
17
- const DEFAULT_MULTICALL_BATCH_OPTIONS = {
18
- batchSize: 1024,
19
- wait: 8,
20
- };
21
- /**
22
- * @class Mento
23
- * @description The main class for the Mento SDK. Initializes a viem PublicClient internally
24
- * and provides a public API for interacting with the Mento Protocol.
25
- * @dev example usage:
26
- * const mento = await Mento.create(ChainId.CELO);
27
- * // or with custom RPC URL
28
- * const mento = await Mento.create(ChainId.CELO, 'https://custom-rpc-url.com');
29
- * // or with an existing viem PublicClient
30
- * const mento = await Mento.create(ChainId.CELO, myPublicClient);
31
- *
32
- * // Get all stable tokens
33
- * const stableTokens = await mento.tokens.getStableTokens();
34
- *
35
- * // Get all collateral assets
36
- * const collateralAssets = await mento.tokens.getCollateralAssets();
37
- *
38
- * // Get all pools
39
- * const pools = await mento.pools.getPools();
40
- *
41
- * // Find a route between tokens
42
- * const route = await mento.routes.findRoute(USDm, CELO);
43
- *
44
- * // Get a quote for a swap
45
- * const amountOut = await mento.quotes.getAmountOut(USDm, CELO, amountIn);
46
- *
47
- * // Build swap parameters
48
- * const swapDetails = await mento.swap.buildSwapParams(USDm, CELO, amountIn, recipient, { slippageTolerance: 0.5, deadline: deadlineFromMinutes(5) });
49
- *
50
- * // Check if a pair is tradable (circuit breaker check)
51
- * const isTradable = await mento.trading.isPairTradable(USDm, CELO);
52
- *
53
- * // Get trading limits for a pool
54
- * const limits = await mento.trading.getPoolTradingLimits(pool);
55
- *
56
- * // Get full tradability status (circuit breaker + limits)
57
- * const status = await mento.trading.getPoolTradabilityStatus(pool);
58
- *
59
- * // Add liquidity to a pool
60
- * const { approval0, approval1, addLiquidity } = await mento.liquidity.buildAddLiquidityTransaction(
61
- * poolAddress, amount0, amount1, recipient, owner, { slippageTolerance: 0.5, deadline: deadlineFromMinutes(5) }
62
- * );
63
- *
64
- * // Add liquidity using a single token (zap in)
65
- * const { approval, zapIn } = await mento.liquidity.buildZapInTransaction(
66
- * poolAddress, tokenIn, amountIn, 0.5, recipient, owner, { slippageTolerance: 0.5, deadline: deadlineFromMinutes(5) }
67
- * );
68
- */
69
- export class Mento {
70
- constructor(chainId, tokens, pools, routes, quotes, swap, trading, liquidity, borrow) {
71
- this.chainId = chainId;
72
- this.tokens = tokens;
73
- this.pools = pools;
74
- this.routes = routes;
75
- this.quotes = quotes;
76
- this.swap = swap;
77
- this.trading = trading;
78
- this.liquidity = liquidity;
79
- this.borrow = borrow;
80
- }
81
- static async create(chainId, rpcUrlOrClient, options) {
82
- // Validate chainId is supported
83
- const supportedChainIds = Object.values(ChainId).filter((v) => typeof v === 'number');
84
- if (!supportedChainIds.includes(chainId)) {
85
- throw new Error(`ChainId ${chainId} is not supported. ` +
86
- `Supported chains: ${supportedChainIds.map((id) => `${id} (${ChainId[id]})`).join(', ')}`);
87
- }
88
- let publicClient;
89
- if (rpcUrlOrClient && typeof rpcUrlOrClient !== 'string') {
90
- publicClient = rpcUrlOrClient;
91
- }
92
- else {
93
- const transport = http(rpcUrlOrClient || getDefaultRpcUrl(chainId), {
94
- batch: options?.httpBatch === false
95
- ? false
96
- : {
97
- ...DEFAULT_HTTP_BATCH_OPTIONS,
98
- ...(options?.httpBatch ?? {}),
99
- },
100
- });
101
- publicClient = createPublicClient({
102
- batch: {
103
- multicall: options?.multicallBatch === false
104
- ? false
105
- : {
106
- ...DEFAULT_MULTICALL_BATCH_OPTIONS,
107
- ...(options?.multicallBatch ?? {}),
108
- },
109
- },
110
- chain: getChainConfig(chainId),
111
- transport,
112
- });
113
- }
114
- const tokenService = new TokenService(publicClient, chainId);
115
- const poolService = new PoolService(publicClient, chainId);
116
- const routeService = new RouteService(publicClient, chainId, poolService);
117
- const quoteService = new QuoteService(publicClient, chainId, routeService);
118
- const swapService = new SwapService(publicClient, chainId, routeService, quoteService);
119
- const tradingService = new TradingService(publicClient, chainId, routeService);
120
- const liquidityService = new LiquidityService(publicClient, chainId, poolService, routeService);
121
- const borrowService = new BorrowService(publicClient, chainId);
122
- // Return new mento
123
- return new Mento(chainId, tokenService, poolService, routeService, quoteService, swapService, tradingService, liquidityService, borrowService);
124
- }
125
- /**
126
- * Get the address of a contract for the current chain
127
- * @param contractName - The contract name
128
- * @returns The contract address
129
- */
130
- getContractAddress(contractName) {
131
- return getContractAddress(this.chainId, contractName);
132
- }
133
- }
134
- export * from './core/constants';
135
- export * from './core/errors';
136
- export * from './core/types';
137
- export * from './core/abis';
138
- export * from './services';
1
+ /* istanbul ignore file */
2
+ export * from './constants';
3
+ export * from './enums';
4
+ export * from './governance';
5
+ export * from './mento';
6
+ export * from './routeUtils';
139
7
  export * from './utils';
@@ -0,0 +1,6 @@
1
+ import { ethers, providers } from 'ethers';
2
+ export interface IChainClient {
3
+ getSigner(): Promise<ethers.Signer | providers.Provider>;
4
+ getChainId(): Promise<number>;
5
+ populateTransaction(tx: ethers.PopulatedTransaction): Promise<providers.TransactionRequest>;
6
+ }
@@ -0,0 +1,4 @@
1
+ export * from './tradingLimit';
2
+ export * from './tradingLimitsConfig';
3
+ export * from './tradingLimitsState';
4
+ export * from './IChainClient';
@@ -0,0 +1,4 @@
1
+ export * from './tradingLimit';
2
+ export * from './tradingLimitsConfig';
3
+ export * from './tradingLimitsState';
4
+ export * from './IChainClient';
@@ -0,0 +1,7 @@
1
+ export type Address = string;
2
+ export interface TradingLimit {
3
+ asset: Address;
4
+ maxIn: number;
5
+ maxOut: number;
6
+ until: number;
7
+ }
@@ -0,0 +1,10 @@
1
+ import { Address } from './tradingLimit';
2
+ export interface TradingLimitsConfig {
3
+ asset: Address;
4
+ timestep0: number;
5
+ timestep1: number;
6
+ limit0: number;
7
+ limit1: number;
8
+ limitGlobal: number;
9
+ flags: number;
10
+ }
@@ -0,0 +1,9 @@
1
+ import { Address } from './tradingLimit';
2
+ export interface TradingLimitsState {
3
+ asset: Address;
4
+ lastUpdated0: number;
5
+ lastUpdated1: number;
6
+ netflow0: number;
7
+ netflow1: number;
8
+ netflowGlobal: number;
9
+ }
@@ -0,0 +1,33 @@
1
+ import { Address, TradingLimit, TradingLimitsConfig, TradingLimitsState } from './interfaces';
2
+ import { Broker } from '@mento-protocol/mento-core-ts';
3
+ /**
4
+ * Returns the limit configuration in the broker for the given exchange and asset
5
+ * @param broker an instance of the broker
6
+ * @param exchangeId the id of the exchange
7
+ * @param asset the address of the limited asset
8
+ * @returns the limit configuration
9
+ */
10
+ export declare function getLimitsConfig(broker: Broker, exchangeId: string, asset: Address): Promise<TradingLimitsConfig>;
11
+ /**
12
+ * Returns the limit state in the broker for the given exchange and asset
13
+ * @param broker an instance of the broker
14
+ * @param exchangeId the id of the exchange
15
+ * @param asset the address of the limited asset
16
+ * @returns the limit state
17
+ */
18
+ export declare function getLimitsState(broker: Broker, exchangeId: string, asset: Address): Promise<TradingLimitsState>;
19
+ /**
20
+ * Returns a human-friendly representation of the limits for the given exchange and asset
21
+ * @param broker an instance of the broker
22
+ * @param exchangeId the id of the exchange
23
+ * @param asset the address of the asset with the limit
24
+ * @returns a list of TradingLimit objects
25
+ */
26
+ export declare function getLimits(broker: Broker, exchangeId: string, asset: Address): Promise<TradingLimit[]>;
27
+ /**
28
+ * Returns the limit id for the given exchange and asset
29
+ * @param exchangeId the id of the exchange
30
+ * @param asset the address of the asset with the limit
31
+ * @returns the limit id
32
+ */
33
+ export declare function getLimitId(exchangeId: string, asset: Address): string;