import type Unit from '../index.js'; import deposit, { type DepositParams } from './deposit.js'; import getSwapInfo, { type GetSwapInfoParams } from './getSwapInfo.js'; import { generateSwapCalldataWithUnit, type GenerateSwapCalldataWithUnitParams } from './generateSwapCalldata.js'; import withdraw, { type WithdrawParams } from './withdraw.js'; import type { SwapLimitParams } from './swapLimit.js'; import swapLimit from './swapLimit.js'; import swapMarket from './swapMarket.js'; import type { SwapMarketParams } from './swapMarket.js'; type PureDepositParams = Omit type PureWithdrawParams = Omit type PureGetSwapMarketInfoParams = Omit type PureGenerateSwapCalldataParams = Omit type PureSwapLimitParams = Omit type PureSwapMarketParams = Omit export default class Exchange { private readonly unit: Unit; constructor(unit: Unit) { this.unit = unit; } public getSwapInfo(params: PureGetSwapMarketInfoParams) { return getSwapInfo({ aggregator: this.unit.aggregator, blockchainService: this.unit.blockchainService, ...params, }); } public deposit(params: PureDepositParams) { return deposit({ ...params, unit: this.unit, }); } public withdraw(params: PureWithdrawParams) { return withdraw({ ...params, unit: this.unit, }); } public generateSwapCalldata(params: PureGenerateSwapCalldataParams) { return generateSwapCalldataWithUnit({ ...params, unit: this.unit, }) } public swapLimit(params: PureSwapLimitParams) { return swapLimit({ ...params, unit: this.unit, }); } public swapMarket(params: PureSwapMarketParams) { return swapMarket({ ...params, unit: this.unit, }); } }