types

package
v0.2.4 Latest Latest
Warning

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

Go to latest
Published: Feb 14, 2024 License: AGPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RocketPoolValidatorPath    string = "m/12381/3600/%d/0/0"
	StakewiseValidatorPath     string = "m/12381/3600/%d/1/0"
	ConstellationValidatorPath string = "m/12381/3600/%d/2/0"
	SoloValidatorPath          string = "m/12381/3600/%d/3/0"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AttestationInfo

type AttestationInfo struct {
	AggregationBits bitfield.Bitlist
	SlotIndex       uint64
	CommitteeIndex  uint64
}

type BeaconBlock

type BeaconBlock struct {
	Slot                 uint64
	ProposerIndex        string
	HasExecutionPayload  bool
	Attestations         []AttestationInfo
	FeeRecipient         common.Address
	ExecutionBlockNumber uint64
}

type BeaconHead

type BeaconHead struct {
	Epoch                  uint64
	FinalizedEpoch         uint64
	JustifiedEpoch         uint64
	PreviousJustifiedEpoch uint64
}

type ByteArray

type ByteArray []byte

Byte array type

func (ByteArray) MarshalJSON

func (b ByteArray) MarshalJSON() ([]byte, error)

func (*ByteArray) UnmarshalJSON

func (b *ByteArray) UnmarshalJSON(data []byte) error

type DerivationPath

type DerivationPath string
const (
	DerivationPath_Default    DerivationPath = ""
	DerivationPath_LedgerLive DerivationPath = "ledger-live"
	DerivationPath_Mew        DerivationPath = "mew"
)

type Eth1Data

type Eth1Data struct {
	DepositRoot  common.Hash
	DepositCount uint64
	BlockHash    common.Hash
}

type Eth2Config

type Eth2Config struct {
	GenesisForkVersion           []byte
	GenesisValidatorsRoot        []byte
	GenesisEpoch                 uint64
	GenesisTime                  uint64
	SecondsPerSlot               uint64
	SlotsPerEpoch                uint64
	SecondsPerEpoch              uint64
	EpochsPerSyncCommitteePeriod uint64
}

type Eth2DepositContract

type Eth2DepositContract struct {
	ChainID uint64
	Address common.Address
}

type ExtendedDepositData

type ExtendedDepositData struct {
	PublicKey             ByteArray `json:"pubkey"`
	WithdrawalCredentials ByteArray `json:"withdrawal_credentials"`
	Amount                uint64    `json:"amount"`
	Signature             ByteArray `json:"signature"`
	DepositMessageRoot    ByteArray `json:"deposit_message_root"`
	DepositDataRoot       ByteArray `json:"deposit_data_root"`
	ForkVersion           ByteArray `json:"fork_version"`
	NetworkName           string    `json:"network_name"`
	HyperdriveVersion     string    `json:"hyperdrive_version,omitempty"`
}

Extended deposit data beyond what is required in an actual deposit message to Beacon, emulating what the deposit CLI produces

type HardwareWalletData

type HardwareWalletData struct {
}

Placeholder for hardware wallets

type IBeaconClient

type IBeaconClient interface {
	GetSyncStatus(ctx context.Context) (SyncStatus, error)
	GetEth2Config(ctx context.Context) (Eth2Config, error)
	GetEth2DepositContract(ctx context.Context) (Eth2DepositContract, error)
	GetAttestations(ctx context.Context, blockId string) ([]AttestationInfo, bool, error)
	GetBeaconBlock(ctx context.Context, blockId string) (BeaconBlock, bool, error)
	GetBeaconHead(ctx context.Context) (BeaconHead, error)
	GetValidatorStatusByIndex(ctx context.Context, index string, opts *ValidatorStatusOptions) (ValidatorStatus, error)
	GetValidatorStatus(ctx context.Context, pubkey beacon.ValidatorPubkey, opts *ValidatorStatusOptions) (ValidatorStatus, error)
	GetValidatorStatuses(ctx context.Context, pubkeys []beacon.ValidatorPubkey, opts *ValidatorStatusOptions) (map[beacon.ValidatorPubkey]ValidatorStatus, error)
	GetValidatorIndex(ctx context.Context, pubkey beacon.ValidatorPubkey) (string, error)
	GetValidatorSyncDuties(ctx context.Context, indices []string, epoch uint64) (map[string]bool, error)
	GetValidatorProposerDuties(ctx context.Context, indices []string, epoch uint64) (map[string]uint64, error)
	GetDomainData(ctx context.Context, domainType []byte, epoch uint64, useGenesisFork bool) ([]byte, error)
	ExitValidator(ctx context.Context, validatorIndex string, epoch uint64, signature beacon.ValidatorSignature) error
	Close(ctx context.Context) error
	GetEth1DataForEth2Block(ctx context.Context, blockId string) (Eth1Data, bool, error)
	ChangeWithdrawalCredentials(ctx context.Context, validatorIndex string, fromBlsPubkey beacon.ValidatorPubkey, toExecutionAddress common.Address, signature beacon.ValidatorSignature) error
}

