@@ -45,13 +45,17 @@ type GrpcGateway struct {
45
45
}
46
46
47
47
// NewGrpcGateway returns a new gRPC gateway.
48
- func NewGrpcGateway (network config.Network ) (* GrpcGateway , error ) {
49
-
50
- gClient , err := grpcAccess .NewClient (
51
- network .Host ,
48
+ func NewGrpcGateway (network config.Network , opts ... grpc.DialOption ) (* GrpcGateway , error ) {
49
+ options := []grpc.DialOption {
52
50
grpc .WithTransportCredentials (insecure .NewCredentials ()),
53
51
grpc .WithDefaultCallOptions (grpc .MaxCallRecvMsgSize (maxGRPCMessageSize )),
52
+ }
53
+ options = append (options , opts ... )
54
+ gClient , err := grpcAccess .NewClient (
55
+ network .Host ,
56
+ options ... ,
54
57
)
58
+
55
59
ctx := context .Background ()
56
60
57
61
if err != nil || gClient == nil {
@@ -66,17 +70,23 @@ func NewGrpcGateway(network config.Network) (*GrpcGateway, error) {
66
70
}
67
71
68
72
// NewSecureGrpcGateway returns a new gRPC gateway with a secure client connection.
69
- func NewSecureGrpcGateway (network config.Network ) (* GrpcGateway , error ) {
73
+ func NewSecureGrpcGateway (network config.Network , opts ... grpc. DialOption ) (* GrpcGateway , error ) {
70
74
secureDialOpts , err := grpcutils .SecureGRPCDialOpt (strings .TrimPrefix (network .Key , "0x" ))
71
75
if err != nil {
72
76
return nil , fmt .Errorf ("failed to create secure GRPC dial options with network key \" %s\" : %w" , network .Key , err )
73
77
}
74
78
75
- gClient , err := grpcAccess .NewClient (
76
- network .Host ,
79
+ options := []grpc.DialOption {
77
80
secureDialOpts ,
78
81
grpc .WithDefaultCallOptions (grpc .MaxCallRecvMsgSize (maxGRPCMessageSize )),
82
+ }
83
+ options = append (options , opts ... )
84
+
85
+ gClient , err := grpcAccess .NewClient (
86
+ network .Host ,
87
+ options ... ,
79
88
)
89
+
80
90
ctx := context .Background ()
81
91
82
92
if err != nil || gClient == nil {
@@ -174,7 +184,6 @@ func (g *GrpcGateway) GetEvents(
174
184
startHeight uint64 ,
175
185
endHeight uint64 ,
176
186
) ([]flow.BlockEvents , error ) {
177
-
178
187
events , err := g .client .GetEventsForHeightRange (
179
188
g .ctx ,
180
189
eventType ,
0 commit comments