Skip to content

Commit 9cc5468

Browse files
Feaature: TzKT events accounts channel
1 parent 76704ff commit 9cc5468

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

tzkt/events/consts.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ const (
66
MethodBlocks = "SubscribeToBlocks"
77
MethodOperations = "SubscribeToOperations"
88
MethodBigMap = "SubscribeToBigMaps"
9+
MethodAccounts = "SubscribeToAccounts"
910
)
1011

1112
// Channels
@@ -14,6 +15,7 @@ const (
1415
ChannelBlocks = "blocks"
1516
ChannelOperations = "operations"
1617
ChannelBigMap = "bigmaps"
18+
ChannelAccounts = "accounts"
1719
)
1820

1921
// operation kinds

tzkt/events/tzkt.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,15 @@ func (tzkt *TzKT) SubscribeToBigMaps(ptr *int64, contract, path string, tags ...
104104
return tzkt.subscribe(MethodBigMap, args)
105105
}
106106

107+
// SubscribeToBigMaps - subscribe to accounts channel. Sends touched accounts (affected by any operation in any way)..
108+
func (tzkt *TzKT) SubscribeToAccounts(addresses ...string) error {
109+
args := make(map[string]interface{})
110+
if len(addresses) > 0 {
111+
args["addresses"] = addresses
112+
}
113+
return tzkt.subscribe(MethodAccounts, args)
114+
}
115+
107116
func (tzkt *TzKT) subscribe(channel string, args ...interface{}) error {
108117
tzkt.invokationID += 1
109118
msg := signalr.NewInvocation(fmt.Sprintf("%d", tzkt.invokationID), channel, args...)

0 commit comments

Comments
 (0)