@api3/airnode-node
The node part of Airnode that allows for connecting multiple blockchains to the rest of the world
Documentation
You can learn all the information about Airnode in the docs.
For developers
Build the docker image locally
To build the image follow these instructions.
Configuration
Before running Airnode, you will need to have a valid config.json
and security.json
placed in the
packages/airnode-node folder. You can find more information on these files in the API3 documentation
repository.
Usage
You must have a valid config.json
file present in the __dev__
folder. It is also recommended to use a .env
file
for handling secrets. See Development below for more details.
Invoking
Airnode does not yet have an stable API for usage. However, you can run Airnode locally, for development and test
environments, by running the following command:
yarn run dev:invoke
Testing API
You can test the endpoints specified in your config.json
by running the following command:
yarn run dev:http-data-invoke --endpoint-id "0xd9e8c9bcc8960df5f954c0817757d2f7f9601bd638ea2f94e890ae5481681153" --parameters '{"coinId": "bitcoin"}'
Directory Structure
src/
├── adapters/
│ └── http/
├── api/
├── cli/
├── config/
├── coordinator/
│ └── calls/
├── evm/
│ ├── authorization/
│ ├── contracts/
│ ├── fulfillments/
│ ├── handlers/
│ ├── requests/
│ ├── templates
│ └── verification/
├── handlers/
├── providers/
├── reporting/
├── requests/
├── utils/
└── workers/
└── cloud-platforms/
Local invocation
Before you can use or invoke Airnode locally, you must have a valid config.json
in the config
folder. You can find
the specification in the
config.json documentation.
For your convenience, example config.json
and secrets.env
files are provided in the config
folder. You can simply
copy these files and remove the .example
from the filename.
Unit tests
Like with a development setup, it is important to ensure that all sibling dependencies are built before running tests.
Use yarn run build
from the monorepo root to build all of these packages.
Tests can run using the following commands:
yarn run test:node
yarn run test:node:watch
yarn run test:node:watch -f src/evm/handlers/initialize-provider.test.ts
yarn run test
yarn run test:watch
yarn run test:watch -f evm/handlers/initialize-provider.test.ts
E2E tests
End-to-end (E2E) tests test the entire Airnode request–response protocol, from start to finish. This includes (but is
not limited to): deploying Airnode RRP, creating the relevant onchain data, making onchain requests, invoking Airnode
and testing relevant expected outcomes.
In order to run E2E tests, you will need to have both an Ethereum node and the "dummy" web API running. The simplest way
to accomplish this is by running following commands from the repo root:
yarn run dev:eth-node
yarn run dev:api
yarn run dev:background
E2E tests are run in parallel and can be run using the following commands:
yarn run test:e2e
yarn run test:e2e:debug
E2E tests are defined in the test/e2e/
folder and are identified by the feature.ts
extension.