feat: add blockchain status getter to all daemons

This commit is contained in:
Sérgio Salgado 2022-01-21 17:44:53 +00:00
parent 75cb094476
commit 2819b8a519
11 changed files with 107 additions and 16 deletions

View file

@ -118,11 +118,18 @@ function supportsBatching (cryptoCode) {
.then(() => SUPPORTS_BATCHING)
}
function checkBlockchainStatus (cryptoCode) {
return checkCryptoCode(cryptoCode)
.then(() => fetch('getblockchaininfo'))
.then(res => !!res['initialblockdownload'] ? 'ready' : 'syncing')
}
module.exports = {
balance,
sendCoins,
newAddress,
getStatus,
newFunding,
supportsBatching
supportsBatching,
checkBlockchainStatus
}