nimbus

package
v1.0.0-pre Latest Latest
Warning

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

Go to latest
Published: Sep 9, 2021 License: GPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RequestSyncStatusMethod          = "get_v1_node_syncing"
	RequestEth2ConfigMethod          = "get_v1_config_spec"
	RequestEth2DepositContractMethod = "get_v1_config_deposit_contract"
	RequestGenesisMethod             = "get_v1_beacon_genesis"
	RequestFinalityCheckpointsMethod = "get_v1_beacon_states_finality_checkpoints"
	RequestForkMethod                = "get_v1_beacon_states_fork"
	RequestValidatorsMethod          = "get_v1_beacon_states_stateId_validators"
	RequestVoluntaryExitMethod       = "post_v1_beacon_pool_voluntary_exits"

	MaxRequestValidatorsCount = 30
)

Config

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

Nimbus client

func NewClient

func NewClient(providerAddress string) (*Client, error)

Create new Nimbus client

func (*Client) Close

func (c *Client) Close() error

Close the client connection

func (*Client) ExitValidator

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

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

Get the beacon client type

func (*Client) GetDomainData

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

Get domain data for a domain type at a given epoch

func (*Client) GetEth2Config

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

Get the eth2 config

func (*Client) GetEth2DepositContract

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

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

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 {
	SecondsPerSlot uinteger `json:"SECONDS_PER_SLOT"`
	SlotsPerEpoch  uinteger `json:"SLOTS_PER_EPOCH"`
}

type Eth2DepositContractResponse

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

type FinalityCheckpointsResponse

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

type ForkResponse

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

type GenesisResponse

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

type SyncStatusResponse

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

Response types

type Validator

type Validator struct {
	Index     uint64 `json:"index"`
	Balance   uint64 `json:"balance"`
	Status    string `json:"status"`
	Validator struct {
		Pubkey                     byteArray `json:"pubkey"`
		WithdrawalCredentials      byteArray `json:"withdrawal_credentials"`
		EffectiveBalance           uint64    `json:"effective_balance"`
		Slashed                    bool      `json:"slashed"`
		ActivationEligibilityEpoch int64     `json:"activation_eligibility_epoch"` // Nimbus uses -1 for FAR_FUTURE_EPOCH so this has to be a signed int
		ActivationEpoch            int64     `json:"activation_epoch"`             // Same here
		ExitEpoch                  int64     `json:"exit_epoch"`                   // Same here
		WithdrawableEpoch          int64     `json:"withdrawable_epoch"`           // Same here
	} `json:"validator"`
}

type VoluntaryExitMessage

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

type VoluntaryExitRequest

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