Light friendly dapps (#5634)
* move native_contracts ABIs to JSON files, add urlhint * port hash-fetch to futures, fix tests * fix dapps compilation, defer async port to later * activate dapps server in the light client * better formatting
This commit is contained in:
committed by
Gav Wood
parent
95d9706fe1
commit
b1eab698d2
@@ -16,6 +16,7 @@ target_info = "0.1"
|
||||
ethcore = { path = "../ethcore" }
|
||||
ethsync = { path = "../sync" }
|
||||
ethcore-util = { path = "../util" }
|
||||
futures = "0.1"
|
||||
parity-hash-fetch = { path = "../hash-fetch" }
|
||||
ipc-common-types = { path = "../ipc-common-types" }
|
||||
ethcore-ipc = { path = "../ipc/rpc" }
|
||||
|
||||
@@ -24,6 +24,7 @@ extern crate ethcore;
|
||||
extern crate ethabi;
|
||||
extern crate ethsync;
|
||||
extern crate ethcore_ipc as ipc;
|
||||
extern crate futures;
|
||||
extern crate target_info;
|
||||
extern crate parity_reactor;
|
||||
extern crate path;
|
||||
|
||||
@@ -14,23 +14,25 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
use std::sync::{Arc, Weak};
|
||||
use std::fs;
|
||||
use std::io::Write;
|
||||
use std::path::{PathBuf};
|
||||
use target_info::Target;
|
||||
use util::misc;
|
||||
use ipc_common_types::{VersionInfo, ReleaseTrack};
|
||||
use path::restrict_permissions_owner;
|
||||
use util::{Address, H160, H256, Mutex, Bytes};
|
||||
use ethsync::{SyncProvider};
|
||||
use std::sync::{Arc, Weak};
|
||||
|
||||
use ethcore::client::{BlockId, BlockChainClient, ChainNotify};
|
||||
use ethsync::{SyncProvider};
|
||||
use futures::{future, Future, BoxFuture};
|
||||
use hash_fetch::{self as fetch, HashFetch};
|
||||
use hash_fetch::fetch::Client as FetchService;
|
||||
use ipc_common_types::{VersionInfo, ReleaseTrack};
|
||||
use operations::Operations;
|
||||
use parity_reactor::Remote;
|
||||
use path::restrict_permissions_owner;
|
||||
use service::{Service};
|
||||
use target_info::Target;
|
||||
use types::all::{ReleaseInfo, OperationsInfo, CapState};
|
||||
use util::{Address, H160, H256, Mutex, Bytes};
|
||||
use util::misc;
|
||||
|
||||
/// Filter for releases.
|
||||
#[derive(Debug, Eq, PartialEq, Clone)]
|
||||
@@ -338,9 +340,12 @@ impl fetch::urlhint::ContractClient for Updater {
|
||||
.ok_or_else(|| "Registrar not available".into())
|
||||
}
|
||||
|
||||
fn call(&self, address: Address, data: Bytes) -> Result<Bytes, String> {
|
||||
self.client.upgrade().ok_or_else(|| "Client not available".to_owned())?
|
||||
.call_contract(BlockId::Latest, address, data)
|
||||
fn call(&self, address: Address, data: Bytes) -> BoxFuture<Bytes, String> {
|
||||
future::done(
|
||||
self.client.upgrade()
|
||||
.ok_or_else(|| "Client not available".into())
|
||||
.and_then(move |c| c.call_contract(BlockId::Latest, address, data))
|
||||
).boxed()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user