Export account RPC (#4967)

* Export account RPC

* Removing GethDirectory and ParityDirectory

* Updating ethstore-cli help.
This commit is contained in:
Tomasz Drwięga
2017-03-23 13:23:03 +01:00
committed by Gav Wood
parent 9fdd0e3a0a
commit bb1bbebfd6
19 changed files with 318 additions and 265 deletions

View File

@@ -20,6 +20,7 @@ use std::collections::BTreeMap;
use util::{Address};
use ethkey::{Brain, Generator, Secret};
use ethstore::KeyFile;
use ethcore::account_provider::AccountProvider;
use jsonrpc_core::Error;
@@ -315,6 +316,17 @@ impl ParityAccounts for ParityAccountsClient {
.map(Into::into)
.map_err(|e| errors::account("Could not derive account.", e))
}
fn export_account(&self, addr: RpcH160, password: String) -> Result<KeyFile, Error> {
let addr = addr.into();
take_weak!(self.accounts)
.export_account(
&addr,
password,
)
.map(Into::into)
.map_err(|e| errors::account("Could not export account.", e))
}
}
fn into_vec<A, B>(a: Vec<A>) -> Vec<B> where