eth2http

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Aug 31, 2023 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EthCLAddrFlag added in v0.3.1

func EthCLAddrFlag(v *viper.Viper, f *pflag.FlagSet)

EthCLAddrFlag register flag for Eth1 node to connect to

func Flags added in v0.3.1

func Flags(v *viper.Viper, f *pflag.FlagSet)

func GetCLAddr added in v0.3.1

func GetCLAddr(v *viper.Viper) string

func InspectGetBlockRootResponse

func InspectGetBlockRootResponse(resp *http.Response) (*beaconcommon.Root, error)

func WithBeaconErrorUnlessOK

func WithBeaconErrorUnlessOK() autorest.RespondDecorator

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client provides methods to connect to an Ethereum 2.0 Beacon chain node

func NewClient

func NewClient(cfg *Config) (*Client, error)

NewClient creates a client connecting to an Ethereum 2.0 Beacon chain node at given addr

func NewClientFromClient

func NewClientFromClient(s autorest.Sender) *Client

func (*Client) GetAttestations

func (c *Client) GetAttestations(ctx context.Context) (beaconphase0.Attestations, error)

GetAttestations returns attestations known by the node but not necessarily incorporated into any block.

func (*Client) GetAttesterSlashings

func (c *Client) GetAttesterSlashings(ctx context.Context) (beaconphase0.AttesterSlashings, error)

GetAttesterSlashings returns attester slashings known by the node but not necessarily incorporated into any block.

func (*Client) GetBlock

func (c *Client) GetBlock(ctx context.Context, blockID string) (*bellatrix.SignedBeaconBlock, error)

GetBlock returns block details for given block id.

func (*Client) GetBlockAttestations

func (c *Client) GetBlockAttestations(ctx context.Context, blockID string) (beaconphase0.Attestations, error)

GetBlockAttestations returns attestations included in requested block with given blockID

func (*Client) GetBlockHeader

func (c *Client) GetBlockHeader(ctx context.Context, blockID string) (*types.BeaconBlockHeader, error)

GetBlockHeader returns block header for given blockID

func (*Client) GetBlockHeaders

func (c *Client) GetBlockHeaders(ctx context.Context, slot *beaconcommon.Slot, parentRoot *beaconcommon.Root) ([]*types.BeaconBlockHeader, error)

GetBlockHeaders return block headers Set slot and/or parentRoot to filter result (if nil no filter is applied)

func (*Client) GetBlockRoot

func (c *Client) GetBlockRoot(ctx context.Context, blockID string) (*beaconcommon.Root, error)

GetBlockRoot returns hashTreeRoot of block

func (*Client) GetCommittees

func (c *Client) GetCommittees(ctx context.Context, stateID string, epoch *beaconcommon.Epoch, index *beaconcommon.CommitteeIndex, slot *beaconcommon.Slot) ([]*types.Committee, error)

GetCommittees returns the committees for the given state. Set epoch and/or index and/or slot to filter result (if nil no filter is applied)

func (*Client) GetGenesis

func (c *Client) GetGenesis(ctx context.Context) (*types.Genesis, error)

GetGenesis returns genesis block

func (*Client) GetNodeVersion

func (c *Client) GetNodeVersion(ctx context.Context) (string, error)

GetNodeVersion returns node's version contains informations about the node processing the request

func (*Client) GetProposerSlashings

func (c *Client) GetProposerSlashings(ctx context.Context) (beaconphase0.ProposerSlashings, error)

GetProposerSlashings returns proposer slashings known by the node but not necessarily incorporated into any block.

func (*Client) GetSpec

func (c *Client) GetSpec(ctx context.Context) (*beaconcommon.Spec, error)

GetSpec returns Ethreum 2.0 specifications configuration used on the node.

func (*Client) GetStateFinalityCheckpoints

func (c *Client) GetStateFinalityCheckpoints(ctx context.Context, stateID string) (*types.StateFinalityCheckpoints, error)

GetStateFinalityCheckpoints returns finality checkpoints for state with given stateID In case finality is not yet achieved returns epoch 0 and ZERO_HASH as root.

func (*Client) GetStateFork

func (c *Client) GetStateFork(ctx context.Context, stateID string) (*beaconcommon.Fork, error)

GetStateFork returns Fork object for state with given stateID

func (*Client) GetStateRoot

func (c *Client) GetStateRoot(ctx context.Context, stateID string) (*beaconcommon.Root, error)

GetStateRoot returns State root for state with given stateID

func (*Client) GetSyncCommittees

func (c *Client) GetSyncCommittees(ctx context.Context, stateID string, epoch *beaconcommon.Epoch) (*types.SyncCommittees, error)

GetSyncCommittees returns the sync committees for given stateID Set epoch to filter result (if nil no filter is applied)

func (*Client) GetValidator

func (c *Client) GetValidator(ctx context.Context, stateID, validatorID string) (*types.Validator, error)

GetValidator returns validator specified by stateID and validatorID

func (*Client) GetValidatorBalances

func (c *Client) GetValidatorBalances(ctx context.Context, stateID string, validatorIDs []string) ([]*types.ValidatorBalance, error)

GetValidatorBalances returns list of validator balances. Set validatorsIDs to filter validator result (if empty no filter is applied)

func (*Client) GetValidators

func (c *Client) GetValidators(ctx context.Context, stateID string, validatorIDs, statuses []string) ([]*types.Validator, error)

GetValidators returns list of validators Set validatorsIDs and/or statuses to filter result (if empty no filter is applied)

func (*Client) GetVoluntaryExits

func (c *Client) GetVoluntaryExits(ctx context.Context) (beaconphase0.VoluntaryExits, error)

GetVoluntaryExits returns voluntary exits known by the node but not necessarily incorporated into any block.

func (*Client) Logger

func (c *Client) Logger() logrus.FieldLogger

func (*Client) SetLogger

func (c *Client) SetLogger(logger logrus.FieldLogger)

type Config

type Config struct {
	Address string

	HTTP *kilnhttp.ClientConfig
}

func ConfigFromViper added in v0.3.1

func ConfigFromViper(v *viper.Viper) *Config

func (*Config) SetDefault

func (cfg *Config) SetDefault() *Config

Jump to

Keyboard shortcuts

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