Nostr relay publish for outbound Timmy events — zap + DM broadcast #51

Open
opened 2026-03-19 19:32:55 +00:00 by replit · 0 comments
Owner

Background

Task #29 creates signed Nostr events (zap requests kind 9734, DMs kind 4) and logs them to timmy_nostr_events. When NOSTR_RELAY_URL is set, EngagementService POSTs DMs to the relay, but ZapService does not. Relay communication should be centralised and robust.

Acceptance Criteria

  • Extract a NostrRelayClient singleton (artifacts/api-server/src/lib/nostr-relay.ts) that wraps WebSocket or HTTP POST to NOSTR_RELAY_URL
  • Implements exponential back-off retry (3 attempts, max 10s)
  • ZapService.sendZap() calls nostrRelayClient.publish(event) after logging
  • EngagementService.sendDm() uses the same client
  • GET /api/identity/timmy response includes relayUrl (or null) so the frontend can display relay connectivity status
  • Relay URL validated at startup (reachable check, warn if not)

Relevant files

  • artifacts/api-server/src/lib/zap.ts
  • artifacts/api-server/src/lib/engagement.ts
  • artifacts/api-server/src/routes/identity.ts
## Background Task #29 creates signed Nostr events (zap requests kind 9734, DMs kind 4) and logs them to `timmy_nostr_events`. When `NOSTR_RELAY_URL` is set, EngagementService POSTs DMs to the relay, but ZapService does not. Relay communication should be centralised and robust. ## Acceptance Criteria - [ ] Extract a `NostrRelayClient` singleton (`artifacts/api-server/src/lib/nostr-relay.ts`) that wraps WebSocket or HTTP POST to `NOSTR_RELAY_URL` - [ ] Implements exponential back-off retry (3 attempts, max 10s) - [ ] `ZapService.sendZap()` calls `nostrRelayClient.publish(event)` after logging - [ ] `EngagementService.sendDm()` uses the same client - [ ] `GET /api/identity/timmy` response includes `relayUrl` (or null) so the frontend can display relay connectivity status - [ ] Relay URL validated at startup (reachable check, warn if not) ## Relevant files - `artifacts/api-server/src/lib/zap.ts` - `artifacts/api-server/src/lib/engagement.ts` - `artifacts/api-server/src/routes/identity.ts`
replit added the integrationhermesbackendtimmy labels 2026-03-19 19:33:31 +00:00
gemini was assigned by Rockachopa 2026-03-22 23:37:58 +00:00
This repo is archived. You cannot comment on issues.