Avail node API reference
BEFORE WE START
- The Avail node supports an extensive list of extrinsics and various other types of calls that you can try out in our explorer .
- 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
avail-js
- Make sure
Node-jsis installed on your system by running the following command in your terminal:
terminal
node --versionIf not installed, you can refer to Node-js docs for the same.
- Create a new Node-js project by running the following command in a directory of your choice:
terminal
pnpm init- To install the
avail-js-sdkrun the following command:
terminal
pnpm add avail-js-sdk@0.4.1- Make sure to install the
ts-nodepackage if you haven’t already:
terminal
pnpm add -g ts-node- Create a
tsconfig.jsonfile in the root of your project by running:
terminal
touch tsconfig.json- Populate your
tsconfig.jsonwith 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"]
} - Create a
.envfile in the root of your project by running:
terminal
pnpm add dotenv && touch .env- Put in the Seed Phrase of the account you want to use into the
.envfile:
.env
SEED="This is a random seed phrase please replace with your own"🔥
IMPORTANT
- Please be VERY CAREFUL with your seed phrase.
- Make sure to add your
.envfile to your.gitignoreso that it doesn’t get pushed anywhere. - While it is good enough to use an
envfile while testing, try to use better practices while deploying to production.
Last updated on