Browse Source

Merge pull request #549 from fanatid/feature/wif-2.0.1

Update wif to 2.0.1
hk-custom-address
Daniel Cousens 9 years ago
parent
commit
54c071c131
  1. 1
      .gitignore
  2. 2
      package.json
  3. 7
      src/ecpair.js

1
.gitignore

@ -1,3 +1,2 @@
bitcoin.js
coverage
node_modules

2
package.json

@ -73,7 +73,7 @@
"ecurve": "^1.0.0",
"randombytes": "^2.0.1",
"typeforce": "^1.6.2",
"wif": "^1.1.0"
"wif": "^2.0.1"
},
"devDependencies": {
"async": "^1.5.0",

7
src/ecpair.js

@ -66,11 +66,12 @@ ECPair.fromWIF = function (string, network) {
network = network.filter(function (network) {
return version === network.wif
}).pop() || {}
}).pop()
if (!network) throw new Error('Invalid network version')
}
var decoded = wif.decodeRaw(network.wif, buffer)
var d = BigInteger.fromBuffer(decoded.d)
var decoded = wif.decodeRaw(buffer, network.wif)
var d = BigInteger.fromBuffer(decoded.privateKey)
return new ECPair(d, null, {
compressed: decoded.compressed,

Loading…
Cancel
Save