Open mahnunchik opened 1 year ago
Could you show an example code describing how returning hash could help?
For internal usage and some kind of tests it can be useful. For example to match that p2pkh and p2wpkh payments use the same keypair if hashes are the same.
Current solution: parse provided script
or address
. But there is original hash
inside functions so it can be reused when returned.
The reference from bitcoinjs-lib: https://github.com/bitcoinjs/bitcoinjs-lib/blob/master/ts_src/payments/p2pkh.ts#L52-L56
It would be helpful to have hash
exposed by p2*
to work with CashAddr
.
import { Address } from 'cashaddr';
const payment = btc.p2pkh(PubKey);
const address = Address().encode(payment);
It would be helpful to have original
hash
included in returnedP2Ret
for hash based payments: p2sh, p2pkh, p2wsh, p2wpkh.