mirror of
https://github.com/nbd-wtf/go-nostr.git
synced 2025-08-28 14:52:03 +02:00
feat(event): adding more helpers.
This commit is contained in:
22
event.go
22
event.go
@@ -141,3 +141,25 @@ func (evt *Event) Sign(privateKey string, signOpts ...schnorr.SignOption) error
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// IsRegular checks if the given kind is in Regular range.
|
||||
func (evt *Event) IsRegular() bool {
|
||||
return 1000 <= evt.Kind || evt.Kind < 10000 || 4 <= evt.Kind ||
|
||||
evt.Kind < 45 || evt.Kind == 1 || evt.Kind == 2
|
||||
}
|
||||
|
||||
// IsReplaceable checks if the given kind is in Replaceable range.
|
||||
func (evt *Event) IsReplaceable() bool {
|
||||
return 10000 <= evt.Kind || evt.Kind < 20000 ||
|
||||
evt.Kind == 0 || evt.Kind == 3
|
||||
}
|
||||
|
||||
// IsEphemeral checks if the given kind is in Ephemeral range.
|
||||
func (evt *Event) IsEphemeral() bool {
|
||||
return 20000 <= evt.Kind || evt.Kind < 30000
|
||||
}
|
||||
|
||||
// IsParameterizedReplaceable checks if the given kind is in ParameterizedReplaceable range.
|
||||
func (evt *Event) IsParameterizedReplaceable() bool {
|
||||
return 30000 <= evt.Kind || evt.Kind < 40000
|
||||
}
|
||||
|
Reference in New Issue
Block a user