Skip to content
Javascript API client for Switcheo Exchange https://docs.switcheo.network
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.

README.md

Switcheo JS

Switcheo JS is a Javascript client library for interfacing with the Switcheo Exchange API.

As the library is written in TypeScript, TypeScript annotations are available by default.

Usage

Getting started

Import the Client object to call any available Switcheo API endpoint:

import { Client, Network } from 'switcheo-js'

const switcheo: Client = new Client({ net: Network.TestNet })

const pairs: Pairs = switcheo.listPairs()

An alternative way of accessing the functions is through the lower level api and Config objects:

import { Account, api, Config, Network } from 'switcheo-js'

const config: Config = new Config({ net: Network.TestNet, source: 'my-api' })
const params: CreateOrderParams = { ... }
const account: Account = new Account(...)

const order: Order = await api.orders.make(config, account, params)

Development

  • yarn build: "Clean and rebuild the project",
  • yarn lint: "Lint the project",
  • yarn test: "Lint and unit test the project",
  • yarn reset: "Delete all untracked files and reset the repo to the last commit",
  • yarn prepare-release: "One-step: clean, build, test, publish docs, and prep a release"

NOTE: "prepare": "yarn run build", is needed for projects targeting this lib as a git repo

You can’t perform that action at this time.