A project showcasing how to get started with 0x.js
Branch: master
Clone or download
Latest commit 8cf7877 Feb 7, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.circleci Add circleci Dec 13, 2018
src Update to latest bignumber API Feb 8, 2019
.gitignore Split constants into configs and constants, clean up package.json Aug 28, 2018
.npmignore initial setup Oct 25, 2017
.prettierignore Add prettier and tslint and fix styling issues Feb 10, 2018
.prettierrc Add prettier and tslint and fix styling issues Feb 10, 2018
LICENSE 0x v2 Aug 28, 2018
README.md
package.json Update to latest bignumber API Feb 8, 2019
tsconfig.json 0x v2 Aug 28, 2018
tslint.json feat: Update packages (0x.js to 2.0.0) Oct 22, 2018
yarn.lock Update to latest bignumber API Feb 8, 2019

README.md

0x Starter Project

CircleCI

cli

This project will take you through a number of scenarios using the 0x v2 protocol. The previous v1 starter project has been moved to the 'v1' branch.

Scenarios

This repository contains a bunch of scenarios that you can run from the command-line:

  • Fill order (ERC20)
  • Fill order Fees
  • Fill order (ERC721)
  • Cancel orders up to
  • Match orders
  • Execute transaction
  • Forwarder buy orders (ERC20)
  • Forwarder buy orders (ERC721)
  • Standard Relayer API fill order example

Getting Started

By default this project uses the 0x development mnemonic running against Ganache. This project can be configured to use a different mnenonic and also run against Kovan testnet.

You may choose to update the mnemonic in src/configs.ts or use the one provided (note if many people use this mnemonic on Kovan then the funds may be drained). When changing the mnemonic ensure that the account has available funds (ETH and ZRX) on the respective network. You can request ZRX and ETH from the 0x Faucet located in 0x Portal.

Install dependencies:

yarn install

Build this package:

yarn build

Download the Ganache snapshot and load it on to a Ganache node:

yarn download_snapshot
yarn ganache-cli

Run a scenario in another terminal:

yarn scenario:fill_order_erc20

To run all scenarios:

yarn scenario:all

All the scenarios commands can be found in the package.json's scripts section and begin with scenario:.

Switching to Kovan

To switch between Kovan/ganache, change the last line in src/configs.ts and re-build. Ganache is enabled by default.

For Ganache:

export const NETWORK_CONFIGS = GANACHE_CONFIGS;

For Kovan:

export const NETWORK_CONFIGS = KOVAN_CONFIGS;

Fill Order SRA Example

To run the Fill Order SRA Example you must first start up a server in another terminal:

yarn fake_sra_server

Then in another terminal run:

yarn scenario:fill_order_sra

Windows Development Setup

If you're setting up Node.js for the first time on Windows, you may find the following StackOverflow guide useful. There are a few build tools required for Node.js on Windows which are not installed by default (such as Python). Please follow that guide before running through the tutorials.