This external adapter is used to get off-chain marine traffic data using the Datalastic Maritime API.
- The project use case is to get location of vessels for assets tracking of equipment shipments and ports information.
- Another area of interest is a use case for Paramatic Insurance Trigger events of shipments and ports information.
-
Datalastic Maritime API User Agreement – Terms of Service
-
Terms of Usage and License
-
4.1. Subject to your compliance with the Terms of this Agreement, Datalastic grants you a non-exclusive, non-transferable right to access and use the Services. Any sort of information and data acquired by being a Registered User of Datalastic is for internal use only. The User shall use such information and data for his/her use only and shall not share his/her API access information or purchased databases without the explicit consent of Datalastic.
-
4.2. Except as otherwise set forth herein, The User shall have no other rights with respect to the Data, including without limitation, any right otherwise to use, distribute, furnish or resell the Data to third parties or any portion or derivative thereof.
-
Gas Fees on Ethereum Mainnet
- The external adapter is being deployed on the Kovan Testnet.
- Ideally, the production version will be Polygon Mainnet.
- Currently looking for a Maritime API Provider with an exclusive right allowing to distribute, furnish or resell the Data to third parties.
- Deploy external adapter on Polygon Mainnet.
This template provides a basic framework for developing Chainlink external adapters in NodeJS. Comments are included to assist with development and testing of the external adapter. Once the API-specific values (like query parameters and API key authentication) have been added to the adapter, it is very easy to add some tests to verify that the data will be correctly formatted when returned to the Chainlink node. There is no need to use any additional frameworks or to run a Chainlink node in order to test the adapter.
Clone this repo and change "ExternalAdapterProject" below to the name of your project
git clone https://github.com/thodges-gh/CL-EA-NodeJS-Template.git ExternalAdapterProject
Enter into the newly-created directory
cd ExternalAdapterProject
You can remove the existing git history by running:
rm -rf .git
See Install Locally for a quickstart
base
,from
, orcoin
: The symbol of the currency to queryquote
,to
, ormarket
: The symbol of the currency to convert to
{
"jobRunID": "278c97ffadb54a5bbb93cfec5f7b5503",
"data": {
"USD": 164.02,
"result": 164.02
},
"statusCode": 200
}
Install dependencies:
yarn
Run the local tests:
yarn test
Natively run the application (defaults to port 8080):
yarn start
curl -X POST -H "content-type:application/json" "http://localhost:8080/" --data '{ "id": 0, "data": { "from": "ETH", "to": "USD" } }'
If you wish to use Docker to run the adapter, you can build the image by running the following command:
docker build . -t external-adapter
Then run it with:
docker run -p 8080:8080 -it external-adapter:latest
After installing locally:
zip -r external-adapter.zip .
- In Lambda Functions, create function
- On the Create function page:
- Give the function a name
- Use Node.js 12.x for the runtime
- Choose an existing role or create a new one
- Click Create Function
- Under Function code, select "Upload a .zip file" from the Code entry type drop-down
- Click Upload and select the
external-adapter.zip
file - Handler:
- index.handler for REST API Gateways
- index.handlerv2 for HTTP API Gateways
- Add the environment variable (repeat for all environment variables):
- Key: API_KEY
- Value: Your_API_key
- Save
If using a HTTP API Gateway, Lambda's built-in Test will fail, but you will be able to externally call the function successfully.
- Click Add Trigger
- Select API Gateway in Trigger configuration
- Under API, click Create an API
- Choose HTTP API
- Select the security for the API
- Click Add
If using a REST API Gateway, you will need to disable the Lambda proxy integration for Lambda-based adapter to function.
- Click Add Trigger
- Select API Gateway in Trigger configuration
- Under API, click Create an API
- Choose REST API
- Select the security for the API
- Click Add
- Click the API Gateway trigger
- Click the name of the trigger (this is a link, a new window opens)
- Click Integration Request
- Uncheck Use Lamba Proxy integration
- Click OK on the two dialogs
- Return to your function
- Remove the API Gateway and Save
- Click Add Trigger and use the same API Gateway
- Select the deployment stage and security
- Click Add
- In Functions, create a new function, choose to ZIP upload
- Click Browse and select the
external-adapter.zip
file - Select a Storage Bucket to keep the zip in
- Function to execute: gcpservice
- Click More, Add variable (repeat for all environment variables)
- NAME: API_KEY
- VALUE: Your_API_key