@mento-protocol/mento-sdk 3.2.3 → 3.2.4

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 (396) hide show
  1. package/dist/cache/routes.d.ts +13 -0
  2. package/dist/cache/routes.js +14089 -0
  3. package/dist/cache/tokens.d.ts +68 -0
  4. package/dist/cache/tokens.js +460 -0
  5. package/dist/core/abis/activePool.d.ts +2 -0
  6. package/dist/core/abis/activePool.js +14 -0
  7. package/dist/core/abis/addressesRegistry.d.ts +2 -0
  8. package/dist/core/abis/addressesRegistry.js +26 -0
  9. package/dist/core/abis/bipoolmanager.d.ts +34 -0
  10. package/dist/core/abis/bipoolmanager.js +72 -0
  11. package/dist/core/abis/borrowerOperations.d.ts +9 -0
  12. package/dist/core/abis/borrowerOperations.js +89 -0
  13. package/dist/core/abis/breakerbox.d.ts +13 -0
  14. package/dist/core/abis/breakerbox.js +8 -0
  15. package/dist/core/abis/broker.d.ts +2 -0
  16. package/dist/core/abis/broker.js +9 -0
  17. package/dist/core/abis/erc20.d.ts +9 -0
  18. package/dist/core/abis/erc20.js +21 -0
  19. package/dist/core/abis/fpmm.d.ts +270 -0
  20. package/dist/core/abis/fpmm.js +49 -0
  21. package/dist/core/abis/fpmmFactory.d.ts +85 -0
  22. package/dist/core/abis/fpmmFactory.js +26 -0
  23. package/dist/core/abis/hintHelpers.d.ts +2 -0
  24. package/dist/core/abis/hintHelpers.js +14 -0
  25. package/dist/core/abis/index.d.ts +22 -0
  26. package/dist/core/abis/index.js +38 -0
  27. package/dist/core/abis/liquidityStrategy.d.ts +132 -0
  28. package/dist/core/abis/liquidityStrategy.js +10 -0
  29. package/dist/core/abis/multiTroveGetter.d.ts +8 -0
  30. package/dist/core/abis/multiTroveGetter.js +15 -0
  31. package/dist/core/abis/priceFeed.d.ts +7 -0
  32. package/dist/core/abis/priceFeed.js +16 -0
  33. package/dist/core/abis/pricingmodule.d.ts +2 -0
  34. package/dist/core/abis/pricingmodule.js +6 -0
  35. package/dist/core/abis/reserve.d.ts +3 -0
  36. package/dist/core/abis/reserve.js +18 -0
  37. package/dist/core/abis/router.d.ts +521 -0
  38. package/dist/core/abis/router.js +45 -0
  39. package/dist/core/abis/sortedTroves.d.ts +2 -0
  40. package/dist/core/abis/sortedTroves.js +15 -0
  41. package/dist/core/abis/systemParams.d.ts +2 -0
  42. package/dist/core/abis/systemParams.js +14 -0
  43. package/dist/core/abis/troveManager.d.ts +2 -0
  44. package/dist/core/abis/troveManager.js +27 -0
  45. package/dist/core/abis/troveNFT.d.ts +2 -0
  46. package/dist/core/abis/troveNFT.js +9 -0
  47. package/dist/core/abis/virtualPool.d.ts +50 -0
  48. package/dist/core/abis/virtualPool.js +11 -0
  49. package/dist/core/abis/virtualPoolFactory.d.ts +59 -0
  50. package/dist/core/abis/virtualPoolFactory.js +17 -0
  51. package/dist/core/constants/addresses.d.ts +18 -0
  52. package/dist/core/constants/addresses.js +113 -0
  53. package/dist/core/constants/borrowConstants.d.ts +10 -0
  54. package/dist/core/constants/borrowConstants.js +16 -0
  55. package/dist/core/constants/borrowRegistries.d.ts +7 -0
  56. package/dist/core/constants/borrowRegistries.js +30 -0
  57. package/dist/core/constants/chainId.d.ts +7 -0
  58. package/dist/{cjs/enums → core/constants}/chainId.js +4 -1
  59. package/dist/core/constants/contractNames.d.ts +21 -0
  60. package/dist/core/constants/contractNames.js +24 -0
  61. package/dist/core/constants/index.d.ts +6 -0
  62. package/dist/core/constants/index.js +22 -0
  63. package/dist/core/errors/base.d.ts +8 -0
  64. package/dist/core/errors/base.js +17 -0
  65. package/dist/core/errors/index.d.ts +4 -0
  66. package/dist/{cjs/constants → core/errors}/index.js +4 -4
  67. package/dist/core/errors/oracle.d.ts +9 -0
  68. package/dist/core/errors/oracle.js +15 -0
  69. package/dist/core/errors/router.d.ts +14 -0
  70. package/dist/core/errors/router.js +24 -0
  71. package/dist/core/types/borrow.d.ts +87 -0
  72. package/dist/{cjs/interfaces/tradingLimitsConfig.js → core/types/borrow.js} +1 -0
  73. package/dist/core/types/contractAddresses.d.ts +42 -0
  74. package/dist/{cjs → core}/types/contractAddresses.js +1 -0
  75. package/dist/core/types/index.d.ts +10 -0
  76. package/dist/core/types/index.js +26 -0
  77. package/dist/core/types/liquidity.d.ts +194 -0
  78. package/dist/core/types/liquidity.js +3 -0
  79. package/dist/core/types/pool.d.ts +208 -0
  80. package/dist/core/types/pool.js +14 -0
  81. package/dist/core/types/provider.d.ts +45 -0
  82. package/dist/{cjs/interfaces/tradingLimitsState.js → core/types/provider.js} +1 -0
  83. package/dist/core/types/route.d.ts +62 -0
  84. package/dist/{cjs/interfaces/IChainClient.js → core/types/route.js} +1 -0
  85. package/dist/core/types/token.d.ts +21 -0
  86. package/dist/{cjs/interfaces/tradingLimit.js → core/types/token.js} +1 -0
  87. package/dist/core/types/tradingLimits.d.ts +91 -0
  88. package/dist/core/types/tradingLimits.js +3 -0
  89. package/dist/core/types/tradingMode.d.ts +24 -0
  90. package/dist/core/types/tradingMode.js +31 -0
  91. package/dist/core/types/transaction.d.ts +45 -0
  92. package/dist/core/types/transaction.js +3 -0
  93. package/dist/esm/cache/routes.js +14084 -0
  94. package/dist/esm/cache/tokens.js +452 -0
  95. package/dist/esm/core/abis/activePool.js +10 -0
  96. package/dist/esm/core/abis/addressesRegistry.js +22 -0
  97. package/dist/esm/core/abis/bipoolmanager.js +68 -0
  98. package/dist/esm/core/abis/borrowerOperations.js +85 -0
  99. package/dist/esm/core/abis/breakerbox.js +4 -0
  100. package/dist/esm/core/abis/broker.js +5 -0
  101. package/dist/esm/core/abis/erc20.js +17 -0
  102. package/dist/esm/core/abis/fpmm.js +45 -0
  103. package/dist/esm/core/abis/fpmmFactory.js +22 -0
  104. package/dist/esm/core/abis/hintHelpers.js +10 -0
  105. package/dist/esm/core/abis/index.js +21 -0
  106. package/dist/esm/core/abis/liquidityStrategy.js +6 -0
  107. package/dist/esm/core/abis/multiTroveGetter.js +11 -0
  108. package/dist/esm/core/abis/priceFeed.js +12 -0
  109. package/dist/esm/core/abis/pricingmodule.js +2 -0
  110. package/dist/esm/core/abis/reserve.js +14 -0
  111. package/dist/esm/core/abis/router.js +41 -0
  112. package/dist/esm/core/abis/sortedTroves.js +11 -0
  113. package/dist/esm/core/abis/systemParams.js +10 -0
  114. package/dist/esm/core/abis/troveManager.js +23 -0
  115. package/dist/esm/core/abis/troveNFT.js +5 -0
  116. package/dist/esm/core/abis/virtualPool.js +7 -0
  117. package/dist/esm/core/abis/virtualPoolFactory.js +13 -0
  118. package/dist/esm/core/constants/addresses.js +107 -0
  119. package/dist/esm/core/constants/borrowConstants.js +12 -0
  120. package/dist/esm/core/constants/borrowRegistries.js +25 -0
  121. package/dist/esm/{enums → core/constants}/chainId.js +2 -0
  122. package/dist/esm/core/constants/contractNames.js +20 -0
  123. package/dist/esm/core/constants/index.js +5 -0
  124. package/dist/esm/core/errors/base.js +12 -0
  125. package/dist/esm/core/errors/index.js +3 -0
  126. package/dist/esm/core/errors/oracle.js +10 -0
  127. package/dist/esm/core/errors/router.js +18 -0
  128. package/dist/esm/core/types/index.js +9 -0
  129. package/dist/esm/core/types/pool.js +10 -0
  130. package/dist/esm/core/types/tradingLimits.js +1 -0
  131. package/dist/esm/core/types/tradingMode.js +26 -0
  132. package/dist/esm/core/types/transaction.js +1 -0
  133. package/dist/esm/index.js +138 -6
  134. package/dist/esm/package.json +1 -0
  135. package/dist/esm/services/borrow/BorrowService.js +455 -0
  136. package/dist/esm/services/borrow/borrowHelpers.js +3 -0
  137. package/dist/esm/services/borrow/borrowMath.js +127 -0
  138. package/dist/esm/services/borrow/index.js +3 -0
  139. package/dist/esm/services/borrow/internal/borrowApprovalService.js +48 -0
  140. package/dist/esm/services/borrow/internal/borrowContextStore.js +35 -0
  141. package/dist/esm/services/borrow/internal/borrowErc20.js +38 -0
  142. package/dist/esm/services/borrow/internal/borrowHints.js +27 -0
  143. package/dist/esm/services/borrow/internal/borrowPositionParser.js +82 -0
  144. package/dist/esm/services/borrow/internal/borrowReadService.js +271 -0
  145. package/dist/esm/services/borrow/internal/borrowRegistryReader.js +108 -0
  146. package/dist/esm/services/borrow/internal/borrowTransactionService.js +271 -0
  147. package/dist/esm/services/borrow/internal/borrowTypes.js +1 -0
  148. package/dist/esm/services/borrow/internal/borrowValidation.js +89 -0
  149. package/dist/esm/services/index.js +8 -0
  150. package/dist/esm/services/liquidity/LiquidityService.js +163 -0
  151. package/dist/esm/services/liquidity/basicLiquidity.js +162 -0
  152. package/dist/esm/services/liquidity/index.js +1 -0
  153. package/dist/esm/services/liquidity/liquidityHelpers.js +95 -0
  154. package/dist/esm/services/liquidity/rebalance.js +59 -0
  155. package/dist/esm/services/liquidity/zapHelpers.js +120 -0
  156. package/dist/esm/services/liquidity/zapIn.js +112 -0
  157. package/dist/esm/services/liquidity/zapOut.js +248 -0
  158. package/dist/esm/services/pools/PoolService.js +204 -0
  159. package/dist/esm/services/pools/index.js +1 -0
  160. package/dist/esm/services/pools/poolDetails.js +209 -0
  161. package/dist/esm/services/pools/poolDiscovery.js +112 -0
  162. package/dist/esm/services/pools/rebalancePreview.js +181 -0
  163. package/dist/esm/services/quotes/QuoteService.js +85 -0
  164. package/dist/esm/services/quotes/index.js +1 -0
  165. package/dist/esm/services/routes/RouteService.js +268 -0
  166. package/dist/esm/services/routes/index.js +1 -0
  167. package/dist/esm/services/swap/SwapService.js +247 -0
  168. package/dist/esm/services/swap/index.js +1 -0
  169. package/dist/esm/services/tokens/index.js +1 -0
  170. package/dist/esm/services/tokens/tokenService.js +285 -0
  171. package/dist/esm/services/trading/TradingLimitsService.js +154 -0
  172. package/dist/esm/services/trading/TradingService.js +196 -0
  173. package/dist/esm/services/trading/index.js +2 -0
  174. package/dist/esm/utils/chainConfig.js +118 -0
  175. package/dist/esm/utils/costUtils.js +56 -0
  176. package/dist/esm/utils/deadline.js +22 -0
  177. package/dist/esm/utils/index.js +9 -0
  178. package/dist/esm/utils/multicall.js +47 -0
  179. package/dist/esm/utils/pathEncoder.js +69 -0
  180. package/dist/esm/utils/rateFeed.js +23 -0
  181. package/dist/esm/utils/retry.js +24 -0
  182. package/dist/esm/{routeUtils.js → utils/routeUtils.js} +115 -116
  183. package/dist/esm/utils/routes.js +2 -0
  184. package/dist/esm/utils/sortUtils.js +33 -0
  185. package/dist/esm/utils/tokens.js +2 -0
  186. package/dist/esm/utils/tradingLimits.js +163 -0
  187. package/dist/esm/utils/validation.js +30 -0
  188. package/dist/index.d.ts +101 -0
  189. package/dist/index.js +158 -0
  190. package/dist/services/borrow/BorrowService.d.ts +381 -0
  191. package/dist/services/borrow/BorrowService.js +460 -0
  192. package/dist/services/borrow/borrowHelpers.d.ts +4 -0
  193. package/dist/services/borrow/borrowHelpers.js +13 -0
  194. package/dist/services/borrow/borrowMath.d.ts +21 -0
  195. package/dist/services/borrow/borrowMath.js +137 -0
  196. package/dist/services/borrow/index.d.ts +4 -0
  197. package/dist/{cjs/interfaces → services/borrow}/index.js +4 -4
  198. package/dist/services/borrow/internal/borrowApprovalService.d.ts +14 -0
  199. package/dist/services/borrow/internal/borrowApprovalService.js +53 -0
  200. package/dist/services/borrow/internal/borrowContextStore.d.ts +11 -0
  201. package/dist/services/borrow/internal/borrowContextStore.js +40 -0
  202. package/dist/services/borrow/internal/borrowErc20.d.ts +5 -0
  203. package/dist/services/borrow/internal/borrowErc20.js +43 -0
  204. package/dist/services/borrow/internal/borrowHints.d.ts +7 -0
  205. package/dist/services/borrow/internal/borrowHints.js +31 -0
  206. package/dist/services/borrow/internal/borrowPositionParser.d.ts +4 -0
  207. package/dist/services/borrow/internal/borrowPositionParser.js +87 -0
  208. package/dist/services/borrow/internal/borrowReadService.d.ts +31 -0
  209. package/dist/services/borrow/internal/borrowReadService.js +276 -0
  210. package/dist/services/borrow/internal/borrowRegistryReader.d.ts +5 -0
  211. package/dist/services/borrow/internal/borrowRegistryReader.js +113 -0
  212. package/dist/services/borrow/internal/borrowTransactionService.d.ts +23 -0
  213. package/dist/services/borrow/internal/borrowTransactionService.js +276 -0
  214. package/dist/services/borrow/internal/borrowTypes.d.ts +15 -0
  215. package/dist/services/borrow/internal/borrowTypes.js +3 -0
  216. package/dist/services/borrow/internal/borrowValidation.d.ts +14 -0
  217. package/dist/services/borrow/internal/borrowValidation.js +104 -0
  218. package/dist/services/index.d.ts +9 -0
  219. package/dist/{cjs → services}/index.js +9 -7
  220. package/dist/services/liquidity/LiquidityService.d.ts +139 -0
  221. package/dist/services/liquidity/LiquidityService.js +168 -0
  222. package/dist/services/liquidity/basicLiquidity.d.ts +11 -0
  223. package/dist/services/liquidity/basicLiquidity.js +172 -0
  224. package/dist/services/liquidity/index.d.ts +2 -0
  225. package/dist/{cjs/types → services/liquidity}/index.js +2 -2
  226. package/dist/services/liquidity/liquidityHelpers.d.ts +19 -0
  227. package/dist/services/liquidity/liquidityHelpers.js +104 -0
  228. package/dist/services/liquidity/rebalance.d.ts +6 -0
  229. package/dist/services/liquidity/rebalance.js +64 -0
  230. package/dist/services/liquidity/zapHelpers.d.ts +66 -0
  231. package/dist/services/liquidity/zapHelpers.js +129 -0
  232. package/dist/services/liquidity/zapIn.d.ts +18 -0
  233. package/dist/services/liquidity/zapIn.js +119 -0
  234. package/dist/services/liquidity/zapOut.d.ts +9 -0
  235. package/dist/services/liquidity/zapOut.js +255 -0
  236. package/dist/services/pools/PoolService.d.ts +69 -0
  237. package/dist/services/pools/PoolService.js +209 -0
  238. package/dist/services/pools/index.d.ts +2 -0
  239. package/dist/{cjs/enums → services/pools}/index.js +2 -3
  240. package/dist/services/pools/poolDetails.d.ts +13 -0
  241. package/dist/services/pools/poolDetails.js +216 -0
  242. package/dist/services/pools/poolDiscovery.d.ts +12 -0
  243. package/dist/services/pools/poolDiscovery.js +117 -0
  244. package/dist/services/pools/rebalancePreview.d.ts +5 -0
  245. package/dist/services/pools/rebalancePreview.js +186 -0
  246. package/dist/services/quotes/QuoteService.d.ts +51 -0
  247. package/dist/services/quotes/QuoteService.js +91 -0
  248. package/dist/services/quotes/index.d.ts +2 -0
  249. package/dist/services/quotes/index.js +18 -0
  250. package/dist/services/routes/RouteService.d.ts +117 -0
  251. package/dist/services/routes/RouteService.js +306 -0
  252. package/dist/services/routes/index.d.ts +2 -0
  253. package/dist/services/routes/index.js +18 -0
  254. package/dist/services/swap/SwapService.d.ts +198 -0
  255. package/dist/services/swap/SwapService.js +252 -0
  256. package/dist/services/swap/index.d.ts +2 -0
  257. package/dist/services/swap/index.js +18 -0
  258. package/dist/services/tokens/index.d.ts +2 -0
  259. package/dist/services/tokens/index.js +18 -0
  260. package/dist/services/tokens/tokenService.d.ts +55 -0
  261. package/dist/services/tokens/tokenService.js +290 -0
  262. package/dist/services/trading/TradingLimitsService.d.ts +38 -0
  263. package/dist/services/trading/TradingLimitsService.js +159 -0
  264. package/dist/services/trading/TradingService.d.ts +113 -0
  265. package/dist/services/trading/TradingService.js +201 -0
  266. package/dist/services/trading/index.d.ts +3 -0
  267. package/dist/services/trading/index.js +19 -0
  268. package/dist/utils/chainConfig.d.ts +16 -0
  269. package/dist/utils/chainConfig.js +123 -0
  270. package/dist/utils/costUtils.d.ts +12 -0
  271. package/dist/utils/costUtils.js +60 -0
  272. package/dist/utils/deadline.d.ts +21 -0
  273. package/dist/utils/deadline.js +26 -0
  274. package/dist/utils/index.d.ts +10 -0
  275. package/dist/utils/index.js +26 -0
  276. package/dist/utils/multicall.d.ts +30 -0
  277. package/dist/utils/multicall.js +52 -0
  278. package/dist/utils/pathEncoder.d.ts +34 -0
  279. package/dist/utils/pathEncoder.js +73 -0
  280. package/dist/utils/rateFeed.d.ts +18 -0
  281. package/dist/utils/rateFeed.js +27 -0
  282. package/dist/utils/retry.d.ts +12 -0
  283. package/dist/utils/retry.js +28 -0
  284. package/dist/{esm → utils}/routeUtils.d.ts +84 -93
  285. package/dist/{cjs → utils}/routeUtils.js +123 -124
  286. package/dist/utils/routes.d.ts +3 -0
  287. package/dist/utils/routes.js +8 -0
  288. package/dist/utils/sortUtils.d.ts +24 -0
  289. package/dist/utils/sortUtils.js +39 -0
  290. package/dist/utils/tokens.d.ts +2 -0
  291. package/dist/utils/tokens.js +13 -0
  292. package/dist/utils/tradingLimits.d.ts +41 -0
  293. package/dist/utils/tradingLimits.js +171 -0
  294. package/dist/utils/validation.d.ts +19 -0
  295. package/dist/utils/validation.js +34 -0
  296. package/package.json +1 -1
  297. package/dist/cjs/ChainClient.d.ts +0 -9
  298. package/dist/cjs/ChainClient.js +0 -58
  299. package/dist/cjs/TestChainClient.d.ts +0 -7
  300. package/dist/cjs/TestChainClient.js +0 -41
  301. package/dist/cjs/constants/addresses.d.ts +0 -4
  302. package/dist/cjs/constants/addresses.js +0 -59
  303. package/dist/cjs/constants/currencies.d.ts +0 -5
  304. package/dist/cjs/constants/currencies.js +0 -29
  305. package/dist/cjs/constants/index.d.ts +0 -4
  306. package/dist/cjs/constants/tokens.11142220.d.ts +0 -2
  307. package/dist/cjs/constants/tokens.11142220.js +0 -128
  308. package/dist/cjs/constants/tokens.42220.d.ts +0 -2
  309. package/dist/cjs/constants/tokens.42220.js +0 -128
  310. package/dist/cjs/constants/tokens.d.ts +0 -65
  311. package/dist/cjs/constants/tokens.js +0 -170
  312. package/dist/cjs/constants/tradablePairs.11142220.d.ts +0 -2
  313. package/dist/cjs/constants/tradablePairs.11142220.js +0 -7391
  314. package/dist/cjs/constants/tradablePairs.42220.d.ts +0 -2
  315. package/dist/cjs/constants/tradablePairs.42220.js +0 -7391
  316. package/dist/cjs/constants/tradablePairs.d.ts +0 -16
  317. package/dist/cjs/constants/tradablePairs.js +0 -53
  318. package/dist/cjs/enums/chainId.d.ts +0 -4
  319. package/dist/cjs/enums/index.d.ts +0 -3
  320. package/dist/cjs/enums/proposalState.d.ts +0 -10
  321. package/dist/cjs/enums/proposalState.js +0 -14
  322. package/dist/cjs/enums/tradingMode.d.ts +0 -17
  323. package/dist/cjs/enums/tradingMode.js +0 -21
  324. package/dist/cjs/governance.d.ts +0 -62
  325. package/dist/cjs/governance.js +0 -151
  326. package/dist/cjs/index.d.ts +0 -7
  327. package/dist/cjs/interfaces/IChainClient.d.ts +0 -6
  328. package/dist/cjs/interfaces/index.d.ts +0 -4
  329. package/dist/cjs/interfaces/tradingLimit.d.ts +0 -7
  330. package/dist/cjs/interfaces/tradingLimitsConfig.d.ts +0 -10
  331. package/dist/cjs/interfaces/tradingLimitsState.d.ts +0 -9
  332. package/dist/cjs/limits.d.ts +0 -33
  333. package/dist/cjs/limits.js +0 -130
  334. package/dist/cjs/mento.d.ts +0 -287
  335. package/dist/cjs/mento.js +0 -699
  336. package/dist/cjs/routeUtils.d.ts +0 -304
  337. package/dist/cjs/types/contractAddressMap.d.ts +0 -4
  338. package/dist/cjs/types/contractAddressMap.js +0 -2
  339. package/dist/cjs/types/contractAddresses.d.ts +0 -23
  340. package/dist/cjs/types/index.d.ts +0 -2
  341. package/dist/cjs/utils.d.ts +0 -80
  342. package/dist/cjs/utils.js +0 -177
  343. package/dist/esm/ChainClient.d.ts +0 -9
  344. package/dist/esm/ChainClient.js +0 -54
  345. package/dist/esm/TestChainClient.d.ts +0 -7
  346. package/dist/esm/TestChainClient.js +0 -37
  347. package/dist/esm/constants/addresses.d.ts +0 -4
  348. package/dist/esm/constants/addresses.js +0 -55
  349. package/dist/esm/constants/currencies.d.ts +0 -5
  350. package/dist/esm/constants/currencies.js +0 -26
  351. package/dist/esm/constants/index.d.ts +0 -4
  352. package/dist/esm/constants/index.js +0 -4
  353. package/dist/esm/constants/tokens.11142220.d.ts +0 -2
  354. package/dist/esm/constants/tokens.11142220.js +0 -125
  355. package/dist/esm/constants/tokens.42220.d.ts +0 -2
  356. package/dist/esm/constants/tokens.42220.js +0 -125
  357. package/dist/esm/constants/tokens.d.ts +0 -65
  358. package/dist/esm/constants/tokens.js +0 -142
  359. package/dist/esm/constants/tradablePairs.11142220.d.ts +0 -2
  360. package/dist/esm/constants/tradablePairs.11142220.js +0 -7388
  361. package/dist/esm/constants/tradablePairs.42220.d.ts +0 -2
  362. package/dist/esm/constants/tradablePairs.42220.js +0 -7388
  363. package/dist/esm/constants/tradablePairs.d.ts +0 -16
  364. package/dist/esm/constants/tradablePairs.js +0 -26
  365. package/dist/esm/enums/chainId.d.ts +0 -4
  366. package/dist/esm/enums/index.d.ts +0 -3
  367. package/dist/esm/enums/index.js +0 -3
  368. package/dist/esm/enums/proposalState.d.ts +0 -10
  369. package/dist/esm/enums/proposalState.js +0 -11
  370. package/dist/esm/enums/tradingMode.d.ts +0 -17
  371. package/dist/esm/enums/tradingMode.js +0 -18
  372. package/dist/esm/governance.d.ts +0 -62
  373. package/dist/esm/governance.js +0 -147
  374. package/dist/esm/index.d.ts +0 -7
  375. package/dist/esm/interfaces/IChainClient.d.ts +0 -6
  376. package/dist/esm/interfaces/index.d.ts +0 -4
  377. package/dist/esm/interfaces/index.js +0 -4
  378. package/dist/esm/interfaces/tradingLimit.d.ts +0 -7
  379. package/dist/esm/interfaces/tradingLimitsConfig.d.ts +0 -10
  380. package/dist/esm/interfaces/tradingLimitsState.d.ts +0 -9
  381. package/dist/esm/limits.d.ts +0 -33
  382. package/dist/esm/limits.js +0 -123
  383. package/dist/esm/mento.d.ts +0 -287
  384. package/dist/esm/mento.js +0 -671
  385. package/dist/esm/types/contractAddressMap.d.ts +0 -4
  386. package/dist/esm/types/contractAddresses.d.ts +0 -23
  387. package/dist/esm/types/index.d.ts +0 -2
  388. package/dist/esm/types/index.js +0 -2
  389. package/dist/esm/utils.d.ts +0 -80
  390. package/dist/esm/utils.js +0 -162
  391. /package/dist/esm/{interfaces/IChainClient.js → core/types/borrow.js} +0 -0
  392. /package/dist/esm/{types → core/types}/contractAddresses.js +0 -0
  393. /package/dist/esm/{interfaces/tradingLimit.js → core/types/liquidity.js} +0 -0
  394. /package/dist/esm/{interfaces/tradingLimitsConfig.js → core/types/provider.js} +0 -0
  395. /package/dist/esm/{interfaces/tradingLimitsState.js → core/types/route.js} +0 -0
  396. /package/dist/esm/{types/contractAddressMap.js → core/types/token.js} +0 -0
