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

Completely remove all dapps struct from rpc #9107

Merged
merged 2 commits into from
Jul 16, 2018
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion parity/rpc_apis.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ use std::str::FromStr;
use std::sync::{Arc, Weak};

pub use parity_rpc::signer::SignerService;
pub use parity_rpc::dapps::LocalDapp;

use ethcore_service::PrivateTxService;
use ethcore::account_provider::AccountProvider;
Expand Down
2 changes: 1 addition & 1 deletion rpc/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ pub use http::{
AccessControlAllowOrigin, Host, DomainsValidation
};

pub use v1::{NetworkSettings, Metadata, Origin, informant, dispatch, signer, dapps};
pub use v1::{NetworkSettings, Metadata, Origin, informant, dispatch, signer};
pub use v1::block_import::is_major_importing;
pub use v1::extractors::{RpcExtractor, WsExtractor, WsStats, WsDispatcher};
pub use authcodes::{AuthCodes, TimeProvider};
Expand Down
27 changes: 0 additions & 27 deletions rpc/src/v1/helpers/dapps.rs

This file was deleted.

8 changes: 0 additions & 8 deletions rpc/src/v1/helpers/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -211,14 +211,6 @@ pub fn signer_disabled() -> Error {
}
}

pub fn dapps_disabled() -> Error {
Error {
code: ErrorCode::ServerError(codes::UNSUPPORTED_REQUEST),
message: "Dapps Server is disabled. This API is not available.".into(),
data: None,
}
}

