Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

melis-fork-claimer

Package Overview
Dependencies
Maintainers
1
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

melis-fork-claimer - npm Package Compare versions

Comparing version 1.0.0 to 1.0.1

2

package.json

@@ -6,3 +6,3 @@ {

"license": "ISC",
"version": "1.0.0",
"version": "1.0.1",
"main": "src/index.js",

@@ -9,0 +9,0 @@ "scripts": {

@@ -808,7 +808,8 @@ //

unspents.forEach(u => {
tx.addInput(Buffer.from(u.hash, 'hex').reverse(), u.n, Bitcoin.Transaction.DEFAULT_SEQUENCE)
inputAmount += u.amount
})
tx.addInput(Buffer.from(u.hash, 'hex').reverse(), u.n, Bitcoin.Transaction.DEFAULT_SEQUENCE)
inputAmount += u.amount
})
/console.log("[prepareSignaturesForClaim] recipients:", recipients)
/
console.log("[prepareSignaturesForClaim] recipients:", recipients)
let outputAmount = 0

@@ -957,79 +958,75 @@ recipients.forEach(recipient => {

async bsvScan(melis, accounts, doDebug) {
try {
const bchDriver = melis.getCoinDriver('BCH')
const res = {}
const bchDriver = melis.getCoinDriver('BCH')
const res = {}
for (let i = 0; i < accounts.length; i++) {
const account = accounts[i]
if (account.type !== '2' && account.type !== 'H') {
console.log("Skipping account " + account.pubId + " of unsupported type " + account.type)
continue
for (let i = 0; i < accounts.length; i++) {
const account = accounts[i]
if (account.coin !== 'BCH') {
console.log("Skipping account " + account.pubId + " " + account.coin)
continue
}
if (account.type !== '2' && account.type !== 'H') {
console.log("Skipping account " + account.pubId + " of unsupported type " + account.type)
continue
}
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)
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)
res[account.pubId] = {
utxos,
account
}
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)
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)
res[account.pubId] = {
utxos,
account
}
}
return res
} catch (err) {
console.log("bsvScan Ex:", err)
}
return res
}
async bsvRedeem(melis, params) {
try {
const account = params.account
const utxos = params.utxos
let targetAddress = params.targetAddress
const account = params.account
const utxos = params.utxos
let targetAddress = params.targetAddress
if (params && params.doDebug)
console.log("[BSV CLAIM] utxos: ", utxos)
if (!account)
throw ("Missing account in parameters")
if (!utxos || !utxos.length)
throw ("Missing utxos in parameters")
if (!targetAddress) {
const pubId = await this.findExistingBSVAccount(melis)
const aa = await melis.getPaymentAddressViaRest(pubId, {
info: 'BSV Redeemed coins'
})
if (params && params.doDebug)
console.log("[BSV CLAIM] utxos: ", utxos)
if (!account)
throw ("Missing account in parameters")
if (!utxos || !utxos.length)
throw ("Missing utxos in parameters")
console.log("Created new aa: ", aa)
targetAddress = aa.address
}
if (!targetAddress) {
const pubId = await this.findExistingBSVAccount(melis)
const aa = await melis.getPaymentAddressViaRest(pubId, {
info: 'BSV Redeemed coins'
})
if (params && params.doDebug)
console.log("Created new aa: ", aa)
targetAddress = aa.address
}
console.log("Target BSV address: ", targetAddress)
const unspents = utxos.map(u => ({
hash: u.txid,
n: u.vout,
address: u.address
}))
console.log("Target BSV address: ", targetAddress)
const unspents = utxos.map(u => ({
hash: u.txid,
n: u.vout,
address: u.address
}))
const res = await this.redeem(melis, {
account,
targetCoin: 'BSV',
targetAddress,
unspents
})
const res = await this.redeem(melis, {
account,
targetCoin: 'BSV',
targetAddress,
unspents
})
return res
} catch (err) {
console.log("bsvRedeem Ex:", err)
}
return res
}

@@ -1036,0 +1033,0 @@ }

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc