Skip to Content
API ReferenceAvail node API reference

Avail node API reference

BEFORE WE START

  1. The Avail node supports an extensive list of extrinsics and various other types of calls that you can try out in our explorer.
  2. This API reference currently documents only the most widely used extrinsics, but will be iterated upon to eventually be an exhaustive resource for the Avail node API.

Setting up the dev environment

  1. Make sure Node-js is installed on your system by running the following command in your terminal:
terminal
node --version

If not installed, you can refer to Node-js docs for the same.

  1. Create a new Node-js project by running the following command in a directory of your choice:
terminal
pnpm init
  1. To install the avail-js-sdk run the following command:
terminal
pnpm add avail-js-sdk@0.4.0
  1. Make sure to install the ts-node package if you haven’t already:
terminal
pnpm add -g ts-node
  1. Create a tsconfig.json file in the root of your project by running:
terminal
touch tsconfig.json
  1. Populate your tsconfig.json with the following configuration:
tsconfig.json
{ "compilerOptions": { "target": "es2016", "module": "commonjs", "outDir": "build", "declaration": true, "esModuleInterop": true, "forceConsistentCasingInFileNames": true, "strict": true, "skipLibCheck": true, "noUnusedParameters": true }, "include": ["**/*.ts", "**/*.js"], "exclude": ["node_modules", "build"] }
  1. Create a .env file in the root of your project by running:
terminal
pnpm add dotenv && touch .env
  1. Put in the Seed Phrase of the account you want to use into the .env file:
.env
SEED="This is a random seed phrase please replace with your own"
🔥

IMPORTANT

  1. Please be VERY CAREFUL with your seed phrase.
  2. Make sure to add your .env file to your .gitignore so that it doesn’t get pushed anywhere.
  3. While it is good enough to use an env file while testing, try to use better practices while deploying to production.
Last updated on