Coder Social home page Coder Social logo

kadirc / hummingbot-gateway Goto Github PK

View Code? Open in Web Editor NEW

This project forked from hummingbot/gateway

0.0 1.0 0.0 1.37 MB

Middleware that standardizes DEX API endpoints on different blockchain networks

Shell 1.97% JavaScript 0.21% TypeScript 97.72% Dockerfile 0.09%

hummingbot-gateway's Introduction

Hummingbot

Hummingbot Gateway

Hummingbot Gateway is a REST API that exposes connections to various blockchains (wallet, node & chain interaction) and decentralized exchanges (pricing, trading & liquidity provision). It is written in Typescript and takes advantage of existing blockchain and DEX SDKs. The advantage of using gateway is it provideds a programming language agnostic approach to interacting with blockchains and DEXs.

Gateway may be used alongside the main Hummingbot client to enable trading on DEXs, or as a standalone module by external developers.

Install and run locally

# Install dependencies
yarn

# Complile Typescript into JS
$ yarn build

# Generate the config files and edit as needed, especially server.yml
$ setup/generate_conf.sh

# Start the server using the passphrase you used to generate the certs in Hummingbot
$ yarn start --passphrase=<passphrase>

Documentation

See the official Gateway docs.

The API is documented using Swagger. When Gateway is started, it also generates Swagger API docs at: https://localhost:8080

Contributing

There are a number of ways to contribute to gateway.

Configuration

  • Edit certs_path in conf/server.yml and enter the absolute path to the folder where Hummingbot stored the certificates it created with gateway generate-certs. You can also edit this config inside the Hummingbot client by running the command: gateway config server.certs_path.

  • If you want to turn off https, set unsafeDevModeWithHTTP to true in conf/server.yml.

  • If you want Gateway to log to standard out, set logToStdOut to true in conf/server.yml.

  • The format of configuration files are dictated by src/services/config-manager-v2.ts and the corresponding schema files in src/services/schema.

Architecture

Here are some files we recommend you look at in order to get familiar with the Gateway codebase:

Testing

For a pull request merged into the codebase, it has to pass unit test coverage requirements. Take a look at Workflow for more details.

Unit tests

Read this document for more details about how to write unit test in gateway: How we write unit tests for gateway.

Run all unit tests.

yarn test:unit

Run an individual test folder or file

yarn jest test/<folder>/<file>

Manual tests

We have found it is useful to test individual endpoints with curl commands. We have a collection of prepared curl calls. POST bodies are stored in JSON files. Take a look at the curl calls for gateway. Note that some environment variables are expected.

Linting

This repo uses eslint and prettier. When you run git commit it will trigger the pre-commit hook. This will run eslint on the src and test directories.

You can lint before committing with:

yarn run lint

You can run the prettifier before committing with:

yarn run prettier

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.