Documentation ¶
Overview ¶
Package account is a generated GoMock package.
Index ¶
- Variables
- func FromAddress(accountAddress string) common.Address
- func ParseAccountString(account string) (accounts.Account, error)
- func ToAddress(accountAddress string) *common.Address
- type GethServiceProvider
- type Manager
- func (m *Manager) Accounts() ([]gethcommon.Address, error)
- func (m *Manager) AddressToDecryptedAccount(address, password string) (accounts.Account, *keystore.Key, error)
- func (m *Manager) CreateAccount(password string) (address, pubKey, mnemonic string, err error)
- func (m *Manager) CreateChildAccount(parentAddress, password string) (address, pubKey string, err error)
- func (m *Manager) Logout()
- func (m *Manager) RecoverAccount(password, mnemonic string) (address, pubKey string, err error)
- func (m *Manager) SelectAccount(address, password string) error
- func (m *Manager) SelectedAccount() (*SelectedExtKey, error)
- func (m *Manager) VerifyAccountPassword(keyStoreDir, address, password string) (*keystore.Key, error)
- type MockGethServiceProvider
- type MockGethServiceProviderMockRecorder
- type SelectedExtKey
Constants ¶
This section is empty.
Variables ¶
var ( ErrAddressToAccountMappingFailure = errors.New("cannot retrieve a valid account for a given address") ErrAccountToKeyMappingFailure = errors.New("cannot retrieve a valid key for a given account") ErrNoAccountSelected = errors.New("no account has been selected, please login") ErrInvalidMasterKeyCreated = errors.New("can not create master extended key") )
errors
var (
ErrInvalidAccountAddressOrKey = errors.New("cannot parse address or key to valid account address")
)
errors
Functions ¶
func FromAddress ¶
FromAddress converts account address from string to common.Address. The function is useful to format "From" field of send transaction struct.
func ParseAccountString ¶
ParseAccountString parses hex encoded string and returns is as accounts.Account.
Types ¶
type GethServiceProvider ¶
type GethServiceProvider interface { AccountManager() (*accounts.Manager, error) AccountKeyStore() (*keystore.KeyStore, error) }
GethServiceProvider provides required geth services.
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager represents account manager interface.
func NewManager ¶
func NewManager(geth GethServiceProvider) *Manager
NewManager returns new node account manager.
func (*Manager) Accounts ¶
func (m *Manager) Accounts() ([]gethcommon.Address, error)
Accounts returns list of addresses for selected account, including subaccounts.
func (*Manager) AddressToDecryptedAccount ¶
func (m *Manager) AddressToDecryptedAccount(address, password string) (accounts.Account, *keystore.Key, error)
AddressToDecryptedAccount tries to load decrypted key for a given account. The running node, has a keystore directory which is loaded on start. Key file for a given address is expected to be in that directory prior to node start.
func (*Manager) CreateAccount ¶
CreateAccount creates an internal geth account BIP44-compatible keys are generated: CKD#1 is stored as account key, CKD#2 stored as sub-account root Public key of CKD#1 is returned, with CKD#2 securely encoded into account key file (to be used for sub-account derivations)
func (*Manager) CreateChildAccount ¶
func (m *Manager) CreateChildAccount(parentAddress, password string) (address, pubKey string, err error)
CreateChildAccount creates sub-account for an account identified by parent address. CKD#2 is used as root for master accounts (when parentAddress is ""). Otherwise (when parentAddress != ""), child is derived directly from parent.
func (*Manager) RecoverAccount ¶
RecoverAccount re-creates master key using given details. Once master key is re-generated, it is inserted into keystore (if not already there).
func (*Manager) SelectAccount ¶
SelectAccount selects current account, by verifying that address has corresponding account which can be decrypted using provided password. Once verification is done, all previous identities are removed).
func (*Manager) SelectedAccount ¶
func (m *Manager) SelectedAccount() (*SelectedExtKey, error)
SelectedAccount returns currently selected account
type MockGethServiceProvider ¶
type MockGethServiceProvider struct {
// contains filtered or unexported fields
}
MockGethServiceProvider is a mock of GethServiceProvider interface
func NewMockGethServiceProvider ¶
func NewMockGethServiceProvider(ctrl *gomock.Controller) *MockGethServiceProvider
NewMockGethServiceProvider creates a new mock instance
func (*MockGethServiceProvider) AccountKeyStore ¶
func (m *MockGethServiceProvider) AccountKeyStore() (*keystore.KeyStore, error)
AccountKeyStore mocks base method
func (*MockGethServiceProvider) AccountManager ¶
func (m *MockGethServiceProvider) AccountManager() (*accounts.Manager, error)
AccountManager mocks base method
func (*MockGethServiceProvider) EXPECT ¶
func (m *MockGethServiceProvider) EXPECT() *MockGethServiceProviderMockRecorder
EXPECT returns an object that allows the caller to indicate expected use
type MockGethServiceProviderMockRecorder ¶
type MockGethServiceProviderMockRecorder struct {
// contains filtered or unexported fields
}
MockGethServiceProviderMockRecorder is the mock recorder for MockGethServiceProvider
func (*MockGethServiceProviderMockRecorder) AccountKeyStore ¶
func (mr *MockGethServiceProviderMockRecorder) AccountKeyStore() *gomock.Call
AccountKeyStore indicates an expected call of AccountKeyStore
func (*MockGethServiceProviderMockRecorder) AccountManager ¶
func (mr *MockGethServiceProviderMockRecorder) AccountManager() *gomock.Call
AccountManager indicates an expected call of AccountManager
type SelectedExtKey ¶
type SelectedExtKey struct { Address common.Address AccountKey *keystore.Key SubAccounts []accounts.Account }
SelectedExtKey is a container for the selected (logged in) external account.
func (*SelectedExtKey) Hex ¶
func (k *SelectedExtKey) Hex() string
Hex dumps address of a given extended key as hex string.