Collection of serverless API to enable public access to data surrounding the Badger protocol.
To get started, install the following dependencies:
- Node
- Java
Note: If you are running on an M1 Mac you will have to install the x86 version of Java and run the following commands in Rosetta
Setup project dependencies:
yarn install --frozen-lockfile
npm install -g serverless
sls dynamodb install
In case if u don't have .aws
credentials yet
sls config credentials --provider aws \
--key <aws_access_key_id>
--secret <aws_secret_access_key>
Contact Tritium | BadgerDAO#4816 for AWS access if required. After getting keys, complite the MFA section.
Badger accepts only verified commits, this can be done by signing them with gpg keys. For more info, proceed to github gpg doc.
Variables are handled by a combination of dot env files, and the serverless manifest. An example file is available at .env.example.
Before running the API, make sure to create a local .env
file:
cp .env.example .env
Update the RPC values and Graph API key with data from the DevOps team or your own endpoints.
Contact jintao#0713 for RPC or TheGraph access if required.
yarn dev
Note: You cannot view Swagger documentation via Serverless
npx ts-node src/index.ts
Express is not the recommended development environment as implmentations will execute in lambda. Serverless offline framework is the closest to production execution environment.
The API supports local (offline) testing of nearly all endpoints. Certain endpoints which require access to AWS resources may not work appropriately without AWS credentials. The databased used for local testing DynamoDB - a local version with exact table copies of production. These tables are seeded with data located in the seed folder.
Note: Running only sls offline will not start or seed dynamo. Run sls offline start, or yarn dev instead.