mirror of
https://github.com/OffchainLabs/prysm.git
synced 2026-01-08 23:18:15 -05:00
19 lines
713 B
Go
19 lines
713 B
Go
package node_client_factory
|
|
|
|
import (
|
|
"github.com/OffchainLabs/prysm/v7/config/features"
|
|
beaconApi "github.com/OffchainLabs/prysm/v7/validator/client/beacon-api"
|
|
grpcApi "github.com/OffchainLabs/prysm/v7/validator/client/grpc-api"
|
|
"github.com/OffchainLabs/prysm/v7/validator/client/iface"
|
|
validatorHelpers "github.com/OffchainLabs/prysm/v7/validator/helpers"
|
|
)
|
|
|
|
func NewNodeClient(validatorConn validatorHelpers.NodeConnection, jsonRestHandler beaconApi.RestHandler) iface.NodeClient {
|
|
grpcClient := grpcApi.NewNodeClient(validatorConn.GetGrpcClientConn())
|
|
if features.Get().EnableBeaconRESTApi {
|
|
return beaconApi.NewNodeClientWithFallback(jsonRestHandler, grpcClient)
|
|
} else {
|
|
return grpcClient
|
|
}
|
|
}
|