helpers

package
v7.1.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 9, 2026 License: GPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EpochFromString

func EpochFromString(str string) (primitives.Epoch, error)

EpochFromString converts a string into Epoch.

func PubKeyFromHex

func PubKeyFromHex(str string) ([fieldparams.BLSPubkeyLength]byte, error)

PubKeyFromHex takes in a hex string, verifies its length as 48 bytes, and converts that representation.

func PubKeyToHexString

func PubKeyToHexString(pubKey []byte) (string, error)

func RootFromHex

func RootFromHex(str string) ([32]byte, error)

RootFromHex takes in a hex string, verifies its length as 32 bytes, and converts that representation.

func RootToHexString

func RootToHexString(root []byte) (string, error)

func SlotFromString

func SlotFromString(str string) (primitives.Slot, error)

SlotFromString converts a string into Slot.

func Uint64FromString

func Uint64FromString(str string) (uint64, error)

Uint64FromString converts a string into a uint64 representation.

func ValidateMetadata

func ValidateMetadata(ctx context.Context, validatorDB iface.ValidatorDB, interchangeJSON *format.EIPSlashingProtectionFormat) error

Types

type NodeConnection

type NodeConnection interface {
	// GetGrpcClientConn returns the current gRPC client connection.
	// Returns nil if no gRPC provider is configured.
	GetGrpcClientConn() *grpc.ClientConn
	// GetGrpcConnectionProvider returns the gRPC connection provider.
	GetGrpcConnectionProvider() grpcutil.GrpcConnectionProvider
	// GetRestConnectionProvider returns the REST connection provider.
	GetRestConnectionProvider() rest.RestConnectionProvider
	// GetRestHandler returns the REST handler for making API requests.
	// Returns nil if no REST provider is configured.
	GetRestHandler() rest.Handler
}

NodeConnection provides access to both gRPC and REST API connections to a beacon node.

func NewNodeConnection

func NewNodeConnection(opts ...NodeConnectionOption) (NodeConnection, error)

NewNodeConnection creates a new NodeConnection with the given options. At least one provider (gRPC or REST) must be configured via options. Returns an error if no providers are configured.

type NodeConnectionOption

type NodeConnectionOption func(*nodeConnection) error

NodeConnectionOption is a functional option for configuring a NodeConnection.

func WithGRPC added in v7.1.3

func WithGRPC(ctx context.Context, endpoint string, dialOpts []grpc.DialOption) NodeConnectionOption

WithGRPC configures a gRPC connection provider for the NodeConnection. If endpoint is empty, this option is a no-op.

func WithGRPCProvider added in v7.1.3

func WithGRPCProvider(provider grpcutil.GrpcConnectionProvider) NodeConnectionOption

WithGRPCProvider sets a pre-built gRPC connection provider.

func WithREST added in v7.1.3

WithREST configures a REST connection provider for the NodeConnection. If endpoint is empty, this option is a no-op.

func WithRestProvider added in v7.1.3

func WithRestProvider(provider rest.RestConnectionProvider) NodeConnectionOption

WithRestProvider sets a pre-built REST connection provider.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL