hd

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Jan 22, 2024 License: GPL-3.0 Imports: 9 Imported by: 3

Documentation

Index

Constants

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

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

Variables

View Source
var ErrAccountNotFound = errors.New("account not found")

ErrAccountNotFound is the error when account not found

Functions

This section is empty.

Types

type Wallet added in v1.0.1

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

Wallet represents hierarchical deterministic wallet

func NewWallet added in v1.0.1

func NewWallet(context *core.WalletContext) *Wallet

NewWallet is the constructor of Wallet

func (*Wallet) AccountByID added in v1.0.1

func (wallet *Wallet) 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 (*Wallet) AccountByPublicKey added in v1.0.1

func (wallet *Wallet) 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 (*Wallet) Accounts added in v1.0.1

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

Accounts provides all accounts in the wallet.

func (*Wallet) AddValidatorAccount added in v1.0.1

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

AddValidatorAccount returns error

func (*Wallet) BuildValidatorAccount added in v1.0.8

func (wallet *Wallet) BuildValidatorAccount(indexPointer *int, key *core.MasterDerivableKey) (*wallets.HDAccount, error)

BuildValidatorAccount using pointer and constructed key, using seedless or seed modes

func (*Wallet) CreateValidatorAccount added in v1.0.1

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

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

func (*Wallet) CreateValidatorAccountFromPrivateKey added in v1.0.8

func (wallet *Wallet) CreateValidatorAccountFromPrivateKey(privateKey []byte, indexPointer *int) (core.ValidatorAccount, error)

CreateValidatorAccountFromPrivateKey creates account having only private key

func (*Wallet) DeleteAccountByPublicKey added in v1.0.1

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

DeleteAccountByPublicKey deletes account by the given public key

func (*Wallet) GetNextAccountIndex added in v1.0.1

func (wallet *Wallet) GetNextAccountIndex() int

GetNextAccountIndex provides next index to create account at.

func (*Wallet) ID added in v1.0.1

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

ID provides the ID for the wallet.

func (*Wallet) MarshalJSON added in v1.0.1

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

MarshalJSON is the custom JSON marshaler

func (*Wallet) SetContext added in v1.0.1

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

SetContext is the context setter

func (*Wallet) Type added in v1.0.1

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

Type provides the type of the wallet.

func (*Wallet) UnmarshalJSON added in v1.0.1

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

UnmarshalJSON is the custom JSON unmarshaler

Jump to

Keyboard shortcuts

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