Skip to main content
Version: 3.2.0

Initialise API

Now that we have the API installed, we can initialise the API. There are two ways to initialise the API:

Offline mode exposes the AWT token generation and signature proof generation required to configure JSON-RPC calls, along with account generation tools found here. To run the API in offline mode, have this at the top of your code:

note

AVN_GATEWAY_URL is ignored in Offline mode.

const { AvnApi, SetupMode, SigningMode } = require("avn-api");

const singleUserOptions = {
setupMode: SetupMode.Offline,
};
const avnSdk = new AvnApi(null, singleUserOptions); // null here has replaced the gateway url and configures the use as offline mode.
async function main() {
await avnSdk.init();
}
note

The avnSdk.apis() is not available in offline mode.