@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,101 @@
1
+ import { type PublicClient } from 'viem';
2
+ import { ContractAddresses } from './core/types';
3
+ import { TokenService } from './services/tokens';
4
+ import { PoolService } from './services/pools';
5
+ import { RouteService } from './services/routes';
6
+ import { QuoteService } from './services/quotes';
7
+ import { SwapService } from './services/swap';
8
+ import { TradingService } from './services/trading';
9
+ import { LiquidityService } from './services/liquidity';
10
+ import { BorrowService } from './services/borrow';
11
+ export interface MentoBatchOptions {
12
+ batchSize?: number;
13
+ wait?: number;
14
+ }
15
+ export interface MentoClientOptions {
16
+ httpBatch?: MentoBatchOptions | false;
17
+ multicallBatch?: MentoBatchOptions | false;
18
+ }
19
+ /**
20
+ * @class Mento
21
+ * @description The main class for the Mento SDK. Initializes a viem PublicClient internally
22
+ * and provides a public API for interacting with the Mento Protocol.
23
+ * @dev example usage:
24
+ * const mento = await Mento.create(ChainId.CELO);
25
+ * // or with custom RPC URL
26
+ * const mento = await Mento.create(ChainId.CELO, 'https://custom-rpc-url.com');
27
+ * // or with an existing viem PublicClient
28
+ * const mento = await Mento.create(ChainId.CELO, myPublicClient);
29
+ *
30
+ * // Get all stable tokens
31
+ * const stableTokens = await mento.tokens.getStableTokens();
32
+ *
33
+ * // Get all collateral assets
34
+ * const collateralAssets = await mento.tokens.getCollateralAssets();
35
+ *
36
+ * // Get all pools
37
+ * const pools = await mento.pools.getPools();
38
+ *
39
+ * // Find a route between tokens
40
+ * const route = await mento.routes.findRoute(USDm, CELO);
41
+ *
42
+ * // Get a quote for a swap
43
+ * const amountOut = await mento.quotes.getAmountOut(USDm, CELO, amountIn);
44
+ *
45
+ * // Build swap parameters
46
+ * const swapDetails = await mento.swap.buildSwapParams(USDm, CELO, amountIn, recipient, { slippageTolerance: 0.5, deadline: deadlineFromMinutes(5) });
47
+ *
48
+ * // Check if a pair is tradable (circuit breaker check)
49
+ * const isTradable = await mento.trading.isPairTradable(USDm, CELO);
50
+ *
51
+ * // Get trading limits for a pool
52
+ * const limits = await mento.trading.getPoolTradingLimits(pool);
53
+ *
54
+ * // Get full tradability status (circuit breaker + limits)
55
+ * const status = await mento.trading.getPoolTradabilityStatus(pool);
56
+ *
57
+ * // Add liquidity to a pool
58
+ * const { approval0, approval1, addLiquidity } = await mento.liquidity.buildAddLiquidityTransaction(
59
+ * poolAddress, amount0, amount1, recipient, owner, { slippageTolerance: 0.5, deadline: deadlineFromMinutes(5) }
60
+ * );
61
+ *
62
+ * // Add liquidity using a single token (zap in)
63
+ * const { approval, zapIn } = await mento.liquidity.buildZapInTransaction(
64
+ * poolAddress, tokenIn, amountIn, 0.5, recipient, owner, { slippageTolerance: 0.5, deadline: deadlineFromMinutes(5) }
65
+ * );
66
+ */
67
+ export declare class Mento {
68
+ private chainId;
69
+ tokens: TokenService;
70
+ pools: PoolService;
71
+ routes: RouteService;
72
+ quotes: QuoteService;
73
+ swap: SwapService;
74
+ trading: TradingService;
75
+ liquidity: LiquidityService;
76
+ borrow: BorrowService;
77
+ private constructor();
78
+ /**
79
+ * Create a new Mento SDK instance
80
+ * @param chainId - The chain ID (e.g., ChainId.CELO, ChainId.CELO_SEPOLIA)
81
+ * @param rpcUrlOrClient - Optional RPC URL string or an existing viem PublicClient.
82
+ * If not provided, uses the default RPC URL for the chain.
83
+ * @param options - Optional batching configuration used only when the SDK creates the PublicClient internally.
84
+ * @returns A new Mento instance
85
+ */
86
+ static create(chainId: number): Promise<Mento>;
87
+ static create(chainId: number, rpcUrlOrClient: string | PublicClient, options?: MentoClientOptions): Promise<Mento>;
88
+ /**
89
+ * Get the address of a contract for the current chain
90
+ * @param contractName - The contract name
91
+ * @returns The contract address
92
+ */
93
+ getContractAddress(contractName: keyof ContractAddresses): string;
94
+ }
95
+ export * from './core/constants';
96
+ export * from './core/errors';
97
+ export * from './core/types';
98
+ export * from './core/abis';
99
+ export * from './services';
100
+ export * from './utils';
101
+ //# sourceMappingURL=index.d.ts.map
package/dist/index.js ADDED
@@ -0,0 +1,158 @@
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
+ exports.Mento = void 0;
18
+ const viem_1 = require("viem");
19
+ const chainId_1 = require("./core/constants/chainId");
20
+ const addresses_1 = require("./core/constants/addresses");
21
+ const chainConfig_1 = require("./utils/chainConfig");
22
+ const tokens_1 = require("./services/tokens");
23
+ const pools_1 = require("./services/pools");
24
+ const routes_1 = require("./services/routes");
25
+ const quotes_1 = require("./services/quotes");
26
+ const swap_1 = require("./services/swap");
27
+ const trading_1 = require("./services/trading");
28
+ const liquidity_1 = require("./services/liquidity");
29
+ const borrow_1 = require("./services/borrow");
30
+ const DEFAULT_HTTP_BATCH_OPTIONS = {
31
+ batchSize: 1000,
32
+ wait: 8,
33
+ };
34
+ const DEFAULT_MULTICALL_BATCH_OPTIONS = {
35
+ batchSize: 1024,
36
+ wait: 8,
37
+ };
38
+ /**
39
+ * @class Mento
40
+ * @description The main class for the Mento SDK. Initializes a viem PublicClient internally
41
+ * and provides a public API for interacting with the Mento Protocol.
42
+ * @dev example usage:
43
+ * const mento = await Mento.create(ChainId.CELO);
44
+ * // or with custom RPC URL
45
+ * const mento = await Mento.create(ChainId.CELO, 'https://custom-rpc-url.com');
46
+ * // or with an existing viem PublicClient
47
+ * const mento = await Mento.create(ChainId.CELO, myPublicClient);
48
+ *
49
+ * // Get all stable tokens
50
+ * const stableTokens = await mento.tokens.getStableTokens();
51
+ *
52
+ * // Get all collateral assets
53
+ * const collateralAssets = await mento.tokens.getCollateralAssets();
54
+ *
55
+ * // Get all pools
56
+ * const pools = await mento.pools.getPools();
57
+ *
58
+ * // Find a route between tokens
59
+ * const route = await mento.routes.findRoute(USDm, CELO);
60
+ *
61
+ * // Get a quote for a swap
62
+ * const amountOut = await mento.quotes.getAmountOut(USDm, CELO, amountIn);
63
+ *
64
+ * // Build swap parameters
65
+ * const swapDetails = await mento.swap.buildSwapParams(USDm, CELO, amountIn, recipient, { slippageTolerance: 0.5, deadline: deadlineFromMinutes(5) });
66
+ *
67
+ * // Check if a pair is tradable (circuit breaker check)
68
+ * const isTradable = await mento.trading.isPairTradable(USDm, CELO);
69
+ *
70
+ * // Get trading limits for a pool
71
+ * const limits = await mento.trading.getPoolTradingLimits(pool);
72
+ *
73
+ * // Get full tradability status (circuit breaker + limits)
74
+ * const status = await mento.trading.getPoolTradabilityStatus(pool);
75
+ *
76
+ * // Add liquidity to a pool
77
+ * const { approval0, approval1, addLiquidity } = await mento.liquidity.buildAddLiquidityTransaction(
78
+ * poolAddress, amount0, amount1, recipient, owner, { slippageTolerance: 0.5, deadline: deadlineFromMinutes(5) }
79
+ * );
80
+ *
81
+ * // Add liquidity using a single token (zap in)
82
+ * const { approval, zapIn } = await mento.liquidity.buildZapInTransaction(
83
+ * poolAddress, tokenIn, amountIn, 0.5, recipient, owner, { slippageTolerance: 0.5, deadline: deadlineFromMinutes(5) }
84
+ * );
85
+ */
86
+ class Mento {
87
+ constructor(chainId, tokens, pools, routes, quotes, swap, trading, liquidity, borrow) {
88
+ this.chainId = chainId;
89
+ this.tokens = tokens;
90
+ this.pools = pools;
91
+ this.routes = routes;
92
+ this.quotes = quotes;
93
+ this.swap = swap;
94
+ this.trading = trading;
95
+ this.liquidity = liquidity;
96
+ this.borrow = borrow;
97
+ }
98
+ static async create(chainId, rpcUrlOrClient, options) {
99
+ // Validate chainId is supported
100
+ const supportedChainIds = Object.values(chainId_1.ChainId).filter((v) => typeof v === 'number');
101
+ if (!supportedChainIds.includes(chainId)) {
102
+ throw new Error(`ChainId ${chainId} is not supported. ` +
103
+ `Supported chains: ${supportedChainIds.map((id) => `${id} (${chainId_1.ChainId[id]})`).join(', ')}`);
104
+ }
105
+ let publicClient;
106
+ if (rpcUrlOrClient && typeof rpcUrlOrClient !== 'string') {
107
+ publicClient = rpcUrlOrClient;
108
+ }
109
+ else {
110
+ const transport = (0, viem_1.http)(rpcUrlOrClient || (0, chainConfig_1.getDefaultRpcUrl)(chainId), {
111
+ batch: options?.httpBatch === false
112
+ ? false
113
+ : {
114
+ ...DEFAULT_HTTP_BATCH_OPTIONS,
115
+ ...(options?.httpBatch ?? {}),
116
+ },
117
+ });
118
+ publicClient = (0, viem_1.createPublicClient)({
119
+ batch: {
120
+ multicall: options?.multicallBatch === false
121
+ ? false
122
+ : {
123
+ ...DEFAULT_MULTICALL_BATCH_OPTIONS,
124
+ ...(options?.multicallBatch ?? {}),
125
+ },
126
+ },
127
+ chain: (0, chainConfig_1.getChainConfig)(chainId),
128
+ transport,
129
+ });
130
+ }
131
+ const tokenService = new tokens_1.TokenService(publicClient, chainId);
132
+ const poolService = new pools_1.PoolService(publicClient, chainId);
133
+ const routeService = new routes_1.RouteService(publicClient, chainId, poolService);
134
+ const quoteService = new quotes_1.QuoteService(publicClient, chainId, routeService);
135
+ const swapService = new swap_1.SwapService(publicClient, chainId, routeService, quoteService);
136
+ const tradingService = new trading_1.TradingService(publicClient, chainId, routeService);
137
+ const liquidityService = new liquidity_1.LiquidityService(publicClient, chainId, poolService, routeService);
138
+ const borrowService = new borrow_1.BorrowService(publicClient, chainId);
139
+ // Return new mento
140
+ return new Mento(chainId, tokenService, poolService, routeService, quoteService, swapService, tradingService, liquidityService, borrowService);
141
+ }
142
+ /**
143
+ * Get the address of a contract for the current chain
144
+ * @param contractName - The contract name
145
+ * @returns The contract address
146
+ */
147
+ getContractAddress(contractName) {
148
+ return (0, addresses_1.getContractAddress)(this.chainId, contractName);
149
+ }
150
+ }
151
+ exports.Mento = Mento;
152
+ __exportStar(require("./core/constants"), exports);
153
+ __exportStar(require("./core/errors"), exports);
154
+ __exportStar(require("./core/types"), exports);
155
+ __exportStar(require("./core/abis"), exports);
156
+ __exportStar(require("./services"), exports);
157
+ __exportStar(require("./utils"), exports);
158
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,381 @@
1
+ import { PublicClient } from 'viem';
2
+ import { AdjustTroveParams, BorrowPosition, CallParams, InterestRateBracket, OpenTroveParams, SystemParams } from '../../core/types';
3
+ /**
4
+ * Service for managing borrowing positions (troves) in the Mento protocol.
5
+ * Provides methods to open, adjust, and close troves, manage collateral and debt,
6
+ * handle interest rates and batch managers, and query position data.
7
+ *
8
+ * All `build*` methods return `CallParams` ({ to, data, value }) that can be
9
+ * executed with any wallet client. The `debtTokenSymbol` parameter (e.g., 'GBPm')
10
+ * identifies which borrowing deployment to interact with.
11
+ *
12
+ * @example
13
+ * ```typescript
14
+ * const mento = await Mento.create(ChainId.CELO)
15
+ *
16
+ * const ownerIndex = await mento.borrow.findNextAvailableOwnerIndex('GBPm', '0x...', '0x...')
17
+ *
18
+ * // Open a trove
19
+ * const tx = await mento.borrow.buildOpenTroveTransaction('GBPm', {
20
+ * owner: '0x...', ownerIndex,
21
+ * collAmount: parseUnits('10', 18),
22
+ * boldAmount: parseUnits('1000', 18),
23
+ * annualInterestRate: parseUnits('0.05', 18),
24
+ * maxUpfrontFee: parseUnits('100', 18),
25
+ * })
26
+ * await walletClient.sendTransaction(tx)
27
+ * ```
28
+ */
29
+ export declare class BorrowService {
30
+ private contextStore;
31
+ private txService;
32
+ private approvalService;
33
+ private readService;
34
+ constructor(publicClient: PublicClient, chainId: number);
35
+ /**
36
+ * Builds a transaction to open a new trove (borrowing position).
37
+ * Requires prior collateral approval via `buildCollateralApprovalParams`.
38
+ *
39
+ * @param debtTokenSymbol - The debt token symbol (e.g., 'GBPm')
40
+ * @param params - Trove opening parameters including collateral, debt amount, and interest rate
41
+ * @returns Transaction parameters ready to send
42
+ */
43
+ buildOpenTroveTransaction(debtTokenSymbol: string, params: OpenTroveParams): Promise<CallParams>;
44
+ /**
45
+ * Builds a transaction to adjust an existing trove's collateral and/or debt.
46
+ *
47
+ * @param debtTokenSymbol - The debt token symbol (e.g., 'GBPm')
48
+ * @param params - Adjustment parameters specifying collateral/debt changes
49
+ * @returns Transaction parameters ready to send
50
+ */
51
+ buildAdjustTroveTransaction(debtTokenSymbol: string, params: AdjustTroveParams): Promise<CallParams>;
52
+ /**
53
+ * Builds a transaction to adjust a zombie trove. Zombie troves are still-open troves whose
54
+ * debt fell below the branch minimum debt, typically after a redemption.
55
+ *
56
+ * Use this when `getTroveData()` or `getUserTroves()` returns `status === 'zombie'`.
57
+ * Same parameters as `buildAdjustTroveTransaction`.
58
+ *
59
+ * @param debtTokenSymbol - The debt token symbol (e.g., 'GBPm')
60
+ * @param params - Adjustment parameters specifying collateral/debt changes
61
+ * @returns Transaction parameters ready to send
62
+ */
63
+ buildAdjustZombieTroveTransaction(debtTokenSymbol: string, params: AdjustTroveParams): Promise<CallParams>;
64
+ /**
65
+ * Builds a transaction to close a trove, repaying all debt and reclaiming collateral.
66
+ *
67
+ * @param debtTokenSymbol - The debt token symbol (e.g., 'GBPm')
68
+ * @param troveId - The NFT token ID identifying the trove
69
+ * @returns Transaction parameters ready to send
70
+ */
71
+ buildCloseTroveTransaction(debtTokenSymbol: string, troveId: string): Promise<CallParams>;
72
+ /**
73
+ * Builds a transaction to add collateral to an existing trove.
74
+ * Requires prior collateral approval via `buildCollateralApprovalParams`.
75
+ *
76
+ * @param debtTokenSymbol - The debt token symbol (e.g., 'GBPm')
77
+ * @param troveId - The NFT token ID identifying the trove
78
+ * @param amount - Amount of collateral to add (in wei)
79
+ * @returns Transaction parameters ready to send
80
+ */
81
+ buildAddCollTransaction(debtTokenSymbol: string, troveId: string, amount: bigint): Promise<CallParams>;
82
+ /**
83
+ * Builds a transaction to withdraw collateral from an existing trove.
84
+ *
85
+ * @param debtTokenSymbol - The debt token symbol (e.g., 'GBPm')
86
+ * @param troveId - The NFT token ID identifying the trove
87
+ * @param amount - Amount of collateral to withdraw (in wei)
88
+ * @returns Transaction parameters ready to send
89
+ */
90
+ buildWithdrawCollTransaction(debtTokenSymbol: string, troveId: string, amount: bigint): Promise<CallParams>;
91
+ /**
92
+ * Builds a transaction to borrow additional debt against an existing trove.
93
+ *
94
+ * @param debtTokenSymbol - The debt token symbol (e.g., 'GBPm')
95
+ * @param troveId - The NFT token ID identifying the trove
96
+ * @param amount - Additional debt amount to borrow (in wei)
97
+ * @param maxFee - Maximum upfront fee the borrower is willing to pay (in wei)
98
+ * @returns Transaction parameters ready to send
99
+ */
100
+ buildBorrowMoreTransaction(debtTokenSymbol: string, troveId: string, amount: bigint, maxFee: bigint): Promise<CallParams>;
101
+ /**
102
+ * Builds a transaction to repay debt on an existing trove.
103
+ *
104
+ * @param debtTokenSymbol - The debt token symbol (e.g., 'GBPm')
105
+ * @param troveId - The NFT token ID identifying the trove
106
+ * @param amount - Amount of debt to repay (in wei)
107
+ * @returns Transaction parameters ready to send
108
+ */
109
+ buildRepayDebtTransaction(debtTokenSymbol: string, troveId: string, amount: bigint): Promise<CallParams>;
110
+ /**
111
+ * Builds a transaction to change the annual interest rate on a trove.
112
+ *
113
+ * @param debtTokenSymbol - The debt token symbol (e.g., 'GBPm')
114
+ * @param troveId - The NFT token ID identifying the trove
115
+ * @param newRate - New annual interest rate (18-decimal fixed-point, e.g., parseUnits('0.05', 18) for 5%)
116
+ * @param maxFee - Maximum upfront fee the borrower is willing to pay (in wei)
117
+ * @returns Transaction parameters ready to send
118
+ */
119
+ buildAdjustInterestRateTransaction(debtTokenSymbol: string, troveId: string, newRate: bigint, maxFee: bigint): Promise<CallParams>;
120
+ /**
121
+ * Builds a transaction to claim collateral surplus after a liquidation.
122
+ * This is for collateral held in the surplus pool after `closedByLiquidation`.
123
+ * Zombie troves with remaining collateral should usually be closed or adjusted instead.
124
+ *
125
+ * @param debtTokenSymbol - The debt token symbol (e.g., 'GBPm')
126
+ * @returns Transaction parameters ready to send
127
+ */
128
+ buildClaimCollateralTransaction(debtTokenSymbol: string): Promise<CallParams>;
129
+ /**
130
+ * Builds a transaction to delegate interest rate management to a batch manager.
131
+ *
132
+ * @param debtTokenSymbol - The debt token symbol (e.g., 'GBPm')
133
+ * @param troveId - The NFT token ID identifying the trove
134
+ * @param manager - Address of the batch manager contract
135
+ * @param maxFee - Maximum upfront fee the borrower is willing to pay (in wei)
136
+ * @returns Transaction parameters ready to send
137
+ */
138
+ buildSetBatchManagerTransaction(debtTokenSymbol: string, troveId: string, manager: string, maxFee: bigint): Promise<CallParams>;
139
+ /**
140
+ * Builds a transaction to remove a trove from a batch manager, setting a new individual rate.
141
+ *
142
+ * @param debtTokenSymbol - The debt token symbol (e.g., 'GBPm')
143
+ * @param troveId - The NFT token ID identifying the trove
144
+ * @param newRate - New individual annual interest rate (18-decimal fixed-point)
145
+ * @param maxFee - Maximum upfront fee the borrower is willing to pay (in wei)
146
+ * @returns Transaction parameters ready to send
147
+ */
148
+ buildRemoveFromBatchTransaction(debtTokenSymbol: string, troveId: string, newRate: bigint, maxFee: bigint): Promise<CallParams>;
149
+ /**
150
+ * Builds a transaction to switch a trove to a different batch manager.
151
+ *
152
+ * @param debtTokenSymbol - The debt token symbol (e.g., 'GBPm')
153
+ * @param troveId - The NFT token ID identifying the trove
154
+ * @param newManager - Address of the new batch manager contract
155
+ * @param maxFee - Maximum upfront fee the borrower is willing to pay (in wei)
156
+ * @returns Transaction parameters ready to send
157
+ */
158
+ buildSwitchBatchManagerTransaction(debtTokenSymbol: string, troveId: string, newManager: string, maxFee: bigint): Promise<CallParams>;
159
+ /**
160
+ * Builds a transaction to delegate interest rate management to another address
161
+ * with bounded rate constraints.
162
+ *
163
+ * @param debtTokenSymbol - The debt token symbol (e.g., 'GBPm')
164
+ * @param troveId - The NFT token ID identifying the trove
165
+ * @param delegate - Address to delegate interest rate management to
166
+ * @param minRate - Minimum allowed annual interest rate (18-decimal fixed-point)
167
+ * @param maxRate - Maximum allowed annual interest rate (18-decimal fixed-point)
168
+ * @param newRate - Initial annual interest rate to set (18-decimal fixed-point)
169
+ * @param maxFee - Maximum upfront fee the borrower is willing to pay (in wei)
170
+ * @param minChangePeriod - Minimum time between rate changes (in seconds)
171
+ * @returns Transaction parameters ready to send
172
+ */
173
+ buildSetInterestDelegateTransaction(debtTokenSymbol: string, troveId: string, delegate: string, minRate: bigint, maxRate: bigint, newRate: bigint, maxFee: bigint, minChangePeriod: bigint): Promise<CallParams>;
174
+ /**
175
+ * Builds a transaction to remove the interest rate delegate from a trove.
176
+ *
177
+ * @param debtTokenSymbol - The debt token symbol (e.g., 'GBPm')
178
+ * @param troveId - The NFT token ID identifying the trove
179
+ * @returns Transaction parameters ready to send
180
+ */
181
+ buildRemoveInterestDelegateTransaction(debtTokenSymbol: string, troveId: string): Promise<CallParams>;
182
+ /**
183
+ * Builds approval params to allow BorrowerOperations to spend collateral tokens.
184
+ * Must be executed before `buildOpenTroveTransaction` or `buildAddCollTransaction`.
185
+ *
186
+ * @param debtTokenSymbol - The debt token symbol (e.g., 'GBPm')
187
+ * @param amount - Amount of collateral to approve (in wei)
188
+ * @returns Transaction parameters for the ERC-20 approve call
189
+ */
190
+ buildCollateralApprovalParams(debtTokenSymbol: string, amount: bigint): Promise<CallParams>;
191
+ /**
192
+ * Builds approval params for the debt token (e.g., for repayment or closing).
193
+ *
194
+ * @param debtTokenSymbol - The debt token symbol (e.g., 'GBPm')
195
+ * @param spender - Address to approve as spender
196
+ * @param amount - Amount of debt tokens to approve (in wei)
197
+ * @returns Transaction parameters for the ERC-20 approve call
198
+ */
199
+ buildDebtApprovalParams(debtTokenSymbol: string, spender: string, amount: bigint): Promise<CallParams>;
200
+ /**
201
+ * Builds approval params for the gas compensation token (required when opening a trove).
202
+ *
203
+ * @param debtTokenSymbol - The debt token symbol (e.g., 'GBPm')
204
+ * @param amount - Amount to approve (in wei). If omitted, approves the gas compensation amount.
205
+ * @returns Transaction parameters for the ERC-20 approve call
206
+ */
207
+ buildGasCompensationApprovalParams(debtTokenSymbol: string, amount?: bigint): Promise<CallParams>;
208
+ /**
209
+ * Gets the current collateral token allowance for BorrowerOperations.
210
+ *
211
+ * @param debtTokenSymbol - The debt token symbol (e.g., 'GBPm')
212
+ * @param owner - Address to check allowance for
213
+ * @returns Current allowance in wei
214
+ */
215
+ getCollateralAllowance(debtTokenSymbol: string, owner: string): Promise<bigint>;
216
+ /**
217
+ * Gets the current debt token allowance for a specific spender.
218
+ *
219
+ * @param debtTokenSymbol - The debt token symbol (e.g., 'GBPm')
220
+ * @param owner - Address to check allowance for
221
+ * @param spender - Address of the approved spender
222
+ * @returns Current allowance in wei
223
+ */
224
+ getDebtAllowance(debtTokenSymbol: string, owner: string, spender: string): Promise<bigint>;
225
+ /**
226
+ * Gets the current gas compensation token allowance.
227
+ *
228
+ * @param debtTokenSymbol - The debt token symbol (e.g., 'GBPm')
229
+ * @param owner - Address to check allowance for
230
+ * @returns Current allowance in wei
231
+ */
232
+ getGasTokenAllowance(debtTokenSymbol: string, owner: string): Promise<bigint>;
233
+ /**
234
+ * Fetches on-chain data for a specific trove.
235
+ * The returned position reflects the trove's current lifecycle status, including
236
+ * zombie troves that may still hold collateral even when their debt is zero.
237
+ *
238
+ * @param debtTokenSymbol - The debt token symbol (e.g., 'GBPm')
239
+ * @param troveId - The NFT token ID identifying the trove
240
+ * @returns Trove position data including collateral, debt, interest rate, and status
241
+ */
242
+ getTroveData(debtTokenSymbol: string, troveId: string): Promise<BorrowPosition>;
243
+ /**
244
+ * Fetches troves currently owned by an address via the Trove NFT.
245
+ * This includes zombie troves that have been removed from `SortedTroves` but are still owned
246
+ * by the address. Closed or liquidated troves are not returned once their Trove NFT is burned
247
+ * or transferred away.
248
+ *
249
+ * @param debtTokenSymbol - The debt token symbol (e.g., 'GBPm')
250
+ * @param owner - Address to query troves for
251
+ * @returns Array of trove positions currently owned by the address
252
+ */
253
+ getUserTroves(debtTokenSymbol: string, owner: string): Promise<BorrowPosition[]>;
254
+ /**
255
+ * Gets the current collateral token price from the price feed.
256
+ *
257
+ * @param debtTokenSymbol - The debt token symbol (e.g., 'GBPm')
258
+ * @returns Collateral price in 18-decimal fixed-point format
259
+ */
260
+ getCollateralPrice(debtTokenSymbol: string): Promise<bigint>;
261
+ /**
262
+ * Gets the system parameters for a borrowing deployment.
263
+ * Returns MCR, CCR, SCR, BCR, minimum debt, gas compensation, and minimum interest rate.
264
+ *
265
+ * @param debtTokenSymbol - The debt token symbol (e.g., 'GBPm')
266
+ * @returns System parameters (all values in 18-decimal fixed-point)
267
+ */
268
+ getSystemParams(debtTokenSymbol: string): Promise<SystemParams>;
269
+ /**
270
+ * Checks whether the borrowing system has been shut down (e.g., during a crisis).
271
+ *
272
+ * @param debtTokenSymbol - The debt token symbol (e.g., 'GBPm')
273
+ * @returns true if the system is shut down, false otherwise
274
+ */
275
+ isSystemShutDown(debtTokenSymbol: string): Promise<boolean>;
276
+ /**
277
+ * Gets aggregate collateral and debt statistics for the borrowing branch.
278
+ *
279
+ * @param debtTokenSymbol - The debt token symbol (e.g., 'GBPm')
280
+ * @returns Total collateral and total debt across all troves (in wei)
281
+ */
282
+ getBranchStats(debtTokenSymbol: string): Promise<{
283
+ totalColl: bigint;
284
+ totalDebt: bigint;
285
+ }>;
286
+ /**
287
+ * Gets the distribution of debt across interest rate brackets.
288
+ *
289
+ * @param debtTokenSymbol - The debt token symbol (e.g., 'GBPm')
290
+ * @returns Array of brackets, each with a rate and total debt at that rate
291
+ */
292
+ getInterestRateBrackets(debtTokenSymbol: string): Promise<InterestRateBracket[]>;
293
+ /**
294
+ * Gets the weighted average interest rate across all active troves.
295
+ *
296
+ * @param debtTokenSymbol - The debt token symbol (e.g., 'GBPm')
297
+ * @returns Average annual interest rate in 18-decimal fixed-point
298
+ */
299
+ getAverageInterestRate(debtTokenSymbol: string): Promise<bigint>;
300
+ /**
301
+ * Gets information about a batch manager's configuration.
302
+ *
303
+ * @param debtTokenSymbol - The debt token symbol (e.g., 'GBPm')
304
+ * @param address - Address of the batch manager
305
+ * @returns Batch manager config (min/max rate, min change period), or null if not a valid manager
306
+ */
307
+ getBatchManagerInfo(debtTokenSymbol: string, address: string): Promise<{
308
+ minRate: bigint;
309
+ maxRate: bigint;
310
+ minChangePeriod: bigint;
311
+ } | null>;
312
+ /**
313
+ * Estimates the upfront fee for opening a new trove.
314
+ *
315
+ * @param debtTokenSymbol - The debt token symbol (e.g., 'GBPm')
316
+ * @param amount - Debt amount to borrow (in wei)
317
+ * @param rate - Annual interest rate (18-decimal fixed-point)
318
+ * @returns Estimated upfront fee in wei
319
+ */
320
+ predictOpenTroveUpfrontFee(debtTokenSymbol: string, amount: bigint, rate: bigint): Promise<bigint>;
321
+ /**
322
+ * Estimates the upfront fee for increasing debt on an existing trove.
323
+ *
324
+ * @param debtTokenSymbol - The debt token symbol (e.g., 'GBPm')
325
+ * @param troveId - The NFT token ID identifying the trove
326
+ * @param debtIncrease - Amount of additional debt (in wei)
327
+ * @returns Estimated upfront fee in wei
328
+ */
329
+ predictAdjustUpfrontFee(debtTokenSymbol: string, troveId: string, debtIncrease: bigint): Promise<bigint>;
330
+ /**
331
+ * Estimates the upfront fee for changing a trove's interest rate.
332
+ *
333
+ * @param debtTokenSymbol - The debt token symbol (e.g., 'GBPm')
334
+ * @param troveId - The NFT token ID identifying the trove
335
+ * @param newRate - New annual interest rate (18-decimal fixed-point)
336
+ * @returns Estimated upfront fee in wei
337
+ */
338
+ predictAdjustInterestRateUpfrontFee(debtTokenSymbol: string, troveId: string, newRate: bigint): Promise<bigint>;
339
+ /**
340
+ * Estimates the upfront fee for joining a batch manager.
341
+ *
342
+ * @param debtTokenSymbol - The debt token symbol (e.g., 'GBPm')
343
+ * @param troveId - The NFT token ID identifying the trove
344
+ * @param batchAddress - Address of the batch manager to join
345
+ * @returns Estimated upfront fee in wei
346
+ */
347
+ predictJoinBatchUpfrontFee(debtTokenSymbol: string, troveId: string, batchAddress: string): Promise<bigint>;
348
+ /**
349
+ * Gets the current number of troves owned by an address via the Trove NFT.
350
+ *
351
+ * @param debtTokenSymbol - The debt token symbol (e.g., 'GBPm')
352
+ * @param owner - Address of the trove owner
353
+ * @returns The number of troves currently owned by the address
354
+ */
355
+ getOwnedTroveCount(debtTokenSymbol: string, owner: string): Promise<number>;
356
+ /**
357
+ * Finds the first safe owner index for opening a trove with the given transaction sender.
358
+ *
359
+ * The `opener` must be the address that will call BorrowerOperations on-chain.
360
+ * For smart accounts, pass the smart account address rather than the controlling EOA.
361
+ *
362
+ * @param debtTokenSymbol - The debt token symbol (e.g., 'GBPm')
363
+ * @param owner - Address that will own the trove NFT
364
+ * @param opener - Address that will submit the open-trove transaction on-chain
365
+ * @returns The first owner index that does not already map to an existing trove
366
+ */
367
+ findNextAvailableOwnerIndex(debtTokenSymbol: string, owner: string, opener: string): Promise<number>;
368
+ /**
369
+ * Gets the current number of troves owned by an address via the Trove NFT.
370
+ *
371
+ * @deprecated Use `findNextAvailableOwnerIndex` when preparing an open-trove transaction.
372
+ *
373
+ * @param debtTokenSymbol - The debt token symbol (e.g., 'GBPm')
374
+ * @param owner - Address of the trove owner
375
+ * @returns The number of troves currently owned by the address
376
+ */
377
+ getNextOwnerIndex(debtTokenSymbol: string, owner: string): Promise<number>;
378
+ private withContext;
379
+ private ensureInitialized;
380
+ }
381
+ //# sourceMappingURL=BorrowService.d.ts.map