Update lib_btc.js

This commit is contained in:
tripathyr 2022-10-10 17:46:53 +05:30 committed by GitHub
parent e9490c8b67
commit 0b9a71a1a2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -443,6 +443,18 @@
}; };
} }
//Return a Bech32 address for the multisig. Format is same as above
coinjs.pubkeys2MultisigAddressBech32 = function (pubkeys, required){
var t1,t2,t3;
t1 = coinjs.pubkeys2MultisigAddress(pubkeys, required);
t2 = Crypto.SHA256(Crypto.util.hexToBytes(t1.redeemScript));
t3 = btc_api.encodeBech32(t2,0,"bc");
return {
'address': t3,
'redeemScript': t1.redeemScript,
'size': t1.size
};
}
/* new time locked address, provide the pubkey and time necessary to unlock the funds. /* new time locked address, provide the pubkey and time necessary to unlock the funds.
when time is greater than 500000000, it should be a unix timestamp (seconds since epoch), when time is greater than 500000000, it should be a unix timestamp (seconds since epoch),
otherwise it should be the block height required before this transaction can be released. otherwise it should be the block height required before this transaction can be released.