Clone this repo and change "ExternalAdapterProject" below to the name of your project
git clone https://github.com/vatsal095/Spectral_Adapter.git
Enter into the newly-created directory
cd Spectral_Adapter
You can remove the existing git history by running:
rm -rf .git
See Install Locally for a quickstart
{
"addresses": [
"0x71B274ddd46a15f5324a4B3F40543af3869DE8B0",
"0x97b90FBc8904F861F76CB06BFa0A465b72C5E662",
"0xB5600a26257786A173852c176cb8e286B637af80",
"0x6801b5ae5781c93Be0F7d223DB72B4E6e56c8Bf6"
],
"job_type": "calculate"
}
{
"message": "job_created",
"job_id": "2ed72dd9-bc03-49c3-a189-82885b4b9216"
}
Install dependencies:
yarn
Copy the .env.example
file into your repository as .env
and modify as necessary.
Variable | Description |
---|---|
API_KEY | Spectral Proxy API Key |
Run the local tests:
yarn test
Natively run the application (defaults to port 8080):
API_KEY={{insert API key}} docker-compose up
curl -H "Content-Type: application/json" \
--request POST \
--data '{"jobID": "1", "data": {"tokenIdInt": "42747786677057537933777365201756780713494970703527385451017290874280990481333", "tickSet": "1"}}' \
http://localhost:3000
(Optional) Compile the code
yarn build
Run the code
yarn start
Run the code with ts-node.
This is not the way the code is run in production, but is convenient for local development to avoid having to compile changes.
yarn dev
curl -X POST -H "content-type:application/json" "http://18.191.166.107/api/submit/" --data '{"addresses": ["0x71B274ddd46a15f5324a4B3F40543af3869DE8B0","0x97b90FBc8904F861F76CB06BFa0A465b72C5E662","0xB5600a26257786A173852c176cb8e286B637af80","0x6801b5ae5781c93Be0F7d223DB72B4E6e56c8Bf6"],"job_type": "calculate"}'
{"message":"job_created","job_id":"48b5c100-5e59-40e0-87cc-315b775f9bee"}
curl -X GET "http://18.191.166.107/api/resolve/<job_id>/"