Node Package Manager (npm) is required to start using this API. You can install npm here. Installing nodejs will automatically install npm.
You can either use the API in Offline mode or in Online mode. See the initialise page. For online mode, you can get the AVN_GATEWAY_URL here.
📄️ Account Generation
On this page, we'll cover how to generate a new account on the AVN.
There are two networks you can interact with Mainnet and Testnet. The testnet is designed to be an environment where you can test your code before deploying it on the mainnet; the mainnet is for production ready code as it has real world effects.
Before running any script with the avn-api, let's set your AvN mnemonic or secret seed generated via the accounts page. There are two ways you can set this:
Now that we have the API installed, we can initialise the API. There are two ways to initialise the API:
Only required if using JSON-RPC
📄️ Dapps & Remote Signer
When the sdk is run in SingleUser mode, a user can be passed in instead of a suri. In this setup, signing will happen remotely on the caller's side using the sign() method defined in the remoteSignerOptions object. This is especially useful when building Dapps that require the user to sign actions on the Dapp or validate themselves without exposing their Suri.
📄️ Set up Complete
Now, let's test our setup and verify that we query blockchain successfully: