@mento-protocol/mento-sdk 3.2.2 → 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
@@ -1,60 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getPoolCostPercent = getPoolCostPercent;
4
- const types_1 = require("../core/types");
5
- const abis_1 = require("../core/abis");
6
- const virtualPool_1 = require("../core/abis/virtualPool");
7
- const multicall_1 = require("./multicall");
8
- /**
9
- * Calculate cost percentage for a pool based on its type
10
- * Returns cost as a percentage (e.g., 0.5 = 0.5%)
11
- *
12
- * @param pool - The pool to calculate cost for
13
- * @param publicClient - Viem public client for RPC calls
14
- * @returns Cost percentage for the pool
15
- */
16
- async function getPoolCostPercent(pool, publicClient) {
17
- if (pool.poolType === types_1.PoolType.FPMM) {
18
- return getFPMMCostPercent(pool.poolAddr, publicClient);
19
- }
20
- else if (pool.poolType === types_1.PoolType.Virtual) {
21
- return getVirtualPoolCostPercent(pool.poolAddr, publicClient);
22
- }
23
- else {
24
- throw new Error('Invalid pool type');
25
- }
26
- }
27
- /**
28
- * Calculate cost for FPMM pools
29
- * FPMM pools use lpFee + protocolFee in basis points (10000 = 100%)
30
- */
31
- async function getFPMMCostPercent(poolAddress, publicClient) {
32
- const results = await (0, multicall_1.multicall)(publicClient, [
33
- { address: poolAddress, abi: abis_1.FPMM_ABI, functionName: 'lpFee' },
34
- { address: poolAddress, abi: abis_1.FPMM_ABI, functionName: 'protocolFee' },
35
- ]);
36
- if (results[0].status === 'failure' || results[1].status === 'failure') {
37
- throw new Error(`Failed to read fees for pool ${poolAddress}`);
38
- }
39
- const lpFee = results[0].result;
40
- const protocolFee = results[1].result;
41
- // Convert from basis points to percentage using BigInt arithmetic to avoid precision loss
42
- const totalBasisPoints = lpFee + protocolFee;
43
- const scaled = totalBasisPoints * 1000000n;
44
- return Number(scaled / 100n) / 1e6;
45
- }
46
- /**
47
- * Calculate cost for Virtual pools
48
- */
49
- async function getVirtualPoolCostPercent(poolAddress, publicClient) {
50
- const results = await (0, multicall_1.multicall)(publicClient, [
51
- { address: poolAddress, abi: virtualPool_1.VIRTUAL_POOL_ABI, functionName: 'protocolFee' },
52
- ]);
53
- if (results[0].status === 'failure') {
54
- throw new Error(`Failed to read protocolFee for pool ${poolAddress}`);
55
- }
56
- // Convert from basis points to percentage using BigInt arithmetic to avoid precision loss
57
- const scaled = results[0].result * 1000000n;
58
- return Number(scaled / 100n) / 1e6;
59
- }
60
- //# sourceMappingURL=costUtils.js.map
@@ -1,21 +0,0 @@
1
- /**
2
- * Creates a deadline timestamp from a duration in minutes.
3
- *
4
- * @param minutes - Number of minutes from now
5
- * @returns Unix timestamp as bigint suitable for router contract deadline parameter
6
- *
7
- * @example
8
- * ```typescript
9
- * import { deadlineFromMinutes } from '@mento-protocol/mento-sdk'
10
- *
11
- * // 5 minute deadline
12
- * const deadline = deadlineFromMinutes(5)
13
- *
14
- * const swap = await mento.swap.buildSwapParams(
15
- * tokenIn, tokenOut, amountIn, recipient,
16
- * { slippageTolerance: 0.5, deadline }
17
- * )
18
- * ```
19
- */
20
- export declare function deadlineFromMinutes(minutes: number): bigint;
21
- //# sourceMappingURL=deadline.d.ts.map
@@ -1,26 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.deadlineFromMinutes = deadlineFromMinutes;
4
- /**
5
- * Creates a deadline timestamp from a duration in minutes.
6
- *
7
- * @param minutes - Number of minutes from now
8
- * @returns Unix timestamp as bigint suitable for router contract deadline parameter
9
- *
10
- * @example
11
- * ```typescript
12
- * import { deadlineFromMinutes } from '@mento-protocol/mento-sdk'
13
- *
14
- * // 5 minute deadline
15
- * const deadline = deadlineFromMinutes(5)
16
- *
17
- * const swap = await mento.swap.buildSwapParams(
18
- * tokenIn, tokenOut, amountIn, recipient,
19
- * { slippageTolerance: 0.5, deadline }
20
- * )
21
- * ```
22
- */
23
- function deadlineFromMinutes(minutes) {
24
- return BigInt(Date.now()) / 1000n + BigInt(minutes * 60);
25
- }
26
- //# sourceMappingURL=deadline.js.map
@@ -1,10 +0,0 @@
1
- export * from './retry';
2
- export * from './chainConfig';
3
- export * from './routes';
4
- export * from './sortUtils';
5
- export * from './pathEncoder';
6
- export * from './tokens';
7
- export * from './rateFeed';
8
- export * from './tradingLimits';
9
- export * from './deadline';
10
- //# sourceMappingURL=index.d.ts.map
@@ -1,26 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./retry"), exports);
18
- __exportStar(require("./chainConfig"), exports);
19
- __exportStar(require("./routes"), exports);
20
- __exportStar(require("./sortUtils"), exports);
21
- __exportStar(require("./pathEncoder"), exports);
22
- __exportStar(require("./tokens"), exports);
23
- __exportStar(require("./rateFeed"), exports);
24
- __exportStar(require("./tradingLimits"), exports);
25
- __exportStar(require("./deadline"), exports);
26
- //# sourceMappingURL=index.js.map
@@ -1,30 +0,0 @@
1
- import type { Abi, PublicClient } from 'viem';
2
- /**
3
- * Standard Multicall3 contract address, deployed at the same address on all EVM chains.
4
- * https://www.multicall3.com/
5
- */
6
- export declare const MULTICALL3_ADDRESS: "0xcA11bde05977b3631167028862bE2a173976CA11";
7
- type MulticallResult = {
8
- status: 'success';
9
- result: unknown;
10
- } | {
11
- status: 'failure';
12
- error: Error;
13
- };
14
- interface ContractCall {
15
- address: `0x${string}`;
16
- abi: Abi | readonly unknown[];
17
- functionName: string;
18
- args?: readonly unknown[];
19
- }
20
- interface MulticallOptions {
21
- allowFailure?: boolean;
22
- batchSize?: number;
23
- }
24
- /**
25
- * Wrapper around viem's multicall that explicitly provides the Multicall3 address.
26
- * This ensures multicall works even when the PublicClient was created without a `chain` config.
27
- */
28
- export declare function multicall(publicClient: PublicClient, contracts: ContractCall[], options?: MulticallOptions): Promise<MulticallResult[]>;
29
- export {};
30
- //# sourceMappingURL=multicall.d.ts.map
@@ -1,52 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.MULTICALL3_ADDRESS = void 0;
4
- exports.multicall = multicall;
5
- /**
6
- * Standard Multicall3 contract address, deployed at the same address on all EVM chains.
7
- * https://www.multicall3.com/
8
- */
9
- exports.MULTICALL3_ADDRESS = '0xcA11bde05977b3631167028862bE2a173976CA11';
10
- /**
11
- * Wrapper around viem's multicall that explicitly provides the Multicall3 address.
12
- * This ensures multicall works even when the PublicClient was created without a `chain` config.
13
- */
14
- async function multicall(publicClient, contracts, options = {}) {
15
- const { allowFailure = true, batchSize } = options;
16
- const client = publicClient;
17
- if (typeof client.multicall !== 'function') {
18
- if (typeof client.readContract !== 'function') {
19
- throw new Error('Public client does not support multicall or readContract');
20
- }
21
- return Promise.all(contracts.map(async (contract) => {
22
- try {
23
- const result = await client.readContract({
24
- ...contract,
25
- args: contract.args ?? [],
26
- });
27
- return { status: 'success', result };
28
- }
29
- catch (error) {
30
- if (!allowFailure) {
31
- throw error;
32
- }
33
- return {
34
- status: 'failure',
35
- error: error instanceof Error ? error : new Error(String(error)),
36
- };
37
- }
38
- }));
39
- }
40
- const raw = await client.multicall({
41
- allowFailure,
42
- batchSize,
43
- contracts: contracts,
44
- multicallAddress: exports.MULTICALL3_ADDRESS,
45
- });
46
- const results = raw;
47
- if (!allowFailure) {
48
- return results.map((result) => ({ status: 'success', result }));
49
- }
50
- return results;
51
- }
52
- //# sourceMappingURL=multicall.js.map
@@ -1,34 +0,0 @@
1
- import { Address } from 'viem';
2
- import { Pool } from '../core/types';
3
- /**
4
- * Route structure expected by the Router contract's getAmountsOut and swapTokensForTokens functions
5
- */
6
- export interface RouterRoute {
7
- from: Address;
8
- to: Address;
9
- factory: Address;
10
- }
11
- export type ReadonlyRouterRoutes = readonly {
12
- from: Address;
13
- to: Address;
14
- factory: Address;
15
- }[];
16
- /**
17
- * Converts a route path to the format expected by the Router contract.
18
- * Used by both QuoteService (getAmountsOut) and SwapService (swapTokensForTokens).
19
- *
20
- * @param path - The route path (array of pools)
21
- * @param tokenIn - The input token address (determines swap direction)
22
- * @param _tokenOut - The output token address (unused but kept for API clarity)
23
- * @returns Array of RouterRoute objects for the contract call
24
- * @throws {Error} If path is empty, too long, or contains invalid pools
25
- *
26
- * @example
27
- * ```typescript
28
- * const route = await routeService.findRoute(USDm, CELO)
29
- * const routerRoutes = encodeRoutePath(route.path, USDm, CELO)
30
- * // routerRoutes can now be passed to Router.getAmountsOut or Router.swapTokensForTokens
31
- * ```
32
- */
33
- export declare function encodeRoutePath(path: Pool[], tokenIn: Address, _tokenOut: Address): RouterRoute[];
34
- //# sourceMappingURL=pathEncoder.d.ts.map
@@ -1,73 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.encodeRoutePath = encodeRoutePath;
4
- /**
5
- * Converts a route path to the format expected by the Router contract.
6
- * Used by both QuoteService (getAmountsOut) and SwapService (swapTokensForTokens).
7
- *
8
- * @param path - The route path (array of pools)
9
- * @param tokenIn - The input token address (determines swap direction)
10
- * @param _tokenOut - The output token address (unused but kept for API clarity)
11
- * @returns Array of RouterRoute objects for the contract call
12
- * @throws {Error} If path is empty, too long, or contains invalid pools
13
- *
14
- * @example
15
- * ```typescript
16
- * const route = await routeService.findRoute(USDm, CELO)
17
- * const routerRoutes = encodeRoutePath(route.path, USDm, CELO)
18
- * // routerRoutes can now be passed to Router.getAmountsOut or Router.swapTokensForTokens
19
- * ```
20
- */
21
- function encodeRoutePath(path, tokenIn, _tokenOut) {
22
- // Validate path is not empty
23
- if (!path || path.length === 0) {
24
- throw new Error('Internal error: Route path is empty. This should not happen - routes are validated before encoding.');
25
- }
26
- // Validate all pools have required structure
27
- for (let i = 0; i < path.length; i++) {
28
- const pool = path[i];
29
- if (!pool.token0 || !pool.token1 || !pool.factoryAddr) {
30
- throw new Error(`Invalid pool structure at index ${i}: missing required fields. ` +
31
- `Pool must have token0, token1, and factoryAddr. ` +
32
- `Got: ${JSON.stringify(pool)}`);
33
- }
34
- }
35
- const routes = [];
36
- const tokenInLower = tokenIn.toLowerCase();
37
- // Check if we need to reverse the path
38
- // The path is stored in canonical order, but we may need to traverse it backwards
39
- const firstPool = path[0];
40
- const startsWithTokenIn = firstPool.token0.toLowerCase() === tokenInLower || firstPool.token1.toLowerCase() === tokenInLower;
41
- // If tokenIn isn't in the first pool, reverse the path
42
- const orderedPath = startsWithTokenIn ? path : [...path].reverse();
43
- let currentTokenIn = tokenInLower;
44
- for (const pool of orderedPath) {
45
- const token0 = pool.token0.toLowerCase();
46
- const token1 = pool.token1.toLowerCase();
47
- // Determine direction: which token is the input for this hop?
48
- let from;
49
- let to;
50
- if (currentTokenIn === token0) {
51
- from = pool.token0;
52
- to = pool.token1;
53
- }
54
- else if (currentTokenIn === token1) {
55
- from = pool.token1;
56
- to = pool.token0;
57
- }
58
- else {
59
- throw new Error(`Route encoding error: Token ${currentTokenIn} not found in pool ${pool.poolAddr}. ` +
60
- `Pool contains tokens: ${token0}, ${token1}. ` +
61
- `This indicates the route path is invalid or tokens don't form a connected path.`);
62
- }
63
- routes.push({
64
- from,
65
- to,
66
- factory: pool.factoryAddr,
67
- });
68
- // The output of this hop becomes the input of the next hop
69
- currentTokenIn = to.toLowerCase();
70
- }
71
- return routes;
72
- }
73
- //# sourceMappingURL=pathEncoder.js.map
@@ -1,18 +0,0 @@
1
- /**
2
- * Computes the rate feed ID from a rate feed identifier string.
3
- * Follows the Solidity formula: address(uint160(uint256(keccak256(abi.encodePacked(rateFeed)))))
4
- *
5
- * @param rateFeed - The rate feed identifier string (e.g., "EURUSD", "relayed:COPUSD")
6
- * @returns The computed rate feed address as a hex string
7
- *
8
- * @example
9
- * ```typescript
10
- * const rateFeedId = toRateFeedId('EURUSD')
11
- * // Returns the computed address for the EURUSD rate feed
12
- *
13
- * const relayedRateFeedId = toRateFeedId('relayed:COPUSD')
14
- * // Returns the computed address for the relayed COPUSD rate feed
15
- * ```
16
- */
17
- export declare function toRateFeedId(rateFeed: string): `0x${string}`;
18
- //# sourceMappingURL=rateFeed.d.ts.map
@@ -1,27 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.toRateFeedId = toRateFeedId;
4
- const viem_1 = require("viem");
5
- /**
6
- * Computes the rate feed ID from a rate feed identifier string.
7
- * Follows the Solidity formula: address(uint160(uint256(keccak256(abi.encodePacked(rateFeed)))))
8
- *
9
- * @param rateFeed - The rate feed identifier string (e.g., "EURUSD", "relayed:COPUSD")
10
- * @returns The computed rate feed address as a hex string
11
- *
12
- * @example
13
- * ```typescript
14
- * const rateFeedId = toRateFeedId('EURUSD')
15
- * // Returns the computed address for the EURUSD rate feed
16
- *
17
- * const relayedRateFeedId = toRateFeedId('relayed:COPUSD')
18
- * // Returns the computed address for the relayed COPUSD rate feed
19
- * ```
20
- */
21
- function toRateFeedId(rateFeed) {
22
- const hashedBytes = (0, viem_1.keccak256)((0, viem_1.toBytes)(rateFeed));
23
- const hashAsBigInt = BigInt(hashedBytes);
24
- const maskedToUint160 = hashAsBigInt & ((1n << 160n) - 1n);
25
- return `0x${maskedToUint160.toString(16).padStart(40, '0')}`;
26
- }
27
- //# sourceMappingURL=rateFeed.js.map
@@ -1,12 +0,0 @@
1
- export interface RetryOptions {
2
- maxAttempts?: number;
3
- initialDelayMs?: number;
4
- }
5
- /**
6
- * Retry an operation a number of times with exponential backoff.
7
- * @param operation - The operation to retry
8
- * @param options - The retry options
9
- * @returns The result of the operation
10
- */
11
- export declare function retryOperation<T>(operation: () => Promise<T>, options?: RetryOptions): Promise<T>;
12
- //# sourceMappingURL=retry.d.ts.map
@@ -1,28 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.retryOperation = retryOperation;
4
- /**
5
- * Retry an operation a number of times with exponential backoff.
6
- * @param operation - The operation to retry
7
- * @param options - The retry options
8
- * @returns The result of the operation
9
- */
10
- async function retryOperation(operation, options = {}) {
11
- const maxAttempts = options.maxAttempts ?? 3;
12
- const delayMs = options.initialDelayMs ?? 1000;
13
- let lastError;
14
- for (let attempt = 1; attempt <= maxAttempts; attempt++) {
15
- try {
16
- return await operation();
17
- }
18
- catch (error) {
19
- lastError = error;
20
- if (attempt === maxAttempts)
21
- break;
22
- // Exponential backoff
23
- await new Promise((resolve) => setTimeout(resolve, delayMs * attempt));
24
- }
25
- }
26
- throw new Error(`Operation failed after ${maxAttempts} attempts: ${lastError?.message}`);
27
- }
28
- //# sourceMappingURL=retry.js.map
@@ -1,3 +0,0 @@
1
- export { getCachedRoutes, cachedRoutes } from '../cache/routes';
2
- export type { RouteWithCost } from '../core/types';
3
- //# sourceMappingURL=routes.d.ts.map
@@ -1,8 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.cachedRoutes = exports.getCachedRoutes = void 0;
4
- // Re-export from consolidated cache
5
- var routes_1 = require("../cache/routes");
6
- Object.defineProperty(exports, "getCachedRoutes", { enumerable: true, get: function () { return routes_1.getCachedRoutes; } });
7
- Object.defineProperty(exports, "cachedRoutes", { enumerable: true, get: function () { return routes_1.cachedRoutes; } });
8
- //# sourceMappingURL=routes.js.map
@@ -1,24 +0,0 @@
1
- import { Address } from 'viem';
2
- /**
3
- * Sorts two token addresses to match the smart contract's _sortTokens behavior.
4
- * Compares addresses as numeric values (BigInt), matching Solidity's address comparison.
5
- *
6
- * Solidity reference:
7
- * ```solidity
8
- * function _sortTokens(address a, address b) private pure returns (address, address) {
9
- * return (a < b) ? (a, b) : (b, a);
10
- * }
11
- * ```
12
- */
13
- export declare function sortTokenAddresses(tokenA: Address, tokenB: Address): [Address, Address];
14
- /**
15
- * Creates a canonical route ID from two addresses.
16
- * Uses numeric address comparison to match contract behavior.
17
- */
18
- export declare function canonicalAddressKey(addressA: Address, addressB: Address, separator?: string): string;
19
- /**
20
- * Creates a canonical pair key from two symbols.
21
- * Uses standard string comparison for human-readable IDs.
22
- */
23
- export declare function canonicalSymbolKey(symbolA: string, symbolB: string, separator?: string): string;
24
- //# sourceMappingURL=sortUtils.d.ts.map
@@ -1,39 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.sortTokenAddresses = sortTokenAddresses;
4
- exports.canonicalAddressKey = canonicalAddressKey;
5
- exports.canonicalSymbolKey = canonicalSymbolKey;
6
- /**
7
- * Sorts two token addresses to match the smart contract's _sortTokens behavior.
8
- * Compares addresses as numeric values (BigInt), matching Solidity's address comparison.
9
- *
10
- * Solidity reference:
11
- * ```solidity
12
- * function _sortTokens(address a, address b) private pure returns (address, address) {
13
- * return (a < b) ? (a, b) : (b, a);
14
- * }
15
- * ```
16
- */
17
- function sortTokenAddresses(tokenA, tokenB) {
18
- return BigInt(tokenA) < BigInt(tokenB)
19
- ? [tokenA, tokenB]
20
- : [tokenB, tokenA];
21
- }
22
- /**
23
- * Creates a canonical route ID from two addresses.
24
- * Uses numeric address comparison to match contract behavior.
25
- */
26
- function canonicalAddressKey(addressA, addressB, separator = '-') {
27
- const [first, second] = sortTokenAddresses(addressA, addressB);
28
- return `${first}${separator}${second}`;
29
- }
30
- /**
31
- * Creates a canonical pair key from two symbols.
32
- * Uses standard string comparison for human-readable IDs.
33
- */
34
- function canonicalSymbolKey(symbolA, symbolB, separator = '-') {
35
- return symbolA < symbolB
36
- ? `${symbolA}${separator}${symbolB}`
37
- : `${symbolB}${separator}${symbolA}`;
38
- }
39
- //# sourceMappingURL=sortUtils.js.map
@@ -1,2 +0,0 @@
1
- export { TokenSymbol, cachedTokens, getCachedTokens, getCachedTokensSync, getTokenAddress, findTokenBySymbol, TOKEN_ADDRESSES_BY_CHAIN, } from '../cache/tokens';
2
- //# sourceMappingURL=tokens.d.ts.map
@@ -1,13 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.TOKEN_ADDRESSES_BY_CHAIN = exports.findTokenBySymbol = exports.getTokenAddress = exports.getCachedTokensSync = exports.getCachedTokens = exports.cachedTokens = exports.TokenSymbol = void 0;
4
- // Re-export from consolidated cache
5
- var tokens_1 = require("../cache/tokens");
6
- Object.defineProperty(exports, "TokenSymbol", { enumerable: true, get: function () { return tokens_1.TokenSymbol; } });
7
- Object.defineProperty(exports, "cachedTokens", { enumerable: true, get: function () { return tokens_1.cachedTokens; } });
8
- Object.defineProperty(exports, "getCachedTokens", { enumerable: true, get: function () { return tokens_1.getCachedTokens; } });
9
- Object.defineProperty(exports, "getCachedTokensSync", { enumerable: true, get: function () { return tokens_1.getCachedTokensSync; } });
10
- Object.defineProperty(exports, "getTokenAddress", { enumerable: true, get: function () { return tokens_1.getTokenAddress; } });
11
- Object.defineProperty(exports, "findTokenBySymbol", { enumerable: true, get: function () { return tokens_1.findTokenBySymbol; } });
12
- Object.defineProperty(exports, "TOKEN_ADDRESSES_BY_CHAIN", { enumerable: true, get: function () { return tokens_1.TOKEN_ADDRESSES_BY_CHAIN; } });
13
- //# sourceMappingURL=tokens.js.map
@@ -1,41 +0,0 @@
1
- import type { TradingLimit, TradingLimitsConfigV1, TradingLimitsStateV1, TradingLimitsConfigV2, TradingLimitsStateV2 } from '../core/types';
2
- /**
3
- * Compute limit ID for Broker (V1) trading limits.
4
- * limitId = exchangeId XOR bytes32(uint256(uint160(token)))
5
- *
6
- * @param exchangeId - The exchange ID (bytes32)
7
- * @param token - The token address
8
- * @returns The limit ID as hex string
9
- */
10
- export declare function computeLimitId(exchangeId: string, token: string): `0x${string}`;
11
- /**
12
- * Calculate trading limits from V1 config and state (Broker/Virtual pools).
13
- * Returns human-friendly TradingLimit objects with maxIn/maxOut/until.
14
- *
15
- * @param config - V1 trading limits configuration
16
- * @param state - V1 trading limits state
17
- * @param asset - Token address
18
- * @param tokenDecimals - Token decimals for consumer reference
19
- * @returns Array of TradingLimit objects
20
- */
21
- export declare function calculateTradingLimitsV1(config: TradingLimitsConfigV1, state: TradingLimitsStateV1, asset: string, tokenDecimals: number): TradingLimit[];
22
- /**
23
- * Calculate trading limits from V2 config and state (FPMM pools).
24
- * V2 uses fixed timeframes: 5 min for L0, 1 day for L1.
25
- * Values are stored with 15 decimals precision.
26
- *
27
- * @param config - V2 trading limits configuration
28
- * @param state - V2 trading limits state
29
- * @param asset - Token address
30
- * @returns Array of TradingLimit objects
31
- */
32
- export declare function calculateTradingLimitsV2(config: TradingLimitsConfigV2, state: TradingLimitsStateV2, asset: string): TradingLimit[];
33
- /**
34
- * Check if any trading limits are configured (flags > 0 for V1, or limit0/limit1 > 0 for V2)
35
- */
36
- export declare function hasConfiguredLimitsV1(config: TradingLimitsConfigV1): boolean;
37
- /**
38
- * Check if any trading limits are configured for V2
39
- */
40
- export declare function hasConfiguredLimitsV2(config: TradingLimitsConfigV2): boolean;
41
- //# sourceMappingURL=tradingLimits.d.ts.map