aboutsummaryrefslogtreecommitdiff
path: root/src/js
diff options
context:
space:
mode:
authorIan Coleman <ian@iancoleman.io>2019-12-17 11:44:54 +1100
committerIan Coleman <ian@iancoleman.io>2019-12-17 11:46:07 +1100
commitf7e9fdf002e7355a122a86a8407b470b56bf3f59 (patch)
treecaaa9e0580d04280b40410b76feb3e0e7a7fcc91 /src/js
parent5c203fab6ac25fc76e2b805b7709d9b06ccdd995 (diff)
downloadBIP39-f7e9fdf002e7355a122a86a8407b470b56bf3f59.tar.gz
BIP39-f7e9fdf002e7355a122a86a8407b470b56bf3f59.tar.zst
BIP39-f7e9fdf002e7355a122a86a8407b470b56bf3f59.zip
Generate addresses for P2WSH and P2WSH-P2SH
Diffstat (limited to 'src/js')
-rw-r--r--src/js/index.js15
1 files changed, 11 insertions, 4 deletions
diff --git a/src/js/index.js b/src/js/index.js
index db47412..5fb0c47 100644
--- a/src/js/index.js
+++ b/src/js/index.js
@@ -1152,12 +1152,19 @@
1152 address = bitcoinjs.bitcoin.address.fromOutputScript(scriptpubkey, network) 1152 address = bitcoinjs.bitcoin.address.fromOutputScript(scriptpubkey, network)
1153 } 1153 }
1154 else if (isP2wsh) { 1154 else if (isP2wsh) {
1155 // TODO 1155 // https://github.com/bitcoinjs/bitcoinjs-lib/blob/v3.3.2/test/integration/addresses.js#L71
1156 address = ""; 1156 // This is a 1-of-1
1157 var witnessScript = bitcoinjs.bitcoin.script.multisig.output.encode(1, [key.getPublicKeyBuffer()]);
1158 var scriptPubKey = bitcoinjs.bitcoin.script.witnessScriptHash.output.encode(bitcoinjs.bitcoin.crypto.sha256(witnessScript));
1159 address = bitcoinjs.bitcoin.address.fromOutputScript(scriptPubKey, network);
1157 } 1160 }
1158 else if (isP2wshInP2sh) { 1161 else if (isP2wshInP2sh) {
1159 // TODO 1162 // https://github.com/bitcoinjs/bitcoinjs-lib/blob/v3.3.2/test/integration/transactions.js#L183
1160 address = ""; 1163 // This is a 1-of-1
1164 var witnessScript = bitcoinjs.bitcoin.script.multisig.output.encode(1, [key.getPublicKeyBuffer()]);
1165 var redeemScript = bitcoinjs.bitcoin.script.witnessScriptHash.output.encode(bitcoinjs.bitcoin.crypto.sha256(witnessScript));
1166 var scriptPubKey = bitcoinjs.bitcoin.script.scriptHash.output.encode(bitcoinjs.bitcoin.crypto.hash160(redeemScript));
1167 address = bitcoinjs.bitcoin.address.fromOutputScript(scriptPubKey, network)
1161 } 1168 }
1162 } 1169 }
1163 1170