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
200: OK Success 401: Unauthorized When incorrect apiKey or authToken
Copy {
"code" : 200 ,
"message" : "Dapp gas tank balance fetched for dappid: 6214cb11e5163ec3a892f729" ,
"responseCode" : 200 ,
"dappGasTankData" : {
"effectiveBalanceInWei" : 3496503496503496700 ,
"effectiveBalanceInStandardForm" : 3.4965034965034967 ,
"isBelowThreshold" : false ,
"isInGracePeriod" : false
}
}
Copy {
code : 401 ,
message : 'Not Authorized' ,
responseCode : 401
}
Copy 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();