-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcheckBchBalanceBatch.js
More file actions
44 lines (34 loc) · 935 Bytes
/
checkBchBalanceBatch.js
File metadata and controls
44 lines (34 loc) · 935 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
/*
checkBchBalanceBatch.js
A script to get the total BCH balance of a batch of BCH addresses
Inputs:
1) An Array of objects each with an `addr` key defining a cashAddr
Outputs:
1) Total BCH balance of all addresses
*/
// Import Bitbox
let BITBOX = require("bitbox-sdk").BITBOX;
let bitbox = new BITBOX();
// Import keys
const keys = require("./keys");
// Define batch wallet
const sweepableWallets = keys.sweepableWallets;
// Build addrArray for batch balance
batchAddresses = [];
for (let i = 0; i < sweepableWallets.length; i++) {
batchAddresses.push(sweepableWallets[i].addr);
}
checkBatchBalance(batchAddresses);
function checkBatchBalance(addrArray) {
bitbox.Address.details(addrArray).then(
result => {
//console.log(result);
for (let i = 0; i < result.length; i++) {
console.log(`${addrArray[i]}: ${result[i].balance} BCH`);
}
},
err => {
console.log(err);
}
);
}