Welcome to alkemi-earn-api πŸ‘‹
​
​
​​
​
​
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

1
npm install
Copied!

Setting Environment Variables

Create a new .env file based off the example. Make sure there are no spaces for the values
Then run
1
export $(grep -v '^#' .env | xargs)
Copied!

Usage

Production

1
npm run start
Copied!

Development

1
npm run start:dev
Copied!

Run tests

1
npm run test
Copied!

Coverage

1
npm run coverage
Copied!
Runs coverage script and stores data under ./coverage, open ./coverage/icov-report/index.html to see the coverage.
For windows:
1
npm run coverageWIN
Copied!

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:

1
# name of the network connecting to
2
NETWORK = rinkeby
3
​
4
# HOST SETTINGS
5
HOST = example.api.alkemi.network
6
PORT = 3030
7
PROTOCOL = http
8
​
9
# mongo db connection string
10
MONGODB_URL = mongodb://localhost:27017/rinkeby
11
​
12
# Main Protocol Smart Contract for tx and event monitoring
13
CONTRACT_ADDRESS = 0x0
14
​
15
# Address of the Protocol Price Oracle
16
ORACLE_ADDRESS = 0x0
17
​
18
# Project Infura ID + Secret
19
INFURA_WS = wss://rinkeby.infura.io/ws/v3/
20
INFURA_URL = https://rinkeby.infura.io/v3/
21
INFURA_ID = theProjectID
22
INFURA_SECRET = theProjectSecret
23
​
24
#Etherscan settings
25
ETHERSCAN_URL = https://api-rinkeby.etherscan.io/api
26
ETHERSCAN_KEY = theEtherscanKey
27
​
28
# Slack Bot Settings
29
SLACK_CHANNEL_ID=slackID
30
SLACK_TOKEN_ID=slackToken
31
# Sentry DSN
32
SENTRY_DSN=sentryLink
33
​
34
# Auth Secret
35
AUTH_SECRET= superauthsecret
36
​
37
# Disables fetching data on server start and on a regular interval (see where it's used)
38
DISABLE_FETCHING_DATA = true
Copied!
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 modified 8mo ago