# README
TzKT events wrapper
Golang library for TzKT events API
Usage
Full docs for TzKT API can be found here.
TzKT client
First of all, import library
import events "github.com/dipdup-net/go-lib/tzkt/events"
Then create TzKT
client, connect to server and subscribe to channels.
tzkt := events.NewTzKT(data.BaseEventsURL)
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
if err := tzkt.Connect(ctx); err != nil {
log.Panic(err)
}
defer tzkt.Close()
if err := tzkt.SubscribeToBlocks(); err != nil {
log.Panic(err)
}
Now, you can listen message channel
for msg := range tzkt.Listen() {
log.Println(msg)
}
Message is struct with fields:
type Message struct {
Channel string // is channel name: head, block or operations
Type MessageType // is message type: 0, 1 or 2 (state, data, reorg)
State uint64 // is current level
Body interface{} // is map or array of data depending of channel
}
SignalR
If you want to write custom client or re-use SignalR in another package you can import only signalr and use it.
import "github.com/dipdup-net/go-lib/tzkt/events/signalr"
client := signalr.NewSignalR("https://api.tzkt.io/v1/ws")
# Packages
No description provided by the author
# Functions
NewTzKT - constructor of `TzKT`.
# Constants
Big map tags.
Big map tags.
Channels.
Channels.
Channels.
Channels.
Channels.
Channels.
Channels.
Channels.
message types.
message types.
message types.
message types.
Methods.
Methods.
Methods.
Methods.
Methods.
Methods.
Methods.
Methods.
# Type aliases
MessageType - TzKT message type.