From 5c0fbfe953de3f0800c6f72bf62e050c800a610b Mon Sep 17 00:00:00 2001 From: tripathyr Date: Tue, 18 Oct 2022 19:07:25 +0530 Subject: [PATCH] Update lib_btc.js --- lib_btc.js | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/lib_btc.js b/lib_btc.js index 381f604..06f8244 100644 --- a/lib_btc.js +++ b/lib_btc.js @@ -544,7 +544,20 @@ 'redeemscript': Crypto.util.bytesToHex(program) }; } + + coinjs.multisigBech32Address = function (raw_redeemscript) { + var t1,t2; + t1 = Crypto.SHA256(Crypto.util.hexToBytes(raw_redeemscript)); + t2 = btc_api.encodeBech32(t1,0,"bc"); + + return { + 'address': t2, + 'type': 'multisigBech32', + 'redeemscript': t1 + }; + } + /* extract the redeemscript from a bech32 address */ coinjs.bech32redeemscript = function (address) { var r = false; @@ -555,7 +568,7 @@ } return r; } - + /* provide a privkey and return an WIF */ coinjs.privkey2wif = function (h) { var r = Crypto.util.hexToBytes(h);