import { JsonRpcProvider } from "@ethersproject/providers"; import { ChainId, TradeType } from "@onyxcoindev/sdk-core-test"; import { SwapOptions, SwapRoute } from "../routers"; import { CurrencyAmount } from "../util"; import { ProviderConfig } from "./provider"; export type SimulationResult = { transaction: { hash: string; gas_used: number; gas: number; error_message: string; }; simulation: { state_overrides: Record; }; }; export declare enum SimulationStatus { NotSupported = 0, Failed = 1, Succeeded = 2, InsufficientBalance = 3, NotApproved = 4 } /** * Provider for dry running transactions. * * @export * @class Simulator */ export declare abstract class Simulator { protected chainId: ChainId; protected provider: JsonRpcProvider; /** * Returns a new SwapRoute with simulated gas estimates * @returns SwapRoute */ constructor(provider: JsonRpcProvider, chainId: ChainId); simulate(fromAddress: string, swapOptions: SwapOptions, swapRoute: SwapRoute, amount: CurrencyAmount, quote: CurrencyAmount, providerConfig?: ProviderConfig): Promise; protected abstract simulateTransaction(fromAddress: string, swapOptions: SwapOptions, swapRoute: SwapRoute, providerConfig?: ProviderConfig): Promise; protected userHasSufficientBalance(fromAddress: string, tradeType: TradeType, amount: CurrencyAmount, quote: CurrencyAmount): Promise; protected checkTokenApproved(fromAddress: string, inputAmount: CurrencyAmount, swapOptions: SwapOptions, provider: JsonRpcProvider): Promise; }