Beacon client interface

type LocalWalletData

type LocalWalletData struct {
	// Encrypted seed information
	Crypto map[string]interface{} `json:"crypto"`

	// Name of the encryptor used to generate the keystore
	Name string `json:"name"`

	// Version of the encryptor used to generate the keystore
	Version uint `json:"version"`

	// Unique ID for this keystore
	UUID uuid.UUID `json:"uuid"`

	// The path that should be used to derive the target key; assumes there's only one index that can be iterated on
	DerivationPath string `json:"derivationPath,omitempty"`

	// The index of the target wallet, used to format DerivationPath
	WalletIndex uint `json:"walletIndex,omitempty"`
}

Keystore for local node wallets - note that this is NOT an EIP-2335 keystore.

type SyncStatus

type SyncStatus struct {
	Syncing  bool
	Progress float64
}

API response types

type ValidatorKeystore

type ValidatorKeystore struct {
	Crypto  map[string]interface{} `json:"crypto"`
	Name    string                 `json:"name,omitempty"` // Technically not part of the spec but Prysm needs it
	Version uint                   `json:"version"`
	UUID    uuid.UUID              `json:"uuid"`
	Path    string                 `json:"path"`
	Pubkey  beacon.ValidatorPubkey `json:"pubkey,omitempty"`
}

Encrypted validator keystore following the EIP-2335 standard (https://eips.ethereum.org/EIPS/eip-2335)

type ValidatorState

type ValidatorState string
const (
	ValidatorState_PendingInitialized ValidatorState = "pending_initialized"
	ValidatorState_PendingQueued      ValidatorState = "pending_queued"
	ValidatorState_ActiveOngoing      ValidatorState = "active_ongoing"
	ValidatorState_ActiveExiting      ValidatorState = "active_exiting"
	ValidatorState_ActiveSlashed      ValidatorState = "active_slashed"
	ValidatorState_ExitedUnslashed    ValidatorState = "exited_unslashed"
	ValidatorState_ExitedSlashed      ValidatorState = "exited_slashed"
	ValidatorState_WithdrawalPossible ValidatorState = "withdrawal_possible"
	ValidatorState_WithdrawalDone     ValidatorState = "withdrawal_done"
)

type ValidatorStatus

type ValidatorStatus struct {
	Pubkey                     beacon.ValidatorPubkey
	Index                      string
	WithdrawalCredentials      common.Hash
	Balance                    uint64
	Status                     ValidatorState
	EffectiveBalance           uint64
	Slashed                    bool
	ActivationEligibilityEpoch uint64
	ActivationEpoch            uint64
	ExitEpoch                  uint64
	WithdrawableEpoch          uint64
	Exists                     bool
}

type ValidatorStatusOptions

type ValidatorStatusOptions struct {
	Epoch *uint64
	Slot  *uint64
}

API request options

type WalletData

type WalletData struct {
	// The type of wallet
	Type WalletType `json:"type"`

	// Data about a local wallet
	LocalData LocalWalletData `json:"localData"`

	// Data about a hardware wallet
	HardwareData HardwareWalletData `json:"hardwareData"`
}

Data storage for node wallets

type WalletStatus

type WalletStatus struct {
	Address struct {
		NodeAddress common.Address `json:"nodeAddress"`
		HasAddress  bool           `json:"hasAddress"`
	} `json:"address"`

	Wallet struct {
		Type          WalletType     `json:"type"`
		IsLoaded      bool           `json:"isLoaded"`
		IsOnDisk      bool           `json:"isOnDisk"`
		WalletAddress common.Address `json:"walletAddress"`
	} `json:"wallet"`

	Password struct {
		IsPasswordSaved bool `json:"isPasswordSaved"`
	} `json:"password"`
}

type WalletType

type WalletType string

An enum describing the type of wallet used by the node

const (
	// Unset wallet type
	WalletType_Unknown WalletType = ""

	// Indicator for local wallets that have encrypted keystores saved to disk
	WalletType_Local WalletType = "local"

	// Indicator for hardware wallets that store the private key offline
	WalletType_Hardware WalletType = "hardware"
)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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