aboutsummaryrefslogtreecommitdiffstats
path: root/accounts/accounts.go
diff options
context:
space:
mode:
authorPéter Szilágyi <peterke@gmail.com>2017-08-14 23:52:40 +0800
committerGitHub <noreply@github.com>2017-08-14 23:52:40 +0800
commitef0edc6e32d98d2fca54076f38cb317f43704900 (patch)
tree3c110e3aa936721d90537074ea187cbfb5f5991c /accounts/accounts.go
parent6ca59d98f88d4b4cc8bdeb2f023ff8c1fa228c6f (diff)
parent02656f9f614374b3f30b0cc57562e31c570cdf3d (diff)
downloadgo-tangerine-ef0edc6e32d98d2fca54076f38cb317f43704900.tar
go-tangerine-ef0edc6e32d98d2fca54076f38cb317f43704900.tar.gz
go-tangerine-ef0edc6e32d98d2fca54076f38cb317f43704900.tar.bz2
go-tangerine-ef0edc6e32d98d2fca54076f38cb317f43704900.tar.lz
go-tangerine-ef0edc6e32d98d2fca54076f38cb317f43704900.tar.xz
go-tangerine-ef0edc6e32d98d2fca54076f38cb317f43704900.tar.zst
go-tangerine-ef0edc6e32d98d2fca54076f38cb317f43704900.zip
Merge pull request #14885 from karalabe/trezor-boom
accounts, console, internal: support trezor hardware wallet
Diffstat (limited to 'accounts/accounts.go')
-rw-r--r--accounts/accounts.go26
1 files changed, 22 insertions, 4 deletions
diff --git a/accounts/accounts.go b/accounts/accounts.go
index 640de5220..76951e1a4 100644
--- a/accounts/accounts.go
+++ b/accounts/accounts.go
@@ -42,8 +42,9 @@ type Wallet interface {
URL() URL
// Status returns a textual status to aid the user in the current state of the
- // wallet.
- Status() string
+ // wallet. It also returns an error indicating any failure the wallet might have
+ // encountered.
+ Status() (string, error)
// Open initializes access to a wallet instance. It is not meant to unlock or
// decrypt account keys, rather simply to establish a connection to hardware
@@ -147,9 +148,26 @@ type Backend interface {
Subscribe(sink chan<- WalletEvent) event.Subscription
}
+// WalletEventType represents the different event types that can be fired by
+// the wallet subscription subsystem.
+type WalletEventType int
+
+const (
+ // WalletArrived is fired when a new wallet is detected either via USB or via
+ // a filesystem event in the keystore.
+ WalletArrived WalletEventType = iota
+
+ // WalletOpened is fired when a wallet is successfully opened with the purpose
+ // of starting any background processes such as automatic key derivation.
+ WalletOpened
+
+ // WalletDropped
+ WalletDropped
+)
+
// WalletEvent is an event fired by an account backend when a wallet arrival or
// departure is detected.
type WalletEvent struct {
- Wallet Wallet // Wallet instance arrived or departed
- Arrive bool // Whether the wallet was added or removed
+ Wallet Wallet // Wallet instance arrived or departed
+ Kind WalletEventType // Event type that happened in the system
}