Set up Complete
Now, let's test our setup and verify that we can query the AVN for data, in this case, the total amount of AVT on the AVN.
Below is a sample script on how your code should look at this point, to request the total amount of AVT on the AVN. It returns the total amount of AVT on the AvN.
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();
const totalAvt = await api.query.getTotalAvt();
console.log("The total amount of AVT on the AVN is: ", totalAvt);
// 5100000000000000000000
}
(async () => {
await main();
})();
Expected Output
5100000000000000000000
If you had a successful query with a similar result Congratulations! You're all set up to use the AVN Gateway.