diff --git a/packages/app/src/relays.ts b/packages/app/src/relays.ts index 06dce9b..ae31444 100644 --- a/packages/app/src/relays.ts +++ b/packages/app/src/relays.ts @@ -31,7 +31,7 @@ export const onRelay = (sub: (relay: RelayProfile) => void) => { export const fetchRelayDirectly = async (url: string): Promise> => { try { - const json = fetchJson(url.replace(/^ws/, "http"), { + const json = await fetchJson(url.replace(/^ws/, "http"), { headers: { Accept: "application/nostr+json", }, diff --git a/packages/lib/src/Tools.ts b/packages/lib/src/Tools.ts index d9fa9fe..05b0058 100644 --- a/packages/lib/src/Tools.ts +++ b/packages/lib/src/Tools.ts @@ -6,6 +6,8 @@ export type Maybe = T | undefined export type MaybeAsync = T | Promise +export const maybe = (x?: T) => x + export const isDefined = (x: T, ...args: unknown[]) => x !== undefined export const isUndefined = (x: T, ...args: unknown[]) => x === undefined @@ -1034,9 +1036,11 @@ export const tryCatch = (f: () => T, onError?: (e: Error) => void): T | undef /** * Throws an error with the given message */ -export const thrower = (message: string) => () => { - throw new Error(message) -} +export const thrower = + (message: string) => + (...args: unknown[]) => { + throw new Error(message) + } /** * Creates function that only executes once diff --git a/packages/util/src/Kinds.ts b/packages/util/src/Kinds.ts index 8d6ba99..df639df 100644 --- a/packages/util/src/Kinds.ts +++ b/packages/util/src/Kinds.ts @@ -138,8 +138,10 @@ export const EMOJIS = 10030 export const MESSAGING_RELAYS = 10050 export const BLOSSOM_SERVERS = 10063 export const FILE_SERVERS = 10096 +export const WALLET_INFO = 13194 export const RELAY_MEMBERS = 13534 export const PROMENADE_REGISTER_ACCOUNT = 16430 +export const ROOM_CREATE_PERMISSION = 19004 export const LIGHTNING_PUB_RPC = 21000 export const CLIENT_AUTH = 22242 export const BLOSSOM_AUTH = 24242 @@ -152,7 +154,6 @@ export const PROMENADE_RESULT = 26433 export const RELAY_JOIN = 28934 export const RELAY_INVITE = 28935 export const RELAY_LEAVE = 28936 -export const WALLET_INFO = 13194 export const WALLET_REQUEST = 23194 export const WALLET_RESPONSE = 23195 export const NOSTR_CONNECT = 24133 @@ -199,7 +200,6 @@ export const ROOM = 35834 export const ROOM_META = 39000 export const ROOM_ADMINS = 39001 export const ROOM_MEMBERS = 39002 -export const ROOM_CREATE_PERMISSION = 39004 export const FOLLOW_PACK = 39089 export const DEPRECATED_RELAY_RECOMMENDATION = 2