Route

Describes a swap route which includes an ordered array of the tokens and pools with the same pair used in the swap.

GitHub File: route.ts

Properties

Public

PropertyTypeModifierDescription

pools

readonly

Array of potential pools with the same pair through which the swap can be routed. Ordered by the route the swap will take.

tokenPath

readonly

Array of tokens through which the swap is routed. Ordered by the swap route whereby first token corresponds to the input token.

input

TInput

readonly

The input token for the swap.

output

TOutput

readonly

The output token for the swap.

Private

PropertyTypeDescription

_midPrice

Price<TInput, TOutput>

The mid price of the route.

Constructor

Parameters

ParamsTypeDescription

pools

Array of potential pools through which the swap can be routed. Ordered by the route the swap will take. The first pool must contain the input token and the last pool must contain the output token.

input

TInput

The input token for the swap.

output

TOutput

The output token for the swap.

Methods

chainId() - public get

Gets the chain ID for the chain on which the trade is taking place.

Returns

TypeDescription

number

The chainId for the route.


midPrice() - public get

Returns the mid price of the route.

Returns

TypeDescription

Price<TInput, TOutput>

The mid price of the route.

Last updated