https://github.com/api3dao/beacons-api
An API to power beacons-related frontend services
https://github.com/api3dao/beacons-api
Last synced: about 1 year ago
JSON representation
An API to power beacons-related frontend services
- Host: GitHub
- URL: https://github.com/api3dao/beacons-api
- Owner: api3dao
- License: mit
- Archived: true
- Created: 2022-03-18T13:29:05.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2023-02-04T11:45:09.000Z (over 3 years ago)
- Last Synced: 2025-03-02T16:16:06.344Z (over 1 year ago)
- Language: TypeScript
- Size: 284 KB
- Stars: 3
- Watchers: 5
- Forks: 0
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Beacons API
> A set of Lambda handlers to serve data required by Beacons-related frontends
## Overview
Beacon data feeds ideally require frontend UIs to visualise them for the purposes of marketing and assessment. These UIs
will often have the need to display the last updates associated with a beacon and the current on-chain price, among
other requirements not yet defined.
This repository contains a set of serverless handler functions that provide backing services to these frontends.
## Installation
```shell
yarn install
```
## Deployment
Start by copying the example files and modifying them with real values:
```shell
cp telemetryConfig.example.json telemetryConfig.json
cp serverless.example.yml serverless.yml
```
Test your potential deployment:
The best way to test the Lambdas is to deploy them to your personal AWS account and then call them using the default
URLs generated by AWS after deployment.
You can also test them locally, but this is not the ultimate indicator of success.
Any testing and/or execution of the functions requires access to a suitable database. Refer to
`telemetryConfig.example.json` and `serverless.example.json` for an example of the credentials required to be set to
enable database access.
To deploy to AWS,
[ensure your AWS credentials are accessible](https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-envvars.html)
and then run:
```shell
rm -rf .build .serverless; # Sometimes serverless caches build artifacts that can confound testing
yarn sls deploy
```
To test locally:
```shell
rm -rf .build .serverless; # Sometimes serverless caches build artifacts that can confound testing
yarn sls invoke local --function --data
```
Examples:
```shell
rm -rf .build .serverless && yarn sls invoke local --function last_transactions --data '{ "queryStringParameters": {"beaconId":"0x5237b1d9dbbb7fcfabf646bcad0054abda328cee9d9d1fe2488cbed3a33cd47e", "chainId":"80001"}}'
rm -rf .build .serverless && yarn sls invoke local --function chain_value_data_point --data '{ "queryStringParameters": {"dapiName":"AVAX/USD", "chainId":"80001"}}'
rm -rf .build .serverless && yarn sls invoke local --function coin_value --data '{ "queryStringParameters": {"symbol":"AVAX"}}'
rm -rf .build .serverless && yarn sls invoke local --function volatility --data '{ "queryStringParameters": {"beaconId":"0x8dd297503e6e8b95c979677e9e6aecfee08ee5426bea72adff2d7a797f7bd69d", "chainId":"137"}}'
```