Skip to content

Commit

Permalink
event support
Browse files Browse the repository at this point in the history
  • Loading branch information
AugustDev committed Dec 26, 2022
1 parent 5b15525 commit 4d08a17
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
11 changes: 11 additions & 0 deletions tzkt/data/general.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"`
}
1 change: 1 addition & 0 deletions tzkt/events/consts.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ const (
ChannelBigMap = "bigmaps"
ChannelAccounts = "accounts"
ChannelTransfers = "transfers"
ChannelEvents = "events"
)

// Big map tags
Expand Down
6 changes: 5 additions & 1 deletion tzkt/events/tzkt.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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)
}
Expand Down

0 comments on commit 4d08a17

Please sign in to comment.