A Chainlink compatible External Adapter that supports a REST API and AWS Lambda Handler.
This adapter interfaces with the CryptoCompare data source.
This is a Gradle project built using OpenJDK 15 with Micronaut.
- Build the JAR:
./gradlew clean build
- Create the Docker image:
docker build -t cl-ea-price-kotlin .
- Get your image ID:
docker images
- Start the Docker container:
docker run -p 7080:7080 <image_id>
- To start the application, run the main class:
Main.kt
- Send requests as follows:
POST: http://localhost:7080
Headers: Content-Type application/json
Body:
{
"id": 123,
"data": {
"from": "ETH",
"to": "CAD"
}
}
Response:
{
"jobRunId": 123,
"data": "{\"CAD\":3325.15}"
}
- Run the tests using:
./gradlew clean build
A cache is enabled by default. The adapter does not support an API key (this may be added in a future release).
- A Caffeine cache is enabled by default.
- It supports the following configuration options in the application.yml:
micronaut.caches.prices.initial-capacity
micronaut.caches.prices.maximum-size
micronaut.caches.prices.maximum-weight
micronaut.caches.prices.expire-after-write
micronaut.caches.prices.expire-after-access
For more information on each property, take a look at the documentation.
- The project uses Logback, which can be configured in:
/src/resources/logback.xml
- To enable DEBUG logs, update:
<root level="info">
To:
<root level="debug">