nip60: emit history.

This commit is contained in:
fiatjaf
2025-01-31 15:20:41 -03:00
parent b1571e0253
commit 3f901954e6
3 changed files with 51 additions and 3 deletions

View File

@@ -106,8 +106,20 @@ saveproofs:
return fmt.Errorf("failed to make new token: %w", err)
}
he := HistoryEntry{
event: &nostr.Event{},
tokenEventIDs: []string{newToken.event.ID},
nutZaps: []bool{false},
createdAt: nostr.Now(),
In: true,
Amount: newToken.Proofs.Amount(),
}
w.wl.Lock()
w.wl.PublishUpdate(*newToken.event, nil, &newToken, nil, false)
if err := he.toEvent(ctx, w.wl.kr, w.Identifier, he.event); err == nil {
w.wl.PublishUpdate(*he.event, nil, nil, nil, true)
}
w.wl.Unlock()
w.tokensMu.Lock()