Skip to content

Commit 8205dc3

Browse files
committed
fix: avoid json intermediary for payload parsing
Signed-off-by: Chris Gianelloni <[email protected]>
1 parent a7c6c8c commit 8205dc3

File tree

1 file changed

+2
-13
lines changed

1 file changed

+2
-13
lines changed

output/notify/notify.go

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
package notify
1616

1717
import (
18-
"encoding/json"
1918
"fmt"
2019

2120
"github.com/blinklabs-io/snek/event"
@@ -55,18 +54,8 @@ func (n *NotifyOutput) Start() error {
5554
panic(fmt.Errorf("ERROR: %v", payload))
5655
}
5756

58-
data, err := json.Marshal(payload)
59-
if err != nil {
60-
panic(err)
61-
}
62-
63-
var be chainsync.BlockEvent
64-
err = json.Unmarshal(data, &be)
65-
if err != nil {
66-
panic(err)
67-
}
68-
69-
err = beeep.Notify(
57+
be := payload.(chainsync.BlockEvent)
58+
err := beeep.Notify(
7059
"Snek",
7160
fmt.Sprintf("New Block!\nBlockNumber: %d, SlotNumber: %d\nHash: %s",
7261
be.BlockNumber,

0 commit comments

Comments
 (0)