This is a workshop used to build an end-to-end DEMO that uses Chainlink Adapters from Chainlink Hackathon Spring 2022. The workshop followed to complete this repo is this one. The used repo that contains some implementations is this one and the cloned repo with the template used is this one.
Chainlink External Adapters allows to connect to APIs that are unreachable via de standard HTTP task. That means that you can connect any API that is avaliable on the Internet to your Smart Contract by using Chainlink nodes through Chainlink external adapters.
- They way it work is like the one in the following figure:
- The API we are going to ask for information is this one.
- Create API KEY.
- Clone template repo.
git clone https://github.com/thodges-gh/CL-EA-NodeJS-Template halo-ea
- Execute:
cd halo-ea
yarn
- Create
.env
file and paste APY_KEY - Install dotenv:
npm install dotenv
- Modify
index.js
createRequest() function to call to our API. - Setup authentification (function headers()).
NOTICE: index.js
should look like the one included in this repo. -> Feel free to make changes in order to adapt it to your API request
- Execute:
yarn start
- Open new terminal and execute:
curl -X POST -H "content type: applications/json" "http://localhost:8080/" --data '{ "id": 1, "data": {{"playerId": "Frosty"} }'
You will get the response form the API request! ✅
- Chalink External Adapters: Chainlink external adapters documentation.
- HTTP task: standard HTTP task documentation.
- HALODOTAPI: Used API in the example.
- Extneral-adapters-js: repo with external adapters implementations.
- Nodejs Template: Used Nodjs Template example.