mirror of
https://github.com/nbd-wtf/go-nostr.git
synced 2025-11-15 16:50:16 +01:00
sdk: fix fetching specific event from note1 codes.
This commit is contained in:
@@ -19,15 +19,15 @@ func (sys *System) FetchSpecificEventFromInput(
|
|||||||
) (event *nostr.Event, successRelays []string, err error) {
|
) (event *nostr.Event, successRelays []string, err error) {
|
||||||
var pointer nostr.Pointer
|
var pointer nostr.Pointer
|
||||||
|
|
||||||
_, data, err := nip19.Decode(input)
|
prefix, data, err := nip19.Decode(input)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
switch p := data.(type) {
|
switch prefix {
|
||||||
case nostr.EventPointer:
|
case "nevent":
|
||||||
pointer = p
|
pointer = data.(nostr.EventPointer)
|
||||||
case nostr.EntityPointer:
|
case "naddr":
|
||||||
pointer = p
|
pointer = data.(nostr.EntityPointer)
|
||||||
case string:
|
case "note":
|
||||||
pointer = nostr.EventPointer{ID: input}
|
pointer = nostr.EventPointer{ID: data.(string)}
|
||||||
default:
|
default:
|
||||||
return nil, nil, fmt.Errorf("invalid code '%s'", input)
|
return nil, nil, fmt.Errorf("invalid code '%s'", input)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user