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
  • Installation
  • Usage
  • ES6 (import)
  • CommonJS (require)
  • Reference

Was this helpful?

  1. Developer Guides
  2. Javascript SDK

SDK Quick Start

PreviousJavascript SDKNextFetching Data

Last updated 4 years ago

Was this helpful?

The WhiteSwap SDK exists to help developers build on top of WhiteSwap. It’s designed to run in any environment that can execute JavaScript (think websites, node scripts, etc.). While simple enough to use in a hackathon project, it’s also robust enough to power production applications.

Installation

The easiest way to consume the SDK is via npm. To install it in your project, simply run yarn add @whiteswap/sdk (or npm install @whiteswap/sdk).

Usage

To run code from the SDK in your application, use an import or require statement, depending on which your environment supports. Note that the guides following this page will use ES6 syntax.

ES6 (import)

import { ChainId } from '@whiteswap/sdk'
console.log(`The chainId of mainnet is ${ChainId.MAINNET}.`)

CommonJS (require)

const WHITESWAP = require('@whiteswap/sdk')
console.log(`The chainId of mainnet is ${WHITESWAP.ChainId.MAINNET}.`)

Reference

Comprehensive reference material for the SDK is available .

here