Add parity_removeAddress RPC

This commit is contained in:
Jaco Greeff
2016-12-07 16:53:46 +01:00
parent 1f0a02b638
commit 46840d36c9
6 changed files with 65 additions and 1 deletions

View File

@@ -126,6 +126,16 @@ impl<C: 'static> ParityAccounts for ParityAccountsClient<C> where C: MiningBlock
.map_err(|e| errors::account("Could not delete account.", e))
}
fn remove_address(&self, addr: RpcH160) -> Result<bool, Error> {
try!(self.active());
let store = take_weak!(self.accounts);
let addr: Address = addr.into();
store.remove_address(addr, name))
.expect("remove_address always returns Ok; qed");
Ok(true)
}
fn set_account_name(&self, addr: RpcH160, name: String) -> Result<bool, Error> {
try!(self.active());
let store = take_weak!(self.accounts);

View File

@@ -58,6 +58,11 @@ build_rpc_trait! {
#[rpc(name = "parity_killAccount")]
fn kill_account(&self, H160, String) -> Result<bool, Error>;
/// Permanently deletes an address from the addressbook
/// Arguments: `address`
#[rpc(name = "parity_removeAddress")]
fn remove_address(&self, H160) -> Result<bool, Error>;
/// Set an account's name.
#[rpc(name = "parity_setAccountName")]
fn set_account_name(&self, H160, String) -> Result<bool, Error>;
@@ -83,4 +88,3 @@ build_rpc_trait! {
fn geth_accounts(&self) -> Result<Vec<H160>, Error>;
}
}