Giter Club home page Giter Club logo

smartdex-trade-backend's Introduction

This repository is forked from https://github.com/0xProject/0x-launch-kit-frontend

Table of contents

Introduction

Autonio Smartdex backend runs as a forked version of 0x relayer

Getting started

Pre-requirements

To develop the project, follow the following instructions:

  1. Fork this repository

  2. Clone your fork of this repository

  3. Open the config.ts/config.js file and edit the whitelisted tokens

  4. Open the .env file and edit the following fields. Defaults are defined in config.ts/config.js. The bash environment takes precedence over the .env file. If you run source .env, changes to the .env file will have no effect until you unset the colliding variables.

    • NETWORK_ID -- the network you'd like your relayer to run on
    • FEE_RECIPIENT -- The Ethereum address which should be specified as the fee recipient in orders your relayer accepts. Defaults to a fake address that helps the 0x core team use anonymous, already public data to understand Launch Kit developer usage.
    • MAKER_FEE_ZRX_UNIT_AMOUNT -- The flat maker fee you'd like to receive for filled orders hosted by you
    • TAKER_FEE_ZRX_UNIT_AMOUNT -- The flat taker fee you'd like to receive for filled orders hosted by you.
    • RPC_URL -- Update with your node url. NOTE: Kovan doesn't work on INFURA with the current version of the OrderWatcher

Instructions for using Launch Kit with Ganache

  1. Make sure you have Yarn installed.

  2. Install the dependencies:

    yarn
  3. Build the project [This step is for Typescript users only]

    yarn build:ts

    or build & watch:

    yarn watch:ts
  4. Start the backend

    yarn start:ts

    OR

    yarn start:js

Client for your backend APIs

To quickly check if your backend (relayer) is up-and-running, send it this CURL request from the command-line:

curl http://localhost:3000/v2/orders

If everything is working as expected, you should see a similar response:

{
    "total": 0,
    "page": 0,
    "perPage": 20,
    "records": []
}

Since no orders have been added to your backend yet, the records array is empty.

Commands

Typescript project commands:

  • yarn build:ts - Build the code
  • yarn lint:ts - Lint the code
  • yarn start:ts - Starts the backend
  • yarn watch:ts - Watch the source code and rebuild on change
  • yarn prettier:ts - Auto-format the code

Javascript project commands:

  • yarn start:js - Start the backend
  • yarn prettier:js - Auto-format the code

Database

This project uses TypeORM. It makes it easier for anyone to switch out the backing database used by this project. By default, this project uses an SQLite database.

Because we want to support both Javascript and Typescript codebases, we don't use TypeORM's decorators (since they don't transpile nicely into readable Javascript). TypeORM shines with decorators however, so you might want to use them if you're going to be working in Typescript.

Deployment

The project also comes with a docker container, to build project using docker:

docker build -t 0x-launch-kit .

You can check that the image was built by running:

docker images

And launch it with

docker run -p 3000:3000 -d 0x-launch-kit

Check that it's working by running

curl http://localhost:3000/v2/asset_pairs

smartdex-trade-backend's People

Contributors

ikramansari77 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.