@@ -37,6 +37,7 @@ import (
3737 "github.com/onflow/flow/protobuf/go/flow/executiondata"
3838
3939 "github.com/onflow/flow-go-sdk"
40+ base "github.com/onflow/flow-go-sdk/access"
4041 "github.com/onflow/flow-go-sdk/access/grpc/convert"
4142)
4243
@@ -50,31 +51,6 @@ type ExecutionDataRPCClient interface {
5051 executiondata.ExecutionDataAPIClient
5152}
5253
53- type SubscribeOption func (* SubscribeConfig )
54-
55- type SubscribeConfig struct {
56- heartbeatInterval uint64
57- grpcOpts []grpc.CallOption
58- }
59-
60- func DefaultSubscribeConfig () * SubscribeConfig {
61- return & SubscribeConfig {
62- heartbeatInterval : 100 ,
63- }
64- }
65-
66- func WithHeartbeatInterval (interval uint64 ) SubscribeOption {
67- return func (config * SubscribeConfig ) {
68- config .heartbeatInterval = interval
69- }
70- }
71-
72- func WithGRPCOptions (grpcOpts ... grpc.CallOption ) SubscribeOption {
73- return func (config * SubscribeConfig ) {
74- config .grpcOpts = grpcOpts
75- }
76- }
77-
7854// BaseClient is a gRPC client for the Flow Access API exposing all grpc specific methods.
7955//
8056// Use this client if you need advance access to the HTTP API. If you
@@ -89,7 +65,7 @@ type BaseClient struct {
8965
9066// NewBaseClient creates a new gRPC handler for network communication.
9167func NewBaseClient (url string , opts ... grpc.DialOption ) (* BaseClient , error ) {
92- conn , err := grpc .Dial (url , opts ... )
68+ conn , err := grpc .NewClient (url , opts ... )
9369 if err != nil {
9470 return nil , err
9571 }
@@ -1078,7 +1054,7 @@ func (c *BaseClient) SubscribeEventsByBlockID(
10781054 ctx context.Context ,
10791055 startBlockID flow.Identifier ,
10801056 filter flow.EventFilter ,
1081- opts ... SubscribeOption ,
1057+ opts ... base. SubscribeOption ,
10821058) (<- chan flow.BlockEvents , <- chan error , error ) {
10831059 req := executiondata.SubscribeEventsRequest {
10841060 StartBlockId : startBlockID [:],
@@ -1091,7 +1067,7 @@ func (c *BaseClient) SubscribeEventsByBlockHeight(
10911067 ctx context.Context ,
10921068 startHeight uint64 ,
10931069 filter flow.EventFilter ,
1094- opts ... SubscribeOption ,
1070+ opts ... base. SubscribeOption ,
10951071) (<- chan flow.BlockEvents , <- chan error , error ) {
10961072 req := executiondata.SubscribeEventsRequest {
10971073 StartBlockHeight : startHeight ,
@@ -1104,9 +1080,9 @@ func (c *BaseClient) subscribeEvents(
11041080 ctx context.Context ,
11051081 req * executiondata.SubscribeEventsRequest ,
11061082 filter flow.EventFilter ,
1107- opts ... SubscribeOption ,
1083+ opts ... base. SubscribeOption ,
11081084) (<- chan flow.BlockEvents , <- chan error , error ) {
1109- conf := DefaultSubscribeConfig ()
1085+ conf := base . DefaultSubscribeConfig ()
11101086 for _ , apply := range opts {
11111087 apply (conf )
11121088 }
@@ -1116,9 +1092,9 @@ func (c *BaseClient) subscribeEvents(
11161092 Address : filter .Addresses ,
11171093 Contract : filter .Contracts ,
11181094 }
1119- req .HeartbeatInterval = conf .heartbeatInterval
1095+ req .HeartbeatInterval = conf .HeartbeatInterval
11201096
1121- stream , err := c .executionDataClient .SubscribeEvents (ctx , req , conf .grpcOpts ... )
1097+ stream , err := c .executionDataClient .SubscribeEvents (ctx , req , conf .GrpcOpts ... )
11221098 if err != nil {
11231099 return nil , nil , err
11241100 }
0 commit comments