Skip to content

Spectral-Finance/Spectral_Adapter

 
 

Repository files navigation

Run

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

Input Params

{
  "addresses": [
    "0x71B274ddd46a15f5324a4B3F40543af3869DE8B0",
    "0x97b90FBc8904F861F76CB06BFa0A465b72C5E662",
    "0xB5600a26257786A173852c176cb8e286B637af80",
    "0x6801b5ae5781c93Be0F7d223DB72B4E6e56c8Bf6"
  ],
  "job_type": "calculate"
}

Output

{
  "message": "job_created",
  "job_id": "2ed72dd9-bc03-49c3-a189-82885b4b9216"
}

Install Locally

Install dependencies:

yarn

Environment Variables

Copy the .env.example file into your repository as .env and modify as necessary.

Variable Description
API_KEY Spectral Proxy API Key

Test

Run the local tests:

yarn test

Natively run the application (defaults to port 8080):

Run with Docker

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

Run Locally

(Optional) Compile the code

yarn build

Run the code

yarn start

Local Development

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

Call the external adapter/API server POST

curl -X POST -H "content-type:application/json" "http://18.191.166.107/api/submit/" --data '{"addresses": ["0x71B274ddd46a15f5324a4B3F40543af3869DE8B0","0x97b90FBc8904F861F76CB06BFa0A465b72C5E662","0xB5600a26257786A173852c176cb8e286B637af80","0x6801b5ae5781c93Be0F7d223DB72B4E6e56c8Bf6"],"job_type": "calculate"}'

Output

{"message":"job_created","job_id":"48b5c100-5e59-40e0-87cc-315b775f9bee"}

Call the external adapter for fetching score using GET

curl -X GET "http://18.191.166.107/api/resolve/<job_id>/"

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 89.3%
  • JavaScript 6.1%
  • Dockerfile 4.4%
  • Shell 0.2%