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-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.
- 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-sdk
run the following command:
terminal
pnpm add avail-js-sdk@0.4.0
- Make sure to install the
ts-node
package if you haven’t already:
terminal
pnpm add -g ts-node
- Create a
tsconfig.json
file in the root of your project by running:
terminal
touch tsconfig.json
- 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"]
}
- Create a
.env
file 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
.env
file:
.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
.env
file to your.gitignore
so that it doesn’t get pushed anywhere. - While it is good enough to use an
env
file while testing, try to use better practices while deploying to production.
Last updated on