From 1a74ca0f4dd297d5064628db8c5efb82eb7b9728 Mon Sep 17 00:00:00 2001 From: tripathyr Date: Tue, 8 Aug 2023 16:47:06 +0530 Subject: [PATCH] Taproot Address Decoding Added --- scripts/lib.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/scripts/lib.js b/scripts/lib.js index 040ae1e..7823282 100644 --- a/scripts/lib.js +++ b/scripts/lib.js @@ -7226,6 +7226,15 @@ /* decode or validate an address and return the hash */ coinjs.addressDecode = function (addr) { try { + //Addition of Taproot check before other checks + if (segwit_addr.isTaprootAddress(addr)){ + var data = segwit_addr.decode("bc",addr); + data.type = "bech32m"; + data.outstring = "5120" + Crypto.util.bytesToHex(data.program); + return data; + } + + //Resuming regular checks var bytes = coinjs.base58decode(addr); var front = bytes.slice(0, bytes.length - 4); var back = bytes.slice(bytes.length - 4);