Skip to content

mycelium-ethereum/staking-launchpad-api

Repository files navigation

Nest Logo

A progressive Node.js framework for building efficient and scalable server-side applications.

NPM Version Package License NPM Downloads CircleCI Coverage Discord Backers on Open Collective Sponsors on Open Collective Donate us Support us Follow us on Twitter

Description

A small API service to improve performance and loading times of the staking-launchpad. Initially the launchpad made a number of queries to beaconcha.in API using a subscribed key. This service aims to improve performance by caching results of the numerous queries. Caches results on a per validator basis. eg if the user queries for /validators/performance/555555 and then later validators/performance/555555,555556 the API returns fresh results for 555556 (assuming it hasnt been queried before) and cached results for 555555. The cache lifetime is 1 hour.

TODO

  • Cache beaconchain results to improve API key usage and performance (this does not perform well if the user is querying an unknown list of validators for the first time)
  • [] Continuously sync beaconchain results with some known list of PierTwo validators to greatly increase performance for a very large set of known validators

Installation

$ npm install

Running the app

# development
$ npm run start

# watch mode
$ npm run start:dev

# production mode
$ npm run start:prod

Test

# unit tests
$ npm run test

# e2e tests
$ npm run test:e2e

# test coverage
$ npm run test:cov

Documentation

yarn start Swagger docs at /api

Deployment

Deployment is done manually through the GCP instance. Ensure you are on master.

  1. git pull
  2. docker build . -t staking-launchpad-api
  3. docker run staking-launchpad-api