pub fn ws_disabled() -> Error {
Error {
code: ErrorCode::ServerError(codes::UNSUPPORTED_REQUEST),
Expand Down
1 change: 0 additions & 1 deletion rpc/src/v1/helpers/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
pub mod errors;

pub mod block_import;
pub mod dapps;
pub mod dispatch;
pub mod fake_sign;
pub mod ipfs;
Expand Down
4 changes: 0 additions & 4 deletions rpc/src/v1/impls/light/parity.rs
Original file line number Diff line number Diff line change
Expand Up @@ -326,10 +326,6 @@ impl Parity for ParityClient {
Ok(map)
}

fn dapps_url(&self) -> Result<String> {
Err(errors::dapps_disabled())
}

fn ws_url(&self) -> Result<String> {
helpers::to_url(&self.ws_address)
.ok_or_else(|| errors::ws_disabled())
Expand Down
10 changes: 1 addition & 9 deletions rpc/src/v1/impls/light/parity_set.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ use jsonrpc_core::{Result, BoxFuture};
use jsonrpc_core::futures::Future;
use v1::helpers::errors;
use v1::traits::ParitySet;
use v1::types::{Bytes, H160, H256, U256, ReleaseInfo, Transaction, LocalDapp};
use v1::types::{Bytes, H160, H256, U256, ReleaseInfo, Transaction};

/// Parity-specific rpc interface for operations altering the settings.
pub struct ParitySetClient<F> {
Expand Down Expand Up @@ -137,14 +137,6 @@ impl<F: Fetch> ParitySet for ParitySetClient<F> {
Box::new(self.pool.spawn(future))
}

fn dapps_refresh(&self) -> Result<bool> {
Err(errors::dapps_disabled())
}

fn dapps_list(&self) -> Result<Vec<LocalDapp>> {
Err(errors::dapps_disabled())
}

fn upgrade_ready(&self) -> Result<Option<ReleaseInfo>> {
Err(errors::light_unimplemented(None))
}
Expand Down
8 changes: 2 additions & 6 deletions rpc/src/v1/impls/parity.rs
Original file line number Diff line number Diff line change
Expand Up @@ -139,11 +139,11 @@ impl<C, M, U, S> Parity for ParityClient<C, M, U> where
.collect()
)
}

fn locked_hardware_accounts_info(&self) -> Result<Vec<String>> {
self.accounts.locked_hardware_accounts().map_err(|e| errors::account("Error communicating with hardware wallet.", e))
}

fn default_account(&self, meta: Self::Metadata) -> Result<H160> {
let dapp_id = meta.dapp_id();

Expand Down Expand Up @@ -347,10 +347,6 @@ impl<C, M, U, S> Parity for ParityClient<C, M, U> where
)
}

fn dapps_url(&self) -> Result<String> {
Err(errors::dapps_disabled())
}

fn ws_url(&self) -> Result<String> {
helpers::to_url(&self.ws_address)
.ok_or_else(|| errors::ws_disabled())
Expand Down
10 changes: 1 addition & 9 deletions rpc/src/v1/impls/parity_set.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ use jsonrpc_core::{BoxFuture, Result};
use jsonrpc_core::futures::Future;
use v1::helpers::errors;
use v1::traits::ParitySet;
use v1::types::{Bytes, H160, H256, U256, ReleaseInfo, Transaction, LocalDapp};
use v1::types::{Bytes, H160, H256, U256, ReleaseInfo, Transaction};

/// Parity-specific rpc interface for operations altering the settings.
pub struct ParitySetClient<C, M, U, F = fetch::Client> {
Expand Down Expand Up @@ -182,14 +182,6 @@ impl<C, M, U, F> ParitySet for ParitySetClient<C, M, U, F> where
Box::new(self.pool.spawn(future))
}

fn dapps_refresh(&self) -> Result<bool> {
Err(errors::dapps_disabled())
}

fn dapps_list(&self) -> Result<Vec<LocalDapp>> {
Err(errors::dapps_disabled())
}

fn upgrade_ready(&self) -> Result<Option<ReleaseInfo>> {
Ok(self.updater.upgrade_ready().map(Into::into))
}
Expand Down
6 changes: 0 additions & 6 deletions rpc/src/v1/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,3 @@ pub mod signer {
pub use super::helpers::{SigningQueue, SignerService, ConfirmationsQueue};
pub use super::types::{ConfirmationRequest, TransactionModification, U256, TransactionCondition};
}

/// Dapps integration utilities
pub mod dapps {
pub use super::helpers::dapps::DappsService;
pub use super::types::LocalDapp;
}
14 changes: 0 additions & 14 deletions rpc/src/v1/tests/mocked/parity.rs
Original file line number Diff line number Diff line change
Expand Up @@ -425,20 +425,6 @@ fn rpc_parity_ws_address() {
assert_eq!(io2.handle_request_sync(request), Some(response2.to_owned()));
}

#[test]
fn rpc_parity_dapps_address() {
// given
let deps = Dependencies::new();
let io1 = deps.default_client();

// when
let request = r#"{"jsonrpc": "2.0", "method": "parity_dappsUrl", "params": [], "id": 1}"#;
let response = r#"{"jsonrpc":"2.0","error":{"code":-32000,"message":"Dapps Server is disabled. This API is not available."},"id":1}"#;

// then
assert_eq!(io1.handle_request_sync(request), Some(response.to_owned()));
}

#[test]
fn rpc_parity_next_nonce() {
let deps = Dependencies::new();
Expand Down
15 changes: 0 additions & 15 deletions rpc/src/v1/tests/mocked/parity_set.rs
Original file line number Diff line number Diff line change
Expand Up @@ -238,18 +238,3 @@ fn rpc_parity_remove_transaction() {
miner.pending_transactions.lock().insert(hash, signed);
assert_eq!(io.handle_request_sync(&request), Some(response.to_owned()));
}

#[test]
fn rpc_parity_set_dapps_list() {
let miner = miner_service();
let client = client_service();
let network = network_service();
let updater = updater_service();
let mut io = IoHandler::new();
io.extend_with(parity_set_client(&client, &miner, &updater, &network).to_delegate());

let request = r#"{"jsonrpc": "2.0", "method": "parity_dappsList", "params":[], "id": 1}"#;
let response = r#"{"jsonrpc":"2.0","error":{"code":-32000,"message":"Dapps Server is disabled. This API is not available."},"id":1}"#;

assert_eq!(io.handle_request_sync(request), Some(response.to_owned()));
}
5 changes: 0 additions & 5 deletions rpc/src/v1/traits/parity.rs
Original file line number Diff line number Diff line change
Expand Up @@ -161,11 +161,6 @@ build_rpc_trait! {
#[rpc(name = "parity_localTransactions")]
fn local_transactions(&self) -> Result<BTreeMap<H256, LocalTransactionStatus>>;

/// Returns current Dapps Server interface and port or an error if dapps server is disabled.
/// (deprecated, should always return an error now).
#[rpc(name = "parity_dappsUrl")]
fn dapps_url(&self) -> Result<String>;

/// Returns current WS Server interface and port or an error if ws server is disabled.
#[rpc(name = "parity_wsUrl")]
fn ws_url(&self) -> Result<String>;
Expand Down
11 changes: 1 addition & 10 deletions rpc/src/v1/traits/parity_set.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

use jsonrpc_core::{BoxFuture, Result};

use v1::types::{Bytes, H160, H256, U256, ReleaseInfo, Transaction, LocalDapp};
use v1::types::{Bytes, H160, H256, U256, ReleaseInfo, Transaction};

build_rpc_trait! {
/// Parity-specific rpc interface for operations altering the settings.
Expand Down Expand Up @@ -95,15 +95,6 @@ build_rpc_trait! {
#[rpc(name = "parity_hashContent")]
fn hash_content(&self, String) -> BoxFuture<H256>;

/// Returns true if refresh successful, error if unsuccessful or server is disabled
/// (deprecated, should always return an error now).
#[rpc(name = "parity_dappsRefresh")]
fn dapps_refresh(&self) -> Result<bool>;

/// Returns a list of local dapps (deprecated, should always return an error now).
#[rpc(name = "parity_dappsList")]
fn dapps_list(&self) -> Result<Vec<LocalDapp>>;

/// Is there a release ready for install?
#[rpc(name = "parity_upgradeReady")]
fn upgrade_ready(&self) -> Result<Option<ReleaseInfo>>;
Expand Down
61 changes: 0 additions & 61 deletions rpc/src/v1/types/dapps.rs

This file was deleted.

2 changes: 0 additions & 2 deletions rpc/src/v1/types/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ mod bytes;
mod call_request;
mod confirmations;
mod consensus_status;
mod dapps;
mod derivation;
mod filter;
mod hash;
Expand Down Expand Up @@ -57,7 +56,6 @@ pub use self::confirmations::{
TransactionModification, SignRequest, DecryptRequest, Either
};
pub use self::consensus_status::*;
pub use self::dapps::LocalDapp;
pub use self::derivation::{DeriveHash, DeriveHierarchical, Derive};
pub use self::filter::{Filter, FilterChanges};
pub use self::hash::{H64, H160, H256, H512, H520, H2048};
Expand Down