From 4d08a1770b9a279b402614e1dcaf2cff88fb08e7 Mon Sep 17 00:00:00 2001 From: Augustinas Malinauskas Date: Mon, 26 Dec 2022 00:38:43 +0000 Subject: [PATCH] event support --- tzkt/data/general.go | 11 +++++++++++ tzkt/events/consts.go | 1 + tzkt/events/tzkt.go | 6 +++++- 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/tzkt/data/general.go b/tzkt/data/general.go index 3f1fef3..c6952ae 100644 --- a/tzkt/data/general.go +++ b/tzkt/data/general.go @@ -160,3 +160,14 @@ type Statistics struct { TotalVested uint64 `json:"totalVested"` Quote *Quote `json:"quote,omitempty"` } + +type Event struct { + Id int `json:"id"` + Level int `json:"level"` + Timestamp time.Time `json:"timestamp"` + Contract Address `json:"contract"` + CodeHash int `json:"codeHash"` + Tag string `json:"tag"` + Payload interface{} `json:"payload,omitempty"` + TransactionId int64 `json:"transactionId"` +} diff --git a/tzkt/events/consts.go b/tzkt/events/consts.go index 42ad39b..7221ae6 100644 --- a/tzkt/events/consts.go +++ b/tzkt/events/consts.go @@ -19,6 +19,7 @@ const ( ChannelBigMap = "bigmaps" ChannelAccounts = "accounts" ChannelTransfers = "transfers" + ChannelEvents = "events" ) // Big map tags diff --git a/tzkt/events/tzkt.go b/tzkt/events/tzkt.go index e236835..c5f8c3d 100644 --- a/tzkt/events/tzkt.go +++ b/tzkt/events/tzkt.go @@ -9,7 +9,7 @@ import ( "github.com/dipdup-net/go-lib/tzkt/events/signalr" - tzktData "github.com/dipdup-net/go-lib/tzkt/data" + tzktData "github.com/art-technologies/go-lib/tzkt/data" "github.com/pkg/errors" "github.com/rs/zerolog" "github.com/rs/zerolog/log" @@ -255,6 +255,10 @@ func parseData(channel string, data []byte) (any, error) { var transfer []tzktData.Transfer err := json.Unmarshal(data, &transfer) return transfer, err + case ChannelEvents: + var events []tzktData.Event + err := json.Unmarshal(data, &events) + return events, err default: return nil, errors.Errorf("unknown channel: %s", channel) }