Add NIP-22 support

This commit is contained in:
dtonon
2025-01-01 20:30:54 +01:00
committed by fiatjaf_
parent ef0717afb6
commit dcd5030fcd
3 changed files with 48 additions and 0 deletions

23
sdk/thread.go Normal file
View File

@@ -0,0 +1,23 @@
package sdk
import (
"github.com/nbd-wtf/go-nostr"
"github.com/nbd-wtf/go-nostr/nip10"
"github.com/nbd-wtf/go-nostr/nip22"
)
func GetThreadRoot(evt *nostr.Event) *nostr.Tag {
if evt.Kind == nostr.KindComment {
return nip22.GetThreadRoot(evt.Tags)
} else {
return nip10.GetThreadRoot(evt.Tags)
}
}
func GetImmediateReply(evt *nostr.Event) *nostr.Tag {
if evt.Kind == nostr.KindComment {
return nip22.GetImmediateReply(evt.Tags)
} else {
return nip10.GetImmediateReply(evt.Tags)
}
}