Currently, I am utilizing an API to retrieve the balance from a bitcoin address.
This is my code:
async function getWalletBalance(address) {
try {
const response = await got(`blockchain.info/balance?active=${address}`)
return response.body.address.final_balance
} catch(err) {
return err
}
}
The JSON that is being returned looks like this:
{
"3D2oetdNuZUqQHPJmcMDDHYoqkyNVsFk9r": {
"final_balance": 15392048444281,
"n_tx": 3938,
"total_received": 138450271881712
}
}
However, when attempting to access the final balance, it returns undefined. What steps should I take to resolve this issue?