@mento-protocol/mento-sdk 1.10.2 → 2.0.0-beta.10

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 (254) hide show
  1. package/README.md +114 -48
  2. package/dist/abis/bipoolmanager.d.ts +15 -0
  3. package/dist/abis/bipoolmanager.d.ts.map +1 -0
  4. package/dist/abis/bipoolmanager.js +26 -0
  5. package/dist/abis/bipoolmanager.js.map +1 -0
  6. package/dist/abis/broker.d.ts +2 -0
  7. package/dist/abis/broker.d.ts.map +1 -0
  8. package/dist/abis/broker.js +8 -0
  9. package/dist/abis/broker.js.map +1 -0
  10. package/dist/abis/erc20.d.ts +2 -0
  11. package/dist/abis/erc20.d.ts.map +1 -0
  12. package/dist/abis/erc20.js +11 -0
  13. package/dist/abis/erc20.js.map +1 -0
  14. package/dist/abis/index.d.ts +5 -0
  15. package/dist/abis/index.d.ts.map +1 -0
  16. package/dist/{cjs/constants → abis}/index.js +5 -2
  17. package/dist/abis/index.js.map +1 -0
  18. package/dist/abis/pricingmodule.d.ts +2 -0
  19. package/dist/abis/pricingmodule.d.ts.map +1 -0
  20. package/dist/abis/pricingmodule.js +5 -0
  21. package/dist/abis/pricingmodule.js.map +1 -0
  22. package/dist/abis/reserve.d.ts +2 -0
  23. package/dist/abis/reserve.d.ts.map +1 -0
  24. package/dist/abis/reserve.js +9 -0
  25. package/dist/abis/reserve.js.map +1 -0
  26. package/dist/abis/uniswapV3.d.ts +4 -0
  27. package/dist/abis/uniswapV3.d.ts.map +1 -0
  28. package/dist/abis/uniswapV3.js +15 -0
  29. package/dist/abis/uniswapV3.js.map +1 -0
  30. package/dist/adapters/implementations/ethersAdapter.d.ts +9 -0
  31. package/dist/adapters/implementations/ethersAdapter.d.ts.map +1 -0
  32. package/dist/adapters/implementations/ethersAdapter.js +19 -0
  33. package/dist/adapters/implementations/ethersAdapter.js.map +1 -0
  34. package/dist/adapters/implementations/ethersV5Adapter.d.ts +9 -0
  35. package/dist/adapters/implementations/ethersV5Adapter.d.ts.map +1 -0
  36. package/dist/adapters/implementations/ethersV5Adapter.js +19 -0
  37. package/dist/adapters/implementations/ethersV5Adapter.js.map +1 -0
  38. package/dist/adapters/implementations/viemAdapter.d.ts +9 -0
  39. package/dist/adapters/implementations/viemAdapter.d.ts.map +1 -0
  40. package/dist/adapters/implementations/viemAdapter.js +26 -0
  41. package/dist/adapters/implementations/viemAdapter.js.map +1 -0
  42. package/dist/adapters/index.d.ts +5 -0
  43. package/dist/adapters/index.d.ts.map +1 -0
  44. package/dist/adapters/index.js +10 -0
  45. package/dist/adapters/index.js.map +1 -0
  46. package/dist/adapters/proxies/ethersAdapterProxy.d.ts +25 -0
  47. package/dist/adapters/proxies/ethersAdapterProxy.d.ts.map +1 -0
  48. package/dist/adapters/proxies/ethersAdapterProxy.js +71 -0
  49. package/dist/adapters/proxies/ethersAdapterProxy.js.map +1 -0
  50. package/dist/adapters/proxies/ethersV5AdapterProxy.d.ts +25 -0
  51. package/dist/adapters/proxies/ethersV5AdapterProxy.d.ts.map +1 -0
  52. package/dist/adapters/proxies/ethersV5AdapterProxy.js +71 -0
  53. package/dist/adapters/proxies/ethersV5AdapterProxy.js.map +1 -0
  54. package/dist/adapters/proxies/viemAdapterProxy.d.ts +25 -0
  55. package/dist/adapters/proxies/viemAdapterProxy.d.ts.map +1 -0
  56. package/dist/adapters/proxies/viemAdapterProxy.js +71 -0
  57. package/dist/adapters/proxies/viemAdapterProxy.js.map +1 -0
  58. package/dist/constants/aaveConfig.d.ts +7 -0
  59. package/dist/constants/aaveConfig.d.ts.map +1 -0
  60. package/dist/constants/aaveConfig.js +22 -0
  61. package/dist/constants/aaveConfig.js.map +1 -0
  62. package/dist/constants/addresses.d.ts +14 -0
  63. package/dist/constants/addresses.d.ts.map +1 -0
  64. package/dist/{esm/constants → constants}/addresses.js +17 -16
  65. package/dist/constants/addresses.js.map +1 -0
  66. package/dist/{cjs/enums → constants}/chainId.d.ts +1 -0
  67. package/dist/constants/chainId.d.ts.map +1 -0
  68. package/dist/{cjs/enums → constants}/chainId.js +2 -1
  69. package/dist/constants/chainId.js.map +1 -0
  70. package/dist/constants/contractNames.d.ts +21 -0
  71. package/dist/constants/contractNames.d.ts.map +1 -0
  72. package/dist/constants/contractNames.js +24 -0
  73. package/dist/constants/contractNames.js.map +1 -0
  74. package/dist/constants/index.d.ts +9 -0
  75. package/dist/constants/index.d.ts.map +1 -0
  76. package/dist/constants/index.js +25 -0
  77. package/dist/constants/index.js.map +1 -0
  78. package/dist/constants/mentoAddresses.d.ts +6 -0
  79. package/dist/constants/mentoAddresses.d.ts.map +1 -0
  80. package/dist/constants/mentoAddresses.js +9 -0
  81. package/dist/constants/mentoAddresses.js.map +1 -0
  82. package/dist/{cjs/enums → constants}/proposalState.d.ts +1 -0
  83. package/dist/constants/proposalState.d.ts.map +1 -0
  84. package/dist/{cjs/enums → constants}/proposalState.js +2 -1
  85. package/dist/constants/proposalState.js.map +1 -0
  86. package/dist/constants/protocolAddresses.d.ts +5 -0
  87. package/dist/constants/protocolAddresses.d.ts.map +1 -0
  88. package/dist/constants/protocolAddresses.js +8 -0
  89. package/dist/constants/protocolAddresses.js.map +1 -0
  90. package/dist/constants/stableTokenMetadata.d.ts +12 -0
  91. package/dist/constants/stableTokenMetadata.d.ts.map +1 -0
  92. package/dist/constants/stableTokenMetadata.js +14 -0
  93. package/dist/constants/stableTokenMetadata.js.map +1 -0
  94. package/dist/index.d.ts +67 -0
  95. package/dist/index.d.ts.map +1 -0
  96. package/dist/index.js +122 -0
  97. package/dist/index.js.map +1 -0
  98. package/dist/services/collateralAssetService.d.ts +8 -0
  99. package/dist/services/collateralAssetService.d.ts.map +1 -0
  100. package/dist/services/collateralAssetService.js +47 -0
  101. package/dist/services/collateralAssetService.js.map +1 -0
  102. package/dist/services/index.d.ts +6 -0
  103. package/dist/services/index.d.ts.map +1 -0
  104. package/dist/{cjs/interfaces → services}/index.js +6 -4
  105. package/dist/services/index.js.map +1 -0
  106. package/dist/services/stableTokenService.d.ts +9 -0
  107. package/dist/services/stableTokenService.d.ts.map +1 -0
  108. package/dist/services/stableTokenService.js +40 -0
  109. package/dist/services/stableTokenService.js.map +1 -0
  110. package/dist/services/supply/ISupplyCalculator.d.ts +14 -0
  111. package/dist/services/supply/ISupplyCalculator.d.ts.map +1 -0
  112. package/dist/{cjs/interfaces/tradingLimitsState.js → services/supply/ISupplyCalculator.js} +1 -0
  113. package/dist/services/supply/ISupplyCalculator.js.map +1 -0
  114. package/dist/services/supply/aaveSupplyCalculator.d.ts +21 -0
  115. package/dist/services/supply/aaveSupplyCalculator.d.ts.map +1 -0
  116. package/dist/services/supply/aaveSupplyCalculator.js +46 -0
  117. package/dist/services/supply/aaveSupplyCalculator.js.map +1 -0
  118. package/dist/services/supply/calculatorFactory.d.ts +8 -0
  119. package/dist/services/supply/calculatorFactory.d.ts.map +1 -0
  120. package/dist/services/supply/calculatorFactory.js +3 -0
  121. package/dist/services/supply/calculatorFactory.js.map +1 -0
  122. package/dist/services/supply/defaultCalculatorFactory.d.ts +9 -0
  123. package/dist/services/supply/defaultCalculatorFactory.d.ts.map +1 -0
  124. package/dist/services/supply/defaultCalculatorFactory.js +27 -0
  125. package/dist/services/supply/defaultCalculatorFactory.js.map +1 -0
  126. package/dist/services/supply/index.d.ts +7 -0
  127. package/dist/services/supply/index.d.ts.map +1 -0
  128. package/dist/{cjs → services/supply}/index.js +7 -6
  129. package/dist/services/supply/index.js.map +1 -0
  130. package/dist/services/supply/multisigSupplyCalculator.d.ts +9 -0
  131. package/dist/services/supply/multisigSupplyCalculator.d.ts.map +1 -0
  132. package/dist/services/supply/multisigSupplyCalculator.js +33 -0
  133. package/dist/services/supply/multisigSupplyCalculator.js.map +1 -0
  134. package/dist/services/supply/uniV3SupplyCalculator.d.ts +21 -0
  135. package/dist/services/supply/uniV3SupplyCalculator.d.ts.map +1 -0
  136. package/dist/services/supply/uniV3SupplyCalculator.js +233 -0
  137. package/dist/services/supply/uniV3SupplyCalculator.js.map +1 -0
  138. package/dist/services/supplyAdjustmentService.d.ts +14 -0
  139. package/dist/services/supplyAdjustmentService.d.ts.map +1 -0
  140. package/dist/services/supplyAdjustmentService.js +46 -0
  141. package/dist/services/supplyAdjustmentService.js.map +1 -0
  142. package/dist/services/tokenMetadataService.d.ts +8 -0
  143. package/dist/services/tokenMetadataService.d.ts.map +1 -0
  144. package/dist/services/tokenMetadataService.js +44 -0
  145. package/dist/services/tokenMetadataService.js.map +1 -0
  146. package/dist/{cjs/types → types}/contractAddresses.d.ts +1 -1
  147. package/dist/types/contractAddresses.d.ts.map +1 -0
  148. package/dist/{cjs/types → types}/contractAddresses.js +1 -0
  149. package/dist/types/contractAddresses.js.map +1 -0
  150. package/dist/types/exchange.d.ts +6 -0
  151. package/dist/types/exchange.d.ts.map +1 -0
  152. package/dist/{cjs/interfaces/tradingLimit.js → types/exchange.js} +1 -0
  153. package/dist/types/exchange.js.map +1 -0
  154. package/dist/types/index.d.ts +5 -0
  155. package/dist/types/index.d.ts.map +1 -0
  156. package/dist/{cjs/types → types}/index.js +4 -1
  157. package/dist/types/index.js.map +1 -0
  158. package/dist/types/provider.d.ts +11 -0
  159. package/dist/types/provider.d.ts.map +1 -0
  160. package/dist/{cjs/interfaces/tradingLimitsConfig.js → types/provider.js} +1 -0
  161. package/dist/types/provider.js.map +1 -0
  162. package/dist/types/token.d.ts +25 -0
  163. package/dist/types/token.d.ts.map +1 -0
  164. package/dist/{cjs/interfaces/IChainClient.js → types/token.js} +1 -0
  165. package/dist/types/token.js.map +1 -0
  166. package/dist/utils/index.d.ts +2 -0
  167. package/dist/utils/index.d.ts.map +1 -0
  168. package/dist/{cjs/enums → utils}/index.js +2 -2
  169. package/dist/utils/index.js.map +1 -0
  170. package/dist/utils/retry.d.ts +12 -0
  171. package/dist/utils/retry.d.ts.map +1 -0
  172. package/dist/utils/retry.js +28 -0
  173. package/dist/utils/retry.js.map +1 -0
  174. package/package.json +33 -61
  175. package/dist/cjs/ChainClient.d.ts +0 -9
  176. package/dist/cjs/ChainClient.js +0 -58
  177. package/dist/cjs/TestChainClient.d.ts +0 -7
  178. package/dist/cjs/TestChainClient.js +0 -41
  179. package/dist/cjs/constants/addresses.d.ts +0 -4
  180. package/dist/cjs/constants/addresses.js +0 -64
  181. package/dist/cjs/constants/index.d.ts +0 -2
  182. package/dist/cjs/constants/tradablePairs.42220.d.ts +0 -2
  183. package/dist/cjs/constants/tradablePairs.42220.js +0 -6407
  184. package/dist/cjs/constants/tradablePairs.44787.d.ts +0 -2
  185. package/dist/cjs/constants/tradablePairs.44787.js +0 -7391
  186. package/dist/cjs/constants/tradablePairs.d.ts +0 -16
  187. package/dist/cjs/constants/tradablePairs.js +0 -53
  188. package/dist/cjs/enums/index.d.ts +0 -2
  189. package/dist/cjs/governance.d.ts +0 -62
  190. package/dist/cjs/governance.js +0 -151
  191. package/dist/cjs/index.d.ts +0 -6
  192. package/dist/cjs/interfaces/IChainClient.d.ts +0 -6
  193. package/dist/cjs/interfaces/index.d.ts +0 -4
  194. package/dist/cjs/interfaces/tradingLimit.d.ts +0 -7
  195. package/dist/cjs/interfaces/tradingLimitsConfig.d.ts +0 -10
  196. package/dist/cjs/interfaces/tradingLimitsState.d.ts +0 -9
  197. package/dist/cjs/limits.d.ts +0 -33
  198. package/dist/cjs/limits.js +0 -130
  199. package/dist/cjs/mento.d.ts +0 -238
  200. package/dist/cjs/mento.js +0 -559
  201. package/dist/cjs/routeUtils.d.ts +0 -304
  202. package/dist/cjs/routeUtils.js +0 -372
  203. package/dist/cjs/types/contractAddressMap.d.ts +0 -4
  204. package/dist/cjs/types/contractAddressMap.js +0 -2
  205. package/dist/cjs/types/index.d.ts +0 -2
  206. package/dist/cjs/utils.d.ts +0 -50
  207. package/dist/cjs/utils.js +0 -129
  208. package/dist/esm/ChainClient.d.ts +0 -9
  209. package/dist/esm/ChainClient.js +0 -54
  210. package/dist/esm/TestChainClient.d.ts +0 -7
  211. package/dist/esm/TestChainClient.js +0 -37
  212. package/dist/esm/constants/addresses.d.ts +0 -4
  213. package/dist/esm/constants/index.d.ts +0 -2
  214. package/dist/esm/constants/index.js +0 -2
  215. package/dist/esm/constants/tradablePairs.42220.d.ts +0 -2
  216. package/dist/esm/constants/tradablePairs.42220.js +0 -6404
  217. package/dist/esm/constants/tradablePairs.44787.d.ts +0 -2
  218. package/dist/esm/constants/tradablePairs.44787.js +0 -7388
  219. package/dist/esm/constants/tradablePairs.d.ts +0 -16
  220. package/dist/esm/constants/tradablePairs.js +0 -26
  221. package/dist/esm/enums/chainId.d.ts +0 -4
  222. package/dist/esm/enums/chainId.js +0 -5
  223. package/dist/esm/enums/index.d.ts +0 -2
  224. package/dist/esm/enums/index.js +0 -2
  225. package/dist/esm/enums/proposalState.d.ts +0 -10
  226. package/dist/esm/enums/proposalState.js +0 -11
  227. package/dist/esm/governance.d.ts +0 -62
  228. package/dist/esm/governance.js +0 -147
  229. package/dist/esm/index.d.ts +0 -6
  230. package/dist/esm/index.js +0 -6
  231. package/dist/esm/interfaces/IChainClient.d.ts +0 -6
  232. package/dist/esm/interfaces/IChainClient.js +0 -1
  233. package/dist/esm/interfaces/index.d.ts +0 -4
  234. package/dist/esm/interfaces/index.js +0 -4
  235. package/dist/esm/interfaces/tradingLimit.d.ts +0 -7
  236. package/dist/esm/interfaces/tradingLimit.js +0 -1
  237. package/dist/esm/interfaces/tradingLimitsConfig.d.ts +0 -10
  238. package/dist/esm/interfaces/tradingLimitsConfig.js +0 -1
  239. package/dist/esm/interfaces/tradingLimitsState.d.ts +0 -9
  240. package/dist/esm/interfaces/tradingLimitsState.js +0 -1
  241. package/dist/esm/limits.d.ts +0 -33
  242. package/dist/esm/limits.js +0 -123
  243. package/dist/esm/mento.d.ts +0 -238
  244. package/dist/esm/mento.js +0 -555
  245. package/dist/esm/routeUtils.d.ts +0 -304
  246. package/dist/esm/routeUtils.js +0 -362
  247. package/dist/esm/types/contractAddressMap.d.ts +0 -4
  248. package/dist/esm/types/contractAddressMap.js +0 -1
  249. package/dist/esm/types/contractAddresses.d.ts +0 -23
  250. package/dist/esm/types/contractAddresses.js +0 -1
  251. package/dist/esm/types/index.d.ts +0 -2
  252. package/dist/esm/types/index.js +0 -2
  253. package/dist/esm/utils.d.ts +0 -50
  254. package/dist/esm/utils.js +0 -119
