WhiteSwap
  • About WhiteSwap
  • Protocol Overview
    • How WhiteSwap Works
    • Eсosystem Participants
    • Smart Contracts
    • Glossary
  • Core Concepts
    • Swaps
    • Pools
    • Flash Swaps
    • Oracles
    • Farming
    • WSD Staking
  • Advanced Topics
    • Fees
    • Pricing
    • Understanding Returns
    • Security
    • Research
  • Governance
    • Overview
    • Process
    • Glossary
  • Governance Token
    • Introducing WSD
    • Allocation & Vesting
    • Community Treasury
  • Developer Guides
    • Token Listing
    • Javascript SDK
      • SDK Quick Start
      • Fetching Data
      • Pricing
      • Trading
      • Pair Addresses
  • Reference
    • API
      • API Overview
      • Entities
      • Queries
    • SDK
      • Getting Started
      • Token
      • Pair
      • Route
      • Trade
      • Fractions
      • Fetcher
      • Other Exports
    • Smart Contracts
Powered by GitBook
On this page
  • Example
  • Properties
  • pairs
  • path
  • input
  • output
  • midPrice

Was this helpful?

  1. Reference
  2. SDK

Route

constructor(pairs: Pair[], input: Token)

The Route entity represents one or more ordered WhiteSwap pairs with a fully specified path from input token to output token.

Example

import { ChainId, Token, TokenAmount, Pair, Route } from '@whiteswap/sdk'

const HOT = new Token(ChainId.MAINNET, '0xc0FFee0000000000000000000000000000000000', 18, 'HOT', 'Caffeine')
const NOT = new Token(ChainId.MAINNET, '0xDeCAf00000000000000000000000000000000000', 18, 'NOT', 'Caffeine')
const HOT_NOT = new Pair(new TokenAmount(HOT, '2000000000000000000'), new TokenAmount(NOT, '1000000000000000000'))

const route = new Route([HOT_NOT], NOT)

Properties

pairs

pairs: Pair[]

The ordered pairs that the route is comprised of.

path

path: Token[]

The full path from input token to output token.

input

input: string

The input token.

output

output: string

The output token.

midPrice

midPrice: Price

Returns the current mid price along the route.

PreviousPairNextTrade

Last updated 4 years ago

Was this helpful?