lighthouse

package
v1.1.0-rc2 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2021 License: GPL-3.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RequestUrlFormat   = "%s%s"
	RequestContentType = "application/json"

	RequestSyncStatusPath            = "/eth/v1/node/syncing"
	RequestEth2ConfigPath            = "/eth/v1/config/spec"
	RequestEth2DepositContractMethod = "/eth/v1/config/deposit_contract"
	RequestGenesisPath               = "/eth/v1/beacon/genesis"
	RequestFinalityCheckpointsPath   = "/eth/v1/beacon/states/%s/finality_checkpoints"
	RequestForkPath                  = "/eth/v1/beacon/states/%s/fork"
	RequestValidatorsPath            = "/eth/v1/beacon/states/%s/validators"
	RequestVoluntaryExitPath         = "/eth/v1/beacon/pool/voluntary_exits"
	RequestBeaconBlockPath           = "/eth/v1/beacon/blocks/%s"

	MaxRequestValidatorsCount = 600
)

Config

Variables

This section is empty.

Functions

This section is empty.

Types

type BeaconBlockResponse added in v1.0.0

type BeaconBlockResponse struct {
	Data struct {
		Message struct {
			Body struct {
				Eth1Data struct {
					DepositRoot  byteArray `json:"deposit_root"`
					DepositCount uinteger  `json:"deposit_count"`
					BlockHash    byteArray `json:"block_hash"`
				} `json:"eth1_data"`
			} `json:"body"`
		} `json:"message"`
	} `json:"data"`
}

type Client

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

Lighthouse client

func NewClient

func NewClient(providerAddress string) *Client

Create new lighthouse client

func (*Client) Close

func (c *Client) Close() error

Close the client connection

func (*Client) ExitValidator added in v0.0.6

func (c *Client) ExitValidator(validatorIndex, epoch uint64, signature types.ValidatorSignature) error

Perform a voluntary exit on a validator

func (*Client) GetBeaconHead

func (c *Client) GetBeaconHead() (beacon.BeaconHead, error)

Get the beacon head

func (*Client) GetClientType added in v1.0.0

func (c *Client) GetClientType() beacon.BeaconClientType

Get the beacon client type

func (*Client) GetDomainData added in v0.0.6

func (c *Client) GetDomainData(domainType []byte, epoch uint64) ([]byte, error)

Get domain data for a domain type at a given epoch

func (*Client) GetEth1DataForEth2Block added in v1.0.0

func (c *Client) GetEth1DataForEth2Block(blockId string) (beacon.Eth1Data, error)

Get the ETH1 data for the target beacon block

func (*Client) GetEth2Config

func (c *Client) GetEth2Config() (beacon.Eth2Config, error)

Get the eth2 config

func (*Client) GetEth2DepositContract added in v1.0.0

func (c *Client) GetEth2DepositContract() (beacon.Eth2DepositContract, error)

Get the eth2 deposit contract info

func (*Client) GetSyncStatus

func (c *Client) GetSyncStatus() (beacon.SyncStatus, error)

Get the node's sync status

func (*Client) GetValidatorIndex added in v0.0.6

func (c *Client) GetValidatorIndex(pubkey types.ValidatorPubkey) (uint64, error)

Get a validator's index

func (*Client) GetValidatorStatus

func (c *Client) GetValidatorStatus(pubkey types.ValidatorPubkey, opts *beacon.ValidatorStatusOptions) (beacon.ValidatorStatus, error)

Get a validator's status

func (*Client) GetValidatorStatuses added in v0.0.4

func (c *Client) GetValidatorStatuses(pubkeys []types.ValidatorPubkey, opts *beacon.ValidatorStatusOptions) (map[types.ValidatorPubkey]beacon.ValidatorStatus, error)

Get multiple validators' statuses

type Eth2ConfigResponse

type Eth2ConfigResponse struct {
	Data struct {
		SecondsPerSlot uinteger `json:"SECONDS_PER_SLOT"`
		SlotsPerEpoch  uinteger `json:"SLOTS_PER_EPOCH"`
	} `json:"data"`
}

type Eth2DepositContractResponse added in v1.0.0

type Eth2DepositContractResponse struct {
	Data struct {
		ChainID uinteger       `json:"chain_id"`
		Address common.Address `json:"address"`
	} `json:"data"`
}

type FinalityCheckpointsResponse added in v0.0.6

type FinalityCheckpointsResponse struct {
	Data struct {
		PreviousJustified struct {
			Epoch uinteger `json:"epoch"`
		} `json:"previous_justified"`
		CurrentJustified struct {
			Epoch uinteger `json:"epoch"`
		} `json:"current_justified"`
		Finalized struct {
			Epoch uinteger `json:"epoch"`
		} `json:"finalized"`
	} `json:"data"`
}

type ForkResponse added in v0.0.6

type ForkResponse struct {
	Data struct {
		PreviousVersion byteArray `json:"previous_version"`
		CurrentVersion  byteArray `json:"current_version"`
		Epoch           uinteger  `json:"epoch"`
	}
}

type GenesisResponse added in v0.0.6

type GenesisResponse struct {
	Data struct {
		GenesisTime           uinteger  `json:"genesis_time"`
		GenesisForkVersion    byteArray `json:"genesis_fork_version"`
		GenesisValidatorsRoot byteArray `json:"genesis_validators_root"`
	} `json:"data"`
}

type SyncStatusResponse

type SyncStatusResponse struct {
	Data struct {
		IsSyncing    bool     `json:"is_syncing"`
		HeadSlot     uinteger `json:"head_slot"`
		SyncDistance uinteger `json:"sync_distance"`
	} `json:"data"`
}

Response types

type Validator added in v0.0.6

type Validator struct {
	Index   uinteger `json:"index"`
	Balance uinteger `json:"balance"`
	//Status string                       `json:"status"`
	Validator struct {
		Pubkey                     byteArray `json:"pubkey"`
		WithdrawalCredentials      byteArray `json:"withdrawal_credentials"`
		EffectiveBalance           uinteger  `json:"effective_balance"`
		Slashed                    bool      `json:"slashed"`
		ActivationEligibilityEpoch uinteger  `json:"activation_eligibility_epoch"`
		ActivationEpoch            uinteger  `json:"activation_epoch"`
		ExitEpoch                  uinteger  `json:"exit_epoch"`
		WithdrawableEpoch          uinteger  `json:"withdrawable_epoch"`
	} `json:"validator"`
}

type ValidatorsResponse added in v0.0.6

type ValidatorsResponse struct {
	Data []Validator `json:"data"`
}

type VoluntaryExitMessage added in v0.0.6

type VoluntaryExitMessage struct {
	Epoch          uinteger `json:"epoch"`
	ValidatorIndex uinteger `json:"validator_index"`
}

type VoluntaryExitRequest added in v0.0.6

type VoluntaryExitRequest struct {
	Message   VoluntaryExitMessage `json:"message"`
	Signature byteArray            `json:"signature"`
}

Request types

Jump to

Keyboard shortcuts

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