diff --git a/gateway/grpc.go b/gateway/grpc.go index 68072609..54ef3dec 100644 --- a/gateway/grpc.go +++ b/gateway/grpc.go @@ -29,7 +29,6 @@ import ( grpcAccess "github.com/onflow/flow-go-sdk/access/grpc" "github.com/onflow/flow-go/utils/grpcutils" "google.golang.org/grpc" - "google.golang.org/grpc/credentials/insecure" "github.com/onflow/flowkit/v2/config" ) @@ -45,18 +44,17 @@ type GrpcGateway struct { // NewGrpcGateway returns a new gRPC gateway. -func NewGrpcGateway(network config.Network, opts ...grpc.DialOption) (*GrpcGateway, error) { - options := []grpc.DialOption{ +func NewGrpcGateway(network config.Network, opts ...grpcAccess.ClientOption) (*GrpcGateway, error) { + opts = append( + opts, + grpcAccess.WithGRPCDialOptions( + grpc.WithDefaultCallOptions(grpc.MaxCallRecvMsgSize(maxGRPCMessageSize), + ), + )) - grpc.WithTransportCredentials(insecure.NewCredentials()), - grpc.WithDefaultCallOptions(grpc.MaxCallRecvMsgSize(maxGRPCMessageSize)), - } - options = append(options, opts...) gClient, err := grpcAccess.NewClient( network.Host, - grpcAccess.WithGRPCDialOptions( - options..., - ), + opts..., ) if err != nil || gClient == nil {