Skip to main content
Version: 3.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:

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

const singleUserOptions = {
// the suri is the secret seed of your account.
suri: "0x5392ca60a61aea99fce14358798de93c1bc11c3696a905718738c71fae539c24", // this is from the generated example account
setupMode: SetupMode.SingleUser,
signingMode: SigningMode.SuriBased,
};
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.