Open mirzabusatlic opened 1 year ago
hmm i could not replicate your error. this code runs for me.
signEvent will automatically add id and pubkey if they are missing. can you just try:
signEvent(event)
{
return new Promise((resolve, reject) => {
if (window.nostr) {
return window.nostr.signEvent(event).then(response => {
// Does not enter here...
//resolve(event);
}).catch(error => {
reject(error); // Error occurs here 'nos2x: undefined'
});
} else { // window.nostr undefined
reject('window.nostr undefined');
}
});
},
I'm able to fetch the public key from the extension, and when I call
window.nostr.signEvent
, it does ask me to give permissions to post the event. When I choose "Allow for 5 minutes", I get the errornos2x is undefined
.Not sure if I'm doing something wrong but I couldn't find any resources on how to fix this...
Note that 'pubkey' is not set on the event. Setting it before
validateEvent
causes that method to returnfalse
. Settingevent.pubkey = pubkey
aftervalidateEvent
still produces the error...