Add switch_relays to nip 46 signer

This commit is contained in:
Jon Staab
2026-01-20 12:46:33 -08:00
parent 414854a392
commit 1c0204c17c
3 changed files with 54 additions and 29 deletions
+2 -2
View File
@@ -1363,11 +1363,11 @@ export const displayDomain = (url: string) => displayUrl(first(url.split(/[\/\?]
* @param json - JSON string to parse
* @returns Parsed object or null if invalid
*/
export const parseJson = (json: string | undefined) => {
export function parseJson<T = any>(json: string | undefined) {
if (!json) return undefined
try {
return JSON.parse(json)
return JSON.parse(json) as T
} catch (e) {
return undefined
}