feat: diff-sync follows
This commit is contained in:
@ -2,7 +2,7 @@ import { EventKind, HexKey, NostrPrefix, NostrEvent, EventSigner, PowMiner } fro
|
||||
import { HashtagRegex, MentionNostrEntityRegex } from "./const";
|
||||
import { getPublicKey, jitter, unixNow } from "@snort/shared";
|
||||
import { EventExt } from "./event-ext";
|
||||
import { tryParseNostrLink } from "./nostr-link";
|
||||
import { NostrLink, tryParseNostrLink } from "./nostr-link";
|
||||
|
||||
export class EventBuilder {
|
||||
#kind?: EventKind;
|
||||
@ -14,6 +14,21 @@ export class EventBuilder {
|
||||
#powMiner?: PowMiner;
|
||||
#jitter?: number;
|
||||
|
||||
/**
|
||||
* Populate builder with values from link
|
||||
*/
|
||||
fromLink(link: NostrLink) {
|
||||
if (link.kind) {
|
||||
this.#kind = link.kind;
|
||||
}
|
||||
if (link.author) {
|
||||
this.#pubkey = link.author;
|
||||
}
|
||||
if (link.type === NostrPrefix.Address && link.id) {
|
||||
this.tag(["d", link.id]);
|
||||
}
|
||||
}
|
||||
|
||||
jitter(n: number) {
|
||||
this.#jitter = n;
|
||||
return this;
|
||||
|
Reference in New Issue
Block a user