State export

This commit is contained in:
arkpar
2016-11-27 11:11:56 +01:00
parent 8b3cdc513b
commit b0555fbe7c
17 changed files with 323 additions and 95 deletions

View File

@@ -234,19 +234,20 @@ impl<C, M, S: ?Sized> Parity for ParityClient<C, M, S> where
Ok(Brain::new(phrase).generate().unwrap().address().into())
}
fn list_accounts(&self) -> Result<Option<Vec<H160>>, Error> {
fn list_accounts(&self, after: Option<H160>, count: u64) -> Result<Option<Vec<H160>>, Error> {
try!(self.active());
Ok(take_weak!(self.client)
.list_accounts(BlockID::Latest)
.list_accounts(BlockID::Latest, after.map(Into::into).as_ref(), count)
.map(|a| a.into_iter().map(Into::into).collect()))
}
fn list_storage_keys(&self, _address: H160) -> Result<Option<Vec<H256>>, Error> {
fn list_storage_keys(&self, address: H160, after: Option<H256>, count: u64) -> Result<Option<Vec<H256>>, Error> {
try!(self.active());
// TODO: implement this
Ok(None)
Ok(take_weak!(self.client)
.list_storage(BlockID::Latest, &address.into(), after.map(Into::into).as_ref(), count)
.map(|a| a.into_iter().map(Into::into).collect()))
}
fn encrypt_message(&self, key: H512, phrase: Bytes) -> Result<Bytes, Error> {

View File

@@ -103,12 +103,12 @@ build_rpc_trait! {
/// Returns all addresses if Fat DB is enabled (`--fat-db`), or null if not.
#[rpc(name = "parity_listAccounts")]
fn list_accounts(&self) -> Result<Option<Vec<H160>>, Error>;
fn list_accounts(&self, Option<H160>, u64) -> Result<Option<Vec<H160>>, Error>;
/// Returns all storage keys of the given address (first parameter) if Fat DB is enabled (`--fat-db`),
/// or null if not.
#[rpc(name = "parity_listStorageKeys")]
fn list_storage_keys(&self, H160) -> Result<Option<Vec<H256>>, Error>;
fn list_storage_keys(&self, H160, Option<H256>, u64) -> Result<Option<Vec<H256>>, Error>;
/// Encrypt some data with a public key under ECIES.
/// First parameter is the 512-byte destination public key, second is the message.