fix: tests

This commit is contained in:
2023-10-18 15:36:39 +01:00
parent 4d4106a3ff
commit 3b3a920124
2 changed files with 10 additions and 19 deletions

View File

@ -75,13 +75,9 @@ export function parseId(id: string) {
}
export function bech32ToHex(str: string) {
try {
const nKey = bech32.decode(str, 1_000);
const buff = bech32.fromWords(nKey.words);
return utils.bytesToHex(Uint8Array.from(buff));
} catch (e) {
return str;
}
const nKey = bech32.decode(str, 10_000);
const buff = bech32.fromWords(nKey.words);
return bytesToHex(buff);
}
/**
@ -90,13 +86,9 @@ export function bech32ToHex(str: string) {
* @returns
*/
export function bech32ToText(str: string) {
try {
const decoded = bech32.decode(str, 1000);
const buf = bech32.fromWords(decoded.words);
return new TextDecoder().decode(Uint8Array.from(buf));
} catch {
return "";
}
const nKey = bech32.decode(str, 10_000);
const buff = bech32.fromWords(nKey.words);
return new TextDecoder().decode(buff);
}
/**