Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface WhirlpoolRouter

Convienience class to find routes through a set of Whirlpools and execute a swap across them. The router only supports up to 2-hop trades between pools and does not support arbitrage trades between the same token.

Hierarchy

  • WhirlpoolRouter

Index

Methods

  • Finds all possible routes for a trade and select the best route that is executable under the current execution environment.

    Parameters

    Returns Promise<null | ExecutableRoute>

    The best ExecutableRoute that can be used to execute a swap. If no executable route is found, null is returned.

  • Construct a {@link TransactionBuilder} to help execute a trade route.

    Parameters

    • trade: TradeRoute

      The trade route to execute.

    • slippage: Percentage

      The slippage tolerance for the trade.

    • resolvedAtas: null | AtaAccountInfo[]

      The ATA accounts that the executing wallet owns / needed by the execution. If not provided, the router will attempt to resolve them.

    Returns Promise<TransactionBuilder>

    A {@link TransactionBuilder}that can be used to execute the trade. If provvided from ExecutableRoute, plug the {@link AddressLookupTableAccount}s into builder to lower the transaction size.

Generated using TypeDoc