@@ -0,0 +1,159 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TradingLimitsService = void 0;
4
+ const types_1 = require("../../core/types");
5
+ const abis_1 = require("../../core/abis");
6
+ const constants_1 = require("../../core/constants");
7
+ const tradingLimits_1 = require("../../utils/tradingLimits");
8
+ /**
9
+ * Service for querying trading limits from the Mento protocol.
10
+ * Supports both FPMM pools (TradingLimitsV2) and Virtual pools (TradingLimitsV1).
11
+ */
12
+ class TradingLimitsService {
13
+ constructor(publicClient, chainId) {
14
+ this.publicClient = publicClient;
15
+ this.chainId = chainId;
16
+ }
17
+ /**
18
+ * Get trading limits for a pool.
19
+ * Returns an array of TradingLimit objects for each configured limit.
20
+ *
21
+ * @param pool - The pool to get trading limits for
22
+ * @returns Array of TradingLimit objects with maxIn/maxOut/until
23
+ */
24
+ async getPoolTradingLimits(pool) {
25
+ if (pool.poolType === types_1.PoolType.FPMM) {
26
+ return this.getFPMMTradingLimits(pool);
27
+ }
28
+ else {
29
+ return this.getVirtualPoolTradingLimits(pool);
30
+ }
31
+ }
32
+ /**
33
+ * Get trading limits for an FPMM pool.
34
+ * FPMM pools use TradingLimitsV2 with fixed timeframes.
35
+ */
36
+ async getFPMMTradingLimits(pool) {
37
+ const limits = [];
38
+ // Get trading limits for both tokens
39
+ const [token0Limits, token1Limits] = await Promise.all([
40
+ this.getFPMMTokenLimits(pool.poolAddr, pool.token0),
41
+ this.getFPMMTokenLimits(pool.poolAddr, pool.token1),
42
+ ]);
43
+ limits.push(...token0Limits);
44
+ limits.push(...token1Limits);
45
+ return limits;
46
+ }
47
+ /**
48
+ * Get trading limits for a specific token in an FPMM pool.
49
+ */
50
+ async getFPMMTokenLimits(poolAddr, token) {
51
+ try {
52
+ const result = await this.publicClient.readContract({
53
+ address: poolAddr,
54
+ abi: abis_1.FPMM_ABI,
55
+ functionName: 'getTradingLimits',
56
+ args: [token],
57
+ });
58
+ // Result is a tuple: [config, state]
59
+ const [configTuple, stateTuple] = result;
60
+ const config = {
61
+ limit0: configTuple.limit0,
62
+ limit1: configTuple.limit1,
63
+ decimals: configTuple.decimals,
64
+ };
65
+ const state = {
66
+ lastUpdated0: Number(stateTuple.lastUpdated0),
67
+ lastUpdated1: Number(stateTuple.lastUpdated1),
68
+ netflow0: stateTuple.netflow0,
69
+ netflow1: stateTuple.netflow1,
70
+ };
71
+ if (!(0, tradingLimits_1.hasConfiguredLimitsV2)(config)) {
72
+ return [];
73
+ }
74
+ return (0, tradingLimits_1.calculateTradingLimitsV2)(config, state, token);
75
+ }
76
+ catch {
77
+ // Token may not have limits configured, or invalid token
78
+ return [];
79
+ }
80
+ }
81
+ /**
82
+ * Get trading limits for a Virtual pool.
83
+ * Virtual pools use TradingLimitsV1 via the Broker contract.
84
+ */
85
+ async getVirtualPoolTradingLimits(pool) {
86
+ if (!pool.exchangeId) {
87
+ return [];
88
+ }
89
+ const limits = [];
90
+ // Get trading limits for both tokens
91
+ const [token0Limits, token1Limits] = await Promise.all([
92
+ this.getVirtualPoolTokenLimits(pool.exchangeId, pool.token0),
93
+ this.getVirtualPoolTokenLimits(pool.exchangeId, pool.token1),
94
+ ]);
95
+ limits.push(...token0Limits);
96
+ limits.push(...token1Limits);
97
+ return limits;
98
+ }
99
+ /**
100
+ * Get trading limits for a specific token in a Virtual pool.
101
+ */
102
+ async getVirtualPoolTokenLimits(exchangeId, token) {
103
+ const brokerAddr = (0, constants_1.tryGetContractAddress)(this.chainId, 'Broker');
104
+ if (!brokerAddr) {
105
+ return [];
106
+ }
107
+ const limitId = (0, tradingLimits_1.computeLimitId)(exchangeId, token);
108
+ try {
109
+ // Fetch config and state in parallel
110
+ const [configResult, stateResult] = await Promise.all([
111
+ this.publicClient.readContract({
112
+ address: brokerAddr,
113
+ abi: abis_1.BROKER_ABI,
114
+ functionName: 'tradingLimitsConfig',
115
+ args: [limitId],
116
+ }),
117
+ this.publicClient.readContract({
118
+ address: brokerAddr,
119
+ abi: abis_1.BROKER_ABI,
120
+ functionName: 'tradingLimitsState',
121
+ args: [limitId],
122
+ }),
123
+ ]);
124
+ // Parse config result
125
+ const configTuple = configResult;
126
+ const config = {
127
+ timestep0: Number(configTuple[0]),
128
+ timestep1: Number(configTuple[1]),
129
+ limit0: configTuple[2],
130
+ limit1: configTuple[3],
131
+ limitGlobal: configTuple[4],
132
+ flags: Number(configTuple[5]),
133
+ };
134
+ // Parse state result
135
+ const stateTuple = stateResult;
136
+ const state = {
137
+ lastUpdated0: Number(stateTuple[0]),
138
+ lastUpdated1: Number(stateTuple[1]),
139
+ netflow0: stateTuple[2],
140
+ netflow1: stateTuple[3],
141
+ netflowGlobal: stateTuple[4],
142
+ };
143
+ // Only return limits if configured
144
+ if (!(0, tradingLimits_1.hasConfiguredLimitsV1)(config)) {
145
+ return [];
146
+ }
147
+ // Get token decimals (V1 uses 0 decimals internally, but we track token decimals for display)
148
+ // For now, return 0 as the reference - consumers should query token decimals separately
149
+ const tokenDecimals = 0; // V1 stores values with 0 decimal precision
150
+ return (0, tradingLimits_1.calculateTradingLimitsV1)(config, state, token, tokenDecimals);
151
+ }
152
+ catch {
153
+ // Trading limits may not be configured for this token
154
+ return [];
155
+ }
156
+ }
157
+ }
158
+ exports.TradingLimitsService = TradingLimitsService;
159
+ //# sourceMappingURL=TradingLimitsService.js.map
@@ -0,0 +1,113 @@
1
+ import { PublicClient } from 'viem';
2
+ import { Route, Pool, TradingLimit, PoolTradabilityStatus } from '../../core/types';
3
+ import { RouteService } from '../routes';
4
+ /**
5
+ * Service for checking trading status and circuit breaker state in the Mento protocol.
6
+ * Provides methods to query whether trading is enabled for specific rate feeds,
7
+ * token pairs, or routes. Also integrates trading limit checks.
8
+ */
9
+ export declare class TradingService {
10
+ private publicClient;
11
+ private chainId;
12
+ private routeService;
13
+ private tradingLimitsService;
14
+ constructor(publicClient: PublicClient, chainId: number, routeService: RouteService);
15
+ /**
16
+ * Returns the current trading mode for a given rate feed.
17
+ *
18
+ * The BreakerBox uses a bitmask approach where 0 means bidirectional trading
19
+ * is enabled, and any non-zero value means trading is suspended.
20
+ *
21
+ * @param rateFeedId - The address of the rate feed
22
+ * @returns The raw trading mode value from BreakerBox (0 = enabled, non-zero = suspended)
23
+ *
24
+ * @example
25
+ * ```typescript
26
+ * const mode = await tradingService.getRateFeedTradingMode(rateFeedId)
27
+ * if (mode === TradingMode.BIDIRECTIONAL) {
28
+ * console.log('Trading is enabled')
29
+ * }
30
+ * ```
31
+ */
32
+ getRateFeedTradingMode(rateFeedId: string): Promise<number>;
33
+ /**
34
+ * Checks if a trading pair is currently tradable.
35
+ * For multi-hop routes (e.g., CELO → USDm → USDT), checks that ALL
36
+ * intermediate rate feeds are in BIDIRECTIONAL mode.
37
+ *
38
+ * @param tokenIn - Input token address
39
+ * @param tokenOut - Output token address
40
+ * @returns true if the pair is tradable (all rate feeds BIDIRECTIONAL), false otherwise
41
+ * @throws {RouteNotFoundError} If no route exists between the token pair
42
+ *
43
+ * @example
44
+ * ```typescript
45
+ * const isTradable = await tradingService.isPairTradable(USDm, CELO)
46
+ * if (!isTradable) {
47
+ * console.log('Trading is currently suspended for this pair')
48
+ * }
49
+ * ```
50
+ */
51
+ isPairTradable(tokenIn: string, tokenOut: string): Promise<boolean>;
52
+ /**
53
+ * Checks if a route is currently tradable.
54
+ * Verifies that all pools in the route's path have their rate feeds
55
+ * in BIDIRECTIONAL mode.
56
+ *
57
+ * @param route - The route to check
58
+ * @returns true if all pools in the route are tradable, false otherwise
59
+ *
60
+ * @example
61
+ * ```typescript
62
+ * const route = await routeService.findRoute(tokenIn, tokenOut)
63
+ * const isRouteTradable = await tradingService.isRouteTradable(route)
64
+ * ```
65
+ */
66
+ isRouteTradable(route: Route): Promise<boolean>;
67
+ /**
68
+ * Get trading limits for a pool.
69
+ *
70
+ * @param pool - The pool to get trading limits for
71
+ * @returns Array of TradingLimit objects with maxIn/maxOut/until
72
+ *
73
+ * @example
74
+ * ```typescript
75
+ * const limits = await tradingService.getPoolTradingLimits(pool)
76
+ * limits.forEach(limit => {
77
+ * console.log(`${limit.asset}: maxIn=${limit.maxIn}, maxOut=${limit.maxOut}`)
78
+ * })
79
+ * ```
80
+ */
81
+ getPoolTradingLimits(pool: Pool): Promise<TradingLimit[]>;
82
+ /**
83
+ * Get complete tradability status for a pool.
84
+ * Returns separate flags for circuit breaker and trading limits,
85
+ * allowing frontends to show different messages for each condition.
86
+ *
87
+ * @param pool - The pool to check
88
+ * @returns PoolTradabilityStatus with tradable, circuitBreakerOk, limitsOk, and limits
89
+ *
90
+ * @example
91
+ * ```typescript
92
+ * const status = await tradingService.getPoolTradabilityStatus(pool)
93
+ * if (!status.circuitBreakerOk) {
94
+ * showModal("Trading temporarily suspended (circuit breaker)")
95
+ * } else if (!status.limitsOk) {
96
+ * showModal("Trading limit reached", status.limits)
97
+ * }
98
+ * ```
99
+ */
100
+ getPoolTradabilityStatus(pool: Pool): Promise<PoolTradabilityStatus>;
101
+ /**
102
+ * Get the reference rate feed ID for a pool.
103
+ * Both FPMM and Virtual pools expose this via the referenceRateFeedID() view function.
104
+ *
105
+ * @param pool - The pool to get rate feed ID for
106
+ * @returns The rate feed ID address
107
+ */
108
+ getPoolRateFeedId(pool: Pool): Promise<string>;
109
+ private getTradingModesForPools;
110
+ private getPoolRateFeedIds;
111
+ private getTradingModesForRateFeeds;
112
+ }
113
+ //# sourceMappingURL=TradingService.d.ts.map
@@ -0,0 +1,201 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TradingService = void 0;
4
+ const types_1 = require("../../core/types");
5
+ const TradingLimitsService_1 = require("./TradingLimitsService");
6
+ const abis_1 = require("../../core/abis");
7
+ const constants_1 = require("../../core/constants");
8
+ const multicall_1 = require("../../utils/multicall");
9
+ /**
10
+ * Service for checking trading status and circuit breaker state in the Mento protocol.
11
+ * Provides methods to query whether trading is enabled for specific rate feeds,
12
+ * token pairs, or routes. Also integrates trading limit checks.
13
+ */
14
+ class TradingService {
15
+ constructor(publicClient, chainId, routeService) {
16
+ this.publicClient = publicClient;
17
+ this.chainId = chainId;
18
+ this.routeService = routeService;
19
+ this.tradingLimitsService = new TradingLimitsService_1.TradingLimitsService(publicClient, chainId);
20
+ }
21
+ /**
22
+ * Returns the current trading mode for a given rate feed.
23
+ *
24
+ * The BreakerBox uses a bitmask approach where 0 means bidirectional trading
25
+ * is enabled, and any non-zero value means trading is suspended.
26
+ *
27
+ * @param rateFeedId - The address of the rate feed
28
+ * @returns The raw trading mode value from BreakerBox (0 = enabled, non-zero = suspended)
29
+ *
30
+ * @example
31
+ * ```typescript
32
+ * const mode = await tradingService.getRateFeedTradingMode(rateFeedId)
33
+ * if (mode === TradingMode.BIDIRECTIONAL) {
34
+ * console.log('Trading is enabled')
35
+ * }
36
+ * ```
37
+ */
38
+ async getRateFeedTradingMode(rateFeedId) {
39
+ const breakerBoxAddr = (0, constants_1.getContractAddress)(this.chainId, 'BreakerBox');
40
+ const mode = await this.publicClient.readContract({
41
+ address: breakerBoxAddr,
42
+ abi: abis_1.BREAKERBOX_ABI,
43
+ functionName: 'getRateFeedTradingMode',
44
+ args: [rateFeedId],
45
+ });
46
+ return Number(mode);
47
+ }
48
+ /**
49
+ * Checks if a trading pair is currently tradable.
50
+ * For multi-hop routes (e.g., CELO → USDm → USDT), checks that ALL
51
+ * intermediate rate feeds are in BIDIRECTIONAL mode.
52
+ *
53
+ * @param tokenIn - Input token address
54
+ * @param tokenOut - Output token address
55
+ * @returns true if the pair is tradable (all rate feeds BIDIRECTIONAL), false otherwise
56
+ * @throws {RouteNotFoundError} If no route exists between the token pair
57
+ *
58
+ * @example
59
+ * ```typescript
60
+ * const isTradable = await tradingService.isPairTradable(USDm, CELO)
61
+ * if (!isTradable) {
62
+ * console.log('Trading is currently suspended for this pair')
63
+ * }
64
+ * ```
65
+ */
66
+ async isPairTradable(tokenIn, tokenOut) {
67
+ const route = await this.routeService.findRoute(tokenIn, tokenOut);
68
+ return this.isRouteTradable(route);
69
+ }
70
+ /**
71
+ * Checks if a route is currently tradable.
72
+ * Verifies that all pools in the route's path have their rate feeds
73
+ * in BIDIRECTIONAL mode.
74
+ *
75
+ * @param route - The route to check
76
+ * @returns true if all pools in the route are tradable, false otherwise
77
+ *
78
+ * @example
79
+ * ```typescript
80
+ * const route = await routeService.findRoute(tokenIn, tokenOut)
81
+ * const isRouteTradable = await tradingService.isRouteTradable(route)
82
+ * ```
83
+ */
84
+ async isRouteTradable(route) {
85
+ const tradingModes = await this.getTradingModesForPools(route.path);
86
+ // All rate feeds must have trading enabled for the route to be tradable
87
+ return tradingModes.every((tradingMode) => (0, types_1.isTradingEnabled)(tradingMode));
88
+ }
89
+ /**
90
+ * Get trading limits for a pool.
91
+ *
92
+ * @param pool - The pool to get trading limits for
93
+ * @returns Array of TradingLimit objects with maxIn/maxOut/until
94
+ *
95
+ * @example
96
+ * ```typescript
97
+ * const limits = await tradingService.getPoolTradingLimits(pool)
98
+ * limits.forEach(limit => {
99
+ * console.log(`${limit.asset}: maxIn=${limit.maxIn}, maxOut=${limit.maxOut}`)
100
+ * })
101
+ * ```
102
+ */
103
+ async getPoolTradingLimits(pool) {
104
+ return this.tradingLimitsService.getPoolTradingLimits(pool);
105
+ }
106
+ /**
107
+ * Get complete tradability status for a pool.
108
+ * Returns separate flags for circuit breaker and trading limits,
109
+ * allowing frontends to show different messages for each condition.
110
+ *
111
+ * @param pool - The pool to check
112
+ * @returns PoolTradabilityStatus with tradable, circuitBreakerOk, limitsOk, and limits
113
+ *
114
+ * @example
115
+ * ```typescript
116
+ * const status = await tradingService.getPoolTradabilityStatus(pool)
117
+ * if (!status.circuitBreakerOk) {
118
+ * showModal("Trading temporarily suspended (circuit breaker)")
119
+ * } else if (!status.limitsOk) {
120
+ * showModal("Trading limit reached", status.limits)
121
+ * }
122
+ * ```
123
+ */
124
+ async getPoolTradabilityStatus(pool) {
125
+ const [[tradingMode], limits] = await Promise.all([
126
+ this.getTradingModesForPools([pool]),
127
+ this.tradingLimitsService.getPoolTradingLimits(pool),
128
+ ]);
129
+ const circuitBreakerOk = (0, types_1.isTradingEnabled)(tradingMode);
130
+ // Limits are OK if no limits configured OR all limits have capacity
131
+ const limitsOk = limits.length === 0 || limits.every((l) => l.maxIn > 0n && l.maxOut > 0n);
132
+ return {
133
+ tradable: circuitBreakerOk && limitsOk,
134
+ circuitBreakerOk,
135
+ tradingMode,
136
+ limitsOk,
137
+ limits,
138
+ };
139
+ }
140
+ /**
141
+ * Get the reference rate feed ID for a pool.
142
+ * Both FPMM and Virtual pools expose this via the referenceRateFeedID() view function.
143
+ *
144
+ * @param pool - The pool to get rate feed ID for
145
+ * @returns The rate feed ID address
146
+ */
147
+ async getPoolRateFeedId(pool) {
148
+ const [rateFeedId] = await this.getPoolRateFeedIds([pool]);
149
+ return rateFeedId;
150
+ }
151
+ async getTradingModesForPools(pools) {
152
+ const rateFeedIds = await this.getPoolRateFeedIds(pools);
153
+ return this.getTradingModesForRateFeeds(rateFeedIds);
154
+ }
155
+ async getPoolRateFeedIds(pools) {
156
+ if (pools.length === 0) {
157
+ return [];
158
+ }
159
+ const results = await (0, multicall_1.multicall)(this.publicClient, pools.map((pool) => ({
160
+ address: pool.poolAddr,
161
+ abi: abis_1.FPMM_ABI,
162
+ functionName: 'referenceRateFeedID',
163
+ args: [],
164
+ })), { allowFailure: false });
165
+ return results.map((result) => {
166
+ if (result.status === 'failure') {
167
+ throw result.error;
168
+ }
169
+ return result.result;
170
+ });
171
+ }
172
+ async getTradingModesForRateFeeds(rateFeedIds) {
173
+ if (rateFeedIds.length === 0) {
174
+ return [];
175
+ }
176
+ const breakerBoxAddr = (0, constants_1.getContractAddress)(this.chainId, 'BreakerBox');
177
+ const uniqueRateFeeds = Array.from(new Map(rateFeedIds.map((rateFeedId) => [rateFeedId.toLowerCase(), rateFeedId])).values());
178
+ const results = await (0, multicall_1.multicall)(this.publicClient, uniqueRateFeeds.map((rateFeedId) => ({
179
+ address: breakerBoxAddr,
180
+ abi: abis_1.BREAKERBOX_ABI,
181
+ functionName: 'getRateFeedTradingMode',
182
+ args: [rateFeedId],
183
+ })), { allowFailure: false });
184
+ const tradingModes = new Map();
185
+ for (const [index, result] of results.entries()) {
186
+ if (result.status === 'failure') {
187
+ throw result.error;
188
+ }
189
+ tradingModes.set(uniqueRateFeeds[index].toLowerCase(), Number(result.result));
190
+ }
191
+ return rateFeedIds.map((rateFeedId) => {
192
+ const tradingMode = tradingModes.get(rateFeedId.toLowerCase());
193
+ if (tradingMode === undefined) {
194
+ throw new Error(`Trading mode not found for rate feed ${rateFeedId}`);
195
+ }
196
+ return tradingMode;
197
+ });
198
+ }
199
+ }
200
+ exports.TradingService = TradingService;
201
+ //# sourceMappingURL=TradingService.js.map
@@ -0,0 +1,3 @@
1
+ export * from './TradingService';
2
+ export * from './TradingLimitsService';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,19 @@
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("./TradingService"), exports);
18
+ __exportStar(require("./TradingLimitsService"), exports);
19
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,16 @@
1
+ import { type Chain } from 'viem/chains';
2
+ /**
3
+ * Get the default RPC URL for a given chain ID
4
+ * @param chainId - The chain ID
5
+ * @returns The default RPC URL for the chain
6
+ * @throws Error if chain ID is not supported
7
+ */
8
+ export declare function getDefaultRpcUrl(chainId: number): string;
9
+ /**
10
+ * Get the viem chain configuration for a given chain ID
11
+ * @param chainId - The chain ID
12
+ * @returns The viem chain configuration
13
+ * @throws Error if chain ID is not supported
14
+ */
15
+ export declare function getChainConfig(chainId: number): Chain;
16
+ //# sourceMappingURL=chainConfig.d.ts.map
@@ -0,0 +1,123 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getDefaultRpcUrl = getDefaultRpcUrl;
4
+ exports.getChainConfig = getChainConfig;
5
+ const chains_1 = require("viem/chains");
6
+ const viem_1 = require("viem");
7
+ const chainId_1 = require("../core/constants/chainId");
8
+ // Celo Sepolia chain definition (not available in viem/chains yet)
9
+ const celoSepolia = (0, viem_1.defineChain)({
10
+ id: 11142220,
11
+ name: 'Celo Sepolia',
12
+ nativeCurrency: {
13
+ decimals: 18,
14
+ name: 'CELO',
15
+ symbol: 'CELO',
16
+ },
17
+ rpcUrls: {
18
+ default: {
19
+ http: ['https://forno.celo-sepolia.celo-testnet.org'],
20
+ },
21
+ },
22
+ blockExplorers: {
23
+ default: {
24
+ name: 'Celo Explorer',
25
+ url: 'https://sepolia.celoscan.io',
26
+ },
27
+ },
28
+ testnet: true,
29
+ });
30
+ const monadTestnet = (0, viem_1.defineChain)({
31
+ id: 10143,
32
+ name: 'Monad Testnet',
33
+ nativeCurrency: {
34
+ decimals: 18,
35
+ name: 'MON',
36
+ symbol: 'MON',
37
+ },
38
+ rpcUrls: {
39
+ default: {
40
+ http: ['https://testnet-rpc.monad.xyz'],
41
+ },
42
+ },
43
+ blockExplorers: {
44
+ default: {
45
+ name: 'Monad Testnet Explorer',
46
+ url: 'https://testnet.monadexplorer.com',
47
+ },
48
+ },
49
+ contracts: {
50
+ multicall3: {
51
+ address: '0xcA11bde05977b3631167028862bE2a173976CA11',
52
+ blockCreated: 251449,
53
+ },
54
+ },
55
+ testnet: true,
56
+ });
57
+ const monad = (0, viem_1.defineChain)({
58
+ id: 143,
59
+ name: 'Monad',
60
+ nativeCurrency: {
61
+ decimals: 18,
62
+ name: 'MON',
63
+ symbol: 'MON',
64
+ },
65
+ rpcUrls: {
66
+ default: {
67
+ http: ['https://rpc.monad.xyz'],
68
+ },
69
+ },
70
+ blockExplorers: {
71
+ default: {
72
+ name: 'Monad Explorer',
73
+ url: 'https://monadvision.com',
74
+ },
75
+ },
76
+ contracts: {
77
+ multicall3: {
78
+ address: '0xcA11bde05977b3631167028862bE2a173976CA11',
79
+ blockCreated: 9248132,
80
+ },
81
+ },
82
+ });
83
+ /**
84
+ * Get the default RPC URL for a given chain ID
85
+ * @param chainId - The chain ID
86
+ * @returns The default RPC URL for the chain
87
+ * @throws Error if chain ID is not supported
88
+ */
89
+ function getDefaultRpcUrl(chainId) {
90
+ switch (chainId) {
91
+ case chainId_1.ChainId.CELO:
92
+ return 'https://forno.celo.org';
93
+ case chainId_1.ChainId.CELO_SEPOLIA:
94
+ return 'https://forno.celo-sepolia.celo-testnet.org';
95
+ case chainId_1.ChainId.MONAD_TESTNET:
96
+ return 'https://testnet-rpc.monad.xyz';
97
+ case chainId_1.ChainId.MONAD:
98
+ return 'https://rpc.monad.xyz';
99
+ default:
100
+ throw new Error(`Unsupported chain ID: ${chainId}`);
101
+ }
102
+ }
103
+ /**
104
+ * Get the viem chain configuration for a given chain ID
105
+ * @param chainId - The chain ID
106
+ * @returns The viem chain configuration
107
+ * @throws Error if chain ID is not supported
108
+ */
109
+ function getChainConfig(chainId) {
110
+ switch (chainId) {
111
+ case chainId_1.ChainId.CELO:
112
+ return chains_1.celo;
113
+ case chainId_1.ChainId.CELO_SEPOLIA:
114
+ return celoSepolia;
115
+ case chainId_1.ChainId.MONAD_TESTNET:
116
+ return monadTestnet;
117
+ case chainId_1.ChainId.MONAD:
118
+ return monad;
119
+ default:
120
+ throw new Error(`Unsupported chain ID: ${chainId}`);
121
+ }
122
+ }
123
+ //# sourceMappingURL=chainConfig.js.map
@@ -0,0 +1,12 @@
1
+ import { Pool } from '../core/types';
2
+ import type { PublicClient } from 'viem';
3
+ /**
4
+ * Calculate cost percentage for a pool based on its type
5
+ * Returns cost as a percentage (e.g., 0.5 = 0.5%)
6
+ *
7
+ * @param pool - The pool to calculate cost for
8
+ * @param publicClient - Viem public client for RPC calls
9
+ * @returns Cost percentage for the pool
10
+ */
11
+ export declare function getPoolCostPercent(pool: Pool, publicClient: PublicClient): Promise<number>;
12
+ //# sourceMappingURL=costUtils.d.ts.map