Browse Source

Added getAddressScriptHashBalances to helpers/index.js.

get-transaction-merkle
Corey Phillips 4 years ago
parent
commit
0587aa27b5
No known key found for this signature in database GPG Key ID: 80C0975F55D3A07B
  1. 14
      helpers/index.js

14
helpers/index.js

@ -317,12 +317,26 @@ const getFeeEstimate = ({ blocksWillingToWait = 8, id = Math.random(), network =
});
};
const getAddressScriptHashBalances = ({ scriptHashes = [], id = Math.random(), network = "" } = {}) => {
const method = "getAddressScriptHashBalances";
return new Promise(async (resolve) => {
try {
if (clients.mainClient[network] === false) await connectToRandomPeer(network, clients.peers[network]);
const response = await promiseTimeout(getTimeout(), clients.mainClient[network].blockchainScripthash_getBalanceBatch(scriptHashes));
resolve({ ...response, id, method, network });
} catch (e) {
console.log(e);
resolve({ id, error: true, method, data: e, network });
}
});
};
module.exports = {
start,
stop,
pingServer,
getAddressScriptHashBalance,
getAddressScriptHashBalances,
getPeers,
subscribeHeader,
subscribeAddress,

Loading…
Cancel
Save