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

coinselect

Package Overview
Dependencies
Maintainers
1
Versions
26
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

coinselect - npm Package Compare versions

Comparing version 1.0.1 to 2.0.0

14

index.js

@@ -10,7 +10,7 @@ // TODO: integrate privacy calculations, group by address, avoid linking multiple addresses together

function estimateRelayFee (byteLength, feePerKb) {
return Math.round((byteLength / 1000) * feePerKb)
function estimateRelayFee (byteLength, feeRate) {
return byteLength * feeRate
}
module.exports = function coinSelect (unspents, outputs, feePerKb) {
module.exports = function coinSelect (unspents, outputs, feeRate) {
// sort by descending value

@@ -41,3 +41,3 @@ var sorted = unspents.concat().sort(function (o1, o2) {

var baseFee = estimateRelayFee(byteLength, feePerKb)
var baseFee = estimateRelayFee(byteLength, feeRate)
var total = target + baseFee

@@ -49,3 +49,3 @@

var feeWithChange = estimateRelayFee(byteLength + TX_OUTPUT_BASE + TX_OUTPUT_PUBKEYHASH, feePerKb)
var feeWithChange = estimateRelayFee(byteLength + TX_OUTPUT_BASE + TX_OUTPUT_PUBKEYHASH, feeRate)
var totalWithChange = target + feeWithChange

@@ -64,2 +64,4 @@

console.log(baseFee, accum, total, remainder, feeWithChange)
var remainder = accum - total

@@ -75,5 +77,5 @@

return {
fee: estimateRelayFee(byteLength, feePerKb),
fee: estimateRelayFee(byteLength, feeRate),
inputs: null
}
}
{
"name": "coinselect",
"version": "1.0.1",
"version": "2.0.0",
"description": "A fee optimizing bitcoin input selection module",
"main": "./index.js",
"scripts": {
"prepublish": "npm run test",
"standard": "standard",
"test": "npm run-script unit",
"unit": "mocha"
"keywords": [
"coinselect",
"coin",
"unspents",
"wallet",
"BIP32",
"management",
"utxo",
"transaction",
"fee",
"optimization",
"optimizing",
"bitcoin"
],
"homepage": "https://github.com/dcousens/coinselect",
"bugs": {
"url": "https://github.com/dcousens/coinselect/issues"
},
"license": "MIT",
"author": "Daniel Cousens",
"files": [
"index.js"
],
"main": "index.js",
"repository": {

@@ -16,14 +33,14 @@ "type": "git",

},
"author": "Daniel Cousens",
"license": "MIT",
"bugs": {
"url": "https://github.com/dcousens/coinselect/issues"
"scripts": {
"prepublish": "npm run test",
"coverage": "nyc --check-coverage --branches 100 --functions 100 tape test/*.js",
"lint": "standard",
"test": "npm run lint && npm run unit",
"unit": "tape test/*.js"
},
"homepage": "https://github.com/dcousens/coinselect",
"dependencies": {},
"devDependencies": {
"mocha": "*",
"sinon": "^1.12.0",
"standard": "*"
"nyc": "^6.4.0",
"standard": "*",
"tape": "^4.5.1"
}
}

@@ -22,3 +22,3 @@ # coinselect

var feePerKb = 1000
var feeRate = 55
var unspents = [

@@ -39,3 +39,3 @@ ...,

var result = coinselect(unspents, outputs, feePerKb)
var result = coinselect(unspents, outputs, feeRate)

@@ -42,0 +42,0 @@ // the accumulated fee is always returned

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