From 92d1944e69da009978f1bf597d635dfae3d0e38f Mon Sep 17 00:00:00 2001 From: Daniele Tonon Date: Wed, 30 Aug 2023 18:29:54 +0200 Subject: [PATCH] Replace nson.Marshal with json one Because: > note1lykvtd827lg6eqmgajqxkwau56fwx00u4z950sdqaah35jp3g3rqru9tj7 "it's a giant event broke my nson" --- nostr.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/nostr.go b/nostr.go index 7e98fcd..85197d6 100644 --- a/nostr.go +++ b/nostr.go @@ -2,6 +2,7 @@ package main import ( "context" + "encoding/json" "fmt" "math/rand" "time" @@ -9,7 +10,6 @@ import ( "github.com/nbd-wtf/go-nostr" "github.com/nbd-wtf/go-nostr/nip05" "github.com/nbd-wtf/go-nostr/nip19" - "github.com/nbd-wtf/go-nostr/nson" "github.com/nbd-wtf/go-nostr/sdk" "golang.org/x/exp/slices" ) @@ -59,7 +59,7 @@ func getRelay() string { func getEvent(ctx context.Context, code string) (*nostr.Event, error) { if b, ok := cache.Get(code); ok { v := &nostr.Event{} - err := nson.Unmarshal(string(b), v) + err := json.Unmarshal(b, v) return v, err } @@ -128,7 +128,7 @@ func getEvent(ctx context.Context, code string) (*nostr.Event, error) { ctx, cancel := context.WithTimeout(ctx, time.Second*8) defer cancel() if evt := pool.QuerySingle(ctx, relays, filter); evt != nil { - b, err := nson.Marshal(evt) + b, err := json.Marshal(evt) if err != nil { log.Error().Err(err).Stringer("event", evt).Msg("error marshaling nson") return evt, nil