Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ func (c *ExecutionDataClient) SubscribeEvents(
startBlockID flow.Identifier,
startHeight uint64,
filter EventFilter,
heartbeatInterval uint64,
opts ...grpc.CallOption,
) (*Subscription[EventsResponse], error) {
if startBlockID != flow.ZeroID && startHeight > 0 {
Expand All @@ -149,6 +150,7 @@ func (c *ExecutionDataClient) SubscribeEvents(
Address: filter.Addresses,
Contract: filter.Contracts,
},
HeartbeatInterval: heartbeatInterval,
}
if startBlockID != flow.ZeroID {
req.StartBlockId = startBlockID[:]
Expand Down
2 changes: 1 addition & 1 deletion cmd/demo/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ func main() {
}

func followBlocks(ctx context.Context, execClient *client.ExecutionDataClient, filter client.EventFilter) error {
sub, err := execClient.SubscribeEvents(ctx, flow.ZeroID, 0, filter)
sub, err := execClient.SubscribeEvents(ctx, flow.ZeroID, 0, filter, 1)
if err != nil {
return fmt.Errorf("could not subscribe to execution data: %w", err)
}
Expand Down
12 changes: 9 additions & 3 deletions examples/events_streaming/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,15 @@ func main() {
log.Fatalf("could not create execution data client: %v", err)
}

sub, err := execClient.SubscribeEvents(ctx, flow.ZeroID, 0, client.EventFilter{
Contracts: []string{"A.7e60df042a9c0868.FlowToken"},
})
sub, err := execClient.SubscribeEvents(
ctx,
flow.ZeroID,
0,
client.EventFilter{
Contracts: []string{"A.7e60df042a9c0868.FlowToken"},
},
1,
)
if err != nil {
log.Fatalf("could not subscribe to execution data: %v", err)
}
Expand Down
17 changes: 9 additions & 8 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ go 1.19

require (
github.com/gorilla/websocket v1.5.0
github.com/onflow/flow-go v0.32.9
github.com/onflow/flow/protobuf/go/flow v0.3.2-0.20231018182244-e72527c55c63
github.com/onflow/flow-go v0.32.4-0.20231122162232-0ba81ff8d241
github.com/onflow/flow/protobuf/go/flow v0.3.2-0.20231121210617-52ee94b830c2
google.golang.org/grpc v1.58.3
)

require (
github.com/bits-and-blooms/bitset v1.5.0 // indirect
github.com/bits-and-blooms/bitset v1.7.0 // indirect
github.com/btcsuite/btcd/btcec/v2 v2.2.1 // indirect
github.com/cenkalti/backoff/v4 v4.2.1 // indirect
github.com/cespare/xxhash v1.1.0 // indirect
Expand All @@ -21,19 +21,20 @@ require (
github.com/dgraph-io/ristretto v0.0.3-0.20200630154024-f66de99634de // indirect
github.com/dgryski/go-farm v0.0.0-20190423205320-6a90982ecee2 // indirect
github.com/dustin/go-humanize v1.0.1 // indirect
github.com/ethereum/go-ethereum v1.9.13 // indirect
github.com/ethereum/go-ethereum v1.12.0 // indirect
github.com/frankban/quicktest v1.14.4 // indirect
github.com/fxamacker/cbor/v2 v2.4.1-0.20230228173756-c0c9f774e40c // indirect
github.com/fxamacker/circlehash v0.3.0 // indirect
github.com/go-logr/logr v1.2.4 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/protobuf v1.5.3 // indirect
github.com/golang/snappy v0.0.4 // indirect
github.com/golang/snappy v0.0.5-0.20220116011046-fa5810519dcb // indirect
github.com/google/uuid v1.3.0 // indirect
github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0 // indirect
github.com/hashicorp/golang-lru v0.5.4 // indirect
github.com/hashicorp/golang-lru/v2 v2.0.2 // indirect
github.com/holiman/uint256 v1.2.2-0.20230321075855-87b91420868c // indirect
github.com/ipfs/bbloom v0.0.4 // indirect
github.com/ipfs/go-block-format v0.1.2 // indirect
github.com/ipfs/go-cid v0.4.1 // indirect
Expand Down Expand Up @@ -99,12 +100,12 @@ require (
go.uber.org/atomic v1.11.0 // indirect
go.uber.org/multierr v1.11.0 // indirect
go.uber.org/zap v1.24.0 // indirect
golang.org/x/crypto v0.11.0 // indirect
golang.org/x/crypto v0.12.0 // indirect
golang.org/x/exp v0.0.0-20230321023759-10a507213a29 // indirect
golang.org/x/net v0.12.0 // indirect
golang.org/x/sync v0.3.0 // indirect
golang.org/x/sys v0.10.0 // indirect
golang.org/x/text v0.11.0 // indirect
golang.org/x/sys v0.11.0 // indirect
golang.org/x/text v0.12.0 // indirect
golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/genproto v0.0.0-20230711160842-782d3b101e98 // indirect
Expand Down
Loading