Browse Source

s/scriptPubKey/outputScript

hk-custom-address
Daniel Cousens 8 years ago
parent
commit
3635a9f078
  1. 8
      src/address.js

8
src/address.js

@ -25,13 +25,13 @@ function toBase58Check (hash, version) {
return bs58check.encode(payload)
}
function fromOutputScript (scriptPubKey, network) {
function fromOutputScript (outputScript, network) {
network = network || networks.bitcoin
if (bscript.pubKeyHash.output.check(scriptPubKey)) return toBase58Check(bscript.compile(scriptPubKey).slice(3, 23), network.pubKeyHash)
if (bscript.scriptHash.output.check(scriptPubKey)) return toBase58Check(bscript.compile(scriptPubKey).slice(2, 22), network.scriptHash)
if (bscript.pubKeyHash.output.check(outputScript)) return toBase58Check(bscript.compile(outputScript).slice(3, 23), network.pubKeyHash)
if (bscript.scriptHash.output.check(outputScript)) return toBase58Check(bscript.compile(outputScript).slice(2, 22), network.scriptHash)
throw new Error(bscript.toASM(scriptPubKey) + ' has no matching Address')
throw new Error(bscript.toASM(outputScript) + ' has no matching Address')
}
function toOutputScript (address, network) {

Loading…
Cancel
Save