Skip to main content

Getting Started

The Unicorn SDK is meant to simplify every aspect of integrating Unicorn into your project. It's written in TypeScript, has a robust test suite, uses bignumber.js for math, and includes an optional data-fetching module which relies on ethers.js.

The SDK was built to be extremely easy to use, but also feature-rich. It offers various levels of abstraction that make it suitable for use nearly anywhere, from hackathon projects to production applications.

Overview​

The SDK is divided into several modular components that perform tightly scoped tasks:

  • Data - Fetches Unicorn data from the blockchain
  • Computation - Computes market- and trade-specific statistics using blockchain data
  • Format - Formats data for display
  • Orchestration - Offers named abstraction functions that seamlessly combine lower-level data- and computation-related functions
  • Transact - Prepares computed trades for execution against Unicorn smart contracts
  • Constants - Exports various helpful constants for use throughout the SDK

Additionally, it exports a number of custom types:

  • Types - Exports all types used by the SDK

Installation​

To start using the SDK, simply install it into your project...

yarn add @unicorn/sdk

...import some functions...

import { ... } from '@unicorn/sdk'

...and dive into the rest of the documentation to learn more!