Update wif to 2.0.1
This commit is contained in:
parent
2f2e50092c
commit
48866992d4
3 changed files with 5 additions and 5 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -1,3 +1,2 @@
|
||||||
bitcoin.js
|
|
||||||
coverage
|
coverage
|
||||||
node_modules
|
node_modules
|
||||||
|
|
|
@ -73,7 +73,7 @@
|
||||||
"ecurve": "^1.0.0",
|
"ecurve": "^1.0.0",
|
||||||
"randombytes": "^2.0.1",
|
"randombytes": "^2.0.1",
|
||||||
"typeforce": "^1.6.2",
|
"typeforce": "^1.6.2",
|
||||||
"wif": "^1.1.0"
|
"wif": "^2.0.1"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"async": "^1.5.0",
|
"async": "^1.5.0",
|
||||||
|
|
|
@ -66,11 +66,12 @@ ECPair.fromWIF = function (string, network) {
|
||||||
|
|
||||||
network = network.filter(function (network) {
|
network = network.filter(function (network) {
|
||||||
return version === network.wif
|
return version === network.wif
|
||||||
}).pop() || {}
|
}).pop()
|
||||||
|
if (!network) throw new Error('Invalid network version')
|
||||||
}
|
}
|
||||||
|
|
||||||
var decoded = wif.decodeRaw(network.wif, buffer)
|
var decoded = wif.decodeRaw(buffer, network.wif)
|
||||||
var d = BigInteger.fromBuffer(decoded.d)
|
var d = BigInteger.fromBuffer(decoded.privateKey)
|
||||||
|
|
||||||
return new ECPair(d, null, {
|
return new ECPair(d, null, {
|
||||||
compressed: decoded.compressed,
|
compressed: decoded.compressed,
|
||||||
|
|
Loading…
Reference in a new issue