multiple zapping issues resolved for confirming and showing active states of zaps #36

Merged
freakoverse merged 6 commits from staging into master 2024-09-11 18:02:41 +00:00
Showing only changes of commit 53d47fcb80 - Show all commits

View File

@ -121,10 +121,10 @@ export class MetadataController {
public findUserRelays = async (
hexKey: string,
userRelaysType: UserRelaysType = UserRelaysType.Both
) => {
): Promise<string[]> => {
log(true, LogType.Info, ` Finding user's relays`, hexKey, userRelaysType)
const ndkRelayListPromise = await getRelayListForUser(hexKey, this.ndk)
const ndkRelayListPromise = getRelayListForUser(hexKey, this.ndk)
// Use Promise.race to either get the NDKRelayList instance or handle the timeout
return await Promise.race([
@ -132,11 +132,12 @@ export class MetadataController {
timeout() // Custom timeout function that rejects after a specified time
])
.then((ndkRelayList) => {
return ndkRelayList[userRelaysType]
if (ndkRelayList) return ndkRelayList[userRelaysType]
return [] // Return an empty array if ndkRelayList is undefined
})
.catch((err) => {
log(true, LogType.Error, err)
return [] as string[] // Return an empty array if an error occurs
return [] // Return an empty array if an error occurs
})
}