Skip to content

Commit

Permalink
inherir properties from ndkevent when using from
Browse files Browse the repository at this point in the history
  • Loading branch information
pablof7z committed Jul 18, 2024
1 parent 709f9d7 commit 848abda
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion ndk/src/events/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ export class NDKEvent extends EventEmitter {
public publishStatus?: "pending" | "success" | "error" = "success";
public publishError?: Error;

constructor(ndk?: NDK, event?: NostrEvent) {
constructor(ndk?: NDK, event?: NostrEvent | NDKEvent) {
super();
this.ndk = ndk;
this.created_at = event?.created_at;
Expand All @@ -76,6 +76,13 @@ export class NDKEvent extends EventEmitter {
this.sig = event?.sig;
this.pubkey = event?.pubkey || "";
this.kind = event?.kind;

if (event instanceof NDKEvent) {
this.relay = event.relay;
this.onRelays = event.onRelays;
this.publishStatus = event.publishStatus;
this.publishError = event.publishError;
}
}

/**
Expand Down

0 comments on commit 848abda

Please sign in to comment.