Welcome to alkemi-earn-api 👋

Version Documentation Twitter: AlkemiOfficial

A Rest API that provides data for the Alkemi Earn Protocol

Docs

Prerequisites

  • node ^12.9.1

  • npm >= 3.0.0

  • nodemon (https://www.npmjs.com/package/nodemon)

Install

npm install

Setting Environment Variables

Create a new .env file based off the example. Make sure there are no spaces for the values

Then run

export $(grep -v '^#' .env | xargs)

Usage

Production

npm run start

Development

npm run start:dev

Run tests

npm run test

Coverage

npm run coverage

Runs coverage script and stores data under ./coverage, open ./coverage/icov-report/index.html to see the coverage.

For windows:

npm run coverageWIN

Authentication

See: https://docs.feathersjs.com/guides/basics/authentication.html#registering-a-user

.env

To make the API work properly, you need an .env var on the same directly as the index.js file (base of /src)

Example:

# name of the network connecting to
NETWORK = rinkeby

# HOST SETTINGS
HOST = example.api.alkemi.network
PORT = 3030
PROTOCOL = http

# mongo db connection string
MONGODB_URL = mongodb://localhost:27017/rinkeby

# Main Protocol Smart Contract for tx and event monitoring
CONTRACT_ADDRESS = 0x0

# Address of the Protocol Price Oracle
ORACLE_ADDRESS = 0x0

# Project Infura ID + Secret
INFURA_WS = wss://rinkeby.infura.io/ws/v3/
INFURA_URL = https://rinkeby.infura.io/v3/
INFURA_ID = theProjectID
INFURA_SECRET = theProjectSecret

#Etherscan settings
ETHERSCAN_URL = https://api-rinkeby.etherscan.io/api
ETHERSCAN_KEY = theEtherscanKey

# Slack Bot Settings
SLACK_CHANNEL_ID=slackID
SLACK_TOKEN_ID=slackToken
# Sentry DSN
SENTRY_DSN=sentryLink

# Auth Secret
AUTH_SECRET= superauthsecret

# Disables fetching data on server start and on a regular interval (see where it's used)
DISABLE_FETCHING_DATA = true

N.B: HOST (for example: localhost:3030) & PROTOCOL (for example: http) env variables are important to be set properly to have swagger working, especially for local testing (as by default PROTOCOL will be set to https)

Author

👤 Alkemi

🤝 Contributing

Contributions, issues and feature requests are welcome! Feel free to check issues page.

Last updated