Skip to content
This repository has been archived by the owner on Nov 6, 2020. It is now read-only.

Making personal json-rpc configurable via cli #677

Merged
merged 4 commits into from
Mar 11, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 3 additions & 1 deletion parity/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,8 @@ API and Console Options:
--jsonrpc-port PORT Specify the port portion of the JSONRPC API server [default: 8545].
--jsonrpc-cors URL Specify CORS header for JSON-RPC API responses [default: null].
--jsonrpc-apis APIS Specify the APIs available through the JSONRPC interface. APIS is a comma-delimited
list of API name. Possible names are web3, eth and net. [default: web3,eth,net].
list of API name. Possible name are web3, eth and net. [default: web3,eth,net,personal].

--rpc Equivalent to --jsonrpc (geth-compatible).
--rpcaddr HOST Equivalent to --jsonrpc-addr HOST (geth-compatible).
--rpcport PORT Equivalent to --jsonrpc-port PORT (geth-compatible).
Expand Down Expand Up @@ -231,6 +232,7 @@ fn setup_rpc_server(client: Arc<Client>, sync: Arc<EthSync>, secret_store: Arc<A
server.add_delegate(EthClient::new(&client, &sync, &secret_store).to_delegate());
server.add_delegate(EthFilterClient::new(&client).to_delegate());
}
"personal" => server.add_delegate(PersonalClient::new(&secret_store).to_delegate()),
_ => {
die!("{}: Invalid API name to be enabled.", api);
}
Expand Down
10 changes: 5 additions & 5 deletions rpc/src/v1/impls/personal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,20 +22,20 @@ use util::keys::store::*;
use util::Address;

/// Account management (personal) rpc implementation.
pub struct PersonalClient {
accounts: Weak<AccountProvider>,
pub struct PersonalClient<A> where A: AccountProvider {
accounts: Weak<A>,
}

impl PersonalClient {
impl<A> PersonalClient<A> where A: AccountProvider {
/// Creates new PersonalClient
pub fn new(store: &Arc<AccountProvider>) -> Self {
pub fn new(store: &Arc<A>) -> Self {
PersonalClient {
accounts: Arc::downgrade(store),
}
}
}

impl Personal for PersonalClient {
impl<A> Personal for PersonalClient<A> where A: AccountProvider + 'static {
fn accounts(&self, _: Params) -> Result<Value, Error> {
let store = take_weak!(self.accounts);
match store.accounts() {
Expand Down