11/**
2- * Ground Truth Protocol Nostr event builders and parsers.
2+ * Anchr Nostr event builders and parsers.
33 *
44 * Uses NIP-90 Data Vending Machine (DVM) event kinds so that any
55 * DVM-aware client can discover and interact with Anchr queries.
66 *
77 * Event kind mapping (GT constant → DVM kind):
8- * GT_QUERY_REQUEST = 5300 (DVM Job Request)
9- * GT_QUERY_RESPONSE = 6300 (DVM Job Result)
10- * GT_QUERY_SETTLEMENT = 7000 (DVM Job Feedback)
8+ * ANCHR_QUERY_REQUEST = 5300 (DVM Job Request)
9+ * ANCHR_QUERY_RESPONSE = 6300 (DVM Job Result)
10+ * ANCHR_QUERY_SETTLEMENT = 7000 (DVM Job Feedback)
1111 *
1212 * OracleAttestation (30103) remains a custom parametric-replaceable kind.
1313 */
@@ -16,11 +16,10 @@ import { finalizeEvent, type EventTemplate, type VerifiedEvent } from "nostr-too
1616import type { NostrIdentity } from "./identity" ;
1717import { deriveConversationKey , encryptNip44 , decryptNip44 } from "./encryption" ;
1818
19- // NIP-90 DVM event kinds for Ground Truth Protocol.
20- // Constant names kept as GT_* for backward compat; values are DVM kinds.
21- export const GT_QUERY_REQUEST = 5300 ; // was 30100 → DVM Job Request
22- export const GT_QUERY_RESPONSE = 6300 ; // was 30101 → DVM Job Result
23- export const GT_QUERY_SETTLEMENT = 7000 ; // was 30102 → DVM Job Feedback
19+ // NIP-90 DVM event kinds for Anchr.
20+ export const ANCHR_QUERY_REQUEST = 5300 ; // DVM Job Request
21+ export const ANCHR_QUERY_RESPONSE = 6300 ; // DVM Job Result
22+ export const ANCHR_QUERY_SETTLEMENT = 7000 ; // DVM Job Feedback
2423
2524export interface QueryRequestPayload {
2625 type : string ;
@@ -65,7 +64,7 @@ export interface QuerySettlementPayload {
6564 * ["output", "application/json"] - expected result MIME type
6665 * ["encrypted"] - signals that the result should be NIP-44 encrypted
6766 * ["d", <queryId>] - deduplication / replaceable-event tag
68- * ["t", "ground-truth"] - protocol marker
67+ * ["t", "anchr"] - protocol marker
6968 * ["t", <query_type>] - query type tag
7069 * ["expiration", <unix>] - NIP-40 expiration
7170 * ["region", <code>] - optional region filter
@@ -87,7 +86,7 @@ export function buildQueryRequestEvent(
8786 [ "output" , "application/json" ] ,
8887 [ "encrypted" ] ,
8988 [ "d" , queryId ] ,
90- [ "t" , "ground-truth " ] ,
89+ [ "t" , "anchr " ] ,
9190 [ "t" , payload . type ] ,
9291 [ "expiration" , String ( Math . floor ( payload . expires_at / 1000 ) ) ] ,
9392 ] ;
@@ -102,7 +101,7 @@ export function buildQueryRequestEvent(
102101 }
103102
104103 const template : EventTemplate = {
105- kind : GT_QUERY_REQUEST ,
104+ kind : ANCHR_QUERY_REQUEST ,
106105 created_at : Math . floor ( Date . now ( ) / 1000 ) ,
107106 tags,
108107 content : JSON . stringify ( payload ) ,
@@ -136,7 +135,7 @@ export function buildQueryResponseEvent(
136135 const encrypted = encryptNip44 ( JSON . stringify ( payload ) , conversationKey ) ;
137136
138137 const template : EventTemplate = {
139- kind : GT_QUERY_RESPONSE ,
138+ kind : ANCHR_QUERY_RESPONSE ,
140139 created_at : Math . floor ( Date . now ( ) / 1000 ) ,
141140 tags : [
142141 [ "e" , queryEventId ] ,
@@ -163,7 +162,7 @@ export function buildQuerySettlementEvent(
163162 const encrypted = encryptNip44 ( JSON . stringify ( payload ) , conversationKey ) ;
164163
165164 const template : EventTemplate = {
166- kind : GT_QUERY_SETTLEMENT ,
165+ kind : ANCHR_QUERY_SETTLEMENT ,
167166 created_at : Math . floor ( Date . now ( ) / 1000 ) ,
168167 tags : [
169168 [ "e" , queryEventId ] ,
0 commit comments