nip29: fix group address parsing and encoding order.

This commit is contained in:
fiatjaf
2024-05-24 15:13:05 -03:00
parent e1ae36ceb2
commit 8897cc36e4
2 changed files with 4 additions and 4 deletions

View File

@@ -15,7 +15,7 @@ type GroupAddress struct {
func (gid GroupAddress) String() string {
p, _ := url.Parse(gid.Relay)
return fmt.Sprintf("%s'%s", gid.ID, p.Host)
return fmt.Sprintf("%s'%s", p.Host, gid.ID)
}
func (gid GroupAddress) IsValid() bool {
@@ -31,7 +31,7 @@ func ParseGroupAddress(raw string) (GroupAddress, error) {
if len(spl) != 2 {
return GroupAddress{}, fmt.Errorf("invalid group id")
}
return GroupAddress{ID: spl[0], Relay: nostr.NormalizeURL(spl[1])}, nil
return GroupAddress{ID: spl[1], Relay: nostr.NormalizeURL(spl[0])}, nil
}
type Group struct {