Update lib_btc.js

This commit is contained in:
tripathyr 2022-10-18 19:07:25 +05:30 committed by GitHub
parent 7b8764fd2c
commit 5c0fbfe953
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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);