hd

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2020 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BaseAccountPath   = "/%d"
	WithdrawalKeyPath = BaseAccountPath + "/0"
	ValidatorKeyPath  = WithdrawalKeyPath + "/0"
)

according to https://github.com/ethereum/EIPs/blob/master/EIPS/eip-2334.md

Variables

View Source
var (
	// ErrAccountNotFound is the error when account not found
	ErrAccountNotFound = errors.New("account not found")
)

Predefined errors

Functions

This section is empty.

Types

type HDWallet

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

an hierarchical deterministic wallet

func NewHDWallet

func NewHDWallet(context *core.WalletContext) *HDWallet

func (*HDWallet) AccountByID

func (wallet *HDWallet) AccountByID(id uuid.UUID) (core.ValidatorAccount, error)

AccountByID provides a nd account from the wallet given its ID. This will error if the account is not found.

func (*HDWallet) AccountByPublicKey

func (wallet *HDWallet) AccountByPublicKey(pubKey string) (core.ValidatorAccount, error)

AccountByPublicKey provides a nd account from the wallet given its public key. This will error if the account is not found.

func (*HDWallet) Accounts

func (wallet *HDWallet) Accounts() []core.ValidatorAccount

Accounts provides all accounts in the wallet.

func (*HDWallet) AddValidatorAccount

func (wallet *HDWallet) AddValidatorAccount(account core.ValidatorAccount) error

func (*HDWallet) CreateValidatorAccount

func (wallet *HDWallet) CreateValidatorAccount(seed []byte, indexPointer *int) (core.ValidatorAccount, error)

CreateValidatorKey creates a new validation (validator) key pair in the wallet.

func (*HDWallet) DeleteAccountByPublicKey

func (wallet *HDWallet) DeleteAccountByPublicKey(pubKey string) error

func (*HDWallet) GetNextAccountIndex

func (wallet *HDWallet) GetNextAccountIndex() int

GetNextAccountIndex provides next index to create account at.

func (*HDWallet) ID

func (wallet *HDWallet) ID() uuid.UUID

ID provides the ID for the wallet.

func (*HDWallet) MarshalJSON

func (wallet *HDWallet) MarshalJSON() ([]byte, error)

func (*HDWallet) SetContext

func (wallet *HDWallet) SetContext(ctx *core.WalletContext)

func (*HDWallet) Type

func (wallet *HDWallet) Type() core.WalletType

Type provides the type of the wallet.

func (*HDWallet) UnmarshalJSON

func (wallet *HDWallet) UnmarshalJSON(data []byte) error

Jump to

Keyboard shortcuts

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