fix type assertions from [32]byte to nostr.PubKey or nostr.ID.
This commit is contained in:
@@ -40,13 +40,13 @@ func ToPointer(code string) (nostr.Pointer, error) {
|
||||
|
||||
switch prefix {
|
||||
case "npub":
|
||||
return nostr.ProfilePointer{PublicKey: data.([32]byte)}, nil
|
||||
return nostr.ProfilePointer{PublicKey: data.(nostr.PubKey)}, nil
|
||||
case "nprofile":
|
||||
return data.(nostr.ProfilePointer), nil
|
||||
case "nevent":
|
||||
return data.(nostr.EventPointer), nil
|
||||
case "note":
|
||||
return nostr.EventPointer{ID: data.([32]byte)}, nil
|
||||
return nostr.EventPointer{ID: data.(nostr.ID)}, nil
|
||||
case "naddr":
|
||||
return data.(nostr.EntityPointer), nil
|
||||
default:
|
||||
|
||||
@@ -45,7 +45,7 @@ func InputToEventPointer(input string) *nostr.EventPointer {
|
||||
prefix, data, _ := nip19.Decode(input)
|
||||
switch prefix {
|
||||
case "note":
|
||||
return &nostr.EventPointer{ID: data.([32]byte)}
|
||||
return &nostr.EventPointer{ID: data.(nostr.ID)}
|
||||
case "nevent":
|
||||
if ep, ok := data.(nostr.EventPointer); ok {
|
||||
return &ep
|
||||
|
||||
@@ -41,7 +41,7 @@ func (sys *System) FetchSpecificEventFromInput(
|
||||
case "naddr":
|
||||
pointer = data.(nostr.EntityPointer)
|
||||
case "note":
|
||||
pointer = nostr.EventPointer{ID: data.([32]byte)}
|
||||
pointer = nostr.EventPointer{ID: data.(nostr.ID)}
|
||||
default:
|
||||
return nil, nil, fmt.Errorf("invalid code '%s'", input)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user