@mento-protocol/mento-sdk 2.0.0-beta.9 → 3.0.0-beta.2
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.
- package/README.md +170 -132
- package/dist/cache/routes.11142220.js +1 -0
- package/dist/cache/routes.42220.d.ts +3 -0
- package/dist/cache/routes.42220.d.ts.map +1 -0
- package/dist/cache/routes.42220.js +112 -0
- package/dist/cache/routes.42220.js.map +1 -0
- package/dist/cache/tokens.11142220.d.ts +3 -0
- package/dist/cache/tokens.11142220.d.ts.map +1 -0
- package/dist/cache/tokens.11142220.js +129 -0
- package/dist/cache/tokens.11142220.js.map +1 -0
- package/dist/cache/tokens.42220.d.ts +3 -0
- package/dist/cache/tokens.42220.d.ts.map +1 -0
- package/dist/cache/tokens.42220.js +129 -0
- package/dist/cache/tokens.42220.js.map +1 -0
- package/dist/core/abis/bipoolmanager.d.ts +34 -0
- package/dist/core/abis/bipoolmanager.d.ts.map +1 -0
- package/dist/core/abis/bipoolmanager.js +72 -0
- package/dist/core/abis/bipoolmanager.js.map +1 -0
- package/dist/core/abis/broker.d.ts +2 -0
- package/dist/core/abis/broker.d.ts.map +1 -0
- package/dist/core/abis/broker.js +9 -0
- package/dist/core/abis/broker.js.map +1 -0
- package/dist/core/abis/erc20.d.ts +2 -0
- package/dist/core/abis/erc20.d.ts.map +1 -0
- package/dist/{abis → core/abis}/erc20.js +5 -2
- package/dist/core/abis/erc20.js.map +1 -0
- package/dist/core/abis/fpmm.d.ts +34 -0
- package/dist/core/abis/fpmm.d.ts.map +1 -0
- package/dist/core/abis/fpmm.js +11 -0
- package/dist/core/abis/fpmm.js.map +1 -0
- package/dist/core/abis/fpmmFactory.d.ts +21 -0
- package/dist/core/abis/fpmmFactory.d.ts.map +1 -0
- package/dist/core/abis/fpmmFactory.js +9 -0
- package/dist/core/abis/fpmmFactory.js.map +1 -0
- package/dist/core/abis/index.d.ts +10 -0
- package/dist/core/abis/index.d.ts.map +1 -0
- package/dist/{abis → core/abis}/index.js +4 -0
- package/dist/core/abis/index.js.map +1 -0
- package/dist/core/abis/pricingmodule.d.ts +2 -0
- package/dist/core/abis/pricingmodule.d.ts.map +1 -0
- package/dist/core/abis/pricingmodule.js +6 -0
- package/dist/core/abis/pricingmodule.js.map +1 -0
- package/dist/core/abis/reserve.d.ts +2 -0
- package/dist/core/abis/reserve.d.ts.map +1 -0
- package/dist/core/abis/reserve.js +10 -0
- package/dist/core/abis/reserve.js.map +1 -0
- package/dist/core/abis/router.d.ts +2 -0
- package/dist/core/abis/router.d.ts.map +1 -0
- package/dist/core/abis/router.js +10 -0
- package/dist/core/abis/router.js.map +1 -0
- package/dist/core/abis/uniswapV3.d.ts +4 -0
- package/dist/core/abis/uniswapV3.d.ts.map +1 -0
- package/dist/{abis → core/abis}/uniswapV3.js +7 -6
- package/dist/core/abis/uniswapV3.js.map +1 -0
- package/dist/core/abis/virtualPool.d.ts +10 -0
- package/dist/core/abis/virtualPool.d.ts.map +1 -0
- package/dist/core/abis/virtualPool.js +6 -0
- package/dist/core/abis/virtualPool.js.map +1 -0
- package/dist/core/abis/virtualPoolFactory.d.ts +27 -0
- package/dist/core/abis/virtualPoolFactory.d.ts.map +1 -0
- package/dist/core/abis/virtualPoolFactory.js +9 -0
- package/dist/core/abis/virtualPoolFactory.js.map +1 -0
- package/dist/core/constants/aaveConfig.d.ts.map +1 -0
- package/dist/core/constants/aaveConfig.js.map +1 -0
- package/dist/{constants → core/constants}/addresses.d.ts +4 -5
- package/dist/core/constants/addresses.d.ts.map +1 -0
- package/dist/core/constants/addresses.js +73 -0
- package/dist/core/constants/addresses.js.map +1 -0
- package/dist/core/constants/chainId.d.ts +5 -0
- package/dist/core/constants/chainId.d.ts.map +1 -0
- package/dist/{constants → core/constants}/chainId.js +1 -1
- package/dist/core/constants/chainId.js.map +1 -0
- package/dist/core/constants/contractNames.d.ts.map +1 -0
- package/dist/core/constants/contractNames.js.map +1 -0
- package/dist/{constants → core/constants}/index.d.ts +0 -2
- package/dist/core/constants/index.d.ts.map +1 -0
- package/dist/{constants → core/constants}/index.js +0 -2
- package/dist/core/constants/index.js.map +1 -0
- package/dist/{constants → core/constants}/mentoAddresses.d.ts +2 -0
- package/dist/core/constants/mentoAddresses.d.ts.map +1 -0
- package/dist/{constants → core/constants}/mentoAddresses.js +2 -0
- package/dist/core/constants/mentoAddresses.js.map +1 -0
- package/dist/core/constants/protocolAddresses.d.ts.map +1 -0
- package/dist/core/constants/protocolAddresses.js.map +1 -0
- package/dist/core/errors/base.d.ts +8 -0
- package/dist/core/errors/base.d.ts.map +1 -0
- package/dist/core/errors/base.js +17 -0
- package/dist/core/errors/base.js.map +1 -0
- package/dist/core/errors/index.d.ts +3 -0
- package/dist/core/errors/index.d.ts.map +1 -0
- package/dist/core/errors/index.js +19 -0
- package/dist/core/errors/index.js.map +1 -0
- package/dist/core/errors/router.d.ts +8 -0
- package/dist/core/errors/router.d.ts.map +1 -0
- package/dist/core/errors/router.js +14 -0
- package/dist/core/errors/router.js.map +1 -0
- package/dist/core/types/contractAddresses.d.ts +39 -0
- package/dist/core/types/contractAddresses.d.ts.map +1 -0
- package/dist/core/types/contractAddresses.js.map +1 -0
- package/dist/{types → core/types}/index.d.ts +2 -1
- package/dist/core/types/index.d.ts.map +1 -0
- package/dist/{types → core/types}/index.js +2 -1
- package/dist/core/types/index.js.map +1 -0
- package/dist/core/types/pool.d.ts +35 -0
- package/dist/core/types/pool.d.ts.map +1 -0
- package/dist/core/types/pool.js +14 -0
- package/dist/core/types/pool.js.map +1 -0
- package/dist/core/types/provider.d.ts +45 -0
- package/dist/core/types/provider.d.ts.map +1 -0
- package/dist/core/types/provider.js +4 -0
- package/dist/core/types/provider.js.map +1 -0
- package/dist/core/types/route.d.ts +62 -0
- package/dist/core/types/route.d.ts.map +1 -0
- package/dist/{types/provider.js → core/types/route.js} +1 -1
- package/dist/core/types/route.js.map +1 -0
- package/dist/{types → core/types}/token.d.ts +7 -7
- package/dist/core/types/token.d.ts.map +1 -0
- package/dist/{types → core/types}/token.js.map +1 -1
- package/dist/index.d.ts +39 -109
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +57 -152
- package/dist/index.js.map +1 -1
- package/dist/services/index.d.ts +6 -6
- package/dist/services/index.d.ts.map +1 -1
- package/dist/services/index.js +6 -6
- package/dist/services/index.js.map +1 -1
- package/dist/services/pools/PoolService.d.ts +37 -0
- package/dist/services/pools/PoolService.d.ts.map +1 -0
- package/dist/services/pools/PoolService.js +158 -0
- package/dist/services/pools/PoolService.js.map +1 -0
- package/dist/services/pools/index.d.ts +2 -0
- package/dist/services/pools/index.d.ts.map +1 -0
- package/dist/services/pools/index.js +18 -0
- package/dist/services/pools/index.js.map +1 -0
- package/dist/services/quotes/QuoteService.d.ts +41 -0
- package/dist/services/quotes/QuoteService.d.ts.map +1 -0
- package/dist/services/quotes/QuoteService.js +61 -0
- package/dist/services/quotes/QuoteService.js.map +1 -0
- package/dist/services/quotes/index.d.ts +2 -0
- package/dist/services/quotes/index.d.ts.map +1 -0
- package/dist/services/quotes/index.js +18 -0
- package/dist/services/quotes/index.js.map +1 -0
- package/dist/services/routes/RouteService.d.ts +109 -0
- package/dist/services/routes/RouteService.d.ts.map +1 -0
- package/dist/services/routes/RouteService.js +241 -0
- package/dist/services/routes/RouteService.js.map +1 -0
- package/dist/services/routes/index.d.ts +2 -0
- package/dist/services/routes/index.d.ts.map +1 -0
- package/dist/services/routes/index.js +18 -0
- package/dist/services/routes/index.js.map +1 -0
- package/dist/services/swap/SwapService.d.ts +158 -0
- package/dist/services/swap/SwapService.d.ts.map +1 -0
- package/dist/services/swap/SwapService.js +160 -0
- package/dist/services/swap/SwapService.js.map +1 -0
- package/dist/services/swap/index.d.ts +2 -0
- package/dist/services/swap/index.d.ts.map +1 -0
- package/dist/services/swap/index.js +18 -0
- package/dist/services/swap/index.js.map +1 -0
- package/dist/services/tokens/index.d.ts +2 -0
- package/dist/services/tokens/index.d.ts.map +1 -0
- package/dist/services/tokens/index.js +18 -0
- package/dist/services/tokens/index.js.map +1 -0
- package/dist/services/tokens/supply/ISupplyCalculator.d.ts.map +1 -0
- package/dist/services/tokens/supply/ISupplyCalculator.js.map +1 -0
- package/dist/services/{supply → tokens/supply}/aaveSupplyCalculator.d.ts +4 -3
- package/dist/services/tokens/supply/aaveSupplyCalculator.d.ts.map +1 -0
- package/dist/services/{supply → tokens/supply}/aaveSupplyCalculator.js +7 -7
- package/dist/services/tokens/supply/aaveSupplyCalculator.js.map +1 -0
- package/dist/services/tokens/supply/calculatorFactory.d.ts +8 -0
- package/dist/services/tokens/supply/calculatorFactory.d.ts.map +1 -0
- package/dist/services/tokens/supply/calculatorFactory.js.map +1 -0
- package/dist/services/tokens/supply/defaultCalculatorFactory.d.ts +9 -0
- package/dist/services/tokens/supply/defaultCalculatorFactory.d.ts.map +1 -0
- package/dist/services/{supply → tokens/supply}/defaultCalculatorFactory.js +12 -7
- package/dist/services/tokens/supply/defaultCalculatorFactory.js.map +1 -0
- package/dist/services/tokens/supply/index.d.ts.map +1 -0
- package/dist/services/tokens/supply/index.js.map +1 -0
- package/dist/services/tokens/supply/multisigSupplyCalculator.d.ts +9 -0
- package/dist/services/tokens/supply/multisigSupplyCalculator.d.ts.map +1 -0
- package/dist/services/tokens/supply/multisigSupplyCalculator.js +33 -0
- package/dist/services/tokens/supply/multisigSupplyCalculator.js.map +1 -0
- package/dist/services/{supply → tokens/supply}/uniV3SupplyCalculator.d.ts +3 -3
- package/dist/services/tokens/supply/uniV3SupplyCalculator.d.ts.map +1 -0
- package/dist/services/{supply → tokens/supply}/uniV3SupplyCalculator.js +11 -6
- package/dist/services/tokens/supply/uniV3SupplyCalculator.js.map +1 -0
- package/dist/services/{supplyAdjustmentService.d.ts → tokens/supplyAdjustmentService.d.ts} +7 -2
- package/dist/services/tokens/supplyAdjustmentService.d.ts.map +1 -0
- package/dist/services/{supplyAdjustmentService.js → tokens/supplyAdjustmentService.js} +14 -11
- package/dist/services/tokens/supplyAdjustmentService.js.map +1 -0
- package/dist/services/tokens/tokenService.d.ts +33 -0
- package/dist/services/tokens/tokenService.d.ts.map +1 -0
- package/dist/services/tokens/tokenService.js +136 -0
- package/dist/services/tokens/tokenService.js.map +1 -0
- package/dist/utils/chainConfig.d.ts +16 -0
- package/dist/utils/chainConfig.d.ts.map +1 -0
- package/dist/utils/chainConfig.js +62 -0
- package/dist/utils/chainConfig.js.map +1 -0
- package/dist/utils/costUtils.d.ts +12 -0
- package/dist/utils/costUtils.d.ts.map +1 -0
- package/dist/utils/costUtils.js +59 -0
- package/dist/utils/costUtils.js.map +1 -0
- package/dist/utils/index.d.ts +5 -0
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +5 -0
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/pathEncoder.d.ts +28 -0
- package/dist/utils/pathEncoder.d.ts.map +1 -0
- package/dist/utils/pathEncoder.js +57 -0
- package/dist/utils/pathEncoder.js.map +1 -0
- package/dist/utils/routeUtils.d.ts +295 -0
- package/dist/utils/routeUtils.d.ts.map +1 -0
- package/dist/utils/routeUtils.js +371 -0
- package/dist/utils/routeUtils.js.map +1 -0
- package/dist/utils/routes.d.ts +9 -0
- package/dist/utils/routes.d.ts.map +1 -0
- package/dist/utils/routes.js +49 -0
- package/dist/utils/routes.js.map +1 -0
- package/dist/utils/sortUtils.d.ts +24 -0
- package/dist/utils/sortUtils.d.ts.map +1 -0
- package/dist/utils/sortUtils.js +39 -0
- package/dist/utils/sortUtils.js.map +1 -0
- package/dist/utils/tokens.d.ts +78 -0
- package/dist/utils/tokens.d.ts.map +1 -0
- package/dist/utils/tokens.js +181 -0
- package/dist/utils/tokens.js.map +1 -0
- package/package.json +10 -23
- package/dist/abis/bipoolmanager.d.ts +0 -15
- package/dist/abis/bipoolmanager.d.ts.map +0 -1
- package/dist/abis/bipoolmanager.js +0 -26
- package/dist/abis/bipoolmanager.js.map +0 -1
- package/dist/abis/broker.d.ts +0 -2
- package/dist/abis/broker.d.ts.map +0 -1
- package/dist/abis/broker.js +0 -15
- package/dist/abis/broker.js.map +0 -1
- package/dist/abis/erc20.d.ts +0 -2
- package/dist/abis/erc20.d.ts.map +0 -1
- package/dist/abis/erc20.js.map +0 -1
- package/dist/abis/index.d.ts +0 -6
- package/dist/abis/index.d.ts.map +0 -1
- package/dist/abis/index.js.map +0 -1
- package/dist/abis/pricingmodule.d.ts +0 -2
- package/dist/abis/pricingmodule.d.ts.map +0 -1
- package/dist/abis/pricingmodule.js +0 -5
- package/dist/abis/pricingmodule.js.map +0 -1
- package/dist/abis/reserve.d.ts +0 -2
- package/dist/abis/reserve.d.ts.map +0 -1
- package/dist/abis/reserve.js +0 -9
- package/dist/abis/reserve.js.map +0 -1
- package/dist/abis/uniswapV3.d.ts +0 -4
- package/dist/abis/uniswapV3.d.ts.map +0 -1
- package/dist/abis/uniswapV3.js.map +0 -1
- package/dist/adapters/implementations/ethersAdapter.d.ts +0 -13
- package/dist/adapters/implementations/ethersAdapter.d.ts.map +0 -1
- package/dist/adapters/implementations/ethersAdapter.js +0 -92
- package/dist/adapters/implementations/ethersAdapter.js.map +0 -1
- package/dist/adapters/implementations/ethersV5Adapter.d.ts +0 -13
- package/dist/adapters/implementations/ethersV5Adapter.d.ts.map +0 -1
- package/dist/adapters/implementations/ethersV5Adapter.js +0 -92
- package/dist/adapters/implementations/ethersV5Adapter.js.map +0 -1
- package/dist/adapters/implementations/viemAdapter.d.ts +0 -18
- package/dist/adapters/implementations/viemAdapter.d.ts.map +0 -1
- package/dist/adapters/implementations/viemAdapter.js +0 -126
- package/dist/adapters/implementations/viemAdapter.js.map +0 -1
- package/dist/adapters/index.d.ts +0 -5
- package/dist/adapters/index.d.ts.map +0 -1
- package/dist/adapters/index.js +0 -10
- package/dist/adapters/index.js.map +0 -1
- package/dist/adapters/proxies/ethersAdapterProxy.d.ts +0 -26
- package/dist/adapters/proxies/ethersAdapterProxy.d.ts.map +0 -1
- package/dist/adapters/proxies/ethersAdapterProxy.js +0 -78
- package/dist/adapters/proxies/ethersAdapterProxy.js.map +0 -1
- package/dist/adapters/proxies/ethersV5AdapterProxy.d.ts +0 -26
- package/dist/adapters/proxies/ethersV5AdapterProxy.d.ts.map +0 -1
- package/dist/adapters/proxies/ethersV5AdapterProxy.js +0 -78
- package/dist/adapters/proxies/ethersV5AdapterProxy.js.map +0 -1
- package/dist/adapters/proxies/viemAdapterProxy.d.ts +0 -29
- package/dist/adapters/proxies/viemAdapterProxy.d.ts.map +0 -1
- package/dist/adapters/proxies/viemAdapterProxy.js +0 -78
- package/dist/adapters/proxies/viemAdapterProxy.js.map +0 -1
- package/dist/constants/aaveConfig.d.ts.map +0 -1
- package/dist/constants/aaveConfig.js.map +0 -1
- package/dist/constants/addresses.d.ts.map +0 -1
- package/dist/constants/addresses.js +0 -61
- package/dist/constants/addresses.js.map +0 -1
- package/dist/constants/chainId.d.ts +0 -5
- package/dist/constants/chainId.d.ts.map +0 -1
- package/dist/constants/chainId.js.map +0 -1
- package/dist/constants/contractNames.d.ts.map +0 -1
- package/dist/constants/contractNames.js.map +0 -1
- package/dist/constants/index.d.ts.map +0 -1
- package/dist/constants/index.js.map +0 -1
- package/dist/constants/mentoAddresses.d.ts.map +0 -1
- package/dist/constants/mentoAddresses.js.map +0 -1
- package/dist/constants/proposalState.d.ts +0 -11
- package/dist/constants/proposalState.d.ts.map +0 -1
- package/dist/constants/proposalState.js +0 -15
- package/dist/constants/proposalState.js.map +0 -1
- package/dist/constants/protocolAddresses.d.ts.map +0 -1
- package/dist/constants/protocolAddresses.js.map +0 -1
- package/dist/constants/stableTokenMetadata.d.ts +0 -12
- package/dist/constants/stableTokenMetadata.d.ts.map +0 -1
- package/dist/constants/stableTokenMetadata.js +0 -14
- package/dist/constants/stableTokenMetadata.js.map +0 -1
- package/dist/services/collateralAssetService.d.ts +0 -8
- package/dist/services/collateralAssetService.d.ts.map +0 -1
- package/dist/services/collateralAssetService.js +0 -47
- package/dist/services/collateralAssetService.js.map +0 -1
- package/dist/services/stableTokenService.d.ts +0 -9
- package/dist/services/stableTokenService.d.ts.map +0 -1
- package/dist/services/stableTokenService.js +0 -40
- package/dist/services/stableTokenService.js.map +0 -1
- package/dist/services/supply/ISupplyCalculator.d.ts.map +0 -1
- package/dist/services/supply/ISupplyCalculator.js.map +0 -1
- package/dist/services/supply/aaveSupplyCalculator.d.ts.map +0 -1
- package/dist/services/supply/aaveSupplyCalculator.js.map +0 -1
- package/dist/services/supply/calculatorFactory.d.ts +0 -8
- package/dist/services/supply/calculatorFactory.d.ts.map +0 -1
- package/dist/services/supply/calculatorFactory.js.map +0 -1
- package/dist/services/supply/defaultCalculatorFactory.d.ts +0 -9
- package/dist/services/supply/defaultCalculatorFactory.d.ts.map +0 -1
- package/dist/services/supply/defaultCalculatorFactory.js.map +0 -1
- package/dist/services/supply/index.d.ts.map +0 -1
- package/dist/services/supply/index.js.map +0 -1
- package/dist/services/supply/multisigSupplyCalculator.d.ts +0 -9
- package/dist/services/supply/multisigSupplyCalculator.d.ts.map +0 -1
- package/dist/services/supply/multisigSupplyCalculator.js +0 -21
- package/dist/services/supply/multisigSupplyCalculator.js.map +0 -1
- package/dist/services/supply/uniV3SupplyCalculator.d.ts.map +0 -1
- package/dist/services/supply/uniV3SupplyCalculator.js.map +0 -1
- package/dist/services/supplyAdjustmentService.d.ts.map +0 -1
- package/dist/services/supplyAdjustmentService.js.map +0 -1
- package/dist/services/swapService.d.ts +0 -70
- package/dist/services/swapService.d.ts.map +0 -1
- package/dist/services/swapService.js +0 -134
- package/dist/services/swapService.js.map +0 -1
- package/dist/services/tokenMetadataService.d.ts +0 -8
- package/dist/services/tokenMetadataService.d.ts.map +0 -1
- package/dist/services/tokenMetadataService.js +0 -44
- package/dist/services/tokenMetadataService.js.map +0 -1
- package/dist/types/contractAddresses.d.ts +0 -23
- package/dist/types/contractAddresses.d.ts.map +0 -1
- package/dist/types/contractAddresses.js.map +0 -1
- package/dist/types/exchange.d.ts +0 -6
- package/dist/types/exchange.d.ts.map +0 -1
- package/dist/types/exchange.js +0 -3
- package/dist/types/exchange.js.map +0 -1
- package/dist/types/index.d.ts.map +0 -1
- package/dist/types/index.js.map +0 -1
- package/dist/types/provider.d.ts +0 -29
- package/dist/types/provider.d.ts.map +0 -1
- package/dist/types/provider.js.map +0 -1
- package/dist/types/token.d.ts.map +0 -1
- /package/dist/{constants → core/constants}/aaveConfig.d.ts +0 -0
- /package/dist/{constants → core/constants}/aaveConfig.js +0 -0
- /package/dist/{constants → core/constants}/contractNames.d.ts +0 -0
- /package/dist/{constants → core/constants}/contractNames.js +0 -0
- /package/dist/{constants → core/constants}/protocolAddresses.d.ts +0 -0
- /package/dist/{constants → core/constants}/protocolAddresses.js +0 -0
- /package/dist/{types → core/types}/contractAddresses.js +0 -0
- /package/dist/{types → core/types}/token.js +0 -0
- /package/dist/services/{supply → tokens/supply}/ISupplyCalculator.d.ts +0 -0
- /package/dist/services/{supply → tokens/supply}/ISupplyCalculator.js +0 -0
- /package/dist/services/{supply → tokens/supply}/calculatorFactory.js +0 -0
- /package/dist/services/{supply → tokens/supply}/index.d.ts +0 -0
- /package/dist/services/{supply → tokens/supply}/index.js +0 -0
package/dist/index.d.ts
CHANGED
|
@@ -1,131 +1,61 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
/** Provider can be one of:
|
|
8
|
-
* - Ethers v6 Provider (from 'ethers')
|
|
9
|
-
* - Ethers v5 Provider (from 'ethers-v5')
|
|
10
|
-
* - Viem PublicClient (from 'viem')
|
|
11
|
-
*/
|
|
12
|
-
provider: SupportedProvider;
|
|
13
|
-
/** Optional configuration for Viem wallet client (required for write operations with Viem) */
|
|
14
|
-
viemAdapterConfig?: {
|
|
15
|
-
walletClient: WalletClient;
|
|
16
|
-
account: Account;
|
|
17
|
-
};
|
|
18
|
-
}
|
|
1
|
+
import { ContractAddresses } from './core/types';
|
|
2
|
+
import { TokenService } from '@services/tokens';
|
|
3
|
+
import { PoolService } from '@services/pools';
|
|
4
|
+
import { RouteService } from '@services/routes';
|
|
5
|
+
import { QuoteService } from '@services/quotes';
|
|
6
|
+
import { SwapService } from '@services/swap';
|
|
19
7
|
/**
|
|
20
8
|
* @class Mento
|
|
21
|
-
* @description The main class for the Mento SDK.
|
|
9
|
+
* @description The main class for the Mento SDK. Initializes a viem PublicClient internally
|
|
22
10
|
* and provides a public API for interacting with the Mento Protocol.
|
|
23
11
|
* @dev example usage:
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
* });
|
|
28
|
-
*
|
|
29
|
-
* // Ethers v5
|
|
30
|
-
* const mento = await Mento.create({
|
|
31
|
-
* provider: new ethersV5.providers.JsonRpcProvider("https://forno.celo.org")
|
|
32
|
-
* });
|
|
33
|
-
*
|
|
34
|
-
* // Viem
|
|
35
|
-
* const mento = await Mento.create({
|
|
36
|
-
* provider: createPublicClient({
|
|
37
|
-
* transport: http("https://forno.celo.org")
|
|
38
|
-
* })
|
|
39
|
-
* });
|
|
12
|
+
* const mento = await Mento.create(ChainId.CELO);
|
|
13
|
+
* // or with custom RPC URL
|
|
14
|
+
* const mento = await Mento.create(ChainId.CELO, 'https://custom-rpc-url.com');
|
|
40
15
|
*
|
|
41
16
|
* // Get all stable tokens
|
|
42
|
-
* const stableTokens = await mento.getStableTokens();
|
|
17
|
+
* const stableTokens = await mento.tokens.getStableTokens();
|
|
43
18
|
*
|
|
44
19
|
* // Get all collateral assets
|
|
45
|
-
* const collateralAssets = await mento.getCollateralAssets();
|
|
20
|
+
* const collateralAssets = await mento.tokens.getCollateralAssets();
|
|
21
|
+
*
|
|
22
|
+
* // Get all pools
|
|
23
|
+
* const pools = await mento.pools.getPools();
|
|
24
|
+
*
|
|
25
|
+
* // Find a route between tokens
|
|
26
|
+
* const route = await mento.routes.findRoute(cUSD, CELO);
|
|
27
|
+
*
|
|
28
|
+
* // Get a quote for a swap
|
|
29
|
+
* const amountOut = await mento.quotes.getAmountOut(cUSD, CELO, amountIn);
|
|
30
|
+
*
|
|
31
|
+
* // Build swap parameters
|
|
32
|
+
* const swapDetails = await mento.swap.buildSwapParams(cUSD, CELO, amountIn, { slippageTolerance: 0.5 });
|
|
46
33
|
*/
|
|
47
34
|
export declare class Mento {
|
|
48
|
-
private
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
35
|
+
private chainId;
|
|
36
|
+
tokens: TokenService;
|
|
37
|
+
pools: PoolService;
|
|
38
|
+
routes: RouteService;
|
|
39
|
+
quotes: QuoteService;
|
|
40
|
+
swap: SwapService;
|
|
52
41
|
private constructor();
|
|
53
|
-
static create(config: MentoConfig): Promise<Mento>;
|
|
54
|
-
getStableTokens(): Promise<StableToken[]>;
|
|
55
42
|
/**
|
|
56
|
-
*
|
|
57
|
-
* @
|
|
43
|
+
* Create a new Mento SDK instance
|
|
44
|
+
* @param chainId - The chain ID (e.g., ChainId.CELO, ChainId.CELO_SEPOLIA)
|
|
45
|
+
* @param rpcUrl - Optional RPC URL. If not provided, uses default for the chain
|
|
46
|
+
* @returns A new Mento instance
|
|
58
47
|
*/
|
|
59
|
-
|
|
48
|
+
static create(chainId: number, rpcUrl?: string): Promise<Mento>;
|
|
60
49
|
/**
|
|
61
50
|
* Get the address of a contract for the current chain
|
|
62
51
|
* @param contractName - The contract name
|
|
63
52
|
* @returns The contract address
|
|
64
53
|
*/
|
|
65
|
-
getContractAddress(contractName: keyof ContractAddresses):
|
|
66
|
-
/**
|
|
67
|
-
* Swap a specified amount of collateral token for stable token.
|
|
68
|
-
*
|
|
69
|
-
* @param tokenIn The address of the input token (collateral token)
|
|
70
|
-
* @param tokenOut The address of the output token (stable token)
|
|
71
|
-
* @param amountIn The amount of input token to swap
|
|
72
|
-
* @param minAmountOut The minimum amount of output token to receive (for slippage protection)
|
|
73
|
-
* @param options Optional parameters for the transaction (gas settings)
|
|
74
|
-
* @returns A transaction response object
|
|
75
|
-
*/
|
|
76
|
-
swapIn(tokenIn: string, tokenOut: string, amountIn: string, minAmountOut: string, options?: Omit<ContractWriteOptions, 'address' | 'abi' | 'functionName' | 'args'>): Promise<TransactionResponse>;
|
|
77
|
-
/**
|
|
78
|
-
* Swap collateral token for a specified amount of stable token.
|
|
79
|
-
*
|
|
80
|
-
* @param tokenIn The address of the input token (collateral token)
|
|
81
|
-
* @param tokenOut The address of the output token (stable token)
|
|
82
|
-
* @param amountOut The exact amount of output token to receive
|
|
83
|
-
* @param maxAmountIn The maximum amount of input token to spend (for slippage protection)
|
|
84
|
-
* @param options Optional parameters for the transaction (gas settings)
|
|
85
|
-
* @returns A transaction response object
|
|
86
|
-
*/
|
|
87
|
-
swapOut(tokenIn: string, tokenOut: string, amountOut: string, maxAmountIn: string, options?: Omit<ContractWriteOptions, 'address' | 'abi' | 'functionName' | 'args'>): Promise<TransactionResponse>;
|
|
88
|
-
/**
|
|
89
|
-
* Calculate the amount of output token that would be received for a given input amount.
|
|
90
|
-
*
|
|
91
|
-
* @param tokenIn The address of the input token
|
|
92
|
-
* @param tokenOut The address of the output token
|
|
93
|
-
* @param amountIn The amount of input token
|
|
94
|
-
* @returns The expected amount of output token as a string
|
|
95
|
-
*/
|
|
96
|
-
getAmountOut(tokenIn: string, tokenOut: string, amountIn: string): Promise<string>;
|
|
97
|
-
/**
|
|
98
|
-
* Calculate the amount of input token required to receive a given output amount.
|
|
99
|
-
*
|
|
100
|
-
* @param tokenIn The address of the input token
|
|
101
|
-
* @param tokenOut The address of the output token
|
|
102
|
-
* @param amountOut The desired amount of output token
|
|
103
|
-
* @returns The required amount of input token as a string
|
|
104
|
-
*/
|
|
105
|
-
getAmountIn(tokenIn: string, tokenOut: string, amountOut: string): Promise<string>;
|
|
106
|
-
/**
|
|
107
|
-
* Estimate the gas needed for a swap transaction.
|
|
108
|
-
*
|
|
109
|
-
* @param methodName The method to call ('swapIn' or 'swapOut')
|
|
110
|
-
* @param args The arguments for the method
|
|
111
|
-
* @returns The estimated gas as a string
|
|
112
|
-
*/
|
|
113
|
-
estimateGas(methodName: 'swapIn' | 'swapOut', args: [string, string, string, string]): Promise<string>;
|
|
114
|
-
/**
|
|
115
|
-
* Calculate the price impact of a swap as a percentage.
|
|
116
|
-
*
|
|
117
|
-
* @param tokenIn The address of the input token
|
|
118
|
-
* @param tokenOut The address of the output token
|
|
119
|
-
* @param amountIn The amount of input token
|
|
120
|
-
* @param amountOut The expected amount of output token
|
|
121
|
-
* @returns The price impact as a percentage string (e.g., "0.5" for 0.5%)
|
|
122
|
-
*/
|
|
123
|
-
calculatePriceImpact(tokenIn: string, tokenOut: string, amountIn: string, amountOut: string): Promise<string>;
|
|
54
|
+
getContractAddress(contractName: keyof ContractAddresses): string;
|
|
124
55
|
}
|
|
125
|
-
export * from './constants';
|
|
126
|
-
export * from './types';
|
|
127
|
-
export * from './
|
|
56
|
+
export * from './core/constants';
|
|
57
|
+
export * from './core/types';
|
|
58
|
+
export * from './core/abis';
|
|
128
59
|
export * from './services';
|
|
129
|
-
export * from './abis';
|
|
130
60
|
export * from './utils';
|
|
131
61
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAA;AAIhD,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAA;AAC/C,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAA;AAC7C,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAA;AAC/C,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAA;AAC/C,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAE5C;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,qBAAa,KAAK;IAEd,OAAO,CAAC,OAAO;IACR,MAAM,EAAE,YAAY;IACpB,KAAK,EAAE,WAAW;IAClB,MAAM,EAAE,YAAY;IACpB,MAAM,EAAE,YAAY;IACpB,IAAI,EAAE,WAAW;IAN1B,OAAO;IASP;;;;;OAKG;WACiB,MAAM,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,KAAK,CAAC;IAoB5E;;;;OAIG;IACI,kBAAkB,CAAC,YAAY,EAAE,MAAM,iBAAiB,GAAG,MAAM;CAGzE;AAED,cAAc,kBAAkB,CAAA;AAChC,cAAc,cAAc,CAAA;AAC5B,cAAc,aAAa,CAAA;AAC3B,cAAc,YAAY,CAAA;AAC1B,cAAc,SAAS,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -15,180 +15,85 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
exports.Mento = void 0;
|
|
18
|
-
const
|
|
19
|
-
const
|
|
20
|
-
const
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
// v5 specific internal property
|
|
27
|
-
'formatter' in provider);
|
|
28
|
-
}
|
|
29
|
-
/** Helper type guard for Ethers v6 Provider */
|
|
30
|
-
function isEthersV6Provider(provider) {
|
|
31
|
-
// Check for v6 specific properties that don't exist in v5
|
|
32
|
-
return ('getNetwork' in provider &&
|
|
33
|
-
// v6 specific methods
|
|
34
|
-
'broadcastTransaction' in provider);
|
|
35
|
-
}
|
|
36
|
-
/** Helper type guard for Viem Provider */
|
|
37
|
-
function isViemProvider(provider) {
|
|
38
|
-
return !('getNetwork' in provider);
|
|
39
|
-
}
|
|
18
|
+
const viem_1 = require("viem");
|
|
19
|
+
const addresses_1 = require("./core/constants/addresses");
|
|
20
|
+
const chainConfig_1 = require("./utils/chainConfig");
|
|
21
|
+
const tokens_1 = require("@services/tokens");
|
|
22
|
+
const pools_1 = require("@services/pools");
|
|
23
|
+
const routes_1 = require("@services/routes");
|
|
24
|
+
const quotes_1 = require("@services/quotes");
|
|
25
|
+
const swap_1 = require("@services/swap");
|
|
40
26
|
/**
|
|
41
27
|
* @class Mento
|
|
42
|
-
* @description The main class for the Mento SDK.
|
|
28
|
+
* @description The main class for the Mento SDK. Initializes a viem PublicClient internally
|
|
43
29
|
* and provides a public API for interacting with the Mento Protocol.
|
|
44
30
|
* @dev example usage:
|
|
45
|
-
*
|
|
46
|
-
*
|
|
47
|
-
*
|
|
48
|
-
* });
|
|
49
|
-
*
|
|
50
|
-
* // Ethers v5
|
|
51
|
-
* const mento = await Mento.create({
|
|
52
|
-
* provider: new ethersV5.providers.JsonRpcProvider("https://forno.celo.org")
|
|
53
|
-
* });
|
|
54
|
-
*
|
|
55
|
-
* // Viem
|
|
56
|
-
* const mento = await Mento.create({
|
|
57
|
-
* provider: createPublicClient({
|
|
58
|
-
* transport: http("https://forno.celo.org")
|
|
59
|
-
* })
|
|
60
|
-
* });
|
|
31
|
+
* const mento = await Mento.create(ChainId.CELO);
|
|
32
|
+
* // or with custom RPC URL
|
|
33
|
+
* const mento = await Mento.create(ChainId.CELO, 'https://custom-rpc-url.com');
|
|
61
34
|
*
|
|
62
35
|
* // Get all stable tokens
|
|
63
|
-
* const stableTokens = await mento.getStableTokens();
|
|
36
|
+
* const stableTokens = await mento.tokens.getStableTokens();
|
|
64
37
|
*
|
|
65
38
|
* // Get all collateral assets
|
|
66
|
-
* const collateralAssets = await mento.getCollateralAssets();
|
|
39
|
+
* const collateralAssets = await mento.tokens.getCollateralAssets();
|
|
40
|
+
*
|
|
41
|
+
* // Get all pools
|
|
42
|
+
* const pools = await mento.pools.getPools();
|
|
43
|
+
*
|
|
44
|
+
* // Find a route between tokens
|
|
45
|
+
* const route = await mento.routes.findRoute(cUSD, CELO);
|
|
46
|
+
*
|
|
47
|
+
* // Get a quote for a swap
|
|
48
|
+
* const amountOut = await mento.quotes.getAmountOut(cUSD, CELO, amountIn);
|
|
49
|
+
*
|
|
50
|
+
* // Build swap parameters
|
|
51
|
+
* const swapDetails = await mento.swap.buildSwapParams(cUSD, CELO, amountIn, { slippageTolerance: 0.5 });
|
|
67
52
|
*/
|
|
68
53
|
class Mento {
|
|
69
|
-
constructor(
|
|
70
|
-
this.
|
|
71
|
-
this.
|
|
72
|
-
this.
|
|
73
|
-
this.
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
if (!config.provider) {
|
|
77
|
-
throw new Error('Provider is required to initialize Mento SDK');
|
|
78
|
-
}
|
|
79
|
-
let provider;
|
|
80
|
-
if (isEthersV5Provider(config.provider)) {
|
|
81
|
-
provider = new adapters_1.EthersV5Adapter(config.provider);
|
|
82
|
-
}
|
|
83
|
-
else if (isEthersV6Provider(config.provider)) {
|
|
84
|
-
provider = new adapters_1.EthersAdapter(config.provider);
|
|
85
|
-
}
|
|
86
|
-
else if (isViemProvider(config.provider)) {
|
|
87
|
-
provider = new adapters_1.ViemAdapter(config.provider, config.viemAdapterConfig);
|
|
88
|
-
}
|
|
89
|
-
else {
|
|
90
|
-
throw new Error('Unsupported provider type');
|
|
91
|
-
}
|
|
92
|
-
const stableTokenService = new services_1.StableTokenService(provider);
|
|
93
|
-
const collateralAssetService = new services_1.CollateralAssetService(provider);
|
|
94
|
-
const swapService = new services_1.SwapService(provider);
|
|
95
|
-
return new Mento(provider, stableTokenService, collateralAssetService, swapService);
|
|
96
|
-
}
|
|
97
|
-
async getStableTokens() {
|
|
98
|
-
return this.stableTokenService.getStableTokens();
|
|
54
|
+
constructor(chainId, tokens, pools, routes, quotes, swap) {
|
|
55
|
+
this.chainId = chainId;
|
|
56
|
+
this.tokens = tokens;
|
|
57
|
+
this.pools = pools;
|
|
58
|
+
this.routes = routes;
|
|
59
|
+
this.quotes = quotes;
|
|
60
|
+
this.swap = swap;
|
|
99
61
|
}
|
|
100
62
|
/**
|
|
101
|
-
*
|
|
102
|
-
* @
|
|
63
|
+
* Create a new Mento SDK instance
|
|
64
|
+
* @param chainId - The chain ID (e.g., ChainId.CELO, ChainId.CELO_SEPOLIA)
|
|
65
|
+
* @param rpcUrl - Optional RPC URL. If not provided, uses default for the chain
|
|
66
|
+
* @returns A new Mento instance
|
|
103
67
|
*/
|
|
104
|
-
async
|
|
105
|
-
|
|
68
|
+
static async create(chainId, rpcUrl) {
|
|
69
|
+
// Use provided RPC URL or default for the chain
|
|
70
|
+
const transport = (0, viem_1.http)(rpcUrl || (0, chainConfig_1.getDefaultRpcUrl)(chainId));
|
|
71
|
+
// Create viem PublicClient
|
|
72
|
+
const publicClient = (0, viem_1.createPublicClient)({
|
|
73
|
+
chain: (0, chainConfig_1.getChainConfig)(chainId),
|
|
74
|
+
transport,
|
|
75
|
+
});
|
|
76
|
+
const tokenService = new tokens_1.TokenService(publicClient, chainId);
|
|
77
|
+
const poolService = new pools_1.PoolService(publicClient, chainId);
|
|
78
|
+
const routeService = new routes_1.RouteService(publicClient, chainId, poolService);
|
|
79
|
+
const quoteService = new quotes_1.QuoteService(publicClient, chainId, routeService);
|
|
80
|
+
const swapService = new swap_1.SwapService(publicClient, chainId, routeService, quoteService);
|
|
81
|
+
// Return new mento
|
|
82
|
+
return new Mento(chainId, tokenService, poolService, routeService, quoteService, swapService);
|
|
106
83
|
}
|
|
107
84
|
/**
|
|
108
85
|
* Get the address of a contract for the current chain
|
|
109
86
|
* @param contractName - The contract name
|
|
110
87
|
* @returns The contract address
|
|
111
88
|
*/
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
return addresses_1.addresses[chainId][contractName];
|
|
115
|
-
}
|
|
116
|
-
/**
|
|
117
|
-
* Swap a specified amount of collateral token for stable token.
|
|
118
|
-
*
|
|
119
|
-
* @param tokenIn The address of the input token (collateral token)
|
|
120
|
-
* @param tokenOut The address of the output token (stable token)
|
|
121
|
-
* @param amountIn The amount of input token to swap
|
|
122
|
-
* @param minAmountOut The minimum amount of output token to receive (for slippage protection)
|
|
123
|
-
* @param options Optional parameters for the transaction (gas settings)
|
|
124
|
-
* @returns A transaction response object
|
|
125
|
-
*/
|
|
126
|
-
async swapIn(tokenIn, tokenOut, amountIn, minAmountOut, options = {}) {
|
|
127
|
-
return this.swapService.swapIn(tokenIn, tokenOut, amountIn, minAmountOut, options);
|
|
128
|
-
}
|
|
129
|
-
/**
|
|
130
|
-
* Swap collateral token for a specified amount of stable token.
|
|
131
|
-
*
|
|
132
|
-
* @param tokenIn The address of the input token (collateral token)
|
|
133
|
-
* @param tokenOut The address of the output token (stable token)
|
|
134
|
-
* @param amountOut The exact amount of output token to receive
|
|
135
|
-
* @param maxAmountIn The maximum amount of input token to spend (for slippage protection)
|
|
136
|
-
* @param options Optional parameters for the transaction (gas settings)
|
|
137
|
-
* @returns A transaction response object
|
|
138
|
-
*/
|
|
139
|
-
async swapOut(tokenIn, tokenOut, amountOut, maxAmountIn, options = {}) {
|
|
140
|
-
return this.swapService.swapOut(tokenIn, tokenOut, amountOut, maxAmountIn, options);
|
|
141
|
-
}
|
|
142
|
-
/**
|
|
143
|
-
* Calculate the amount of output token that would be received for a given input amount.
|
|
144
|
-
*
|
|
145
|
-
* @param tokenIn The address of the input token
|
|
146
|
-
* @param tokenOut The address of the output token
|
|
147
|
-
* @param amountIn The amount of input token
|
|
148
|
-
* @returns The expected amount of output token as a string
|
|
149
|
-
*/
|
|
150
|
-
async getAmountOut(tokenIn, tokenOut, amountIn) {
|
|
151
|
-
return this.swapService.getAmountOut(tokenIn, tokenOut, amountIn);
|
|
152
|
-
}
|
|
153
|
-
/**
|
|
154
|
-
* Calculate the amount of input token required to receive a given output amount.
|
|
155
|
-
*
|
|
156
|
-
* @param tokenIn The address of the input token
|
|
157
|
-
* @param tokenOut The address of the output token
|
|
158
|
-
* @param amountOut The desired amount of output token
|
|
159
|
-
* @returns The required amount of input token as a string
|
|
160
|
-
*/
|
|
161
|
-
async getAmountIn(tokenIn, tokenOut, amountOut) {
|
|
162
|
-
return this.swapService.getAmountIn(tokenIn, tokenOut, amountOut);
|
|
163
|
-
}
|
|
164
|
-
/**
|
|
165
|
-
* Estimate the gas needed for a swap transaction.
|
|
166
|
-
*
|
|
167
|
-
* @param methodName The method to call ('swapIn' or 'swapOut')
|
|
168
|
-
* @param args The arguments for the method
|
|
169
|
-
* @returns The estimated gas as a string
|
|
170
|
-
*/
|
|
171
|
-
async estimateGas(methodName, args) {
|
|
172
|
-
return this.swapService.estimateGas(methodName, args);
|
|
173
|
-
}
|
|
174
|
-
/**
|
|
175
|
-
* Calculate the price impact of a swap as a percentage.
|
|
176
|
-
*
|
|
177
|
-
* @param tokenIn The address of the input token
|
|
178
|
-
* @param tokenOut The address of the output token
|
|
179
|
-
* @param amountIn The amount of input token
|
|
180
|
-
* @param amountOut The expected amount of output token
|
|
181
|
-
* @returns The price impact as a percentage string (e.g., "0.5" for 0.5%)
|
|
182
|
-
*/
|
|
183
|
-
async calculatePriceImpact(tokenIn, tokenOut, amountIn, amountOut) {
|
|
184
|
-
return this.swapService.calculatePriceImpact(tokenIn, tokenOut, amountIn, amountOut);
|
|
89
|
+
getContractAddress(contractName) {
|
|
90
|
+
return (0, addresses_1.getContractAddress)(this.chainId, contractName);
|
|
185
91
|
}
|
|
186
92
|
}
|
|
187
93
|
exports.Mento = Mento;
|
|
188
|
-
__exportStar(require("./constants"), exports);
|
|
189
|
-
__exportStar(require("./types"), exports);
|
|
190
|
-
__exportStar(require("./
|
|
94
|
+
__exportStar(require("./core/constants"), exports);
|
|
95
|
+
__exportStar(require("./core/types"), exports);
|
|
96
|
+
__exportStar(require("./core/abis"), exports);
|
|
191
97
|
__exportStar(require("./services"), exports);
|
|
192
|
-
__exportStar(require("./abis"), exports);
|
|
193
98
|
__exportStar(require("./utils"), exports);
|
|
194
99
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,+BAAkE;AAGlE,0DAA+D;AAC/D,qDAAsE;AACtE,6CAA+C;AAC/C,2CAA6C;AAC7C,6CAA+C;AAC/C,6CAA+C;AAC/C,yCAA4C;AAE5C;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,MAAa,KAAK;IAChB,YACU,OAAe,EAChB,MAAoB,EACpB,KAAkB,EAClB,MAAoB,EACpB,MAAoB,EACpB,IAAiB;QALhB,YAAO,GAAP,OAAO,CAAQ;QAChB,WAAM,GAAN,MAAM,CAAc;QACpB,UAAK,GAAL,KAAK,CAAa;QAClB,WAAM,GAAN,MAAM,CAAc;QACpB,WAAM,GAAN,MAAM,CAAc;QACpB,SAAI,GAAJ,IAAI,CAAa;IACvB,CAAC;IAEJ;;;;;OAKG;IACI,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,OAAe,EAAE,MAAe;QACzD,gDAAgD;QAChD,MAAM,SAAS,GAAG,IAAA,WAAI,EAAC,MAAM,IAAI,IAAA,8BAAgB,EAAC,OAAO,CAAC,CAAC,CAAA;QAE3D,2BAA2B;QAC3B,MAAM,YAAY,GAAG,IAAA,yBAAkB,EAAC;YACtC,KAAK,EAAE,IAAA,4BAAc,EAAC,OAAO,CAAC;YAC9B,SAAS;SACV,CAAC,CAAA;QAEF,MAAM,YAAY,GAAG,IAAI,qBAAY,CAAC,YAAY,EAAE,OAAO,CAAC,CAAA;QAC5D,MAAM,WAAW,GAAG,IAAI,mBAAW,CAAC,YAAY,EAAE,OAAO,CAAC,CAAA;QAC1D,MAAM,YAAY,GAAG,IAAI,qBAAY,CAAC,YAAY,EAAE,OAAO,EAAE,WAAW,CAAC,CAAA;QACzE,MAAM,YAAY,GAAG,IAAI,qBAAY,CAAC,YAAY,EAAE,OAAO,EAAE,YAAY,CAAC,CAAA;QAC1E,MAAM,WAAW,GAAG,IAAI,kBAAW,CAAC,YAAY,EAAE,OAAO,EAAE,YAAY,EAAE,YAAY,CAAC,CAAA;QAEtF,mBAAmB;QACnB,OAAO,IAAI,KAAK,CAAC,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,YAAY,EAAE,YAAY,EAAE,WAAW,CAAC,CAAA;IAC/F,CAAC;IAED;;;;OAIG;IACI,kBAAkB,CAAC,YAAqC;QAC7D,OAAO,IAAA,8BAAkB,EAAC,IAAI,CAAC,OAAkB,EAAE,YAAY,CAAC,CAAA;IAClE,CAAC;CACF;AA5CD,sBA4CC;AAED,mDAAgC;AAChC,+CAA4B;AAC5B,8CAA2B;AAC3B,6CAA0B;AAC1B,0CAAuB"}
|
package/dist/services/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export * from './
|
|
2
|
-
export * from './
|
|
3
|
-
export * from './
|
|
4
|
-
export * from './
|
|
5
|
-
export * from './
|
|
6
|
-
export * from './
|
|
1
|
+
export * from './tokens/supplyAdjustmentService';
|
|
2
|
+
export * from './tokens/supply';
|
|
3
|
+
export * from './pools';
|
|
4
|
+
export * from './routes';
|
|
5
|
+
export * from './quotes';
|
|
6
|
+
export * from './swap';
|
|
7
7
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/services/index.ts"],"names":[],"mappings":"AAAA,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/services/index.ts"],"names":[],"mappings":"AAAA,cAAc,kCAAkC,CAAA;AAChD,cAAc,iBAAiB,CAAA;AAC/B,cAAc,SAAS,CAAA;AACvB,cAAc,UAAU,CAAA;AACxB,cAAc,UAAU,CAAA;AACxB,cAAc,QAAQ,CAAA"}
|
package/dist/services/index.js
CHANGED
|
@@ -14,10 +14,10 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./
|
|
18
|
-
__exportStar(require("./
|
|
19
|
-
__exportStar(require("./
|
|
20
|
-
__exportStar(require("./
|
|
21
|
-
__exportStar(require("./
|
|
22
|
-
__exportStar(require("./
|
|
17
|
+
__exportStar(require("./tokens/supplyAdjustmentService"), exports);
|
|
18
|
+
__exportStar(require("./tokens/supply"), exports);
|
|
19
|
+
__exportStar(require("./pools"), exports);
|
|
20
|
+
__exportStar(require("./routes"), exports);
|
|
21
|
+
__exportStar(require("./quotes"), exports);
|
|
22
|
+
__exportStar(require("./swap"), exports);
|
|
23
23
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/services/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/services/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,mEAAgD;AAChD,kDAA+B;AAC/B,0CAAuB;AACvB,2CAAwB;AACxB,2CAAwB;AACxB,yCAAsB"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { Pool } from '../../core/types';
|
|
2
|
+
import { PublicClient } from 'viem';
|
|
3
|
+
/**
|
|
4
|
+
* Service for discovering liquidity pools in the Mento protocol.
|
|
5
|
+
* Aggregates pools from multiple factory contracts (FPMM and VirtualPool).
|
|
6
|
+
*/
|
|
7
|
+
export declare class PoolService {
|
|
8
|
+
private publicClient;
|
|
9
|
+
private chainId;
|
|
10
|
+
private poolsCache;
|
|
11
|
+
constructor(publicClient: PublicClient, chainId: number);
|
|
12
|
+
/**
|
|
13
|
+
* Fetches all pools available in the protocol from both FPMM and Virtual pool factories
|
|
14
|
+
* Results are cached in memory for the service instance lifetime
|
|
15
|
+
*
|
|
16
|
+
* @returns Array of all pools available in the protocol
|
|
17
|
+
* @throws {Error} If RPC call fails or pools are unavailable
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```typescript
|
|
21
|
+
* const pools = await poolService.getPools()
|
|
22
|
+
* console.log(`Found ${pools.length} pools`)
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
25
|
+
getPools(): Promise<Pool[]>;
|
|
26
|
+
/**
|
|
27
|
+
* Fetches all FPMM pools from the FPMM Factory
|
|
28
|
+
*/
|
|
29
|
+
private fetchFPMMPools;
|
|
30
|
+
/**
|
|
31
|
+
* Fetches all Virtual pools by discovering them from BiPoolManager exchanges.
|
|
32
|
+
* VirtualPoolFactory doesn't have an enumeration method,
|
|
33
|
+
* so we have to derive pools from BiPoolManager.
|
|
34
|
+
*/
|
|
35
|
+
private fetchVirtualPools;
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=PoolService.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PoolService.d.ts","sourceRoot":"","sources":["../../../src/services/pools/PoolService.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAY,MAAM,kBAAkB,CAAA;AAEjD,OAAO,EAAE,YAAY,EAAW,MAAM,MAAM,CAAA;AAK5C;;;GAGG;AACH,qBAAa,WAAW;IAGV,OAAO,CAAC,YAAY;IAAgB,OAAO,CAAC,OAAO;IAF/D,OAAO,CAAC,UAAU,CAAsB;gBAEpB,YAAY,EAAE,YAAY,EAAU,OAAO,EAAE,MAAM;IAEvE;;;;;;;;;;;;OAYG;IACG,QAAQ,IAAI,OAAO,CAAC,IAAI,EAAE,CAAC;IAoBjC;;OAEG;YACW,cAAc;IAkD5B;;;;OAIG;YACW,iBAAiB;CAmEhC"}
|