Documentation ¶
Overview ¶
Package hd contains perun wallet and accounts implementation for accessing accounts stored in an ethereum hierarchial deterministic (HD) wallet.
Index ¶
- Variables
- type Account
- type Transactor
- type Wallet
- func (w *Wallet) Contains(addr common.Address) bool
- func (w *Wallet) DecrementUsage(a wallet.Address)
- func (w *Wallet) IncrementUsage(a wallet.Address)
- func (w *Wallet) LockAll()
- func (w *Wallet) NewAccount() (*Account, error)
- func (w *Wallet) Unlock(addr wallet.Address) (wallet.Account, error)
- func (w *Wallet) Wallet() accounts.Wallet
Constants ¶
This section is empty.
Variables ¶
var DefaultRootDerivationPath = accounts.DefaultRootDerivationPath
DefaultRootDerivationPath represent the default root derivation path for ethereum accounts as per BIP32.
Functions ¶
This section is empty.
Types ¶
type Account ¶
Account represents an account held in the HD wallet.
func NewAccountFromEth ¶
NewAccountFromEth creates a new perun account from a given ethereum account.
type Transactor ¶
Transactor can be used to make TransactOpts for accounts stored in a HD wallet.
func NewTransactor ¶
func NewTransactor(w accounts.Wallet, signer types.Signer) *Transactor
NewTransactor returns a backend that can make TransactOpts for accounts contained in the given ethereum wallet.
func (*Transactor) NewTransactor ¶
func (t *Transactor) NewTransactor(account accounts.Account) (*bind.TransactOpts, error)
NewTransactor returns a TransactOpts for the given account. It errors if the account is not contained in the wallet used for initializing transactor backend.
type Wallet ¶
type Wallet struct {
// contains filtered or unexported fields
}
Wallet is a wallet.Wallet implementation for using HD wallets. It supports any implementation of the HD wallet interface (accounts.Wallet) defined in go-ethereum project.
func NewWallet ¶
NewWallet returns a new perun wallet that uses the given HD wallet.
Use the DefaultRootDerivationPath for accessing ethereum on-chain accounts. numUsedAccs should be the number of used accounts in the wallet.
All of these accounts will be retreived from the wallet, unlocked and made accesible for making signatures.
func (*Wallet) Contains ¶
Contains checks whether this wallet contains the account corresponding to the given address.
func (*Wallet) DecrementUsage ¶
DecrementUsage implements wallet.Wallet. It is a noop.
func (*Wallet) IncrementUsage ¶
IncrementUsage implements wallet.Wallet. It is a noop.
func (*Wallet) NewAccount ¶
NewAccount creates a new account which is unlocked and ready to use. It will be derived at the index numDerivedAccs (as the index starts from 0) and numDerivedAccs will be incremented.