Documentation
¶
Overview ¶
Package simple contains a simplistic implementation of the perun wallet, account, and transactor interfaces. A simple wallet can be instantiated directly from a list of secret keys. It is meant to be used for testing and demonstration purposes only. It should not be used in production.
Index ¶
- Variables
- func IsErrWrongAddrType(err error) bool
- type Account
- type Transactor
- type Wallet
- func (w *Wallet) Contains(addr common.Address) bool
- func (w *Wallet) DecrementUsage(address wallet.Address)
- func (w *Wallet) IncrementUsage(address wallet.Address)
- func (w *Wallet) LockAll()
- func (w *Wallet) NewRandomAccount(prng *rand.Rand) wallet.Account
- func (w *Wallet) Unlock(address wallet.Address) (wallet.Account, error)
Constants ¶
This section is empty.
Variables ¶
var ErrWrongAddrType = stderrors.New("wrong address type")
ErrWrongAddrType signals than an operation failed because an address was of the wrong type.
Functions ¶
func IsErrWrongAddrType ¶
IsErrWrongAddrType returns whether the cause of the error was an ErrWrongAddrType error.
Types ¶
type Account ¶
Account represents an account held in the simple wallet.
type Transactor ¶
Transactor can be used to make TransactOpts for accounts stored in a wallet.
func NewTransactor ¶
func NewTransactor(w *Wallet, signer types.Signer) *Transactor
NewTransactor returns a Transactor that can make TransactOpts for accounts contained in the given simple 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 of the transactor factory.
type Wallet ¶
type Wallet struct {
// contains filtered or unexported fields
}
Wallet is a simple wallet.Wallet implementation holding a map of all included accounts.
func NewWallet ¶
func NewWallet(privateKeys ...*ecdsa.PrivateKey) *Wallet
NewWallet creates a new Wallet with accounts corresponding to the privateKeys.
func (*Wallet) Contains ¶
Contains checks whether this wallet contains the account corresponding to the given address.
func (*Wallet) DecrementUsage ¶
DecrementUsage is called whenever a channel is settled.
func (*Wallet) IncrementUsage ¶
IncrementUsage is called whenever a new channel is created or restored.
func (*Wallet) LockAll ¶
func (w *Wallet) LockAll()
LockAll is called by the framework when a Client shuts down.
func (*Wallet) NewRandomAccount ¶
NewRandomAccount creates a new pseudorandom account using the provided randomness. The returned account is already unlocked.