With this data API, you can find out the current gas tank balance for a particular dapp that you have registered on the dashboard
Fetches gas tank balance for a particular dapp
{
"code": 200,
"message": "Dapp gas tank balance fetched for dappid: 6214cb11e5163ec3a892f729",
"responseCode": 200,
"dappGasTankData": {
"effectiveBalanceInWei": 3496503496503496700,
"effectiveBalanceInStandardForm": 3.4965034965034967,
"isBelowThreshold": false,
"isInGracePeriod": false
}
}
{
code: 401,
message: 'Not Authorized',
responseCode: 401
}
const fetch = require("node-fetch");
const { URL, URLSearchParams } = require('url');
const authToken = "<Account's AUTH TOKEN>";
const apiKey = "<Dapp's API KEY>";
const getDappGasTankBalance = () => {
const url = new URL("https://data.biconomy.io/api/v1/dapp/gas-tank-balance");
const requestOptions = {
method: 'GET',
headers: { "Content-Type": "application/x-www-form-urlencoded", "authToken": authToken, "apiKey" : apiKey }
};
fetch(url, requestOptions)
.then(response => response.json())
.then(data => console.log(data))
.catch(error => console.error('Error:', error));
}
getDappGasTankBalance();