Skip to main content
Version: 0.8

Initialise API

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

info

You can get the AVN_GATEWAY_URL here.

There are some other params that are accepted in options, See here for the new split-fee functionality.

const AVN_API = require("avn-api");

// If no URL is passed, the API will run in offline mode exposing just its core functionalities.
const AVN_GATEWAY_URL = "https://testnet.gateway.aventus.io/";
const options = {
suri: "0x5392ca60a61aea99fce14358798de93c1bc11c3696a905718738c71fae539c24", // this is from the generated example account
};


const API = new AVN_API(AVN_GATEWAY_URL, options);

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

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