@mento-protocol/mento-sdk 2.0.0-beta.9 → 3.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.
- package/README.md +204 -132
- package/dist/cache/routes.d.ts +13 -0
- package/dist/cache/routes.d.ts.map +1 -0
- package/dist/cache/routes.js +130 -0
- package/dist/cache/routes.js.map +1 -0
- package/dist/cache/tokens.d.ts +67 -0
- package/dist/cache/tokens.d.ts.map +1 -0
- package/dist/cache/tokens.js +379 -0
- package/dist/cache/tokens.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/breakerbox.d.ts +13 -0
- package/dist/core/abis/breakerbox.d.ts.map +1 -0
- package/dist/core/abis/breakerbox.js +8 -0
- package/dist/core/abis/breakerbox.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 +9 -0
- package/dist/core/abis/erc20.d.ts.map +1 -0
- package/dist/core/abis/erc20.js +21 -0
- package/dist/core/abis/erc20.js.map +1 -0
- package/dist/core/abis/fpmm.d.ts +160 -0
- package/dist/core/abis/fpmm.d.ts.map +1 -0
- package/dist/core/abis/fpmm.js +21 -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 +12 -0
- package/dist/core/abis/index.d.ts.map +1 -0
- package/dist/{abis → core/abis}/index.js +6 -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 +40 -0
- package/dist/core/abis/virtualPool.d.ts.map +1 -0
- package/dist/core/abis/virtualPool.js +10 -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/{constants → core/constants}/aaveConfig.js +2 -2
- 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 +78 -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/{types → core/errors}/index.js +2 -4
- 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 +41 -0
- package/dist/core/types/contractAddresses.d.ts.map +1 -0
- package/dist/core/types/contractAddresses.js.map +1 -0
- package/dist/core/types/index.d.ts +8 -0
- package/dist/core/types/index.d.ts.map +1 -0
- package/dist/core/types/index.js +24 -0
- package/dist/core/types/index.js.map +1 -0
- package/dist/core/types/pool.d.ts +145 -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/{types → core/types}/provider.js.map +1 -1
- package/dist/core/types/route.d.ts +62 -0
- package/dist/core/types/route.d.ts.map +1 -0
- package/dist/{types/exchange.js → core/types/route.js} +1 -1
- package/dist/core/types/route.js.map +1 -0
- package/dist/{types → core/types}/token.d.ts +16 -6
- package/dist/core/types/token.d.ts.map +1 -0
- package/dist/{types → core/types}/token.js.map +1 -1
- package/dist/core/types/tradingLimits.d.ts +91 -0
- package/dist/core/types/tradingLimits.d.ts.map +1 -0
- package/dist/core/types/tradingLimits.js +3 -0
- package/dist/core/types/tradingLimits.js.map +1 -0
- package/dist/core/types/tradingMode.d.ts +24 -0
- package/dist/core/types/tradingMode.d.ts.map +1 -0
- package/dist/core/types/tradingMode.js +31 -0
- package/dist/core/types/tradingMode.js.map +1 -0
- package/dist/core/types/transaction.d.ts +45 -0
- package/dist/core/types/transaction.d.ts.map +1 -0
- package/dist/core/types/transaction.js +3 -0
- package/dist/core/types/transaction.js.map +1 -0
- package/dist/index.d.ts +50 -109
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +69 -152
- package/dist/index.js.map +1 -1
- package/dist/services/index.d.ts +7 -6
- package/dist/services/index.d.ts.map +1 -1
- package/dist/services/index.js +7 -6
- package/dist/services/index.js.map +1 -1
- package/dist/services/pools/PoolService.d.ts +49 -0
- package/dist/services/pools/PoolService.d.ts.map +1 -0
- package/dist/services/pools/PoolService.js +92 -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/pools/poolDetails.d.ts +11 -0
- package/dist/services/pools/poolDetails.d.ts.map +1 -0
- package/dist/services/pools/poolDetails.js +136 -0
- package/dist/services/pools/poolDetails.js.map +1 -0
- package/dist/services/pools/poolDiscovery.d.ts +13 -0
- package/dist/services/pools/poolDiscovery.d.ts.map +1 -0
- package/dist/services/pools/poolDiscovery.js +115 -0
- package/dist/services/pools/poolDiscovery.js.map +1 -0
- package/dist/services/quotes/QuoteService.d.ts +50 -0
- package/dist/services/quotes/QuoteService.d.ts.map +1 -0
- package/dist/services/quotes/QuoteService.js +74 -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 +239 -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 +162 -0
- package/dist/services/swap/SwapService.d.ts.map +1 -0
- package/dist/services/swap/SwapService.js +180 -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} +3 -2
- package/dist/services/tokens/supplyAdjustmentService.d.ts.map +1 -0
- package/dist/services/{supplyAdjustmentService.js → tokens/supplyAdjustmentService.js} +11 -13
- 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/services/trading/TradingLimitsService.d.ts +38 -0
- package/dist/services/trading/TradingLimitsService.d.ts.map +1 -0
- package/dist/services/trading/TradingLimitsService.js +157 -0
- package/dist/services/trading/TradingLimitsService.js.map +1 -0
- package/dist/services/trading/TradingService.d.ts +110 -0
- package/dist/services/trading/TradingService.d.ts.map +1 -0
- package/dist/services/trading/TradingService.js +162 -0
- package/dist/services/trading/TradingService.js.map +1 -0
- package/dist/services/trading/index.d.ts +3 -0
- package/dist/services/trading/index.d.ts.map +1 -0
- package/dist/services/trading/index.js +19 -0
- package/dist/services/trading/index.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 +7 -0
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +7 -0
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/pathEncoder.d.ts +29 -0
- package/dist/utils/pathEncoder.d.ts.map +1 -0
- package/dist/utils/pathEncoder.js +73 -0
- package/dist/utils/pathEncoder.js.map +1 -0
- package/dist/utils/rateFeed.d.ts +18 -0
- package/dist/utils/rateFeed.d.ts.map +1 -0
- package/dist/utils/rateFeed.js +27 -0
- package/dist/utils/rateFeed.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 +3 -0
- package/dist/utils/routes.d.ts.map +1 -0
- package/dist/utils/routes.js +8 -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 +2 -0
- package/dist/utils/tokens.d.ts.map +1 -0
- package/dist/utils/tokens.js +13 -0
- package/dist/utils/tokens.js.map +1 -0
- package/dist/utils/tradingLimits.d.ts +41 -0
- package/dist/utils/tradingLimits.d.ts.map +1 -0
- package/dist/utils/tradingLimits.js +171 -0
- package/dist/utils/tradingLimits.js.map +1 -0
- package/dist/utils/validation.d.ts +19 -0
- package/dist/utils/validation.d.ts.map +1 -0
- package/dist/utils/validation.js +34 -0
- package/dist/utils/validation.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 +0 -11
- 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.map +0 -1
- package/dist/types/index.d.ts +0 -5
- 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/token.d.ts.map +0 -1
- /package/dist/{constants → core/constants}/aaveConfig.d.ts +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}/provider.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/README.md
CHANGED
|
@@ -31,7 +31,7 @@ const provider = createPublicClient({
|
|
|
31
31
|
const mento = new Mento({ provider })
|
|
32
32
|
|
|
33
33
|
// Use the SDK
|
|
34
|
-
const stableTokens = await mento.
|
|
34
|
+
const stableTokens = await mento.tokens.getStableTokens()
|
|
35
35
|
console.log('Stable Tokens:', stableTokens)
|
|
36
36
|
```
|
|
37
37
|
|
|
@@ -84,6 +84,40 @@ pnpm build
|
|
|
84
84
|
pnpm test
|
|
85
85
|
```
|
|
86
86
|
|
|
87
|
+
#### Cache Generation Scripts
|
|
88
|
+
|
|
89
|
+
The SDK includes scripts to generate and update cached route and token data:
|
|
90
|
+
|
|
91
|
+
```bash
|
|
92
|
+
# Generate route cache
|
|
93
|
+
pnpm cacheRoutes
|
|
94
|
+
|
|
95
|
+
# Generate token cache
|
|
96
|
+
pnpm cacheTokens
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
**Environment Variables:**
|
|
100
|
+
|
|
101
|
+
You can override the default RPC URLs used by cache generation scripts:
|
|
102
|
+
|
|
103
|
+
```bash
|
|
104
|
+
# Use custom RPC for Celo mainnet
|
|
105
|
+
export CELO_RPC_URL=https://your-custom-rpc.example.com
|
|
106
|
+
pnpm cacheRoutes
|
|
107
|
+
|
|
108
|
+
# Use custom RPC for Celo Sepolia testnet
|
|
109
|
+
export CELO_SEPOLIA_RPC_URL=https://your-sepolia-rpc.example.com
|
|
110
|
+
pnpm cacheRoutes
|
|
111
|
+
|
|
112
|
+
# Or set both
|
|
113
|
+
CELO_RPC_URL=https://your-rpc.com CELO_SEPOLIA_RPC_URL=https://your-sepolia.com pnpm cacheRoutes
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
By default, scripts use the public Forno RPC endpoints:
|
|
117
|
+
|
|
118
|
+
- Celo mainnet: `https://forno.celo.org`
|
|
119
|
+
- Celo Sepolia: `https://forno.celo-sepolia.celo-testnet.org`
|
|
120
|
+
|
|
87
121
|
### Project Structure
|
|
88
122
|
|
|
89
123
|
```bash
|
|
@@ -102,200 +136,238 @@ pnpm test
|
|
|
102
136
|
|
|
103
137
|
## Features
|
|
104
138
|
|
|
105
|
-
###
|
|
139
|
+
### Read Operations
|
|
140
|
+
|
|
141
|
+
#### Stable Tokens
|
|
106
142
|
|
|
107
143
|
Query Mento stable tokens:
|
|
108
144
|
|
|
109
145
|
```typescript
|
|
110
146
|
// Get all stable tokens
|
|
111
|
-
const tokens = await mento.getStableTokens()
|
|
147
|
+
const tokens = await mento.tokens.getStableTokens()
|
|
112
148
|
```
|
|
113
149
|
|
|
114
|
-
|
|
150
|
+
#### Collateral Assets
|
|
115
151
|
|
|
116
152
|
Retrieve collateral assets:
|
|
117
153
|
|
|
118
154
|
```typescript
|
|
119
155
|
// Get all collateral assets
|
|
120
|
-
const assets = await mento.getCollateralAssets()
|
|
156
|
+
const assets = await mento.collateral.getCollateralAssets()
|
|
121
157
|
```
|
|
122
158
|
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
The SDK provides comprehensive swap functionality, supporting exchanges between collateral assets and stable tokens:
|
|
126
|
-
|
|
127
|
-
#### Provider-Specific Setup for Write Operations
|
|
159
|
+
#### Exchanges
|
|
128
160
|
|
|
129
|
-
|
|
161
|
+
Query exchanges and tradable pairs:
|
|
130
162
|
|
|
131
|
-
**With Ethers v6:**
|
|
132
163
|
```typescript
|
|
133
|
-
|
|
134
|
-
|
|
164
|
+
// Get all exchanges
|
|
165
|
+
const exchanges = await mento.exchanges.getExchanges()
|
|
135
166
|
|
|
136
|
-
//
|
|
137
|
-
const
|
|
138
|
-
const wallet = new Wallet('YOUR_PRIVATE_KEY', provider)
|
|
167
|
+
// Get tradable pairs (includes multi-hop routes)
|
|
168
|
+
const pairs = await mento.exchanges.getTradablePairs()
|
|
139
169
|
|
|
140
|
-
//
|
|
141
|
-
const
|
|
170
|
+
// Find specific pair
|
|
171
|
+
const pair = await mento.exchanges.findPairForTokens(
|
|
172
|
+
tokenInAddress,
|
|
173
|
+
tokenOutAddress
|
|
174
|
+
)
|
|
142
175
|
```
|
|
143
176
|
|
|
144
|
-
|
|
145
|
-
```typescript
|
|
146
|
-
import { providers, Wallet } from 'ethers-v5'
|
|
147
|
-
import { Mento } from '@mento/sdk'
|
|
177
|
+
### Write Operations
|
|
148
178
|
|
|
149
|
-
|
|
150
|
-
const provider = new providers.JsonRpcProvider('YOUR_RPC_URL')
|
|
151
|
-
const wallet = new Wallet('YOUR_PRIVATE_KEY', provider)
|
|
179
|
+
The SDK supports write transactions for submitting state-changing operations to the blockchain. Write operations require a signer (Ethers) or wallet client (Viem).
|
|
152
180
|
|
|
153
|
-
|
|
154
|
-
const mento = await Mento.create({ provider: wallet })
|
|
155
|
-
```
|
|
181
|
+
#### Setup for Write Operations
|
|
156
182
|
|
|
157
183
|
**With Viem:**
|
|
184
|
+
|
|
158
185
|
```typescript
|
|
159
186
|
import { createPublicClient, createWalletClient, http } from 'viem'
|
|
160
187
|
import { privateKeyToAccount } from 'viem/accounts'
|
|
161
188
|
import { celo } from 'viem/chains'
|
|
162
189
|
import { Mento } from '@mento/sdk'
|
|
163
190
|
|
|
164
|
-
// Create
|
|
191
|
+
// Create account from private key
|
|
192
|
+
const account = privateKeyToAccount('0x...')
|
|
193
|
+
|
|
194
|
+
// Create public and wallet clients
|
|
165
195
|
const publicClient = createPublicClient({
|
|
166
196
|
chain: celo,
|
|
167
|
-
transport: http('
|
|
197
|
+
transport: http('https://forno.celo.org'),
|
|
168
198
|
})
|
|
169
199
|
|
|
170
|
-
// Create wallet client
|
|
171
|
-
const account = privateKeyToAccount('0x' + 'YOUR_PRIVATE_KEY')
|
|
172
200
|
const walletClient = createWalletClient({
|
|
173
201
|
account,
|
|
174
202
|
chain: celo,
|
|
175
|
-
transport: http('
|
|
203
|
+
transport: http('https://forno.celo.org'),
|
|
176
204
|
})
|
|
177
205
|
|
|
178
|
-
// Initialize
|
|
179
|
-
const mento = await Mento.create({
|
|
206
|
+
// Initialize SDK with write support
|
|
207
|
+
const mento = await Mento.create({
|
|
180
208
|
provider: publicClient,
|
|
181
|
-
|
|
209
|
+
signer: walletClient, // Add wallet client for write operations
|
|
182
210
|
})
|
|
183
211
|
```
|
|
184
212
|
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
Exchange a specific amount of input token for at least a minimum amount of output token:
|
|
213
|
+
**With Ethers v6:**
|
|
188
214
|
|
|
189
215
|
```typescript
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
celoAddress,
|
|
193
|
-
cUsdAddress,
|
|
194
|
-
'1000000000000000000' // 1 CELO with 18 decimals
|
|
195
|
-
)
|
|
196
|
-
console.log(`Expected amount out: ${amountOut}`)
|
|
197
|
-
|
|
198
|
-
// Calculate slippage (0.5% in this example)
|
|
199
|
-
const minAmountOut = (BigInt(amountOut) * BigInt(995)) / BigInt(1000)
|
|
200
|
-
|
|
201
|
-
// Execute the swap
|
|
202
|
-
const tx = await mento.swapIn(
|
|
203
|
-
celoAddress, // tokenIn (CELO)
|
|
204
|
-
cUsdAddress, // tokenOut (cUSD)
|
|
205
|
-
'1000000000000000000', // amountIn (fixed)
|
|
206
|
-
minAmountOut.toString(), // minimum acceptable output
|
|
207
|
-
{ gasLimit: '300000' } // Optional gas settings
|
|
208
|
-
)
|
|
216
|
+
import { JsonRpcProvider, Wallet } from 'ethers'
|
|
217
|
+
import { Mento } from '@mento/sdk'
|
|
209
218
|
|
|
210
|
-
//
|
|
211
|
-
const
|
|
212
|
-
|
|
219
|
+
// Create provider and signer
|
|
220
|
+
const provider = new JsonRpcProvider('https://forno.celo.org')
|
|
221
|
+
const signer = new Wallet('0x...', provider)
|
|
222
|
+
|
|
223
|
+
// Initialize SDK with write support
|
|
224
|
+
const mento = await Mento.create({
|
|
225
|
+
provider,
|
|
226
|
+
signer, // Add signer for write operations
|
|
227
|
+
})
|
|
213
228
|
```
|
|
214
229
|
|
|
215
|
-
####
|
|
230
|
+
#### Token Approval
|
|
216
231
|
|
|
217
|
-
|
|
232
|
+
Approve tokens for Mento protocol interactions:
|
|
218
233
|
|
|
219
234
|
```typescript
|
|
220
|
-
// Get
|
|
221
|
-
const
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
{ gasLimit: '350000' } // Optional gas settings
|
|
238
|
-
)
|
|
235
|
+
// Get the adapter (provider-agnostic)
|
|
236
|
+
const adapter = mento.getAdapter()
|
|
237
|
+
|
|
238
|
+
// Approve USDC for Mento Broker
|
|
239
|
+
const tx = await adapter.writeContract({
|
|
240
|
+
address: '0x765DE816845861e75A25fCA122bb6898B8B1282a', // USDC on Celo
|
|
241
|
+
abi: ['function approve(address spender, uint256 amount) returns (bool)'],
|
|
242
|
+
functionName: 'approve',
|
|
243
|
+
args: [
|
|
244
|
+
'0x...', // Spender address (e.g., Mento Broker)
|
|
245
|
+
1000000n, // Amount (1 USDC with 6 decimals)
|
|
246
|
+
],
|
|
247
|
+
})
|
|
248
|
+
|
|
249
|
+
console.log('Transaction hash:', tx.hash)
|
|
250
|
+
console.log('From:', tx.from)
|
|
251
|
+
console.log('To:', tx.to)
|
|
239
252
|
|
|
240
253
|
// Wait for confirmation
|
|
241
254
|
const receipt = await tx.wait()
|
|
242
|
-
console.log('
|
|
255
|
+
console.log('Transaction confirmed in block:', receipt.blockNumber)
|
|
256
|
+
console.log('Status:', receipt.status) // 'success' or 'failed'
|
|
257
|
+
```
|
|
258
|
+
|
|
259
|
+
#### Transaction Status Tracking
|
|
260
|
+
|
|
261
|
+
Monitor transaction status and confirmations:
|
|
262
|
+
|
|
263
|
+
```typescript
|
|
264
|
+
// Submit transaction
|
|
265
|
+
const tx = await adapter.writeContract({...})
|
|
266
|
+
|
|
267
|
+
// Check if transaction is mined (returns null if pending)
|
|
268
|
+
const receipt = await tx.getReceipt()
|
|
269
|
+
if (receipt) {
|
|
270
|
+
console.log('Transaction mined!', receipt.blockNumber)
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
// Wait for specific number of confirmations
|
|
274
|
+
const confirmedReceipt = await tx.wait(3) // Wait for 3 confirmations
|
|
275
|
+
console.log('Transaction confirmed after 3 blocks')
|
|
243
276
|
```
|
|
244
277
|
|
|
245
278
|
#### Gas Estimation
|
|
246
279
|
|
|
247
|
-
Estimate gas
|
|
280
|
+
Estimate gas before submitting transactions:
|
|
248
281
|
|
|
249
282
|
```typescript
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
)
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
283
|
+
// Estimate gas for an approval
|
|
284
|
+
const estimatedGas = await adapter.estimateGas({
|
|
285
|
+
address: '0x765DE816845861e75A25fCA122bb6898B8B1282a',
|
|
286
|
+
abi: ['function approve(address spender, uint256 amount) returns (bool)'],
|
|
287
|
+
functionName: 'approve',
|
|
288
|
+
args: ['0x...', 1000000n],
|
|
289
|
+
})
|
|
290
|
+
|
|
291
|
+
console.log('Estimated gas:', estimatedGas) // Returns BigInt
|
|
292
|
+
```
|
|
293
|
+
|
|
294
|
+
#### Custom Gas Parameters
|
|
295
|
+
|
|
296
|
+
Customize gas parameters for transactions:
|
|
297
|
+
|
|
298
|
+
```typescript
|
|
299
|
+
// Legacy gas price (Type 0/1 transactions)
|
|
300
|
+
const tx = await adapter.writeContract({
|
|
301
|
+
address: '0x...',
|
|
302
|
+
abi: [...],
|
|
303
|
+
functionName: 'approve',
|
|
304
|
+
args: [...],
|
|
305
|
+
gasLimit: 100000n, // Custom gas limit
|
|
306
|
+
gasPrice: 5000000000n, // 5 gwei
|
|
307
|
+
})
|
|
308
|
+
|
|
309
|
+
// EIP-1559 (Type 2 transactions)
|
|
310
|
+
const tx = await adapter.writeContract({
|
|
311
|
+
address: '0x...',
|
|
312
|
+
abi: [...],
|
|
313
|
+
functionName: 'approve',
|
|
314
|
+
args: [...],
|
|
315
|
+
gasLimit: 100000n,
|
|
316
|
+
maxFeePerGas: 10000000000n, // 10 gwei max
|
|
317
|
+
maxPriorityFeePerGas: 2000000000n, // 2 gwei priority
|
|
318
|
+
})
|
|
319
|
+
|
|
320
|
+
// Custom nonce (for transaction ordering)
|
|
321
|
+
const tx = await adapter.writeContract({
|
|
322
|
+
address: '0x...',
|
|
323
|
+
abi: [...],
|
|
324
|
+
functionName: 'approve',
|
|
325
|
+
args: [...],
|
|
326
|
+
nonce: 42n, // Explicit nonce
|
|
327
|
+
})
|
|
328
|
+
```
|
|
329
|
+
|
|
330
|
+
#### Error Handling
|
|
331
|
+
|
|
332
|
+
The SDK provides detailed error information:
|
|
333
|
+
|
|
334
|
+
```typescript
|
|
335
|
+
import { ValidationError, ExecutionError, NetworkError } from '@mento/sdk'
|
|
336
|
+
|
|
337
|
+
try {
|
|
338
|
+
const tx = await adapter.writeContract({...})
|
|
339
|
+
const receipt = await tx.wait()
|
|
340
|
+
} catch (error) {
|
|
341
|
+
if (error instanceof ValidationError) {
|
|
342
|
+
// Pre-submission validation errors (no gas cost)
|
|
343
|
+
console.error('Invalid parameters:', error.message)
|
|
344
|
+
} else if (error instanceof ExecutionError) {
|
|
345
|
+
// Transaction reverted on-chain (gas was consumed)
|
|
346
|
+
console.error('Transaction failed:', error.message)
|
|
347
|
+
console.error('Revert reason:', error.revertReason)
|
|
348
|
+
} else if (error instanceof NetworkError) {
|
|
349
|
+
// RPC/network errors
|
|
350
|
+
console.error('Network error:', error.message)
|
|
351
|
+
if (error.retry) {
|
|
352
|
+
console.log('This error is retryable')
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
}
|
|
264
356
|
```
|
|
265
357
|
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
- In Claude Code, type `/prime`.
|
|
280
|
-
- When prompted (or if your tool allows inline commands), execute the command defined in `.claude/commands/context_prime`. This will provide the AI with essential background information about the Mento SDK project.
|
|
281
|
-
- **Generate Feature Specification:**
|
|
282
|
-
- To create a new feature, first generate a detailed specification.
|
|
283
|
-
- In Claude Code, type `/spec` and select the "generate spec" command/prompt.
|
|
284
|
-
- Provide a clear description of the feature you want to implement. The AI will use the templates and examples in the `specs/` directory as a guide.
|
|
285
|
-
- **Review and Refine:** Carefully review the generated spec. Edit and refine it to ensure it accurately and comprehensively captures the feature requirements, edge cases, and acceptance criteria.
|
|
286
|
-
- **Implement Feature from Specification:**
|
|
287
|
-
- Once the spec is finalized, instruct the AI to write the code.
|
|
288
|
-
- In Claude Code, type `/spec` again, but this time select the "generate code from spec" command/prompt.
|
|
289
|
-
- Provide the filename of the spec you just created (e.g., `specs/my-new-feature.md`). You might be able to provide this inline with the command or when prompted by the AI.
|
|
290
|
-
- **Review Generated Code:**
|
|
291
|
-
- Thoroughly review the code generated by the AI. Check for correctness, adherence to coding standards (`ai_docs/project-patterns.md`), and completeness against the spec.
|
|
292
|
-
- Iterate with the AI if necessary, providing feedback for corrections or improvements.
|
|
293
|
-
- **Create a Pull Request (PR):**
|
|
294
|
-
- Once you are satisfied with the code, ask Claude Code to help you create a Pull Request.
|
|
295
|
-
- Ensure the PR description is clear and links to the relevant spec.
|
|
296
|
-
- The PR should then be reviewed by another team member before merging.
|
|
297
|
-
|
|
298
|
-
By following this workflow, you can leverage AI to handle boilerplate, draft implementations, and ensure consistency, allowing you to focus on the more complex and strategic aspects of development.
|
|
358
|
+
#### Utility Methods
|
|
359
|
+
|
|
360
|
+
Additional helper methods for write operations:
|
|
361
|
+
|
|
362
|
+
```typescript
|
|
363
|
+
// Get signer/wallet address
|
|
364
|
+
const address = await adapter.getSignerAddress()
|
|
365
|
+
console.log('Wallet address:', address)
|
|
366
|
+
|
|
367
|
+
// Get current nonce
|
|
368
|
+
const nonce = await adapter.getTransactionCount(address)
|
|
369
|
+
console.log('Next nonce:', nonce)
|
|
370
|
+
```
|
|
299
371
|
|
|
300
372
|
## Contributing
|
|
301
373
|
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { RouteWithCost } from '../core/types';
|
|
2
|
+
/**
|
|
3
|
+
* Cached routes indexed by chain ID
|
|
4
|
+
* Routes that don't exist for a chain will return an empty array
|
|
5
|
+
*/
|
|
6
|
+
export declare const cachedRoutes: Record<number, RouteWithCost[]>;
|
|
7
|
+
/**
|
|
8
|
+
* Get cached routes for a specific chain
|
|
9
|
+
* @param chainId - The chain ID
|
|
10
|
+
* @returns The cached routes array, or empty array if not available
|
|
11
|
+
*/
|
|
12
|
+
export declare function getCachedRoutes(chainId: number): RouteWithCost[];
|
|
13
|
+
//# sourceMappingURL=routes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"routes.d.ts","sourceRoot":"","sources":["../../src/cache/routes.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAA;AAElD;;;GAGG;AACH,eAAO,MAAM,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,EAAE,CA8GxD,CAAA;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,MAAM,GAAG,aAAa,EAAE,CAEhE"}
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// This file is auto-generated. Do not edit manually.
|
|
3
|
+
// Generated on 2026-01-21T20:27:37.682Z
|
|
4
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
+
exports.cachedRoutes = void 0;
|
|
6
|
+
exports.getCachedRoutes = getCachedRoutes;
|
|
7
|
+
/**
|
|
8
|
+
* Cached routes indexed by chain ID
|
|
9
|
+
* Routes that don't exist for a chain will return an empty array
|
|
10
|
+
*/
|
|
11
|
+
exports.cachedRoutes = {
|
|
12
|
+
// Chain 42220
|
|
13
|
+
42220: [
|
|
14
|
+
{
|
|
15
|
+
"id": "KESm-USDm",
|
|
16
|
+
"tokens": [
|
|
17
|
+
{
|
|
18
|
+
"address": "0x456a3D042C0DbD3db53D5489e98dFb038553B0d0",
|
|
19
|
+
"symbol": "KESm"
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
"address": "0x765DE816845861e75A25fCA122bb6898B8B1282a",
|
|
23
|
+
"symbol": "USDm"
|
|
24
|
+
}
|
|
25
|
+
],
|
|
26
|
+
"path": [
|
|
27
|
+
{
|
|
28
|
+
"factoryAddr": "0x65A67cb93a3e035C32f131e911A0d6b46a5f3Bd0",
|
|
29
|
+
"poolAddr": "0x5c3919258a040D203260880401E3201a82d224c4",
|
|
30
|
+
"token0": "0x456a3D042C0DbD3db53D5489e98dFb038553B0d0",
|
|
31
|
+
"token1": "0x765DE816845861e75A25fCA122bb6898B8B1282a",
|
|
32
|
+
"poolType": "FPMM"
|
|
33
|
+
}
|
|
34
|
+
],
|
|
35
|
+
"costData": {
|
|
36
|
+
"totalCostPercent": 0.3,
|
|
37
|
+
"hops": [
|
|
38
|
+
{
|
|
39
|
+
"poolAddress": "0x5c3919258a040D203260880401E3201a82d224c4",
|
|
40
|
+
"costPercent": 0.3
|
|
41
|
+
}
|
|
42
|
+
]
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
"id": "GHSm-USDm",
|
|
47
|
+
"tokens": [
|
|
48
|
+
{
|
|
49
|
+
"address": "0xfAeA5F3404bbA20D3cc2f8C4B0A888F55a3c7313",
|
|
50
|
+
"symbol": "GHSm"
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
"address": "0x765DE816845861e75A25fCA122bb6898B8B1282a",
|
|
54
|
+
"symbol": "USDm"
|
|
55
|
+
}
|
|
56
|
+
],
|
|
57
|
+
"path": [
|
|
58
|
+
{
|
|
59
|
+
"factoryAddr": "0x6CE2dFC48b2688075A804835757a734e3316E0a2",
|
|
60
|
+
"poolAddr": "0x21243E9F64815D86Eeb38d80a212295a39634e70",
|
|
61
|
+
"token0": "0x765DE816845861e75A25fCA122bb6898B8B1282a",
|
|
62
|
+
"token1": "0xfAeA5F3404bbA20D3cc2f8C4B0A888F55a3c7313",
|
|
63
|
+
"poolType": "Virtual",
|
|
64
|
+
"exchangeId": "0x3562f9d29eba092b857480a82b03375839c752346b9ebe93a57ab82410328187"
|
|
65
|
+
}
|
|
66
|
+
],
|
|
67
|
+
"costData": {
|
|
68
|
+
"totalCostPercent": 1,
|
|
69
|
+
"hops": [
|
|
70
|
+
{
|
|
71
|
+
"poolAddress": "0x21243E9F64815D86Eeb38d80a212295a39634e70",
|
|
72
|
+
"costPercent": 1
|
|
73
|
+
}
|
|
74
|
+
]
|
|
75
|
+
}
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
"id": "GHSm-KESm",
|
|
79
|
+
"tokens": [
|
|
80
|
+
{
|
|
81
|
+
"address": "0xfAeA5F3404bbA20D3cc2f8C4B0A888F55a3c7313",
|
|
82
|
+
"symbol": "GHSm"
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
"address": "0x456a3D042C0DbD3db53D5489e98dFb038553B0d0",
|
|
86
|
+
"symbol": "KESm"
|
|
87
|
+
}
|
|
88
|
+
],
|
|
89
|
+
"path": [
|
|
90
|
+
{
|
|
91
|
+
"factoryAddr": "0x65A67cb93a3e035C32f131e911A0d6b46a5f3Bd0",
|
|
92
|
+
"poolAddr": "0x5c3919258a040D203260880401E3201a82d224c4",
|
|
93
|
+
"token0": "0x456a3D042C0DbD3db53D5489e98dFb038553B0d0",
|
|
94
|
+
"token1": "0x765DE816845861e75A25fCA122bb6898B8B1282a",
|
|
95
|
+
"poolType": "FPMM"
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
"factoryAddr": "0x6CE2dFC48b2688075A804835757a734e3316E0a2",
|
|
99
|
+
"poolAddr": "0x21243E9F64815D86Eeb38d80a212295a39634e70",
|
|
100
|
+
"token0": "0x765DE816845861e75A25fCA122bb6898B8B1282a",
|
|
101
|
+
"token1": "0xfAeA5F3404bbA20D3cc2f8C4B0A888F55a3c7313",
|
|
102
|
+
"poolType": "Virtual",
|
|
103
|
+
"exchangeId": "0x3562f9d29eba092b857480a82b03375839c752346b9ebe93a57ab82410328187"
|
|
104
|
+
}
|
|
105
|
+
],
|
|
106
|
+
"costData": {
|
|
107
|
+
"totalCostPercent": 1.297,
|
|
108
|
+
"hops": [
|
|
109
|
+
{
|
|
110
|
+
"poolAddress": "0x5c3919258a040D203260880401E3201a82d224c4",
|
|
111
|
+
"costPercent": 0.3
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
"poolAddress": "0x21243E9F64815D86Eeb38d80a212295a39634e70",
|
|
115
|
+
"costPercent": 1
|
|
116
|
+
}
|
|
117
|
+
]
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
],
|
|
121
|
+
};
|
|
122
|
+
/**
|
|
123
|
+
* Get cached routes for a specific chain
|
|
124
|
+
* @param chainId - The chain ID
|
|
125
|
+
* @returns The cached routes array, or empty array if not available
|
|
126
|
+
*/
|
|
127
|
+
function getCachedRoutes(chainId) {
|
|
128
|
+
return exports.cachedRoutes[chainId] ?? [];
|
|
129
|
+
}
|
|
130
|
+
//# sourceMappingURL=routes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"routes.js","sourceRoot":"","sources":["../../src/cache/routes.ts"],"names":[],"mappings":";AAAA,qDAAqD;AACrD,wCAAwC;;;AA6HxC,0CAEC;AA3HD;;;GAGG;AACU,QAAA,YAAY,GAAoC;IAC3D,cAAc;IACd,KAAK,EAAE;QACL;YACE,IAAI,EAAE,WAAW;YACjB,QAAQ,EAAE;gBACR;oBACE,SAAS,EAAE,4CAA4C;oBACvD,QAAQ,EAAE,MAAM;iBACjB;gBACD;oBACE,SAAS,EAAE,4CAA4C;oBACvD,QAAQ,EAAE,MAAM;iBACjB;aACF;YACD,MAAM,EAAE;gBACN;oBACE,aAAa,EAAE,4CAA4C;oBAC3D,UAAU,EAAE,4CAA4C;oBACxD,QAAQ,EAAE,4CAA4C;oBACtD,QAAQ,EAAE,4CAA4C;oBACtD,UAAU,EAAE,MAAM;iBACnB;aACF;YACD,UAAU,EAAE;gBACV,kBAAkB,EAAE,GAAG;gBACvB,MAAM,EAAE;oBACN;wBACE,aAAa,EAAE,4CAA4C;wBAC3D,aAAa,EAAE,GAAG;qBACnB;iBACF;aACF;SACF;QACD;YACE,IAAI,EAAE,WAAW;YACjB,QAAQ,EAAE;gBACR;oBACE,SAAS,EAAE,4CAA4C;oBACvD,QAAQ,EAAE,MAAM;iBACjB;gBACD;oBACE,SAAS,EAAE,4CAA4C;oBACvD,QAAQ,EAAE,MAAM;iBACjB;aACF;YACD,MAAM,EAAE;gBACN;oBACE,aAAa,EAAE,4CAA4C;oBAC3D,UAAU,EAAE,4CAA4C;oBACxD,QAAQ,EAAE,4CAA4C;oBACtD,QAAQ,EAAE,4CAA4C;oBACtD,UAAU,EAAE,SAAS;oBACrB,YAAY,EAAE,oEAAoE;iBACnF;aACF;YACD,UAAU,EAAE;gBACV,kBAAkB,EAAE,CAAC;gBACrB,MAAM,EAAE;oBACN;wBACE,aAAa,EAAE,4CAA4C;wBAC3D,aAAa,EAAE,CAAC;qBACjB;iBACF;aACF;SACF;QACD;YACE,IAAI,EAAE,WAAW;YACjB,QAAQ,EAAE;gBACR;oBACE,SAAS,EAAE,4CAA4C;oBACvD,QAAQ,EAAE,MAAM;iBACjB;gBACD;oBACE,SAAS,EAAE,4CAA4C;oBACvD,QAAQ,EAAE,MAAM;iBACjB;aACF;YACD,MAAM,EAAE;gBACN;oBACE,aAAa,EAAE,4CAA4C;oBAC3D,UAAU,EAAE,4CAA4C;oBACxD,QAAQ,EAAE,4CAA4C;oBACtD,QAAQ,EAAE,4CAA4C;oBACtD,UAAU,EAAE,MAAM;iBACnB;gBACD;oBACE,aAAa,EAAE,4CAA4C;oBAC3D,UAAU,EAAE,4CAA4C;oBACxD,QAAQ,EAAE,4CAA4C;oBACtD,QAAQ,EAAE,4CAA4C;oBACtD,UAAU,EAAE,SAAS;oBACrB,YAAY,EAAE,oEAAoE;iBACnF;aACF;YACD,UAAU,EAAE;gBACV,kBAAkB,EAAE,KAAK;gBACzB,MAAM,EAAE;oBACN;wBACE,aAAa,EAAE,4CAA4C;wBAC3D,aAAa,EAAE,GAAG;qBACnB;oBACD;wBACE,aAAa,EAAE,4CAA4C;wBAC3D,aAAa,EAAE,CAAC;qBACjB;iBACF;aACF;SACF;KACF;CACF,CAAA;AAED;;;;GAIG;AACH,SAAgB,eAAe,CAAC,OAAe;IAC7C,OAAO,oBAAY,CAAC,OAAO,CAAC,IAAI,EAAE,CAAA;AACpC,CAAC"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import type { Token } from '../core/types';
|
|
2
|
+
/**
|
|
3
|
+
* Enum of all token symbols across all supported chains
|
|
4
|
+
*/
|
|
5
|
+
export declare enum TokenSymbol {
|
|
6
|
+
AUDm = "AUDm",
|
|
7
|
+
BRLm = "BRLm",
|
|
8
|
+
CADm = "CADm",
|
|
9
|
+
CELO = "CELO",
|
|
10
|
+
CHFm = "CHFm",
|
|
11
|
+
COPm = "COPm",
|
|
12
|
+
EURm = "EURm",
|
|
13
|
+
GBPm = "GBPm",
|
|
14
|
+
GHSm = "GHSm",
|
|
15
|
+
JPYm = "JPYm",
|
|
16
|
+
KESm = "KESm",
|
|
17
|
+
NGNm = "NGNm",
|
|
18
|
+
PHPm = "PHPm",
|
|
19
|
+
USDC = "USDC",
|
|
20
|
+
USDm = "USDm",
|
|
21
|
+
USD_ = "USD\u20AE",
|
|
22
|
+
XOFm = "XOFm",
|
|
23
|
+
ZARm = "ZARm",
|
|
24
|
+
axlEUROC = "axlEUROC",
|
|
25
|
+
axlUSDC = "axlUSDC"
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Cached tokens indexed by chain ID
|
|
29
|
+
*/
|
|
30
|
+
export declare const cachedTokens: Record<number, readonly Token[]>;
|
|
31
|
+
/**
|
|
32
|
+
* Mapping of token addresses by chain ID and token symbol
|
|
33
|
+
* Useful for quickly looking up a token address by its symbol on a specific chain
|
|
34
|
+
*/
|
|
35
|
+
export declare const TOKEN_ADDRESSES_BY_CHAIN: {
|
|
36
|
+
[chainId: number]: {
|
|
37
|
+
[tokenSymbol in TokenSymbol]?: string;
|
|
38
|
+
};
|
|
39
|
+
};
|
|
40
|
+
/**
|
|
41
|
+
* Get cached tokens for a specific chain
|
|
42
|
+
* @param chainId - The chain ID
|
|
43
|
+
* @returns The cached tokens array, or empty array if not available
|
|
44
|
+
*/
|
|
45
|
+
export declare function getCachedTokens(chainId: number): readonly Token[];
|
|
46
|
+
/**
|
|
47
|
+
* Get cached tokens synchronously for a specific chain
|
|
48
|
+
* @param chainId - The chain ID to get tokens for
|
|
49
|
+
* @returns The cached tokens array
|
|
50
|
+
* @throws Error if tokens are not available for the chain
|
|
51
|
+
*/
|
|
52
|
+
export declare function getCachedTokensSync(chainId: number): readonly Token[];
|
|
53
|
+
/**
|
|
54
|
+
* Get token address by chain ID and symbol
|
|
55
|
+
* @param chainId - The chain ID
|
|
56
|
+
* @param symbol - The token symbol
|
|
57
|
+
* @returns The token address or undefined if not found
|
|
58
|
+
*/
|
|
59
|
+
export declare function getTokenAddress(chainId: number, symbol: TokenSymbol): string | undefined;
|
|
60
|
+
/**
|
|
61
|
+
* Find a token by its symbol on a specific chain
|
|
62
|
+
* @param chainId - The chain ID
|
|
63
|
+
* @param symbol - The token symbol
|
|
64
|
+
* @returns The token object or undefined if not found
|
|
65
|
+
*/
|
|
66
|
+
export declare function findTokenBySymbol(chainId: number, symbol: TokenSymbol): Token | undefined;
|
|
67
|
+
//# sourceMappingURL=tokens.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tokens.d.ts","sourceRoot":"","sources":["../../src/cache/tokens.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,eAAe,CAAA;AAE1C;;GAEG;AACH,oBAAY,WAAW;IACrB,IAAI,SAAS;IACb,IAAI,SAAS;IACb,IAAI,SAAS;IACb,IAAI,SAAS;IACb,IAAI,SAAS;IACb,IAAI,SAAS;IACb,IAAI,SAAS;IACb,IAAI,SAAS;IACb,IAAI,SAAS;IACb,IAAI,SAAS;IACb,IAAI,SAAS;IACb,IAAI,SAAS;IACb,IAAI,SAAS;IACb,IAAI,SAAS;IACb,IAAI,SAAS;IACb,IAAI,cAAS;IACb,IAAI,SAAS;IACb,IAAI,SAAS;IACb,QAAQ,aAAa;IACrB,OAAO,YAAY;CACpB;AAED;;GAEG;AACH,eAAO,MAAM,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,KAAK,EAAE,CAuPzD,CAAA;AAED;;;GAGG;AACH,eAAO,MAAM,wBAAwB,EAAE;IACrC,CAAC,OAAO,EAAE,MAAM,GAAG;SAAG,WAAW,IAAI,WAAW,CAAC,CAAC,EAAE,MAAM;KAAE,CAAA;CA8C7D,CAAA;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,MAAM,GAAG,SAAS,KAAK,EAAE,CAEjE;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,MAAM,GAAG,SAAS,KAAK,EAAE,CAMrE;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAC7B,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,WAAW,GAClB,MAAM,GAAG,SAAS,CAEpB;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAC/B,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,WAAW,GAClB,KAAK,GAAG,SAAS,CAInB"}
|