aboutsummaryrefslogtreecommitdiffstats
path: root/internal/ethapi
diff options
context:
space:
mode:
authorPéter Szilágyi <peterke@gmail.com>2017-08-09 17:51:16 +0800
committerPéter Szilágyi <peterke@gmail.com>2017-08-09 18:26:07 +0800
commit5d9ac49c7e6027c60998a56287dbb3e407011c9b (patch)
tree325712b0955076ba81a91031e84f25dee88727b2 /internal/ethapi
parentdb568a61e2a98880ab308bf2224aa34073dc7f39 (diff)
downloadgo-tangerine-5d9ac49c7e6027c60998a56287dbb3e407011c9b.tar
go-tangerine-5d9ac49c7e6027c60998a56287dbb3e407011c9b.tar.gz
go-tangerine-5d9ac49c7e6027c60998a56287dbb3e407011c9b.tar.bz2
go-tangerine-5d9ac49c7e6027c60998a56287dbb3e407011c9b.tar.lz
go-tangerine-5d9ac49c7e6027c60998a56287dbb3e407011c9b.tar.xz
go-tangerine-5d9ac49c7e6027c60998a56287dbb3e407011c9b.tar.zst
go-tangerine-5d9ac49c7e6027c60998a56287dbb3e407011c9b.zip
accounts: refactor API for generalized USB wallets
Diffstat (limited to 'internal/ethapi')
-rw-r--r--internal/ethapi/api.go15
1 files changed, 11 insertions, 4 deletions
diff --git a/internal/ethapi/api.go b/internal/ethapi/api.go
index 6b9c151cf..c3924b93a 100644
--- a/internal/ethapi/api.go
+++ b/internal/ethapi/api.go
@@ -230,18 +230,25 @@ func (s *PrivateAccountAPI) ListAccounts() []common.Address {
type rawWallet struct {
URL string `json:"url"`
Status string `json:"status"`
- Accounts []accounts.Account `json:"accounts"`
+ Failure string `json:"failure,omitempty"`
+ Accounts []accounts.Account `json:"accounts,omitempty"`
}
// ListWallets will return a list of wallets this node manages.
func (s *PrivateAccountAPI) ListWallets() []rawWallet {
wallets := make([]rawWallet, 0) // return [] instead of nil if empty
for _, wallet := range s.am.Wallets() {
- wallets = append(wallets, rawWallet{
+ status, failure := wallet.Status()
+
+ raw := rawWallet{
URL: wallet.URL().String(),
- Status: wallet.Status(),
+ Status: status,
Accounts: wallet.Accounts(),
- })
+ }
+ if failure != nil {
+ raw.Failure = failure.Error()
+ }
+ wallets = append(wallets, raw)
}
return wallets
}