mirror of
https://github.com/nbd-wtf/nostr-tools.git
synced 2025-12-09 16:48:50 +00:00
always add event.id
This commit is contained in:
3
pool.js
3
pool.js
@@ -95,11 +95,12 @@ export function relayPool(globalPrivateKey) {
|
|||||||
if (index !== -1) noticeCallbacks.splice(index, 1)
|
if (index !== -1) noticeCallbacks.splice(index, 1)
|
||||||
},
|
},
|
||||||
async publish(event, statusCallback = (status, relayURL) => {}) {
|
async publish(event, statusCallback = (status, relayURL) => {}) {
|
||||||
|
event.id = await getEventHash(event)
|
||||||
|
|
||||||
if (!event.sig) {
|
if (!event.sig) {
|
||||||
event.tags = event.tags || []
|
event.tags = event.tags || []
|
||||||
|
|
||||||
if (globalPrivateKey) {
|
if (globalPrivateKey) {
|
||||||
event.id = await getEventHash(event)
|
|
||||||
event.sig = await signEvent(event, globalPrivateKey)
|
event.sig = await signEvent(event, globalPrivateKey)
|
||||||
} else {
|
} else {
|
||||||
throw new Error(
|
throw new Error(
|
||||||
|
|||||||
Reference in New Issue
Block a user