Initialise API
Now that we have the API installed, we can initialise it with the code below:
const AvnApi = require("avn-api");
const GATEWAY = "<endpoint_url>"; //Replace the endpoint_url with the url received from Aventus.
const api = new AvnApi(GATEWAY);
async function main() {
await api.init(); // The account used for your SURI must hold 1 AVT to initialise the API
}
(async () => {
await main();
})();
Replace <endpoint_url> with the actual url of the public endpoint
info
Contact us to get the url of the endpoint here
This creates a new instance of the API connecting to one of the nodes.