mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2026-08-12 09:13:23 +00:00
Quartz's PubKeyHintProvider / EventHintProvider / AddressHintProvider are the kind-agnostic answer to "what does this event point at" — they let a caller walk an event's references without knowing which tag name a given NIP chose (`p` vs `P` vs `member` vs `moderator`). Measured against the 248k-event corpus in commonTest, 84 of 403 event classes implement one, covering ~95% of all pointer edges. This closes the four largest remaining gaps. ReportEvent (1984) carried the most undeclared edges of any kind — 14,244 — and they are the negative trust signal that a web-of-trust projection most needs. Its tag classes also predate the modern layout, so they are brought up to the structure used by e.g. NIP-88 polls: - ReportedAuthorTag now implements PubKeyReferenceTag, ReportedEventTag implements GenericETag, and all three tags carry a relay hint. - Adds parseKey / parseId / parseAddressId / parseAsHint companions. Fixes a latent bug while doing so. NIP-56 predates the convention that slot 2 of a pointer tag is a relay hint — it put the report type there — so both layouts are in the wild. The old reader passed slot 2 straight to ReportType.parseOrNull, which despite its name never returns null and maps anything unrecognized to OTHER. A modern `["p", <pubkey>, "wss://relay/"]` tag therefore became an OTHER report and masked the event-level default. The new shared ReportTagLayout disambiguates by shape (a slot that parses as a relay URL is a hint, never a type) and falls back to the event-level default when a tag names no type of its own. Emitted tags are unchanged: assemble() still writes the legacy `[name, id, type]` form unless a relay hint is supplied, since many clients still read the report type out of slot 2. Also renames ReportedAuthorTag.pubkey to pubKey to satisfy PubKeyReferenceTag, updating the four call sites. Coverage over the corpus goes from ~95.3% to ~98.5% of pointer edges. What remains is GiftWrapEvent's recipient p-tag (deliberate — it is the store owner key and handled separately) and PrivateDmEvent's e-tags.