melis-fork-claimer
Advanced tools
Comparing version 1.0.9 to 1.0.10
@@ -6,3 +6,3 @@ { | ||
"license": "ISC", | ||
"version": "1.0.9", | ||
"version": "1.0.10", | ||
"main": "src/index.js", | ||
@@ -26,4 +26,4 @@ "scripts": { | ||
"dependencies": { | ||
"melis-api-js": "^0.12.2" | ||
"melis-api-js": "^0.12.3" | ||
} | ||
} |
@@ -107,2 +107,6 @@ // | ||
/* | ||
BTC2: { | ||
fork: 507850, | ||
name "Bitcoin2" | ||
} | ||
B2X: { | ||
@@ -957,2 +961,3 @@ fork: 501451, | ||
const bchDriver = melis.getCoinDriver('BCH') | ||
const maxSliceSize = 20 | ||
const res = {} | ||
@@ -971,19 +976,40 @@ | ||
console.log("scanning account " + account.pubId + " type: " + account.type + " meta: " + JSON.stringify(account.meta)) | ||
const slice = await melis.addressesGet(account) | ||
// console.log("slice result: " + slice.list) | ||
if (!slice.list) { | ||
console.log("No addresses on melis for account " + account.pubId) | ||
continue | ||
} | ||
const addrs = slice.list.map(aa => bchDriver.toLegacyAddress(aa.address)) | ||
if (doDebug) | ||
console.log("#Addresses: " + addrs.length + "\n", addrs) | ||
const utxos = await this.queryUtxos(addrs, { | ||
doDebug | ||
}) | ||
if (doDebug) | ||
console.log("utxos:", utxos) | ||
if (utxos.length) | ||
let numCheckedAddrs = 0 | ||
let slicePage = 0 | ||
let unspents = [] | ||
do { | ||
const slice = await melis.addressesGet(account, { | ||
page: slicePage++, | ||
size: maxSliceSize | ||
}) | ||
// console.log("slicePage: " + slicePage + " maxSliceSize: " + maxSliceSize + " slice result: ", slice) | ||
if (!slice.list) { | ||
console.log("No addresses on melis for account " + account.pubId) | ||
break | ||
} | ||
const addrs = slice.list.map(aa => bchDriver.toLegacyAddress(aa.address)) | ||
if (doDebug) | ||
console.log("slicePage: " + slicePage + " maxSliceSize: " + maxSliceSize + " #Addresses: " + addrs.length + "\n", addrs) | ||
numCheckedAddrs += addrs.length | ||
const utxos = await this.queryUtxos(addrs, { | ||
doDebug | ||
}) | ||
if (doDebug) | ||
console.log("utxos:", utxos) | ||
if (utxos.length) | ||
unspents = unspents.concat(utxos) | ||
if (!slice.hasNext) | ||
break | ||
} while (true) | ||
console.log("#unspents found: " + unspents.length + " numCheckedAddrs: " + numCheckedAddrs + " slices used: " + slicePage + " (sliceSize:" + maxSliceSize + ")") | ||
if (unspents.length) | ||
res[account.pubId] = { | ||
utxos, | ||
utxos: unspents, | ||
account | ||
@@ -990,0 +1016,0 @@ } |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
32294
959
Updatedmelis-api-js@^0.12.3