From 1294bc21497d8795ecc484cee9486d3f586de3a0 Mon Sep 17 00:00:00 2001 From: mathi Date: Wed, 15 Dec 2021 12:08:58 +0100 Subject: [PATCH] added documentation toHash160() --- src/address.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/address.js b/src/address.js index 0bce96c..d8be6fa 100644 --- a/src/address.js +++ b/src/address.js @@ -186,6 +186,21 @@ class Address { return cashAddress.split(':')[1] } + /** + * @api Address.toHash160() toHash160() + * @apiName toHash160 + * @apiGroup Address + * @apiDescription Converts any address format to hash160 + * + * @apiExample Example usage: + * // cash address mainnet p2pkh + * bchjs.Address.toHash160("bitcoincash:qptnmya5wkly7xf97wm5ak23yqdsz3l2cyj7k9vyyh") + * // 573d93b475be4f1925f3b74ed951201b0147eac1 + * + * // cash address mainnet p2sh + * bchjs.Address.toHash160("bitcoincash:pp7ushdxf5we8mcpaa3wqgsuqt639cu59ur5xu5fug") + * // 7dc85da64d1d93ef01ef62e0221c02f512e3942f + */ // Converts any address format to hash160 toHash160 (address) { const legacyAddress = this.toLegacyAddress(address)