prysm

package
v1.3.0-rc2 Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2022 License: GPL-3.0 Imports: 18 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"
	RequestValidatorSyncDuties       = "/eth/v1/validator/duties/sync/%s"
	RequestValidatorProposerDuties   = "/eth/v1/validator/duties/proposer/%s"

	MaxRequestValidatorsCount = 600
)

Config

Variables

This section is empty.

Functions

This section is empty.

Types

type BeaconBlockResponse added in v1.1.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
}

Prysm client

func NewClient

func NewClient(providerAddress string) *Client

Create new prysm 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) GetValidatorProposerDuties added in v1.2.0

func (c *Client) GetValidatorProposerDuties(indices []uint64, epoch uint64) (map[uint64]uint64, error)

Sums proposer duties per validators for a given epoch

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

func (*Client) GetValidatorSyncDuties added in v1.2.0

func (c *Client) GetValidatorSyncDuties(indices []uint64, epoch uint64) (map[uint64]bool, error)

Get whether validators have sync duties to perform at given epoch

type Eth2ConfigResponse added in v1.1.0

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

type Eth2DepositContractResponse added in v1.1.0

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

type FinalityCheckpointsResponse added in v1.1.0

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 v1.1.0

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

type GenesisResponse added in v1.1.0

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 ProposerDutiesResponse added in v1.2.0

type ProposerDutiesResponse struct {
	Data []ProposerDuty `json:"data"`
}

type ProposerDuty added in v1.2.0

type ProposerDuty struct {
	ValidatorIndex uinteger `json:"validator_index"`
}

type SyncDutiesResponse added in v1.2.0

type SyncDutiesResponse struct {
	Data []SyncDuty `json:"data"`
}

type SyncDuty added in v1.2.0

type SyncDuty struct {
	Pubkey               byteArray  `json:"pubkey"`
	ValidatorIndex       uinteger   `json:"validator_index"`
	SyncCommitteeIndices []uinteger `json:"validator_sync_committee_indices"`
}

type SyncStatusResponse added in v1.1.0

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 v1.1.0

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 v1.1.0

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

type VoluntaryExitMessage added in v1.1.0

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

type VoluntaryExitRequest added in v1.1.0

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