@mento-protocol/mento-sdk 3.2.7 → 3.2.8

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 (302) hide show
  1. package/dist/cache/routes.d.ts +13 -0
  2. package/dist/cache/routes.js +14649 -0
  3. package/dist/cache/tokens.d.ts +68 -0
  4. package/dist/cache/tokens.js +488 -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 +34 -0
  57. package/dist/core/constants/chainId.d.ts +7 -0
  58. package/dist/core/constants/chainId.js +11 -0
  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/core/errors/index.js +20 -0
  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/core/types/borrow.js +3 -0
  73. package/dist/core/types/contractAddresses.d.ts +42 -0
  74. package/dist/core/types/contractAddresses.js +3 -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/core/types/provider.js +3 -0
  83. package/dist/core/types/route.d.ts +62 -0
  84. package/dist/core/types/route.js +3 -0
  85. package/dist/core/types/token.d.ts +21 -0
  86. package/dist/core/types/token.js +3 -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 +14644 -0
  94. package/dist/esm/cache/tokens.js +480 -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 +29 -0
  121. package/dist/esm/core/constants/chainId.js +7 -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/borrow.js +1 -0
  129. package/dist/esm/core/types/contractAddresses.js +1 -0
  130. package/dist/esm/core/types/index.js +9 -0
  131. package/dist/esm/core/types/liquidity.js +1 -0
  132. package/dist/esm/core/types/pool.js +10 -0
  133. package/dist/esm/core/types/provider.js +1 -0
  134. package/dist/esm/core/types/route.js +1 -0
  135. package/dist/esm/core/types/token.js +1 -0
  136. package/dist/esm/core/types/tradingLimits.js +1 -0
  137. package/dist/esm/core/types/tradingMode.js +26 -0
  138. package/dist/esm/core/types/transaction.js +1 -0
  139. package/dist/esm/index.js +139 -0
  140. package/dist/esm/package.json +1 -0
  141. package/dist/esm/services/borrow/BorrowService.js +455 -0
  142. package/dist/esm/services/borrow/borrowHelpers.js +3 -0
  143. package/dist/esm/services/borrow/borrowMath.js +127 -0
  144. package/dist/esm/services/borrow/index.js +3 -0
  145. package/dist/esm/services/borrow/internal/borrowApprovalService.js +48 -0
  146. package/dist/esm/services/borrow/internal/borrowContextStore.js +35 -0
  147. package/dist/esm/services/borrow/internal/borrowErc20.js +38 -0
  148. package/dist/esm/services/borrow/internal/borrowHints.js +27 -0
  149. package/dist/esm/services/borrow/internal/borrowPositionParser.js +82 -0
  150. package/dist/esm/services/borrow/internal/borrowReadService.js +271 -0
  151. package/dist/esm/services/borrow/internal/borrowRegistryReader.js +108 -0
  152. package/dist/esm/services/borrow/internal/borrowTransactionService.js +271 -0
  153. package/dist/esm/services/borrow/internal/borrowTypes.js +1 -0
  154. package/dist/esm/services/borrow/internal/borrowValidation.js +89 -0
  155. package/dist/esm/services/index.js +8 -0
  156. package/dist/esm/services/liquidity/LiquidityService.js +163 -0
  157. package/dist/esm/services/liquidity/basicLiquidity.js +162 -0
  158. package/dist/esm/services/liquidity/index.js +1 -0
  159. package/dist/esm/services/liquidity/liquidityHelpers.js +95 -0
  160. package/dist/esm/services/liquidity/rebalance.js +59 -0
  161. package/dist/esm/services/liquidity/zapHelpers.js +181 -0
  162. package/dist/esm/services/liquidity/zapIn.js +131 -0
  163. package/dist/esm/services/liquidity/zapOut.js +248 -0
  164. package/dist/esm/services/pools/PoolService.js +204 -0
  165. package/dist/esm/services/pools/index.js +1 -0
  166. package/dist/esm/services/pools/poolDetails.js +209 -0
  167. package/dist/esm/services/pools/poolDiscovery.js +112 -0
  168. package/dist/esm/services/pools/rebalancePreview.js +181 -0
  169. package/dist/esm/services/quotes/QuoteService.js +85 -0
  170. package/dist/esm/services/quotes/index.js +1 -0
  171. package/dist/esm/services/routes/RouteService.js +268 -0
  172. package/dist/esm/services/routes/index.js +1 -0
  173. package/dist/esm/services/swap/SwapService.js +247 -0
  174. package/dist/esm/services/swap/index.js +1 -0
  175. package/dist/esm/services/tokens/index.js +1 -0
  176. package/dist/esm/services/tokens/tokenService.js +285 -0
  177. package/dist/esm/services/trading/TradingLimitsService.js +154 -0
  178. package/dist/esm/services/trading/TradingService.js +222 -0
  179. package/dist/esm/services/trading/index.js +2 -0
  180. package/dist/esm/utils/chainConfig.js +118 -0
  181. package/dist/esm/utils/costUtils.js +56 -0
  182. package/dist/esm/utils/deadline.js +22 -0
  183. package/dist/esm/utils/index.js +9 -0
  184. package/dist/esm/utils/multicall.js +47 -0
  185. package/dist/esm/utils/pathEncoder.js +69 -0
  186. package/dist/esm/utils/rateFeed.js +23 -0
  187. package/dist/esm/utils/retry.js +24 -0
  188. package/dist/esm/utils/routeUtils.js +361 -0
  189. package/dist/esm/utils/routes.js +2 -0
  190. package/dist/esm/utils/sortUtils.js +33 -0
  191. package/dist/esm/utils/tokens.js +2 -0
  192. package/dist/esm/utils/tradingLimits.js +163 -0
  193. package/dist/esm/utils/validation.js +30 -0
  194. package/dist/index.d.ts +101 -0
  195. package/dist/index.js +158 -0
  196. package/dist/services/borrow/BorrowService.d.ts +381 -0
  197. package/dist/services/borrow/BorrowService.js +460 -0
  198. package/dist/services/borrow/borrowHelpers.d.ts +4 -0
  199. package/dist/services/borrow/borrowHelpers.js +13 -0
  200. package/dist/services/borrow/borrowMath.d.ts +21 -0
  201. package/dist/services/borrow/borrowMath.js +137 -0
  202. package/dist/services/borrow/index.d.ts +4 -0
  203. package/dist/services/borrow/index.js +20 -0
  204. package/dist/services/borrow/internal/borrowApprovalService.d.ts +14 -0
  205. package/dist/services/borrow/internal/borrowApprovalService.js +53 -0
  206. package/dist/services/borrow/internal/borrowContextStore.d.ts +11 -0
  207. package/dist/services/borrow/internal/borrowContextStore.js +40 -0
  208. package/dist/services/borrow/internal/borrowErc20.d.ts +5 -0
  209. package/dist/services/borrow/internal/borrowErc20.js +43 -0
  210. package/dist/services/borrow/internal/borrowHints.d.ts +7 -0
  211. package/dist/services/borrow/internal/borrowHints.js +31 -0
  212. package/dist/services/borrow/internal/borrowPositionParser.d.ts +4 -0
  213. package/dist/services/borrow/internal/borrowPositionParser.js +87 -0
  214. package/dist/services/borrow/internal/borrowReadService.d.ts +31 -0
  215. package/dist/services/borrow/internal/borrowReadService.js +276 -0
  216. package/dist/services/borrow/internal/borrowRegistryReader.d.ts +5 -0
  217. package/dist/services/borrow/internal/borrowRegistryReader.js +113 -0
  218. package/dist/services/borrow/internal/borrowTransactionService.d.ts +23 -0
  219. package/dist/services/borrow/internal/borrowTransactionService.js +276 -0
  220. package/dist/services/borrow/internal/borrowTypes.d.ts +15 -0
  221. package/dist/services/borrow/internal/borrowTypes.js +3 -0
  222. package/dist/services/borrow/internal/borrowValidation.d.ts +14 -0
  223. package/dist/services/borrow/internal/borrowValidation.js +104 -0
  224. package/dist/services/index.d.ts +9 -0
  225. package/dist/services/index.js +25 -0
  226. package/dist/services/liquidity/LiquidityService.d.ts +139 -0
  227. package/dist/services/liquidity/LiquidityService.js +168 -0
  228. package/dist/services/liquidity/basicLiquidity.d.ts +11 -0
  229. package/dist/services/liquidity/basicLiquidity.js +172 -0
  230. package/dist/services/liquidity/index.d.ts +2 -0
  231. package/dist/services/liquidity/index.js +18 -0
  232. package/dist/services/liquidity/liquidityHelpers.d.ts +19 -0
  233. package/dist/services/liquidity/liquidityHelpers.js +104 -0
  234. package/dist/services/liquidity/rebalance.d.ts +6 -0
  235. package/dist/services/liquidity/rebalance.js +64 -0
  236. package/dist/services/liquidity/zapHelpers.d.ts +100 -0
  237. package/dist/services/liquidity/zapHelpers.js +192 -0
  238. package/dist/services/liquidity/zapIn.d.ts +18 -0
  239. package/dist/services/liquidity/zapIn.js +138 -0
  240. package/dist/services/liquidity/zapOut.d.ts +9 -0
  241. package/dist/services/liquidity/zapOut.js +255 -0
  242. package/dist/services/pools/PoolService.d.ts +69 -0
  243. package/dist/services/pools/PoolService.js +209 -0
  244. package/dist/services/pools/index.d.ts +2 -0
  245. package/dist/services/pools/index.js +18 -0
  246. package/dist/services/pools/poolDetails.d.ts +13 -0
  247. package/dist/services/pools/poolDetails.js +216 -0
  248. package/dist/services/pools/poolDiscovery.d.ts +12 -0
  249. package/dist/services/pools/poolDiscovery.js +117 -0
  250. package/dist/services/pools/rebalancePreview.d.ts +5 -0
  251. package/dist/services/pools/rebalancePreview.js +186 -0
  252. package/dist/services/quotes/QuoteService.d.ts +51 -0
  253. package/dist/services/quotes/QuoteService.js +91 -0
  254. package/dist/services/quotes/index.d.ts +2 -0
  255. package/dist/services/quotes/index.js +18 -0
  256. package/dist/services/routes/RouteService.d.ts +117 -0
  257. package/dist/services/routes/RouteService.js +306 -0
  258. package/dist/services/routes/index.d.ts +2 -0
  259. package/dist/services/routes/index.js +18 -0
  260. package/dist/services/swap/SwapService.d.ts +198 -0
  261. package/dist/services/swap/SwapService.js +252 -0
  262. package/dist/services/swap/index.d.ts +2 -0
  263. package/dist/services/swap/index.js +18 -0
  264. package/dist/services/tokens/index.d.ts +2 -0
  265. package/dist/services/tokens/index.js +18 -0
  266. package/dist/services/tokens/tokenService.d.ts +55 -0
  267. package/dist/services/tokens/tokenService.js +290 -0
  268. package/dist/services/trading/TradingLimitsService.d.ts +38 -0
  269. package/dist/services/trading/TradingLimitsService.js +159 -0
  270. package/dist/services/trading/TradingService.d.ts +115 -0
  271. package/dist/services/trading/TradingService.js +227 -0
  272. package/dist/services/trading/index.d.ts +3 -0
  273. package/dist/services/trading/index.js +19 -0
  274. package/dist/utils/chainConfig.d.ts +16 -0
  275. package/dist/utils/chainConfig.js +123 -0
  276. package/dist/utils/costUtils.d.ts +12 -0
  277. package/dist/utils/costUtils.js +60 -0
  278. package/dist/utils/deadline.d.ts +21 -0
  279. package/dist/utils/deadline.js +26 -0
  280. package/dist/utils/index.d.ts +10 -0
  281. package/dist/utils/index.js +26 -0
  282. package/dist/utils/multicall.d.ts +30 -0
  283. package/dist/utils/multicall.js +52 -0
  284. package/dist/utils/pathEncoder.d.ts +34 -0
  285. package/dist/utils/pathEncoder.js +73 -0
  286. package/dist/utils/rateFeed.d.ts +18 -0
  287. package/dist/utils/rateFeed.js +27 -0
  288. package/dist/utils/retry.d.ts +12 -0
  289. package/dist/utils/retry.js +28 -0
  290. package/dist/utils/routeUtils.d.ts +295 -0
  291. package/dist/utils/routeUtils.js +371 -0
  292. package/dist/utils/routes.d.ts +3 -0
  293. package/dist/utils/routes.js +8 -0
  294. package/dist/utils/sortUtils.d.ts +24 -0
  295. package/dist/utils/sortUtils.js +39 -0
  296. package/dist/utils/tokens.d.ts +2 -0
  297. package/dist/utils/tokens.js +13 -0
  298. package/dist/utils/tradingLimits.d.ts +41 -0
  299. package/dist/utils/tradingLimits.js +171 -0
  300. package/dist/utils/validation.d.ts +19 -0
  301. package/dist/utils/validation.js +34 -0
  302. package/package.json +1 -1
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=borrow.js.map
@@ -0,0 +1,42 @@
1
+ import type { ChainId } from '../constants/chainId';
2
+ /**
3
+ * All possible contract identifiers across all chains.
4
+ * Not all chains have all contracts deployed.
5
+ */
6
+ export type ContractAddresses = {
7
+ FPMMFactory?: string;
8
+ VirtualPoolFactory?: string;
9
+ BreakerBox?: string;
10
+ MedianDeltaBreaker?: string;
11
+ SortedOracles?: string;
12
+ ValueDeltaBreaker?: string;
13
+ BiPoolManager?: string;
14
+ Broker?: string;
15
+ ConstantProductPricingModule?: string;
16
+ ConstantSumPricingModule?: string;
17
+ MentoRouter?: string;
18
+ Reserve?: string;
19
+ Airgrab?: string;
20
+ Emission?: string;
21
+ GovernanceFactory?: string;
22
+ Locking?: string;
23
+ MentoGovernor?: string;
24
+ MentoToken?: string;
25
+ TimelockController?: string;
26
+ StableToken?: string;
27
+ StableTokenEUR?: string;
28
+ StableTokenBRL?: string;
29
+ StableTokenXOF?: string;
30
+ Router?: string;
31
+ ReserveLiquidityStrategy?: string;
32
+ CDPLiquidityStrategy?: string;
33
+ OpenLiquidityStrategy?: string;
34
+ };
35
+ /**
36
+ * Map of chain IDs to their contract addresses.
37
+ * Each chain may have a different subset of contracts deployed.
38
+ */
39
+ export type ContractAddressMap = {
40
+ [key in ChainId]: ContractAddresses;
41
+ };
42
+ //# sourceMappingURL=contractAddresses.d.ts.map
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=contractAddresses.js.map
@@ -0,0 +1,10 @@
1
+ export * from './contractAddresses';
2
+ export * from './transaction';
3
+ export * from './token';
4
+ export * from './route';
5
+ export * from './pool';
6
+ export * from './tradingMode';
7
+ export * from './tradingLimits';
8
+ export * from './liquidity';
9
+ export * from './borrow';
10
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,26 @@
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("./contractAddresses"), exports);
18
+ __exportStar(require("./transaction"), exports);
19
+ __exportStar(require("./token"), exports);
20
+ __exportStar(require("./route"), exports);
21
+ __exportStar(require("./pool"), exports);
22
+ __exportStar(require("./tradingMode"), exports);
23
+ __exportStar(require("./tradingLimits"), exports);
24
+ __exportStar(require("./liquidity"), exports);
25
+ __exportStar(require("./borrow"), exports);
26
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,194 @@
1
+ import { CallParams } from './transaction';
2
+ import { LiquidityStrategyDirection } from './pool';
3
+ import { RouterRoute } from '../../utils/pathEncoder';
4
+ export interface LiquidityOptions {
5
+ slippageTolerance: number;
6
+ deadline: bigint;
7
+ }
8
+ export interface AddLiquidityQuote {
9
+ amountA: bigint;
10
+ amountB: bigint;
11
+ liquidity: bigint;
12
+ }
13
+ export interface RemoveLiquidityQuote {
14
+ amount0: bigint;
15
+ amount1: bigint;
16
+ }
17
+ export interface AddLiquidityDetails {
18
+ params: CallParams;
19
+ poolAddress: string;
20
+ token0: string;
21
+ token1: string;
22
+ tokenA: string;
23
+ tokenB: string;
24
+ amountADesired: bigint;
25
+ amountBDesired: bigint;
26
+ amountAMin: bigint;
27
+ amountBMin: bigint;
28
+ estimatedMinLiquidity: bigint;
29
+ deadline: bigint;
30
+ }
31
+ export interface RemoveLiquidityDetails {
32
+ params: CallParams;
33
+ poolAddress: string;
34
+ token0: string;
35
+ token1: string;
36
+ liquidity: bigint;
37
+ amount0Min: bigint;
38
+ amount1Min: bigint;
39
+ expectedAmount0: bigint;
40
+ expectedAmount1: bigint;
41
+ deadline: bigint;
42
+ }
43
+ export interface TokenApproval {
44
+ token: string;
45
+ amount: bigint;
46
+ params: CallParams;
47
+ }
48
+ export interface AddLiquidityTransaction {
49
+ approvalA: TokenApproval | null;
50
+ approvalB: TokenApproval | null;
51
+ addLiquidity: AddLiquidityDetails;
52
+ }
53
+ export interface RemoveLiquidityTransaction {
54
+ approval: TokenApproval | null;
55
+ removeLiquidity: RemoveLiquidityDetails;
56
+ }
57
+ export interface LPTokenBalance {
58
+ poolAddress: string;
59
+ balance: bigint;
60
+ token0: string;
61
+ token1: string;
62
+ totalSupply: bigint;
63
+ sharePercent: number;
64
+ }
65
+ export interface ZapParams {
66
+ tokenA: string;
67
+ tokenB: string;
68
+ factory: string;
69
+ amountOutMinA: bigint;
70
+ amountOutMinB: bigint;
71
+ amountAMin: bigint;
72
+ amountBMin: bigint;
73
+ }
74
+ export interface ZapInQuote {
75
+ amountOutFromA: bigint;
76
+ amountOutFromB: bigint;
77
+ amountAMin: bigint;
78
+ amountBMin: bigint;
79
+ estimatedMinLiquidity: bigint;
80
+ }
81
+ export interface ZapOutQuote {
82
+ amountOutFromA: bigint;
83
+ amountOutFromB: bigint;
84
+ amountAMin: bigint;
85
+ amountBMin: bigint;
86
+ estimatedMinTokenOut: bigint;
87
+ }
88
+ export interface ZapInDetails {
89
+ params: CallParams;
90
+ poolAddress: string;
91
+ tokenIn: string;
92
+ amountIn: bigint;
93
+ amountInA: bigint;
94
+ amountInB: bigint;
95
+ routesA: RouterRoute[];
96
+ routesB: RouterRoute[];
97
+ zapParams: ZapParams;
98
+ estimatedMinLiquidity: bigint;
99
+ }
100
+ export interface ZapOutDetails {
101
+ params: CallParams;
102
+ poolAddress: string;
103
+ tokenOut: string;
104
+ liquidity: bigint;
105
+ routesA: RouterRoute[];
106
+ routesB: RouterRoute[];
107
+ zapParams: ZapParams;
108
+ estimatedMinTokenOut: bigint;
109
+ }
110
+ export interface ZapInTransaction {
111
+ approval: TokenApproval | null;
112
+ zapIn: ZapInDetails;
113
+ }
114
+ export interface ZapOutTransaction {
115
+ approval: TokenApproval | null;
116
+ zapOut: ZapOutDetails;
117
+ }
118
+ export interface RebalanceDetails {
119
+ params: CallParams;
120
+ poolAddress: string;
121
+ strategyAddress: string;
122
+ inputToken: string;
123
+ outputToken: string;
124
+ amountRequired: bigint;
125
+ expectedAmountTransferred: bigint;
126
+ expectedProtocolIncentive: bigint;
127
+ expectedLiquiditySourceIncentive: bigint;
128
+ approvalToken: string;
129
+ approvalSpender: string;
130
+ approvalAmount: bigint;
131
+ direction: LiquidityStrategyDirection;
132
+ }
133
+ export interface RebalanceTransaction {
134
+ approval: TokenApproval | null;
135
+ rebalance: RebalanceDetails;
136
+ }
137
+ export interface PreparedZapIn {
138
+ routesA: RouterRoute[];
139
+ routesB: RouterRoute[];
140
+ quote: ZapInQuote;
141
+ approval?: TokenApproval | null;
142
+ details: ZapInDetails;
143
+ }
144
+ export interface PreparedZapOut {
145
+ routesA: RouterRoute[];
146
+ routesB: RouterRoute[];
147
+ quote: ZapOutQuote;
148
+ approval?: TokenApproval | null;
149
+ details: ZapOutDetails;
150
+ }
151
+ /** Input for adding liquidity (without approval handling) */
152
+ export interface AddLiquidityInput {
153
+ poolAddress: string;
154
+ tokenA: string;
155
+ amountA: bigint;
156
+ tokenB: string;
157
+ amountB: bigint;
158
+ recipient: string;
159
+ options: LiquidityOptions;
160
+ }
161
+ /** Input for removing liquidity (without approval handling) */
162
+ export interface RemoveLiquidityInput {
163
+ poolAddress: string;
164
+ liquidity: bigint;
165
+ recipient: string;
166
+ options: LiquidityOptions;
167
+ }
168
+ /** Input for zap in (without approval handling) */
169
+ export interface ZapInInput {
170
+ poolAddress: string;
171
+ tokenIn: string;
172
+ amountIn: bigint;
173
+ amountInSplit: number;
174
+ recipient: string;
175
+ options: LiquidityOptions;
176
+ }
177
+ export interface PrepareZapInInput extends ZapInInput {
178
+ owner?: string;
179
+ }
180
+ /** Input for zap out (without approval handling) */
181
+ export interface ZapOutInput {
182
+ poolAddress: string;
183
+ tokenOut: string;
184
+ liquidity: bigint;
185
+ recipient: string;
186
+ options: LiquidityOptions;
187
+ }
188
+ export interface PrepareZapOutInput extends ZapOutInput {
189
+ owner?: string;
190
+ }
191
+ export interface RebalanceInput {
192
+ poolAddress: string;
193
+ }
194
+ //# sourceMappingURL=liquidity.d.ts.map
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=liquidity.js.map
@@ -0,0 +1,208 @@
1
+ /**
2
+ * Types of liquidity pools supported in the Mento protocol
3
+ */
4
+ export declare enum PoolType {
5
+ /** FPMM (Fixed Product Market Maker) pools - v3 native pools */
6
+ FPMM = "FPMM",
7
+ /** Virtual pools - wrapper around v2 BiPoolManager exchanges */
8
+ Virtual = "Virtual"
9
+ }
10
+ /**
11
+ * Represents a liquidity pool between two tokens in the Mento protocol
12
+ */
13
+ export interface Pool {
14
+ /**
15
+ * The address of the factory contract that was used to deploy this pool
16
+ */
17
+ factoryAddr: string;
18
+ /**
19
+ * The deployed pool contract address (serves as unique identifier)
20
+ */
21
+ poolAddr: string;
22
+ /**
23
+ * The address of the first token in the pool
24
+ */
25
+ token0: string;
26
+ /**
27
+ * The address of the second token in the pool
28
+ */
29
+ token1: string;
30
+ /**
31
+ * The type of pool (FPMM or Virtual)
32
+ */
33
+ poolType: `${PoolType}`;
34
+ /**
35
+ * The exchange ID from BiPoolManager (Virtual pools only).
36
+ */
37
+ exchangeId?: string;
38
+ }
39
+ /**
40
+ * Pricing and oracle data for an FPMM pool
41
+ */
42
+ export interface FPMMPricing {
43
+ /** Raw oracle price numerator from contract */
44
+ oraclePriceNum: bigint;
45
+ /** Raw oracle price denominator from contract */
46
+ oraclePriceDen: bigint;
47
+ /** Oracle price as a decimal number (num / den) */
48
+ oraclePrice: number;
49
+ /** Raw reserve/pool price numerator from contract */
50
+ reservePriceNum: bigint;
51
+ /** Raw reserve/pool price denominator from contract */
52
+ reservePriceDen: bigint;
53
+ /** Reserve/pool price as a decimal number (num / den) */
54
+ reservePrice: number;
55
+ /** Price difference in basis points (raw from contract) */
56
+ priceDifferenceBps: bigint;
57
+ /** Price difference as a percentage (bps / 100, e.g. 12 bps → 0.12%) */
58
+ priceDifferencePercent: number;
59
+ /** Whether the reserve/pool price is above the oracle price */
60
+ reservePriceAboveOraclePrice: boolean;
61
+ }
62
+ /**
63
+ * Fee configuration for an FPMM pool
64
+ */
65
+ export interface FPMMFees {
66
+ /** LP fee in basis points (raw) */
67
+ lpFeeBps: bigint;
68
+ /** LP fee as a percentage (e.g. 0.25 = 0.25%) */
69
+ lpFeePercent: number;
70
+ /** Protocol fee in basis points (raw) */
71
+ protocolFeeBps: bigint;
72
+ /** Protocol fee as a percentage */
73
+ protocolFeePercent: number;
74
+ /** Total fee (lpFee + protocolFee) as a percentage */
75
+ totalFeePercent: number;
76
+ }
77
+ /**
78
+ * Rebalancing state and configuration for an FPMM pool
79
+ */
80
+ export interface FPMMRebalancing {
81
+ /** Rebalance incentive in basis points (raw) */
82
+ rebalanceIncentiveBps: bigint;
83
+ /** Rebalance incentive as a percentage */
84
+ rebalanceIncentivePercent: number;
85
+ /** Threshold above oracle price in basis points (raw) */
86
+ rebalanceThresholdAboveBps: bigint;
87
+ /** Threshold above as a percentage */
88
+ rebalanceThresholdAbovePercent: number;
89
+ /** Threshold below oracle price in basis points (raw) */
90
+ rebalanceThresholdBelowBps: bigint;
91
+ /** Threshold below as a percentage */
92
+ rebalanceThresholdBelowPercent: number;
93
+ /** Whether the current price is within rebalancing thresholds (null when pricing unavailable) */
94
+ inBand: boolean | null;
95
+ /** The registered Open Liquidity Strategy address for this pool, or null if none */
96
+ liquidityStrategy: string | null;
97
+ }
98
+ export type LiquidityStrategyDirection = 'Expand' | 'Contract';
99
+ export interface LiquidityStrategyRebalanceIncentives {
100
+ liquiditySourceIncentiveExpansion: bigint;
101
+ protocolIncentiveExpansion: bigint;
102
+ liquiditySourceIncentiveContraction: bigint;
103
+ protocolIncentiveContraction: bigint;
104
+ }
105
+ export interface LiquidityStrategyPoolConfig {
106
+ isToken0Debt: boolean;
107
+ lastRebalance: number;
108
+ rebalanceCooldown: number;
109
+ protocolFeeRecipient: string;
110
+ liquiditySourceIncentiveExpansion: bigint;
111
+ protocolIncentiveExpansion: bigint;
112
+ liquiditySourceIncentiveContraction: bigint;
113
+ protocolIncentiveContraction: bigint;
114
+ }
115
+ export interface LiquidityStrategyContext {
116
+ pool: string;
117
+ reserves: {
118
+ reserveNum: bigint;
119
+ reserveDen: bigint;
120
+ };
121
+ prices: {
122
+ oracleNum: bigint;
123
+ oracleDen: bigint;
124
+ poolPriceAbove: boolean;
125
+ rebalanceThreshold: number;
126
+ };
127
+ token0: string;
128
+ token1: string;
129
+ token0Dec: bigint;
130
+ token1Dec: bigint;
131
+ isToken0Debt: boolean;
132
+ incentives: LiquidityStrategyRebalanceIncentives;
133
+ }
134
+ export interface LiquidityStrategyAction {
135
+ dir: LiquidityStrategyDirection;
136
+ amount0Out: bigint;
137
+ amount1Out: bigint;
138
+ amountOwedToPool: bigint;
139
+ }
140
+ export interface PoolRebalanceTokenAmount {
141
+ token: string;
142
+ amount: bigint;
143
+ }
144
+ export interface PoolRebalancePreview {
145
+ poolAddress: string;
146
+ strategyAddress: string;
147
+ direction: LiquidityStrategyDirection;
148
+ config: LiquidityStrategyPoolConfig;
149
+ context: LiquidityStrategyContext;
150
+ action: LiquidityStrategyAction;
151
+ inputToken: string;
152
+ outputToken: string;
153
+ amountRequired: PoolRebalanceTokenAmount;
154
+ amountTransferred: PoolRebalanceTokenAmount;
155
+ protocolIncentive: PoolRebalanceTokenAmount;
156
+ liquiditySourceIncentive: PoolRebalanceTokenAmount;
157
+ approvalToken: string;
158
+ approvalSpender: string;
159
+ approvalAmount: bigint;
160
+ }
161
+ /**
162
+ * Enriched details for an FPMM pool including pricing, fees, and rebalancing state
163
+ */
164
+ export interface FPMMPoolDetails extends Pool {
165
+ poolType: 'FPMM';
166
+ /** Scaling factor for token0 (10^tokenDecimals) */
167
+ scalingFactor0: bigint;
168
+ /** Scaling factor for token1 (10^tokenDecimals) */
169
+ scalingFactor1: bigint;
170
+ /** Reserve of token0 (raw) */
171
+ reserve0: bigint;
172
+ /** Reserve of token1 (raw) */
173
+ reserve1: bigint;
174
+ /** Block timestamp of last reserve update */
175
+ blockTimestampLast: bigint;
176
+ /** Pricing and oracle data (null when FX market is closed) */
177
+ pricing: FPMMPricing | null;
178
+ /** Fee configuration */
179
+ fees: FPMMFees;
180
+ /** Rebalancing state */
181
+ rebalancing: FPMMRebalancing;
182
+ }
183
+ /**
184
+ * Enriched details for a Virtual pool including reserves and spread
185
+ */
186
+ export interface VirtualPoolDetails extends Pool {
187
+ poolType: 'Virtual';
188
+ /** Scaling factor for token0 (10^tokenDecimals) */
189
+ scalingFactor0: bigint;
190
+ /** Scaling factor for token1 (10^tokenDecimals) */
191
+ scalingFactor1: bigint;
192
+ /** Reserve (bucket) of token0 (raw) */
193
+ reserve0: bigint;
194
+ /** Reserve (bucket) of token1 (raw) */
195
+ reserve1: bigint;
196
+ /** Block timestamp of last reserve update */
197
+ blockTimestampLast: bigint;
198
+ /** Spread/fee in basis points (raw) */
199
+ spreadBps: bigint;
200
+ /** Spread as a percentage (e.g. 0.5 = 0.5%) */
201
+ spreadPercent: number;
202
+ }
203
+ /**
204
+ * Discriminated union of enriched pool details.
205
+ * Use `poolType` to narrow the type.
206
+ */
207
+ export type PoolDetails = FPMMPoolDetails | VirtualPoolDetails;
208
+ //# sourceMappingURL=pool.d.ts.map
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PoolType = void 0;
4
+ /**
5
+ * Types of liquidity pools supported in the Mento protocol
6
+ */
7
+ var PoolType;
8
+ (function (PoolType) {
9
+ /** FPMM (Fixed Product Market Maker) pools - v3 native pools */
10
+ PoolType["FPMM"] = "FPMM";
11
+ /** Virtual pools - wrapper around v2 BiPoolManager exchanges */
12
+ PoolType["Virtual"] = "Virtual";
13
+ })(PoolType || (exports.PoolType = PoolType = {}));
14
+ //# sourceMappingURL=pool.js.map
@@ -0,0 +1,45 @@
1
+ export interface ContractCallOptions {
2
+ address: string;
3
+ abi: string[] | unknown[];
4
+ functionName: string;
5
+ args?: unknown[];
6
+ }
7
+ /**
8
+ * Contract write options for building call parameters
9
+ *
10
+ * Configuration for building transaction call parameters for write operations.
11
+ * These parameters can be used by consumers to execute transactions themselves.
12
+ */
13
+ export interface ContractWriteOptions extends ContractCallOptions {
14
+ /**
15
+ * Optional gas limit override
16
+ * If not provided, will be estimated automatically
17
+ */
18
+ gasLimit?: bigint;
19
+ /**
20
+ * Transaction value in wei
21
+ * For payable functions only
22
+ */
23
+ value?: bigint;
24
+ }
25
+ /**
26
+ * Call parameters for executing a contract transaction
27
+ *
28
+ * Contains all the data needed to execute a contract call.
29
+ * Consumers can use these parameters with their own wallet/signer to execute transactions.
30
+ */
31
+ export interface CallParams {
32
+ /**
33
+ * Contract address to call
34
+ */
35
+ to: string;
36
+ /**
37
+ * Encoded function call data (hex string)
38
+ */
39
+ data: string;
40
+ /**
41
+ * Transaction value in wei (hex string with 0x prefix)
42
+ */
43
+ value: string;
44
+ }
45
+ //# sourceMappingURL=provider.d.ts.map
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=provider.js.map
@@ -0,0 +1,62 @@
1
+ import { Pool } from './pool';
2
+ import { RouteToken } from './token';
3
+ /**
4
+ * Route identifier: sorted symbols joined with hyphen
5
+ * Represents the two endpoint tokens regardless of the path taken
6
+ */
7
+ export type RouteID = `${string}-${string}`;
8
+ /**
9
+ * Represents a tradable route between two tokens, including the pool path needed to execute the trade
10
+ */
11
+ export interface Route {
12
+ /**
13
+ * Canonical identifier: sorted symbols joined with hyphen
14
+ * Always uses alphabetical order (e.g., 'EURm-USDm' not 'USDm-EURm')
15
+ * Ensures consistent identification regardless of query direction
16
+ */
17
+ id: RouteID;
18
+ /**
19
+ * The two tokens being traded, in alphabetical order by symbol
20
+ * Always [symbolA, symbolB] where symbolA < symbolB alphabetically
21
+ */
22
+ tokens: [RouteToken, RouteToken];
23
+ /**
24
+ * Array of exchange hops needed to execute the trade
25
+ * Length 1: Direct route (single pool)
26
+ * Length 2: Two-hop route via intermediate token through two pools
27
+ * Order matters for execution
28
+ */
29
+ path: Array<Pool>;
30
+ }
31
+ /**
32
+ * Extended route with cost data for route optimization
33
+ */
34
+ export interface RouteWithCost extends Route {
35
+ /**
36
+ * Cost data for this route
37
+ * Used to select optimal route when multiple options exist
38
+ */
39
+ costData: {
40
+ /**
41
+ * Total cost percentage for this route
42
+ * Lower is better (more cost-efficient)
43
+ * Example: 0.3 means 0.3% cost
44
+ */
45
+ totalCostPercent: number;
46
+ /**
47
+ * Per-hop cost breakdown
48
+ * Used for detailed cost analysis and debugging
49
+ */
50
+ hops: Array<{
51
+ /**
52
+ * Pool Address for this hop
53
+ */
54
+ poolAddress: string;
55
+ /**
56
+ * Cost percentage for this specific hop
57
+ */
58
+ costPercent: number;
59
+ }>;
60
+ };
61
+ }
62
+ //# sourceMappingURL=route.d.ts.map
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=route.js.map
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Minimal token info for routing purposes.
3
+ * Contains only the fields needed to identify and route between tokens.
4
+ */
5
+ export interface RouteToken {
6
+ address: string;
7
+ symbol: string;
8
+ }
9
+ /**
10
+ * Full token info for consumer-facing operations.
11
+ * Extends RouteToken with display and transaction fields.
12
+ */
13
+ export interface Token extends RouteToken {
14
+ name: string;
15
+ decimals: number;
16
+ }
17
+ export interface StableToken extends Token {
18
+ totalSupply: string;
19
+ }
20
+ export type CollateralAsset = Token;
21
+ //# sourceMappingURL=token.d.ts.map
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=token.js.map