Successfully detecting and routing offers and counter-offers

This commit is contained in:
Chris Troutner
2022-03-22 08:00:08 -07:00
parent ceafb2820d
commit 65bffe1ef6
7 changed files with 29 additions and 7 deletions
+5 -3
View File
@@ -35,9 +35,11 @@ async function sweepFunds () {
do {
// Generate a keypair from the HD wallet.
const childNode = masterHDNode.derivePath(`m/44'/245'/0'/0/${hdIndex}`)
// const cashAddress = bchjs.HDNode.toCashAddress(childNode)
const cashAddress = bchjs.HDNode.toCashAddress(childNode)
const wifToSweep = bchjs.HDNode.toWIF(childNode)
console.log(`\nSweeping ${cashAddress}`)
try {
// Sweep tokens from address
const sweeper = new BchTokenSweep(
@@ -62,12 +64,12 @@ async function sweepFunds () {
// Wait between loop iterations.
await bchjs.Util.sleep(3000)
} catch (err) {
console.log(`error message: ${err.message}`)
console.log(`error message with index ${hdIndex}: ${err.message}`)
emptyAddrCnt++
}
hdIndex++
} while (emptyAddrCnt < 5)
} while (emptyAddrCnt < 10)
console.log('5 empty addresses detected. Exiting.')