aboutsummaryrefslogtreecommitdiffstats
path: root/accounts
diff options
context:
space:
mode:
authorzelig <viktor.tron@gmail.com>2015-03-25 00:19:11 +0800
committerzelig <viktor.tron@gmail.com>2015-03-27 03:00:18 +0800
commitd1b52efdb581ca90613d2047b974d3a128f9bc58 (patch)
tree39148dfa9bf43062ec44bccd69d790218172725e /accounts
parent34d5a6c156a014ce000b4f850f2b0f11533387f0 (diff)
downloaddexon-d1b52efdb581ca90613d2047b974d3a128f9bc58.tar.gz
dexon-d1b52efdb581ca90613d2047b974d3a128f9bc58.tar.zst
dexon-d1b52efdb581ca90613d2047b974d3a128f9bc58.zip
cli: implement ethereum presale wallet import via cli
Diffstat (limited to 'accounts')
-rw-r--r--accounts/account_manager.go12
1 files changed, 12 insertions, 0 deletions
diff --git a/accounts/account_manager.go b/accounts/account_manager.go
index 21ef46991..f063f8ca5 100644
--- a/accounts/account_manager.go
+++ b/accounts/account_manager.go
@@ -239,3 +239,15 @@ func (am *Manager) Import(path string, keyAuth string) (Account, error) {
}
return Account{Address: key.Address}, nil
}
+
+func (am *Manager) ImportPreSaleKey(keyJSON []byte, password string) (acc Account, err error) {
+ var key *crypto.Key
+ key, err = crypto.ImportPreSaleKey(am.keyStore, keyJSON, password)
+ if err != nil {
+ return
+ }
+ if err = am.keyStore.StoreKey(key, password); err != nil {
+ return
+ }
+ return Account{Address: key.Address}, nil
+}