@@ -1,238 +0,0 @@
1
- import { IBroker } from '@mento-protocol/mento-core-ts';
2
- import { BigNumber, BigNumberish, providers, Signer } from 'ethers';
3
- import { Address, TradingLimit, TradingLimitsConfig, TradingLimitsState } from './interfaces';
4
- import { TradablePairWithSpread } from './constants/tradablePairs';
5
- export interface Exchange {
6
- providerAddr: Address;
7
- id: string;
8
- assets: Address[];
9
- }
10
- export interface Asset {
11
- address: Address;
12
- symbol: string;
13
- }
14
- export type TradablePairID = `${Address}-${Address}`;
15
- export interface TradablePair {
16
- id: TradablePairID;
17
- assets: [Asset, Asset];
18
- path: Array<{
19
- providerAddr: Address;
20
- id: string;
21
- assets: [Address, Address];
22
- }>;
23
- }
24
- export declare class Mento {
25
- private readonly signerOrProvider;
26
- private readonly broker;
27
- private readonly router;
28
- private exchanges;
29
- /**
30
- * This constructor is private, use the static create or createWithParams methods
31
- * to create a new Mento instance
32
- * @param signerOrProvider an ethers provider or connected signer
33
- * @param brokerAddress the address of the broker contract
34
- * @param exchanges exchange data for the broker
35
- */
36
- private constructor();
37
- /**
38
- * Creates a new Mento object instance.
39
- * When constructed with only a Provider only read-only operations are supported
40
- * @param signerOrProvider an ethers signer or provider. A signer is required to execute swaps
41
- * @returns a new Mento object instance
42
- */
43
- static create(signerOrProvider: Signer | providers.Provider): Promise<Mento>;
44
- /**
45
- * Create a new Mento object instance given a broker address and optional exchanges data
46
- * When constructed with a Provider, only read-only operations are supported
47
- * @param signerOrProvider an ethers signer or provider. A signer is required to execute swaps
48
- * @param brokerAddr the address of the broker contract
49
- * @param exchanges the exchanges data for the broker
50
- * @returns a new Mento object instance
51
- */
52
- static createWithParams(signerOrProvider: Signer | providers.Provider, brokerAddr: Address, routerAddr: Address, exchanges?: Exchange[]): Mento;
53
- /**
54
- * Returns a new Mento instance connected to the given signer
55
- * @param signer an ethers signer
56
- * @returns new Mento object instance
57
- */
58
- connectSigner(signer: Signer): Mento;
59
- /**
60
- * Get tradable pairs for backwards compatibility
61
- * @returns an array of Asset pairs
62
- */
63
- getTradablePairs({ cached, }?: {
64
- cached?: boolean;
65
- }): Promise<[Asset, Asset][]>;
66
- /**
67
- * Returns a list of all tradable pairs on Mento via direct exchanges.
68
- * Each pair is represented using the TradablePair interface, with its id
69
- * (a concatenation of the two asset symbols in alphabetical order),
70
- * the two Asset objects, and a path (an array with a single direct exchange hop).
71
- * @returns An array of direct TradablePair objects.
72
- */
73
- getDirectPairs(): Promise<TradablePair[]>;
74
- /**
75
- * Returns a list of all tradable pairs on Mento, including those achievable
76
- * via two-hop routes. For two-hop pairs, the path will contain two exchange hops.
77
- * Each TradablePair contains an id (the concatenation of the two asset symbols in alphabetical order),
78
- * the two Asset objects, and an array of exchange details for each hop.
79
- * @param options - Optional parameters
80
- * @param options.cached - Whether to use cached data (default: true)
81
- * @param options.returnAllRoutes - Whether to return all possible routes or just the best one per pair (default: false)
82
- * @returns An array of TradablePair objects representing available trade routes.
83
- */
84
- getTradablePairsWithPath({ cached, returnAllRoutes, }?: {
85
- cached?: boolean;
86
- returnAllRoutes?: boolean;
87
- }): Promise<readonly (TradablePair | TradablePairWithSpread)[]>;
88
- /**
89
- * Attempts to get cached tradable pairs for the current chain
90
- */
91
- private getCachedTradablePairs;
92
- /**
93
- * Returns the amount of tokenIn to be sold to buy amountOut of tokenOut.
94
- * If the provided tradablePair has a single (direct) pricing path, then direct pricing is used.
95
- * Otherwise, routed pricing via the MentoRouter is applied.
96
- * @param tokenIn the token to be sold
97
- * @param tokenOut the token to be bought
98
- * @param amountOut the desired amount of tokenOut to be obtained
99
- * @param tradablePair the TradablePair object containing the pricing path information
100
- * @returns the amount of tokenIn to be sold
101
- */
102
- getAmountIn(tokenIn: Address, tokenOut: Address, amountOut: BigNumberish, tradablePair?: TradablePair): Promise<BigNumber>;
103
- /**
104
- * Returns the amount of tokenOut to be bought by selling amountIn of tokenIn.
105
- * If the provided tradablePair has a single (direct) pricing path, then direct pricing is used.
106
- * Otherwise, routed pricing via the MentoRouter is applied.
107
- * @param tokenIn the token to be sold
108
- * @param tokenOut the token to be bought
109
- * @param amountIn the amount of tokenIn to be sold
110
- * @param tradablePair the TradablePair object containing the pricing path information
111
- * @returns the amount of tokenOut to be bought
112
- */
113
- getAmountOut(tokenIn: Address, tokenOut: Address, amountIn: BigNumberish, tradablePair?: TradablePair): Promise<BigNumber>;
114
- /**
115
- * Internal method for direct pricing: retrieves the exchange for the given tokens
116
- * and returns the amountIn using the broker.
117
- */
118
- private getAmountInDirect;
119
- /**
120
- * Internal method for direct pricing: retrieves the exchange for the given tokens
121
- * and returns the amountOut using the broker.
122
- */
123
- private getAmountOutDirect;
124
- /**
125
- * Internal method for routed pricing: uses the MentoRouter to determine the required tokenIn
126
- * for obtaining amountOut through a multi-hop route specified in tradablePair.path.
127
- */
128
- private getAmountInRouted;
129
- /**
130
- * Internal method for routed pricing: uses the MentoRouter to determine the amountOut
131
- * obtainable by selling amountIn through a multi-hop route specified in tradablePair.path.
132
- */
133
- private getAmountOutRouted;
134
- /**
135
- * Increases the broker's trading allowance for the given token
136
- * @param token the token to increase the allowance for
137
- * @param amount the amount to increase the allowance by
138
- * @returns the populated TransactionRequest object
139
- */
140
- increaseTradingAllowance(tokenIn: Address, amount: BigNumberish, tradablePair?: TradablePair): Promise<providers.TransactionRequest>;
141
- /**
142
- * Returns a token swap populated tx object with a fixed amount of tokenIn and a minimum amount of tokenOut.
143
- * If the tradablePair contains a single-hop route, a direct swap is executed using swapExactTokensForTokens on the broker.
144
- * Otherwise, a routed swap is executed via the router.
145
- * @param tokenIn the token to be sold
146
- * @param tokenOut the token to be bought
147
- * @param amountIn the amount of tokenIn to be sold
148
- * @param amountOutMin the minimum amount of tokenOut to be bought
149
- * @param tradablePair the tradable pair details to determine routing
150
- * @returns the populated TransactionRequest object
151
- */
152
- swapIn(tokenIn: Address, tokenOut: Address, amountIn: BigNumberish, amountOutMin: BigNumberish, tradablePair?: TradablePair): Promise<providers.TransactionRequest>;
153
- private swapInDirect;
154
- private swapInRouted;
155
- /**
156
- * Returns a token swap populated tx object with a maximum amount of tokenIn and a fixed amount of tokenOut.
157
- * If the tradablePair contains a single-hop route, a direct swap is executed using swapTokensForExactTokens on the broker.
158
- * Otherwise, a routed swap is executed via the router.
159
- * @param tokenIn the token to be sold
160
- * @param tokenOut the token to be bought
161
- * @param amountOut the amount of tokenOut to be bought
162
- * @param amountInMax the maximum amount of tokenIn to be sold
163
- * @returns the populated TransactionRequest object
164
- */
165
- swapOut(tokenIn: Address, tokenOut: Address, amountOut: BigNumberish, amountInMax: BigNumberish, tradablePair?: TradablePair): Promise<providers.TransactionRequest>;
166
- private swapOutDirect;
167
- private swapOutRouted;
168
- /**
169
- * Helper method to build the steps for a routed swap, ensuring proper token ordering
170
- * through the path segments
171
- */
172
- private buildSteps;
173
- /**
174
- * Returns the mento instance's broker contract
175
- * @returns broker contract
176
- */
177
- getBroker(): IBroker;
178
- /**
179
- * Finds a tradable pair for the given input and output tokens
180
- * @param tokenIn the input token address
181
- * @param tokenOut the output token address
182
- * @returns the tradable pair containing the path between the tokens
183
- * @throws if no path is found between the tokens
184
- */
185
- findPairForTokens(tokenIn: Address, tokenOut: Address): Promise<TradablePair>;
186
- /**
187
- * Returns the list of exchanges available in Mento (cached)
188
- * @returns the list of exchanges
189
- */
190
- getExchanges(): Promise<Exchange[]>;
191
- /**
192
- * Returns the list of exchanges for a given exchange provider address
193
- * @returns list of exchanges
194
- */
195
- getExchangesForProvider(exchangeProviderAddr: Address): Promise<Exchange[]>;
196
- /**
197
- * Returns the Mento exchange (if any) for a given pair of tokens
198
- * @param token0 the address of the first token
199
- * @param token1 the address of the second token
200
- * @returns exchange
201
- */
202
- getExchangeForTokens(token0: Address, token1: Address): Promise<Exchange>;
203
- /**
204
- * Returns the Mento exchange for a given exchange id
205
- * @param exchangeId the id of the exchange
206
- * @returns the exchange with the given id
207
- */
208
- getExchangeById(exchangeId: string): Promise<Exchange>;
209
- /**
210
- * Returns whether trading is enabled in the given mode for a given exchange id
211
- * @param exchangeId the id of the exchange
212
- * @param mode the trading mode
213
- * @returns true if trading is enabled in the given mode, false otherwise
214
- */
215
- isTradingEnabled(exchangeId: string): Promise<boolean>;
216
- /**
217
- * Return the trading limits for a given exchange id. Each limit is an object with the following fields:
218
- * asset: the address of the asset with the limit
219
- * maxIn: the maximum amount of the asset that can be sold
220
- * maxOut: the maximum amount of the asset that can be bought
221
- * until: the timestamp until which the limit is valid
222
- * @param exchangeId the id of the exchange
223
- * @returns the list of trading limits
224
- */
225
- getTradingLimits(exchangeId: string): Promise<TradingLimit[]>;
226
- /**
227
- * Returns the trading limits configurations for a given exchange id
228
- * @param exchangeId the id of the exchange
229
- * @returns the trading limits configuration
230
- */
231
- getTradingLimitConfig(exchangeId: string): Promise<TradingLimitsConfig[]>;
232
- /**
233
- * Returns the trading limits state for a given exchange id
234
- * @param exchangeId the id of the exchange
235
- * @returns the trading limits state
236
- */
237
- getTradingLimitState(exchangeId: string): Promise<TradingLimitsState[]>;
238
- }