fixing kind.T references

This commit is contained in:
mleku
2023-11-23 11:26:38 +00:00
parent 6f20a08f30
commit 84de9d4625
2 changed files with 5 additions and 3 deletions

View File

@@ -5,6 +5,7 @@ import (
"encoding/hex"
"fmt"
"github.com/mleku/replicatr/pkg/jsontext"
"github.com/mleku/replicatr/pkg/nostr/kind"
"github.com/mailru/easyjson"
btcec "github.com/mleku/ec"
@@ -25,7 +26,7 @@ type Event struct {
CreatedAt Timestamp `json:"created_at"`
// Kind is the nostr protocol code for the type of event. See kind.T
Kind int `json:"kind"`
Kind kind.T `json:"kind"`
// Tags are a list of tags, which are a list of strings usually structured
// as a 3 layer scheme indicating specific features of an event.

View File

@@ -4,6 +4,7 @@ package nostr
import (
json "encoding/json"
"github.com/mleku/replicatr/pkg/nostr/kind"
easyjson "github.com/mailru/easyjson"
jlexer "github.com/mailru/easyjson/jlexer"
@@ -45,7 +46,7 @@ func easyjsonF642ad3eDecodeGithubComNbdWtfGoNostr(in *jlexer.Lexer, out *Event)
case "created_at":
out.CreatedAt = Timestamp(in.Int64())
case "kind":
out.Kind = in.Int()
out.Kind = kind.T(in.Int())
case "tags":
if in.IsNull() {
in.Skip()
@@ -127,7 +128,7 @@ func easyjsonF642ad3eEncodeGithubComNbdWtfGoNostr(out *jwriter.Writer, in Event)
{
const prefix string = ",\"kind\":"
out.RawString(prefix)
out.Int(in.Kind)
out.Int(int(in.Kind))
}
{
const prefix string = ",\"tags\":"