Skip to main content
Version: 0.6

Initialise API

Now that we have the API installed, we can initialise it with the code below:

const AVN_API = require("avn-api");
//Replace the <endpoint_url> with the url received from Aventus.
const AVN_GATEWAY_URL = "<endpoint_url>";
// If no URL is passed, the API will run in offline mode exposing just its core functionalities.
const API = new AVN_API(AVN_GATEWAY_URL);

async function main() {
// The account used for your SURI must hold 1 AVT to initialise the API
await API.init();
}

(async () => {
await main();
})();
tip

See HERE for instructions on how to add options as a parameter when initialising the API.

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.