Remove all dapp permissions related settings (#9120)
* Completely remove all dapps struct from rpc * Remove unused pub use * Remove dapp policy/permission func in ethcore * Remove all dapps settings from rpc * Fix rpc tests * Use both origin and user_agent * Address grumbles * Address grumbles * Fix tests
This commit is contained in:
@@ -21,11 +21,11 @@ use std::time::{Instant, Duration, SystemTime, UNIX_EPOCH};
|
||||
use std::sync::Arc;
|
||||
|
||||
use rlp::{self, Rlp};
|
||||
use ethereum_types::{U256, H64, H160, H256, Address};
|
||||
use ethereum_types::{U256, H64, H256, Address};
|
||||
use parking_lot::Mutex;
|
||||
|
||||
use ethash::SeedHashCompute;
|
||||
use ethcore::account_provider::{AccountProvider, DappId};
|
||||
use ethcore::account_provider::AccountProvider;
|
||||
use ethcore::client::{BlockChainClient, BlockId, TransactionId, UncleId, StateOrBlock, StateClient, StateInfo, Call, EngineInfo};
|
||||
use ethcore::ethereum::Ethash;
|
||||
use ethcore::filter::Filter as EthcoreFilter;
|
||||
@@ -398,13 +398,6 @@ impl<C, SN: ?Sized, S: ?Sized, M, EM, T: StateInfo + 'static> EthClient<C, SN, S
|
||||
Ok(Some(block))
|
||||
}
|
||||
|
||||
fn dapp_accounts(&self, dapp: DappId) -> Result<Vec<H160>> {
|
||||
self.accounts
|
||||
.note_dapp_used(dapp.clone())
|
||||
.and_then(|_| self.accounts.dapp_addresses(dapp))
|
||||
.map_err(|e| errors::account("Could not fetch accounts.", e))
|
||||
}
|
||||
|
||||
fn get_state(&self, number: BlockNumber) -> StateOrBlock {
|
||||
match number {
|
||||
BlockNumber::Num(num) => BlockId::Number(num).into(),
|
||||
@@ -507,12 +500,10 @@ impl<C, SN: ?Sized, S: ?Sized, M, EM, T: StateInfo + 'static> Eth for EthClient<
|
||||
}
|
||||
}
|
||||
|
||||
fn author(&self, meta: Metadata) -> Result<RpcH160> {
|
||||
let dapp = meta.dapp_id();
|
||||
|
||||
fn author(&self) -> Result<RpcH160> {
|
||||
let mut miner = self.miner.authoring_params().author;
|
||||
if miner == 0.into() {
|
||||
miner = self.dapp_accounts(dapp.into())?.get(0).cloned().unwrap_or_default();
|
||||
miner = self.accounts.accounts().ok().and_then(|a| a.get(0).cloned()).unwrap_or_default();
|
||||
}
|
||||
|
||||
Ok(RpcH160::from(miner))
|
||||
@@ -530,10 +521,9 @@ impl<C, SN: ?Sized, S: ?Sized, M, EM, T: StateInfo + 'static> Eth for EthClient<
|
||||
Ok(RpcU256::from(default_gas_price(&*self.client, &*self.miner, self.options.gas_price_percentile)))
|
||||
}
|
||||
|
||||
fn accounts(&self, meta: Metadata) -> Result<Vec<RpcH160>> {
|
||||
let dapp = meta.dapp_id();
|
||||
|
||||
let accounts = self.dapp_accounts(dapp.into())?;
|
||||
fn accounts(&self) -> Result<Vec<RpcH160>> {
|
||||
let accounts = self.accounts.accounts()
|
||||
.map_err(|e| errors::account("Could not fetch accounts.", e))?;
|
||||
Ok(accounts.into_iter().map(Into::into).collect())
|
||||
}
|
||||
|
||||
@@ -835,9 +825,9 @@ impl<C, SN: ?Sized, S: ?Sized, M, EM, T: StateInfo + 'static> Eth for EthClient<
|
||||
self.send_raw_transaction(raw)
|
||||
}
|
||||
|
||||
fn call(&self, meta: Self::Metadata, request: CallRequest, num: Trailing<BlockNumber>) -> BoxFuture<Bytes> {
|
||||
fn call(&self, request: CallRequest, num: Trailing<BlockNumber>) -> BoxFuture<Bytes> {
|
||||
let request = CallRequest::into(request);
|
||||
let signed = try_bf!(fake_sign::sign_call(request, meta.is_dapp()));
|
||||
let signed = try_bf!(fake_sign::sign_call(request));
|
||||
|
||||
let num = num.unwrap_or_default();
|
||||
|
||||
@@ -875,9 +865,9 @@ impl<C, SN: ?Sized, S: ?Sized, M, EM, T: StateInfo + 'static> Eth for EthClient<
|
||||
))
|
||||
}
|
||||
|
||||
fn estimate_gas(&self, meta: Self::Metadata, request: CallRequest, num: Trailing<BlockNumber>) -> BoxFuture<RpcU256> {
|
||||
fn estimate_gas(&self, request: CallRequest, num: Trailing<BlockNumber>) -> BoxFuture<RpcU256> {
|
||||
let request = CallRequest::into(request);
|
||||
let signed = try_bf!(fake_sign::sign_call(request, meta.is_dapp()));
|
||||
let signed = try_bf!(fake_sign::sign_call(request));
|
||||
let num = num.unwrap_or_default();
|
||||
|
||||
let (state, header) = if num == BlockNumber::Pending {
|
||||
|
||||
@@ -29,7 +29,7 @@ use light::client::LightChainClient;
|
||||
use light::{cht, TransactionQueue};
|
||||
use light::on_demand::{request, OnDemand};
|
||||
|
||||
use ethcore::account_provider::{AccountProvider, DappId};
|
||||
use ethcore::account_provider::AccountProvider;
|
||||
use ethcore::encoded;
|
||||
use ethcore::filter::Filter as EthcoreFilter;
|
||||
use ethcore::ids::BlockId;
|
||||
@@ -251,7 +251,7 @@ impl<T: LightChainClient + 'static> Eth for EthClient<T> {
|
||||
}
|
||||
}
|
||||
|
||||
fn author(&self, _meta: Self::Metadata) -> Result<RpcH160> {
|
||||
fn author(&self) -> Result<RpcH160> {
|
||||
Ok(Default::default())
|
||||
}
|
||||
|
||||
@@ -270,12 +270,8 @@ impl<T: LightChainClient + 'static> Eth for EthClient<T> {
|
||||
.unwrap_or_else(Default::default))
|
||||
}
|
||||
|
||||
fn accounts(&self, meta: Metadata) -> Result<Vec<RpcH160>> {
|
||||
let dapp: DappId = meta.dapp_id().into();
|
||||
|
||||
self.accounts
|
||||
.note_dapp_used(dapp.clone())
|
||||
.and_then(|_| self.accounts.dapp_addresses(dapp))
|
||||
fn accounts(&self) -> Result<Vec<RpcH160>> {
|
||||
self.accounts.accounts()
|
||||
.map_err(|e| errors::account("Could not fetch accounts.", e))
|
||||
.map(|accs| accs.into_iter().map(Into::<RpcH160>::into).collect())
|
||||
}
|
||||
@@ -397,7 +393,7 @@ impl<T: LightChainClient + 'static> Eth for EthClient<T> {
|
||||
self.send_raw_transaction(raw)
|
||||
}
|
||||
|
||||
fn call(&self, _meta: Self::Metadata, req: CallRequest, num: Trailing<BlockNumber>) -> BoxFuture<Bytes> {
|
||||
fn call(&self, req: CallRequest, num: Trailing<BlockNumber>) -> BoxFuture<Bytes> {
|
||||
Box::new(self.fetcher().proved_execution(req, num).and_then(|res| {
|
||||
match res {
|
||||
Ok(exec) => Ok(exec.output.into()),
|
||||
@@ -406,7 +402,7 @@ impl<T: LightChainClient + 'static> Eth for EthClient<T> {
|
||||
}))
|
||||
}
|
||||
|
||||
fn estimate_gas(&self, _meta: Self::Metadata, req: CallRequest, num: Trailing<BlockNumber>) -> BoxFuture<RpcU256> {
|
||||
fn estimate_gas(&self, req: CallRequest, num: Trailing<BlockNumber>) -> BoxFuture<RpcU256> {
|
||||
// TODO: binary chop for more accurate estimates.
|
||||
Box::new(self.fetcher().proved_execution(req, num).and_then(|res| {
|
||||
match res {
|
||||
|
||||
@@ -43,7 +43,7 @@ use v1::types::{
|
||||
Peers, Transaction, RpcSettings, Histogram,
|
||||
TransactionStats, LocalTransactionStatus,
|
||||
BlockNumber, ConsensusCapability, VersionInfo,
|
||||
OperationsInfo, DappId, ChainStatus,
|
||||
OperationsInfo, ChainStatus,
|
||||
AccountInfo, HwAccountInfo, Header, RichHeader,
|
||||
};
|
||||
use Host;
|
||||
@@ -99,13 +99,10 @@ impl ParityClient {
|
||||
impl Parity for ParityClient {
|
||||
type Metadata = Metadata;
|
||||
|
||||
fn accounts_info(&self, dapp: Trailing<DappId>) -> Result<BTreeMap<H160, AccountInfo>> {
|
||||
let dapp = dapp.unwrap_or_default();
|
||||
|
||||
fn accounts_info(&self) -> Result<BTreeMap<H160, AccountInfo>> {
|
||||
let store = &self.accounts;
|
||||
let dapp_accounts = store
|
||||
.note_dapp_used(dapp.clone().into())
|
||||
.and_then(|_| store.dapp_addresses(dapp.into()))
|
||||
.accounts()
|
||||
.map_err(|e| errors::account("Could not fetch accounts.", e))?
|
||||
.into_iter().collect::<HashSet<_>>();
|
||||
|
||||
@@ -136,10 +133,9 @@ impl Parity for ParityClient {
|
||||
Ok(store.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();
|
||||
fn default_account(&self) -> Result<H160> {
|
||||
Ok(self.accounts
|
||||
.dapp_addresses(dapp_id.into())
|
||||
.accounts()
|
||||
.ok()
|
||||
.and_then(|accounts| accounts.get(0).cloned())
|
||||
.map(|acc| acc.into())
|
||||
@@ -423,7 +419,7 @@ impl Parity for ParityClient {
|
||||
ipfs::cid(content)
|
||||
}
|
||||
|
||||
fn call(&self, _meta: Self::Metadata, _requests: Vec<CallRequest>, _block: Trailing<BlockNumber>) -> Result<Vec<Bytes>> {
|
||||
fn call(&self, _requests: Vec<CallRequest>, _block: Trailing<BlockNumber>) -> Result<Vec<Bytes>> {
|
||||
Err(errors::light_unimplemented(None))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -46,11 +46,11 @@ impl Traces for TracesClient {
|
||||
Err(errors::light_unimplemented(None))
|
||||
}
|
||||
|
||||
fn call(&self, _meta: Self::Metadata, _request: CallRequest, _flags: TraceOptions, _block: Trailing<BlockNumber>) -> Result<TraceResults> {
|
||||
fn call(&self, _request: CallRequest, _flags: TraceOptions, _block: Trailing<BlockNumber>) -> Result<TraceResults> {
|
||||
Err(errors::light_unimplemented(None))
|
||||
}
|
||||
|
||||
fn call_many(&self, _meta: Self::Metadata, _request: Vec<(CallRequest, TraceOptions)>, _block: Trailing<BlockNumber>) -> Result<Vec<TraceResults>> {
|
||||
fn call_many(&self, _request: Vec<(CallRequest, TraceOptions)>, _block: Trailing<BlockNumber>) -> Result<Vec<TraceResults>> {
|
||||
Err(errors::light_unimplemented(None))
|
||||
}
|
||||
|
||||
|
||||
@@ -44,7 +44,7 @@ use v1::types::{
|
||||
Peers, Transaction, RpcSettings, Histogram,
|
||||
TransactionStats, LocalTransactionStatus,
|
||||
BlockNumber, ConsensusCapability, VersionInfo,
|
||||
OperationsInfo, DappId, ChainStatus,
|
||||
OperationsInfo, ChainStatus,
|
||||
AccountInfo, HwAccountInfo, RichHeader,
|
||||
block_number_to_id
|
||||
};
|
||||
@@ -103,12 +103,8 @@ impl<C, M, U, S> Parity for ParityClient<C, M, U> where
|
||||
{
|
||||
type Metadata = Metadata;
|
||||
|
||||
fn accounts_info(&self, dapp: Trailing<DappId>) -> Result<BTreeMap<H160, AccountInfo>> {
|
||||
let dapp = dapp.unwrap_or_default();
|
||||
|
||||
let dapp_accounts = self.accounts
|
||||
.note_dapp_used(dapp.clone().into())
|
||||
.and_then(|_| self.accounts.dapp_addresses(dapp.into()))
|
||||
fn accounts_info(&self) -> Result<BTreeMap<H160, AccountInfo>> {
|
||||
let dapp_accounts = self.accounts.accounts()
|
||||
.map_err(|e| errors::account("Could not fetch accounts.", e))?
|
||||
.into_iter().collect::<HashSet<_>>();
|
||||
|
||||
@@ -137,11 +133,8 @@ impl<C, M, U, S> Parity for ParityClient<C, M, U> where
|
||||
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();
|
||||
|
||||
Ok(self.accounts
|
||||
.dapp_default_address(dapp_id.into())
|
||||
fn default_account(&self) -> Result<H160> {
|
||||
Ok(self.accounts.default_account()
|
||||
.map(Into::into)
|
||||
.ok()
|
||||
.unwrap_or_default())
|
||||
@@ -421,11 +414,11 @@ impl<C, M, U, S> Parity for ParityClient<C, M, U> where
|
||||
ipfs::cid(content)
|
||||
}
|
||||
|
||||
fn call(&self, meta: Self::Metadata, requests: Vec<CallRequest>, num: Trailing<BlockNumber>) -> Result<Vec<Bytes>> {
|
||||
fn call(&self, requests: Vec<CallRequest>, num: Trailing<BlockNumber>) -> Result<Vec<Bytes>> {
|
||||
let requests = requests
|
||||
.into_iter()
|
||||
.map(|request| Ok((
|
||||
fake_sign::sign_call(request.into(), meta.is_dapp())?,
|
||||
fake_sign::sign_call(request.into())?,
|
||||
Default::default()
|
||||
)))
|
||||
.collect::<Result<Vec<_>>>()?;
|
||||
|
||||
@@ -25,7 +25,7 @@ use ethcore::account_provider::AccountProvider;
|
||||
use jsonrpc_core::Result;
|
||||
use v1::helpers::errors;
|
||||
use v1::traits::ParityAccounts;
|
||||
use v1::types::{H160 as RpcH160, H256 as RpcH256, H520 as RpcH520, DappId, Derive, DeriveHierarchical, DeriveHash, ExtAccountInfo};
|
||||
use v1::types::{H160 as RpcH160, H256 as RpcH256, H520 as RpcH520, Derive, DeriveHierarchical, DeriveHash, ExtAccountInfo};
|
||||
use ethkey::Password;
|
||||
|
||||
/// Account management (personal) rpc implementation.
|
||||
@@ -143,61 +143,6 @@ impl ParityAccounts for ParityAccountsClient {
|
||||
Ok(true)
|
||||
}
|
||||
|
||||
fn set_dapp_addresses(&self, dapp: DappId, addresses: Option<Vec<RpcH160>>) -> Result<bool> {
|
||||
self.accounts.set_dapp_addresses(dapp.into(), addresses.map(into_vec))
|
||||
.map_err(|e| errors::account("Couldn't set dapp addresses.", e))
|
||||
.map(|_| true)
|
||||
}
|
||||
|
||||
fn dapp_addresses(&self, dapp: DappId) -> Result<Vec<RpcH160>> {
|
||||
self.accounts.dapp_addresses(dapp.into())
|
||||
.map_err(|e| errors::account("Couldn't get dapp addresses.", e))
|
||||
.map(into_vec)
|
||||
}
|
||||
|
||||
fn set_dapp_default_address(&self, dapp: DappId, address: RpcH160) -> Result<bool> {
|
||||
self.accounts.set_dapp_default_address(dapp.into(), address.into())
|
||||
.map_err(|e| errors::account("Couldn't set dapp default address.", e))
|
||||
.map(|_| true)
|
||||
}
|
||||
|
||||
fn dapp_default_address(&self, dapp: DappId) -> Result<RpcH160> {
|
||||
self.accounts.dapp_default_address(dapp.into())
|
||||
.map_err(|e| errors::account("Couldn't get dapp default address.", e))
|
||||
.map(Into::into)
|
||||
}
|
||||
|
||||
fn set_new_dapps_addresses(&self, addresses: Option<Vec<RpcH160>>) -> Result<bool> {
|
||||
self.accounts
|
||||
.set_new_dapps_addresses(addresses.map(into_vec))
|
||||
.map_err(|e| errors::account("Couldn't set dapps addresses.", e))
|
||||
.map(|_| true)
|
||||
}
|
||||
|
||||
fn new_dapps_addresses(&self) -> Result<Option<Vec<RpcH160>>> {
|
||||
self.accounts.new_dapps_addresses()
|
||||
.map_err(|e| errors::account("Couldn't get dapps addresses.", e))
|
||||
.map(|accounts| accounts.map(into_vec))
|
||||
}
|
||||
|
||||
fn set_new_dapps_default_address(&self, address: RpcH160) -> Result<bool> {
|
||||
self.accounts.set_new_dapps_default_address(address.into())
|
||||
.map_err(|e| errors::account("Couldn't set new dapps default address.", e))
|
||||
.map(|_| true)
|
||||
}
|
||||
|
||||
fn new_dapps_default_address(&self) -> Result<RpcH160> {
|
||||
self.accounts.new_dapps_default_address()
|
||||
.map_err(|e| errors::account("Couldn't get new dapps default address.", e))
|
||||
.map(Into::into)
|
||||
}
|
||||
|
||||
fn recent_dapps(&self) -> Result<BTreeMap<DappId, u64>> {
|
||||
self.accounts.recent_dapps()
|
||||
.map_err(|e| errors::account("Couldn't get recent dapps.", e))
|
||||
.map(|map| map.into_iter().map(|(k, v)| (k.into(), v)).collect())
|
||||
}
|
||||
|
||||
fn import_geth_accounts(&self, addresses: Vec<RpcH160>) -> Result<Vec<RpcH160>> {
|
||||
self.accounts
|
||||
.import_geth_accounts(into_vec(addresses), false)
|
||||
|
||||
@@ -58,14 +58,14 @@ impl<D: Dispatcher> PersonalClient<D> {
|
||||
}
|
||||
|
||||
impl<D: Dispatcher + 'static> PersonalClient<D> {
|
||||
fn do_sign_transaction(&self, meta: Metadata, request: TransactionRequest, password: String) -> BoxFuture<(PendingTransaction, D)> {
|
||||
fn do_sign_transaction(&self, _meta: Metadata, request: TransactionRequest, password: String) -> BoxFuture<(PendingTransaction, D)> {
|
||||
let dispatcher = self.dispatcher.clone();
|
||||
let accounts = self.accounts.clone();
|
||||
|
||||
let default = match request.from.as_ref() {
|
||||
Some(account) => Ok(account.clone().into()),
|
||||
None => accounts
|
||||
.dapp_default_address(meta.dapp_id().into())
|
||||
.default_account()
|
||||
.map_err(|e| errors::account("Cannot find default account.", e)),
|
||||
};
|
||||
|
||||
|
||||
@@ -100,14 +100,14 @@ impl Private for PrivateClient {
|
||||
})
|
||||
}
|
||||
|
||||
fn private_call(&self, meta: Self::Metadata, block_number: BlockNumber, request: CallRequest) -> Result<Bytes, Error> {
|
||||
fn private_call(&self, block_number: BlockNumber, request: CallRequest) -> Result<Bytes, Error> {
|
||||
let id = match block_number {
|
||||
BlockNumber::Pending => return Err(errors::private_message_block_id_not_supported()),
|
||||
num => block_number_to_id(num)
|
||||
};
|
||||
|
||||
let request = CallRequest::into(request);
|
||||
let signed = fake_sign::sign_call(request, meta.is_dapp())?;
|
||||
let signed = fake_sign::sign_call(request)?;
|
||||
let client = self.unwrap_manager()?;
|
||||
let executed_result = client.private_call(id, &signed).map_err(|e| errors::private_message(e))?;
|
||||
Ok(executed_result.output.into())
|
||||
|
||||
@@ -112,7 +112,6 @@ impl<D: Dispatcher + 'static> SigningQueueClient<D> {
|
||||
let accounts = self.accounts.clone();
|
||||
let default_account = match default_account {
|
||||
DefaultAccount::Provided(acc) => acc,
|
||||
DefaultAccount::ForDapp(dapp) => accounts.dapp_default_address(dapp).ok().unwrap_or_default(),
|
||||
};
|
||||
|
||||
let dispatcher = self.dispatcher.clone();
|
||||
@@ -138,8 +137,8 @@ impl<D: Dispatcher + 'static> SigningQueueClient<D> {
|
||||
impl<D: Dispatcher + 'static> ParitySigning for SigningQueueClient<D> {
|
||||
type Metadata = Metadata;
|
||||
|
||||
fn compose_transaction(&self, meta: Metadata, transaction: RpcTransactionRequest) -> BoxFuture<RpcTransactionRequest> {
|
||||
let default_account = self.accounts.dapp_default_address(meta.dapp_id().into()).ok().unwrap_or_default();
|
||||
fn compose_transaction(&self, _meta: Metadata, transaction: RpcTransactionRequest) -> BoxFuture<RpcTransactionRequest> {
|
||||
let default_account = self.accounts.default_account().ok().unwrap_or_default();
|
||||
Box::new(self.dispatcher.fill_optional_fields(transaction.into(), default_account, true).map(Into::into))
|
||||
}
|
||||
|
||||
@@ -164,7 +163,7 @@ impl<D: Dispatcher + 'static> ParitySigning for SigningQueueClient<D> {
|
||||
let remote = self.remote.clone();
|
||||
let confirmations = self.confirmations.clone();
|
||||
|
||||
Box::new(self.dispatch(RpcConfirmationPayload::SendTransaction(request), meta.dapp_id().into(), meta.origin)
|
||||
Box::new(self.dispatch(RpcConfirmationPayload::SendTransaction(request), DefaultAccount::Provided(self.accounts.default_account().ok().unwrap_or_default()), meta.origin)
|
||||
.map(|result| match result {
|
||||
DispatchResult::Value(v) => RpcEither::Or(v),
|
||||
DispatchResult::Future(id, future) => {
|
||||
@@ -221,7 +220,7 @@ impl<D: Dispatcher + 'static> EthSigning for SigningQueueClient<D> {
|
||||
fn send_transaction(&self, meta: Metadata, request: RpcTransactionRequest) -> BoxFuture<RpcH256> {
|
||||
let res = self.dispatch(
|
||||
RpcConfirmationPayload::SendTransaction(request),
|
||||
meta.dapp_id().into(),
|
||||
DefaultAccount::Provided(self.accounts.default_account().ok().unwrap_or_default()),
|
||||
meta.origin,
|
||||
);
|
||||
|
||||
@@ -236,7 +235,7 @@ impl<D: Dispatcher + 'static> EthSigning for SigningQueueClient<D> {
|
||||
fn sign_transaction(&self, meta: Metadata, request: RpcTransactionRequest) -> BoxFuture<RpcRichRawTransaction> {
|
||||
let res = self.dispatch(
|
||||
RpcConfirmationPayload::SignTransaction(request),
|
||||
meta.dapp_id().into(),
|
||||
DefaultAccount::Provided(self.accounts.default_account().ok().unwrap_or_default()),
|
||||
meta.origin,
|
||||
);
|
||||
|
||||
|
||||
@@ -55,7 +55,6 @@ impl<D: Dispatcher + 'static> SigningUnsafeClient<D> {
|
||||
let accounts = self.accounts.clone();
|
||||
let default = match account {
|
||||
DefaultAccount::Provided(acc) => acc,
|
||||
DefaultAccount::ForDapp(dapp) => accounts.dapp_default_address(dapp).ok().unwrap_or_default(),
|
||||
};
|
||||
|
||||
let dis = self.dispatcher.clone();
|
||||
@@ -80,8 +79,8 @@ impl<D: Dispatcher + 'static> EthSigning for SigningUnsafeClient<D>
|
||||
}))
|
||||
}
|
||||
|
||||
fn send_transaction(&self, meta: Metadata, request: RpcTransactionRequest) -> BoxFuture<RpcH256> {
|
||||
Box::new(self.handle(RpcConfirmationPayload::SendTransaction(request), meta.dapp_id().into())
|
||||
fn send_transaction(&self, _meta: Metadata, request: RpcTransactionRequest) -> BoxFuture<RpcH256> {
|
||||
Box::new(self.handle(RpcConfirmationPayload::SendTransaction(request), DefaultAccount::Provided(self.accounts.default_account().ok().unwrap_or_default()))
|
||||
.then(|res| match res {
|
||||
Ok(RpcConfirmationResponse::SendTransaction(hash)) => Ok(hash),
|
||||
Err(e) => Err(e),
|
||||
@@ -89,8 +88,8 @@ impl<D: Dispatcher + 'static> EthSigning for SigningUnsafeClient<D>
|
||||
}))
|
||||
}
|
||||
|
||||
fn sign_transaction(&self, meta: Metadata, request: RpcTransactionRequest) -> BoxFuture<RpcRichRawTransaction> {
|
||||
Box::new(self.handle(RpcConfirmationPayload::SignTransaction(request), meta.dapp_id().into())
|
||||
fn sign_transaction(&self, _meta: Metadata, request: RpcTransactionRequest) -> BoxFuture<RpcRichRawTransaction> {
|
||||
Box::new(self.handle(RpcConfirmationPayload::SignTransaction(request), DefaultAccount::Provided(self.accounts.default_account().ok().unwrap_or_default()))
|
||||
.then(|res| match res {
|
||||
Ok(RpcConfirmationResponse::SignTransaction(tx)) => Ok(tx),
|
||||
Err(e) => Err(e),
|
||||
@@ -102,9 +101,9 @@ impl<D: Dispatcher + 'static> EthSigning for SigningUnsafeClient<D>
|
||||
impl<D: Dispatcher + 'static> ParitySigning for SigningUnsafeClient<D> {
|
||||
type Metadata = Metadata;
|
||||
|
||||
fn compose_transaction(&self, meta: Metadata, transaction: RpcTransactionRequest) -> BoxFuture<RpcTransactionRequest> {
|
||||
fn compose_transaction(&self, _meta: Metadata, transaction: RpcTransactionRequest) -> BoxFuture<RpcTransactionRequest> {
|
||||
let accounts = self.accounts.clone();
|
||||
let default_account = accounts.dapp_default_address(meta.dapp_id().into()).ok().unwrap_or_default();
|
||||
let default_account = accounts.default_account().ok().unwrap_or_default();
|
||||
Box::new(self.dispatcher.fill_optional_fields(transaction.into(), default_account, true).map(Into::into))
|
||||
}
|
||||
|
||||
|
||||
@@ -87,11 +87,11 @@ impl<C, S> Traces for TracesClient<C> where
|
||||
.map(LocalizedTrace::from))
|
||||
}
|
||||
|
||||
fn call(&self, meta: Self::Metadata, request: CallRequest, flags: TraceOptions, block: Trailing<BlockNumber>) -> Result<TraceResults> {
|
||||
fn call(&self, request: CallRequest, flags: TraceOptions, block: Trailing<BlockNumber>) -> Result<TraceResults> {
|
||||
let block = block.unwrap_or_default();
|
||||
|
||||
let request = CallRequest::into(request);
|
||||
let signed = fake_sign::sign_call(request, meta.is_dapp())?;
|
||||
let signed = fake_sign::sign_call(request)?;
|
||||
|
||||
let id = match block {
|
||||
BlockNumber::Num(num) => BlockId::Number(num),
|
||||
@@ -109,13 +109,13 @@ impl<C, S> Traces for TracesClient<C> where
|
||||
.map_err(errors::call)
|
||||
}
|
||||
|
||||
fn call_many(&self, meta: Self::Metadata, requests: Vec<(CallRequest, TraceOptions)>, block: Trailing<BlockNumber>) -> Result<Vec<TraceResults>> {
|
||||
fn call_many(&self, requests: Vec<(CallRequest, TraceOptions)>, block: Trailing<BlockNumber>) -> Result<Vec<TraceResults>> {
|
||||
let block = block.unwrap_or_default();
|
||||
|
||||
let requests = requests.into_iter()
|
||||
.map(|(request, flags)| {
|
||||
let request = CallRequest::into(request);
|
||||
let signed = fake_sign::sign_call(request, meta.is_dapp())?;
|
||||
let signed = fake_sign::sign_call(request)?;
|
||||
Ok((signed, to_call_analytics(flags)))
|
||||
})
|
||||
.collect::<Result<Vec<_>>>()?;
|
||||
|
||||
Reference in New Issue
Block a user