aboutsummaryrefslogtreecommitdiffstats
path: root/cmd/geth/accountcmd.go
diff options
context:
space:
mode:
authorPéter Szilágyi <peterke@gmail.com>2017-02-07 18:47:34 +0800
committerPéter Szilágyi <peterke@gmail.com>2017-02-13 20:00:07 +0800
commitfad5eb0a87abfc12812647344a26de8a43830182 (patch)
treea679f37933a85edade15ee69b385b6705cc94043 /cmd/geth/accountcmd.go
parentb3c0e9d3ccb0bb326646aea47dda391a9552b122 (diff)
downloadgo-tangerine-fad5eb0a87abfc12812647344a26de8a43830182.tar
go-tangerine-fad5eb0a87abfc12812647344a26de8a43830182.tar.gz
go-tangerine-fad5eb0a87abfc12812647344a26de8a43830182.tar.bz2
go-tangerine-fad5eb0a87abfc12812647344a26de8a43830182.tar.lz
go-tangerine-fad5eb0a87abfc12812647344a26de8a43830182.tar.xz
go-tangerine-fad5eb0a87abfc12812647344a26de8a43830182.tar.zst
go-tangerine-fad5eb0a87abfc12812647344a26de8a43830182.zip
accounts, cmd, eth, internal, miner, node: wallets and HD APIs
Diffstat (limited to 'cmd/geth/accountcmd.go')
-rw-r--r--cmd/geth/accountcmd.go17
1 files changed, 11 insertions, 6 deletions
diff --git a/cmd/geth/accountcmd.go b/cmd/geth/accountcmd.go
index 3a0eb13e8..97a060e48 100644
--- a/cmd/geth/accountcmd.go
+++ b/cmd/geth/accountcmd.go
@@ -181,8 +181,13 @@ nodes.
func accountList(ctx *cli.Context) error {
stack := utils.MakeNode(ctx, clientIdentifier, gitCommit)
- for i, acct := range stack.AccountManager().Accounts() {
- fmt.Printf("Account #%d: {%x} %s\n", i, acct.Address, acct.URL)
+
+ var index int
+ for _, wallet := range stack.AccountManager().Wallets() {
+ for _, account := range wallet.Accounts() {
+ fmt.Printf("Account #%d: {%x} %s\n", index, account.Address, account.URL)
+ index++
+ }
}
return nil
}
@@ -276,7 +281,7 @@ func accountCreate(ctx *cli.Context) error {
stack := utils.MakeNode(ctx, clientIdentifier, gitCommit)
password := getPassPhrase("Your new account is locked with a password. Please give a password. Do not forget this password.", true, 0, utils.MakePasswordList(ctx))
- ks := stack.AccountManager().Backend(keystore.BackendType).(*keystore.KeyStore)
+ ks := stack.AccountManager().Backends(keystore.KeyStoreType)[0].(*keystore.KeyStore)
account, err := ks.NewAccount(password)
if err != nil {
utils.Fatalf("Failed to create account: %v", err)
@@ -292,7 +297,7 @@ func accountUpdate(ctx *cli.Context) error {
utils.Fatalf("No accounts specified to update")
}
stack := utils.MakeNode(ctx, clientIdentifier, gitCommit)
- ks := stack.AccountManager().Backend(keystore.BackendType).(*keystore.KeyStore)
+ ks := stack.AccountManager().Backends(keystore.KeyStoreType)[0].(*keystore.KeyStore)
account, oldPassword := unlockAccount(ctx, ks, ctx.Args().First(), 0, nil)
newPassword := getPassPhrase("Please give a new password. Do not forget this password.", true, 0, nil)
@@ -315,7 +320,7 @@ func importWallet(ctx *cli.Context) error {
stack := utils.MakeNode(ctx, clientIdentifier, gitCommit)
passphrase := getPassPhrase("", false, 0, utils.MakePasswordList(ctx))
- ks := stack.AccountManager().Backend(keystore.BackendType).(*keystore.KeyStore)
+ ks := stack.AccountManager().Backends(keystore.KeyStoreType)[0].(*keystore.KeyStore)
acct, err := ks.ImportPreSaleKey(keyJson, passphrase)
if err != nil {
utils.Fatalf("%v", err)
@@ -336,7 +341,7 @@ func accountImport(ctx *cli.Context) error {
stack := utils.MakeNode(ctx, clientIdentifier, gitCommit)
passphrase := getPassPhrase("Your new account is locked with a password. Please give a password. Do not forget this password.", true, 0, utils.MakePasswordList(ctx))
- ks := stack.AccountManager().Backend(keystore.BackendType).(*keystore.KeyStore)
+ ks := stack.AccountManager().Backends(keystore.KeyStoreType)[0].(*keystore.KeyStore)
acct, err := ks.ImportECDSA(key, passphrase)
if err != nil {
utils.Fatalf("Could not create the account: %v", err)