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
Property | Type | Modifier | Description |
---|---|---|---|
pools | Pool[] | 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 | Token[] | 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
Property | Type | Description |
---|---|---|
_midPrice | Price<TInput, TOutput> | The mid price of the route. |
Constructor
Parameters
Params | Type | Description |
---|---|---|
pools | Pool[] | 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
public
get
Gets the chain ID for the chain on which the trade is taking place.
Returns
Type | Description |
---|---|
number | The chainId for the route. |
midPrice() - public
get
public
get
Returns the mid price of the route.
Returns
Type | Description |
---|---|
Price<TInput, TOutput> | The mid price of the route. |
Last updated