mod publish - try gain #191
@ -369,16 +369,14 @@ export const NDKContextProvider = ({ children }: { children: ReactNode }) => {
|
|||||||
const publish = async (event: NDKEvent): Promise<string[]> => {
|
const publish = async (event: NDKEvent): Promise<string[]> => {
|
||||||
if (!event.sig) throw new Error('Before publishing first sign the event!')
|
if (!event.sig) throw new Error('Before publishing first sign the event!')
|
||||||
|
|
||||||
return event
|
try {
|
||||||
.publish(undefined, 10000)
|
const res = await event.publish(undefined, 10000)
|
||||||
.then((res) => {
|
|
||||||
const relaysPublishedOn = Array.from(res)
|
const relaysPublishedOn = Array.from(res)
|
||||||
return relaysPublishedOn.map((relay) => relay.url)
|
return relaysPublishedOn.map((relay) => relay.url)
|
||||||
})
|
} catch (err) {
|
||||||
.catch((err) => {
|
|
||||||
console.error(`An error occurred in publishing event`, err)
|
console.error(`An error occurred in publishing event`, err)
|
||||||
return []
|
return []
|
||||||
})
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user