diff --git a/.gitignore b/.gitignore index 12ac647..d16c649 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,4 @@ node_modules/ -.DS_Store \ No newline at end of file + +.DS_Store +npm-debug.log diff --git a/.npmignore b/.npmignore deleted file mode 100644 index f547b9c..0000000 --- a/.npmignore +++ /dev/null @@ -1,3 +0,0 @@ -.gitignore -test/ -.DS_Store diff --git a/lib/coins/blk.js b/lib/coins/blk.js index cb67abb..8ff015e 100644 --- a/lib/coins/blk.js +++ b/lib/coins/blk.js @@ -1,12 +1,10 @@ -/* - info from: - https://github.com/rat4/blackcoin/blob/master/src/chainparams.cpp -*/ - var assign = require('object-assign') +var bip44Constants = require('bip44-constants') + +// https://github.com/rat4/blackcoin/blob/master/src/chainparams.cpp var common = { - name: 'BlackCoin', + name: 'Blackcoin', per1: 1e8, unit: 'BLK' } @@ -30,8 +28,7 @@ var main = assign({}, { private: 0x0488ade4, public: 0x0488b21e }, - // http://doc.satoshilabs.com/slips/slip-0044.html - bip44: 0xa, + bip44: bip44Constants.Blackcoin - 0x80000000, private: 0x99, public: 0x19, scripthash: 0x55 diff --git a/lib/coins/btc.js b/lib/coins/btc.js index edf589b..29f256d 100644 --- a/lib/coins/btc.js +++ b/lib/coins/btc.js @@ -4,6 +4,7 @@ */ var assign = require('object-assign') +var bip44Constants = require('bip44-constants') var common = { name: 'Bitcoin', @@ -34,8 +35,7 @@ var main = assign({}, { private: 0x0488ade4, public: 0x0488b21e }, - // http://doc.satoshilabs.com/slips/slip-0044.html - bip44: 0, + bip44: bip44Constants.Bitcoin - 0x80000000, private: 0x80, public: 0x00, scripthash: 0x05 @@ -59,7 +59,7 @@ var test = assign({}, { private: 0x04358394, public: 0x043587cf }, - bip44: 1, + bip44: bip44Constants.Testnet - 0x80000000, private: 0xef, public: 0x6f, scripthash: 0xc4 @@ -78,7 +78,7 @@ var regtest = assign({}, { private: 0x04358394, public: 0x043587cf }, - bip44: 1, + bip44: bip44Constants.Testnet - 0x80000000, private: 0xef, public: 0x6f, scripthash: 0xc4 diff --git a/lib/coins/dash.js b/lib/coins/dash.js index c481665..a11bd2d 100644 --- a/lib/coins/dash.js +++ b/lib/coins/dash.js @@ -1,9 +1,7 @@ -/* - info from: - https://github.com/dashpay/dash/blob/master/src/chainparams.cpp -*/ - var assign = require('object-assign') +var bip44Constants = require('bip44-constants') + +// https://github.com/dashpay/dash/blob/master/src/chainparams.cpp var common = { name: 'Dash', @@ -31,7 +29,7 @@ var main = assign({}, { private: 0x02FE52CC, public: 0x02FE52F8 }, - bip44: 5, + bip44: bip44Constants.Dash - 0x80000000, private: 0xcc, public: 0x4c, scripthash: 0x10 @@ -54,7 +52,7 @@ var test = assign({}, { private: 0x3a805837, public: 0x3a8061a0 }, - bip44: 1, + bip44: bip44Constants.Testnet - 0x80000000, private: 0xef, public: 0x8b, scripthash: 0x13 diff --git a/lib/coins/doge.js b/lib/coins/doge.js index e64875b..d1545e5 100644 --- a/lib/coins/doge.js +++ b/lib/coins/doge.js @@ -1,4 +1,5 @@ var assign = require('object-assign') +var bip44Constants = require('bip44-constants') // https://github.com/dogecoin/dogecoin/blob/master/src/chainparams.cpp @@ -23,7 +24,7 @@ var main = assign({}, { private: 0x02fac398, public: 0x02facafd }, - bip44: 3, + bip44: bip44Constants.Dogecoin - 0x80000000, private: 0x9e, public: 0x1e, scripthash: 0x16 @@ -32,7 +33,7 @@ var main = assign({}, { var test = assign({}, { versions: { - bip44: 1, + bip44: bip44Constants.Testnet - 0x80000000, private: 0xf1, public: 0x71, scripthash: 0xc4 diff --git a/lib/coins/ltc.js b/lib/coins/ltc.js index 6d9ba98..61757bf 100644 --- a/lib/coins/ltc.js +++ b/lib/coins/ltc.js @@ -1,4 +1,5 @@ var assign = require('object-assign') +var bip44Constants = require('bip44-constants') // https://github.com/litecoin-project/litecoin/blob/master-0.10/src/chainparams.cpp @@ -24,7 +25,7 @@ var main = assign({}, { private: 0x019d9cfe, public: 0x019da462 }, - bip44: 2, + bip44: bip44Constants.Litecoin - 0x80000000, private: 0xb0, public: 0x30, scripthash: 0x05 @@ -33,7 +34,7 @@ var main = assign({}, { var test = assign({}, { versions: { - bip44: 1, + bip44: bip44Constants.Testnet - 0x80000000, private: 0xef, public: 0x6f, scripthash: 0xc4 diff --git a/lib/coins/nbt.js b/lib/coins/nbt.js index de1442d..e44f518 100644 --- a/lib/coins/nbt.js +++ b/lib/coins/nbt.js @@ -1,4 +1,5 @@ var assign = require('object-assign') +var bip44Constants = require('bip44-constants') var common = { name: 'NuBits', @@ -23,7 +24,7 @@ var main = assign({}, { private: 0x0488ade4, public: 0x0488b21e }, - bip44: 12, + bip44: bip44Constants.NuBits - 0x80000000, private: 0x96, public: 0x19, scripthash: 0x1a diff --git a/lib/coins/nmc.js b/lib/coins/nmc.js index 266b594..7721c09 100644 --- a/lib/coins/nmc.js +++ b/lib/coins/nmc.js @@ -1,4 +1,5 @@ var assign = require('object-assign') +var bip44Constants = require('bip44-constants') var common = { name: 'Namecoin', @@ -7,8 +8,7 @@ var common = { var main = assign({}, { versions: { - // http://doc.satoshilabs.com/slips/slip-0044.html - bip44: 7, + bip44: bip44Constants.Namecoin - 0x80000000, private: 0xb4, public: 0x34, scripthash: 0x05 diff --git a/lib/coins/ppc.js b/lib/coins/ppc.js index 8147e89..bb04eea 100644 --- a/lib/coins/ppc.js +++ b/lib/coins/ppc.js @@ -1,4 +1,5 @@ var assign = require('object-assign') +var bip44Constants = require('bip44-constants') var common = { name: 'Peercoin', @@ -7,7 +8,7 @@ var common = { var main = assign({}, { versions: { - bip44: 6, + bip44: bip44Constants.Peercoin - 0x80000000, private: 0xc4, public: 0x44, scripthash: 0x05 diff --git a/lib/coins/rdd.js b/lib/coins/rdd.js index f87a394..5b07249 100644 --- a/lib/coins/rdd.js +++ b/lib/coins/rdd.js @@ -1,13 +1,14 @@ var assign = require('object-assign') +var bip44Constants = require('bip44-constants') var common = { - name: 'ReddCoin', + name: 'Reddcoin', unit: 'RDD' } var main = assign({}, { versions: { - bip44: 4, + bip44: bip44Constants.Reddcoin - 0x80000000, private: 0xbd, public: 0x3d, scripthash: 0x05 @@ -16,7 +17,7 @@ var main = assign({}, { var test = assign({}, { versions: { - bip44: 1, + bip44: bip44Constants.Testnet - 0x80000000, private: 0xef, public: 0x6f, scripthash: 0xc4 diff --git a/package.json b/package.json index e67b580..551e420 100644 --- a/package.json +++ b/package.json @@ -25,12 +25,16 @@ "type": "git" }, "main": "./lib/coininfo.js", + "files": [ + "lib" + ], "scripts": { "lint": "standard", "test": "npm run lint && npm run unit", "unit": "mocha" }, "dependencies": { + "bip44-constants": "^2.1.0", "object-assign": "^4.0.1" } }