Catch exceptions

This commit is contained in:
Kieran 2023-01-14 13:11:01 +00:00
parent b43f01ff4a
commit 4aeea82bc2
Signed by: Kieran
GPG Key ID: DE71CEB3925BE941

View File

@ -62,8 +62,13 @@ export function hexToBech32(hrp, hex) {
return "";
}
try {
let buf = secp.utils.hexToBytes(hex);
return bech32.encode(hrp, bech32.toWords(buf));
} catch (e) {
console.warn("Invalid hex", hex, e);
return "";
}
}
/**