hdwallet

package
v0.0.0-...-d56c475 Latest Latest
Warning

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

Go to latest
Published: Mar 14, 2024 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const BitSizeOfEntropy = 128

BitSizeOfEntropy can be {128, 256}.

Variables

This section is empty.

Functions

func MustParseDerivationPath

func MustParseDerivationPath(path string) as.DerivationPath

MustParseDerivationPath parses the derivation path in string format into []uint32 but will panic if it can't parse it.

func NewMnemonic

func NewMnemonic() (string, error)

NewMnemonic returns a randomly generated BIP-39 mnemonic.

func NewSeedFromMnemonic

func NewSeedFromMnemonic(mnemonic string, password string) ([]byte, error)

NewSeedFromMnemonic returns a BIP-39 seed based on a BIP-39 mnemonic and password. DK = PBKDF2(PRF, Password, Salt, c, dkLen) and HMAC-SHA512

func ParseDerivationPath

func ParseDerivationPath(path string) (as.DerivationPath, error)

! @todo [ ] ParseDerivationPath parses the derivation path in string format into []uint32.

Types

type Wallet

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

func NewWallet

func NewWallet(password string) (*Wallet, error)

func NewWalletFromMnemonic

func NewWalletFromMnemonic(mnemonic string, password string) (*Wallet, error)

NewWalletFromMnemonic returns a new wallet from a BIP-39 mnemonic.

func NewWalletFromSeed

func NewWalletFromSeed(seed []byte) (*Wallet, error)

NewWalletFromSeed returns a new wallet from a BIP-39 seed.

func (*Wallet) Accounts

func (w *Wallet) Accounts() []as.Account

Accounts implements accounts.Wallet, returning the list of accounts pinned to the wallet. If self-derivation was enabled, the account list is periodically expanded based on current chain state.

func (*Wallet) Address

func (w *Wallet) Address(account as.Account) (as.Address, error)

Address returns the address of the account.

func (*Wallet) Close

func (w *Wallet) Close() error

func (*Wallet) Contains

func (w *Wallet) Contains(account as.Account) bool

Contains implements accounts.Wallet, returning whether a particular account is or is not pinned into this wallet instance.

func (*Wallet) CreateProposeForm

func (wallet *Wallet) CreateProposeForm(WalletToPropose string, Proposal string, Deadline int, Postscript string)

func (*Wallet) CreateWalletForm

func (wallet *Wallet) CreateWalletForm(
	Owners string,
	Threshold int) ([]byte, error)

func (*Wallet) Derive

func (w *Wallet) Derive(path as.DerivationPath, pin bool) (as.Account, error)

Derive implements accounts.Wallet, deriving a new account at the specific derivation path. If pin is set to true, the account will be added to the list of tracked accounts.

func (*Wallet) MultiSignForm

func (wallet *Wallet) MultiSignForm(
	Data string,
	Quorum int,
	Threshold int) (url.Values, error)

func (*Wallet) Open

func (w *Wallet) Open(password string) error

func (*Wallet) Path

func (w *Wallet) Path(account as.Account) (string, error)

Path return the derivation path of the account.

func (*Wallet) PrivateKey

func (w *Wallet) PrivateKey(account as.Account) ([]byte, error)

PrivateKey returns the ECDSA private key of the account.

func (*Wallet) PublicKey

func (w *Wallet) PublicKey(account as.Account) ([]byte, error)

PublicKey returns the ECDSA public key of the account.

func (*Wallet) SendTokens

func (w *Wallet) SendTokens(recipient string, amount decimal.Decimal) error

func (*Wallet) SignData

func (w *Wallet) SignData(account as.Account, mimeType string, data []byte) ([]byte, error)

@todo [ ] SignHash signs the given hash with the requested account.

func (*Wallet) SignDataWithPassword

func (w *Wallet) SignDataWithPassword(account as.Account, password, mimeType string, data []byte) ([]byte, error)

func (*Wallet) SignHash

func (w *Wallet) SignHash(account as.Account, hash []byte) ([]byte, error)

SignHash implements accounts.Wallet, which allows signing arbitrary data.

func (*Wallet) SignText

func (w *Wallet) SignText(account as.Account, text []byte) ([]byte, error)

func (*Wallet) SignTextWithPassword

func (w *Wallet) SignTextWithPassword(account as.Account, password string, text []byte) ([]byte, error)

func (*Wallet) Status

func (w *Wallet) Status() (string, error)

func (*Wallet) URL

func (w *Wallet) URL() as.URL

@todo [ ] do nothing for now.

func (*Wallet) Unpin

func (w *Wallet) Unpin(account as.Account) error

Unpin unpins account from list of pinned accounts.

Jump to

Keyboard shortcuts

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