Sign inSign up

sergeyitsib/0x-swap-api

By sergeyitsib

•Updated over 4 years ago

Image
0

1.1K

sergeyitsib/0x-swap-api repository overview

⁠0x Swap service

This API faciliates consuming the best-priced liquidity from the greater DEX ecosystem, including tens of on-chain and off-chain liquidity networks. We use smart order routing to split up your transaction across decentralized exchange networks to be filled with the lowest slippage possible while minimizing transaction costs.

⁠Getting started

⁠Pre-requirements
⁠Developing

To get a local development version of 0x-swap-api running:

  1. Clone the repo.

  2. Create an .env file and copy the content from the .env_example file. 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.

Environment VariableDefaultDescription
LOG_LEVELINFONOTHING, ERROR, WARN, INFO, DEBUG.
LOGGER_INCLUDE_TIMESTAMPtrueShow milliseconds timestamp in log output.
CHAIN_ID42The chain id you'd like your API to run on (e.g: 1 -> mainnet, 42 -> Kovan, 3 -> Ropsten, 1337 -> Ganache). Defaults to 42 in the API, but required for docker-compose up.
ETHEREUM_RPC_URLRequired. No default.The URL used to issue JSON RPC requests.
ETHEREUM_RPC_KEEP_ALIVE_TIMEOUT5000Timeout waiting for an RPC response, in milliseconds
EXCHANGE_PROXY_ADDRESSBy default used address from @0x/contract-addresses by chain idCustom ZeroEx proxy contract address.
HTTP_PORT3000Server port
HEALTH_CHECK_HTTP_PORTBy default equal of HTTP_PORT valueServer Status Check port
HTTP_KEEP_ALIVE_TIMEOUT5000Number of milliseconds of inactivity the servers waits for additional incoming data after it finished writing last response before a socket will be destroyed. Ref: https://nodejs.org/api/http.html#http_server_keepalivetimeout⁠
HTTP_HEADERS_TIMEOUT6000Limit the amount of time the parser will wait to receive the complete HTTP headers. NOTE: This value HAS to be higher than HTTP_KEEP_ALIVE_TIMEOUT. Ref: https://nodejs.org/api/http.html#http_server_headerstimeout⁠
ETH_GAS_STATION_API_URLhttps://ethgasstation.api.0x.org/api/ethgasAPI.jsonEth Gas Station URL.
  1. Install the dependencies:

    npm install
    
  2. Build the project:

    npm run build
    
  3. Start the API

    docker-compose up
    

    For development:

    npm run dev
    

    or

     npm run dev:watch
    
  4. Enjoy yourself

Tag summary

Content type

Image

Digest

Size

410.1 MB

Last updated

over 4 years ago

docker pull sergeyitsib/0x-swap-api