refactoring to use generic account provider as web3 svc
This commit is contained in:
parent
ed0047725c
commit
70ee6aa942
@ -22,20 +22,20 @@ use util::keys::store::*;
|
|||||||
use util::Address;
|
use util::Address;
|
||||||
|
|
||||||
/// Account management (personal) rpc implementation.
|
/// Account management (personal) rpc implementation.
|
||||||
pub struct PersonalClient {
|
pub struct PersonalClient<A> where A: AccountProvider {
|
||||||
accounts: Weak<AccountProvider>,
|
accounts: Weak<A>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl PersonalClient {
|
impl<A> PersonalClient<A> where A: AccountProvider {
|
||||||
/// Creates new PersonalClient
|
/// Creates new PersonalClient
|
||||||
pub fn new(store: &Arc<AccountProvider>) -> Self {
|
pub fn new(store: &Arc<A>) -> Self {
|
||||||
PersonalClient {
|
PersonalClient {
|
||||||
accounts: Arc::downgrade(store),
|
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> {
|
fn accounts(&self, _: Params) -> Result<Value, Error> {
|
||||||
let store = take_weak!(self.accounts);
|
let store = take_weak!(self.accounts);
|
||||||
match store.accounts() {
|
match store.accounts() {
|
||||||
|
Loading…
Reference in New Issue
Block a user